enum {T-CREATED, T_READY};
typedef struct TaskControlBlock
{
struct TaskControlBlock *next;
unsigned char tid; /* task id */
unsigned char state; /* task state, do not use enum since
compiler may allocate more space */
unsigned char ticks; /* how many ticks does task execute */
unsigned char current_ticks; /* number of ticks remaining */
void (*func)(void); /* function to call for that task */
unsigned char *stack_start; /* stack low value */
unsigned char *stack_end; /* stack high value */
unsigned char *sp; /* current value of stack pointer */
}
TaskControlBlock;
Listing 3The key data structure of a multitasking executive is its task control block. µexecs task control block is described here as a C structure.