no-OS
axi_jesd204_rx.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef AXI_JESD204_RX_H_
40 #define AXI_JESD204_RX_H_
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 #include <stdint.h>
46 #include <stdbool.h>
47 #include "jesd204.h"
48 
49 /******************************************************************************/
50 /*************************** Types Declarations *******************************/
51 /******************************************************************************/
56 };
57 
64  const char *name;
66  uint32_t base;
68  uint32_t version;
69  /* Number of lanes of the peripheral */
70  uint32_t num_lanes;
72  uint32_t data_path_width;
78  uint32_t device_clk_khz;
80  uint32_t lane_clk_khz;
83 
84  struct jesd204_dev *jdev;
85 };
86 
93  const char *name;
95  uint32_t base;
101  uint8_t subclass;
103  uint32_t device_clk_khz;
105  uint32_t lane_clk_khz;
106 };
107 
108 /******************************************************************************/
109 /************************ Functions Declarations ******************************/
110 /******************************************************************************/
112 int32_t axi_jesd204_rx_lane_clk_enable(struct axi_jesd204_rx *jesd);
114 int32_t axi_jesd204_rx_lane_clk_disable(struct axi_jesd204_rx *jesd);
116 uint32_t axi_jesd204_rx_status_read(struct axi_jesd204_rx *jesd);
118 int32_t axi_jesd204_rx_laneinfo_read(struct axi_jesd204_rx *jesd,
119  uint32_t lane);
121 int32_t axi_jesd204_rx_watchdog(struct axi_jesd204_rx *jesd);
123 int32_t axi_jesd204_rx_init(struct axi_jesd204_rx **jesd204,
124  const struct jesd204_rx_init *init);
126 int32_t axi_jesd204_rx_init_jesd_fsm(struct axi_jesd204_rx **jesd204,
127  const struct jesd204_rx_init *init);
129 int32_t axi_jesd204_rx_remove(struct axi_jesd204_rx *jesd);
130 #endif
JESD204_LINK_STATUS_DATA
#define JESD204_LINK_STATUS_DATA
Definition: axi_jesd204_rx.c:85
JESD204_RX_REG_MAGIC
#define JESD204_RX_REG_MAGIC
Definition: axi_jesd204_rx.c:57
axi_jesd204_rx_apply_config_legacy
int32_t axi_jesd204_rx_apply_config_legacy(struct axi_jesd204_rx *jesd, struct jesd204_rx_config *config)
Apply the JESD204 RX configuration.
Definition: axi_jesd204_rx.c:571
JESD204_RX_REG_LINK_CONF2
#define JESD204_RX_REG_LINK_CONF2
Definition: axi_jesd204_rx.c:81
JESD204_RX_REG_ILAS
#define JESD204_RX_REG_ILAS(x, y)
Definition: axi_jesd204_rx.c:93
JESD204_EMB_STATE_GET
#define JESD204_EMB_STATE_GET(x)
Definition: axi_jesd204_rx.c:89
ADI_AXI_PCORE_VER
#define ADI_AXI_PCORE_VER(major, minor, patch)
Definition: axi_jesd204_rx.c:106
dev_err
#define dev_err(dev, format,...)
Definition: ad9361_util.h:69
jesd204_rx_config::subclass_version
uint8_t subclass_version
Definition: axi_jesd204_rx.h:55
axi_jesd204_rx::num_lanes
uint32_t num_lanes
Definition: axi_jesd204_rx.h:70
jesd204_dev_data::state_ops
struct jesd204_state_op state_ops[__JESD204_MAX_OPS]
Definition: jesd204.h:232
JESD204_STATE_OP_REASON_INIT
@ JESD204_STATE_OP_REASON_INIT
Definition: jesd204.h:148
axi_jesd204_rx_check_lane_status
bool axi_jesd204_rx_check_lane_status(struct axi_jesd204_rx *jesd, uint32_t lane)
Check JESD204 RX Lane Status.
Definition: axi_jesd204_rx.c:447
axi_jesd204_rx_lane_clk_disable
int32_t axi_jesd204_rx_lane_clk_disable(struct axi_jesd204_rx *jesd)
JESD204 RX Lane Clock Disable.
Definition: axi_jesd204_rx.c:206
jesd204_rx_init::frames_per_multiframe
uint16_t frames_per_multiframe
Definition: axi_jesd204_rx.h:99
jesd204_rx_init::lane_clk_khz
uint32_t lane_clk_khz
Definition: axi_jesd204_rx.h:105
axi_jesd204_rx::data_path_width
uint32_t data_path_width
Definition: axi_jesd204_rx.h:72
axi_jesd204_rx::base
uint32_t base
Definition: axi_jesd204_rx.h:66
axi_jesd204_rx::jdev
struct jesd204_dev * jdev
Definition: axi_jesd204_rx.h:84
pr_err
#define pr_err(fmt, args...)
Definition: no_os_print_log.h:94
no_os_delay.h
Header file of Delay functions.
axi_jesd204_rx_status_read
uint32_t axi_jesd204_rx_status_read(struct axi_jesd204_rx *jesd)
Read status of the JESD204 Receive Peripherial.
Definition: axi_jesd204_rx.c:216
JESD204_ENCODER_8B10B
@ JESD204_ENCODER_8B10B
Definition: jesd204.h:30
JESD204_RX_REG_SYNTH_NUM_LANES
#define JESD204_RX_REG_SYNTH_NUM_LANES
Definition: axi_jesd204_rx.c:59
jesd204_state_op_reason
jesd204_state_op_reason
Definition: jesd204.h:147
pr_info
#define pr_info(fmt, args...)
Definition: no_os_print_log.h:121
NO_OS_DIV_ROUND_CLOSEST_ULL
#define NO_OS_DIV_ROUND_CLOSEST_ULL(x, y)
Definition: no_os_util.h:60
JESD204_RX_REG_LINK_DISABLE
#define JESD204_RX_REG_LINK_DISABLE
Definition: axi_jesd204_rx.c:66
JESD204_RX_REG_LANE_ERRORS
#define JESD204_RX_REG_LANE_ERRORS(x)
Definition: axi_jesd204_rx.c:92
axi_jesd204_rx_link_status_label
const char * axi_jesd204_rx_link_status_label[]
Definition: axi_jesd204_rx.c:119
JESD204_EMB_STATE_INIT
@ JESD204_EMB_STATE_INIT
Definition: axi_jesd204_rx.c:114
axi_jesd204_rx_status_read
uint32_t axi_jesd204_rx_status_read(struct axi_jesd204_rx *jesd)
Read status of the JESD204 Receive Peripherial.
Definition: axi_jesd204_rx.c:216
JESD204_RX_ENCODER_GET
#define JESD204_RX_ENCODER_GET(x)
Definition: axi_jesd204_rx.c:64
no_os_print_log.h
Print messages helpers.
jesd204_rx_config::octets_per_frame
uint8_t octets_per_frame
Definition: axi_jesd204_rx.h:53
axi_jesd204_rx_jesd204_priv
Definition: axi_jesd204_rx.c:151
axi_jesd204_rx::tpl_data_path_width
uint32_t tpl_data_path_width
Definition: axi_jesd204_rx.h:74
axi_jesd204_rx_link_status_64b66b_l
const char * axi_jesd204_rx_link_status_64b66b_l[]
Definition: axi_jesd204_rx.c:133
axi_jesd204_rx_init
int32_t axi_jesd204_rx_init(struct axi_jesd204_rx **jesd204, const struct jesd204_rx_init *init)
Device initialization.
Definition: axi_jesd204_rx.c:835
no_os_axi_io.h
Header file of AXI IO.
axi_jesd204_rx_remove
int32_t axi_jesd204_rx_remove(struct axi_jesd204_rx *jesd)
Free resoulces allocated for JESD204 RX peripheral.
Definition: axi_jesd204_rx.c:984
jesd204_rx_init::name
const char * name
Definition: axi_jesd204_rx.h:93
axi_jesd204_rx::version
uint32_t version
Definition: axi_jesd204_rx.h:68
JESD204_RX_REG_SYSREF_CONF_SYSREF_DISABLE
#define JESD204_RX_REG_SYSREF_CONF_SYSREF_DISABLE
Definition: axi_jesd204_rx.c:71
JESD204_STATE_OP_REASON_UNINIT
@ JESD204_STATE_OP_REASON_UNINIT
Definition: jesd204.h:149
jesd204_rx_init::octets_per_frame
uint8_t octets_per_frame
Definition: axi_jesd204_rx.h:97
JESD204_RX_LINK_CONF2_BUFFER_EARLY_RELEASE
#define JESD204_RX_LINK_CONF2_BUFFER_EARLY_RELEASE
Definition: axi_jesd204_rx.c:82
JESD204_LMFC_OFFSET_UNINITIALIZED
#define JESD204_LMFC_OFFSET_UNINITIALIZED
Definition: jesd204.h:51
axi_jesd204_rx_init
int32_t axi_jesd204_rx_init(struct axi_jesd204_rx **jesd204, const struct jesd204_rx_init *init)
Device initialization.
Definition: axi_jesd204_rx.c:835
jesd204_rx_config
Definition: axi_jesd204_rx.h:52
jesd204_dev_priv
void * jesd204_dev_priv(struct jesd204_dev *jdev)
JESD204_RX_REG_SYNTH_REG_1
#define JESD204_RX_REG_SYNTH_REG_1
Definition: axi_jesd204_rx.c:62
axi_jesd204_rx_init_jesd_fsm
int32_t axi_jesd204_rx_init_jesd_fsm(struct axi_jesd204_rx **jesd204, const struct jesd204_rx_init *init)
Device initialization, JESD FSM ON.
Definition: axi_jesd204_rx.c:911
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:132
jesd204_link_get_device_clock
int jesd204_link_get_device_clock(struct jesd204_link *lnk, unsigned long *device_clock)
axi_jesd204_rx_lane_clk_enable
int32_t axi_jesd204_rx_lane_clk_enable(struct axi_jesd204_rx *jesd)
JESD204 RX Lane Clock Enable.
Definition: axi_jesd204_rx.c:193
JESD204_OP_CLOCKS_ENABLE
@ JESD204_OP_CLOCKS_ENABLE
Definition: jesd204.h:210
JESD204_RX_REG_LINK_CONF0
#define JESD204_RX_REG_LINK_CONF0
Definition: axi_jesd204_rx.c:77
no_os_error.h
Error codes definition.
pr_debug
#define pr_debug(fmt, args...)
Definition: no_os_print_log.h:135
axi_jesd204_rx_init_jesd_fsm
int32_t axi_jesd204_rx_init_jesd_fsm(struct axi_jesd204_rx **jesd204, const struct jesd204_rx_init *init)
Device initialization, JESD FSM ON.
Definition: axi_jesd204_rx.c:911
axi_jesd204_rx::device_clk_khz
uint32_t device_clk_khz
Definition: axi_jesd204_rx.h:78
jesd204_rx_init::subclass
uint8_t subclass
Definition: axi_jesd204_rx.h:101
axi_jesd204_rx_remove
int32_t axi_jesd204_rx_remove(struct axi_jesd204_rx *jesd)
Free resoulces allocated for JESD204 RX peripheral.
Definition: axi_jesd204_rx.c:984
JESD204_RX_REG_LINK_CONF4
#define JESD204_RX_REG_LINK_CONF4
Definition: axi_jesd204_rx.c:79
jesd204.h
JESD204_RX_REG_LINK_STATE
#define JESD204_RX_REG_LINK_STATE
Definition: axi_jesd204_rx.c:67
axi_jesd204_rx::encoder
enum jesd204_encoder encoder
Definition: axi_jesd204_rx.h:82
JESD204_RX_REG_LANE_LATENCY
#define JESD204_RX_REG_LANE_LATENCY(x)
Definition: axi_jesd204_rx.c:91
jesd204_rx_config::frames_per_multiframe
uint16_t frames_per_multiframe
Definition: axi_jesd204_rx.h:54
JESD204_ENCODER_MAX
@ JESD204_ENCODER_MAX
Definition: jesd204.h:34
jesd204_rx_init::device_clk_khz
uint32_t device_clk_khz
Definition: axi_jesd204_rx.h:103
axi_jesd204_rx_read
int32_t axi_jesd204_rx_read(struct axi_jesd204_rx *jesd, uint32_t reg_addr, uint32_t *reg_val)
JESD204 RX AXI Data Read.
Definition: axi_jesd204_rx.c:180
JESD204_RX_REG_SYNTH_DATA_PATH_WIDTH
#define JESD204_RX_REG_SYNTH_DATA_PATH_WIDTH
Definition: axi_jesd204_rx.c:60
PCORE_VERSION_MAJOR
#define PCORE_VERSION_MAJOR(x)
Definition: axi_jesd204_rx.c:109
JESD204_OP_LINK_ENABLE
@ JESD204_OP_LINK_ENABLE
Definition: jesd204.h:211
axi_jesd204_rx_emb_state_label
const char * axi_jesd204_rx_emb_state_label[]
Definition: axi_jesd204_rx.c:140
no_os_axi_io_read
int32_t no_os_axi_io_read(uint32_t base, uint32_t offset, uint32_t *data)
AXI IO Altera specific read function.
Definition: altera_axi_io.c:59
JESD204_ENCODER_64B66B
@ JESD204_ENCODER_64B66B
Definition: jesd204.h:31
JESD204_SYNTH_DATA_PATH_WIDTH_GET
#define JESD204_SYNTH_DATA_PATH_WIDTH_GET(x)
Definition: axi_jesd204_rx.c:102
PCORE_VERSION_PATCH
#define PCORE_VERSION_PATCH(x)
Definition: axi_jesd204_rx.c:111
JESD204_STATE_CHANGE_ERROR
@ JESD204_STATE_CHANGE_ERROR
Definition: jesd204.h:44
axi_jesd204_rx::config
struct jesd204_rx_config config
Definition: axi_jesd204_rx.h:76
JESD204_OP_LINK_PRE_SETUP
@ JESD204_OP_LINK_PRE_SETUP
Definition: jesd204.h:200
JESD204_SUBCLASS_0
@ JESD204_SUBCLASS_0
Definition: jesd204.h:16
axi_jesd204_rx_watchdog
int32_t axi_jesd204_rx_watchdog(struct axi_jesd204_rx *jesd)
JESD204 RX Watchdog.
Definition: axi_jesd204_rx.c:483
axi_jesd204_rx_jesd204_priv::jesd
struct axi_jesd204_rx * jesd
Definition: axi_jesd204_rx.c:152
JESD204_RX_REG_SYSREF_STATUS
#define JESD204_RX_REG_SYSREF_STATUS
Definition: axi_jesd204_rx.c:75
JESD204_EMB_STATE_LOCK
@ JESD204_EMB_STATE_LOCK
Definition: axi_jesd204_rx.c:116
axi_jesd204_rx_lane_status_label
const char * axi_jesd204_rx_lane_status_label[]
Definition: axi_jesd204_rx.c:126
axi_jesd204_rx_watchdog
int32_t axi_jesd204_rx_watchdog(struct axi_jesd204_rx *jesd)
JESD204 RX Watchdog.
Definition: axi_jesd204_rx.c:483
NO_OS_BIT
#define NO_OS_BIT(x)
Definition: no_os_util.h:51
JESD204_RX_REG_LINK_STATUS
#define JESD204_RX_REG_LINK_STATUS
Definition: axi_jesd204_rx.c:84
axi_jesd204_rx_laneinfo_read
int32_t axi_jesd204_rx_laneinfo_read(struct axi_jesd204_rx *jesd, uint32_t lane)
Read JESD204 RX Lane Info.
Definition: axi_jesd204_rx.c:419
jesd204_dev_register
int jesd204_dev_register(struct jesd204_dev **jdev, const struct jesd204_dev_data *dev_data)
JESD204_TPL_DATA_PATH_WIDTH_GET
#define JESD204_TPL_DATA_PATH_WIDTH_GET(x)
Definition: axi_jesd204_rx.c:104
JESD204_EMB_STATE_HUNT
@ JESD204_EMB_STATE_HUNT
Definition: axi_jesd204_rx.c:115
jesd204_encoder
jesd204_encoder
Definition: jesd204.h:28
JESD204_RX_REG_SYSREF_LMFC_OFFSET
#define JESD204_RX_REG_SYSREF_LMFC_OFFSET
Definition: axi_jesd204_rx.c:73
axi_jesd204_rx_laneinfo_read
int32_t axi_jesd204_rx_laneinfo_read(struct axi_jesd204_rx *jesd, uint32_t lane)
Read JESD204 RX Lane Info.
Definition: axi_jesd204_rx.c:419
axi_jesd204_rx
Definition: axi_jesd204_rx.h:62
JESD204_RX_REG_VERSION
#define JESD204_RX_REG_VERSION
Definition: axi_jesd204_rx.c:56
jesd204_link_get_rate_khz
int jesd204_link_get_rate_khz(struct jesd204_link *lnk, unsigned long *lane_rate_khz)
JESD204_STATE_CHANGE_DONE
@ JESD204_STATE_CHANGE_DONE
Definition: jesd204.h:46
axi_jesd204_rx.h
Driver for the Analog Devices AXI-JESD204-RX peripheral.
no_os_axi_io_write
int32_t no_os_axi_io_write(uint32_t base, uint32_t offset, uint32_t data)
AXI IO Altera specific write function.
Definition: altera_axi_io.c:73
jesd204_rx_init::base
uint32_t base
Definition: axi_jesd204_rx.h:95
JESD204_RX_MAGIC
#define JESD204_RX_MAGIC
Definition: axi_jesd204_rx.c:98
jesd204_rx_init
JESD204B/C Receive Peripheral Initialization Structure.
Definition: axi_jesd204_rx.h:91
axi_jesd204_rx_write
int32_t axi_jesd204_rx_write(struct axi_jesd204_rx *jesd, uint32_t reg_addr, uint32_t reg_val)
JESD204 RX AXI Data Write.
Definition: axi_jesd204_rx.c:165
JESD204_ENCODER_UNKNOWN
@ JESD204_ENCODER_UNKNOWN
Definition: jesd204.h:29
jesd204_state_op::per_link
jesd204_link_cb per_link
Definition: jesd204.h:192
clk_prepare_enable
int32_t clk_prepare_enable(struct no_os_clk *clk)
clk_prepare_enable
Definition: ad9361_util.c:55
axi_jesd204_rx_get_lane_errors
int32_t axi_jesd204_rx_get_lane_errors(struct axi_jesd204_rx *jesd, uint32_t lane, uint32_t *errors)
Read the JESD204 RX Lane Errors.
Definition: axi_jesd204_rx.c:301
axi_jesd204_rx::lane_clk_khz
uint32_t lane_clk_khz
Definition: axi_jesd204_rx.h:80
axi_jesd204_rx::name
const char * name
Definition: axi_jesd204_rx.h:64
no_os_util.h
Header file of utility functions.
PCORE_VERSION_MINOR
#define PCORE_VERSION_MINOR(x)
Definition: axi_jesd204_rx.c:110
JESD204_RX_REG_SYSREF_CONF
#define JESD204_RX_REG_SYSREF_CONF
Definition: axi_jesd204_rx.c:70
axi_jesd204_rx_lane_clk_disable
int32_t axi_jesd204_rx_lane_clk_disable(struct axi_jesd204_rx *jesd)
JESD204 RX Lane Clock Disable.
Definition: axi_jesd204_rx.c:206
JESD204_OP_LINK_RUNNING
@ JESD204_OP_LINK_RUNNING
Definition: jesd204.h:212
jesd204_dev_data
JESD204 device initialization data.
Definition: jesd204.h:227
axi_jesd204_rx_lane_clk_enable
int32_t axi_jesd204_rx_lane_clk_enable(struct axi_jesd204_rx *jesd)
JESD204 RX Lane Clock Enable.
Definition: axi_jesd204_rx.c:193
JESD204_RX_REG_LANE_STATUS
#define JESD204_RX_REG_LANE_STATUS(x)
Definition: axi_jesd204_rx.c:87
NO_OS_DIV_ROUND_CLOSEST
#define NO_OS_DIV_ROUND_CLOSEST(x, y)
Definition: no_os_util.h:58
JESD204_OP_LINK_SETUP
@ JESD204_OP_LINK_SETUP
Definition: jesd204.h:204
JESD204_RX_REG_LINK_CLK_RATIO
#define JESD204_RX_REG_LINK_CLK_RATIO
Definition: axi_jesd204_rx.c:68
no_os_div_u64
uint64_t no_os_div_u64(uint64_t dividend, uint32_t divisor)