diff options
Diffstat (limited to 'cpukit/rtems/inline/rtems/rtems')
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/asr.inl | 119 | ||||
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/attr.inl | 197 | ||||
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/barrier.inl | 89 | ||||
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/dpmem.inl | 90 | ||||
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/event.inl | 33 | ||||
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/eventset.inl | 94 | ||||
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/message.inl | 83 | ||||
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/modes.inl | 136 | ||||
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/options.inl | 61 | ||||
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/part.inl | 175 | ||||
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/ratemon.inl | 127 | ||||
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/region.inl | 115 | ||||
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/sem.inl | 110 | ||||
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/status.inl | 62 | ||||
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/support.inl | 63 | ||||
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/tasks.inl | 86 | ||||
-rw-r--r-- | cpukit/rtems/inline/rtems/rtems/timer.inl | 126 |
17 files changed, 1766 insertions, 0 deletions
diff --git a/cpukit/rtems/inline/rtems/rtems/asr.inl b/cpukit/rtems/inline/rtems/rtems/asr.inl new file mode 100644 index 0000000000..93587a312c --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/asr.inl @@ -0,0 +1,119 @@ +/** + * @file rtems/rtems/asr.inl + * + * This include file contains the implemenation of all routines + * associated with the asynchronous signal handler which are inlined. + */ + +/* COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_ASR_H +# error "Never use <rtems/rtems/asr.inl> directly; include <rtems/rtems/asr.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_ASR_INL +#define _RTEMS_RTEMS_ASR_INL + +#include <rtems/score/isr.h> + +/** + * @addtogroup ClassicASR + * @{ + */ + +/** + * @brief ASR_Initialize + * + * This routine initializes the given RTEMS_ASR information record. + */ +RTEMS_INLINE_ROUTINE void _ASR_Initialize ( + ASR_Information *information +) +{ + information->is_enabled = false; + information->handler = NULL; + information->mode_set = RTEMS_DEFAULT_MODES; + information->signals_posted = 0; + information->signals_pending = 0; + information->nest_level = 0; +} + +/** + * @brief ASR_Swap_signals + * + * This routine atomically swaps the pending and posted signal + * sets. This is done when the thread alters its mode in such a + * way that the RTEMS_ASR disable/enable flag changes. + */ +RTEMS_INLINE_ROUTINE void _ASR_Swap_signals ( + ASR_Information *information +) +{ + rtems_signal_set _signals; + ISR_Level _level; + + _ISR_Disable( _level ); + _signals = information->signals_pending; + information->signals_pending = information->signals_posted; + information->signals_posted = _signals; + _ISR_Enable( _level ); +} + +/** + * @brief ASR_Is_null_handler + * + * This function returns TRUE if the given asr_handler is NULL and + * FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _ASR_Is_null_handler ( + rtems_asr_entry asr_handler +) +{ + return asr_handler == NULL; +} + +/** + * @brief ASR_Are_signals_pending + * + * This function returns TRUE if there are signals pending in the + * given RTEMS_ASR information record and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _ASR_Are_signals_pending ( + ASR_Information *information +) +{ + return information->signals_posted != 0; +} + +/** + * @brief ASR_Post_signals + * + * This routine posts the given signals into the signal_set + * passed in. The result is returned to the user in signal_set. + * + * NOTE: This must be implemented as a macro. + */ +RTEMS_INLINE_ROUTINE void _ASR_Post_signals( + rtems_signal_set signals, + rtems_signal_set *signal_set +) +{ + ISR_Level _level; + + _ISR_Disable( _level ); + *signal_set |= signals; + _ISR_Enable( _level ); +} + +/**@}*/ + +#endif +/* end of include file */ diff --git a/cpukit/rtems/inline/rtems/rtems/attr.inl b/cpukit/rtems/inline/rtems/rtems/attr.inl new file mode 100644 index 0000000000..7a697588da --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/attr.inl @@ -0,0 +1,197 @@ +/** + * @file rtems/rtems/attr.inl + * + * This include file contains all of the inlined routines associated + * with attributes. + */ + +/* + * COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_ATTR_H +# error "Never use <rtems/rtems/attr.inl> directly; include <rtems/rtems/attr.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_ATTR_INL +#define _RTEMS_RTEMS_ATTR_INL + +#include <rtems/score/basedefs.h> /* RTEMS_INLINE_ROUTINE */ + +/** + * @addtogroup ClassicAttributes + * @{ + */ + +/** + * @brief Attributes_Set + * + * This function sets the requested new_attributes in the attribute_set + * passed in. The result is returned to the user. + */ +RTEMS_INLINE_ROUTINE rtems_attribute _Attributes_Set ( + rtems_attribute new_attributes, + rtems_attribute attribute_set +) +{ + return attribute_set | new_attributes; +} + +/** + * @brief Attributes_Clear + * + * This function clears the requested new_attributes in the attribute_set + * passed in. The result is returned to the user. + */ +RTEMS_INLINE_ROUTINE rtems_attribute _Attributes_Clear ( + rtems_attribute attribute_set, + rtems_attribute mask +) +{ + return attribute_set & ~mask; +} + +/** + * @brief Attributes_Is_floating_point + * + * This function returns TRUE if the floating point attribute is + * enabled in the attribute_set and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Attributes_Is_floating_point( + rtems_attribute attribute_set +) +{ + return ( attribute_set & RTEMS_FLOATING_POINT ) ? true : false; +} + +#if defined(RTEMS_MULTIPROCESSING) +/** + * @brief Attributes_Is_global + * + * This function returns TRUE if the global object attribute is + * enabled in the attribute_set and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Attributes_Is_global( + rtems_attribute attribute_set +) +{ + return ( attribute_set & RTEMS_GLOBAL ) ? true : false; +} +#endif + +/** + * @brief Attributes_Is_priority + * + * This function returns TRUE if the priority attribute is + * enabled in the attribute_set and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Attributes_Is_priority( + rtems_attribute attribute_set +) +{ + return ( attribute_set & RTEMS_PRIORITY ) ? true : false; +} + +/** + * @brief Attributes_Is_binary_semaphore + * + * This function returns TRUE if the binary semaphore attribute is + * enabled in the attribute_set and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Attributes_Is_binary_semaphore( + rtems_attribute attribute_set +) +{ + return ((attribute_set & RTEMS_SEMAPHORE_CLASS) == RTEMS_BINARY_SEMAPHORE); +} + +/** + * @brief Attributes_Is_simple_binary_semaphore + * + * This function returns TRUE if the simple binary semaphore attribute is + * enabled in the attribute_set and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Attributes_Is_simple_binary_semaphore( + rtems_attribute attribute_set +) +{ + return + ((attribute_set & RTEMS_SEMAPHORE_CLASS) == RTEMS_SIMPLE_BINARY_SEMAPHORE); +} + +/** + * @brief Attributes_Is_counting_semaphore + * + * This function returns TRUE if the counting semaphore attribute is + * enabled in the attribute_set and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Attributes_Is_counting_semaphore( + rtems_attribute attribute_set +) +{ + return ((attribute_set & RTEMS_SEMAPHORE_CLASS) == RTEMS_COUNTING_SEMAPHORE); +} + +/** + * @brief Attributes_Is_inherit_priority + * + * This function returns TRUE if the priority inheritance attribute + * is enabled in the attribute_set and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Attributes_Is_inherit_priority( + rtems_attribute attribute_set +) +{ + return ( attribute_set & RTEMS_INHERIT_PRIORITY ) ? true : false; +} + +/** + * @brief Attributes_Is_priority_ceiling + * + * This function returns TRUE if the priority ceiling attribute + * is enabled in the attribute_set and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Attributes_Is_priority_ceiling( + rtems_attribute attribute_set +) +{ + return ( attribute_set & RTEMS_PRIORITY_CEILING ) ? true : false; +} + +/** + * @brief Attributes_Is_barrier_automatic + * + * This function returns TRUE if the barrier automatic release + * attribute is enabled in the attribute_set and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Attributes_Is_barrier_automatic( + rtems_attribute attribute_set +) +{ + return ( attribute_set & RTEMS_BARRIER_AUTOMATIC_RELEASE ) ? true : false; +} + +/** + * @brief Attributes_Is_system_task + * + * This function returns TRUE if the system task attribute + * is enabled in the attribute_set and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Attributes_Is_system_task( + rtems_attribute attribute_set +) +{ + return ( attribute_set & RTEMS_SYSTEM_TASK ) ? true : false; +} + +/**@}*/ + +#endif +/* end of include file */ diff --git a/cpukit/rtems/inline/rtems/rtems/barrier.inl b/cpukit/rtems/inline/rtems/rtems/barrier.inl new file mode 100644 index 0000000000..3bec0f2075 --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/barrier.inl @@ -0,0 +1,89 @@ +/** + * @file rtems/rtems/barrier.inl + * + * This file contains the static inlin implementation of the inlined + * routines from the Barrier Manager. + */ + +/* COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_BARRIER_H +# error "Never use <rtems/rtems/barrier.inl> directly; include <rtems/rtems/barrier.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_BARRIER_INL +#define _RTEMS_RTEMS_BARRIER_INL + +/** + * @addtogroup ClassicBarrier + * @{ + */ + +/** + * @brief _Barrier_Allocate + * + * This function allocates a barrier control block from + * the inactive chain of free barrier control blocks. + */ +RTEMS_INLINE_ROUTINE Barrier_Control *_Barrier_Allocate( void ) +{ + return (Barrier_Control *) _Objects_Allocate( &_Barrier_Information ); +} + +/** + * @brief _Barrier_Free + * + * This routine frees a barrier control block to the + * inactive chain of free barrier control blocks. + */ +RTEMS_INLINE_ROUTINE void _Barrier_Free ( + Barrier_Control *the_barrier +) +{ + _Objects_Free( &_Barrier_Information, &the_barrier->Object ); +} + +/** + * @brief _Barrier_Get + * + * This function maps barrier IDs to barrier control blocks. + * If ID corresponds to a local barrier, then it returns + * the_barrier control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the barrier ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the_barrier is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the_barrier is undefined. + */ +RTEMS_INLINE_ROUTINE Barrier_Control *_Barrier_Get ( + Objects_Id id, + Objects_Locations *location +) +{ + return (Barrier_Control *) + _Objects_Get( &_Barrier_Information, id, location ); +} + +/** + * @brief _Barrier_Is_null + * + * This function returns TRUE if the_barrier is NULL and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Barrier_Is_null ( + Barrier_Control *the_barrier +) +{ + return ( the_barrier == NULL ); +} + +/**@}*/ + +#endif +/* end of include file */ diff --git a/cpukit/rtems/inline/rtems/rtems/dpmem.inl b/cpukit/rtems/inline/rtems/rtems/dpmem.inl new file mode 100644 index 0000000000..5b944484b5 --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/dpmem.inl @@ -0,0 +1,90 @@ +/** + * @file rtems/rtems/dpmem.inl + * + * This include file contains the inline routine used in conjunction + * with the Dual Ported Memory Manager + */ + +/* COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_DPMEM_H +# error "Never use <rtems/rtems/dpmem.inl> directly; include <rtems/rtems/dpmem.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_DPMEM_INL +#define _RTEMS_RTEMS_DPMEM_INL + +/** + * @addtogroup ClassicDPMEM + * @{ + */ + +/** + * @brief Dual_ported_memory_Allocate + * + * This routine allocates a port control block from the inactive chain + * of free port control blocks. + */ +RTEMS_INLINE_ROUTINE Dual_ported_memory_Control + *_Dual_ported_memory_Allocate ( void ) +{ + return (Dual_ported_memory_Control *) + _Objects_Allocate( &_Dual_ported_memory_Information ); +} + +/** + * @brief Dual_ported_memory_Free + * + * This routine frees a port control block to the inactive chain + * of free port control blocks. + */ +RTEMS_INLINE_ROUTINE void _Dual_ported_memory_Free ( + Dual_ported_memory_Control *the_port +) +{ + _Objects_Free( &_Dual_ported_memory_Information, &the_port->Object ); +} + +/** + * @brief Dual_ported_memory_Get + * + * This function maps port IDs to port control blocks. If ID + * corresponds to a local port, then it returns the_port control + * pointer which maps to ID and location is set to OBJECTS_LOCAL. + * Global ports are not supported, thus if ID does not map to a + * local port, location is set to OBJECTS_ERROR and the_port is + * undefined. + */ +RTEMS_INLINE_ROUTINE Dual_ported_memory_Control *_Dual_ported_memory_Get ( + Objects_Id id, + Objects_Locations *location +) +{ + return (Dual_ported_memory_Control *) + _Objects_Get( &_Dual_ported_memory_Information, id, location ); +} + +/** + * @brief Dual_ported_memory_Is_null + * + * This function returns true if the_port is NULL and false otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Dual_ported_memory_Is_null( + Dual_ported_memory_Control *the_port +) +{ + return ( the_port == NULL ); +} + +/**@}*/ + +#endif +/* end of include file */ diff --git a/cpukit/rtems/inline/rtems/rtems/event.inl b/cpukit/rtems/inline/rtems/rtems/event.inl new file mode 100644 index 0000000000..8ea83e2176 --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/event.inl @@ -0,0 +1,33 @@ +/** + * @file rtems/rtems/event.inl + * + * This include file contains the static inline implementation of + * macros for the Event Manager. + */ + +/* COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_EVENT_H +# error "Never use <rtems/rtems/event.inl> directly; include <rtems/rtems/event.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_EVENT_INL +#define _RTEMS_RTEMS_EVENT_INL + +/** + * @addtogroup ClassicEvent + * @{ + */ + +/**@}*/ + +#endif +/* end of include file */ diff --git a/cpukit/rtems/inline/rtems/rtems/eventset.inl b/cpukit/rtems/inline/rtems/rtems/eventset.inl new file mode 100644 index 0000000000..dbe869c85d --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/eventset.inl @@ -0,0 +1,94 @@ +/** + * @file rtems/rtems/eventset.inl + * + * This include file contains the information pertaining to event sets. + */ + +/* COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_EVENTSET_H +# error "Never use <rtems/rtems/eventset.inl> directly; include <rtems/rtems/eventset.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_EVENTSET_INL +#define _RTEMS_RTEMS_EVENTSET_INL + +#include <rtems/score/basedefs.h> /* RTEMS_INLINE_ROUTINE */ +#include <rtems/score/isr.h> /* ISR_Level */ + +/** + * @addtogroup ClassicEventSet + * @{ + */ + +/** + * @brief Event_sets_Is_empty + * + * This function returns TRUE if on events are posted in the event_set, + * and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Event_sets_Is_empty( + rtems_event_set the_event_set +) +{ + return ( the_event_set == 0 ); +} + +/** + * @brief Event_sets_Post + * + * This routine posts the given new_events into the event_set + * passed in. The result is returned to the user in event_set. + */ +RTEMS_INLINE_ROUTINE void _Event_sets_Post( + rtems_event_set the_new_events, + rtems_event_set *the_event_set +) +{ + ISR_Level level; + + _ISR_Disable( level ); + *the_event_set |= the_new_events; + _ISR_Enable( level ); +} + +/** + * @brief Event_sets_Get + * + * This function returns the events in event_condition which are + * set in event_set. + */ +RTEMS_INLINE_ROUTINE rtems_event_set _Event_sets_Get( + rtems_event_set the_event_set, + rtems_event_set the_event_condition +) +{ + return ( the_event_set & the_event_condition ); +} + +/** + * @brief Event_sets_Clear + * + * This function removes the events in mask from the event_set + * passed in. The result is returned to the user in event_set. + */ +RTEMS_INLINE_ROUTINE rtems_event_set _Event_sets_Clear( + rtems_event_set the_event_set, + rtems_event_set the_mask +) +{ + return ( the_event_set & ~(the_mask) ); +} + +/**@}*/ + +#endif +/* end of include file */ diff --git a/cpukit/rtems/inline/rtems/rtems/message.inl b/cpukit/rtems/inline/rtems/rtems/message.inl new file mode 100644 index 0000000000..dfaeb25fb3 --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/message.inl @@ -0,0 +1,83 @@ +/** + * @file rtems/rtems/message.inl + * + * This include file contains the static inline implementation of all + * inlined routines in the Message Manager. + */ + +/* COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_MESSAGE_H +# error "Never use <rtems/rtems/message.inl> directly; include <rtems/rtems/message.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_MESSAGE_INL +#define _RTEMS_RTEMS_MESSAGE_INL + +#include <rtems/score/wkspace.h> + +/** + * @addtogroup ClassicMessageQueue + * @{ + */ + +/** + * @brief Message_queue_Is_null + * + * This function places the_message at the rear of the outstanding + * messages on the_message_queue. + */ +RTEMS_INLINE_ROUTINE bool _Message_queue_Is_null ( + Message_queue_Control *the_message_queue +) +{ + return ( the_message_queue == NULL ); +} + + +/** + * @brief Message_queue_Free + * + * This routine deallocates a message queue control block into + * the inactive chain of free message queue control blocks. + */ +RTEMS_INLINE_ROUTINE void _Message_queue_Free ( + Message_queue_Control *the_message_queue +) +{ + _Objects_Free( &_Message_queue_Information, &the_message_queue->Object ); +} + +/** + * @brief Message_queue_Get + * + * This function maps message queue IDs to message queue control + * blocks. If ID corresponds to a local message queue, then it + * returns the_message_queue control pointer which maps to ID + * and location is set to OBJECTS_LOCAL. If the message queue ID is + * global and resides on a remote node, then location is set + * to OBJECTS_REMOTE, and the_message_queue is undefined. + * Otherwise, location is set to OBJECTS_ERROR and + * the_message_queue is undefined. + */ +RTEMS_INLINE_ROUTINE Message_queue_Control *_Message_queue_Get ( + Objects_Id id, + Objects_Locations *location +) +{ + return (Message_queue_Control *) + _Objects_Get( &_Message_queue_Information, id, location ); +} + +/**@}*/ + +#endif +/* end of include file */ diff --git a/cpukit/rtems/inline/rtems/rtems/modes.inl b/cpukit/rtems/inline/rtems/rtems/modes.inl new file mode 100644 index 0000000000..d0dfe4932b --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/modes.inl @@ -0,0 +1,136 @@ +/** + * @file rtems/rtems/modes.inl + * + * This include file contains the static inline implementation of the + * inlined routines in the Mode Handler + */ + +/* COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_MODES_H +# error "Never use <rtems/rtems/modes.inl> directly; include <rtems/rtems/modes.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_MODES_INL +#define _RTEMS_RTEMS_MODES_INL + +/** + * @addtogroup ClassicModes + * @{ + */ + +/** + * @brief Modes_Mask_changed + * + * This function returns TRUE if any of the mode flags in mask + * are set in mode_set, and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Modes_Mask_changed ( + Modes_Control mode_set, + Modes_Control masks +) +{ + return ( mode_set & masks ) ? true : false; +} + +/** + * @brief Modes_Is_asr_disabled + * + * This function returns TRUE if mode_set indicates that Asynchronous + * Signal Processing is disabled, and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Modes_Is_asr_disabled ( + Modes_Control mode_set +) +{ + return (mode_set & RTEMS_ASR_MASK) == RTEMS_NO_ASR; +} + +/** + * @brief Modes_Is_preempt + * + * This function returns TRUE if mode_set indicates that preemption + * is enabled, and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Modes_Is_preempt ( + Modes_Control mode_set +) +{ + return (mode_set & RTEMS_PREEMPT_MASK) == RTEMS_PREEMPT; +} + +/** + * @brief Modes_Is_timeslice + * + * This function returns TRUE if mode_set indicates that timeslicing + * is enabled, and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Modes_Is_timeslice ( + Modes_Control mode_set +) +{ + return (mode_set & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE; +} + +/** + * @brief Modes_Get_interrupt_level + * + * This function returns the interrupt level portion of the mode_set. + */ +RTEMS_INLINE_ROUTINE ISR_Level _Modes_Get_interrupt_level ( + Modes_Control mode_set +) +{ + return ( mode_set & RTEMS_INTERRUPT_MASK ); +} + +/** + * @brief Modes_Set_interrupt_level + * + * This routine sets the current interrupt level to that specified + * in the mode_set. + */ +RTEMS_INLINE_ROUTINE void _Modes_Set_interrupt_level ( + Modes_Control mode_set +) +{ + _ISR_Set_level( _Modes_Get_interrupt_level( mode_set ) ); +} + +/** + * @brief Modes_Change + * + * This routine changes the modes in old_mode_set indicated by + * mask to the requested values in new_mode_set. The resulting + * mode set is returned in out_mode_set and the modes that changed + * is returned in changed. + */ +RTEMS_INLINE_ROUTINE void _Modes_Change ( + Modes_Control old_mode_set, + Modes_Control new_mode_set, + Modes_Control mask, + Modes_Control *out_mode_set, + Modes_Control *changed +) +{ + Modes_Control _out_mode; + + _out_mode = old_mode_set; + _out_mode &= ~mask; + _out_mode |= new_mode_set & mask; + *changed = _out_mode ^ old_mode_set; + *out_mode_set = _out_mode; +} + +/**@}*/ + +#endif +/* end of include file */ diff --git a/cpukit/rtems/inline/rtems/rtems/options.inl b/cpukit/rtems/inline/rtems/rtems/options.inl new file mode 100644 index 0000000000..8d2b406f33 --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/options.inl @@ -0,0 +1,61 @@ +/** + * @file rtems/rtems/options.inl + * + * This file contains the static inline implementation of the inlined + * routines from the Options Handler. + */ + +/* COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_OPTIONS_H +# error "Never use <rtems/rtems/options.inl> directly; include <rtems/rtems/options.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_OPTIONS_INL +#define _RTEMS_RTEMS_OPTIONS_INL + +#include <rtems/score/basedefs.h> /* RTEMS_INLINE_ROUTINE */ + +/** + * @addtogroup ClassicOptions + * @{ + */ + +/** + * @brief Options_Is_no_wait + * + * This function returns TRUE if the RTEMS_NO_WAIT option is enabled in + * option_set, and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Options_Is_no_wait ( + rtems_option option_set +) +{ + return (option_set & RTEMS_NO_WAIT) ? true : false; +} + +/** + * @brief Options_Is_any + * + * This function returns TRUE if the RTEMS_EVENT_ANY option is enabled in + * OPTION_SET, and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Options_Is_any ( + rtems_option option_set +) +{ + return (option_set & RTEMS_EVENT_ANY) ? true : false; +} + +/**@}*/ + +#endif +/* end of include file */ diff --git a/cpukit/rtems/inline/rtems/rtems/part.inl b/cpukit/rtems/inline/rtems/rtems/part.inl new file mode 100644 index 0000000000..eb10dc4e58 --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/part.inl @@ -0,0 +1,175 @@ +/** + * @file rtems/rtems/part.inl + * + * This file contains the macro implementation of all inlined routines + * in the Partition Manager. + */ + +/* COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_PART_H +# error "Never use <rtems/rtems/part.inl> directly; include <rtems/rtems/part.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_PART_INL +#define _RTEMS_RTEMS_PART_INL + +/** + * @addtogroup ClassicPart + * @{ + */ + +/** + * @brief Partition_Allocate_buffer + * + * This function attempts to allocate a buffer from the_partition. + * If successful, it returns the address of the allocated buffer. + * Otherwise, it returns NULL. + */ +RTEMS_INLINE_ROUTINE void *_Partition_Allocate_buffer ( + Partition_Control *the_partition +) +{ + return _Chain_Get( &the_partition->Memory ); +} + +/** + * @brief Partition_Free_buffer + * + * This routine frees the_buffer to the_partition. + */ +RTEMS_INLINE_ROUTINE void _Partition_Free_buffer ( + Partition_Control *the_partition, + Chain_Node *the_buffer +) +{ + _Chain_Append( &the_partition->Memory, the_buffer ); +} + +/** + * @brief Partition_Is_buffer_on_boundary + * + * This function returns TRUE if the_buffer is on a valid buffer + * boundary for the_partition, and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Partition_Is_buffer_on_boundary ( + void *the_buffer, + Partition_Control *the_partition +) +{ + uint32_t offset; + + offset = (uint32_t) _Addresses_Subtract( + the_buffer, + the_partition->starting_address + ); + + return ((offset % the_partition->buffer_size) == 0); +} + +/** + * @brief Partition_Is_buffer_valid + * + * This function returns TRUE if the_buffer is a valid buffer from + * the_partition, otherwise FALSE is returned. + */ +RTEMS_INLINE_ROUTINE bool _Partition_Is_buffer_valid ( + Chain_Node *the_buffer, + Partition_Control *the_partition +) +{ + void *starting; + void *ending; + + starting = the_partition->starting_address; + ending = _Addresses_Add_offset( starting, the_partition->length ); + + return ( + _Addresses_Is_in_range( the_buffer, starting, ending ) && + _Partition_Is_buffer_on_boundary( the_buffer, the_partition ) + ); +} + +/** + * @brief Partition_Is_buffer_size_aligned + * + * This function returns TRUE if the use of the specified buffer_size + * will result in the allocation of buffers whose first byte is + * properly aligned, and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Partition_Is_buffer_size_aligned ( + uint32_t buffer_size +) +{ + return ((buffer_size % CPU_PARTITION_ALIGNMENT) == 0); +} + +/** + * @brief Partition_Allocate + * + * This function allocates a partition control block from + * the inactive chain of free partition control blocks. + */ +RTEMS_INLINE_ROUTINE Partition_Control *_Partition_Allocate ( void ) +{ + return (Partition_Control *) _Objects_Allocate( &_Partition_Information ); +} + +/** + * @brief Partition_Free + * + * This routine frees a partition control block to the + * inactive chain of free partition control blocks. + */ +RTEMS_INLINE_ROUTINE void _Partition_Free ( + Partition_Control *the_partition +) +{ + _Objects_Free( &_Partition_Information, &the_partition->Object ); +} + +/** + * @brief Partition_Get + * + * This function maps partition IDs to partition control blocks. + * If ID corresponds to a local partition, then it returns + * the_partition control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. If the partition ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the_partition is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the_partition is undefined. + */ +RTEMS_INLINE_ROUTINE Partition_Control *_Partition_Get ( + Objects_Id id, + Objects_Locations *location +) +{ + return (Partition_Control *) + _Objects_Get( &_Partition_Information, id, location ); +} + +/** + * @brief Partition_Is_null + * + * This function returns TRUE if the_partition is NULL + * and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Partition_Is_null ( + Partition_Control *the_partition +) +{ + return ( the_partition == NULL ); +} + +/**@}*/ + +#endif +/* end of include file */ diff --git a/cpukit/rtems/inline/rtems/rtems/ratemon.inl b/cpukit/rtems/inline/rtems/rtems/ratemon.inl new file mode 100644 index 0000000000..2e8964faa1 --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/ratemon.inl @@ -0,0 +1,127 @@ +/** + * @file rtems/rtems/ratemon.inl + * + * This file contains the static inline implementation of the inlined + * routines in the Rate Monotonic Manager. + */ + +/* COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_RATEMON_H +# error "Never use <rtems/rtems/ratemon.inl> directly; include <rtems/rtems/ratemon.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_RATEMON_INL +#define _RTEMS_RTEMS_RATEMON_INL + +/** + * @addtogroup ClassicRateMon + * @{ + */ + +/** + * @brief Rate_monotonic_Allocate + * + * This function allocates a period control block from + * the inactive chain of free period control blocks. + */ +RTEMS_INLINE_ROUTINE Rate_monotonic_Control *_Rate_monotonic_Allocate( void ) +{ + return (Rate_monotonic_Control *) + _Objects_Allocate( &_Rate_monotonic_Information ); +} + +/** + * @brief Rate_monotonic_Free + * + * This routine allocates a period control block from + * the inactive chain of free period control blocks. + */ +RTEMS_INLINE_ROUTINE void _Rate_monotonic_Free ( + Rate_monotonic_Control *the_period +) +{ + _Objects_Free( &_Rate_monotonic_Information, &the_period->Object ); +} + +/** + * @brief Rate_monotonic_Get + * + * This function maps period IDs to period control blocks. + * If ID corresponds to a local period, then it returns + * the_period control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. Otherwise, location is set + * to OBJECTS_ERROR and the_period is undefined. + */ +RTEMS_INLINE_ROUTINE Rate_monotonic_Control *_Rate_monotonic_Get ( + Objects_Id id, + Objects_Locations *location +) +{ + return (Rate_monotonic_Control *) + _Objects_Get( &_Rate_monotonic_Information, id, location ); +} + +/** + * @brief Rate_monotonic_Is_active + * + * This function returns TRUE if the_period is in the ACTIVE state, + * and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Rate_monotonic_Is_active ( + Rate_monotonic_Control *the_period +) +{ + return (the_period->state == RATE_MONOTONIC_ACTIVE); +} + +/** + * @brief Rate_monotonic_Is_inactive + * + * This function returns TRUE if the_period is in the ACTIVE state, + * and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Rate_monotonic_Is_inactive ( + Rate_monotonic_Control *the_period +) +{ + return (the_period->state == RATE_MONOTONIC_INACTIVE); +} + +/** + * @brief Rate_monotonic_Is_expired + * + * This function returns TRUE if the_period is in the EXPIRED state, + * and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Rate_monotonic_Is_expired ( + Rate_monotonic_Control *the_period +) +{ + return (the_period->state == RATE_MONOTONIC_EXPIRED); +} + +/** + * @brief Rate_monotonic_Is_null + * + * This function returns TRUE if the_period is NULL and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Rate_monotonic_Is_null ( + Rate_monotonic_Control *the_period +) +{ + return (the_period == NULL); +} + +/**@}*/ + +#endif +/* end of include file */ diff --git a/cpukit/rtems/inline/rtems/rtems/region.inl b/cpukit/rtems/inline/rtems/rtems/region.inl new file mode 100644 index 0000000000..e70891378d --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/region.inl @@ -0,0 +1,115 @@ +/** + * @file rtems/rtems/region.inl + * + * This file contains the macro implementation of the inlined + * routines from the Region Manager. + */ + +/* COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_REGION_H +# error "Never use <rtems/rtems/region.inl> directly; include <rtems/rtems/region.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_REGION_INL +#define _RTEMS_RTEMS_REGION_INL + +/** + * @addtogroup ClassicRegion + * @{ + */ + +/** + * @brief Region_Allocate + * + * This function allocates a region control block from + * the inactive chain of free region control blocks. + */ +RTEMS_INLINE_ROUTINE Region_Control *_Region_Allocate( void ) +{ + return (Region_Control *) _Objects_Allocate( &_Region_Information ); +} + +/** + * @brief Region_Free + * + * This routine frees a region control block to the + * inactive chain of free region control blocks. + */ +RTEMS_INLINE_ROUTINE void _Region_Free ( + Region_Control *the_region +) +{ + _Objects_Free( &_Region_Information, &the_region->Object ); +} + +/** + * @brief Region_Get + * + * This function maps region IDs to region control blocks. + * If ID corresponds to a local region, then it returns + * the_region control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. Otherwise, location is set + * to OBJECTS_ERROR and the_region is undefined. + */ +RTEMS_INLINE_ROUTINE Region_Control *_Region_Get ( + Objects_Id id, + Objects_Locations *location +) +{ + return (Region_Control *) + _Objects_Get_no_protection( &_Region_Information, id, location ); +} + +/** + * @brief Region_Allocate_segment + * + * This function attempts to allocate a segment from the_region. + * If successful, it returns the address of the allocated segment. + * Otherwise, it returns NULL. + */ +RTEMS_INLINE_ROUTINE void *_Region_Allocate_segment ( + Region_Control *the_region, + uintptr_t size +) +{ + return _Heap_Allocate( &the_region->Memory, size ); +} + +/** + * @brief Region_Free_segment + * + * This function frees the_segment to the_region. + */ +RTEMS_INLINE_ROUTINE bool _Region_Free_segment ( + Region_Control *the_region, + void *the_segment +) +{ + return _Heap_Free( &the_region->Memory, the_segment ); +} + +/** + * @brief Region_Is_null + * + * This function returns TRUE if the_region is NULL and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Region_Is_null ( + Region_Control *the_region +) +{ + return ( the_region == NULL ); +} + +/**@}*/ + +#endif +/* end of include file */ diff --git a/cpukit/rtems/inline/rtems/rtems/sem.inl b/cpukit/rtems/inline/rtems/rtems/sem.inl new file mode 100644 index 0000000000..de876d896a --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/sem.inl @@ -0,0 +1,110 @@ +/** + * @file rtems/rtems/sem.inl + * + * This file contains the static inlin implementation of the inlined + * routines from the Semaphore Manager. + */ + +/* COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_SEM_H +# error "Never use <rtems/rtems/sem.inl> directly; include <rtems/rtems/sem.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_SEM_INL +#define _RTEMS_RTEMS_SEM_INL + +/** + * @addtogroup ClassicSem + * @{ + */ + +/** + * @brief Semaphore_Allocate + * + * This function allocates a semaphore control block from + * the inactive chain of free semaphore control blocks. + */ +RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Allocate( void ) +{ + return (Semaphore_Control *) _Objects_Allocate( &_Semaphore_Information ); +} + +/** + * @brief Semaphore_Free + * + * This routine frees a semaphore control block to the + * inactive chain of free semaphore control blocks. + */ +RTEMS_INLINE_ROUTINE void _Semaphore_Free ( + Semaphore_Control *the_semaphore +) +{ + _Objects_Free( &_Semaphore_Information, &the_semaphore->Object ); +} + +/** + * @brief Semaphore_Get + * + * This function maps semaphore IDs to semaphore control blocks. + * If ID corresponds to a local semaphore, then it returns + * the_semaphore control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the semaphore ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the_semaphore is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the_semaphore is undefined. + */ +RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Get ( + Objects_Id id, + Objects_Locations *location +) +{ + return (Semaphore_Control *) + _Objects_Get( &_Semaphore_Information, id, location ); +} + +/** + * @brief Semaphore_Get (Interrupts disabled) + * + * This function maps semaphore IDs to semaphore control blocks. + * If ID corresponds to a local semaphore, then it returns + * the_semaphore control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the semaphore ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the_semaphore is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the_semaphore is undefined. + */ +RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Get_interrupt_disable ( + Objects_Id id, + Objects_Locations *location, + ISR_Level *level +) +{ + return (Semaphore_Control *) + _Objects_Get_isr_disable( &_Semaphore_Information, id, location, level ); +} + +/** + * @brief Semaphore_Is_null + * + * This function returns TRUE if the_semaphore is NULL and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Semaphore_Is_null ( + Semaphore_Control *the_semaphore +) +{ + return ( the_semaphore == NULL ); +} + +/**@}*/ + +#endif +/* end of include file */ diff --git a/cpukit/rtems/inline/rtems/rtems/status.inl b/cpukit/rtems/inline/rtems/rtems/status.inl new file mode 100644 index 0000000000..a518c102f3 --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/status.inl @@ -0,0 +1,62 @@ +/** + * @file rtems/rtems/status.inl + * + * This include file contains the implementations of the inlined + * routines for the status package. + */ + +/* COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_STATUS_H +# error "Never use <rtems/rtems/status.inl> directly; include <rtems/rtems/status.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_STATUS_INL +#define _RTEMS_RTEMS_STATUS_INL + +#include <rtems/score/basedefs.h> + +/** + * @addtogroup ClassicStatus + * @{ + */ + +/** + * @brief rtems_is_status_successful + * + * This function returns TRUE if the status code is equal to RTEMS_SUCCESSFUL, + * and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool rtems_is_status_successful( + rtems_status_code code +) +{ + return (code == RTEMS_SUCCESSFUL); +} + +/** + * @brief rtems_are_statuses_equal + * + * This function returns TRUE if the status code1 is equal to code2, + * and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool rtems_are_statuses_equal( + rtems_status_code code1, + rtems_status_code code2 +) +{ + return (code1 == code2); +} + +/**@}*/ + +#endif +/* end of include file */ diff --git a/cpukit/rtems/inline/rtems/rtems/support.inl b/cpukit/rtems/inline/rtems/rtems/support.inl new file mode 100644 index 0000000000..bd79300e8a --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/support.inl @@ -0,0 +1,63 @@ +/** + * @file + * + * @ingroup ClassicRTEMS + * + * @brief Classic API support. + */ + +/* COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_SUPPORT_H +# error "Never use <rtems/rtems/support.inl> directly; include <rtems/rtems/support.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_SUPPORT_INL +#define _RTEMS_RTEMS_SUPPORT_INL + +/** + * @addtogroup ClassicRTEMS + * + * @{ + */ + +/** + * @brief Returns @c true if the name is valid, and @c false otherwise. + */ +RTEMS_INLINE_ROUTINE bool rtems_is_name_valid ( + rtems_name name +) +{ + return ( name != 0 ); +} + +/** + * @brief Breaks the object name into the four component characters @a c1, + * @a c2, @a c3, and @a c4. + */ +RTEMS_INLINE_ROUTINE void rtems_name_to_characters( + rtems_name name, + char *c1, + char *c2, + char *c3, + char *c4 +) +{ + *c1 = (char) ((name >> 24) & 0xff); + *c2 = (char) ((name >> 16) & 0xff); + *c3 = (char) ((name >> 8) & 0xff); + *c4 = (char) ( name & 0xff); +} + +/** @} */ + +#endif +/* end of include file */ diff --git a/cpukit/rtems/inline/rtems/rtems/tasks.inl b/cpukit/rtems/inline/rtems/rtems/tasks.inl new file mode 100644 index 0000000000..e0fe241d45 --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/tasks.inl @@ -0,0 +1,86 @@ +/** + * @file rtems/rtems/tasks.inl + * + * This file contains the static inline implementation of all inlined + * routines in the with RTEMS Tasks Manager. + */ + +/* COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_TASKS_H +# error "Never use <rtems/rtems/tasks.inl> directly; include <rtems/rtems/tasks.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_TASKS_INL +#define _RTEMS_RTEMS_TASKS_INL + +/** + * @addtogroup ClassicTasks + * @{ + */ + +/** + * @brief RTEMS_tasks_Allocate + * + * This function allocates a task control block from + * the inactive chain of free task control blocks. + */ +RTEMS_INLINE_ROUTINE Thread_Control *_RTEMS_tasks_Allocate( void ) +{ + return (Thread_Control *) _Objects_Allocate( &_RTEMS_tasks_Information ); +} + +/** + * @brief RTEMS_tasks_Free + * + * This routine frees a task control block to the + * inactive chain of free task control blocks. + */ +RTEMS_INLINE_ROUTINE void _RTEMS_tasks_Free ( + Thread_Control *the_task +) +{ + _Objects_Free( + _Objects_Get_information_id( the_task->Object.id ), + &the_task->Object + ); +} + +/** + * @brief RTEMS_tasks_Priority_to_Core + * + * This function converts an RTEMS API priority into a core priority. + */ +RTEMS_INLINE_ROUTINE Priority_Control _RTEMS_tasks_Priority_to_Core( + rtems_task_priority priority +) +{ + return (Priority_Control) priority; +} + +/** + * @brief RTEMS_tasks_Priority_is_valid + * + * This function returns TRUE if the_priority is a valid user task priority + * and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _RTEMS_tasks_Priority_is_valid ( + rtems_task_priority the_priority +) +{ + return ( ( the_priority >= RTEMS_MINIMUM_PRIORITY ) && + ( the_priority <= RTEMS_MAXIMUM_PRIORITY ) ); +} + +/**@}*/ + +#endif +/* end of include file */ diff --git a/cpukit/rtems/inline/rtems/rtems/timer.inl b/cpukit/rtems/inline/rtems/rtems/timer.inl new file mode 100644 index 0000000000..10cae3f67d --- /dev/null +++ b/cpukit/rtems/inline/rtems/rtems/timer.inl @@ -0,0 +1,126 @@ +/** + * @file rtems/rtems/timer.inl + * + * This file contains the static inline implementation of the inlined routines + * from the Timer Manager. + */ + +/* COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifndef _RTEMS_RTEMS_TIMER_H +# error "Never use <rtems/rtems/timer.inl> directly; include <rtems/rtems/timer.h> instead." +#endif + +#ifndef _RTEMS_RTEMS_TIMER_INL +#define _RTEMS_RTEMS_TIMER_INL + +/** + * @addtogroup ClassicTimer + * @{ + */ + +/** + * @brief Timer_Allocate + * + * This function allocates a timer control block from + * the inactive chain of free timer control blocks. + */ +RTEMS_INLINE_ROUTINE Timer_Control *_Timer_Allocate( void ) +{ + return (Timer_Control *) _Objects_Allocate( &_Timer_Information ); +} + +/** + * @brief Timer_Free + * + * This routine frees a timer control block to the + * inactive chain of free timer control blocks. + */ +RTEMS_INLINE_ROUTINE void _Timer_Free ( + Timer_Control *the_timer +) +{ + _Objects_Free( &_Timer_Information, &the_timer->Object ); +} + +/** + * @brief Timer_Get + * + * This function maps timer IDs to timer control blocks. + * If ID corresponds to a local timer, then it returns + * the timer control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. Otherwise, location is set + * to OBJECTS_ERROR and the returned value is undefined. + */ +RTEMS_INLINE_ROUTINE Timer_Control *_Timer_Get ( + Objects_Id id, + Objects_Locations *location +) +{ + return (Timer_Control *) + _Objects_Get( &_Timer_Information, id, location ); +} + +/** + * @brief Timer_Is_interval_class + * + * This function returns TRUE if the class is that of an INTERVAL + * timer, and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Timer_Is_interval_class ( + Timer_Classes the_class +) +{ + return (the_class == TIMER_INTERVAL) || (the_class == TIMER_INTERVAL_ON_TASK); +} + +/** + * @brief Timer_Is_time_of_day_class + * + * This function returns TRUE if the class is that of an INTERVAL + * timer, and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Timer_Is_timer_of_day_class ( + Timer_Classes the_class +) +{ + return ( the_class == TIMER_TIME_OF_DAY ); +} + +/** + * @brief Timer_Is_dormant_class + * + * This function returns TRUE if the class is that of a DORMANT + * timer, and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Timer_Is_dormant_class ( + Timer_Classes the_class +) +{ + return ( the_class == TIMER_DORMANT ); +} + +/** + * @brief Timer_Is_null + * + * This function returns TRUE if the_timer is NULL and FALSE otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Timer_Is_null ( + Timer_Control *the_timer +) +{ + return ( the_timer == NULL ); +} + +/**@}*/ + +#endif +/* end of include file */ |