Mercurial > ecos
annotate packages/kernel/current/include/kapi.h @ 2275:bd5fe26e87c5
* src/strftime.cxx: Fixed "%I" (Time in 12 hour modus was 1 hour off)
| author | jlarmour |
|---|---|
| date | Fri, 25 Aug 2006 00:12:41 +0000 |
| parents | 57cebf53b527 |
| children | 74dbf4c3f2e1 |
| 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 //========================================================================== | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
11 //####ECOSGPLCOPYRIGHTBEGIN#### |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
12 // ------------------------------------------- |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
13 // This file is part of eCos, the Embedded Configurable Operating System. |
|
263
c0d53837cb68
Allow configurations which have the kernel but not the memalloc
bartv
parents:
215
diff
changeset
|
14 // Copyright (C) 2002 Bart Veer |
| 460 | 15 // Copyright (C) 2002 Nick Garnett |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
16 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
17 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
18 // eCos is free software; you can redistribute it and/or modify it under |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
19 // the terms of the GNU General Public License as published by the Free |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
20 // Software Foundation; either version 2 or (at your option) any later version. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
21 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
22 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
23 // WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
24 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
25 // for more details. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
26 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
27 // You should have received a copy of the GNU General Public License along |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
28 // with eCos; if not, write to the Free Software Foundation, Inc., |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
29 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
30 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
31 // As a special exception, if other files instantiate templates or use macros |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
32 // or inline functions from this file, or you compile this file and link it |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
33 // with other works to produce a work based on this file, this file does not |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
34 // by itself cause the resulting work to be covered by the GNU General Public |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
35 // License. However the source code for this file must still be made available |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
36 // in accordance with section (3) of the GNU General Public License. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
37 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
38 // This exception does not invalidate any other reasons why a work based on |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
39 // this file might be covered by the GNU General Public License. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
40 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
41 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
42 // at http://sources.redhat.com/ecos/ecos-license/ |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
43 // ------------------------------------------- |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
44 //####ECOSGPLCOPYRIGHTEND#### |
| 0 | 45 //========================================================================== |
| 46 //#####DESCRIPTIONBEGIN#### | |
| 47 // | |
| 2 | 48 // Author(s): nickg, dsm |
| 49 // Contributors: nickg | |
| 50 // Date: 1998-03-02 | |
| 51 // Purpose: Native API for Kernel | |
| 52 // Description: This file describes the native API for using the kernel. | |
| 0 | 53 // It is essentially a set of C wrappers for the C++ class |
| 54 // member functions. | |
| 2 | 55 // Usage: #include <cyg/kernel/kapi.h> |
| 0 | 56 // |
| 57 //####DESCRIPTIONEND#### | |
| 58 // | |
| 59 //========================================================================*/ | |
| 60 | |
|
263
c0d53837cb68
Allow configurations which have the kernel but not the memalloc
bartv
parents:
215
diff
changeset
|
61 #include <pkgconf/system.h> |
| 0 | 62 #include <pkgconf/kernel.h> |
| 63 | |
| 64 #ifdef CYGFUN_KERNEL_API_C | |
| 65 #include <cyg/infra/cyg_type.h> | |
| 66 | |
| 67 /*---------------------------------------------------------------------------*/ | |
| 68 | |
| 69 #ifdef __cplusplus | |
| 70 extern "C" { | |
| 71 #endif | |
| 72 | |
| 73 /*---------------------------------------------------------------------------*/ | |
| 74 /* The following are derived types, they may have different */ | |
| 75 /* definitions from these depending on configuration. */ | |
| 76 | |
| 2 | 77 typedef CYG_ADDRWORD cyg_addrword_t; /* May hold pointer or word */ |
| 78 typedef cyg_addrword_t cyg_handle_t; /* Object handle */ | |
| 79 typedef cyg_uint32 cyg_priority_t; /* type for priorities */ | |
| 80 typedef cyg_int32 cyg_code_t; /* type for various codes */ | |
| 81 typedef cyg_uint32 cyg_vector_t; /* Interrupt vector id */ | |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
82 typedef cyg_uint32 cyg_cpu_t; /* CPU id type */ |
| 0 | 83 |
| 2 | 84 typedef cyg_uint64 cyg_tick_count_t; |
| 0 | 85 |
| 86 typedef int cyg_bool_t; | |
| 87 | |
| 88 /* Exception handler function definition */ | |
| 89 typedef void cyg_exception_handler_t( | |
| 90 cyg_addrword_t data, | |
| 91 cyg_code_t exception_number, | |
| 92 cyg_addrword_t info | |
| 93 ); | |
| 94 | |
| 95 /*---------------------------------------------------------------------------*/ | |
| 96 struct cyg_thread; | |
| 97 typedef struct cyg_thread cyg_thread; | |
| 98 | |
| 99 struct cyg_interrupt; | |
| 100 typedef struct cyg_interrupt cyg_interrupt; | |
| 101 | |
| 102 struct cyg_counter; | |
| 103 typedef struct cyg_counter cyg_counter; | |
| 104 | |
| 105 struct cyg_clock; | |
| 106 typedef struct cyg_clock cyg_clock; | |
| 107 | |
| 108 struct cyg_alarm; | |
| 109 typedef struct cyg_alarm cyg_alarm; | |
| 110 | |
| 111 struct cyg_mbox; | |
| 112 typedef struct cyg_mbox cyg_mbox; | |
| 113 | |
| 114 struct cyg_sem_t; | |
| 115 typedef struct cyg_sem_t cyg_sem_t; | |
| 116 | |
| 117 struct cyg_flag_t; | |
| 118 typedef struct cyg_flag_t cyg_flag_t; | |
| 119 | |
| 120 struct cyg_mutex_t; | |
| 121 typedef struct cyg_mutex_t cyg_mutex_t; | |
| 122 | |
| 123 struct cyg_cond_t; | |
| 124 typedef struct cyg_cond_t cyg_cond_t; | |
| 125 | |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
126 struct cyg_spinlock_t; |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
127 typedef struct cyg_spinlock_t cyg_spinlock_t; |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
128 |
| 0 | 129 /*---------------------------------------------------------------------------*/ |
| 130 /* Scheduler operations */ | |
| 131 | |
| 132 /* Starts scheduler with created threads. Never returns. */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
133 void cyg_scheduler_start(void) __THROW CYGBLD_ATTRIB_NORET; |
| 0 | 134 |
| 135 /* Lock and unlock the scheduler. When the scheduler is */ | |
| 136 /* locked thread preemption is disabled. */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
137 void cyg_scheduler_lock(void) __THROW; |
| 0 | 138 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
139 void cyg_scheduler_unlock(void) __THROW; |
|
84
489eb5632bc3
Merge from eCos master repository on 2000-04-28-18:44:39-BST
jlarmour
parents:
66
diff
changeset
|
140 |
|
489eb5632bc3
Merge from eCos master repository on 2000-04-28-18:44:39-BST
jlarmour
parents:
66
diff
changeset
|
141 /* 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
|
142 /* 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
|
143 /* subsequent call to 'cyg_scheduler_unlock()' will completely unlock. */ |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
144 void cyg_scheduler_safe_lock(void) __THROW; |
| 0 | 145 |
|
105
5a0cc6c243a9
Merge from eCos master repository on 2000-06-30-08:18:49-BST
jlarmour
parents:
84
diff
changeset
|
146 /* Read the scheduler lock value. */ |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
147 cyg_ucount32 cyg_scheduler_read_lock(void) __THROW; |
|
105
5a0cc6c243a9
Merge from eCos master repository on 2000-06-30-08:18:49-BST
jlarmour
parents:
84
diff
changeset
|
148 |
| 0 | 149 /*---------------------------------------------------------------------------*/ |
| 150 /* Thread operations */ | |
| 151 | |
| 152 typedef void cyg_thread_entry_t(cyg_addrword_t); | |
| 153 | |
| 154 void cyg_thread_create( | |
| 2 | 155 cyg_addrword_t sched_info, /* scheduling info (eg pri) */ |
| 0 | 156 cyg_thread_entry_t *entry, /* entry point function */ |
| 2 | 157 cyg_addrword_t entry_data, /* entry data */ |
| 0 | 158 char *name, /* optional thread name */ |
| 159 void *stack_base, /* stack base, NULL = alloc */ | |
| 160 cyg_ucount32 stack_size, /* stack size, 0 = default */ | |
| 161 cyg_handle_t *handle, /* returned thread handle */ | |
| 162 cyg_thread *thread /* put thread here */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
163 ) __THROW; |
| 0 | 164 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
165 void cyg_thread_exit(void) __THROW; |
| 0 | 166 |
|
8
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
2
diff
changeset
|
167 /* It may be necessary to arrange for the victim to run for it to disappear */ |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
168 cyg_bool_t cyg_thread_delete(cyg_handle_t thread) __THROW; /* false if NOT deleted */ |
| 0 | 169 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
170 void cyg_thread_suspend(cyg_handle_t thread) __THROW; |
| 0 | 171 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
172 void cyg_thread_resume(cyg_handle_t thread) __THROW; |
| 0 | 173 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
174 void cyg_thread_kill(cyg_handle_t thread) __THROW; |
| 0 | 175 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
176 void cyg_thread_release(cyg_handle_t thread) __THROW; |
| 0 | 177 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
178 void cyg_thread_yield(void) __THROW; |
| 0 | 179 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
180 cyg_handle_t cyg_thread_self(void) __THROW; |
| 0 | 181 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
182 cyg_handle_t cyg_thread_idle_thread(void) __THROW; |
| 0 | 183 |
| 184 /* Priority manipulation */ | |
| 185 | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
186 void cyg_thread_set_priority(cyg_handle_t thread, cyg_priority_t priority ) __THROW; |
| 0 | 187 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
188 cyg_priority_t cyg_thread_get_priority(cyg_handle_t thread) __THROW; |
|
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
189 cyg_priority_t cyg_thread_get_current_priority(cyg_handle_t thread) __THROW; |
| 0 | 190 |
| 191 /* Deadline scheduling control (optional) */ | |
| 192 | |
| 193 void cyg_thread_deadline_wait( | |
| 194 cyg_tick_count_t start_time, /* abs earliest start time */ | |
| 195 cyg_tick_count_t run_time, /* worst case execution time */ | |
| 196 cyg_tick_count_t deadline /* absolute deadline */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
197 ) __THROW; |
| 0 | 198 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
199 void cyg_thread_delay(cyg_tick_count_t delay) __THROW; |
| 0 | 200 |
|
10
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
201 /* Stack information */ |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
202 cyg_addrword_t cyg_thread_get_stack_base(cyg_handle_t thread) __THROW; |
|
10
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
203 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
204 cyg_uint32 cyg_thread_get_stack_size(cyg_handle_t thread) __THROW; |
|
10
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
205 |
|
147
d397fc472bcf
Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents:
115
diff
changeset
|
206 #ifdef CYGFUN_KERNEL_THREADS_STACK_MEASUREMENT |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
207 cyg_uint32 cyg_thread_measure_stack_usage(cyg_handle_t thread) __THROW; |
|
147
d397fc472bcf
Merge from eCos master repository on 2001-01-05-06:43:02-GMT
jlarmour
parents:
115
diff
changeset
|
208 #endif |
|
10
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
209 |
| 0 | 210 /*---------------------------------------------------------------------------*/ |
| 460 | 211 /* Thread enumeration and information */ |
| 212 | |
| 213 typedef struct | |
| 214 { | |
| 215 cyg_handle_t handle; | |
| 216 cyg_uint16 id; | |
| 217 cyg_uint32 state; | |
| 218 char *name; | |
| 219 cyg_priority_t set_pri; | |
| 220 cyg_priority_t cur_pri; | |
| 221 cyg_addrword_t stack_base; | |
| 222 cyg_uint32 stack_size; | |
| 223 cyg_uint32 stack_used; | |
| 224 } cyg_thread_info; | |
| 225 | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
226 cyg_bool_t cyg_thread_get_next( cyg_handle_t *thread, cyg_uint16 *id ) __THROW; |
| 460 | 227 |
| 228 cyg_bool_t cyg_thread_get_info( cyg_handle_t thread, | |
| 229 cyg_uint16 id, | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
230 cyg_thread_info *info ) __THROW; |
| 460 | 231 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
232 cyg_uint16 cyg_thread_get_id( cyg_handle_t thread ) __THROW; |
|
1436
1b465c781382
New API for cyg_thread_get_id() - from Dan Jakubiec
gthomas
parents:
460
diff
changeset
|
233 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
234 cyg_handle_t cyg_thread_find( cyg_uint16 id ) __THROW; |
| 460 | 235 |
| 236 /*---------------------------------------------------------------------------*/ | |
| 2 | 237 /* Per-thread Data */ |
| 238 | |
| 239 #ifdef CYGVAR_KERNEL_THREADS_DATA | |
| 240 | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
241 cyg_ucount32 cyg_thread_new_data_index(void) __THROW; |
| 2 | 242 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
243 void cyg_thread_free_data_index(cyg_ucount32 index) __THROW; |
| 2 | 244 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
245 CYG_ADDRWORD cyg_thread_get_data(cyg_ucount32 index) __THROW; |
| 2 | 246 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
247 CYG_ADDRWORD *cyg_thread_get_data_ptr(cyg_ucount32 index) __THROW; |
| 2 | 248 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
249 void cyg_thread_set_data(cyg_ucount32 index, CYG_ADDRWORD data) __THROW; |
| 2 | 250 |
| 251 #endif | |
| 252 | |
| 253 /*---------------------------------------------------------------------------*/ | |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
254 /* Thread destructors */ |
|
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
255 |
|
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
256 #ifdef CYGPKG_KERNEL_THREADS_DESTRUCTORS |
|
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
257 |
|
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
258 typedef void (*cyg_thread_destructor_fn)(cyg_addrword_t); |
|
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
259 |
|
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
260 cyg_bool_t cyg_thread_add_destructor( cyg_thread_destructor_fn fn, |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
261 cyg_addrword_t data ) __THROW; |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
262 cyg_bool_t cyg_thread_rem_destructor( cyg_thread_destructor_fn fn, |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
263 cyg_addrword_t data ) __THROW; |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
264 #endif |
|
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
265 |
|
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
266 /*---------------------------------------------------------------------------*/ |
| 0 | 267 /* Exception handling. */ |
| 268 | |
| 269 /* Replace current exception handler, this may apply to either the */ | |
| 270 /* current thread, or to a global exception handler. The exception */ | |
| 271 /* number may be ignored, or used to specify a particular handler. */ | |
| 272 | |
| 273 void cyg_exception_set_handler( | |
| 274 cyg_code_t exception_number, | |
| 275 cyg_exception_handler_t *new_handler, | |
| 276 cyg_addrword_t new_data, | |
| 277 cyg_exception_handler_t **old_handler, | |
| 278 cyg_addrword_t *old_data | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
279 ) __THROW; |
| 0 | 280 |
| 281 /* Clear exception hander to default value */ | |
| 282 void cyg_exception_clear_handler( | |
| 283 cyg_code_t exception_number | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
284 ) __THROW; |
| 0 | 285 |
| 286 /* Invoke exception handler */ | |
| 287 void cyg_exception_call_handler( | |
| 288 cyg_handle_t thread, | |
| 289 cyg_code_t exception_number, | |
| 2 | 290 cyg_addrword_t exception_info |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
291 ) __THROW; |
| 0 | 292 |
| 293 | |
| 294 /*---------------------------------------------------------------------------*/ | |
| 295 /* Interrupt handling */ | |
| 296 typedef void cyg_VSR_t(void); | |
| 297 typedef cyg_uint32 cyg_ISR_t(cyg_vector_t vector, cyg_addrword_t data); | |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
298 typedef void cyg_DSR_t( cyg_vector_t vector, |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
299 cyg_ucount32 count, |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
300 cyg_addrword_t data); |
| 0 | 301 |
| 302 | |
| 303 enum cyg_ISR_results | |
| 304 { | |
| 305 CYG_ISR_HANDLED = 1, /* Interrupt was handled */ | |
| 306 CYG_ISR_CALL_DSR = 2 /* Schedule DSR */ | |
| 307 }; | |
| 308 | |
| 309 void cyg_interrupt_create( | |
| 310 cyg_vector_t vector, /* Vector to attach to */ | |
| 311 cyg_priority_t priority, /* Queue priority */ | |
| 2 | 312 cyg_addrword_t data, /* Data pointer */ |
| 0 | 313 cyg_ISR_t *isr, /* Interrupt Service Routine */ |
| 314 cyg_DSR_t *dsr, /* Deferred Service Routine */ | |
| 315 cyg_handle_t *handle, /* returned handle */ | |
| 316 cyg_interrupt *intr /* put interrupt here */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
317 ) __THROW; |
| 0 | 318 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
319 void cyg_interrupt_delete( cyg_handle_t interrupt ) __THROW; |
| 0 | 320 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
321 void cyg_interrupt_attach( cyg_handle_t interrupt ) __THROW; |
| 0 | 322 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
323 void cyg_interrupt_detach( cyg_handle_t interrupt ) __THROW; |
| 0 | 324 |
| 325 /* VSR manipulation */ | |
| 326 | |
| 327 void cyg_interrupt_get_vsr( | |
| 328 cyg_vector_t vector, /* vector to get */ | |
| 329 cyg_VSR_t **vsr /* vsr got */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
330 ) __THROW; |
| 0 | 331 |
| 332 void cyg_interrupt_set_vsr( | |
| 333 cyg_vector_t vector, /* vector to set */ | |
| 334 cyg_VSR_t *vsr /* vsr to set */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
335 ) __THROW; |
| 0 | 336 |
| 337 /* CPU level interrupt mask */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
338 void cyg_interrupt_disable(void) __THROW; |
| 0 | 339 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
340 void cyg_interrupt_enable(void) __THROW; |
| 0 | 341 |
| 342 /* Interrupt controller access */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
343 void cyg_interrupt_mask(cyg_vector_t vector) __THROW; |
|
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
344 void cyg_interrupt_mask_intunsafe(cyg_vector_t vector) __THROW; |
| 0 | 345 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
346 void cyg_interrupt_unmask(cyg_vector_t vector) __THROW; |
|
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
347 void cyg_interrupt_unmask_intunsafe(cyg_vector_t vector) __THROW; |
| 0 | 348 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
349 void cyg_interrupt_acknowledge(cyg_vector_t vector) __THROW; |
| 0 | 350 |
| 351 void cyg_interrupt_configure( | |
| 352 cyg_vector_t vector, /* vector to configure */ | |
| 353 cyg_bool_t level, /* level or edge triggered */ | |
| 354 cyg_bool_t up /* rising/faling edge, high/low level*/ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
355 ) __THROW; |
| 0 | 356 |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
357 void cyg_interrupt_set_cpu( |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
358 cyg_vector_t vector, /* vector to control */ |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
359 cyg_cpu_t cpu /* CPU to set */ |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
360 ) __THROW; |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
361 |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
362 cyg_cpu_t cyg_interrupt_get_cpu( |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
363 cyg_vector_t vector /* vector to control */ |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
364 ) __THROW; |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
365 |
| 0 | 366 /*---------------------------------------------------------------------------*/ |
| 367 /* Counters, Clocks and Alarms */ | |
| 368 | |
| 369 void cyg_counter_create( | |
| 370 cyg_handle_t *handle, /* returned counter handle */ | |
| 371 cyg_counter *counter /* put counter here */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
372 ) __THROW; |
| 0 | 373 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
374 void cyg_counter_delete(cyg_handle_t counter) __THROW; |
| 0 | 375 |
| 376 /* Return current value of counter */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
377 cyg_tick_count_t cyg_counter_current_value(cyg_handle_t counter) __THROW; |
| 0 | 378 |
| 379 /* Set new current value */ | |
| 380 void cyg_counter_set_value( | |
| 381 cyg_handle_t counter, | |
| 382 cyg_tick_count_t new_value | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
383 ) __THROW; |
| 0 | 384 |
| 385 /* Advance counter by one tick */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
386 void cyg_counter_tick(cyg_handle_t counter) __THROW; |
| 0 | 387 |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
388 /* Advance counter by multiple ticks */ |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
389 void cyg_counter_multi_tick(cyg_handle_t counter, cyg_tick_count_t _ticks) __THROW; |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
390 |
| 0 | 391 |
|
181
d61da071934c
Merge from eCos master repository on 2001-08-22-06:38:55-BST
jlarmour
parents:
179
diff
changeset
|
392 #define CYG_RESOLUTION_T_MEMBERS \ |
|
d61da071934c
Merge from eCos master repository on 2001-08-22-06:38:55-BST
jlarmour
parents:
179
diff
changeset
|
393 cyg_uint32 dividend; \ |
|
d61da071934c
Merge from eCos master repository on 2001-08-22-06:38:55-BST
jlarmour
parents:
179
diff
changeset
|
394 cyg_uint32 divisor; |
|
d61da071934c
Merge from eCos master repository on 2001-08-22-06:38:55-BST
jlarmour
parents:
179
diff
changeset
|
395 |
| 0 | 396 typedef struct |
| 397 { | |
|
181
d61da071934c
Merge from eCos master repository on 2001-08-22-06:38:55-BST
jlarmour
parents:
179
diff
changeset
|
398 CYG_RESOLUTION_T_MEMBERS |
| 0 | 399 } cyg_resolution_t; |
| 400 | |
| 401 /* Create a clock object */ | |
| 402 void cyg_clock_create( | |
| 403 cyg_resolution_t resolution, /* Initial resolution */ | |
| 404 cyg_handle_t *handle, /* Returned clock handle */ | |
| 405 cyg_clock *clock /* put clock here */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
406 ) __THROW; |
| 0 | 407 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
408 void cyg_clock_delete(cyg_handle_t clock) __THROW; |
| 0 | 409 |
| 410 /* convert a clock handle to a counter handle so we can use the */ | |
| 411 /* counter API on it. */ | |
| 412 void cyg_clock_to_counter( | |
| 413 cyg_handle_t clock, | |
| 414 cyg_handle_t *counter | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
415 ) __THROW; |
| 0 | 416 |
| 417 void cyg_clock_set_resolution( | |
| 418 cyg_handle_t clock, | |
| 419 cyg_resolution_t resolution /* New resolution */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
420 ) __THROW; |
| 0 | 421 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
422 cyg_resolution_t cyg_clock_get_resolution(cyg_handle_t clock) __THROW; |
| 0 | 423 |
| 424 /* handle of real time clock */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
425 cyg_handle_t cyg_real_time_clock(void) __THROW; |
| 0 | 426 |
| 427 /* returns value of real time clock's counter. | |
| 428 This is the same as: | |
| 429 (cyg_clock_to_counter(cyg_real_time_clock(), &h), | |
| 430 cyg_counter_current_value(h)) */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
431 cyg_tick_count_t cyg_current_time(void) __THROW; |
| 0 | 432 |
| 433 /* Alarm handler function */ | |
| 434 typedef void cyg_alarm_t(cyg_handle_t alarm, cyg_addrword_t data); | |
| 435 | |
| 436 void cyg_alarm_create( | |
| 437 cyg_handle_t counter, /* Attached to this counter */ | |
| 438 cyg_alarm_t *alarmfn, /* Call-back function */ | |
| 2 | 439 cyg_addrword_t data, /* Call-back data */ |
| 0 | 440 cyg_handle_t *handle, /* Returned alarm object */ |
| 441 cyg_alarm *alarm /* put alarm here */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
442 ) __THROW; |
| 0 | 443 |
| 444 /* Disable alarm, detach from counter and invalidate handles */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
445 void cyg_alarm_delete( cyg_handle_t alarm) __THROW; |
| 0 | 446 |
| 447 void cyg_alarm_initialize( | |
| 448 cyg_handle_t alarm, | |
| 449 cyg_tick_count_t trigger, /* Absolute trigger time */ | |
| 450 cyg_tick_count_t interval /* Relative retrigger interval */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
451 ) __THROW; |
| 0 | 452 |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
453 void cyg_alarm_get_times( |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
454 cyg_handle_t alarm, |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
455 cyg_tick_count_t *trigger, /* Next trigger time */ |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
456 cyg_tick_count_t *interval /* Current interval */ |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
457 ) __THROW; |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
181
diff
changeset
|
458 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
459 void cyg_alarm_enable( cyg_handle_t alarm ) __THROW; |
| 0 | 460 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
461 void cyg_alarm_disable( cyg_handle_t alarm ) __THROW; |
| 0 | 462 |
| 463 /*---------------------------------------------------------------------------*/ | |
| 464 /* Mail boxes */ | |
| 465 void cyg_mbox_create( | |
| 466 cyg_handle_t *handle, | |
| 467 cyg_mbox *mbox | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
468 ) __THROW; |
| 0 | 469 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
470 void cyg_mbox_delete(cyg_handle_t mbox) __THROW; |
| 0 | 471 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
472 void *cyg_mbox_get(cyg_handle_t mbox) __THROW; |
| 0 | 473 |
| 474 #ifdef CYGFUN_KERNEL_THREADS_TIMER | |
| 475 void *cyg_mbox_timed_get( | |
| 476 cyg_handle_t mbox, | |
| 477 cyg_tick_count_t abstime | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
478 ) __THROW; |
| 0 | 479 #endif |
| 480 | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
481 void *cyg_mbox_tryget(cyg_handle_t mbox) __THROW; |
| 0 | 482 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
483 void *cyg_mbox_peek_item(cyg_handle_t mbox) __THROW; |
| 0 | 484 |
| 485 #ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
486 cyg_bool_t cyg_mbox_put(cyg_handle_t mbox, void *item) __THROW; |
| 0 | 487 #ifdef CYGFUN_KERNEL_THREADS_TIMER |
| 488 cyg_bool_t cyg_mbox_timed_put( | |
| 489 cyg_handle_t mbox, | |
| 490 void *item, | |
| 491 cyg_tick_count_t abstime | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
492 ) __THROW; |
| 0 | 493 #endif |
| 494 #endif | |
| 495 | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
496 cyg_bool_t cyg_mbox_tryput(cyg_handle_t mbox, void *item) __THROW; |
| 0 | 497 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
498 cyg_count32 cyg_mbox_peek(cyg_handle_t mbox) __THROW; |
| 0 | 499 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
500 cyg_bool_t cyg_mbox_waiting_to_get(cyg_handle_t mbox) __THROW; |
| 0 | 501 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
502 cyg_bool_t cyg_mbox_waiting_to_put(cyg_handle_t mbox) __THROW; |
| 0 | 503 |
| 504 | |
| 505 /*-----------------------------------------------------------------------*/ | |
| 506 /* Memory pools */ | |
| 507 | |
|
115
6ed91473a1cd
Merge from eCos master repository on 2000-08-21-22:40:54-BST
jlarmour
parents:
105
diff
changeset
|
508 /* 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
|
509 /* where the implementation lives. */ |
| 0 | 510 |
|
263
c0d53837cb68
Allow configurations which have the kernel but not the memalloc
bartv
parents:
215
diff
changeset
|
511 #ifdef CYGPKG_MEMALLOC |
|
c0d53837cb68
Allow configurations which have the kernel but not the memalloc
bartv
parents:
215
diff
changeset
|
512 # include <cyg/memalloc/kapi.h> |
|
c0d53837cb68
Allow configurations which have the kernel but not the memalloc
bartv
parents:
215
diff
changeset
|
513 #endif |
| 0 | 514 |
| 515 /*---------------------------------------------------------------------------*/ | |
| 516 /* Semaphores */ | |
| 517 | |
| 518 void cyg_semaphore_init( | |
| 519 cyg_sem_t *sem, /* Semaphore to init */ | |
| 2 | 520 cyg_count32 val /* Initial semaphore value */ |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
521 ) __THROW; |
| 0 | 522 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
523 void cyg_semaphore_destroy( cyg_sem_t *sem ) __THROW; |
| 0 | 524 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
525 cyg_bool_t cyg_semaphore_wait( cyg_sem_t *sem ) __THROW; |
| 0 | 526 |
| 527 #ifdef CYGFUN_KERNEL_THREADS_TIMER | |
| 528 cyg_bool_t cyg_semaphore_timed_wait( | |
| 529 cyg_sem_t *sem, | |
| 530 cyg_tick_count_t abstime | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
531 ) __THROW; |
| 0 | 532 #endif |
| 533 | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
534 cyg_bool_t cyg_semaphore_trywait( cyg_sem_t *sem ) __THROW; |
| 0 | 535 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
536 void cyg_semaphore_post( cyg_sem_t *sem ) __THROW; |
| 0 | 537 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
538 void cyg_semaphore_peek( cyg_sem_t *sem, cyg_count32 *val ) __THROW; |
| 0 | 539 |
| 540 /*---------------------------------------------------------------------------*/ | |
| 541 /* Flags */ | |
| 542 | |
| 543 typedef cyg_uint32 cyg_flag_value_t; | |
| 544 typedef cyg_uint8 cyg_flag_mode_t; | |
| 545 #define CYG_FLAG_WAITMODE_AND ((cyg_flag_mode_t)0) /* all bits must be set */ | |
| 546 #define CYG_FLAG_WAITMODE_OR ((cyg_flag_mode_t)2) /* any bit must be set */ | |
| 547 #define CYG_FLAG_WAITMODE_CLR ((cyg_flag_mode_t)1) /* clear when satisfied */ | |
| 548 | |
| 549 void cyg_flag_init( | |
| 550 cyg_flag_t *flag /* Flag to init */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
551 ) __THROW; |
| 0 | 552 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
553 void cyg_flag_destroy( cyg_flag_t *flag ) __THROW; |
| 0 | 554 |
| 555 /* bitwise-or in the bits in value; awaken any waiting tasks whose | |
| 556 condition is now satisfied */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
557 void cyg_flag_setbits( cyg_flag_t *flag, cyg_flag_value_t value) __THROW; |
| 0 | 558 |
| 559 /* bitwise-and with the the bits in value; this clears the bits which | |
| 560 are not set in value. No waiting task can be awoken. */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
561 void cyg_flag_maskbits( cyg_flag_t *flag, cyg_flag_value_t value) __THROW; |
| 0 | 562 |
| 563 /* wait for the flag value to match the pattern, according to the mode. | |
| 564 If mode includes CLR, set the flag value to zero when | |
| 565 our pattern is matched. The return value is that which matched | |
| 566 the request, or zero for an error/timeout return. | |
| 567 Value must not itself be zero. */ | |
| 568 cyg_flag_value_t cyg_flag_wait( cyg_flag_t *flag, | |
| 569 cyg_flag_value_t pattern, | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
570 cyg_flag_mode_t mode ) __THROW; |
| 0 | 571 |
| 572 #ifdef CYGFUN_KERNEL_THREADS_TIMER | |
| 573 cyg_flag_value_t cyg_flag_timed_wait( cyg_flag_t *flag, | |
| 574 cyg_flag_value_t pattern, | |
| 575 cyg_flag_mode_t mode, | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
576 cyg_tick_count_t abstime ) __THROW; |
| 0 | 577 |
| 578 #endif | |
| 579 | |
| 580 cyg_flag_value_t cyg_flag_poll( cyg_flag_t *flag, | |
| 581 cyg_flag_value_t pattern, | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
582 cyg_flag_mode_t mode ) __THROW; |
| 0 | 583 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
584 cyg_flag_value_t cyg_flag_peek( cyg_flag_t *flag ) __THROW; |
| 0 | 585 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
586 cyg_bool_t cyg_flag_waiting( cyg_flag_t *flag ) __THROW; |
| 0 | 587 |
| 588 /*---------------------------------------------------------------------------*/ | |
| 589 /* Mutex */ | |
| 590 | |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
591 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC |
|
179
391299f9e541
Merge from eCos master repository on 2001-08-17-16:31:54-BST
jlarmour
parents:
177
diff
changeset
|
592 enum cyg_mutex_protocol |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
593 { |
|
179
391299f9e541
Merge from eCos master repository on 2001-08-17-16:31:54-BST
jlarmour
parents:
177
diff
changeset
|
594 CYG_MUTEX_NONE = 0, // no inversion protocol |
|
391299f9e541
Merge from eCos master repository on 2001-08-17-16:31:54-BST
jlarmour
parents:
177
diff
changeset
|
595 CYG_MUTEX_INHERIT, // priority inheritance protocol |
|
391299f9e541
Merge from eCos master repository on 2001-08-17-16:31:54-BST
jlarmour
parents:
177
diff
changeset
|
596 CYG_MUTEX_CEILING // priority ceiling protocol |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
597 }; |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
598 #endif |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
599 |
| 0 | 600 void cyg_mutex_init( |
| 601 cyg_mutex_t *mutex /* Mutex to init */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
602 ) __THROW; |
| 0 | 603 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
604 void cyg_mutex_destroy( cyg_mutex_t *mutex ) __THROW; |
| 0 | 605 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
606 cyg_bool_t cyg_mutex_lock( cyg_mutex_t *mutex ) __THROW; |
| 0 | 607 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
608 cyg_bool_t cyg_mutex_trylock( cyg_mutex_t *mutex ) __THROW; |
| 0 | 609 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
610 void cyg_mutex_unlock( cyg_mutex_t *mutex ) __THROW; |
| 0 | 611 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
612 void cyg_mutex_release( cyg_mutex_t *mutex ) __THROW; |
| 2 | 613 |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
614 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
615 void cyg_mutex_set_ceiling( cyg_mutex_t *mutex, cyg_priority_t priority ) __THROW; |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
616 #endif |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
617 |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
618 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
619 void cyg_mutex_set_protocol ( cyg_mutex_t *mutex, enum cyg_mutex_protocol protocol ) __THROW; |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
620 #endif |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
621 |
| 0 | 622 /*---------------------------------------------------------------------------*/ |
| 623 /* Condition Variables */ | |
| 624 | |
| 625 void cyg_cond_init( | |
| 626 cyg_cond_t *cond, /* condition variable to init */ | |
| 627 cyg_mutex_t *mutex /* associated mutex */ | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
628 ) __THROW; |
| 0 | 629 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
630 void cyg_cond_destroy( cyg_cond_t *cond ) __THROW; |
| 0 | 631 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
632 cyg_bool_t cyg_cond_wait( cyg_cond_t *cond ) __THROW; |
| 0 | 633 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
634 void cyg_cond_signal( cyg_cond_t *cond ) __THROW; |
| 0 | 635 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
636 void cyg_cond_broadcast( cyg_cond_t *cond ) __THROW; |
| 0 | 637 |
| 638 #ifdef CYGMFN_KERNEL_SYNCH_CONDVAR_TIMED_WAIT | |
| 639 cyg_bool_t cyg_cond_timed_wait( | |
| 640 cyg_cond_t *cond, | |
| 641 cyg_tick_count_t abstime | |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
642 ) __THROW; |
| 0 | 643 #endif |
| 644 | |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
645 /*---------------------------------------------------------------------------*/ |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
646 /* Spinlocks */ |
| 0 | 647 |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
648 void cyg_spinlock_init( |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
649 cyg_spinlock_t *lock, /* spinlock to initialize */ |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
650 cyg_bool_t locked /* init locked or unlocked */ |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
651 ) __THROW; |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
652 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
653 void cyg_spinlock_destroy( cyg_spinlock_t *lock ) __THROW; |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
654 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
655 void cyg_spinlock_spin( cyg_spinlock_t *lock ) __THROW; |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
656 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
657 void cyg_spinlock_clear( cyg_spinlock_t *lock ) __THROW; |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
658 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
659 cyg_bool_t cyg_spinlock_try( cyg_spinlock_t *lock ) __THROW; |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
660 |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
661 cyg_bool_t cyg_spinlock_test( cyg_spinlock_t *lock ) __THROW; |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
662 |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
663 void cyg_spinlock_spin_intsave( cyg_spinlock_t *lock, |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
664 cyg_addrword_t *istate ) __THROW; |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
665 |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
666 void cyg_spinlock_clear_intsave( cyg_spinlock_t *lock, |
|
1539
57cebf53b527
* include/kapi.h: Add throw specifications throughout.
jlarmour
parents:
1436
diff
changeset
|
667 cyg_addrword_t istate ) __THROW; |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
668 |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
669 /*---------------------------------------------------------------------------*/ |
| 0 | 670 #ifdef __cplusplus |
| 671 } | |
| 672 #endif | |
| 673 | |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
674 /*---------------------------------------------------------------------------*/ |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
147
diff
changeset
|
675 |
| 0 | 676 #include <cyg/kernel/kapidata.h> |
| 677 | |
| 678 /*---------------------------------------------------------------------------*/ | |
| 679 /* EOF kapi.h */ | |
| 680 #endif /* CYGFUN_KERNEL_API_C */ | |
| 681 #endif /* CYGONCE_KERNEL_KAPI_H */ |
