Changeset 16771
- Timestamp:
- 06/08/13 12:25:58 (12 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/HeadersFTM.h
r15106 r16771 36 36 enum StateMachine 37 37 { 38 kDisconnected = 1, //= ConnectionFTM::kDisconnected, 39 kConnected, //= ConnectionFTM::kConnected, 40 kIdle, //= ConnectionFTM::kIdle, 41 kTriggerOn, //= ConnectionFTM::kTriggerOn, 38 kDisconnected = 1, 39 kConnected, 40 kIdle, 41 kValid, 42 kTriggerOn, 42 43 kConfiguring1, 43 44 kConfiguring2, … … 261 262 return memcmp(this, &d, sizeof(StaticData))==0; 262 263 } 264 265 bool valid() const { static StaticData empty; return memcmp(this, &empty, sizeof(FTM::StaticData))!=0; } 263 266 264 267 void clear() { reset(*this); } -
trunk/FACT++/src/ftmctrl.cc
r16732 r16771 51 51 FTM::Header fHeader; 52 52 FTM::FtuList fFtuList; 53 FTM::StaticData fStaticData; 53 FTM::StaticData fStaticData; // fStaticBufferTx 54 54 FTM::DynamicData fDynamicData; 55 55 FTM::Error fError; 56 56 57 FTM::StaticData fBufStaticData; 57 FTM::StaticData fBufStaticData; // fStaticBufferRx 58 58 59 59 virtual void UpdateFirstHeader() … … 314 314 315 315 fStaticData = fBuffer; 316 317 // is this the first received static data block? 318 if (!fBufStaticData.valid()) 319 fBufStaticData = fStaticData; 320 316 321 UpdateStaticData(); 317 322 break; … … 670 675 if (patch<0) 671 676 { 672 FTM::StaticData data(f StaticData);677 FTM::StaticData data(fBufStaticData); 673 678 674 679 bool ident = true; … … 714 719 return true; 715 720 } 721 /* 722 bool SetSelectedThresholds(const int32_t *th) 723 { 724 for (int i=0; i<FTM::StaticData::kMaxPatchIdx; i++) 725 if (th[i]<0 || th[i]>FTM::StaticData::kMaxDAC) 726 return false; 727 728 FTM::StaticData data(fBufStaticData); 729 730 for (int i=0; i<=FTM::StaticData::kMaxPatchIdx; i++) 731 { 732 if (fBufStaticData[i/4].fDac[i%4]!=th[i]) 733 { 734 735 // Calculate offset in static data block 736 const uint16_t addr = (uintptr_t(&fStaticData[i/4].fDAC[i%4])-uintptr_t(&fStaticData))/2; 737 738 // From CmdSetRegister 739 const array<uint16_t, 2> data = {{ addr, uint16_t(th[i]) }}; 740 PostCmd(data, FTM::kCmdWrite, FTM::kCmdRegister); 741 742 reinterpret_cast<uint16_t*>(&fBufStaticData)[addr] = th[i]; 743 } 744 } 745 746 // Now execute change before the static data is requested back 747 PostCmd(FTM::kCmdConfigFTU, (patch/40) | (((patch/4)%10)<<8)); 748 749 //CmdGetRegister(addr); 750 CmdReqStatDat(); 751 752 return true; 753 }*/ 754 755 756 bool SetAllThresholds(const int32_t *th) 757 { 758 for (int i=0; i<FTM::StaticData::kMaxPatchIdx; i++) 759 if (th[i]<0 || th[i]>FTM::StaticData::kMaxDAC) 760 return false; 761 762 FTM::StaticData data(fBufStaticData); 763 764 for (int i=0; i<=FTM::StaticData::kMaxPatchIdx; i++) 765 data[i/4].fDAC[i%4] = th[i]; 766 767 CmdSendStatDat(data); 768 769 return true; 770 } 716 771 717 772 bool SetNoutof4(int32_t patch, int32_t value) … … 725 780 if (patch<0) 726 781 { 727 FTM::StaticData data(f StaticData);782 FTM::StaticData data(fBufStaticData); 728 783 729 784 bool ident = true; … … 780 835 return false; 781 836 782 FTM::StaticData data(f StaticData);837 FTM::StaticData data(fBufStaticData); 783 838 784 839 bool ident = true; … … 806 861 return false; 807 862 808 FTM::StaticData data(f StaticData);863 FTM::StaticData data(fBufStaticData); 809 864 810 865 if (board<0) … … 835 890 return false; 836 891 837 FTM::StaticData data(f StaticData);892 FTM::StaticData data(fBufStaticData); 838 893 839 894 data.ToggleFTU(board); … … 853 908 return true; 854 909 855 FTM::StaticData data(f StaticData);910 FTM::StaticData data(fBufStaticData); 856 911 857 912 dest = reinterpret_cast<uint16_t*>(&data) + (dest - reinterpret_cast<uint16_t*>(&fStaticData)); … … 866 921 bool SetTriggerInterval(uint32_t val) 867 922 { 868 return SetVal(&f StaticData.fTriggerInterval, val,923 return SetVal(&fBufStaticData.fTriggerInterval, val, 869 924 FTM::StaticData::kMaxTriggerInterval); 870 925 } … … 872 927 bool SetTriggerDelay(uint32_t val) 873 928 { 874 return SetVal(&f StaticData.fDelayTrigger, val,929 return SetVal(&fBufStaticData.fDelayTrigger, val, 875 930 FTM::StaticData::kMaxDelayTrigger); 876 931 } … … 878 933 bool SetTimeMarkerDelay(uint32_t val) 879 934 { 880 return SetVal(&f StaticData.fDelayTimeMarker, val,935 return SetVal(&fBufStaticData.fDelayTimeMarker, val, 881 936 FTM::StaticData::kMaxDelayTimeMarker); 882 937 } … … 884 939 bool SetDeadTime(uint32_t val) 885 940 { 886 return SetVal(&f StaticData.fDeadTime, val,941 return SetVal(&fBufStaticData.fDeadTime, val, 887 942 FTM::StaticData::kMaxDeadTime); 888 943 } … … 893 948 // return; 894 949 895 FTM::StaticData data(f StaticData);950 FTM::StaticData data(fBufStaticData); 896 951 data.Enable(type, enable); 897 952 CmdSendStatDat(data); … … 905 960 return false; 906 961 907 FTM::StaticData data(f StaticData);962 FTM::StaticData data(fBufStaticData); 908 963 909 964 /* … … 929 984 return false; 930 985 931 if (n==fStaticData.fMultiplicityPhysics)932 return true;933 934 FTM::StaticData data(f StaticData);986 //if (n==fBufStaticData.fMultiplicityPhysics) 987 // return true; 988 989 FTM::StaticData data(fBufStaticData); 935 990 936 991 data.fMultiplicityPhysics = n; … … 946 1001 return false; 947 1002 948 if (win==fStaticData.fWindowPhysics)949 return true;950 951 FTM::StaticData data(f StaticData);1003 //if (win==fStaticData.fWindowPhysics) 1004 // return true; 1005 1006 FTM::StaticData data(fBufStaticData); 952 1007 953 1008 data.fWindowPhysics = win; … … 963 1018 return false; 964 1019 965 if (n==fStaticData.fMultiplicityCalib)966 return true;967 968 FTM::StaticData data(f StaticData);1020 //if (n==fStaticData.fMultiplicityCalib) 1021 // return true; 1022 1023 FTM::StaticData data(fBufStaticData); 969 1024 970 1025 data.fMultiplicityCalib = n; … … 980 1035 return false; 981 1036 982 if (win==fStaticData.fWindowCalib)983 return true;984 985 FTM::StaticData data(f StaticData);1037 //if (win==fStaticData.fWindowCalib) 1038 // return true; 1039 1040 FTM::StaticData data(fBufStaticData); 986 1041 987 1042 data.fWindowCalib = win; … … 994 1049 bool SetClockRegister(const uint64_t reg[]) 995 1050 { 996 FTM::StaticData data(f StaticData);1051 FTM::StaticData data(fBufStaticData); 997 1052 998 1053 for (int i=0; i<8; i++) … … 1012 1067 return false; 1013 1068 1014 FTM::StaticData data(f StaticData);1069 FTM::StaticData data(fBufStaticData); 1015 1070 1016 1071 if (lp==FTM::StaticData::kLPint) … … 1033 1088 return false; 1034 1089 1035 FTM::StaticData data(f StaticData);1090 FTM::StaticData data(fBufStaticData); 1036 1091 1037 1092 if (lp==FTM::StaticData::kLPint) … … 1053 1108 if (idx==-1) 1054 1109 { 1055 FTM::StaticData data(f StaticData);1110 FTM::StaticData data(fBufStaticData); 1056 1111 1057 1112 for (int i=0; i<=FTM::StaticData::kMaxPixelIdx; i++) … … 1069 1124 */ 1070 1125 1071 FTM::StaticData data(f StaticData);1126 FTM::StaticData data(fBufStaticData); 1072 1127 1073 1128 const uintptr_t base = uintptr_t(&data); … … 1098 1153 return false; 1099 1154 1100 FTM::StaticData data(f StaticData);1155 FTM::StaticData data(fBufStaticData); 1101 1156 1102 1157 for (int i=0; i<=FTM::StaticData::kMaxPixelIdx; i++) … … 1113 1168 return false; 1114 1169 1115 FTM::StaticData data(f StaticData);1170 FTM::StaticData data(fBufStaticData); 1116 1171 1117 1172 for (int i=0; i<=FTM::StaticData::kMaxPixelIdx; i++) … … 1128 1183 return false; 1129 1184 1130 FTM::StaticData data(f StaticData);1185 FTM::StaticData data(fBufStaticData); 1131 1186 1132 1187 for (int i=0; i<=FTM::StaticData::kMaxPixelIdx; i++) … … 1144 1199 return false; 1145 1200 1146 FTM::StaticData data(f StaticData);1147 1148 data.EnablePixel(idx, !f StaticData.Enabled(idx));1201 FTM::StaticData data(fBufStaticData); 1202 1203 data.EnablePixel(idx, !fBufStaticData.Enabled(idx)); 1149 1204 1150 1205 CmdSendStatDat(data); … … 1161 1216 { 1162 1217 case FTM::kFtmUndefined: // 0 1163 return kConnected; // rc=21218 return fBufStaticData.valid() ? kConnected : kDisconnected; // rc=2 1164 1219 1165 1220 case FTM::kFtmRunning: // 3 … … 1178 1233 //bool IsLocked() const { return fHeader.fState&FTM::kFtmLocked; } 1179 1234 1180 int GetCounter(FTM::Types type) { return fCounter[type]; }1235 uint32_t GetCounter(FTM::Types type) { return fCounter[type]; } 1181 1236 1182 1237 const FTM::StaticData &GetStaticData() const { return fStaticData; } … … 1577 1632 } 1578 1633 1634 int SetAllThresholds(const EventImp &evt) 1635 { 1636 if (!CheckEventSize(evt.GetSize(), "SetAllThresholds", 160*4)) 1637 return T::kSM_FatalError; 1638 1639 const int32_t *data = evt.Ptr<int32_t>(); 1640 if (!fFTM.SetAllThresholds(data)) 1641 { 1642 ostringstream msg; 1643 msg << "SetAllThresholds - Value out of range [0; 0xffff]"; 1644 T::Warn(msg); 1645 } 1646 1647 return T::GetCurrentState(); 1648 } 1649 1579 1650 int SetNoutof4(const EventImp &evt) 1580 1651 { … … 1901 1972 }*/ 1902 1973 1903 int64_t fCounterReg;1904 int64_t fCounterStat;1974 uint32_t fCounterReg; 1975 uint32_t fCounterStat; 1905 1976 1906 1977 typedef map<string, FTM::StaticData> Configs; … … 1971 2042 case FTM::State::kConfiguring2: 1972 2043 case FTM::State::kConfigured: 1973 // If FTM has received an anwer to the stop_run command1974 // the counter for the registershas been increased2044 // If FTM has received an anwer to the CmdSendStatDat 2045 // the counter for static data has been increased 1975 2046 if (fFTM.GetCounter(FTM::kStaticData)<=fCounterStat) 1976 2047 break; … … 1989 2060 T::Message("Sending new configuration was successfull."); 1990 2061 else 1991 T::Message("Configuration successfull updated.");2062 T::Message("Configuration successfully updated."); 1992 2063 1993 2064 // Next state is: wait for the answer to our configuration … … 2003 2074 { 2004 2075 case ConnectionFTM::kIdle: return FTM::State::kIdle; 2005 case ConnectionFTM::kConfigured: return FTM::State::k Idle;2076 case ConnectionFTM::kConfigured: return FTM::State::kValid; 2006 2077 case ConnectionFTM::kTriggerOn: return FTM::State::kTriggerOn; 2007 2078 default: 2008 throw runtime_error("StateMachi enFTM - Execute() - Inavlid state.");2079 throw runtime_error("StateMachineFTM - Execute() - Inavlid state."); 2009 2080 } 2010 2081 } … … 2038 2109 T::AddStateName(FTM::State::kIdle, "Idle", 2039 2110 "Ethernet connection to FTM established, FTM in idle state."); 2111 2112 T::AddStateName(FTM::State::kValid, "Valid", 2113 "FTM in idle state and the last sent and received static data block are bitwise identical."); 2040 2114 2041 2115 T::AddStateName(FTM::State::kConfiguring1, "Configuring1", … … 2054 2128 2055 2129 // FTM Commands 2056 T::AddEvent("TOGGLE_LED", FTM::State::kIdle )2130 T::AddEvent("TOGGLE_LED", FTM::State::kIdle, FTM::State::kValid) 2057 2131 (Wrapper(bind(&ConnectionFTM::CmdToggleLed, &fFTM))) 2058 2132 ("toggle led"); 2059 2133 2060 T::AddEvent("PING", FTM::State::kIdle )2134 T::AddEvent("PING", FTM::State::kIdle, FTM::State::kValid) 2061 2135 (Wrapper(bind(&ConnectionFTM::CmdPing, &fFTM))) 2062 2136 ("send ping"); 2063 2137 2064 T::AddEvent("REQUEST_DYNAMIC_DATA", FTM::State::kIdle )2138 T::AddEvent("REQUEST_DYNAMIC_DATA", FTM::State::kIdle, FTM::State::kValid) 2065 2139 (Wrapper(bind(&ConnectionFTM::CmdReqDynDat, &fFTM))) 2066 2140 ("request transmission of dynamic data block"); 2067 2141 2068 T::AddEvent("REQUEST_STATIC_DATA", FTM::State::kIdle )2142 T::AddEvent("REQUEST_STATIC_DATA", FTM::State::kIdle, FTM::State::kValid) 2069 2143 (Wrapper(bind(&ConnectionFTM::CmdReqStatDat, &fFTM))) 2070 2144 ("request transmission of static data from FTM to memory"); 2071 2145 2072 T::AddEvent("GET_REGISTER", "I", FTM::State::kIdle )2146 T::AddEvent("GET_REGISTER", "I", FTM::State::kIdle, FTM::State::kValid) 2073 2147 (bind(&StateMachineFTM::GetRegister, this, placeholders::_1)) 2074 2148 ("read register from address addr" 2075 2149 "|addr[short]:Address of register"); 2076 2150 2077 T::AddEvent("SET_REGISTER", "I:2", FTM::State::kIdle )2151 T::AddEvent("SET_REGISTER", "I:2", FTM::State::kIdle, FTM::State::kValid) 2078 2152 (bind(&StateMachineFTM::SetRegister, this, placeholders::_1)) 2079 2153 ("set register to value" … … 2081 2155 "|val[short]:Value to be set"); 2082 2156 2083 T::AddEvent("START_TRIGGER", FTM::State::kIdle, FTM::State::k Configured)2157 T::AddEvent("START_TRIGGER", FTM::State::kIdle, FTM::State::kValid, FTM::State::kConfigured) 2084 2158 (Wrapper(bind(&ConnectionFTM::CmdStartRun, &fFTM))) 2085 2159 ("start a run (start distributing triggers)"); … … 2089 2163 ("stop a run (stop distributing triggers)"); 2090 2164 2091 T::AddEvent("TAKE_N_EVENTS", "I", FTM::State::kIdle )2165 T::AddEvent("TAKE_N_EVENTS", "I", FTM::State::kIdle, FTM::State::kValid) 2092 2166 (bind(&StateMachineFTM::TakeNevents, this, placeholders::_1)) 2093 2167 ("take n events (distribute n triggers)|number[int]:Number of events to be taken"); 2094 2168 2095 T::AddEvent("DISABLE_REPORTS", "B", FTM::State::kIdle )2169 T::AddEvent("DISABLE_REPORTS", "B", FTM::State::kIdle, FTM::State::kValid) 2096 2170 (bind(&StateMachineFTM::DisableReports, this, placeholders::_1)) 2097 2171 ("disable sending rate reports" 2098 2172 "|status[bool]:disable or enable that the FTM sends rate reports (yes/no)"); 2099 2173 2100 T::AddEvent("SET_THRESHOLD", "I:2", FTM::State::kIdle, FTM::State::k Configured, FTM::State::kTriggerOn)2174 T::AddEvent("SET_THRESHOLD", "I:2", FTM::State::kIdle, FTM::State::kValid, FTM::State::kConfigured, FTM::State::kTriggerOn) 2101 2175 (bind(&StateMachineFTM::SetThreshold, this, placeholders::_1)) 2102 2176 ("Set the comparator threshold" … … 2104 2178 "|Threshold[counts]:Threshold to be set in binary counts"); 2105 2179 2106 T::AddEvent("SET_N_OUT_OF_4", "I:2", FTM::State::kIdle, FTM::State::kTriggerOn) 2180 T::AddEvent("SET_ALL_THRESHOLDS", "I:160", FTM::State::kIdle, FTM::State::kValid, FTM::State::kConfigured, FTM::State::kTriggerOn) 2181 (bind(&StateMachineFTM::SetAllThresholds, this, placeholders::_1)) 2182 ("Set the comparator thresholds" 2183 "|Thresholds[counts]:Threshold to be set in binary counts"); 2184 2185 T::AddEvent("SET_N_OUT_OF_4", "I:2", FTM::State::kIdle, FTM::State::kValid, FTM::State::kTriggerOn) 2107 2186 (bind(&StateMachineFTM::SetNoutof4, this, placeholders::_1)) 2108 2187 ("Set the comparator threshold" … … 2110 2189 "|Threshold[counts]:Threshold to be set in binary counts"); 2111 2190 2112 T::AddEvent("SET_PRESCALING", "I:1", FTM::State::kIdle )2191 T::AddEvent("SET_PRESCALING", "I:1", FTM::State::kIdle, FTM::State::kValid) 2113 2192 (bind(&StateMachineFTM::SetPrescaling, this, placeholders::_1)) 2114 2193 ("Sets the FTU readout time intervals" 2115 2194 "|time[0.5s]:The interval is given in units of 0.5s, i.e. 1 means 0.5s, 2 means 1s, ..."); 2116 2195 2117 T::AddEvent("ENABLE_FTU", "I:1;B:1", FTM::State::kIdle, FTM::State::k Configured)2196 T::AddEvent("ENABLE_FTU", "I:1;B:1", FTM::State::kIdle, FTM::State::kValid, FTM::State::kConfigured) 2118 2197 (bind(&StateMachineFTM::EnableFTU, this, placeholders::_1)) 2119 2198 ("Enable or disable FTU" … … 2121 2200 "|Enable[bool]:Whether FTU should be enabled or disabled (yes/no)"); 2122 2201 2123 T::AddEvent("DISABLE_PIXEL", "S:1", FTM::State::kIdle, FTM::State::k TriggerOn)2202 T::AddEvent("DISABLE_PIXEL", "S:1", FTM::State::kIdle, FTM::State::kValid, FTM::State::kTriggerOn) 2124 2203 (bind(&StateMachineFTM::EnablePixel, this, placeholders::_1, false)) 2125 2204 ("(-1 or all)"); 2126 2205 2127 T::AddEvent("ENABLE_PIXEL", "S:1", FTM::State::kIdle, FTM::State::k TriggerOn)2206 T::AddEvent("ENABLE_PIXEL", "S:1", FTM::State::kIdle, FTM::State::kValid, FTM::State::kTriggerOn) 2128 2207 (bind(&StateMachineFTM::EnablePixel, this, placeholders::_1, true)) 2129 2208 ("(-1 or all)"); 2130 2209 2131 T::AddEvent("DISABLE_ALL_PIXELS_EXCEPT", "S:1", FTM::State::kIdle )2210 T::AddEvent("DISABLE_ALL_PIXELS_EXCEPT", "S:1", FTM::State::kIdle, FTM::State::kValid) 2132 2211 (bind(&StateMachineFTM::DisableAllPixelsExcept, this, placeholders::_1)) 2133 2212 (""); 2134 2213 2135 T::AddEvent("DISABLE_ALL_PATCHES_EXCEPT", "S:1", FTM::State::kIdle )2214 T::AddEvent("DISABLE_ALL_PATCHES_EXCEPT", "S:1", FTM::State::kIdle, FTM::State::kValid) 2136 2215 (bind(&StateMachineFTM::DisableAllPatchesExcept, this, placeholders::_1)) 2137 2216 (""); 2138 2217 2139 T::AddEvent("ENABLE_PATCH", "S:1", FTM::State::kIdle )2218 T::AddEvent("ENABLE_PATCH", "S:1", FTM::State::kIdle, FTM::State::kValid) 2140 2219 (bind(&StateMachineFTM::EnablePatch, this, placeholders::_1, true)) 2141 2220 (""); 2142 2221 2143 T::AddEvent("DISABLE_PATCH", "S:1", FTM::State::kIdle )2222 T::AddEvent("DISABLE_PATCH", "S:1", FTM::State::kIdle, FTM::State::kValid) 2144 2223 (bind(&StateMachineFTM::EnablePatch, this, placeholders::_1, false)) 2145 2224 (""); 2146 2225 2147 T::AddEvent("TOGGLE_PIXEL", "S:1", FTM::State::kIdle )2226 T::AddEvent("TOGGLE_PIXEL", "S:1", FTM::State::kIdle, FTM::State::kValid) 2148 2227 (bind(&StateMachineFTM::TogglePixel, this, placeholders::_1)) 2149 2228 (""); 2150 2229 2151 T::AddEvent("TOGGLE_FTU", "I:1", FTM::State::kIdle )2230 T::AddEvent("TOGGLE_FTU", "I:1", FTM::State::kIdle, FTM::State::kValid) 2152 2231 (bind(&StateMachineFTM::ToggleFTU, this, placeholders::_1)) 2153 2232 ("Toggle status of FTU (this is mainly meant to be used in the GUI)" 2154 2233 "|Board[idx]:Index of the board (0-39)"); 2155 2234 2156 T::AddEvent("SET_TRIGGER_INTERVAL", "I:1", FTM::State::kIdle )2235 T::AddEvent("SET_TRIGGER_INTERVAL", "I:1", FTM::State::kIdle, FTM::State::kValid) 2157 2236 (bind(&StateMachineFTM::SetTriggerInterval, this, placeholders::_1)) 2158 2237 ("Sets the trigger interval which is the distance between two consecutive artificial triggers." 2159 2238 "|interval[ms]:The applied trigger interval in millisecond (min 1ms / 10bit)"); 2160 2239 2161 T::AddEvent("SET_TRIGGER_DELAY", "I:1", FTM::State::kIdle )2240 T::AddEvent("SET_TRIGGER_DELAY", "I:1", FTM::State::kIdle, FTM::State::kValid) 2162 2241 (bind(&StateMachineFTM::SetTriggerDelay, this, placeholders::_1)) 2163 2242 ("" 2164 2243 "|delay[int]:The applied trigger delay is: delay*4ns+8ns"); 2165 2244 2166 T::AddEvent("SET_TIME_MARKER_DELAY", "I:1", FTM::State::kIdle )2245 T::AddEvent("SET_TIME_MARKER_DELAY", "I:1", FTM::State::kIdle, FTM::State::kValid) 2167 2246 (bind(&StateMachineFTM::SetTimeMarkerDelay, this, placeholders::_1)) 2168 2247 ("" 2169 2248 "|delay[int]:The applied time marker delay is: delay*4ns+8ns"); 2170 2249 2171 T::AddEvent("SET_DEAD_TIME", "I:1", FTM::State::kIdle )2250 T::AddEvent("SET_DEAD_TIME", "I:1", FTM::State::kIdle, FTM::State::kValid) 2172 2251 (bind(&StateMachineFTM::SetDeadTime, this, placeholders::_1)) 2173 2252 ("" 2174 2253 "|dead_time[int]:The applied dead time is: dead_time*4ns+8ns"); 2175 2254 2176 T::AddEvent("ENABLE_TRIGGER", "B:1", FTM::State::kIdle )2255 T::AddEvent("ENABLE_TRIGGER", "B:1", FTM::State::kIdle, FTM::State::kValid) 2177 2256 (bind(&StateMachineFTM::Enable, this, placeholders::_1, FTM::StaticData::kTrigger)) 2178 2257 ("Switch on the physics trigger" … … 2180 2259 2181 2260 // FIXME: Switch on/off depending on sequence 2182 T::AddEvent("ENABLE_EXT1", "B:1", FTM::State::kIdle )2261 T::AddEvent("ENABLE_EXT1", "B:1", FTM::State::kIdle, FTM::State::kValid) 2183 2262 (bind(&StateMachineFTM::Enable, this, placeholders::_1, FTM::StaticData::kExt1)) 2184 2263 ("Switch on the triggers through the first external line" … … 2186 2265 2187 2266 // FIXME: Switch on/off depending on sequence 2188 T::AddEvent("ENABLE_EXT2", "B:1", FTM::State::kIdle )2267 T::AddEvent("ENABLE_EXT2", "B:1", FTM::State::kIdle, FTM::State::kValid) 2189 2268 (bind(&StateMachineFTM::Enable, this, placeholders::_1, FTM::StaticData::kExt2)) 2190 2269 ("Switch on the triggers through the second external line" 2191 2270 "|Enable[bool]:Enable ext2 trigger (yes/no)"); 2192 2271 2193 T::AddEvent("ENABLE_VETO", "B:1", FTM::State::kIdle )2272 T::AddEvent("ENABLE_VETO", "B:1", FTM::State::kIdle, FTM::State::kValid) 2194 2273 (bind(&StateMachineFTM::Enable, this, placeholders::_1, FTM::StaticData::kVeto)) 2195 2274 ("Enable veto line" 2196 2275 "|Enable[bool]:Enable veto (yes/no)"); 2197 2276 2198 T::AddEvent("ENABLE_CLOCK_CONDITIONER", "B:1", FTM::State::kIdle )2277 T::AddEvent("ENABLE_CLOCK_CONDITIONER", "B:1", FTM::State::kIdle, FTM::State::kValid) 2199 2278 (bind(&StateMachineFTM::Enable, this, placeholders::_1, FTM::StaticData::kClockConditioner)) 2200 2279 ("Enable clock conidtioner output in favor of time marker output" 2201 2280 "|Enable[bool]:Enable clock conditioner (yes/no)"); 2202 2281 2203 T::AddEvent("ENABLE_GROUP1_LPINT", "B:1", FTM::State::kIdle )2282 T::AddEvent("ENABLE_GROUP1_LPINT", "B:1", FTM::State::kIdle, FTM::State::kValid) 2204 2283 (bind(&StateMachineFTM::EnableLP, this, placeholders::_1, FTM::StaticData::kLPint, FTM::StaticData::kGroup1)) 2205 2284 (""); 2206 T::AddEvent("ENABLE_GROUP1_LPEXT", "B:1", FTM::State::kIdle )2285 T::AddEvent("ENABLE_GROUP1_LPEXT", "B:1", FTM::State::kIdle, FTM::State::kValid) 2207 2286 (bind(&StateMachineFTM::EnableLP, this, placeholders::_1, FTM::StaticData::kLPext, FTM::StaticData::kGroup1)) 2208 2287 (""); 2209 T::AddEvent("ENABLE_GROUP2_LPINT", "B:1", FTM::State::kIdle )2288 T::AddEvent("ENABLE_GROUP2_LPINT", "B:1", FTM::State::kIdle, FTM::State::kValid) 2210 2289 (bind(&StateMachineFTM::EnableLP, this, placeholders::_1, FTM::StaticData::kLPint, FTM::StaticData::kGroup2)) 2211 2290 (""); 2212 T::AddEvent("ENABLE_GROUP2_LPEXT", "B:1", FTM::State::kIdle )2291 T::AddEvent("ENABLE_GROUP2_LPEXT", "B:1", FTM::State::kIdle, FTM::State::kValid) 2213 2292 (bind(&StateMachineFTM::EnableLP, this, placeholders::_1, FTM::StaticData::kLPext, FTM::StaticData::kGroup2)) 2214 2293 (""); 2215 T::AddEvent("SET_INTENSITY_LPINT", "S:1", FTM::State::kIdle )2294 T::AddEvent("SET_INTENSITY_LPINT", "S:1", FTM::State::kIdle, FTM::State::kValid) 2216 2295 (bind(&StateMachineFTM::SetIntensity, this, placeholders::_1, FTM::StaticData::kLPint)) 2217 2296 (""); 2218 T::AddEvent("SET_INTENSITY_LPEXT", "S:1", FTM::State::kIdle )2297 T::AddEvent("SET_INTENSITY_LPEXT", "S:1", FTM::State::kIdle, FTM::State::kValid) 2219 2298 (bind(&StateMachineFTM::SetIntensity, this, placeholders::_1, FTM::StaticData::kLPext)) 2220 2299 (""); 2221 2300 2222 2301 2223 T::AddEvent("SET_TRIGGER_SEQUENCE", "S:3", FTM::State::kIdle )2302 T::AddEvent("SET_TRIGGER_SEQUENCE", "S:3", FTM::State::kIdle, FTM::State::kValid) 2224 2303 (bind(&StateMachineFTM::SetTriggerSeq, this, placeholders::_1)) 2225 2304 ("Setup the sequence of artificial triggers produced by the FTM" … … 2228 2307 "|LPint[short]:number of triggers of the internal light pulser"); 2229 2308 2230 T::AddEvent("SET_TRIGGER_MULTIPLICITY", "S:1", FTM::State::kIdle )2309 T::AddEvent("SET_TRIGGER_MULTIPLICITY", "S:1", FTM::State::kIdle, FTM::State::kValid) 2231 2310 (bind(&StateMachineFTM::SetTriggerMultiplicity, this, placeholders::_1)) 2232 2311 ("Setup the Multiplicity condition for physcis triggers" 2233 2312 "|N[int]:Number of requirered coincident triggers from sum-patches (1-40)"); 2234 2313 2235 T::AddEvent("SET_TRIGGER_WINDOW", "S:1", FTM::State::kIdle )2314 T::AddEvent("SET_TRIGGER_WINDOW", "S:1", FTM::State::kIdle, FTM::State::kValid) 2236 2315 (bind(&StateMachineFTM::SetTriggerWindow, this, placeholders::_1)) 2237 2316 (""); 2238 2317 2239 T::AddEvent("SET_CALIBRATION_MULTIPLICITY", "S:1", FTM::State::kIdle )2318 T::AddEvent("SET_CALIBRATION_MULTIPLICITY", "S:1", FTM::State::kIdle, FTM::State::kValid) 2240 2319 (bind(&StateMachineFTM::SetCalibMultiplicity, this, placeholders::_1)) 2241 2320 ("Setup the Multiplicity condition for artificial (calibration) triggers" 2242 2321 "|N[int]:Number of requirered coincident triggers from sum-patches (1-40)"); 2243 2322 2244 T::AddEvent("SET_CALIBRATION_WINDOW", "S:1", FTM::State::kIdle )2323 T::AddEvent("SET_CALIBRATION_WINDOW", "S:1", FTM::State::kIdle, FTM::State::kValid) 2245 2324 (bind(&StateMachineFTM::SetCalibWindow, this, placeholders::_1)) 2246 2325 (""); 2247 2326 2248 T::AddEvent("SET_CLOCK_FREQUENCY", "S:1", FTM::State::kIdle )2327 T::AddEvent("SET_CLOCK_FREQUENCY", "S:1", FTM::State::kIdle, FTM::State::kValid) 2249 2328 (bind(&StateMachineFTM::SetClockFrequency, this, placeholders::_1)) 2250 2329 (""); 2251 2330 2252 T::AddEvent("SET_CLOCK_REGISTER", "X:8", FTM::State::kIdle )2331 T::AddEvent("SET_CLOCK_REGISTER", "X:8", FTM::State::kIdle, FTM::State::kValid) 2253 2332 (bind(&StateMachineFTM::SetClockRegister, this, placeholders::_1)) 2254 2333 (""); … … 2256 2335 // A new configure will first stop the FTM this means 2257 2336 // we can allow it in idle _and_ taking data 2258 T::AddEvent("CONFIGURE", "C" , FTM::State::kIdle, FTM::State::kConfiguring1, FTM::State::kConfiguring2, FTM::State::kConfigured,FTM::State::kTriggerOn)2337 T::AddEvent("CONFIGURE", "C")(FTM::State::kIdle)(FTM::State::kValid)(FTM::State::kConfiguring1)(FTM::State::kConfiguring2)(FTM::State::kConfigured)(FTM::State::kTriggerOn) 2259 2338 (bind(&StateMachineFTM::ConfigureFTM, this, placeholders::_1)) 2260 2339 (""); … … 2266 2345 2267 2346 2268 T::AddEvent("RESET_CRATE", "S:1", FTM::State::kIdle, FTM::State::k Configured)2347 T::AddEvent("RESET_CRATE", "S:1", FTM::State::kIdle, FTM::State::kValid, FTM::State::kConfigured) 2269 2348 (bind(&StateMachineFTM::ResetCrate, this, placeholders::_1)) 2270 2349 ("Reset one of the crates 0-3" 2271 2350 "|crate[short]:Crate number to be reseted (0-3)"); 2272 2351 2273 T::AddEvent("RESET_CAMERA", FTM::State::kIdle )2352 T::AddEvent("RESET_CAMERA", FTM::State::kIdle, FTM::State::kValid) 2274 2353 (Wrapper(bind(&ConnectionFTM::CmdResetCamera, &fFTM))) 2275 2354 ("Reset all crates. The commands are sent in the order 0,1,2,3"); … … 2277 2356 2278 2357 // Load/save static data block 2279 T::AddEvent("SAVE", "C", FTM::State::kIdle )2358 T::AddEvent("SAVE", "C", FTM::State::kIdle, FTM::State::kValid) 2280 2359 (bind(&StateMachineFTM::SaveStaticData, this, placeholders::_1)) 2281 2360 ("Saves the static data (FTM configuration) from memory to a file" 2282 2361 "|filename[string]:Filename (can include a path), .bin is automatically added"); 2283 2362 2284 T::AddEvent("LOAD", "C", FTM::State::kIdle )2363 T::AddEvent("LOAD", "C", FTM::State::kIdle, FTM::State::kValid) 2285 2364 (bind(&StateMachineFTM::LoadStaticData, this, placeholders::_1)) 2286 2365 ("Loads the static data (FTM configuration) from a file into memory and sends it to the FTM" … … 2307 2386 2308 2387 // Conenction commands 2309 T::AddEvent("DISCONNECT", FTM::State::kConnected, FTM::State::kIdle )2388 T::AddEvent("DISCONNECT", FTM::State::kConnected, FTM::State::kIdle, FTM::State::kValid) 2310 2389 (bind(&StateMachineFTM::Disconnect, this)) 2311 2390 ("disconnect from ethernet"); 2312 2391 2313 T::AddEvent("RECONNECT", "O", FTM::State::kDisconnected, FTM::State::kConnected, FTM::State::kIdle, FTM::State::k Configured)2392 T::AddEvent("RECONNECT", "O", FTM::State::kDisconnected, FTM::State::kConnected, FTM::State::kIdle, FTM::State::kValid, FTM::State::kConfigured) 2314 2393 (bind(&StateMachineFTM::Reconnect, this, placeholders::_1)) 2315 2394 ("(Re)connect ethernet connection to FTM, a new address can be given"
Note:
See TracChangeset
for help on using the changeset viewer.