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 #include "no_os_clk.h"
49 
50 /******************************************************************************/
51 /*************************** Types Declarations *******************************/
52 /******************************************************************************/
57 };
58 
65  const char *name;
67  uint32_t base;
69  uint32_t version;
70  /* Number of lanes of the peripheral */
71  uint32_t num_lanes;
73  uint32_t data_path_width;
79  uint32_t device_clk_khz;
81  uint32_t lane_clk_khz;
87  struct jesd204_dev *jdev;
88 };
89 
96  const char *name;
98  uint32_t base;
104  uint8_t subclass;
106  uint32_t device_clk_khz;
108  uint32_t lane_clk_khz;
111 };
112 
113 /******************************************************************************/
114 /************************ Functions Declarations ******************************/
115 /******************************************************************************/
117 int32_t axi_jesd204_rx_lane_clk_enable(struct axi_jesd204_rx *jesd);
119 int32_t axi_jesd204_rx_lane_clk_disable(struct axi_jesd204_rx *jesd);
121 uint32_t axi_jesd204_rx_status_read(struct axi_jesd204_rx *jesd);
123 int32_t axi_jesd204_rx_laneinfo_read(struct axi_jesd204_rx *jesd,
124  uint32_t lane);
126 int32_t axi_jesd204_rx_watchdog(struct axi_jesd204_rx *jesd);
128 int32_t axi_jesd204_rx_init_legacy(struct axi_jesd204_rx **jesd204,
129  const struct jesd204_rx_init *init);
131 int32_t axi_jesd204_rx_init(struct axi_jesd204_rx **jesd204,
132  const struct jesd204_rx_init *init);
134 int32_t axi_jesd204_rx_remove(struct axi_jesd204_rx *jesd);
135 #endif
JESD204_LINK_STATUS_DATA
#define JESD204_LINK_STATUS_DATA
Definition: axi_jesd204_rx.c:87
JESD204_RX_REG_MAGIC
#define JESD204_RX_REG_MAGIC
Definition: axi_jesd204_rx.c:59
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:573
JESD204_RX_REG_LINK_CONF2
#define JESD204_RX_REG_LINK_CONF2
Definition: axi_jesd204_rx.c:83
JESD204_RX_REG_ILAS
#define JESD204_RX_REG_ILAS(x, y)
Definition: axi_jesd204_rx.c:95
JESD204_EMB_STATE_GET
#define JESD204_EMB_STATE_GET(x)
Definition: axi_jesd204_rx.c:91
no_os_alloc.h
ADI_AXI_PCORE_VER
#define ADI_AXI_PCORE_VER(major, minor, patch)
Definition: axi_jesd204_rx.c:108
jesd204_rx_config::subclass_version
uint8_t subclass_version
Definition: axi_jesd204_rx.h:56
axi_jesd204_rx_init_legacy
int32_t axi_jesd204_rx_init_legacy(struct axi_jesd204_rx **jesd204, const struct jesd204_rx_init *init)
Device initialization.
Definition: axi_jesd204_rx.c:841
axi_jesd204_rx::num_lanes
uint32_t num_lanes
Definition: axi_jesd204_rx.h:71
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:449
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:208
jesd204_rx_init::frames_per_multiframe
uint16_t frames_per_multiframe
Definition: axi_jesd204_rx.h:102
jesd204_rx_init::lane_clk_khz
uint32_t lane_clk_khz
Definition: axi_jesd204_rx.h:108
axi_jesd204_rx::data_path_width
uint32_t data_path_width
Definition: axi_jesd204_rx.h:73
axi_jesd204_rx::base
uint32_t base
Definition: axi_jesd204_rx.h:67
axi_jesd204_rx::jdev
struct jesd204_dev * jdev
Definition: axi_jesd204_rx.h:87
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:218
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:61
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_clk_enable
int32_t no_os_clk_enable(struct no_os_clk_desc *desc)
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:68
JESD204_RX_REG_LANE_ERRORS
#define JESD204_RX_REG_LANE_ERRORS(x)
Definition: axi_jesd204_rx.c:94
axi_jesd204_rx_link_status_label
const char * axi_jesd204_rx_link_status_label[]
Definition: axi_jesd204_rx.c:121
JESD204_EMB_STATE_INIT
@ JESD204_EMB_STATE_INIT
Definition: axi_jesd204_rx.c:116
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:218
JESD204_RX_ENCODER_GET
#define JESD204_RX_ENCODER_GET(x)
Definition: axi_jesd204_rx.c:66
no_os_print_log.h
Print messages helpers.
jesd204_rx_config::octets_per_frame
uint8_t octets_per_frame
Definition: axi_jesd204_rx.h:54
axi_jesd204_rx_jesd204_priv
Definition: axi_jesd204_rx.c:153
axi_jesd204_rx::tpl_data_path_width
uint32_t tpl_data_path_width
Definition: axi_jesd204_rx.h:75
axi_jesd204_rx_link_status_64b66b_l
const char * axi_jesd204_rx_link_status_64b66b_l[]
Definition: axi_jesd204_rx.c:135
axi_jesd204_rx_init
int32_t axi_jesd204_rx_init(struct axi_jesd204_rx **jesd204, const struct jesd204_rx_init *init)
Device initialization, JESD FSM ON.
Definition: axi_jesd204_rx.c:917
no_os_axi_io.h
Header file of AXI IO.
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
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:996
jesd204_rx_init::name
const char * name
Definition: axi_jesd204_rx.h:96
axi_jesd204_rx::version
uint32_t version
Definition: axi_jesd204_rx.h:69
JESD204_RX_REG_SYSREF_CONF_SYSREF_DISABLE
#define JESD204_RX_REG_SYSREF_CONF_SYSREF_DISABLE
Definition: axi_jesd204_rx.c:73
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:100
JESD204_RX_LINK_CONF2_BUFFER_EARLY_RELEASE
#define JESD204_RX_LINK_CONF2_BUFFER_EARLY_RELEASE
Definition: axi_jesd204_rx.c:84
JESD204_LMFC_OFFSET_UNINITIALIZED
#define JESD204_LMFC_OFFSET_UNINITIALIZED
Definition: jesd204.h:51
no_os_clk_disable
int32_t no_os_clk_disable(struct no_os_clk_desc *desc)
axi_jesd204_rx_init
int32_t axi_jesd204_rx_init(struct axi_jesd204_rx **jesd204, const struct jesd204_rx_init *init)
Device initialization, JESD FSM ON.
Definition: axi_jesd204_rx.c:917
jesd204_rx_config
Definition: axi_jesd204_rx.h:53
jesd204_dev_priv
void * jesd204_dev_priv(struct jesd204_dev *jdev)
no_os_clk.h
Header file of Clock Driver.
JESD204_RX_REG_SYNTH_REG_1
#define JESD204_RX_REG_SYNTH_REG_1
Definition: axi_jesd204_rx.c:64
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:195
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:79
no_os_error.h
Error codes definition.
pr_debug
#define pr_debug(fmt, args...)
Definition: no_os_print_log.h:135
axi_jesd204_rx::device_clk_khz
uint32_t device_clk_khz
Definition: axi_jesd204_rx.h:79
jesd204_rx_init::subclass
uint8_t subclass
Definition: axi_jesd204_rx.h:104
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:996
JESD204_RX_REG_LINK_CONF4
#define JESD204_RX_REG_LINK_CONF4
Definition: axi_jesd204_rx.c:81
jesd204.h
JESD204_RX_REG_LINK_STATE
#define JESD204_RX_REG_LINK_STATE
Definition: axi_jesd204_rx.c:69
axi_jesd204_rx::encoder
enum jesd204_encoder encoder
Definition: axi_jesd204_rx.h:83
JESD204_RX_REG_LANE_LATENCY
#define JESD204_RX_REG_LANE_LATENCY(x)
Definition: axi_jesd204_rx.c:93
jesd204_rx_config::frames_per_multiframe
uint16_t frames_per_multiframe
Definition: axi_jesd204_rx.h:55
JESD204_ENCODER_MAX
@ JESD204_ENCODER_MAX
Definition: jesd204.h:34
no_os_clk_set_rate
int32_t no_os_clk_set_rate(struct no_os_clk_desc *desc, uint64_t rate)
jesd204_rx_init::device_clk_khz
uint32_t device_clk_khz
Definition: axi_jesd204_rx.h:106
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:182
no_os_clk_desc
Structure holding CLK descriptor.
Definition: no_os_clk.h:81
JESD204_RX_REG_SYNTH_DATA_PATH_WIDTH
#define JESD204_RX_REG_SYNTH_DATA_PATH_WIDTH
Definition: axi_jesd204_rx.c:62
PCORE_VERSION_MAJOR
#define PCORE_VERSION_MAJOR(x)
Definition: axi_jesd204_rx.c:111
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:142
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:104
PCORE_VERSION_PATCH
#define PCORE_VERSION_PATCH(x)
Definition: axi_jesd204_rx.c:113
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:77
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:485
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:49
axi_jesd204_rx_jesd204_priv::jesd
struct axi_jesd204_rx * jesd
Definition: axi_jesd204_rx.c:154
JESD204_RX_REG_SYSREF_STATUS
#define JESD204_RX_REG_SYSREF_STATUS
Definition: axi_jesd204_rx.c:77
JESD204_EMB_STATE_LOCK
@ JESD204_EMB_STATE_LOCK
Definition: axi_jesd204_rx.c:118
axi_jesd204_rx_lane_status_label
const char * axi_jesd204_rx_lane_status_label[]
Definition: axi_jesd204_rx.c:128
axi_jesd204_rx_init_legacy
int32_t axi_jesd204_rx_init_legacy(struct axi_jesd204_rx **jesd204, const struct jesd204_rx_init *init)
Device initialization.
Definition: axi_jesd204_rx.c:841
axi_jesd204_rx_watchdog
int32_t axi_jesd204_rx_watchdog(struct axi_jesd204_rx *jesd)
JESD204 RX Watchdog.
Definition: axi_jesd204_rx.c:485
NO_OS_BIT
#define NO_OS_BIT(x)
Definition: no_os_util.h:51
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
JESD204_RX_REG_LINK_STATUS
#define JESD204_RX_REG_LINK_STATUS
Definition: axi_jesd204_rx.c:86
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:421
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:106
JESD204_EMB_STATE_HUNT
@ JESD204_EMB_STATE_HUNT
Definition: axi_jesd204_rx.c:117
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:75
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:421
axi_jesd204_rx
Definition: axi_jesd204_rx.h:63
JESD204_RX_REG_VERSION
#define JESD204_RX_REG_VERSION
Definition: axi_jesd204_rx.c:58
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:98
JESD204_RX_MAGIC
#define JESD204_RX_MAGIC
Definition: axi_jesd204_rx.c:100
jesd204_rx_init
JESD204B/C Receive Peripheral Initialization Structure.
Definition: axi_jesd204_rx.h:94
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:167
JESD204_ENCODER_UNKNOWN
@ JESD204_ENCODER_UNKNOWN
Definition: jesd204.h:29
jesd204_state_op::per_link
jesd204_link_cb per_link
Definition: jesd204.h:192
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:303
axi_jesd204_rx::lane_clk_khz
uint32_t lane_clk_khz
Definition: axi_jesd204_rx.h:81
axi_jesd204_rx::name
const char * name
Definition: axi_jesd204_rx.h:65
no_os_util.h
Header file of utility functions.
PCORE_VERSION_MINOR
#define PCORE_VERSION_MINOR(x)
Definition: axi_jesd204_rx.c:112
JESD204_RX_REG_SYSREF_CONF
#define JESD204_RX_REG_SYSREF_CONF
Definition: axi_jesd204_rx.c:72
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:208
JESD204_OP_LINK_RUNNING
@ JESD204_OP_LINK_RUNNING
Definition: jesd204.h:212
jesd204_dev_data
JESD204 device initialization data.
Definition: jesd204.h:227
jesd204_rx_init::lane_clk
struct no_os_clk_desc * lane_clk
Definition: axi_jesd204_rx.h:110
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:195
JESD204_RX_REG_LANE_STATUS
#define JESD204_RX_REG_LANE_STATUS(x)
Definition: axi_jesd204_rx.c:89
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:70
no_os_div_u64
uint64_t no_os_div_u64(uint64_t dividend, uint32_t divisor)
axi_jesd204_rx::lane_clk
struct no_os_clk_desc * lane_clk
Definition: axi_jesd204_rx.h:85