Line data Source code
1 : /**
2 : * @file HSIFrameProcessor.cpp HSI specific Task based raw processor
3 : * implementation
4 : *
5 : * This is part of the DUNE DAQ , copyright 2020.
6 : * Licensing/copyright details are in the COPYING file that you should have
7 : * received with this code.
8 : */
9 : #include "hsilibs/Types.hpp"
10 : #include "HSIFrameProcessor.hpp"
11 :
12 : #include <atomic>
13 : #include <functional>
14 : #include <memory>
15 : #include <string>
16 :
17 : using dunedaq::datahandlinglibs::logging::TLVL_FRAME_RECEIVED;
18 :
19 : namespace dunedaq {
20 : namespace hsilibs {
21 :
22 : void
23 0 : HSIFrameProcessor::conf(const appmodel::DataHandlerModule* conf)
24 : {
25 0 : inherited::add_preprocess_task(
26 0 : std::bind(&HSIFrameProcessor::timestamp_check, this, std::placeholders::_1));
27 : // m_tasklist.push_back( std::bind(&HSIFrameProcessor::frame_error_check, this, std::placeholders::_1) );
28 0 : inherited::conf(conf);
29 0 : }
30 :
31 : void
32 0 : HSIFrameProcessor::timestamp_check(frameptr fp)
33 : {
34 : // Acquire timestamp
35 0 : timestamp_t current_ts = fp->get_timestamp();
36 0 : uint64_t k_clock_frequency = 62500000; // NOLINT(build/unsigned)
37 0 : TLOG_DEBUG(TLVL_FRAME_RECEIVED) << "Received HSI frame timestamp value of " << current_ts << " ticks (..."
38 0 : << std::fixed << std::setprecision(8) << (static_cast<double>(current_ts % (k_clock_frequency*1000)) / static_cast<double>(k_clock_frequency)) << " sec)"; // NOLINT
39 :
40 0 : if (current_ts < m_previous_ts) {
41 0 : TLOG() << "*** Data Integrity ERROR *** Current HSIFrame timestamp " << current_ts << " is before previous timestamp " << m_previous_ts;
42 : }
43 :
44 0 : if (current_ts == 0) {
45 0 : TLOG() << "*** Data Integrity ERROR *** Current HSIFrame timestamp " << current_ts << " is 0";
46 : }
47 :
48 0 : m_previous_ts = current_ts;
49 0 : m_last_processed_daq_ts = current_ts;
50 0 : }
51 :
52 : /**
53 : * Pipeline Stage 2.: Check for errors
54 : * */
55 : void
56 0 : HSIFrameProcessor::frame_error_check(frameptr /*fp*/)
57 : {
58 : // check error fields
59 0 : }
60 :
61 : } // namespace hsilibs
62 : } // namespace dunedaq
|