no-OS
api_def.h
Go to the documentation of this file.
1 
14 #ifndef __API_DEF_H__
15 #define __API_DEF_H__
16 #include <stdint.h>
17 #include "no_os_util.h"
18 
19 #define ADI_POW2_48 ((uint64_t)1u << 48)
20 #define ADI_MAXUINT48 (ADI_POW2_48 - 1)
21 
22 #define ADI_POW2_32 ((uint64_t)1u << 32)
23 #define ADI_MAXUINT32 (ADI_POW2_32 - 1)
24 #define ADI_MAXUINT24 (0xFFFFFF)
25 #define ADI_GET_BYTE(w, p) (uint8_t)(((w) >> (p)) & 0xFF)
26 #define ALL -1
27 
28 #define DIV_U64_REM(x, y, r) no_os_div64_u64_rem(x, y, r)
29 #ifndef NO_OS_DIV_U64
30 #define NO_OS_DIV_U64(x, y) no_os_div_u64(x, y)
31 #endif
32 #define DIV_S64(x, y) no_os_div_s64(x, y)
33 
47 typedef int (*spi_xfer_t) (void *user_data, uint8_t *indata, uint8_t *outdata,
48  int size_bytes);
49 
62 typedef int (*delay_us_t) (void *user_data, unsigned int us);
63 
80 typedef int (*hw_open_t) (void *user_data);
81 
98 typedef int (*hw_close_t) (void *user_data);
113 typedef int (*event_handler_t) (uint16_t event, uint8_t ref, void *data);
114 
133 typedef int (*tx_en_pin_ctrl_t) (void *user_data, uint8_t enable);
134 
152 typedef int (*reset_pin_ctrl_t) (void *user_data, uint8_t enable);
153 
155 struct adi_reg_data {
157  uint16_t reg;
159  uint8_t val;
160 };
161 
163 typedef struct {
165  uint8_t chip_type;
167  uint16_t prod_id;
169  uint8_t prod_grade;
171  uint8_t dev_revision;
172 } adi_chip_id_t;
173 
175 typedef enum {
176  /* Keep this invalid value as 0, so the API can test for wrong setting. */
177  SPI_NONE = 0,
178  /*
179  * Set SPI SDO (Serial Data Output) pin as active.
180  * This is in case the 4-wire SPI is needed.
181  */
182  SPI_SDO = 1,
183  /*
184  * Set SPI SDIO (Serial Data Input-Output) pin as active.
185  * This is in case the 3-wire SPI is needed.
186  */
187  SPI_SDIO = 2,
188  /* Keep it last. */
191 
193 typedef enum {
197 } signal_type_t;
198 
200 typedef enum {
205 
207 typedef enum {
208  JESD_LINK_0 = 0x0,
209  JESD_LINK_1 = 0x1,
211 } jesd_link_t;
212 
214 typedef enum {
215  SYNCOUTB_0 = 0x0,
216  SYNCOUTB_1 = 0x1,
217  SYNCOUTB_ALL = 0xFF
219 
221 typedef enum {
222  SYSREF_NONE = 0x0,
228 
230 typedef struct {
231  uint8_t jesd_L;
232  uint8_t jesd_F;
233  uint8_t jesd_M;
234  uint8_t jesd_S;
236  uint8_t jesd_HD;
237  uint8_t jesd_K;
238  uint8_t jesd_N;
239  uint8_t jesd_NP;
240  uint8_t jesd_CF;
241  uint8_t jesd_CS;
243  uint8_t jesd_DID;
244  uint8_t jesd_BID;
245  uint8_t jesd_LID0;
246  uint8_t jesd_JESDV;
247 } jesd_param_t;
248 
250 typedef enum {
255 
257 typedef enum {
264 
265 #endif /* !__API_DEF_H__ */
SYNCOUTB_0
@ SYNCOUTB_0
Definition: api_def.h:215
PRBS_NONE
@ PRBS_NONE
Definition: api_def.h:258
SPI_SDO
@ SPI_SDO
Definition: api_def.h:182
SIGNAL_CMOS
@ SIGNAL_CMOS
Definition: api_def.h:194
PRBS31
@ PRBS31
Definition: api_def.h:261
PRBS7
@ PRBS7
Definition: api_def.h:259
API_ERROR_INVALID_HANDLE_PTR
#define API_ERROR_INVALID_HANDLE_PTR
Definition: api_errors.h:29
adi_reg_data
Definition: api_def.h:155
jesd_param_t::jesd_CS
uint8_t jesd_CS
Definition: api_def.h:241
AD9208_FD_LT_LSB
#define AD9208_FD_LT_LSB(x)
Definition: ad9208_reg.h:114
tx_en_pin_ctrl_t
int(* tx_en_pin_ctrl_t)(void *user_data, uint8_t enable)
TX_ENABLE PIN CONTROL FUNCTION.
Definition: api_def.h:133
SIGNAL_UNKNOWN
@ SIGNAL_UNKNOWN
Definition: api_def.h:196
signal_type_t
signal_type_t
Definition: api_def.h:193
FD_THRESHOLD_MAG_DBFS_MAX
#define FD_THRESHOLD_MAG_DBFS_MAX
Definition: ad9208_signal_monitor_api.c:18
JESD_SUBCLASS_0
@ JESD_SUBCLASS_0
Definition: api_def.h:251
AD9208_FD_DWELL_MSB
#define AD9208_FD_DWELL_MSB(x)
Definition: ad9208_reg.h:121
AD9208_FD_UT_LSB
#define AD9208_FD_UT_LSB(x)
Definition: ad9208_reg.h:110
jesd_param_t::jesd_L
uint8_t jesd_L
Definition: api_def.h:231
ad9208_handle_t
Definition: ad9208_api.h:78
COUPLING_DC
@ COUPLING_DC
Definition: api_def.h:202
jesd_param_t::jesd_N
uint8_t jesd_N
Definition: api_def.h:238
ad9208_register_read
int ad9208_register_read(ad9208_handle_t *h, const uint16_t address, uint8_t *data)
Perform SPI register read access to AD9208 Device.
Definition: ad9208_reg.c:40
SYSREF_CONT
@ SYSREF_CONT
Definition: api_def.h:224
adi_reg_data::val
uint8_t val
Definition: api_def.h:159
hw_close_t
int(* hw_close_t)(void *user_data)
Closes any platform hardware resources for the AD9164 Device.
Definition: api_def.h:98
SYNCOUTB_1
@ SYNCOUTB_1
Definition: api_def.h:216
AD9208_FD_UT_LSB_REG
#define AD9208_FD_UT_LSB_REG
Definition: ad9208_reg.h:109
JESD_LINK_0
@ JESD_LINK_0
Definition: api_def.h:208
event_handler_t
int(* event_handler_t)(uint16_t event, uint8_t ref, void *data)
Client Event Handler.
Definition: api_def.h:113
SIGNAL_LVDS
@ SIGNAL_LVDS
Definition: api_def.h:195
spi_sdo_config_t
spi_sdo_config_t
Definition: api_def.h:175
AD9208_FD_DWELL_MSB_REG
#define AD9208_FD_DWELL_MSB_REG
Definition: ad9208_reg.h:120
JESD_SUBCLASS_INVALID
@ JESD_SUBCLASS_INVALID
Definition: api_def.h:253
AD9208_FD_LT_MSB
#define AD9208_FD_LT_MSB(x)
Definition: ad9208_reg.h:116
jesd_param_t::jesd_S
uint8_t jesd_S
Definition: api_def.h:234
signal_coupling_t
signal_coupling_t
Definition: api_def.h:200
AD9208_FD_UT_MSB_REG
#define AD9208_FD_UT_MSB_REG
Definition: ad9208_reg.h:111
jesd_prbs_pattern_t
jesd_prbs_pattern_t
Definition: api_def.h:257
adi_chip_id_t::dev_revision
uint8_t dev_revision
Definition: api_def.h:171
jesd_param_t::jesd_NP
uint8_t jesd_NP
Definition: api_def.h:239
jesd_param_t
Definition: api_def.h:230
SYSREF_MODE_INVLD
@ SYSREF_MODE_INVLD
Definition: api_def.h:226
FD_DWELL_CLK_CYCLES_MAX
#define FD_DWELL_CLK_CYCLES_MAX
Definition: ad9208_signal_monitor_api.c:19
AD9208_FD_UT_MSB
#define AD9208_FD_UT_MSB(x)
Definition: ad9208_reg.h:112
jesd_param_t::jesd_LID0
uint8_t jesd_LID0
Definition: api_def.h:245
jesd_sysref_mode_t
jesd_sysref_mode_t
Definition: api_def.h:221
SPI_CONFIG_MAX
@ SPI_CONFIG_MAX
Definition: api_def.h:189
AD9208_FD_LT_MSB_REG
#define AD9208_FD_LT_MSB_REG
Definition: ad9208_reg.h:115
ad9208_adc_set_fd_thresholds
int ad9208_adc_set_fd_thresholds(ad9208_handle_t *h, uint16_t upper_dbfs, uint16_t lower_dbfs, uint16_t dwell_time)
Configure The Fast Detect Overange Signal Thresholds.
Definition: ad9208_signal_monitor_api.c:40
jesd_param_t::jesd_F
uint8_t jesd_F
Definition: api_def.h:232
JESD_LINK_1
@ JESD_LINK_1
Definition: api_def.h:209
ad9208_adc_get_overange_status
int ad9208_adc_get_overange_status(ad9208_handle_t *h, uint8_t *status)
Get ADC Over range Status.
Definition: ad9208_signal_monitor_api.c:21
PRBS_MAX
@ PRBS_MAX
Definition: api_def.h:262
delay_us_t
int(* delay_us_t)(void *user_data, unsigned int us)
Delay for specified number of microseconds. Platform Dependant.
Definition: api_def.h:62
jesd_param_t::jesd_HD
uint8_t jesd_HD
Definition: api_def.h:236
api_errors.h
API error codes header file.
jesd_subclass_t
jesd_subclass_t
Definition: api_def.h:250
jesd_param_t::jesd_BID
uint8_t jesd_BID
Definition: api_def.h:244
jesd_param_t::jesd_JESDV
uint8_t jesd_JESDV
Definition: api_def.h:246
spi_xfer_t
int(* spi_xfer_t)(void *user_data, uint8_t *indata, uint8_t *outdata, int size_bytes)
Platform dependent SPI access functions.
Definition: api_def.h:47
COUPLING_UNKNOWN
@ COUPLING_UNKNOWN
Definition: api_def.h:203
reset_pin_ctrl_t
int(* reset_pin_ctrl_t)(void *user_data, uint8_t enable)
RESETB PIN CONTROL FUNCTION.
Definition: api_def.h:152
SYSREF_NONE
@ SYSREF_NONE
Definition: api_def.h:222
SYSREF_MON
@ SYSREF_MON
Definition: api_def.h:225
SYNCOUTB_ALL
@ SYNCOUTB_ALL
Definition: api_def.h:217
ad9208_reg.h
AD9208 SPI Register Definition Header File.
ad9208_api.h
API_ERROR_INVALID_PARAM
#define API_ERROR_INVALID_PARAM
Definition: api_errors.h:35
AD9208_FD_DWELL_LSB_REG
#define AD9208_FD_DWELL_LSB_REG
Definition: ad9208_reg.h:118
adi_chip_id_t::chip_type
uint8_t chip_type
Definition: api_def.h:165
jesd_param_t::jesd_K
uint8_t jesd_K
Definition: api_def.h:237
COUPLING_AC
@ COUPLING_AC
Definition: api_def.h:201
NULL
#define NULL
Definition: wrapper.h:64
AD9208_OP_OVERANGE_STAT_REG
#define AD9208_OP_OVERANGE_STAT_REG
Definition: ad9208_reg.h:192
JESD_LINK_ALL
@ JESD_LINK_ALL
Definition: api_def.h:210
adi_chip_id_t
Definition: api_def.h:163
JESD_SUBCLASS_1
@ JESD_SUBCLASS_1
Definition: api_def.h:252
jesd_param_t::jesd_M
uint8_t jesd_M
Definition: api_def.h:233
AD9208_FD_DWELL_LSB
#define AD9208_FD_DWELL_LSB(x)
Definition: ad9208_reg.h:119
API_ERROR_OK
#define API_ERROR_OK
Definition: api_errors.h:25
jesd_param_t::jesd_CF
uint8_t jesd_CF
Definition: api_def.h:240
SPI_NONE
@ SPI_NONE
Definition: api_def.h:177
hw_open_t
int(* hw_open_t)(void *user_data)
Platform hardware initialisation for the AD9164 Device.
Definition: api_def.h:80
jesd_link_t
jesd_link_t
Definition: api_def.h:207
no_os_util.h
Header file of utility functions.
adi_chip_id_t::prod_grade
uint8_t prod_grade
Definition: api_def.h:169
AD9208_OP_OVERANGE_CLR_REG
#define AD9208_OP_OVERANGE_CLR_REG
Definition: ad9208_reg.h:191
jesd_param_t::jesd_DID
uint8_t jesd_DID
Definition: api_def.h:243
adi_reg_data::reg
uint16_t reg
Definition: api_def.h:157
adi_chip_id_t::prod_id
uint16_t prod_id
Definition: api_def.h:167
PRBS15
@ PRBS15
Definition: api_def.h:260
SYSREF_ONESHOT
@ SYSREF_ONESHOT
Definition: api_def.h:223
SPI_SDIO
@ SPI_SDIO
Definition: api_def.h:187
ad9208_register_write
int ad9208_register_write(ad9208_handle_t *h, const uint16_t address, const uint8_t data)
Perform SPI register write access to AD9208 Device.
Definition: ad9208_reg.c:20
jesd_syncoutb_t
jesd_syncoutb_t
Definition: api_def.h:214