]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDrawTPStream.cxx
Adding directory with the production requests
[u/mrichter/AliRoot.git] / TRD / AliTRDrawTPStream.cxx
CommitLineData
242f25f2 1#/**************************************************************************
2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
7* Permission to use, copy, modify and distribute this software and its *
8* documentation strictly for non-commercial purposes is hereby granted *
9* without fee, provided that the above copyright notice appears in all *
10* copies and that both the copyright notice and this permission notice *
11* appear in the supporting documentation. The authors make no claims *
12* about the suitability of this software for any purpose. It is *
13* provided "as is" without express or implied warranty. *
14**************************************************************************/
15
16/* $Id: AliTRDrawTPStream.cxx 27797 2008-08-05 14:37:22Z cblume $ */
17
18///////////////////////////////////////////////////////////////////////////////////////
19// //
20// This class provides access to pattern generated TRD raw data including //
21// configuration data. //
22// //
23// It is based on Venelin Angelov's c++ code decoding standalone //
24// configuration data //
25// http://alice.physi.uni-heidelberg.de/svn/trd/wconfigurations/trunk/C/trap_cnf.cpp //
26// http://alice.physi.uni-heidelberg.de/svn/trd/wconfigurations/trunk/C/trap_cnf.h //
27// //
28// Author: MinJung Kweon(minjung@physi.uni-heidelberg.de) //
29// //
30///////////////////////////////////////////////////////////////////////////////////////
31
32#include "TString.h"
33#include "AliLog.h"
34
77913956 35#include "AliTRDrawStream.h"
242f25f2 36#include "AliTRDrawTPStream.h"
37
38
39#define GET_VALUE_AT(w,m,s) (( (w) >> (s)) & (m) )
40#define MCM_HEADER_MASK_ERR(w) ( ((w) & (0xf)) == (0xc) ? 0 : 1)
41#define MCM_ROB_NUMBER(w) GET_VALUE_AT(w,0x7,28)
42#define MCM_MCM_NUMBER(w) GET_VALUE_AT(w,0x0f,24)
43#define MCM_EVENT_COUNTER(w) GET_VALUE_AT(w,0x00fffff,4)
44
45
46
47ClassImp(AliTRDrawTPStream)
48
49//---------------------------------------------------------------------
50AliTRDrawTPStream::AliTRDrawTPStream(Int_t rawVMajorOpt, UInt_t * pPos)
51 : AliTRDrawStreamBase()
52 , fTrapReg()
53 , fCmdReg()
54 , fRoReg()
55 , fCnfPro()
56 , fDmemValid()
57 , fRegs()
58 , fDmem()
59 , fDbank()
60 , fDbankPro()
61 , fpPos(pPos)
62 , fRawVMajorOpt(rawVMajorOpt)
63{
64 //
65 // default constructor
66 //
67
68 if (FillConfig() == kFALSE)
69 AliError("Reading reset value failed.");
70
71}
72
73//---------------------------------------------------------------------
74AliTRDrawTPStream::AliTRDrawTPStream(const AliTRDrawTPStream& /*st*/)
75 : AliTRDrawStreamBase()
76 , fTrapReg()
77 , fCmdReg()
78 , fRoReg()
79 , fCnfPro()
80 , fDmemValid()
81 , fRegs()
82 , fDmem()
83 , fDbank()
84 , fDbankPro()
85 , fpPos()
86 , fRawVMajorOpt()
87{
88 //
89 // copy constructor
90 //
91
92 AliError("Not implemeneted.");
93
94}
95
96//---------------------------------------------------------------------
97AliTRDrawTPStream &
98AliTRDrawTPStream::operator=(const AliTRDrawTPStream &)
99{
100 //
101 // we are not using this functionality
102 //
103 AliFatal("May not use.");
104 return *this;
105}
106
107//---------------------------------------------------------------------
108AliTRDrawTPStream::~AliTRDrawTPStream()
109{
110 //
111 // destructor
112 //
113}
114
115//---------------------------------------------------------------------
116Bool_t AliTRDrawTPStream::DecodeTPdata()
117{
242f25f2 118
77913956 119 if (fRawVMajorOpt == 7)
242f25f2 120 {
77913956 121 AliInfo("This is configuration data event read by first trigger.");
122 if(!AliTRDrawStream::fgEnableDecodeConfigData) return kTRUE;
242f25f2 123 if (DecodeConfigdata() == kFALSE) // configuration data
124 {
125 AliError("failed to to decode configuration data");
126 return kFALSE;
127 }
128 else
129 return kTRUE;
130 }
131 else
132 AliError("These are different type of test pattern data. You need other reader");
133
134 return kFALSE;
135}
136
137//---------------------------------------------------------------------
138Bool_t AliTRDrawTPStream::DecodeConfigdata()
139{
140
141 UInt_t packedConf[256];
142 Int_t mcmPos, mcmsRead, lengthPacked;
143
144 mcmsRead = 0;
145 do
146 {
147 mcmPos = ReadPacked(fpPos, packedConf, &lengthPacked);
148 if (mcmPos >= 0)
149 {
150 PowerUp();
151 UnPackConfN(packedConf, lengthPacked);
152 DumpCnf(mcmPos);
153 mcmsRead++;
154 AliInfo(Form("%d MCMs read up to now, last was MCM%02d\n",mcmsRead, mcmPos));
155 }
156 } while ((mcmsRead < 84) && (mcmPos >= 0)); // [mj] have to think about # of mcmsRead
157 AliInfo("Done\n");
158
159 return kTRUE;
160}
161
162//---------------------------------------------------------------------
163Int_t AliTRDrawTPStream::ReadPacked(UInt_t *word, UInt_t *pData, Int_t *nWords)
164{
165
166 UInt_t vword = *word;
167
168 Int_t iLength;
169 UInt_t err, robNum, mcmNum, chipId, NoEndMarker;
170
171 iLength = 0;
172 err = 0;
173
174 // decode mcm header
77913956 175 if(MCM_HEADER_MASK_ERR(vword)) err++;
242f25f2 176
177 robNum = MCM_ROB_NUMBER(vword);
178 mcmNum = MCM_MCM_NUMBER(vword);
179 chipId = MCM_EVENT_COUNTER(vword);
180
181 if (err == 0) {
182 AliInfo(Form("MCM header ROB %d, MCM %02d, ChipId %d 0x%05x\n", robNum, mcmNum, chipId, chipId));
183 }
184 else
185 return -1;
186
187 // read MCM data and store into array
188 NoEndMarker = 1;
189 do
190 {
191 word++;
192 vword = *word;
193
194 NoEndMarker = ((vword != ENDM_CONF) && (vword != (ENDM_CONF | 1)) && (vword != 0x10001000));
195 *pData = vword;
196 pData++;
197 iLength++;
198 } while (NoEndMarker && (iLength < 256));
199
77913956 200 word++;
201 fpPos = word;
202
242f25f2 203 *nWords = iLength;
204 if (iLength == 0)
205 return -1;
206 else
207 return mcmNum;
208}
209
210//---------------------------------------------------------------------
211void AliTRDrawTPStream::PowerUp() // power up
212{
213 // copy the reset values
214 for (Int_t i=0; i< N_REGS; i++)
215 {
216 fRegs[i] = fTrapReg[i].fResVal;
217 fCnfPro[i] = 0;
218 }
219 // mark all DMEM cells as invalid
220 for (Int_t i=0; i< N_DMEM; i++) fDmemValid[i] = 0;
221 // mark all DBANK cells as empty
222 for (Int_t i=0; i< N_DBANK; i++) fDbankPro[i] = kDbankEmpty;
223}
224
225
226//---------------------------------------------------------------------
227Int_t AliTRDrawTPStream::UnPackConfN(UInt_t *pData, Int_t maxLength)
228{
229 Int_t debug = 0; // the debug mode not completely ready
230 Int_t step, bwidth, nwords, idx, err, exitFlag, bitcnt, werr;
231 UInt_t caddr;
232 UInt_t dat, msk, header, dataHi;
233
234 idx = 0; // index in PackedConf
235 err = 0;
236 while (idx < maxLength)
237 {
238 header = *pData;
239 if (debug) printf("read 0x%08x ",header);
240 pData++;
241 idx++;
242 if (header & 0x01) // single data
243 {
244 dat = (header >> 2) & 0xFFFF; // 16 bit data
245 caddr = (header >> 18) & 0x3FFF; // 14 bit address
246 if (caddr != 0x1FFF) // temp!!! because the end marker was wrong
247 {
248 if (header & 0x02) // check if > 16 bits
249 {
250 dataHi = *pData;
251 if (debug) printf("read 0x%08x ",dataHi);
252 pData++;
253 idx++;
254 err += ((dataHi ^ (dat | 1)) & 0xFFFF) != 0;
255 dat = (dataHi & 0xFFFF0000) | dat;
256 }
257 if (debug) printf("addr=0x%04x (%s) data=0x%08x\n",caddr, Addr2Name(caddr), dat);
258 werr = SetU(caddr, dat);
259 if (werr < 0)
260 {
261 printf("(single-write): non-existing address 0x%04x containing 0x%08x\n", caddr, header);
262 }
263 if (idx > maxLength)
264 {
265 printf("(single-write): no more data, missing end marker\n");
266 return -err;
267 }
268 }
269 else
270 {
271 printf("(single-write): address 0x%04x => old endmarker?\n",caddr);
272 return err;
273 }
274 }
275 else // block of data
276 {
277 step = (header >> 1) & 0x0003;
278 bwidth = ((header >> 3) & 0x001F) + 1;
279 nwords = (header >> 8) & 0x00FF;
280 caddr = (header >> 16) & 0xFFFF;
281 exitFlag = (step == 0) || (step == 3) || (nwords == 0);
282 if (exitFlag) return err;
283 switch (bwidth)
284 {
285 case 15:
286 case 10:
287 case 7:
288 case 6:
289 case 5:
290 {
291 msk = (1 << bwidth) - 1;
292 bitcnt = 0;
293 while (nwords > 0)
294 {
295 nwords--;
296 bitcnt -= bwidth;
297 if (bitcnt < 0)
298 {
299 header = *pData;
300 if (debug) printf("read 0x%08x ",header);
301 pData++;
302 idx++;
303 err += (header & 1);
304 header = header >> 1;
305 bitcnt = 31 - bwidth;
306 }
307 if (debug) printf("addr=0x%04x (%s) data=0x%08x\n",caddr, Addr2Name(caddr), header & msk);
308 werr = SetU(caddr, header & msk);
309 if (werr < 0)
310 {
311 printf("(single-write): non-existing address 0x%04x containing 0x%08x\n", caddr, header);
312 }
313 caddr += step;
314 header = header >> bwidth;
315 if (idx >= maxLength)
316 {
317 printf("(block-write): no end marker! %d words read\n",idx);
318 return -err;
319 }
320 }
321 break;
322 } // end case 5-15
323 case 31:
324 {
325 while (nwords > 0)
326 {
327 header = *pData;
328 if (debug) printf("read 0x%08x ",header);
329 pData++;
330 idx++;
331 nwords--;
332 err += (header & 1);
333 if (debug) printf("addr=0x%04x (%s) data=0x%08x\n",caddr, Addr2Name(caddr), header >> 1);
334 werr = SetU(caddr, header >> 1);
335 if (werr < 0)
336 {
337 printf("(single-write): non-existing address 0x%04x containing 0x%08x\n", caddr, header);
338 }
339 caddr += step;
340 if (idx >= maxLength)
341 {
342 printf("no end marker! %d words read\n",idx);
343 return -err;
344 }
345 }
346 break;
347 }
348 default: return err;
349 } // end switch
350 } // end block case
351 } // end while
352 printf("no end marker! %d words read\n",idx);
353 return -err; // only if the max length of the block reached!
354}
355
356//---------------------------------------------------------------------
357void AliTRDrawTPStream::DumpCnf(Int_t slv)
358{
359 UInt_t idx;
360 for (idx = 0; idx < N_REGS; idx++) // config. reg
361 {
362 if (slv >= 0)
363 printf("%s\t0x%08x\t%3d %c\n", fTrapReg[idx].fName, (Int_t) fRegs[idx], slv, CnfStat(fCnfPro[idx]));
364 else
365 printf("%s\t0x%08x %c\n", fTrapReg[idx].fName, (Int_t) fRegs[idx], CnfStat(fCnfPro[idx]));
366 }
367}
368
369
370//---------------------------------------------------------------------
a6e0ebfe 371const Char_t * AliTRDrawTPStream::Addr2Name(UInt_t addr)
242f25f2 372{
373 Int_t idx;
374 idx = 0;
375 if ( ( ( (addr >> 4) & 0xFFE) == 0x0C0) && ( ( (addr >> 2) & 1) == 1) )
376 {
377 addr = addr & 0x0C07;
378 }
379 while ((idx < N_REGS) && (fTrapReg[idx].fAddr != addr) ) idx++;
380 if (idx < N_REGS)
381 return fTrapReg[idx].fName;
382 idx = 0;
383 while ((idx < N_CMD) && (fCmdReg[idx].fAddr != addr)) idx++;
384 if (idx < N_CMD)
385 return fCmdReg[idx].fName;
386 idx = 0;
387 while ((idx < N_RO) && (fRoReg[idx].fAddr != addr)) idx++;
388 if (idx < N_RO)
389 return fRoReg[idx].fName;
390 else
391 return 0;
392}
393
394//---------------------------------------------------------------------
395Char_t AliTRDrawTPStream::CnfStat(UInt_t prop)
396{
397 if (prop == 0) return 'U';
398 else
399 if (prop == 1) return 'R';
400 else
401 if (prop == 2) return 'I';
402 else
403 return prop;
404}
405
406//---------------------------------------------------------------------
407Int_t AliTRDrawTPStream::SetU(UInt_t addr, UInt_t newVal)
408{
409 Int_t i;
410 UInt_t maxVal = 0;
411
412 if (AddrIsDmem(addr))
413 {
414 fDmem[addr & 0x3FF] = newVal;
415 fDmemValid[addr & 0x3FF] = 1;
416 return 0;
417 }
418 else
419 if (AddrIsDbank(addr))
420 {
421 fDbank[addr & 0xFF] = newVal;
422 fDbankPro[addr & 0xFF] = kScsnDat;
423 return 0;
424 }
425 else
426 {
427 i = Addr2Idx(addr);
428 if (i < N_REGS) // found
429 {
430 fCnfPro[i] = 2;
431 if (fTrapReg[i].fNbits < 32) // create the max value from the number of bits
432 {
433 maxVal = 1;
434 maxVal = (maxVal << fTrapReg[i].fNbits) - 1;
435 }
436 if ( (fTrapReg[i].fNbits == 32) || (newVal <= maxVal) ) // in range
437 {
438 fRegs[i] = newVal;
439 return 0;
440 }
441 else
442 { // out of range
443 fRegs[i] = newVal & maxVal;
444 printf("Out of range, writing 0x%08x to %d bits at addr = 0x%04x\n",newVal, fTrapReg[i].fNbits, addr);
445 return -2;
446 }
447 }
448 else // not found
449 {
450 printf("(SetU): No such address, writing 0x%08x to addr = 0x%04x\n",newVal, addr);
451 return -1; // no such address
452 }
453 }
454}
455
456//---------------------------------------------------------------------
457Int_t AliTRDrawTPStream::AddrIsDmem(UInt_t addr)
458{
459 addr = (addr >> 10);
460 return (addr == 0x30);
461}
462
463//---------------------------------------------------------------------
464Int_t AliTRDrawTPStream::AddrIsDbank(UInt_t addr)
465{
466 addr = (addr >> 8);
467 return (addr == 0xF0);
468}
469
470//---------------------------------------------------------------------
471UInt_t AliTRDrawTPStream::Addr2Idx(UInt_t addr)
472{
473 Int_t idx;
474 idx = 0;
475 // check if global const
476 if ( ( ( (addr >> 4) & 0xFFE) == 0x0C0) && ( ( (addr >> 2) & 1) == 1) )
477 {
478 addr = addr & 0x0C07;
479 }
480 // searching
481 while ((idx < N_REGS) && (fTrapReg[idx].fAddr != addr)) idx++;
482 // printf("Addr = 0x%04x; Idx = %d\n",addr, idx); // debugging
483 return idx;
484}
485
486//---------------------------------------------------------------------
487Bool_t AliTRDrawTPStream::FillConfig()
488{
489
490 const SimpleRegs trapReg[N_REGS] = {
491 // Name Address Nbits Reset Value
492 // Global state machine
493 {"SML0", 0x0A00, 15, 0x4050},
494 {"SML1", 0x0A01, 15, 0x4200},
495 {"SML2", 0x0A02, 15, 0x4384},
496 {"SMMODE", 0x0A03, 16, 0xF0E2},
497 {"NITM0", 0x0A08, 14, 0x3FFF},
498 {"NITM1", 0x0A09, 14, 0x3FFF},
499 {"NITM2", 0x0A0A, 14, 0x3FFF},
500 {"NIP4D", 0x0A0B, 7, 0x7F},
501 {"CPU0CLK", 0x0A20, 5, 0x07},
502 {"CPU1CLK", 0x0A22, 5, 0x07},
503 {"CPU2CLK", 0x0A24, 5, 0x07},
504 {"CPU3CLK", 0x0A26, 5, 0x07},
505 {"NICLK", 0x0A28, 5, 0x07},
506 {"FILCLK", 0x0A2A, 5, 0x07},
507 {"PRECLK", 0x0A2C, 5, 0x07},
508 {"ADCEN", 0x0A2E, 5, 0x07},
509 {"NIODE", 0x0A30, 5, 0x07},
510 {"NIOCE", 0x0A32, 5, 0x21}, // bit 5 is status bit (read-only)!
511 {"NIIDE", 0x0A34, 5, 0x07},
512 {"NIICE", 0x0A36, 5, 0x07},
513 // Arbiter
514 {"ARBTIM", 0x0A3F, 4, 0x0},
515 // IVT of CPU0
516 {"IA0IRQ0", 0x0B00, 12, 0x000},
517 {"IA0IRQ1", 0x0B01, 12, 0x000},
518 {"IA0IRQ2", 0x0B02, 12, 0x000},
519 {"IA0IRQ3", 0x0B03, 12, 0x000},
520 {"IA0IRQ4", 0x0B04, 12, 0x000},
521 {"IA0IRQ5", 0x0B05, 12, 0x000},
522 {"IA0IRQ6", 0x0B06, 12, 0x000},
523 {"IA0IRQ7", 0x0B07, 12, 0x000},
524 {"IA0IRQ8", 0x0B08, 12, 0x000},
525 {"IA0IRQ9", 0x0B09, 12, 0x000},
526 {"IA0IRQA", 0x0B0A, 12, 0x000},
527 {"IA0IRQB", 0x0B0B, 12, 0x000},
528 {"IA0IRQC", 0x0B0C, 12, 0x000},
529 {"IRQSW0", 0x0B0D, 13, 0x1FFF},
530 {"IRQHW0", 0x0B0E, 13, 0x0000},
531 {"IRQHL0", 0x0B0F, 13, 0x0000},
532 // IVT of CPU1
533 {"IA1IRQ0", 0x0B20, 12, 0x000},
534 {"IA1IRQ1", 0x0B21, 12, 0x000},
535 {"IA1IRQ2", 0x0B22, 12, 0x000},
536 {"IA1IRQ3", 0x0B23, 12, 0x000},
537 {"IA1IRQ4", 0x0B24, 12, 0x000},
538 {"IA1IRQ5", 0x0B25, 12, 0x000},
539 {"IA1IRQ6", 0x0B26, 12, 0x000},
540 {"IA1IRQ7", 0x0B27, 12, 0x000},
541 {"IA1IRQ8", 0x0B28, 12, 0x000},
542 {"IA1IRQ9", 0x0B29, 12, 0x000},
543 {"IA1IRQA", 0x0B2A, 12, 0x000},
544 {"IA1IRQB", 0x0B2B, 12, 0x000},
545 {"IA1IRQC", 0x0B2C, 12, 0x000},
546 {"IRQSW1", 0x0B2D, 13, 0x1FFF},
547 {"IRQHW1", 0x0B2E, 13, 0x0000},
548 {"IRQHL1", 0x0B2F, 13, 0x0000},
549 // IVT of CPU2
550 {"IA2IRQ0", 0x0B40, 12, 0x000},
551 {"IA2IRQ1", 0x0B41, 12, 0x000},
552 {"IA2IRQ2", 0x0B42, 12, 0x000},
553 {"IA2IRQ3", 0x0B43, 12, 0x000},
554 {"IA2IRQ4", 0x0B44, 12, 0x000},
555 {"IA2IRQ5", 0x0B45, 12, 0x000},
556 {"IA2IRQ6", 0x0B46, 12, 0x000},
557 {"IA2IRQ7", 0x0B47, 12, 0x000},
558 {"IA2IRQ8", 0x0B48, 12, 0x000},
559 {"IA2IRQ9", 0x0B49, 12, 0x000},
560 {"IA2IRQA", 0x0B4A, 12, 0x000},
561 {"IA2IRQB", 0x0B4B, 12, 0x000},
562 {"IA2IRQC", 0x0B4C, 12, 0x000},
563 {"IRQSW2", 0x0B4D, 13, 0x1FFF},
564 {"IRQHW2", 0x0B4E, 13, 0x0000},
565 {"IRQHL2", 0x0B4F, 13, 0x0000},
566 // IVT of CPU3
567 {"IA3IRQ0", 0x0B60, 12, 0x000},
568 {"IA3IRQ1", 0x0B61, 12, 0x000},
569 {"IA3IRQ2", 0x0B62, 12, 0x000},
570 {"IA3IRQ3", 0x0B63, 12, 0x000},
571 {"IA3IRQ4", 0x0B64, 12, 0x000},
572 {"IA3IRQ5", 0x0B65, 12, 0x000},
573 {"IA3IRQ6", 0x0B66, 12, 0x000},
574 {"IA3IRQ7", 0x0B67, 12, 0x000},
575 {"IA3IRQ8", 0x0B68, 12, 0x000},
576 {"IA3IRQ9", 0x0B69, 12, 0x000},
577 {"IA3IRQA", 0x0B6A, 12, 0x000},
578 {"IA3IRQB", 0x0B6B, 12, 0x000},
579 {"IA3IRQC", 0x0B6C, 12, 0x000},
580 {"IRQSW3", 0x0B6D, 13, 0x1FFF},
581 {"IRQHW3", 0x0B6E, 13, 0x0000},
582 {"IRQHL3", 0x0B6F, 13, 0x0000},
583 // Global Counter/Timer
584 {"CTGDINI", 0x0B80, 32, 0x00000000},
585 {"CTGCTRL", 0x0B81, 12, 0xE3F},
586 // CPU constants
587 {"C08CPU0", 0x0C00, 32, 0x00000000},
588 {"C09CPU0", 0x0C01, 32, 0x00000000},
589 {"C10CPU0", 0x0C02, 32, 0x00000000},
590 {"C11CPU0", 0x0C03, 32, 0x00000000},
591 {"C12CPUA", 0x0C04, 32, 0x00000000},
592 {"C13CPUA", 0x0C05, 32, 0x00000000},
593 {"C14CPUA", 0x0C06, 32, 0x00000000},
594 {"C15CPUA", 0x0C07, 32, 0x00000000},
595 {"C08CPU1", 0x0C08, 32, 0x00000000},
596 {"C09CPU1", 0x0C09, 32, 0x00000000},
597 {"C10CPU1", 0x0C0A, 32, 0x00000000},
598 {"C11CPU1", 0x0C0B, 32, 0x00000000},
599 {"C08CPU2", 0x0C10, 32, 0x00000000},
600 {"C09CPU2", 0x0C11, 32, 0x00000000},
601 {"C10CPU2", 0x0C12, 32, 0x00000000},
602 {"C11CPU2", 0x0C13, 32, 0x00000000},
603 {"C08CPU3", 0x0C18, 32, 0x00000000},
604 {"C09CPU3", 0x0C19, 32, 0x00000000},
605 {"C10CPU3", 0x0C1A, 32, 0x00000000},
606 {"C11CPU3", 0x0C1B, 32, 0x00000000},
607 // NI interface
608 {"NMOD", 0x0D40, 6, 0x08},
609 {"NDLY", 0x0D41, 30, 0x24924924},
610 {"NED", 0x0D42, 16, 0xA240},
611 {"NTRO", 0x0D43, 18, 0x3FFFC},
612 {"NRRO", 0x0D44, 18, 0x3FFFC},
613
614 {"NES", 0x0D45, 32, 0x00000000},
615 {"NTP", 0x0D46, 32, 0x0000FFFF},
616 {"NBND", 0x0D47, 16, 0x6020},
617 {"NP0", 0x0D48, 11, 0x44C},
618 {"NP1", 0x0D49, 11, 0x44C},
619 {"NP2", 0x0D4A, 11, 0x44C},
620 {"NP3", 0x0D4B, 11, 0x44C},
621 {"NCUT", 0x0D4C, 32, 0xFFFFFFFF},
622 // Filter and Preprocessor
623 {"TPPT0", 0x3000, 7, 0x01},
624 {"TPFS", 0x3001, 7, 0x05},
625 {"TPFE", 0x3002, 7, 0x14},
626 {"TPPGR", 0x3003, 7, 0x15},
627 {"TPPAE", 0x3004, 7, 0x1E},
628 {"TPQS0", 0x3005, 7, 0x00},
629 {"TPQE0", 0x3006, 7, 0x0A},
630 {"TPQS1", 0x3007, 7, 0x0B},
631 {"TPQE1", 0x3008, 7, 0x14},
632 {"EBD", 0x3009, 3, 0x0},
633 {"EBAQA", 0x300A, 7, 0x00},
634 {"EBSIA", 0x300B, 7, 0x20},
635 {"EBSF", 0x300C, 1, 0x1},
636 {"EBSIM", 0x300D, 1, 0x1},
637 {"EBPP", 0x300E, 1, 0x1},
638 {"EBPC", 0x300F, 1, 0x1},
639
640 {"EBIS", 0x3014, 10, 0x005},
641 {"EBIT", 0x3015, 12, 0x028},
642 {"EBIL", 0x3016, 8, 0xF0},
643 {"EBIN", 0x3017, 1, 0x1},
644 {"FLBY", 0x3018, 1, 0x0},
645 {"FPBY", 0x3019, 1, 0x0},
646 {"FGBY", 0x301A, 1, 0x0},
647 {"FTBY", 0x301B, 1, 0x0},
648 {"FCBY", 0x301C, 1, 0x0},
649 {"FPTC", 0x3020, 2, 0x3},
650 {"FPNP", 0x3021, 9, 0x078},
651 {"FPCL", 0x3022, 1, 0x1},
652 {"FGTA", 0x3028, 12, 0x014},
653 {"FGTB", 0x3029, 12, 0x80C},
654 {"FGCL", 0x302A, 1, 0x1},
655 {"FTAL", 0x3030, 10, 0x0F6},
656 {"FTLL", 0x3031, 9, 0x11D},
657 {"FTLS", 0x3032, 9, 0x0D3},
658 {"FCW1", 0x3038, 8, 0x1E},
659 {"FCW2", 0x3039, 8, 0xD4},
660 {"FCW3", 0x303A, 8, 0xE6},
661 {"FCW4", 0x303B, 8, 0x4A},
662 {"FCW5", 0x303C, 8, 0xEF},
663 {"TPFP", 0x3040, 9, 0x037},
664 {"TPHT", 0x3041, 14, 0x00A0},
665
666 {"TPVT", 0x3042, 6, 0x00},
667 {"TPVBY", 0x3043, 1, 0x0},
668 {"TPCT", 0x3044, 5, 0x08},
669 {"TPCL", 0x3045, 5, 0x01},
670 {"TPCBY", 0x3046, 1, 0x1},
671 {"TPD", 0x3047, 4, 0xF},
672 {"TPCI0", 0x3048, 5, 0x00},
673 {"TPCI1", 0x3049, 5, 0x00},
674 {"TPCI2", 0x304A, 5, 0x00},
675 {"TPCI3", 0x304B, 5, 0x00},
676
677 {"ADCMSK", 0x3050, 21, 0x1FFFFF},
678 {"ADCINB", 0x3051, 2, 0x2},
679 {"ADCDAC", 0x3052, 5, 0x10},
680 {"ADCPAR", 0x3053, 18, 0x195EF},
681 {"ADCTST", 0x3054, 2, 0x0},
682 {"SADCAZ", 0x3055, 1, 0x1},
683
684 {"FGF0", 0x3080, 9, 0x000},
685 {"FGF1", 0x3081, 9, 0x000},
686 {"FGF2", 0x3082, 9, 0x000},
687 {"FGF3", 0x3083, 9, 0x000},
688 {"FGF4", 0x3084, 9, 0x000},
689 {"FGF5", 0x3085, 9, 0x000},
690 {"FGF6", 0x3086, 9, 0x000},
691 {"FGF7", 0x3087, 9, 0x000},
692 {"FGF8", 0x3088, 9, 0x000},
693 {"FGF9", 0x3089, 9, 0x000},
694 {"FGF10", 0x308A, 9, 0x000},
695 {"FGF11", 0x308B, 9, 0x000},
696 {"FGF12", 0x308C, 9, 0x000},
697 {"FGF13", 0x308D, 9, 0x000},
698 {"FGF14", 0x308E, 9, 0x000},
699 {"FGF15", 0x308F, 9, 0x000},
700 {"FGF16", 0x3090, 9, 0x000},
701 {"FGF17", 0x3091, 9, 0x000},
702 {"FGF18", 0x3092, 9, 0x000},
703 {"FGF19", 0x3093, 9, 0x000},
704 {"FGF20", 0x3094, 9, 0x000},
705
706 {"FGA0", 0x30A0, 6, 0x00},
707 {"FGA1", 0x30A1, 6, 0x00},
708 {"FGA2", 0x30A2, 6, 0x00},
709 {"FGA3", 0x30A3, 6, 0x00},
710 {"FGA4", 0x30A4, 6, 0x00},
711 {"FGA5", 0x30A5, 6, 0x00},
712 {"FGA6", 0x30A6, 6, 0x00},
713 {"FGA7", 0x30A7, 6, 0x00},
714 {"FGA8", 0x30A8, 6, 0x00},
715 {"FGA9", 0x30A9, 6, 0x00},
716 {"FGA10", 0x30AA, 6, 0x00},
717 {"FGA11", 0x30AB, 6, 0x00},
718 {"FGA12", 0x30AC, 6, 0x00},
719 {"FGA13", 0x30AD, 6, 0x00},
720 {"FGA14", 0x30AE, 6, 0x00},
721 {"FGA15", 0x30AF, 6, 0x00},
722 {"FGA16", 0x30B0, 6, 0x00},
723 {"FGA17", 0x30B1, 6, 0x00},
724 {"FGA18", 0x30B2, 6, 0x00},
725 {"FGA19", 0x30B3, 6, 0x00},
726 {"FGA20", 0x30B4, 6, 0x00},
727 // non-linearity table, 64 x 6 bits
728 {"FLL00", 0x3100, 6, 0x00},
729 {"FLL01", 0x3101, 6, 0x00},
730 {"FLL02", 0x3102, 6, 0x00},
731 {"FLL03", 0x3103, 6, 0x00},
732 {"FLL04", 0x3104, 6, 0x00},
733 {"FLL05", 0x3105, 6, 0x00},
734 {"FLL06", 0x3106, 6, 0x00},
735 {"FLL07", 0x3107, 6, 0x00},
736 {"FLL08", 0x3108, 6, 0x00},
737 {"FLL09", 0x3109, 6, 0x00},
738 {"FLL0A", 0x310A, 6, 0x00},
739 {"FLL0B", 0x310B, 6, 0x00},
740 {"FLL0C", 0x310C, 6, 0x00},
741 {"FLL0D", 0x310D, 6, 0x00},
742 {"FLL0E", 0x310E, 6, 0x00},
743 {"FLL0F", 0x310F, 6, 0x00},
744 {"FLL10", 0x3110, 6, 0x00},
745 {"FLL11", 0x3111, 6, 0x00},
746 {"FLL12", 0x3112, 6, 0x00},
747 {"FLL13", 0x3113, 6, 0x00},
748 {"FLL14", 0x3114, 6, 0x00},
749 {"FLL15", 0x3115, 6, 0x00},
750 {"FLL16", 0x3116, 6, 0x00},
751 {"FLL17", 0x3117, 6, 0x00},
752 {"FLL18", 0x3118, 6, 0x00},
753 {"FLL19", 0x3119, 6, 0x00},
754 {"FLL1A", 0x311A, 6, 0x00},
755 {"FLL1B", 0x311B, 6, 0x00},
756 {"FLL1C", 0x311C, 6, 0x00},
757 {"FLL1D", 0x311D, 6, 0x00},
758 {"FLL1E", 0x311E, 6, 0x00},
759 {"FLL1F", 0x311F, 6, 0x00},
760 {"FLL20", 0x3120, 6, 0x00},
761 {"FLL21", 0x3121, 6, 0x00},
762 {"FLL22", 0x3122, 6, 0x00},
763 {"FLL23", 0x3123, 6, 0x00},
764 {"FLL24", 0x3124, 6, 0x00},
765 {"FLL25", 0x3125, 6, 0x00},
766 {"FLL26", 0x3126, 6, 0x00},
767 {"FLL27", 0x3127, 6, 0x00},
768 {"FLL28", 0x3128, 6, 0x00},
769 {"FLL29", 0x3129, 6, 0x00},
770 {"FLL2A", 0x312A, 6, 0x00},
771 {"FLL2B", 0x312B, 6, 0x00},
772 {"FLL2C", 0x312C, 6, 0x00},
773 {"FLL2D", 0x312D, 6, 0x00},
774 {"FLL2E", 0x312E, 6, 0x00},
775 {"FLL2F", 0x312F, 6, 0x00},
776 {"FLL30", 0x3130, 6, 0x00},
777 {"FLL31", 0x3131, 6, 0x00},
778 {"FLL32", 0x3132, 6, 0x00},
779 {"FLL33", 0x3133, 6, 0x00},
780 {"FLL34", 0x3134, 6, 0x00},
781 {"FLL35", 0x3135, 6, 0x00},
782 {"FLL36", 0x3136, 6, 0x00},
783 {"FLL37", 0x3137, 6, 0x00},
784 {"FLL38", 0x3138, 6, 0x00},
785 {"FLL39", 0x3139, 6, 0x00},
786 {"FLL3A", 0x313A, 6, 0x00},
787 {"FLL3B", 0x313B, 6, 0x00},
788 {"FLL3C", 0x313C, 6, 0x00},
789 {"FLL3D", 0x313D, 6, 0x00},
790 {"FLL3E", 0x313E, 6, 0x00},
791 {"FLL3F", 0x313F, 6, 0x00},
792 // end of non-lin table
793 {"PASADEL", 0x3158, 8, 0xFF},
794 {"PASAPHA", 0x3159, 6, 0x3F},
795 {"PASAPRA", 0x315A, 6, 0x0F},
796 {"PASADAC", 0x315B, 8, 0x80},
797 {"PASACHM", 0x315C, 19, 0x7FFFF},
798 {"PASASTL", 0x315D, 8, 0xFF},
799 {"PASAPR1", 0x315E, 1, 0x0},
800 {"PASAPR0", 0x315F, 1, 0x0},
801 {"SADCTRG", 0x3161, 1, 0x0},
802 {"SADCRUN", 0x3162, 1, 0x0},
803 {"SADCPWR", 0x3163, 3, 0x7},
804 {"L0TSIM", 0x3165, 14, 0x0050},
805 {"SADCEC", 0x3166, 7, 0x00},
806 {"SADCMC", 0x3170, 8, 0xC0},
807 {"SADCOC", 0x3171, 8, 0x19},
808 {"SADCGTB", 0x3172, 32, 0x37737700},
809 {"SEBDEN", 0x3178, 3, 0x0},
810 {"SEBDOU", 0x3179, 3, 0x0},
811 // pos table, 128 x 5 bits
812 {"TPL00", 0x3180, 5, 0x00},
813 {"TPL01", 0x3181, 5, 0x00},
814 {"TPL02", 0x3182, 5, 0x00},
815 {"TPL03", 0x3183, 5, 0x00},
816 {"TPL04", 0x3184, 5, 0x00},
817 {"TPL05", 0x3185, 5, 0x00},
818 {"TPL06", 0x3186, 5, 0x00},
819 {"TPL07", 0x3187, 5, 0x00},
820 {"TPL08", 0x3188, 5, 0x00},
821 {"TPL09", 0x3189, 5, 0x00},
822 {"TPL0A", 0x318A, 5, 0x00},
823 {"TPL0B", 0x318B, 5, 0x00},
824 {"TPL0C", 0x318C, 5, 0x00},
825 {"TPL0D", 0x318D, 5, 0x00},
826 {"TPL0E", 0x318E, 5, 0x00},
827 {"TPL0F", 0x318F, 5, 0x00},
828 {"TPL10", 0x3190, 5, 0x00},
829 {"TPL11", 0x3191, 5, 0x00},
830 {"TPL12", 0x3192, 5, 0x00},
831 {"TPL13", 0x3193, 5, 0x00},
832 {"TPL14", 0x3194, 5, 0x00},
833 {"TPL15", 0x3195, 5, 0x00},
834 {"TPL16", 0x3196, 5, 0x00},
835 {"TPL17", 0x3197, 5, 0x00},
836 {"TPL18", 0x3198, 5, 0x00},
837 {"TPL19", 0x3199, 5, 0x00},
838 {"TPL1A", 0x319A, 5, 0x00},
839 {"TPL1B", 0x319B, 5, 0x00},
840 {"TPL1C", 0x319C, 5, 0x00},
841 {"TPL1D", 0x319D, 5, 0x00},
842 {"TPL1E", 0x319E, 5, 0x00},
843 {"TPL1F", 0x319F, 5, 0x00},
844 {"TPL20", 0x31A0, 5, 0x00},
845 {"TPL21", 0x31A1, 5, 0x00},
846 {"TPL22", 0x31A2, 5, 0x00},
847 {"TPL23", 0x31A3, 5, 0x00},
848 {"TPL24", 0x31A4, 5, 0x00},
849 {"TPL25", 0x31A5, 5, 0x00},
850 {"TPL26", 0x31A6, 5, 0x00},
851 {"TPL27", 0x31A7, 5, 0x00},
852 {"TPL28", 0x31A8, 5, 0x00},
853 {"TPL29", 0x31A9, 5, 0x00},
854 {"TPL2A", 0x31AA, 5, 0x00},
855 {"TPL2B", 0x31AB, 5, 0x00},
856 {"TPL2C", 0x31AC, 5, 0x00},
857 {"TPL2D", 0x31AD, 5, 0x00},
858 {"TPL2E", 0x31AE, 5, 0x00},
859 {"TPL2F", 0x31AF, 5, 0x00},
860 {"TPL30", 0x31B0, 5, 0x00},
861 {"TPL31", 0x31B1, 5, 0x00},
862 {"TPL32", 0x31B2, 5, 0x00},
863 {"TPL33", 0x31B3, 5, 0x00},
864 {"TPL34", 0x31B4, 5, 0x00},
865 {"TPL35", 0x31B5, 5, 0x00},
866 {"TPL36", 0x31B6, 5, 0x00},
867 {"TPL37", 0x31B7, 5, 0x00},
868 {"TPL38", 0x31B8, 5, 0x00},
869 {"TPL39", 0x31B9, 5, 0x00},
870 {"TPL3A", 0x31BA, 5, 0x00},
871 {"TPL3B", 0x31BB, 5, 0x00},
872 {"TPL3C", 0x31BC, 5, 0x00},
873 {"TPL3D", 0x31BD, 5, 0x00},
874 {"TPL3E", 0x31BE, 5, 0x00},
875 {"TPL3F", 0x31BF, 5, 0x00},
876 {"TPL40", 0x31C0, 5, 0x00},
877 {"TPL41", 0x31C1, 5, 0x00},
878 {"TPL42", 0x31C2, 5, 0x00},
879 {"TPL43", 0x31C3, 5, 0x00},
880 {"TPL44", 0x31C4, 5, 0x00},
881 {"TPL45", 0x31C5, 5, 0x00},
882 {"TPL46", 0x31C6, 5, 0x00},
883 {"TPL47", 0x31C7, 5, 0x00},
884 {"TPL48", 0x31C8, 5, 0x00},
885 {"TPL49", 0x31C9, 5, 0x00},
886 {"TPL4A", 0x31CA, 5, 0x00},
887 {"TPL4B", 0x31CB, 5, 0x00},
888 {"TPL4C", 0x31CC, 5, 0x00},
889 {"TPL4D", 0x31CD, 5, 0x00},
890 {"TPL4E", 0x31CE, 5, 0x00},
891 {"TPL4F", 0x31CF, 5, 0x00},
892 {"TPL50", 0x31D0, 5, 0x00},
893 {"TPL51", 0x31D1, 5, 0x00},
894 {"TPL52", 0x31D2, 5, 0x00},
895 {"TPL53", 0x31D3, 5, 0x00},
896 {"TPL54", 0x31D4, 5, 0x00},
897 {"TPL55", 0x31D5, 5, 0x00},
898 {"TPL56", 0x31D6, 5, 0x00},
899 {"TPL57", 0x31D7, 5, 0x00},
900 {"TPL58", 0x31D8, 5, 0x00},
901 {"TPL59", 0x31D9, 5, 0x00},
902 {"TPL5A", 0x31DA, 5, 0x00},
903 {"TPL5B", 0x31DB, 5, 0x00},
904 {"TPL5C", 0x31DC, 5, 0x00},
905 {"TPL5D", 0x31DD, 5, 0x00},
906 {"TPL5E", 0x31DE, 5, 0x00},
907 {"TPL5F", 0x31DF, 5, 0x00},
908 {"TPL60", 0x31E0, 5, 0x00},
909 {"TPL61", 0x31E1, 5, 0x00},
910 {"TPL62", 0x31E2, 5, 0x00},
911 {"TPL63", 0x31E3, 5, 0x00},
912 {"TPL64", 0x31E4, 5, 0x00},
913 {"TPL65", 0x31E5, 5, 0x00},
914 {"TPL66", 0x31E6, 5, 0x00},
915 {"TPL67", 0x31E7, 5, 0x00},
916 {"TPL68", 0x31E8, 5, 0x00},
917 {"TPL69", 0x31E9, 5, 0x00},
918 {"TPL6A", 0x31EA, 5, 0x00},
919 {"TPL6B", 0x31EB, 5, 0x00},
920 {"TPL6C", 0x31EC, 5, 0x00},
921 {"TPL6D", 0x31ED, 5, 0x00},
922 {"TPL6E", 0x31EE, 5, 0x00},
923 {"TPL6F", 0x31EF, 5, 0x00},
924 {"TPL70", 0x31F0, 5, 0x00},
925 {"TPL71", 0x31F1, 5, 0x00},
926 {"TPL72", 0x31F2, 5, 0x00},
927 {"TPL73", 0x31F3, 5, 0x00},
928 {"TPL74", 0x31F4, 5, 0x00},
929 {"TPL75", 0x31F5, 5, 0x00},
930 {"TPL76", 0x31F6, 5, 0x00},
931 {"TPL77", 0x31F7, 5, 0x00},
932 {"TPL78", 0x31F8, 5, 0x00},
933 {"TPL79", 0x31F9, 5, 0x00},
934 {"TPL7A", 0x31FA, 5, 0x00},
935 {"TPL7B", 0x31FB, 5, 0x00},
936 {"TPL7C", 0x31FC, 5, 0x00},
937 {"TPL7D", 0x31FD, 5, 0x00},
938 {"TPL7E", 0x31FE, 5, 0x00},
939 {"TPL7F", 0x31FF, 5, 0x00},
940 // end of pos table
941 {"MEMRW", 0xD000, 7, 0x79},
942 {"MEMCOR", 0xD001, 9, 0x000},
943 {"DMDELA", 0xD002, 4, 0x8},
944 {"DMDELS", 0xD003, 4, 0x8}
945 };
946
947 const CmdRegs cmdReg[N_CMD] = {
948 // Name Address
949 {"SMCMD" , 0x0A04},
950 {"SMOFFON" , 0x0A05},
951 {"SMON" , 0x0A06},
952 {"SMOFF" , 0x0A07},
953 {"CPU0SS" , 0x0A21},
954 {"CPU1SS" , 0x0A23},
955 {"CPU2SS" , 0x0A25},
956 {"CPU3SS" , 0x0A27},
957 {"NICLKSS" , 0x0A29},
958 {"FILCLKSS", 0x0A2B},
959 {"PRECLKSS", 0x0A2D},
960 {"ADCENSS" , 0x0A2F},
961 {"NIODESS" , 0x0A31},
962 {"NIOCESS" , 0x0A33},
963 {"NIIDESS" , 0x0A35},
964 {"NIICESS" , 0x0A37}
965 };
966
967 const CmdRegs roReg[N_RO] = {
968 // NI
969 {"NCTRL" , 0x0DC0},
970 {"NFE" , 0x0DC1},
971 {"NFSM" , 0x0DC2},
972 // event buffer parity violation counters
973 {"EBP0" , 0x3010},
974 {"EBP1" , 0x3011},
975 {"EBP2" , 0x3012},
976 {"EBP3" , 0x3013},
977 // slow ADC
978 {"SADCC0" , 0x3168},
979 {"SADCC1" , 0x3169},
980 {"SADCC2" , 0x316A},
981 {"SADCC3" , 0x316B},
982 {"SADCC4" , 0x316C},
983 {"SADCC5" , 0x316D},
984 {"SADCC6" , 0x316E},
985 {"SADCC7" , 0x316F},
986 // hamming counters
987 {"HCNTI0" , 0xD010},
988 {"HCNTI1" , 0xD011},
989 {"HCNTI2" , 0xD012},
990 {"HCNTI3" , 0xD013},
991 {"HCNTD0" , 0xD014},
992 {"HCNTD1" , 0xD015},
993 {"HCNTD2" , 0xD016},
994 {"HCNTD3" , 0xD017},
995
996 {"CHIPID" , 0x3160},
997
998 {"SEBDIN" , 0x317A}
999 };
1000
1001
1002 for (Int_t i = 0; i < N_REGS; i++) {
1003 fTrapReg[i] = trapReg[i];
1004 }
1005 for (Int_t i = 0; i < N_CMD; i++) {
1006 fCmdReg[i] = cmdReg[i];
1007 }
1008 for (Int_t i = 0; i < N_RO; i++) {
1009 fRoReg[i] = roReg[i];
1010 }
1011
1012 return kTRUE;
1013}