no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
jesd204.h
Go to the documentation of this file.
1
6#ifndef _JESD204_H_
7#define _JESD204_H_
8
9#include <stdbool.h>
10#include <stddef.h>
11#include <stdint.h>
12
13struct jesd204_dev;
14
20
26
27/* JESD204C Supported encoding scheme */
36
42
48
49#define JESD204_LINKS_ALL ((unsigned int)(-1))
50
51#define JESD204_LMFC_OFFSET_UNINITIALIZED ((uint16_t)-1)
52
66
106 uint32_t link_id;
107 int error;
108
109 uint64_t sample_rate;
111
113
114 uint8_t num_lanes;
119
121
125 uint8_t subclass;
126
127 uint8_t device_id;
128 uint8_t bank_id;
129
130 uint8_t scrambling;
132
136
137 uint8_t *lane_ids;
138
140
141 /* Subclass 2 only */
145};
146
151
152static inline const char *jesd204_state_op_reason_str(enum
154{
155 switch (reason) {
157 return "initialization";
159 return "uninitialization";
160 default:
161 return "unknown";
162 }
163}
164
165typedef int (*jesd204_sysref_cb)(struct jesd204_dev *jdev);
166
167typedef int (*jesd204_dev_cb)(struct jesd204_dev *jdev,
168 enum jesd204_state_op_reason reason);
169
170typedef int (*jesd204_link_cb)(struct jesd204_dev *jdev,
172 struct jesd204_link *lnk);
173
178
195
217
234
235/* no-OS specific */
236#define JESD204_MAX_TOPOLOGY_LINKS 16
237
238/* no-OS specific */
240 struct jesd204_dev *jdev;
244 unsigned int links_number;
245};
246
247/* no-OS specific */
249 struct jesd204_dev_top *dev_top;
251 unsigned int devs_number;
252};
253
254/* no-OS specific */
255int jesd204_dev_register(struct jesd204_dev **jdev,
256 const struct jesd204_dev_data *dev_data);
257
258/* no-OS specific */
259int jesd204_dev_unregister(struct jesd204_dev *jdev);
260
261/* no-OS specific */
263 struct jesd204_topology_dev *devs,
264 unsigned int devs_number);
265
266/* no-OS specific */
268
269/* no-OS specific */
270int jesd204_fsm_start(struct jesd204_topology *topology, unsigned int link_idx);
271
272/* no-OS specific */
273int jesd204_fsm_stop(struct jesd204_topology *topology, unsigned int link_idx);
274
275void *jesd204_dev_priv(struct jesd204_dev *jdev);
276
278 unsigned long *rate_hz);
279
281 unsigned long *lane_rate_khz);
282
284 unsigned long *device_clock);
285
286int jesd204_sysref_async(struct jesd204_dev *jdev);
287
288int jesd204_sysref_async_force(struct jesd204_dev *jdev);
289
290bool jesd204_dev_is_top(struct jesd204_dev *jdev);
291
293 const struct jesd204_link *src);
294
295#endif
int jesd204_topology_remove(struct jesd204_topology *topology)
int jesd204_fsm_start(struct jesd204_topology *topology, unsigned int link_idx)
jesd204_version
Definition jesd204.h:21
@ JESD204_VERSION_C
Definition jesd204.h:24
@ JESD204_VERSION_B
Definition jesd204.h:23
@ JESD204_VERSION_A
Definition jesd204.h:22
int jesd204_dev_unregister(struct jesd204_dev *jdev)
jesd204_dev_op
Definition jesd204.h:196
@ JESD204_OP_OPT_SETUP_STAGE3
Definition jesd204.h:207
@ JESD204_OP_LINK_RUNNING
Definition jesd204.h:212
@ JESD204_OP_CLOCKS_ENABLE
Definition jesd204.h:210
@ JESD204_OP_CLK_SYNC_STAGE3
Definition jesd204.h:203
@ JESD204_OP_OPT_POST_RUNNING_STAGE
Definition jesd204.h:213
@ JESD204_OP_LINK_PRE_SETUP
Definition jesd204.h:200
@ JESD204_OP_OPT_SETUP_STAGE4
Definition jesd204.h:208
@ JESD204_OP_DEVICE_INIT
Definition jesd204.h:197
@ JESD204_OP_LINK_INIT
Definition jesd204.h:198
@ __JESD204_MAX_OPS
Definition jesd204.h:215
@ JESD204_OP_OPT_SETUP_STAGE2
Definition jesd204.h:206
@ JESD204_OP_LINK_ENABLE
Definition jesd204.h:211
@ JESD204_OP_OPT_SETUP_STAGE5
Definition jesd204.h:209
@ JESD204_OP_LINK_SUPPORTED
Definition jesd204.h:199
@ JESD204_OP_OPT_SETUP_STAGE1
Definition jesd204.h:205
@ JESD204_OP_LINK_SETUP
Definition jesd204.h:204
@ JESD204_OP_CLK_SYNC_STAGE2
Definition jesd204.h:202
@ JESD204_OP_CLK_SYNC_STAGE1
Definition jesd204.h:201
int(* jesd204_sysref_cb)(struct jesd204_dev *jdev)
Definition jesd204.h:165
int jesd204_sysref_async_force(struct jesd204_dev *jdev)
int jesd204_sysref_async(struct jesd204_dev *jdev)
jesd204_state_op_reason
Definition jesd204.h:147
@ JESD204_STATE_OP_REASON_UNINIT
Definition jesd204.h:149
@ JESD204_STATE_OP_REASON_INIT
Definition jesd204.h:148
void jesd204_copy_link_params(struct jesd204_link *dst, const struct jesd204_link *src)
int jesd204_link_get_rate_khz(struct jesd204_link *lnk, unsigned long *lane_rate_khz)
int jesd204_fsm_stop(struct jesd204_topology *topology, unsigned int link_idx)
int(* jesd204_dev_cb)(struct jesd204_dev *jdev, enum jesd204_state_op_reason reason)
Definition jesd204.h:167
int jesd204_link_get_device_clock(struct jesd204_link *lnk, unsigned long *device_clock)
jesd204_state_op_mode
Definition jesd204.h:174
@ JESD204_STATE_OP_MODE_PER_LINK
Definition jesd204.h:175
@ JESD204_STATE_OP_MODE_PER_DEVICE
Definition jesd204.h:176
jesd204_state_change_result
Definition jesd204.h:43
@ JESD204_STATE_CHANGE_DEFER
Definition jesd204.h:45
@ JESD204_STATE_CHANGE_DONE
Definition jesd204.h:46
@ JESD204_STATE_CHANGE_ERROR
Definition jesd204.h:44
jesd204_encoder
Definition jesd204.h:28
@ JESD204_ENCODER_64B66B
Definition jesd204.h:31
@ JESD204_ENCODER_64B80B
Definition jesd204.h:32
@ JESD204_ENCODER_MAX
Definition jesd204.h:34
@ JESD204_ENCODER_UNKNOWN
Definition jesd204.h:29
@ JESD204_ENCODER_8B10B
Definition jesd204.h:30
int jesd204_topology_init(struct jesd204_topology **topology, struct jesd204_topology_dev *devs, unsigned int devs_number)
jesd204_sysref_mode
Definition jesd204.h:37
@ JESD204_SYSREF_ONESHOT
Definition jesd204.h:40
@ JESD204_SYSREF_CONTINUOUS
Definition jesd204.h:39
@ JESD204_SYSREF_DISABLED
Definition jesd204.h:38
int jesd204_dev_register(struct jesd204_dev **jdev, const struct jesd204_dev_data *dev_data)
bool jesd204_dev_is_top(struct jesd204_dev *jdev)
void * jesd204_dev_priv(struct jesd204_dev *jdev)
int(* jesd204_link_cb)(struct jesd204_dev *jdev, enum jesd204_state_op_reason, struct jesd204_link *lnk)
Definition jesd204.h:170
#define JESD204_MAX_TOPOLOGY_LINKS
Definition jesd204.h:236
int jesd204_link_get_lmfc_lemc_rate(struct jesd204_link *lnk, unsigned long *rate_hz)
jesd204_subclass
Definition jesd204.h:15
@ JESD204_SUBCLASS_1
Definition jesd204.h:17
@ JESD204_SUBCLASS_2
Definition jesd204.h:18
@ JESD204_SUBCLASS_0
Definition jesd204.h:16
JESD204 device initialization data.
Definition jesd204.h:227
size_t sizeof_priv
Definition jesd204.h:229
unsigned int max_num_links
Definition jesd204.h:230
unsigned int num_retries
Definition jesd204.h:231
struct jesd204_state_op state_ops[__JESD204_MAX_OPS]
Definition jesd204.h:232
jesd204_sysref_cb sysref_cb
Definition jesd204.h:228
JESD204 device per-state op.
Definition jesd204.h:189
bool post_state_sysref
Definition jesd204.h:193
jesd204_link_cb per_link
Definition jesd204.h:192
enum jesd204_state_op_mode mode
Definition jesd204.h:190
jesd204_dev_cb per_device
Definition jesd204.h:191
JESD204 parameters for SYSREF.
Definition jesd204.h:60
uint8_t valid_falling_edge
Definition jesd204.h:63
uint8_t capture_falling_edge
Definition jesd204.h:62
enum jesd204_sysref_mode mode
Definition jesd204.h:61
uint16_t lmfc_offset
Definition jesd204.h:64
Definition jesd204.h:239
struct jesd204_dev * jdev
Definition jesd204.h:240
unsigned int links_number
Definition jesd204.h:244
bool is_sysref_provider
Definition jesd204.h:242
bool is_top_device
Definition jesd204.h:241
unsigned int link_ids[JESD204_MAX_TOPOLOGY_LINKS]
Definition jesd204.h:243
Definition jesd204.h:248
unsigned int devs_number
Definition jesd204.h:251
struct jesd204_topology_dev * devs
Definition jesd204.h:250
struct jesd204_dev_top * dev_top
Definition jesd204.h:249