diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2020-06-05 13:28:02 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2020-06-05 13:28:02 -0400 |
commit | 60c9307cae1c4e5ca18c90181fe0a227db95562a (patch) | |
tree | 48852e434188ddd2d2954bcde7ae59a50ef2da8e /arm7/lib/include/OS_system.h | |
parent | 6c31958c9daa124877b31cf8456a890d3c736bc1 (diff) | |
parent | 9595aa2bee8b1c87342cf20cff10c2675aa1006f (diff) |
Merge branch 'master' of github.com:martmists/pokediamond into pikalax_work
Diffstat (limited to 'arm7/lib/include/OS_system.h')
-rw-r--r-- | arm7/lib/include/OS_system.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/arm7/lib/include/OS_system.h b/arm7/lib/include/OS_system.h new file mode 100644 index 00000000..b6c81ab4 --- /dev/null +++ b/arm7/lib/include/OS_system.h @@ -0,0 +1,37 @@ +#ifndef POKEDIAMOND_ARM7_OS_SYSTEM_H +#define POKEDIAMOND_ARM7_OS_SYSTEM_H + +#include "types.h" + +//todo consts.h +#define HW_PSR_CPU_MODE_MASK 0x1f // CPU mode + +#define HW_PSR_DISABLE_FIQ 0x40 // Disable FIQ +#define HW_PSR_DISABLE_IRQ 0x80 // Disable IRQ +#define HW_PSR_DISABLE_IRQ_FIQ 0xc0 // Disable FIQ and IRQ + +typedef enum { + OS_PROCMODE_USER=16, + OS_PROCMODE_FIQ=17, + OS_PROCMODE_IRQ=18, + OS_PROCMODE_SVC=19, + OS_PROCMODE_ABORT=23, + OS_PROCMODE_UNDEF=27, + OS_PROCMODE_SYS=31 +} OSProcMode; + +typedef enum { + OS_INTRMODE_DISABLE_IRQ = HW_PSR_DISABLE_IRQ, + OS_INTRMODE_DISABLE_FIQ = HW_PSR_DISABLE_FIQ, + OS_INTRMODE_ENABLE = 0 +} OSIntrMode; + +OSIntrMode OS_EnableInterrupts(void); +OSIntrMode OS_DisableInterrupts(void); +OSIntrMode OS_RestoreInterrupts(register OSIntrMode state); +OSIntrMode OS_DisableInterrupts_IrqAndFiq(void); +OSIntrMode OS_RestoreInterrupts_IrqAndFiq(register OSIntrMode state); +OSProcMode OS_GetProcMode(void); +void OS_SpinWait(u32 cycle); + +#endif //POKEDIAMOND_ARM7_OS_SYSTEM_H |