Switchtec Userspace  PROJECT_NUMBER = PROJECT_NUMBER=PROJECT_NUMBER = 2.2
Classes | Functions | Variables
switchtec.c File Reference

Switchtec core library functions for basic device operations. More...

#include "switchtec_priv.h"
#include "switchtec/switchtec.h"
#include "switchtec/mrpc.h"
#include "switchtec/errors.h"
#include "switchtec/log.h"
#include "switchtec/endian.h"
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
Include dependency graph for switchtec.c:

Go to the source code of this file.

Classes

struct  switchtec_device_id
 Switchtec device id to generation/variant mapping. More...
 

Functions

struct switchtec_dev * switchtec_open (const char *device)
 Open a Switchtec device by string. More...
 
_PURE int switchtec_device_id (struct switchtec_dev *dev)
 Get the device id of the device. More...
 
_PURE enum switchtec_gen switchtec_gen (struct switchtec_dev *dev)
 Get the generation of the device. More...
 
_PURE enum switchtec_variant switchtec_variant (struct switchtec_dev *dev)
 Get the variant type of the device. More...
 
_PURE enum switchtec_boot_phase switchtec_boot_phase (struct switchtec_dev *dev)
 Get boot phase of the device. More...
 
_PURE const char * switchtec_name (struct switchtec_dev *dev)
 Get the string that was used to open the deviec. More...
 
_PURE int switchtec_partition (struct switchtec_dev *dev)
 Get the partiton number of the device that was opened. More...
 
int switchtec_status (struct switchtec_dev *dev, struct switchtec_status **status)
 Get the status of all the ports on a switchtec device. More...
 
void switchtec_status_free (struct switchtec_status *status, int ports)
 Free a list of status structures allocated by switchtec_status() More...
 
const char * switchtec_strerror (void)
 Return a message coresponding to the last error. More...
 
void switchtec_perror (const char *str)
 Print an error string to stdout. More...
 
int switchtec_echo (struct switchtec_dev *dev, uint32_t input, uint32_t *output)
 Perform an MRPC echo command. More...
 
int switchtec_hard_reset (struct switchtec_dev *dev)
 Perform an MRPC hard reset command. More...
 
int switchtec_log_to_file (struct switchtec_dev *dev, enum switchtec_log_type type, int fd)
 Dump the Switchtec log data to a file. More...
 
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. More...
 
float switchtec_die_temp (struct switchtec_dev *dev)
 Get the die temperature of the switchtec device. More...
 

Variables

static const struct switchtec_device_id switchtec_device_id_tbl []
 Supported Switchtec device id table.
 
int mrpc_error_cmd
 The MRPC command ID when errno is set. More...
 

Detailed Description

Switchtec core library functions for basic device operations.

Definition in file switchtec.c.