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