precision-converters-firmware
app_config.h
Go to the documentation of this file.
1 /***************************************************************************//*
2  * @file app_config.h
3  * @brief Configuration file for AD77681 IIO firmware application
4  * @details
5 ******************************************************************************
6  * Copyright (c) 2021-23 Analog Devices, Inc.
7  * All rights reserved.
8  *
9  * This software is proprietary to Analog Devices, Inc. and its licensors.
10  * By using this software you agree to the terms of the associated
11  * Analog Devices Software License Agreement.
12 ******************************************************************************/
13 
14 #ifndef _APP_CONFIG_H_
15 #define _APP_CONFIG_H_
16 
17 /******************************************************************************/
18 /***************************** Include Files **********************************/
19 /******************************************************************************/
20 
21 #include <stdint.h>
22 
23 /******************************************************************************/
24 /********************** Macros and Constants Definition ***********************/
25 /******************************************************************************/
26 
27 /* List of supported platforms*/
28 #define MBED_PLATFORM 1
29 
30 /* List of supported data capture modes for an application */
31 #define BURST_DATA_CAPTURE 0
32 #define CONTINUOUS_DATA_CAPTURE 1
33 
34 /* Macros for stringification */
35 #define XSTR(s) #s
36 #define STR(s) XSTR(s)
37 
38 /* Select the active platform (default is Mbed) */
39 #if !defined(ACTIVE_PLATFORM)
40 #define ACTIVE_PLATFORM MBED_PLATFORM
41 #endif
42 
43 /* Select the ADC data capture mode (default is CC mode) */
44 #if !defined(DATA_CAPTURE_MODE)
45 #define DATA_CAPTURE_MODE CONTINUOUS_DATA_CAPTURE
46 #endif
47 
48 /* Enable the UART/VirtualCOM port connection (default VCOM) */
49 //#define USE_PHY_COM_PORT // Uncomment to select UART
50 
51 #if !defined(USE_PHY_COM_PORT)
52 #define USE_VIRTUAL_COM_PORT
53 #endif
54 
55 /* Name of active device */
56 #define ACTIVE_DEVICE_NAME "ad7768-1"
57 
58 #if (ACTIVE_PLATFORM == MBED_PLATFORM)
59 #include "app_config_mbed.h"
60 
61 #define HW_CARRIER_NAME TARGET_NAME
62 
63 /* Redefine the init params structure mapping w.r.t. platform */
64 #define ext_int_extra_init_params mbed_ext_int_extra_init_params
65 #if defined(USE_VIRTUAL_COM_PORT)
66 #define uart_extra_init_params mbed_vcom_extra_init_params
67 #define uart_ops mbed_virtual_com_ops
68 #else
69 #define uart_extra_init_params mbed_uart_extra_init_params
70 #define uart_ops mbed_uart_ops
71 #endif
72 #define spi_extra_init_params mbed_spi_extra_init_params
73 #define i2c_extra_init_params mbed_i2c_extra_init_params
74 #define trigger_gpio_irq_extra_params mbed_trigger_gpio_irq_init_params
75 #define trigger_gpio_extra_init_params mbed_trigger_gpio_extra_init_params
76 #define trigger_gpio_ops mbed_gpio_ops
77 #define irq_ops mbed_gpio_irq_ops
78 #define gpio_ops mbed_gpio_ops
79 #define spi_ops mbed_spi_ops
80 #define i2c_ops mbed_i2c_ops
81 #define trigger_gpio_irq_ops mbed_gpio_irq_ops
82 #define trigger_gpio_handle 0 // Unused macro
83 #define TRIGGER_GPIO_PORT 0 // Unused macro
84 #define TRIGGER_GPIO_PIN CONV_MON
85 #define TRIGGER_INT_ID GPIO_IRQ_ID1
86 #else
87 #error "No/Invalid active platform selected"
88 #endif
89 
90 /* ADC resolution for active device */
91 #define ADC_RESOLUTION 24
92 
93 /****** Macros used to form a VCOM serial number ******/
94 #define FIRMWARE_NAME "ad77681_iio"
95 
96 #define DEVICE_NAME "DEV_AD77681"
97 
98 #if !defined(PLATFORM_NAME)
99 #define PLATFORM_NAME HW_CARRIER_NAME
100 #endif
101 
102 /* Below USB configurations (VID and PID) are owned and assigned by ADI.
103  * If intended to distribute software further, use the VID and PID owned by your
104  * organization */
105 #define VIRTUAL_COM_PORT_VID 0x0456
106 #define VIRTUAL_COM_PORT_PID 0xb66c
107 /* Serial number string is formed as: application name + device (target) name + platform (host) name */
108 #define VIRTUAL_COM_SERIAL_NUM (FIRMWARE_NAME "_" DEVICE_NAME "_" STR(PLATFORM_NAME))
109 
110 /* Baud rate for IIO application UART interface */
111 #define IIO_UART_BAUD_RATE (230400)
112 
113 /* Enable/Disable the use of SDRAM for ADC data capture buffer */
114 //#define USE_SDRAM // Uncomment to use SDRAM for data buffer
115 
116 /******************************************************************************/
117 /************************ Public Declarations *********************************/
118 /******************************************************************************/
119 
120 int32_t init_system(void);
121 
122 extern struct no_os_uart_desc *uart_desc;
123 extern struct no_os_gpio_desc *trigger_gpio_desc;
124 extern struct no_os_spi_init_param spi_init_params;
125 extern struct no_os_irq_ctrl_desc *trigger_irq_desc;
126 
127 #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_uart_desc * uart_desc
Definition: app_config.c:97
struct no_os_gpio_desc * trigger_gpio_desc
Definition: app_config.c:192
struct no_os_spi_init_param spi_init_params
Definition: app_config.c:56
Header file for Mbed platform configurations.