LCOV - code coverage report
Current view: top level - libs/bsp/bspInterrupts/include/interrupts - SuspendResumeAllInterruptsLock.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 4 4
Test Date: 2026-06-18 08:29:03 Functions: 100.0 % 2 2

            Line data    Source code
       1              : /********************************************************************************
       2              :  * Copyright (c) 2024 Accenture
       3              :  *
       4              :  * This program and the accompanying materials are made available under the
       5              :  * terms of the Apache License Version 2.0 which is available at
       6              :  * https://www.apache.org/licenses/LICENSE-2.0
       7              :  *
       8              :  * SPDX-License-Identifier: Apache-2.0
       9              :  ********************************************************************************/
      10              : 
      11              : #pragma once
      12              : 
      13              : #include "interrupts/suspendResumeAllInterrupts.h"
      14              : 
      15              : namespace interrupts
      16              : {
      17              : class SuspendResumeAllInterruptsLock
      18              : {
      19              : public:
      20              :     // [PUBLICAPI_START]
      21              :     /**
      22              :      * Suspend all interrupts and store previous state in an class internal variable
      23              :      */
      24            1 :     void suspend()
      25              :     {
      26            1 :         fOldMachineStateRegisterValue = getMachineStateRegisterValueAndSuspendAllInterrupts();
      27            1 :     }
      28              : 
      29              :     /**
      30              :      * Resume all interrupts restoring the interrupt state that has been saved during the suspend()
      31              :      * call from the class internal variable
      32              :      */
      33            1 :     void resume() { resumeAllInterrupts(fOldMachineStateRegisterValue); }
      34              : 
      35              :     // [PUBLICAPI_END]
      36              : 
      37              : private:
      38              :     uint32_t fOldMachineStateRegisterValue{};
      39              : };
      40              : 
      41              : } /* namespace interrupts */
        

Generated by: LCOV version 2.0-1