Changeset 11519
- Timestamp:
- 07/21/11 17:36:51 (13 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/HeadersFTM.h
r11469 r11519 52 52 kCmdCrateReset = 0x0020, ///< Reboot (no power cycle) all FTUs and FADs of one crate 53 53 kCmdDisableReports = 0x0040, ///< Disable transmission of rate-reports (dynamic data) 54 kCmdConfigFTU = 0x0080, ///< Configure single FTU board 54 55 kCmdToggleLed = 0xc000, 55 56 … … 260 261 bool IsEnabled(GeneralSettings type) const { return fGeneralSettings&uint16_t(type); } 261 262 262 voidEnablePixel(int idx, bool enable)263 uint16_t *EnablePixel(int idx, bool enable) 263 264 { 264 265 const int pixel = idx%9; … … 272 273 else 273 274 pix &= ~(1<<pixel); 275 276 return &pix; 274 277 } 275 278 -
trunk/FACT++/src/ftmctrl.cc
r11483 r11519 554 554 PostCmd(data, FTM::kCmdWrite, FTM::kCmdRegister); 555 555 556 fBufStaticData.clear();556 reinterpret_cast<uint16_t*>(&fBufStaticData)[addr] = val; 557 557 558 558 // Request the changed configuration to ensure the … … 600 600 } 601 601 602 602 603 void SetVerbose(bool b) 603 604 { … … 670 671 return false; 671 672 672 FTM::StaticData data(fStaticData);673 674 673 if (patch<0) 675 674 { 675 FTM::StaticData data(fStaticData); 676 676 677 bool ident = true; 677 678 for (int i=0; i<160; i++) … … 687 688 for (int i=0; i<160; i++) 688 689 data[i/4].fDAC[i%4] = value; 689 } 690 else 691 { 692 if (data[patch/4].fDAC[patch%4] == value) 693 return true; 694 695 data[patch/4].fDAC[patch%4] = value; 696 } 697 698 // Maybe move to a "COMMIT" command? 699 CmdSendStatDat(data); 690 691 // Maybe move to a "COMMIT" command? 692 CmdSendStatDat(data); 693 694 return true; 695 } 696 697 /* 698 if (data[patch/4].fDAC[patch%4] == value) 699 return true; 700 701 data[patch/4].fDAC[patch%4] = value; 702 703 CmdSendStatDat(data); 704 return true; 705 */ 706 707 // Calculate offset in static data block 708 const uint16_t addr = (uintptr_t(&fStaticData[patch/4].fDAC[patch%4])-uintptr_t(&fStaticData))/2; 709 710 // From CmdSetRegister 711 const array<uint16_t, 2> data = {{ addr, uint16_t(value) }}; 712 PostCmd(data, FTM::kCmdWrite, FTM::kCmdRegister); 713 714 reinterpret_cast<uint16_t*>(&fBufStaticData)[addr] = value; 715 716 // Now execute change before the static data is requested back 717 PostCmd(FTM::kCmdConfigFTU, (patch/40) | (((patch/4)%10)<<8)); 718 719 CmdGetRegister(addr); 720 //CmdReqStatDat(); 700 721 701 722 return true; … … 939 960 return false; 940 961 941 FTM::StaticData data(fStaticData);942 943 962 if (idx==-1) 963 { 964 FTM::StaticData data(fStaticData); 965 944 966 for (int i=0; i<=FTM::StaticData::kMaxPixelIdx; i++) 945 967 data.EnablePixel(i, enable); 946 else 947 data.EnablePixel(idx, enable); 948 949 CmdSendStatDat(data); 968 969 CmdSendStatDat(data); 970 971 return true; 972 } 973 974 /* 975 data.EnablePixel(idx, enable); 976 CmdSendStatDat(data); 977 return true; 978 */ 979 980 FTM::StaticData data(fStaticData); 981 982 const uintptr_t base = uintptr_t(&data); 983 const uint16_t *mem = data.EnablePixel(idx, enable); 984 985 // Calculate offset in static data block 986 const uint16_t addr = (uintptr_t(mem)-base)/2; 987 988 // From CmdSetRegister 989 const array<uint16_t, 2> cmd = {{ addr, *mem }}; 990 PostCmd(cmd, FTM::kCmdWrite, FTM::kCmdRegister); 991 992 reinterpret_cast<uint16_t*>(&fBufStaticData)[addr] = *mem; 993 994 // Now execute change before the static data is requested back 995 PostCmd(FTM::kCmdConfigFTU, (idx/360) | (((idx/36)%10)<<8)); 996 997 // Now request the register back to ensure consistency 998 CmdGetRegister(addr); 999 //CmdReqStatDat(); 950 1000 951 1001 return true; … … 1776 1826 "|status[bool]:disable or enable that the FTM sends rate reports (yes/no)"); 1777 1827 1778 T::AddEvent("SET_THRESHOLD", "I:2", FTM::kIdle)1828 T::AddEvent("SET_THRESHOLD", "I:2", FTM::kIdle, FTM::kTakingData) 1779 1829 (bind(&StateMachineFTM::SetThreshold, this, placeholders::_1)) 1780 1830 ("Set the comparator threshold" … … 1793 1843 "|Enable[bool]:Whether FTU should be enabled or disabled (yes/no)"); 1794 1844 1795 T::AddEvent("DISABLE_PIXEL", "S:1", FTM::kIdle )1845 T::AddEvent("DISABLE_PIXEL", "S:1", FTM::kIdle, FTM::kTakingData) 1796 1846 (bind(&StateMachineFTM::EnablePixel, this, placeholders::_1, false)) 1797 1847 ("(-1 or all)"); 1798 1848 1799 T::AddEvent("ENABLE_PIXEL", "S:1", FTM::kIdle )1849 T::AddEvent("ENABLE_PIXEL", "S:1", FTM::kIdle, FTM::kTakingData) 1800 1850 (bind(&StateMachineFTM::EnablePixel, this, placeholders::_1, true)) 1801 1851 ("(-1 or all)");
Note:
See TracChangeset
for help on using the changeset viewer.