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
33
extern
"C"
{
34
#endif // __cplusplus
35
36
#include <config.h>
37
#include <
mem.h
>
38
40
//
41
// Definitions
42
//
44
45
typedef
volatile
unsigned
char
tstate_t
;
46
typedef
volatile
unsigned
char
tflags_t
;
47
48
typedef
unsigned
char
priority_t
;
49
51
#define PRIO_LOWEST 1
52
#define PRIO_NORMAL 10
54
#define PRIO_HIGHEST 20
56
57
typedef
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
84
88
struct
_pchain_t {
89
priority_t
priority;
90
91
struct
_pchain_t *next;
92
struct
_pchain_t *prev;
93
94
struct
_tdata_t *
ctid
;
95
};
96
100
typedef
struct
_pchain_t pchain_t;
101
105
struct
_tdata_t {
106
size_t
*sp_save;
107
108
tstate_t
tstate;
109
tflags_t
tflags;
110
pchain_t *priority;
111
112
struct
_tdata_t *next;
113
struct
_tdata_t *prev;
114
struct
_tdata_t *parent;
115
116
size_t
*stack_base;
117
118
wakeup_t
(*wakeup) (
wakeup_t
);
119
wakeup_t
wakeup_data;
120
};
121
123
125
typedef
struct
_tdata_t tdata_t;
126
127
#endif // DOXYGEN_SHOULD_SKIP_INTERNALS
128
129
#if defined(CONF_TM)
130
134
#define shutdown_requested() ((ctid->tflags & T_SHUTDOWN) != 0)
135
extern
tdata_t *
ctid
;
136
#else // CONF_TM
137
#define shutdown_requested() (0)
138
#endif // CONF_TM
139
141
143
typedef
signed
int
tid_t
;
144
145
#ifdef __cplusplus
146
}
147
#endif // __cplusplus
148
149
#endif
wakeup_t
unsigned long wakeup_t
wakeup data area type
Definition:
tm.h:57
tstate_t
volatile unsigned char tstate_t
task state type
Definition:
tm.h:45
ctid
tdata_t * ctid
tid_t
signed int tid_t
task id type
Definition:
tm.h:143
priority_t
unsigned char priority_t
task priority type
Definition:
tm.h:48
tflags_t
volatile unsigned char tflags_t
task flags type
Definition:
tm.h:46
mem.h
Interface: memory data types.
brickOS
is released under the
Mozilla Public License
.
Original code copyright 1998-2005 by the authors.
Generated for brickOS C by
1.8.16