- Timestamp:
- 06/10/11 09:18:02 (13 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/HeadersFAD.h
r10924 r10973 33 33 enum Commands 34 34 { 35 kCmdWriteExecute = 0x0400, // Configure FAD with the current config ram 36 35 37 kCmdWrite = 0x0500, // write to Config-RAM 36 38 kCmdWriteRoi = kCmdWrite|0x00, // Baseaddress ROI-Values -
trunk/FACT++/src/fad.cc
r10926 r10973 32 32 33 33 double fStartTime; 34 uint32_t fRunNumber;35 34 36 35 void AsyncRead(ba::mutable_buffers_1 buffers) … … 72 71 73 72 FAD::EventHeader fHeader; 73 FAD::EventHeader fRam; 74 74 FAD::ChannelHeader fChHeader[kNumChannels]; 75 76 uint16_t fRamRoi[kNumChannels]; 75 77 76 78 ba::deadline_timer fTriggerSendData; … … 89 91 fHeader.fEventCounter++; 90 92 fHeader.fTimeStamp = uint32_t((Time(Time::utc).UnixTime()-fStartTime)*10000); 91 fHeader.fRunNumber = fRunNumber;92 93 93 94 94 fBuffer.resize(0); … … 228 228 cout << "-> Trigger" << endl; 229 229 SendData(); 230 break; 231 232 case kCmdWriteExecute: 233 cout << "-> Execute" << endl; 234 memcpy(fHeader.fDac, fRam.fDac, sizeof(fHeader.fDac)); 235 for (int i=0; i<kNumChannels; i++) 236 fChHeader[i].fRegionOfInterest = fRamRoi[i]; 237 fHeader.fRunNumber = fRam.fRunNumber; 230 238 break; 231 239 … … 270 278 { 271 279 case kCmdWriteRunNumberMSW: 272 fR unNumber &= 0xffff;273 fR unNumber |= fBufCommand[0]<<16;280 fRam.fRunNumber &= 0xffff; 281 fRam.fRunNumber |= fBufCommand[0]<<16; 274 282 cout << "-> Set RunNumber MSW" << endl; 275 283 break; 276 284 case kCmdWriteRunNumberLSW: 277 fR unNumber &= 0xffff0000;278 fR unNumber |= fBufCommand[0];285 fRam.fRunNumber &= 0xffff0000; 286 fRam.fRunNumber |= fBufCommand[0]; 279 287 cout << "-> Set RunNumber LSW" << endl; 280 288 break; 281 289 case kCmdWriteRoi: 282 290 cout << "-> Set Roi[" << fCommand[1] << "]=" << fBufCommand[0] << endl; 283 fChHeader[fCommand[1]].fRegionOfInterest = fBufCommand[0]; 291 //fChHeader[fCommand[1]].fRegionOfInterest = fBufCommand[0]; 292 fRamRoi[fCommand[1]] = fBufCommand[0]; 284 293 break; 285 294 286 295 case kCmdWriteDac: 287 296 cout << "-> Set Dac[" << fCommand[1] << "]=" << fBufCommand[0] << endl; 288 f Header.fDac[fCommand[1]] = fBufCommand[0];297 fRam.fDac[fCommand[1]] = fBufCommand[0]; 289 298 break; 290 299 } … … 310 319 fTriggerEnabled=false; 311 320 fCommandSocket=true; 312 fRunNumber = 1;313 321 314 322 fHeader.fStartDelimiter = FAD::kDelimiterStart; 315 323 fHeader.fVersion = 0x104; 316 324 fHeader.fBoardId = (fBoardId%10) | ((fBoardId/10)<<8); 325 fHeader.fRunNumber = 1; 317 326 fHeader.fStatus = 0xf<<12 | 318 327 FAD::EventHeader::kDenable | -
trunk/FACT++/src/fadctrl.cc
r10966 r10973 378 378 379 379 PostCmd(FAD::kCmdWriteRate, val);//uint8_t(1000./val/12.5)); 380 PostCmd(FAD::kCmdWriteExecute); 380 381 //PostCmd(kCmdContTriggerRate, uint8_t(80/val)); 381 382 … … 387 388 PostCmd(FAD::kCmdWriteRunNumberLSW, num&0xffff); 388 389 PostCmd(FAD::kCmdWriteRunNumberMSW, num>>16); 390 PostCmd(FAD::kCmdWriteExecute); 389 391 } 390 392 … … 394 396 // Allowed value: [0, MAX_VAL] 395 397 PostCmd(FAD::kCmdWrite + addr, val); 398 PostCmd(FAD::kCmdWriteExecute); 396 399 } 397 400 … … 401 404 return false; 402 405 403 PostCmd(FAD::kCmdWrite Dac + addr, val);406 PostCmd(FAD::kCmdWriteExecute); 404 407 return true; 405 408 } … … 414 417 for (unsigned int i=0; i<=FAD::kMaxRoiAddr; i++) 415 418 PostCmd(FAD::kCmdWriteRoi + i, val); 419 PostCmd(FAD::kCmdWriteExecute); 416 420 return true; 417 421 } … … 421 425 422 426 PostCmd(FAD::kCmdWriteRoi + addr, val); 427 PostCmd(FAD::kCmdWriteExecute); 423 428 return true; 424 429 }
Note:
See TracChangeset
for help on using the changeset viewer.