LCOV - code coverage report
Current view: top level - workspace/libs/bsp/bspInterrupts/include/interrupts - SuspendResumeAllInterruptsLock.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 3 3 100.0 %
Date: 2025-01-20 13:53:09 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright 2024 Accenture.
       2             : 
       3             : #ifndef GUARD_D7E38C8A_C22E_47BC_B05A_773E8AA4F30F
       4             : #define GUARD_D7E38C8A_C22E_47BC_B05A_773E8AA4F30F
       5             : 
       6             : #include "interrupts/suspendResumeAllInterrupts.h"
       7             : 
       8             : namespace interrupts
       9             : {
      10             : class SuspendResumeAllInterruptsLock
      11             : {
      12             : public:
      13             :     // [PUBLICAPI_START]
      14             :     /**
      15             :      * Suspend all interrupts and store previous state in an class internal variable
      16             :      */
      17           1 :     void suspend()
      18             :     {
      19           1 :         fOldMachineStateRegisterValue = getMachineStateRegisterValueAndSuspendAllInterrupts();
      20             :     }
      21             : 
      22             :     /**
      23             :      * Resume all interrupts restoring the interrupt state that has been saved during the suspend()
      24             :      * call from the class internal variable
      25             :      */
      26           1 :     void resume() { resumeAllInterrupts(fOldMachineStateRegisterValue); }
      27             : 
      28             :     // [PUBLICAPI_END]
      29             : 
      30             : private:
      31             :     uint32_t fOldMachineStateRegisterValue{};
      32             : };
      33             : 
      34             : } /* namespace interrupts */
      35             : 
      36             : #endif /* GUARD_D7E38C8A_C22E_47BC_B05A_773E8AA4F30F */

Generated by: LCOV version 1.14