LCOV - code coverage report
Current view: top level - wibmod/src/WIB1 - WIB_spybuffer.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 36 0
Test Date: 2026-10-11 15:05:20 Functions: 0.0 % 2 0

            Line data    Source code
       1              : #include "wibmod/WIB1/WIB.hh"
       2              : #include "wibmod/WIB1/WIBException.hh"
       3              : 
       4              : std::vector<data_8b10b_t>
       5            0 : WIB::ReadOutCDLinkSpyBuffer()
       6              : {
       7            0 :   if (Read("FEMB_SPY.FIFO_EMPTY")) {
       8            0 :     BUException::WIB_ERROR e;
       9            0 :     e.Append("CD Spy fifo is empty!");
      10            0 :     throw e;
      11            0 :   }
      12              : 
      13            0 :   std::vector<data_8b10b_t> data;
      14            0 :   while (!Read("FEMB_SPY.FIFO_EMPTY")) {
      15            0 :     uint32_t val = Read("FEMB_SPY.DATA");
      16            0 :     data.push_back(data_8b10b_t((val >> 8) & 0x1, uint8_t(val & 0xff)));
      17              :   }
      18            0 :   return data;
      19            0 : }
      20              : 
      21              : std::vector<data_8b10b_t>
      22            0 : WIB::ReadDAQLinkSpyBuffer(uint8_t iDAQLink, uint8_t trigger_mode)
      23              : {
      24              :   // TODO read DAQ link count
      25            0 :   std::string base("DAQ_LINK_");
      26            0 :   base.push_back(GetDAQLinkChar(iDAQLink));
      27            0 :   base.append(".SPY_BUFFER.");
      28              : 
      29              :   // Check if there is an active capture
      30            0 :   if (ReadWithRetry(base + "CAPTURING_DATA")) {
      31            0 :     BUException::WIB_BUSY e;
      32            0 :     e.Append(base);
      33            0 :     e.Append(" is busy\n");
      34            0 :     throw e;
      35            0 :   }
      36              :   // The spy buffer isn't busy, so let's make sure the fifo is empty
      37            0 :   while (!ReadWithRetry(base + "EMPTY")) {
      38              :     // Read out a workd from the fifo
      39            0 :     WriteWithRetry(base + "DATA", 0x0);
      40              :   }
      41              : 
      42              :   // write trigger mode
      43            0 :   WriteWithRetry(base + "TRIGGER_MODE", trigger_mode & 0x1);
      44              : 
      45              :   // Start the capture
      46            0 :   Write(base + "START", 0x1);
      47              : 
      48              :   // Wait for capture to finish
      49            0 :   while (ReadWithRetry(base + "CAPTURING_DATA")) {
      50              :   }
      51              : 
      52              :   // Read out the data
      53            0 :   std::vector<data_8b10b_t> ret;
      54              : 
      55            0 :   while (!ReadWithRetry(base + "EMPTY")) {
      56              :     // read out the k-chars
      57            0 :     uint32_t k_data = ReadWithRetry(base + "K_DATA");
      58              :     // read out the data
      59            0 :     uint32_t data = ReadWithRetry(base + "DATA");
      60              : 
      61              :     //    printf("0x%08X 0x%08X\n",k_data,data);
      62              : 
      63            0 :     for (size_t iWord = 0; iWord < 4; iWord++) {
      64            0 :       ret.push_back(data_8b10b_t((k_data >> iWord) & 0x1, (data >> (iWord * 8) & 0xFF)));
      65              :     }
      66              :     // mark word as read
      67            0 :     Write(base + "DATA", 0x0);
      68              :   }
      69            0 :   return ret;
      70            0 : }
        

Generated by: LCOV version 2.0-1