Changeset 3d1e8ba in rtems


Ignore:
Timestamp:
Mar 8, 2007, 9:41:46 PM (13 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
8583f82
Parents:
9bacef80
Message:

2007-03-08 Joel Sherrill <joel@…>

  • rtems/Makefile.am, rtems/src/msgqsend.c, rtems/src/msgqurgent.c: Remove wrapper for message queue send and urgent and implement them directly. There was an unnecessary function call layer in addition to conditions in the shared routine. Directly coding both directives is simpler and should result in smaller code.
  • rtems/src/msgqsubmit.c: Removed.
Location:
cpukit
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r9bacef80 r3d1e8ba  
     12007-03-08      Joel Sherrill <joel@OARcorp.com>
     2
     3        * rtems/Makefile.am, rtems/src/msgqsend.c, rtems/src/msgqurgent.c:
     4        Remove wrapper for message queue send and urgent and implement them
     5        directly. There was an unnecessary function call layer in addition to
     6        conditions in the shared routine. Directly coding both directives is
     7        simpler and should result in smaller code.
     8        * rtems/src/msgqsubmit.c: Removed.
     9
    1102007-03-05      Joel Sherrill <joel@OARcorp.com>
    211
  • cpukit/rtems/Makefile.am

    r9bacef80 r3d1e8ba  
    9090    src/msgqcreate.c src/msgqdelete.c src/msgqflush.c \
    9191    src/msgqgetnumberpending.c src/msgqident.c src/msgqreceive.c \
    92     src/msgqsend.c src/msgqsubmit.c src/msgqtranslatereturncode.c \
    93     src/msgqurgent.c
     92    src/msgqsend.c c src/msgqtranslatereturncode.c src/msgqurgent.c
    9493
    9594## SEMAPHORE_C_FILES
  • cpukit/rtems/src/msgqsend.c

    r9bacef80 r3d1e8ba  
    11/*
    2  *  Message Queue Manager
     2 *  Message Queue Manager - rtems_message_queue_send
    33 *
    4  *
    5  *  COPYRIGHT (c) 1989-1999.
     4 *  COPYRIGHT (c) 1989-2007.
    65 *  On-Line Applications Research Corporation (OAR).
    76 *
     
    3534#include <rtems/rtems/support.h>
    3635
    37 /*PAGE
     36/*
    3837 *
    3938 *  rtems_message_queue_send
    4039 *
    41  *  This routine implements the directives q_send.  It sends a
     40 *  This routine implements the directive rtems_message_queue_sent.  It sends a
    4241 *  message to the specified message queue.
    4342 *
     
    5251 */
    5352
     53#if defined(RTEMS_MULTIPROCESSING)
     54#define MESSAGE_QUEUE_MP_HANDLER _Message_queue_Core_message_queue_mp_support
     55#else
     56#define MESSAGE_QUEUE_MP_HANDLER NULL
     57#endif
     58
    5459rtems_status_code rtems_message_queue_send(
    5560  Objects_Id            id,
     
    5863)
    5964{
    60   return( _Message_queue_Submit(id, buffer, size, MESSAGE_QUEUE_SEND_REQUEST) );
     65  register Message_queue_Control  *the_message_queue;
     66  Objects_Locations                location;
     67  CORE_message_queue_Status        status;
     68
     69  if ( !buffer )
     70    return RTEMS_INVALID_ADDRESS;
     71
     72  the_message_queue = _Message_queue_Get( id, &location );
     73  switch ( location )
     74  {
     75    case OBJECTS_REMOTE:
     76#if defined(RTEMS_MULTIPROCESSING)
     77      return _Message_queue_MP_Send_request_packet(
     78        MESSAGE_QUEUE_MP_SEND_REQUEST,
     79        id,
     80        buffer,
     81        &size,
     82        0,                               /* option_set */
     83        MPCI_DEFAULT_TIMEOUT
     84      );
     85      break;
     86#endif
     87
     88    case OBJECTS_ERROR:
     89      return RTEMS_INVALID_ID;
     90
     91    case OBJECTS_LOCAL:
     92      status = _CORE_message_queue_Send(
     93        &the_message_queue->message_queue,
     94        buffer,
     95        size,
     96        id,
     97        MESSAGE_QUEUE_MP_HANDLER,
     98        FALSE,   /* sender does not block */
     99        0        /* no timeout */
     100      );
     101
     102      _Thread_Enable_dispatch();
     103
     104      /*
     105       *  Since this API does not allow for blocking sends, we can directly
     106       *  return the returned status.
     107       */
     108
     109      return _Message_queue_Translate_core_message_queue_return_code(status);
     110
     111  }
     112  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    61113}
  • cpukit/rtems/src/msgqurgent.c

    r9bacef80 r3d1e8ba  
    11/*
    2  *  Message Queue Manager
     2 *  Message Queue Manager - rtems_message_queue_urgent
    33 *
    4  *
    5  *  COPYRIGHT (c) 1989-1999.
     4 *  COPYRIGHT (c) 1989-2007.
    65 *  On-Line Applications Research Corporation (OAR).
    76 *
     
    3938 *  rtems_message_queue_urgent
    4039 *
    41  *  This routine implements the directives q_urgent.  It urgents a
    42  *  message to the specified message queue.
     40 *  This routine implements the directives rtems_message_queue_urgent.  It
     41 *  prepends a message to the specified message queue.
    4342 *
    4443 *  Input parameters:
     
    5251 */
    5352
     53#if defined(RTEMS_MULTIPROCESSING)
     54#define MESSAGE_QUEUE_MP_HANDLER _Message_queue_Core_message_queue_mp_support
     55#else
     56#define MESSAGE_QUEUE_MP_HANDLER NULL
     57#endif
     58
    5459rtems_status_code rtems_message_queue_urgent(
    5560  Objects_Id            id,
     
    5863)
    5964{
    60   return(_Message_queue_Submit(id, buffer, size, MESSAGE_QUEUE_URGENT_REQUEST));
     65  register Message_queue_Control  *the_message_queue;
     66  Objects_Locations                location;
     67  CORE_message_queue_Status        status;
     68
     69  if ( !buffer )
     70    return RTEMS_INVALID_ADDRESS;
     71
     72  the_message_queue = _Message_queue_Get( id, &location );
     73  switch ( location )
     74  {
     75    case OBJECTS_REMOTE:
     76#if defined(RTEMS_MULTIPROCESSING)
     77      return _Message_queue_MP_Send_request_packet(
     78        MESSAGE_QUEUE_MP_URGENT_REQUEST,
     79        id,
     80        buffer,
     81        &size,
     82        0,                               /* option_set */
     83        MPCI_DEFAULT_TIMEOUT
     84      );
     85#endif
     86
     87    case OBJECTS_ERROR:
     88      return RTEMS_INVALID_ID;
     89
     90    case OBJECTS_LOCAL:
     91      status = _CORE_message_queue_Urgent(
     92        &the_message_queue->message_queue,
     93        buffer,
     94        size,
     95        id,
     96        MESSAGE_QUEUE_MP_HANDLER,
     97        FALSE,   /* sender does not block */
     98        0        /* no timeout */
     99      );
     100      _Thread_Enable_dispatch();
     101
     102      /*
     103       *  Since this API does not allow for blocking sends, we can directly
     104       *  return the returned status.
     105       */
     106
     107      return _Message_queue_Translate_core_message_queue_return_code(status);
     108
     109  }
     110  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    61111}
Note: See TracChangeset for help on using the changeset viewer.