* scheduler revamp, simpler design

* fix dumb bug of the year: ARM LDR opcodes would accidentally read twice, which fucked with things like the IPC FIFO.
This commit is contained in:
StapleButter
2017-01-31 03:54:51 +01:00
parent 348bbd8cb8
commit 594286ee5d
10 changed files with 274 additions and 108 deletions

25
NDS.h
View File

@ -24,7 +24,7 @@
namespace NDS
{
#define SCHED_BUF_LEN 64
/*#define SCHED_BUF_LEN 64
typedef struct _SchedEvent
{
@ -34,7 +34,7 @@ typedef struct _SchedEvent
struct _SchedEvent* PrevEvent;
struct _SchedEvent* NextEvent;
} SchedEvent;
} SchedEvent;*/
enum
{
@ -52,6 +52,14 @@ enum
Event_MAX
};
typedef struct
{
void (*Func)(u32 param);
s32 WaitCycles;
u32 Param;
} SchedEvent;
enum
{
IRQ_VBlank = 0,
@ -84,9 +92,10 @@ enum
typedef struct
{
u16 Reload;
u16 Control;
u16 Counter;
SchedEvent* Event;
u16 Cnt;
u32 Counter;
u32 CycleShift;
//SchedEvent* Event;
} Timer;
@ -111,9 +120,11 @@ void RunFrame();
void PressKey(u32 key);
void ReleaseKey(u32 key);
SchedEvent* ScheduleEvent(s32 Delay, void (*Func)(u32), u32 Param);
/*SchedEvent* ScheduleEvent(s32 Delay, void (*Func)(u32), u32 Param);
void CancelEvent(SchedEvent* event);
void RunEvents(s32 cycles);
void RunEvents(s32 cycles);*/
void ScheduleEvent(u32 id, bool periodic, s32 delay, void (*func)(u32), u32 param);
void CancelEvent(u32 id);
// DO NOT CALL FROM ARM7!!
void CompensateARM7();