00001
00002
00003
00004
00005
00006
00007
00008
00017 #ifndef __ndk_tss_h__
00018 #define __ndk_tss_h__
00019
00020
00021
00022 #include "ndk.h"
00023 #include "array.h"
00024 #include <errorCodes.h>
00025 #include <types.h>
00026 #include <messageQueue.h>
00027
00028
00029 typedef enum _TaskType
00030 {
00031 TaskTypeOS = 0,
00032 TaskTypeUser
00033 } TaskType;
00034
00035 typedef enum _TaskState
00036 {
00037 TaskStateDead,
00038 TaskStateAlive,
00039 TaskStateWaiting,
00040 TaskStateTimedOut
00041 } TaskState;
00042
00043 typedef enum _TaskWaitingOn
00044 {
00045 TaskWaitingOnMutex,
00046 TaskWaitingOnSemaphore,
00047 TaskWaitingOnDelay
00048 } TaskWaitingOn;
00049
00050 typedef struct _Task *Task;
00051
00052
00053
00054
00071 ErrorCode taskCreate(Task *task, Task parent, String name, void (*entry) (void *), void *argument,
00072 TaskType type, uint32 stackSize, uint8 priority);
00073
00079 ErrorCode taskDestroy(Task *task);
00080
00086 ErrorCode taskGetCurrent(Task *task);
00087
00094 ErrorCode taskGetState(Task task, TaskState * state);
00095
00102 ErrorCode taskSetState(Task task, TaskState state);
00103
00110 ErrorCode taskGetMessageQueue(Task task, MessageQueue *queue);
00111
00117
00118
00126
00127
00134 ErrorCode taskSetTimeout(Task task, Timeout to);
00135
00140 ErrorCode taskForceSwitch(void);
00141
00148 ErrorCode taskPrintStackTrace(Task task);
00149
00157 ErrorCode taskGetStackPointer(Task task, Pointer *ptr);
00158
00165 ErrorCode taskGetStackBase(Task task, Pointer *ptr);
00166
00173 ErrorCode taskGetStackSize(Task task, uint32 *size);
00174
00180 ErrorCode taskGetStackDirection(int32 *direction);
00181
00182 #endif
00183