|
Switchtec Userspace PROJECT_NUMBER = 4.2
|
Various functions that fit don't fit into other categories. More...
Functions | |
| int | switchtec_echo (struct switchtec_dev *dev, uint32_t input, uint32_t *output) |
| Perform an MRPC echo command. | |
| int | switchtec_hard_reset (struct switchtec_dev *dev) |
| Perform an MRPC hard reset command. | |
| static void | free_log_defs (struct log_defs *defs) |
| Free log definition data. | |
| static int | realloc_log_defs (struct log_defs *defs, int num_modules) |
| Allocate / reallocate log definition data. | |
| static bool | parse_int (char *str, int *val) |
| Parse an integer from a string. | |
| static int | read_app_log_defs (FILE *log_def_file, struct log_defs *defs) |
| Read an app log definition file and store the definitions. | |
| static int | read_mailbox_log_defs (FILE *log_def_file, struct log_defs *defs) |
| Read a mailbox log definition file and store the definitions. | |
| static int | write_parsed_log (struct log_a_data log_data[], size_t count, int init_entry_idx, struct log_defs *defs, enum switchtec_log_parse_type log_type, FILE *log_file, int ts_factor) |
| Parse an app log or mailbox log and write the results to a file. | |
| int | switchtec_log_to_file (struct switchtec_dev *dev, enum switchtec_log_type type, int fd, FILE *log_def_file, struct switchtec_log_file_info *info) |
| Dump the Switchtec log data to a file. | |
| int | switchtec_parse_log (FILE *bin_log_file, FILE *log_def_file, FILE *parsed_log_file, enum switchtec_log_parse_type log_type, enum switchtec_gen gen, struct switchtec_log_file_info *info) |
| Parse a binary app log or mailbox log to a text file. | |
| int | switchtec_log_def_to_file (struct switchtec_dev *dev, enum switchtec_log_def_type type, FILE *file) |
| Dump the Switchtec log definition data to a file. | |
| int | switchtec_get_device_info (struct switchtec_dev *dev, enum switchtec_boot_phase *phase, enum switchtec_gen *gen, enum switchtec_rev *rev) |
| Get device generation, revision, and boot phase info. | |
| float | switchtec_die_temp (struct switchtec_dev *dev) |
| Get the die temperature of the switchtec device. | |
| int | switchtec_die_temps (struct switchtec_dev *dev, int nr_sensor, float *sensor_readings) |
| Get the die temperature sensor readings of the switchtec device. | |
| int | switchtec_calc_lane_id (struct switchtec_dev *dev, int phys_port_id, int lane_id, struct switchtec_status *port) |
| Calculate the global lane ID for a lane within a physical port. | |
| int | switchtec_calc_port_lane (struct switchtec_dev *dev, int lane_id, int *phys_port_id, int *port_lane_id, struct switchtec_status *port) |
| Calculate the port and lane within the port from a global lane ID. | |
| int | switchtec_calc_lane_mask (struct switchtec_dev *dev, int phys_port_id, int lane_id, int num_lanes, int *lane_mask, struct switchtec_status *port) |
| Calculate the lane mask for lanes within a physical port. | |
| bool | switchtec_stack_bif_port_valid (struct switchtec_dev *dev, int stack_id, int port_id) |
| Return true if a port within a stack is valid. | |
| int | switchtec_stack_bif_width (struct switchtec_dev *dev, int stack_id, int port_bif) |
| Return the number of stack ports used for a given bifurcation. | |
| int | switchtec_get_stack_bif (struct switchtec_dev *dev, int stack_id, int port_bif[SWITCHTEC_PORTS_PER_STACK]) |
| Get the bifurcation of ports in a stack. | |
| int | switchtec_set_stack_bif (struct switchtec_dev *dev, int stack_id, int port_bif[SWITCHTEC_PORTS_PER_STACK]) |
| Set the bifurcation of ports in a stack. | |
| int | switchtec_pff_to_port (struct switchtec_dev *dev, int pff, int *partition, int *port) |
| Convert a port function index to a partition and port number. | |
| int | switchtec_port_to_pff (struct switchtec_dev *dev, int partition, int port, int *pff) |
| Convert a partition and port number to a port function index. | |
Various functions that fit don't fit into other categories.
|
static |
Free log definition data.
| [in] | defs | - log definition data to free |
Definition at line 802 of file switchtec.c.
|
static |
Parse an integer from a string.
| [in] | str | - string to parse |
| [out] | val | - integer |
Definition at line 854 of file switchtec.c.
|
static |
Read an app log definition file and store the definitions.
| [in] | log_def_file | - log definition file |
| [out] | defs | - log definitions |
Definition at line 873 of file switchtec.c.
|
static |
Read a mailbox log definition file and store the definitions.
| [in] | log_def_file | - log definition file |
| [out] | defs | - log definitions |
Definition at line 982 of file switchtec.c.
|
static |
Allocate / reallocate log definition data.
| [in] | defs | - log definition data |
| [in] | num_modules | - number of modules to allocate for |
Definition at line 827 of file switchtec.c.
| int switchtec_calc_lane_id | ( | struct switchtec_dev * | dev, |
| int | phys_port_id, | ||
| int | lane_id, | ||
| struct switchtec_status * | port ) |
Calculate the global lane ID for a lane within a physical port.
| [in] | dev | Switchtec device handle |
| [in] | phys_port_id | Physical port id |
| [in] | lane_id | Lane number within the port |
| [out] | status | Optionally return the status of the port |
Definition at line 1967 of file switchtec.c.
| int switchtec_calc_lane_mask | ( | struct switchtec_dev * | dev, |
| int | phys_port_id, | ||
| int | lane_id, | ||
| int | num_lanes, | ||
| int * | lane_mask, | ||
| struct switchtec_status * | port ) |
Calculate the lane mask for lanes within a physical port.
| [in] | dev | Switchtec device handle |
| [in] | phys_port_id | Physical port id |
| [in] | lane_id | Lane number within the port |
| [in] | num_lanes | Number of consecutive lanes to set |
| [out] | lane_mask | Pointer to array of 4 integers to set the bits of the lanes to |
| [out] | status | Optionally, return the status of the port |
Definition at line 2071 of file switchtec.c.
| int switchtec_calc_port_lane | ( | struct switchtec_dev * | dev, |
| int | lane_id, | ||
| int * | phys_port_id, | ||
| int * | port_lane_id, | ||
| struct switchtec_status * | port ) |
Calculate the port and lane within the port from a global lane ID.
| [in] | dev | Switchtec device handle |
| [in] | lane_id | Global Lane Number |
| [out] | phys_port_id | Physical port id |
| [out] | port_lane | Lane number within the port |
| [out] | status | Optionally return the status of the port |
Definition at line 2007 of file switchtec.c.
| float switchtec_die_temp | ( | struct switchtec_dev * | dev | ) |
Get the die temperature of the switchtec device.
| [in] | dev | Switchtec device handle |
Definition at line 1791 of file switchtec.c.
| int switchtec_die_temps | ( | struct switchtec_dev * | dev, |
| int | nr_sensor, | ||
| float * | sensor_readings ) |
Get the die temperature sensor readings of the switchtec device.
| [in] | dev | Switchtec device handle |
| [in] | nr_sensor | Number of temp sensors to read |
| [out] | sensor_readings | Array of sensor readings (in degrees celsius) |
Definition at line 1835 of file switchtec.c.
| int switchtec_echo | ( | struct switchtec_dev * | dev, |
| uint32_t | input, | ||
| uint32_t * | output ) |
Perform an MRPC echo command.
| [in] | dev | Switchtec device handle |
| [in] | input | The input data for the echo command |
| [out] | output | The result of the echo command |
The echo command takes 4 bytes and returns the bitwise-not of those bytes.
Definition at line 774 of file switchtec.c.
| int switchtec_get_device_info | ( | struct switchtec_dev * | dev, |
| enum switchtec_boot_phase * | phase, | ||
| enum switchtec_gen * | gen, | ||
| enum switchtec_rev * | rev ) |
Get device generation, revision, and boot phase info.
| [in] | dev | Switchtec device handle |
| [out] | phase | The current boot phase |
| [out] | gen | Device generation |
| [out] | rev | Device revision |
Definition at line 1736 of file switchtec.c.
| int switchtec_get_stack_bif | ( | struct switchtec_dev * | dev, |
| int | stack_id, | ||
| int | port_bif[SWITCHTEC_PORTS_PER_STACK] ) |
Get the bifurcation of ports in a stack.
| [in] | dev | Switchtec device handle |
| [in] | stack_id | Stack ID to get the bifurcation of |
| [out] | port_bif | Port bifurcation returned |
Definition at line 2159 of file switchtec.c.
| int switchtec_hard_reset | ( | struct switchtec_dev * | dev | ) |
Perform an MRPC hard reset command.
| [in] | dev | Switchtec device handle |
Note: if your system does not support hotplug this may leave the Switchtec device in an unusable state. A reboot would be required to fix this.
Definition at line 790 of file switchtec.c.
| int switchtec_log_def_to_file | ( | struct switchtec_dev * | dev, |
| enum switchtec_log_def_type | type, | ||
| FILE * | file ) |
Dump the Switchtec log definition data to a file.
| [in] | dev | - Switchtec device handle |
| [in] | type | - Type of log definition data to dump |
| [in] | file | - File descriptor to dump the data to |
Definition at line 1658 of file switchtec.c.
| int switchtec_log_to_file | ( | struct switchtec_dev * | dev, |
| enum switchtec_log_type | type, | ||
| int | fd, | ||
| FILE * | log_def_file, | ||
| struct switchtec_log_file_info * | info ) |
Dump the Switchtec log data to a file.
| [in] | dev | - Switchtec device handle |
| [in] | type | - Type of log data to dump |
| [in] | fd | - File descriptor to dump the data to |
| [in] | log_def_file | - Log definition file |
| [out] | info | - Log file information |
Definition at line 1462 of file switchtec.c.
| int switchtec_parse_log | ( | FILE * | bin_log_file, |
| FILE * | log_def_file, | ||
| FILE * | parsed_log_file, | ||
| enum switchtec_log_parse_type | log_type, | ||
| enum switchtec_gen | gen, | ||
| struct switchtec_log_file_info * | info ) |
Parse a binary app log or mailbox log to a text file.
| [in] | bin_log_file | - Binary log input file |
| [in] | log_def_file | - Log definition file |
| [in] | parsed_log_file | - Parsed output file |
| [in] | log_type | - log type |
| [in] | gen | - device generation |
| [out] | info | - log file information |
Definition at line 1543 of file switchtec.c.
| int switchtec_pff_to_port | ( | struct switchtec_dev * | dev, |
| int | pff, | ||
| int * | partition, | ||
| int * | port ) |
Convert a port function index to a partition and port number.
| [in] | dev | Switchtec device handle |
| [in] | pff | Port function number |
| [out] | partition | Partition number |
| [out] | port | Port number |
Definition at line 213 of file platform.c.
| int switchtec_port_to_pff | ( | struct switchtec_dev * | dev, |
| int | partition, | ||
| int | port, | ||
| int * | pff ) |
Convert a partition and port number to a port function index.
| [in] | dev | Switchtec device handle |
| [in] | partition | Partition number |
| [in] | port | Port number |
| [out] | pff | Port function number |
Definition at line 228 of file platform.c.
| int switchtec_set_stack_bif | ( | struct switchtec_dev * | dev, |
| int | stack_id, | ||
| int | port_bif[SWITCHTEC_PORTS_PER_STACK] ) |
Set the bifurcation of ports in a stack.
| [in] | dev | Switchtec device handle |
| [in] | stack_id | Stack ID to get the bifurcation of |
| [in] | port_bif | Port bifurcation returned |
Definition at line 2203 of file switchtec.c.
| bool switchtec_stack_bif_port_valid | ( | struct switchtec_dev * | dev, |
| int | stack_id, | ||
| int | port_id ) |
Return true if a port within a stack is valid.
| [in] | dev | Switchtec device handle |
| [in] | stack_id | Stack ID |
| [out] | port_id | Port ID within the stack |
Definition at line 2118 of file switchtec.c.
| int switchtec_stack_bif_width | ( | struct switchtec_dev * | dev, |
| int | stack_id, | ||
| int | port_bif ) |
Return the number of stack ports used for a given bifurcation.
| [in] | dev | Switchtec device handle |
| [in] | stack_id | Stack ID |
| [in] | port_bif | Port bifurcation |
Definition at line 2134 of file switchtec.c.
|
static |
Parse an app log or mailbox log and write the results to a file.
| [in] | log_data | - logging data |
| [in] | count | - number of entries |
| [in] | init_entry_idx | - index of the initial entry |
| [in] | defs | - log definitions |
| [in] | log_type | - log type |
| [in] | log_file | - log output file |
| [in] | ts_factor | - timestamp conversion factor |
Definition at line 1052 of file switchtec.c.