Changeset 11481 for trunk/FACT++/src/fadctrl.cc
- Timestamp:
- 07/20/11 08:03:38 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fadctrl.cc
r11480 r11481 1 #include <functional> 2 1 3 #include "Dim.h" 2 4 #include "Event.h" … … 1528 1530 // FAD Commands 1529 1531 T::AddEvent("SEND_CMD", "I:1") 1530 (b oost::bind(&StateMachineFAD::SendCmd, this,_1))1532 (bind(&StateMachineFAD::SendCmd, this, placeholders::_1)) 1531 1533 ("Send a command to the FADs. Values between 0 and 0xffff are allowed." 1532 1534 "|command[uint16]:Command to be transmittted."); 1533 1535 T::AddEvent("SEND_DATA", "I:2") 1534 (b oost::bind(&StateMachineFAD::SendCmdData, this,_1))1536 (bind(&StateMachineFAD::SendCmdData, this, placeholders::_1)) 1535 1537 ("Send a command with data to the FADs. Values between 0 and 0xffff are allowed." 1536 1538 "|command[uint16]:Command to be transmittted." … … 1538 1540 1539 1541 T::AddEvent("ENABLE_SRCLK", "B:1") 1540 (b oost::bind(&StateMachineFAD::CmdEnable, this,_1, FAD::kCmdSrclk))1542 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdSrclk)) 1541 1543 ("Set SRCLK"); 1542 1544 T::AddEvent("ENABLE_BUSY", "B:1") 1543 (b oost::bind(&StateMachineFAD::CmdEnable, this,_1, FAD::kCmdBusy))1545 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdBusy)) 1544 1546 ("Set BUSY"); 1545 1547 T::AddEvent("ENABLE_SCLK", "B:1") 1546 (b oost::bind(&StateMachineFAD::CmdEnable, this,_1, FAD::kCmdSclk))1548 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdSclk)) 1547 1549 ("Set SCLK"); 1548 1550 T::AddEvent("ENABLE_DRS", "B:1") 1549 (b oost::bind(&StateMachineFAD::CmdEnable, this,_1, FAD::kCmdDrsEnable))1551 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdDrsEnable)) 1550 1552 ("Switch Domino wave"); 1551 1553 T::AddEvent("ENABLE_DWRITE", "B:1") 1552 (b oost::bind(&StateMachineFAD::CmdEnable, this,_1, FAD::kCmdDwrite))1554 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdDwrite)) 1553 1555 ("Set Dwrite (possibly high / always low)"); 1554 1556 T::AddEvent("ENABLE_CONTINOUS_TRIGGER", "B:1") 1555 (b oost::bind(&StateMachineFAD::CmdEnable, this,_1, FAD::kCmdContTrigger))1557 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdContTrigger)) 1556 1558 ("Enable continous (internal) trigger."); 1557 1559 T::AddEvent("ENABLE_TRIGGER_LINE", "B:1") 1558 (b oost::bind(&StateMachineFAD::CmdEnable, this,_1, FAD::kCmdTriggerLine))1560 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdTriggerLine)) 1559 1561 ("Incoming triggers can be accepted/will not be accepted"); 1560 1562 T::AddEvent("ENABLE_COMMAND_SOCKET_MODE", "B:1") 1561 (b oost::bind(&StateMachineFAD::CmdEnable, this,_1, FAD::kCmdSocket))1563 (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdSocket)) 1562 1564 ("Set debug mode (yes: dump events through command socket, no=dump events through other sockets)"); 1563 1565 1564 1566 T::AddEvent("SET_TRIGGER_RATE", "I:1") 1565 (b oost::bind(&StateMachineFAD::SetTriggerRate, this,_1))1567 (bind(&StateMachineFAD::SetTriggerRate, this, placeholders::_1)) 1566 1568 ("Enable continous trigger"); 1567 1569 T::AddEvent("SEND_SINGLE_TRIGGER") 1568 (b oost::bind(&StateMachineFAD::Trigger, this, 1))1570 (bind(&StateMachineFAD::Trigger, this, 1)) 1569 1571 ("Issue software triggers"); 1570 1572 T::AddEvent("SEND_N_TRIGGERS", "I") 1571 (b oost::bind(&StateMachineFAD::SendTriggers, this,_1))1573 (bind(&StateMachineFAD::SendTriggers, this, placeholders::_1)) 1572 1574 ("Issue software triggers"); 1573 1575 T::AddEvent("START_RUN", "") 1574 (b oost::bind(&StateMachineFAD::StartRun, this,_1, true))1576 (bind(&StateMachineFAD::StartRun, this, placeholders::_1, true)) 1575 1577 ("Set FAD DAQ mode. when started, no configurations must be send."); 1576 1578 T::AddEvent("STOP_RUN") 1577 (b oost::bind(&StateMachineFAD::StartRun, this,_1, false))1579 (bind(&StateMachineFAD::StartRun, this, placeholders::_1, false)) 1578 1580 (""); 1579 1581 T::AddEvent("PHASE_SHIFT", "S:1") 1580 (b oost::bind(&StateMachineFAD::PhaseShift, this,_1))1582 (bind(&StateMachineFAD::PhaseShift, this, placeholders::_1)) 1581 1583 ("Adjust ADC phase (in 'steps')"); 1582 1584 1583 1585 T::AddEvent("RESET_EVENT_COUNTER") 1584 (b oost::bind(&StateMachineFAD::Cmd, this, FAD::kCmdResetEventCounter))1586 (bind(&StateMachineFAD::Cmd, this, FAD::kCmdResetEventCounter)) 1585 1587 (""); 1586 1588 1587 1589 T::AddEvent("SET_RUN_NUMBER", "X:1") 1588 (b oost::bind(&StateMachineFAD::SetRunNumber, this,_1))1590 (bind(&StateMachineFAD::SetRunNumber, this, placeholders::_1)) 1589 1591 (""); 1590 1592 1591 1593 T::AddEvent("SET_MAX_MEMORY", "S:1") 1592 (b oost::bind(&StateMachineFAD::SetMaxMemoryBuffer, this,_1))1594 (bind(&StateMachineFAD::SetMaxMemoryBuffer, this, placeholders::_1)) 1593 1595 ("Set maximum memory buffer size allowed to be consumed by the EventBuilder to buffer events." 1594 1596 "|memory[short]:Buffer size in Mega-bytes."); 1595 1597 1596 1598 T::AddEvent("SET_REGISTER", "I:2") 1597 (b oost::bind(&StateMachineFAD::SetRegister, this,_1))1599 (bind(&StateMachineFAD::SetRegister, this, placeholders::_1)) 1598 1600 ("set register to value" 1599 1601 "|addr[short]:Address of register" … … 1602 1604 // FIXME: Maybe add a mask which channels should be set? 1603 1605 T::AddEvent("SET_REGION_OF_INTEREST", "I:2") 1604 (b oost::bind(&StateMachineFAD::SetRoi, this,_1))1606 (bind(&StateMachineFAD::SetRoi, this, placeholders::_1)) 1605 1607 ("Set region-of-interest to value" 1606 1608 "|addr[short]:Address of register" … … 1609 1611 // FIXME: Maybe add a mask which channels should be set? 1610 1612 T::AddEvent("SET_DAC_VALUE", "I:2") 1611 (b oost::bind(&StateMachineFAD::SetDac, this,_1))1613 (bind(&StateMachineFAD::SetDac, this, placeholders::_1)) 1612 1614 ("Set DAC numbers in range to value" 1613 1615 "|addr[short]:Address of register (-1 for all)" … … 1615 1617 1616 1618 T::AddEvent("CONFIGURE", "C", FAD::kConnected, FAD::kConfigured) 1617 (b oost::bind(&StateMachineFAD::StartConfigure, this,_1))1619 (bind(&StateMachineFAD::StartConfigure, this, placeholders::_1)) 1618 1620 (""); 1619 1621 1620 1622 T::AddEvent("RESET_CONFIGURE", FAD::kConfiguring, FAD::kConfigured) 1621 (b oost::bind(&StateMachineFAD::ResetConfig, this))1623 (bind(&StateMachineFAD::ResetConfig, this)) 1622 1624 (""); 1623 1625 1624 1626 // Verbosity commands 1625 1627 T::AddEvent("SET_VERBOSE", "B:1") 1626 (b oost::bind(&StateMachineFAD::SetVerbosity, this,_1))1628 (bind(&StateMachineFAD::SetVerbosity, this, placeholders::_1)) 1627 1629 ("Set verbosity state" 1628 1630 "|verbosity[bool]:disable or enable verbosity for received data (yes/no), except dynamic data"); 1629 1631 1630 1632 T::AddEvent("SET_HEX_OUTPUT", "B:1") 1631 (b oost::bind(&StateMachineFAD::SetHexOutput, this,_1))1633 (bind(&StateMachineFAD::SetHexOutput, this, placeholders::_1)) 1632 1634 ("Enable or disable hex output for received data" 1633 1635 "|hexout[bool]:disable or enable hex output for received data (yes/no)"); 1634 1636 1635 1637 T::AddEvent("SET_DATA_OUTPUT", "B:1") 1636 (b oost::bind(&StateMachineFAD::SetDataOutput, this,_1))1638 (bind(&StateMachineFAD::SetDataOutput, this, placeholders::_1)) 1637 1639 (""); 1638 1640 1639 1641 T::AddEvent("SET_DEBUG_TX", "B:1") 1640 (b oost::bind(&StateMachineFAD::SetDebugTx, this,_1))1642 (bind(&StateMachineFAD::SetDebugTx, this, placeholders::_1)) 1641 1643 ("Enable or disable the output of messages in case of successfull data transmission to the boards." 1642 1644 "|debug[bool]:disable or enable debug output for transmitted data (yes/no)"); 1643 1645 1644 1646 T::AddEvent("SET_DEBUG_EVENT_BUILDER_OUT", "B:1") 1645 (b oost::bind(&StateMachineFAD::SetDebugEb, this,_1))1647 (bind(&StateMachineFAD::SetDebugEb, this, placeholders::_1)) 1646 1648 (""); 1647 1649 1648 1650 T::AddEvent("PRINT_EVENT", "S:1") 1649 (b oost::bind(&StateMachineFAD::PrintEvent, this,_1))1651 (bind(&StateMachineFAD::PrintEvent, this, placeholders::_1)) 1650 1652 ("Print (last) event" 1651 1653 "|board[short]:slot from which the event should be printed (-1 for all)"); 1652 1654 1653 1655 T::AddEvent("DUMP_STREAM", "B:1") 1654 (b oost::bind(&StateMachineFAD::SetDumpStream, this,_1))1656 (bind(&StateMachineFAD::SetDumpStream, this, placeholders::_1)) 1655 1657 ("For debugging purpose: the binary data stream read from the sockets 0-7 can be dumped to files." 1656 1658 "|switch[bool]:Enable (yes) or disable (no)"); 1657 1659 1658 1660 T::AddEvent("DUMP_RECV", "B:1") 1659 (b oost::bind(&StateMachineFAD::SetDumpRecv, this,_1))1661 (bind(&StateMachineFAD::SetDumpRecv, this, placeholders::_1)) 1660 1662 ("For debugging purpose: the times when data has been receives are dumped to a file." 1661 1663 "|switch[bool]:Enable (yes) or disable (no)"); 1662 1664 1663 1665 T::AddEvent("BLOCK_TRANSMISSION", "S:1;B:1") 1664 (b oost::bind(&StateMachineFAD::SetBlockTransmission, this,_1))1666 (bind(&StateMachineFAD::SetBlockTransmission, this, placeholders::_1)) 1665 1667 ("Blocks the transmission of commands to the given slot. Use with care! For debugging pupose only!" 1666 1668 "|slot[short]:Slot to which the command transmission should be blocked (0-39)" … … 1668 1670 1669 1671 T::AddEvent("BLOCK_TRANSMISSION_RANGE", "S:2;B:1") 1670 (b oost::bind(&StateMachineFAD::SetBlockTransmissionRange, this,_1))1672 (bind(&StateMachineFAD::SetBlockTransmissionRange, this, placeholders::_1)) 1671 1673 ("Blocks the transmission of commands to the given range of slots. Use with care! For debugging pupose only!" 1672 1674 "|first[short]:First slot to which the command transmission should be blocked (0-39)" … … 1675 1677 1676 1678 T::AddEvent("IGNORE_EVENTS", "S:1;B:1") 1677 (b oost::bind(&StateMachineFAD::SetIgnoreSlot, this,_1))1679 (bind(&StateMachineFAD::SetIgnoreSlot, this, placeholders::_1)) 1678 1680 ("Instructs the event-builder to ignore events from the given slot but still read the data from the socket." 1679 1681 "|slot[short]:Slot from which the data should be ignored when building events" … … 1681 1683 1682 1684 T::AddEvent("IGNORE_EVENTS_RANGE", "S:2;B:1") 1683 (b oost::bind(&StateMachineFAD::SetIgnoreSlots, this,_1))1685 (bind(&StateMachineFAD::SetIgnoreSlots, this, placeholders::_1)) 1684 1686 ("Instructs the event-builder to ignore events from the given slot but still read the data from the socket." 1685 1687 "|first[short]:First slot from which the data should be ignored when building events" … … 1688 1690 1689 1691 T::AddEvent("CLOSE_OPEN_FILES", FAD::kConnecting, FAD::kConnected) 1690 (b oost::bind(&StateMachineFAD::CloseOpenFiles, this))1692 (bind(&StateMachineFAD::CloseOpenFiles, this)) 1691 1693 ("Close all run files opened by the EventBuilder."); 1692 1694 1693 1695 T::AddEvent("TEST", "S:1") 1694 (b oost::bind(&StateMachineFAD::Test, this,_1))1696 (bind(&StateMachineFAD::Test, this, placeholders::_1)) 1695 1697 (""); 1696 1698 … … 1699 1701 // Conenction commands 1700 1702 T::AddEvent("START", FAD::kOffline) 1701 (b oost::bind(&StateMachineFAD::StartConnection, this))1703 (bind(&StateMachineFAD::StartConnection, this)) 1702 1704 ("Start EventBuilder thread and connect all valid slots."); 1703 1705 1704 1706 T::AddEvent("STOP", FAD::kDisconnected, FAD::kConnecting, FAD::kConnected) 1705 (b oost::bind(&StateMachineFAD::StopConnection, this))1707 (bind(&StateMachineFAD::StopConnection, this)) 1706 1708 ("Stop EventBuilder thread (still write buffered events) and disconnect all slots."); 1707 1709 1708 1710 T::AddEvent("ABORT", FAD::kDisconnected, FAD::kConnecting, FAD::kConnected) 1709 (b oost::bind(&StateMachineFAD::AbortConnection, this))1711 (bind(&StateMachineFAD::AbortConnection, this)) 1710 1712 ("Immediately abort EventBuilder thread and disconnect all slots."); 1711 1713 1712 1714 T::AddEvent("SOFT_RESET", FAD::kConnected) 1713 (b oost::bind(&StateMachineFAD::Reset, this, true))1715 (bind(&StateMachineFAD::Reset, this, true)) 1714 1716 ("Wait for buffers to drain, close all files and reinitialize event builder thread."); 1715 1717 1716 1718 T::AddEvent("HARD_RESET", FAD::kConnected) 1717 (b oost::bind(&StateMachineFAD::Reset, this, false))1719 (bind(&StateMachineFAD::Reset, this, false)) 1718 1720 ("Free all buffers, close all files and reinitialize event builder thread."); 1719 1721 1720 1722 T::AddEvent("CONNECT", "S:1", FAD::kDisconnected, FAD::kConnecting, FAD::kConnected) 1721 (b oost::bind(&StateMachineFAD::EnableSlot, this,_1, true))1723 (bind(&StateMachineFAD::EnableSlot, this, placeholders::_1, true)) 1722 1724 ("Connect a disconnected slot."); 1723 1725 1724 1726 T::AddEvent("DISCONNECT", "S:1", FAD::kConnecting, FAD::kConnected) 1725 (b oost::bind(&StateMachineFAD::EnableSlot, this,_1, false))1727 (bind(&StateMachineFAD::EnableSlot, this, placeholders::_1, false)) 1726 1728 ("Disconnect a connected slot."); 1727 1729 1728 1730 T::AddEvent("TOGGLE", "S:1", FAD::kDisconnected, FAD::kConnecting, FAD::kConnected) 1729 (b oost::bind(&StateMachineFAD::ToggleSlot, this,_1))1731 (bind(&StateMachineFAD::ToggleSlot, this, placeholders::_1)) 1730 1732 (""); 1731 1733 1732 1734 T::AddEvent("SET_FILE_FORMAT", "S:1") 1733 (b oost::bind(&StateMachineFAD::SetFileFormat, this,_1))1735 (bind(&StateMachineFAD::SetFileFormat, this, placeholders::_1)) 1734 1736 (""); 1735 1737 1736 1738 1737 1739 T::AddEvent("ADD_ADDRESS", "C", FAD::kOffline) 1738 (b oost::bind(&StateMachineFAD::AddAddress, this,_1))1740 (bind(&StateMachineFAD::AddAddress, this, placeholders::_1)) 1739 1741 ("Add the address of a DRS4 board to the first free slot" 1740 1742 "|IP[string]:address in the format <address:port>"); 1741 1743 T::AddEvent("REMOVE_SLOT", "S:1", FAD::kOffline) 1742 (b oost::bind(&StateMachineFAD::RemoveSlot, this,_1))1744 (bind(&StateMachineFAD::RemoveSlot, this, placeholders::_1)) 1743 1745 ("Remove the Iaddress in slot n. For a list see LIST" 1744 1746 "|slot[short]:Remove the address in slot n from the list"); 1745 1747 T::AddEvent("LIST_SLOTS") 1746 (b oost::bind(&StateMachineFAD::ListSlots, this))1748 (bind(&StateMachineFAD::ListSlots, this)) 1747 1749 ("Print a list of all available board addressesa and whether they are enabled"); 1748 1750 } … … 2023 2025 shell.SetReceiver(io_service); 2024 2026 2025 boost::thread t(b oost::bind(RunThread, &io_service));2026 //boost::thread t(b oost::bind(&StateMachineFAD<S>::Run, &io_service));2027 boost::thread t(bind(RunThread, &io_service)); 2028 //boost::thread t(bind(&StateMachineFAD<S>::Run, &io_service)); 2027 2029 2028 2030 if (conf.Has("cmd"))
Note:
See TracChangeset
for help on using the changeset viewer.