no-OS
app.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef APP_H_
35 #define APP_H_
36 #include <stdint.h>
37 #include <stdbool.h>
38 #include "ad5940.h"
39 
40 struct eit_config {
41  uint16_t nElectrodeCnt;
42  uint16_t nForceDist;
43  uint16_t nSenseDist;
44  uint16_t nRefEl;
45 };
46 
48  uint16_t nFrequency; // Frequency of Excitation in Khz
49  uint16_t nAmplitudePP; // Amplitude of DAC output in mV
50  bool bMagnitudeMode; // If true, will return magnitude
51  // otherwise, will return
52  // comma-separated complex numbers
53  bool bImpedanceReadMode; // If true, it will measure Impedance
54  // otherwise, it will measure Voltage.
55  bool bSweepEn; // Enable Sweep Frequency
56 };
57 
58 extern volatile uint32_t
59 ucInterrupted; /* Flag to indicate interrupt occurred */
60 int app_main();
61 int ADG2128_SwRst(struct ad5940_dev *dev);
62 uint32_t GetMCUIntFlag(void);
63 uint32_t ClrMCUIntFlag(void);
64 void AD5940BiaStructInit(void);
65 #endif /* APP_H_ */
spi_engine_offload_init_param::offload_config
uint8_t offload_config
Definition: spi_engine.h:151
NO_OS_SPI_MODE_1
@ NO_OS_SPI_MODE_1
Definition: no_os_spi.h:63
ad713x_init_param::gpio_dclkmode
struct no_os_gpio_init_param * gpio_dclkmode
Definition: ad713x.h:715
iio_app_init_param
IIO application descriptor initialization parameters.
Definition: iio_app.h:101
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
spi_engine_offload_message::no_commands
uint32_t no_commands
Definition: spi_engine.h:165
no_os_pwm_init_param
Structure containing the init parameters needed by the PWM generator.
Definition: no_os_pwm.h:66
ad713x.h
Header file for the ad713x Driver.
ad713x_dig_filter_sel_ch
int32_t ad713x_dig_filter_sel_ch(struct ad713x_dev *dev, enum ad713x_dig_filter_sel filter, enum ad713x_channels ch)
Digital filter type selection for each channel.
Definition: ad713x.c:338
iio_app_init_param::uart_init_params
struct no_os_uart_init_param uart_init_params
Definition: iio_app.h:115
IIO_APP_DEVICE
#define IIO_APP_DEVICE(_name, _dev, _dev_descriptor, _read_buff, _write_buff, _default_trigger_id)
Definition: iio_app.h:47
CN0561_SPI_CS
#define CN0561_SPI_CS
Definition: parameters.h:50
GPIO_PS
@ GPIO_PS
Definition: xilinx_gpio.h:56
SPI_PS
@ SPI_PS
Definition: xilinx_spi.h:62
ad713x_init_param::clk_delay_en
bool clk_delay_en
Definition: ad713x.h:740
SINC3
@ SINC3
Definition: ad713x.h:641
iio_data_buffer::size
uint32_t size
Definition: iio_app.h:63
ZED_DATA_CLK_FREQ_HZ
#define ZED_DATA_CLK_FREQ_HZ
Definition: parameters.h:74
no_os_spi.h
Header file of SPI Interface.
parameters.h
Parameters Definitions.
NO_OS_UART_STOP_1_BIT
@ NO_OS_UART_STOP_1_BIT
Definition: no_os_uart.h:94
no_os_irq.h
Header file of IRQ interface.
CN0561_SPI_ENGINE_BASEADDR
#define CN0561_SPI_ENGINE_BASEADDR
Definition: parameters.h:48
xil_uart_init_param::type
enum xil_uart_type type
Definition: xilinx_uart.h:69
ad713x_init_param::dev_id
enum ad713x_supported_dev_ids dev_id
Definition: ad713x.h:733
spi_engine_offload_init
int32_t spi_engine_offload_init(struct no_os_spi_desc *desc, const struct spi_engine_offload_init_param *param)
Initialize the SPI engine's offload module.
Definition: spi_engine.c:763
iio_desc
Definition: iio.c:204
iio_app.h
Header file of iio_app.
clk_axi_clkgen.h
Driver for the Analog Devices AXI CLKGEN.
DMA_PARTIAL_REPORTING_EN
@ DMA_PARTIAL_REPORTING_EN
Definition: axi_dmac.h:93
xilinx_uart.h
iio_app_desc
IIO application descriptor.
Definition: iio_app.h:80
main
int main()
Definition: cn0561.c:74
QUAD_CH_PO
@ QUAD_CH_PO
Definition: ad713x.h:626
ad713x_init_param
AD713x driver initialization structure.
Definition: ad713x.h:709
spi_engine_offload_message::commands_data
uint32_t * commands_data
Definition: spi_engine.h:167
iio_data_buffer::buff
void * buff
Definition: iio_app.h:64
no_os_pwm_init_param::period_ns
uint32_t period_ns
Definition: no_os_pwm.h:70
no_os_delay.h
Header file of Delay functions.
xil_gpio_ops
const struct no_os_gpio_platform_ops xil_gpio_ops
Xilinx platform specific GPIO platform ops structure.
Definition: xilinx_gpio.c:450
ADC_24_BIT_DATA
@ ADC_24_BIT_DATA
Definition: ad713x.h:596
axi_clkgen_init
Definition: clk_axi_clkgen.h:50
ad713x_init_param::crc_header
enum ad713x_crc_header crc_header
Definition: ad713x.h:737
axi_clkgen_set_rate
int32_t axi_clkgen_set_rate(struct axi_clkgen *clkgen, uint32_t rate)
axi_clkgen_set_rate
Definition: clk_axi_clkgen.c:414
app_main
int app_main()
no_os_spi_init_param::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:148
ad713x_init_param::pnd
bool pnd
Definition: ad713x.h:731
spi_engine_offload_message
Structure representing an offload message.
Definition: spi_engine.h:158
ad713x_init_param::dclkio_out_nin
bool dclkio_out_nin
Definition: ad713x.h:729
eit_config::nRefEl
uint16_t nRefEl
Definition: app.h:44
UART_PS
@ UART_PS
Definition: xilinx_uart.h:59
no_os_gpio_init_param::number
int32_t number
Definition: no_os_gpio.h:83
measurement_config::nFrequency
uint16_t nFrequency
Definition: app.h:48
xil_gpio_init_param::device_id
uint32_t device_id
Definition: xilinx_gpio.h:68
measurement_config::bSweepEn
bool bSweepEn
Definition: app.h:55
axi_clkgen_init
int32_t axi_clkgen_init(struct axi_clkgen **clk, const struct axi_clkgen_init *init)
axi_clkgen_init
Definition: clk_axi_clkgen.c:520
ADC_BUFFER_SIZE
#define ADC_BUFFER_SIZE
Definition: parameters.h:77
axi_clkgen
Definition: clk_axi_clkgen.h:44
ad713x_init_param::gpio_pnd
struct no_os_gpio_init_param * gpio_pnd
Definition: ad713x.h:721
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:49
ad713x_init_param::adc_data_len
enum ad713x_adc_data_len adc_data_len
Definition: ad713x.h:735
CN0561_DMA_BASEADDR
#define CN0561_DMA_BASEADDR
Definition: parameters.h:47
GPIO_RESETN
#define GPIO_RESETN
Definition: parameters.h:53
no_os_spi_init_param::platform_ops
const struct no_os_spi_platform_ops * platform_ops
Definition: no_os_spi.h:154
eit_config::nForceDist
uint16_t nForceDist
Definition: app.h:42
spi_eng_init_param
struct spi_engine_init_param spi_eng_init_param
Definition: parameters.c:55
measurement_config::bImpedanceReadMode
bool bImpedanceReadMode
Definition: app.h:53
axi_pwm_ops
const struct no_os_pwm_platform_ops axi_pwm_ops
AXI platform specific PWM platform ops structure.
Definition: axi_pwm.c:406
no_os_spi_init_param::device_id
uint32_t device_id
Definition: no_os_spi.h:142
no_os_spi_init_param::chip_select
uint8_t chip_select
Definition: no_os_spi.h:146
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
spi_engine_init_param::type
enum xil_spi_type type
Definition: spi_engine.h:87
iio.h
Header file of iio.
no_os_error.h
Error codes definition.
ad713x_spi_reg_dump
int32_t ad713x_spi_reg_dump(struct ad713x_dev *dev)
Print all registers values for the AD4134 device. Register map has gaps, reg dump function specific f...
Definition: ad713x.c:664
ad713x_spi_reg_write
int32_t ad713x_spi_reg_write(struct ad713x_dev *dev, uint8_t reg_addr, uint8_t reg_data)
Write to device.
Definition: ad713x.c:129
ad713x_remove
int32_t ad713x_remove(struct ad713x_dev *dev)
Free the resources allocated by ad713x_init().
Definition: ad713x.c:638
AD713X_REG_GPIO_DIR_CTRL
#define AD713X_REG_GPIO_DIR_CTRL
Definition: ad713x.h:90
iio_app_device
Definition: iio_app.h:67
measurement_config::bMagnitudeMode
bool bMagnitudeMode
Definition: app.h:50
spi_engine.h
axi_clkgen_init::base
uint32_t base
Definition: clk_axi_clkgen.h:52
axi_dmac.h
Driver for the Analog Devices AXI-DMAC core.
iio_data_buffer
Definition: iio_app.h:62
UART_IRQ_ID
#define UART_IRQ_ID
Definition: parameters.h:50
GPIO_DEVICE_ID
#define GPIO_DEVICE_ID
Definition: parameters.h:87
CH0
@ CH0
Definition: ad713x.h:652
CRC_6
@ CRC_6
Definition: ad713x.h:611
ad713x_init_param::spi_init_prm
struct no_os_spi_init_param spi_init_prm
Definition: ad713x.h:711
spi_engine_offload_message::tx_addr
uint32_t tx_addr
Definition: spi_engine.h:169
UART_BAUDRATE
#define UART_BAUDRATE
Definition: parameters.h:53
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
xilinx_gpio.h
ad713x_init_param::gpio_dclkio
struct no_os_gpio_init_param * gpio_dclkio
Definition: ad713x.h:717
ID_AD4134
@ ID_AD4134
Definition: ad713x.h:574
iio_ad713x.h
Header file of iio_axi_adc.
xil_uart_init_param
Structure holding the initialization parameters for Xilinx platform specific UART parameters.
Definition: xilinx_uart.h:67
xil_spi_init_param::type
enum xil_spi_type type
Definition: xilinx_spi.h:74
ad713x_init_param::gpio_mode
struct no_os_gpio_init_param * gpio_mode
Definition: ad713x.h:713
xilinx_irq.h
iio_app_run
int iio_app_run(struct iio_app_desc *app)
spi_engine_offload_message::commands
uint32_t * commands
Definition: spi_engine.h:163
spi_engine_offload_init_param::rx_dma_baseaddr
uint32_t rx_dma_baseaddr
Definition: spi_engine.h:145
no_os_pwm_desc
Structure representing an PWM generator device.
Definition: no_os_pwm.h:93
axi_pwm_init_param
Structure holding the initialization parameters for axi PWM.
Definition: axi_pwm_extra.h:50
SPI_ENGINE
@ SPI_ENGINE
Definition: xilinx_spi.h:64
no_os_pwm_init
int32_t no_os_pwm_init(struct no_os_pwm_desc **desc, const struct no_os_pwm_init_param *param)
Initialize the PWM peripheral.
Definition: no_os_pwm.c:51
xil_spi_init_param
Structure holding the initialization parameters for Xilinx platform specific SPI parameters when usin...
Definition: xilinx_spi.h:72
iio_app_init
int iio_app_init(struct iio_app_desc **app, struct iio_app_init_param app_init_param)
no_os_spi_init_param::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_spi.h:144
no_os_pwm.h
Header file of PWM Interface.
OFFLOAD_RX_EN
#define OFFLOAD_RX_EN
Definition: spi_engine.h:53
xil_uart_ops
const struct no_os_uart_platform_ops xil_uart_ops
Xilinx platform specific UART platform ops structure.
Definition: xilinx_uart.c:520
spi_engine_offload_init_param::dma_flags
uint32_t dma_flags
Definition: spi_engine.h:149
NULL
#define NULL
Definition: wrapper.h:64
no_os_uart_init_param
Structure holding the parameters for UART initialization.
Definition: no_os_uart.h:110
ad713x_dev
AD713x driver handler structure.
Definition: ad713x.h:680
xil_spi_ops
const struct no_os_spi_platform_ops xil_spi_ops
Spi engine platform specific SPI platform ops structure.
Definition: xilinx_spi.c:453
SPI_DEVICE_ID
#define SPI_DEVICE_ID
Definition: parameters.h:69
ADG2128_SwRst
int ADG2128_SwRst(struct ad5940_dev *dev)
Definition: app.c:63
spi_engine_init_param
Structure containing the init parameters needed by the SPI engine.
Definition: spi_engine.h:83
NO_OS_UART_PAR_NO
@ NO_OS_UART_PAR_NO
Definition: no_os_uart.h:77
spi_eng_platform_ops
const struct no_os_spi_platform_ops spi_eng_platform_ops
Spi engine platform specific SPI platform ops structure.
Definition: spi_engine.c:61
ad713x_init_param::format
enum ad713x_doutx_format format
Definition: ad713x.h:738
GPIO_PDN
#define GPIO_PDN
Definition: parameters.h:54
CH3
@ CH3
Definition: ad713x.h:658
no_os_uart_init_param::device_id
uint8_t device_id
Definition: no_os_uart.h:112
spi_engine_offload_transfer
int32_t spi_engine_offload_transfer(struct no_os_spi_desc *desc, struct spi_engine_offload_message msg, uint32_t no_samples)
Initiate a SPI transfer in offload mode.
Definition: spi_engine.c:809
CN0561_FMC_CH_NO
#define CN0561_FMC_CH_NO
Definition: parameters.h:64
GetMCUIntFlag
uint32_t GetMCUIntFlag(void)
Definition: app.c:72
xil_gpio_init_param
Structure holding the initialization parameters for Xilinx platform specific GPIO parameters.
Definition: xilinx_gpio.h:64
ad713x_init_param::spi_common_dev
struct no_os_spi_desc * spi_common_dev
Definition: ad713x.h:743
measurement_config
Definition: app.h:47
ad713x_init_param::dclkmode_free_ngated
bool dclkmode_free_ngated
Definition: ad713x.h:727
spi_engine_offload_init_param
Structure containing the init parameters needed by the offload module.
Definition: spi_engine.h:143
no_os_gpio.h
Header file of GPIO Interface.
gpio_extra_param
struct xil_gpio_init_param gpio_extra_param
Definition: parameters.c:63
no_os_uart.h
Header file of UART interface.
CN0561_SPI_ENG_REF_CLK_FREQ_HZ
#define CN0561_SPI_ENG_REF_CLK_FREQ_HZ
Definition: parameters.h:49
ad713x_init_param::gpio_resetn
struct no_os_gpio_init_param * gpio_resetn
Definition: ad713x.h:719
no_os_spi_init
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:52
UART_DEVICE_ID
#define UART_DEVICE_ID
Definition: parameters.h:52
DMA_LAST
@ DMA_LAST
Definition: axi_dmac.h:92
eit_config::nSenseDist
uint16_t nSenseDist
Definition: app.h:43
axi_pwm_init_param::base_addr
uint32_t base_addr
Definition: axi_pwm_extra.h:52
no_os_util.h
Header file of utility functions.
iio_uart_ip
struct no_os_uart_init_param iio_uart_ip
Definition: common_data.c:46
CN0561_FMC_SAMPLE_NO
#define CN0561_FMC_SAMPLE_NO
Definition: parameters.h:65
eit_config
Definition: app.h:40
no_os_spi_init_param::extra
void * extra
Definition: no_os_spi.h:158
NO_OS_SPI_MODE_0
@ NO_OS_SPI_MODE_0
Definition: no_os_spi.h:61
CORA_Z7S_DATA_CLK_FREQ_HZ
#define CORA_Z7S_DATA_CLK_FREQ_HZ
Definition: parameters.h:73
spi_engine_offload_message::rx_addr
uint32_t rx_addr
Definition: spi_engine.h:171
eit_config::nElectrodeCnt
uint16_t nElectrodeCnt
Definition: app.h:41
adc_buffer
uint16_t adc_buffer[ADC_BUFFER_SAMPLES *ADC_CHANNELS]
Definition: main.c:100
xilinx_spi.h
AD713X_REG_GPIO_DATA
#define AD713X_REG_GPIO_DATA
Definition: ad713x.h:91
NO_OS_UART_CS_8
@ NO_OS_UART_CS_8
Definition: no_os_uart.h:66
ClrMCUIntFlag
uint32_t ClrMCUIntFlag(void)
Definition: app.c:77
ad713x_init
int32_t ad713x_init(struct ad713x_dev **device, struct ad713x_init_param *init_param)
Initialize the device.
Definition: ad713x.c:551
iio_app_init_param::devices
struct iio_app_device * devices
Definition: iio_app.h:107
AD5940BiaStructInit
void AD5940BiaStructInit(void)
Definition: app.c:291
xil_gpio_init_param::type
enum xil_gpio_type type
Definition: xilinx_gpio.h:66
READ
#define READ(no_bytes)
Definition: spi_engine.h:62
ad713x_init_param::mode_master_nslave
bool mode_master_nslave
Definition: ad713x.h:725
measurement_config::nAmplitudePP
uint16_t nAmplitudePP
Definition: app.h:49
iio_app_init_param::nb_devices
uint32_t nb_devices
Definition: iio_app.h:109
GPIO_MODE
#define GPIO_MODE
Definition: parameters.h:55
ucInterrupted
volatile uint32_t ucInterrupted
Definition: app.c:58
axi_pwm_extra.h
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140