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

            Line data    Source code
       1              : #include "wibmod/WIB1/WIB.hh"
       2              : #include "wibmod/WIB1/WIBException.hh"
       3              : 
       4              : uint32_t
       5            0 : WIB::ReadLocalFlash(uint16_t address)
       6              : {
       7              :   // load the address
       8            0 :   Write("SYSTEM.FLASH.ADDRESS", address);
       9              :   // start the read transaction
      10            0 :   Write("SYSTEM.FLASH.RW", 1);
      11            0 :   Write("SYSTEM.FLASH.RUN", 1);
      12              : 
      13              :   // Wait for transaction to finish
      14            0 :   while (Read("SYSTEM.FLASH.DONE") == 0) {
      15            0 :     printf("busy\n");
      16              :     // sleep for 1ms
      17            0 :     usleep(1000);
      18              :   }
      19              : 
      20            0 :   return Read("SYSTEM.FLASH.RD_DATA");
      21              : }
      22              : 
      23              : std::vector<uint32_t>
      24            0 : WIB::ReadLocalFlash(uint16_t address, size_t n)
      25              : {
      26            0 :   std::vector<uint32_t> readData;
      27            0 :   size_t current_address = address;
      28            0 :   size_t end_address = current_address + n;
      29            0 :   for (; current_address < end_address; current_address++) {
      30            0 :     readData.push_back(ReadLocalFlash(current_address));
      31              :   }
      32            0 :   return readData;
      33            0 : }
      34              : 
      35              : void
      36            0 : WIB::WriteLocalFlash(uint16_t address, uint32_t data)
      37              : {
      38              :   // load the address
      39            0 :   Write("SYSTEM.FLASH.ADDRESS", address);
      40              :   // load the data to write
      41            0 :   Write("SYSTEM.FLASH.WR_DATA", data);
      42              : 
      43              :   // start the read transaction
      44            0 :   Write("SYSTEM.FLASH.RW", 0);
      45            0 :   Write("SYSTEM.FLASH.RUN", 1);
      46              :   // Wait for finish
      47            0 :   while (Read("SYSTEM.FLASH.DONE") == 0) {
      48              :     // sleep for 1ms
      49            0 :     usleep(1000);
      50              :   }
      51            0 : }
      52              : 
      53              : void
      54            0 : WIB::WriteLocalFlash(uint16_t address, std::vector<uint32_t> const& data)
      55              : {
      56            0 :   for (size_t iWord = 0; iWord < data.size(); iWord++) {
      57            0 :     WriteLocalFlash(address, data[iWord]);
      58            0 :     address++;
      59              :   }
      60            0 : }
        

Generated by: LCOV version 2.0-1