aboutsummaryrefslogtreecommitdiffstats
path: root/src/simulator/main.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-06-08 21:13:53 -0400
committerKevin O'Connor <kevin@koconnor.net>2016-06-13 23:18:59 -0400
commitfa85094cbb139c734150802b02e22913abcfccb3 (patch)
tree980eccc8282acfb602a96523488f033bb368fcd4 /src/simulator/main.c
parent9dd101c26fff95e596039d6168d4ad25e080071c (diff)
downloadkutter-fa85094cbb139c734150802b02e22913abcfccb3.tar.gz
kutter-fa85094cbb139c734150802b02e22913abcfccb3.tar.xz
kutter-fa85094cbb139c734150802b02e22913abcfccb3.zip
irq: Allow boards to define the return type of irq_save()
The AVR wants a uint8_t return type for irq_save(), but other architectures will generally prefer int. Allow the board to configure the size of the flag by introducing an irqstatus_t typedef. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/simulator/main.c')
-rw-r--r--src/simulator/main.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/simulator/main.c b/src/simulator/main.c
index 419fa531..1bffc265 100644
--- a/src/simulator/main.c
+++ b/src/simulator/main.c
@@ -16,28 +16,32 @@
* Interrupts
****************************************************************/
-uint8_t Interrupt_off;
+irqstatus_t Interrupt_off;
-void irq_disable(void)
+void
+irq_disable(void)
{
Interrupt_off = 1;
barrier();
}
-void irq_enable(void)
+void
+irq_enable(void)
{
barrier();
Interrupt_off = 0;
}
-uint8_t irq_save(void)
+irqstatus_t
+irq_save(void)
{
- uint8_t flag = Interrupt_off;
+ irqstatus_t flag = Interrupt_off;
irq_disable();
return flag;
}
-void irq_restore(uint8_t flag)
+void
+irq_restore(irqstatus_t flag)
{
barrier();
Interrupt_off = flag;