GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LEM / dev > lem / rad750
#include <LEM/defs.h>
#include <PBI/PARITY.ih>
#include <PBS/PARITY.h>
#include <LCBD/LCB_cr.h>
Defines | |
#define | PARITY_2(WD) PARITY_4(0x3 & WD) |
Get parity of a 2-bit word. | |
#define | CMD_CLEAR(CMD) CMD.ull[0] = CMD.ull[1] = 0; |
Set all bits of a command word to 0. | |
#define | LCB_HDR_ENCODE(HDR, FUNCTION) |
Encode the LCB command item header. | |
#define | HDR_ENCODE(CMD, LATP_ADDRESS) CMD.cell.header.dst = LATP_ADDRESS; |
Put the Destination LATp address into a LATp command header. | |
#define | BSC_PFX(CMD, TYPE, INSTANCE, EXTERNAL) |
Put a basic command string prefix into a command. | |
#define | CAL_PFX(CMD, CCC_ID, CRC_ID, EXTERNAL) |
Write a calorimeter-specific command string prefix into a command. | |
#define | TKR_PFX(CMD, TCC_ID, EXTERNAL) |
Write a tracker specific command string prefix into a command. | |
#define | LCL_PLD(CMD, PAYLOAD) |
Put the payload into a command. | |
#define | AEM_ENV_PLD(CMD, PAYLOAD) |
Put the payload into an AEM ENV command. | |
#define | DAB_PLD(CMD, PAYLOAD) CMD.dab_cmd.payload = PAYLOAD; |
Put the payload into a DAB-style command. | |
#define | ARC_PLD(CMD, PAYLOAD) |
Put the payload into an ARC command. | |
#define | AFE_PLD(CMD, FUNCTION, AFE_ADDR,REG, PAYLOAD) |
Put the payload into an AFE command. | |
#define | CAL_PLD(CMD, PAYLOAD) |
Put the payload into a calorimeter command. | |
#define | TKR_PLD(CMD, PAYLOAD) |
Put the payload into a tracker command. | |
#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). |
$Id: encode_macros.h,v 1.22 2011/03/25 18:51:52 apw Exp $
#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);\ }
CMD LATpCommand variable.
IS_AFE 0 for ARC, 1 for AFE
ADDR block ID for ARC and AFE ID for AFE
FUNCTION one of ACD_CMD_READ, ACD_CMD_LOAD, ACD_CMD_DATALESS
REG the ID of the target register
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) }\ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
REG the ID of the target register
PAYLOAD an unsigned long
Referenced by AEM_encode().
#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) }\ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
REG the ID of the target register
PAYLOAD an unsigned long
Referenced by AEM_ENV_encode().
#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);\ }
CMD LATpCommand variable
PAYLOAD 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)\ }
CMD LATpCommand variable
FUNCTION one of ACD_CMD_READ, ACD_CMD_LOAD, ACD_CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
ARC_ID the ID of the target ARC, or BCAST to broadcast to all the ARCs
AFE_ID the ID of the target AFE, or BCAST to broadcast to all the AFEs
REG the ID of the target register
PAYLOAD an unsigned short
Referenced by AFE_encode().
#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); \ }
CMD LATpCommand variable
PAYLOAD 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) \ }
CMD LATpCommand variable
FUNCTION one of ACD_CMD_READ, ACD_CMD_LOAD, ACD_CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
ARC_ID the ID of the target ARC, or BCAST to broadcast to all the ARCs
REG the ID of the target register (this is converted into a block number, REG/16, and a register number REG16)
PAYLOAD an unsigned short
Referenced by ARC_encode().
#define ARC_PLD | ( | CMD, | |||
PAYLOAD | ) |
Value:
{\ CMD.arc_pld.payload = PAYLOAD; \ CMD.arc_pld.parity_pld = PARITY_ODD16(PAYLOAD);\ }
CMD LATpCommand variable
PAYLOAD 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; \ }
CMD LATpCommand variable
TYPE one of the LOCAL_TYPE
INSTANCE the ID of the object (Cable Controller)
EXTERNAL 0 if the target is on-board, or 1 if it is off-board
#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) } \ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
CRC_ID the ID of the target CRC, or BCAST to broadcast to all CRCs
IS_CFE 0 for the CRC, 1 for CFE
CFE_ID the ID of the target CFE, or BCAST to broadcast to all CFEs
REG the ID of the target register
PAYLOAD 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; \ }
CMD LATpCommand variable
CCC_ID the ID of the target CCC, or BCAST to broadcast to all CCCs
CRC_ID the ID of the target CRC, or BCAST to broadcast to all CRCs
EXTERNAL 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);\ }
CMD LATpCommand variable
PAYLOAD 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) }\ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
CCC_ID the ID of the target CCC, or BCAST to broadcast to all CCCs
REG the ID of the target register
PAYLOAD an unsigned long
Referenced by CCC_encode().
#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)\ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
CCC_ID the ID of the target CCC, or BCAST to broadcast to all CCCs
CRC_ID the ID of the target CRC, or BCAST to broadcast to all CRCs
CFE_ID the ID of the target CFE, or BCAST to broadcast to all CFEs
REG the ID of the target register
PAYLOAD an unsigned short
Referenced by CFE_encode().
#define CMD_CLEAR | ( | CMD | ) | CMD.ull[0] = CMD.ull[1] = 0; |
Set all bits of a command word to 0.
CMD 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)\ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
CCC_ID the ID of the target CCC, or BCAST to broadcast to all CCCs
CRC_ID the ID of the target CRC, or BCAST to broadcast to all CRCs
REG the ID of the target register
PAYLOAD an unsigned short
Referenced by CRC_encode().
#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) \ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
REG the ID of the target register
PAYLOAD an unsigned long
Referenced by CRU_encode().
#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) } \ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
BLOCK the ID of the block containing the target register
REG the target REG ID
PAYLOAD an unsigned long
#define DAB_PLD | ( | CMD, | |||
PAYLOAD | ) | CMD.dab_cmd.payload = PAYLOAD; |
#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) \ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
REG the ID of the target register
PAYLOAD an unsigned long
Referenced by EBM_encode().
#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) \ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
REG the ID of the target register
PAYLOAD an unsigned long
Referenced by EBM_STAT_encode().
#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) \ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
BLOCK the ID of the register block (one of the GEM_BLK_X from LEM_REG_BLK)
REG the ID of the target register
PAYLOAD an unsigned long
Referenced by GEM_encode().
#define HDR_ENCODE | ( | CMD, | |||
LATP_ADDRESS | ) | CMD.cell.header.dst = LATP_ADDRESS; |
Put the Destination LATp address into a LATp command header.
CMD LATpCommand variable
LATP_ADDRESS 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;\ }
CMD LATpCommand variable
LATP_ADDRESS LATP address of the target
Referenced by LAM_encode().
#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;\ }
CMD 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
Referenced by LAM_LCB_encode().
#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;\ }
HDR LCB_ci_hdr union
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS (or the ACD equivalents)
Referenced by AEM_encode(), AEM_ENV_encode(), AFE_encode(), ARC_encode(), CCC_encode(), CFE_encode(), CRC_encode(), CRU_encode(), EBM_encode(), EBM_STAT_encode(), GEM_encode(), LAM_encode(), LAM_LCB_encode(), PDU_encode(), PDU_ENV_encode(), TCC_encode(), TDC_encode(), TEM_encode(), TFE_encode(), TIC_encode(), and TRC_encode().
#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); \ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
REG the target register ID
#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); \ }
CMD LATpCommand variable
PAYLOAD an unsigned long
#define PARITY_2 | ( | WD | ) | PARITY_4(0x3 & WD) |
Get parity of a 2-bit word.
#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) \ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
REG the ID of the target register
PAYLOAD an unsigned long
Referenced by PDU_encode().
#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) \ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
REG the ID of the target register
PAYLOAD an unsigned long
Referenced by PDU_ENV_encode().
#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) }\ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
TCC_ID the ID of the target TCC, or BCAST to broadcast to all TCCs
REG the ID of the target register
PAYLOAD an unsigned long
Referenced by TCC_encode().
#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))\ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
TCC_ID the ID of the target TCC, or BCAST to broadcast to all TCCs
TRC_ID the ID of the target TRC, or BCAST to broadcast to all TRCs
TFE_ID the ID of the target TFE, or BCAST to broadcast to all TFEs
PAYLOAD an unsigned long long
Referenced by TDC_encode().
#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) }\ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
REG the ID of the target register
PAYLOAD an unsigned long
Referenced by TEM_encode().
#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)\ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
TCC_ID the ID of the target TCC, or BCAST to broadcast to all TCCs
TRC_ID the ID of the target TRC, or BCAST to broadcast to all TRCs
TFE_ID the ID of the target TFE, or BCAST to broadcast to all TFEs
REG the ID of the target register
PAYLOAD an unsigned long long
Referenced by TFE_encode().
#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) }\ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
REG the ID of the target register
PAYLOAD an unsigned long
Referenced by TIC_encode().
#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) }\ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
TRC_ID the ID of the target TRC, or BCAST to broadcast to all TRCs
IS_TRC 0 for the TRC, 1 for the TFE
TFE_ID the ID of the target TFE, or BCAST to broadcast to all TFEs
REG the ID of the targte register
PAYLOAD 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; \ }
CMD LATpCommand variable
TCC The ID of the target TCC, or BCAST to broadcast to all TCCs
EXTERNAL 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);\ }
CMD LATpCommand variable
PAYLOAD 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)\ }
CMD LATpCommand variable
FUNCTION one of CMD_READ, CMD_LOAD, CMD_DATALESS
LATP_ADDRESS one of LEM_LATP_ADDR
TCC_ID the ID of the target TCC, or BCAST to broadcast to all TCCs
TRC_ID the ID of the target TRC, or BCAST to broadcast to all TRCs
REG the ID of the target register
PAYLOAD an unsigned long long
Referenced by TRC_encode().