00001
00002
00003
00004 #include <iostream>
00005
00006 #include "CalibFormats/SiPixelObjects/interface/PixelFEDCard.h"
00007 #include "CalibFormats/SiPixelObjects/interface/PixelTimeFormatter.h"
00008
00009 #include <cassert>
00010 #include <sstream>
00011 #include <map>
00012
00013 using namespace std;
00014
00015 using namespace pos;
00016
00017
00018 PixelFEDCard::PixelFEDCard():
00019 PixelConfigBase(" "," "," "){}
00020
00021
00022
00023 PixelFEDCard::PixelFEDCard(vector<vector<string> > &tableMat):PixelConfigBase(" "," "," ")
00024 {
00025 vector<string> ins = tableMat[0];
00026 map<string , int > colM;
00027 vector<string> colNames;
00028 bool first = true ;
00096 colNames.push_back("CONFIG_KEY_ID" );
00097 colNames.push_back("CONFIG_KEY" );
00098 colNames.push_back("FED_CHAN_VERS" );
00099 colNames.push_back("FED_CONFIG_VERS" );
00100 colNames.push_back("SERIAL_NUMBER" );
00101 colNames.push_back("PIXEL_FED" );
00102 colNames.push_back("CRATE_NUMBER" );
00103 colNames.push_back("SLOT_NUMBER" );
00104 colNames.push_back("VME_ADDRS_HEX" );
00105 colNames.push_back("CHANNEL_ID" );
00106 colNames.push_back("NUM_ROCS" );
00107 colNames.push_back("CHAN_OFFST_DAC" );
00108 colNames.push_back("CHAN_DELAY" );
00109 colNames.push_back("CHAN_BHIGH" );
00110 colNames.push_back("CHAN_BLOW" );
00111 colNames.push_back("CHAN_UB" );
00112 colNames.push_back("OPT1_CAP" );
00113 colNames.push_back("OPT2_CAP" );
00114 colNames.push_back("OPT3_CAP" );
00115 colNames.push_back("OPT1_INP" );
00116 colNames.push_back("OPT2_INP" );
00117 colNames.push_back("OPT3_INP" );
00118 colNames.push_back("OPT1_OUT" );
00119 colNames.push_back("OPT2_OUT" );
00120 colNames.push_back("OPT3_OUT" );
00121 colNames.push_back("NORTH_CLKPHB" );
00122 colNames.push_back("NORTHCENTER_CLKPHB" );
00123 colNames.push_back("SOUTHCENTER_CLKPHB" );
00124 colNames.push_back("SOUTH_CLKPHB" );
00125 colNames.push_back("NORTH_CTRL" );
00126 colNames.push_back("NORTHCENTER_CTRL" );
00127 colNames.push_back("SOUTHCENTER_CTRL" );
00128 colNames.push_back("SOUTH_CTRL" );
00129 colNames.push_back("REG1_TTCRX_FDLA" );
00130 colNames.push_back("REG2_TTCRX_CDLA" );
00131 colNames.push_back("REG3_TTCRX_CLKD2" );
00132 colNames.push_back("CENTER_CTRL" );
00133 colNames.push_back("CENTER_MODE" );
00134 colNames.push_back("B1_ADCGN" );
00135 colNames.push_back("B2_ADCGN" );
00136 colNames.push_back("B3_ADCGN" );
00137 colNames.push_back("B4_ADCGN" );
00138 colNames.push_back("NORTH_BADJ" );
00139 colNames.push_back("NORTHCENTER_BADJ" );
00140 colNames.push_back("SOUTHCENTER_BADJ" );
00141 colNames.push_back("SOUTH_BADJ" );
00142 colNames.push_back("NORTH_TBMMASK" );
00143 colNames.push_back("NORTHCENTER_TBMMASK" );
00144 colNames.push_back("SOUTHCENTER_TBMMASK" );
00145 colNames.push_back("SOUTH_TBMMASK" );
00146 colNames.push_back("NORTH_PWORD" );
00147 colNames.push_back("NORTHCENTER_PWORD" );
00148 colNames.push_back("SOUTH_PWORD" );
00149 colNames.push_back("SOUTHCENTER_PWORD" );
00150 colNames.push_back("SPECDAC" );
00151 colNames.push_back("OOS_LVL" );
00152 colNames.push_back("ERR_LVL" );
00153 colNames.push_back("NORTH_FIFO1_BZ_LVL" );
00154 colNames.push_back("NORTHCENTER_FIFO1_BZ_LVL" );
00155 colNames.push_back("SOUTHCENTER_FIFO1_BZ_LVL" );
00156 colNames.push_back("SOUTH_FIFO1_BZ_LVL" );
00157
00158 for(unsigned int c = 0 ; c < ins.size() ; c++)
00159 {
00160 for(unsigned int n=0; n<colNames.size(); n++)
00161 {
00162 if(tableMat[0][c] == colNames[n]){
00163 colM[colNames[n]] = c;
00164 break;
00165 }
00166 }
00167 }
00168 for(unsigned int n=0; n<colNames.size(); n++)
00169 {
00170 if(colM.find(colNames[n]) == colM.end())
00171 {
00172 std::cerr << "[PixelTBMSettings::PixelTBMSettings()]\tCouldn't find in the database the column with name " << colNames[n] << std::endl;
00173 assert(0);
00174 }
00175 }
00176
00177 int size[3] ;
00178 int indexsize = 0 ;
00179 for(unsigned int r = 0 ; r < tableMat.size() ; r++){
00180 if(tableMat[r].size() == 0)
00181 {
00182 cout << "__________________ NEW TABLE __________________"<< endl ;
00183 size[indexsize] = r ;
00184 cout << "size[" << indexsize << "] = " << size[indexsize] << endl ;
00185 indexsize++ ;
00186 continue ;
00187 }
00188 for(vector<string>::iterator it = tableMat[r].begin() ; it != tableMat[r].end() ; it++)
00189 {
00190
00191 cout << *it <<"\t" ;
00192 }
00193 cout << endl ;
00194 }
00195
00196
00197 if(first)
00198 {
00199 first = false ;
00200
00201 string fakeHex = "0x" + tableMat[1][colM["VME_ADDRS_HEX"]] ;
00202
00203 sscanf(fakeHex.c_str(),"%lx",&FEDBASE_0);
00204 sscanf(tableMat[1][colM["PIXEL_FED"]].c_str(), "PxlFED_%ld",&fedNumber);
00205
00206 opt_cap[0] = atoi(tableMat[1][colM["OPT1_CAP"]].c_str()) ;
00207 opt_cap[1] = atoi(tableMat[1][colM["OPT2_CAP"]].c_str()) ;
00208 opt_cap[2] = atoi(tableMat[1][colM["OPT3_CAP"]].c_str()) ;
00209 opt_inadj[0] = atoi(tableMat[1][colM["OPT1_INP"]].c_str()) ;
00210 opt_inadj[1] = atoi(tableMat[1][colM["OPT2_INP"]].c_str()) ;
00211 opt_inadj[2] = atoi(tableMat[1][colM["OPT3_INP"]].c_str()) ;
00212 opt_ouadj[0] = atoi(tableMat[1][colM["OPT1_OUT"]].c_str()) ;
00213 opt_ouadj[1] = atoi(tableMat[1][colM["OPT2_OUT"]].c_str()) ;
00214 opt_ouadj[2] = atoi(tableMat[1][colM["OPT3_OUT"]].c_str()) ;
00215
00216
00217 clkphs1_9 = atoi(tableMat[1][colM["NORTH_CLKPHB"]].c_str() ) ;
00218 clkphs10_18 = atoi(tableMat[1][colM["NORTHCENTER_CLKPHB"]].c_str() ) ;
00219 clkphs19_27 = atoi(tableMat[1][colM["SOUTHCENTER_CLKPHB"]].c_str() ) ;
00220 clkphs28_36 = atoi(tableMat[1][colM["SOUTH_CLKPHB"]].c_str() ) ;
00221
00222
00223 CoarseDel = atoi(tableMat[1][colM["REG2_TTCRX_CDLA"]].c_str() ) ;
00224 ClkDes2 = atoi(tableMat[1][colM["REG3_TTCRX_CLKD2"]].c_str() ) ;
00225 FineDes2Del = atoi(tableMat[1][colM["REG1_TTCRX_FDLA"]].c_str() ) ;
00226
00227 Ccntrl = atoi(tableMat[1][colM["CENTER_CTRL"]].c_str() ) ;
00228 modeRegister = atoi(tableMat[1][colM["CENTER_MODE"]].c_str() ) ;
00229
00230
00231 Nfifo1Bzlvl = atoi(tableMat[1][colM["NORTH_FIFO1_BZ_LVL"]].c_str() ) ;
00232 NCfifo1Bzlvl = atoi(tableMat[1][colM["NORTHCENTER_FIFO1_BZ_LVL"]].c_str() ) ;
00233 SCfifo1Bzlvl = atoi(tableMat[1][colM["SOUTHCENTER_FIFO1_BZ_LVL"]].c_str() ) ;
00234 Sfifo1Bzlvl = atoi(tableMat[1][colM["SOUTTH_FIFO1_BZ_LVL"]].c_str() ) ;
00235
00236
00237 N_TBMmask = atoi(tableMat[1][colM["NORTH_TBMMASK"]].c_str() ) ;
00238 NC_TBMmask = atoi(tableMat[1][colM["NORTHCENTER_TBMMASK"]].c_str() ) ;
00239 SC_TBMmask = atoi(tableMat[1][colM["SOUTHCENTER_TBMMASK"]].c_str() ) ;
00240 S_TBMmask = atoi(tableMat[1][colM["SOUTH_TBMMASK"]].c_str() ) ;
00241
00242
00243 N_Pword = atoi(tableMat[1][colM["NORTH_PWORD"]].c_str() ) ;
00244 NC_Pword = atoi(tableMat[1][colM["NORTHCENTER_PWORD"]].c_str() ) ;
00245 SC_Pword = atoi(tableMat[1][colM["SOUTHCENTER_PWORD"]].c_str() ) ;
00246 S_Pword = atoi(tableMat[1][colM["SOUTH_PWORD"]].c_str() ) ;
00247
00248 Nbaseln = atoi(tableMat[1][colM["NORTH_BADJ"]].c_str() ) ;
00249 NCbaseln = atoi(tableMat[1][colM["NORTHCENTER_BADJ"]].c_str() ) ;
00250 SCbaseln = atoi(tableMat[1][colM["SOUTHCENTER_BADJ"]].c_str() ) ;
00251 Sbaseln = atoi(tableMat[1][colM["SOUTH_BADJ"]].c_str() ) ;
00252
00253 Ncntrl = atoi(tableMat[1][colM["NORTH_CTRL"]].c_str() ) ;
00254 NCcntrl = atoi(tableMat[1][colM["NORTHCENTER_CTRL"]].c_str() ) ;
00255 SCcntrl = atoi(tableMat[1][colM["SOUTHCENTER_CTRL"]].c_str() ) ;
00256 Scntrl = atoi(tableMat[1][colM["SOUTH_CTRL"]].c_str() ) ;
00257
00258
00259
00260 SpecialDac = atoi(tableMat[1][colM["SPECDAC"]].c_str() ) ;
00261
00262
00263 Ooslvl = atoi(tableMat[1][colM["OOS_LVL"]].c_str() ) ;
00264
00265 Errlvl = atoi(tableMat[1][colM["ERR_LVL"]].c_str() ) ;
00266
00267
00268 Nadcg = atoi(tableMat[1][colM["B1_ADCGN"]].c_str() ) ;
00269 NCadcg = atoi(tableMat[1][colM["B2_ADCGN"]].c_str() ) ;
00270 SCadcg = atoi(tableMat[1][colM["B3_ADCGN"]].c_str() ) ;
00271 Sadcg = atoi(tableMat[1][colM["B4_ADCGN"]].c_str() ) ;
00272
00273 }
00274 for(int r = 1 ; r < size[0] ; r++)
00275 {
00276
00277 NRocs[atoi(tableMat[r][colM["CHANNEL_ID"]].c_str())-1] = atoi(tableMat[r][colM["NUM_ROCS"]].c_str() ) ;
00278
00279 offs_dac[atoi(tableMat[r][colM["CHANNEL_ID"]].c_str())-1] = atoi(tableMat[r][colM["CHAN_OFFST_DAC"]].c_str() ) ;
00280
00281 DelayCh[atoi(tableMat[r][colM["CHANNEL_ID"]].c_str())-1] = atoi(tableMat[r][colM["CHAN_DELAY"]].c_str() ) ;
00282
00283 BlackHi[atoi(tableMat[r][colM["CHANNEL_ID"]].c_str())-1] = atoi(tableMat[r][colM["CHAN_BHIGH"]].c_str() ) ;
00284 BlackLo[atoi(tableMat[r][colM["CHANNEL_ID"]].c_str())-1] = atoi(tableMat[r][colM["CHAN_BLOW"]].c_str() ) ;
00285 Ublack[atoi(tableMat[r][colM["CHANNEL_ID"]].c_str())-1] = atoi(tableMat[r][colM["CHAN_UB"]].c_str() ) ;
00286 }
00287 readDBTBMLevels(tableMat, size[0]+1, size[1]) ;
00288 readDBROCLevels(tableMat, size[1]+1, size[2]) ;
00289 }
00290
00291 void PixelFEDCard::readDBTBMLevels(std::vector<std::vector<std::string> > &tableMat, int firstRow, int lastRow)
00292 {
00293 string mthn = "[PixelFEDCard::readDBTBMLevels()] ";
00294 vector<string> ins = tableMat[firstRow];
00295 map<string , int > colM;
00296 vector<string> colNames;
00297
00323 colNames.push_back("CONFIG_KEY_ID" );
00324 colNames.push_back("CONFIG_KEY" );
00325 colNames.push_back("VERSION" );
00326 colNames.push_back("CONDITION_DATA_SET_ID" );
00327 colNames.push_back("KIND_OF_CONDITION_ID" );
00328 colNames.push_back("KIND_OF_COND" );
00329 colNames.push_back("PXLFED_NAME" );
00330 colNames.push_back("FED_CHAN" );
00331 colNames.push_back("TBM_PART_ID" );
00332 colNames.push_back("TBM_SER_NUM" );
00333 colNames.push_back("PANEL_NAME" );
00334 colNames.push_back("HUB_ADDRS" );
00335 colNames.push_back("TBMA_HEAD_L0" );
00336 colNames.push_back("TBMA_HEAD_L1" );
00337 colNames.push_back("TBMA_HEAD_L2" );
00338 colNames.push_back("TBMA_HEAD_L3" );
00339 colNames.push_back("TBMA_HEAD_L4" );
00340 colNames.push_back("TBMA_TRAIL_L0" );
00341 colNames.push_back("TBMA_TRAIL_L1" );
00342 colNames.push_back("TBMA_TRAIL_L2" );
00343 colNames.push_back("TBMA_TRAIL_L3" );
00344 colNames.push_back("TBMA_TRAIL_L4" );
00345
00346
00347 for(unsigned int c = 0 ; c < ins.size() ; c++)
00348 {
00349 for(unsigned int n=0; n<colNames.size(); n++)
00350 {
00351 if(tableMat[firstRow][c] == colNames[n]){
00352 colM[colNames[n]] = c;
00353 break;
00354 }
00355 }
00356 }
00357 for(unsigned int n=0; n<colNames.size(); n++)
00358 {
00359 if(colM.find(colNames[n]) == colM.end())
00360 {
00361 std::cerr << mthn << "\tCouldn't find in the database the column with name " << colNames[n] << std::endl;
00362 assert(0);
00363 }
00364 }
00365 for(int r = firstRow + 1 ; r < lastRow ; r++)
00366 {
00367
00368 TBM_L0[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_HEAD_L0"]].c_str() ) ;
00369 TBM_L1[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_HEAD_L1"]].c_str() ) ;
00370 TBM_L2[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_HEAD_L2"]].c_str() ) ;
00371 TBM_L3[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_HEAD_L3"]].c_str() ) ;
00372 TBM_L4[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_HEAD_L4"]].c_str() ) ;
00373 TRL_L0[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_TRAIL_L0"]].c_str() ) ;
00374 TRL_L1[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_TRAIL_L1"]].c_str() ) ;
00375 TRL_L2[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_TRAIL_L2"]].c_str() ) ;
00376 TRL_L3[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_TRAIL_L3"]].c_str() ) ;
00377 TRL_L4[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1] = atoi(tableMat[r][colM["TBMA_TRAIL_L4"]].c_str() ) ;
00378 }
00379 }
00380
00381 void PixelFEDCard::readDBROCLevels(std::vector<std::vector<std::string> > &tableMat, int firstRow, int lastRow)
00382 {
00383 string mthn = "[PixelFEDCard::readDBROCLevels()] ";
00384 map<string , int > colM;
00385 vector<string> colNames;
00386
00408 colNames.push_back("CONFIG_KEY_ID" );
00409 colNames.push_back("CONFIG_KEY" );
00410 colNames.push_back("VERSION" );
00411 colNames.push_back("KIND_OF_COND" );
00412 colNames.push_back("PXLFED_NAME" );
00413 colNames.push_back("FED_CHAN" );
00414 colNames.push_back("AOH_CHAN" );
00415 colNames.push_back("ROC_NAME" );
00416 colNames.push_back("HUB_ADDRS" );
00417 colNames.push_back("PORT_NUMBER" );
00418 colNames.push_back("ROC_I2C_ADDR" );
00419 colNames.push_back("GEOM_ROC_NUM" );
00420 colNames.push_back("FED_ROC_NUM" );
00421 colNames.push_back("ROC_L0" );
00422 colNames.push_back("ROC_L1" );
00423 colNames.push_back("ROC_L2" );
00424 colNames.push_back("ROC_L3" );
00425 colNames.push_back("ROC_L4" );
00426
00427
00428 for(unsigned int c = 0 ; c < tableMat[firstRow].size() ; c++)
00429 {
00430 for(unsigned int n=0; n<colNames.size(); n++)
00431 {
00432 if(tableMat[firstRow][c] == colNames[n]){
00433 colM[colNames[n]] = c;
00434 break;
00435 }
00436 }
00437 }
00438 for(unsigned int n=0; n<colNames.size(); n++)
00439 {
00440 if(colM.find(colNames[n]) == colM.end())
00441 {
00442 std::cerr << mthn << "\tCouldn't find in the database the column with name " << colNames[n] << std::endl;
00443 assert(0);
00444 }
00445 }
00446
00447
00448
00449 for(int r = firstRow + 1 ; r < lastRow ; r++)
00450 {
00451 ROC_L0[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1][atoi(tableMat[r][colM["FED_ROC_NUM"]].c_str())-1] = atoi(tableMat[r][colM["ROC_L0"]].c_str()) ;
00452 ROC_L1[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1][atoi(tableMat[r][colM["FED_ROC_NUM"]].c_str())-1] = atoi(tableMat[r][colM["ROC_L1"]].c_str()) ;
00453 ROC_L2[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1][atoi(tableMat[r][colM["FED_ROC_NUM"]].c_str())-1] = atoi(tableMat[r][colM["ROC_L2"]].c_str()) ;
00454 ROC_L3[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1][atoi(tableMat[r][colM["FED_ROC_NUM"]].c_str())-1] = atoi(tableMat[r][colM["ROC_L3"]].c_str()) ;
00455 ROC_L4[atoi(tableMat[r][colM["FED_CHAN"]].c_str())-1][atoi(tableMat[r][colM["FED_ROC_NUM"]].c_str())-1] = atoi(tableMat[r][colM["ROC_L4"]].c_str()) ;
00456 }
00457
00458 }
00459
00460
00461
00462 PixelFEDCard::PixelFEDCard(string fileName):
00463 PixelConfigBase(" "," "," ")
00464 {
00465
00466
00467 const bool localDEBUG = false;
00468
00469
00470 clear() ;
00471
00472
00473 FILE *infile = fopen((fileName.c_str()),"r");
00474 if (infile == NULL) {
00475 cout<<"No parameter file:"<<fileName<<endl;
00476 return;
00477 }
00478
00479
00480 fscanf(infile,"FED Base address :%lx\n",
00481 &FEDBASE_0);
00482 fscanf(infile,"FEDID Number :%lx\n",
00483 &fedNumber);
00484
00485 printf("FED Base address, FED # :%lx\n",FEDBASE_0);
00486
00487 printf("FEDID # :%lx\n",fedNumber);
00488
00489
00490 int ijx=0;
00491 for(int i=0;i<36;i++){
00492 ijx=i+1;
00493 fscanf(infile,"Number of ROCs Chnl %d:%d \n",&ijx,&NRocs[i]);
00494 if(localDEBUG)printf("Number of ROCs per Chnl %d:%d \n",ijx,NRocs[i]);
00495 }
00496
00497
00498 fscanf(infile,"Optical reciever 1 Capacitor Adjust(0-3):%d\n",&opt_cap[0]);
00499 fscanf(infile,"Optical reciever 2 Capacitor Adjust(0-3):%d\n",&opt_cap[1]);
00500 fscanf(infile,"Optical reciever 3 Capacitor Adjust(0-3):%d\n",&opt_cap[2]);
00501 fscanf(infile,"Optical reciever 1 Input Offset (0-15) :%d\n",&opt_inadj[0]);
00502 fscanf(infile,"Optical reciever 2 Input Offset (0-15) :%d\n",&opt_inadj[1]);
00503 fscanf(infile,"Optical reciever 3 Input Offset (0-15) :%d\n",&opt_inadj[2]);
00504 fscanf(infile,"Optical reciever 1 Output Offset (0-3) :%d\n",&opt_ouadj[0]);
00505 fscanf(infile,"Optical reciever 2 Output Offset (0-3) :%d\n",&opt_ouadj[1]);
00506 fscanf(infile,"Optical reciever 3 Output Offset (0-3) :%d\n",&opt_ouadj[2]);
00507
00508 if(localDEBUG) {
00509 printf("Optical reciever 1 Capacitor Adjust(0-3):%d\n",opt_cap[0]);
00510 printf("Optical reciever 2 Capacitor Adjust(0-3):%d\n",opt_cap[1]);
00511 printf("Optical reciever 3 Capacitor Adjust(0-3):%d\n",opt_cap[2]);
00512 printf("Optical reciever 1 Input Offset (0-15) :%d\n",opt_inadj[0]);
00513 printf("Optical reciever 2 Input Offset (0-15) :%d\n",opt_inadj[1]);
00514 printf("Optical reciever 3 Input Offset (0-15) :%d\n",opt_inadj[2]);
00515 printf("Optical reciever 1 Output Offset (0-3) :%d\n",opt_ouadj[0]);
00516 printf("Optical reciever 2 Output Offset (0-3) :%d\n",opt_ouadj[1]);
00517 printf("Optical reciever 3 Output Offset (0-3) :%d\n",opt_ouadj[2]);
00518 }
00519
00520
00521 for(int i=0;i<36;i++) {
00522 fscanf(infile,"Offset DAC channel %d:%d\n",&ijx,&offs_dac[i]);
00523 if(localDEBUG) printf("Offset DAC channel %d:%d\n",i+1,offs_dac[i]);
00524 }
00525
00526
00527 fscanf(infile,"Clock Phase Bits ch 1-9:%x\n",& clkphs1_9 );
00528 fscanf(infile,"Clock Phase Bits ch 10-18:%x\n",&clkphs10_18);
00529 fscanf(infile,"Clock Phase Bits ch 19-27:%x\n",&clkphs19_27);
00530 fscanf(infile,"Clock Phase Bits ch 28-36:%x\n",&clkphs28_36);
00531 if(localDEBUG)printf("Clock Phase Bits ch 1-9:%x\n",clkphs1_9 );
00532 if(localDEBUG)printf("Clock Phase Bits ch 10-18:%x\n",clkphs10_18 );
00533 if(localDEBUG)printf("Clock Phase Bits ch 19-27:%x\n",clkphs19_27 );
00534 if(localDEBUG)printf("Clock Phase Bits ch 28-36:%x\n",clkphs28_36 );
00535
00536
00537 for(int i=0;i<36;i++){
00538 fscanf(infile,"Black HiThold ch %d:%d \n",&ijx,&BlackHi[i]);
00539 fscanf(infile,"Black LoThold ch %d:%d \n",&ijx,&BlackLo[i]);
00540 fscanf(infile,"ULblack Thold ch %d:%d \n",&ijx, &Ublack[i]);
00541 if(localDEBUG)printf("Black HiThold ch %d:%d\n",ijx,BlackHi[i]);
00542 if(localDEBUG)printf("Black LoThold ch %d:%d\n",ijx,BlackLo[i]);
00543 if(localDEBUG)printf("ULblack Thold ch %d:%d\n",ijx, Ublack[i]);
00544 }
00545
00546
00547 for(int i=0;i<36;i++) {
00548 fscanf(infile,"Delay channel %d(0-15):%d\n",&ijx,&DelayCh[i]);
00549 if(localDEBUG)
00550 printf("Delay channel %d(0-15):%d\n",i+1,DelayCh[i]);
00551 }
00552
00553
00554 for(int i=0;i<36;i++) {
00555 fscanf(infile,"TBM level 0 Channel %d:%d\n",&ijx,&TBM_L0[i]);
00556 fscanf(infile,"TBM level 1 Channel %d:%d\n",&ijx,&TBM_L1[i]);
00557 fscanf(infile,"TBM level 2 Channel %d:%d\n",&ijx,&TBM_L2[i]);
00558 fscanf(infile,"TBM level 3 Channel %d:%d\n",&ijx,&TBM_L3[i]);
00559 fscanf(infile,"TBM level 4 Channel %d:%d\n",&ijx,&TBM_L4[i]);
00560 if(localDEBUG)printf("TBM level 0 Channel %d:%d\n",ijx,TBM_L0[i]);
00561 if(localDEBUG)printf("TBM level 1 Channel %d:%d\n",ijx,TBM_L1[i]);
00562 if(localDEBUG)printf("TBM level 2 Channel %d:%d\n",ijx,TBM_L2[i]);
00563 if(localDEBUG)printf("TBM level 3 Channel %d:%d\n",ijx,TBM_L3[i]);
00564 if(localDEBUG)printf("TBM level 4 Channel %d:%d\n",ijx,TBM_L4[i]);
00565
00566 int ijy=0;
00567 for(int j=0;j<NRocs[i];j++) {
00568 fscanf(infile,"ROC%d level 0 Channel %d :%d\n",
00569 &ijy,&ijx,&ROC_L0[i][j]);
00570 fscanf(infile,"ROC%d level 1 Channel %d :%d\n",
00571 &ijy,&ijx,&ROC_L1[i][j]);
00572 fscanf(infile,"ROC%d level 2 Channel %d :%d\n",
00573 &ijy,&ijx,&ROC_L2[i][j]);
00574 fscanf(infile,"ROC%d level 3 Channel %d :%d\n",
00575 &ijy,&ijx,&ROC_L3[i][j]);
00576 fscanf(infile,"ROC%d level 4 Channel %d :%d\n",
00577 &ijy,&ijx,&ROC_L4[i][j]);
00578 if(localDEBUG)
00579 printf("ROC%d level 0 Channel %d :%d\n",ijy,ijx,ROC_L0[i][j]);
00580 if(localDEBUG)
00581 printf("ROC%d level 1 Channel %d :%d\n",ijy,ijx,ROC_L1[i][j]);
00582 if(localDEBUG)
00583 printf("ROC%d level 2 Channel %d :%d\n",ijy,ijx,ROC_L2[i][j]);
00584 if(localDEBUG)
00585 printf("ROC%d level 3 Channel %d :%d\n",ijy,ijx,ROC_L3[i][j]);
00586 if(localDEBUG)
00587 printf("ROC%d level 4 Channel %d :%d\n",ijy,ijx,ROC_L4[i][j]);
00588 }
00589
00590 fscanf(infile,"TRLR level 0 Channel %d:%d\n",&ijx,&TRL_L0[i]);
00591 fscanf(infile,"TRLR level 1 Channel %d:%d\n",&ijx,&TRL_L1[i]);
00592 fscanf(infile,"TRLR level 2 Channel %d:%d\n",&ijx,&TRL_L2[i]);
00593 fscanf(infile,"TRLR level 3 Channel %d:%d\n",&ijx,&TRL_L3[i]);
00594 fscanf(infile,"TRLR level 4 Channel %d:%d\n",&ijx,&TRL_L4[i]);
00595 if(localDEBUG)printf("TRLR level 0 Channel %d:%d\n",ijx,TRL_L0[i]);
00596 if(localDEBUG)printf("TRLR level 1 Channel %d:%d\n",ijx,TRL_L1[i]);
00597 if(localDEBUG)printf("TRLR level 2 Channel %d:%d\n",ijx,TRL_L2[i]);
00598 if(localDEBUG)printf("TRLR level 3 Channel %d:%d\n",ijx,TRL_L3[i]);
00599 if(localDEBUG)printf("TRLR level 4 Channel %d:%d\n",ijx,TRL_L4[i]);
00600 }
00601
00602
00603
00604 fscanf(infile,"Channel Enbable bits chnls 1-9 (on = 0):%x\n",
00605 &Ncntrl);
00606 fscanf(infile,"Channel Enbable bits chnls 10-18(on = 0):%x\n",
00607 &NCcntrl);
00608 fscanf(infile,"Channel Enbable bits chnls 19-27(on = 0):%x\n",
00609 &SCcntrl);
00610 fscanf(infile,"Channel Enbable bits chnls 28-36(on = 0):%x\n",
00611 &Scntrl);
00612 if(localDEBUG)
00613 printf("Channel Enbable bits chnls 1-9 (on = 0):%x\n",Ncntrl);
00614 if(localDEBUG)
00615 printf("Channel Enbable bits chnls 10-18(on = 0):%x\n",NCcntrl);
00616 if(localDEBUG)
00617 printf("Channel Enbable bits chnls 19-27(on = 0):%x\n",SCcntrl);
00618 if(localDEBUG)
00619 printf("Channel Enbable bits chnls 28-36(on = 0):%x\n",Scntrl);
00620
00621
00622 fscanf(infile,"TTCrx Coarse Delay Register 2:%d\n",&CoarseDel);
00623 fscanf(infile,"TTCrc ClkDes2 Register 3:%x\n",&ClkDes2);
00624 fscanf(infile,"TTCrc Fine Dlay ClkDes2 Reg 1:%d\n",&FineDes2Del);
00625 if(localDEBUG)printf("TTCrx Coarse Delay Register 2:%d\n",CoarseDel);
00626 if(localDEBUG)printf("TTCrc ClkDes2 Register 3:%x\n",ClkDes2);
00627 if(localDEBUG)printf("TTCrc Fine Dlay ClkDes2 Reg 1:%d\n",FineDes2Del);
00628
00629
00630 fscanf(infile,"Center Chip Control Reg:%x\n",&Ccntrl);
00631 printf("Control Reg:0x%x\n",Ccntrl);
00632 fscanf(infile,"Initial Slink DAQ mode:%d\n",&modeRegister);
00633 printf("Mode Reg:%d\n",modeRegister);
00634
00635
00636 fscanf(infile,"Channel ADC Gain bits chnls 1-12(1Vpp = 0):%x\n",
00637 &Nadcg);
00638 fscanf(infile,"Channel ADC Gain bits chnls 13-20(1Vpp = 0):%x\n",
00639 &NCadcg);
00640 fscanf(infile,"Channel ADC Gain bits chnls 21-28(1Vpp = 0):%x\n",
00641 &SCadcg);
00642 fscanf(infile,"Channel ADC Gain bits chnls 29-36(1Vpp = 0):%x\n",
00643 &Sadcg);
00644 if(localDEBUG)
00645 printf("Channel ADC Gain bits chnls 1-12(1Vpp = 0):%x\n",Nadcg);
00646 if(localDEBUG)
00647 printf("Channel ADC Gain bits chnls 13-20(1Vpp = 0):%x\n",NCadcg);
00648 if(localDEBUG)
00649 printf("Channel ADC Gain bits chnls 21-28(1Vpp = 0):%x\n",SCadcg);
00650 if(localDEBUG)
00651 printf("Channel ADC Gain bits chnls 29-36(1Vpp = 0):%x\n",Sadcg);
00652
00653
00654 fscanf(infile,"Channel Baseline Enbable chnls 1-9 (on = (0x1ff<<16)+):%x\n",
00655 &Nbaseln);
00656 fscanf(infile,"Channel Baseline Enbable chnls 10-18(on = (0x1ff<<16)+):%x\n",
00657 &NCbaseln);
00658 fscanf(infile,"Channel Baseline Enbable chnls 19-27(on = (0x1ff<<16)+):%x\n",
00659 &SCbaseln);
00660 fscanf(infile,"Channel Baseline Enbable chnls 28-36(on = (0x1ff<<16)+):%x\n",
00661 &Sbaseln);
00662 if(localDEBUG)
00663 printf("Channel Baseline Enbable chnls 1-9 (on = (0x1ff<<16)+):%x\n",Nbaseln);
00664 if(localDEBUG)
00665 printf("Channel Baseline Enbable chnls 10-18(on = (0x1ff<<16)+):%x\n",NCbaseln);
00666 if(localDEBUG)
00667 printf("Channel Baseline Enbable chnls 19-27(on = (0x1ff<<16)+):%x\n",SCbaseln);
00668 if(localDEBUG)
00669 printf("Channel Baseline Enbable chnls 28-36(on = (0x1ff<<16)+):%x\n",Sbaseln);
00670
00671
00672 fscanf(infile,"TBM trailer mask chnls 1-9 (0xff = all masked):%x\n",
00673 &N_TBMmask);
00674 fscanf(infile,"TBM trailer mask chnls 10-18(0xff = all masked):%x\n",
00675 &NC_TBMmask);
00676 fscanf(infile,"TBM trailer mask chnls 19-27(0xff = all masked):%x\n",
00677 &SC_TBMmask);
00678 fscanf(infile,"TBM trailer mask chnls 28-36(0xff = all masked):%x\n",
00679 &S_TBMmask);
00680 if(localDEBUG)
00681 printf("TBM trailer mask chnls 1-9 (0xff = all masked):%x\n",N_TBMmask);
00682 if(localDEBUG)
00683 printf("TBM trailer mask chnls 10-18(0xff = all masked):%x\n",NC_TBMmask);
00684 if(localDEBUG)
00685 printf("TBM trailer mask chnls 19-27(0xff = all masked):%x\n",SC_TBMmask);
00686 if(localDEBUG)
00687 printf("TBM trailer mask chnls 28-36(0xff = all masked):%x\n",S_TBMmask);
00688
00689
00690 fscanf(infile,"Private 8 bit word chnls 1-9 :%x\n",
00691 &N_Pword);
00692 fscanf(infile,"Private 8 bit word chnls 10-18:%x\n",
00693 &NC_Pword);
00694 fscanf(infile,"Private 8 bit word chnls 19-27:%x\n",
00695 &SC_Pword);
00696 fscanf(infile,"Private 8 bit word chnls 28-36:%x\n",
00697 &S_Pword);
00698 if(localDEBUG)
00699 printf("Private 8 bit word chnls 1-9 :%x\n",N_Pword);
00700 if(localDEBUG)
00701 printf("Private 8 bit word chnls 10-18:%x\n",NC_Pword);
00702 if(localDEBUG)
00703 printf("Private 8 bit word chnls 19-27:%x\n",SC_Pword);
00704 if(localDEBUG)
00705 printf("Private 8 bit word chnls 28-36:%x\n",S_Pword);
00706
00707
00708 fscanf(infile,"Special Random testDAC mode (on = 0x1, off=0x0):%x\n",
00709 &SpecialDac);
00710 if(localDEBUG)
00711 printf("Special Random testDAC mode (on = 0x1, off=0x0):%x\n",SpecialDac);
00712
00713
00714
00715 fscanf(infile,"Number of Consecutive (max 1023) Out of Syncs till TTs OOS set:%d\n",
00716 &Ooslvl);
00717 if(localDEBUG)
00718 printf("Number of Consecutive (max 1023) Out of Syncs till TTs OOS set:%d\n",Ooslvl);
00719
00720
00721 fscanf(infile,"Number of Consecutive (max 1023) Empty events till TTs ERR set:%d\n",
00722 &Errlvl);
00723 if(localDEBUG)
00724 printf("Number of Consecutive (max 1023) Empty events till TTs ERR set:%d\n",Errlvl);
00725
00726
00727 fscanf(infile,"N Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
00728 &Nfifo1Bzlvl);
00729 if(localDEBUG)
00730 printf("N Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",Nfifo1Bzlvl);
00731
00732
00733 fscanf(infile,"NC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
00734 &NCfifo1Bzlvl);
00735 if(localDEBUG)
00736 printf("NC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",NCfifo1Bzlvl);
00737
00738
00739 fscanf(infile,"SC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
00740 &SCfifo1Bzlvl);
00741 if(localDEBUG)
00742 printf("SC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",SCfifo1Bzlvl);
00743
00744
00745 fscanf(infile,"S Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
00746 &Sfifo1Bzlvl);
00747 if(localDEBUG)
00748 printf("S Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",Sfifo1Bzlvl);
00749
00750
00751 fscanf(infile,"Fifo-3 almost full level,sets TTs WARN (max 8191):%d\n",
00752 &fifo3Wrnlvl);
00753 if(localDEBUG)
00754 printf("Fifo-3 almost full level,sets TTs WARN (max 8191):%d\n",fifo3Wrnlvl);
00755
00756 fscanf(infile,"FED Master delay 0=0,1=32,2=48,3=64:%d\n",
00757 &FedTTCDelay);
00758 if(localDEBUG)
00759 printf("FED Master delay 0=0,1=32,2=48,3=64:%d\n",FedTTCDelay);
00760
00761 int checkword=0;
00762 fscanf(infile,"Params FED file check word:%d\n",
00763 &checkword);
00764 if(checkword!=60508)cout<<"FEDID:"<<fedNumber<<" Params FED File read error. Checkword read "<<checkword<<" check word expected 060508"<<endl;
00765
00766 if(localDEBUG)
00767 printf("Params FED file check word:%d\n",checkword);
00768
00769
00770
00771
00772 fclose(infile);
00773
00774 Ccntrl_original=Ccntrl;
00775 modeRegister_original=modeRegister;
00776
00777
00778 Ncntrl_original=Ncntrl;
00779 NCcntrl_original=NCcntrl;
00780 SCcntrl_original=SCcntrl;
00781 Scntrl_original=Scntrl;
00782
00783 Nbaseln_original=Nbaseln;
00784 NCbaseln_original=NCbaseln;
00785 SCbaseln_original=SCbaseln;
00786 Sbaseln_original=Sbaseln;
00787
00788 return;
00789 }
00790
00791
00792
00793 void PixelFEDCard::clear(void)
00794 {
00795 FEDBASE_0 = 0 ;
00796 fedNumber = 0 ;
00797 for(int i=0;i<36;i++){
00798 NRocs[i] = 0;
00799 offs_dac[i] = 0;
00800 BlackHi[i] = 0;
00801 BlackLo[i] = 0;
00802 Ublack[i] = 0;
00803 DelayCh[i] = 0;
00804 TBM_L0[i] = 0;
00805 TBM_L1[i] = 0;
00806 TBM_L2[i] = 0;
00807 TBM_L3[i] = 0;
00808 TBM_L4[i] = 0;
00809 TRL_L0[i] = 0;
00810 TRL_L1[i] = 0;
00811 TRL_L2[i] = 0;
00812 TRL_L3[i] = 0;
00813 TRL_L4[i] = 0;
00814 }
00815 for(int i=0;i<3;i++){
00816 opt_cap[i] = 0;
00817 opt_inadj[i] = 0;
00818 opt_ouadj[i] = 0;
00819 }
00820 clkphs1_9 = 0;
00821 clkphs10_18 = 0;
00822 clkphs19_27 = 0;
00823 clkphs28_36 = 0;
00824
00825 for(int i=0;i<36;i++) {
00826 for(int j=0;j<26;j++) {
00827 ROC_L0[i][j] = 0;
00828 ROC_L1[i][j] = 0;
00829 ROC_L2[i][j] = 0;
00830 ROC_L3[i][j] = 0;
00831 ROC_L4[i][j] = 0;
00832 }
00833 }
00834 Ncntrl = 0;
00835 NCcntrl = 0;
00836 SCcntrl = 0;
00837 Scntrl = 0;
00838 CoarseDel = 0;
00839 ClkDes2 = 0;
00840 FineDes2Del = 0;
00841 Ccntrl = 0;
00842 modeRegister = 0;
00843 Nadcg = 0;
00844 NCadcg = 0;
00845 SCadcg = 0;
00846 Sadcg = 0;
00847 Nbaseln = 0;
00848 NCbaseln = 0;
00849 SCbaseln = 0;
00850 Sbaseln = 0;
00851 N_TBMmask = 0;
00852 NC_TBMmask = 0;
00853 SC_TBMmask = 0;
00854 S_TBMmask = 0;
00855 N_Pword = 0;
00856 NC_Pword = 0;
00857 SC_Pword = 0;
00858 S_Pword = 0;
00859 SpecialDac = 0;
00860 Ooslvl = 0;
00861 Errlvl = 0;
00862 Nfifo1Bzlvl = 0;
00863 NCfifo1Bzlvl = 0;
00864 SCfifo1Bzlvl = 0;
00865 Sfifo1Bzlvl = 0;
00866 fifo3Wrnlvl = 0;
00867 }
00868
00869
00870 void PixelFEDCard::writeASCII(std::string dir) const{
00871
00872
00873
00874 ostringstream s1;
00875 s1<<fedNumber;
00876 std::string fedNum=s1.str();
00877
00878 if (dir!="") dir+="/";
00879
00880 std::string filename=dir+"params_fed_"+fedNum+".dat";
00881
00882 FILE *outfile = fopen((filename.c_str()),"w");
00883 if (outfile == NULL) {
00884 cout<<"Could not open file:"<<filename<<" for writing"<<endl;
00885 return;
00886 }
00887
00888
00889 fprintf(outfile,"FED Base address :0x%lx\n",
00890 FEDBASE_0);
00891 fprintf(outfile,"FEDID Number :0x%lx\n",
00892 fedNumber);
00893
00894
00895 int ijx=0;
00896 for(int i=0;i<36;i++){
00897 ijx=i+1;
00898 fprintf(outfile,"Number of ROCs Chnl %d:%d\n",ijx,NRocs[i]);
00899 }
00900
00901
00902 fprintf(outfile,"Optical reciever 1 Capacitor Adjust(0-3):%d\n",opt_cap[0]);
00903 fprintf(outfile,"Optical reciever 2 Capacitor Adjust(0-3):%d\n",opt_cap[1]);
00904 fprintf(outfile,"Optical reciever 3 Capacitor Adjust(0-3):%d\n",opt_cap[2]);
00905 fprintf(outfile,"Optical reciever 1 Input Offset (0-15) :%d\n",opt_inadj[0]);
00906 fprintf(outfile,"Optical reciever 2 Input Offset (0-15) :%d\n",opt_inadj[1]);
00907 fprintf(outfile,"Optical reciever 3 Input Offset (0-15) :%d\n",opt_inadj[2]);
00908 fprintf(outfile,"Optical reciever 1 Output Offset (0-3) :%d\n",opt_ouadj[0]);
00909 fprintf(outfile,"Optical reciever 2 Output Offset (0-3) :%d\n",opt_ouadj[1]);
00910 fprintf(outfile,"Optical reciever 3 Output Offset (0-3) :%d\n",opt_ouadj[2]);
00911
00912
00913 for(int i=0;i<36;i++) {
00914 fprintf(outfile,"Offset DAC channel %d:%d\n",i+1,offs_dac[i]);
00915 }
00916
00917
00918 fprintf(outfile,"Clock Phase Bits ch 1-9:0x%x\n",clkphs1_9 );
00919 fprintf(outfile,"Clock Phase Bits ch 10-18:0x%x\n",clkphs10_18);
00920 fprintf(outfile,"Clock Phase Bits ch 19-27:0x%x\n",clkphs19_27);
00921 fprintf(outfile,"Clock Phase Bits ch 28-36:0x%x\n",clkphs28_36);
00922
00923
00924 for(int i=0;i<36;i++){
00925 fprintf(outfile,"Black HiThold ch %d:%d \n",i+1,BlackHi[i]);
00926 fprintf(outfile,"Black LoThold ch %d:%d \n",i+1,BlackLo[i]);
00927 fprintf(outfile,"ULblack Thold ch %d:%d \n",i+1,Ublack[i]);
00928 }
00929
00930
00931 for(int i=0;i<36;i++) {
00932 fprintf(outfile,"Delay channel %d(0-15):%d\n",i+1,DelayCh[i]);
00933 }
00934
00935
00936 for(int i=0;i<36;i++) {
00937 fprintf(outfile,"TBM level 0 Channel %d:%d\n",i+1,TBM_L0[i]);
00938 fprintf(outfile,"TBM level 1 Channel %d:%d\n",i+1,TBM_L1[i]);
00939 fprintf(outfile,"TBM level 2 Channel %d:%d\n",i+1,TBM_L2[i]);
00940 fprintf(outfile,"TBM level 3 Channel %d:%d\n",i+1,TBM_L3[i]);
00941 fprintf(outfile,"TBM level 4 Channel %d:%d\n",i+1,TBM_L4[i]);
00942
00943 for(int j=0;j<NRocs[i];j++) {
00944 fprintf(outfile,"ROC%d level 0 Channel %d :%d\n",
00945 j,i+1,ROC_L0[i][j]);
00946 fprintf(outfile,"ROC%d level 1 Channel %d :%d\n",
00947 j,i+1,ROC_L1[i][j]);
00948 fprintf(outfile,"ROC%d level 2 Channel %d :%d\n",
00949 j,i+1,ROC_L2[i][j]);
00950 fprintf(outfile,"ROC%d level 3 Channel %d :%d\n",
00951 j,i+1,ROC_L3[i][j]);
00952 fprintf(outfile,"ROC%d level 4 Channel %d :%d\n",
00953 j,i+1,ROC_L4[i][j]);
00954 }
00955
00956 fprintf(outfile,"TRLR level 0 Channel %d:%d\n",i+1,TRL_L0[i]);
00957 fprintf(outfile,"TRLR level 1 Channel %d:%d\n",i+1,TRL_L1[i]);
00958 fprintf(outfile,"TRLR level 2 Channel %d:%d\n",i+1,TRL_L2[i]);
00959 fprintf(outfile,"TRLR level 3 Channel %d:%d\n",i+1,TRL_L3[i]);
00960 fprintf(outfile,"TRLR level 4 Channel %d:%d\n",i+1,TRL_L4[i]);
00961 }
00962
00963
00964
00965 fprintf(outfile,"Channel Enbable bits chnls 1-9 (on = 0):0x%x\n",
00966 Ncntrl);
00967 fprintf(outfile,"Channel Enbable bits chnls 10-18(on = 0):0x%x\n",
00968 NCcntrl);
00969 fprintf(outfile,"Channel Enbable bits chnls 19-27(on = 0):0x%x\n",
00970 SCcntrl);
00971 fprintf(outfile,"Channel Enbable bits chnls 28-36(on = 0):0x%x\n",
00972 Scntrl);
00973
00974
00975 fprintf(outfile,"TTCrx Coarse Delay Register 2:%d\n",CoarseDel);
00976 fprintf(outfile,"TTCrc ClkDes2 Register 3:0x%x\n",ClkDes2);
00977 fprintf(outfile,"TTCrc Fine Dlay ClkDes2 Reg 1:%d\n",FineDes2Del);
00978
00979
00980 fprintf(outfile,"Center Chip Control Reg:0x%x\n",Ccntrl);
00981 fprintf(outfile,"Initial Slink DAQ mode:%d\n",modeRegister);
00982
00983
00984 fprintf(outfile,"Channel ADC Gain bits chnls 1-12(1Vpp = 0):0x%x\n",
00985 Nadcg);
00986 fprintf(outfile,"Channel ADC Gain bits chnls 13-20(1Vpp = 0):0x%x\n",
00987 NCadcg);
00988 fprintf(outfile,"Channel ADC Gain bits chnls 21-28(1Vpp = 0):0x%x\n",
00989 SCadcg);
00990 fprintf(outfile,"Channel ADC Gain bits chnls 29-36(1Vpp = 0):0x%x\n",
00991 Sadcg);
00992
00993
00994 fprintf(outfile,"Channel Baseline Enbable chnls 1-9 (on = (0x1ff<<16)+):0x%x\n",
00995 Nbaseln);
00996 fprintf(outfile,"Channel Baseline Enbable chnls 10-18(on = (0x1ff<<16)+):0x%x\n",
00997 NCbaseln);
00998 fprintf(outfile,"Channel Baseline Enbable chnls 19-27(on = (0x1ff<<16)+):0x%x\n",
00999 SCbaseln);
01000 fprintf(outfile,"Channel Baseline Enbable chnls 28-36(on = (0x1ff<<16)+):0x%x\n",
01001 Sbaseln);
01002
01003
01004 fprintf(outfile,"TBM trailer mask chnls 1-9 (0xff = all masked):0x%x\n",
01005 N_TBMmask);
01006 fprintf(outfile,"TBM trailer mask chnls 10-18(0xff = all masked):0x%x\n",
01007 NC_TBMmask);
01008 fprintf(outfile,"TBM trailer mask chnls 19-27(0xff = all masked):0x%x\n",
01009 SC_TBMmask);
01010 fprintf(outfile,"TBM trailer mask chnls 28-36(0xff = all masked):0x%x\n",
01011 S_TBMmask);
01012
01013
01014 fprintf(outfile,"Private 8 bit word chnls 1-9 :0x%x\n",
01015 N_Pword);
01016 fprintf(outfile,"Private 8 bit word chnls 10-18:0x%x\n",
01017 NC_Pword);
01018 fprintf(outfile,"Private 8 bit word chnls 19-27:0x%x\n",
01019 SC_Pword);
01020 fprintf(outfile,"Private 8 bit word chnls 28-36:0x%x\n",
01021 S_Pword);
01022
01023
01024 fprintf(outfile,"Special Random testDAC mode (on = 0x1, off=0x0):0x%x\n",
01025 SpecialDac);
01026
01027
01028 fprintf(outfile,"Number of Consecutive (max 1023) Out of Syncs till TTs OOS set:%d\n",
01029 Ooslvl);
01030
01031
01032 fprintf(outfile,"Number of Consecutive (max 1023) Empty events till TTs ERR set:%d\n",
01033 Errlvl);
01034
01035
01036 fprintf(outfile,"N Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
01037 Nfifo1Bzlvl);
01038
01039
01040 fprintf(outfile,"NC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
01041 NCfifo1Bzlvl);
01042
01043
01044 fprintf(outfile,"SC Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
01045 SCfifo1Bzlvl);
01046
01047
01048 fprintf(outfile,"S Fifo-1 almost full level,sets TTs BUSY (max 1023):%d\n",
01049 Sfifo1Bzlvl);
01050
01051
01052 fprintf(outfile,"Fifo-3 almost full level,sets TTs WARN (max 8191):%d\n",
01053 fifo3Wrnlvl);
01054
01055 fprintf(outfile,"FED Master delay 0=0,1=32,2=48,3=64:%d\n",
01056 FedTTCDelay);
01057
01058 int checkword=60508;
01059 fprintf(outfile,"Params FED file check word:%d\n",
01060 checkword);
01061
01062 fclose(outfile);
01063
01064
01065 }
01066
01067
01068 void PixelFEDCard::writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const {
01069 std::string mthn = "[PixelFEDCard::writeXMLHeader()]\t\t\t " ;
01070 std::stringstream fullPath ;
01071
01072 fullPath << path << "/fedcard.xml" ;
01073 std::cout << mthn << "Writing to: " << fullPath.str() << "" << std::endl ;
01074
01075 out->open(fullPath.str().c_str()) ;
01076
01077 *out << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ;
01078 *out << "<ROOT>" << std::endl ;
01079 *out << "" << std::endl ;
01080 *out << " <HEADER>" << std::endl ;
01081 *out << " <TYPE>" << std::endl ;
01082 *out << " <EXTENSION_TABLE_NAME>FED_CONFIGURATION</EXTENSION_TABLE_NAME>" << std::endl ;
01083 *out << " <NAME>Pixel FED Configuration</NAME>" << std::endl ;
01084 *out << " </TYPE>" << std::endl ;
01085 *out << " <RUN>" << std::endl ;
01086 *out << " <RUN_TYPE>Pixel FED Configuration</RUN_TYPE>" << std::endl ;
01087 *out << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
01088 *out << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ;
01089 *out << " <COMMENT_DESCRIPTION>Pixel FED Configuration</COMMENT_DESCRIPTION>" << std::endl ;
01090 *out << " <LOCATION>CERN TAC</LOCATION>" << std::endl ;
01091 *out << " <INITIATED_BY_USER>Dario Menasce</INITIATED_BY_USER>" << std::endl ;
01092 *out << " </RUN>" << std::endl ;
01093 *out << " </HEADER>" << std::endl ;
01094 *out << "" << std::endl ;
01095 *out << " <DATA_SET>" << std::endl ;
01096 *out << "" << std::endl ;
01097 *out << " <VERSION>" << version << "</VERSION>" << std::endl ;
01098 *out << " <COMMENT_DESCRIPTION>Pixel FED Configuration</COMMENT_DESCRIPTION>" << std::endl ;
01099 *out << "" << std::endl ;
01100 *out << " <PART>" << std::endl ;
01101 *out << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
01102 *out << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
01103 *out << " </PART>" << std::endl ;
01104 }
01105
01106 void PixelFEDCard::writeXML( std::ofstream *out) const {
01107 std::string mthn = "[PixelFEDCard::writeXML()]\t\t\t " ;
01108
01109 *out << " <DATA>" << std::endl ;
01110 *out << " " << std::endl ;
01111 *out << " <PXLFED_NAME>PxlFED_" << fedNumber<< "</PXLFED_NAME>" << std::endl ;
01112
01113
01114
01115
01116 *out << "" << std::endl ;
01117 *out << " <CHANNEL_ID>1</CHANNEL_ID>" << std::endl ;
01118 *out << " <NUMBER_OF_ROCS>21</NUMBER_OF_ROCS>" << std::endl ;
01119 *out << " <CHANNEL_OFFSET_DAC_SETTINGS>0</CHANNEL_OFFSET_DAC_SETTINGS>" << std::endl ;
01120 *out << " <CHANNEL_DELAY_SETTINGS>3</CHANNEL_DELAY_SETTINGS>" << std::endl ;
01121 *out << " <CHANNEL_BLACK_HIGH>400</CHANNEL_BLACK_HIGH>" << std::endl ;
01122 *out << " <CHANNEL_BLACK_LOW>150</CHANNEL_BLACK_LOW>" << std::endl ;
01123 *out << " <CHANNEL_ULTRA_BLACK>120</CHANNEL_ULTRA_BLACK>" << std::endl ;
01124 *out << "" << std::endl ;
01125 *out << " <OPT1_CAP>0</OPT1_CAP>" << std::endl ;
01126 *out << " <OPT2_CAP>0</OPT2_CAP>" << std::endl ;
01127 *out << " <OPT3_CAP>0</OPT3_CAP>" << std::endl ;
01128 *out << " <OPT1_INP>0</OPT1_INP>" << std::endl ;
01129 *out << " <OPT2_INP>0</OPT2_INP>" << std::endl ;
01130 *out << " <OPT3_INP>0</OPT3_INP>" << std::endl ;
01131 *out << " <OPT1_OUT>0</OPT1_OUT>" << std::endl ;
01132 *out << " <OPT2_OUT>0</OPT2_OUT>" << std::endl ;
01133 *out << " <OPT3_OUT>0</OPT3_OUT>" << std::endl ;
01134 *out << " <NORTH_CLKPHB>511</NORTH_CLKPHB>" << std::endl ;
01135 *out << " <NORTHCENTER_CLKPHB>511</NORTHCENTER_CLKPHB>" << std::endl ;
01136 *out << " <SOUTHCENTER_CLKPHB>511</SOUTHCENTER_CLKPHB>" << std::endl ;
01137 *out << " <SOUTH_CLKPHB>511</SOUTH_CLKPHB>" << std::endl ;
01138 *out << " <NORTH_CTRL>0</NORTH_CTRL> " << std::endl ;
01139 *out << " <NORTHCENTER_CTRL>0</NORTHCENTER_CTRL>" << std::endl ;
01140 *out << " <SOUTHCENTER_CTRL>0</SOUTHCENTER_CTRL>" << std::endl ;
01141 *out << " <SOUTH_CTRL>0</SOUTH_CTRL>" << std::endl ;
01142 *out << " <REG1_TTCRX_FDLA>5</REG1_TTCRX_FDLA>" << std::endl ;
01143 *out << " <REG2_TTCRX_CDLA>0</REG2_TTCRX_CDLA>" << std::endl ;
01144 *out << " <REG3_TTCRX_CLKD2>155</REG3_TTCRX_CLKD2>" << std::endl ;
01145 *out << " <CENTER_CTRL>0</CENTER_CTRL>" << std::endl ;
01146 *out << " <CENTER_MODE>0</CENTER_MODE>" << std::endl ;
01147 *out << " <B1_ADCGN>0</B1_ADCGN>" << std::endl ;
01148 *out << " <B2_ADCGN>0</B2_ADCGN>" << std::endl ;
01149 *out << " <B3_ADCGN>0</B3_ADCGN>" << std::endl ;
01150 *out << " <B4_ADCGN>0</B4_ADCGN>" << std::endl ;
01151 *out << " <NORTH_BADJ>330</NORTH_BADJ>" << std::endl ;
01152 *out << " <NORTHCENTER_BADJ>330</NORTHCENTER_BADJ>" << std::endl ;
01153 *out << " <SOUTHCENTER_BADJ>330</SOUTHCENTER_BADJ>" << std::endl ;
01154 *out << " <SOUTH_BADJ>330</SOUTH_BADJ>" << std::endl ;
01155 *out << " <NORTH_TBMMASK>2</NORTH_TBMMASK>" << std::endl ;
01156 *out << " <NORTHCENTER_TBMMASK>2</NORTHCENTER_TBMMASK>" << std::endl ;
01157 *out << " <SOUTHCENTER_TBMMASK>2</SOUTHCENTER_TBMMASK>" << std::endl ;
01158 *out << " <SOUTH_TBMMASK>2</SOUTH_TBMMASK>" << std::endl ;
01159 *out << " <NORTH_PWORD>177</NORTH_PWORD>" << std::endl ;
01160 *out << " <NORTHCENTER_PWORD>178</NORTHCENTER_PWORD>" << std::endl ;
01161 *out << " <SOUTHCENTER_PWORD>179</SOUTHCENTER_PWORD>" << std::endl ;
01162 *out << " <SOUTH_PWORD>180</SOUTH_PWORD>" << std::endl ;
01163 *out << " <SPECDAC>0</SPECDAC>" << std::endl ;
01164 *out << " <OOS_LVL>0</OOS_LVL>" << std::endl ;
01165 *out << " <ERR_LVL>0</ERR_LVL>" << std::endl ;
01166 *out << " <NORTH_FIFO1_BZ_LVL>900</NORTH_FIFO1_BZ_LVL>" << std::endl ;
01167 *out << " <NORTHCENTER_FIFO1_BZ_LVL>900</NORTHCENTER_FIFO1_BZ_LVL>" << std::endl ;
01168 *out << " <SOUTHCENTER_FIFO1_BZ_LVL>900</SOUTHCENTER_FIFO1_BZ_LVL>" << std::endl ;
01169 *out << " <SOUTH_FIFO1_BZ_LVL>900</SOUTH_FIFO1_BZ_LVL>" << std::endl ;
01170 *out << " <FIFO3_WRN_LVL>7680</FIFO3_WRN_LVL> " << std::endl ;
01171 *out << " " << std::endl ;
01172 *out << " </DATA>" << std::endl ;
01173 *out << " " << std::endl ;
01174 }
01175
01176
01177 void PixelFEDCard::writeXMLTrailer(std::ofstream *out) const {
01178 std::string mthn = "[PixelFEDCard::writeXMLTrailer()]\t\t\t " ;
01179
01180 *out << " </DATA_SET>" << std::endl ;
01181 *out << "</ROOT>" << std::endl ;
01182
01183 out->close() ;
01184 std::cout << mthn << "Data written" << std::endl ;
01185 }
01186
01187
01188 void PixelFEDCard::writeXML(pos::PixelConfigKey key, int version, std::string path) const {
01189 std::string mthn = "[PixelFEDCard::writeXML()]\t\t\t " ;
01190 std::stringstream fullPath ;
01191
01192 fullPath << path << "/fedcard.xml" ;
01193 std::cout << mthn << "Writing to: |" << fullPath.str() << "|" << std::endl ;
01194
01195 std::ofstream out(fullPath.str().c_str()) ;
01196
01197 out << "<ROOT>" << std::endl ;
01198 out << "" << std::endl ;
01199 out << " <HEADER>" << std::endl ;
01200 out << " <TYPE>" << std::endl ;
01201 out << " <EXTENSION_TABLE_NAME>FED_CONFIGURATION</EXTENSION_TABLE_NAME>" << std::endl ;
01202 out << " <NAME>Pixel FED Configuration</NAME>" << std::endl ;
01203 out << " </TYPE>" << std::endl ;
01204 out << " <RUN>" << std::endl ;
01205 out << " <RUN_TYPE>Pixel FED Configuration</RUN_TYPE>" << std::endl ;
01206 out << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ;
01207 out << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ;
01208 out << " <COMMENT_DESCRIPTION>Pixel FED Configuration</COMMENT_DESCRIPTION>" << std::endl ;
01209 out << " <LOCATION>CERN TAC</LOCATION>" << std::endl ;
01210 out << " <INITIATED_BY_USER>Dario Menasce</INITIATED_BY_USER>" << std::endl ;
01211 out << " </RUN>" << std::endl ;
01212 out << " </HEADER>" << std::endl ;
01213 out << "" << std::endl ;
01214 out << " <DATA_SET>" << std::endl ;
01215 out << "" << std::endl ;
01216 out << " <VERSION>T_E_S_T</VERSION>" << std::endl ;
01217 out << " <COMMENT_DESCRIPTION>Pixel FED Configuration</COMMENT_DESCRIPTION>" << std::endl ;
01218 out << "" << std::endl ;
01219 out << " <PART>" << std::endl ;
01220 out << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ;
01221 out << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ;
01222 out << " </PART>" << std::endl ;
01223 out << "" << std::endl ;
01224 out << " <DATA>" << std::endl ;
01225 out << " <PXLFED_NAME>PxlFED_32</PXLFED_NAME>" << std::endl ;
01226 out << " <CRATE_NUMBER>1</CRATE_NUMBER>" << std::endl ;
01227 out << " <SLOT_NUMBER>5</SLOT_NUMBER> " << std::endl ;
01228 out << " <VME_ADDRESS>268435456</VME_ADDRESS>" << std::endl ;
01229 out << " <CRATE_LABEL>S1G03e</CRATE_LABEL>" << std::endl ;
01230 out << "" << std::endl ;
01231 out << " <CHANNEL_ID>1</CHANNEL_ID>" << std::endl ;
01232 out << " <NUMBER_OF_ROCS>21</NUMBER_OF_ROCS>" << std::endl ;
01233 out << " <CHANNEL_OFFSET_DAC_SETTINGS>0</CHANNEL_OFFSET_DAC_SETTINGS>" << std::endl ;
01234 out << " <CHANNEL_DELAY_SETTINGS>3</CHANNEL_DELAY_SETTINGS>" << std::endl ;
01235 out << " <CHANNEL_BLACK_HIGH>400</CHANNEL_BLACK_HIGH>" << std::endl ;
01236 out << " <CHANNEL_BLACK_LOW>150</CHANNEL_BLACK_LOW>" << std::endl ;
01237 out << " <CHANNEL_ULTRA_BLACK>120</CHANNEL_ULTRA_BLACK>" << std::endl ;
01238 out << "" << std::endl ;
01239 out << " <OPT1_CAP>0</OPT1_CAP>" << std::endl ;
01240 out << " <OPT2_CAP>0</OPT2_CAP>" << std::endl ;
01241 out << " <OPT3_CAP>0</OPT3_CAP>" << std::endl ;
01242 out << " <OPT1_INP>0</OPT1_INP>" << std::endl ;
01243 out << " <OPT2_INP>0</OPT2_INP>" << std::endl ;
01244 out << " <OPT3_INP>0</OPT3_INP>" << std::endl ;
01245 out << " <OPT1_OUT>0</OPT1_OUT>" << std::endl ;
01246 out << " <OPT2_OUT>0</OPT2_OUT>" << std::endl ;
01247 out << " <OPT3_OUT>0</OPT3_OUT>" << std::endl ;
01248 out << " <NORTH_CLKPHB>511</NORTH_CLKPHB>" << std::endl ;
01249 out << " <NORTHCENTER_CLKPHB>511</NORTHCENTER_CLKPHB>" << std::endl ;
01250 out << " <SOUTHCENTER_CLKPHB>511</SOUTHCENTER_CLKPHB>" << std::endl ;
01251 out << " <SOUTH_CLKPHB>511</SOUTH_CLKPHB>" << std::endl ;
01252 out << " <NORTH_CTRL>0</NORTH_CTRL> " << std::endl ;
01253 out << " <NORTHCENTER_CTRL>0</NORTHCENTER_CTRL>" << std::endl ;
01254 out << " <SOUTHCENTER_CTRL>0</SOUTHCENTER_CTRL>" << std::endl ;
01255 out << " <SOUTH_CTRL>0</SOUTH_CTRL>" << std::endl ;
01256 out << " <REG1_TTCRX_FDLA>5</REG1_TTCRX_FDLA>" << std::endl ;
01257 out << " <REG2_TTCRX_CDLA>0</REG2_TTCRX_CDLA>" << std::endl ;
01258 out << " <REG3_TTCRX_CLKD2>155</REG3_TTCRX_CLKD2>" << std::endl ;
01259 out << " <CENTER_CTRL>0</CENTER_CTRL>" << std::endl ;
01260 out << " <CENTER_MODE>0</CENTER_MODE>" << std::endl ;
01261 out << " <B1_ADCGN>0</B1_ADCGN>" << std::endl ;
01262 out << " <B2_ADCGN>0</B2_ADCGN>" << std::endl ;
01263 out << " <B3_ADCGN>0</B3_ADCGN>" << std::endl ;
01264 out << " <B4_ADCGN>0</B4_ADCGN>" << std::endl ;
01265 out << " <NORTH_BADJ>330</NORTH_BADJ>" << std::endl ;
01266 out << " <NORTHCENTER_BADJ>330</NORTHCENTER_BADJ>" << std::endl ;
01267 out << " <SOUTHCENTER_BADJ>330</SOUTHCENTER_BADJ>" << std::endl ;
01268 out << " <SOUTH_BADJ>330</SOUTH_BADJ>" << std::endl ;
01269 out << " <NORTH_TBMMASK>2</NORTH_TBMMASK>" << std::endl ;
01270 out << " <NORTHCENTER_TBMMASK>2</NORTHCENTER_TBMMASK>" << std::endl ;
01271 out << " <SOUTHCENTER_TBMMASK>2</SOUTHCENTER_TBMMASK>" << std::endl ;
01272 out << " <SOUTH_TBMMASK>2</SOUTH_TBMMASK>" << std::endl ;
01273 out << " <NORTH_PWORD>177</NORTH_PWORD>" << std::endl ;
01274 out << " <NORTHCENTER_PWORD>178</NORTHCENTER_PWORD>" << std::endl ;
01275 out << " <SOUTHCENTER_PWORD>179</SOUTHCENTER_PWORD>" << std::endl ;
01276 out << " <SOUTH_PWORD>180</SOUTH_PWORD>" << std::endl ;
01277 out << " <SPECDAC>0</SPECDAC>" << std::endl ;
01278 out << " <OOS_LVL>0</OOS_LVL>" << std::endl ;
01279 out << " <ERR_LVL>0</ERR_LVL>" << std::endl ;
01280 out << " <NORTH_FIFO1_BZ_LVL>900</NORTH_FIFO1_BZ_LVL>" << std::endl ;
01281 out << " <NORTHCENTER_FIFO1_BZ_LVL>900</NORTHCENTER_FIFO1_BZ_LVL>" << std::endl ;
01282 out << " <SOUTHCENTER_FIFO1_BZ_LVL>900</SOUTHCENTER_FIFO1_BZ_LVL>" << std::endl ;
01283 out << " <SOUTH_FIFO1_BZ_LVL>900</SOUTH_FIFO1_BZ_LVL>" << std::endl ;
01284 out << " <FIFO3_WRN_LVL>7680</FIFO3_WRN_LVL> " << std::endl ;
01285 out << " </DATA>" << std::endl ;
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300
01301
01302
01303
01304
01305
01306
01307
01308
01309
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320
01321
01322
01323
01324
01325
01326
01327
01328
01329
01330
01331
01332
01333
01334
01335
01336
01337
01338
01339
01340
01341
01342 std::cout << mthn << "Data written" << std::endl ;
01343 }
01344
01345
01346 unsigned long long PixelFEDCard::enabledChannels() {
01347 unsigned long long channels=0;
01348
01349
01350
01351 channels = (Ncntrl & 0x1ffLL);
01352 channels += (NCcntrl & 0x1ffLL) << 9;
01353 channels += (SCcntrl & 0x1ffLL) << 18;
01354 channels += (Scntrl & 0x1ffLL) << 27;
01355 return ~channels;
01356 }
01357
01358 bool PixelFEDCard::useChannel(unsigned int iChannel){
01359 assert(iChannel>0&&iChannel<37);
01360 return (enabledChannels()>>(iChannel-1))&0x1LL;
01361 }
01362
01363 void PixelFEDCard::setChannel(unsigned int iChannel, bool mode){
01364 assert(iChannel>0&&iChannel<37);
01365 long long mask=enabledChannels();
01366 long long bit=0x1LL<<(iChannel-1);
01367 if (mode) {
01368 mask=mask|bit;
01369 }
01370 else{
01371 bit=~bit;
01372 mask=mask&bit;
01373 }
01374 mask=~mask;
01375 Ncntrl=mask & 0x1ffLL;
01376 mask=mask>>9;
01377 NCcntrl=mask & 0x1ffLL;
01378 mask=mask>>9;
01379 SCcntrl=mask & 0x1ffLL;
01380 mask=mask>>9;
01381 Scntrl=mask & 0x1ffLL;
01382
01383 }
01384
01385 void PixelFEDCard::restoreBaselinAndChannelMasks(){
01386
01387 Ncntrl=Ncntrl_original;
01388 NCcntrl=NCcntrl_original;
01389 SCcntrl=SCcntrl_original;
01390 Scntrl=Scntrl_original;
01391
01392 Nbaseln=Nbaseln_original;
01393 NCbaseln=NCbaseln_original;
01394 SCbaseln=SCbaseln_original;
01395 Sbaseln=Sbaseln_original;
01396
01397
01398 }
01399
01400
01401 void PixelFEDCard::restoreControlAndModeRegister(){
01402
01403 Ccntrl=Ccntrl_original;
01404 modeRegister=modeRegister_original;
01405
01406 }
01407
01408
01409
01410
01411
01412
01413