no-OS
ad796x.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef __AD796X_H__
40 #define __AD796X_H__
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 #include "no_os_gpio.h"
46 #include "no_os_pwm.h"
47 #include "axi_dmac.h"
48 #include "clk_axi_clkgen.h"
49 #include "axi_adc_core.h"
50 
51 /******************************************************************************/
52 /********************** Macros and Constants Definitions **********************/
53 /******************************************************************************/
66 };
67 
68 #define AD796X_NUM_GPIOS 4
69 
70 /******************************************************************************/
71 /*************************** Types Declarations *******************************/
72 /******************************************************************************/
85 };
86 
91 struct ad796x_dev {
93  struct axi_clkgen *clkgen;
94  struct axi_dmac *axi_dmac;
98 };
99 
100 /******************************************************************************/
101 /************************ Functions Declarations ******************************/
102 /******************************************************************************/
103 
104 /* Initialize the device. */
105 int ad796x_init(struct ad796x_dev **device,
106  struct ad796x_init_param *init_param);
107 
108 /* Remove the device and release resources. */
109 int ad796x_remove(struct ad796x_dev *dev);
110 
111 /* Read samples from the device */
112 int32_t ad796x_read_data(struct ad796x_dev *dev, uint32_t *buf,
113  uint16_t samples);
114 
115 #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:97
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:85
AD796X_MODE10_SNOOZE2
@ AD796X_MODE10_SNOOZE2
Definition: ad796x.h:65
no_os_pwm_init_param
Structure containing the init parameters needed by the PWM generator.
Definition: no_os_pwm.h:72
ad796x_mode
ad796x_mode
Definition: ad796x.h:54
ad796x_remove
int ad796x_remove(struct ad796x_dev *dev)
Remove the device and release resources.
Definition: ad796x.c:229
AD796X_NUM_GPIOS
#define AD796X_NUM_GPIOS
Definition: ad796x.h:68
ad796x_init_param::ad796x_core_ip
struct axi_adc_init * ad796x_core_ip
Definition: ad796x.h:78
ad796x_init_param::dmac_ip
struct axi_dmac_init * dmac_ip
Definition: ad796x.h:80
axi_dmac_init
Definition: axi_dmac.h:129
AD796X_MODE5_TEST
@ AD796X_MODE5_TEST
Definition: ad796x.h:60
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:85
axi_adc_init
AXI ADC Initialization Parameters structure.
Definition: axi_adc_core.h:149
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:510
pr_err
#define pr_err(fmt, args...)
Definition: no_os_print_log.h:94
ad796x_remove
int ad796x_remove(struct ad796x_dev *dev)
Remove the device and release resources.
Definition: ad796x.c:229
axi_clkgen_init
Definition: clk_axi_clkgen.h:56
ad796x_dev::ad796x_core
struct axi_adc * ad796x_core
Definition: ad796x.h:92
axi_adc
AXI ADC Device Descriptor.
Definition: axi_adc_core.h:128
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:419
device
Definition: ad9361_util.h:75
ad796x_init_param::mode
enum ad796x_mode mode
Definition: ad796x.h:84
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:525
axi_clkgen
Definition: clk_axi_clkgen.h:50
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:60
ad7616_init_param::mode
enum ad7616_mode mode
Definition: ad7616.h:232
AD796X_MODE1_EXT_REF_5P0
@ AD796X_MODE1_EXT_REF_5P0
Definition: ad796x.h:56
AD796X_MODE0_POWER_DOWN
@ AD796X_MODE0_POWER_DOWN
Definition: ad796x.h:55
axi_dma_transfer
Definition: axi_dmac.h:106
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:80
AD796X_MODE7_EXT_REF_5P0_9MHZ
@ AD796X_MODE7_EXT_REF_5P0_9MHZ
Definition: ad796x.h:62
ad796x_init_param::axi_pwm_1_ip
struct no_os_pwm_init_param * axi_pwm_1_ip
Definition: ad796x.h:82
ad796x_init_param::gpio_ip
struct no_os_gpio_init_param * gpio_ip[AD796X_NUM_GPIOS]
Definition: ad796x.h:83
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:64
ad796x_dev::axi_pwm_0
struct no_os_pwm_desc * axi_pwm_0
Definition: ad796x.h:95
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:110
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:102
no_os_pwm_desc
Structure representing an PWM generator device.
Definition: no_os_pwm.h:99
ad796x_dev::axi_dmac
struct axi_dmac * axi_dmac
Definition: ad796x.h:94
ad796x_init
int ad796x_init(struct ad796x_dev **device, struct ad796x_init_param *init_param)
Initialize the device.
Definition: ad796x.c:165
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:57
AD796X_MODE6_INVALID
@ AD796X_MODE6_INVALID
Definition: ad796x.h:61
ad796x_init_param::clkgen_ip
struct axi_clkgen_init * clkgen_ip
Definition: ad796x.h:79
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:165
ad796x_dev::axi_pwm_1
struct no_os_pwm_desc * axi_pwm_1
Definition: ad796x.h:96
NO
@ NO
Definition: axi_dmac.h:102
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:75
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:647
axi_dmac_init
int32_t axi_dmac_init(struct axi_dmac **dmac_core, const struct axi_dmac_init *init)
Definition: axi_dmac.c:332
AD796X_MODE4_SNOOZE
@ AD796X_MODE4_SNOOZE
Definition: ad796x.h:59
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
ad796x_dev
AD796X Device structure.
Definition: ad796x.h:91
axi_adc_remove
int32_t axi_adc_remove(struct axi_adc *adc)
AXI ADC Resources deallocation.
Definition: axi_adc_core.c:687
ad796x_init_param::axi_pwm_0_ip
struct no_os_pwm_init_param * axi_pwm_0_ip
Definition: ad796x.h:81
AD796X_BYTES_PER_SAMPLE
#define AD796X_BYTES_PER_SAMPLE
Definition: ad796x.c:53
AD796X_MODE2_INT_REF_4P0
@ AD796X_MODE2_INT_REF_4P0
Definition: ad796x.h:57
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:383
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:80
axi_clkgen_remove
int32_t axi_clkgen_remove(struct axi_clkgen *clkgen)
axi_clkgen_remove
Definition: clk_axi_clkgen.c:546
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:153
axi_dma_transfer::size
uint32_t size
Definition: axi_dmac.h:107
AD796X_MODE3_EXT_REF_4P0
@ AD796X_MODE3_EXT_REF_4P0
Definition: ad796x.h:58
AD796X_MODE8_INT_REF_4P0_9MHZ
@ AD796X_MODE8_INT_REF_4P0_9MHZ
Definition: ad796x.h:63
errno.h
Error macro definition for ARM Compiler.
ad796x_dev::clkgen
struct axi_clkgen * clkgen
Definition: ad796x.h:93
axi_dmac
Definition: axi_dmac.h:114
ad796x_init_param
AD796X Device initialization parameters.
Definition: ad796x.h:77
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:81