From 43b6f757ce6127d95778fe2eaa9e3a9fc3a06ae3 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 30 Nov 2000 14:08:30 +0000 Subject: 2000-11-30 Joel Sherrill * General effort to make things compile with macros not inlines * inline/rtems/score/coremutex.inl: Added comment indicating for macros there is another copy of _CORE_mutex_Seize_interrupt_trylock() in src/coremutexseize.c. * src/coremutexseize.c: Added body of _CORE_mutex_Seize_interrupt_trylock() for macro case. * macros/rtems/score/coremutex.inl: Added prototype for _CORE_mutex_Seize_interrupt_trylock() since there is a real body when macros are enabled. * macros/rtems/score/coresem.inl: Added macro implementation of _CORE_semaphore_Seize_isr_disable. * macros/score/Makefile.am: Fixed typos. * rtems/score/address.inl: Correct macro implementation of _Addresses_Is_aligned() so it would compile. * macros/rtems/score/coremsg.inl: Added closing parentheses. --- cpukit/score/macros/rtems/score/coresem.inl | 43 +++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'cpukit/score/macros/rtems/score/coresem.inl') diff --git a/cpukit/score/macros/rtems/score/coresem.inl b/cpukit/score/macros/rtems/score/coresem.inl index 904b004cc6..01590c23b4 100644 --- a/cpukit/score/macros/rtems/score/coresem.inl +++ b/cpukit/score/macros/rtems/score/coresem.inl @@ -34,6 +34,49 @@ #define _Core_semaphore_Get_count( _the_semaphore ) \ ( (_the_semaphore)->count ) +/*PAGE + * + * _CORE_semaphore_Seize_isr_disable + * + * DESCRIPTION: + * + * This routine attempts to receive a unit from the_semaphore. + * If a unit is available or if the wait flag is FALSE, then the routine + * returns. Otherwise, the calling task is blocked until a unit becomes + * available. + * + * NOTE: There is currently no MACRO version of this routine. + */ + +#define _CORE_semaphore_Seize_isr_disable( \ + _the_semaphore, _id, _wait, _timeout, _level_p) \ +{ \ + Thread_Control *executing; \ + ISR_Level level = *(_level_p); \ + \ + /* disabled when you get here */ \ + \ + executing = _Thread_Executing; \ + executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL; \ + if ( (_the_semaphore)->count != 0 ) { \ + (_the_semaphore)->count -= 1; \ + _ISR_Enable( level ); \ + } else if ( !(_wait) ) { \ + _ISR_Enable( level ); \ + executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT; \ + } else { \ + _Thread_Disable_dispatch(); \ + _ISR_Enable( level ); \ + _Thread_queue_Enter_critical_section( &(_the_semaphore)->Wait_queue ); \ + executing->Wait.queue = &(_the_semaphore)->Wait_queue; \ + executing->Wait.id = (_id); \ + _ISR_Enable( level ); \ + \ + _Thread_queue_Enqueue( &(_the_semaphore)->Wait_queue, (_timeout) ); \ + _Thread_Enable_dispatch(); \ + } \ +} + #endif /* end of include file */ -- cgit v1.2.3