GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LATC / dev > latc_wb / mv2304


Interface   Data Structures   File List   Data Fields   Globals  

latp.c File Reference

LATp operations. More...

#include <LATC/LATC_msgs.h>
#include <latp_p.h>
#include <data.h>
#include <AG_descriptions_s.h>
#include <AG_lem_s.h>
#include <AG_addr_s.h>
#include <AG_fldEnums_s.h>
#include <AG_regEnums_s.h>
#include <number.ic>
#include <LEM/msg_macros.h>
#include <LEM/list.h>
#include <LEM/decode.h>

Defines

#define NELEM(x)   (sizeof x / sizeof x[0])

Functions

static unsigned traverseRead (LATC_imm *imm, LEM_read *lem_r, LATC_type type, unsigned *index, LATC_addr *addr, unsigned depth, const LATC_map *ign)
 Traverse the LAT reading the configuration for all nodes.
static unsigned traverseLoad (LATC_imm *imm, LEM_load *lem_l, LATC_type type, unsigned *index, LATC_addr *addr, unsigned depth)
 Traverse the LAT reading the configuration for all nodes.
static unsigned loadReg (LEM_load *lem_l, LATC_addr *addr, unsigned reg, unsigned short *ptr)
 Load a single register.
static unsigned readReg (LEM_read *lem_r, LATC_addr *addr, unsigned reg, void *dst)
 Read a single register.
static void handleReadErrors (unsigned error, unsigned index, void *ptr)
 Read error callback routine for LATC.
static unsigned loadSimple (LATC_imm *imm, LEM_load *lem_l, LATC_type type)
 Load a generic LAT component.
static unsigned loadSplit (LATC_imm *imm, LEM_load *lem_l, int nLow, int nHigh)
 Load the layer splits.
static unsigned loadLayerSplit (LEM_load *lem_l, LATC_addr *addr, short low, short high)
 Load the splits for a single layer.
static unsigned loadTracker (LATC_imm *imm, LEM_load *lem_l, LATC_type type)
 Load the tracker front ends from the configuration tree.
static unsigned loadCpt (LATC_imm *imm, LEM_load *lem_l, LATC_type type, unsigned index, LATC_addr *addr)
 Set all the registers of the target component.
static unsigned readSimple (LATC_imm *imm, LEM_read *lem_r, LATC_type type, const LATC_map *ign)
 Read the current configuration for a register type.
static unsigned readSplit (LATC_imm *imm, LEM_read *lem_r, const LATC_map *ign)
 Read the current layer splits from the TRC TFE_CNT settings.
static unsigned readTracker (LATC_imm *imm, LEM_read *lem_r, LATC_type type, const LATC_map *ign)
 Read the current TFE settings.
static unsigned readCpt (LATC_imm *imm, LEM_read *lem_r, LATC_type type, unsigned index, LATC_addr *addr)
 Read all the registers of the current component.
unsigned LATC_read (LATC_imm *imm, LEM_micr *cr, LATC_di *di, const LATC_map *ign)
 Read the current configuration of the LAT.
unsigned LATC_load (LATC_imm *imm, LEM_micr *cr)
 Load the LAT with the configuration held in imm.
unsigned loadAfeConfig (LATC_imm *imm, unsigned int mask, unsigned int value0, unsigned int value1, unsigned int rcMask, unsigned int feMask, LEM_micr *cr)
 Load the AFE configuration register.
unsigned loadCfeConfig0 (LATC_imm *imm, unsigned int mask, unsigned int value, LEM_micr *cr)
 Load CFE configuration register 0.
unsigned loadCfeConfig1 (LATC_imm *imm, unsigned int mask, unsigned int value0, unsigned int value1, unsigned int cMask, LEM_micr *cr)
 Load CFE configuration register 1.
unsigned loadTkrSplits (LATC_imm *imm, int nLow, int nHigh, LEM_micr *cr)
 Load TKR splits values.
unsigned loadTfeDac (LATC_imm *imm, unsigned int mask, unsigned int value, int nLow, int nHigh, LEM_micr *cr)
 Load the TFE DAC register.
unsigned setTrigger (LATC_imm *imm, int enable, int marker, LEM_micr *cr)
 Enable or disable triggers.


Detailed Description

LATp operations.

Author:
James Swain & Owen Saxton
Id
latp.c,v 1.41 2011/04/08 00:20:45 apw Exp

Function Documentation

void handleReadErrors ( unsigned  error,
unsigned  index,
void *  ptr 
) [static]

Read error callback routine for LATC.

This routine clears the bit in the LATC_map corresponding to the register that failed to read

Parameters:
error Error field from a result item
index Index of the command the failed
ptr Pointer to the array of LATC_di

References clearBit().

Referenced by LATC_read().

unsigned LATC_load ( LATC_imm *  imm,
LEM_micr *  cr 
)

Load the LAT with the configuration held in imm.

Parameters:
imm The IMM structure to use as the basis for the load commands sent to the LAT
cr Pointer to structure holding multi-item command and response lists (plus some state information)
Return values:
LATC_SUCCESS If the LAT is loaded successfully
LEM_* If there is an error arising from one of the load commands

References LEM_load::cr, LEM_load::ldfn, loadSimple(), loadSplit(), and loadTracker().

Referenced by LATC_configure().

unsigned LATC_read ( LATC_imm *  imm,
LEM_micr *  cr,
LATC_di di,
const LATC_map *  ign 
)

Read the current configuration of the LAT.

Parameters:
imm Pointer to the IMM structure to populate from the LAT
cr Pointer to structure holding multi-item command and response lists (plus some state information)
di Array of lem_max_ci latc_di objects that capture read errors from the corresponding command items
ign Map of the sections of the lat known to be bad or not present so can be ignored.
Return values:
LATC_SUCCESS If all goes well - note that individual register reads may fail but the operation as a whole still succeeds.
LEM_* An error concerning the queuing of the c/r list
  • individual read command failures are noted in the map associated with the IMM.

References LEM_read::cr, LEM_read::ddfn, LEM_read::di, handleReadErrors(), LEM_read::rdfn, readSimple(), readSplit(), and readTracker().

Referenced by LATC_capture().

unsigned loadAfeConfig ( LATC_imm *  imm,
unsigned int  mask,
unsigned int  value0,
unsigned int  value1,
unsigned int  rcMask,
unsigned int  feMask,
LEM_micr *  cr 
)

Load the AFE configuration register.

The AFE configuration register is loaded with a modified version of the value from the LAT configuration, with the specified bits replaced.

Parameters:
imm Pointer to the cached in-memory model of the LATC registers
mask Mask of bits to be changed from the configuration.
value0 The value to be masked and merged with the configuration value for front-ends not selected by the RC and FE masks.
value1 The value to be masked and merged with the configuration value for front-ends selected by the RC and FE masks.
rcMask Mask of bits, one per RC, specifying which RCs are selected.
feMask Mask of bits, one per FE, specifying which FEs within selected RCs are selected.
cr Multi-item command-response list used to load the modified registers
Return values:
LATC_SUCCESS if all goes well
LEM_* if there is an error arising from one of the register load commands

References LATC_addr::acd, checkBit(), LEM_load::cr, ACD_addr::fe, LEM_load::ldfn, loadReg(), and ACD_addr::rc.

Referenced by LATC_loadAfeConfig().

unsigned loadCfeConfig0 ( LATC_imm *  imm,
unsigned int  mask,
unsigned int  value,
LEM_micr *  cr 
)

Load CFE configuration register 0.

CFE configuration register 0 is loaded with a modified version of the value from the LAT configuration, with the specified bits replaced.

Parameters:
imm Pointer to the cached in-memory model of the LATC registers
mask Mask of bits to be changed from the configuration.
value The value to be masked and merged with the configuration value.
cr Multi-item command-response list used to load the modified registers
Return values:
LATC_SUCCESS if all goes well
LEM_* if there is an error arising from one of the register load commands

References TEM_addr::cc, checkBit(), LEM_load::cr, TEM_addr::fe, LEM_load::ldfn, loadReg(), TEM_addr::rc, LATC_addr::tem, and TEM_addr::to.

Referenced by LATC_loadCfeConfig0().

unsigned loadCfeConfig1 ( LATC_imm *  imm,
unsigned int  mask,
unsigned int  value0,
unsigned int  value1,
unsigned int  cMask,
LEM_micr *  cr 
)

Load CFE configuration register 1.

CFE configuration register 1 is loaded with a modified version of the value from the LAT configuration, with the specified bits replaced.

Parameters:
imm Pointer to the cached in-memory model of the LATC registers
mask Mask of bits to be changed from the configuration.
value0 The value to be masked and merged with the configuration value for front-ends whose bit is clear in the column mask.
value1 The value to be masked and merged with the configuration value for front-ends whose bit is set in the column mask.
cMask Mask of bits, one per column, specifying which value is to be used for loading the config register.
cr Multi-item command-response list used to load the modified registers
Return values:
LATC_SUCCESS if all goes well
LEM_* if there is an error arising from one of the register load commands

References TEM_addr::cc, checkBit(), LEM_load::cr, TEM_addr::fe, LEM_load::ldfn, loadReg(), TEM_addr::rc, LATC_addr::tem, and TEM_addr::to.

Referenced by LATC_loadCfeConfig1().

unsigned loadCpt ( LATC_imm *  imm,
LEM_load lem_l,
LATC_type  type,
unsigned  index,
LATC_addr addr 
) [static]

Set all the registers of the target component.

Parameters:
imm IMM structure containing the values to load onto the LAT
lem_l Pointer to the command/response lists to use for loading the LAT
type Component type
index Componenet instance being loaded
addr Hierarchical representation of the index (address of the instance)
Return values:
LATC_SUCCESS If the LAT is loaded successfully
LEM_* If there is an error arising from one of the load commands

References checkBit(), loadReg(), CptDescription::nregs, CptDescription::rd, RegDescription::regId, and CptDescription::width.

Referenced by loadSimple(), loadTracker(), and traverseLoad().

unsigned loadLayerSplit ( LEM_load lem_l,
LATC_addr addr,
short  low,
short  high 
) [static]

Load the splits for a single layer.

This routine loads the mode registers on all the TFEs in the layer and sets the split values in the CSRs of the two TRCs in the layer.

Parameters:
lem_l Pointer to the command and response lists used for loading the LAT
addr Pointer to an address structure used for loading the TFEs and TRC
low ID of the highest low talking TFE
high ID of the lowest high talking TFE
Return values:
LATC_SUCCESS If the LAT is loaded successfully
LEM_* If there is an error arising from one of the load commands

References TEM_addr::fe, LATC_addr::layer, LEM_load::ldfn, loadReg(), and LATC_addr::tem.

Referenced by loadSplit().

unsigned loadReg ( LEM_load lem_l,
LATC_addr addr,
unsigned  reg,
unsigned short *  ptr 
) [static]

Load a single register.

Parameters:
lem_l Pointer to the command/response lists to use for register loads
addr Pointer to a LATC_addr address structure
reg Register index
ptr Pointer to data to be loaded
Return values:
LATC_SUCCESS If the LAT is loaded successfully
LEM_* If there is an error arising from one of the load commands

References LEM_load::cr, and LEM_load::ldfn.

Referenced by loadAfeConfig(), loadCfeConfig0(), loadCfeConfig1(), loadCpt(), loadLayerSplit(), and loadTfeDac().

unsigned loadSimple ( LATC_imm *  imm,
LEM_load lem_l,
LATC_type  type 
) [static]

Load a generic LAT component.

Parameters:
imm IMM structure containing the values to load onto the LAT
lem_l Pointer to command and response lists used for loading the LAT
type Type of LAT component to load
Return values:
LATC_SUCCESS If the LAT is loaded successfully
LEM_* If there is an error arising from one of the load commands

References LATC_addr::cpt, loadCpt(), and traverseLoad().

Referenced by LATC_load().

unsigned loadSplit ( LATC_imm *  imm,
LEM_load lem_l,
int  nLow,
int  nHigh 
) [static]

Load the layer splits.

Parameters:
imm IMM structure containing the values to load onto the LAT
lem_l Pointer to the command response lists used for loading the LAT
nLow Number of TFEs to talk on the low side, or -1 if the configured values are to be used.
nHigh Number of TFEs to talk on the high side, or -1 if the configured values are to be used.
Return values:
LATC_SUCCESS If the LAT is loaded successfully
LEM_* If there is an error arising from one of the load commands

References checkBit(), Layer_addr::la, LATC_addr::layer, loadLayerSplit(), and Layer_addr::to.

Referenced by LATC_load(), and loadTkrSplits().

unsigned loadTfeDac ( LATC_imm *  imm,
unsigned int  mask,
unsigned int  value,
int  nLow,
int  nHigh,
LEM_micr *  cr 
)

Load the TFE DAC register.

The TFE DAC register is loaded with a modified version of the value from the LAT configuration, with the specified bits replaced.

Parameters:
imm Pointer to the cached in-memory model of the LATC registers
mask Mask of bits to be changed from the configuration.
value The value to be masked and merged with the configuration value.
nLow Number of TFEs talking on the low side, or -1 if the configured values are being used.
nHigh Number of TFEs talking on the high side, or -1 if the configured values are being used.
cr Multi-item command-response list used to load the modified registers
Return values:
LATC_SUCCESS if all goes well
LEM_* if there is an error arising from one of the register load commands

References checkBit(), LEM_load::cr, Layer_addr::fe, Layer_addr::la, LATC_addr::layer, LEM_load::ldfn, loadReg(), LATC_addr::tem, and Layer_addr::to.

Referenced by LATC_loadTfeDac().

unsigned loadTkrSplits ( LATC_imm *  imm,
int  nLow,
int  nHigh,
LEM_micr *  cr 
)

Load TKR splits values.

The tracker RC and FE registers are loaded to reflect the given split values.

Parameters:
imm Pointer to the cached in-memory model of the LATC registers
nLow Number of TFEs to talk on the low side, or -1 if the configured values are to be used.
nHigh Number of TFEs to talk on the high side, or -1 if the configured values are to be used.
cr Multi-item command-response list used to load the modified registers
Return values:
LATC_SUCCESS if all goes well
LEM_* if there is an error arising from one of the register load commands

References LEM_load::cr, LEM_load::ldfn, and loadSplit().

Referenced by LATC_loadTkrSplits().

unsigned loadTracker ( LATC_imm *  imm,
LEM_load lem_l,
LATC_type  type 
) [static]

Load the tracker front ends from the configuration tree.

Parameters:
imm IMM structure containing the values to load onto the LAT
lem_l Pointer to the command/response lists used for loading the LAT
type Type of component being loaded, either TFE or TDC
Return values:
LATC_SUCCESS If the LAT is loaded successfully
LEM_* If there is an error arising from one of the load commands

References checkBit(), Layer_addr::fe, Layer_addr::la, LATC_addr::layer, loadCpt(), LATC_addr::tem, and Layer_addr::to.

Referenced by LATC_load().

unsigned readCpt ( LATC_imm *  imm,
LEM_read lem_r,
LATC_type  type,
unsigned  index,
LATC_addr addr 
) [static]

Read all the registers of the current component.

Parameters:
imm Pointer to the structure to populate from the LAT register values
lem_r Command/response lists to use for the read
type Cpt type being read
index Instance of the component being read
addr Hierarchical representation of the index (address of the instance to read).
Return values:
LATC_SUCCESS If all goes well - note that individual register reads may fail but the operation as a whole still succeeds
LEM_* An error concerning the queuing of the C/R list
  • individual read command failures are noted in the map associated with the IMM.

References LEM_read::cr, LEM_read::di, LATC_di::index, LATC_di::map, CptDescription::nregs, CptDescription::rd, readReg(), RegDescription::regId, setBit(), LATC_di::type, and CptDescription::width.

Referenced by readSimple(), readTracker(), and traverseRead().

unsigned readReg ( LEM_read lem_r,
LATC_addr addr,
unsigned  reg,
void *  dst 
) [static]

Read a single register.

Parameters:
lem_r Pointer to command/response lists for reading the LAT registers
addr Hierarchical identification of the instance to read
reg Identification of the register to read
dst Location to place value read from register
Return values:
LATC_SUCCESS If all goes well - note that individual register reads may fail but the operation as a whole still succeeds
LEM_* An error concerning the queuing of the C/R list
  • individual read command failures are noted in the map associated with the IMM.

References LEM_read::cr, LEM_read::ddfn, and LEM_read::rdfn.

Referenced by readCpt(), and readSplit().

unsigned readSimple ( LATC_imm *  imm,
LEM_read lem_r,
LATC_type  type,
const LATC_map *  ign 
) [static]

Read the current configuration for a register type.

Parameters:
imm IMM structure being populated by the read operation
lem_r Pointer to the command/response lists and other structures used to read the LAT
type Component type to read
ign Map of the sections of the LAT known to be bad or not present so can be ignored.
Return values:
LATC_SUCCESS If all goes well - note that individual register reads may fail but the operation as a whole still succeeds
LEM_* An error concerning the queuing of the C/R list
  • individual read command failures are noted in the map associated with the IMM

References readCpt(), and traverseRead().

Referenced by LATC_read().

unsigned readSplit ( LATC_imm *  imm,
LEM_read lem_r,
const LATC_map *  ign 
) [static]

Read the current layer splits from the TRC TFE_CNT settings.

Parameters:
imm Pointer to the structure to populate from the LAT register values
lem_r Pointer to the command response lists
ign Map of the sections of the LAT known to be bad or not present so can be ignored.
Return values:
LATC_SUCCESS If all goes well - note that individual register reads may fail but the operation as a whole still succeeds
LEM_* An error concerning the queuing of the C/R list
  • individual read command failures are noted in the map associated with the IMM.

References checkBit(), LEM_read::cr, LEM_read::di, LATC_di::index, Layer_addr::la, LATC_addr::layer, LATC_di::map, readReg(), setBit(), LATC_addr::tem, Layer_addr::to, and LATC_di::type.

Referenced by LATC_read().

unsigned readTracker ( LATC_imm *  imm,
LEM_read lem_r,
LATC_type  type,
const LATC_map *  ign 
) [static]

Read the current TFE settings.

Parameters:
imm Pointer to the structure to populate from the LAT register values
lem_r Pointer to the command/response lists used for reading the LAT
type Component type being read (either TFE or TDC)
ign Map of the sections of the LAT known to be bad or not present so can be ignored.
Return values:
LATC_SUCCESS If all goes well - note that individual register reads may fail but the operation as a whole still succeeds
LEM_* An error concerning the queuing of the C/R list
  • individual read command failures are noted in the map associated with the IMM.

References checkBit(), Layer_addr::fe, Layer_addr::la, LATC_addr::layer, readCpt(), LATC_addr::tem, and Layer_addr::to.

Referenced by LATC_read().

unsigned setTrigger ( LATC_imm *  imm,
int  enable,
int  marker,
LEM_micr *  cr 
)

Enable or disable triggers.

This routine enables or disables LAT triggers. If the marker parameter is non-zero, the LAT is first configured to broadcast a trigger message to all CPUs upon receipt of a solicited trigger, a solicited trigger is issued, and the configuration restored from the IMM data.

Parameters:
imm IMM structure containing LAT configuration data
enable If non-zero, triggers are anabled; otherwise disabled
marker If non-zero, causes a solicited trigger with this value in the event data.
cr Pointer to the multi-item command/response list.
Return values:
LATC_SUCCESS if all goes well
LEM_* if there is an error arising from one of the register load commands

Referenced by LATC_disableTriggers(), and LATC_enableTriggers().

unsigned traverseLoad ( LATC_imm *  imm,
LEM_load lem_l,
LATC_type  type,
unsigned *  index,
LATC_addr addr,
unsigned  depth 
) [static]

Traverse the LAT reading the configuration for all nodes.

This routine loads the configuration for any instances of the current component whose configuration differs from the default

Parameters:
imm IMM structure containing the values to load onto the LAT
lem_l Pointer to the command response lists used for loading the LAT
type Type of component to load
index Pointer to the index of the next instance to load
addr Hierarchical representation of the index
depth Number of recursive calls to traverse_Load
Return values:
LATC_SUCCESS If the LAT is loaded successfully
LEM_* If there is an error arising from one of the load commands

References LATC_addr::cpt, and loadCpt().

Referenced by loadSimple().

unsigned traverseRead ( LATC_imm *  imm,
LEM_read lem_r,
LATC_type  type,
unsigned *  index,
LATC_addr addr,
unsigned  depth,
const LATC_map *  ign 
) [static]

Traverse the LAT reading the configuration for all nodes.

Parameters:
imm Pointer to the structure to populate from the LAT register values
lem_r Pointer to the command/response lists used for reading the LAT
type The type of component to read
index Pointer to a variable tracking the current instance being read
addr Pointer to an address structure containing the same information as index, but in heirarchical form
depth Number of times this function has been recursively called.
ign Map of the sections of the LAT known to be bad or not present so can be ignored.
Return values:
LATC_SUCCESS If all goes well - note that individual register reads may fail but the operation as a whole still succeeds
LEM_* An error concerning the queuing of the C/R list
  • individual read command failures are noted in the map associated with the IMM.

References checkBit(), LATC_addr::cpt, and readCpt().

Referenced by readSimple().


Generated on Thu Apr 7 17:39:14 2011 by  doxygen 1.5.8