Skip to content
Snippets Groups Projects
Select Git revision
  • 6fc8ff8dce11558df552c464276554f162767b1d
  • master default protected
2 results

aborted-computation.cc

Blame
  • user avatar
    Christian Dietrich authored
    The TIMING_POINT_NO_INTERRUPTS_IN_BLOCK annotation forbids the action of
    interrupts in the end or begin block to be included into the state
    graph.
    6fc8ff8d
    History
    aborted-computation.cc 797 B
    #include "os.h"
    #include "syscall.h"
    #include "timing.h"
    
    TIMING_MAKE_OS_MAIN( StartOS(0) )
    
    DeclareTask(Control);
    DeclareTask(Computation);
    DeclareEvent(ComputationFinished);
    DeclareEvent(ComputationAborted);
    
    
    GENERATE_TIME_CONSUMER(computation, 5000)
    
    
    TASK(Control) {
        timing_start(0);
        ActivateTask(Computation);
        WaitEvent(ComputationFinished | ComputationAborted);
        timing_end(TIMING_POINT_NO_INTERRUPTS_IN_BLOCK | 0);
    
        /* ABB Split Point */
        DisableAllInterrupts();
        EnableAllInterrupts();
        timing_dump();
        ShutdownMachine();
    
        TerminateTask();
    }
    
    TASK(Computation) {
        computation();
        SetEvent(Control, ComputationFinished);
        TerminateTask();
    }
    
    
    ISR2(Abort) {
        SetEvent(Control, ComputationAborted);
    }
    
    void PreIdleHook() {
        timing_dump();
    }