no-OS
ad796x.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef __AD796X_H__
34 #define __AD796X_H__
35 
36 /******************************************************************************/
37 /***************************** Include Files **********************************/
38 /******************************************************************************/
39 #include "no_os_gpio.h"
40 #include "no_os_pwm.h"
41 #include "axi_dmac.h"
42 #include "clk_axi_clkgen.h"
43 #include "axi_adc_core.h"
44 
45 /******************************************************************************/
46 /********************** Macros and Constants Definitions **********************/
47 /******************************************************************************/
60 };
61 
62 #define AD796X_NUM_GPIOS 4
63 
64 /******************************************************************************/
65 /*************************** Types Declarations *******************************/
66 /******************************************************************************/
79 };
80 
85 struct ad796x_dev {
87  struct axi_clkgen *clkgen;
88  struct axi_dmac *axi_dmac;
92 };
93 
94 /******************************************************************************/
95 /************************ Functions Declarations ******************************/
96 /******************************************************************************/
97 
98 /* Initialize the device. */
99 int ad796x_init(struct ad796x_dev **device,
100  struct ad796x_init_param *init_param);
101 
102 /* Remove the device and release resources. */
103 int ad796x_remove(struct ad796x_dev *dev);
104 
105 /* Read samples from the device */
106 int32_t ad796x_read_data(struct ad796x_dev *dev, uint32_t *buf,
107  uint16_t samples);
108 
109 #endif /* __AD796X_H__ */
axi_adc_core.h
Driver for the Analog Devices AXI-ADC-CORE module.
ad796x_dev::gpio_en
struct no_os_gpio_desc * gpio_en[AD796X_NUM_GPIOS]
Definition: ad796x.h:91
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
AD796X_MODE10_SNOOZE2
@ AD796X_MODE10_SNOOZE2
Definition: ad796x.h:59
no_os_pwm_init_param
Structure containing the init parameters needed by the PWM generator.
Definition: no_os_pwm.h:66
ad796x_mode
ad796x_mode
Definition: ad796x.h:48
ad796x_remove
int ad796x_remove(struct ad796x_dev *dev)
Remove the device and release resources.
Definition: ad796x.c:223
AD796X_NUM_GPIOS
#define AD796X_NUM_GPIOS
Definition: ad796x.h:62
ad796x_init_param::ad796x_core_ip
struct axi_adc_init * ad796x_core_ip
Definition: ad796x.h:72
ad796x_init_param::dmac_ip
struct axi_dmac_init * dmac_ip
Definition: ad796x.h:74
axi_dmac_init
Definition: axi_dmac.h:127
AD796X_MODE5_TEST
@ AD796X_MODE5_TEST
Definition: ad796x.h:54
no_os_pwm_remove
int32_t no_os_pwm_remove(struct no_os_pwm_desc *desc)
Free the resources allocated by no_os_pwm_init().
Definition: no_os_pwm.c:79
axi_adc_init
AXI ADC Initialization Parameters structure.
Definition: axi_adc_core.h:143
clk_axi_clkgen.h
Driver for the Analog Devices AXI CLKGEN.
axi_dmac_transfer_wait_completion
int32_t axi_dmac_transfer_wait_completion(struct axi_dmac *dmac, uint32_t timeout_ms)
Definition: axi_dmac.c:525
pr_err
#define pr_err(fmt, args...)
Definition: no_os_print_log.h:88
ad796x_remove
int ad796x_remove(struct ad796x_dev *dev)
Remove the device and release resources.
Definition: ad796x.c:223
axi_clkgen_init
Definition: clk_axi_clkgen.h:50
ad796x_dev::ad796x_core
struct axi_adc * ad796x_core
Definition: ad796x.h:86
axi_adc
AXI ADC Device Descriptor.
Definition: axi_adc_core.h:122
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
device
Definition: ad9361_util.h:69
ad796x_init_param::mode
enum ad796x_mode mode
Definition: ad796x.h:78
no_os_print_log.h
Print messages helpers.
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
axi_clkgen
Definition: clk_axi_clkgen.h:44
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
ad7616_init_param::mode
enum ad7616_mode mode
Definition: ad7616.h:226
AD796X_MODE1_EXT_REF_5P0
@ AD796X_MODE1_EXT_REF_5P0
Definition: ad796x.h:50
AD796X_MODE0_POWER_DOWN
@ AD796X_MODE0_POWER_DOWN
Definition: ad796x.h:49
axi_dma_transfer
Definition: axi_dmac.h:102
ad796x_read_data
int32_t ad796x_read_data(struct ad796x_dev *dev, uint32_t *buf, uint16_t samples)
Read data samples from adc.
Definition: ad796x.c:74
AD796X_MODE7_EXT_REF_5P0_9MHZ
@ AD796X_MODE7_EXT_REF_5P0_9MHZ
Definition: ad796x.h:56
ad796x_init_param::axi_pwm_1_ip
struct no_os_pwm_init_param * axi_pwm_1_ip
Definition: ad796x.h:76
ad796x_init_param::gpio_ip
struct no_os_gpio_init_param * gpio_ip[AD796X_NUM_GPIOS]
Definition: ad796x.h:77
axi_dmac.h
Driver for the Analog Devices AXI-DMAC core.
AD796X_MODE9_EXT_REF_4P0_9MHZ
@ AD796X_MODE9_EXT_REF_4P0_9MHZ
Definition: ad796x.h:58
ad796x_dev::axi_pwm_0
struct no_os_pwm_desc * axi_pwm_0
Definition: ad796x.h:89
no_os_gpio_remove
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:104
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
no_os_pwm_desc
Structure representing an PWM generator device.
Definition: no_os_pwm.h:93
ad796x_dev::axi_dmac
struct axi_dmac * axi_dmac
Definition: ad796x.h:88
ad796x_init
int ad796x_init(struct ad796x_dev **device, struct ad796x_init_param *init_param)
Initialize the device.
Definition: ad796x.c:159
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
AD796X_MODE6_INVALID
@ AD796X_MODE6_INVALID
Definition: ad796x.h:55
ad796x_init_param::clkgen_ip
struct axi_clkgen_init * clkgen_ip
Definition: ad796x.h:73
no_os_pwm.h
Header file of PWM Interface.
ad796x_init
int ad796x_init(struct ad796x_dev **device, struct ad796x_init_param *init_param)
Initialize the device.
Definition: ad796x.c:159
ad796x_dev::axi_pwm_1
struct no_os_pwm_desc * axi_pwm_1
Definition: ad796x.h:90
NO
@ NO
Definition: axi_dmac.h:98
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
axi_adc_init
int32_t axi_adc_init(struct axi_adc **adc_core, const struct axi_adc_init *init)
AXI ADC Main Initialization.
Definition: axi_adc_core.c:641
axi_dmac_init
int32_t axi_dmac_init(struct axi_dmac **dmac_core, const struct axi_dmac_init *init)
Definition: axi_dmac.c:334
AD796X_MODE4_SNOOZE
@ AD796X_MODE4_SNOOZE
Definition: ad796x.h:53
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
ad796x_dev
AD796X Device structure.
Definition: ad796x.h:85
axi_adc_remove
int32_t axi_adc_remove(struct axi_adc *adc)
AXI ADC Resources deallocation.
Definition: axi_adc_core.c:681
ad796x_init_param::axi_pwm_0_ip
struct no_os_pwm_init_param * axi_pwm_0_ip
Definition: ad796x.h:75
AD796X_BYTES_PER_SAMPLE
#define AD796X_BYTES_PER_SAMPLE
Definition: ad796x.c:47
AD796X_MODE2_INT_REF_4P0
@ AD796X_MODE2_INT_REF_4P0
Definition: ad796x.h:51
no_os_gpio.h
Header file of GPIO Interface.
ad796x.h
Header file of AD796X Driver.
axi_dmac_transfer_start
int32_t axi_dmac_transfer_start(struct axi_dmac *dmac, struct axi_dma_transfer *dma_transfer)
Definition: axi_dmac.c:385
ad796x_read_data
int32_t ad796x_read_data(struct ad796x_dev *dev, uint32_t *buf, uint16_t samples)
Read data samples from adc.
Definition: ad796x.c:74
axi_clkgen_remove
int32_t axi_clkgen_remove(struct axi_clkgen *clkgen)
axi_clkgen_remove
Definition: clk_axi_clkgen.c:541
no_os_gpio_direction_output
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:147
axi_dma_transfer::size
uint32_t size
Definition: axi_dmac.h:103
AD796X_MODE3_EXT_REF_4P0
@ AD796X_MODE3_EXT_REF_4P0
Definition: ad796x.h:52
AD796X_MODE8_INT_REF_4P0_9MHZ
@ AD796X_MODE8_INT_REF_4P0_9MHZ
Definition: ad796x.h:57
errno.h
Error macro definition for ARM Compiler.
ad796x_dev::clkgen
struct axi_clkgen * clkgen
Definition: ad796x.h:87
axi_dmac
Definition: axi_dmac.h:110
ad796x_init_param
AD796X Device initialization parameters.
Definition: ad796x.h:71
no_os_gpio_get_optional
int32_t no_os_gpio_get_optional(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Get the value of an optional GPIO.
Definition: no_os_gpio.c:75