precision-converters-firmware
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 
20 #include <stdint.h>
21 #include "ltc2672.h"
22 
23 /******************************************************************************/
24 /********************** Macros and Constants Definition ***********************/
25 /******************************************************************************/
26 
27 /* List of supported platforms */
28 #define MBED_PLATFORM 1
29 #define STM32_PLATFORM 2
30 
31 /* Macros for stringification */
32 #define XSTR(s) #s
33 #define STR(s) XSTR(s)
34 
35 /******************************************************************************/
36 
37 /* Select the active platform (default is Mbed) */
38 #if !defined(ACTIVE_PLATFORM)
39 #define ACTIVE_PLATFORM MBED_PLATFORM
40 #endif
41 
42 /* Enable the UART/VirtualCOM port connection (default VCOM) */
43 //#define USE_PHY_COM_PORT // Uncomment to select UART
44 
45 #if !defined(USE_PHY_COM_PORT)
46 #define USE_VIRTUAL_COM_PORT
47 #endif
48 
49 //*** Note for user to select active device ***//
50 /* Define the device type here
51  * (use only one define at time. Defining multiple devices gives compilation error)
52  * e.g. #define DEV_LTC2672_16 will select LTC2672_16 as the active device
53  * */
54 // #define DEV_LTC2672_16
55 
56 #if defined(DEV_LTC2672_12)
57 #define ACTIVE_DEVICE_NAME "ltc2672-12"
58 #define DEVICE_NAME "DEV_LTC2672_12"
59 #define ACTIVE_DEVICE_ID LTC2672_12
60 #define DAC_RESOLUTION 12
61 #define DAC_MAX_COUNT LTC2672_12BIT_RESO
62 #elif defined(DEV_LTC2672_16)
63 #define ACTIVE_DEVICE_NAME "ltc2672-16"
64 #define DEVICE_NAME "DEV_LTC2672_16"
65 #define ACTIVE_DEVICE_ID LTC2672_16
66 #define DAC_RESOLUTION 16
67 #define DAC_MAX_COUNT LTC2672_16BIT_RESO
68 #else
69 #warning No/Unsupported ADxxxxy symbol defined. LTC2672_16 defined
70 #define DEV_LTC2672_16
71 #define ACTIVE_DEVICE_NAME "ltc2672-16"
72 #define DEVICE_NAME "DEV_LTC2672_16"
73 #define ACTIVE_DEVICE_ID LTC2672_16
74 #define DAC_RESOLUTION 16
75 #define DAC_MAX_COUNT LTC2672_16BIT_RESO
76 #endif
77 
78 /* DAC Reference Voltage */
79 #define DAC_VREF 1.25
80 
81 #if (ACTIVE_PLATFORM == MBED_PLATFORM)
82 #include "app_config_mbed.h"
83 #elif (ACTIVE_PLATFORM == STM32_PLATFORM)
84 #include "app_config_stm32.h"
85 #else
86 #error "No/Invalid active platform selected"
87 #endif
88 
89 #define HW_CARRIER_NAME TARGET_NAME
90 
91 #define HW_MEZZANINE_NAME "DC2903A-A"
92 
93 /****** Macros used to form a VCOM serial number ******/
94 
95 /* Baud rate for IIO application UART interface */
96 #define IIO_UART_BAUD_RATE (230400)
97 
98 /* Used to form a VCOM serial number */
99 #define FIRMWARE_NAME "ltc2672_iio"
100 
101 #if !defined(PLATFORM_NAME)
102 #define PLATFORM_NAME HW_CARRIER_NAME
103 #endif
104 
105 /* Below USB configurations (VID and PID) are owned and assigned by ADI.
106  * If intended to distribute software further, use the VID and PID owned by your
107  * organization */
108 #define VIRTUAL_COM_PORT_VID 0x0456
109 #define VIRTUAL_COM_PORT_PID 0xb66c
110 /* Serial number string is formed as: application name + device (target) name + platform (host) name */
111 #define VIRTUAL_COM_SERIAL_NUM (FIRMWARE_NAME "_" DEVICE_NAME "_" STR(PLATFORM_NAME))
112 
113 /* Check if any serial port available for use as console stdio port */
114 #if defined(USE_PHY_COM_PORT)
115 /* If PHY com is selected, VCOM or alternate PHY com port can act as a console stdio port */
116 #if (ACTIVE_PLATFORM == MBED_PLATFORM)
117 #define CONSOLE_STDIO_PORT_AVAILABLE
118 #endif
119 #else
120 /* If VCOM is selected, PHY com port will/should act as a console stdio port */
121 #define CONSOLE_STDIO_PORT_AVAILABLE
122 #endif
123 
124 /* Enable/Disable the use of SDRAM for DAC data streaming buffer */
125 //#define USE_SDRAM // Uncomment to use SDRAM for data buffer
126 
127 /* PWM period and duty cycle */
128 #define CONV_TRIGGER_PERIOD_NSEC (((float)(1.0 / SAMPLING_RATE) * 1000000) * 1000)
129 #define CONV_TRIGGER_DUTY_CYCLE_NSEC (CONV_TRIGGER_PERIOD_NSEC / 2)
130 
131 /******************************************************************************/
132 /************************ Public Declarations *********************************/
133 /******************************************************************************/
134 
135 extern struct no_os_uart_desc *uart_iio_com_desc;
136 extern struct no_os_uart_desc *uart_console_stdio_desc;
137 
138 int32_t init_system(void);
139 
140 #endif /* APP_CONFIG_H_ */
int32_t init_system(void)
Initialize the system peripherals.
Definition: app_config.c:185
struct no_os_uart_desc * uart_iio_com_desc
Definition: app_config.c:127
struct no_os_uart_desc * uart_console_stdio_desc
Definition: app_config.c:100
Header file for Mbed platform configurations.