Mercurial > ecos
annotate packages/kernel/current/include/kapidata.h @ 94:4642a6d35749 ecos-sw-2000-06-02
Merge from eCos master repository on 2000-06-02-07:47:04-BST
| author | jlarmour |
|---|---|
| date | Fri, 02 Jun 2000 17:35:00 +0000 |
| parents | bf00f99aec69 |
| children | 6ed91473a1cd |
| 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 */ | |
| 213 | |
| 214 #elif defined(CYGSEM_KERNEL_SCHED_LOTTERY) | |
| 215 | |
| 216 cyg_thread *next; | |
| 217 cyg_thread *prev; | |
| 218 | |
| 219 cyg_priority_t priority; /* current thread priority */ | |
| 220 | |
| 221 cyg_priority_t compensation_tickets; /* sleep compensation */ | |
| 222 | |
| 223 #else | |
| 224 | |
| 225 #error Undefined scheduler type | |
| 226 | |
| 227 #endif | |
| 228 | |
| 229 cyg_threadqueue *queue; | |
| 230 | |
| 231 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INHERITANCE | |
| 232 cyg_count32 mutex_count; | |
| 233 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INHERITANCE_SIMPLE | |
| 234 cyg_priority_t original_priority; | |
| 235 cyg_bool priority_inherited; | |
| 236 #endif | |
| 237 #endif | |
| 238 | |
| 239 } cyg_schedthread; | |
| 240 | |
| 241 typedef struct | |
| 242 { | |
| 243 cyg_alarm alarm; | |
| 244 cyg_thread *thread; | |
| 245 } cyg_threadtimer; | |
| 246 | |
| 247 | |
| 248 typedef int cyg_reason_t; /* cyg_reason is originally an enum */ | |
| 249 | |
| 250 struct cyg_thread | |
| 251 { | |
| 252 cyg_hardwarethread hwthread; | |
| 253 cyg_schedthread schedthread; | |
| 254 | |
| 255 cyg_uint32 state; | |
| 256 cyg_ucount32 suspend_count; | |
| 257 cyg_ucount32 wakeup_count; | |
| 258 CYG_ADDRWORD wait_info; | |
| 259 cyg_uint16 unique_id; | |
| 260 | |
| 261 | |
| 262 #if defined(CYGPKG_KERNEL_EXCEPTIONS) && !defined(CYGSEM_KERNEL_EXCEPTIONS_GLOBAL) | |
| 263 | |
| 264 cyg_exception_control exception_control; | |
| 265 | |
| 266 #endif | |
| 267 | |
| 268 #ifdef CYGFUN_KERNEL_THREADS_TIMER | |
| 269 cyg_threadtimer timer; | |
| 270 #endif | |
| 271 | |
| 272 cyg_reason_t sleep_reason; | |
| 273 cyg_reason_t wake_reason; | |
| 274 | |
| 275 #ifdef CYGVAR_KERNEL_THREADS_DATA | |
| 276 | |
| 277 CYG_ADDRWORD thread_data[CYGNUM_KERNEL_THREADS_DATA_MAX]; | |
| 278 | |
| 279 #endif | |
| 280 | |
| 281 #ifdef CYGVAR_KERNEL_THREADS_NAME | |
| 282 | |
| 283 char *name; | |
| 284 | |
| 285 #endif | |
| 286 | |
| 287 #ifdef CYGVAR_KERNEL_THREADS_LIST | |
| 288 | |
| 289 cyg_thread *list_next; | |
| 290 | |
| 291 #endif | |
| 292 | |
| 293 }; | |
| 294 | |
| 295 /*---------------------------------------------------------------------------*/ | |
| 296 | |
| 297 struct cyg_mbox | |
| 298 { | |
| 299 cyg_count32 base; /* index of first used slot */ | |
| 300 cyg_count32 count; /* count of used slots */ | |
| 301 cyg_threadqueue get_threadq; /* Queue of waiting threads */ | |
| 302 #ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT | |
| 303 cyg_threadqueue put_threadq; /* Queue of waiting threads */ | |
| 304 #endif | |
| 2 | 305 void * itemqueue[ CYGNUM_KERNEL_SYNCH_MBOX_QUEUE_SIZE ]; |
| 0 | 306 }; |
| 307 | |
| 308 /*---------------------------------------------------------------------------*/ | |
| 309 | |
| 310 struct cyg_sem_t | |
| 311 { | |
| 312 cyg_count32 count; /* The semaphore count */ | |
| 313 cyg_threadqueue queue; /* Queue of waiting threads */ | |
| 314 }; | |
| 315 | |
| 316 /*---------------------------------------------------------------------------*/ | |
| 317 | |
| 318 struct cyg_flag_t | |
| 319 { | |
| 320 cyg_flag_value_t value; /* The flag value */ | |
| 321 cyg_threadqueue queue; /* Queue of waiting threads */ | |
| 322 }; | |
| 323 | |
| 324 /*---------------------------------------------------------------------------*/ | |
| 325 | |
| 326 struct cyg_mutex_t | |
| 327 { | |
| 328 cyg_bool locked; /* true if locked */ | |
| 329 cyg_thread *owner; /* Current locking thread */ | |
| 330 cyg_threadqueue queue; /* Queue of waiting threads */ | |
| 331 | |
| 332 }; | |
| 333 | |
| 334 /*---------------------------------------------------------------------------*/ | |
| 335 | |
| 336 struct cyg_cond_t | |
| 337 { | |
| 338 cyg_mutex_t *mutex; /* Associated mutex */ | |
| 339 cyg_threadqueue queue; /* Queue of waiting threads */ | |
| 340 }; | |
| 341 | |
| 342 /*---------------------------------------------------------------------------*/ | |
| 343 | |
| 344 /* This corresponds to the extra fields provided by the mempoolt template | |
| 345 not the actual size of the template in any given instance. */ | |
| 346 typedef struct cyg_mempoolt { | |
| 347 cyg_threadqueue queue; | |
| 348 } cyg_mempoolt; | |
| 349 | |
| 350 | |
| 351 struct cyg_mempool_var_memdq { | |
| 352 struct cyg_mempool_var_memdq *prev, *next; | |
| 353 cyg_int32 size; | |
| 354 }; | |
| 355 | |
| 356 struct cyg_mempool_var { | |
| 357 struct cyg_mempool_var_memdq head; | |
| 358 cyg_uint8 *obase; | |
| 359 cyg_int32 osize; | |
| 360 cyg_int32 oalign; | |
| 361 cyg_uint8 *bottom; | |
| 362 cyg_uint8 *top; | |
| 363 cyg_int32 alignment; | |
| 364 cyg_int32 freemem; | |
| 365 cyg_mempoolt mempoolt; | |
| 366 }; | |
| 367 | |
| 368 struct cyg_mempool_fix { | |
| 369 cyg_uint32 *bitmap; | |
| 370 cyg_int32 maptop; | |
| 371 cyg_uint8 *mempool; | |
| 372 cyg_int32 numblocks; | |
| 373 cyg_int32 freeblocks; | |
| 374 cyg_int32 blocksize; | |
| 375 cyg_int32 firstfree; | |
| 376 cyg_uint8 *top; | |
| 377 cyg_mempoolt mempoolt; | |
| 378 }; | |
| 379 | |
| 380 /*------------------------------------------------------------------------*/ | |
| 381 | |
| 382 #ifdef __cplusplus | |
| 383 } | |
| 384 #endif | |
| 385 | |
| 386 /*---------------------------------------------------------------------------*/ | |
| 387 /* EOF kapidata.h */ | |
| 388 #endif /* CYGONCE_KERNEL_KAPIDATA_H */ |
