1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 #include "AliITSDDLModuleMapSDD.h"
8 // Macro to extract and print the configuration parameters of SDD modules
9 // from JTAG hexadecimal files
10 // Origin: F. Prino, prino@to.infn.it
12 void DecodeJTAG(Int_t nDDL, Int_t nCarlos=0, TString type="PHY"){
14 AliITSDDLModuleMapSDD* dmap=new AliITSDDLModuleMapSDD();
17 if(nDDL>=0 && nDDL<23){
18 theMod=dmap->GetModuleNumber(nDDL,nCarlos);
19 }else if(nDDL>=240 && nDDL<500){
21 dmap->FindInDDLMap(theMod,nDDL,nCarlos);
23 printf("ERROR: wronng DDL/Module number %d\n",nDDL);
27 if(nDDL<8) crate="TOP";
28 else if(nDDL<16) crate="MED";
29 else if(nDDL<24) crate="BOT";
31 Int_t numSlot=nDDL%8+1;
40 TString filnam=Form("%s%d/%s_jtag_carlos%02d%02d.txt",crate.Data(),numSlot,
41 type.Data(),car1,car2);
42 gSystem->Exec(Form("ls -l %s\n",filnam.Data()));
43 FILE* fil=fopen(filnam.Data(),"r");
47 retcode=fscanf(fil,"%x\n",&word);
48 Int_t modNum=word&0x0000000F;
49 for(Int_t iMod=0; iMod<2; iMod++){
50 retcode=fscanf(fil,"%x\n",&word);
51 if(iMod==0 && word!=0xFFFFFF00){printf("ERROR - mod 0\n"); return;}
52 if(iMod==1 && word!=0xFFFFFF11){printf("ERROR - mod 1\n"); return;}
53 retcode=fscanf(fil,"%x\n",&word); // CarlosRX word
55 Int_t maskMod=(word&0x000FFF00)>>8;
56 printf("Active modules: ");
57 for(Int_t i=0;i<12;i++){
58 if(maskMod&(1<<i)) printf(" 1 ");
64 Bool_t doPrint=kFALSE;
65 if(modNum+iMod==nCarlos)doPrint=kTRUE;
66 if(doPrint) printf("*********** Module %d DDL %d (%s%d) Carlos %d **********\n",theMod,nDDL,crate.Data(),numSlot,modNum+iMod);
67 retcode=fscanf(fil,"%x\n",&word);
68 retcode=fscanf(fil,"%x\n",&word);
69 Int_t th1=(word&0xFF000000)>>24;
70 Int_t th0=(word&0x00FF0000)>>16;
71 Int_t tl1=(word&0x0000FF00)>>8;
72 Int_t tl0=(word&0x000000FF);
73 if(doPrint) printf("High Thresholds = %d %d\n",th1,th0);
74 if(doPrint) printf("Low Thresholds = %d %d\n",tl1,tl0);
75 retcode=fscanf(fil,"%x\n",&word);
76 retcode=fscanf(fil,"%x\n",&word);
77 for(Int_t iSide=0; iSide<2; iSide++){
78 if(doPrint) printf("------------------ Hybrid %d -------------\n",iSide);
80 for(Int_t iAmbra=0; iAmbra<4; iAmbra++){
81 for(Int_t iw=0;iw<5;iw++){
82 retcode=fscanf(fil,"%x\n",&word);
83 if(doPrint && iw==1) {
84 printf("AMBRA %d --- SOP %d",iAmbra,word&0x000000FF);
88 if(doPrint) printf(" --- Baselines present");
89 for(Int_t iwb=0;iwb<16;iwb++) retcode=fscanf(fil,"%x\n",&word);
91 if(doPrint) printf(" --- No baseline equalization");
93 if(doPrint) printf("\n");
96 for(Int_t iPascal=0; iPascal<4; iPascal++){
97 for(Int_t iw=0;iw<4;iw++){
98 retcode=fscanf(fil,"%x\n",&word);
100 printf("PASCAL %d ",iPascal);
101 if(word&0xFF000000) printf(" --- ADC full");
102 else printf(" --- ADC 1/2");
103 if(word&0x00FF0000) printf(" --- AM full");
104 else printf(" --- AM 1/2");