precision-converters-firmware
Loading...
Searching...
No Matches
app_config.h
Go to the documentation of this file.
1/*************************************************************************/
14#ifndef APP_CONFIG_H
15#define APP_CONFIG_H
16
17/******************************************************************************/
18/***************************** Include Files **********************************/
19/******************************************************************************/
20#include <stdint.h>
21#include "common.h"
22#include "no_os_gpio.h"
23#include "no_os_uart.h"
24#include "no_os_irq.h"
25#include "no_os_pwm.h"
26#include "common_macros.h"
27
28/******************************************************************************/
29/********************** Macros and Constants Definition ***********************/
30/******************************************************************************/
31/* List of data transmit methods supported by hardware platform */
32#define SPI_DMA 0
33#define SPI_INTERRUPT 1
34
35/* List of supported DAC data stream modes */
36#define CYCLIC_STREAM 0
37#define ARBITRARY_STREAM 1
38
39/* Macros for stringification */
40#define XSTR(s) #s
41#define STR(s) XSTR(s)
42
43/******************************************************************************/
44
45/* Name of active device */
46#define ACTIVE_DEVICE_NAME "ad5710r"
47
48/* Select the active platform */
49#if !defined(ACTIVE_PLATFORM)
50#define ACTIVE_PLATFORM STM32_PLATFORM
51#endif
52
53/* Select the DAC data stream mode (default is Cyclic stream mode) */
54#if !defined(DATA_STREAM_MODE)
55#define DATA_STREAM_MODE CYCLIC_STREAM
56#endif
57
58/* Enable the UART/VirtualCOM port connection (default VCOM) */
59//#define USE_PHY_COM_PORT // Uncomment to select UART
60
61#if !defined(USE_PHY_COM_PORT)
62#define USE_VIRTUAL_COM_PORT
63#endif
64
65/* Interface mode either spi interrupt or spi dma (default spi dma) */
66//#define INTERFACE_MODE SPI_INTERRUPT // Uncomment to select spi interrupt
67
68#if !defined(INTERFACE_MODE)
69#define INTERFACE_MODE SPI_DMA
70#endif
71
72#if (ACTIVE_PLATFORM == STM32_PLATFORM)
73#include "app_config_stm32.h"
74#else
75#error "No/Invalid active platform selected"
76#endif
77
78/* HW ID of the target EVB */
79#define HW_MEZZANINE_NAME "EVAL-AD5710R-ARDZ"
80
81/* DAC resolution for active device */
82#define DAC_RESOLUTION 16
83
84/* Number of DAC channels */
85#define DAC_CHANNELS 8
86
87/* DAC reference voltage (Range: 2.5 to 3.3v) */
88#define DAC_REF_VOLTAGE 2.5
89
90/* DAC max count (full scale value) */
91#define DAC_MAX_COUNT (uint32_t)((1 << DAC_RESOLUTION) - 1)
92
93/****** Macros used to form a VCOM serial number ******/
94#define FIRMWARE_NAME "ad5710r_iio"
95
96#define DEVICE_NAME "DEV_AD5710R"
97
98#if !defined(PLATFORM_NAME)
99#define PLATFORM_NAME HW_CARRIER_NAME
100#endif
101/******/
102
103/* Below USB configurations (VID and PID) are owned and assigned by ADI.
104 * If intended to distribute software further, use the VID and PID owned by your
105 * organization */
106#define VIRTUAL_COM_PORT_VID 0x0456
107#define VIRTUAL_COM_PORT_PID 0xb66c
108
109/* Serial number string is formed as: application name + device (target) name + platform (host) name */
110#define VIRTUAL_COM_SERIAL_NUM (FIRMWARE_NAME "_" DEVICE_NAME "_" STR(PLATFORM_NAME))
111
112/* Baud rate for IIO application UART interface */
113#define IIO_UART_BAUD_RATE (230400)
114
115/* Check if any serial port available for use as console stdio port */
116#if defined(USE_PHY_COM_PORT)
117/* If PHY com is selected, VCOM or alternate PHY com port can act as a console stdio port */
118#if (ACTIVE_PLATFORM == STM32_PLATFORM)
119#define CONSOLE_STDIO_PORT_AVAILABLE
120#endif
121#else
122/* If VCOM is selected, PHY com port will/should act as a console stdio port */
123#define CONSOLE_STDIO_PORT_AVAILABLE
124#endif
125
126/* Enable/Disable the use of SDRAM for DAC data streaming buffer */
127//#define USE_SDRAM // Uncomment to use SDRAM for data buffer
128
129/* PWM period and duty cycle */
130#define CONV_TRIGGER_PERIOD_NSEC(x) (((float)(1.0 / x) * 1000000) * 1000)
131#define CONV_TRIGGER_DUTY_CYCLE_NSEC(x,y) (((float)y / 100) * CONV_TRIGGER_PERIOD_NSEC(x))
132
133/******************************************************************************/
134/********************** Variables and User Defined Data Types *****************/
135/******************************************************************************/
136
137/******************************************************************************/
138/************************ Public Declarations *********************************/
139/******************************************************************************/
140extern struct no_os_pwm_desc *pwm_desc;
141extern struct no_os_uart_desc *uart_iio_com_desc;
142extern struct no_os_gpio_desc *trigger_gpio_desc;
143extern struct no_os_irq_ctrl_desc *trigger_irq_desc;
144extern struct no_os_spi_init_param spi_init_params;
145extern struct no_os_eeprom_desc *eeprom_desc;
146extern struct no_os_pwm_init_param pwm_init_params;
147extern struct no_os_gpio_desc* csb_gpio_desc;
148extern struct no_os_pwm_init_param pwm_init_params;
149extern struct no_os_eeprom_init_param eeprom_init_params;
150
151#if (INTERFACE_MODE == SPI_DMA)
152extern struct no_os_pwm_desc* tx_trigger_desc;
153extern struct no_os_dma_init_param ad5710r_dma_init_param;
154extern struct no_os_gpio_init_param pwm_gpio_params;
155#endif
156
157int32_t init_pwm(void);
158int32_t deinit_pwm(void);
159int32_t init_system(void);
160
161#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_pwm_init_param pwm_init_params
Definition app_config.h:149
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
struct no_os_pwm_desc * pwm_desc
Definition app_config.c:106
struct no_os_spi_init_param spi_init_params
Definition ad3530r_user_config.c:48
struct no_os_gpio_desc * trigger_gpio_desc
Definition app_config.c:164
struct no_os_gpio_desc * csb_gpio_desc
Definition app_config.c:173
struct no_os_uart_desc * uart_iio_com_desc
Definition app_config.c:158
struct no_os_gpio_init_param pwm_gpio_params
Definition app_config.c:87
int32_t init_pwm(void)
Initialize the PWM interface.
Definition app_config.c:259
int32_t deinit_pwm(void)
DeInitialize the PWM interface.
Definition app_config.c:420
struct no_os_eeprom_init_param eeprom_init_params
Definition app_config.c:228
struct no_os_dma_init_param ad5710r_dma_init_param
Definition app_config.c:150
The file contain common macros that needs to be followed same across all the projects.
Header file for STM32 platform configurations.