Switchtec Userspace  PROJECT_NUMBER = PROJECT_NUMBER=PROJECT_NUMBER = 2.2
Functions
platform.c File Reference

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 <errno.h>
Include dependency graph for platform.c:

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...
 
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...
 
uint8_t gas_read8 (struct switchtec_dev *dev, uint8_t __gas *addr)
 Read a uint8_t from the GAS. More...
 
uint16_t gas_read16 (struct switchtec_dev *dev, uint16_t __gas *addr)
 Read a uint16_t from the GAS. More...
 
uint32_t gas_read32 (struct switchtec_dev *dev, uint32_t __gas *addr)
 Read a uint32_t from the GAS. More...
 
uint64_t gas_read64 (struct switchtec_dev *dev, uint64_t __gas *addr)
 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...
 
void 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...
 

Detailed Description

Switchtec platform specific functions.

Definition in file platform.c.