User documentation

Overview

bspInterrupts provides lock objects to suspend and resume all interrupts. There are 2 types of locks provided: RAII and non-RAII. The ECU specific implementation of interrupt locks are done in the module bspInterruptsImpl.

Public API

Class SuspendResumeAllInterruptsLock provides non-RAII lock object for suspending/resuming interrupts.

    /**
     * Suspend all interrupts and store previous state in an class internal variable
     */
    void suspend()
    {
        fOldMachineStateRegisterValue = getMachineStateRegisterValueAndSuspendAllInterrupts();
    }

    /**
     * Resume all interrupts restoring the interrupt state that has been saved during the suspend()
     * call from the class internal variable
     */
    void resume() { resumeAllInterrupts(fOldMachineStateRegisterValue); }

Class SuspendResumeAllInterruptsScopedLock provides RAII lock object for suspending/resuming interrupts.

    /**
     * Create a lock object instance with disabling of all interrupts
     * Store the current interrupt state on instance creation in a private member variable
     */
    SuspendResumeAllInterruptsScopedLock()
    : fOldMachineStateRegisterValue(getMachineStateRegisterValueAndSuspendAllInterrupts())
    {}

    /**
     * Destroy the lock object instance and restore the internally stored interrupt state from
     * before this object instance has been created
     */
    ~SuspendResumeAllInterruptsScopedLock() { resumeAllInterrupts(fOldMachineStateRegisterValue); }

Code generation

Not applicable

Configuration

Not applicable

Calibration

Not applicable

Usage Examples and Integration

It should be synced together with a specific implementation of bspInterruptsImpl module.