From 939ba8162fd32d4ce918b0b994adda8511641364 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Sun, 13 Sep 2009 16:05:14 +0000 Subject: 2009-09-13 Joel Sherrill * score/inline/rtems/score/coremsg.inl, score/src/coremsg.c, score/src/coremsgbroadcast.c, score/src/coremsginsert.c, score/src/coremsgseize.c, score/src/coremsgsubmit.c: Add wrappers for accessing message priority. Since these are empty when priority-based message queues are disabled, this eliminates some of the conditionals. --- cpukit/score/inline/rtems/score/coremsg.inl | 64 +++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 16 deletions(-) (limited to 'cpukit/score/inline/rtems/score/coremsg.inl') diff --git a/cpukit/score/inline/rtems/score/coremsg.inl b/cpukit/score/inline/rtems/score/coremsg.inl index bd961b3957..dd53865aa7 100644 --- a/cpukit/score/inline/rtems/score/coremsg.inl +++ b/cpukit/score/inline/rtems/score/coremsg.inl @@ -119,13 +119,44 @@ _CORE_message_queue_Allocate_message_buffer ( * message buffer chain. */ RTEMS_INLINE_ROUTINE void _CORE_message_queue_Free_message_buffer ( - CORE_message_queue_Control *the_message_queue, - CORE_message_queue_Buffer_control *the_message + CORE_message_queue_Control *the_message_queue, + CORE_message_queue_Buffer_control *the_message ) { _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node ); } +/** + * This function returns the priority of @a the_message. + * + * NOTE: It encapsulates the optional behavior that message priority is + * disabled if no API requires it. + */ +RTEMS_INLINE_ROUTINE int _CORE_message_queue_Get_message_priority ( + CORE_message_queue_Buffer_control *the_message +) +{ + #if defined(RTEMS_SCORE_COREMSG_ENABLE_MESSAGE_PRIORITY) + return the_message->priority; + #else + return 0; + #endif +} + +/** + * This function sets the priority of @a the_message. + * + * NOTE: It encapsulates the optional behavior that message priority is + * disabled if no API requires it. + */ +RTEMS_INLINE_ROUTINE void _CORE_message_queue_Set_message_priority ( + CORE_message_queue_Buffer_control *the_message, + int priority +) +{ + the_message->priority = priority; +} + /** * This function removes the first message from the_message_queue * and returns a pointer to it. @@ -202,22 +233,23 @@ RTEMS_INLINE_ROUTINE bool _CORE_message_queue_Is_null ( { return (the_message_queue->notify_handler != NULL); } +#endif - /** - * This routine initializes the notification information for - * @a the_message_queue. - */ - - RTEMS_INLINE_ROUTINE void _CORE_message_queue_Set_notify ( - CORE_message_queue_Control *the_message_queue, - CORE_message_queue_Notify_Handler the_handler, - void *the_argument - ) - { - the_message_queue->notify_handler = the_handler; - the_message_queue->notify_argument = the_argument; - } +/** + * This routine initializes the notification information for + * @a the_message_queue. + */ +RTEMS_INLINE_ROUTINE void _CORE_message_queue_Set_notify ( + CORE_message_queue_Control *the_message_queue, + CORE_message_queue_Notify_Handler the_handler, + void *the_argument +) +{ +#if defined(RTEMS_SCORE_COREMSG_ENABLE_NOTIFICATION) + the_message_queue->notify_handler = the_handler; + the_message_queue->notify_argument = the_argument; #endif +} /**@}*/ -- cgit v1.2.3