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

include/tm.h

Go to the documentation of this file.
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 <config.h>
00037 #include <mem.h>
00038 
00040 //
00041 // Definitions
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

brickOS is released under the Mozilla Public License.
Original code copyright 1998-2002 by the authors.

Generated on Mon Feb 16 21:01:52 2004 for brickOS C by doxygen 1.3.5