diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2000-11-30 14:08:30 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2000-11-30 14:08:30 +0000 |
commit | 43b6f757ce6127d95778fe2eaa9e3a9fc3a06ae3 (patch) | |
tree | b8cce290191ffcee0ce79451897a0ce89aec6af2 /c/src | |
parent | 2000-11-30 Joel Sherrill <joel@OARcorp.com> (diff) | |
download | rtems-43b6f757ce6127d95778fe2eaa9e3a9fc3a06ae3.tar.bz2 |
2000-11-30 Joel Sherrill <joel@OARcorp.com>
* 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.
Diffstat (limited to '')
-rw-r--r-- | c/src/exec/score/ChangeLog | 18 | ||||
-rw-r--r-- | c/src/exec/score/inline/rtems/score/coremutex.inl | 2 | ||||
-rw-r--r-- | c/src/exec/score/macros/rtems/score/Makefile.am | 4 | ||||
-rw-r--r-- | c/src/exec/score/macros/rtems/score/address.inl | 4 | ||||
-rw-r--r-- | c/src/exec/score/macros/rtems/score/coremsg.inl | 6 | ||||
-rw-r--r-- | c/src/exec/score/macros/rtems/score/coremutex.inl | 14 | ||||
-rw-r--r-- | c/src/exec/score/macros/rtems/score/coresem.inl | 43 | ||||
-rw-r--r-- | c/src/exec/score/src/coremutexseize.c | 60 |
8 files changed, 145 insertions, 6 deletions
diff --git a/c/src/exec/score/ChangeLog b/c/src/exec/score/ChangeLog index 70487f1a84..51e54127c4 100644 --- a/c/src/exec/score/ChangeLog +++ b/c/src/exec/score/ChangeLog @@ -1,3 +1,21 @@ + +2000-11-30 Joel Sherrill <joel@OARcorp.com> + + * 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. 2000-11-28 Chris Johns <ccj@acm.org> diff --git a/c/src/exec/score/inline/rtems/score/coremutex.inl b/c/src/exec/score/inline/rtems/score/coremutex.inl index 04a56a549f..fe783b3d91 100644 --- a/c/src/exec/score/inline/rtems/score/coremutex.inl +++ b/c/src/exec/score/inline/rtems/score/coremutex.inl @@ -113,6 +113,8 @@ RTEMS_INLINE_ROUTINE boolean _CORE_mutex_Is_priority_ceiling( * the mutex and will have to block to do so. * * NOTE: There is no MACRO version of this routine. + * A body is in coremutexseize.c that is duplicated + * from the .inl by hand. */ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock( diff --git a/c/src/exec/score/macros/rtems/score/Makefile.am b/c/src/exec/score/macros/rtems/score/Makefile.am index 4260e15c08..87cac6f169 100644 --- a/c/src/exec/score/macros/rtems/score/Makefile.am +++ b/c/src/exec/score/macros/rtems/score/Makefile.am @@ -18,11 +18,11 @@ if MACROS if HAS_MP I_FILES = $(STD_I_FILES) $(MP_I_FILES) else -I_FILES = $(STD_I_FILES +I_FILES = $(STD_I_FILES) endif PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score \ - $(I_FILES:%=$(PROJECT_INCLUDE)/rtems/score%) + $(I_FILES:%=$(PROJECT_INCLUDE)/rtems/score/%) $(PROJECT_INCLUDE)/rtems/score: @$(mkinstalldirs) $@ diff --git a/c/src/exec/score/macros/rtems/score/address.inl b/c/src/exec/score/macros/rtems/score/address.inl index 10623b1f76..24f9dc12e5 100644 --- a/c/src/exec/score/macros/rtems/score/address.inl +++ b/c/src/exec/score/macros/rtems/score/address.inl @@ -52,12 +52,14 @@ */ #if (CPU_ALIGNMENT == 0) +#define _Addresses_Is_aligned( _address ) \ (TRUE) #elif defined(RTEMS_CPU_HAS_16_BIT_ADDRESSES) +#define _Addresses_Is_aligned( _address ) \ ( ( (unsigned short)(_address) % CPU_ALIGNMENT ) == 0 ) +#else #define _Addresses_Is_aligned( _address ) \ ( ( (unsigned32)(_address) % CPU_ALIGNMENT ) == 0 ) -#else #endif /*PAGE diff --git a/c/src/exec/score/macros/rtems/score/coremsg.inl b/c/src/exec/score/macros/rtems/score/coremsg.inl index 0717b3eea3..c37c307287 100644 --- a/c/src/exec/score/macros/rtems/score/coremsg.inl +++ b/c/src/exec/score/macros/rtems/score/coremsg.inl @@ -21,12 +21,12 @@ * _CORE_message_queue_Send * */ - + #define _CORE_message_queue_Send( _the_message_queue, _buffer, _size, \ _id, _api_message_queue_mp_support, _wait, _timeout ) \ _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \ (_id), (_api_message_queue_mp_support), \ - CORE_MESSAGE_QUEUE_SEND_REQUEST, (_wait), (_timeout) + CORE_MESSAGE_QUEUE_SEND_REQUEST, (_wait), (_timeout) ) /*PAGE * @@ -38,7 +38,7 @@ _id, _api_message_queue_mp_support, _wait, _timeout ) \ _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \ (_id), (_api_message_queue_mp_support), \ - CORE_MESSAGE_QUEUE_URGENT_REQUEST, (_wait), (_timeout) + CORE_MESSAGE_QUEUE_URGENT_REQUEST, (_wait), (_timeout) ) /*PAGE * diff --git a/c/src/exec/score/macros/rtems/score/coremutex.inl b/c/src/exec/score/macros/rtems/score/coremutex.inl index be6f483dae..90323374e5 100644 --- a/c/src/exec/score/macros/rtems/score/coremutex.inl +++ b/c/src/exec/score/macros/rtems/score/coremutex.inl @@ -63,5 +63,19 @@ #define _CORE_mutex_Is_priority_ceiling( _the_attribute )\ ( (_the_attribute)->discipline == CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING ) +/*PAGE + * + * _CORE_mutex_Seize_interrupt_trylock + * + * NOTE: This is not really a MACRO version of this routine. + * A body is in coremutexseize.c that is duplicated + * from the .inl by hand. + */ + +int _CORE_mutex_Seize_interrupt_trylock( + CORE_mutex_Control *the_mutex, + ISR_Level *level_p +); + #endif /* end of include file */ diff --git a/c/src/exec/score/macros/rtems/score/coresem.inl b/c/src/exec/score/macros/rtems/score/coresem.inl index 904b004cc6..01590c23b4 100644 --- a/c/src/exec/score/macros/rtems/score/coresem.inl +++ b/c/src/exec/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 */ diff --git a/c/src/exec/score/src/coremutexseize.c b/c/src/exec/score/src/coremutexseize.c index 500c8bb61c..a4aadb7410 100644 --- a/c/src/exec/score/src/coremutexseize.c +++ b/c/src/exec/score/src/coremutexseize.c @@ -82,3 +82,63 @@ void _CORE_mutex_Seize_interrupt_blocking( } _Thread_Enable_dispatch(); } + +#if !defined(USE_INLINES) +int _CORE_mutex_Seize_interrupt_trylock( + CORE_mutex_Control *the_mutex, + ISR_Level *level_p +) +{ + Thread_Control *executing; + ISR_Level level = *level_p; + + /* disabled when you get here */ + + executing = _Thread_Executing; + executing->Wait.return_code = CORE_MUTEX_STATUS_SUCCESSFUL; + if ( !_CORE_mutex_Is_locked( the_mutex ) ) { + the_mutex->lock = CORE_MUTEX_LOCKED; + the_mutex->holder = executing; + the_mutex->holder_id = executing->Object.id; + the_mutex->nest_count = 1; + executing->resource_count++; + if ( the_mutex->Attributes.discipline != + CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING ) { + _ISR_Enable( level ); + return 0; + } + /* else must be CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING */ + { + Priority_Control ceiling; + Priority_Control current; + + ceiling = the_mutex->Attributes.priority_ceiling; + current = executing->current_priority; + if ( current == ceiling ) { + _ISR_Enable( level ); + return 0; + } + if ( current > ceiling ) { + _Thread_Disable_dispatch(); + _ISR_Enable( level ); + _Thread_Change_priority( + the_mutex->holder, + the_mutex->Attributes.priority_ceiling, + FALSE + ); + _Thread_Enable_dispatch(); + return 0; + } + /* if ( current < ceiling ) */ { + executing->Wait.return_code = CORE_MUTEX_STATUS_CEILING_VIOLATED; + the_mutex->nest_count = 0; /* undo locking above */ + executing->resource_count--; /* undo locking above */ + _ISR_Enable( level ); + return 0; + } + } + return 0; + } + return 1; +} +#endif |