brickOS Kernel Developer v0.9.0
tm.h
Go to the documentation of this file.
1
8/*
9 * The contents of this file are subject to the Mozilla Public License
10 * Version 1.0 (the "License"); you may not use this file except in
11 * compliance with the License. You may obtain a copy of the License
12 * at http://www.mozilla.org/MPL/
13 *
14 * Software distributed under the License is distributed on an "AS IS"
15 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
16 * the License for the specific language governing rights and
17 * limitations under the License.
18 *
19 * The Original Code is legOS code, released October 17, 1999.
20 *
21 * The Initial Developer of the Original Code is Markus L. Noga.
22 * Portions created by Markus L. Noga are Copyright (C) 1999
23 * Markus L. Noga. All Rights Reserved.
24 *
25 * Contributor(s): Markus L. Noga <markus@noga.de>
26 * Lou Sortman <lou (at) sunsite (dot) unc (dot) edu>
27 */
28
29#ifndef __tm_h__
30#define __tm_h__
31
32#ifdef __cplusplus
33extern "C" {
34#endif // __cplusplus
35
36#include <config.h>
37#include <mem.h>
38
40//
41// Definitions
42//
44
45typedef volatile unsigned char tstate_t;
46typedef volatile unsigned char tflags_t;
47
48typedef unsigned char priority_t;
49
51#define PRIO_LOWEST 1
53#define PRIO_NORMAL 10
55#define PRIO_HIGHEST 20
56
57typedef unsigned long wakeup_t;
58
59//
61
65#define T_DEAD 0
66#define T_ZOMBIE 1
67#define T_WAITING 2
68#define T_SLEEPING 3
69#define T_RUNNING 4
70
71//
73//
74
75#define T_KERNEL (1 << 0)
76#define T_USER (1 << 1)
77#define T_IDLE (1 << 2)
78#define T_SHUTDOWN (1 << 7)
79
80
81#define DEFAULT_STACK_SIZE 512
82
83#ifndef DOXYGEN_SHOULD_SKIP_INTERNALS
88struct _pchain_t {
90
91 struct _pchain_t *next;
92 struct _pchain_t *prev;
93
94 struct _tdata_t *ctid;
95};
96
100typedef struct _pchain_t pchain_t;
101
121
123
125typedef struct _tdata_t tdata_t;
126
127#endif // DOXYGEN_SHOULD_SKIP_INTERNALS
128
129#if defined(CONF_TM)
131
134#define shutdown_requested() ((ctid->tflags & T_SHUTDOWN) != 0)
135extern tdata_t *ctid;
136#else // CONF_TM
137#define shutdown_requested() (0)
138#endif // CONF_TM
139
141
143typedef signed int tid_t;
144
145#ifdef __cplusplus
146}
147#endif // __cplusplus
148
149#endif
kernel configuration file
Interface: memory data types.
priority chain data structure
Definition tm.h:88
priority_t priority
numeric priority level
Definition tm.h:89
struct _pchain_t * prev
higher priority chain
Definition tm.h:92
struct _tdata_t * ctid
current task in chain
Definition tm.h:94
struct _pchain_t * next
lower priority chain
Definition tm.h:91
task data structure
Definition tm.h:105
wakeup_t(* wakeup)(wakeup_t)
event wakeup function
Definition tm.h:118
pchain_t * priority
priority chain
Definition tm.h:110
struct _tdata_t * next
next task in queue
Definition tm.h:112
struct _tdata_t * parent
parent task
Definition tm.h:114
tstate_t tstate
task state
Definition tm.h:108
size_t * sp_save
saved stack pointer
Definition tm.h:106
wakeup_t wakeup_data
user data for wakeup fn
Definition tm.h:119
size_t * stack_base
lower stack boundary
Definition tm.h:116
struct _tdata_t * prev
previous task in queue
Definition tm.h:113
tflags_t tflags
task flags
Definition tm.h:109
tdata_t * ctid
ptr to current process data
volatile unsigned char tflags_t
task flags type
Definition tm.h:46
signed int tid_t
task id type
Definition tm.h:143
unsigned long wakeup_t
wakeup data area type
Definition tm.h:57
volatile unsigned char tstate_t
task state type
Definition tm.h:45
unsigned char priority_t
task priority type
Definition tm.h:48