Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

task.h

Go to the documentation of this file.
00001 /* ndk - [ task.h ]
00002  *
00003  * Interface for creating/controlling tasks
00004  *
00005  * (c)2004 dcipher / neuraldk
00006  *           www.neuraldk.org
00007  */
00008 
00017 #ifndef __ndk_tss_h__
00018 #define __ndk_tss_h__
00019 
00020 // TODO: all this crap has to be made portable... move to task.c in arch!!!
00021 
00022 #include "ndk.h"
00023 #include "array.h"
00024 #include <errorCodes.h>
00025 #include <types.h>
00026 #include <messageQueue.h>
00027 
00028 // new API!
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 //extern Task currentTask;
00053 //extern Task firstTask;
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 //ErrorCode taskFirst(Task *task);
00118 
00126 //ErrorCode taskNext(Task current, Task *next);
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 

Generated on Wed Mar 22 20:36:33 2006 for ndk by  doxygen 1.4.4