Changeset 641b44c in rtems


Ignore:
Timestamp:
May 20, 2016, 12:21:12 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
62c528e6
Parents:
0a00b2b
git-author:
Sebastian Huber <sebastian.huber@…> (05/20/16 12:21:12)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/20/16 14:16:59)
Message:

rtems: _Message_queue_Get_interrupt_disable()

Use _Objects_Get_local() for _Message_queue_Get_interrupt_disable() to
get rid of the location parameter. Move remote object handling to
message queue MPCI support.

Location:
cpukit/rtems
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/include/rtems/rtems/messageimpl.h

    r0a00b2b r641b44c  
    105105_Message_queue_Get_interrupt_disable(
    106106  Objects_Id         id,
    107   Objects_Locations *location,
    108107  ISR_lock_Context  *lock_context
    109108)
    110109{
    111   return (Message_queue_Control *) _Objects_Get_isr_disable(
    112     &_Message_queue_Information,
     110  return (Message_queue_Control *) _Objects_Get_local(
    113111    id,
    114     location,
    115     lock_context
     112    lock_context,
     113    &_Message_queue_Information
    116114  );
    117115}
  • cpukit/rtems/include/rtems/rtems/msgmp.h

    r0a00b2b r641b44c  
    8080  offsetof(Message_queue_MP_Packet, Buffer.buffer)
    8181
     82RTEMS_INLINE_ROUTINE bool _Message_queue_MP_Is_remote( Objects_Id id )
     83{
     84  return _Objects_MP_Is_remote( id, &_Message_queue_Information );
     85}
     86
    8287/**
    8388 *  @brief Message_queue_Core_message_queue_mp_support
     
    108113
    109114/**
    110  *  @brief _Message_queue_MP_Send_request_packet
    111  *
    112  *  This routine performs a remote procedure call so that a
    113  *  directive operation can be initiated on another node.
    114  */
    115 rtems_status_code _Message_queue_MP_Send_request_packet (
    116   Message_queue_MP_Remote_operations  operation,
    117   Objects_Id                          message_queue_id,
    118   const void                         *buffer,
    119   size_t                             *size_p,
    120   rtems_option                        option_set,
    121   rtems_interval                      timeout
     115 * @brief Issues a remote rtems_message_queue_broadcast() request.
     116 */
     117rtems_status_code _Message_queue_MP_Broadcast(
     118  rtems_id    id,
     119  const void *buffer,
     120  size_t      size,
     121  uint32_t   *count
     122);
     123
     124/**
     125 * @brief Issues a remote rtems_message_queue_flush() request.
     126 */
     127rtems_status_code _Message_queue_MP_Flush(
     128  rtems_id  id,
     129  uint32_t *count
     130);
     131
     132/**
     133 * @brief Issues a remote rtems_message_queue_get_number_pending() request.
     134 */
     135rtems_status_code _Message_queue_MP_Get_number_pending(
     136  rtems_id  id,
     137  uint32_t *count
     138);
     139
     140/**
     141 * @brief Issues a remote rtems_message_queue_receive() request.
     142 */
     143rtems_status_code _Message_queue_MP_Receive(
     144  rtems_id        id,
     145  void           *buffer,
     146  size_t         *size,
     147  rtems_option    option_set,
     148  rtems_interval  timeout
     149);
     150
     151/**
     152 * @brief Issues a remote rtems_message_queue_send() request.
     153 */
     154rtems_status_code _Message_queue_MP_Send(
     155  rtems_id    id,
     156  const void *buffer,
     157  size_t      size
     158);
     159
     160/**
     161 * @brief Issues a remote rtems_message_queue_urgent() request.
     162 */
     163rtems_status_code _Message_queue_MP_Urgent(
     164  rtems_id    id,
     165  const void *buffer,
     166  size_t      size
    122167);
    123168
  • cpukit/rtems/src/msgmp.c

    r0a00b2b r641b44c  
    9696 */
    9797
    98 rtems_status_code _Message_queue_MP_Send_request_packet (
    99   Message_queue_MP_Remote_operations  operation,
     98static rtems_status_code _Message_queue_MP_Send_request_packet (
    10099  Objects_Id                          message_queue_id,
    101100  const void                         *buffer,
    102101  size_t                             *size_p,
    103102  rtems_option                        option_set,
    104   rtems_interval                      timeout
     103  rtems_interval                      timeout,
     104  Message_queue_MP_Remote_operations  operation
    105105)
    106106{
    107107  Message_queue_MP_Packet *the_packet;
     108
     109  if ( !_Message_queue_MP_Is_remote( message_queue_id ) ) {
     110    return RTEMS_INVALID_ID;
     111  }
    108112
    109113  switch ( operation ) {
     
    201205}
    202206
     207rtems_status_code _Message_queue_MP_Broadcast(
     208  rtems_id    id,
     209  const void *buffer,
     210  size_t      size,
     211  uint32_t   *count
     212)
     213{
     214  _Thread_Get_executing()->Wait.return_argument = count;
     215  return _Message_queue_MP_Send_request_packet(
     216    id,
     217    buffer,
     218    &size,
     219    0,
     220    MPCI_DEFAULT_TIMEOUT,
     221    MESSAGE_QUEUE_MP_BROADCAST_REQUEST
     222  );
     223}
     224
     225rtems_status_code _Message_queue_MP_Flush(
     226  rtems_id  id,
     227  uint32_t *count
     228)
     229{
     230  _Thread_Get_executing()->Wait.return_argument = count;
     231  return _Message_queue_MP_Send_request_packet(
     232    id,
     233    NULL,
     234    NULL,
     235    0,
     236    MPCI_DEFAULT_TIMEOUT,
     237    MESSAGE_QUEUE_MP_FLUSH_REQUEST
     238  );
     239}
     240
     241rtems_status_code _Message_queue_MP_Get_number_pending(
     242  rtems_id  id,
     243  uint32_t *count
     244)
     245{
     246  _Thread_Get_executing()->Wait.return_argument = count;
     247  return _Message_queue_MP_Send_request_packet(
     248    id,
     249    NULL,
     250    NULL,
     251    0,
     252    MPCI_DEFAULT_TIMEOUT,
     253    MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST
     254  );
     255}
     256
     257rtems_status_code _Message_queue_MP_Receive(
     258  rtems_id        id,
     259  void           *buffer,
     260  size_t         *size,
     261  rtems_option    option_set,
     262  rtems_interval  timeout
     263)
     264{
     265  return _Message_queue_MP_Send_request_packet(
     266    id,
     267    buffer,
     268    size,
     269    option_set,
     270    timeout,
     271    MESSAGE_QUEUE_MP_RECEIVE_REQUEST
     272  );
     273}
     274
     275rtems_status_code _Message_queue_MP_Send(
     276  rtems_id    id,
     277  const void *buffer,
     278  size_t      size
     279)
     280{
     281  return _Message_queue_MP_Send_request_packet(
     282    id,
     283    buffer,
     284    &size,
     285    0,
     286    MPCI_DEFAULT_TIMEOUT,
     287    MESSAGE_QUEUE_MP_SEND_REQUEST
     288  );
     289}
     290
     291rtems_status_code _Message_queue_MP_Urgent(
     292  rtems_id    id,
     293  const void *buffer,
     294  size_t      size
     295)
     296{
     297  return _Message_queue_MP_Send_request_packet(
     298    id,
     299    buffer,
     300    &size,
     301    0,
     302    MPCI_DEFAULT_TIMEOUT,
     303    MESSAGE_QUEUE_MP_URGENT_REQUEST
     304  );
     305}
     306
    203307/*
    204308 *  _Message_queue_MP_Send_response_packet
  • cpukit/rtems/src/msgqbroadcast.c

    r0a00b2b r641b44c  
    1919#endif
    2020
    21 #include <rtems/system.h>
    22 #include <rtems/score/chain.h>
    23 #include <rtems/score/isr.h>
    24 #include <rtems/score/coremsgimpl.h>
    25 #include <rtems/score/thread.h>
    26 #include <rtems/score/wkspace.h>
    27 #include <rtems/rtems/status.h>
    28 #include <rtems/rtems/attrimpl.h>
    2921#include <rtems/rtems/messageimpl.h>
    30 #include <rtems/rtems/options.h>
    31 #include <rtems/rtems/support.h>
    3222
    3323rtems_status_code rtems_message_queue_broadcast(
     
    3828)
    3929{
    40   Message_queue_Control          *the_message_queue;
    41   Objects_Locations               location;
    42   CORE_message_queue_Status       core_status;
    43   ISR_lock_Context                lock_context;
     30  Message_queue_Control     *the_message_queue;
     31  ISR_lock_Context           lock_context;
     32  CORE_message_queue_Status  status;
    4433
    45   if ( !buffer )
     34  if ( buffer == NULL ) {
    4635    return RTEMS_INVALID_ADDRESS;
     36  }
    4737
    48   if ( !count )
     38  if ( count == NULL ) {
    4939    return RTEMS_INVALID_ADDRESS;
     40  }
    5041
    5142  the_message_queue = _Message_queue_Get_interrupt_disable(
    5243    id,
    53     &location,
    5444    &lock_context
    5545  );
    56   switch ( location ) {
    5746
    58     case OBJECTS_LOCAL:
    59       core_status = _CORE_message_queue_Broadcast(
    60                       &the_message_queue->message_queue,
    61                       buffer,
    62                       size,
    63                       _Message_queue_Core_message_queue_mp_support,
    64                       id,
    65                       count,
    66                       &lock_context
    67                     );
    68       return
    69         _Message_queue_Translate_core_message_queue_return_code( core_status );
     47  if ( the_message_queue == NULL ) {
     48#if defined(RTEMS_MULTIPROCESSING)
     49    _Message_queue_MP_Broadcast( id, buffer, size, count );
     50#else
     51    return RTEMS_INVALID_ID;
     52#endif
     53  }
    7054
    71 #if defined(RTEMS_MULTIPROCESSING)
    72     case OBJECTS_REMOTE:
    73       _Thread_Executing->Wait.return_argument = count;
    74 
    75       return
    76         _Message_queue_MP_Send_request_packet(
    77           MESSAGE_QUEUE_MP_BROADCAST_REQUEST,
    78           id,
    79           buffer,
    80           &size,
    81           0,                               /* option_set not used */
    82           MPCI_DEFAULT_TIMEOUT
    83         );
    84 #endif
    85 
    86     case OBJECTS_ERROR:
    87       break;
    88   }
    89   return RTEMS_INVALID_ID;
     55  status = _CORE_message_queue_Broadcast(
     56    &the_message_queue->message_queue,
     57    buffer,
     58    size,
     59    _Message_queue_Core_message_queue_mp_support,
     60    id,
     61    count,
     62    &lock_context
     63  );
     64  return _Message_queue_Translate_core_message_queue_return_code( status );
    9065}
  • cpukit/rtems/src/msgqdelete.c

    r0a00b2b r641b44c  
    2626)
    2727{
    28   Message_queue_Control          *the_message_queue;
    29   Objects_Locations               location;
    30   ISR_lock_Context                lock_context;
     28  Message_queue_Control *the_message_queue;
     29  ISR_lock_Context       lock_context;
    3130
    3231  _Objects_Allocator_lock();
    33   the_message_queue = _Message_queue_Get_interrupt_disable(
    34     id,
    35     &location,
     32  the_message_queue = _Message_queue_Get_interrupt_disable( id, &lock_context );
     33
     34  if ( the_message_queue == NULL ) {
     35    _Objects_Allocator_unlock();
     36
     37#if defined(RTEMS_MULTIPROCESSING)
     38    if ( _Message_queue_MP_Is_remote( id ) ) {
     39      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
     40    }
     41#endif
     42
     43    return RTEMS_INVALID_ID;
     44  }
     45
     46  _CORE_message_queue_Acquire_critical(
     47    &the_message_queue->message_queue,
    3648    &lock_context
    3749  );
    38   switch ( location ) {
    3950
    40     case OBJECTS_LOCAL:
    41       _CORE_message_queue_Acquire_critical(
    42         &the_message_queue->message_queue,
    43         &lock_context
    44       );
     51  _Objects_Close( &_Message_queue_Information, &the_message_queue->Object );
    4552
    46       _Objects_Close( &_Message_queue_Information,
    47                       &the_message_queue->Object );
    48 
    49       _CORE_message_queue_Close(
    50         &the_message_queue->message_queue,
    51         _Message_queue_MP_Send_object_was_deleted,
    52         id,
    53         &lock_context
    54       );
     53  _CORE_message_queue_Close(
     54    &the_message_queue->message_queue,
     55    _Message_queue_MP_Send_object_was_deleted,
     56    id,
     57    &lock_context
     58  );
    5559
    5660#if defined(RTEMS_MULTIPROCESSING)
    57       if ( _Attributes_Is_global( the_message_queue->attribute_set ) ) {
    58         _Objects_MP_Close(
    59           &_Message_queue_Information,
    60           the_message_queue->Object.id
    61         );
     61  if ( _Attributes_Is_global( the_message_queue->attribute_set ) ) {
     62    _Objects_MP_Close(
     63      &_Message_queue_Information,
     64      the_message_queue->Object.id
     65    );
    6266
    63         _Message_queue_MP_Send_process_packet(
    64           MESSAGE_QUEUE_MP_ANNOUNCE_DELETE,
    65           the_message_queue->Object.id,
    66           0,                                 /* Not used */
    67           0
    68         );
    69       }
    70 #endif
    71       _Message_queue_Free( the_message_queue );
    72       _Objects_Allocator_unlock();
    73       return RTEMS_SUCCESSFUL;
    74 
    75 #if defined(RTEMS_MULTIPROCESSING)
    76     case OBJECTS_REMOTE:
    77       _Objects_Allocator_unlock();
    78       return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
     67    _Message_queue_MP_Send_process_packet(
     68      MESSAGE_QUEUE_MP_ANNOUNCE_DELETE,
     69      the_message_queue->Object.id,
     70      0,                         /* Not used */
     71      0
     72    );
     73  }
    7974#endif
    8075
    81     case OBJECTS_ERROR:
    82       break;
    83   }
    84 
     76  _Message_queue_Free( the_message_queue );
    8577  _Objects_Allocator_unlock();
    86 
    87   return RTEMS_INVALID_ID;
     78  return RTEMS_SUCCESSFUL;
    8879}
  • cpukit/rtems/src/msgqflush.c

    r0a00b2b r641b44c  
    1919#endif
    2020
    21 #include <rtems/system.h>
    22 #include <rtems/score/chain.h>
    23 #include <rtems/score/isr.h>
    24 #include <rtems/score/coremsgimpl.h>
    25 #include <rtems/score/thread.h>
    26 #include <rtems/score/wkspace.h>
    27 #include <rtems/rtems/status.h>
    28 #include <rtems/rtems/attrimpl.h>
    2921#include <rtems/rtems/messageimpl.h>
    30 #include <rtems/rtems/options.h>
    31 #include <rtems/rtems/support.h>
    32 
    33 /*
    34  *  rtems_message_queue_flush
    35  *
    36  *  This directive removes all pending messages from a queue and returns
    37  *  the number of messages removed.  If no messages were present then
    38  *  a count of zero is returned.
    39  *
    40  *  Input parameters:
    41  *    id    - queue id
    42  *    count - return area for count
    43  *
    44  *  Output parameters:
    45  *    count             - number of messages removed ( 0 = empty queue )
    46  *    RTEMS_SUCCESSFUL - if successful
    47  *    error code        - if unsuccessful
    48  */
    4922
    5023rtems_status_code rtems_message_queue_flush(
     
    5326)
    5427{
    55   Message_queue_Control          *the_message_queue;
    56   Objects_Locations               location;
    57   ISR_lock_Context                lock_context;
     28  Message_queue_Control *the_message_queue;
     29  ISR_lock_Context       lock_context;
    5830
    59   if ( !count )
     31  if ( count == NULL ) {
    6032    return RTEMS_INVALID_ADDRESS;
     33  }
    6134
    6235  the_message_queue = _Message_queue_Get_interrupt_disable(
    6336    id,
    64     &location,
    6537    &lock_context
    6638  );
    67   switch ( location ) {
    6839
    69     case OBJECTS_LOCAL:
    70       *count = _CORE_message_queue_Flush(
    71         &the_message_queue->message_queue,
    72         &lock_context
    73       );
    74       return RTEMS_SUCCESSFUL;
    75 
     40  if ( the_message_queue == NULL ) {
    7641#if defined(RTEMS_MULTIPROCESSING)
    77     case OBJECTS_REMOTE:
    78       _Thread_Executing->Wait.return_argument = count;
    79 
    80       return
    81         _Message_queue_MP_Send_request_packet(
    82           MESSAGE_QUEUE_MP_FLUSH_REQUEST,
    83           id,
    84           0,                               /* buffer not used */
    85           0,                               /* size */
    86           0,                               /* option_set not used */
    87           MPCI_DEFAULT_TIMEOUT
    88         );
     42    _Message_queue_MP_Flush( id, count );
     43#else
     44    return RTEMS_INVALID_ID;
    8945#endif
    90 
    91     case OBJECTS_ERROR:
    92       break;
    9346  }
    9447
    95   return RTEMS_INVALID_ID;
     48  *count = _CORE_message_queue_Flush(
     49    &the_message_queue->message_queue,
     50    &lock_context
     51  );
     52  return RTEMS_SUCCESSFUL;
    9653}
  • cpukit/rtems/src/msgqgetnumberpending.c

    r0a00b2b r641b44c  
    2727{
    2828  Message_queue_Control *the_message_queue;
    29   Objects_Locations      location;
    3029  ISR_lock_Context       lock_context;
    3130
    32   if ( !count )
     31  if ( count == NULL ) {
    3332    return RTEMS_INVALID_ADDRESS;
     33  }
    3434
    3535  the_message_queue = _Message_queue_Get_interrupt_disable(
    3636    id,
    37     &location,
    3837    &lock_context
    3938  );
    40   switch ( location ) {
    4139
    42     case OBJECTS_LOCAL:
    43       _CORE_message_queue_Acquire_critical(
    44         &the_message_queue->message_queue,
    45         &lock_context
    46       );
    47       *count = the_message_queue->message_queue.number_of_pending_messages;
    48       _CORE_message_queue_Release(
    49         &the_message_queue->message_queue,
    50         &lock_context
    51       );
    52       return RTEMS_SUCCESSFUL;
    53 
     40  if ( the_message_queue == NULL ) {
    5441#if defined(RTEMS_MULTIPROCESSING)
    55     case OBJECTS_REMOTE:
    56       _Thread_Get_executing()->Wait.return_argument = count;
    57 
    58       return _Message_queue_MP_Send_request_packet(
    59           MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST,
    60           id,
    61           0,                               /* buffer not used */
    62           0,                               /* size */
    63           0,                               /* option_set not used */
    64           MPCI_DEFAULT_TIMEOUT
    65         );
     42    _Message_queue_MP_Get_number_pending( id, count );
     43#else
     44    return RTEMS_INVALID_ID;
    6645#endif
    67 
    68     case OBJECTS_ERROR:
    69       break;
    7046  }
    7147
    72   return RTEMS_INVALID_ID;
     48  _CORE_message_queue_Acquire_critical(
     49    &the_message_queue->message_queue,
     50    &lock_context
     51  );
     52  *count = the_message_queue->message_queue.number_of_pending_messages;
     53  _CORE_message_queue_Release(
     54    &the_message_queue->message_queue,
     55    &lock_context
     56  );
     57  return RTEMS_SUCCESSFUL;
    7358}
  • cpukit/rtems/src/msgqreceive.c

    r0a00b2b r641b44c  
    1919#endif
    2020
    21 #include <rtems/system.h>
    22 #include <rtems/score/chain.h>
    23 #include <rtems/score/isr.h>
    24 #include <rtems/score/coremsgimpl.h>
     21#include <rtems/rtems/messageimpl.h>
    2522#include <rtems/score/threadimpl.h>
    26 #include <rtems/score/wkspace.h>
    27 #include <rtems/rtems/status.h>
    28 #include <rtems/rtems/attrimpl.h>
    29 #include <rtems/rtems/messageimpl.h>
    3023#include <rtems/rtems/optionsimpl.h>
    31 #include <rtems/rtems/support.h>
    3224
    3325THREAD_WAIT_QUEUE_OBJECT_ASSERT(
     
    4436)
    4537{
    46   Message_queue_Control          *the_message_queue;
    47   Objects_Locations               location;
    48   bool                            wait;
    49   Thread_Control                 *executing;
    50   ISR_lock_Context                lock_context;
     38  Message_queue_Control *the_message_queue;
     39  ISR_lock_Context       lock_context;
     40  Thread_Control        *executing;
    5141
    52   if ( !buffer )
     42  if ( buffer == NULL ) {
    5343    return RTEMS_INVALID_ADDRESS;
     44  }
    5445
    55   if ( !size )
     46  if ( size == NULL ) {
    5647    return RTEMS_INVALID_ADDRESS;
     48  }
    5749
    5850  the_message_queue = _Message_queue_Get_interrupt_disable(
    5951    id,
    60     &location,
    6152    &lock_context
    6253  );
    63   switch ( location ) {
    6454
    65     case OBJECTS_LOCAL:
    66       if ( _Options_Is_no_wait( option_set ) )
    67         wait = false;
    68       else
    69         wait = true;
    70 
    71       _CORE_message_queue_Acquire_critical(
    72         &the_message_queue->message_queue,
    73         &lock_context
    74       );
    75 
    76       executing = _Thread_Executing;
    77       _CORE_message_queue_Seize(
    78         &the_message_queue->message_queue,
    79         executing,
    80         the_message_queue->Object.id,
    81         buffer,
    82         size,
    83         wait,
    84         timeout,
    85         &lock_context
    86       );
    87       return _Message_queue_Translate_core_message_queue_return_code(
    88         executing->Wait.return_code
    89       );
    90 
     55  if ( the_message_queue == NULL ) {
    9156#if defined(RTEMS_MULTIPROCESSING)
    92     case OBJECTS_REMOTE:
    93       return _Message_queue_MP_Send_request_packet(
    94           MESSAGE_QUEUE_MP_RECEIVE_REQUEST,
    95           id,
    96           buffer,
    97           size,
    98           option_set,
    99           timeout
    100         );
     57    _Message_queue_MP_Receive( id, buffer, size, option_set, timeout );
     58#else
     59    return RTEMS_INVALID_ID;
    10160#endif
    102 
    103     case OBJECTS_ERROR:
    104       break;
    10561  }
    10662
    107   return RTEMS_INVALID_ID;
     63  _CORE_message_queue_Acquire_critical(
     64    &the_message_queue->message_queue,
     65    &lock_context
     66  );
     67
     68  executing = _Thread_Executing;
     69  _CORE_message_queue_Seize(
     70    &the_message_queue->message_queue,
     71    executing,
     72    the_message_queue->Object.id,
     73    buffer,
     74    size,
     75    !_Options_Is_no_wait( option_set ),
     76    timeout,
     77    &lock_context
     78  );
     79  return _Message_queue_Translate_core_message_queue_return_code(
     80    executing->Wait.return_code
     81  );
    10882}
  • cpukit/rtems/src/msgqsend.c

    r0a00b2b r641b44c  
    1919#endif
    2020
    21 #include <rtems/system.h>
    22 #include <rtems/score/chain.h>
    23 #include <rtems/score/isr.h>
    24 #include <rtems/score/coremsgimpl.h>
    25 #include <rtems/score/thread.h>
    26 #include <rtems/score/wkspace.h>
    27 #include <rtems/rtems/status.h>
    28 #include <rtems/rtems/attrimpl.h>
    2921#include <rtems/rtems/messageimpl.h>
    30 #include <rtems/rtems/options.h>
    31 #include <rtems/rtems/support.h>
    3222
    3323rtems_status_code rtems_message_queue_send(
     
    3727)
    3828{
    39   Message_queue_Control           *the_message_queue;
    40   Objects_Locations                location;
    41   CORE_message_queue_Status        status;
    42   ISR_lock_Context                 lock_context;
     29  Message_queue_Control     *the_message_queue;
     30  ISR_lock_Context           lock_context;
     31  CORE_message_queue_Status  status;
    4332
    44   if ( !buffer )
     33  if ( buffer == NULL ) {
    4534    return RTEMS_INVALID_ADDRESS;
     35  }
    4636
    4737  the_message_queue = _Message_queue_Get_interrupt_disable(
    4838    id,
    49     &location,
    5039    &lock_context
    5140  );
    52   switch ( location ) {
    5341
    54     case OBJECTS_LOCAL:
    55       _CORE_message_queue_Acquire_critical(
    56         &the_message_queue->message_queue,
    57         &lock_context
    58       );
    59       status = _CORE_message_queue_Send(
    60         &the_message_queue->message_queue,
    61         buffer,
    62         size,
    63         _Message_queue_Core_message_queue_mp_support,
    64         id,
    65         false,   /* sender does not block */
    66         0,       /* no timeout */
    67         &lock_context
    68       );
     42  if ( the_message_queue == NULL ) {
     43#if defined(RTEMS_MULTIPROCESSING)
     44    _Message_queue_MP_Send( id, buffer, size );
     45#else
     46    return RTEMS_INVALID_ID;
     47#endif
     48  }
    6949
    70       /*
    71        *  Since this API does not allow for blocking sends, we can directly
    72        *  return the returned status.
    73        */
     50  _CORE_message_queue_Acquire_critical(
     51    &the_message_queue->message_queue,
     52    &lock_context
     53  );
     54  status = _CORE_message_queue_Send(
     55    &the_message_queue->message_queue,
     56    buffer,
     57    size,
     58    _Message_queue_Core_message_queue_mp_support,
     59    id,
     60    false,   /* sender does not block */
     61    0,       /* no timeout */
     62    &lock_context
     63  );
    7464
    75       return _Message_queue_Translate_core_message_queue_return_code(status);
     65  /*
     66   *  Since this API does not allow for blocking sends, we can directly
     67   *  return the returned status.
     68   */
    7669
    77 #if defined(RTEMS_MULTIPROCESSING)
    78     case OBJECTS_REMOTE:
    79       return _Message_queue_MP_Send_request_packet(
    80         MESSAGE_QUEUE_MP_SEND_REQUEST,
    81         id,
    82         buffer,
    83         &size,
    84         0,                               /* option_set */
    85         MPCI_DEFAULT_TIMEOUT
    86       );
    87       break;
    88 #endif
    89 
    90     case OBJECTS_ERROR:
    91       break;
    92   }
    93   return RTEMS_INVALID_ID;
     70  return _Message_queue_Translate_core_message_queue_return_code( status );
    9471}
  • cpukit/rtems/src/msgqurgent.c

    r0a00b2b r641b44c  
    1919#endif
    2020
    21 #include <rtems/system.h>
    22 #include <rtems/score/chain.h>
    23 #include <rtems/score/isr.h>
    24 #include <rtems/score/coremsgimpl.h>
    25 #include <rtems/score/thread.h>
    26 #include <rtems/score/wkspace.h>
    27 #include <rtems/rtems/status.h>
    28 #include <rtems/rtems/attrimpl.h>
    2921#include <rtems/rtems/messageimpl.h>
    30 #include <rtems/rtems/options.h>
    31 #include <rtems/rtems/support.h>
    3222
    3323rtems_status_code rtems_message_queue_urgent(
     
    3727)
    3828{
    39   Message_queue_Control           *the_message_queue;
    40   Objects_Locations                location;
    41   CORE_message_queue_Status        status;
    42   ISR_lock_Context                 lock_context;
     29  Message_queue_Control     *the_message_queue;
     30  ISR_lock_Context           lock_context;
     31  CORE_message_queue_Status  status;
    4332
    44   if ( !buffer )
     33  if ( buffer == NULL ) {
    4534    return RTEMS_INVALID_ADDRESS;
     35  }
    4636
    4737  the_message_queue = _Message_queue_Get_interrupt_disable(
    4838    id,
    49     &location,
    5039    &lock_context
    5140  );
    52   switch ( location ) {
    5341
    54     case OBJECTS_LOCAL:
    55       _CORE_message_queue_Acquire_critical(
    56         &the_message_queue->message_queue,
    57         &lock_context
    58       );
    59       status = _CORE_message_queue_Urgent(
    60         &the_message_queue->message_queue,
    61         buffer,
    62         size,
    63         _Message_queue_Core_message_queue_mp_support,
    64         id,
    65         false,   /* sender does not block */
    66         0,       /* no timeout */
    67         &lock_context
    68       );
    69 
    70       /*
    71        *  Since this API does not allow for blocking sends, we can directly
    72        *  return the returned status.
    73        */
    74 
    75       return _Message_queue_Translate_core_message_queue_return_code(status);
    76 
     42  if ( the_message_queue == NULL ) {
    7743#if defined(RTEMS_MULTIPROCESSING)
    78     case OBJECTS_REMOTE:
    79       return _Message_queue_MP_Send_request_packet(
    80         MESSAGE_QUEUE_MP_URGENT_REQUEST,
    81         id,
    82         buffer,
    83         &size,
    84         0,                               /* option_set */
    85         MPCI_DEFAULT_TIMEOUT
    86       );
     44    _Message_queue_MP_Urgent( id, buffer, size );
     45#else
     46    return RTEMS_INVALID_ID;
    8747#endif
    88 
    89     case OBJECTS_ERROR:
    90       break;
    9148  }
    9249
    93   return RTEMS_INVALID_ID;
     50  _CORE_message_queue_Acquire_critical(
     51    &the_message_queue->message_queue,
     52    &lock_context
     53  );
     54  status = _CORE_message_queue_Urgent(
     55    &the_message_queue->message_queue,
     56    buffer,
     57    size,
     58    _Message_queue_Core_message_queue_mp_support,
     59    id,
     60    false,   /* sender does not block */
     61    0,       /* no timeout */
     62    &lock_context
     63  );
     64
     65  /*
     66   *  Since this API does not allow for blocking sends, we can directly
     67   *  return the returned status.
     68   */
     69
     70  return _Message_queue_Translate_core_message_queue_return_code( status );
    9471}
Note: See TracChangeset for help on using the changeset viewer.