Commit 46f0a305 authored by Serguei Kolos's avatar Serguei Kolos
Browse files

Finalize resources handling for stop/start of a run

parent a0b3b04d
......@@ -417,11 +417,6 @@ void Core::ROB::enable(uint32_t lastL1ID) {
return;
}
// The order is important. First the links, which were explicitly disabled
// must be re enabled
std::vector<InputLinkId> links(m_disabled_elinks.begin(), m_disabled_elinks.end());
enableLinks(links, lastL1ID);
m_builder->enable(lastL1ID, 0);
m_enabled = true;
for (auto & c : m_consumers) {
......@@ -447,7 +442,11 @@ void Core::ROB::runStarted(const RunParams & run_params) {
// Re enables all temporary disabled resources which could have been disabled
// during the last run. Must be called after the runStarted()
// The order is important. First the ORB has to be enabled and only then
// the E-Links which were explicitly disabled.
std::vector<InputLinkId> links(m_disabled_elinks.begin(), m_disabled_elinks.end());
enable(-1);
enableLinks(links, -1);
}
void Core::ROB::runStopped() {
......
......@@ -96,14 +96,7 @@ void DataInputHandlerBase::disable() {
ERS_LOG("Disable '" << m_id << "' input handler");
m_input->executeSynchronousAction([this]{
for (Link & link : m_links) {
if (link.m_enabled) {
m_input->unsubscribe(link.m_fid);
link.m_enabled = false;
--m_links_number;
ERS_DEBUG(1, "Unsubscribed from the 0x" << std::hex << link.m_fid << " input link");
}
}
unsubscribeFromFelix();
disabled();
});
......@@ -150,12 +143,10 @@ void DataInputHandlerBase::enable(uint32_t lastL1ID, uint64_t triggersNumber) {
<< " triggers counter = " << std::dec << triggersNumber);
for (Link & link : m_links) {
if (not link.m_enabled) {
if (link.m_enabled) {
m_input->subscribe(link.m_fid, m_callback.bind(link));
link.m_enabled = true;
link.m_packets_counter = triggersNumber;
link.m_expected_l1id = (lastL1ID & 0xff000000) + 0x01000000;
++m_links_number;
ERS_DEBUG(2, "Subscribed to the " << std::hex << link.m_fid << " input link");
}
}
......@@ -182,6 +173,12 @@ void DataInputHandlerBase::enableLinks(std::vector<InputLinkId> & link_ids,
continue;
}
if (link->m_enabled) {
ERS_LOG("Link 0x" << std::hex << *id << " is already enabled");
id = link_ids.erase(id);
continue;
}
try {
m_input->subscribe(link->m_fid, m_callback.bind(*link));
link->m_enabled = true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment