28 #ifndef __ONLP_SFP_H__ 29 #define __ONLP_SFP_H__ 32 #include <onlp/onlp.h> 34 #include <AIM/aim_bitmap.h> 35 #include <AIM/aim_pvs.h> 42 ONLP_SFP_CONTROL_RESET,
43 ONLP_SFP_CONTROL_RESET_STATE,
44 ONLP_SFP_CONTROL_RX_LOS,
45 ONLP_SFP_CONTROL_TX_FAULT,
46 ONLP_SFP_CONTROL_TX_DISABLE,
47 ONLP_SFP_CONTROL_TX_DISABLE_CHANNEL,
48 ONLP_SFP_CONTROL_LP_MODE,
49 ONLP_SFP_CONTROL_POWER_OVERRIDE,
50 ONLP_SFP_CONTROL_LAST = ONLP_SFP_CONTROL_POWER_OVERRIDE,
51 ONLP_SFP_CONTROL_COUNT,
52 ONLP_SFP_CONTROL_INVALID = -1,
59 ONLP_SFP_CONTROL_FLAG_RESET = (1 << 0),
60 ONLP_SFP_CONTROL_FLAG_RESET_STATE = (1 << 1),
61 ONLP_SFP_CONTROL_FLAG_RX_LOS = (1 << 2),
62 ONLP_SFP_CONTROL_FLAG_TX_FAULT = (1 << 3),
63 ONLP_SFP_CONTROL_FLAG_TX_DISABLE = (1 << 4),
64 ONLP_SFP_CONTROL_FLAG_TX_DISABLE_CHANNEL = (1 << 5),
65 ONLP_SFP_CONTROL_FLAG_LP_MODE = (1 << 6),
66 ONLP_SFP_CONTROL_FLAG_POWER_OVERRIDE = (1 << 7),
75 ONLP_SFP_TYPE_LAST = ONLP_SFP_TYPE_QSFP28,
77 ONLP_SFP_TYPE_INVALID = -1,
86 #define ONLP_SFP_BLOCK_DATA_SIZE 256 244 uint8_t* dst,
int count);
256 int devaddr,
int addr,
int count,
268 uint8_t* src,
int count);
393 #define ONLP_SFP_CONTROL_STRINGS \ 400 "TX_DISABLE_CHANNEL", \ 414 #define ONLP_SFP_CONTROL_VALID(_e) \ 415 ( (0 <= (_e)) && ((_e) <= ONLP_SFP_CONTROL_POWER_OVERRIDE)) 437 #define ONLP_SFP_CONTROL_FLAG_VALID(_e) \ 438 (onlp_sfp_control_flag_valid((_e))) 446 #define ONLP_SFP_TYPE_STRINGS \ 463 #define ONLP_SFP_TYPE_VALID(_e) \ 464 ( (0 <= (_e)) && ((_e) <= ONLP_SFP_TYPE_QSFP28)) uint8_t a0[ONLP_SFP_BLOCK_DATA_SIZE]
Definition: sfp.h:127
onlp Configuration Header
struct onlp_sfp_info_t::@0 bytes
aim_map_si_t onlp_sfp_control_flag_map[]
int onlp_sfp_dev_alloc_read(onlp_oid_t port, int devaddr, int addr, int count, uint8_t **rv)
Read bytes from the target device on the given SFP port.
aim_map_si_t onlp_sfp_control_map[]
int onlp_sfp_hw_denit(void)
Hardware deinitialize the SFP subsystem.
const char * onlp_sfp_type_name(onlp_sfp_type_t e)
int onlp_sfp_control_flags_get(onlp_oid_t port, uint32_t *flags)
Get the value of all SFP controls.
int onlp_sfp_presence_bitmap_get(onlp_sfp_bitmap_t *dst)
Return the presence bitmap for all ports.
int onlp_sfp_rx_los_bitmap_get(onlp_sfp_bitmap_t *dst)
Get the RX_LOS bitmap for all ports.
onlp_sfp_control_flag_e
Definition: sfp.h:58
const char * onlp_sfp_type_desc(onlp_sfp_type_t e)
int onlp_sfp_control_get(onlp_oid_t port, onlp_sfp_control_t control, int *value)
Get an SFP control.
aim_map_si_t onlp_sfp_type_map[]
uint32_t onlp_oid_t
Definition: oids.h:52
uint8_t a2[ONLP_SFP_BLOCK_DATA_SIZE]
Definition: sfp.h:130
int onlp_sfp_type_get(onlp_oid_t port, onlp_sfp_type_t *rtype)
Determine the SFP Connector type.
int onlp_sfp_info_get(onlp_oid_t port, onlp_sfp_info_t *info)
Get the SFP information structure.
int onlp_sfp_post_insert(onlp_oid_t port, sff_info_t *info)
Perform any actions required after an SFP is inserted.
int onlp_sfp_control_flag_value(const char *str, onlp_sfp_control_flag_t *e, int substr)
int onlp_sfp_hw_init(uint32_t flags)
Hardware initialization of the SFP module.
void onlp_sfp_bitmap_t_init(onlp_sfp_bitmap_t *bmap)
int onlp_sfp_dev_writeb(onlp_oid_t port, int devaddr, int addr, uint8_t value)
Write a byte to the target device on the given SFP port.
int onlp_sfp_hdr_get(onlp_oid_t port, onlp_oid_hdr_t *rv)
Get the SFP's oid header.
int onlp_sfp_control_value(const char *str, onlp_sfp_control_t *e, int substr)
onlp_sfp_type_e
Definition: sfp.h:70
int onlp_sfp_type_value(const char *str, onlp_sfp_type_t *e, int substr)
aim_map_si_t onlp_sfp_control_desc_map[]
int onlp_sfp_control_flag_valid(onlp_sfp_control_flag_t e)
int onlp_sfp_dev_readw(onlp_oid_t port, int devaddr, int addr)
Read a word from the target device on the given SFP port.
const char * onlp_sfp_control_flag_name(onlp_sfp_control_flag_t e)
int onlp_sfp_bitmap_get(onlp_sfp_bitmap_t *bmap)
Get the set of valid SFP ports.
const char * onlp_sfp_control_flag_desc(onlp_sfp_control_flag_t e)
int onlp_sfp_dev_read(onlp_oid_t port, int devaddr, int addr, uint8_t *dst, int count)
Read bytes from the target device on the given SFP port.
int onlp_sfp_dev_write(onlp_oid_t port, int devaddr, int addr, uint8_t *src, int count)
Write bytes to the target device on the given SFP port.
int onlp_sfp_control_set(onlp_oid_t port, onlp_sfp_control_t control, int value)
Set an SFP control.
const char * onlp_sfp_control_desc(onlp_sfp_control_t e)
int onlp_sfp_info_to_user_json(onlp_sfp_info_t *info, cJSON **rv, uint32_t flags)
Convert an SFP info structure to user JSON.
int onlp_sfp_is_present(onlp_oid_t port)
Determine if an SFP is currently plugged in.
aim_bitmap256_t onlp_sfp_bitmap_t
Definition: sfp.h:138
int onlp_sfp_info_dom_get(onlp_oid_t port, onlp_sfp_info_t *info)
Get the SFP information structure (including DOM)
uint32_t controls
Definition: sfp.h:100
int onlp_sfp_inventory_show(aim_pvs_t *pvs)
Show the current SFP inventory.
sff_dom_info_t dom
Definition: sfp.h:122
int onlp_sfp_sw_init(void)
Software initialization of the SFP module.
enum onlp_sfp_control_flag_e onlp_sfp_control_flag_t
enum onlp_sfp_type_e onlp_sfp_type_t
const char * onlp_sfp_control_name(onlp_sfp_control_t e)
int onlp_sfp_info_to_json(onlp_sfp_info_t *info, cJSON **rv, uint32_t flags)
Convert an SFP info structure to JSON.
onlp_sfp_control_e
Definition: sfp.h:41
enum onlp_sfp_control_e onlp_sfp_control_t
int onlp_sfp_port_valid(onlp_oid_t port)
Determine if a given port number is a valid SFP port.
onlp_oid_hdr_t hdr
Definition: sfp.h:94
int onlp_sfp_sw_denit(void)
Deinitialize the sfp software module.
aim_map_si_t onlp_sfp_type_desc_map[]
sff_info_t sff
Definition: sfp.h:117
int onlp_sfp_dev_readb(onlp_oid_t port, int devaddr, int addr)
Read a byte from the target device on the given SFP port.
int onlp_sfp_info_from_json(cJSON *cj, onlp_sfp_info_t *info)
Convert a JSON object to an SFP info structure.
struct onlp_sfp_info_t onlp_sfp_info_t
int onlp_sfp_dev_writew(onlp_oid_t port, int devaddr, int addr, uint16_t value)
Write a word to the target device on the given SFP port.
#define ONLP_SFP_BLOCK_DATA_SIZE
Definition: sfp.h:86
aim_map_si_t onlp_sfp_control_flag_desc_map[]
onlp_sfp_type_t type
Definition: sfp.h:97