Mercurial > ecos
annotate packages/kernel/current/include/kapidata.h @ 143:6b5f480c6929 ecos-sw-2000-12-08
Merge from eCos master repository on 2000-12-08-02:09:36-GMT
| author | jlarmour |
|---|---|
| date | Fri, 08 Dec 2000 03:30:06 +0000 |
| parents | 6ed91473a1cd |
| children | 8f2f7615e727 |
| rev | line source |
|---|---|
| 0 | 1 #ifndef CYGONCE_KERNEL_KAPIDATA_H |
| 2 #define CYGONCE_KERNEL_KAPIDATA_H | |
| 3 | |
| 4 /*============================================================================= | |
| 5 // | |
| 2 | 6 // kapidata.h |
| 0 | 7 // |
| 2 | 8 // Native API data structures |
| 0 | 9 // |
| 10 //========================================================================== | |
| 11 //####COPYRIGHTBEGIN#### | |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
12 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
13 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
14 // The contents of this file are subject to the Red Hat eCos Public License |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
15 // Version 1.1 (the "License"); you may not use this file except in |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
16 // compliance with the License. You may obtain a copy of the License at |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
17 // http://www.redhat.com/ |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
18 // |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
19 // Software distributed under the License is distributed on an "AS IS" |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
20 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
21 // License for the specific language governing rights and limitations under |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
22 // the License. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
23 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
24 // The Original Code is eCos - Embedded Configurable Operating System, |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
25 // released September 30, 1998. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
26 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
27 // The Initial Developer of the Original Code is Red Hat. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
28 // Portions created by Red Hat are |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
29 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
30 // All Rights Reserved. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
31 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
32 // |
| 0 | 33 //####COPYRIGHTEND#### |
| 34 //========================================================================== | |
| 35 //#####DESCRIPTIONBEGIN#### | |
| 36 // | |
| 2 | 37 // Author(s): nickg |
| 38 // Contributors: nickg | |
| 39 // Date: 1998-03-13 | |
| 40 // Purpose: Native API data structures | |
| 41 // Description: This file defines the structures used in the native API. The | |
| 0 | 42 // sizes of these structures are dependent on the system |
| 43 // configuration and must be kept in step with their real | |
| 44 // counterparts in the C++ headers. | |
| 2 | 45 // Usage: included by kapi.h |
| 0 | 46 // |
| 47 //####DESCRIPTIONEND#### | |
| 48 // | |
| 49 //==========================================================================*/ | |
| 50 | |
| 51 #include <pkgconf/kernel.h> | |
| 52 | |
| 53 #include <cyg/infra/cyg_type.h> | |
| 54 #include <cyg/hal/hal_intr.h> // exception defines | |
| 55 | |
| 56 /*---------------------------------------------------------------------------*/ | |
| 57 | |
| 58 #ifdef __cplusplus | |
| 59 extern "C" { | |
| 60 #endif | |
| 61 | |
| 62 /*---------------------------------------------------------------------------*/ | |
| 63 | |
| 64 #ifndef CYGNUM_KERNEL_SCHED_BITMAP_SIZE | |
| 65 #if defined(CYGSEM_KERNEL_SCHED_MLQUEUE) | |
| 66 #define CYGNUM_KERNEL_SCHED_BITMAP_SIZE 32 | |
| 67 #elif defined(CYGSEM_KERNEL_SCHED_BITMAP) | |
| 68 #define CYGNUM_KERNEL_SCHED_BITMAP_SIZE 32 | |
| 69 #endif | |
| 70 #endif | |
| 71 | |
| 72 #if CYGNUM_KERNEL_SCHED_BITMAP_SIZE <= 8 | |
| 73 typedef cyg_ucount8 cyg_sched_bitmap; | |
| 74 #elif CYGNUM_KERNEL_SCHED_BITMAP_SIZE <= 16 | |
| 75 typedef cyg_ucount16 cyg_sched_bitmap; | |
| 76 #elif CYGNUM_KERNEL_SCHED_BITMAP_SIZE <= 32 | |
| 77 typedef cyg_ucount32 cyg_sched_bitmap; | |
| 78 #elif CYGNUM_KERNEL_SCHED_BITMAP_SIZE <= 64 | |
| 79 typedef cyg_ucount64 cyg_sched_bitmap; | |
| 80 #else | |
| 81 #error Bitmaps greater than 64 bits not currently allowed | |
| 82 #endif | |
| 83 | |
| 84 typedef struct | |
| 85 { | |
| 86 #if defined(CYGSEM_KERNEL_SCHED_BITMAP) | |
| 87 | |
| 88 cyg_sched_bitmap map; | |
| 89 | |
| 90 #elif defined(CYGSEM_KERNEL_SCHED_MLQUEUE) | |
| 91 | |
| 92 cyg_thread *queue; | |
| 93 | |
| 94 #elif defined(CYGSEM_KERNEL_SCHED_LOTTERY) | |
| 95 | |
| 96 cyg_thread *queue; | |
| 97 | |
| 98 #else | |
| 99 | |
| 100 #error Undefined scheduler type | |
| 101 | |
| 102 #endif | |
| 103 } cyg_threadqueue; | |
| 104 | |
| 105 /*---------------------------------------------------------------------------*/ | |
| 106 | |
| 107 struct cyg_interrupt | |
| 108 { | |
| 109 cyg_vector_t vector; | |
| 110 cyg_priority_t priority; | |
| 111 cyg_ISR_t *isr; | |
| 112 cyg_DSR_t *dsr; | |
| 113 CYG_ADDRWORD data; | |
| 114 | |
| 115 #ifdef CYGIMP_KERNEL_INTERRUPTS_DSRS_LIST | |
| 116 cyg_ucount32 dsr_count; | |
| 117 cyg_interrupt *next_dsr; | |
| 118 #endif | |
| 119 #ifdef CYGIMP_KERNEL_INTERRUPTS_CHAIN | |
| 120 cyg_interrupt *next; | |
| 121 #endif | |
| 122 }; | |
| 123 | |
| 124 | |
| 125 /*---------------------------------------------------------------------------*/ | |
| 126 | |
| 127 struct cyg_counter | |
| 128 { | |
| 129 #if defined(CYGIMP_KERNEL_COUNTERS_SINGLE_LIST) | |
| 130 cyg_alarm *alarm_list; | |
| 131 #elif defined(CYGIMP_KERNEL_COUNTERS_MULTI_LIST) | |
| 132 cyg_alarm *alarm_list[CYGNUM_KERNEL_COUNTERS_MULTI_LIST_SIZE]; | |
| 133 #endif | |
| 134 cyg_tick_count_t counter; | |
| 135 cyg_uint32 increment; | |
| 136 }; | |
| 137 | |
| 138 /*---------------------------------------------------------------------------*/ | |
| 139 | |
| 140 struct cyg_clock | |
| 141 { | |
| 142 cyg_counter counter; | |
| 143 cyg_resolution_t resolution; | |
| 144 }; | |
| 145 | |
| 146 /*---------------------------------------------------------------------------*/ | |
| 147 | |
| 148 struct cyg_alarm | |
| 149 { | |
| 150 #if defined(CYGIMP_KERNEL_COUNTERS_SINGLE_LIST) || defined(CYGIMP_KERNEL_COUNTERS_MULTI_LIST) | |
| 151 cyg_alarm *next; | |
| 152 #endif | |
| 153 cyg_counter *counter; | |
| 154 cyg_alarm_t *alarm; | |
| 155 CYG_ADDRWORD data; | |
| 156 cyg_tick_count_t trigger; | |
| 157 cyg_tick_count_t interval; | |
| 158 cyg_bool enabled; | |
| 159 }; | |
| 160 | |
| 161 /*---------------------------------------------------------------------------*/ | |
| 162 /* Exception controller */ | |
| 163 | |
| 164 #ifdef CYGPKG_KERNEL_EXCEPTIONS | |
| 165 typedef struct | |
| 166 { | |
| 167 #ifdef CYGSEM_KERNEL_EXCEPTIONS_DECODE | |
| 2 | 168 cyg_exception_handler_t *exception_handler[CYGNUM_HAL_EXCEPTION_COUNT]; |
| 0 | 169 |
| 2 | 170 CYG_ADDRWORD exception_data[CYGNUM_HAL_EXCEPTION_COUNT]; |
| 0 | 171 #else |
| 172 cyg_exception_handler_t *exception_handler; // Handler function | |
| 173 | |
| 174 CYG_ADDRWORD exception_data; // Handler data | |
| 175 #endif | |
| 176 | |
| 177 } cyg_exception_control; | |
| 178 | |
| 179 #endif | |
| 180 | |
| 181 /*---------------------------------------------------------------------------*/ | |
| 182 /* Thread structure */ | |
| 183 | |
| 184 typedef struct | |
| 185 { | |
| 186 CYG_ADDRESS stack_base; /* pointer to base of stack area */ | |
| 187 cyg_uint32 stack_size; /* size of stack area in bytes */ | |
| 188 #ifdef CYGFUN_KERNEL_THREADS_STACK_LIMIT | |
| 189 CYG_ADDRESS stack_limit; /* movable stack limit */ | |
| 190 #endif | |
| 191 CYG_ADDRESS stack_ptr; /* pointer to saved state on stack */ | |
| 192 CYG_ADDRWORD entry_point; /* main entry point (code pointer!) */ | |
| 193 CYG_ADDRWORD entry_data; /* entry point argument */ | |
| 194 #ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT | |
| 195 void *saved_context; // If non-zero, this points at a more | |
| 196 // interesting context than stack_ptr. | |
| 197 #endif | |
| 198 | |
| 199 } cyg_hardwarethread; | |
| 200 | |
| 201 typedef struct | |
| 202 { | |
| 203 #if defined(CYGSEM_KERNEL_SCHED_BITMAP) | |
| 204 | |
| 205 cyg_priority_t priority; /* current thread priority */ | |
| 206 | |
| 207 #elif defined(CYGSEM_KERNEL_SCHED_MLQUEUE) | |
| 208 | |
| 209 cyg_thread *next; | |
| 210 cyg_thread *prev; | |
| 211 | |
| 212 cyg_priority_t priority; /* current thread priority */ | |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
213 |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
214 #ifdef CYGSEM_KERNEL_SCHED_TIMESLICE_ENABLE |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
215 cyg_bool timeslice_enabled; /* per-thread timeslice enable */ |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
216 #endif |
| 0 | 217 #elif defined(CYGSEM_KERNEL_SCHED_LOTTERY) |
| 218 | |
| 219 cyg_thread *next; | |
| 220 cyg_thread *prev; | |
| 221 | |
| 222 cyg_priority_t priority; /* current thread priority */ | |
| 223 | |
| 224 cyg_priority_t compensation_tickets; /* sleep compensation */ | |
| 225 | |
| 226 #else | |
| 227 | |
| 228 #error Undefined scheduler type | |
| 229 | |
| 230 #endif | |
| 231 | |
| 232 cyg_threadqueue *queue; | |
| 233 | |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
234 #ifdef CYGSEM_KERNEL_SCHED_ASR_SUPPORT |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
235 volatile cyg_bool asr_inhibit; // If true, blocks calls to ASRs |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
236 volatile cyg_bool asr_pending; // If true, this thread's ASR should be called. |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
237 #ifndef CYGSEM_KERNEL_SCHED_ASR_GLOBAL |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
238 void (*asr)(CYG_ADDRWORD); // ASR function |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
239 #endif |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
240 #ifndef CYGSEM_KERNEL_SCHED_ASR_DATA_GLOBAL |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
241 CYG_ADDRWORD asr_data; // ASR data pointer |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
242 #endif |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
243 #endif |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
244 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL |
| 0 | 245 cyg_count32 mutex_count; |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
246 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_SIMPLE |
| 0 | 247 cyg_priority_t original_priority; |
| 248 cyg_bool priority_inherited; | |
| 249 #endif | |
| 250 #endif | |
| 251 | |
| 252 } cyg_schedthread; | |
| 253 | |
| 254 typedef struct | |
| 255 { | |
| 256 cyg_alarm alarm; | |
| 257 cyg_thread *thread; | |
| 258 } cyg_threadtimer; | |
| 259 | |
| 260 | |
| 261 typedef int cyg_reason_t; /* cyg_reason is originally an enum */ | |
| 262 | |
| 263 struct cyg_thread | |
| 264 { | |
| 265 cyg_hardwarethread hwthread; | |
| 266 cyg_schedthread schedthread; | |
| 267 | |
| 268 cyg_uint32 state; | |
| 269 cyg_ucount32 suspend_count; | |
| 270 cyg_ucount32 wakeup_count; | |
| 271 CYG_ADDRWORD wait_info; | |
| 272 cyg_uint16 unique_id; | |
| 273 | |
| 274 | |
| 275 #if defined(CYGPKG_KERNEL_EXCEPTIONS) && !defined(CYGSEM_KERNEL_EXCEPTIONS_GLOBAL) | |
| 276 | |
| 277 cyg_exception_control exception_control; | |
| 278 | |
| 279 #endif | |
| 280 | |
| 281 #ifdef CYGFUN_KERNEL_THREADS_TIMER | |
| 282 cyg_threadtimer timer; | |
| 283 #endif | |
| 284 | |
| 285 cyg_reason_t sleep_reason; | |
| 286 cyg_reason_t wake_reason; | |
| 287 | |
| 288 #ifdef CYGVAR_KERNEL_THREADS_DATA | |
| 289 | |
| 290 CYG_ADDRWORD thread_data[CYGNUM_KERNEL_THREADS_DATA_MAX]; | |
| 291 | |
| 292 #endif | |
| 293 | |
| 294 #ifdef CYGVAR_KERNEL_THREADS_NAME | |
| 295 | |
| 296 char *name; | |
| 297 | |
| 298 #endif | |
| 299 | |
| 300 #ifdef CYGVAR_KERNEL_THREADS_LIST | |
| 301 | |
| 302 cyg_thread *list_next; | |
| 303 | |
| 304 #endif | |
| 305 | |
| 306 }; | |
| 307 | |
| 308 /*---------------------------------------------------------------------------*/ | |
| 309 | |
| 310 struct cyg_mbox | |
| 311 { | |
| 312 cyg_count32 base; /* index of first used slot */ | |
| 313 cyg_count32 count; /* count of used slots */ | |
| 314 cyg_threadqueue get_threadq; /* Queue of waiting threads */ | |
| 315 #ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT | |
| 316 cyg_threadqueue put_threadq; /* Queue of waiting threads */ | |
| 317 #endif | |
| 2 | 318 void * itemqueue[ CYGNUM_KERNEL_SYNCH_MBOX_QUEUE_SIZE ]; |
| 0 | 319 }; |
| 320 | |
| 321 /*---------------------------------------------------------------------------*/ | |
| 322 | |
| 323 struct cyg_sem_t | |
| 324 { | |
| 325 cyg_count32 count; /* The semaphore count */ | |
| 326 cyg_threadqueue queue; /* Queue of waiting threads */ | |
| 327 }; | |
| 328 | |
| 329 /*---------------------------------------------------------------------------*/ | |
| 330 | |
| 331 struct cyg_flag_t | |
| 332 { | |
| 333 cyg_flag_value_t value; /* The flag value */ | |
| 334 cyg_threadqueue queue; /* Queue of waiting threads */ | |
| 335 }; | |
| 336 | |
| 337 /*---------------------------------------------------------------------------*/ | |
| 338 | |
| 339 struct cyg_mutex_t | |
| 340 { | |
| 341 cyg_bool locked; /* true if locked */ | |
| 342 cyg_thread *owner; /* Current locking thread */ | |
| 343 cyg_threadqueue queue; /* Queue of waiting threads */ | |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
344 |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
345 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
346 cyg_uint32 protocol; /* this mutex's protocol */ |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
347 #endif |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
348 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
349 cyg_priority_t ceiling; /* mutex priority ceiling */ |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
350 #endif |
| 0 | 351 |
| 352 }; | |
| 353 | |
| 354 /*---------------------------------------------------------------------------*/ | |
| 355 | |
| 356 struct cyg_cond_t | |
| 357 { | |
| 358 cyg_mutex_t *mutex; /* Associated mutex */ | |
| 359 cyg_threadqueue queue; /* Queue of waiting threads */ | |
| 360 }; | |
| 361 | |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
362 /*------------------------------------------------------------------------*/ |
| 0 | 363 |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
364 /* Memory allocator types now come from the "memalloc" package which is */ |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
365 /* where the implementation lives. */ |
| 0 | 366 |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
66
diff
changeset
|
367 #include <cyg/memalloc/kapidata.h> |
| 0 | 368 |
| 369 #ifdef __cplusplus | |
| 370 } | |
| 371 #endif | |
| 372 | |
| 373 /*---------------------------------------------------------------------------*/ | |
| 374 /* EOF kapidata.h */ | |
| 375 #endif /* CYGONCE_KERNEL_KAPIDATA_H */ |
