Changeset 11102 for trunk/FACT++/src
- Timestamp:
- 06/22/11 13:20:05 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/FACT++/src/ftmctrl.cc ¶
r11058 r11102 898 898 } 899 899 900 bool SetClockRegister(const uint64_t reg[]) 901 { 902 for (int i=0; i<8; i++) 903 { 904 if (reg[i]>0xffffffff) 905 return false; 906 907 fStaticData.fClockConditioner[i] = reg[i]; 908 } 909 910 CmdSendStatDat(); 911 912 return true; 913 } 914 900 915 bool EnablePixel(int16_t idx, bool enable) 901 916 { … … 1390 1405 } 1391 1406 1407 int SetClockRegister(const EventImp &evt) 1408 { 1409 if (!CheckEventSize(evt.GetSize(), "SetClockRegister", 8*16)) 1410 return T::kSM_FatalError; 1411 1412 const uint64_t *reg = evt.Ptr<uint64_t>(); 1413 1414 if (!fFTM.SetClockRegister(reg)) 1415 T::Warn("SetClockRegister - Value out of range."); 1416 1417 return T::GetCurrentState(); 1418 } 1419 1420 //map<uint32_t, uint32_t> fClockConditionerMap; 1421 1422 int SetClockFrequency(const EventImp &evt) 1423 { 1424 if (!CheckEventSize(evt.GetSize(), "SetClockFrequency", 4)) 1425 return T::kSM_FatalError; 1426 1427 const uint32_t freq = evt.GetUInt(); 1428 1429 //map<uint32_t,uint32_t>::const_iterator = fClockConditionerMap.find(freq); 1430 1431 static const uint64_t R1 = 0x00010101; 1432 static const uint64_t R8 = 0x10000908; 1433 static const uint64_t R9 = 0xa0032a09; 1434 static const uint64_t R11 = 0x0082000b; 1435 static const uint64_t R13 = 0x020a000d; 1436 1437 static const uint64_t freq0700[8] = { 0x0003e000, R1, R8, R9, R11, R13, 0x0830400e, 0x1400f50f }; 1438 static const uint64_t freq1000[8] = { 0x0003a000, R1, R8, R9, R11, R13, 0x0830400e, 0x1400fa0f }; 1439 static const uint64_t freq2000[8] = { 0x00035000, R1, R8, R9, R11, R13, 0x0830400e, 0x1400fa0f }; 1440 static const uint64_t freq3000[8] = { 0x00037200, R1, R8, R9, R11, R13, 0x0830400e, 0x1420a30f }; 1441 static const uint64_t freq4000[8] = { 0x00032800, R1, R8, R9, R11, R13, 0x0830400e, 0x1400fa0f }; 1442 static const uint64_t freq5000[8] = { 0x00032000, R1, R8, R9, R11, R13, 0x0830400e, 0x1400fa0f }; 1443 1444 const uint64_t *reg = 0; 1445 1446 switch (freq) 1447 { 1448 case 700: reg = freq0700; break; 1449 case 1000: reg = freq1000; break; 1450 case 2000: reg = freq2000; break; 1451 case 3000: reg = freq3000; break; 1452 case 4000: reg = freq4000; break; 1453 case 5000: reg = freq5000; break; 1454 default: 1455 T::Warn("SetClockFrequency - Frequency not supported."); 1456 return T::GetCurrentState(); 1457 } 1458 1459 if (!fFTM.SetClockRegister(reg)) 1460 T::Warn("SetClockFrequency - Register values out of range."); 1461 1462 return T::GetCurrentState(); 1463 } 1392 1464 1393 1465 int Enable(const EventImp &evt, FTM::StaticData::GeneralSettings type) … … 1694 1766 (boost::bind(&StateMachineFTM::SetCalibWindow, this, _1)) 1695 1767 (""); 1768 1769 AddEvent("SET_CLOCK_FREQUENCY", "I:1", kStateIdle) 1770 (boost::bind(&StateMachineFTM::SetClockFrequency, this, _1)) 1771 (""); 1772 1773 AddEvent("SET_CLOCK_REGISTER", "X:8", kStateIdle) 1774 (boost::bind(&StateMachineFTM::SetClockRegister, this, _1)) 1775 (""); 1776 1777 1696 1778 1697 1779 AddEvent("RESET_CRATE", "S:1", kStateIdle)
Note:
See TracChangeset
for help on using the changeset viewer.