no-OS
api_def.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0
15 #ifndef __API_DEF_H__
16 #define __API_DEF_H__
17 #include <stdint.h>
18 #include "no_os_util.h"
19 
20 #define ADI_POW2_48 ((uint64_t)1u << 48)
21 #define ADI_MAXUINT48 (ADI_POW2_48 - 1)
22 
23 #define ADI_POW2_32 ((uint64_t)1u << 32)
24 #define ADI_MAXUINT32 (ADI_POW2_32 - 1)
25 #define ADI_MAXUINT24 (0xFFFFFF)
26 #define ADI_GET_BYTE(w, p) (uint8_t)(((w) >> (p)) & 0xFF)
27 #define ALL -1
28 
29 #define DIV_U64_REM(x, y, r) no_os_div64_u64_rem(x, y, r)
30 #ifndef NO_OS_DIV_U64
31 #define NO_OS_DIV_U64(x, y) no_os_div_u64(x, y)
32 #endif
33 #define DIV_S64(x, y) no_os_div_s64(x, y)
34 
48 typedef int (*spi_xfer_t) (void *user_data, uint8_t *indata, uint8_t *outdata,
49  int size_bytes);
50 
63 typedef int (*delay_us_t) (void *user_data, unsigned int us);
64 
81 typedef int (*hw_open_t) (void *user_data);
82 
99 typedef int (*hw_close_t) (void *user_data);
114 typedef int (*event_handler_t) (uint16_t event, uint8_t ref, void *data);
115 
134 typedef int (*tx_en_pin_ctrl_t) (void *user_data, uint8_t enable);
135 
153 typedef int (*reset_pin_ctrl_t) (void *user_data, uint8_t enable);
154 
156 struct adi_reg_data {
158  uint16_t reg;
160  uint8_t val;
161 };
162 
164 typedef struct {
166  uint8_t chip_type;
168  uint16_t prod_id;
170  uint8_t prod_grade;
172  uint8_t dev_revision;
173 } adi_chip_id_t;
174 
176 typedef enum {
177  /* Keep this invalid value as 0, so the API can test for wrong setting. */
178  SPI_NONE = 0,
179  /*
180  * Set SPI SDO (Serial Data Output) pin as active.
181  * This is in case the 4-wire SPI is needed.
182  */
183  SPI_SDO = 1,
184  /*
185  * Set SPI SDIO (Serial Data Input-Output) pin as active.
186  * This is in case the 3-wire SPI is needed.
187  */
188  SPI_SDIO = 2,
189  /* Keep it last. */
192 
194 typedef enum {
198 } signal_type_t;
199 
201 typedef enum {
206 
208 typedef enum {
209  JESD_LINK_0 = 0x0,
210  JESD_LINK_1 = 0x1,
212 } jesd_link_t;
213 
215 typedef enum {
216  SYNCOUTB_0 = 0x0,
217  SYNCOUTB_1 = 0x1,
218  SYNCOUTB_ALL = 0xFF
220 
222 typedef enum {
223  SYSREF_NONE = 0x0,
229 
231 typedef struct {
232  uint8_t jesd_L;
233  uint8_t jesd_F;
234  uint8_t jesd_M;
235  uint8_t jesd_S;
237  uint8_t jesd_HD;
238  uint8_t jesd_K;
239  uint8_t jesd_N;
240  uint8_t jesd_NP;
241  uint8_t jesd_CF;
242  uint8_t jesd_CS;
244  uint8_t jesd_DID;
245  uint8_t jesd_BID;
246  uint8_t jesd_LID0;
247  uint8_t jesd_JESDV;
248 } jesd_param_t;
249 
251 typedef enum {
256 
258 typedef enum {
265 
266 #endif /* !__API_DEF_H__ */
SYNCOUTB_0
@ SYNCOUTB_0
Definition: api_def.h:216
PRBS_NONE
@ PRBS_NONE
Definition: api_def.h:259
SPI_SDO
@ SPI_SDO
Definition: api_def.h:183
SIGNAL_CMOS
@ SIGNAL_CMOS
Definition: api_def.h:195
PRBS31
@ PRBS31
Definition: api_def.h:262
PRBS7
@ PRBS7
Definition: api_def.h:260
API_ERROR_INVALID_HANDLE_PTR
#define API_ERROR_INVALID_HANDLE_PTR
Definition: api_errors.h:29
adi_reg_data
Definition: api_def.h:156
jesd_param_t::jesd_CS
uint8_t jesd_CS
Definition: api_def.h:242
AD9208_FD_LT_LSB
#define AD9208_FD_LT_LSB(x)
Definition: ad9208_reg.h:115
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:134
SIGNAL_UNKNOWN
@ SIGNAL_UNKNOWN
Definition: api_def.h:197
signal_type_t
signal_type_t
Definition: api_def.h:194
FD_THRESHOLD_MAG_DBFS_MAX
#define FD_THRESHOLD_MAG_DBFS_MAX
Definition: ad9208_signal_monitor_api.c:19
JESD_SUBCLASS_0
@ JESD_SUBCLASS_0
Definition: api_def.h:252
AD9208_FD_DWELL_MSB
#define AD9208_FD_DWELL_MSB(x)
Definition: ad9208_reg.h:122
AD9208_FD_UT_LSB
#define AD9208_FD_UT_LSB(x)
Definition: ad9208_reg.h:111
jesd_param_t::jesd_L
uint8_t jesd_L
Definition: api_def.h:232
ad9208_handle_t
Definition: ad9208_api.h:79
COUPLING_DC
@ COUPLING_DC
Definition: api_def.h:203
jesd_param_t::jesd_N
uint8_t jesd_N
Definition: api_def.h:239
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:41
SYSREF_CONT
@ SYSREF_CONT
Definition: api_def.h:225
adi_reg_data::val
uint8_t val
Definition: api_def.h:160
hw_close_t
int(* hw_close_t)(void *user_data)
Closes any platform hardware resources for the AD9164 Device.
Definition: api_def.h:99
SYNCOUTB_1
@ SYNCOUTB_1
Definition: api_def.h:217
AD9208_FD_UT_LSB_REG
#define AD9208_FD_UT_LSB_REG
Definition: ad9208_reg.h:110
JESD_LINK_0
@ JESD_LINK_0
Definition: api_def.h:209
event_handler_t
int(* event_handler_t)(uint16_t event, uint8_t ref, void *data)
Client Event Handler.
Definition: api_def.h:114
SIGNAL_LVDS
@ SIGNAL_LVDS
Definition: api_def.h:196
spi_sdo_config_t
spi_sdo_config_t
Definition: api_def.h:176
AD9208_FD_DWELL_MSB_REG
#define AD9208_FD_DWELL_MSB_REG
Definition: ad9208_reg.h:121
JESD_SUBCLASS_INVALID
@ JESD_SUBCLASS_INVALID
Definition: api_def.h:254
AD9208_FD_LT_MSB
#define AD9208_FD_LT_MSB(x)
Definition: ad9208_reg.h:117
jesd_param_t::jesd_S
uint8_t jesd_S
Definition: api_def.h:235
signal_coupling_t
signal_coupling_t
Definition: api_def.h:201
AD9208_FD_UT_MSB_REG
#define AD9208_FD_UT_MSB_REG
Definition: ad9208_reg.h:112
jesd_prbs_pattern_t
jesd_prbs_pattern_t
Definition: api_def.h:258
adi_chip_id_t::dev_revision
uint8_t dev_revision
Definition: api_def.h:172
jesd_param_t::jesd_NP
uint8_t jesd_NP
Definition: api_def.h:240
jesd_param_t
Definition: api_def.h:231
SYSREF_MODE_INVLD
@ SYSREF_MODE_INVLD
Definition: api_def.h:227
FD_DWELL_CLK_CYCLES_MAX
#define FD_DWELL_CLK_CYCLES_MAX
Definition: ad9208_signal_monitor_api.c:20
AD9208_FD_UT_MSB
#define AD9208_FD_UT_MSB(x)
Definition: ad9208_reg.h:113
jesd_param_t::jesd_LID0
uint8_t jesd_LID0
Definition: api_def.h:246
jesd_sysref_mode_t
jesd_sysref_mode_t
Definition: api_def.h:222
SPI_CONFIG_MAX
@ SPI_CONFIG_MAX
Definition: api_def.h:190
AD9208_FD_LT_MSB_REG
#define AD9208_FD_LT_MSB_REG
Definition: ad9208_reg.h:116
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:41
jesd_param_t::jesd_F
uint8_t jesd_F
Definition: api_def.h:233
JESD_LINK_1
@ JESD_LINK_1
Definition: api_def.h:210
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:22
PRBS_MAX
@ PRBS_MAX
Definition: api_def.h:263
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:63
jesd_param_t::jesd_HD
uint8_t jesd_HD
Definition: api_def.h:237
api_errors.h
API error codes header file.
jesd_subclass_t
jesd_subclass_t
Definition: api_def.h:251
jesd_param_t::jesd_BID
uint8_t jesd_BID
Definition: api_def.h:245
jesd_param_t::jesd_JESDV
uint8_t jesd_JESDV
Definition: api_def.h:247
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:48
COUPLING_UNKNOWN
@ COUPLING_UNKNOWN
Definition: api_def.h:204
reset_pin_ctrl_t
int(* reset_pin_ctrl_t)(void *user_data, uint8_t enable)
RESETB PIN CONTROL FUNCTION.
Definition: api_def.h:153
SYSREF_NONE
@ SYSREF_NONE
Definition: api_def.h:223
SYSREF_MON
@ SYSREF_MON
Definition: api_def.h:226
SYNCOUTB_ALL
@ SYNCOUTB_ALL
Definition: api_def.h:218
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:119
adi_chip_id_t::chip_type
uint8_t chip_type
Definition: api_def.h:166
jesd_param_t::jesd_K
uint8_t jesd_K
Definition: api_def.h:238
COUPLING_AC
@ COUPLING_AC
Definition: api_def.h:202
NULL
#define NULL
Definition: wrapper.h:64
AD9208_OP_OVERANGE_STAT_REG
#define AD9208_OP_OVERANGE_STAT_REG
Definition: ad9208_reg.h:193
JESD_LINK_ALL
@ JESD_LINK_ALL
Definition: api_def.h:211
adi_chip_id_t
Definition: api_def.h:164
JESD_SUBCLASS_1
@ JESD_SUBCLASS_1
Definition: api_def.h:253
jesd_param_t::jesd_M
uint8_t jesd_M
Definition: api_def.h:234
AD9208_FD_DWELL_LSB
#define AD9208_FD_DWELL_LSB(x)
Definition: ad9208_reg.h:120
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:241
SPI_NONE
@ SPI_NONE
Definition: api_def.h:178
hw_open_t
int(* hw_open_t)(void *user_data)
Platform hardware initialisation for the AD9164 Device.
Definition: api_def.h:81
jesd_link_t
jesd_link_t
Definition: api_def.h:208
no_os_util.h
Header file of utility functions.
adi_chip_id_t::prod_grade
uint8_t prod_grade
Definition: api_def.h:170
AD9208_OP_OVERANGE_CLR_REG
#define AD9208_OP_OVERANGE_CLR_REG
Definition: ad9208_reg.h:192
jesd_param_t::jesd_DID
uint8_t jesd_DID
Definition: api_def.h:244
adi_reg_data::reg
uint16_t reg
Definition: api_def.h:158
adi_chip_id_t::prod_id
uint16_t prod_id
Definition: api_def.h:168
PRBS15
@ PRBS15
Definition: api_def.h:261
SYSREF_ONESHOT
@ SYSREF_ONESHOT
Definition: api_def.h:224
SPI_SDIO
@ SPI_SDIO
Definition: api_def.h:188
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:21
jesd_syncoutb_t
jesd_syncoutb_t
Definition: api_def.h:215