Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages

primParams_sct.h

00001 /************************************************************************************
00002  * primParams_sct.h
00003  *
00004  *  synopsis: Defines IDs and structures for SCT-specific primitives and tasks.
00005  * 
00006  *  Douglas Ferguson, UW Madison   (510) 486-5230         dpferguson@lbl.gov
00007  ************************************************************************************/
00008 #ifndef PRIM_PARAMS_SCT
00009 #define PRIM_PARAMS_SCT
00010 
00011 /************************************************************************************
00012  *                        Primitives common to all DSPs go here
00013  * Note: some of these primitives are used to coordinate the DSPs with each other or
00014  * other electronics on the ROD (such as the router). These primitives should be sent
00015  * to the master DSP from the host; the master DSP primitive will then set the
00016  * appropriate board registers, etc. and pass on the primitive to the slave DSP.
00017  * The primitive passing software will not break if the host sends one of these
00018  * primitives directly to a slave, but slave applications might break as a result of
00019  * inconsistent parameter settings. See the code in eventTrapSetup and moduleMask for
00020  * examples of how to do this.
00021  ************************************************************************************/
00022 #define COMMON_SCT_PRIMITIVES_BASE 0x800
00023 
00024 #ifdef NEWDEF
00025     enum {
00026         TEST= COMMON_SCT_PRIMITIVES_BASE,
00027         LAST_COMMON_SCT_PRIMITIVE
00028     };
00029 
00030 #else
00031     enum {
00032         LAST_COMMON_SCT_PRIMITIVE= COMMON_SCT_PRIMITIVES_BASE
00033     };
00034 
00035 #endif
00036 
00037 #define NUM_COMMON_SCT_PRIMITIVES \
00038        ((LAST_COMMON_SCT_PRIMITIVE) -(COMMON_SCT_PRIMITIVES_BASE))
00039 
00040 #define R_TEST              100
00041     struct TEST_IN {
00042         UINT32 dataLen, *dataPtr;
00043     };
00044 
00045 /************************************************************************************
00046  *                             Slave DSP primitives go here.
00047  ************************************************************************************/
00048 #define SLAVE_SCT_PRIMITIVES_BASE 0x1800
00049 
00050 #ifdef NEWDEF
00051     enum {
00052         HISTOGRAM_SETUP= SLAVE_SCT_PRIMITIVES_BASE,
00053         //FIT_HISTOGRAMS,
00054         LAST_SLAVE_SCT_PRIMITIVE
00055     };
00056 
00057 #else
00058     enum {
00059         LAST_SLAVE_SCT_PRIMITIVE= SLAVE_SCT_PRIMITIVES_BASE
00060     };
00061 
00062 #endif
00063 
00064 #define NUM_SLAVE_SCT_PRIMITIVES \
00065        ((LAST_SLAVE_SCT_PRIMITIVE) -(SLAVE_SCT_PRIMITIVES_BASE))
00066 
00067 /* Set up & define the histograms. */
00068 #define R_HISTOGRAM_SETUP            108
00069     struct HISTOGRAM_SETUP_IN {
00070         UINT32  *base;
00071         UINT32  nBins;
00072         UINT32  binSize;
00073         UINT32  routineType;
00074         UINT32  dataType[2];
00075         UINT32  opt[4];
00076 
00077         UINT32  validModules[2];
00078         UINT32  moduleRangeMap[2][2];
00079         MDAT32 *xPtr[2];
00080     };
00081 
00082     struct HISTOGRAM_SETUP_OUT {
00083         UINT32 *base, size;
00084         UINT32 *ctrlPtr, *binCtrPtr, *varRangePtr;
00085     };
00086 
00087     /* Histogramming options:
00088      *     opt[0]:           True if chip-occupancy histograms are desired.
00089      *     opt[1]:           The link data format (condensed or expanded).
00090      *     opt[2]:           Verbose mode flag (c code only).
00091      *     opt[3]:           Unused.
00092      */
00093 
00094     /* The default histogram base is defined inside memoryPartitions.h along with
00095        the other memory-related constants. */
00096     #define HISTOGRAM_CONDENSED 1
00097     #define HISTOGRAM_FULL      3
00098 
00099     #define HISTOGRAM_8BIT      8
00100     #define HISTOGRAM_16BIT     16
00101     #define HISTOGRAM_32BIT     32
00102 
00103     #define HISTO_ROUTINE_C     0
00104     #define HISTO_ROUTINE_ASM   1
00105 
00106 #define R_FIT_HISTOGRAMS           100
00107     typedef struct {
00108         UINT32 *fitBase;
00109         UINT32 fitFlags;
00110         UINT32 routineType;
00111     } FitHistogramsIn;
00112 
00113     typedef struct {
00114         UINT32 *fitBase;
00115         UINT32 dataLen;
00116     } FitHistogramsOut;
00117 
00118     /* flags: */
00119     #define USER_WEIGHTS   1
00120     #define USER_GUESS     2
00121     #define MAX_LIKELIHOOD 4
00122 
00123     /* routine: */
00124     #define FIT_ROUTINE_C     0
00125     #define FIT_ROUTINE_ASM   1
00126 
00127 /************************************************************************************
00128  *                          Master DSP primitives go here.
00129  ************************************************************************************/
00130 #define MASTER_SCT_PRIMITIVES_BASE 0x2800
00131 
00132 enum {
00133 #ifdef NEWDEF
00134     RW_MODULE_DATA= MASTER_SCT_PRIMITIVES_BASE,
00135     RW_MODULE_VARIABLE,
00136     SEND_CONFIG,
00137     SET_MODULE_SCAN_MODE,
00138 #else
00139     SET_MODULE_SCAN_MODE= MASTER_SCT_PRIMITIVES_BASE,
00140 #endif
00141     SET_MASK_STAGE,
00142     LAST_MASTER_SCT_PRIMITIVE
00143 };
00144 
00145 #define NUM_MASTER_SCT_PRIMITIVES \
00146        ((LAST_MASTER_SCT_PRIMITIVE) -(MASTER_SCT_PRIMITIVES_BASE))
00147 
00148 
00149 /* configure a module, or send it's data (resident in memory) to control links.
00150    For input data, the pointer to configData is the start. */
00151 #define R_RW_MODULE_DATA   103
00152     typedef struct {
00153         UINT32 fRead, fCopy, copySrcCfgSet, cfgSet, cfgBitfield, module, chip, dataType;
00154     } RwModuleDataIn_v103;
00155     //If writing, data follows directly after structure.
00156 
00157     typedef struct {
00158         Module configData;
00159     } RwModuleDataOut_v103;
00160 
00161     //Addititive inputs for cfgSet:
00162     #define PHYSICS_MODULE_CFG  1
00163     #define SCAN_MODULE_CFG     2
00164     #define SPARE_MODULE_CFG    4
00165 
00166     //Indices of the configuration sets:
00167     #define PHYSICS_CONFIG_SET    0
00168     #define SCAN_CONFIG_SET       1
00169     #define SPARE_CONFIG_SET      2
00170     #define N_MODULE_CONFIG_SETS ((SPARE_CONFIG_SET) -(PHYSICS_CONFIG_SET) +1)
00171 
00172 #define R_RW_MODULE_VARIABLE    103
00173     //variable types defined in ABCDScans.h
00174     typedef struct {
00175         UINT32  fRead, cfgSet, cfgBitfield, groupId, module, chip, varType;
00176 
00177         UINT32 info;      /* for writing: output message? */
00178         UINT32 dataLen;   /* for writing: length of data (e.g. mask= 4) */
00179     } RwModuleVariableIn_v103;
00180     //If writing, data follows directly after structure.
00181 
00182     typedef struct {
00183         UINT32  nModData, dataLen;
00184     } RwModuleVariableOut_v103;
00185     //If reading, data follows directly after structure.
00186 
00187     #define MVAR_GROUP_ID    100
00188     #define MVAR_ACTIVE      101
00189     #define MVAR_PRESENT     102
00190     #define MVAR_SELECT      103
00191 
00192 #define R_SEND_CONFIG    106
00193     typedef struct {
00194         UINT32   port, module[2], chip, setLinks,
00195                  cfgSet, groupId, dataType,
00196                  activeOnly, enableDataTaking;
00197     } SendConfigIn_v106;
00198 
00199 
00200     /* The dataType variable, used by r/w module data & send cfg. Note
00201        that the cfg. sending routine will only accept inputs of types:
00202        1) basic, 2) trim, or  3) both (=> all) types of register sets. */
00203     #define CONFIG_MODULE_CFG          1
00204     #define CONFIG_MODULE_CALDATA      2
00205     #define CONFIG_MODULE_BASIC_OTHER  4
00206     #define CONFIG_MODULE_BASIC        5
00207     #define CONFIG_MODULE_TRIM         8
00208 
00209     #define CONFIG_MODULE_CHIP_OTHER   16
00210     #define CONFIG_MODULE_CHIP         31
00211 
00212     #define CONFIG_MODULE_OTHER        32
00213     #define CONFIG_MODULE_ALL          63
00214 
00215     //used internally:
00216     #define CONFIG_MODULE_MASK         256
00217     #define CONFIG_MODULE_SCAN_TRIM    512
00218 
00219     #define NO_CONFIG_LOOP            0
00220     #define NORMAL_CONFIG_LOOP        1
00221     #define OFF_ROD_CONFIG_LOOP       2
00222 
00223     //More definitions are in serialStreams.h
00224 
00225 #define R_SET_MODULE_SCAN_MODE   100
00226     typedef struct {
00227         UINT32 cfgSet;
00228         UINT32 module;
00229 
00230     } SetModuleScanModeIn_v100;
00231 
00232 #define R_SET_MASK_STAGE   100
00233     typedef struct {
00234         UINT32 cfgSet;
00235         UINT32 module;
00236         UINT32 chip;
00237 
00238         UINT32 stage;
00239     } SetMaskStageIn_v100;
00240 
00241 /************************************************************************************
00242  *  Primitive function prototypes (not needed by the host processor).
00243  ************************************************************************************/
00244 #if (defined(I_AM_MASTER_DSP) || defined(I_AM_SLAVE_DSP))
00245 
00246 INT32 test(PrimData *);
00247 
00248 INT32 histogramSetup(PrimData *);
00249 INT32 fitHistograms(PrimData *);
00250 
00251 INT32 rwModuleData(PrimData *);
00252 INT32 rwModuleVariable(PrimData *);
00253 INT32 sendConfig(PrimData *);
00254 INT32 setModuleScanMode(PrimData *);
00255 INT32 setMaskStage(PrimData *);
00256 
00257 #endif  /* primitive parameters definition block */
00258 #endif  /* Multiple inclusion protection */

Generated on Thu Dec 15 21:14:31 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5