Changeset 11031
- Timestamp:
- 06/16/11 11:09:52 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fadctrl.cc
r11014 r11031 46 46 bool fIsHexOutput; 47 47 bool fIsDataOutput; 48 bool fBlockTransmission; 48 49 49 50 uint64_t fCounter; … … 304 305 } 305 306 307 public: 306 308 void PostCmd(std::vector<uint16_t> cmd) 307 309 { 310 if (fBlockTransmission) 311 return; 312 308 313 #ifdef DEBUG_TX 309 314 ostringstream msg; … … 320 325 void PostCmd(uint16_t cmd) 321 326 { 327 if (fBlockTransmission) 328 return; 329 322 330 #ifdef DEBUG_TX 323 331 ostringstream msg; … … 332 340 void PostCmd(uint16_t cmd, uint16_t data) 333 341 { 342 if (fBlockTransmission) 343 return; 344 334 345 #ifdef DEBUG_TX 335 346 ostringstream msg; … … 345 356 public: 346 357 ConnectionFAD(ba::io_service& ioservice, MessageImp &imp) : 347 Connection(ioservice, imp()), 348 fIsVerbose(false), fIsHexOutput(false), fIsDataOutput(false), fCounter(0) 358 Connection(ioservice, imp()), 359 fIsVerbose(false), fIsHexOutput(false), fIsDataOutput(false), 360 fBlockTransmission(false), fCounter(0) 349 361 { 350 362 // Maximum possible needed space: … … 508 520 { 509 521 fIsDataOutput = b; 522 } 523 524 void SetBlockTransmission(bool b) 525 { 526 fBlockTransmission = b; 510 527 } 511 528 … … 546 563 for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++) 547 564 i->second.second->Cmd(command); 565 566 return T::GetCurrentState(); 567 } 568 569 int SendCmd(const EventImp &evt) 570 { 571 if (!CheckEventSize(evt.GetSize(), "SendCmd", 4)) 572 return T::kSM_FatalError; 573 574 if (evt.GetUInt()>0xffff) 575 { 576 T::Warn("Command value out of range (0-65535)."); 577 return T::GetCurrentState(); 578 } 579 580 for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++) 581 i->second.second->PostCmd(evt.GetUInt()); 582 583 return T::GetCurrentState(); 584 } 585 586 int SendCmdData(const EventImp &evt) 587 { 588 if (!CheckEventSize(evt.GetSize(), "SendCmdData", 8)) 589 return T::kSM_FatalError; 590 591 const uint32_t *ptr = evt.Ptr<uint32_t>(); 592 593 if (ptr[0]>0xffff) 594 { 595 T::Warn("Command value out of range (0-65535)."); 596 return T::GetCurrentState(); 597 } 598 599 if (ptr[1]>0xffff) 600 { 601 T::Warn("Data value out of range (0-65535)."); 602 return T::GetCurrentState(); 603 } 604 605 for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++) 606 i->second.second->PostCmd(ptr[0], ptr[1]); 548 607 549 608 return T::GetCurrentState(); … … 756 815 for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++) 757 816 i->second.second->SetDataOutput(evt.GetBool()); 817 818 return T::GetCurrentState(); 819 } 820 821 int SetBlockTransmission(const EventImp &evt) 822 { 823 if (!CheckEventSize(evt.GetSize(), "SetBlockTransmission", 5)) 824 return T::kSM_FatalError; 825 826 const int32_t slot = evt.Get<int32_t>(); 827 828 const BoardList::iterator it=fBoards.find(slot); 829 if (it==fBoards.end()) 830 { 831 ostringstream str; 832 str << "Slot " << slot << " not found."; 833 T::Warn(str); 834 return T::GetCurrentState(); 835 } 836 837 it->second.second->SetBlockTransmission(evt.Get<uint8_t>(4)); 758 838 759 839 return T::GetCurrentState(); … … 1054 1134 1055 1135 // FAD Commands 1136 T::AddEvent("SEND_CMD", "I:1") 1137 (boost::bind(&StateMachineFAD::SendCmd, this, _1)) 1138 ("Send a command to the FADs. Values between 0 and 65535 are allowed." 1139 "|command[uint16]:Command to be transmittted."); 1140 T::AddEvent("SEND_DATA", "I:2") 1141 (boost::bind(&StateMachineFAD::SendCmdData, this, _1)) 1142 ("Send a command with data to the FADs. Values between 0 and 65535 are allowed." 1143 "|command[uint16]:Command to be transmittted." 1144 "|data[uint16]:Data to be sent with the command."); 1145 1056 1146 T::AddEvent("ENABLE_SRCLK", "B:1") 1057 1147 (boost::bind(&StateMachineFAD::CmdEnable, this, _1, FAD::kCmdSrclk)) … … 1141 1231 (""); 1142 1232 1233 T::AddEvent("BLOCK_TRANSMISSION", "I:1;B:1") 1234 (boost::bind(&StateMachineFAD::SetBlockTransmission, this, _1)) 1235 ("Blocks the transmission of commands to the given slot. Use with care! For debugging pupose only!" 1236 "|slot[int]:Slot to which the command transmission should be blocked (0-39)" 1237 "|enable[bool]:Whether the command transmission should be blockes (yes) or allowed (no)"); 1238 1143 1239 // Conenction commands 1144 1240 /*
Note:
See TracChangeset
for help on using the changeset viewer.