precision-converters-firmware
Loading...
Searching...
No Matches
app_config.h
Go to the documentation of this file.
1/*************************************************************************/
12#ifndef APP_CONFIG_H
13#define APP_CONFIG_H
14
15/******************************************************************************/
16/***************************** Include Files **********************************/
17/******************************************************************************/
18#include <stdint.h>
19#include "no_os_gpio.h"
20#include "no_os_uart.h"
21#include "no_os_pwm.h"
22#include "common_macros.h"
23
24/******************************************************************************/
25/********************** Macros and Constants Definition ***********************/
26/******************************************************************************/
27/* List of data capture modes */
28#define SPI_INTERRUPT 1
29#define SPI_DMA 2
30
31/* Macros for stringification */
32#define XSTR(s) #s
33#define STR(s) XSTR(s)
34
35/******************************************************************************/
36
37/* Name of active device */
38#define ACTIVE_DEVICE_NAME "ad5706r"
39
40/* Resolution of the DAC */
41#define AD5706_DAC_RESOLUTION 16
42
43/* Enable the UART/VirtualCOM port connection (default VCOM) */
44//#define USE_PHY_COM_PORT // Uncomment to select UART
45
46#if !defined(USE_PHY_COM_PORT)
47#define USE_VIRTUAL_COM_PORT
48#endif
49
50/* Select the active platform (default is STM32) */
51#if !defined(ACTIVE_PLATFORM)
52#define ACTIVE_PLATFORM STM32_PLATFORM
53#endif
54
55/* Select the Interface mode. Default is SPI DMA */
56#if !defined(INTERFACE_MODE)
57#define INTERFACE_MODE SPI_DMA
58#endif
59
60#if (ACTIVE_PLATFORM == STM32_PLATFORM)
61#include "app_config_stm32.h"
62#else
63#error "No/Invalid active platform selected"
64#endif //ACTIVE_PLATFORM
65
66/* Check if any serial port available for use as console stdio port */
67#if defined(USE_PHY_COM_PORT)
68/* If PHY com is selected, VCOM or alternate PHY com port can act as a console stdio port */
69#if (ACTIVE_PLATFORM == MBED_PLATFORM)
70#define CONSOLE_STDIO_PORT_AVAILABLE
71#endif
72#else
73/* If VCOM is selected, PHY com port will/should act as a console stdio port */
74//#define CONSOLE_STDIO_PORT_AVAILABLE
75#endif
76
77/* Baud rate for IIO application UART interface */
78#define IIO_UART_BAUD_RATE (230400)
79
80/****** Macros used to form a VCOM serial number ******/
81#define FIRMWARE_NAME "ad5706r_iio"
82
83#if !defined(DEVICE_NAME)
84#define DEVICE_NAME "DEV_AD5706"
85#endif
86
87#if !defined(PLATFORM_NAME)
88#define PLATFORM_NAME HW_CARRIER_NAME
89#endif
90/******/
91
92/* Below USB configurations (VID and PID) are owned and assigned by ADI.
93 * If intended to distribute software further, use the VID and PID owned by your
94 * organization */
95#define VIRTUAL_COM_PORT_VID 0x0456
96#define VIRTUAL_COM_PORT_PID 0xb66c
97/* Serial number string is formed as: application name + device (target) name + platform (host) name */
98#define VIRTUAL_COM_SERIAL_NUM (FIRMWARE_NAME "_" DEVICE_NAME "_" STR(PLATFORM_NAME))
99
100/* Enable/Disable the use of SDRAM for DAC data buffer */
101//#define USE_SDRAM // Uncomment to use SDRAM as data buffer
102
103#define FREQ_TO_NSEC(x) (((float)(1.0 / x) * 1000000) * 1000)
104
105/* Note: LDAC duty cycle is always 50% */
106#define LDAC_DUTY_CYCLE_NSEC(x) (x * 0.5)
107
108/* DAC Update Duty cycle */
109#define DAC_UPDATE_DUTY_CYCLE_NSEC(x) (x * 0.05)
110
111/******************************************************************************/
112/********************** Variables and User Defined Data Types *****************/
113/******************************************************************************/
114
115/******************************************************************************/
116/************************ Public Declarations *********************************/
117/******************************************************************************/
118
119extern struct no_os_uart_desc *uart_iio_comm_desc;
120extern struct no_os_uart_desc *uart_console_stdio_desc;
121extern struct no_os_gpio_desc *gpio_ad0_desc;
122extern struct no_os_gpio_desc *gpio_ad1_desc;
123extern struct no_os_gpio_desc *gpio_ldac_tg_desc;
124extern struct no_os_pwm_desc *ldac_pwm_desc;
125extern struct no_os_pwm_desc *dac_update_pwm_desc;
126extern struct no_os_gpio_init_param gpio_ldac_tg_params;
127extern struct no_os_eeprom_desc *eeprom_desc;
128extern struct no_os_gpio_desc *gpio_shutdown_desc;
129extern struct no_os_irq_ctrl_desc *trigger_irq_desc;
130extern struct no_os_pwm_init_param cs_init_params;
131extern struct no_os_gpio_init_param csb_gpio_init_param;
132extern struct no_os_pwm_desc* tx_trigger_desc;
133extern struct no_os_pwm_init_param tx_trigger_init_params;
134extern struct no_os_gpio_init_param ldac_pwm_gpio_params;
135int32_t init_system(void);
136int32_t init_pwm(void);
137
138#endif //APP_CONFIG_H
struct no_os_irq_ctrl_desc * trigger_irq_desc
Definition app_config.c:103
int32_t init_system(void)
Initialize the system peripherals.
Definition app_config.c:185
struct no_os_eeprom_desc * eeprom_desc
Definition app_config.c:170
struct no_os_pwm_desc * tx_trigger_desc
Definition app_config.c:143
int32_t init_pwm(void)
Initialize the PWM interface.
Definition app_config.c:259
struct no_os_pwm_desc * ldac_pwm_desc
Definition app_config.c:133
struct no_os_pwm_init_param cs_init_params
Definition app_config.c:119
struct no_os_uart_desc * uart_console_stdio_desc
Definition app_config.c:100
struct no_os_uart_desc * uart_iio_comm_desc
Definition app_config.c:197
struct no_os_gpio_desc * gpio_ad0_desc
Definition app_config.c:228
struct no_os_gpio_init_param gpio_ldac_tg_params
Definition app_config.c:93
struct no_os_gpio_desc * gpio_ad1_desc
Definition app_config.c:231
struct no_os_gpio_init_param csb_gpio_init_param
Definition app_config.c:131
struct no_os_gpio_init_param ldac_pwm_gpio_params
Definition app_config.c:109
struct no_os_pwm_desc * dac_update_pwm_desc
Definition app_config.c:243
struct no_os_gpio_desc * gpio_ldac_tg_desc
Definition app_config.c:234
struct no_os_pwm_init_param tx_trigger_init_params
Definition app_config.c:121
struct no_os_gpio_desc * gpio_shutdown_desc
Definition app_config.c:237
The file contain common macros that needs to be followed same across all the projects.
Header file for STM32 platform configurations.