Pixel ROD configuration data structure and function calls: Version 0.4 ====================================================================== Revision History ================ 23 Feb 2000. JCH. Initial Version 0.1. 24 Feb 2000. JCH. Version 0.2. Minor tidying up. 25 Feb 2000. JCH. Version 0.3. Add a module mask and minor fixes. 25 Feb 2000. JCH. Version 0.4. Fist attempt at function definitions. ==================================================================== #define N_RODS 16 #define N_MODULES 24 #define N_CHIPS 16 #define N_PIXELS 18*160 /*for non-B layer*/ /* The following typedefs are for clarity, and obviously may need to change depending on platform. */ typedef unsigned short UINT16; typedef unsigned int UINT32; struct CSR { unsigned int outputMode : 2; unsigned int errorReport : 1; unsigned int enableCheck : 1; unsigned int enableTOT : 1; unsigned int outputPattern : 1; unsigned int playback : 1; : 9; /*pad to 16 bits */ } ; struct CAL { unsigned int pulseWidth : 9; unsigned int pulseDelay : 7; } ; struct CHIP { UINT32 tdac0[N_PIXELS/32]; UINT32 tdac1[N_PIXELS/32]; UINT32 tdac2[N_PIXELS/32]; UINT32 readoutMask[N_PIXELS/32]; } oneChipConfig; struct MODULE { struct CHIP chipConfig[N_CHIPS]; struct CSR csrReg; struct CAL calReg; UINT16 feen; } oneModuleConfig; struct ROD { UINT32 moduleMask[N_MODULES/4]; struct MODULE moduleConfig[N_MODULES]; } rodConfig; struct { struct ROD rodConfig[N_RODS]; } pixelConfig; /* function definitions */ int pixelConfigInit(UINT16 numRods); /*initialise the structure?*/ int pixelConfigLoad(char *filename); /*fill the structure from data in a file*/ int pixelConfigReadCalReg(UINT16 rod, UINT16 module, UINT16 chip, \ UINT16 &value); /*read the CAL register*/ int pixelConfigReadCsrReg(UINT16 rod, UINT16 module, UINT16 chip, \ UINT16 &value); /*read the CSR register*/ int pixelConfigReadFeenReg(UINT16 rod, UINT16 module, UINT16 chip, \ UINT16 &value); /*read the FEEN register*/ int pixelConfigReadModuleMask(UINT16 rod, UINT32 &value[N_MODULES/4]); /*read the module mask*/ int pixelConfigReadReadoutMask(UINT16 rod, UINT16 module, UINT16 chip, \ UINT32 &value[N_PIXELS/32]); /*read the readout mask string*/ int pixelConfigReadTdac0(UINT16 rod, UINT16 module, UINT16 chip, \ UINT32 &value[N_PIXELS/32); /*read the tdac0 bit string*/ int pixelConfigReadTdac1(UINT16 rod, UINT16 module, UINT16 chip, \ UINT32 &value[N_PIXELS/32); /*read the tdac1 bit string*/ int pixelConfigReadTdac2(UINT16 rod, UINT16 module, UINT16 chip, \ UINT32 &value[N_PIXELS/32); /*read the tdac2 bit string*/ int pixelConfigSetCalReg(UINT16 rod, UINT16 module, UINT16 chip, \ UINT16 &value); /*set the CAL register*/ int pixelConfigSetCsrReg(UINT16 rod, UINT16 module, UINT16 chip, \ UINT16 &value); /*set the CSR register*/ int pixelConfigSetFeenReg(UINT16 rod, UINT16 module, UINT16 chip, \ UINT16 &value); /*set the FEEN register*/ int pixelConfigSetModuleMask(UINT16 rod, UINT32 &value[N_MODULES/4]); /*set the module mask*/ int pixelConfigSetReadoutMask(UINT16 rod, UINT16 module, UINT16 chip, \ UINT32 &value[N_PIXELS/32]); /*set the readout mask string*/ int pixelConfigSetTdac0(UINT16 rod, UINT16 module, UINT16 chip, \ UINT32 &value[N_PIXELS/32); /*set the tdac0 bit string*/ int pixelConfigSetTdac1(UINT16 rod, UINT16 module, UINT16 chip, \ UINT32 &value[N_PIXELS/32); /*set the tdac1 bit string*/ int pixelConfigSetTdac2(UINT16 rod, UINT16 module, UINT16 chip, \ UINT32 &value[N_PIXELS/32); /*set the tdac2 bit string*/ Notes ===== 1) The bit order is not defined in the C language for structures like CONFIG, so we may have to revert to #define and masks. 2) The above structure definitions would take up 540kB/ROD (i.e. ~8.4MB for a full crate). 3) All functions return the status as an int. <0 indicates errors, >0 means probable success but with issues. 4) List of functions is clearly not complete - for example we may need higher level functions?