comparison packages/kernel/current/include/kapidata.h @ 181:d61da071934c

Merge from eCos master repository on 2001-08-22-06:38:55-BST
author jlarmour
date Wed, 22 Aug 2001 06:27:14 +0000
parents 4c750ce71ae3
children f62680ef1804
comparison
equal deleted inserted replaced
180:2bdd82a025e1 181:d61da071934c
125 }; 125 };
126 126
127 127
128 /*---------------------------------------------------------------------------*/ 128 /*---------------------------------------------------------------------------*/
129 129
130 struct cyg_counter 130
131 {
132 #if defined(CYGIMP_KERNEL_COUNTERS_SINGLE_LIST) 131 #if defined(CYGIMP_KERNEL_COUNTERS_SINGLE_LIST)
132 # define CYG_COUNTER_ALARM_LIST_MEMBER \
133 cyg_alarm *alarm_list; 133 cyg_alarm *alarm_list;
134 #elif defined(CYGIMP_KERNEL_COUNTERS_MULTI_LIST) 134 #elif defined(CYGIMP_KERNEL_COUNTERS_MULTI_LIST)
135 # define CYG_COUNTER_ALARM_LIST_MEMBER \
135 cyg_alarm *alarm_list[CYGNUM_KERNEL_COUNTERS_MULTI_LIST_SIZE]; 136 cyg_alarm *alarm_list[CYGNUM_KERNEL_COUNTERS_MULTI_LIST_SIZE];
136 #endif 137 #else
137 cyg_tick_count_t counter; 138 # define CYG_COUNTER_ALARM_LIST_MEMBER
139 #endif
140
141 #define CYG_COUNTER_MEMBERS \
142 CYG_COUNTER_ALARM_LIST_MEMBER \
143 cyg_tick_count_t counter; \
138 cyg_uint32 increment; 144 cyg_uint32 increment;
145
146 struct cyg_counter
147 {
148 CYG_COUNTER_MEMBERS
139 }; 149 };
140 150
141 /*---------------------------------------------------------------------------*/ 151 /*---------------------------------------------------------------------------*/
142 152
143 struct cyg_clock 153 struct cyg_clock
144 { 154 {
145 cyg_counter counter; 155 CYG_COUNTER_MEMBERS
146 cyg_resolution_t resolution; 156 CYG_RESOLUTION_T_MEMBERS
147 }; 157 };
148 158
149 /*---------------------------------------------------------------------------*/ 159 /*---------------------------------------------------------------------------*/
160
161
162 #if defined(CYGIMP_KERNEL_COUNTERS_SINGLE_LIST) || \
163 defined(CYGIMP_KERNEL_COUNTERS_MULTI_LIST)
164 # define CYG_ALARM_LIST_MEMBERS \
165 cyg_alarm *next; \
166 cyg_alarm *prev;
167 #else
168 # define CYG_ALARM_LIST_MEMBERS
169 #endif
170
171 #define CYG_ALARM_MEMBERS \
172 CYG_ALARM_LIST_MEMBERS \
173 cyg_counter *counter; \
174 cyg_alarm_t *alarm; \
175 CYG_ADDRWORD data; \
176 cyg_tick_count_t trigger; \
177 cyg_tick_count_t interval; \
178 cyg_bool enabled;
150 179
151 struct cyg_alarm 180 struct cyg_alarm
152 { 181 {
153 #if defined(CYGIMP_KERNEL_COUNTERS_SINGLE_LIST) || defined(CYGIMP_KERNEL_COUNTERS_MULTI_LIST) 182 CYG_ALARM_MEMBERS
154 cyg_alarm *next;
155 cyg_alarm *prev;
156 #endif
157 cyg_counter *counter;
158 cyg_alarm_t *alarm;
159 CYG_ADDRWORD data;
160 cyg_tick_count_t trigger;
161 cyg_tick_count_t interval;
162 cyg_bool enabled;
163 }; 183 };
164 184
165 /*---------------------------------------------------------------------------*/ 185 /*---------------------------------------------------------------------------*/
166 /* Exception controller */ 186 /* Exception controller */
167 187
168 #ifdef CYGPKG_KERNEL_EXCEPTIONS 188 #ifdef CYGPKG_KERNEL_EXCEPTIONS
189
190 # ifdef CYGSEM_KERNEL_EXCEPTIONS_DECODE
191 # define CYG_EXCEPTION_CONTROL_MEMBERS \
192 cyg_exception_handler_t *exception_handler[CYGNUM_HAL_EXCEPTION_COUNT]; \
193 CYG_ADDRWORD exception_data[CYGNUM_HAL_EXCEPTION_COUNT];
194 # else
195 # define CYG_EXCEPTION_CONTROL_MEMBERS \
196 cyg_exception_handler_t *exception_handler; /* Handler function */ \
197 CYG_ADDRWORD exception_data; /* Handler data */
198 # endif
199
169 typedef struct 200 typedef struct
170 { 201 {
171 #ifdef CYGSEM_KERNEL_EXCEPTIONS_DECODE 202 CYG_EXCEPTION_CONTROL_MEMBERS
172 cyg_exception_handler_t *exception_handler[CYGNUM_HAL_EXCEPTION_COUNT];
173
174 CYG_ADDRWORD exception_data[CYGNUM_HAL_EXCEPTION_COUNT];
175 #else
176 cyg_exception_handler_t *exception_handler; // Handler function
177
178 CYG_ADDRWORD exception_data; // Handler data
179 #endif
180
181 } cyg_exception_control; 203 } cyg_exception_control;
182 204
183 #endif 205 #endif
184 206
185 /*---------------------------------------------------------------------------*/ 207 /*---------------------------------------------------------------------------*/
186 /* Thread structure */ 208 /* Hardware Thread structure */
187 209
188 typedef struct
189 {
190 CYG_ADDRESS stack_base; /* pointer to base of stack area */
191 cyg_uint32 stack_size; /* size of stack area in bytes */
192 #ifdef CYGFUN_KERNEL_THREADS_STACK_LIMIT 210 #ifdef CYGFUN_KERNEL_THREADS_STACK_LIMIT
211 # define CYG_HARDWARETHREAD_STACK_LIMIT_MEMBER \
193 CYG_ADDRESS stack_limit; /* movable stack limit */ 212 CYG_ADDRESS stack_limit; /* movable stack limit */
194 #endif 213 #else
195 CYG_ADDRESS stack_ptr; /* pointer to saved state on stack */ 214 # define CYG_HARDWARETHREAD_STACK_LIMIT_MEMBER
196 CYG_ADDRWORD entry_point; /* main entry point (code pointer!) */ 215 #endif
197 CYG_ADDRWORD entry_data; /* entry point argument */ 216
198 #ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT 217 #ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT
218 # define CYG_HARDWARETHREAD_SAVED_CONTEXT_MEMBER \
199 void *saved_context; // If non-zero, this points at a more 219 void *saved_context; // If non-zero, this points at a more
200 // interesting context than stack_ptr. 220 // interesting context than stack_ptr.
201 #endif 221 #else
202 222 # define CYG_HARDWARETHREAD_SAVED_CONTEXT_MEMBER
223 #endif
224
225 #define CYG_HARDWARETHREAD_MEMBERS \
226 CYG_ADDRESS stack_base; /* pointer to base of stack area */ \
227 cyg_uint32 stack_size; /* size of stack area in bytes */ \
228 CYG_HARDWARETHREAD_STACK_LIMIT_MEMBER \
229 CYG_ADDRESS stack_ptr; /* pointer to saved state on stack */ \
230 CYG_ADDRWORD entry_point; /* main entry point (code pointer!) */ \
231 CYG_ADDRWORD entry_data; /* entry point argument */ \
232 CYG_HARDWARETHREAD_SAVED_CONTEXT_MEMBER
233
234 typedef struct
235 {
236 CYG_HARDWARETHREAD_MEMBERS
203 } cyg_hardwarethread; 237 } cyg_hardwarethread;
238
239 /*---------------------------------------------------------------------------*/
240 /* Scheduler Thread structure */
241
242 #ifdef CYGPKG_KERNEL_SMP_SUPPORT
243 # define CYG_SCHEDTHREAD_CPU_MEMBER \
244 cyg_uint32 cpu; // CPU id of cpu currently running
245 #else
246 # define CYG_SCHEDTHREAD_CPU_MEMBER
247 #endif
248
249 #ifdef CYGSEM_KERNEL_SCHED_TIMESLICE_ENABLE
250 # define CYG_SCHEDTHREAD_TIMESLICE_ENABLED_MEMBER \
251 cyg_bool timeslice_enabled; /* per-thread timeslice enable */
252 #else
253 # define CYG_SCHEDTHREAD_TIMESLICE_ENABLED_MEMBER
254 #endif
255
256 #if defined(CYGSEM_KERNEL_SCHED_BITMAP)
257 # define CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS \
258 cyg_priority_t priority; /* current thread priority */
259 #elif defined(CYGSEM_KERNEL_SCHED_MLQUEUE)
260 # define CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS \
261 cyg_thread *next; \
262 cyg_thread *prev; \
263 cyg_priority_t priority; /* current thread priority */ \
264 CYG_SCHEDTHREAD_CPU_MEMBER \
265 CYG_SCHEDTHREAD_TIMESLICE_ENABLED_MEMBER
266 #elif defined(CYGSEM_KERNEL_SCHED_LOTTERY)
267 # define CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS \
268 cyg_thread *next; \
269 cyg_thread *prev; \
270 cyg_priority_t priority; /* current thread priority */ \
271 cyg_priority_t compensation_tickets; /* sleep compensation */
272 #else
273 # error Undefined scheduler type
274 #endif
275
276 #ifndef CYGSEM_KERNEL_SCHED_ASR_GLOBAL
277 # define CYG_SCHEDTHREAD_ASR_NONGLOBAL_MEMBER \
278 void (*asr)(CYG_ADDRWORD); // ASR function
279 #else
280 # define CYG_SCHEDTHREAD_ASR_NONGLOBAL_MEMBER
281 #endif
282
283 #ifndef CYGSEM_KERNEL_SCHED_ASR_DATA_GLOBAL
284 # define CYG_SCHEDTHREAD_ASR_DATA_NONGLOBAL_MEMBER \
285 CYG_ADDRWORD asr_data; // ASR data pointer
286 #else
287 # define CYG_SCHEDTHREAD_ASR_DATA_NONGLOBAL_MEMBER
288 #endif
289
290 #ifdef CYGSEM_KERNEL_SCHED_ASR_SUPPORT
291 # define CYG_SCHEDTHREAD_ASR_MEMBER \
292 volatile cyg_bool asr_inhibit; /* If true, blocks calls to ASRs */ \
293 volatile cyg_bool asr_pending; /* If true, this thread's ASR */ \
294 /* should be called. */ \
295 CYG_SCHEDTHREAD_ASR_NONGLOBAL_MEMBER \
296 CYG_SCHEDTHREAD_ASR_DATA_NONGLOBAL_MEMBER
297 #else
298 # define CYG_SCHEDTHREAD_ASR_MEMBER
299 #endif
300
301 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_SIMPLE
302 # define CYG_SCHEDTHREAD_MUTEX_INV_PROTO_SIMPLE_MEMBERS \
303 cyg_priority_t original_priority; \
304 cyg_bool priority_inherited;
305 #else
306 # define CYG_SCHEDTHREAD_MUTEX_INV_PROTO_SIMPLE_MEMBERS
307 #endif
308
309 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL
310 # define CYG_SCHEDTHREAD_MUTEX_INV_PROTO_MEMBERS \
311 cyg_count32 mutex_count; \
312 CYG_SCHEDTHREAD_MUTEX_INV_PROTO_SIMPLE_MEMBERS
313 #else
314 # define CYG_SCHEDTHREAD_MUTEX_INV_PROTO_MEMBERS
315 #endif
316
317 #define CYG_SCHEDTHREAD_MEMBERS \
318 CYG_SCHEDTHREAD_SCHEDIMP_MEMBERS \
319 cyg_threadqueue *queue; \
320 CYG_SCHEDTHREAD_ASR_MEMBER \
321 CYG_SCHEDTHREAD_MUTEX_INV_PROTO_MEMBERS
322
204 323
205 typedef struct 324 typedef struct
206 { 325 {
207 #if defined(CYGSEM_KERNEL_SCHED_BITMAP) 326 CYG_SCHEDTHREAD_MEMBERS
208
209 cyg_priority_t priority; /* current thread priority */
210
211 #elif defined(CYGSEM_KERNEL_SCHED_MLQUEUE)
212
213 cyg_thread *next;
214 cyg_thread *prev;
215
216 cyg_priority_t priority; /* current thread priority */
217
218 #ifdef CYGPKG_KERNEL_SMP_SUPPORT
219 cyg_uint32 cpu; // CPU id of cpu currently running
220 #endif
221
222 #ifdef CYGSEM_KERNEL_SCHED_TIMESLICE_ENABLE
223 cyg_bool timeslice_enabled; /* per-thread timeslice enable */
224 #endif
225 #elif defined(CYGSEM_KERNEL_SCHED_LOTTERY)
226
227 cyg_thread *next;
228 cyg_thread *prev;
229
230 cyg_priority_t priority; /* current thread priority */
231
232 cyg_priority_t compensation_tickets; /* sleep compensation */
233
234 #else
235
236 #error Undefined scheduler type
237
238 #endif
239
240 cyg_threadqueue *queue;
241
242 #ifdef CYGSEM_KERNEL_SCHED_ASR_SUPPORT
243 volatile cyg_bool asr_inhibit; // If true, blocks calls to ASRs
244 volatile cyg_bool asr_pending; // If true, this thread's ASR should be called.
245 #ifndef CYGSEM_KERNEL_SCHED_ASR_GLOBAL
246 void (*asr)(CYG_ADDRWORD); // ASR function
247 #endif
248 #ifndef CYGSEM_KERNEL_SCHED_ASR_DATA_GLOBAL
249 CYG_ADDRWORD asr_data; // ASR data pointer
250 #endif
251 #endif
252 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL
253 cyg_count32 mutex_count;
254 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_SIMPLE
255 cyg_priority_t original_priority;
256 cyg_bool priority_inherited;
257 #endif
258 #endif
259
260 } cyg_schedthread; 327 } cyg_schedthread;
261 328
329 #define CYG_THREADTIMER_MEMBERS \
330 CYG_ALARM_MEMBERS \
331 cyg_thread *thread;
332
333 /*---------------------------------------------------------------------------*/
334 /* Thread structure */
335
262 typedef struct 336 typedef struct
263 { 337 {
264 cyg_alarm alarm; 338 CYG_THREADTIMER_MEMBERS
265 cyg_thread *thread;
266 } cyg_threadtimer; 339 } cyg_threadtimer;
267 340
268 341
269 typedef int cyg_reason_t; /* cyg_reason is originally an enum */ 342 typedef int cyg_reason_t; /* cyg_reason is originally an enum */
270 343
344 #if defined(CYGPKG_KERNEL_EXCEPTIONS) && !defined(CYGSEM_KERNEL_EXCEPTIONS_GLOBAL)
345 # define CYG_THREAD_EXCEPTION_CONTROL_MEMBER \
346 cyg_exception_control exception_control;
347 #else
348 # define CYG_THREAD_EXCEPTION_CONTROL_MEMBER
349 #endif
350
351 #ifdef CYGFUN_KERNEL_THREADS_TIMER
352 # define CYG_THREAD_TIMER_MEMBER \
353 cyg_threadtimer timer;
354 #else
355 # define CYG_THREAD_TIMER_MEMBER
356 #endif
357
358 #ifdef CYGVAR_KERNEL_THREADS_DATA
359 # define CYG_THREAD_THREAD_DATA_MEMBER \
360 CYG_ADDRWORD thread_data[CYGNUM_KERNEL_THREADS_DATA_MAX];
361 #else
362 # define CYG_THREAD_THREAD_DATA_MEMBER
363 #endif
364
365 #ifdef CYGVAR_KERNEL_THREADS_NAME
366 # define CYG_THREAD_NAME_MEMBER \
367 char *name;
368 #else
369 # define CYG_THREAD_NAME_MEMBER
370 #endif
371
372 #ifdef CYGVAR_KERNEL_THREADS_LIST
373 # define CYG_THREAD_LIST_NEXT_MEMBER \
374 cyg_thread *list_next;
375 #else
376 # define CYG_THREAD_LIST_NEXT_MEMBER
377 #endif
378
379 #define CYG_THREAD_MEMBERS \
380 CYG_HARDWARETHREAD_MEMBERS \
381 CYG_SCHEDTHREAD_MEMBERS \
382 \
383 cyg_uint32 state; \
384 cyg_ucount32 suspend_count; \
385 cyg_ucount32 wakeup_count; \
386 CYG_ADDRWORD wait_info; \
387 cyg_uint16 unique_id; \
388 \
389 CYG_THREAD_EXCEPTION_CONTROL_MEMBER \
390 CYG_THREAD_TIMER_MEMBER \
391 \
392 cyg_reason_t sleep_reason; \
393 cyg_reason_t wake_reason; \
394 \
395 CYG_THREAD_THREAD_DATA_MEMBER \
396 CYG_THREAD_NAME_MEMBER \
397 CYG_THREAD_LIST_NEXT_MEMBER
398
399
271 struct cyg_thread 400 struct cyg_thread
272 { 401 {
273 cyg_hardwarethread hwthread; 402 CYG_THREAD_MEMBERS
274 cyg_schedthread schedthread;
275
276 cyg_uint32 state;
277 cyg_ucount32 suspend_count;
278 cyg_ucount32 wakeup_count;
279 CYG_ADDRWORD wait_info;
280 cyg_uint16 unique_id;
281
282
283 #if defined(CYGPKG_KERNEL_EXCEPTIONS) && !defined(CYGSEM_KERNEL_EXCEPTIONS_GLOBAL)
284
285 cyg_exception_control exception_control;
286
287 #endif
288
289 #ifdef CYGFUN_KERNEL_THREADS_TIMER
290 cyg_threadtimer timer;
291 #endif
292
293 cyg_reason_t sleep_reason;
294 cyg_reason_t wake_reason;
295
296 #ifdef CYGVAR_KERNEL_THREADS_DATA
297
298 CYG_ADDRWORD thread_data[CYGNUM_KERNEL_THREADS_DATA_MAX];
299
300 #endif
301
302 #ifdef CYGVAR_KERNEL_THREADS_NAME
303
304 char *name;
305
306 #endif
307
308 #ifdef CYGVAR_KERNEL_THREADS_LIST
309
310 cyg_thread *list_next;
311
312 #endif
313
314 }; 403 };
315 404
316 /*---------------------------------------------------------------------------*/ 405 /*---------------------------------------------------------------------------*/
317 406
318 struct cyg_mbox 407 struct cyg_mbox