small correction for error calculation
[u/mrichter/AliRoot.git] / TRD / AliTRDrawTPStream.h
CommitLineData
1c16bea2 1#ifndef ALITRDRAWTPSTREAM_H\r
2#define ALITRDRAWTPSTREAM_H\r
3\r
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
5 * See cxx source for full Copyright notice */\r
6\r
7/* $Id: AliTRDrawTPStream.h 27696 2008-07-31 09:18:53Z cblume $ */\r
8\r
9///////////////////////////////////////////////////////////////////////////////////////\r
10// //\r
11// This class provides access to pattern generated TRD raw data including //\r
12// configuration data. //\r
13// //\r
14///////////////////////////////////////////////////////////////////////////////////////\r
15\r
16\r
17#define NREGS 433 // number of conf. registers\r
18#define NCMD 16 // number of command registers\r
19#define NRO 25 // number of command registers\r
20#define N_BLOCKS 38 // number of blocks\r
21#define N_BLOCKS_n 64 // number of blocks\r
22#define N_PACKD_DAT 0xE0 // the max size of the packed conf., the absolute max is 256!\r
23#define N_NO_BCST 3 // number of regs without broadcast\r
24#define NDMEM 0x400 // number of DMEM words\r
25#define NDBANK 0x100 // number of DBANK words\r
26#define N_IMEM 0x1000 // number of IMEM words/CPU\r
27#define IMEM_EMPTY 0x80000000 // mark for empty IMEM\r
28#define DBANK_ADDR 0xF000 // start address of DBANK in GIO\r
29#define DMEM_ADDR 0xC000 // start address of DMEM in GIO\r
30#define ENDM_CONF 0x7FFF00FE // end marker for the packed configuration\r
31\r
32#include "TObject.h"\r
33#include "TString.h"\r
34#include "AliTRDrawStreamBase.h"\r
35\r
36\r
37\r
38class AliTRDrawTPStream : public AliTRDrawStreamBase\r
39{ // class def begin\r
40\r
41 public:\r
42\r
43 struct SimpleRegs {\r
44 const Char_t * fName; //! Name of the register \r
45 UInt_t fAddr; // Address in GIO of TRAP\r
46 UInt_t fNbits; // Number of bits, from 1 to 32\r
47 UInt_t fResVal; // reset value [mj]\r
48 };\r
49\r
50 struct CmdRegs{\r
51 const Char_t * fName; //! Name of the command register\r
52 UInt_t fAddr; // Address in GIO of TRAP\r
53 };\r
54\r
55 AliTRDrawTPStream(Int_t rawVMajorOpt, UInt_t * pPos);\r
56 AliTRDrawTPStream(const AliTRDrawTPStream& st);\r
57 AliTRDrawTPStream &operator=(const AliTRDrawTPStream &);\r
58 virtual ~AliTRDrawTPStream();\r
59\r
60 Bool_t DecodeTPdata();\r
61 Bool_t DecodeConfigdata();\r
62 Bool_t FillConfig();\r
63 Int_t ReadPacked(UInt_t *word, UInt_t *pdata, Int_t * const len);\r
64 Int_t UnPackConfN(const UInt_t *pData, Int_t maxLength);\r
65 Int_t SetU(UInt_t addr, UInt_t newVal);\r
66 Int_t AddrIsDmem(UInt_t addr) const;\r
67 Int_t AddrIsDbank(UInt_t addr) const;\r
68 UInt_t Addr2Idx(UInt_t addr) const;\r
69 const Char_t * Addr2Name(UInt_t addr) const; //!\r
70 Char_t CnfStat(UInt_t prop) const;\r
71 void PowerUp();\r
72 void DumpCnf(Int_t slv);\r
73 \r
74\r
75\r
76 protected:\r
77\r
78 enum DbankProp {kDbankEmpty=0, kDbankHeader, kDbankData, kDbankNoB, kDbankCrc32, kDbankEheader, kScsnDat}; \r
79\r
80 SimpleRegs fTrapReg[NREGS]; // all TRAP configuration registers \r
81 CmdRegs fCmdReg[NCMD]; // all TRAP command registers\r
82 CmdRegs fRoReg[NRO]; // all TRAP command registers\r
83\r
84 UInt_t fCnfPro[NREGS]; // something ...\r
85 UInt_t fDmemValid[NDMEM]; // 0- empty, 1- valid\r
86 UInt_t fRegs[NREGS]; // the actual content of all conf. registers\r
87 UInt_t fDmem[NDMEM]; // content of the DMEM, in GIO from 0xC000 to 0xC3FF\r
88 UInt_t fDbank[NDBANK]; // 32 bit data, to be send to DBANK\r
89 DbankProp fDbankPro[NDBANK]; // property: 0-empty, 1- header, 2- data, 3- data no broadcast, 4- crc-32 checksum, 5- empty header\r
90\r
91 UInt_t *fpPos; //! current position in the buffer\r
92 Int_t fRawVMajorOpt; // Raw data version\r
93\r
94\r
95 ClassDef(AliTRDrawTPStream, 0) // Pattern generated TRD raw data\r
96\r
97}; \r
98\r
99#endif\r