GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> FES / V6-2-0 > fes / i845e


Interface   Data Structures   File List   Data Fields   Globals  

fesDevice.c File Reference

FES device access routines. More...

#include "fesFpga.h"
#include "fesDevice.h"
#include "fesMsgs.h"
#include "EMSG/EMSG_pubdefs.h"
#include <plx.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vxWorks.h>
#include <memLib.h>
#include <sysLib.h>

Functions

int fesDevInit (void)
 Initialize device information table.
int fesDevUnits (void)
 Get the number of hardware units present.
void fesDevIntConnect (int unit, void(*pFunc)(int), int arg)
 Connect to interrupts.
int fesDevLoadCode (int unit, const char *file)
 Load FPGA code.
void fesDevBusReset (int unit, int reload)
 Reset a board's local bus.
unsigned int fesDevConfRegGet (int unit)
 Get configuration register.
void fesDevConfRegSet (int unit, int value)
 Set configuration register.
unsigned int fesDevSyncRegGet (int unit)
 Get sync register.
void fesDevSyncRegSet (int unit, int value)
 Set sync register.
unsigned int fesDevDispRegGet (int unit)
 Get display register.
void fesDevDispRegSet (int unit, int value)
 Set display register.
unsigned int fesDevEvtsRegGet (int unit)
 Get events register.
void fesDevEvtsRegClr (int unit)
 Clear events register.
void fesDevReset (int unit, int value)
 Perform reset.
int fesDevIdGet (int unit)
 Get device ID.
unsigned int fesDevIntRegGet (int unit)
 Get interrupt register.
void fesDevIntRegSet (int unit, int value)
 Set interrupt register.
int fesDevIsRunning (int unit)
 Get running state.
int fesDevEpldType (int unit)
 Get EPLD type.
int fesDevType (int unit)
 Get device type.
void fesDevLedDisp (int unit, char data, int invert)
 Display character on LED.
unsigned int fesDevCntlRegGet (int unit, int fpga)
 Get control register.
void fesDevCntlRegSet (int unit, int fpga, int value)
 Set control register.
unsigned int fesDevOneShotGet (int unit, int fpga)
 Get one-shot register.
void fesDevOneShotSet (int unit, int fpga, int value)
 Set one-shot register.
unsigned int fesDevEventsReq (int unit, int fpga)
 Get events requested.
unsigned int fesDevTFifoStat (int unit, int fpga)
 Get TMEM FIFO status register.
unsigned int fesDevTMemWPtrGet (int unit, int fpga)
 Get TMEM write pointer.
void fesDevTMemWPtrSet (int unit, int fpga, int value)
 Set TMEM write pointer.
unsigned int fesDevTMemRPtrGet (int unit, int fpga)
 Get TMEM read pointer.
void fesDevTMemRPtrSet (int unit, int fpga, int value)
 Set TMEM read pointer.
unsigned int fesDevTPtrStat (int unit, int fpga)
 Get TMEM pointer status register.
unsigned int fesDevTMemIntLvlGet (int unit, int fpga)
 Get TMEM interrupt level.
void fesDevTMemIntLvlSet (int unit, int fpga, int value)
 Set TMEM interrupt level.
int fesDevTwfStatus (int unit, int fpga)
 Get TMEM write FIFO status.
int fesDevTwfLevel (int unit, int fpga)
 Get TMEM write FIFO level.
int fesDevTrfStatus (int unit, int fpga)
 Get TMEM read FIFO status.
int fesDevTrfLevel (int unit, int fpga)
 Get TMEM read FIFO level.
int fesDevTMemStatus (int unit, int fpga)
 Get TMEM status.
int fesDevTMemLevel (int unit, int fpga)
 Get TMEM level.
int fesDevFpgaType (int unit, int fpga)
 Get the FPGA type.
int fesDevFpgaRunning (int unit, int fpga)
 Get FPGA run state.
unsigned int fesDevEvctMaskGet (int unit, int fpga)
 Get event counter mask register.
void fesDevEvctMaskSet (int unit, int fpga, int value)
 Set event count mask register.
unsigned int fesDevEventsAck (int unit, int cable)
 Get events acknowledged.
unsigned int fesDevDFifoStat (int unit, int cable)
 Get DMEM FIFO status register.
unsigned int fesDevDMemWPtrGet (int unit, int cable)
 Get DMEM write pointer.
void fesDevDMemWPtrSet (int unit, int cable, int value)
 Set DMEM write pointer.
unsigned int fesDevDMemRPtrGet (int unit, int cable)
 Get DMEM read pointer.
void fesDevDMemRPtrSet (int unit, int cable, int value)
 Set DMEM read pointer.
unsigned int fesDevDPtrStat (int unit, int cable)
 Get DMEM pointer status register.
unsigned int fesDevDMemIntLvlGet (int unit, int cable)
 Get DMEM interrupt level.
void fesDevDMemIntLvlSet (int unit, int cable, int value)
 Set DMEM interrupt level.
unsigned int fesDevRcCntlRegGet (int unit, int cable)
 Get RC control register.
void fesDevRcCntlRegSet (int unit, int cable, int value)
 Set RC control register.
unsigned int fesDevSccStatGet (int unit, int cable)
 Get SCC status register.
void fesDevSccStatSet (int unit, int cable, int value)
 Set SCC status register.
unsigned int fesDevSdcCntlRegGet (int unit, int cable)
 Get SDC register.
void fesDevSdcCntlRegSet (int unit, int cable, int value)
 Set SDC register.
int fesDevDwfStatus (int unit, int cable)
 Get DMEM write FIFO status.
int fesDevDwfLevel (int unit, int cable)
 Get DMEM write FIFO level.
int fesDevDrfStatus (int unit, int cable)
 Get DMEM read FIFO status.
int fesDevDrfLevel (int unit, int cable)
 Get DMEM read FIFO level.
int fesDevDMemStatus (int unit, int cable)
 Get DMEM status.
int fesDevDMemLevel (int unit, int cable)
 Get DMEM level.
int fesDevDmaToTMem (int unit, int fpga, const char *buf, int bytes)
 Perform DMA transfer to TMEM.
int fesDevDmaFromTMem (int unit, int fpga, char *buf, int bytes)
 Perform DMA transfer from TMEM.
int fesDevCopyToTMem (int unit, int fpga, const char *buf, int bytes)
 Perform copy to TMEM.
int fesDevCopyFromTMem (int unit, int fpga, char *buf, int bytes)
 Perform copy from TMEM.
int fesDevDmaToDMem (int unit, int cable, const char *buf, int bytes)
 Perform DMA transfer to DMEM.
int fesDevDmaFromDMem (int unit, int cable, char *buf, int bytes)
 Perform DMA transfer from DMEM.
int fesDevCopyToDMem (int unit, int cable, const char *buf, int bytes)
 Perform copy to DMEM.
int fesDevCopyFromDMem (int unit, int cable, char *buf, int bytes)
 Perform copy from DMEM.
int fesDevDmaToPMem (int unit, int fpga, const char *buf, int offset, int bytes)
 Perform DMA transfer to PMEM.
int fesDevDmaFromPMem (int unit, int fpga, char *buf, int offset, int bytes)
 Perform DMA transfer from PMEM.
int fesDevCopyToPMem (int unit, int fpga, const char *buf, int offset, int bytes)
 Perform copy to PMEM.
int fesDevCopyFromPMem (int unit, int fpga, char *buf, int offset, int bytes)
 Perform copy from PMEM.
int fesDevStatShow (int unit)
 Display device status.
int fesDevRegsGet (int unit, fesDevRegs_t *regs)
 Get the contents of device registers.
void fesDevRegsDisp (const fesDevRegs_t *regs)
 Display device registers.
int fesDevShow (int unit)
 Show device registers.


Detailed Description

FES device access routines.

Author:
Mark A McDougald, Owen H Saxton
Id

Function Documentation

void fesDevBusReset ( int  unit,
int  reload 
)

Reset a board's local bus.

This routine resets the local bus on the specified FES board.

Parameters:
unit The hardware unit number of the board.
reload If TRUE, the board's configuration registers are reloaded from eeprom.

unsigned int fesDevCntlRegGet ( int  unit,
int  fpga 
)

Get control register.

This routine gets the contents of the control register for the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
The contents of the register.

void fesDevCntlRegSet ( int  unit,
int  fpga,
int  value 
)

Set control register.

This routine sets the control register for the specified FPGA on the specified FES board to the given value.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
value The register value to be set.

unsigned int fesDevConfRegGet ( int  unit  ) 

Get configuration register.

This routine gets the contents of the configuration register on the specified FES board.

Parameters:
unit The hardware unit number of the board.
Returns:
The contents of the register.

void fesDevConfRegSet ( int  unit,
int  value 
)

Set configuration register.

This routine sets the configuration register on the specified board to the given value.

Parameters:
unit The hardware unit number of the board.
value The register value to be set.

int fesDevCopyFromDMem ( int  unit,
int  cable,
char *  buf,
int  bytes 
)

Perform copy from DMEM.

This routine performs a (non-DMA) copy of data from the specified data memory to CPU memory. The address in data memory is specified by the value of its read pointer.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number of the data memory.
buf The address of the data to be received.
bytes The number of bytes to be transferred.
Return values:
FES_SUCCESS Success.
FES_INVHWUNI The unit number is invalid.
FES_INVBALGN The address is not aligned on a 16-byte boundary.
FES_INVBLENG The length is not a multiple of 4 or exceeds the maximum allowed (1M).

int fesDevCopyFromPMem ( int  unit,
int  fpga,
char *  buf,
int  offset,
int  bytes 
)

Perform copy from PMEM.

This routine performs a (non-DMA) copy of data from the specified pedestal memory location to CPU memory.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number of the pedestal memory.
buf The address of the data to be received.
offset The offset into pedestal memory for the transfer.
bytes The number of bytes to be transferred.
Return values:
FES_SUCCESS Success.
FES_INVHWUNI The unit number is invalid.
FES_INVBALGN The address is not aligned on a 4-byte boundary.
FES_INVDVOFF The memory offset is not a multiple of 4.
FES_INVBLENG The length is not a multiple of 4 or exceeds the maximum allowed (1M).

int fesDevCopyFromTMem ( int  unit,
int  fpga,
char *  buf,
int  bytes 
)

Perform copy from TMEM.

This routine performs a (non-DMA) copy of data from the specified transition memory to CPU memory. The address in transition memory is specified by the value of its read pointer.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number of the transition memory.
buf The address of the data to be received.
bytes The number of bytes to be transferred.
Return values:
FES_SUCCESS Success.
FES_INVHWUNI The unit number is invalid.
FES_INVBALGN The address is not aligned on a 16-byte boundary.
FES_INVBLENG The length is not a multiple of 4 or exceeds the maximum allowed (1M).

int fesDevCopyToDMem ( int  unit,
int  cable,
const char *  buf,
int  bytes 
)

Perform copy to DMEM.

This routine performs a (non-DMA) copy of data from CPU memory to the specified data memory. The address in data memory is specified by the value of its write pointer.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number of the data memory.
buf The address of the data to be transferred.
bytes The number of bytes to be transferred.
Return values:
FES_SUCCESS Success.
FES_INVHWUNI The unit number is invalid.
FES_INVBALGN The address is not aligned on a 16-byte boundary.
FES_INVBLENG The length is not a multiple of 4 or exceeds the maximum allowed (1M).

int fesDevCopyToPMem ( int  unit,
int  fpga,
const char *  buf,
int  offset,
int  bytes 
)

Perform copy to PMEM.

This routine performs a (non-DMA) copy of data from CPU memory to the specified pedestal memory location.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number of the pedestal memory.
buf The address of the data to be transferred.
offset The offset into pedestal memory for the transfer.
bytes The number of bytes to be transferred.
Return values:
FES_SUCCESS Success.
FES_INVHWUNI The unit number is invalid.
FES_INVBALGN The address is not aligned on a 4-byte boundary.
FES_INVDVOFF The memory offset is not a multiple of 4.
FES_INVBLENG The length is not a multiple of 4 or exceeds the maximum allowed (1M).

int fesDevCopyToTMem ( int  unit,
int  fpga,
const char *  buf,
int  bytes 
)

Perform copy to TMEM.

This routine performs a (non-DMA) copy of data from CPU memory to the specified transition memory. The address in transition memory is specified by the value of its write pointer.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number of the transition memory.
buf The address of the data to be transferred.
bytes The number of bytes to be transferred.
Return values:
FES_SUCCESS Success.
FES_INVHWUNI The unit number is invalid.
FES_INVBALGN The address is not aligned on a 16-byte boundary.
FES_INVBLENG The length is not a multiple of 4 or exceeds the maximum allowed (1M).

unsigned int fesDevDFifoStat ( int  unit,
int  cable 
)

Get DMEM FIFO status register.

This routine gets the contents of the data memory FIFO status register for the specified cable on the specified FES board.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
Returns:
The register contents.

unsigned int fesDevDispRegGet ( int  unit  ) 

Get display register.

This routine gets the contents of the display register on the specified FES board.

Parameters:
unit The hardware unit number of the board.
Returns:
The contents of the register.

void fesDevDispRegSet ( int  unit,
int  value 
)

Set display register.

This routine sets the display register on the specified board to the given value.

Parameters:
unit The hardware unit number of the board.
value The register value to be set.

int fesDevDmaFromDMem ( int  unit,
int  cable,
char *  buf,
int  bytes 
)

Perform DMA transfer from DMEM.

This routine performs a DMA transfer of data from the specified data memory to CPU memory. The address in data memory is specified by the value of its read pointer.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number of the data memory.
buf The address of the data to be received.
bytes The number of bytes to be transferred.
Return values:
FES_SUCCESS Success.
FES_INVHWUNI The unit number is invalid.
FES_INVBALGN The address is not aligned on a 16-byte boundary.
FES_INVBLENG The length is not a multiple of 4 or exceeds the maximum allowed (1M).
FES_DMAFAIL The DMA transfer failed (not reported).

int fesDevDmaFromPMem ( int  unit,
int  fpga,
char *  buf,
int  offset,
int  bytes 
)

Perform DMA transfer from PMEM.

This routine performs a DMA transfer of data from the specified pedestal memory location to CPU memory.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number of the pedestal memory.
buf The address of the data to be received.
offset The offset into pedestal memory for the transfer.
bytes The number of bytes to be transferred.
Return values:
FES_SUCCESS Success.
FES_INVHWUNI The unit number is invalid.
FES_INVBALGN The address is not aligned on a 4-byte boundary.
FES_INVDVOFF The memory offset is not a multiple of 4.
FES_INVBLENG The length is not a multiple of 4 or exceeds the maximum allowed (1M).
FES_DMAFAIL The DMA transfer failed (not reported).

int fesDevDmaFromTMem ( int  unit,
int  fpga,
char *  buf,
int  bytes 
)

Perform DMA transfer from TMEM.

This routine performs a DMA transfer of data from the specified transition to CPU memory. The address in transition emeory is specified by the value of its read pointer.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number of the transition memory.
buf The address of the data to be received.
bytes The number of bytes to be transferred.
Return values:
FES_SUCCESS Success.
FES_INVHWUNI The unit number is invalid.
FES_INVBALGN The address is not aligned on a 16-byte boundary.
FES_INVBLENG The length is not a multiple of 4 or exceeds the maximum allowed (1M).
FES_DMAFAIL The DMA transfer failed (not reported).

int fesDevDmaToDMem ( int  unit,
int  cable,
const char *  buf,
int  bytes 
)

Perform DMA transfer to DMEM.

This routine performs a DMA transfer of data from CPU memory to the specified data memory. The address in data memory is specified by the value of its write pointer.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number of the data memory.
buf The address of the data to be transferred.
bytes The number of bytes to be transferred.
Return values:
FES_SUCCESS Success.
FES_INVHWUNI The unit number is invalid.
FES_INVBALGN The address is not aligned on a 16-byte boundary.
FES_INVBLENG The length is not a multiple of 4 or exceeds the maximum allowed (1M).
FES_DMAFAIL The DMA transfer failed (not reported).

int fesDevDmaToPMem ( int  unit,
int  fpga,
const char *  buf,
int  offset,
int  bytes 
)

Perform DMA transfer to PMEM.

This routine performs a DMA transfer of data from CPU memory to the specified pedestal memory location.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number of the pedestal memory.
buf The address of the data to be transferred.
offset The offset into pedestal memory for the transfer.
bytes The number of bytes to be transferred.
Return values:
FES_SUCCESS Success.
FES_INVHWUNI The unit number is invalid.
FES_INVBALGN The address is not aligned on a 4-byte boundary.
FES_INVDVOFF The memory offset is not a multiple of 4.
FES_INVBLENG The length is not a multiple of 4 or exceeds the maximum allowed (1M).
FES_DMAFAIL The DMA transfer failed (not reported).

int fesDevDmaToTMem ( int  unit,
int  fpga,
const char *  buf,
int  bytes 
)

Perform DMA transfer to TMEM.

This routine performs a DMA transfer of data from CPU memory to the specified transition memory. The address in transition memory is specified by the value of its write pointer.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number of the transition memory.
buf The address of the data to be transferred.
bytes The number of bytes to be transferred.
Return values:
FES_SUCCESS Success.
FES_INVHWUNI The unit number is invalid.
FES_INVBALGN The address is not aligned on a 16-byte boundary.
FES_INVBLENG The length is not a multiple of 4 or exceeds the maximum allowed (1M).
FES_DMAFAIL The DMA transfer failed (not reported).

unsigned int fesDevDMemIntLvlGet ( int  unit,
int  cable 
)

Get DMEM interrupt level.

This routine gets the data memory interrupt level for the specified FES board.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
Returns:
The DMEM interrupt level.

void fesDevDMemIntLvlSet ( int  unit,
int  cable,
int  value 
)

Set DMEM interrupt level.

This routine sets the data memory interrupt level for the specified cable on the specified FES board to the given value.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
value The interrupt level to be set.

int fesDevDMemLevel ( int  unit,
int  cable 
)

Get DMEM level.

This routine gets the data memory level for the specified cable on the specified FES board.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
Returns:
The data memory level.

unsigned int fesDevDMemRPtrGet ( int  unit,
int  cable 
)

Get DMEM read pointer.

This routine gets the data memory read pointer for the specified cable on the specified FES board.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
Returns:
The DMEM read pointer.

void fesDevDMemRPtrSet ( int  unit,
int  cable,
int  value 
)

Set DMEM read pointer.

This routine sets the data memory read pointer for the specified cable on the specified FES board to the given value.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
value The read pointer value to be set.

int fesDevDMemStatus ( int  unit,
int  cable 
)

Get DMEM status.

This routine gets the data memory status for the specified cable on the specified FES board.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
Returns:
The data memory status.

unsigned int fesDevDMemWPtrGet ( int  unit,
int  cable 
)

Get DMEM write pointer.

This routine gets the data memory write pointer for the specified cable on the specified FES board.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
Returns:
The DMEM write pointer.

void fesDevDMemWPtrSet ( int  unit,
int  cable,
int  value 
)

Set DMEM write pointer.

This routine sets the data memory write pointer for the specified cable on the specified FES board to the given value.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
value The write pointer value to be set.

unsigned int fesDevDPtrStat ( int  unit,
int  cable 
)

Get DMEM pointer status register.

This routine gets the data memory pointer status register for the specified cable on the specified FES board.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
Returns:
The register contents.

int fesDevDrfLevel ( int  unit,
int  cable 
)

Get DMEM read FIFO level.

This routine gets the data memory read FIFO level for the specified cable on the specified FES board.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
Returns:
The DMEM read FIFO level.

int fesDevDrfStatus ( int  unit,
int  cable 
)

Get DMEM read FIFO status.

This routine gets the data memory read FIFO status for the specified cable on the specified FES board.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
Returns:
The DMEM read FIFO status.

int fesDevDwfLevel ( int  unit,
int  cable 
)

Get DMEM write FIFO level.

This routine gets the data memory write FIFO level for the specified cable on the specified FES board.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
Returns:
The DMEM write FIFO level.

int fesDevDwfStatus ( int  unit,
int  cable 
)

Get DMEM write FIFO status.

This routine gets the data memory write FIFO status for the specified cable on the specified FES board.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
Returns:
The DMEM write FIFO status.

int fesDevEpldType ( int  unit  ) 

Get EPLD type.

This routine gets the EPLD type of the specified FES board.

Parameters:
unit The hardware unit number of the board.
Returns:
The type of EPLD formware loaded on the board. Valid values are DEV_EPLD_TYP_SIM and DEV_EPLD_TYP_CTL. The value 0xff can be returned if there is a problem communicating with the board.

unsigned int fesDevEvctMaskGet ( int  unit,
int  fpga 
)

Get event counter mask register.

This routine gets the event counter mask register for the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
The contents of the register.

void fesDevEvctMaskSet ( int  unit,
int  fpga,
int  value 
)

Set event count mask register.

This routine sets the event count mask register for the specified FPGA on the specified FES board to the given value.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
value The register value to be set. Only the low order ten bits are used.

unsigned int fesDevEventsAck ( int  unit,
int  cable 
)

Get events acknowledged.

This routine gets the number of events acknowledged on the specified cable on the specified FES board.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
Returns:
The number of events acknowledged.

unsigned int fesDevEventsReq ( int  unit,
int  fpga 
)

Get events requested.

This routine gets the number of events requested for the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
The number of event requested.

void fesDevEvtsRegClr ( int  unit  ) 

Clear events register.

This routine clears the events register on the specified FES board.

Parameters:
unit The hardware unit number of the board.

unsigned int fesDevEvtsRegGet ( int  unit  ) 

Get events register.

This routine gets the contents of the events register on the specified FES board.

Parameters:
unit The hardware unit number of the board.
Returns:
The contents of the register.

int fesDevFpgaRunning ( int  unit,
int  fpga 
)

Get FPGA run state.

This routine gets the run state of the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
TRUE if the FPGA is in the running state.

int fesDevFpgaType ( int  unit,
int  fpga 
)

Get the FPGA type.

This routine gets the FPGA code type for the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
The FPGA code type.

int fesDevIdGet ( int  unit  ) 

Get device ID.

This routine gets the device ID set in the DIP switch on the specified FES board.

Parameters:
unit The hardware unit number of the board.
Returns:
The device ID

int fesDevInit ( void   ) 

Initialize device information table.

This routine initializes the device information table using hardware information about the attached FES boards.

Return values:
0 Always success.

void fesDevIntConnect ( int  unit,
void(*)(int)  pFunc,
int  arg 
)

Connect to interrupts.

This routine connects a routine to interrupts from the specified FES board.

Parameters:
unit The hardware unit number of the board.
pFunc The routine to be called whenever an interrupt occurs. It is called with one argument, arg, below.
arg The argument for the interrupt routine.

unsigned int fesDevIntRegGet ( int  unit  ) 

Get interrupt register.

This routine gets the contents of the interrupt register on the specified FES board.

Parameters:
unit The hardware unit number of the board.
Returns:
The contents of the register.

void fesDevIntRegSet ( int  unit,
int  value 
)

Set interrupt register.

This routine sets the interrupt register on the specified board to the given value.

Parameters:
unit The hardware unit number of the board.
value The register value to be set.

int fesDevIsRunning ( int  unit  ) 

Get running state.

This routine gets the running state of the specified FES board.

Parameters:
unit The hardware unit number of the board.
Returns:
The running state, TRUE or FALSE.

void fesDevLedDisp ( int  unit,
char  data,
int  invert 
)

Display character on LED.

The given character is displayed, if possible, on the 7-segment LED display on the specified board.

Parameters:
unit The hardware unit number of the board.
data The characer to be displayed.
invert If TRUE, the character is displayed upside down.

int fesDevLoadCode ( int  unit,
const char *  file 
)

Load FPGA code.

This routine loads the FPGA code for the specified FES board.

Parameters:
unit The hardware unit number of the board.
file The name of the file containing the code, in TTF format, to be loaded.
Return values:
FES_SUCCESS The FPGAs were loaded successfully.
FES_FPGANRDY The board was not ready for loading.
FES_EFILOPEN Unable to open the code file.
FES_NOMEMORY Insufficient memory for buffers.
FES_EFILERD Error reading the code file.
FES_EPRGFPGA An error occurred while programming an FPGA.
FES_FPGAFAIL The FPGA load failed to complete.

unsigned int fesDevOneShotGet ( int  unit,
int  fpga 
)

Get one-shot register.

This routine gets the contents of the one-shot register for the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
The contents of the register.

void fesDevOneShotSet ( int  unit,
int  fpga,
int  value 
)

Set one-shot register.

This routine sets the one-shot register for the specified FPGA on the specified FES board to the given value.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
value The register value to be set. Only the low order six bits are used.

unsigned int fesDevRcCntlRegGet ( int  unit,
int  cable 
)

Get RC control register.

This routine gets the readout controller control register for the specified cable on the specified FES board.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
Returns:
The register contents.

void fesDevRcCntlRegSet ( int  unit,
int  cable,
int  value 
)

Set RC control register.

This routine sets the readout controller control register for the specified cable on the specified FES board to the given value.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
value The register value to be set.

void fesDevRegsDisp ( const fesDevRegs_t regs  ) 

Display device registers.

The device register values in the supplied structure are displayed.

Parameters:
regs The address of a structure containing a set of device registers for an FES board. The routine fesDevRegsGet can be used to fill it.

int fesDevRegsGet ( int  unit,
fesDevRegs_t regs 
)

Get the contents of device registers.

This routine reads most of the registers on the specified FES board and stores them in a structure.

Parameters:
unit The hardware unit number of the board.
regs The address of the structure to receive the register values.
Return values:
FES_SUCCESS The registers were successfully read.
FES_INVHWUNI The unit number was invalid.

void fesDevReset ( int  unit,
int  value 
)

Perform reset.

This routine writes the given value to the reset register on the specified board.

Parameters:
unit The hardware unit number of the board.
value Mask of the resets to be performed.

unsigned int fesDevSccStatGet ( int  unit,
int  cable 
)

Get SCC status register.

This routine gets the serial command controller status register for the specified cable on the specified FES board.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
Returns:
The register contents.

void fesDevSccStatSet ( int  unit,
int  cable,
int  value 
)

Set SCC status register.

This routine sets the serial command controller status register for the specified cable on the specified FES board to the given value.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
value The register value to be set.

unsigned int fesDevSdcCntlRegGet ( int  unit,
int  cable 
)

Get SDC register.

This routine gets the serial data controller register for the specified cable on the specified FES board.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
Returns:
The register contents.

void fesDevSdcCntlRegSet ( int  unit,
int  cable,
int  value 
)

Set SDC register.

This routine sets the serial data controller register for the specified cable on the specified FES board to the given value.

Parameters:
unit The hardware unit number of the board.
cable The hardware cable number.
value The register value to be set.

int fesDevShow ( int  unit  ) 

Show device registers.

This routine displays the contents of all the registers on the specified FES board.

Parameters:
unit The hardweare unit number of the board.
Returns:
Always 0.

int fesDevStatShow ( int  unit  ) 

Display device status.

This routine displays brief status for the specified FES board.

Parameters:
unit The hardware unit number of the board.
Returns:
Always 0.

unsigned int fesDevSyncRegGet ( int  unit  ) 

Get sync register.

This routine gets the contents of the sync register on the specified FES board.

Parameters:
unit The hardware unit number of the board.
Returns:
The contents of the register.

void fesDevSyncRegSet ( int  unit,
int  value 
)

Set sync register.

This routine sets the sync register on the specified board to the given value.

Parameters:
unit The hardware unit number of the board.
value The register value to be set.

unsigned int fesDevTFifoStat ( int  unit,
int  fpga 
)

Get TMEM FIFO status register.

This routine gets the contents of the transition memory FIFO status register for the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
The contents of the register.

unsigned int fesDevTMemIntLvlGet ( int  unit,
int  fpga 
)

Get TMEM interrupt level.

This routine gets the transition memory interrupt level for the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
The TMEM interrupt level.

void fesDevTMemIntLvlSet ( int  unit,
int  fpga,
int  value 
)

Set TMEM interrupt level.

This routine sets the TMEM interrupt level for the specified FPGA on the specified FES board to the given value.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
value The TMEM interrupt level to be set.

int fesDevTMemLevel ( int  unit,
int  fpga 
)

Get TMEM level.

This routine gets the transition memory level for the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
The transition memory level.

unsigned int fesDevTMemRPtrGet ( int  unit,
int  fpga 
)

Get TMEM read pointer.

This routine gets the transition memory read pointer for the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
The TMEM read pointer.

void fesDevTMemRPtrSet ( int  unit,
int  fpga,
int  value 
)

Set TMEM read pointer.

This routine sets the transition memory read pointer for the specified FPGA on the specified FES board to the given value.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
value The TMEM read pointer value to be set.

int fesDevTMemStatus ( int  unit,
int  fpga 
)

Get TMEM status.

This routine gets the transition memory status for the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
The transition memory status.

unsigned int fesDevTMemWPtrGet ( int  unit,
int  fpga 
)

Get TMEM write pointer.

This routine gets the transition memory write pointer for the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
The TMEM write pointer.

void fesDevTMemWPtrSet ( int  unit,
int  fpga,
int  value 
)

Set TMEM write pointer.

This routine sets the transition memory write pointer for the specified FPGA on the specified FES board to the given value.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
value The TMEM write pointer value to be set.

unsigned int fesDevTPtrStat ( int  unit,
int  fpga 
)

Get TMEM pointer status register.

This routine gets the contents of the transition memory pointer status register for the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
The contents of the register.

int fesDevTrfLevel ( int  unit,
int  fpga 
)

Get TMEM read FIFO level.

This routine gets the transition memory read FIFO level for the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
The TMEM read FIFO level.

int fesDevTrfStatus ( int  unit,
int  fpga 
)

Get TMEM read FIFO status.

This routine gets the transition memory read FIFO status for the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
The TMEM read FIFO status.

int fesDevTwfLevel ( int  unit,
int  fpga 
)

Get TMEM write FIFO level.

This routine gets the transition memory write FIFO level for the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
The TMEM write FIFO level.

int fesDevTwfStatus ( int  unit,
int  fpga 
)

Get TMEM write FIFO status.

This routine gets the transition memory write FIFO status for the specified FPGA on the specified FES board.

Parameters:
unit The hardware unit number of the board.
fpga The hardware FPGA number.
Returns:
The TMEM write FIFO status.

int fesDevType ( int  unit  ) 

Get device type.

This routine gets the device type of the specified FES board.

Parameters:
unit The hardware unit number of the board.
Returns:
The type of FPGA firmware loaded on the board. Normal values are DEV_TYP_TKR, DEV_TYP_CAL, DEV_TYP_ACD, or DEV_TYP_CTL. The value DEV_TYP_UNK is returned if there is a problem communicating with the board. The value 0x0f can be returned if the FPGA code has not loaded.

int fesDevUnits ( void   ) 

Get the number of hardware units present.

Returns:
The number of FES boards (hardware units) attached to the system.


Generated on Tue Aug 18 17:05:44 2009 by  doxygen 1.5.3