00001 00008 /* 00009 * The contents of this file are subject to the Mozilla Public License 00010 * Version 1.0 (the "License"); you may not use this file except in 00011 * compliance with the License. You may obtain a copy of the License 00012 * at http://www.mozilla.org/MPL/ 00013 * 00014 * Software distributed under the License is distributed on an "AS IS" 00015 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00016 * the License for the specific language governing rights and 00017 * limitations under the License. 00018 * 00019 * The Original Code is legOS code, released October 17, 1999. 00020 * 00021 * The Initial Developer of the Original Code is Markus L. Noga. 00022 * Portions created by Markus L. Noga are Copyright (C) 1999 00023 * Markus L. Noga. All Rights Reserved. 00024 * 00025 * Contributor(s): Markus L. Noga <markus@noga.de> 00026 * Lou Sortman <lou (at) sunsite (dot) unc (dot) edu> 00027 */ 00028 00029 #ifndef __tm_h__ 00030 #define __tm_h__ 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif // __cplusplus 00035 00036 #include <mem.h> 00037 00039 // 00040 // Definitions 00041 // 00043 00044 typedef volatile unsigned char tstate_t; 00045 typedef volatile unsigned char tflags_t; 00046 00047 typedef unsigned char priority_t; 00048 00050 #define PRIO_LOWEST 1 00051 00052 #define PRIO_NORMAL 10 00053 00054 #define PRIO_HIGHEST 20 00055 00056 typedef unsigned long wakeup_t; 00057 00058 // 00060 00064 #define T_DEAD 0 00065 #define T_ZOMBIE 1 00066 #define T_WAITING 2 00067 #define T_SLEEPING 3 00068 #define T_RUNNING 4 00069 00070 // 00072 // 00073 00074 #define T_KERNEL (1 << 0) 00075 #define T_USER (1 << 1) 00076 #define T_IDLE (1 << 2) 00077 #define T_SHUTDOWN (1 << 7) 00078 00079 00080 #define DEFAULT_STACK_SIZE 512 00081 00082 #ifndef DOXYGEN_SHOULD_SKIP_INTERNALS 00083 00087 struct _pchain_t { 00088 priority_t priority; 00089 00090 struct _pchain_t *next; 00091 struct _pchain_t *prev; 00092 00093 struct _tdata_t *ctid; 00094 }; 00095 00099 typedef struct _pchain_t pchain_t; 00100 00104 struct _tdata_t { 00105 size_t *sp_save; 00106 00107 tstate_t tstate; 00108 tflags_t tflags; 00109 pchain_t *priority; 00110 00111 struct _tdata_t *next; 00112 struct _tdata_t *prev; 00113 struct _tdata_t *parent; 00114 00115 size_t *stack_base; 00116 00117 wakeup_t(*wakeup) (wakeup_t); 00118 wakeup_t wakeup_data; 00119 }; 00120 00122 00124 typedef struct _tdata_t tdata_t; 00125 00126 #endif // DOXYGEN_SHOULD_SKIP_INTERNALS 00127 00128 #if defined(CONF_TM) 00129 00130 00133 #define shutdown_requested() ((ctid->tflags & T_SHUTDOWN) != 0) 00134 extern tdata_t *ctid; 00135 #else // CONF_TM 00136 #define shutdown_requested() (0) 00137 #endif // CONF_TM 00138 00140 00142 typedef size_t tid_t; 00143 00144 #ifdef __cplusplus 00145 } 00146 #endif // __cplusplus 00147 00148 #endif
brickOS is released under the
Mozilla Public License.
Original code copyright 1998-2002 by the authors. |