#ifndef __OS_H__
#define __OS_H__

#define MAX_TASKS 8

typedef unsigned long uint32_t;

typedef struct {
     void * sp; //The task's current stack pointer
     int flags; //Status flags includes activity status, parent task, etc
} task_table_t;

uint32_t current_task;
task_table_t task_table[MAX_TASKS];

//This defines the stack frame that is saved  by the hardware
typedef struct {
  uint32_t r0;
  uint32_t r1;
  uint32_t r2;
  uint32_t r3;
  uint32_t r12;
  uint32_t lr;
  uint32_t pc;
  uint32_t psr;
} hw_stack_frame_t;

//This defines the stack frame that must be saved by the software
typedef struct {
  uint32_t r4;
  uint32_t r5;
  uint32_t r6;
  uint32_t r7;
  uint32_t r8;
  uint32_t r9;
  uint32_t r10;
  uint32_t r11;
} sw_stack_frame_t;

static char m_stack[sizeof(sw_stack_frame_t)];

#endif /* OS_H_ */
