no-OS
ad9434.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef AD9434_H_
40 #define AD9434_H_
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 #include <stdint.h>
46 #include "no_os_delay.h"
47 #include "no_os_spi.h"
48 
49 /******************************************************************************/
50 /********************** Macros and Constants Definitions **********************/
51 /******************************************************************************/
52 #define AD9434_REG_CHIP_PORT_CONF 0x00
53 #define AD9434_REG_CHIP_ID 0x01
54 #define AD9434_REG_CHIP_GRADE 0x02
55 #define AD9434_REG_CHAN_INDEX 0x05
56 #define AD9434_REG_TRANSFER 0xFF
57 #define AD9434_REG_MODES 0x08
58 #define AD9434_REG_TEST_IO 0x0D
59 #define AD9434_REG_ADC_INPUT 0x0F
60 #define AD9434_REG_OFFSET 0x10
61 #define AD9434_REG_OUTPUT_MODE 0x14
62 #define AD9434_REG_OUTPUT_ADJUST 0x15
63 #define AD9434_REG_OUTPUT_PHASE 0x16
64 #define AD9434_REG_OUTPUT_DELAY 0x17
65 #define AD9434_REG_VREF 0x18
66 #define AD9434_REG_ANALOG_INPUT 0x2C
67 
68 /* ADC_REG_TRANSFER */
69 #define TRANSFER_SYNC 0x1
70 
71 /* AD9434_REG_TEST_IO */
72 #define TESTMODE_OFF 0x0
73 #define TESTMODE_MIDSCALE_SHORT 0x1
74 #define TESTMODE_POS_FULLSCALE 0x2
75 #define TESTMODE_NEG_FULLSCALE 0x3
76 #define TESTMODE_ALT_CHECKERBOARD 0x4
77 #define TESTMODE_PN23_SEQ 0x5
78 #define TESTMODE_PN9_SEQ 0x6
79 #define TESTMODE_ONE_ZERO_TOGGLE 0x7
80 #define TESTMODE_USER_DEFINED 0x8
81 
82 /* ADC_REG_OUTPUT_MODE */
83 #define OUTPUT_MODE_OFFSET_BINARY 0x0
84 #define OUTPUT_MODE_TWOS_COMPLEMENT 0x1
85 #define OUTPUT_MODE_GRAY_CODE 0x2
86 
87 /* ADC_REG_OUTPUT_PHASE */
88 #define OUTPUT_EVEN_ODD_MODE_EN 0x20
89 #define INVERT_DCO_CLK 0x80
90 
91 #define AD9434_CHIP_ID 0x6A
92 #define AD9434_DEF_OUTPUT_MODE 0x00
93 
94 /******************************************************************************/
95 /*************************** Types Declarations *******************************/
96 /******************************************************************************/
97 
98 struct ad9434_dev {
99  /* SPI */
101 };
102 
104  /* SPI */
106 };
107 
108 /******************************************************************************/
109 /************************ Functions Declarations ******************************/
110 /******************************************************************************/
111 int32_t ad9434_spi_read(struct ad9434_dev *dev,
112  uint16_t reg_addr,
113  uint8_t *reg_data);
114 int32_t ad9434_spi_write(struct ad9434_dev *dev,
115  uint16_t reg_addr,
116  uint8_t reg_data);
117 int32_t ad9434_testmode_set(struct ad9434_dev *dev,
118  uint8_t mode);
119 int32_t ad9434_setup(struct ad9434_dev **device,
121 int32_t ad9434_outputmode_set(struct ad9434_dev *dev,
122  uint8_t mode);
123 int32_t ad9434_remove(struct ad9434_dev *dev);
124 #endif
ad9434_setup
int32_t ad9434_setup(struct ad9434_dev **device, struct ad9434_init_param init_param)
ad9434_setup
Definition: ad9434.c:143
no_os_alloc.h
no_os_spi_write_and_read
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:165
ad9434_spi_write
int32_t ad9434_spi_write(struct ad9434_dev *dev, uint16_t reg_addr, uint8_t reg_data)
ad9434_spi_write
Definition: ad9434.c:74
no_os_spi.h
Header file of SPI Interface.
ad9434_spi_read
int32_t ad9434_spi_read(struct ad9434_dev *dev, uint16_t reg_addr, uint8_t *reg_data)
ad9434_spi_read
Definition: ad9434.c:53
ad9434_outputmode_set
int32_t ad9434_outputmode_set(struct ad9434_dev *dev, uint8_t mode)
ad9434_setup
Definition: ad9434.c:94
no_os_delay.h
Header file of Delay functions.
ad9434_remove
int32_t ad9434_remove(struct ad9434_dev *dev)
ad9434_remove
Definition: ad9434.c:175
no_os_spi_init_param::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:139
ad9434_outputmode_set
int32_t ad9434_outputmode_set(struct ad9434_dev *dev, uint8_t mode)
ad9434_setup
Definition: ad9434.c:94
device
Definition: ad9361_util.h:75
ad9434_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad9434.h:100
ad9434_remove
int32_t ad9434_remove(struct ad9434_dev *dev)
ad9434_remove
Definition: ad9434.c:175
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:132
ad9434_setup
int32_t ad9434_setup(struct ad9434_dev **device, struct ad9434_init_param init_param)
ad9434_setup
Definition: ad9434.c:143
TESTMODE_OFF
#define TESTMODE_OFF
Definition: ad9265.h:72
AD9434_REG_OUTPUT_DELAY
#define AD9434_REG_OUTPUT_DELAY
Definition: ad9434.h:64
ad9434_init_param::spi_init
struct no_os_spi_init_param spi_init
Definition: ad9434.h:105
ad9434_testmode_set
int32_t ad9434_testmode_set(struct ad9434_dev *dev, uint8_t mode)
ad9434_testmode_set
Definition: ad9434.c:112
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:177
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:49
AD9434_REG_OUTPUT_MODE
#define AD9434_REG_OUTPUT_MODE
Definition: ad9434.h:61
ad9434_dev
Definition: ad9434.h:98
ad9434_init_param
Definition: ad9434.h:103
ad9434_spi_write
int32_t ad9434_spi_write(struct ad9434_dev *dev, uint16_t reg_addr, uint8_t reg_data)
ad9434_spi_write
Definition: ad9434.c:74
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
TRANSFER_SYNC
#define TRANSFER_SYNC
Definition: ad9265.h:69
ad9434_spi_read
int32_t ad9434_spi_read(struct ad9434_dev *dev, uint16_t reg_addr, uint8_t *reg_data)
ad9434_spi_read
Definition: ad9434.c:53
AD9434_CHIP_ID
#define AD9434_CHIP_ID
Definition: ad9434.h:91
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
AD9434_DEF_OUTPUT_MODE
#define AD9434_DEF_OUTPUT_MODE
Definition: ad9434.h:92
ad9434_data_delay
int32_t ad9434_data_delay(struct ad9434_dev *dev, int16_t delay)
ad9434_data_delay
Definition: ad9434.c:130
no_os_spi_remove
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:122
AD9434_REG_TEST_IO
#define AD9434_REG_TEST_IO
Definition: ad9434.h:58
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:58
AD9434_REG_CHIP_ID
#define AD9434_REG_CHIP_ID
Definition: ad9434.h:53
ad9434.h
Header file of AD9434 Driver.
no_os_spi_desc::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:187
ad9434_testmode_set
int32_t ad9434_testmode_set(struct ad9434_dev *dev, uint8_t mode)
ad9434_testmode_set
Definition: ad9434.c:112
AD9434_REG_TRANSFER
#define AD9434_REG_TRANSFER
Definition: ad9434.h:56
chip_id
chip_id
Definition: ad9172.h:57
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:131