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 "ad713x.h"
20#include "common_macros.h"
21
22/******************************************************************************/
23/********************** Macros and Constants Definition ***********************/
24/******************************************************************************/
25
26/* List of data capture modes for AD717x device */
27#define CONTINUOUS_DATA_CAPTURE 0
28#define BURST_DATA_CAPTURE 1
29
30/* AD7134 ASRC mode of operation for data interface */
31#define CONTROLLER_MODE 0
32#define TARGET_MODE 1
33
34/* List of supported interface modes for data capturing */
35#define TDM_MODE 0
36#define BIT_BANGING_MODE 1
37
38/* Select the ADC data capture mode (default is CC mode) */
39#if !defined(DATA_CAPTURE_MODE)
40#define DATA_CAPTURE_MODE CONTINUOUS_DATA_CAPTURE
41#endif
42
43/* Select the platform (default is STM32 platform) */
44#if !defined(ACTIVE_PLATFORM)
45#define ACTIVE_PLATFORM STM32_PLATFORM
46#endif
47
48/* Macros for stringification */
49#define XSTR(s) #s
50#define STR(s) XSTR(s)
51
52// **** Note for User: ACTIVE_DEVICE selection ****//
53/* Define the device type from the list of below device type defines (one at a time)
54 * e.g. #define DEV_AD7134 -> This will make AD7134 as an active device.
55 * The active device is default set to AD4134 if device type is not defined.
56 * */
57//#define DEV_AD4134
58
59/* Name of active device */
60#if defined (DEV_AD7134)
61#define ACTIVE_DEVICE_NAME "ad7134"
62#define HW_MEZZANINE_NAME "EVAL-AD7134ARDZ"
63#define ACTIVE_DEVICE_ID ID_AD7134
64#elif defined (DEV_AD4134)
65#define ACTIVE_DEVICE_NAME "ad4134"
66#define HW_MEZZANINE_NAME "EVAL-CN0561-ARDZ"
67#define ACTIVE_DEVICE_ID ID_AD4134
68#else
69#define INFO_MSG(x) _Pragma(#x)
70INFO_MSG(message("No / Unsupported ADxxxxy symbol defined.AD4134 defined"))
71#define DEV_AD4134
72#define ACTIVE_DEVICE_NAME "ad4134"
73#define HW_MEZZANINE_NAME "EVAL-CN0561-ARDZ"
74#define ACTIVE_DEVICE_ID ID_AD4134
75#endif
76
77/* Enable the UART/VirtualCOM port connection (default VCOM) */
78//#define USE_PHY_COM_PORT // Uncomment to select UART
79
80#if !defined(USE_PHY_COM_PORT)
81#define USE_VIRTUAL_COM_PORT
82#endif
83
84/* Note:
85 * 1. In the STM32 platform, SDPK1 supports Bit Banging Mode.
86 * 2. In the STM32 platform, Nucleo-H563 supports TDM Mode.
87 */
88#if !defined(INTERFACE_MODE)
89#define INTERFACE_MODE BIT_BANGING_MODE
90#endif
91
92/* Bytes per sample (Note: 2 bytes needed per sample) */
93#define BYTES_PER_SAMPLE sizeof(uint16_t)
94
95#if (ACTIVE_PLATFORM == STM32_PLATFORM)
96#include "app_config_stm32.h"
97
98#ifdef STM32F469xx
99#define HW_CARRIER_NAME SDP_K1
100#else
101#define HW_CARRIER_NAME NUCLEO_H563ZI
102#endif
103
104/* Redefine the init params structure mapping w.r.t. platform */
105#define vcom_extra_init_params stm32_vcom_extra_init_params
106#define uart_extra_init_params stm32_uart_extra_init_params
107#define spi_extra_init_params stm32_spi_extra_init_params
108#define tdm_extra_init_params stm32_tdm_extra_init_params
109#define ext_int_extra_init_params stm32_trigger_gpio_irq_init_params
110#define gpio_pdn_extra_init_params stm32_pdn_extra_init_params
111#define gpio_input_extra_init_params stm32_input_extra_init_params
112#define gpio_output_extra_init_params stm32_output_extra_init_params
113#define i2c_extra_init_params stm32_i2c_extra_init_params
114#define tdm_platform_ops stm32_tdm_platform_ops
115#define spi_ops stm32_spi_ops
116#define uart_ops stm32_uart_ops
117#define gpio_ops stm32_gpio_ops
118#define pwm_ops stm32_pwm_ops
119#define pwm_extra_init_params stm32_pwm_extra_init_params
120#define trigger_gpio_irq_ops stm32_gpio_irq_ops
121#ifdef STM32F469xx
122#define vcom_ops stm32_usb_uart_ops
123#endif
124#define i2c_ops stm32_i2c_ops
125#endif // ACTIVE_PLATFORM
126
127/* ADC resolution for active device
128 * Note: Data capture interface is designed to for 16-bit data format only */
129#define ADC_RESOLUTION 16
130
131/* ADC max count (full scale value) for unipolar inputs */
132#define ADC_MAX_COUNT_UNIPOLAR (uint32_t)((1 << ADC_RESOLUTION) - 1)
133
134/* ADC max count (full scale value) for bipolar inputs */
135#define ADC_MAX_COUNT_BIPOLAR (uint32_t)(1 << (ADC_RESOLUTION-1))
136
137/* Max ADC channels */
138#define AD7134_NUM_CHANNELS 4
139
140/****** Macros used to form a VCOM serial number ******/
141#define DEVICE_NAME "DEV_AD7134"
142
143#if !defined(PLATFORM_NAME)
144#if (ACTIVE_PLATFORM == STM32_PLATFORM)
145#define PLATFORM_NAME HW_CARRIER_NAME
146#endif // ACTIVE_PLATFORM
147#endif // PLATFORM_NAME
148
149/* VCOM Serial number definition */
150#define FIRMWARE_NAME "ad7134_iio"
151
152/* Below USB configurations (VID and PID) are owned and assigned by ADI.
153* If intended to distribute software further, use the VID and PID owned by your
154* organization */
155#define VIRTUAL_COM_PORT_VID 0x0456
156#define VIRTUAL_COM_PORT_PID 0xb66c
157#define VIRTUAL_COM_SERIAL_NUM (FIRMWARE_NAME "_" DEVICE_NAME "_" STR(PLATFORM_NAME))
158
159/* Baud rate for IIO application UART interface */
160#define IIO_UART_BAUD_RATE (230400)
161
162/* Set ASRC mode (one at a time, default is AD7134 as controller.)
163 * The ASRC Mode selection is applicable only for the bit banging method.
164 * For TDM, AD7134 can operate only as a controller.
165 * Note: The mode configuration must be modified in the hardware to match the one set
166 * in software. Refer project documentation for required h/w changes */
167#define AD7134_ASRC_MODE CONTROLLER_MODE
168
169/* Enable/Disable the use of SDRAM for ADC data capture buffer */
170// #define USE_SDRAM // Uncomment to use SDRAM for data buffer
171
172/* Check if any serial port available for use as console stdio port */
173#if defined(USE_PHY_COM_PORT)
174/* If PHY com is selected, VCOM or alternate PHY com port can act as a console stdio port */
175#if (ACTIVE_PLATFORM == STM32_PLATFORM && INTERFACE_MODE == BIT_BANGING_MODE)
176#define CONSOLE_STDIO_PORT_AVAILABLE
177#endif
178#else
179/* If VCOM is selected, PHY com port will/should act as a console stdio port */
180#define CONSOLE_STDIO_PORT_AVAILABLE
181#endif
182
183/******************************************************************************/
184/************************ Public Declarations *********************************/
185/******************************************************************************/
186extern struct no_os_uart_desc *uart_iio_com_desc;
187extern struct no_os_uart_desc *uart_console_stdio_desc;
188extern struct no_os_irq_ctrl_desc *external_int_desc;
189extern struct no_os_tdm_desc *ad7134_tdm_desc;
190extern struct no_os_eeprom_desc *eeprom_desc;
191extern struct no_os_gpio_init_param pdn_init_param;
192extern struct no_os_pwm_desc *pwm_desc;
193
194int32_t init_system(void);
195int32_t init_pwm(void);
196
197#endif //_APP_CONFIG_H_
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 * pwm_desc
Definition app_config.c:106
struct no_os_uart_desc * uart_iio_com_desc
Definition app_config.c:158
int32_t init_pwm(void)
Initialize the PWM interface.
Definition app_config.c:259
struct no_os_uart_desc * uart_console_stdio_desc
Definition app_config.c:100
struct no_os_gpio_init_param pdn_init_param
Definition app_config.c:187
#define INFO_MSG(x)
Definition app_config.h:69
struct no_os_tdm_desc * ad7134_tdm_desc
Definition app_config.c:183
struct no_os_irq_ctrl_desc * external_int_desc
Definition app_config.c:218
The file contain common macros that needs to be followed same across all the projects.
Header file for STM32 platform configurations.