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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [kernel/] [v2_0/] [include/] [kapi.h] - Blame information for rev 757

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

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