/************************************************************************************ * primParams_sct.h * * synopsis: Defines IDs and structures for SCT-specific primitives and tasks. * * Douglas Ferguson, UW Madison (510) 486-5230 dpferguson@lbl.gov ************************************************************************************/ #ifndef PRIM_PARAMS_SCT #define PRIM_PARAMS_SCT /************************************************************************************ * Primitives common to all DSPs go here * Note: some of these primitives are used to coordinate the DSPs with each other or * other electronics on the ROD (such as the router). These primitives should be sent * to the master DSP from the host; the master DSP primitive will then set the * appropriate board registers, etc. and pass on the primitive to the slave DSP. * The primitive passing software will not break if the host sends one of these * primitives directly to a slave, but slave applications might break as a result of * inconsistent parameter settings. See the code in eventTrapSetup and moduleMask for * examples of how to do this. ************************************************************************************/ #define COMMON_SCT_PRIMITIVES_BASE 0x800 #ifdef NEWDEF enum { TEST= COMMON_SCT_PRIMITIVES_BASE, LAST_COMMON_SCT_PRIMITIVE }; #else enum { LAST_COMMON_SCT_PRIMITIVE= COMMON_SCT_PRIMITIVES_BASE }; #endif #define NUM_COMMON_SCT_PRIMITIVES \ ((LAST_COMMON_SCT_PRIMITIVE) -(COMMON_SCT_PRIMITIVES_BASE)) #define R_TEST 100 struct TEST_IN { UINT32 dataLen, *dataPtr; }; /************************************************************************************ * Slave DSP primitives go here. ************************************************************************************/ #define SLAVE_SCT_PRIMITIVES_BASE 0x1800 #ifdef NEWDEF enum { HISTOGRAM_SETUP= SLAVE_SCT_PRIMITIVES_BASE, //FIT_HISTOGRAMS, LAST_SLAVE_SCT_PRIMITIVE }; #else enum { LAST_SLAVE_SCT_PRIMITIVE= SLAVE_SCT_PRIMITIVES_BASE }; #endif #define NUM_SLAVE_SCT_PRIMITIVES \ ((LAST_SLAVE_SCT_PRIMITIVE) -(SLAVE_SCT_PRIMITIVES_BASE)) /* Set up & define the histograms. */ #define R_HISTOGRAM_SETUP 108 struct HISTOGRAM_SETUP_IN { UINT32 *base; UINT32 nBins; UINT32 binSize; UINT32 routineType; UINT32 dataType[2]; UINT32 opt[4]; UINT32 validModules[2]; UINT32 moduleRangeMap[2][2]; MDAT32 *xPtr[2]; }; struct HISTOGRAM_SETUP_OUT { UINT32 *base, size; UINT32 *ctrlPtr, *binCtrPtr, *varRangePtr; }; /* Histogramming options: * opt[0]: True if chip-occupancy histograms are desired. * opt[1]: The link data format (condensed or expanded). * opt[2]: Verbose mode flag (c code only). * opt[3]: Unused. */ /* The default histogram base is defined inside memoryPartitions.h along with the other memory-related constants. */ #define HISTOGRAM_CONDENSED 1 #define HISTOGRAM_FULL 3 #define HISTOGRAM_8BIT 8 #define HISTOGRAM_16BIT 16 #define HISTOGRAM_32BIT 32 #define HISTO_ROUTINE_C 0 #define HISTO_ROUTINE_ASM 1 #define R_FIT_HISTOGRAMS 100 typedef struct { UINT32 *fitBase; UINT32 fitFlags; UINT32 routineType; } FitHistogramsIn; typedef struct { UINT32 *fitBase; UINT32 dataLen; } FitHistogramsOut; /* flags: */ #define USER_WEIGHTS 1 #define USER_GUESS 2 #define MAX_LIKELIHOOD 4 /* routine: */ #define FIT_ROUTINE_C 0 #define FIT_ROUTINE_ASM 1 /************************************************************************************ * Master DSP primitives go here. ************************************************************************************/ #define MASTER_SCT_PRIMITIVES_BASE 0x2800 enum { #ifdef NEWDEF RW_MODULE_DATA= MASTER_SCT_PRIMITIVES_BASE, RW_MODULE_VARIABLE, SEND_CONFIG, SET_MODULE_SCAN_MODE, #else SET_MODULE_SCAN_MODE= MASTER_SCT_PRIMITIVES_BASE, #endif SET_MASK_STAGE, LAST_MASTER_SCT_PRIMITIVE }; #define NUM_MASTER_SCT_PRIMITIVES \ ((LAST_MASTER_SCT_PRIMITIVE) -(MASTER_SCT_PRIMITIVES_BASE)) /* configure a module, or send it's data (resident in memory) to control links. For input data, the pointer to configData is the start. */ #define R_RW_MODULE_DATA 103 typedef struct { UINT32 fRead, fCopy, copySrcCfgSet, cfgSet, cfgBitfield, module, chip, dataType; } RwModuleDataIn_v103; //If writing, data follows directly after structure. typedef struct { Module configData; } RwModuleDataOut_v103; //Addititive inputs for cfgSet: #define PHYSICS_MODULE_CFG 1 #define SCAN_MODULE_CFG 2 #define SPARE_MODULE_CFG 4 //Indices of the configuration sets: #define PHYSICS_CONFIG_SET 0 #define SCAN_CONFIG_SET 1 #define SPARE_CONFIG_SET 2 #define N_MODULE_CONFIG_SETS ((SPARE_CONFIG_SET) -(PHYSICS_CONFIG_SET) +1) #define R_RW_MODULE_VARIABLE 103 //variable types defined in ABCDScans.h typedef struct { UINT32 fRead, cfgSet, cfgBitfield, groupId, module, chip, varType; UINT32 info; /* for writing: output message? */ UINT32 dataLen; /* for writing: length of data (e.g. mask= 4) */ } RwModuleVariableIn_v103; //If writing, data follows directly after structure. typedef struct { UINT32 nModData, dataLen; } RwModuleVariableOut_v103; //If reading, data follows directly after structure. #define MVAR_GROUP_ID 100 #define MVAR_ACTIVE 101 #define MVAR_PRESENT 102 #define MVAR_SELECT 103 #define R_SEND_CONFIG 106 typedef struct { UINT32 port, module[2], chip, setLinks, cfgSet, groupId, dataType, activeOnly, enableDataTaking; } SendConfigIn_v106; /* The dataType variable, used by r/w module data & send cfg. Note that the cfg. sending routine will only accept inputs of types: 1) basic, 2) trim, or 3) both (=> all) types of register sets. */ #define CONFIG_MODULE_CFG 1 #define CONFIG_MODULE_CALDATA 2 #define CONFIG_MODULE_BASIC_OTHER 4 #define CONFIG_MODULE_BASIC 5 #define CONFIG_MODULE_TRIM 8 #define CONFIG_MODULE_CHIP_OTHER 16 #define CONFIG_MODULE_CHIP 31 #define CONFIG_MODULE_OTHER 32 #define CONFIG_MODULE_ALL 63 //used internally: #define CONFIG_MODULE_MASK 256 #define CONFIG_MODULE_SCAN_TRIM 512 #define NO_CONFIG_LOOP 0 #define NORMAL_CONFIG_LOOP 1 #define OFF_ROD_CONFIG_LOOP 2 //More definitions are in serialStreams.h #define R_SET_MODULE_SCAN_MODE 100 typedef struct { UINT32 cfgSet; UINT32 module; } SetModuleScanModeIn_v100; #define R_SET_MASK_STAGE 100 typedef struct { UINT32 cfgSet; UINT32 module; UINT32 chip; UINT32 stage; } SetMaskStageIn_v100; /************************************************************************************ * Primitive function prototypes (not needed by the host processor). ************************************************************************************/ #if (defined(I_AM_MASTER_DSP) || defined(I_AM_SLAVE_DSP)) INT32 test(PrimData *); INT32 histogramSetup(PrimData *); INT32 fitHistograms(PrimData *); INT32 rwModuleData(PrimData *); INT32 rwModuleVariable(PrimData *); INT32 sendConfig(PrimData *); INT32 setModuleScanMode(PrimData *); INT32 setMaskStage(PrimData *); #endif /* primitive parameters definition block */ #endif /* Multiple inclusion protection */