no-OS
axi_jesd204_rx.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef AXI_JESD204_RX_H_
34 #define AXI_JESD204_RX_H_
35 
36 /******************************************************************************/
37 /***************************** Include Files **********************************/
38 /******************************************************************************/
39 #include <stdint.h>
40 #include <stdbool.h>
41 #include "jesd204.h"
42 #include "no_os_clk.h"
43 
44 /******************************************************************************/
45 /*************************** Types Declarations *******************************/
46 /******************************************************************************/
51 };
52 
59  const char *name;
61  uint32_t base;
63  uint32_t version;
64  /* Number of lanes of the peripheral */
65  uint32_t num_lanes;
67  uint32_t data_path_width;
73  uint32_t device_clk_khz;
75  uint32_t lane_clk_khz;
81  struct jesd204_dev *jdev;
82 };
83 
90  const char *name;
92  uint32_t base;
98  uint8_t subclass;
100  uint32_t device_clk_khz;
102  uint32_t lane_clk_khz;
105 };
106 
107 /******************************************************************************/
108 /************************ Functions Declarations ******************************/
109 /******************************************************************************/
111 int32_t axi_jesd204_rx_lane_clk_enable(struct axi_jesd204_rx *jesd);
113 int32_t axi_jesd204_rx_lane_clk_disable(struct axi_jesd204_rx *jesd);
115 uint32_t axi_jesd204_rx_status_read(struct axi_jesd204_rx *jesd);
117 int32_t axi_jesd204_rx_laneinfo_read(struct axi_jesd204_rx *jesd,
118  uint32_t lane);
120 int32_t axi_jesd204_rx_watchdog(struct axi_jesd204_rx *jesd);
122 int32_t axi_jesd204_rx_init_legacy(struct axi_jesd204_rx **jesd204,
123  const struct jesd204_rx_init *init);
125 int32_t axi_jesd204_rx_init(struct axi_jesd204_rx **jesd204,
126  const struct jesd204_rx_init *init);
128 int32_t axi_jesd204_rx_remove(struct axi_jesd204_rx *jesd);
129 #endif
JESD204_LINK_STATUS_DATA
#define JESD204_LINK_STATUS_DATA
Definition: axi_jesd204_rx.c:81
JESD204_RX_REG_MAGIC
#define JESD204_RX_REG_MAGIC
Definition: axi_jesd204_rx.c:53
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:567
JESD204_RX_REG_LINK_CONF2
#define JESD204_RX_REG_LINK_CONF2
Definition: axi_jesd204_rx.c:77
JESD204_RX_REG_ILAS
#define JESD204_RX_REG_ILAS(x, y)
Definition: axi_jesd204_rx.c:89
JESD204_EMB_STATE_GET
#define JESD204_EMB_STATE_GET(x)
Definition: axi_jesd204_rx.c:85
no_os_alloc.h
ADI_AXI_PCORE_VER
#define ADI_AXI_PCORE_VER(major, minor, patch)
Definition: axi_jesd204_rx.c:102
jesd204_rx_config::subclass_version
uint8_t subclass_version
Definition: axi_jesd204_rx.h:50
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:835
axi_jesd204_rx::num_lanes
uint32_t num_lanes
Definition: axi_jesd204_rx.h:65
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:443
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:202
jesd204_rx_init::frames_per_multiframe
uint16_t frames_per_multiframe
Definition: axi_jesd204_rx.h:96
jesd204_rx_init::lane_clk_khz
uint32_t lane_clk_khz
Definition: axi_jesd204_rx.h:102
axi_jesd204_rx::data_path_width
uint32_t data_path_width
Definition: axi_jesd204_rx.h:67
axi_jesd204_rx::base
uint32_t base
Definition: axi_jesd204_rx.h:61
axi_jesd204_rx::jdev
struct jesd204_dev * jdev
Definition: axi_jesd204_rx.h:81
pr_err
#define pr_err(fmt, args...)
Definition: no_os_print_log.h:88
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:212
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:55
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:115
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:56
JESD204_RX_REG_LINK_DISABLE
#define JESD204_RX_REG_LINK_DISABLE
Definition: axi_jesd204_rx.c:62
JESD204_RX_REG_LANE_ERRORS
#define JESD204_RX_REG_LANE_ERRORS(x)
Definition: axi_jesd204_rx.c:88
axi_jesd204_rx_link_status_label
const char * axi_jesd204_rx_link_status_label[]
Definition: axi_jesd204_rx.c:115
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:212
JESD204_RX_ENCODER_GET
#define JESD204_RX_ENCODER_GET(x)
Definition: axi_jesd204_rx.c:60
no_os_print_log.h
Print messages helpers.
jesd204_rx_config::octets_per_frame
uint8_t octets_per_frame
Definition: axi_jesd204_rx.h:48
JESD204_EMB_STATE_LOCK
@ JESD204_EMB_STATE_LOCK
Definition: axi_jesd204_rx.c:112
axi_jesd204_rx_jesd204_priv
Definition: axi_jesd204_rx.c:147
axi_jesd204_rx::tpl_data_path_width
uint32_t tpl_data_path_width
Definition: axi_jesd204_rx.h:69
axi_jesd204_rx_link_status_64b66b_l
const char * axi_jesd204_rx_link_status_64b66b_l[]
Definition: axi_jesd204_rx.c:129
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:911
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:54
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:990
jesd204_rx_init::name
const char * name
Definition: axi_jesd204_rx.h:90
axi_jesd204_rx::version
uint32_t version
Definition: axi_jesd204_rx.h:63
JESD204_RX_REG_SYSREF_CONF_SYSREF_DISABLE
#define JESD204_RX_REG_SYSREF_CONF_SYSREF_DISABLE
Definition: axi_jesd204_rx.c:67
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:94
JESD204_RX_LINK_CONF2_BUFFER_EARLY_RELEASE
#define JESD204_RX_LINK_CONF2_BUFFER_EARLY_RELEASE
Definition: axi_jesd204_rx.c:78
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:911
jesd204_rx_config
Definition: axi_jesd204_rx.h:47
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:58
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
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:189
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:73
no_os_error.h
Error codes definition.
pr_debug
#define pr_debug(fmt, args...)
Definition: no_os_print_log.h:129
axi_jesd204_rx::device_clk_khz
uint32_t device_clk_khz
Definition: axi_jesd204_rx.h:73
JESD204_EMB_STATE_INIT
@ JESD204_EMB_STATE_INIT
Definition: axi_jesd204_rx.c:110
jesd204_rx_init::subclass
uint8_t subclass
Definition: axi_jesd204_rx.h:98
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:990
JESD204_RX_REG_LINK_CONF4
#define JESD204_RX_REG_LINK_CONF4
Definition: axi_jesd204_rx.c:75
jesd204.h
JESD204_RX_REG_LINK_STATE
#define JESD204_RX_REG_LINK_STATE
Definition: axi_jesd204_rx.c:63
axi_jesd204_rx::encoder
enum jesd204_encoder encoder
Definition: axi_jesd204_rx.h:77
JESD204_RX_REG_LANE_LATENCY
#define JESD204_RX_REG_LANE_LATENCY(x)
Definition: axi_jesd204_rx.c:87
jesd204_rx_config::frames_per_multiframe
uint16_t frames_per_multiframe
Definition: axi_jesd204_rx.h:49
JESD204_ENCODER_MAX
@ JESD204_ENCODER_MAX
Definition: jesd204.h:34
JESD204_EMB_STATE_HUNT
@ JESD204_EMB_STATE_HUNT
Definition: axi_jesd204_rx.c:111
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:100
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:176
no_os_clk_desc
Structure holding CLK descriptor.
Definition: no_os_clk.h:75
JESD204_RX_REG_SYNTH_DATA_PATH_WIDTH
#define JESD204_RX_REG_SYNTH_DATA_PATH_WIDTH
Definition: axi_jesd204_rx.c:56
PCORE_VERSION_MAJOR
#define PCORE_VERSION_MAJOR(x)
Definition: axi_jesd204_rx.c:105
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:136
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:53
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:98
PCORE_VERSION_PATCH
#define PCORE_VERSION_PATCH(x)
Definition: axi_jesd204_rx.c:107
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:71
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:479
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
axi_jesd204_rx_jesd204_priv::jesd
struct axi_jesd204_rx * jesd
Definition: axi_jesd204_rx.c:148
JESD204_RX_REG_SYSREF_STATUS
#define JESD204_RX_REG_SYSREF_STATUS
Definition: axi_jesd204_rx.c:71
axi_jesd204_rx_lane_status_label
const char * axi_jesd204_rx_lane_status_label[]
Definition: axi_jesd204_rx.c:122
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:835
axi_jesd204_rx_watchdog
int32_t axi_jesd204_rx_watchdog(struct axi_jesd204_rx *jesd)
JESD204 RX Watchdog.
Definition: axi_jesd204_rx.c:479
NO_OS_BIT
#define NO_OS_BIT(x)
Definition: no_os_util.h:45
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:69
JESD204_RX_REG_LINK_STATUS
#define JESD204_RX_REG_LINK_STATUS
Definition: axi_jesd204_rx.c:80
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:415
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:100
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:69
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:415
axi_jesd204_rx
Definition: axi_jesd204_rx.h:57
JESD204_RX_REG_VERSION
#define JESD204_RX_REG_VERSION
Definition: axi_jesd204_rx.c:52
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:67
jesd204_rx_init::base
uint32_t base
Definition: axi_jesd204_rx.h:92
JESD204_RX_MAGIC
#define JESD204_RX_MAGIC
Definition: axi_jesd204_rx.c:94
jesd204_rx_init
JESD204B/C Receive Peripheral Initialization Structure.
Definition: axi_jesd204_rx.h:88
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:161
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:297
axi_jesd204_rx::lane_clk_khz
uint32_t lane_clk_khz
Definition: axi_jesd204_rx.h:75
axi_jesd204_rx::name
const char * name
Definition: axi_jesd204_rx.h:59
no_os_util.h
Header file of utility functions.
PCORE_VERSION_MINOR
#define PCORE_VERSION_MINOR(x)
Definition: axi_jesd204_rx.c:106
JESD204_RX_REG_SYSREF_CONF
#define JESD204_RX_REG_SYSREF_CONF
Definition: axi_jesd204_rx.c:66
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:202
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:104
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:189
JESD204_RX_REG_LANE_STATUS
#define JESD204_RX_REG_LANE_STATUS(x)
Definition: axi_jesd204_rx.c:83
NO_OS_DIV_ROUND_CLOSEST
#define NO_OS_DIV_ROUND_CLOSEST(x, y)
Definition: no_os_util.h:54
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:64
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:79