Data Structures | Defines | Typedefs | Enumerations | Functions | Variables

/scratch/npr78/temp/xspress3_api/det-software/none_vme/xspress3/lib/xspress3_fem_api.c File Reference

Data Structures

struct  _protocol_header

Defines

#define SBIT(val, bit)   val |= (1 << (bit-1))
#define CMPBIT(val, bit)   val & (1 << (bit-1))

Typedefs

typedef struct _protocol_header ProtocolHeader

Enumerations

enum  protocol_commands {
  CMD_UNSUPPORTED = 0, CMD_ACCESS = 1, CMD_INTERNAL = 2, CMD_ACQUIRE = 3,
  CMD_PERSONALITY = 4
}
enum  protocol_bus_type {
  BUS_UNSUPPORTED = 0, BUS_EEPROM = 1, BUS_I2C = 2, BUS_RAW_REG = 3,
  BUS_RDMA = 4, BUS_SPI = 5, BUS_DIRECT = 6, BUS_FAN_CONT = 7,
  BUS_FEM_CONFIG = 8
}
enum  protocol_data_width { WIDTH_UNSUPPORTED = 0, WIDTH_BYTE = 1, WIDTH_WORD = 2, WIDTH_LONG = 3 }
enum  protocol_status {
  STATE_UNSUPPORTED = 0, STATE_READ = 1, STATE_WRITE = 2, STATE_ACK = 6,
  STATE_NACK = 7
}

Functions

int32_t femAccessRead (FemHandle *femHandle, u_int32_t bus, u_int32_t width, u_int32_t address, u_int32_t num, u_int8_t *payload)
 Execute a read transaction on the connected FEM.
int32_t femAccessWrite (FemHandle *femHandle, u_int32_t bus, u_int32_t width, u_int32_t address, u_int8_t *payload, u_int32_t size)
 Execute a write transaction on the connected FEM.
int32_t femPersonalityWrite (FemHandle *femHandle, u_int32_t subCommand, u_int32_t width, u_int32_t streamMask, u_int8_t *payload, size_t size)
 Execute a personality write transaction on the connected FEM.
void encodeTransaction (u_int8_t *transaction, u_int8_t cmd, u_int8_t bus, u_int8_t width, u_int8_t state, u_int32_t address, u_int8_t *payload, u_int32_t payloadSize)
int32_t sendTransaction (int fd, u_int8_t *transaction, u_int32_t bytes)
int32_t responseTransaction (int fd, u_int8_t *transaction, u_int32_t len)
int32_t responsePayload (int fd, u_int8_t *payload, u_int32_t bytes, u_int8_t width)
unsigned char * getMacAddressFromIP (char *ipName)
 Get the MAC address corresponding to the given IP address.
void to_bytes (char *ipName, unsigned char *b, int n)
void * xspress3FemInitialise (const char *hostname, int port)
 Initialises client connection to a FEM.
void xspress3FemClose (void *femHandle)
 Closes the xspress3 client connection to a FEM/.
int xspress3FemSetInt (void *femHandle, int chan, int region, int offset, u_int32_t value)
 Perform a single integer write transaction to the FEM.
int xspress3FemSetIntArray (void *femHandle, int chan, int region, int offset, size_t size, u_int32_t *value)
 Write an array of integers to the FEM.
int xspress3FemGetInt (void *femHandle, int chan, int region, int offset, u_int32_t *value)
int xspress3FemGetIntArray (void *femHandle, int chan, int region, int offset, size_t size, u_int32_t *value)
int xspress3FemReadRawReg (void *femHandle, u_int32_t address, size_t size, u_int32_t *value)
int32_t xspress3FemConfigUDP (void *femHandle, char *fpgaMACaddress, char *fpgaIPaddress, int fpgaPort, char *hostIPaddress, int hostPort)
int xspress3FemSetHostPort (void *femHandle, int hostPort)
int32_t xspress3FemSetFarmLUT (void *femHandle, int index, char *hostIPaddress, int hostPort)
int xspress3FemSetPacketSize (void *femHandle, int sizeInBytes)
int xspress3FemResetFrameCounter (void *femHandle)
int xspress3FemDRAMWrite (void *femHandle, u_int32_t address, size_t size, u_int32_t *value)
int xspress3FemPersonalityWrite (void *femHandle, u_int32_t sub_command, u_int32_t stream_mask, size_t size, u_int32_t *value)
 Perform a write transaction to the FEM.
int xspress3FemGetDMAStatusBlock (void *femHandle, u_int32_t *value)
int xspress3FemRDMARead (void *femHandle, u_int32_t address, size_t size, u_int32_t *value)
int xspress3FemRDMAWrite (void *femHandle, u_int32_t address, size_t size, u_int32_t *value)
int xspress3FemSPIRead (void *femHandle, u_int32_t address, size_t size, u_int32_t *value)
int xspress3FemSPIWrite (void *femHandle, u_int32_t address, size_t size, u_int32_t *value)
int xspress3FemI2CWrite (void *femHandle, u_int32_t fem_i2c_bus, u_int32_t address, size_t size, u_int8_t *value)
int xspress3FemI2CRead (void *femHandle, u_int32_t fem_i2c_bus, u_int32_t address, size_t size, u_int8_t *value)
int xspress3FemWriteFanControl (void *femHandle, int offset, size_t size, u_int32_t *value)
int xspress3FemReadFanControl (void *femHandle, u_int32_t offset, size_t size, u_int32_t *value)
int xspress3FemConfigWrite (void *femHandle, u_int32_t address, size_t size, u_int8_t *value)
int xspress3FemConfigRead (void *femHandle, u_int32_t address, size_t size, u_int8_t *value)

Variables

const int MAGIC = 0xdeadbeef
const int IP_IDENT_COUNT = 0xDB00
const int IP_PKT_LENGTH_BASE = 0x1c
const int UDP_LENGTH_BASE = 0x0008
const int PACKET_SPLIT_SIZE = 0x3e6
const int INT_PKT_GAP_VAL = 0xA
const int INT_PKT_GAP_EN = 0x1
const int DEBUG_MODE_EN = 0x2
const int DEBUG_MODE_STEP = 0x4
const int FXD_PKT_SZE = 0x8
char error_message []
const int MAX_TX_PAYLOAD_LWORDS = 16*1024
const int MAX_RX_PAYLOAD_LWORDS = 255
const int MAX_DIRECT_TX_PAYLOAD_LWORDS = 256
const int MAX_DIRECT_RX_PAYLOAD_LWORDS = 255
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER

Define Documentation

#define CMPBIT (   val,
  bit 
)    val & (1 << (bit-1))
#define SBIT (   val,
  bit 
)    val |= (1 << (bit-1))

Typedef Documentation


Enumeration Type Documentation

Enumerator:
BUS_UNSUPPORTED 
BUS_EEPROM 
BUS_I2C 
BUS_RAW_REG 

V5P memory-mapped peripherals.

BUS_RDMA 

Downstream configuration.

BUS_SPI 

SPI bus.

BUS_DIRECT 

Direct memory write.

BUS_FAN_CONT 

Access to the fan control internal memory.

BUS_FEM_CONFIG 

Access to the FEM Config.

Enumerator:
CMD_UNSUPPORTED 
CMD_ACCESS 
CMD_INTERNAL 
CMD_ACQUIRE 
CMD_PERSONALITY 
Enumerator:
WIDTH_UNSUPPORTED 
WIDTH_BYTE 
WIDTH_WORD 
WIDTH_LONG 
Enumerator:
STATE_UNSUPPORTED 
STATE_READ 
STATE_WRITE 
STATE_ACK 
STATE_NACK 

Function Documentation

void encodeTransaction ( u_int8_t *  transaction,
u_int8_t  cmd,
u_int8_t  bus,
u_int8_t  width,
u_int8_t  state,
u_int32_t  address,
u_int8_t *  payload,
u_int32_t  payloadSize 
)
int32_t responsePayload ( int  fd,
u_int8_t *  payload,
u_int32_t  bytes,
u_int8_t  width 
)
int32_t responseTransaction ( int  fd,
u_int8_t *  transaction,
u_int32_t  len 
)
int32_t sendTransaction ( int  fd,
u_int8_t *  transaction,
u_int32_t  bytes 
)
void to_bytes ( char *  ipName,
unsigned char *  b,
int  n 
)
int xspress3FemConfigRead ( void *  femHandle,
u_int32_t  address,
size_t  size,
u_int8_t *  value 
)
int32_t xspress3FemConfigUDP ( void *  femHandle,
char *  fpgaMACaddress,
char *  fpgaIPaddress,
int  fpgaPort,
char *  hostIPaddress,
int  hostPort 
)
int xspress3FemConfigWrite ( void *  femHandle,
u_int32_t  address,
size_t  size,
u_int8_t *  value 
)
int xspress3FemDRAMWrite ( void *  femHandle,
u_int32_t  address,
size_t  size,
u_int32_t *  value 
)
int xspress3FemGetDMAStatusBlock ( void *  femHandle,
u_int32_t *  value 
)
int xspress3FemGetInt ( void *  femHandle,
int  chan,
int  region,
int  offset,
u_int32_t *  value 
)
int xspress3FemGetIntArray ( void *  femHandle,
int  chan,
int  region,
int  offset,
size_t  size,
u_int32_t *  value 
)
int xspress3FemI2CRead ( void *  femHandle,
u_int32_t  fem_i2c_bus,
u_int32_t  address,
size_t  size,
u_int8_t *  value 
)
int xspress3FemI2CWrite ( void *  femHandle,
u_int32_t  fem_i2c_bus,
u_int32_t  address,
size_t  size,
u_int8_t *  value 
)
int xspress3FemRDMARead ( void *  femHandle,
u_int32_t  address,
size_t  size,
u_int32_t *  value 
)
int xspress3FemRDMAWrite ( void *  femHandle,
u_int32_t  address,
size_t  size,
u_int32_t *  value 
)
int xspress3FemReadFanControl ( void *  femHandle,
u_int32_t  offset,
size_t  size,
u_int32_t *  value 
)
int xspress3FemReadRawReg ( void *  femHandle,
u_int32_t  address,
size_t  size,
u_int32_t *  value 
)
int xspress3FemResetFrameCounter ( void *  femHandle  ) 
int32_t xspress3FemSetFarmLUT ( void *  femHandle,
int  index,
char *  hostIPaddress,
int  hostPort 
)
int xspress3FemSetHostPort ( void *  femHandle,
int  hostPort 
)
int xspress3FemSetPacketSize ( void *  femHandle,
int  sizeInBytes 
)
int xspress3FemSPIRead ( void *  femHandle,
u_int32_t  address,
size_t  size,
u_int32_t *  value 
)
int xspress3FemSPIWrite ( void *  femHandle,
u_int32_t  address,
size_t  size,
u_int32_t *  value 
)
int xspress3FemWriteFanControl ( void *  femHandle,
int  offset,
size_t  size,
u_int32_t *  value 
)

Variable Documentation

const int DEBUG_MODE_EN = 0x2
const int DEBUG_MODE_STEP = 0x4
char error_message[]
const int FXD_PKT_SZE = 0x8
const int INT_PKT_GAP_EN = 0x1
const int INT_PKT_GAP_VAL = 0xA
const int IP_IDENT_COUNT = 0xDB00
const int IP_PKT_LENGTH_BASE = 0x1c
const int MAGIC = 0xdeadbeef
const int MAX_RX_PAYLOAD_LWORDS = 255
const int MAX_TX_PAYLOAD_LWORDS = 16*1024
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER
const int PACKET_SPLIT_SIZE = 0x3e6
const int UDP_LENGTH_BASE = 0x0008