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 <common_macros.h>
20
21/******************************************************************************/
22/********************** Macros and Constants Definition ***********************/
23/******************************************************************************/
24
25/* List of supported data capture modes */
26#define BUSRT_DATA_CAPTURE 0
27#define CONTINUOUS_DATA_CAPTURE 1
28
29/* List of oscillator frequencies available */
30#define OSC_40M 0
31#define OSC_20M 1
32#define OSC_10M 2
33
34/* Macros for stringification */
35#define XSTR(s) #s
36#define STR(s) XSTR(s)
37
38/* Name of active device */
39#define ACTIVE_DEVICE_NAME "ad4080"
40
41#define FIRMWARE_NAME "ad4080_iio"
42
43#define DEVICE_NAME "DEV_AD4080"
44
45#define HW_MEZZANINE_NAME "EVAL-AD4080ARDZ"
46
47/* Number of channels */
48#define NUMBER_OF_CHANNELS 1
49
50/****************************** Configurations ********************************/
51/* Select the active platform (default is STM32) */
52#if !defined(ACTIVE_PLATFORM)
53#define ACTIVE_PLATFORM STM32_PLATFORM
54#endif
55
56/* Select active oscillator */
57#if !defined(ACTIVE_OSC)
58#define ACTIVE_OSC OSC_40M
59#endif
60
61/* Quad SPI support */
62// Uncomment the following to use QSPI
63//#define USE_QUAD_SPI
64
65/* Determine state based on active osc selected */
66#if (ACTIVE_OSC == OSC_40M)
67#define OSC_40M_DEFAULT_STATE NO_OS_GPIO_HIGH
68#define OSC_20M_DEFAULT_STATE NO_OS_GPIO_LOW
69#define OSC_10M_DEFAULT_STATE NO_OS_GPIO_LOW
70#elif (ACTIVE_OSC == OSC_20M)
71#define OSC_40M_DEFAULT_STATE NO_OS_GPIO_LOW
72#define OSC_20M_DEFAULT_STATE NO_OS_GPIO_HIGH
73#define OSC_10M_DEFAULT_STATE NO_OS_GPIO_LOW
74#else
75#define OSC_10M_DEFAULT_STATE NO_OS_GPIO_HIGH
76#define OSC_40M_DEFAULT_STATE NO_OS_GPIO_LOW
77#define OSC_20M_DEFAULT_STATE NO_OS_GPIO_LOW
78#endif
79
80/* Redefine the init params structure mapping w.r.t. platform */
81#if (ACTIVE_PLATFORM == STM32_PLATFORM)
82#include "app_config_stm32.h"
83#define config_spi_extra_init_params stm32_config_spi_extra_init_params
84#define data_spi_extra_init_params stm32_data_spi_extra_init_params
85#define data_qspi_extra_init_params stm32_data_qspi_extra_init_params
86#define uart_extra_init_params stm32_uart_extra_init_params
87#define vcom_extra_init_params stm32_vcom_extra_init_params
88#define gpio_xtal_osc_en_extra_init_params stm32_gpio_xtal_osc_en_init_params
89#define gpio_gp1_extra_init_params stm32_gpio_gp1_init_params
90#define gpio_gp2_extra_init_params stm32_gpio_gp2_init_params
91#define gpio_gp3_extra_init_params stm32_gpio_gp3_init_params
92#define gpio_40m_osc_extra_init_params stm32_gpio_40m_osc_init_params
93#define gpio_20m_osc_extra_init_params stm32_gpio_20m_osc_init_params
94#define gpio_10m_osc_extra_init_params stm32_gpio_10m_osc_init_params
95#define gpio_afe_ctrl_extra_init_params stm32_gpio_afe_ctrl_init_params
96#define i2c_extra_init_params stm32_i2c_extra_init_params
97#define gpio_ops stm32_gpio_ops
98#define spi_ops stm32_spi_ops
99#define xspi_ops stm32_xspi_ops
100#define uart_ops stm32_uart_ops
101#define vcom_ops stm32_usb_uart_ops
102#define i2c_ops stm32_i2c_ops
103#else
104#error "No / Invalid active platform selected"
105#endif /* ACTIVE_PLATFORM */
106
107/* Select the ADC data capture mode (Only Burst Capture mode is supported) */
108#if !defined(DATA_CAPTURE_MODE)
109#define DATA_CAPTURE_MODE BURST_DATA_CAPTURE
110#endif
111
112/* Enable the UART/VirtualCOM port connection (default VCOM) */
113/* (Uncomment to select UART) */
114//#define USE_PHY_COM_PORT
115
116#if !defined(USE_PHY_COM_PORT)
117#define USE_VIRTUAL_COM_PORT
118#endif
119
120/* Check if any serial port available for use as console stdio port */
121#if defined(USE_VIRTUAL_COM_PORT)
122/* If PHY com is selected, VCOM or alternate PHY com port can act as a console stdio port */
123/* If VCOM is selected, PHY com port will/should act as a console stdio port */
124#define CONSOLE_STDIO_PORT_AVAILABLE
125#endif
126
127/* EVAL-AD4080-ARDZ CNV Clock Frequency */
128#define AD4080_CNV_CLK_FREQ_HZ (40000000/(NO_OS_BIT(ACTIVE_OSC)))
129
130/* ADC resolution for active device (in bits) */
131#define AD4080_ADC_RESOLUTION_BITS 20
132
133/* ADC resolution for active device with sign extension (in bits) */
134#define AD4080_SIGN_EXTENDED_RESOLUTION_BITS \
135 (AD4080_ADC_RESOLUTION_BITS + 4)
136
137/* ADC resolution for active device with sign extension (in bytes) */
138#define AD4080_SIGN_EXTENDED_RESOLUTION_BYTES \
139 (AD4080_SIGN_EXTENDED_RESOLUTION_BITS / 8)
140
141/* Number of ADC Sign Extension Bits */
142#define AD4080_SIGN_EXT_BITS 4
143
144/* ADC max count (full scale value) for bipolar input */
145#define ADC_MAX_COUNT (uint32_t)(1 << (AD4080_ADC_RESOLUTION_BITS - 1))
146
147/* Baud rate for IIO application UART interface */
148#define IIO_UART_BAUD_RATE (230400)
149
150/* Enable/Disable the use of SDRAM for ADC data capture buffer */
151/* (Use following macros to use SDRAM for data buffer) */
152//#define USE_SDRAM
153
154/******************************************************************************/
155/********************** Variables and User Defined Data Types *****************/
156/******************************************************************************/
157extern struct no_os_gpio_desc *gpio_afe_ctrl_desc;
158extern struct no_os_gpio_desc *gpio_gp1_desc;
159extern struct no_os_gpio_desc *gpio_gp2_desc;
160extern struct no_os_gpio_desc *gpio_gp3_desc;
161extern struct no_os_gpio_desc *gpio_xtal_osc_en_desc;
162extern struct no_os_gpio_desc *gpio_osc_en_40m_desc;
163extern struct no_os_gpio_desc *gpio_osc_en_20m_desc;
164extern struct no_os_gpio_desc *gpio_osc_en_10m_desc;
165extern struct no_os_spi_init_param config_spi_init_params;
166extern struct no_os_spi_init_param data_spi_init_params;
167#ifdef USE_QUAD_SPI
168extern struct no_os_spi_desc *quad_spi_desc;
169extern struct no_os_spi_init_param qspi_init_params;
170#endif
171extern struct no_os_uart_desc *uart_iio_comm_desc;
172extern struct no_os_uart_desc *uart_console_stdio_desc;
173extern struct no_os_eeprom_desc *eeprom_desc;
174
175/******************************************************************************/
176/************************ Public Declarations *********************************/
177/******************************************************************************/
178int32_t init_system(void);
179
180#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:172
struct no_os_uart_desc * uart_console_stdio_desc
Definition app_config.c:100
struct no_os_gpio_desc * gpio_osc_en_40m_desc
Definition app_config.c:221
struct no_os_uart_desc * uart_iio_comm_desc
Definition app_config.c:198
struct no_os_gpio_desc * gpio_gp1_desc
Definition app_config.c:209
struct no_os_gpio_desc * gpio_osc_en_20m_desc
Definition app_config.c:224
struct no_os_gpio_desc * gpio_osc_en_10m_desc
Definition app_config.c:227
struct no_os_spi_init_param data_spi_init_params
Definition app_config.c:45
struct no_os_spi_init_param config_spi_init_params
Definition app_config.c:34
struct no_os_gpio_desc * gpio_gp3_desc
Definition app_config.c:215
struct no_os_gpio_desc * gpio_afe_ctrl_desc
Definition app_config.c:206
struct no_os_gpio_desc * gpio_xtal_osc_en_desc
Definition app_config.c:218
struct no_os_gpio_desc * gpio_gp2_desc
Definition app_config.c:212
The file contain common macros that needs to be followed same across all the projects.
Header file for STM32 platform configurations.