no-OS
axi_jesd204_tx.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef AXI_JESD204_TX_H_
34 #define AXI_JESD204_TX_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 /******************************************************************************/
48  uint8_t device_id;
49  uint8_t bank_id;
50  uint8_t lane_id;
55  uint8_t resolution;
56  uint8_t bits_per_sample;
58  uint8_t jesd_version;
61  uint32_t version;
64 };
65 
72  const char *name;
74  uint32_t base;
76  uint32_t num_lanes;
78  uint32_t data_path_width;
84  uint32_t device_clk_khz;
86  uint32_t lane_clk_khz;
92  struct jesd204_dev *jdev;
93 };
94 
101  const char *name;
103  uint32_t base;
119  uint8_t subclass;
121  uint32_t device_clk_khz;
123  uint32_t lane_clk_khz;
126 };
127 
128 /******************************************************************************/
129 /************************ Functions Declarations ******************************/
130 /******************************************************************************/
132 int32_t axi_jesd204_tx_lane_clk_enable(struct axi_jesd204_tx *jesd);
134 int32_t axi_jesd204_tx_lane_clk_disable(struct axi_jesd204_tx *jesd);
136 uint32_t axi_jesd204_tx_status_read(struct axi_jesd204_tx *jesd);
138 int32_t axi_jesd204_tx_init_legacy(struct axi_jesd204_tx **jesd204,
139  const struct jesd204_tx_init *init);
141 int32_t axi_jesd204_tx_init(struct axi_jesd204_tx **jesd204,
142  const struct jesd204_tx_init *init);
144 int32_t axi_jesd204_tx_remove(struct axi_jesd204_tx *jesd);
145 #endif
jesd204_tx_config::subclass_version
uint8_t subclass_version
Definition: axi_jesd204_tx.h:59
JESD204_LINK_STATUS_DATA
#define JESD204_LINK_STATUS_DATA
Definition: axi_jesd204_tx.c:78
JESD204_TX_REG_LINK_CONF4
#define JESD204_TX_REG_LINK_CONF4
Definition: axi_jesd204_tx.c:75
no_os_alloc.h
jesd204_tx_config::converters_per_device
uint8_t converters_per_device
Definition: axi_jesd204_tx.h:54
JESD204_TX_REG_MAGIC
#define JESD204_TX_REG_MAGIC
Definition: axi_jesd204_tx.c:53
ADI_AXI_PCORE_VER
#define ADI_AXI_PCORE_VER(major, minor, patch)
Definition: axi_jesd204_tx.c:90
jesd204_tx_config::device_id
uint8_t device_id
Definition: axi_jesd204_tx.h:48
axi_jesd204_tx::name
const char * name
Definition: axi_jesd204_tx.h:72
JESD204_TX_REG_LINK_STATE
#define JESD204_TX_REG_LINK_STATE
Definition: axi_jesd204_tx.c:63
NO_OS_GENMASK
#define NO_OS_GENMASK(h, l)
Definition: no_os_util.h:82
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
JESD204_TX_REG_LINK_STATUS
#define JESD204_TX_REG_LINK_STATUS
Definition: axi_jesd204_tx.c:77
jesd204_tx_init::bits_per_sample
uint8_t bits_per_sample
Definition: axi_jesd204_tx.h:113
JESD204_TX_REG_SYSREF_CONF_SYSREF_DISABLE
#define JESD204_TX_REG_SYSREF_CONF_SYSREF_DISABLE
Definition: axi_jesd204_tx.c:67
jesd204_tx_config::control_bits_per_sample
uint8_t control_bits_per_sample
Definition: axi_jesd204_tx.h:60
jesd204_tx_config::bits_per_sample
uint8_t bits_per_sample
Definition: axi_jesd204_tx.h:56
JESD204_TX_ENCODER_GET
#define JESD204_TX_ENCODER_GET(x)
Definition: axi_jesd204_tx.c:60
jesd204_tx_config::octets_per_frame
uint8_t octets_per_frame
Definition: axi_jesd204_tx.h:52
axi_jesd204_tx::device_clk_khz
uint32_t device_clk_khz
Definition: axi_jesd204_tx.h:84
pr_err
#define pr_err(fmt, args...)
Definition: no_os_print_log.h:88
jesd204_tx_config::high_density
bool high_density
Definition: axi_jesd204_tx.h:63
no_os_delay.h
Header file of Delay functions.
JESD204_ENCODER_8B10B
@ JESD204_ENCODER_8B10B
Definition: jesd204.h:30
JESD204_TX_REG_VERSION
#define JESD204_TX_REG_VERSION
Definition: axi_jesd204_tx.c:52
jesd204_state_op_reason
jesd204_state_op_reason
Definition: jesd204.h:147
jesd204_tx_init::subclass
uint8_t subclass
Definition: axi_jesd204_tx.h:119
no_os_clk_enable
int32_t no_os_clk_enable(struct no_os_clk_desc *desc)
jesd204_tx_init::control_bits_per_sample
uint8_t control_bits_per_sample
Definition: axi_jesd204_tx.h:117
NO_OS_DIV_ROUND_CLOSEST_ULL
#define NO_OS_DIV_ROUND_CLOSEST_ULL(x, y)
Definition: no_os_util.h:56
axi_jesd204_tx::num_lanes
uint32_t num_lanes
Definition: axi_jesd204_tx.h:76
JESD204_TX_REG_SYSREF_CONF
#define JESD204_TX_REG_SYSREF_CONF
Definition: axi_jesd204_tx.c:66
axi_jesd204_tx_apply_config_legacy
int32_t axi_jesd204_tx_apply_config_legacy(struct axi_jesd204_tx *jesd, struct jesd204_tx_config *config)
Apply the JESD204 TX configuration.
Definition: axi_jesd204_tx.c:471
no_os_print_log.h
Print messages helpers.
JESD204_TX_REG_ILAS
#define JESD204_TX_REG_ILAS(x, y)
Definition: axi_jesd204_tx.c:80
JESD204_TX_REG_LINK_CLK_RATIO
#define JESD204_TX_REG_LINK_CLK_RATIO
Definition: axi_jesd204_tx.c:64
JESD204_TX_REG_CONF_DATA_PATH_WIDTH
#define JESD204_TX_REG_CONF_DATA_PATH_WIDTH
Definition: axi_jesd204_tx.c:56
jesd204_tx_config
Definition: axi_jesd204_tx.h:47
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
JESD204_TX_REG_SYNTH_REG_1
#define JESD204_TX_REG_SYNTH_REG_1
Definition: axi_jesd204_tx.c:58
JESD204_STATE_OP_REASON_UNINIT
@ JESD204_STATE_OP_REASON_UNINIT
Definition: jesd204.h:149
JESD204_TX_REG_SYSREF_LMFC_OFFSET
#define JESD204_TX_REG_SYSREF_LMFC_OFFSET
Definition: axi_jesd204_tx.c:69
axi_jesd204_tx_apply_config
int32_t axi_jesd204_tx_apply_config(struct axi_jesd204_tx *jesd, struct jesd204_link *config)
Apply the JESD204 TX configuration.
Definition: axi_jesd204_tx.c:407
JESD204_LMFC_OFFSET_UNINITIALIZED
#define JESD204_LMFC_OFFSET_UNINITIALIZED
Definition: jesd204.h:51
jesd204_tx_init::device_clk_khz
uint32_t device_clk_khz
Definition: axi_jesd204_tx.h:121
axi_jesd204_tx_lane_clk_enable
int32_t axi_jesd204_tx_lane_clk_enable(struct axi_jesd204_tx *jesd)
JESD204 TX Lane Clock Enable.
Definition: axi_jesd204_tx.c:147
jesd204_tx_config::resolution
uint8_t resolution
Definition: axi_jesd204_tx.h:55
jesd204_dev_priv
void * jesd204_dev_priv(struct jesd204_dev *jdev)
no_os_clk.h
Header file of Clock Driver.
axi_jesd204_tx_set_lane_ilas_legacy
void axi_jesd204_tx_set_lane_ilas_legacy(struct axi_jesd204_tx *jesd, struct jesd204_tx_config *config, uint32_t lane)
Set the JESD204 TX lane ILAS.
Definition: axi_jesd204_tx.c:361
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_tx_lane_clk_enable
int32_t axi_jesd204_tx_lane_clk_enable(struct axi_jesd204_tx *jesd)
JESD204 TX Lane Clock Enable.
Definition: axi_jesd204_tx.c:147
JESD204_OP_CLOCKS_ENABLE
@ JESD204_OP_CLOCKS_ENABLE
Definition: jesd204.h:210
axi_jesd204_tx::lane_clk
struct no_os_clk_desc * lane_clk
Definition: axi_jesd204_tx.h:90
no_os_error.h
Error codes definition.
axi_jesd204_tx_remove
int32_t axi_jesd204_tx_remove(struct axi_jesd204_tx *jesd)
Free resoulces allocated for JESD204 TX peripheral.
Definition: axi_jesd204_tx.c:912
pr_debug
#define pr_debug(fmt, args...)
Definition: no_os_print_log.h:129
jesd204_tx_config::enable_scrambling
bool enable_scrambling
Definition: axi_jesd204_tx.h:62
jesd204.h
axi_jesd204_tx_jesd204_priv
Definition: axi_jesd204_tx.c:104
jesd204_tx_config::lanes_per_device
uint8_t lanes_per_device
Definition: axi_jesd204_tx.h:51
axi_jesd204_tx::base
uint32_t base
Definition: axi_jesd204_tx.h:74
JESD204_ENCODER_MAX
@ JESD204_ENCODER_MAX
Definition: jesd204.h:34
axi_jesd204_tx_init_legacy
int32_t axi_jesd204_tx_init_legacy(struct axi_jesd204_tx **jesd204, const struct jesd204_tx_init *init)
Device initialization.
Definition: axi_jesd204_tx.c:729
no_os_clk_set_rate
int32_t no_os_clk_set_rate(struct no_os_clk_desc *desc, uint64_t rate)
axi_jesd204_tx_jesd204_priv::jesd
struct axi_jesd204_tx * jesd
Definition: axi_jesd204_tx.c:105
JESD204_TX_MAGIC
#define JESD204_TX_MAGIC
Definition: axi_jesd204_tx.c:83
jesd204_tx_init::high_density
bool high_density
Definition: axi_jesd204_tx.h:115
jesd204_tx_init::octets_per_frame
uint8_t octets_per_frame
Definition: axi_jesd204_tx.h:105
axi_jesd204_tx::tpl_data_path_width
uint32_t tpl_data_path_width
Definition: axi_jesd204_tx.h:80
jesd204_tx_init::base
uint32_t base
Definition: axi_jesd204_tx.h:103
no_os_clk_desc
Structure holding CLK descriptor.
Definition: no_os_clk.h:75
axi_jesd204_tx_status_read
uint32_t axi_jesd204_tx_status_read(struct axi_jesd204_tx *jesd)
Read status of the JESD204 Transmit Peripherial.
Definition: axi_jesd204_tx.c:170
axi_jesd204_tx_remove
int32_t axi_jesd204_tx_remove(struct axi_jesd204_tx *jesd)
Free resoulces allocated for JESD204 TX peripheral.
Definition: axi_jesd204_tx.c:912
PCORE_VERSION_MAJOR
#define PCORE_VERSION_MAJOR(x)
Definition: axi_jesd204_tx.c:93
JESD204_OP_LINK_ENABLE
@ JESD204_OP_LINK_ENABLE
Definition: jesd204.h:211
axi_jesd204_tx_write
int32_t axi_jesd204_tx_write(struct axi_jesd204_tx *jesd, uint32_t reg_addr, uint32_t reg_val)
JESD204 TX AXI Data Write.
Definition: axi_jesd204_tx.c:119
JESD204_TX_REG_LINK_DISABLE
#define JESD204_TX_REG_LINK_DISABLE
Definition: axi_jesd204_tx.c:62
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_TX_REG_SYSREF_STATUS
#define JESD204_TX_REG_SYSREF_STATUS
Definition: axi_jesd204_tx.c:71
jesd204_tx_config::lane_id
uint8_t lane_id
Definition: axi_jesd204_tx.h:50
axi_jesd204_tx_lane_clk_disable
int32_t axi_jesd204_tx_lane_clk_disable(struct axi_jesd204_tx *jesd)
JESD204 TX Lane Clock Disable.
Definition: axi_jesd204_tx.c:160
jesd204_tx_config::version
uint32_t version
Definition: axi_jesd204_tx.h:61
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_tx.c:87
PCORE_VERSION_PATCH
#define PCORE_VERSION_PATCH(x)
Definition: axi_jesd204_tx.c:95
JESD204_STATE_CHANGE_ERROR
@ JESD204_STATE_CHANGE_ERROR
Definition: jesd204.h:44
JESD204_OP_LINK_PRE_SETUP
@ JESD204_OP_LINK_PRE_SETUP
Definition: jesd204.h:200
jesd204_tx_init::converter_resolution
uint8_t converter_resolution
Definition: axi_jesd204_tx.h:111
JESD204_SUBCLASS_0
@ JESD204_SUBCLASS_0
Definition: jesd204.h:16
axi_jesd204_tx_calc_ilas_chksum_legacy
uint32_t axi_jesd204_tx_calc_ilas_chksum_legacy(const struct jesd204_tx_config *config)
Compute the JESD204 TX ILAS checksum.
Definition: axi_jesd204_tx.c:286
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_tx_read
int32_t axi_jesd204_tx_read(struct axi_jesd204_tx *jesd, uint32_t reg_addr, uint32_t *reg_val)
JESD204 TX AXI Data Read.
Definition: axi_jesd204_tx.c:134
axi_jesd204_tx
Definition: axi_jesd204_tx.h:70
axi_jesd204_tx::jdev
struct jesd204_dev * jdev
Definition: axi_jesd204_tx.h:92
axi_jesd204_tx_init
int32_t axi_jesd204_tx_init(struct axi_jesd204_tx **jesd204, const struct jesd204_tx_init *init)
Device initialization.
Definition: axi_jesd204_tx.c:819
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_TX_REG_CONF_NUM_LANES
#define JESD204_TX_REG_CONF_NUM_LANES
Definition: axi_jesd204_tx.c:55
axi_jesd204_tx_init_legacy
int32_t axi_jesd204_tx_init_legacy(struct axi_jesd204_tx **jesd204, const struct jesd204_tx_init *init)
Device initialization.
Definition: axi_jesd204_tx.c:729
jesd204_dev_register
int jesd204_dev_register(struct jesd204_dev **jdev, const struct jesd204_dev_data *dev_data)
JESD204_TX_REG_CONF0
#define JESD204_TX_REG_CONF0
Definition: axi_jesd204_tx.c:73
JESD204_TPL_DATA_PATH_WIDTH_GET
#define JESD204_TPL_DATA_PATH_WIDTH_GET(x)
Definition: axi_jesd204_tx.c:89
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:114
axi_jesd204_tx_init
int32_t axi_jesd204_tx_init(struct axi_jesd204_tx **jesd204, const struct jesd204_tx_init *init)
Device initialization.
Definition: axi_jesd204_tx.c:819
axi_jesd204_tx::data_path_width
uint32_t data_path_width
Definition: axi_jesd204_tx.h:78
axi_jesd204_tx_status_read
uint32_t axi_jesd204_tx_status_read(struct axi_jesd204_tx *jesd)
Read status of the JESD204 Transmit Peripherial.
Definition: axi_jesd204_tx.c:170
jesd204_encoder
jesd204_encoder
Definition: jesd204.h:28
axi_jesd204_tx::config
struct jesd204_tx_config config
Definition: axi_jesd204_tx.h:82
jesd204_tx_init::converters_per_device
uint8_t converters_per_device
Definition: axi_jesd204_tx.h:109
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_tx_lane_clk_disable
int32_t axi_jesd204_tx_lane_clk_disable(struct axi_jesd204_tx *jesd)
JESD204 TX Lane Clock Disable.
Definition: axi_jesd204_tx.c:160
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_tx_init::frames_per_multiframe
uint16_t frames_per_multiframe
Definition: axi_jesd204_tx.h:107
jesd204_tx_config::bank_id
uint8_t bank_id
Definition: axi_jesd204_tx.h:49
jesd204_tx_init::name
const char * name
Definition: axi_jesd204_tx.h:101
JESD204_ENCODER_UNKNOWN
@ JESD204_ENCODER_UNKNOWN
Definition: jesd204.h:29
jesd204_state_op::per_link
jesd204_link_cb per_link
Definition: jesd204.h:192
no_os_util.h
Header file of utility functions.
axi_jesd204_tx::lane_clk_khz
uint32_t lane_clk_khz
Definition: axi_jesd204_tx.h:86
PCORE_VERSION_MINOR
#define PCORE_VERSION_MINOR(x)
Definition: axi_jesd204_tx.c:94
jesd204_tx_config::samples_per_frame
uint8_t samples_per_frame
Definition: axi_jesd204_tx.h:57
JESD204_OP_LINK_RUNNING
@ JESD204_OP_LINK_RUNNING
Definition: jesd204.h:212
jesd204_tx_config::jesd_version
uint8_t jesd_version
Definition: axi_jesd204_tx.h:58
jesd204_tx_init
JESD204B/C Transmit Peripheral Initialization Structure.
Definition: axi_jesd204_tx.h:99
jesd204_dev_data
JESD204 device initialization data.
Definition: jesd204.h:227
axi_jesd204_tx_link_status_label
const char * axi_jesd204_tx_link_status_label[]
Definition: axi_jesd204_tx.c:97
axi_jesd204_tx::encoder
enum jesd204_encoder encoder
Definition: axi_jesd204_tx.h:88
jesd204_tx_init::lane_clk_khz
uint32_t lane_clk_khz
Definition: axi_jesd204_tx.h:123
jesd204_tx_init::lane_clk
struct no_os_clk_desc * lane_clk
Definition: axi_jesd204_tx.h:125
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
axi_jesd204_tx.h
Driver for the Analog Devices AXI-JESD204-TX peripheral.
jesd204_tx_config::frames_per_multiframe
uint16_t frames_per_multiframe
Definition: axi_jesd204_tx.h:53
no_os_div_u64
uint64_t no_os_div_u64(uint64_t dividend, uint32_t divisor)