GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LEM / V4-6-0

Constituent: t_lem     Tag: sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

encode_macros.h File Reference

Fill the payload of a command item with a LATp command. More...

#include "LEM/defs.h"
#include "PBS/PARITY.h"
#include "LCBD/LCB_cr.h"

Include dependency graph for encode_macros.h:


Defines

#define PARITY_2(WD)   PARITY_4(0x3 & WD)
 0 if even number of set bits in the two LSB of WD, else 1
#define CMD_CLEAR(CMD)   CMD.ull[0] = CMD.ull[1] = 0;
 Set all bits of the CMD to 0.
#define LCB_HDR_ENCODE(HDR, FUNCTION)
 Encode the LCB command item header (distinct from the LATp header filled by HDR_ENCODE).
#define HDR_ENCODE(CMD, LATP_ADDRESS)   CMD.cell.header.dst = LATP_ADDRESS;
 Write the Destination LATp address into the LATp command header of the CMD.
#define BSC_PFX(CMD, TYPE, INSTANCE, EXTERNAL)
 Write a basic command string prefix into the CMD.
#define CAL_PFX(CMD, CCC_ID, CRC_ID, EXTERNAL)
 Write a calorimeter specific command string prefix into the CMD.
#define TKR_PFX(CMD, TCC_ID, EXTERNAL)
 Write a tracker specific command string prefix into the CMD.
#define LCL_PLD(CMD, PAYLOAD)
 Write the PAYLOAD into the CMD.
#define AEM_ENV_PLD(CMD, PAYLOAD)
 Write the PAYLOAD into the CMD.
#define DAB_PLD(CMD, PAYLOAD)   CMD.dab_cmd.payload = PAYLOAD;
 Write the PAYLOAD into the CMD.
#define ARC_PLD(CMD, PAYLOAD)
 Write the PAYLOAD into the CMD.
#define AFE_PLD(CMD, FUNCTION, AFE_ADDR,REG, PAYLOAD)
 Write the PAYLOAD into the CMD.
#define CAL_PLD(CMD, PAYLOAD)
 Write the PAYLOAD into the CMD.
#define TKR_PLD(CMD, PAYLOAD)
 Write the PAYLOAD into the CMD.
#define LCL_CMD(CMD, FUNCTION, REG)
 Complete the command as a command to a local (on TEM/AEM) register.
#define DAB_CMD(CMD, FUNCTION, BLOCK, REG, PAYLOAD)
 Complete the command as a DAB style command.
#define ACD_CMD(CMD, FUNCTION, IS_AFE, ADDR, REG)
 Complete the command as an ACD off-board command.
#define CAL_CMD(CMD, FUNCTION, CRC_ID, IS_CFE, CFE_ID, REG, PAYLOAD)
 Complete the command as a CAL off-board command.
#define TKR_CMD(CMD, FUNCTION, TRC_ID, IS_TFE, TFE_ID, REG, PAYLOAD)
 Complete the command as a TKR off-board command.
#define TEM_ENCODE(CMD, FUNCTION, LATP_ADDRESS, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at the common controller block of a TEM.
#define TIC_ENCODE(CMD, FUNCTION, LATP_ADDRESS, REG, PAYLOAD)
 Pack a LATpCommand union with a command tageted at the TIC block of a TEM.
#define CCC_ENCODE(CMD, FUNCTION, LATP_ADDRESS, CCC_ID, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at a CCC.
#define CRC_ENCODE(CMD, FUNCTION, LATP_ADDRESS, CCC_ID, CRC_ID, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at a CRC.
#define CFE_ENCODE(CMD, FUNCTION, LATP_ADDRESS, CCC_ID, CRC_ID, CFE_ID, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at a CFE.
#define TCC_ENCODE(CMD, FUNCTION, LATP_ADDRESS, TCC_ID, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at a TCC.
#define TRC_ENCODE(CMD, FUNCTION, LATP_ADDRESS, TCC_ID, TRC_ID, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at a TRC.
#define TFE_ENCODE(CMD, FUNCTION, LATP_ADDRESS, TCC_ID, TRC_ID, TFE_ID, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at a TFE.
#define TDC_ENCODE(CMD, FUNCTION, LATP_ADDRESS, TCC_ID, TRC_ID, TFE_ID, PAYLOAD)
 Pack a LATpCommand union with a command targeted at the DAC register of the TFE.
#define AEM_ENCODE(CMD, FUNCTION, LATP_ADDRESS, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at the common controller block of the AEM.
#define AEM_ENV_ENCODE(CMD, FUNCTION, LATP_ADDRESS, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at the enviroment block of the AEM.
#define ARC_ENCODE(CMD, FUNCTION, LATP_ADDRESS, ARC_ID, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at an ARC.
#define AFE_ENCODE(CMD, FUNCTION, LATP_ADDRESS, ARC_ID, AFE_ID, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at an AFE.
#define PDU_ENCODE(CMD, FUNCTION, LATP_ADDRESS, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at the common controller block of a PDU.
#define PDU_ENV_ENCODE(CMD, FUNCTION, LATP_ADDRESS, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at the environment block of a PDU.
#define CRU_ENCODE(CMD, FUNCTION, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at the CRU.
#define EBM_ENCODE(CMD, FUNCTION, LATP_ADDRESS, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at the common controller block of the EBM.
#define EBM_STAT_ENCODE(CMD, FUNCTION, LATP_ADDRESS, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at the environment block of the EBM.
#define GEM_ENCODE(CMD, FUNCTION, LATP_ADDRESS, BLOCK, REG, PAYLOAD)
 Pack a LATpCommand union with a command targeted at the GEM.
#define LAM_ENCODE(CMD, LATP_ADDRESS)
 Pack a LATpCommand with a Look-at-me command targeted at address given (most usually the BCAST address).
#define LAM_LCB_ENCODE(CMD, LATP_ADDRESS, VALUE, ENABLE_MASK)
 Pack a LATpCommand with a Look-at-me command targeted at the LCB at address given (most usually the BCAST address).

Detailed Description

Fill the payload of a command item with a LATp command.

Author:
James Swain - jswain@slac.stanford.edu

Define Documentation

#define ACD_CMD CMD,
FUNCTION,
IS_AFE,
ADDR,
REG   ) 
 

Value:

{\
  CMD.acd_cmd.start      = 9; \
  CMD.acd_cmd.afe_tgt    = IS_AFE; \
  CMD.acd_cmd.address    = ADDR; \
  CMD.acd_cmd.function   = FUNCTION; \
  CMD.acd_cmd.reg_opcode = REG; \
  CMD.acd_cmd.parity_ad  = (0x1 & IS_AFE) ^ PARITY_8(0x1f & ADDR) ^ PARITY_2(FUNCTION) ^ PARITY_4(REG);\
}
Complete the command as an ACD off-board command.

CMD should be a LATpCommand variable. IS_AFE should be 0 for ARC, 1 for AFE ADDR should be block ID for ARC and AFE ID for AFE FUNCTION should be one of ACD_CMD_READ, ACD_CMD_LOAD, ACD_CMD_DATALESS REG should be the ID of the target register PAYLOAD should be an unsigned short

Missing a bit from the parity?

#define AEM_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  BSC_PFX   (CMD, TYPE_AEM_CC, 0, 0) \
  LCL_CMD   (CMD, FUNCTION, REG) \
  if(CMD_READ != FUNCTION) { LCL_PLD(CMD, PAYLOAD) }\
}
Pack a LATpCommand union with a command targeted at the common controller block of the AEM.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR REG should be the ID of the target register PAYLOAD should be an unsigned long

#define AEM_ENV_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR  (CMD) \
  HDR_ENCODE (CMD, LATP_ADDRESS) \
  BSC_PFX    (CMD, TYPE_AEM_ENV, 0, 0) \
  LCL_CMD    (CMD, FUNCTION, REG) \
  if(CMD_READ != FUNCTION) { AEM_ENV_PLD(CMD, PAYLOAD) }\
}
Pack a LATpCommand union with a command targeted at the enviroment block of the AEM.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR REG should be the ID of the target register PAYLOAD should be an unsigned long

#define AEM_ENV_PLD CMD,
PAYLOAD   ) 
 

Value:

{\
  CMD.aen_pld.payload_0  = PAYLOAD >> 36; \
  CMD.aen_pld.payload_1  = PAYLOAD; \
  CMD.aen_pld.parity_pld = PARITY_ODD64(PAYLOAD);\
}
Write the PAYLOAD into the CMD.

CMD should be a LATpCommand variable PAYLOAD should be an unsigned long long long

#define AFE_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
ARC_ID,
AFE_ID,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  BSC_PFX   (CMD, TYPE_AEM_CC, ARC_ID, 1) \
  ACD_CMD   (CMD, FUNCTION, 1, AFE_ID, REG) \
  AFE_PLD(CMD, FUNCTION, AFE_ID, REG, PAYLOAD)\
}
Pack a LATpCommand union with a command targeted at an AFE.

CMD should be a LATpCommand variable FUNCTION should be one of ACD_CMD_READ, ACD_CMD_LOAD, ACD_CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR ARC_ID should be the ID of the target ARC, or BCAST to broadcast to all the ARCs AFE_ID should be the ID of the target AFE, or BCAST to broadcast to all the AFEs REG should be the ID of the target register PAYLOAD should be an unsigned short

#define AFE_PLD CMD,
FUNCTION,
AFE_ADDR,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD.afe_pld.payload    = PAYLOAD; \
  CMD.afe_pld.parity_hac = 1^ PARITY_8(0x1f & AFE_ADDR) ^ PARITY_2(FUNCTION) ^ (0x1 & FUNCTION) ^ PARITY_4(REG) ^ PARITY_16(0x7fff & PAYLOAD);\
  CMD.afe_pld.parity_pld = PARITY_8(0x1f & AFE_ADDR) ^ PARITY_2(FUNCTION) ^ (0x1 & FUNCTION) ^PARITY_4(REG); \
}
Write the PAYLOAD into the CMD.

CMD should be a LATpCommand variable PAYLOAD should be an unsigned short

Watch out for the funky parity trick ..

I quote from Curt's original code ..

Hack fix for GARC V3 -- the whole story from Bob Baker is here:

Problem in the GARC V3 8/1/2003 RGB

One of the GARC V2 to V3 changes was to move the sampling time of the GAFE return data from the (20 MHz) clock pulse just after generating the GAFE Clock positive edge to the (20 MHz) clock pulse just before generating the GAFE Clock positive edge. This was done because for some GAFE5's under some conditions the return data was changing at the sampling time and could not be detected reliably. The change allows an extra 100 nsec for the signals to propagate and settle. The change also causes the last command bit from the GARC to the GAFE (the parity bit) to be cleared to zero 100 nsec too early. For commands with parity=1, the GAFE sees parity of 0 and rejects the command.

The change in the verilog is in the gafe_command_handler state machine. In state SEND_GAFE_ZEROES, the condition (sck_ctr == 1) is used to both clear the gafe_cmdd and shift in the gafe_readback_reg. The condition in GARC V2 was (sck_cntr == 3). The timing diagram shows the new return data sampling time and the parity bit truncation.

The workaround is to form all AEM to ACD GAFE commands so that the GARC to GAFE parity bit computes to zero. Bit 15 in the data field becomes an odd parity bit over the fields: GAFE Address, Read/Write, Register Number, Data[14:0]. This fix does not effect any of the GAFE functions since data bit 15 is not used. (The GAFE CONFIG_REG does contain and read back all 16 bits but bit 15 does not control anything). This fix will work for any GARC version.

#define ARC_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
ARC_ID,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  BSC_PFX   (CMD, TYPE_AEM_CC, ARC_ID, 1) \
  ACD_CMD   (CMD, FUNCTION, 0, REG/16, REG%16) \
  ARC_PLD(CMD, PAYLOAD) \
}
Pack a LATpCommand union with a command targeted at an ARC.

CMD should be a LATpCommand variable FUNCTION should be one of ACD_CMD_READ, ACD_CMD_LOAD, ACD_CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR ARC_ID should be the ID of the target ARC, or BCAST to broadcast to all the ARCs REG should be the ID of the target register (this is converted into a block number, REG/16, and a register number REG16) PAYLOAD should be an unsigned short

#define ARC_PLD CMD,
PAYLOAD   ) 
 

Value:

{\
  CMD.arc_pld.payload    = PAYLOAD; \
  CMD.arc_pld.parity_pld = PARITY_ODD16(PAYLOAD);\
}
Write the PAYLOAD into the CMD.

CMD should be a LATpCommand variable PAYLOAD should be an unsigned short

#define BSC_PFX CMD,
TYPE,
INSTANCE,
EXTERNAL   ) 
 

Value:

{\
  CMD.bsc_pfx.type      = TYPE; \
  CMD.bsc_pfx.broadcast = (INSTANCE == BCAST) ? 1 : 0; \
  CMD.bsc_pfx.instance  = INSTANCE; \
  CMD.bsc_pfx.external  = EXTERNAL; \
  CMD.bsc_pfx.parity_cs = 1 ^ PARITY_2(TYPE) ^ ((INSTANCE == BCAST) ? 1 : 0) ^ PARITY_4(INSTANCE) ^ EXTERNAL; \
}
Write a basic command string prefix into the CMD.

CMD should be a LATpCommand variable TYPE should be one of the LOCAL_TYPE INSTANCE should be the ID of the object (Cable Controller) EXTERNAL should be 0 if the target is on-board and 1 if it is off-board (ie ARC or AFE)

#define CAL_CMD CMD,
FUNCTION,
CRC_ID,
IS_CFE,
CFE_ID,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD.cal_cmd.start      = 9; \
  CMD.cal_cmd.crc_addr   = CRC_ID; \
  CMD.cal_cmd.cfe        = IS_CFE; \
  CMD.cal_cmd.cfe_addr   = CFE_ID; \
  CMD.cal_cmd.function   = FUNCTION; \
  CMD.cal_cmd.reg_opcode = REG; \
  CMD.cal_cmd.parity_ad  = 1 ^ PARITY_4(CRC_ID) ^ (0x1 & IS_CFE) ^ PARITY_4(CFE_ID) ^ PARITY_2(FUNCTION) ^ PARITY_4(0x7 & REG); \
  if(CMD_LOAD == FUNCTION) { CAL_PLD(CMD, PAYLOAD) } \
}
Complete the command as a CAL off-board command.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS CRC_ID should be the ID of the target CRC, or BCAST to broadcast to all CRCs IS_CFE should be 0 for the CRC, 1 for CFE CFE_ID should be the ID of the target CFE, or BCAST to broadcast to all CFEs REG should be the ID of the target register PAYLOAD should be an unsigned short

#define CAL_PFX CMD,
CCC_ID,
CRC_ID,
EXTERNAL   ) 
 

Value:

{\
  CMD.cal_pfx.type      = TYPE_TEM_CCC; \
  CMD.cal_pfx.broadcast = (CCC_ID & ~0x3) ? 1 : 0; \
  CMD.cal_pfx.ccc       = CCC_ID;\
  CMD.cal_pfx.crc       = CRC_ID;\
  CMD.cal_pfx.external  = EXTERNAL; \
  CMD.cal_pfx.parity_cs = 1 ^ PARITY_2(TYPE_TEM_CCC) ^ ((CCC_ID & ~0x3) ? 1 : 0) ^ PARITY_2(CCC_ID) ^ PARITY_2(CRC_ID) ^ EXTERNAL; \
}
Write a calorimeter specific command string prefix into the CMD.

CMD should be a LATpCommand variable CCC_ID should be the ID of the target CCC, or BCAST to broadcast to all CCCs CRC_ID should be the ID of the target CRC, or BCAST to broadcast to all CRCs EXTERNAL should be 0 if the target is a CCC, or 1 if the target is a CRC/CFE

#define CAL_PLD CMD,
PAYLOAD   ) 
 

Value:

{\
  CMD.cal_cmd.payload    = PAYLOAD; \
  CMD.cal_cmd.parity_pld = PARITY_ODD16(PAYLOAD);\
}
Write the PAYLOAD into the CMD.

CMD should be a LATpCommand variable PAYLOAD should be an unsigned short

#define CCC_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
CCC_ID,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  CAL_PFX   (CMD, CCC_ID, 0, 0) \
  LCL_CMD   (CMD, FUNCTION, REG) \
  if(CMD_READ != FUNCTION) { LCL_PLD(CMD, PAYLOAD) }\
}
Pack a LATpCommand union with a command targeted at a CCC.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR CCC_ID should be the ID of the target CCC, or BCAST to broadcast to all CCCs REG should be the ID of the target register PAYLOAD should be an unsigned long

#define CFE_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
CCC_ID,
CRC_ID,
CFE_ID,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  CAL_PFX   (CMD, CCC_ID, CRC_ID, 1) \
  CAL_CMD   (CMD, FUNCTION, CRC_ID, 1, CFE_ID, REG, PAYLOAD)\
}
Pack a LATpCommand union with a command targeted at a CFE.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR CCC_ID should be the ID of the target CCC, or BCAST to broadcast to all CCCs CRC_ID should be the ID of the target CRC, or BCAST to broadcast to all CRCs CFE_ID should be the ID of the target CFE, or BCAST to broadcast to all CFEs REG should be the ID of the target register PAYLOAD should be an unsigned short

#define CMD_CLEAR CMD   )     CMD.ull[0] = CMD.ull[1] = 0;
 

Set all bits of the CMD to 0.

CMD should be a LATpCommand variable

#define CRC_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
CCC_ID,
CRC_ID,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  CAL_PFX   (CMD, CCC_ID, CRC_ID, 1) \
  CAL_CMD   (CMD, FUNCTION, CRC_ID, 0, 0, REG, PAYLOAD)\
}
Pack a LATpCommand union with a command targeted at a CRC.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR CCC_ID should be the ID of the target CCC, or BCAST to broadcast to all CCCs CRC_ID should be the ID of the target CRC, or BCAST to broadcast to all CRCs REG should be the ID of the target register PAYLOAD should be an unsigned short

#define CRU_ENCODE CMD,
FUNCTION,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LEM_ADDR_CRU) \
  DAB_CMD   (CMD, FUNCTION, CRU_BLK_CC, REG, PAYLOAD) \
}
Pack a LATpCommand union with a command targeted at the CRU.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS REG should be the ID of the target register PAYLOAD should be an unsigned long

#define DAB_CMD CMD,
FUNCTION,
BLOCK,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD.dab_cmd.func    = FUNCTION; \
  CMD.dab_cmd.block   = BLOCK; \
  CMD.dab_cmd.reg     = REG; \
  CMD.dab_cmd.parity  = 1 ^ PARITY_2(FUNCTION) ^ PARITY_4(0x7 & BLOCK) ^ PARITY_16(0x3ff & REG); \
  if(CMD_LOAD == FUNCTION) { DAB_PLD(CMD, PAYLOAD) } \
}
Complete the command as a DAB style command.

CMD should be a LATpCommand variable FUNCTION should be on of CMD_READ, CMD_LOAD, CMD_DATALESS BLOCK should be the ID of the block containing the target register REG should be the target REG ID PAYLOAD should be an unsigned long

#define DAB_PLD CMD,
PAYLOAD   )     CMD.dab_cmd.payload = PAYLOAD;
 

Write the PAYLOAD into the CMD.

CMD should be a LATpCommand variable PAYLOAD should be an unsigned long

#define EBM_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  DAB_CMD   (CMD, FUNCTION, EBM_BLK_CC, REG, PAYLOAD) \
}
Pack a LATpCommand union with a command targeted at the common controller block of the EBM.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR REG should be the ID of the target register PAYLOAD should be an unsigned long

#define EBM_STAT_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  DAB_CMD   (CMD, FUNCTION, EBM_BLK_STAT, REG, PAYLOAD) \
}
Pack a LATpCommand union with a command targeted at the environment block of the EBM.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR REG should be the ID of the target register PAYLOAD should be an unsigned long

#define GEM_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
BLOCK,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  DAB_CMD   (CMD, FUNCTION, BLOCK, REG, PAYLOAD) \
}
Pack a LATpCommand union with a command targeted at the GEM.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR BLOCK should be the ID of the register block (one of the GEM_BLK_X from LEM_REG_BLK) REG should be the ID of the target register PAYLOAD should be an unsigned long

#define HDR_ENCODE CMD,
LATP_ADDRESS   )     CMD.cell.header.dst = LATP_ADDRESS;
 

Write the Destination LATp address into the LATp command header of the CMD.

CMD should be a LATpCommand variable LATP_ADDRESS should be one of the LEM_LATP_ADDR

#define LAM_ENCODE CMD,
LATP_ADDRESS   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS)\
  CMD.cell.header.proto = 3;\
  CMD.cell.data[0] = 0x9C3E;\
  CMD.cell.data[1] = 0x07F0;\
  CMD.cell.data[2] = 0x0FF8;\
  CMD.cell.data[3] = 0x01FF;\
  CMD.cell.data[4] = 0xC003;\
  CMD.cell.data[5] = 0xFFE0;\
  CMD.cell.data[6] = 0x007F;\
}
Pack a LATpCommand with a Look-at-me command targeted at address given (most usually the BCAST address).

CMD Should be a LATpCommand variable LATP_ADDRESS LATP address of the target

#define LAM_LCB_ENCODE CMD,
LATP_ADDRESS,
VALUE,
ENABLE_MASK   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS)\
  CMD.cell.header.proto = 3; \
  CMD.cell.data[0] = 0x9C3E;\
  CMD.cell.data[1] = 0x07F0;\
  CMD.cell.data[2] = 0x0FF8;\
  CMD.cell.data[3] = VALUE >> 16;\
  CMD.cell.data[4] = VALUE;\
  CMD.cell.data[5] = ENABLE_MASK >> 16;\
  CMD.cell.data[6] = ENABLE_MASK;\
}
Pack a LATpCommand with a Look-at-me command targeted at the LCB at address given (most usually the BCAST address).

CMD Should be a LATpCommand variable LATP_ADDRESS LATP address of the target LCB VALUE Value to load into the LATp CSR register ENABLE_MASK Enable mask for the register write

#define LCB_HDR_ENCODE HDR,
FUNCTION   ) 
 

Value:

{\
  HDR.bf.len = 4;\
  HDR.bf.opcode = (FUNCTION == CMD_READ || FUNCTION == ACD_CMD_READ) ? LCB_OPCODE_CMDR : LCB_OPCODE_CMD;\
}
Encode the LCB command item header (distinct from the LATp header filled by HDR_ENCODE).

HDR should be a LCB_ci_hdr union FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS or the ACD equivalents

#define LCL_CMD CMD,
FUNCTION,
REG   ) 
 

Value:

{\
  CMD.lcl_cmd.start      = 1; \
  CMD.lcl_cmd.function   = FUNCTION; \
  CMD.lcl_cmd.reg_opcode = REG; \
  CMD.lcl_cmd.parity_ad  = 1 ^ PARITY_8(0x7f & REG) ^ PARITY_2(FUNCTION); \
}
Complete the command as a command to a local (on TEM/AEM) register.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS REG should be the target register ID PAYLOAD should be an unsigned long

#define LCL_PLD CMD,
PAYLOAD   ) 
 

Value:

{\
  CMD.lcl_pld.payload_0  = PAYLOAD >> 4; \
  CMD.lcl_pld.payload_1  = PAYLOAD; \
  CMD.lcl_pld.parity_pld = PARITY_ODD32(PAYLOAD); \
}
Write the PAYLOAD into the CMD.

CMD should be a LATpCommand variable PAYLOAD should be an unsigned long

#define PDU_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  DAB_CMD   (CMD, FUNCTION, PDU_BLK_CC, REG, PAYLOAD) \
}
Pack a LATpCommand union with a command targeted at the common controller block of a PDU.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR REG should be the ID of the target register PAYLOAD should be an unsigned long

#define PDU_ENV_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  DAB_CMD   (CMD, FUNCTION, PDU_BLK_ENV, REG, PAYLOAD) \
}
Pack a LATpCommand union with a command targeted at the environment block of a PDU.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR REG should be the ID of the target register PAYLOAD should be an unsigned long

#define TCC_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
TCC_ID,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  TKR_PFX   (CMD, TCC_ID, 0) \
  LCL_CMD   (CMD, FUNCTION, REG) \
  if(CMD_READ != FUNCTION) { LCL_PLD(CMD, PAYLOAD) }\
}
Pack a LATpCommand union with a command targeted at a TCC.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR TCC_ID should be the ID of the target TCC, or BCAST to broadcast to all TCCs REG should be the ID of the target register PAYLOAD should be an unsigned long

#define TDC_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
TCC_ID,
TRC_ID,
TFE_ID,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  TKR_PFX   (CMD, TCC_ID, 1) \
  TKR_CMD   (CMD, FUNCTION, TRC_ID, 1, TFE_ID, TFE_DAC, rotate_(PAYLOAD))\
}
Pack a LATpCommand union with a command targeted at the DAC register of the TFE.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR TCC_ID should be the ID of the target TCC, or BCAST to broadcast to all TCCs TRC_ID should be the ID of the target TRC, or BCAST to broadcast to all TRCs TFE_ID should be the ID of the target TFE, or BCAST to broadcast to all TFEs PAYLOAD should be an unsigned long long

#define TEM_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  BSC_PFX   (CMD, TYPE_TEM_CC, 0, 0) \
  LCL_CMD   (CMD, FUNCTION, REG) \
  if(CMD_READ != FUNCTION) { LCL_PLD(CMD, PAYLOAD) }\
}
Pack a LATpCommand union with a command targeted at the common controller block of a TEM.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR REG should be the ID of the target register PAYLOAD should be an unsigned long

#define TFE_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
TCC_ID,
TRC_ID,
TFE_ID,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  TKR_PFX   (CMD, TCC_ID, 1) \
  TKR_CMD   (CMD, FUNCTION, TRC_ID, 1, TFE_ID, REG, PAYLOAD)\
}
Pack a LATpCommand union with a command targeted at a TFE.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR TCC_ID should be the ID of the target TCC, or BCAST to broadcast to all TCCs TRC_ID should be the ID of the target TRC, or BCAST to broadcast to all TRCs TFE_ID should be the ID of the target TFE, or BCAST to broadcast to all TFEs REG should be the ID of the target register PAYLOAD should be an unsigned long long

#define TIC_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  BSC_PFX   (CMD, TYPE_TEM_TIC, 0, 0) \
  LCL_CMD   (CMD, FUNCTION, REG) \
  if(CMD_READ != FUNCTION) { LCL_PLD(CMD, PAYLOAD) }\
}
Pack a LATpCommand union with a command tageted at the TIC block of a TEM.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR REG should be the ID of the target register PAYLOAD should be an unsigned long

#define TKR_CMD CMD,
FUNCTION,
TRC_ID,
IS_TFE,
TFE_ID,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD.tkr_cmd.start       = 1; \
  CMD.tkr_cmd.trc_addr    = TRC_ID; \
  CMD.tkr_cmd.tfe         = IS_TFE; \
  CMD.tkr_cmd.tfe_addr    = TFE_ID; \
  CMD.tkr_cmd.function    = FUNCTION; \
  CMD.tkr_cmd.reg_opcode  = REG; \
  CMD.tkr_cmd.parity_ad   = 1 ^ PARITY_4(0xf & TRC_ID) ^ (0x1 & IS_TFE) ^ PARITY_8(0x1f & TFE_ID) ^ PARITY_2(FUNCTION) ^ PARITY_4(0x7 & REG); \
  if(CMD_LOAD == FUNCTION) { TKR_PLD(CMD, PAYLOAD) }\
}
Complete the command as a TKR off-board command.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS TRC_ID should be the ID of the target TRC, or BCAST to broadcast to all TRCs IS_TRC should be 0 for the TRC, 1 for the TFE TFE_ID should be the ID of the target TFE, or BCAST to broadcast to all TFEs REG should be the ID of the targte register PAYLOAD should be an unsigned long long (it will be segmented according to the TKR requirements)

#define TKR_PFX CMD,
TCC_ID,
EXTERNAL   ) 
 

Value:

{\
  CMD.tkr_pfx.type      = TYPE_TEM_TCC; \
  CMD.tkr_pfx.broadcast = (TCC_ID & ~0x7) ? 1 : 0; \
  CMD.tkr_pfx.tcc       = TCC_ID; \
  CMD.tkr_pfx.external  = EXTERNAL; \
  CMD.tkr_pfx.parity_cs = 1 ^ PARITY_2(TYPE_TEM_TCC) ^ ((TCC_ID & ~0x7) ? 1 : 0) ^ PARITY_4(0x7 & TCC_ID) ^ EXTERNAL; \
}
Write a tracker specific command string prefix into the CMD.

CMD should be a LATpCommand variable TCC_ ID should be the ID of the target TCC, or BCAST to broadcast to all TCCs EXTERNAL should be 0 if the target is a TCC, or 1 if the target is a TRC/TFE

#define TKR_PLD CMD,
PAYLOAD   ) 
 

Value:

{\
  CMD.tkr_cmd.mark_0      = 1; \
  CMD.tkr_cmd.payload_0   = PAYLOAD >> 48; \
  CMD.tkr_cmd.mark_1      = 1; \
  CMD.tkr_cmd.payload_1a  = PAYLOAD >> 44; \
  CMD.tkr_cmd.payload_1b  = PAYLOAD >> 32; \
  CMD.tkr_cmd.mark_2      = 1; \
  CMD.tkr_cmd.payload_2   = PAYLOAD >> 16; \
  CMD.tkr_cmd.mark_3      = 1; \
  CMD.tkr_cmd.payload_3   = PAYLOAD; \
  CMD.tkr_cmd.parity_pld  = PARITY_ODD64(PAYLOAD);\
}
Write the PAYLOAD into the CMD.

CMD should be a LATpCommand variable PAYLOAD should be an unsigned long long

#define TRC_ENCODE CMD,
FUNCTION,
LATP_ADDRESS,
TCC_ID,
TRC_ID,
REG,
PAYLOAD   ) 
 

Value:

{\
  CMD_CLEAR (CMD) \
  HDR_ENCODE(CMD, LATP_ADDRESS) \
  TKR_PFX   (CMD, TCC_ID, 1) \
  TKR_CMD   (CMD, FUNCTION, TRC_ID, 0, 0, REG, PAYLOAD)\
}
Pack a LATpCommand union with a command targeted at a TRC.

CMD should be a LATpCommand variable FUNCTION should be one of CMD_READ, CMD_LOAD, CMD_DATALESS LATP_ADDRESS should be one of LEM_LATP_ADDR TCC_ID should be the ID of the target TCC, or BCAST to broadcast to all TCCs TRC_ID should be the ID of the target TRC, or BCAST to broadcast to all TRCs REG should be the ID of the target register PAYLOAD should be an unsigned long long


Generated on Mon Dec 12 20:52:14 2005 by  doxygen 1.4.4