aboutsummaryrefslogtreecommitdiffstats
path: root/src/simulator
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-06-05 15:07:57 -0400
committerKevin O'Connor <kevin@koconnor.net>2016-06-13 23:18:58 -0400
commit73f3b0636a369f9e89fe44b56825eead5361601c (patch)
tree932a8d71a547f579d78031385020cec786113227 /src/simulator
parent9f8817a47e10f35e8008e40576d2bc54157c2767 (diff)
downloadkutter-73f3b0636a369f9e89fe44b56825eead5361601c.tar.gz
kutter-73f3b0636a369f9e89fe44b56825eead5361601c.tar.xz
kutter-73f3b0636a369f9e89fe44b56825eead5361601c.zip
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 <kevin@koconnor.net>
Diffstat (limited to 'src/simulator')
-rw-r--r--src/simulator/irq.h31
-rw-r--r--src/simulator/main.c32
-rw-r--r--src/simulator/pgm.h13
3 files changed, 32 insertions, 44 deletions
diff --git a/src/simulator/irq.h b/src/simulator/irq.h
deleted file mode 100644
index 63f51290..00000000
--- a/src/simulator/irq.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#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
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 <fcntl.h>
#include <stdio.h>
#include <unistd.h>
+#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
diff --git a/src/simulator/pgm.h b/src/simulator/pgm.h
deleted file mode 100644
index e5f3787d..00000000
--- a/src/simulator/pgm.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef __SIMU_PGM_H
-#define __SIMU_PGM_H
-// This header provides wrappers for the AVR specific "PROGMEM"
-// declarations.
-
-#define PROGMEM
-#define PSTR(S) S
-#define READP(VAR) VAR
-#define vsnprintf_P(D, S, F, A) vsnprintf(D, S, F, A)
-#define strcasecmp_P(S1, S2) strcasecmp(S1, S2)
-#define memcpy_P(DST, SRC, SIZE) memcpy((DST), (SRC), (SIZE))
-
-#endif // pgm.h