Changes

Jump to navigation Jump to search
610 bytes added ,  05:27, 18 July 2022
added a section on time
Line 89: Line 89:  
== Memory allocation ==
 
== Memory allocation ==
 
3 types of heaps exist: EXPH (exponential heap), FRMH (frame heap), and UNTH (unit heap).
 
3 types of heaps exist: EXPH (exponential heap), FRMH (frame heap), and UNTH (unit heap).
 +
 +
== Time ==
 +
Time is kept with timers 2 and 3, while alarm interrupts are handled by timer 1; timer 0 is presumably reserved for the DMA sound channels. The OS orders the alarms by alert time, so that it only needs to keep track of the frontmost alarm.
 +
 +
<pre>
 +
struct OSAlarm {
 +
void (*handler)(void *userData);
 +
void *userData;
 +
u32 unknown;
 +
u64 alertTime;
 +
struct OSAlarm *prev;
 +
struct OSAlarm *next;
 +
u64 repeatInterval; // 0 for non-repeating alarms
 +
u64 repeatStart; // undefined value for non-repeating alarms
 +
}
 +
 +
struct OSAlarmQueue {
 +
u32 unknown;
 +
struct OSAlarm *head;
 +
struct OSAlarm *tail;
 +
}
 +
</pre>
322

edits

Navigation menu