precision-converters-firmware
Loading...
Searching...
No Matches
app_config.h
Go to the documentation of this file.
1/*************************************************************************/
13#ifndef APP_CONFIG_H
14#define APP_CONFIG_H
15
16/******************************************************************************/
17/***************************** Include Files **********************************/
18/******************************************************************************/
19#include <stdint.h>
20#include <common_macros.h>
21
22/******************************************************************************/
23/********************** Macros and Constants Definition ***********************/
24/******************************************************************************/
25
26/* List of data capture modes for AD719X device */
27#define CONTINUOUS_DATA_CAPTURE 0
28#define BURST_DATA_CAPTURE 1
29
30/* List of selectable modes for AD719X device */
31#define NORMAL_MODE 0
32#define NOISE_TEST 1
33#define FAST_50HZ_TEST 2
34
35/* List of polarity modes */
36#define BIPOLAR_MODE 0
37#define UNIPOLAR_MODE 1
38
39/* List of Input Configuration */
40#define DIFFERENTIAL_INPUT 0
41#define PSEUDO_DIFFERENTIAL_INPUT 1
42
43/* Select the active platform (default is STM32) */
44#if !defined(ACTIVE_PLATFORM)
45#define ACTIVE_PLATFORM STM32_PLATFORM
46#endif
47
48/* Select the ADC data capture mode (default is CC mode) */
49#if !defined(DATA_CAPTURE_MODE)
50#define DATA_CAPTURE_MODE CONTINUOUS_DATA_CAPTURE
51#endif
52
53/* Enable the UART/VirtualCOM port connection (default VCOM) */
54//#define USE_PHY_COM_PORT // Uncomment to select UART
55
56#if !defined(USE_PHY_COM_PORT)
57#define USE_VIRTUAL_COM_PORT
58#endif
59
60/* Macros for stringification */
61#define XSTR(s) #s
62#define STR(s) XSTR(s)
63
64#if (ACTIVE_PLATFORM == STM32_PLATFORM)
65#include "app_config_stm32.h"
66/* Redefine the init params structure mapping wrt platform */
67#define gpio_ops stm32_gpio_ops
68#define spi_ops stm32_spi_ops
69#define i2c_ops stm32_i2c_ops
70#define uart_ops stm32_uart_ops
71#define irq_platform_ops stm32_gpio_irq_ops
72#define trigger_gpio_irq_ops stm32_gpio_irq_ops
73#define TRIGGER_INT_ID RDY_PIN
74#define trigger_gpio_handle 0
75#define spi_extra_init_params stm32_spi_extra_init_params
76#define uart_extra_init_params stm32_uart_extra_init_params
77#define i2c_extra_init_params stm32_i2c_extra_init_params
78#define trigger_gpio_irq_extra_params stm32_trigger_gpio_irq_init_params
79#define gpio_sync_init_params stm32_gpio_sync_extra_init_params
80#else
81#error "No/Invalid active platform selected"
82#endif
83
84// **** Note for User on selection of Active Device ****//
85/* Define the device type here from the list of below device type defines
86 * (one at a time. Defining more than one device can result into compile error).
87 * e.g. #define DEV_AD7193 -> This will make AD7193 as an active device.
88 * The active device is default set to AD7193 if device type is not defined.
89 * */
90//#define DEV_AD7193
91
92#if defined(DEV_AD7190)
93#define ACTIVE_DEVICE_NAME "ad7190"
94#define DEVICE_NAME "DEV_AD7190"
95#define HW_MEZZANINE_NAME "EVAL-AD7190-ASDZ"
96#elif defined(DEV_AD7192)
97#define ACTIVE_DEVICE_NAME "ad7192"
98#define DEVICE_NAME "DEV_AD7192"
99#define HW_MEZZANINE_NAME "EVAL-AD7192-ASDZ"
100#elif defined(DEV_AD7193)
101#define ACTIVE_DEVICE_NAME "ad7193"
102#define DEVICE_NAME "DEV_AD7193"
103#define HW_MEZZANINE_NAME "EVAL-AD7193-ASDZ"
104#elif defined(DEV_AD7194)
105#define ACTIVE_DEVICE_NAME "ad7194"
106#define DEVICE_NAME "DEV_AD7194"
107#define HW_MEZZANINE_NAME "EVAL-AD7194ASDZ"
108#elif defined(DEV_AD7195)
109#define ACTIVE_DEVICE_NAME "ad7195"
110#define DEVICE_NAME "DEV_AD7195"
111#define HW_MEZZANINE_NAME "EVAL-AD7195-ASDZ"
112#else
113#warning No/Unsupported ADxxxxy symbol defined. AD7193 defined
114#define DEV_AD7193
115#define ACTIVE_DEVICE_NAME "ad7193"
116#define DEVICE_NAME "DEV_AD7193"
117#define HW_MEZZANINE_NAME "EVAL-AD7193-ASDZ"
118#endif // Device Select (Active Device name definition)
119
120#if defined(DEV_AD7190) || defined(DEV_AD7192) || defined(DEV_AD7195)
121#define NO_OF_CHANNELS 4
122#elif defined(DEV_AD7194)
123#define NO_OF_CHANNELS 16
124#else
125#define NO_OF_CHANNELS 8
126#endif
127#define ADC_RESOLUTION 24
128
129/* Active Mode */
130#if !defined(ACTIVE_MODE)
131#define ACTIVE_MODE NORMAL_MODE
132#endif
133
134/* **** Note for User: Unipolar/Bipolar Configuration ****
135 * The analog input to the AD7190/2/3/5 can accept either unipolar or
136 * bipolar input voltage ranges. A bipolar input range does not
137 * imply that the part can tolerate negative voltages with respect
138 * to system AGND. If the ADC is configured for unipolar operation,
139 * the output code is natural (straight) binary. When the ADC
140 * is configured for bipolar operation, the output code is offset binary.
141 *
142 * The default is unipolar mode when in normal mode.
143 * Edit the POLARITY_CONFIG macro to change to polarity settings.
144 * e.g. #if (ACTIVE_MODE == NORMAL_MODE)
145 * #define POLARITY_CONFIG BIPOLAR_MODE
146 * This will configure all the channels as bipolar mode.
147 * */
148#if (ACTIVE_MODE == NORMAL_MODE)
149#define POLARITY_CONFIG UNIPOLAR_MODE
150#else
151#define POLARITY_CONFIG BIPOLAR_MODE
152#endif
153
154/* **** Note for User: Pseudo Differential Input Configuration ****
155 * The analog inputs of AD7193 can be configured as differential
156 * inputs or pseudo differential analog inputs.
157 *
158 * In pseudo differential mode, AD7190/2/5 has four pseudo differential
159 * analog inputs. In case of fully differential input, the AD7190/2/5 is
160 * configured to have two differential analog inputs.
161 *
162 * In case of pseudo differential input, the AD7193 is configured to have eight
163 * pseudo differential analog inputs. In case of differential input,
164 * the AD7193 is configured to have four differential analog inputs.
165 *
166 * The default is pseudo differential input when in normal mode.
167 * Edit the INPUT_CONFIG macro to change to configuration.
168 * e.g. #if (ACTIVE_MODE == NORMAL_MODE)
169 * #define INPUT_CONFIG DIFFERENTIAL_INPUT
170 * This will enable the differential mode for all the channels.
171 * */
172#if (ACTIVE_MODE == NORMAL_MODE)
173#define INPUT_CONFIG PSEUDO_DIFFERENTIAL_INPUT
174#else
175#define INPUT_CONFIG DIFFERENTIAL_INPUT
176#endif
177
178/* ADC max count (full scale value) for unipolar inputs */
179#define ADC_MAX_COUNT_UNIPOLAR (uint32_t)((1 << ADC_RESOLUTION) - 1)
180
181/* ADC max count (full scale value) for bipolar inputs */
182#define ADC_MAX_COUNT_BIPOLAR (uint32_t)(1 << (ADC_RESOLUTION-1))
183
184/* Baud rate for IIO application UART interface */
185#define IIO_UART_BAUD_RATE (230400)
186
187/* Used to form a VCOM serial number */
188#define FIRMWARE_NAME "ad719x_iio"
189
190/****** Macros used to form a VCOM serial number ******/
191#if !defined(PLATFORM_NAME)
192#define PLATFORM_NAME HW_CARRIER_NAME
193#endif
194
195/* Below USB configurations (VID and PID) are owned and assigned by ADI.
196 * If intended to distribute software further, use the VID and PID owned by your
197 * organization */
198#define VIRTUAL_COM_PORT_VID 0x0456
199#define VIRTUAL_COM_PORT_PID 0xb66c
200/* Serial number string is formed as: application name + device (target) name + platform (host) name */
201#define VIRTUAL_COM_SERIAL_NUM (FIRMWARE_NAME "_" DEVICE_NAME "_" STR(PLATFORM_NAME))
202
203/* Enable/Disable the use of SDRAM for ADC data capture buffer */
204//#define USE_SDRAM // Uncomment to use SDRAM as data buffer
205
206/******************************************************************************/
207/********************** Variables and User Defined Data Types *****************/
208/******************************************************************************/
209
210/******************************************************************************/
211/************************ Public Declarations *********************************/
212/******************************************************************************/
213extern struct no_os_uart_desc *uart_desc;
214extern struct no_os_irq_ctrl_desc *trigger_irq_desc;
215extern struct no_os_eeprom_desc *eeprom_desc;
216
217int32_t init_system(void);
218/* callback function in burst mode */
219extern void burst_capture_callback(void *context);
220
221#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_uart_desc * uart_desc
Definition app_config.c:97
struct no_os_eeprom_desc * eeprom_desc
Definition app_config.c:170
void burst_capture_callback(void *context)
Interrupt Service Routine to monitor end of conversion event.
Definition ad469x_iio.c:1037
The file contain common macros that needs to be followed same across all the projects.
Header file for STM32 platform configurations.