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 "HSIFrameProcessor.hpp"
10 : #include "hsilibs/Types.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(std::bind(&HSIFrameProcessor::timestamp_check, this, std::placeholders::_1));
26 : // m_tasklist.push_back( std::bind(&HSIFrameProcessor::frame_error_check, this, std::placeholders::_1) );
27 0 : inherited::conf(conf);
28 0 : }
29 :
30 : void
31 0 : HSIFrameProcessor::timestamp_check(frameptr fp)
32 : {
33 : // Acquire timestamp
34 0 : timestamp_t current_ts = fp->get_timestamp();
35 0 : uint64_t k_clock_frequency = 62500000; // NOLINT(build/unsigned)
36 0 : TLOG_DEBUG(TLVL_FRAME_RECEIVED) << "Received HSI frame timestamp value of " << current_ts << " ticks (..."
37 0 : << std::fixed << std::setprecision(8)
38 0 : << (static_cast<double>(current_ts % (k_clock_frequency * 1000)) /
39 0 : static_cast<double>(k_clock_frequency))
40 0 : << " sec)"; // NOLINT
41 :
42 0 : if (current_ts < m_previous_ts) {
43 0 : TLOG() << "*** Data Integrity ERROR *** Current HSIFrame timestamp " << current_ts
44 0 : << " is before previous timestamp " << m_previous_ts;
45 : }
46 :
47 0 : if (current_ts == 0) {
48 0 : TLOG() << "*** Data Integrity ERROR *** Current HSIFrame timestamp " << current_ts << " is 0";
49 : }
50 :
51 0 : m_previous_ts = current_ts;
52 0 : m_last_processed_daq_ts = current_ts;
53 0 : }
54 :
55 : /**
56 : * Pipeline Stage 2.: Check for errors
57 : * */
58 : void
59 0 : HSIFrameProcessor::frame_error_check(frameptr /*fp*/)
60 : {
61 : // check error fields
62 0 : }
63 :
64 : } // namespace hsilibs
65 : } // namespace dunedaq
|