diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-05-25 11:37:40 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-05-25 11:37:40 -0400 |
commit | f582a36e4df16d5709943f7df17a900c8bcc12ab (patch) | |
tree | 628d927c4f3e19e54618f7f47c7a44af66bf0c2f /src/simulator/irq.h | |
parent | 37a91e9c10648208de002c75df304e23ca89e256 (diff) | |
download | kutter-f582a36e4df16d5709943f7df17a900c8bcc12ab.tar.gz kutter-f582a36e4df16d5709943f7df17a900c8bcc12ab.tar.xz kutter-f582a36e4df16d5709943f7df17a900c8bcc12ab.zip |
Initial commit of source code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/simulator/irq.h')
-rw-r--r-- | src/simulator/irq.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/simulator/irq.h b/src/simulator/irq.h new file mode 100644 index 00000000..63f51290 --- /dev/null +++ b/src/simulator/irq.h @@ -0,0 +1,31 @@ +#ifndef __SIMU_IRQ_H +#define __SIMU_IRQ_H +// Definitions for irq enable/disable on host simulator + +#include <stdint.h> +#include "compiler.h" // barrier + +extern uint8_t Interrupt_off; + +static inline void irq_disable(void) { + Interrupt_off = 1; + barrier(); +} + +static inline void irq_enable(void) { + barrier(); + Interrupt_off = 0; +} + +static inline uint8_t irq_save(void) { + uint8_t flag = Interrupt_off; + irq_disable(); + return flag; +} + +static inline void irq_restore(uint8_t flag) { + barrier(); + Interrupt_off = flag; +} + +#endif // irq.h |