00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef __tm_h__
00030 #define __tm_h__
00031
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif // __cplusplus
00035
00036 #include <config.h>
00037 #include <mem.h>
00038
00040
00041
00042
00044
00045 typedef volatile unsigned char tstate_t;
00046 typedef volatile unsigned char tflags_t;
00047
00048 typedef unsigned char priority_t;
00049
00051 #define PRIO_LOWEST 1
00052
00053 #define PRIO_NORMAL 10
00054
00055 #define PRIO_HIGHEST 20
00056
00057 typedef unsigned long wakeup_t;
00058
00059
00061
00065 #define T_DEAD 0
00066 #define T_ZOMBIE 1
00067 #define T_WAITING 2
00068 #define T_SLEEPING 3
00069 #define T_RUNNING 4
00070
00071
00073
00074
00075 #define T_KERNEL (1 << 0)
00076 #define T_USER (1 << 1)
00077 #define T_IDLE (1 << 2)
00078 #define T_SHUTDOWN (1 << 7)
00079
00080
00081 #define DEFAULT_STACK_SIZE 512
00082
00083 #ifndef DOXYGEN_SHOULD_SKIP_INTERNALS
00084
00088 struct _pchain_t {
00089 priority_t priority;
00090
00091 struct _pchain_t *next;
00092 struct _pchain_t *prev;
00093
00094 struct _tdata_t *ctid;
00095 };
00096
00100 typedef struct _pchain_t pchain_t;
00101
00105 struct _tdata_t {
00106 size_t *sp_save;
00107
00108 tstate_t tstate;
00109 tflags_t tflags;
00110 pchain_t *priority;
00111
00112 struct _tdata_t *next;
00113 struct _tdata_t *prev;
00114 struct _tdata_t *parent;
00115
00116 size_t *stack_base;
00117
00118 wakeup_t(*wakeup) (wakeup_t);
00119 wakeup_t wakeup_data;
00120 };
00121
00123
00125 typedef struct _tdata_t tdata_t;
00126
00127 #endif // DOXYGEN_SHOULD_SKIP_INTERNALS
00128
00129 #if defined(CONF_TM)
00130
00131
00134 #define shutdown_requested() ((ctid->tflags & T_SHUTDOWN) != 0)
00135 extern tdata_t *ctid;
00136 #else // CONF_TM
00137 #define shutdown_requested() (0)
00138 #endif // CONF_TM
00139
00141
00143 typedef signed int tid_t;
00144
00145 #ifdef __cplusplus
00146 }
00147 #endif // __cplusplus
00148
00149 #endif