Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 114 lines (91 sloc) 3.286 kB
dfcd29b @fincs Initial commit
authored
1 #pragma once
2 #include <nds.h>
14636b6 @fincs Add programmatic FeOS version support
authored
3 #include "../../sdk/include/feosver.h"
dfcd29b @fincs Initial commit
authored
4
992c6f2 @fincs Kernel: prepare header files for ARM7
authored
5 #ifdef ARM9
dfcd29b @fincs Initial commit
authored
6 #define ITCM_DATA __attribute__((section(".itcm")))
992c6f2 @fincs Kernel: prepare header files for ARM7
authored
7 #endif
dfcd29b @fincs Initial commit
authored
8
4499798 @fincs Implement the module list and many other changes to make this possible
authored
9 #define FeOS_AllocStack(a) __builtin_alloca(a)
10
992c6f2 @fincs Kernel: prepare header files for ARM7
authored
11 #ifdef ARM9
6886108 @fincs Add FEOSSTDIO module with basic stdio.h functions
authored
12 #define BEGIN_TABLE(_NAME_) static const fxe2_export_t _exp_##_NAME_##_tbl[] = {
13 #define ADD_FUNC(FUNC) {{(word_t)#FUNC}, {(word_t)FUNC}}
14 #define ADD_FUNC_ALIAS(FUNC, NAME) {{(word_t)#NAME}, {(word_t)FUNC}}
15 #define END_TABLE(_NAME_) };
16 #define MAKE_EXPORTSTRUCT(_NAME_) { sizeof(_exp_##_NAME_##_tbl) / sizeof(fxe2_export_t), (fxe2_export_t*) _exp_##_NAME_##_tbl }
17
f84231c @fincs Make fake modules more maintainable
authored
18 #define MAKE_FAKEMODULE(_NAME_) \
19 extern void* _inst_##_NAME_; \
20 \
21 fxe_runtime_header _header_##_NAME_ = \
22 { \
23 &_inst_##_NAME_, /* hThis */ \
24 #_NAME_, /* name */ \
25 1, /* refcount */ \
26 -1, /* file */ \
526b5d1 @fincs Add FeOS_ModuleFromAddress()
authored
27 0, /* size */ \
ed35af4 @fincs FEOSBASE: Add funcs for reading modules' extra data
authored
28 0, /* extrapos */ \
29 0, /* extrasize */ \
f84231c @fincs Make fake modules more maintainable
authored
30 NULL, /* entrypoint */ \
31 MAKE_EXPORTSTRUCT(_NAME_), /* exp */ \
32 { 0, NULL }, /* imp */ \
33 { NULL, 0 }, /* exidx */ \
34 NULL, /* next */ \
35 NULL /* prev */ \
36 }; \
37 \
38 void* _inst_##_NAME_ = &_header_##_NAME_;
992c6f2 @fincs Kernel: prepare header files for ARM7
authored
39 #endif
f84231c @fincs Make fake modules more maintainable
authored
40
dfcd29b @fincs Initial commit
authored
41 typedef unsigned int word_t;
42 typedef unsigned short hword_t;
43 typedef unsigned char byte_t;
44 typedef word_t bool_t;
45 typedef void* instance_t;
46
992c6f2 @fincs Kernel: prepare header files for ARM7
authored
47 #ifdef ARM9
0cc49d1 @fincs Revise module exit() protocol
authored
48 #include "feos_setjmp.h"
49
dfcd29b @fincs Initial commit
authored
50 void DoTheUserMode();
51 void PrepareUserMode();
52
0cebab2 @fincs Add user-mode IRQ system & begin writing user-mode FIFO system
authored
53 word_t __ARMSWP(word_t value, volatile word_t* addr);
54
b0486ab @fincs Add __inFAT variable
authored
55 extern bool_t __inFAT;
56
dfcd29b @fincs Initial commit
authored
57 static inline bool AddressCheckMainRAM(const void* addr)
58 {
59 return (word_t)addr >= 0x02000000 && (word_t)addr <= 0x03000000;
60 }
61
d272581 @fincs FeOS_Execute(): return meaningful error codes instead of -1
authored
62 #define E_FILENOTFOUND (-10)
63 #define E_INVALIDARG (-11)
088fbea @fincs Add support for killing the current application
authored
64 #define E_APPKILLED (-12)
d272581 @fincs FeOS_Execute(): return meaningful error codes instead of -1
authored
65
5e8cf58 @fincs Begin writing user-mode IRQ handing
authored
66 void FeOS_WaitForIRQ(word_t);
67 static inline void FeOS_WaitForVBlank()
68 {
69 FeOS_WaitForIRQ(IRQ_VBLANK);
70 }
dfcd29b @fincs Initial commit
authored
71
2170039 @fincs Add FeOS_NextIRQ() and FeOS_SetIRQWaitFunc()
authored
72 typedef void (*irqWaitFunc_t)(word_t);
73
0cebab2 @fincs Add user-mode IRQ system & begin writing user-mode FIFO system
authored
74 void FeOS_RunFifoQueue();
5165514 @fincs First pass at implementing user-mode FIFO handlers
authored
75 void FeOS_FifoSetDatamsgHandler(int channel, FifoDatamsgHandlerFunc handler, void* userdata);
76 void FeOS_FifoSetValue32Handler(int channel, FifoValue32HandlerFunc handler, void* userdata);
77 void FeOS_FifoSetAddressHandler(int channel, FifoAddressHandlerFunc handler, void* userdata);
0cebab2 @fincs Add user-mode IRQ system & begin writing user-mode FIFO system
authored
78 VoidFn FeOS_SetInterrupt(word_t mask, VoidFn fn);
79 word_t FeOS_CheckPendingIRQs();
80 void FeOS_WaitForIRQ(word_t mask);
2170039 @fincs Add FeOS_NextIRQ() and FeOS_SetIRQWaitFunc()
authored
81 word_t FeOS_NextIRQ();
82
83 #define GET_IRQFUNC ((irqWaitFunc_t)0xFFFFFFFF)
84 irqWaitFunc_t FeOS_SetIRQWaitFunc(irqWaitFunc_t newFunc);
0cebab2 @fincs Add user-mode IRQ system & begin writing user-mode FIFO system
authored
85
370abf5 @fincs Add FEOSMATH fake module / feosmath.h header file
authored
86 int __getMode();
87 #define isUserMode() (__getMode() == 0x10)
88
0701d22 @fincs Add FeOS_SetSuspendMode() for controlling lid behaviour
authored
89 enum { MODE_GET = -1, MODE_DISABLED = 0, MODE_NORMAL, MODE_HEADPHONES, MODE_COUNT };
90 int FeOS_swi_SetSuspendMode(int mode);
91
fd30a07 @fincs Kernel: add many assertions
authored
92 #define ERRSTR_INVALIDPARAM "Invalid parameter"
93 #define CHK_HINST(hInst) sassert(AddressCheckMainRAM(hInst), ERRSTR_INVALIDPARAM);
94
ed35af4 @fincs FEOSBASE: Add funcs for reading modules' extra data
authored
95 #define tell(fd) lseek(fd, 0, SEEK_CUR)
96
a4ca3b6 @fincs Add function to turn on/off automatic OAM/background/keys updating
authored
97 extern bool bOAMUpd, bBgUpd, bKeyUpd;
98
99 enum { AUTOUPD_OAM = 1, AUTOUPD_BG, AUTOUPD_KEYS };
100 void FeOS_SetAutoUpdate(int which, bool enable);
101 bool FeOS_GetAutoUpdate(int which);
102
dfcd29b @fincs Initial commit
authored
103 void FeOS_swi_DataCacheFlush(const void* mem, size_t size);
756d368 @fincs Expose cache management functions
authored
104 void FeOS_swi_DataCacheFlushAll();
dfcd29b @fincs Initial commit
authored
105 void FeOS_swi_InstrCacheInvalidate(const void* mem, size_t size);
106 void FeOS_swi_InstrCacheInvalidateAll();
2dcc91e @fincs Add IRQ enable/disable funcs
authored
107 void FeOS_swi_IrqEnable(word_t mask);
108 void FeOS_swi_IrqDisable(word_t mask);
1d81c61 @fincs Fix ARM9 datamsg receiving, add fifoCheckDatamsgLength
authored
109 //void FeOS_swi_SetDatamsgHandler(int, bool);
110 int FeOS_swi_FifoCheckDatamsgLength(int ch);
5165514 @fincs First pass at implementing user-mode FIFO handlers
authored
111 void FeOS_swi_SetValue32Handler(int, bool);
112 void FeOS_swi_SetAddressHandler(int, bool);
992c6f2 @fincs Kernel: prepare header files for ARM7
authored
113 #endif
Something went wrong with that request. Please try again.