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 == STM32_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/* Enable/Disable the use of SDRAM for DAC data buffer */
93//#define USE_SDRAM // Uncomment to use SDRAM as data buffer
94
95#define FREQ_TO_NSEC(x) (((float)(1.0 / x) * 1000000) * 1000)
96
97/* Note: LDAC duty cycle is always 50% */
98#define LDAC_DUTY_CYCLE_NSEC(x) (x * 0.5)
99
100/* DAC Update Duty cycle */
101#define DAC_UPDATE_DUTY_CYCLE_NSEC(x) (x * 0.05)
102
103/******************************************************************************/
104/********************** Variables and User Defined Data Types *****************/
105/******************************************************************************/
106
107/******************************************************************************/
108/************************ Public Declarations *********************************/
109/******************************************************************************/
110
111extern struct no_os_uart_desc *uart_iio_comm_desc;
112extern struct no_os_uart_desc *uart_console_stdio_desc;
113extern struct no_os_gpio_desc *gpio_ad0_desc;
114extern struct no_os_gpio_desc *gpio_ad1_desc;
115extern struct no_os_gpio_desc *gpio_ldac_tg_desc;
116extern struct no_os_pwm_desc *ldac_pwm_desc;
117extern struct no_os_pwm_desc *dac_update_pwm_desc;
118extern struct no_os_gpio_init_param gpio_ldac_tg_params;
119extern struct no_os_eeprom_desc *eeprom_desc;
120extern struct no_os_gpio_desc *gpio_shutdown_desc;
121extern struct no_os_irq_ctrl_desc *trigger_irq_desc;
122extern struct no_os_pwm_init_param cs_init_params;
123extern struct no_os_gpio_init_param csb_gpio_init_param;
124extern struct no_os_pwm_desc* tx_trigger_desc;
125extern struct no_os_pwm_init_param tx_trigger_init_params;
126extern struct no_os_gpio_init_param ldac_pwm_gpio_params;
127int32_t init_system(void);
128int32_t init_pwm(void);
129
130#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.