git.droids-corp.org
/
aversive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
hostsim: rework to have a more precise interrupt emulation
[aversive.git]
/
include
/
aversive
/
irq_lock.h
diff --git
a/include/aversive/irq_lock.h
b/include/aversive/irq_lock.h
index
ec45b68
..
56ef5bd
100644
(file)
--- a/
include/aversive/irq_lock.h
+++ b/
include/aversive/irq_lock.h
@@
-42,12
+42,22
@@
#ifdef HOST_VERSION
#ifdef HOST_VERSION
+#ifdef CONFIG_MODULE_HOSTSIM
#include <hostsim.h>
/* we must use 'flags' to avoid a warning */
#include <hostsim.h>
/* we must use 'flags' to avoid a warning */
-#define IRQ_UNLOCK(flags) do { flags=0; hostsim_lock(); } while(0)
-#define IRQ_LOCK(flags) do { flags=0; hostsim_unlock(); } while(0)
+#define cli() do { hostsim_cli(); } while(0)
+#define sei() do { hostsim_sei(); } while(0)
+#define IRQ_LOCK(flags) do { flags = hostsim_irq_save(); } while(0)
+#define IRQ_UNLOCK(flags) do { hostsim_irq_restore(flags); } while(0)
#define GLOBAL_IRQ_ARE_MASKED() hostsim_islocked()
#define GLOBAL_IRQ_ARE_MASKED() hostsim_islocked()
+#else
+#define cli() do {} while(0)
+#define sei() do {} while(0)
+#define IRQ_LOCK(flags) do { (void)flags; } while(0)
+#define IRQ_UNLOCK(flags) do { (void)flags; } while(0)
+#define GLOBAL_IRQ_ARE_MASKED() (0)
+#endif /* CONFIG_MODULE_HOSTSIM */
#else
#else