no-OS
ad9656.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef AD9656_H_
40 #define AD9656_H_
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 #include "no_os_spi.h"
46 
47 /******************************************************************************/
48 /********************** Macros and Constants Definitions **********************/
49 /******************************************************************************/
50 #define AD9656_SPI_CONFIG 0x000
51 #define AD9656_REG_CHIP_ID 0x001
52 #define AD9656_REG_DEVICE_INDEX 0x005
53 #define AD9656_REG_ADC_TEST_MODE 0x00D
54 #define AD9656_REG_OUTPUT_MODE 0x014
55 #define AD9656_REG_USER_TEST_PATTERN_1_LSB 0x19
56 #define AD9656_REG_USER_TEST_PATTERN_1_MSB 0x1A
57 #define AD9656_REG_USER_TEST_PATTERN_2_LSB 0x1B
58 #define AD9656_REG_USER_TEST_PATTERN_2_MSB 0x1C
59 #define AD9656_REG_LINK_CONTROL 0x05F
60 #define AD9656_REG_JESD204B_LANE_RATE_CTRL 0x021
61 #define AD9656_REG_JESD204B_PLL_LOCK_STATUS 0x00A
62 #define AD9656_REG_JESD204B_QUICK_CONFIG 0x05E
63 #define AD9656_REG_JESD204B_SCR_L 0x06E
64 #define AD9656_REG_JESD204B_MF_CTRL 0x070
65 #define AD9656_REG_JESD204B_M_CTRL 0x071
66 #define AD9656_REG_JESD204B_CSN_CONFIG 0x072
67 #define AD9656_REG_JESD204B_SUBCLASS_CONFIG 0x073
68 #define AD9656_REG_JESD204B_LANE_SERD_OUT1_OUT0_ASSIGN 0x082
69 #define AD9656_REG_JESD204B_LANE_SERD_OUT3_OUT2_ASSIGN 0x083
70 
71 #define AD9656_CHIP_ID 0x0C0
72 #define AD9656_TEST_OFF 0x000
73 #define AD9656_TEST_PN9 0x006
74 #define AD9656_TEST_PN23 0x005
75 #define AD9656_TEST_USER_INPUT 0x048
76 #define AD9656_FORMAT_2S_COMPLEMENT 0x001
77 #define AD9656_FORMAT_OFFSET_BINARY 0x000
78 
79 /******************************************************************************/
80 /*************************** Types Declarations *******************************/
81 /******************************************************************************/
82 struct ad9656_dev {
83  /* SPI */
85 };
86 
88  /* SPI */
90  /* Device Settings */
91  uint32_t lane_rate_kbps;
92 };
93 
95  /* User input test pattern 1 */
97  /* User input test pattern 2 */
99 };
100 
101 /******************************************************************************/
102 /************************ Functions Declarations ******************************/
103 /******************************************************************************/
104 
105 int32_t ad9656_reg_read(struct ad9656_dev *dev,
106  uint16_t reg_addr,
107  uint8_t *reg_data);
108 
109 int32_t ad9656_reg_write(struct ad9656_dev *dev,
110  uint16_t reg_addr,
111  uint8_t reg_data);
112 
113 int32_t ad9656_setup(struct ad9656_dev **device,
114  const struct ad9656_init_param *init_param);
115 
116 int32_t ad9656_remove(struct ad9656_dev *dev);
117 
118 int32_t ad9656_JESD204_test(struct ad9656_dev *dev,
119  uint32_t test_mode);
120 
121 int32_t ad9656_user_input_test(struct ad9656_dev *dev, uint32_t test_mode,
122  struct ad9656_user_input_test_pattern user_input_test_pattern);
123 
124 #endif
AD9656_REG_JESD204B_SCR_L
#define AD9656_REG_JESD204B_SCR_L
Definition: ad9656.h:63
no_os_alloc.h
ad9656_remove
int32_t ad9656_remove(struct ad9656_dev *dev)
Free the resources allocated by ad9656_setup().
Definition: ad9656.c:287
AD9656_REG_JESD204B_CSN_CONFIG
#define AD9656_REG_JESD204B_CSN_CONFIG
Definition: ad9656.h:66
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
no_os_spi.h
Header file of SPI Interface.
AD9656_REG_JESD204B_MF_CTRL
#define AD9656_REG_JESD204B_MF_CTRL
Definition: ad9656.h:64
ad9656_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad9656.h:84
no_os_delay.h
Header file of Delay functions.
device
Definition: ad9361_util.h:75
AD9656_FORMAT_2S_COMPLEMENT
#define AD9656_FORMAT_2S_COMPLEMENT
Definition: ad9656.h:76
ad9656_user_input_test_pattern::user_test_pattern1
uint16_t user_test_pattern1
Definition: ad9656.h:96
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
AD9656_REG_USER_TEST_PATTERN_2_LSB
#define AD9656_REG_USER_TEST_PATTERN_2_LSB
Definition: ad9656.h:57
AD9656_CHIP_ID
#define AD9656_CHIP_ID
Definition: ad9656.h:71
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:132
AD9656_FORMAT_OFFSET_BINARY
#define AD9656_FORMAT_OFFSET_BINARY
Definition: ad9656.h:77
no_os_error.h
Error codes definition.
ad9656_reg_read
int32_t ad9656_reg_read(struct ad9656_dev *dev, uint16_t reg_addr, uint8_t *reg_data)
Reads from the ad9656 that is contected to the SPI.
Definition: ad9656.c:58
AD9656_REG_JESD204B_PLL_LOCK_STATUS
#define AD9656_REG_JESD204B_PLL_LOCK_STATUS
Definition: ad9656.h:61
AD9656_REG_ADC_TEST_MODE
#define AD9656_REG_ADC_TEST_MODE
Definition: ad9656.h:53
AD9656_REG_OUTPUT_MODE
#define AD9656_REG_OUTPUT_MODE
Definition: ad9656.h:54
AD9656_REG_JESD204B_SUBCLASS_CONFIG
#define AD9656_REG_JESD204B_SUBCLASS_CONFIG
Definition: ad9656.h:67
ad9656_init_param::lane_rate_kbps
uint32_t lane_rate_kbps
Definition: ad9656.h:91
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:177
AD9656_SPI_CONFIG
#define AD9656_SPI_CONFIG
Definition: ad9656.h:50
AD9656_REG_USER_TEST_PATTERN_1_MSB
#define AD9656_REG_USER_TEST_PATTERN_1_MSB
Definition: ad9656.h:56
ad9656_user_input_test_pattern
Definition: ad9656.h:94
ad9656_user_input_test_pattern::user_test_pattern2
uint16_t user_test_pattern2
Definition: ad9656.h:98
ad9656_user_input_test
int32_t ad9656_user_input_test(struct ad9656_dev *dev, uint32_t test_mode, struct ad9656_user_input_test_pattern user_input_test_pattern)
Launch the user input test functionality for the receive path for the ad9656 chip....
Definition: ad9656.c:147
ad9656_dev
Definition: ad9656.h:82
ad9656_init_param
Definition: ad9656.h:87
ad9656_setup
int32_t ad9656_setup(struct ad9656_dev **device, const struct ad9656_init_param *init_param)
Setup the working parameters of the ad9656 chip.
Definition: ad9656.c:183
ad9656_reg_write
int32_t ad9656_reg_write(struct ad9656_dev *dev, uint16_t reg_addr, uint8_t reg_data)
Write to the ad9656 that is conected to the SPI.
Definition: ad9656.c:91
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
ad9656.h
Header file of AD9656 Driver.
ad9656_JESD204_test
int32_t ad9656_JESD204_test(struct ad9656_dev *dev, uint32_t test_mode)
Launch the JESD204 test functionality for the receive path for the ad9656 chip.
Definition: ad9656.c:118
AD9656_REG_USER_TEST_PATTERN_1_LSB
#define AD9656_REG_USER_TEST_PATTERN_1_LSB
Definition: ad9656.h:55
AD9656_TEST_OFF
#define AD9656_TEST_OFF
Definition: ad9656.h:72
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
AD9656_REG_JESD204B_QUICK_CONFIG
#define AD9656_REG_JESD204B_QUICK_CONFIG
Definition: ad9656.h:62
AD9656_REG_CHIP_ID
#define AD9656_REG_CHIP_ID
Definition: ad9656.h:51
ad9656_reg_read
int32_t ad9656_reg_read(struct ad9656_dev *dev, uint16_t reg_addr, uint8_t *reg_data)
Reads from the ad9656 that is contected to the SPI.
Definition: ad9656.c:58
AD9656_REG_JESD204B_LANE_RATE_CTRL
#define AD9656_REG_JESD204B_LANE_RATE_CTRL
Definition: ad9656.h:60
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
ad9656_user_input_test
int32_t ad9656_user_input_test(struct ad9656_dev *dev, uint32_t test_mode, struct ad9656_user_input_test_pattern user_input_test_pattern)
Launch the user input test functionality for the receive path for the ad9656 chip....
Definition: ad9656.c:147
ad9656_JESD204_test
int32_t ad9656_JESD204_test(struct ad9656_dev *dev, uint32_t test_mode)
Launch the JESD204 test functionality for the receive path for the ad9656 chip.
Definition: ad9656.c:118
ad9656_init_param::spi_init
struct no_os_spi_init_param spi_init
Definition: ad9656.h:89
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
AD9656_REG_JESD204B_M_CTRL
#define AD9656_REG_JESD204B_M_CTRL
Definition: ad9656.h:65
ad9656_setup
int32_t ad9656_setup(struct ad9656_dev **device, const struct ad9656_init_param *init_param)
Setup the working parameters of the ad9656 chip.
Definition: ad9656.c:183
ad9656_remove
int32_t ad9656_remove(struct ad9656_dev *dev)
Free the resources allocated by ad9656_setup().
Definition: ad9656.c:287
ad9656_reg_write
int32_t ad9656_reg_write(struct ad9656_dev *dev, uint16_t reg_addr, uint8_t reg_data)
Write to the ad9656 that is conected to the SPI.
Definition: ad9656.c:91
AD9656_REG_LINK_CONTROL
#define AD9656_REG_LINK_CONTROL
Definition: ad9656.h:59
AD9656_REG_USER_TEST_PATTERN_2_MSB
#define AD9656_REG_USER_TEST_PATTERN_2_MSB
Definition: ad9656.h:58
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