forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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) $@
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user