diff options
author | red031000 <rubenru09@aol.com> | 2020-05-28 18:55:41 +0100 |
---|---|---|
committer | red031000 <rubenru09@aol.com> | 2020-05-28 18:58:32 +0100 |
commit | 53dd5bc0de0fb2237c57520971a7854e0dde5902 (patch) | |
tree | 350bb84779b932901dd0a27a540969ab17121b6f /arm9/lib/src | |
parent | d42cc73852cdb0cc0684bb87aaa6975d06cae02f (diff) |
OS_irqHandler
Diffstat (limited to 'arm9/lib/src')
-rw-r--r-- | arm9/lib/src/OS_interrupt.c | 4 | ||||
-rw-r--r-- | arm9/lib/src/OS_irqHandler.c | 24 | ||||
-rw-r--r-- | arm9/lib/src/OS_system.c | 1 |
3 files changed, 25 insertions, 4 deletions
diff --git a/arm9/lib/src/OS_interrupt.c b/arm9/lib/src/OS_interrupt.c index 4692fd54..c7c0704d 100644 --- a/arm9/lib/src/OS_interrupt.c +++ b/arm9/lib/src/OS_interrupt.c @@ -1,7 +1,3 @@ -// -// Created by red031000 on 2020-05-07. -// - #include "consts.h" #include "function_target.h" #include "OS_interrupt.h" diff --git a/arm9/lib/src/OS_irqHandler.c b/arm9/lib/src/OS_irqHandler.c new file mode 100644 index 00000000..31f4453e --- /dev/null +++ b/arm9/lib/src/OS_irqHandler.c @@ -0,0 +1,24 @@ +#include "function_target.h" +#include "OS_irqHandler.h" +#include "OS_system.h" +#include "OS_thread.h" +#include "sections.h" + +#pragma section DTCM begin +OSThreadQueue OSi_IrqThreadQueue = { NULL, NULL }; +#pragma section DTCM end + +ARM_FUNC void OS_WaitIrq(BOOL clear, OSIrqMask irqFlags) +{ + OSIntrMode lastIntrMode = OS_DisableInterrupts(); + if (clear) + { + OS_ClearIrqCheckFlag(irqFlags); + } + (void)OS_RestoreInterrupts(lastIntrMode); + + while (!(OS_GetIrqCheckFlag() & irqFlags)) + { + OS_SleepThread(&OSi_IrqThreadQueue); + } +} diff --git a/arm9/lib/src/OS_system.c b/arm9/lib/src/OS_system.c index 1d257679..b703fc38 100644 --- a/arm9/lib/src/OS_system.c +++ b/arm9/lib/src/OS_system.c @@ -3,6 +3,7 @@ // #include "OS_system.h" +#include "OS_irqHandler.h" #include "syscall.h" ARM_FUNC asm OSIntrMode OS_EnableInterrupts(void) { |