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

histogram_sct.h

00001 /************************************************************************************
00002  *  the histogram control structure:   Set of basic variables that control histograms.
00003  *
00004  *    Fields:
00005  *
00006  * dpsf update.
00007  *
00008  *     nModules:   Depends upon the histogram set; indicates the number of modules
00009  *                 to histogram.
00010  *
00011  *     histogramsAreSetup:  Flag indicating whether or not the histoSetup routine
00012  *                          has been run; if not, the histogramming routines will
00013  *                          not execute.
00014  *
00015  *     nBins:      Defines the number of bins in each histogram.
00016  *     
00017  *     currentBin: The bin to be updated.
00018  *
00019  *     base, size:      The base address of histograms in memory, and their size.
00020  *     
00021  *     deltaChan, deltaChip, deltaModule:  Control offsets from the base into the
00022  *                                         histograms; calculated for 16 bit pointer
00023  *                                         arithmetic.
00024  *
00025  *
00026  * ----------------------------------------------------------------------------------
00027  *  histograms in memory:
00028  *
00029  *
00030  ************************************************************************************/
00031 #ifndef HISTOGRAM_STRUCT
00032 #define HISTOGRAM_STRUCT
00033 
00034 #include "serialStreams.h"
00035 #include "scanControl.h"
00036 #include "eventHandler.h"
00037 
00038 #define HISTOGRAM_BIN_MAX     (0x100)
00039 #define N_STRIPS              N_SCT_CHANS
00040 #define N_CHIPOCC_BINS        32
00041 
00042 typedef struct BinCtr {
00043     UINT32 ctr[HISTOGRAM_BIN_MAX];
00044 } BinCtr;
00045 
00046 /* Fields marked with a ** comment are needed by the assembly language routine,
00047    which has easy no way of getting the order of the structure members from the
00048    c structure. Therefore if changes are made which alter these fields positions
00049    with respect to the start of the structure or each other, the assembly code's
00050    offsets will need updating. */
00051 
00052 typedef struct HistoCtrl {
00053     UINT8  histogramsAreSetup, histogramSet, verbose, doChipOcc,
00054            unused0, dataFormat, routineType, dataWarn,
00055            registerFlag, nValidModules, calLine, calLineEnable;
00056 
00057     UINT32 asmGuard;
00058 
00059     UINT32  stageFirst, emptyLength ;   
00060     UINT32  hashScheme, hash, nStages;
00061 
00062     UINT32  eventsPerL1A, binSize, dataType[2];
00063     UINT8   doOccupancy, doTimeSlice, doTotSpect, doTotMean;
00064 
00065     UINT32 deltaChan, deltaColumn, deltaChp, deltaHash; /* all ** hashing */
00066     UINT32 deltaChip, deltaModule,  deltaBin,  deltaTS, deltaSlice,  deltaSet;
00067 
00068     UINT32 *lutBase ;
00069 
00070     UINT16 nBins, currentBin;
00071     UINT32 repetitions;
00072     MDAT32 *xPtr[2];
00073 
00074     UINT32 *base, *invalidData, size, *occBase,
00075            unused1[4];
00076 
00077     UINT32 moduleRangeMap[2][2];
00078     UINT32 validModules[2];
00079     BinCtr *binCtr;
00080 
00081     UINT32 *fitBase, fitLength;
00082     void   (*histoFxn)(struct EventData *);
00083     UINT32 asmGuard2;   
00084     /* The moduleBase array gives a pointer to the base of histograms (per link);
00085        the 1st set ([0]) is initialized at histogram setup, and the 2nd set ([1])
00086        is initialized at the start of each bin. Links are defined in the ROD-standard
00087        way: 0x00-0x0b => formatter 0, links 0-11, 0x70-0x7b => formatter 7, links 0-11.
00088        If anything other than 32-bit binning is used, the module base pointer
00089        initializations will be correct, but to be used they must be re-cast as a
00090        pointer to words. */
00091     UINT32 *moduleBase[2][128];
00092 
00093     UINT32 unused2[8];
00094 
00095 } HistoCtrl;
00096 
00097 
00098 #if defined(I_AM_MASTER_DSP)
00099 #include "timing.h"
00100 
00101 typedef struct {
00102     UINT8  rangeList, serialPort, unused[2]; 
00103     UINT32 validModules[2];
00104     UINT32 *L1id;
00105     UINT32 *nEvents, *nErrors;
00106 } GroupInfo;
00107 
00108 typedef struct {
00109     UINT8  dspNum, nContribGroups, nPorts, ports;
00110     UINT8  groupId[N_MODULE_GROUPS];
00111     UINT8  paired, pair, active, mask; 
00112 
00113     UINT8  nModules, unused[3];
00114     UINT32 L1id[2];
00115     UINT32 validModules[2];
00116 
00117     UINT32 trapCmd;
00118     UINT32 trapStat[3];
00119     UINT8  iHead, xHead, iTail, xTail;
00120     UINT8  nIdram, nSdram;
00121     UINT16 nWait;
00122 
00123     UINT32 nTrig, nErrors, nEvents, nErrorsTot;
00124     UINT32 delErr;
00125 
00126     UINT32 updateCnt;
00127     UINT32 avgProcTime;
00128     UINT16 avgEvtLen;
00129     UINT16 sigmaEvtLen;
00130 
00131     UINT32 seriesEvents[2], seriesErrors[2];
00132 
00133     //UINT32 avgProcTime;
00134     //UINT32 avgTimeToHeader, avgTransmitTime, avgTimeToTrailer;
00135     //UINT32 avgExtraProcTime, avgDwellTime;
00136 } DspInfo;
00137 
00138 
00139 typedef struct {
00140     ScanControl *scan;
00141     ScanStatus  *status;
00142     ScanTimingInfo *timing;
00143 
00144     UINT8  slvBits, evtWait; 
00145     UINT8  cfgSet, cfgReg[2];
00146     UINT8  nBins[2], bin0, port;
00147 
00148     UINT32 dataType[2];
00149 
00150     UINT8  groupRangeMap[2]; /* bitfield indicating which module groups
00151                                 use which range set. */
00152     MDAT32  *dataPtr[2];
00153 
00154     UINT32  repetitions, trigLoopMax, trigSent, efbCnt, incCnt, trapSeries;
00155     UINT32  taskTimeMax;
00156     UINT32  deltaTrig, trigDelay;
00157     UINT32  tvTime[N_SDSP], tvDelay[N_SDSP]; // PWP
00158 
00159     UINT8   groupSPMap[2];
00160     UINT8   groupDSPMap[4];
00161 
00162     UINT8   defGroups;
00163     UINT8   nDspPairs, dspPair[2][2];
00164 
00165     GroupInfo groupInfo[N_MODULE_GROUPS];
00166     UINT16  evtLen;
00167     DspInfo dspInfo[N_SDSP];
00168 
00169     UINT8 manual, soft_bc_reset, autoStall;
00170     UINT8 trigPause, binPause, stagePause;
00171 
00172     Module *moduleCfg;
00173     
00174     UINT8  mod8[2];
00175 
00176     UINT8  extSetup, dataPath;
00177     UINT32 slvRep, sdspAttention;
00178 
00179     UINT32 initTime, trigTime, time, interval;
00180     UINT32 *ptr, nSets;
00181     CmdBuff *cmdBuffer[2];
00182     CmdList *cmdListPtr[2], postConfigCmdList, triggerSequence[2];
00183     UINT8 SPTriggers[2], SPEcr[2], ecrSent, triggerPairs;
00184     UINT8 L1idReset, extrap;
00185     UINT8 calLineLoop, calLine;
00186     
00187     UINT8  first, ready, expecting, proc, pbin, done, reinit;
00188 
00189     UINT8  singleCfgVar[2];
00190     UINT8  stageAdvance, chipAdvance, binAdvance[2], sendCfg[2];
00191     UINT8  twoDScan, pulsing, eventReTransmits, goodEvent;
00192     UINT32 reTransmitCnt;
00193     UINT32 stageCfg;
00194     INT32 error;
00195 
00196     UINT8  errCnt[4];
00197 
00198 
00199 } MasterHistoCtrl;
00200 
00201 #endif  /* MDSP */
00202 #endif  /* Multiple-inclusion protection. */

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