comparison packages/kernel/current/include/kapi.h @ 2:443894e2e912 ecos-v1_2_1-release

Block commit of eCos version 1.2.1
author jlarmour
date Tue, 11 May 1999 12:24:34 +0000
parents 3111d98ba7b3
children ece80412419a
comparison
equal deleted inserted replaced
1:72f549f0d891 2:443894e2e912
1 #ifndef CYGONCE_KERNEL_KAPI_H 1 #ifndef CYGONCE_KERNEL_KAPI_H
2 #define CYGONCE_KERNEL_KAPI_H 2 #define CYGONCE_KERNEL_KAPI_H
3 3
4 /*========================================================================== 4 /*==========================================================================
5 // 5 //
6 // kapi.h 6 // kapi.h
7 // 7 //
8 // Native API for Kernel 8 // Native API for Kernel
9 // 9 //
10 //========================================================================== 10 //==========================================================================
11 //####COPYRIGHTBEGIN#### 11 //####COPYRIGHTBEGIN####
12 // 12 //
13 // ------------------------------------------- 13 // -------------------------------------------
23 // 23 //
24 // The Original Code is eCos - Embedded Cygnus Operating System, released 24 // The Original Code is eCos - Embedded Cygnus Operating System, released
25 // September 30, 1998. 25 // September 30, 1998.
26 // 26 //
27 // The Initial Developer of the Original Code is Cygnus. Portions created 27 // The Initial Developer of the Original Code is Cygnus. Portions created
28 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. 28 // by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved.
29 // ------------------------------------------- 29 // -------------------------------------------
30 // 30 //
31 //####COPYRIGHTEND#### 31 //####COPYRIGHTEND####
32 //========================================================================== 32 //==========================================================================
33 //#####DESCRIPTIONBEGIN#### 33 //#####DESCRIPTIONBEGIN####
34 // 34 //
35 // Author(s): nickg, dsm 35 // Author(s): nickg, dsm
36 // Contributors: nickg 36 // Contributors: nickg
37 // Date: 1998-03-02 37 // Date: 1998-03-02
38 // Purpose: Native API for Kernel 38 // Purpose: Native API for Kernel
39 // Description: This file describes the native API for using the kernel. 39 // Description: This file describes the native API for using the kernel.
40 // It is essentially a set of C wrappers for the C++ class 40 // It is essentially a set of C wrappers for the C++ class
41 // member functions. 41 // member functions.
42 // Usage: #include <cyg/kernel/kapi.h> 42 // Usage: #include <cyg/kernel/kapi.h>
43 // 43 //
44 //####DESCRIPTIONEND#### 44 //####DESCRIPTIONEND####
45 // 45 //
46 //========================================================================*/ 46 //========================================================================*/
47 47
58 58
59 /*---------------------------------------------------------------------------*/ 59 /*---------------------------------------------------------------------------*/
60 /* The following are derived types, they may have different */ 60 /* The following are derived types, they may have different */
61 /* definitions from these depending on configuration. */ 61 /* definitions from these depending on configuration. */
62 62
63 typedef CYG_ADDRWORD cyg_addrword_t; /* May hold pointer or word */ 63 typedef CYG_ADDRWORD cyg_addrword_t; /* May hold pointer or word */
64 typedef cyg_addrword_t cyg_handle_t; /* Object handle */ 64 typedef cyg_addrword_t cyg_handle_t; /* Object handle */
65 typedef cyg_uint32 cyg_priority_t; /* type for priorities */ 65 typedef cyg_uint32 cyg_priority_t; /* type for priorities */
66 typedef cyg_uint32 cyg_code_t; /* type for various codes */ 66 typedef cyg_int32 cyg_code_t; /* type for various codes */
67 typedef cyg_uint32 cyg_vector_t; /* Interrupt vector id */ 67 typedef cyg_uint32 cyg_vector_t; /* Interrupt vector id */
68 68
69 typedef unsigned long long cyg_tick_count_t; 69 typedef cyg_uint64 cyg_tick_count_t;
70 70
71 typedef int cyg_bool_t; 71 typedef int cyg_bool_t;
72 72
73 /* Exception handler function definition */ 73 /* Exception handler function definition */
74 typedef void cyg_exception_handler_t( 74 typedef void cyg_exception_handler_t(
130 /* Thread operations */ 130 /* Thread operations */
131 131
132 typedef void cyg_thread_entry_t(cyg_addrword_t); 132 typedef void cyg_thread_entry_t(cyg_addrword_t);
133 133
134 void cyg_thread_create( 134 void cyg_thread_create(
135 cyg_addrword_t sched_info, /* scheduling info (eg pri) */ 135 cyg_addrword_t sched_info, /* scheduling info (eg pri) */
136 cyg_thread_entry_t *entry, /* entry point function */ 136 cyg_thread_entry_t *entry, /* entry point function */
137 cyg_addrword_t entry_data, /* entry data */ 137 cyg_addrword_t entry_data, /* entry data */
138 char *name, /* optional thread name */ 138 char *name, /* optional thread name */
139 void *stack_base, /* stack base, NULL = alloc */ 139 void *stack_base, /* stack base, NULL = alloc */
140 cyg_ucount32 stack_size, /* stack size, 0 = default */ 140 cyg_ucount32 stack_size, /* stack size, 0 = default */
141 cyg_handle_t *handle, /* returned thread handle */ 141 cyg_handle_t *handle, /* returned thread handle */
142 cyg_thread *thread /* put thread here */ 142 cyg_thread *thread /* put thread here */
143 ); 143 );
144 144
145 void cyg_thread_exit(void); 145 void cyg_thread_exit(void);
146 146
147 void cyg_thread_delete(cyg_handle_t thread);
147 148
148 void cyg_thread_suspend(cyg_handle_t thread); 149 void cyg_thread_suspend(cyg_handle_t thread);
149 150
150 void cyg_thread_resume(cyg_handle_t thread); 151 void cyg_thread_resume(cyg_handle_t thread);
151 152
152 void cyg_thread_kill(cyg_handle_t thread); 153 void cyg_thread_kill(cyg_handle_t thread);
153 154
155 void cyg_thread_release(cyg_handle_t thread);
154 156
155 void cyg_thread_yield(void); 157 void cyg_thread_yield(void);
156 158
157 cyg_handle_t cyg_thread_self(void); 159 cyg_handle_t cyg_thread_self(void);
158 160
171 cyg_tick_count_t deadline /* absolute deadline */ 173 cyg_tick_count_t deadline /* absolute deadline */
172 ); 174 );
173 175
174 void cyg_thread_delay(cyg_tick_count_t delay); 176 void cyg_thread_delay(cyg_tick_count_t delay);
175 177
178 /*---------------------------------------------------------------------------*/
179 /* Per-thread Data */
180
181 #ifdef CYGVAR_KERNEL_THREADS_DATA
182
183 cyg_ucount32 cyg_thread_new_data_index(void);
184
185 void cyg_thread_free_data_index(cyg_ucount32 index);
186
187 CYG_ADDRWORD cyg_thread_get_data(cyg_ucount32 index);
188
189 CYG_ADDRWORD *cyg_thread_get_data_ptr(cyg_ucount32 index);
190
191 void cyg_thread_set_data(cyg_ucount32 index, CYG_ADDRWORD data);
192
193 #endif
194
176 /*---------------------------------------------------------------------------*/ 195 /*---------------------------------------------------------------------------*/
177 /* Exception handling. */ 196 /* Exception handling. */
178 197
179 /* Replace current exception handler, this may apply to either the */ 198 /* Replace current exception handler, this may apply to either the */
180 /* current thread, or to a global exception handler. The exception */ 199 /* current thread, or to a global exception handler. The exception */
195 214
196 /* Invoke exception handler */ 215 /* Invoke exception handler */
197 void cyg_exception_call_handler( 216 void cyg_exception_call_handler(
198 cyg_handle_t thread, 217 cyg_handle_t thread,
199 cyg_code_t exception_number, 218 cyg_code_t exception_number,
200 cyg_addrword_t exception_info 219 cyg_addrword_t exception_info
201 ); 220 );
202 221
203 222
204 /*---------------------------------------------------------------------------*/ 223 /*---------------------------------------------------------------------------*/
205 /* Interrupt handling */ 224 /* Interrupt handling */
216 }; 235 };
217 236
218 void cyg_interrupt_create( 237 void cyg_interrupt_create(
219 cyg_vector_t vector, /* Vector to attach to */ 238 cyg_vector_t vector, /* Vector to attach to */
220 cyg_priority_t priority, /* Queue priority */ 239 cyg_priority_t priority, /* Queue priority */
221 cyg_addrword_t data, /* Data pointer */ 240 cyg_addrword_t data, /* Data pointer */
222 cyg_ISR_t *isr, /* Interrupt Service Routine */ 241 cyg_ISR_t *isr, /* Interrupt Service Routine */
223 cyg_DSR_t *dsr, /* Deferred Service Routine */ 242 cyg_DSR_t *dsr, /* Deferred Service Routine */
224 cyg_handle_t *handle, /* returned handle */ 243 cyg_handle_t *handle, /* returned handle */
225 cyg_interrupt *intr /* put interrupt here */ 244 cyg_interrupt *intr /* put interrupt here */
226 ); 245 );
326 typedef void cyg_alarm_t(cyg_handle_t alarm, cyg_addrword_t data); 345 typedef void cyg_alarm_t(cyg_handle_t alarm, cyg_addrword_t data);
327 346
328 void cyg_alarm_create( 347 void cyg_alarm_create(
329 cyg_handle_t counter, /* Attached to this counter */ 348 cyg_handle_t counter, /* Attached to this counter */
330 cyg_alarm_t *alarmfn, /* Call-back function */ 349 cyg_alarm_t *alarmfn, /* Call-back function */
331 cyg_addrword_t data, /* Call-back data */ 350 cyg_addrword_t data, /* Call-back data */
332 cyg_handle_t *handle, /* Returned alarm object */ 351 cyg_handle_t *handle, /* Returned alarm object */
333 cyg_alarm *alarm /* put alarm here */ 352 cyg_alarm *alarm /* put alarm here */
334 ); 353 );
335 354
336 /* Disable alarm, detach from counter and invalidate handles */ 355 /* Disable alarm, detach from counter and invalidate handles */
485 /*---------------------------------------------------------------------------*/ 504 /*---------------------------------------------------------------------------*/
486 /* Semaphores */ 505 /* Semaphores */
487 506
488 void cyg_semaphore_init( 507 void cyg_semaphore_init(
489 cyg_sem_t *sem, /* Semaphore to init */ 508 cyg_sem_t *sem, /* Semaphore to init */
490 cyg_ucount32 val /* Initial semaphore value */ 509 cyg_count32 val /* Initial semaphore value */
491 ); 510 );
492 511
493 void cyg_semaphore_destroy( cyg_sem_t *sem ); 512 void cyg_semaphore_destroy( cyg_sem_t *sem );
494 513
495 void cyg_semaphore_wait( cyg_sem_t *sem ); 514 void cyg_semaphore_wait( cyg_sem_t *sem );
503 522
504 cyg_bool_t cyg_semaphore_trywait( cyg_sem_t *sem ); 523 cyg_bool_t cyg_semaphore_trywait( cyg_sem_t *sem );
505 524
506 void cyg_semaphore_post( cyg_sem_t *sem ); 525 void cyg_semaphore_post( cyg_sem_t *sem );
507 526
508 void cyg_semaphore_peek( cyg_sem_t *sem, cyg_ucount32 *val ); 527 void cyg_semaphore_peek( cyg_sem_t *sem, cyg_count32 *val );
509 528
510 /*---------------------------------------------------------------------------*/ 529 /*---------------------------------------------------------------------------*/
511 /* Flags */ 530 /* Flags */
512 531
513 typedef cyg_uint32 cyg_flag_value_t; 532 typedef cyg_uint32 cyg_flag_value_t;
562 cyg_mutex_t *mutex /* Mutex to init */ 581 cyg_mutex_t *mutex /* Mutex to init */
563 ); 582 );
564 583
565 void cyg_mutex_destroy( cyg_mutex_t *mutex ); 584 void cyg_mutex_destroy( cyg_mutex_t *mutex );
566 585
567 void cyg_mutex_lock( cyg_mutex_t *mutex ); 586 cyg_bool_t cyg_mutex_lock( cyg_mutex_t *mutex );
568 587
569 cyg_bool_t cyg_mutex_trylock( cyg_mutex_t *mutex ); 588 cyg_bool_t cyg_mutex_trylock( cyg_mutex_t *mutex );
570 589
571 void cyg_mutex_unlock( cyg_mutex_t *mutex ); 590 void cyg_mutex_unlock( cyg_mutex_t *mutex );
591
592 void cyg_mutex_release( cyg_mutex_t *mutex );
572 593
573 /*---------------------------------------------------------------------------*/ 594 /*---------------------------------------------------------------------------*/
574 /* Condition Variables */ 595 /* Condition Variables */
575 596
576 void cyg_cond_init( 597 void cyg_cond_init(