Changeset 11777 for trunk/FACT++
- Timestamp:
- 08/04/11 20:07:06 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/ftmctrl.cc
r11763 r11777 708 708 709 709 /* 710 if (data[patch/4].fDAC[patch%4] == value) 711 return true; 712 */ 713 714 // Calculate offset in static data block 715 const uint16_t addr = (uintptr_t(&fStaticData[patch/4].fDAC[patch%4])-uintptr_t(&fStaticData))/2; 716 717 // From CmdSetRegister 718 const array<uint16_t, 2> data = {{ addr, uint16_t(value) }}; 719 PostCmd(data, FTM::kCmdWrite, FTM::kCmdRegister); 720 721 reinterpret_cast<uint16_t*>(&fBufStaticData)[addr] = value; 722 723 // Now execute change before the static data is requested back 724 PostCmd(FTM::kCmdConfigFTU, (patch/40) | (((patch/4)%10)<<8)); 725 726 //CmdGetRegister(addr); 727 CmdReqStatDat(); 728 729 return true; 730 } 731 732 bool SetNoutof4(int32_t patch, int32_t value) 733 { 734 if (patch>=FTM::StaticData::kMaxMultiplicity) 735 return false; 736 737 if (value<0 || value>FTM::StaticData::kMaxDAC) 738 return false; 739 740 if (patch<0) 741 { 742 FTM::StaticData data(fStaticData); 743 744 bool ident = true; 745 for (int i=0; i<FTM::StaticData::kMaxMultiplicity; i++) 746 if (data[i].fDAC[4] != value) 747 { 748 ident = false; 749 break; 750 } 751 752 if (ident) 753 return true; 754 755 for (int i=0; i<=FTM::StaticData::kMaxMultiplicity; i++) 756 data[i].fDAC[4] = value; 757 758 // Maybe move to a "COMMIT" command? 759 CmdSendStatDat(data); 760 761 return true; 762 } 763 764 /* 710 765 if (data[patch/4].fDAC[patch%4] == value) 711 766 return true; … … 718 773 719 774 // Calculate offset in static data block 720 const uint16_t addr = (uintptr_t(&fStaticData[patch /4].fDAC[patch%4])-uintptr_t(&fStaticData))/2;775 const uint16_t addr = (uintptr_t(&fStaticData[patch].fDAC[4])-uintptr_t(&fStaticData))/2; 721 776 722 777 // From CmdSetRegister … … 1425 1480 } 1426 1481 1482 int SetNoutof4(const EventImp &evt) 1483 { 1484 if (!CheckEventSize(evt.GetSize(), "SetNoutof4", 8)) 1485 return T::kSM_FatalError; 1486 1487 const int32_t *data = evt.Ptr<int32_t>(); 1488 1489 if (!fFTM.SetNoutof4(data[0], data[1])) 1490 T::Warn("SetNoutof4 - Maximum allowed board number 39, valid value range 0-0xffff"); 1491 1492 return T::GetCurrentState(); 1493 } 1494 1427 1495 int EnableFTU(const EventImp &evt) 1428 1496 { … … 1921 1989 "|status[bool]:disable or enable that the FTM sends rate reports (yes/no)"); 1922 1990 1923 T::AddEvent("SET_THRESHOLD", "I:2", FTM::kIdle, FTM::kTakingData)1991 T::AddEvent("SET_THRESHOLD", "I:2", FTM::kIdle, FTM::kTakingData) 1924 1992 (bind(&StateMachineFTM::SetThreshold, this, placeholders::_1)) 1925 1993 ("Set the comparator threshold" 1926 1994 "|Patch[idx]:Index of the patch (0-159), -1 for all" 1995 "|Threshold[counts]:Threshold to be set in binary counts"); 1996 1997 T::AddEvent("SET_N_OUT_OF_4", "I:2", FTM::kIdle, FTM::kTakingData) 1998 (bind(&StateMachineFTM::SetNoutof4, this, placeholders::_1)) 1999 ("Set the comparator threshold" 2000 "|Board[idx]:Index of the board (0-39), -1 for all" 1927 2001 "|Threshold[counts]:Threshold to be set in binary counts"); 1928 2002 … … 2065 2139 // A new configure will first stop the FTM this means 2066 2140 // we can allow it in idle _and_ taking data 2067 T::AddEvent("CONFIGURE", "C", FTM::kIdle, FTM::k TakingData)2141 T::AddEvent("CONFIGURE", "C", FTM::kIdle, FTM::kConfiguring1, FTM::kConfiguring2, FTM::kConfigured, FTM::kTakingData) 2068 2142 (bind(&StateMachineFTM::ConfigureFTM, this, placeholders::_1)) 2069 2143 (""); … … 2262 2336 !CheckConfigVal<uint16_t>(conf, data.kMaxIntensity, "light-pulser.external.intensity.", *it) || 2263 2337 !CheckConfigVal<uint16_t>(conf, data.kMaxIntensity, "light-pulser.internal.intensity.", *it) || 2264 !CheckConfigVal<uint16_t>(conf, data.kMaxDAC, "trigger.threshold.p ixel.", *it) ||2265 !CheckConfigVal<uint16_t>(conf, data.kMaxDAC, "trigger.threshold. patch.",*it) ||2338 !CheckConfigVal<uint16_t>(conf, data.kMaxDAC, "trigger.threshold.patch.", *it) || 2339 !CheckConfigVal<uint16_t>(conf, data.kMaxDAC, "trigger.threshold.logic.", *it) || 2266 2340 0) 2267 2341 return 2; … … 2336 2410 } 2337 2411 2338 const uint16_t th0 = conf.GetDef<uint16_t>("trigger.threshold.p ixel.", *it);2339 const uint16_t th1 = conf.GetDef<uint16_t>("trigger.threshold. patch.", *it);2412 const uint16_t th0 = conf.GetDef<uint16_t>("trigger.threshold.patch.", *it); 2413 const uint16_t th1 = conf.GetDef<uint16_t>("trigger.threshold.logic.", *it); 2340 2414 2341 2415 for (int i=0; i<40; i++) … … 2433 2507 ("trigger.disable-pixel.*", vars<uint16_t>(), "") 2434 2508 ("trigger.disable-patch.*", vars<uint16_t>(), "") 2435 ("trigger.threshold.pixel.*", var<uint16_t>(), "")2436 2509 ("trigger.threshold.patch.*", var<uint16_t>(), "") 2510 ("trigger.threshold.logic.*", var<uint16_t>(), "") 2437 2511 ("ftu-report-interval.*", var<uint16_t>(), "") 2438 2512 ("light-pulser.external.enable-group1.*", var<bool>(), "Enable LED group 1 of external light pulser")
Note:
See TracChangeset
for help on using the changeset viewer.