// *************************************************************** // Register Usage Summary // *************************************************************** // R1 = Compiler R17 = Free // R2 = Bit Variables R18 = Free // R3 = (LSB) System_Time R19 = Free // R4 = (MSB) System_Time R20 = Free // R5 = (LSB) T0_Compare R21 = Free // R6 = (MSB) T0_Comapre R22 = Compiler // R7 = (LSB) Current_Time R23 = Compiler // R8 = (MSB) Current_Time R24 = Compiler // R9 = Reserved R25 = Compiler // R10 = Reserved R26 = (X LSB) Compiler // R11 = Reserved R27 = (X MSB) Compiler // R12 = Reserved R28 = (Y LSB) Compiler - Data Stack // R13 = Reserved R29 = (Y MSB) Compiler - Data Stack // R14 = Free R30 = (Z LSB) Compiler // R15 = Free R31 = (Z MSB) Compiler // R16 = Free // ************************************ // Job Queues // ************************************ // Job Control Blocks; Size(N)=4+N*12 struct JCB_P { unsigned int Deadline, Period; void (*Task)(void), (*After_Task)(void); struct JCB_P *Next, *Prev; } Job_Table[MAX_JOBS]; struct JCB_P *Job_Table_Head, *Job_Table_Tail; // Hard Periodic Job Queue (Priority = 0); Size(N)=4+N*6 struct Queue_Entry_HP { long Start, End; struct JCB_P *Job; struct Queue_Entry_HP *Next, *Prev; } Queue_HP[MAX_QUEUE_HP]; struct Queue_Entry_HP *Queue_HP_Head, *Queue_HP_Tail, *Current_HP; // Hard Aperiodic Job Queue (Priority = 1); Size(N)=4+N*8 struct Queue_Entry_HA { void (*Task)(void); unsigned int Deadline; struct Queue_Entry_HA *Next, *Prev; } Queue_HA[MAX_QUEUE_HA]; struct Queue_Entry_HA *Queue_HA_Head, *Queue_HA_Tail; // Soft Periodic Job Queue (Priority = 2); Size(N)=4+N*6 struct Queue_Entry_SP { void (*Task)(void); struct Queue_Entry_SP *Next, *Prev; } Queue_SP[MAX_QUEUE_SP]; struct Queue_Entry_SP *Queue_SP_Head, *Queue_SP_Tail; // Soft Aperiodic (Priority = 3); Size(N)=4+N*6 struct Queue_Entry_SA { void (*Task)(void); struct Queue_Entry_SA *Next, *Prev; } Queue_SA[MAX_QUEUE_SA]; struct Queue_Entry_SA *Queue_SA_Head, *Queue_SA_Tail; // ************************************ // Scheduler // ************************************ // Data & Hardware Stack Spaces unsigned char Context_HP[DSTACK_HP + HSTACK_HP]; unsigned char Context_HA[DSTACK_HA + HSTACK_HA]; unsigned char Context_SP[DSTACK_SP + HSTACK_SP]; unsigned char Context_SA[DSTACK_SA + HSTACK_SA]; // ** should spacify memory location unsigned char Context_Regs_HA[CONTEXT_SIZE+4]; unsigned char Context_Regs_SP[CONTEXT_SIZE+4]; unsigned char Context_Regs_SA[CONTEXT_SIZE+4]; // Task Execution Status bit Context_Ex_HP; bit Context_Ex_HA; bit Context_Ex_SP; bit Context_Ex_SA; bit Context_New; bit FILL1, FILL2, FILL3; // ************************************ // Operating System State // ************************************ #if (NUM_LOCKS > 0) unsigned char Locks[NUM_LOCKS]; #endif register unsigned int System_Time @3; register unsigned int T0_Compare @5; register unsigned int Current_Time @7; register unsigned char OS_RESERVED_1 @9; register unsigned char OS_RESERVED_2 @10; register unsigned char OS_RESERVED_3 @11; register unsigned char OS_RESERVED_4 @12; register unsigned char OS_RESERVED_5 @13; void (*Current_Task)(void);