comparison packages/kernel/current/include/kapi.h @ 177:4c750ce71ae3

Merge from eCos master repository on 2001-08-10-19:22:57-BST
author jlarmour
date Fri, 10 Aug 2001 19:27:55 +0000
parents d397fc472bcf
children 391299f9e541
comparison
equal deleted inserted replaced
176:3902ef905c9c 177:4c750ce71ae3
65 typedef CYG_ADDRWORD cyg_addrword_t; /* May hold pointer or word */ 65 typedef CYG_ADDRWORD cyg_addrword_t; /* May hold pointer or word */
66 typedef cyg_addrword_t cyg_handle_t; /* Object handle */ 66 typedef cyg_addrword_t cyg_handle_t; /* Object handle */
67 typedef cyg_uint32 cyg_priority_t; /* type for priorities */ 67 typedef cyg_uint32 cyg_priority_t; /* type for priorities */
68 typedef cyg_int32 cyg_code_t; /* type for various codes */ 68 typedef cyg_int32 cyg_code_t; /* type for various codes */
69 typedef cyg_uint32 cyg_vector_t; /* Interrupt vector id */ 69 typedef cyg_uint32 cyg_vector_t; /* Interrupt vector id */
70 typedef cyg_uint32 cyg_cpu_t; /* CPU id type */
70 71
71 typedef cyg_uint64 cyg_tick_count_t; 72 typedef cyg_uint64 cyg_tick_count_t;
72 73
73 typedef int cyg_bool_t; 74 typedef int cyg_bool_t;
74 75
107 struct cyg_mutex_t; 108 struct cyg_mutex_t;
108 typedef struct cyg_mutex_t cyg_mutex_t; 109 typedef struct cyg_mutex_t cyg_mutex_t;
109 110
110 struct cyg_cond_t; 111 struct cyg_cond_t;
111 typedef struct cyg_cond_t cyg_cond_t; 112 typedef struct cyg_cond_t cyg_cond_t;
113
114 struct cyg_spinlock_t;
115 typedef struct cyg_spinlock_t cyg_spinlock_t;
112 116
113 /*---------------------------------------------------------------------------*/ 117 /*---------------------------------------------------------------------------*/
114 /* Scheduler operations */ 118 /* Scheduler operations */
115 119
116 /* Starts scheduler with created threads. Never returns. */ 120 /* Starts scheduler with created threads. Never returns. */
237 241
238 /*---------------------------------------------------------------------------*/ 242 /*---------------------------------------------------------------------------*/
239 /* Interrupt handling */ 243 /* Interrupt handling */
240 typedef void cyg_VSR_t(void); 244 typedef void cyg_VSR_t(void);
241 typedef cyg_uint32 cyg_ISR_t(cyg_vector_t vector, cyg_addrword_t data); 245 typedef cyg_uint32 cyg_ISR_t(cyg_vector_t vector, cyg_addrword_t data);
242 typedef void cyg_DSR_t( 246 typedef void cyg_DSR_t( cyg_vector_t vector,
243 cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data); 247 cyg_ucount32 count,
248 cyg_addrword_t data);
244 249
245 250
246 enum cyg_ISR_results 251 enum cyg_ISR_results
247 { 252 {
248 CYG_ISR_HANDLED = 1, /* Interrupt was handled */ 253 CYG_ISR_HANDLED = 1, /* Interrupt was handled */
293 cyg_vector_t vector, /* vector to configure */ 298 cyg_vector_t vector, /* vector to configure */
294 cyg_bool_t level, /* level or edge triggered */ 299 cyg_bool_t level, /* level or edge triggered */
295 cyg_bool_t up /* rising/faling edge, high/low level*/ 300 cyg_bool_t up /* rising/faling edge, high/low level*/
296 ); 301 );
297 302
303 void cyg_interrupt_set_cpu(
304 cyg_vector_t vector, /* vector to control */
305 cyg_cpu_t cpu /* CPU to set */
306 );
307
308 cyg_cpu_t cyg_interrupt_get_cpu(
309 cyg_vector_t vector /* vector to control */
310 );
311
298 /*---------------------------------------------------------------------------*/ 312 /*---------------------------------------------------------------------------*/
299 /* Counters, Clocks and Alarms */ 313 /* Counters, Clocks and Alarms */
300 314
301 void cyg_counter_create( 315 void cyg_counter_create(
302 cyg_handle_t *handle, /* returned counter handle */ 316 cyg_handle_t *handle, /* returned counter handle */
504 cyg_bool_t cyg_flag_waiting( cyg_flag_t *flag ); 518 cyg_bool_t cyg_flag_waiting( cyg_flag_t *flag );
505 519
506 /*---------------------------------------------------------------------------*/ 520 /*---------------------------------------------------------------------------*/
507 /* Mutex */ 521 /* Mutex */
508 522
523 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC
524 enum cyg_protcol
525 {
526 NONE = 0, // no inversion protocol
527 INHERIT, // priority inheritance protocol
528 CEILING // priority ceiling protocol
529 };
530 #endif
531
509 void cyg_mutex_init( 532 void cyg_mutex_init(
510 cyg_mutex_t *mutex /* Mutex to init */ 533 cyg_mutex_t *mutex /* Mutex to init */
511 ); 534 );
512 535
513 void cyg_mutex_destroy( cyg_mutex_t *mutex ); 536 void cyg_mutex_destroy( cyg_mutex_t *mutex );
517 cyg_bool_t cyg_mutex_trylock( cyg_mutex_t *mutex ); 540 cyg_bool_t cyg_mutex_trylock( cyg_mutex_t *mutex );
518 541
519 void cyg_mutex_unlock( cyg_mutex_t *mutex ); 542 void cyg_mutex_unlock( cyg_mutex_t *mutex );
520 543
521 void cyg_mutex_release( cyg_mutex_t *mutex ); 544 void cyg_mutex_release( cyg_mutex_t *mutex );
545
546 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_CEILING
547 void cyg_mutex_set_ceiling( cyg_mutex_t *mutex, cyg_priority_t priority );
548 #endif
549
550 #ifdef CYGSEM_KERNEL_SYNCH_MUTEX_PRIORITY_INVERSION_PROTOCOL_DYNAMIC
551 void cyg_mutex_set_protocol ( cyg_mutex_t *mutex, enum cyg_protcol protocol );
552 #endif
522 553
523 /*---------------------------------------------------------------------------*/ 554 /*---------------------------------------------------------------------------*/
524 /* Condition Variables */ 555 /* Condition Variables */
525 556
526 void cyg_cond_init( 557 void cyg_cond_init(
541 cyg_cond_t *cond, 572 cyg_cond_t *cond,
542 cyg_tick_count_t abstime 573 cyg_tick_count_t abstime
543 ); 574 );
544 #endif 575 #endif
545 576
546 577 /*---------------------------------------------------------------------------*/
578 /* Spinlocks */
579
580 void cyg_spinlock_init(
581 cyg_spinlock_t *lock, /* spinlock to initialize */
582 cyg_bool_t locked /* init locked or unlocked */
583 );
584
585 void cyg_spinlock_destroy( cyg_spinlock_t *lock );
586
587 void cyg_spinlock_spin( cyg_spinlock_t *lock );
588
589 void cyg_spinlock_clear( cyg_spinlock_t *lock );
590
591 cyg_bool_t cyg_spinlock_try( cyg_spinlock_t *lock );
592
593 cyg_bool_t cyg_spinlock_test( cyg_spinlock_t *lock );
594
595 void cyg_spinlock_spin_intsave( cyg_spinlock_t *lock,
596 cyg_addrword_t *istate );
597
598 void cyg_spinlock_clear_intsave( cyg_spinlock_t *lock,
599 cyg_addrword_t istate );
600
601 /*---------------------------------------------------------------------------*/
547 #ifdef __cplusplus 602 #ifdef __cplusplus
548 } 603 }
549 #endif 604 #endif
605
606 /*---------------------------------------------------------------------------*/
550 607
551 #include <cyg/kernel/kapidata.h> 608 #include <cyg/kernel/kapidata.h>
552 609
553 /*---------------------------------------------------------------------------*/ 610 /*---------------------------------------------------------------------------*/
554 /* EOF kapi.h */ 611 /* EOF kapi.h */