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 % 37 0
Test Date: 2025-12-21 13:07:08 Functions: 0.0 % 2 0

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

Generated by: LCOV version 2.0-1