CCAENV1x90Registers.h

Go to the documentation of this file.
00001 #ifndef __CCAENV1X90REGISTERS_H
00002 #define __CCAENV1X90REGISTERS_H
00003 
00019 namespace CCAENV1x90Registers
00020 {
00021   // Can't use typedefs for these since you can't mix typedef with 
00022   // static, const etc.
00023 
00024   #define Offset      static const int
00025   #define Size        static const unsigned int
00026   #define RegisterBit unsigned short
00027   #define LongValue   static unsigned int
00028 
00029   // Segment offsets from the module base address:
00030 
00031   Offset OutputBuffer    (0);      
00032   Size   OutputBufferSize(0x1000); 
00033   Offset Registers       (0x1000); 
00034   Size   RegisterSize   (0x1300); 
00035   Offset ConfigRom       (0x4000); 
00036   Size   ConfigRomSize   (0x0200); 
00037   Offset CompensationSram(0x8000); 
00038   Size   CompensationSramSize(0x0200); 
00039 
00040   // Offsets within to register page.  These are prefixed
00041   // W for word sized registers and L for longword sized registers.
00042 
00043   Offset WControlRegister   (0x1000);
00044   Offset WStatusRegister    (0x1002);
00045   Offset WInterruptLevel    (0x100a);
00046   Offset WInterruptVector   (0x100c);
00047   Offset WVirtualSlot       (0x100e);
00048   Offset WMulticastBase     (0x1010);
00049   Offset WMulticastControl  (0x1012);
00050   Offset WReset             (0x1014);
00051   Offset WClear             (0x1016);
00052   Offset WEventReset        (0x1018);
00053   Offset WSWTrigger         (0x101a);
00054   Offset LEventCounter      (0x101c);
00055   Offset WEventStored       (0x1020);
00056   Offset WAlmostFullLevel   (0x1022);
00057   Offset WBLTEventNumber    (0x1024);
00058   Offset WFirmwareRevision  (0x1026);
00059   Offset LTestRegister      (0x1028);
00060   Offset WOutputControl     (0x102c);
00061   Offset WMicroData         (0x102e);
00062   Offset WMicroHandshake    (0x1030);
00063   Offset WSelectFlash       (0x1032);
00064   Offset WFlashMemory       (0x1034);
00065   Offset WSramPage          (0x1036);
00066   Offset LEventFIFO         (0x1038);
00067   Offset WEventFIFOStored   (0x103c);
00068   Offset WEventFIFOStatus   (0x103e);
00069   Offset LDummy32           (0x1200);
00070   Offset WDummy16           (0x1204);
00071 
00072   // Offsets within the configuration prom.  Note that while these locations
00073   // all accept D16 accesses, usually, only the bottom byte has useful
00074   // information.  The top byte will usually be indeterminate.
00075 
00076   Offset WChecksum          (0x00);
00077   Offset WChecksum_Length2  (0x04);
00078   Offset WChecksum_Length1  (0x08);
00079   Offset WChecksum_Length0  (0x0c);
00080   Offset WConstant2         (0x10);
00081   Offset WConstant1         (0x14);
00082   Offset WConstant0         (0x18);
00083   Offset WC_Code            (0x1c);
00084   Offset WR_Code            (0x20);
00085   Offset WOUI2              (0x24);
00086   Offset WOUI1              (0x28);
00087   Offset WOUI0              (0x2c);
00088   Offset WBoardVersion      (0x30); // e.g. a,b,n
00089   Offset WModelNumber2      (0x34);
00090   Offset WModelNumber1      (0x38);
00091   Offset WModelNumber0      (0x3c);
00092   Offset WRevision3         (0x40);
00093   Offset WRevision2         (0x44);
00094   Offset WRevision1         (0x48);
00095   Offset WRevision0         (0x4c);
00096   Offset WSerialNumber1     (0x80);
00097   Offset WSerialNumber0     (0x84);
00098 
00099   // Note that the data buffer bits are defined in CCAENV1x90Data.h
00100   // The remainder of this file defines bits for each register for which
00101   // it makes sense. The bits themselves are defined in namespaces
00102   // that are named after the registers without the size prefix.
00103   //  Each bit is named exactly as the bit is named in the hardware
00104   // manual.
00105 
00106   namespace ControlRegister 
00107   {     
00108     RegisterBit BERREN              (  0x1);    
00109     RegisterBit NBERREN             (0);
00110     RegisterBit TERM                (  0x2);
00111     RegisterBit NTERM               (1);
00112     RegisterBit TERM_SW             (  0x4);
00113     RegisterBit NTERM_SW            (2);
00114     RegisterBit EMPTY_EVENT         (  0x08);
00115     RegisterBit NEMPTY_EVENT        (3);
00116     RegisterBit ALIGN64             ( 0x010);
00117     RegisterBit NALIGN64            (4);
00118     RegisterBit COMPENSATION_ENABLE ( 0x20);
00119     RegisterBit NCOMPENSATION_ENABLE (5);
00120     RegisterBit TEST_FIFO_ENABLE    ( 0x40);
00121     RegisterBit NTEST_FIFO_ENABLE   (6);
00122     RegisterBit READ_SRAM_ENABLE    ( 0x80); 
00123     RegisterBit NREAD_SRAM_ENABLE   (7);
00124     RegisterBit EVENT_FIFO_ENABLE   (0x100);
00125     RegisterBit NEVENT_FIFO_ENABLE  (8);
00126     RegisterBit TRIGGER_TAG_ENABLE (0x200);  
00127     RegisterBit NTRIGGER_TAG_ENABLE (9);
00128   }
00129 
00130   // The N.... are the bit numbers for the corresponding
00131   //      .... bit mask.
00132   namespace StatusRegister 
00133   {     // This is a read only register.
00134     RegisterBit DATA_READY          (0x0001);
00135     RegisterBit NDATA_READY         (0);
00136     RegisterBit ALM_FULL            (0x0002);
00137     RegisterBit NALM_FULL           (1);
00138     RegisterBit FULL                (0x0004);
00139     RegisterBit NFULL               (2);
00140     RegisterBit TRG_MATCH           (0x0008);
00141     RegisterBit NTRG_MATCH          (3);
00142     RegisterBit HEADER_EN           (0x0010);
00143     RegisterBit NHEADER_EN          (4);
00144     RegisterBit TERM_ON             (0x0020);
00145     RegisterBit NTERM_ON            (5);
00146     RegisterBit CHIP0_ERROR         (0x0040);
00147     RegisterBit NCHIP0_ERROR        (6);
00148     RegisterBit CHIP1_ERROR         (0x0080);
00149     RegisterBit NCHIP1_ERROR        (7);
00150     RegisterBit CHIP2_ERROR         (0x0100);
00151     RegisterBit NCHIP2_ERROR        (8);
00152     RegisterBit CHIP3_ERROR         (0x0200);
00153     RegisterBit NCHIP3_ERROR        (9);
00154     RegisterBit BERR_FLAG           (0x0400);
00155     RegisterBit NBERR_FLAG          (10);
00156     RegisterBit PURGE               (0x0800);
00157     RegisterBit NPURGE              (11);
00158     RegisterBit RESOLUTIONMASK      (0x3000); //    \ The resolution mask can
00159     RegisterBit RES_800ps           (0x0000); //     \ be anded with the 
00160     RegisterBit RES_200ps           (0x1000); //     / status reg. &  compared
00161     RegisterBit RES_100ps           (0x2000); //    /  with any of the RES_
00162     RegisterBit RES_25ps            (0x3000); //   /
00163     RegisterBit PAIR                (0x4000); // Hit detection is pair mode
00164     RegisterBit NPAIR               (14);
00165     RegisterBit TRIGGERLOST         (0x8000); // Triggers were lost.    
00166     RegisterBit NTRIGGERLOST        (15);
00167   } 
00168   // Values in the multicast control register.
00169 
00170   namespace MulticastControl 
00171   {
00172     RegisterBit MASK                (0x0003); // Bits in the register of use.
00173     RegisterBit ACTIVE_FIRST        (0x0002); // Module is first in chain.
00174     RegisterBit ACTIVE_LAST         (0x0001); // Module is last in chain.
00175     RegisterBit ACTIVE_INTERMEDIATE (0x0003); // Module in the middle of chain.
00176   }
00177   
00178   // The output control register determines which signal is reflected on 
00179   // the OUT_PROG ECL output of the module.
00180 
00181   namespace OutputControl 
00182   {
00183     RegisterBit MASK              (0x0007); // mask of the bits.
00184     RegisterBit DATA_READY        (0x0000); //  OUT_PROG reflects data ready
00185     RegisterBit FULL              (0x0001); //  OUT_PROG reflects full cond.
00186     RegisterBit ALM_FULL          (0x0002); //  OUT_PROG reflects almost full.
00187     RegisterBit ERROR             (0x0003); //  OUT_PROG reflects TDC error.
00188 
00189   }
00190   // Micro handshake controls interactions with the micro sequencer.
00191 
00192   namespace MicroHandshake 
00193   {
00194     RegisterBit WRITE_OK         (0x000001); // 1 if ok to write sequencer.
00195     RegisterBit READ_OK          (0x000002); // Nonzero if ok to read.
00196 
00197   }
00198   // The event fifo contains the event count and word count for each
00199   // event.
00200 
00201   namespace EventFIFO 
00202   {
00203     LongValue    FIFOCOUNT_MASK  (0x7ff);      // Mask of bits in FIFO count reg. 
00204     LongValue    WORDCOUNT_MASK  (0x0000ffff); // Mask off word count.
00205     LongValue    WORDCOUNT_RSHIFT (0);         // right shift count.
00206     LongValue    EVENTCOUNT_MASK  (0xffff0000); // Event counter mask.
00207     LongValue    EVENTCOUNT_RSHIFT(16);         // Right shift positioning count.
00208   }
00209 
00210   // FIFO status gives the fullness of the FIFO:
00211 
00212   namespace FIFOStatus 
00213   {
00214     RegisterBit  EVFIFODATA_READY(1); // The fifo has data.
00215     RegisterBit  EVFIFO_FULL(2);      // FIFO is full.
00216   }
00217   // In the configuration rom, the version contains the sub type of the module:
00218   namespace ModuleVersion 
00219   {
00220     RegisterBit  A(0);          // 1x90A
00221     RegisterBit  B(1);          // 1190B
00222     RegisterBit  N(2);          // 1290N
00223   }
00224 
00225 }
00226 
00227 
00228 #endif

Generated on Wed Sep 17 08:38:09 2008 for NSCL Device support. by  doxygen 1.5.1