version 1.2, 2007/11/20 12:57:37 |
version 1.3, 2007/11/20 16:07:23 |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
|
/* |
/* |
* Task header is used by user to describe task in config.c |
* Task header is used by user to describe task in config.c. |
|
* "user task". |
*/ |
*/ |
struct taskheader { |
struct u_task { |
const char *th_name; /* task name */ |
const char *ut_name; /* task name */ |
uint8_t th_priority; /* priority, bigger the value = higher priority */ |
uint8_t ut_priority; /* priority, bigger the value = higher priority */ |
void (*th_enter)(void); /* entry point */ |
void (*ut_enter)(void); /* entry point */ |
}; |
}; |
|
|
|
|
|
#if 0 |
/* |
/* |
* Kernel sees each system task as struct task; |
* Task PCB (process control block). |
|
* this is task's hardware context. |
|
*/ |
|
struct pcb __attribute__((packed)) { |
|
|
|
/* ARM general purpose registers */ |
|
uint32_t p_r0; |
|
|
|
} |
|
#endif /* 0 */ |
|
|
|
/* |
|
* Kernel sees each system task as struct k_task; |
* it is used for scheduling and context switches. |
* it is used for scheduling and context switches. |
|
* "kernel task". |
*/ |
*/ |
struct task { |
struct k_task { |
struct taskheader *ta_theader; /* points to user-described data */ |
struct u_task *kt_utask; /* points to user-described data */ |
uint8_t ta_taskid; /* task id (TID) */ |
uint8_t kt_tid; /* task id (TID) */ |
|
|
uint8_t ta_state; /* task state (running, blocked, etc.) */ |
uint8_t kt_state; /* task state (running, blocked, etc.) */ |
uint32_t ta_timeo; /* timeout (in HZ) if task is blocked */ |
// uint32_t kt_timeo; /* timeout (in HZ) if task is blocked */ |
uint32_t *ta_stackptr; /* task stack addr (used to switch-back to that task) */ |
uint32_t kt_pcb[15]; /* hardware context (15 ARM registers) */ |
|
|
struct task *ta_nextp; |
|
|
struct k_task *kt_next; |
}; |
}; |
|
|
/* |
/* |