From 73f3b0636a369f9e89fe44b56825eead5361601c Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 5 Jun 2016 15:07:57 -0400 Subject: generic: Move simulator/irq.h to new file generic/irq.h Move the generic irq definitions into generic/irq.h and move the simulator irq code into main.c. Signed-off-by: Kevin O'Connor --- src/simulator/main.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/simulator/main.c') diff --git a/src/simulator/main.c b/src/simulator/main.c index e871864a..419fa531 100644 --- a/src/simulator/main.c +++ b/src/simulator/main.c @@ -7,10 +7,42 @@ #include #include #include +#include "board/misc.h" // timer_from_us +#include "board/irq.h" // irq_disable #include "sched.h" // sched_main + +/**************************************************************** + * Interrupts + ****************************************************************/ + uint8_t Interrupt_off; +void irq_disable(void) +{ + Interrupt_off = 1; + barrier(); +} + +void irq_enable(void) +{ + barrier(); + Interrupt_off = 0; +} + +uint8_t irq_save(void) +{ + uint8_t flag = Interrupt_off; + irq_disable(); + return flag; +} + +void irq_restore(uint8_t flag) +{ + barrier(); + Interrupt_off = flag; +} + /**************************************************************** * Timers -- cgit v1.2.3-70-g09d2