OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [kernel/] [current/] [include/] [kapi.h] - Blame information for rev 851

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_KERNEL_KAPI_H
2
#define CYGONCE_KERNEL_KAPI_H
3
 
4
/*==========================================================================
5
//
6
//      kapi.h
7
//
8
//      Native API for Kernel
9
//
10
//==========================================================================
11
// ####ECOSGPLCOPYRIGHTBEGIN####
12
// -------------------------------------------
13
// This file is part of eCos, the Embedded Configurable Operating System.
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under
17
// the terms of the GNU General Public License as published by the Free
18
// Software Foundation; either version 2 or (at your option) any later
19
// version.
20
//
21
// eCos is distributed in the hope that it will be useful, but WITHOUT
22
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24
// for more details.
25
//
26
// You should have received a copy of the GNU General Public License
27
// along with eCos; if not, write to the Free Software Foundation, Inc.,
28
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
29
//
30
// As a special exception, if other files instantiate templates or use
31
// macros or inline functions from this file, or you compile this file
32
// and link it with other works to produce a work based on this file,
33
// this file does not by itself cause the resulting work to be covered by
34
// the GNU General Public License. However the source code for this file
35
// must still be made available in accordance with section (3) of the GNU
36
// General Public License v2.
37
//
38
// This exception does not invalidate any other reasons why a work based
39
// on this file might be covered by the GNU General Public License.
40
// -------------------------------------------
41
// ####ECOSGPLCOPYRIGHTEND####
42
//==========================================================================
43
//#####DESCRIPTIONBEGIN####
44
//
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.
50
//              It is essentially a set of C wrappers for the C++ class
51
//              member functions.
52
// Usage:       #include <cyg/kernel/kapi.h>
53
//
54
//####DESCRIPTIONEND####
55
//
56
//========================================================================*/
57
 
58
#include <pkgconf/system.h>
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
 
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           */
79
typedef cyg_uint32     cyg_cpu_t;           /* CPU id type                   */
80
 
81
typedef cyg_uint64 cyg_tick_count_t;
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
 
123
struct cyg_spinlock_t;
124
typedef struct cyg_spinlock_t cyg_spinlock_t;
125
 
126
/*---------------------------------------------------------------------------*/
127
/* Scheduler operations */
128
 
129
/* Starts scheduler with created threads.  Never returns. */
130
void cyg_scheduler_start(void) __THROW CYGBLD_ATTRIB_NORET;
131
 
132
/* Lock and unlock the scheduler. When the scheduler is   */
133
/* locked thread preemption is disabled.                  */
134
void cyg_scheduler_lock(void) __THROW;
135
 
136
void cyg_scheduler_unlock(void) __THROW;
137
 
138
/* Just like 'cyg_scheduler_lock()', but never take the lock higher than 1  */
139
/* Thus this call is safe even if the scheduler is already locked and a     */
140
/* subsequent call to 'cyg_scheduler_unlock()' will completely unlock.      */
141
void cyg_scheduler_safe_lock(void) __THROW;
142
 
143
/* Read the scheduler lock value. */
144
cyg_ucount32 cyg_scheduler_read_lock(void) __THROW;
145
 
146
/*---------------------------------------------------------------------------*/
147
/* Thread operations */
148
 
149
typedef void cyg_thread_entry_t(cyg_addrword_t);
150
 
151
void cyg_thread_create(
152
    cyg_addrword_t      sched_info,             /* scheduling info (eg pri)  */
153
    cyg_thread_entry_t  *entry,                 /* entry point function      */
154
    cyg_addrword_t      entry_data,             /* entry data                */
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           */
160
) __THROW;
161
 
162
void cyg_thread_exit(void) __THROW;
163
 
164
/* It may be necessary to arrange for the victim to run for it to disappear */
165
cyg_bool_t cyg_thread_delete(cyg_handle_t thread) __THROW; /* false if NOT deleted */
166
 
167
void cyg_thread_suspend(cyg_handle_t thread) __THROW;
168
 
169
void cyg_thread_resume(cyg_handle_t thread) __THROW;
170
 
171
void cyg_thread_kill(cyg_handle_t thread) __THROW;
172
 
173
void cyg_thread_release(cyg_handle_t thread) __THROW;
174
 
175
void cyg_thread_yield(void) __THROW;
176
 
177
cyg_handle_t cyg_thread_self(void) __THROW;
178
 
179
cyg_handle_t cyg_thread_idle_thread(void) __THROW;
180
 
181
/* Priority manipulation */
182
 
183
void cyg_thread_set_priority(cyg_handle_t thread, cyg_priority_t priority ) __THROW;
184
 
185
cyg_priority_t cyg_thread_get_priority(cyg_handle_t thread) __THROW;
186
cyg_priority_t cyg_thread_get_current_priority(cyg_handle_t thread) __THROW;
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         */
194
) __THROW;
195
 
196
void cyg_thread_delay(cyg_tick_count_t delay) __THROW;
197
 
198
/* Stack information */
199
cyg_addrword_t cyg_thread_get_stack_base(cyg_handle_t thread) __THROW;
200
 
201
cyg_uint32 cyg_thread_get_stack_size(cyg_handle_t thread) __THROW;
202
 
203
#ifdef CYGFUN_KERNEL_THREADS_STACK_MEASUREMENT
204
cyg_uint32 cyg_thread_measure_stack_usage(cyg_handle_t thread) __THROW;
205
#endif
206
 
207
/*---------------------------------------------------------------------------*/
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
 
223
cyg_bool_t cyg_thread_get_next( cyg_handle_t *thread, cyg_uint16 *id ) __THROW;
224
 
225
cyg_bool_t cyg_thread_get_info( cyg_handle_t thread,
226
                                cyg_uint16 id,
227
                                cyg_thread_info *info ) __THROW;
228
 
229
cyg_uint16 cyg_thread_get_id( cyg_handle_t thread ) __THROW;
230
 
231
cyg_handle_t cyg_thread_find( cyg_uint16 id ) __THROW;
232
 
233
/*---------------------------------------------------------------------------*/
234
/* Per-thread Data                                                           */
235
 
236
#ifdef CYGVAR_KERNEL_THREADS_DATA
237
 
238
cyg_ucount32 cyg_thread_new_data_index(void) __THROW;
239
 
240
void cyg_thread_free_data_index(cyg_ucount32 index) __THROW;
241
 
242
CYG_ADDRWORD cyg_thread_get_data(cyg_ucount32 index) __THROW;
243
 
244
CYG_ADDRWORD *cyg_thread_get_data_ptr(cyg_ucount32 index) __THROW;
245
 
246
void cyg_thread_set_data(cyg_ucount32 index, CYG_ADDRWORD data) __THROW;
247
 
248
#endif
249
 
250
/*---------------------------------------------------------------------------*/
251
/* Thread destructors                                                        */
252
 
253
#ifdef CYGPKG_KERNEL_THREADS_DESTRUCTORS
254
 
255
typedef void (*cyg_thread_destructor_fn)(cyg_addrword_t);
256
 
257
cyg_bool_t cyg_thread_add_destructor( cyg_thread_destructor_fn fn,
258
                                      cyg_addrword_t data ) __THROW;
259
cyg_bool_t cyg_thread_rem_destructor( cyg_thread_destructor_fn fn,
260
                                      cyg_addrword_t data ) __THROW;
261
#endif
262
 
263
/*---------------------------------------------------------------------------*/
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
276
) __THROW;
277
 
278
/* Clear exception hander to default value                                   */
279
void cyg_exception_clear_handler(
280
    cyg_code_t                  exception_number
281
) __THROW;
282
 
283
/* Invoke exception handler                                                  */
284
void cyg_exception_call_handler(
285
    cyg_handle_t                thread,
286
    cyg_code_t                  exception_number,
287
    cyg_addrword_t              exception_info
288
) __THROW;
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);
295
typedef void            cyg_DSR_t( cyg_vector_t vector,
296
                                   cyg_ucount32 count,
297
                                   cyg_addrword_t data);
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                    */
309
    cyg_addrword_t      data,           /* Data pointer                      */
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                */
314
) __THROW;
315
 
316
void cyg_interrupt_delete( cyg_handle_t interrupt ) __THROW;
317
 
318
void cyg_interrupt_attach( cyg_handle_t interrupt ) __THROW;
319
 
320
void cyg_interrupt_detach( cyg_handle_t interrupt ) __THROW;
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                           */
327
) __THROW;
328
 
329
void cyg_interrupt_set_vsr(
330
    cyg_vector_t        vector,         /* vector to set                     */
331
    cyg_VSR_t           *vsr            /* vsr to set                        */
332
) __THROW;
333
 
334
/* CPU level interrupt mask                                                  */
335
void cyg_interrupt_disable(void) __THROW;
336
 
337
void cyg_interrupt_enable(void) __THROW;
338
 
339
/* Interrupt controller access                                               */
340
void cyg_interrupt_mask(cyg_vector_t vector) __THROW;
341
void cyg_interrupt_mask_intunsafe(cyg_vector_t vector) __THROW;
342
 
343
void cyg_interrupt_unmask(cyg_vector_t vector) __THROW;
344
void cyg_interrupt_unmask_intunsafe(cyg_vector_t vector) __THROW;
345
 
346
void cyg_interrupt_acknowledge(cyg_vector_t vector) __THROW;
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*/
352
) __THROW;
353
 
354
void cyg_interrupt_set_cpu(
355
    cyg_vector_t        vector,         /* vector to control                 */
356
    cyg_cpu_t           cpu             /* CPU to set                        */
357
) __THROW;
358
 
359
cyg_cpu_t cyg_interrupt_get_cpu(
360
    cyg_vector_t        vector          /* vector to control                 */
361
) __THROW;
362
 
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                  */
369
) __THROW;
370
 
371
void cyg_counter_delete(cyg_handle_t counter) __THROW;
372
 
373
/* Return current value of counter                                           */
374
cyg_tick_count_t cyg_counter_current_value(cyg_handle_t counter) __THROW;
375
 
376
/* Set new current value                                                     */
377
void cyg_counter_set_value(
378
    cyg_handle_t        counter,
379
    cyg_tick_count_t new_value
380
) __THROW;
381
 
382
/* Advance counter by one tick                                               */
383
void cyg_counter_tick(cyg_handle_t counter) __THROW;
384
 
385
/* Advance counter by multiple ticks                                         */
386
void cyg_counter_multi_tick(cyg_handle_t counter, cyg_tick_count_t _ticks) __THROW;
387
 
388
 
389
#define CYG_RESOLUTION_T_MEMBERS  \
390
    cyg_uint32  dividend;         \
391
    cyg_uint32  divisor;
392
 
393
typedef struct
394
{
395
    CYG_RESOLUTION_T_MEMBERS
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                    */
403
) __THROW;
404
 
405
void cyg_clock_delete(cyg_handle_t clock) __THROW;
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
412
) __THROW;
413
 
414
void cyg_clock_set_resolution(
415
    cyg_handle_t        clock,
416
    cyg_resolution_t    resolution      /* New resolution                    */
417
) __THROW;
418
 
419
cyg_resolution_t cyg_clock_get_resolution(cyg_handle_t clock) __THROW;
420
 
421
/* handle of real time clock                                                 */
422
cyg_handle_t cyg_real_time_clock(void) __THROW;
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))                                            */
428
cyg_tick_count_t cyg_current_time(void) __THROW;
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                */
436
    cyg_addrword_t      data,           /* Call-back data                    */
437
    cyg_handle_t        *handle,        /* Returned alarm object             */
438
    cyg_alarm           *alarm          /* put alarm here                    */
439
) __THROW;
440
 
441
/* Disable alarm, detach from counter and invalidate handles                 */
442
void cyg_alarm_delete( cyg_handle_t alarm) __THROW;
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       */
448
) __THROW;
449
 
450
void cyg_alarm_get_times(
451
    cyg_handle_t        alarm,
452
    cyg_tick_count_t    *trigger,       /* Next trigger time                 */
453
    cyg_tick_count_t    *interval       /* Current interval                  */
454
) __THROW;
455
 
456
void cyg_alarm_enable( cyg_handle_t alarm ) __THROW;
457
 
458
void cyg_alarm_disable( cyg_handle_t alarm ) __THROW;
459
 
460
/*---------------------------------------------------------------------------*/
461
/* Mail boxes                                                                */
462
void cyg_mbox_create(
463
    cyg_handle_t        *handle,
464
    cyg_mbox            *mbox
465
) __THROW;
466
 
467
void cyg_mbox_delete(cyg_handle_t mbox) __THROW;
468
 
469
void *cyg_mbox_get(cyg_handle_t mbox) __THROW;
470
 
471
#ifdef CYGFUN_KERNEL_THREADS_TIMER
472
void *cyg_mbox_timed_get(
473
    cyg_handle_t mbox,
474
    cyg_tick_count_t abstime
475
    ) __THROW;
476
#endif
477
 
478
void *cyg_mbox_tryget(cyg_handle_t mbox) __THROW;
479
 
480
void *cyg_mbox_peek_item(cyg_handle_t mbox) __THROW;
481
 
482
#ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT
483
cyg_bool_t cyg_mbox_put(cyg_handle_t mbox, void *item) __THROW;
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
489
    ) __THROW;
490
#endif
491
#endif
492
 
493
cyg_bool_t cyg_mbox_tryput(cyg_handle_t mbox, void *item) __THROW;
494
 
495
cyg_count32 cyg_mbox_peek(cyg_handle_t mbox) __THROW;
496
 
497
cyg_bool_t cyg_mbox_waiting_to_get(cyg_handle_t mbox) __THROW;
498
 
499
cyg_bool_t cyg_mbox_waiting_to_put(cyg_handle_t mbox) __THROW;
500
 
501
 
502
/*-----------------------------------------------------------------------*/
503
/* Memory pools                                                          */
504
 
505
/* These definitions are found in the "memalloc" package as this is      */
506
/* where the implementation lives.                                       */
507
 
508
#ifdef CYGPKG_MEMALLOC
509
# include <cyg/memalloc/kapi.h>
510
#endif
511
 
512
/*---------------------------------------------------------------------------*/
513
/* Semaphores                                                                */
514
 
515
void      cyg_semaphore_init(
516
    cyg_sem_t           *sem,            /* Semaphore to init                */
517
    cyg_count32         val              /* Initial semaphore value          */
518
) __THROW;
519
 
520
void cyg_semaphore_destroy( cyg_sem_t *sem ) __THROW;
521
 
522
cyg_bool_t cyg_semaphore_wait( cyg_sem_t *sem ) __THROW;
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
528
    ) __THROW;
529
#endif
530
 
531
cyg_bool_t cyg_semaphore_trywait( cyg_sem_t *sem ) __THROW;
532
 
533
void cyg_semaphore_post( cyg_sem_t *sem ) __THROW;
534
 
535
void cyg_semaphore_peek( cyg_sem_t *sem, cyg_count32 *val ) __THROW;
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                      */
548
) __THROW;
549
 
550
void cyg_flag_destroy( cyg_flag_t *flag ) __THROW;
551
 
552
/* bitwise-or in the bits in value; awaken any waiting tasks whose
553
   condition is now satisfied */
554
void cyg_flag_setbits( cyg_flag_t *flag, cyg_flag_value_t value) __THROW;
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. */
558
void cyg_flag_maskbits( cyg_flag_t *flag, cyg_flag_value_t value) __THROW;
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,
567
                                cyg_flag_mode_t    mode ) __THROW;
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,
573
                                      cyg_tick_count_t   abstime ) __THROW;
574
 
575
#endif
576
 
577
cyg_flag_value_t cyg_flag_poll( cyg_flag_t         *flag,
578
                                cyg_flag_value_t    pattern,
579
                                cyg_flag_mode_t     mode ) __THROW;
580
 
581
cyg_flag_value_t cyg_flag_peek( cyg_flag_t *flag ) __THROW;
582
 
583
cyg_bool_t cyg_flag_waiting( cyg_flag_t *flag ) __THROW;
584
 
585
/*---------------------------------------------------------------------------*/
586
/* Mutex                                                                     */
587
 
588
#ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC
589
enum cyg_mutex_protocol
590
{
591
  CYG_MUTEX_NONE = 0,                   // no inversion protocol
592
  CYG_MUTEX_INHERIT,                    // priority inheritance protocol
593
  CYG_MUTEX_CEILING                     // priority ceiling protocol
594
};
595
#endif
596
 
597
void cyg_mutex_init(
598
    cyg_mutex_t        *mutex          /* Mutex to init                      */
599
) __THROW;
600
 
601
void cyg_mutex_destroy( cyg_mutex_t *mutex ) __THROW;
602
 
603
cyg_bool_t cyg_mutex_lock( cyg_mutex_t *mutex ) __THROW;
604
 
605
cyg_bool_t cyg_mutex_trylock( cyg_mutex_t *mutex ) __THROW;
606
 
607
void cyg_mutex_unlock( cyg_mutex_t *mutex ) __THROW;
608
 
609
void cyg_mutex_release( cyg_mutex_t *mutex ) __THROW;
610
 
611
#ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING
612
void cyg_mutex_set_ceiling( cyg_mutex_t *mutex, cyg_priority_t priority ) __THROW;
613
#endif
614
 
615
#ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC
616
void cyg_mutex_set_protocol ( cyg_mutex_t *mutex, enum cyg_mutex_protocol protocol ) __THROW;
617
#endif
618
 
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                  */
625
) __THROW;
626
 
627
void cyg_cond_destroy( cyg_cond_t *cond ) __THROW;
628
 
629
cyg_bool_t cyg_cond_wait( cyg_cond_t *cond ) __THROW;
630
 
631
void cyg_cond_signal( cyg_cond_t *cond ) __THROW;
632
 
633
void cyg_cond_broadcast( cyg_cond_t *cond ) __THROW;
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
639
    ) __THROW;
640
#endif
641
 
642
/*---------------------------------------------------------------------------*/
643
/* Spinlocks                                                                 */
644
 
645
void cyg_spinlock_init(
646
    cyg_spinlock_t      *lock,          /* spinlock to initialize            */
647
    cyg_bool_t          locked          /* init locked or unlocked           */
648
) __THROW;
649
 
650
void cyg_spinlock_destroy( cyg_spinlock_t *lock ) __THROW;
651
 
652
void cyg_spinlock_spin( cyg_spinlock_t *lock ) __THROW;
653
 
654
void cyg_spinlock_clear( cyg_spinlock_t *lock ) __THROW;
655
 
656
cyg_bool_t cyg_spinlock_try( cyg_spinlock_t *lock ) __THROW;
657
 
658
cyg_bool_t cyg_spinlock_test( cyg_spinlock_t *lock ) __THROW;
659
 
660
void cyg_spinlock_spin_intsave( cyg_spinlock_t *lock,
661
                                cyg_addrword_t *istate ) __THROW;
662
 
663
void cyg_spinlock_clear_intsave( cyg_spinlock_t *lock,
664
                                 cyg_addrword_t istate ) __THROW;
665
 
666
/*---------------------------------------------------------------------------*/
667
#ifdef __cplusplus
668
}
669
#endif
670
 
671
/*---------------------------------------------------------------------------*/
672
 
673
#include <cyg/kernel/kapidata.h>
674
 
675
/*---------------------------------------------------------------------------*/
676
/* EOF kapi.h                                                                */
677
#endif /* CYGFUN_KERNEL_API_C   */
678
#endif /* CYGONCE_KERNEL_KAPI_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.