Mercurial > ecos
annotate packages/kernel/current/include/kapi.h @ 115:6ed91473a1cd ecos-sw-2000-08-21
Merge from eCos master repository on 2000-08-21-22:40:54-BST
| author | jlarmour |
|---|---|
| date | Fri, 25 Aug 2000 17:32:38 +0000 |
| parents | 5a0cc6c243a9 |
| children | d397fc472bcf |
| rev | line source |
|---|---|
| 0 | 1 #ifndef CYGONCE_KERNEL_KAPI_H |
| 2 #define CYGONCE_KERNEL_KAPI_H | |
| 3 | |
| 4 /*========================================================================== | |
| 5 // | |
| 2 | 6 // kapi.h |
| 0 | 7 // |
| 2 | 8 // Native API for Kernel |
| 0 | 9 // |
| 10 //========================================================================== | |
| 11 //####COPYRIGHTBEGIN#### | |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
10
diff
changeset
|
12 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
10
diff
changeset
|
13 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
10
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:
10
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:
10
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:
10
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:
10
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:
10
diff
changeset
|
22 // the License. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
10
diff
changeset
|
23 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
10
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:
10
diff
changeset
|
25 // released September 30, 1998. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
10
diff
changeset
|
26 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
10
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:
10
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:
10
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:
10
diff
changeset
|
30 // All Rights Reserved. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
10
diff
changeset
|
31 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
10
diff
changeset
|
32 // |
| 0 | 33 //####COPYRIGHTEND#### |
| 34 //========================================================================== | |
| 35 //#####DESCRIPTIONBEGIN#### | |
| 36 // | |
| 2 | 37 // Author(s): nickg, dsm |
| 38 // Contributors: nickg | |
| 39 // Date: 1998-03-02 | |
| 40 // Purpose: Native API for Kernel | |
| 41 // Description: This file describes the native API for using the kernel. | |
| 0 | 42 // It is essentially a set of C wrappers for the C++ class |
| 43 // member functions. | |
| 2 | 44 // Usage: #include <cyg/kernel/kapi.h> |
| 0 | 45 // |
| 46 //####DESCRIPTIONEND#### | |
| 47 // | |
| 48 //========================================================================*/ | |
| 49 | |
| 50 #include <pkgconf/kernel.h> | |
| 51 | |
| 52 #ifdef CYGFUN_KERNEL_API_C | |
| 53 #include <cyg/infra/cyg_type.h> | |
| 54 | |
| 55 /*---------------------------------------------------------------------------*/ | |
| 56 | |
| 57 #ifdef __cplusplus | |
| 58 extern "C" { | |
| 59 #endif | |
| 60 | |
| 61 /*---------------------------------------------------------------------------*/ | |
| 62 /* The following are derived types, they may have different */ | |
| 63 /* definitions from these depending on configuration. */ | |
| 64 | |
| 2 | 65 typedef CYG_ADDRWORD cyg_addrword_t; /* May hold pointer or word */ |
| 66 typedef cyg_addrword_t cyg_handle_t; /* Object handle */ | |
| 67 typedef cyg_uint32 cyg_priority_t; /* type for priorities */ | |
| 68 typedef cyg_int32 cyg_code_t; /* type for various codes */ | |
| 69 typedef cyg_uint32 cyg_vector_t; /* Interrupt vector id */ | |
| 0 | 70 |
| 2 | 71 typedef cyg_uint64 cyg_tick_count_t; |
| 0 | 72 |
| 73 typedef int cyg_bool_t; | |
| 74 | |
| 75 /* Exception handler function definition */ | |
| 76 typedef void cyg_exception_handler_t( | |
| 77 cyg_addrword_t data, | |
| 78 cyg_code_t exception_number, | |
| 79 cyg_addrword_t info | |
| 80 ); | |
| 81 | |
| 82 /*---------------------------------------------------------------------------*/ | |
| 83 struct cyg_thread; | |
| 84 typedef struct cyg_thread cyg_thread; | |
| 85 | |
| 86 struct cyg_interrupt; | |
| 87 typedef struct cyg_interrupt cyg_interrupt; | |
| 88 | |
| 89 struct cyg_counter; | |
| 90 typedef struct cyg_counter cyg_counter; | |
| 91 | |
| 92 struct cyg_clock; | |
| 93 typedef struct cyg_clock cyg_clock; | |
| 94 | |
| 95 struct cyg_alarm; | |
| 96 typedef struct cyg_alarm cyg_alarm; | |
| 97 | |
| 98 struct cyg_mbox; | |
| 99 typedef struct cyg_mbox cyg_mbox; | |
| 100 | |
| 101 struct cyg_sem_t; | |
| 102 typedef struct cyg_sem_t cyg_sem_t; | |
| 103 | |
| 104 struct cyg_flag_t; | |
| 105 typedef struct cyg_flag_t cyg_flag_t; | |
| 106 | |
| 107 struct cyg_mutex_t; | |
| 108 typedef struct cyg_mutex_t cyg_mutex_t; | |
| 109 | |
| 110 struct cyg_cond_t; | |
| 111 typedef struct cyg_cond_t cyg_cond_t; | |
| 112 | |
| 113 /*---------------------------------------------------------------------------*/ | |
| 114 /* Scheduler operations */ | |
| 115 | |
| 116 /* Starts scheduler with created threads. Never returns. */ | |
| 117 void cyg_scheduler_start(void) __attribute__ ((noreturn)); | |
| 118 | |
| 119 /* Lock and unlock the scheduler. When the scheduler is */ | |
| 120 /* locked thread preemption is disabled. */ | |
| 121 void cyg_scheduler_lock(void); | |
| 122 | |
| 123 void cyg_scheduler_unlock(void); | |
|
84
489eb5632bc3
Merge from eCos master repository on 2000-04-28-18:44:39-BST
jlarmour
parents:
66
diff
changeset
|
124 |
|
489eb5632bc3
Merge from eCos master repository on 2000-04-28-18:44:39-BST
jlarmour
parents:
66
diff
changeset
|
125 /* Just like 'cyg_scheduler_lock()', but never take the lock higher than 1 */ |
|
489eb5632bc3
Merge from eCos master repository on 2000-04-28-18:44:39-BST
jlarmour
parents:
66
diff
changeset
|
126 /* Thus this call is safe even if the scheduler is already locked and a */ |
|
489eb5632bc3
Merge from eCos master repository on 2000-04-28-18:44:39-BST
jlarmour
parents:
66
diff
changeset
|
127 /* subsequent call to 'cyg_scheduler_unlock()' will completely unlock. */ |
|
489eb5632bc3
Merge from eCos master repository on 2000-04-28-18:44:39-BST
jlarmour
parents:
66
diff
changeset
|
128 void cyg_scheduler_safe_lock(void); |
| 0 | 129 |
|
105
5a0cc6c243a9
Merge from eCos master repository on 2000-06-30-08:18:49-BST
jlarmour
parents:
84
diff
changeset
|
130 /* Read the scheduler lock value. */ |
|
5a0cc6c243a9
Merge from eCos master repository on 2000-06-30-08:18:49-BST
jlarmour
parents:
84
diff
changeset
|
131 cyg_ucount32 cyg_scheduler_read_lock(void); |
|
5a0cc6c243a9
Merge from eCos master repository on 2000-06-30-08:18:49-BST
jlarmour
parents:
84
diff
changeset
|
132 |
| 0 | 133 /*---------------------------------------------------------------------------*/ |
| 134 /* Thread operations */ | |
| 135 | |
| 136 typedef void cyg_thread_entry_t(cyg_addrword_t); | |
| 137 | |
| 138 void cyg_thread_create( | |
| 2 | 139 cyg_addrword_t sched_info, /* scheduling info (eg pri) */ |
| 0 | 140 cyg_thread_entry_t *entry, /* entry point function */ |
| 2 | 141 cyg_addrword_t entry_data, /* entry data */ |
| 0 | 142 char *name, /* optional thread name */ |
| 143 void *stack_base, /* stack base, NULL = alloc */ | |
| 144 cyg_ucount32 stack_size, /* stack size, 0 = default */ | |
| 145 cyg_handle_t *handle, /* returned thread handle */ | |
| 146 cyg_thread *thread /* put thread here */ | |
| 147 ); | |
| 148 | |
| 149 void cyg_thread_exit(void); | |
| 150 | |
|
8
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
2
diff
changeset
|
151 /* It may be necessary to arrange for the victim to run for it to disappear */ |
|
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
2
diff
changeset
|
152 cyg_bool_t cyg_thread_delete(cyg_handle_t thread); /* false if NOT deleted */ |
| 0 | 153 |
| 154 void cyg_thread_suspend(cyg_handle_t thread); | |
| 155 | |
| 156 void cyg_thread_resume(cyg_handle_t thread); | |
| 157 | |
| 158 void cyg_thread_kill(cyg_handle_t thread); | |
| 159 | |
| 2 | 160 void cyg_thread_release(cyg_handle_t thread); |
| 0 | 161 |
| 162 void cyg_thread_yield(void); | |
| 163 | |
| 164 cyg_handle_t cyg_thread_self(void); | |
| 165 | |
|
10
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
166 cyg_handle_t cyg_thread_idle_thread(void); |
| 0 | 167 |
| 168 /* Priority manipulation */ | |
| 169 | |
| 170 void cyg_thread_set_priority(cyg_handle_t thread, cyg_priority_t priority ); | |
| 171 | |
| 172 cyg_priority_t cyg_thread_get_priority(cyg_handle_t thread); | |
| 173 | |
| 174 /* Deadline scheduling control (optional) */ | |
| 175 | |
| 176 void cyg_thread_deadline_wait( | |
| 177 cyg_tick_count_t start_time, /* abs earliest start time */ | |
| 178 cyg_tick_count_t run_time, /* worst case execution time */ | |
| 179 cyg_tick_count_t deadline /* absolute deadline */ | |
| 180 ); | |
| 181 | |
| 182 void cyg_thread_delay(cyg_tick_count_t delay); | |
| 183 | |
|
10
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
184 /* Stack information */ |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
185 cyg_addrword_t cyg_thread_get_stack_base(cyg_handle_t thread); |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
186 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
187 cyg_uint32 cyg_thread_get_stack_size(cyg_handle_t thread); |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
188 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
189 |
| 0 | 190 /*---------------------------------------------------------------------------*/ |
| 2 | 191 /* Per-thread Data */ |
| 192 | |
| 193 #ifdef CYGVAR_KERNEL_THREADS_DATA | |
| 194 | |
| 195 cyg_ucount32 cyg_thread_new_data_index(void); | |
| 196 | |
| 197 void cyg_thread_free_data_index(cyg_ucount32 index); | |
| 198 | |
| 199 CYG_ADDRWORD cyg_thread_get_data(cyg_ucount32 index); | |
| 200 | |
| 201 CYG_ADDRWORD *cyg_thread_get_data_ptr(cyg_ucount32 index); | |
| 202 | |
| 203 void cyg_thread_set_data(cyg_ucount32 index, CYG_ADDRWORD data); | |
| 204 | |
| 205 #endif | |
| 206 | |
| 207 /*---------------------------------------------------------------------------*/ | |
| 0 | 208 /* Exception handling. */ |
| 209 | |
| 210 /* Replace current exception handler, this may apply to either the */ | |
| 211 /* current thread, or to a global exception handler. The exception */ | |
| 212 /* number may be ignored, or used to specify a particular handler. */ | |
| 213 | |
| 214 void cyg_exception_set_handler( | |
| 215 cyg_code_t exception_number, | |
| 216 cyg_exception_handler_t *new_handler, | |
| 217 cyg_addrword_t new_data, | |
| 218 cyg_exception_handler_t **old_handler, | |
| 219 cyg_addrword_t *old_data | |
| 220 ); | |
| 221 | |
| 222 /* Clear exception hander to default value */ | |
| 223 void cyg_exception_clear_handler( | |
| 224 cyg_code_t exception_number | |
| 225 ); | |
| 226 | |
| 227 /* Invoke exception handler */ | |
| 228 void cyg_exception_call_handler( | |
| 229 cyg_handle_t thread, | |
| 230 cyg_code_t exception_number, | |
| 2 | 231 cyg_addrword_t exception_info |
| 0 | 232 ); |
| 233 | |
| 234 | |
| 235 /*---------------------------------------------------------------------------*/ | |
| 236 /* Interrupt handling */ | |
| 237 typedef void cyg_VSR_t(void); | |
| 238 typedef cyg_uint32 cyg_ISR_t(cyg_vector_t vector, cyg_addrword_t data); | |
| 239 typedef void cyg_DSR_t( | |
| 240 cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data); | |
| 241 | |
| 242 | |
| 243 enum cyg_ISR_results | |
| 244 { | |
| 245 CYG_ISR_HANDLED = 1, /* Interrupt was handled */ | |
| 246 CYG_ISR_CALL_DSR = 2 /* Schedule DSR */ | |
| 247 }; | |
| 248 | |
| 249 void cyg_interrupt_create( | |
| 250 cyg_vector_t vector, /* Vector to attach to */ | |
| 251 cyg_priority_t priority, /* Queue priority */ | |
| 2 | 252 cyg_addrword_t data, /* Data pointer */ |
| 0 | 253 cyg_ISR_t *isr, /* Interrupt Service Routine */ |
| 254 cyg_DSR_t *dsr, /* Deferred Service Routine */ | |
| 255 cyg_handle_t *handle, /* returned handle */ | |
| 256 cyg_interrupt *intr /* put interrupt here */ | |
| 257 ); | |
| 258 | |
| 259 void cyg_interrupt_delete( cyg_handle_t interrupt ); | |
| 260 | |
| 261 void cyg_interrupt_attach( cyg_handle_t interrupt ); | |
| 262 | |
| 263 void cyg_interrupt_detach( cyg_handle_t interrupt ); | |
| 264 | |
| 265 /* VSR manipulation */ | |
| 266 | |
| 267 void cyg_interrupt_get_vsr( | |
| 268 cyg_vector_t vector, /* vector to get */ | |
| 269 cyg_VSR_t **vsr /* vsr got */ | |
| 270 ); | |
| 271 | |
| 272 void cyg_interrupt_set_vsr( | |
| 273 cyg_vector_t vector, /* vector to set */ | |
| 274 cyg_VSR_t *vsr /* vsr to set */ | |
| 275 ); | |
| 276 | |
| 277 /* CPU level interrupt mask */ | |
| 278 void cyg_interrupt_disable(void); | |
| 279 | |
| 280 void cyg_interrupt_enable(void); | |
| 281 | |
| 282 /* Interrupt controller access */ | |
| 283 void cyg_interrupt_mask(cyg_vector_t vector); | |
| 284 | |
| 285 void cyg_interrupt_unmask(cyg_vector_t vector); | |
| 286 | |
| 287 void cyg_interrupt_acknowledge(cyg_vector_t vector); | |
| 288 | |
| 289 void cyg_interrupt_configure( | |
| 290 cyg_vector_t vector, /* vector to configure */ | |
| 291 cyg_bool_t level, /* level or edge triggered */ | |
| 292 cyg_bool_t up /* rising/faling edge, high/low level*/ | |
| 293 ); | |
| 294 | |
| 295 /*---------------------------------------------------------------------------*/ | |
| 296 /* Counters, Clocks and Alarms */ | |
| 297 | |
| 298 void cyg_counter_create( | |
| 299 cyg_handle_t *handle, /* returned counter handle */ | |
| 300 cyg_counter *counter /* put counter here */ | |
| 301 ); | |
| 302 | |
| 303 void cyg_counter_delete(cyg_handle_t counter); | |
| 304 | |
| 305 /* Return current value of counter */ | |
| 306 cyg_tick_count_t cyg_counter_current_value(cyg_handle_t counter); | |
| 307 | |
| 308 /* Set new current value */ | |
| 309 void cyg_counter_set_value( | |
| 310 cyg_handle_t counter, | |
| 311 cyg_tick_count_t new_value | |
| 312 ); | |
| 313 | |
| 314 /* Advance counter by one tick */ | |
| 315 void cyg_counter_tick(cyg_handle_t counter); | |
| 316 | |
| 317 | |
| 318 typedef struct | |
| 319 { | |
| 320 cyg_uint32 dividend; | |
| 321 cyg_uint32 divisor; | |
| 322 } cyg_resolution_t; | |
| 323 | |
| 324 /* Create a clock object */ | |
| 325 void cyg_clock_create( | |
| 326 cyg_resolution_t resolution, /* Initial resolution */ | |
| 327 cyg_handle_t *handle, /* Returned clock handle */ | |
| 328 cyg_clock *clock /* put clock here */ | |
| 329 ); | |
| 330 | |
| 331 void cyg_clock_delete(cyg_handle_t clock); | |
| 332 | |
| 333 /* convert a clock handle to a counter handle so we can use the */ | |
| 334 /* counter API on it. */ | |
| 335 void cyg_clock_to_counter( | |
| 336 cyg_handle_t clock, | |
| 337 cyg_handle_t *counter | |
| 338 ); | |
| 339 | |
| 340 void cyg_clock_set_resolution( | |
| 341 cyg_handle_t clock, | |
| 342 cyg_resolution_t resolution /* New resolution */ | |
| 343 ); | |
| 344 | |
| 345 cyg_resolution_t cyg_clock_get_resolution(cyg_handle_t clock); | |
| 346 | |
| 347 /* handle of real time clock */ | |
| 348 cyg_handle_t cyg_real_time_clock(void); | |
| 349 | |
| 350 /* returns value of real time clock's counter. | |
| 351 This is the same as: | |
| 352 (cyg_clock_to_counter(cyg_real_time_clock(), &h), | |
| 353 cyg_counter_current_value(h)) */ | |
| 354 cyg_tick_count_t cyg_current_time(void); | |
| 355 | |
| 356 /* Alarm handler function */ | |
| 357 typedef void cyg_alarm_t(cyg_handle_t alarm, cyg_addrword_t data); | |
| 358 | |
| 359 void cyg_alarm_create( | |
| 360 cyg_handle_t counter, /* Attached to this counter */ | |
| 361 cyg_alarm_t *alarmfn, /* Call-back function */ | |
| 2 | 362 cyg_addrword_t data, /* Call-back data */ |
| 0 | 363 cyg_handle_t *handle, /* Returned alarm object */ |
| 364 cyg_alarm *alarm /* put alarm here */ | |
| 365 ); | |
| 366 | |
| 367 /* Disable alarm, detach from counter and invalidate handles */ | |
| 368 void cyg_alarm_delete( cyg_handle_t alarm); | |
| 369 | |
| 370 void cyg_alarm_initialize( | |
| 371 cyg_handle_t alarm, | |
| 372 cyg_tick_count_t trigger, /* Absolute trigger time */ | |
| 373 cyg_tick_count_t interval /* Relative retrigger interval */ | |
| 374 ); | |
| 375 | |
| 376 void cyg_alarm_enable( cyg_handle_t alarm ); | |
| 377 | |
| 378 void cyg_alarm_disable( cyg_handle_t alarm ); | |
| 379 | |
| 380 /*---------------------------------------------------------------------------*/ | |
| 381 /* Mail boxes */ | |
| 382 void cyg_mbox_create( | |
| 383 cyg_handle_t *handle, | |
| 384 cyg_mbox *mbox | |
| 385 ); | |
| 386 | |
| 387 void cyg_mbox_delete(cyg_handle_t mbox); | |
| 388 | |
| 389 void *cyg_mbox_get(cyg_handle_t mbox); | |
| 390 | |
| 391 #ifdef CYGFUN_KERNEL_THREADS_TIMER | |
| 392 void *cyg_mbox_timed_get( | |
| 393 cyg_handle_t mbox, | |
| 394 cyg_tick_count_t abstime | |
| 395 ); | |
| 396 #endif | |
| 397 | |
| 398 void *cyg_mbox_tryget(cyg_handle_t mbox); | |
| 399 | |
| 400 void *cyg_mbox_peek_item(cyg_handle_t mbox); | |
| 401 | |
| 402 #ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT | |
| 403 cyg_bool_t cyg_mbox_put(cyg_handle_t mbox, void *item); | |
| 404 #ifdef CYGFUN_KERNEL_THREADS_TIMER | |
| 405 cyg_bool_t cyg_mbox_timed_put( | |
| 406 cyg_handle_t mbox, | |
| 407 void *item, | |
| 408 cyg_tick_count_t abstime | |
| 409 ); | |
| 410 #endif | |
| 411 #endif | |
| 412 | |
| 413 cyg_bool_t cyg_mbox_tryput(cyg_handle_t mbox, void *item); | |
| 414 | |
| 415 cyg_count32 cyg_mbox_peek(cyg_handle_t mbox); | |
| 416 | |
| 417 cyg_bool_t cyg_mbox_waiting_to_get(cyg_handle_t mbox); | |
| 418 | |
| 419 cyg_bool_t cyg_mbox_waiting_to_put(cyg_handle_t mbox); | |
| 420 | |
| 421 | |
| 422 /*-----------------------------------------------------------------------*/ | |
| 423 /* Memory pools */ | |
| 424 | |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
105
diff
changeset
|
425 /* These definitions are found in the "memalloc" package as this is */ |
|
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
105
diff
changeset
|
426 /* where the implementation lives. */ |
| 0 | 427 |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
105
diff
changeset
|
428 #include <cyg/memalloc/kapi.h> |
| 0 | 429 |
| 430 /*---------------------------------------------------------------------------*/ | |
| 431 /* Semaphores */ | |
| 432 | |
| 433 void cyg_semaphore_init( | |
| 434 cyg_sem_t *sem, /* Semaphore to init */ | |
| 2 | 435 cyg_count32 val /* Initial semaphore value */ |
| 0 | 436 ); |
| 437 | |
| 438 void cyg_semaphore_destroy( cyg_sem_t *sem ); | |
| 439 | |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
105
diff
changeset
|
440 cyg_bool_t cyg_semaphore_wait( cyg_sem_t *sem ); |
| 0 | 441 |
| 442 #ifdef CYGFUN_KERNEL_THREADS_TIMER | |
| 443 cyg_bool_t cyg_semaphore_timed_wait( | |
| 444 cyg_sem_t *sem, | |
| 445 cyg_tick_count_t abstime | |
| 446 ); | |
| 447 #endif | |
| 448 | |
| 449 cyg_bool_t cyg_semaphore_trywait( cyg_sem_t *sem ); | |
| 450 | |
| 451 void cyg_semaphore_post( cyg_sem_t *sem ); | |
| 452 | |
| 2 | 453 void cyg_semaphore_peek( cyg_sem_t *sem, cyg_count32 *val ); |
| 0 | 454 |
| 455 /*---------------------------------------------------------------------------*/ | |
| 456 /* Flags */ | |
| 457 | |
| 458 typedef cyg_uint32 cyg_flag_value_t; | |
| 459 typedef cyg_uint8 cyg_flag_mode_t; | |
| 460 #define CYG_FLAG_WAITMODE_AND ((cyg_flag_mode_t)0) /* all bits must be set */ | |
| 461 #define CYG_FLAG_WAITMODE_OR ((cyg_flag_mode_t)2) /* any bit must be set */ | |
| 462 #define CYG_FLAG_WAITMODE_CLR ((cyg_flag_mode_t)1) /* clear when satisfied */ | |
| 463 | |
| 464 void cyg_flag_init( | |
| 465 cyg_flag_t *flag /* Flag to init */ | |
| 466 ); | |
| 467 | |
| 468 void cyg_flag_destroy( cyg_flag_t *flag ); | |
| 469 | |
| 470 /* bitwise-or in the bits in value; awaken any waiting tasks whose | |
| 471 condition is now satisfied */ | |
| 472 void cyg_flag_setbits( cyg_flag_t *flag, cyg_flag_value_t value); | |
| 473 | |
| 474 /* bitwise-and with the the bits in value; this clears the bits which | |
| 475 are not set in value. No waiting task can be awoken. */ | |
| 476 void cyg_flag_maskbits( cyg_flag_t *flag, cyg_flag_value_t value); | |
| 477 | |
| 478 /* wait for the flag value to match the pattern, according to the mode. | |
| 479 If mode includes CLR, set the flag value to zero when | |
| 480 our pattern is matched. The return value is that which matched | |
| 481 the request, or zero for an error/timeout return. | |
| 482 Value must not itself be zero. */ | |
| 483 cyg_flag_value_t cyg_flag_wait( cyg_flag_t *flag, | |
| 484 cyg_flag_value_t pattern, | |
| 485 cyg_flag_mode_t mode ); | |
| 486 | |
| 487 #ifdef CYGFUN_KERNEL_THREADS_TIMER | |
| 488 cyg_flag_value_t cyg_flag_timed_wait( cyg_flag_t *flag, | |
| 489 cyg_flag_value_t pattern, | |
| 490 cyg_flag_mode_t mode, | |
| 491 cyg_tick_count_t abstime ); | |
| 492 | |
| 493 #endif | |
| 494 | |
| 495 cyg_flag_value_t cyg_flag_poll( cyg_flag_t *flag, | |
| 496 cyg_flag_value_t pattern, | |
| 497 cyg_flag_mode_t mode ); | |
| 498 | |
| 499 cyg_flag_value_t cyg_flag_peek( cyg_flag_t *flag ); | |
| 500 | |
| 501 cyg_bool_t cyg_flag_waiting( cyg_flag_t *flag ); | |
| 502 | |
| 503 /*---------------------------------------------------------------------------*/ | |
| 504 /* Mutex */ | |
| 505 | |
| 506 void cyg_mutex_init( | |
| 507 cyg_mutex_t *mutex /* Mutex to init */ | |
| 508 ); | |
| 509 | |
| 510 void cyg_mutex_destroy( cyg_mutex_t *mutex ); | |
| 511 | |
| 2 | 512 cyg_bool_t cyg_mutex_lock( cyg_mutex_t *mutex ); |
| 0 | 513 |
| 514 cyg_bool_t cyg_mutex_trylock( cyg_mutex_t *mutex ); | |
| 515 | |
| 516 void cyg_mutex_unlock( cyg_mutex_t *mutex ); | |
| 517 | |
| 2 | 518 void cyg_mutex_release( cyg_mutex_t *mutex ); |
| 519 | |
| 0 | 520 /*---------------------------------------------------------------------------*/ |
| 521 /* Condition Variables */ | |
| 522 | |
| 523 void cyg_cond_init( | |
| 524 cyg_cond_t *cond, /* condition variable to init */ | |
| 525 cyg_mutex_t *mutex /* associated mutex */ | |
| 526 ); | |
| 527 | |
| 528 void cyg_cond_destroy( cyg_cond_t *cond ); | |
| 529 | |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
105
diff
changeset
|
530 cyg_bool_t cyg_cond_wait( cyg_cond_t *cond ); |
| 0 | 531 |
| 532 void cyg_cond_signal( cyg_cond_t *cond ); | |
| 533 | |
| 534 void cyg_cond_broadcast( cyg_cond_t *cond ); | |
| 535 | |
| 536 #ifdef CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT | |
| 537 cyg_bool_t cyg_cond_timed_wait( | |
| 538 cyg_cond_t *cond, | |
| 539 cyg_tick_count_t abstime | |
| 540 ); | |
| 541 #endif | |
| 542 | |
| 543 | |
| 544 #ifdef __cplusplus | |
| 545 } | |
| 546 #endif | |
| 547 | |
| 548 #include <cyg/kernel/kapidata.h> | |
| 549 | |
| 550 /*---------------------------------------------------------------------------*/ | |
| 551 /* EOF kapi.h */ | |
| 552 #endif /* CYGFUN_KERNEL_API_C */ | |
| 553 #endif /* CYGONCE_KERNEL_KAPI_H */ |
