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