1 |
786 |
skrzyp |
#ifndef CYGONCE_KERNEL_KAPIDATA_H
|
2 |
|
|
#define CYGONCE_KERNEL_KAPIDATA_H
|
3 |
|
|
|
4 |
|
|
/*=============================================================================
|
5 |
|
|
//
|
6 |
|
|
// kapidata.h
|
7 |
|
|
//
|
8 |
|
|
// Native API data structures
|
9 |
|
|
//
|
10 |
|
|
//==========================================================================
|
11 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
12 |
|
|
// -------------------------------------------
|
13 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
14 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
15 |
|
|
//
|
16 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
17 |
|
|
// the terms of the GNU General Public License as published by the Free
|
18 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
19 |
|
|
// version.
|
20 |
|
|
//
|
21 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
22 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
23 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
24 |
|
|
// for more details.
|
25 |
|
|
//
|
26 |
|
|
// You should have received a copy of the GNU General Public License
|
27 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
28 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
29 |
|
|
//
|
30 |
|
|
// As a special exception, if other files instantiate templates or use
|
31 |
|
|
// macros or inline functions from this file, or you compile this file
|
32 |
|
|
// and link it with other works to produce a work based on this file,
|
33 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
34 |
|
|
// the GNU General Public License. However the source code for this file
|
35 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
36 |
|
|
// General Public License v2.
|
37 |
|
|
//
|
38 |
|
|
// This exception does not invalidate any other reasons why a work based
|
39 |
|
|
// on this file might be covered by the GNU General Public License.
|
40 |
|
|
// -------------------------------------------
|
41 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
42 |
|
|
//==========================================================================
|
43 |
|
|
//#####DESCRIPTIONBEGIN####
|
44 |
|
|
//
|
45 |
|
|
// Author(s): nickg
|
46 |
|
|
// Contributors: nickg
|
47 |
|
|
// Date: 1998-03-13
|
48 |
|
|
// Purpose: Native API data structures
|
49 |
|
|
// Description: This file defines the structures used in the native API. The
|
50 |
|
|
// sizes of these structures are dependent on the system
|
51 |
|
|
// configuration and must be kept in step with their real
|
52 |
|
|
// counterparts in the C++ headers.
|
53 |
|
|
// IMPORTANT: It is NOT guaranteed that the fields of these
|
54 |
|
|
// structures correspond to the equivalent fields in the
|
55 |
|
|
// C++ classes they shadow.
|
56 |
|
|
//
|
57 |
|
|
// One oddity with this file is that the way many of the "mirror"
|
58 |
|
|
// classes are defined with macros. The resulting structures
|
59 |
|
|
// then have a "flat" layout, rather than just declaring a
|
60 |
|
|
// member structure directly in the structure. The reason for
|
61 |
|
|
// this is that as of GCC 3.x, the C++ compiler will optimise
|
62 |
|
|
// classes by removing padding and reusing it for subsequent
|
63 |
|
|
// members defined in a derived class. This affects some targets
|
64 |
|
|
// (including PowerPC and MIPS at least) when a C++ base class
|
65 |
|
|
// includes a long long. By instead arranging for the C structure
|
66 |
|
|
// to just list all the members directly, the compiler will then
|
67 |
|
|
// behave the same for the C structures as the C++ classes.
|
68 |
|
|
//
|
69 |
|
|
// This means that care has to be taken to follow the same
|
70 |
|
|
// methodology if new stuff is added to this file. Even if
|
71 |
|
|
// it doesn't contain long longs for your target, it may for
|
72 |
|
|
// others, depending on HAL definitions.
|
73 |
|
|
//
|
74 |
|
|
// Usage: included by kapi.h
|
75 |
|
|
//
|
76 |
|
|
//####DESCRIPTIONEND####
|
77 |
|
|
//
|
78 |
|
|
//==========================================================================*/
|
79 |
|
|
|
80 |
|
|
#include <pkgconf/system.h>
|
81 |
|
|
#include <pkgconf/kernel.h>
|
82 |
|
|
|
83 |
|
|
#include <cyg/infra/cyg_type.h>
|
84 |
|
|
#include <cyg/hal/hal_intr.h> // exception defines
|
85 |
|
|
|
86 |
|
|
/*---------------------------------------------------------------------------*/
|
87 |
|
|
|
88 |
|
|
#ifdef __cplusplus
|
89 |
|
|
extern "C" {
|
90 |
|
|
#endif
|
91 |
|
|
|
92 |
|
|
/*---------------------------------------------------------------------------*/
|
93 |
|
|
|
94 |
|
|
#ifndef CYGNUM_KERNEL_SCHED_BITMAP_SIZE
|
95 |
|
|
#if defined(CYGSEM_KERNEL_SCHED_MLQUEUE)
|
96 |
|
|
#define CYGNUM_KERNEL_SCHED_BITMAP_SIZE 32
|
97 |
|
|
#elif defined(CYGSEM_KERNEL_SCHED_BITMAP)
|
98 |
|
|
#define CYGNUM_KERNEL_SCHED_BITMAP_SIZE 32
|
99 |
|
|
#endif
|
100 |
|
|
#endif
|
101 |
|
|
|
102 |
|
|
#if CYGNUM_KERNEL_SCHED_BITMAP_SIZE <= 8
|
103 |
|
|
typedef cyg_ucount8 cyg_sched_bitmap;
|
104 |
|
|
#elif CYGNUM_KERNEL_SCHED_BITMAP_SIZE <= 16
|
105 |
|
|
typedef cyg_ucount16 cyg_sched_bitmap;
|
106 |
|
|
#elif CYGNUM_KERNEL_SCHED_BITMAP_SIZE <= 32
|
107 |
|
|
typedef cyg_ucount32 cyg_sched_bitmap;
|
108 |
|
|
#elif CYGNUM_KERNEL_SCHED_BITMAP_SIZE <= 64
|
109 |
|
|
typedef cyg_ucount64 cyg_sched_bitmap;
|
110 |
|
|
#else
|
111 |
|
|
#error Bitmaps greater than 64 bits not currently allowed
|
112 |
|
|
#endif
|
113 |
|
|
|
114 |
|
|
typedef struct
|
115 |
|
|
{
|
116 |
|
|
#if defined(CYGSEM_KERNEL_SCHED_BITMAP)
|
117 |
|
|
|
118 |
|
|
cyg_sched_bitmap map;
|
119 |
|
|
|
120 |
|
|
#elif defined(CYGSEM_KERNEL_SCHED_MLQUEUE)
|
121 |
|
|
|
122 |
|
|
cyg_thread *queue;
|
123 |
|
|
|
124 |
|
|
#elif defined(CYGSEM_KERNEL_SCHED_LOTTERY)
|
125 |
|
|
|
126 |
|
|
cyg_thread *queue;
|
127 |
|
|
|
128 |
|
|
#else
|
129 |
|
|
|
130 |
|
|
#error Undefined scheduler type
|
131 |
|
|
|
132 |
|
|
#endif
|
133 |
|
|
} cyg_threadqueue;
|
134 |
|
|
|
135 |
|
|
/*---------------------------------------------------------------------------*/
|
136 |
|
|
|
137 |
|
|
struct cyg_interrupt
|
138 |
|
|
{
|
139 |
|
|
cyg_vector_t vector;
|
140 |
|
|
cyg_priority_t priority;
|
141 |
|
|
cyg_ISR_t *isr;
|
142 |
|
|
cyg_DSR_t *dsr;
|
143 |
|
|
CYG_ADDRWORD data;
|
144 |
|
|
|
145 |
|
|
#ifdef CYGIMP_KERNEL_INTERRUPTS_DSRS_LIST
|
146 |
|
|
cyg_ucount32 dsr_count;
|
147 |
|
|
cyg_interrupt *next_dsr;
|
148 |
|
|
#endif
|
149 |
|
|
#ifdef CYGIMP_KERNEL_INTERRUPTS_CHAIN
|
150 |
|
|
cyg_interrupt *next;
|
151 |
|
|
#endif
|
152 |
|
|
};
|
153 |
|
|
|
154 |
|
|
|
155 |
|
|
/*---------------------------------------------------------------------------*/
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
#if defined(CYGIMP_KERNEL_COUNTERS_SINGLE_LIST)
|
159 |
|
|
# define CYG_COUNTER_ALARM_LIST_MEMBER \
|
160 |
|
|
cyg_alarm *alarm_list;
|
161 |
|
|
#elif defined(CYGIMP_KERNEL_COUNTERS_MULTI_LIST)
|
162 |
|
|
# define CYG_COUNTER_ALARM_LIST_MEMBER \
|
163 |
|
|
cyg_alarm *alarm_list[CYGNUM_KERNEL_COUNTERS_MULTI_LIST_SIZE];
|
164 |
|
|
#else
|
165 |
|
|
# define CYG_COUNTER_ALARM_LIST_MEMBER
|
166 |
|
|
#endif
|
167 |
|
|
|
168 |
|
|
#define CYG_COUNTER_MEMBERS \
|
169 |
|
|
CYG_COUNTER_ALARM_LIST_MEMBER \
|
170 |
|
|
cyg_tick_count_t counter; \
|
171 |
|
|
cyg_uint32 increment;
|
172 |
|
|
|
173 |
|
|
struct cyg_counter
|
174 |
|
|
{
|
175 |
|
|
CYG_COUNTER_MEMBERS
|
176 |
|
|
};
|
177 |
|
|
|
178 |
|
|
/*---------------------------------------------------------------------------*/
|
179 |
|
|
|
180 |
|
|
struct cyg_clock
|
181 |
|
|
{
|
182 |
|
|
CYG_COUNTER_MEMBERS
|
183 |
|
|
CYG_RESOLUTION_T_MEMBERS
|
184 |
|
|
};
|
185 |
|
|
|
186 |
|
|
/*---------------------------------------------------------------------------*/
|
187 |
|
|
|
188 |
|
|
|
189 |
|
|
#if defined(CYGIMP_KERNEL_COUNTERS_SINGLE_LIST) || \
|
190 |
|
|
defined(CYGIMP_KERNEL_COUNTERS_MULTI_LIST)
|
191 |
|
|
# define CYG_ALARM_LIST_MEMBERS \
|
192 |
|
|
cyg_alarm *next; \
|
193 |
|
|
cyg_alarm *prev;
|
194 |
|
|
#else
|
195 |
|
|
# define CYG_ALARM_LIST_MEMBERS
|
196 |
|
|
#endif
|
197 |
|
|
|
198 |
|
|
#define CYG_ALARM_MEMBERS \
|
199 |
|
|
CYG_ALARM_LIST_MEMBERS \
|
200 |
|
|
cyg_counter *counter; \
|
201 |
|
|
cyg_alarm_t *alarm; \
|
202 |
|
|
CYG_ADDRWORD data; \
|
203 |
|
|
cyg_tick_count_t trigger; \
|
204 |
|
|
cyg_tick_count_t interval; \
|
205 |
|
|
cyg_bool enabled;
|
206 |
|
|
|
207 |
|
|
struct cyg_alarm
|
208 |
|
|
{
|
209 |
|
|
CYG_ALARM_MEMBERS
|
210 |
|
|
};
|
211 |
|
|
|
212 |
|
|
/*---------------------------------------------------------------------------*/
|
213 |
|
|
/* Exception controller */
|
214 |
|
|
|
215 |
|
|
#ifdef CYGPKG_KERNEL_EXCEPTIONS
|
216 |
|
|
|
217 |
|
|
# ifdef CYGSEM_KERNEL_EXCEPTIONS_DECODE
|
218 |
|
|
# define CYG_EXCEPTION_CONTROL_MEMBERS \
|
219 |
|
|
cyg_exception_handler_t *exception_handler[CYGNUM_HAL_EXCEPTION_COUNT]; \
|
220 |
|
|
CYG_ADDRWORD exception_data[CYGNUM_HAL_EXCEPTION_COUNT];
|
221 |
|
|
# else
|
222 |
|
|
# define CYG_EXCEPTION_CONTROL_MEMBERS \
|
223 |
|
|
cyg_exception_handler_t *exception_handler; /* Handler function */ \
|
224 |
|
|
CYG_ADDRWORD exception_data; /* Handler data */
|
225 |
|
|
# endif
|
226 |
|
|
|
227 |
|
|
typedef struct
|
228 |
|
|
{
|
229 |
|
|
CYG_EXCEPTION_CONTROL_MEMBERS
|
230 |
|
|
} cyg_exception_control;
|
231 |
|
|
|
232 |
|
|
#endif
|
233 |
|
|
|
234 |
|
|
/*---------------------------------------------------------------------------*/
|
235 |
|
|
/* Hardware Thread structure */
|
236 |
|
|
|
237 |
|
|
#ifdef CYGFUN_KERNEL_THREADS_STACK_LIMIT
|
238 |
|
|
# define CYG_HARDWARETHREAD_STACK_LIMIT_MEMBER \
|
239 |
|
|
CYG_ADDRESS stack_limit; /* movable stack limit */
|
240 |
|
|
#else
|
241 |
|
|
# define CYG_HARDWARETHREAD_STACK_LIMIT_MEMBER
|
242 |
|
|
#endif
|
243 |
|
|
|
244 |
|
|
#ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT
|
245 |
|
|
# define CYG_HARDWARETHREAD_SAVED_CONTEXT_MEMBER \
|
246 |
|
|
void *saved_context; // If non-zero, this points at a more
|
247 |
|
|
// interesting context than stack_ptr.
|
248 |
|
|
#else
|
249 |
|
|
# define CYG_HARDWARETHREAD_SAVED_CONTEXT_MEMBER
|
250 |
|
|
#endif
|
251 |
|
|
|
252 |
|
|
typedef void cyg_thread_entry(CYG_ADDRWORD data);
|
253 |
|
|
|
254 |
|
|
#define CYG_HARDWARETHREAD_MEMBERS \
|
255 |
|
|
CYG_ADDRESS stack_base; /* pointer to base of stack area */ \
|
256 |
|
|
cyg_uint32 stack_size; /* size of stack area in bytes */ \
|
257 |
|
|
CYG_HARDWARETHREAD_STACK_LIMIT_MEMBER \
|
258 |
|
|
CYG_ADDRESS stack_ptr; /* pointer to saved state on stack */ \
|
259 |
|
|
cyg_thread_entry *entry_point; /* main entry point (code pointer!) */ \
|
260 |
|
|
CYG_ADDRWORD entry_data; /* entry point argument */ \
|
261 |
|
|
CYG_HARDWARETHREAD_SAVED_CONTEXT_MEMBER
|
262 |
|
|
|
263 |
|
|
typedef struct
|
264 |
|
|
{
|
265 |
|
|
CYG_HARDWARETHREAD_MEMBERS
|
266 |
|
|
} cyg_hardwarethread;
|
267 |
|
|
|
268 |
|
|
/*---------------------------------------------------------------------------*/
|
269 |
|
|
/* Scheduler Thread structure */
|
270 |
|
|
|
271 |
|
|
#ifdef CYGPKG_KERNEL_SMP_SUPPORT
|
272 |
|
|
# define CYG_SCHEDTHREAD_CPU_MEMBER \
|
273 |
|
|
cyg_uint32 cpu; // CPU id of cpu currently running
|
274 |
|
|
#else
|
275 |
|
|
# define CYG_SCHEDTHREAD_CPU_MEMBER
|
276 |
|
|
#endif
|
277 |
|
|
|
278 |
|
|
#ifdef CYGSEM_KERNEL_SCHED_TIMESLICE
|
279 |
|
|
# define CYG_SCHEDTHREAD_TIMESLICE_MEMBER \
|
280 |
|
|
cyg_ucount32 timeslice_count; /* per-thread timeslice counter */
|
281 |
|
|
#else
|
282 |
|
|
# define CYG_SCHEDTHREAD_TIMESLICE_MEMBER
|
283 |
|
|
#endif
|
284 |
|
|
|
285 |
|
|
#ifdef CYGSEM_KERNEL_SCHED_TIMESLICE_ENABLE
|
286 |
|
|
# define CYG_SCHEDTHREAD_TIMESLICE_ENABLED_MEMBER \
|
287 |
|
|
cyg_bool timeslice_enabled; /* per-thread timeslice enable */
|
288 |
|
|
#else
|
289 |
|
|
# define CYG_SCHEDTHREAD_TIMESLICE_ENABLED_MEMBER
|
290 |
|
|
#endif
|
291 |
|
|
|
292 |
|
|
#if defined(CYGSEM_KERNEL_SCHED_BITMAP)
|
293 |
|
|
# define CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS \
|
294 |
|
|
cyg_priority_t priority; /* current thread priority */
|
295 |
|
|
#elif defined(CYGSEM_KERNEL_SCHED_MLQUEUE)
|
296 |
|
|
# define CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS \
|
297 |
|
|
cyg_thread *next; \
|
298 |
|
|
cyg_thread *prev; \
|
299 |
|
|
cyg_priority_t priority; /* current thread priority */ \
|
300 |
|
|
CYG_SCHEDTHREAD_CPU_MEMBER \
|
301 |
|
|
CYG_SCHEDTHREAD_TIMESLICE_MEMBER \
|
302 |
|
|
CYG_SCHEDTHREAD_TIMESLICE_ENABLED_MEMBER
|
303 |
|
|
#elif defined(CYGSEM_KERNEL_SCHED_LOTTERY)
|
304 |
|
|
# define CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS \
|
305 |
|
|
cyg_thread *next; \
|
306 |
|
|
cyg_thread *prev; \
|
307 |
|
|
cyg_priority_t priority; /* current thread priority */ \
|
308 |
|
|
cyg_priority_t compensation_tickets; /* sleep compensation */
|
309 |
|
|
#else
|
310 |
|
|
# error Undefined scheduler type
|
311 |
|
|
#endif
|
312 |
|
|
|
313 |
|
|
#ifndef CYGSEM_KERNEL_SCHED_ASR_GLOBAL
|
314 |
|
|
# define CYG_SCHEDTHREAD_ASR_NONGLOBAL_MEMBER \
|
315 |
|
|
void (*asr)(CYG_ADDRWORD); // ASR function
|
316 |
|
|
#else
|
317 |
|
|
# define CYG_SCHEDTHREAD_ASR_NONGLOBAL_MEMBER
|
318 |
|
|
#endif
|
319 |
|
|
|
320 |
|
|
#ifndef CYGSEM_KERNEL_SCHED_ASR_DATA_GLOBAL
|
321 |
|
|
# define CYG_SCHEDTHREAD_ASR_DATA_NONGLOBAL_MEMBER \
|
322 |
|
|
CYG_ADDRWORD asr_data; // ASR data pointer
|
323 |
|
|
#else
|
324 |
|
|
# define CYG_SCHEDTHREAD_ASR_DATA_NONGLOBAL_MEMBER
|
325 |
|
|
#endif
|
326 |
|
|
|
327 |
|
|
#ifdef CYGSEM_KERNEL_SCHED_ASR_SUPPORT
|
328 |
|
|
# define CYG_SCHEDTHREAD_ASR_MEMBER \
|
329 |
|
|
volatile cyg_ucount32 asr_inhibit; /* If true, blocks calls to ASRs */ \
|
330 |
|
|
volatile cyg_bool asr_pending; /* If true, this thread's ASR */ \
|
331 |
|
|
/* should be called. */ \
|
332 |
|
|
CYG_SCHEDTHREAD_ASR_NONGLOBAL_MEMBER \
|
333 |
|
|
CYG_SCHEDTHREAD_ASR_DATA_NONGLOBAL_MEMBER
|
334 |
|
|
#else
|
335 |
|
|
# define CYG_SCHEDTHREAD_ASR_MEMBER
|
336 |
|
|
#endif
|
337 |
|
|
|
338 |
|
|
#ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_SIMPLE
|
339 |
|
|
# define CYG_SCHEDTHREAD_MUTEX_INV_PROTO_SIMPLE_MEMBERS \
|
340 |
|
|
cyg_priority_t original_priority; \
|
341 |
|
|
cyg_bool priority_inherited;
|
342 |
|
|
#else
|
343 |
|
|
# define CYG_SCHEDTHREAD_MUTEX_INV_PROTO_SIMPLE_MEMBERS
|
344 |
|
|
#endif
|
345 |
|
|
|
346 |
|
|
#ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL
|
347 |
|
|
# define CYG_SCHEDTHREAD_MUTEX_INV_PROTO_MEMBERS \
|
348 |
|
|
cyg_count32 mutex_count; \
|
349 |
|
|
CYG_SCHEDTHREAD_MUTEX_INV_PROTO_SIMPLE_MEMBERS
|
350 |
|
|
#else
|
351 |
|
|
# define CYG_SCHEDTHREAD_MUTEX_INV_PROTO_MEMBERS
|
352 |
|
|
#endif
|
353 |
|
|
|
354 |
|
|
#define CYG_SCHEDTHREAD_MEMBERS \
|
355 |
|
|
CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS \
|
356 |
|
|
cyg_threadqueue *queue; \
|
357 |
|
|
CYG_SCHEDTHREAD_ASR_MEMBER \
|
358 |
|
|
CYG_SCHEDTHREAD_MUTEX_INV_PROTO_MEMBERS
|
359 |
|
|
|
360 |
|
|
|
361 |
|
|
typedef struct
|
362 |
|
|
{
|
363 |
|
|
CYG_SCHEDTHREAD_MEMBERS
|
364 |
|
|
} cyg_schedthread;
|
365 |
|
|
|
366 |
|
|
/* This compiler version test is required because the C++ ABI changed in
|
367 |
|
|
GCC v3.x and GCC could now reuse "spare" space from base classes in derived
|
368 |
|
|
classes, and in C++ land, cyg_alarm is a base class of cyg_threadtimer.
|
369 |
|
|
*/
|
370 |
|
|
#if defined(__GNUC__) && (__GNUC__ < 3)
|
371 |
|
|
#define CYG_THREADTIMER_MEMBERS \
|
372 |
|
|
cyg_alarm alarm; \
|
373 |
|
|
cyg_thread *thread;
|
374 |
|
|
#else
|
375 |
|
|
#define CYG_THREADTIMER_MEMBERS \
|
376 |
|
|
CYG_ALARM_MEMBERS \
|
377 |
|
|
cyg_thread *thread;
|
378 |
|
|
#endif
|
379 |
|
|
|
380 |
|
|
/*---------------------------------------------------------------------------*/
|
381 |
|
|
/* Thread structure */
|
382 |
|
|
|
383 |
|
|
typedef struct
|
384 |
|
|
{
|
385 |
|
|
CYG_THREADTIMER_MEMBERS
|
386 |
|
|
} cyg_threadtimer;
|
387 |
|
|
|
388 |
|
|
|
389 |
|
|
typedef enum
|
390 |
|
|
{
|
391 |
|
|
CYG_REASON_NONE,
|
392 |
|
|
CYG_REASON_WAIT,
|
393 |
|
|
CYG_REASON_DELAY,
|
394 |
|
|
CYG_REASON_TIMEOUT,
|
395 |
|
|
CYG_REASON_BREAK,
|
396 |
|
|
CYG_REASON_DESTRUCT,
|
397 |
|
|
CYG_REASON_EXIT,
|
398 |
|
|
CYG_REASON_DONE
|
399 |
|
|
} cyg_reason_t;
|
400 |
|
|
|
401 |
|
|
#if defined(CYGPKG_KERNEL_EXCEPTIONS) && !defined(CYGSEM_KERNEL_EXCEPTIONS_GLOBAL)
|
402 |
|
|
# define CYG_THREAD_EXCEPTION_CONTROL_MEMBER \
|
403 |
|
|
cyg_exception_control exception_control;
|
404 |
|
|
#else
|
405 |
|
|
# define CYG_THREAD_EXCEPTION_CONTROL_MEMBER
|
406 |
|
|
#endif
|
407 |
|
|
|
408 |
|
|
#ifdef CYGFUN_KERNEL_THREADS_TIMER
|
409 |
|
|
# define CYG_THREAD_TIMER_MEMBER \
|
410 |
|
|
cyg_threadtimer timer;
|
411 |
|
|
#else
|
412 |
|
|
# define CYG_THREAD_TIMER_MEMBER
|
413 |
|
|
#endif
|
414 |
|
|
|
415 |
|
|
#ifdef CYGVAR_KERNEL_THREADS_DATA
|
416 |
|
|
# define CYG_THREAD_THREAD_DATA_MEMBER \
|
417 |
|
|
CYG_ADDRWORD thread_data[CYGNUM_KERNEL_THREADS_DATA_MAX];
|
418 |
|
|
#else
|
419 |
|
|
# define CYG_THREAD_THREAD_DATA_MEMBER
|
420 |
|
|
#endif
|
421 |
|
|
|
422 |
|
|
#ifdef CYGVAR_KERNEL_THREADS_NAME
|
423 |
|
|
# define CYG_THREAD_NAME_MEMBER \
|
424 |
|
|
char *name;
|
425 |
|
|
#else
|
426 |
|
|
# define CYG_THREAD_NAME_MEMBER
|
427 |
|
|
#endif
|
428 |
|
|
|
429 |
|
|
#ifdef CYGVAR_KERNEL_THREADS_LIST
|
430 |
|
|
# define CYG_THREAD_LIST_NEXT_MEMBER \
|
431 |
|
|
cyg_thread *list_next;
|
432 |
|
|
#else
|
433 |
|
|
# define CYG_THREAD_LIST_NEXT_MEMBER
|
434 |
|
|
#endif
|
435 |
|
|
|
436 |
|
|
|
437 |
|
|
|
438 |
|
|
#ifdef CYGSEM_KERNEL_THREADS_DESTRUCTORS_PER_THREAD
|
439 |
|
|
struct Cyg_Destructor_Entry {
|
440 |
|
|
cyg_thread_destructor_fn fn;
|
441 |
|
|
cyg_addrword_t data;
|
442 |
|
|
};
|
443 |
|
|
# define CYG_THREAD_DESTRUCTORS_MEMBER \
|
444 |
|
|
struct Cyg_Destructor_Entry destructors[ CYGNUM_KERNEL_THREADS_DESTRUCTORS ];
|
445 |
|
|
#else
|
446 |
|
|
# define CYG_THREAD_DESTRUCTORS_MEMBER
|
447 |
|
|
#endif
|
448 |
|
|
|
449 |
|
|
|
450 |
|
|
#define CYG_THREAD_MEMBERS \
|
451 |
|
|
CYG_HARDWARETHREAD_MEMBERS \
|
452 |
|
|
CYG_SCHEDTHREAD_MEMBERS \
|
453 |
|
|
\
|
454 |
|
|
cyg_uint32 state; \
|
455 |
|
|
cyg_ucount32 suspend_count; \
|
456 |
|
|
cyg_ucount32 wakeup_count; \
|
457 |
|
|
CYG_ADDRWORD wait_info; \
|
458 |
|
|
cyg_uint16 unique_id; \
|
459 |
|
|
\
|
460 |
|
|
CYG_THREAD_EXCEPTION_CONTROL_MEMBER \
|
461 |
|
|
CYG_THREAD_TIMER_MEMBER \
|
462 |
|
|
\
|
463 |
|
|
cyg_reason_t sleep_reason; \
|
464 |
|
|
cyg_reason_t wake_reason; \
|
465 |
|
|
\
|
466 |
|
|
CYG_THREAD_THREAD_DATA_MEMBER \
|
467 |
|
|
CYG_THREAD_DESTRUCTORS_MEMBER \
|
468 |
|
|
CYG_THREAD_NAME_MEMBER \
|
469 |
|
|
CYG_THREAD_LIST_NEXT_MEMBER
|
470 |
|
|
|
471 |
|
|
|
472 |
|
|
struct cyg_thread
|
473 |
|
|
{
|
474 |
|
|
CYG_THREAD_MEMBERS
|
475 |
|
|
};
|
476 |
|
|
|
477 |
|
|
/*---------------------------------------------------------------------------*/
|
478 |
|
|
|
479 |
|
|
struct cyg_mbox
|
480 |
|
|
{
|
481 |
|
|
cyg_count32 base; /* index of first used slot */
|
482 |
|
|
cyg_count32 count; /* count of used slots */
|
483 |
|
|
cyg_threadqueue get_threadq; /* Queue of waiting threads */
|
484 |
|
|
#ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
|
485 |
|
|
cyg_threadqueue put_threadq; /* Queue of waiting threads */
|
486 |
|
|
#endif
|
487 |
|
|
void * itemqueue[ CYGNUM_KERNEL_SYNCH_MBOX_QUEUE_SIZE ];
|
488 |
|
|
};
|
489 |
|
|
|
490 |
|
|
/*---------------------------------------------------------------------------*/
|
491 |
|
|
|
492 |
|
|
struct cyg_sem_t
|
493 |
|
|
{
|
494 |
|
|
cyg_count32 count; /* The semaphore count */
|
495 |
|
|
cyg_threadqueue queue; /* Queue of waiting threads */
|
496 |
|
|
};
|
497 |
|
|
|
498 |
|
|
/*---------------------------------------------------------------------------*/
|
499 |
|
|
|
500 |
|
|
struct cyg_flag_t
|
501 |
|
|
{
|
502 |
|
|
cyg_flag_value_t value; /* The flag value */
|
503 |
|
|
cyg_threadqueue queue; /* Queue of waiting threads */
|
504 |
|
|
};
|
505 |
|
|
|
506 |
|
|
/*---------------------------------------------------------------------------*/
|
507 |
|
|
|
508 |
|
|
typedef enum
|
509 |
|
|
{
|
510 |
|
|
CYG_MUTEX_PROTOCOL_NONE,
|
511 |
|
|
CYG_MUTEX_PROTOCOL_INHERIT,
|
512 |
|
|
CYG_MUTEX_PROTOCOL_CEILING
|
513 |
|
|
} cyg_mutex_protocol_t;
|
514 |
|
|
|
515 |
|
|
struct cyg_mutex_t
|
516 |
|
|
{
|
517 |
|
|
cyg_atomic locked; /* true if locked */
|
518 |
|
|
cyg_thread *owner; /* Current locking thread */
|
519 |
|
|
cyg_threadqueue queue; /* Queue of waiting threads */
|
520 |
|
|
|
521 |
|
|
#ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC
|
522 |
|
|
cyg_mutex_protocol_t protocol; /* this mutex's protocol */
|
523 |
|
|
#endif
|
524 |
|
|
#ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING
|
525 |
|
|
cyg_priority_t ceiling; /* mutex priority ceiling */
|
526 |
|
|
#endif
|
527 |
|
|
|
528 |
|
|
};
|
529 |
|
|
|
530 |
|
|
/*---------------------------------------------------------------------------*/
|
531 |
|
|
|
532 |
|
|
struct cyg_cond_t
|
533 |
|
|
{
|
534 |
|
|
cyg_mutex_t *mutex; /* Associated mutex */
|
535 |
|
|
cyg_threadqueue queue; /* Queue of waiting threads */
|
536 |
|
|
};
|
537 |
|
|
|
538 |
|
|
/*------------------------------------------------------------------------*/
|
539 |
|
|
|
540 |
|
|
struct cyg_spinlock_t
|
541 |
|
|
{
|
542 |
|
|
cyg_uint32 lock; /* lock word */
|
543 |
|
|
};
|
544 |
|
|
|
545 |
|
|
/*------------------------------------------------------------------------*/
|
546 |
|
|
|
547 |
|
|
/* Memory allocator types now come from the "memalloc" package which is */
|
548 |
|
|
/* where the implementation lives. */
|
549 |
|
|
|
550 |
|
|
#ifdef CYGPKG_MEMALLOC
|
551 |
|
|
# include <cyg/memalloc/kapidata.h>
|
552 |
|
|
#endif
|
553 |
|
|
|
554 |
|
|
#ifdef __cplusplus
|
555 |
|
|
}
|
556 |
|
|
#endif
|
557 |
|
|
|
558 |
|
|
/*---------------------------------------------------------------------------*/
|
559 |
|
|
/* EOF kapidata.h */
|
560 |
|
|
#endif /* CYGONCE_KERNEL_KAPIDATA_H */
|