Velocity Userspace
|
Switchtec platform specific functions. More...
#include "../switchtec_priv.h"
#include "switchtec/switchtec.h"
#include "switchtec/gas.h"
#include "switchtec/gas_mrpc.h"
#include "switchtec/errors.h"
#include <string.h>
#include <errno.h>
Go to the source code of this file.
Functions | |
struct switchtec_dev * | switchtec_open_by_path (const char *path) |
Open a switchtec device by path. More... | |
struct switchtec_dev * | switchtec_open_by_index (int index) |
Open a switchtec device by index. More... | |
struct switchtec_dev * | switchtec_open_by_pci_addr (int domain, int bus, int device, int func) |
Open a switchtec device by PCI address (BDF) More... | |
struct switchtec_dev * | switchtec_open_i2c (const char *path, int i2c_addr) |
Open a switchtec device behind an I2C device. More... | |
struct switchtec_dev * | switchtec_open_uart (int fd) |
Open a switchtec device behind a uart device. More... | |
struct switchtec_dev * | switchtec_open_eth (const char *ip, const int inst) |
Open a switchtec device over ethernet. More... | |
void | switchtec_close (struct switchtec_dev *dev) |
Close a Switchtec device handle. More... | |
int | switchtec_list (struct switchtec_device_info **devlist) |
List all the switchtec devices in the system. More... | |
int | switchtec_get_fw_version (struct switchtec_dev *dev, char *buf, size_t buflen) |
Get the firmware version as a user readable string. More... | |
int | switchtec_cmd (struct switchtec_dev *dev, uint32_t cmd, const void *payload, size_t payload_len, void *resp, size_t resp_len) |
Execute an MRPC command. More... | |
int | switchtec_get_devices (struct switchtec_dev *dev, struct switchtec_status *status, int ports) |
Populate an already retrieved switchtec_status structure list with information about the devices plugged into the switch. More... | |
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. More... | |
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. More... | |
gasptr_t | switchtec_gas_map (struct switchtec_dev *dev, int writeable, size_t *map_size) |
Map the GAS and return a pointer to access the gas. More... | |
void | switchtec_gas_unmap (struct switchtec_dev *dev, gasptr_t map) |
Unmap the GAS region mapped with. More... | |
int | switchtec_flash_part (struct switchtec_dev *dev, struct switchtec_fw_image_info *info, enum switchtec_fw_image_part_id_gen3 part) |
Retrieve information about a flash partition. More... | |
int | switchtec_event_summary (struct switchtec_dev *dev, struct switchtec_event_summary *sum) |
Retrieve a summary of all the events that have occurred in the switch. More... | |
int | switchtec_event_ctl (struct switchtec_dev *dev, enum switchtec_event_id e, int index, int flags, uint32_t data[5]) |
Enable, disable and clear events or retrieve event data. More... | |
int | switchtec_event_wait (struct switchtec_dev *dev, int timeout_ms) |
Wait for any event to occur (typically just an interrupt) More... | |
int | gas_read8 (struct switchtec_dev *dev, uint8_t __gas *addr, uint8_t *val) |
Read a uint8_t from the GAS. More... | |
int | gas_read16 (struct switchtec_dev *dev, uint16_t __gas *addr, uint16_t *val) |
Read a uint16_t from the GAS. More... | |
int | gas_read32 (struct switchtec_dev *dev, uint32_t __gas *addr, uint32_t *val) |
Read a uint32_t from the GAS. More... | |
int | gas_read64 (struct switchtec_dev *dev, uint64_t __gas *addr, uint64_t *val) |
Read a uint64_t from the GAS. More... | |
void | gas_write8 (struct switchtec_dev *dev, uint8_t val, uint8_t __gas *addr) |
Write a uint8_t to the GAS. More... | |
void | gas_write16 (struct switchtec_dev *dev, uint16_t val, uint16_t __gas *addr) |
Write a uint16_t to the GAS. More... | |
void | gas_write32 (struct switchtec_dev *dev, uint32_t val, uint32_t __gas *addr) |
Write a uint32_t to the GAS. More... | |
void | gas_write64 (struct switchtec_dev *dev, uint64_t val, uint64_t __gas *addr) |
Write a uint64_t to the GAS. More... | |
void | memcpy_to_gas (struct switchtec_dev *dev, void __gas *dest, const void *src, size_t n) |
Copy data to the GAS. More... | |
int | memcpy_from_gas (struct switchtec_dev *dev, void *dest, const void __gas *src, size_t n) |
Copy data from the GAS. More... | |
ssize_t | write_from_gas (struct switchtec_dev *dev, int fd, const void __gas *src, size_t n) |
Call write() with data from the GAS. More... | |
Switchtec platform specific functions.
Definition in file platform.c.
int gas_read16 | ( | struct switchtec_dev * | dev, |
uint16_t __gas * | addr, | ||
uint16_t * | val | ||
) |
Read a uint16_t from the GAS.
[in] | dev | Switchtec device handle |
[in] | addr | Address to read the value |
[out] | val | Data read from GAS |
Definition at line 363 of file platform.c.
int gas_read32 | ( | struct switchtec_dev * | dev, |
uint32_t __gas * | addr, | ||
uint32_t * | val | ||
) |
Read a uint32_t from the GAS.
[in] | dev | Switchtec device handle |
[in] | addr | Address to read the value |
[out] | val | Data read from GAS |
Definition at line 380 of file platform.c.
int gas_read64 | ( | struct switchtec_dev * | dev, |
uint64_t __gas * | addr, | ||
uint64_t * | val | ||
) |
Read a uint64_t from the GAS.
[in] | dev | Switchtec device handle |
[in] | addr | Address to read the value |
[out] | val | Data read from GAS |
Definition at line 397 of file platform.c.
int gas_read8 | ( | struct switchtec_dev * | dev, |
uint8_t __gas * | addr, | ||
uint8_t * | val | ||
) |
Read a uint8_t from the GAS.
[in] | dev | Switchtec device handle |
[in] | addr | Address to read the value |
[out] | val | Data read from GAS |
Definition at line 346 of file platform.c.
int memcpy_from_gas | ( | struct switchtec_dev * | dev, |
void * | dest, | ||
const void __gas * | src, | ||
size_t | n | ||
) |
Copy data from the GAS.
[in] | dev | Switchtec device handle |
[out] | dest | Destination buffer |
[in] | src | Source gas address |
[in] | n | Number of bytes to transfer |
Definition at line 487 of file platform.c.