Mahesh Phalke / Mbed OS EVAL-AD7689

Dependencies:   sdp_k1_sdram

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers app_config.h Source File

app_config.h

00001 /***************************************************************************//*
00002  * @file    app_config.h
00003  * @brief   Header file for application configurations (platform-agnostic)
00004 ******************************************************************************
00005  * Copyright (c) 2021-22 Analog Devices, Inc.
00006  * All rights reserved.
00007  *
00008  * This software is proprietary to Analog Devices, Inc. and its licensors.
00009  * By using this software you agree to the terms of the associated
00010  * Analog Devices Software License Agreement.
00011 ******************************************************************************/
00012 
00013 #ifndef _APP_CONFIG_H_
00014 #define _APP_CONFIG_H_
00015 
00016 /******************************************************************************/
00017 /***************************** Include Files **********************************/
00018 /******************************************************************************/
00019 
00020 #include <stdint.h>
00021 
00022 /******************************************************************************/
00023 /********************** Macros and Constants Definition ***********************/
00024 /******************************************************************************/
00025 
00026 /* List of supported platforms */
00027 #define MBED_PLATFORM       1
00028 
00029 /* List of data capture modes */
00030 #define CONTINUOUS_DATA_CAPTURE     0
00031 #define BURST_DATA_CAPTURE          1
00032 
00033 /* Macros for stringification */
00034 #define XSTR(s)     #s
00035 #define STR(s)      XSTR(s)
00036 
00037 /******************************************************************************/
00038 
00039 /**** ACTIVE_DEVICE selection *****
00040 * Define the device type here from the available list of devices (one at a time)
00041 * e.g. #define DEV_AD7689 -> This will make AD7689 as an ACTIVE_DEVICE.
00042 **/
00043 //#define   DEV_AD7689
00044 
00045 /* Name of the active device */
00046 #if defined(DEV_AD7689)
00047 #define ACTIVE_DEVICE       ID_AD7689
00048 #define ACTIVE_DEVICE_NAME  "ad7689"
00049 #elif defined(DEV_AD7682)
00050 #define ACTIVE_DEVICE       ID_AD7682
00051 #define ACTIVE_DEVICE_NAME  "ad7682"
00052 #elif defined(DEV_AD7949)
00053 #define ACTIVE_DEVICE       ID_AD7949
00054 #define ACTIVE_DEVICE_NAME  "ad7949"
00055 #elif defined(DEV_AD7699)
00056 #define ACTIVE_DEVICE       ID_AD7699
00057 #define ACTIVE_DEVICE_NAME  "ad7699"
00058 #else
00059 #warning No/Unsupported device selected. AD7689 used as default.
00060 #define ACTIVE_DEVICE       ID_AD7689
00061 #define ACTIVE_DEVICE_NAME  "ad7689"
00062 #endif
00063 
00064 /* Select the active platform (default is Mbed) */
00065 #if !defined(ACTIVE_PLATFORM)
00066 #define ACTIVE_PLATFORM     MBED_PLATFORM
00067 #endif
00068 
00069 /* Select the ADC data capture mode (default is CC mode) */
00070 #if !defined(DATA_CAPTURE_MODE)
00071 #define DATA_CAPTURE_MODE   CONTINUOUS_DATA_CAPTURE
00072 #endif
00073 
00074 #if (ACTIVE_PLATFORM == MBED_PLATFORM)
00075 #include "app_config_mbed.h"
00076 
00077 #define HW_CARRIER_NAME     STR(TARGET_NAME)
00078 
00079 /* Redefine the init params structure mapping w.r.t. platform */
00080 #define ext_int_extra_init_params mbed_ext_int_extra_init_params
00081 #define pwm_extra_init_params mbed_pwm_extra_init_params
00082 #define uart_extra_init_params mbed_uart_extra_init_params
00083 #define spi_extra_init_params mbed_spi_extra_init_params
00084 #define irq_ops mbed_irq_ops
00085 #define gpio_ops mbed_gpio_ops
00086 #define spi_ops mbed_spi_ops
00087 #define EXT_INT_ID EXTERNAL_INT_ID1
00088 #else
00089 #error "No/Invalid active platform selected"
00090 #endif
00091 
00092 /* TODO - These values must be read from EEPROM of target EVB */
00093 #define HW_MEZZANINE_NAME   "EVAL-AD7689-EBZ"
00094 #define HW_NAME             ACTIVE_DEVICE_NAME
00095 
00096 /* ADC resolution for active device */
00097 #if defined(DEV_AD7949)
00098 #define ADC_RESOLUTION      14
00099 #else
00100 #define ADC_RESOLUTION      16
00101 #endif
00102 
00103 /* ADC max count (full scale value) for unipolar inputs */
00104 #define ADC_MAX_COUNT_UNIPOLAR  (uint32_t)((1 << ADC_RESOLUTION) - 1)
00105 
00106 /* ADC max count (full scale value) for bipolar inputs */
00107 #define ADC_MAX_COUNT_BIPOLAR   (uint32_t)(1 << (ADC_RESOLUTION-1))
00108 
00109 /* Max number of ADC channels */
00110 #if defined(DEV_AD7682)
00111 #define TEMPERATURE_CHN     4
00112 #define ADC_CHN_COUNT       5   // Chn0-3 + 1 temperature channel
00113 #else
00114 #define TEMPERATURE_CHN     8
00115 #define ADC_CHN_COUNT       9   // Chn0-7 + 1 temperature channel
00116 #endif
00117 
00118 /****** Macros used to form a VCOM serial number ******/
00119 #if !defined(DEVICE_NAME)
00120 #define DEVICE_NAME     "DEV_AD7689"
00121 #endif
00122 
00123 /* Used to form a VCOM serial number */
00124 #if !defined(FIRMWARE_NAME)
00125 #define FIRMWARE_NAME   "ad7689_iio_application"
00126 #endif
00127 
00128 #if !defined(PLATFORM_NAME)
00129 #define PLATFORM_NAME   HW_CARRIER_NAME
00130 #endif
00131 /******/
00132 
00133 /* Enable the UART/VirtualCOM port connection (default VCOM) */
00134 //#define USE_PHY_COM_PORT      // Uncomment to select UART
00135 
00136 #if !defined(USE_PHY_COM_PORT)
00137 /* Below USB configurations (VID and PID) are owned and assigned by ADI.
00138  * If intended to distribute software further, use the VID and PID owned by your
00139  * organization */
00140 #define VIRTUAL_COM_PORT_VID    0x0456
00141 #define VIRTUAL_COM_PORT_PID    0xb66c
00142 /* Serial number string is formed as: application name + device (target) name + platform (host) name */
00143 #define VIRTUAL_COM_SERIAL_NUM  (FIRMWARE_NAME "_" DEVICE_NAME "_" PLATFORM_NAME)
00144 #endif
00145 
00146 /* Default baud rate for IIO UART interface */
00147 #define IIO_UART_BAUD_RATE  (230400)
00148 
00149 /* Enable/Disable the use of SDRAM for ADC data capture buffer */
00150 //#define USE_SDRAM_CAPTURE_BUFFER  // Uncomment to use SDRAM as data buffer
00151 
00152 /******************************************************************************/
00153 /********************** Public/Extern Declarations ****************************/
00154 /******************************************************************************/
00155 
00156 extern struct no_os_uart_desc *uart_desc;
00157 extern struct no_os_gpio_desc *led_gpio_desc;
00158 
00159 int32_t init_system(void);
00160 
00161 #endif /* _APP_CONFIG_H_ */