1 #ifndef ALITRDTRAPCONFIG_H
2 #define ALITRDTRAPCONFIG_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
7 // Class holding the configuration of the tracklet processor
15 class AliTRDtrapConfig : public TObject
20 static AliTRDtrapConfig* Instance();
22 enum TrapReg_t { kSML0,
455 kLastReg }; // enum of all TRAP registers, to be used for access to them
457 const char* GetRegName(TrapReg_t reg) const { return reg >= 0 && reg < kLastReg ? fRegs[reg].fName.Data() : ""; }
458 UShort_t GetRegAddress(TrapReg_t reg) const { return reg >= 0 && reg < kLastReg ? fRegs[reg].fAddr : 0; }
459 UShort_t GetRegNBits(TrapReg_t reg) const { return reg >= 0 && reg < kLastReg ? fRegs[reg].fNbits : 0; }
460 UInt_t GetRegResetValue(TrapReg_t reg) const { return reg >= 0 && reg < kLastReg ? fRegs[reg].fResetValue : 0; }
462 TrapReg_t GetRegByAddress(Int_t address) const;
464 Int_t GetTrapReg(TrapReg_t reg, Int_t det = -1, Int_t rob = -1, Int_t mcm = -1);
465 Bool_t PrintTrapReg(TrapReg_t reg, Int_t det = -1, Int_t rob = -1, Int_t mcm = -1);
466 Bool_t PrintTrapAddr(Int_t addr, Int_t det = -1, Int_t rob = -1, Int_t mcm = -1);
468 Bool_t SetTrapReg(TrapReg_t reg, Int_t value);
469 Bool_t SetTrapReg(TrapReg_t reg, Int_t value, Int_t det);
470 Bool_t SetTrapReg(TrapReg_t reg, Int_t value, Int_t det, Int_t rob, Int_t mcm);
472 Int_t Peek(Int_t addr, Int_t det, Int_t rob, Int_t mcm);
473 Bool_t Poke(Int_t addr, Int_t value, Int_t det, Int_t rob, Int_t mcm);
479 Bool_t SetDmem(Int_t addr, UInt_t value);
480 Bool_t SetDmem(Int_t addr, UInt_t value, Int_t det);
481 Bool_t SetDmem(Int_t addr, UInt_t value, Int_t det, Int_t rob, Int_t mcm);
482 Bool_t SetDmem(Int_t addr, Int_t value) { return SetDmem(addr, (UInt_t) value); }
483 Bool_t SetDmem(Int_t addr, Int_t value, Int_t det) { return SetDmem(addr, (UInt_t) value, det); }
484 Bool_t SetDmem(Int_t addr, Int_t value, Int_t det, Int_t rob, Int_t mcm) { return SetDmem(addr, (UInt_t) value, det, rob, mcm); }
486 Int_t GetDmem(Int_t addr, Int_t det, Int_t rob, Int_t mcm) { return GetDmemSigned(addr, det, rob, mcm); }
487 Int_t GetDmemSigned(Int_t addr, Int_t det, Int_t rob, Int_t mcm) { return (Int_t) GetDmemUnsigned(addr, det, rob, mcm); }
488 UInt_t GetDmemUnsigned(Int_t addr, Int_t det, Int_t rob, Int_t mcm);
490 // configuration handling
492 Bool_t LoadConfig(Int_t det, TString filename);
494 Bool_t ReadPackedConfig(Int_t det, UInt_t *data, Int_t size);
496 Int_t ExtAliToAli( UInt_t dest, UShort_t linkpair, UShort_t rocType);
499 static const Int_t fgkDmemAddrLUTcor0 = 0xC02A;
500 static const Int_t fgkDmemAddrLUTcor1 = 0xC028;
501 static const Int_t fgkDmemAddrLUTnbins = 0xC029;
503 static const Int_t fgkDmemAddrLUTStart = 0xC100; // LUT start address
504 static const Int_t fgkDmemAddrLUTEnd = 0xC3FF; // maximum possible end address for the LUT table
505 static const Int_t fgkDmemAddrLUTLength = 0xC02B; // address where real size of the LUT table is stored
507 static const Int_t fgkDmemAddrTrackletStart = 0xC0E0; // Storage area for tracklets, start address
508 static const Int_t fgkDmemAddrTrackletEnd = 0xC0E3; // Storage area for tracklets, end address
510 static const Int_t fgkDmemAddrDeflCorr = 0xc022; // DMEM address of deflection correction
511 static const Int_t fgkDmemAddrNdrift = 0xc025; // DMEM address of Ndrift
512 static const Int_t fgkDmemAddrDeflCutStart = 0xc030; // DMEM start address of deflection cut
513 static const Int_t fgkDmemAddrDeflCutEnd = 0xc055; // DMEM end address of deflection cut
516 static AliTRDtrapConfig *fgInstance; // pointer to instance (singleton)
519 TString fName; // Name of the register
520 UShort_t fAddr; // Address in GIO of TRAP
521 UShort_t fNbits; // Number of bits, from 1 to 32
522 UInt_t fResetValue; // reset value
523 SimpleReg_t(const char *nnn = 0, UShort_t a = 0, UShort_t n = 0, UInt_t r = 0) :
524 fName(nnn), fAddr(a), fNbits(n), fResetValue(r) {}
532 } state; // mode of storage (global or per MCM)
535 Int_t *individualValue;
539 // configuration registers
540 SimpleReg_t fRegs[kLastReg]; // array of TRAP registers
541 RegValue_t fRegisterValue[kLastReg]; // array of TRAP register values in use
543 Bool_t AddValues(UInt_t det, UInt_t cmd, UInt_t extali, Int_t addr, UInt_t data);
544 Short_t GetRobAB( UShort_t robsel, UShort_t linkpair ) const; // Converts the ROB part of the extended ALICE ID to robs
545 Short_t ChipmaskToMCMlist( Int_t cmA, Int_t cmB, UShort_t linkpair ); // Converts the chipmask to a list of MCMs
547 static const UInt_t fgkScsnCmdWrite=10; // Command number for the write command
548 static const Int_t fgkMaxLinkPairs=4; // number of linkpairs used during configuration
549 static const Int_t fgkMaxMcm; // max. no. of MCMs to be treated
550 static const Int_t fgkMcmlistSize=256; // list of MCMs to which a value has to be written
552 Int_t fMcmlist[fgkMcmlistSize]; // stores the list of MCMs after the conversion from extAliID -> AliID
555 static const Int_t fgkDmemStartAddress; // = 0xc000; // start address in TRAP GIO
556 static const Int_t fgkDmemWords = 0x400; // number of words in DMEM
557 UInt_t* fDmem[fgkDmemWords]; // DMEM storage
558 // Bool_t* fDmemValid[fgkDmemWords]; // DMEM valid flag storage
560 AliTRDtrapConfig(); // private constructor due to singleton implementation
563 struct BlockDescr_t {
575 enum DbankProp_t { kDBankEmpty = 0,
586 AliTRDtrapConfig& operator=(const AliTRDtrapConfig &rhs); // not implemented
587 AliTRDtrapConfig(const AliTRDtrapConfig& cfg); // not implemented
589 ClassDef(AliTRDtrapConfig, 2);