Changeset 3652ad35 in rtems for cpukit/rtems


Ignore:
Timestamp:
09/19/95 14:53:29 (28 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
38ffa0c
Parents:
b3ac6a8d
Message:

Minor bug fixes to get all targets compilable and running. The
single biggest changes were the expansion of the workspace size
macro to include other types of objects and the increase in the
minimum stack size for most CPUs.

Location:
cpukit/rtems
Files:
8 edited

Legend:

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

    rb3ac6a8d r3652ad35  
    4040#include <rtems/rtems/attr.h>
    4141#include <rtems/core/threadq.h>
    42 
    43 /*
    44  *  The following defines the data types needed to manipulate
    45  *  the contents of message buffers.
    46  *  Since msgs are variable length we just make a ptr to 1.
    47  */
    48 
    49 typedef struct {
    50     unsigned32  size;
    51 
    52 #ifndef __cplusplus
    53                                /* NOTE:   [0] is gcc specific,
    54                                 *   but specifically disallowed by ANSI STD C++
    55                                 * g++ warns about it, so we #ifdef it out to
    56                                 * get rid of warnings when compiled by g++.
    57                                 */
    58     unsigned32  buffer[0];
    59 #endif
    60 
    61 } Message_queue_Buffer;
    62 
    63 /*
    64  *  The following records define the organization of a message
    65  *  buffer.
    66  */
    67 
    68 typedef struct {
    69   Chain_Node           Node;
    70   Message_queue_Buffer Contents;
    71 }   Message_queue_Buffer_control;
    72 
    73 /*
    74  *  The following records define the control block used to manage
    75  *  each message queue.
    76  */
    77 
    78 typedef struct {
    79   Objects_Control      Object;
    80   Thread_queue_Control Wait_queue;
    81   rtems_attribute      attribute_set;
    82   unsigned32           maximum_pending_messages;
    83   unsigned32           number_of_pending_messages;
    84   unsigned32           maximum_message_size;
    85   Chain_Control        Pending_messages;
    86   Message_queue_Buffer *message_buffers;
    87   Chain_Control        Inactive_messages;
    88 }   Message_queue_Control;
    89 
    90 /*
    91  *  The following defines the information control block used to
    92  *  manage this class of objects.
    93  */
    94 
    95 EXTERN Objects_Information  _Message_queue_Information;
     42#include <rtems/core/coremsg.h>
    9643
    9744/*
     
    10047 *  in a send or urgent fashion.
    10148 */
    102 
     49 
    10350typedef enum {
    10451  MESSAGE_QUEUE_SEND_REQUEST   = 0,
    10552  MESSAGE_QUEUE_URGENT_REQUEST = 1
    10653}  Message_queue_Submit_types;
     54
     55/*
     56 *  The following records define the control block used to manage
     57 *  each message queue.
     58 */
     59
     60typedef struct {
     61  Objects_Control             Object;
     62  rtems_attribute             attribute_set;
     63  CORE_message_queue_Control  message_queue;
     64}   Message_queue_Control;
     65
     66/*
     67 *  The following defines the information control block used to
     68 *  manage this class of objects.
     69 */
     70
     71EXTERN Objects_Information  _Message_queue_Information;
    10772
    10873/*
     
    256221  Objects_Id            id,
    257222  void                 *buffer,
    258   unsigned32           *size_p,
     223  unsigned32           *size,
    259224  unsigned32            option_set,
    260225  rtems_interval        timeout
     
    278243
    279244/*
    280  *  _Message_queue_Copy_buffer
    281  *
    282  *  DESCRIPTION:
    283  *
    284  *  This routine copies the contents of the source message buffer
    285  *  to the destination message buffer.
    286  */
    287 
    288 STATIC INLINE void _Message_queue_Copy_buffer (
    289   void      *source,
    290   void      *destination,
    291   unsigned32 size
    292 );
    293 
    294 /*
    295  *  _Message_queue_Seize
    296  *
    297  *  DESCRIPTION:
    298  *
    299  *  This routine attempts to receive a message from the_message_queue.
    300  *  If a message is available or if the RTEMS_NO_WAIT option is enabled in
    301  *  option_set, then the routine returns.  Otherwise, the calling task
    302  *  is blocked until a message is available.  If a message is returned
    303  *  to the task, then buffer will contain its contents.
    304  */
    305 
    306 boolean _Message_queue_Seize(
    307   Message_queue_Control *the_message_queue,
    308   unsigned32             option_set,
    309   void                  *buffer,
    310   unsigned32            *size_p
    311 );
    312 
    313 /*
    314  *  _Message_queue_Flush_support
    315  *
    316  *  DESCRIPTION:
    317  *
    318  *  This routine flushes all outstanding messages and returns
    319  *  them to the inactive message chain.
    320  */
    321 
    322 unsigned32 _Message_queue_Flush_support(
    323   Message_queue_Control *the_message_queue
    324 );
    325 
    326 /*
    327245 *  _Message_queue_Submit
    328246 *
    329247 *  DESCRIPTION:
    330248 *
    331  *  This routine provides the common foundation for the
    332  *  rtems_message_queue_send and rtems_message_queue_urgent directives.
    333  */
    334 
     249 *  This routine implements the directives rtems_message_queue_send
     250 *  and rtems_message_queue_urgent.  It processes a message that is
     251 *  to be submitted to the designated message queue.  The message will
     252 *  either be processed as a send send message which it will be inserted
     253 *  at the rear of the queue or it will be processed as an urgent message
     254 *  which will be inserted at the front of the queue.
     255 */
     256 
    335257rtems_status_code _Message_queue_Submit(
    336258  Objects_Id                  id,
     
    338260  unsigned32                  size,
    339261  Message_queue_Submit_types  submit_type
    340 );
    341 
    342 /*
    343  *  _Message_queue_Allocate_message_buffer
    344  *
    345  *  DESCRIPTION:
    346  *
    347  *  This function allocates a message buffer from the inactive
    348  *  message buffer chain.
    349  */
    350 
    351 STATIC INLINE Message_queue_Buffer_control *
    352   _Message_queue_Allocate_message_buffer (
    353    Message_queue_Control *the_message_queue
    354 );
    355 
    356 /*
    357  *  _Message_queue_Free_message_buffer
    358  *
    359  *  DESCRIPTION:
    360  *
    361  *  This routine frees a message buffer to the inactive
    362  *  message buffer chain.
    363  */
    364 
    365 STATIC INLINE void _Message_queue_Free_message_buffer (
    366   Message_queue_Control        *the_message_queue,
    367   Message_queue_Buffer_control *the_message
    368 );
    369 
    370 /*
    371  *  _Message_queue_Get_pending_message
    372  *
    373  *  DESCRIPTION:
    374  *
    375  *  This function removes the first message from the_message_queue
    376  *  and returns a pointer to it.
    377  */
    378 
    379 STATIC INLINE
    380   Message_queue_Buffer_control *_Message_queue_Get_pending_message (
    381   Message_queue_Control *the_message_queue
    382 );
    383 
    384 /*
    385  *  _Message_queue_Append
    386  *
    387  *  DESCRIPTION:
    388  *
    389  *  This routine places the_message at the rear of the outstanding
    390  *  messages on the_message_queue.
    391  */
    392 
    393 STATIC INLINE void _Message_queue_Append (
    394   Message_queue_Control        *the_message_queue,
    395   Message_queue_Buffer_control *the_message
    396 );
    397 
    398 /*
    399  *  _Message_queue_Prepend
    400  *
    401  *  DESCRIPTION:
    402  *
    403  *  This routine places the_message at the rear of the outstanding
    404  *  messages on the_message_queue.
    405  */
    406 
    407 STATIC INLINE void _Message_queue_Prepend (
    408   Message_queue_Control        *the_message_queue,
    409   Message_queue_Buffer_control *the_message
    410262);
    411263
     
    470322);
    471323
     324/*
     325 *  _Message_queue_Translate_core_message_queue_return_code
     326 *
     327 *  DESCRIPTION:
     328 *
     329 *  This function returns a RTEMS status code based on the core message queue
     330 *  status code specified.
     331 */
     332 
     333rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
     334  unsigned32 the_message_queue_status
     335);
     336
     337/*
     338 *
     339 *  _Message_queue_Core_message_queue_mp_support
     340 *
     341 *  Input parameters:
     342 *    the_thread - the remote thread the message was submitted to
     343 *    id         - id of the message queue
     344 *
     345 *  Output parameters: NONE
     346 */
     347 
     348void  _Message_queue_Core_message_queue_mp_support (
     349  Thread_Control *the_thread,
     350  Objects_Id      id
     351);
     352
    472353#include <rtems/rtems/message.inl>
    473354#include <rtems/rtems/msgmp.h>
  • cpukit/rtems/include/rtems/rtems/msgmp.h

    rb3ac6a8d r3652ad35  
    6464  unsigned32                         size;
    6565  unsigned32                         pad0;
    66   Message_queue_Buffer               Buffer;
     66  CORE_message_queue_Buffer          Buffer;
    6767}   Message_queue_MP_Packet;
    6868
  • cpukit/rtems/inline/rtems/rtems/message.inl

    rb3ac6a8d r3652ad35  
    1919
    2020#include <rtems/core/wkspace.h>
    21 
    22 /*PAGE
    23  *
    24  *  _Message_queue_Copy_buffer
    25  *
    26  */
    27 
    28 STATIC INLINE void _Message_queue_Copy_buffer (
    29   void      *source,
    30   void      *destination,
    31   unsigned32 size
    32 )
    33 {
    34   memcpy(destination, source, size);
    35 }
    36 
    37 /*PAGE
    38  *
    39  *  _Message_queue_Allocate_message_buffer
    40  *
    41  */
    42 
    43 STATIC INLINE Message_queue_Buffer_control *
    44 _Message_queue_Allocate_message_buffer (
    45     Message_queue_Control *the_message_queue
    46 )
    47 {
    48    return (Message_queue_Buffer_control *)
    49      _Chain_Get( &the_message_queue->Inactive_messages );
    50 }
    51 
    52 /*PAGE
    53  *
    54  *  _Message_queue_Free_message_buffer
    55  *
    56  */
    57 
    58 STATIC INLINE void _Message_queue_Free_message_buffer (
    59     Message_queue_Control        *the_message_queue,
    60     Message_queue_Buffer_control *the_message
    61 )
    62 {
    63   _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node );
    64 }
    65 
    66 /*PAGE
    67  *
    68  *  _Message_queue_Get_pending_message
    69  *
    70  */
    71 
    72 STATIC INLINE
    73   Message_queue_Buffer_control *_Message_queue_Get_pending_message (
    74   Message_queue_Control *the_message_queue
    75 )
    76 {
    77   return (Message_queue_Buffer_control *)
    78     _Chain_Get_unprotected( &the_message_queue->Pending_messages );
    79 }
    80 
    81 /*PAGE
    82  *
    83  *  _Message_queue_Append
    84  *
    85  */
    86 
    87 STATIC INLINE void _Message_queue_Append (
    88   Message_queue_Control        *the_message_queue,
    89   Message_queue_Buffer_control *the_message
    90 )
    91 {
    92   _Chain_Append( &the_message_queue->Pending_messages, &the_message->Node );
    93 }
    94 
    95 /*PAGE
    96  *
    97  *  _Message_queue_Prepend
    98  *
    99  */
    100 
    101 STATIC INLINE void _Message_queue_Prepend (
    102   Message_queue_Control        *the_message_queue,
    103   Message_queue_Buffer_control *the_message
    104 )
    105 {
    106   _Chain_Prepend(
    107     &the_message_queue->Pending_messages,
    108     &the_message->Node
    109   );
    110 }
    11121
    11222/*PAGE
     
    13444)
    13545{
    136   if (the_message_queue->message_buffers) {
    137     _Workspace_Free((void *) the_message_queue->message_buffers);
    138     the_message_queue->message_buffers = 0;
    139   }
    140  
    14146  _Objects_Free( &_Message_queue_Information, &the_message_queue->Object );
    14247}
  • cpukit/rtems/macros/rtems/rtems/message.inl

    rb3ac6a8d r3652ad35  
    2020/*PAGE
    2121 *
    22  *  _Message_queue_Copy_buffer
    23  */
    24 
    25 #define _Message_queue_Copy_buffer( _source, _destination, _size ) \
    26   memcpy( _destination, _source, _size)
    27 
    28 /*PAGE
    29  *
    30  *  _Message_queue_Allocate_message_buffer
    31  *
    32  */
    33 
    34 #define _Message_queue_Allocate_message_buffer( _the_message_queue ) \
    35   (Message_queue_Buffer_control *) \
    36     _Chain_Get( &(_the_message_queue)->Inactive_messages )
    37 
    38 /*PAGE
    39  *
    40  *  _Message_queue_Free_message_buffer
    41  *
    42  */
    43 
    44 #define _Message_queue_Free_message_buffer( _the_message_queue, _the_message ) \
    45   _Chain_Append( \
    46     &(_the_message_queue)->Inactive_messages, \
    47     &(_the_message)->Node \
    48   )
    49 
    50 /*PAGE
    51  *
    52  *  _Message_queue_Get_pending_message
    53  *
    54  */
    55 
    56 #define _Message_queue_Get_pending_message( _the_message_queue ) \
    57    (Message_queue_Buffer_control *) \
    58      _Chain_Get_unprotected( &(_the_message_queue)->Pending_messages )
    59 
    60 /*PAGE
    61  *
    62  *  _Message_queue_Append
    63  *
    64  */
    65 
    66 #define _Message_queue_Append( _the_message_queue, _the_message ) \
    67    _Chain_Append( &(_the_message_queue)->Pending_messages, \
    68                   &(_the_message)->Node )
    69 
    70 /*PAGE
    71  *
    72  *  _Message_queue_Prepend
    73  *
    74  */
    75 
    76 #define _Message_queue_Prepend( _the_message_queue, _the_message ) \
    77    _Chain_Prepend( &(_the_message_queue)->Pending_messages, \
    78                    &(_the_message)->Node )
    79 
    80 /*PAGE
    81  *
    8222 *  _Message_queue_Is_null
    8323 *
     
    9434
    9535#define _Message_queue_Free( _the_message_queue ) \
    96   do { \
    97     \
    98     if ( (_the_message_queue)->message_buffers ) { \
    99       _Workspace_Free((void *) (_the_message_queue)->message_buffers); \
    100       (_the_message_queue)->message_buffers = 0; \
    101     } \
    102     \
    103     _Objects_Free( \
    104       &_Message_queue_Information, \
    105       &(_the_message_queue)->Object \
    106     ); \
    107   } while ( 0 )
    108 
     36  _Objects_Free( &_Message_queue_Information, &(_the_message_queue)->Object )
    10937
    11038/*PAGE
  • cpukit/rtems/src/msg.c

    rb3ac6a8d r3652ad35  
    1515
    1616#include <rtems/system.h>
    17 #include <rtems/rtems/status.h>
    18 #include <rtems/rtems/attr.h>
     17#include <rtems/sysstate.h>
    1918#include <rtems/core/chain.h>
    2019#include <rtems/core/isr.h>
    21 #include <rtems/rtems/message.h>
     20#include <rtems/core/coremsg.h>
    2221#include <rtems/core/object.h>
    23 #include <rtems/rtems/options.h>
    2422#include <rtems/core/states.h>
    25 #include <rtems/rtems/support.h>
    2623#include <rtems/core/thread.h>
    2724#include <rtems/core/wkspace.h>
    2825#include <rtems/core/mpci.h>
    29 #include <rtems/sysstate.h>
     26#include <rtems/rtems/status.h>
     27#include <rtems/rtems/attr.h>
     28#include <rtems/rtems/message.h>
     29#include <rtems/rtems/options.h>
     30#include <rtems/rtems/support.h>
    3031
    3132/*PAGE
     
    7374 *
    7475 *  Allocate a message queue and the space for its messages
     76 *
     77 *  Input parameters:
     78 *    the_message_queue - the message queue to allocate message buffers
     79 *    count             - maximum message and reserved buffer count
     80 *    max_message_size  - maximum size of each message
     81 *
     82 *  Output parameters:
     83 *    the_message_queue - set if successful, NULL otherwise
    7584 */
    7685
    7786Message_queue_Control *_Message_queue_Allocate (
    78   unsigned32          count,
    79   unsigned32          max_message_size
    80 )
    81 {
    82     Message_queue_Control *mq = 0;
    83     unsigned32 message_buffering_required;
    84     unsigned32 allocated_message_size;
    85 
    86     mq =
    87       (Message_queue_Control *)_Objects_Allocate(&_Message_queue_Information);
    88 
    89     if (mq == 0)
    90         goto failed;
    91 
    92     mq->maximum_message_size = max_message_size;
    93 
    94     /*
    95      * round size up to multiple of a ptr for chain init
    96      */
    97    
    98     allocated_message_size = max_message_size;
    99     if (allocated_message_size & (sizeof(unsigned32) - 1)) {
    100         allocated_message_size += sizeof(unsigned32);
    101         allocated_message_size &= ~(sizeof(unsigned32) - 1);
    102     }
    103    
    104     message_buffering_required =
    105       count * (allocated_message_size + sizeof(Message_queue_Buffer_control));
    106  
    107     mq->message_buffers =
    108       (Message_queue_Buffer *) _Workspace_Allocate(message_buffering_required);
    109 
    110     if (mq->message_buffers == 0)
    111         goto failed;
    112  
    113     _Chain_Initialize
    114       (&mq->Inactive_messages,
    115       mq->message_buffers,
    116       count,
    117       allocated_message_size + sizeof(Message_queue_Buffer_control)
    118     );
    119     return mq;
    120 
    121 failed:
    122     if (mq)
    123         _Message_queue_Free(mq);
    124     return (Message_queue_Control *) 0;
     87  unsigned32           count,
     88  unsigned32           max_message_size
     89)
     90{
     91  return
     92    (Message_queue_Control *)_Objects_Allocate(&_Message_queue_Information);
     93
    12594}
    12695
     
    133102 *
    134103 *  Input parameters:
    135  *    name          - user defined queue name
    136  *    count         - maximum message and reserved buffer count
     104 *    name             - user defined queue name
     105 *    count            - maximum message and reserved buffer count
    137106 *    max_message_size - maximum size of each message
    138  *    attribute_set - process method
    139  *    id            - pointer to queue
     107 *    attribute_set    - process method
     108 *    id               - pointer to queue
    140109 *
    141110 *  Output parameters:
     
    154123{
    155124  register Message_queue_Control *the_message_queue;
     125  CORE_message_queue_Attributes   the_message_queue_attributes;
     126  boolean                         is_global;
    156127
    157128  if ( !rtems_is_name_valid( name ) )
    158129    return RTEMS_INVALID_NAME;
    159130
    160   if ( _Attributes_Is_global( attribute_set ) &&
     131  if ( (is_global = _Attributes_Is_global( attribute_set ) ) &&
    161132       !_System_state_Is_multiprocessing )
    162133    return RTEMS_MP_NOT_CONFIGURED;
     
    175146   */
    176147 
    177   if ( _Attributes_Is_global( attribute_set ) &&
    178        (_MPCI_table->maximum_packet_size < max_message_size))
    179   {
    180       return RTEMS_INVALID_SIZE;
    181   }
     148  if ( is_global && (_MPCI_table->maximum_packet_size < max_message_size) )
     149    return RTEMS_INVALID_SIZE;
     150
    182151#endif
    183152       
    184153  _Thread_Disable_dispatch();              /* protects object pointer */
    185154
    186   the_message_queue = _Message_queue_Allocate(count, max_message_size);
     155  the_message_queue = _Message_queue_Allocate( count, max_message_size );
    187156
    188157  if ( !the_message_queue ) {
     
    191160  }
    192161
    193   if ( _Attributes_Is_global( attribute_set ) &&
    194        !( _Objects_MP_Allocate_and_open( &_Message_queue_Information, name,
    195                             the_message_queue->Object.id, FALSE ) ) ) {
     162  if ( is_global &&
     163    !( _Objects_MP_Allocate_and_open( &_Message_queue_Information,
     164                              name, the_message_queue->Object.id, FALSE ) ) ) {
    196165    _Message_queue_Free( the_message_queue );
    197166    _Thread_Enable_dispatch();
     
    199168  }
    200169
    201   the_message_queue->maximum_pending_messages = count;
    202 
    203170  the_message_queue->attribute_set = attribute_set;
    204   the_message_queue->number_of_pending_messages = 0;
    205 
    206   _Chain_Initialize_empty( &the_message_queue->Pending_messages );
    207 
    208   _Thread_queue_Initialize(
    209     &the_message_queue->Wait_queue,
    210     OBJECTS_RTEMS_MESSAGE_QUEUES,
    211     _Attributes_Is_priority( attribute_set ) ?
    212        THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
    213     STATES_WAITING_FOR_MESSAGE,
    214     _Message_queue_MP_Send_extract_proxy,
    215     RTEMS_TIMEOUT
    216   );
     171
     172  if (_Attributes_Is_priority( attribute_set ) )
     173    the_message_queue_attributes.discipline =
     174                                      CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY;
     175  else
     176    the_message_queue_attributes.discipline =
     177                                      CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
     178
     179  if ( ! _CORE_message_queue_Initialize(
     180           &the_message_queue->message_queue,
     181           OBJECTS_RTEMS_MESSAGE_QUEUES,
     182           &the_message_queue_attributes,
     183           count,
     184           max_message_size,
     185           _Message_queue_MP_Send_extract_proxy ) ) {
     186    if ( is_global )
     187        _Objects_MP_Close(
     188          &_Message_queue_Information, the_message_queue->Object.id);
     189
     190    _Message_queue_Free( the_message_queue );
     191    _Thread_Enable_dispatch();
     192    return RTEMS_TOO_MANY;
     193  }
    217194
    218195  _Objects_Open(
     
    224201  *id = the_message_queue->Object.id;
    225202
    226   if ( _Attributes_Is_global( attribute_set ) )
     203  if ( is_global )
    227204    _Message_queue_MP_Send_process_packet(
    228205      MESSAGE_QUEUE_MP_ANNOUNCE_CREATE,
     
    305282                      &the_message_queue->Object );
    306283
    307       if ( the_message_queue->number_of_pending_messages != 0 )
    308         (void) _Message_queue_Flush_support( the_message_queue );
    309       else
    310         _Thread_queue_Flush(
    311           &the_message_queue->Wait_queue,
    312           _Message_queue_MP_Send_object_was_deleted,
    313           RTEMS_OBJECT_WAS_DELETED
    314         );
     284      _CORE_message_queue_Close(
     285        &the_message_queue->message_queue,
     286        _Message_queue_MP_Send_object_was_deleted,
     287        CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED
     288      );
    315289
    316290      _Message_queue_Free( the_message_queue );
     
    347321 *    id     - pointer to message queue
    348322 *    buffer - pointer to message buffer
     323 *    size   - size of message to sent urgently
    349324 *
    350325 *  Output parameters:
     
    359334)
    360335{
    361   return _Message_queue_Submit(id, buffer, size, MESSAGE_QUEUE_SEND_REQUEST);
     336  return( _Message_queue_Submit(id, buffer, size, MESSAGE_QUEUE_SEND_REQUEST) );
    362337}
    363338
     
    372347 *    id     - pointer to message queue
    373348 *    buffer - pointer to message buffer
     349 *    size   - size of message to sent urgently
    374350 *
    375351 *  Output parameters:
    376352 *    RTEMS_SUCCESSFUL - if successful
    377  *    error code - if unsuccessful
     353 *    error code       - if unsuccessful
    378354 */
    379355
     
    384360)
    385361{
    386   return _Message_queue_Submit(id, buffer, size, MESSAGE_QUEUE_URGENT_REQUEST);
     362  return(_Message_queue_Submit(id, buffer, size, MESSAGE_QUEUE_URGENT_REQUEST));
    387363}
    388364
     
    397373 *    id     - pointer to message queue
    398374 *    buffer - pointer to message buffer
     375 *    size   - size of message to broadcast
    399376 *    count  - pointer to area to store number of threads made ready
    400377 *
    401378 *  Output parameters:
    402379 *    count             - number of threads made ready
    403  *    RTEMS_SUCCESSFUL - if successful
     380 *    RTEMS_SUCCESSFUL  - if successful
    404381 *    error code        - if unsuccessful
    405382 */
     
    414391  register Message_queue_Control *the_message_queue;
    415392  Objects_Locations               location;
    416   Thread_Control                 *the_thread;
    417   unsigned32                      number_broadcasted;
     393  CORE_message_queue_Status       core_status;
    418394
    419395  the_message_queue = _Message_queue_Get( id, &location );
     
    435411
    436412    case OBJECTS_LOCAL:
    437     {
    438       Thread_Wait_information *waitp;
    439       unsigned32 constrained_size;
    440 
    441       number_broadcasted = 0;
    442       while ( (the_thread =
    443                  _Thread_queue_Dequeue(&the_message_queue->Wait_queue)) ) {
    444         waitp = &the_thread->Wait;
    445         number_broadcasted += 1;
    446 
    447         constrained_size = size;
    448         if (size > the_message_queue->maximum_message_size)
    449             constrained_size = the_message_queue->maximum_message_size;
    450 
    451         _Message_queue_Copy_buffer(buffer,
    452                                    waitp->return_argument,
    453                                    constrained_size);
    454 
    455         *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 = size;
    456        
    457         if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
    458           the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL;
    459 
    460           _Message_queue_MP_Send_response_packet(
    461             MESSAGE_QUEUE_MP_RECEIVE_RESPONSE,
    462             id,
    463             the_thread
    464           );
    465         }
    466       }
     413      core_status = _CORE_message_queue_Broadcast(
     414                      &the_message_queue->message_queue,
     415                      buffer,
     416                      size,
     417                      id,
     418                      _Message_queue_Core_message_queue_mp_support,
     419                      count
     420                    );
     421                     
    467422      _Thread_Enable_dispatch();
    468       *count = number_broadcasted;
    469       return RTEMS_SUCCESSFUL;
    470     }
    471 
    472     default:
    473       return RTEMS_INTERNAL_ERROR;
    474   }
     423      return
     424        _Message_queue_Translate_core_message_queue_return_code( core_status );
     425
     426  }
     427  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    475428}
    476429
     
    485438 *    id         - queue id
    486439 *    buffer     - pointer to message buffer
     440 *    size       - size of message receive
    487441 *    option_set - options on receive
    488442 *    timeout    - number of ticks to wait
     
    490444 *  Output parameters:
    491445 *    RTEMS_SUCCESSFUL - if successful
    492  *    error code        - if unsuccessful
     446 *    error code       - if unsuccessful
    493447 */
    494448
     
    496450  Objects_Id            id,
    497451  void                 *buffer,
    498   unsigned32           *size_p,
     452  unsigned32           *size,
    499453  unsigned32            option_set,
    500454  rtems_interval        timeout
     
    503457  register Message_queue_Control *the_message_queue;
    504458  Objects_Locations               location;
     459  boolean                         wait;
    505460
    506461  the_message_queue = _Message_queue_Get( id, &location );
     
    515470          id,
    516471          buffer,
    517           size_p,
     472          size,
    518473          option_set,
    519474          timeout
     
    521476
    522477    case OBJECTS_LOCAL:
    523       if ( ! _Message_queue_Seize(the_message_queue,
    524                                   option_set,
    525                                   buffer,
    526                                   size_p))
    527       {
    528         _Thread_queue_Enqueue( &the_message_queue->Wait_queue, timeout );
    529       }
     478      if ( _Options_Is_no_wait( option_set ) )
     479        wait = FALSE;
     480      else
     481        wait = TRUE;
     482 
     483      _CORE_message_queue_Seize(
     484        &the_message_queue->message_queue,
     485        the_message_queue->Object.id,
     486        buffer,
     487        size,
     488        wait,
     489        timeout
     490      );
    530491      _Thread_Enable_dispatch();
    531       return _Thread_Executing->Wait.return_code;
     492      return( _Message_queue_Translate_core_message_queue_return_code(
     493                  _Thread_Executing->Wait.return_code ) );
     494
    532495  }
    533496
     
    573536          id,
    574537          0,                               /* buffer not used */
    575           0,                               /* size_p */
     538          0,                               /* size */
    576539          0,                               /* option_set not used */
    577540          MPCI_DEFAULT_TIMEOUT
     
    579542
    580543    case OBJECTS_LOCAL:
    581       if ( the_message_queue->number_of_pending_messages != 0 )
    582         *count = _Message_queue_Flush_support( the_message_queue );
    583       else
    584         *count = 0;
     544      *count = _CORE_message_queue_Flush( &the_message_queue->message_queue );
    585545      _Thread_Enable_dispatch();
    586546      return RTEMS_SUCCESSFUL;
     
    592552/*PAGE
    593553 *
    594  *  _Message_queue_Seize
    595  *
    596  *  This kernel routine dequeues a message, copies the message buffer to
    597  *  a given destination buffer, and frees the message buffer to the
    598  *  inactive message pool.
    599  *
    600  *  Input parameters:
    601  *    the_message_queue - pointer to message queue
    602  *    option_set        - options on receive
    603  *    the_buffer        - pointer to message buffer to be filled
    604  *
    605  *  Output parameters:
    606  *    TRUE  - if message received or RTEMS_NO_WAIT and no message
    607  *    FALSE - if thread is to block
    608  *
    609  *  NOTE: Dependent on BUFFER_LENGTH
    610  *
    611  *  INTERRUPT LATENCY:
    612  *    available
    613  *    wait
    614  */
    615 
    616 boolean _Message_queue_Seize(
    617   Message_queue_Control  *the_message_queue,
    618   rtems_option            option_set,
    619   void                   *buffer,
    620   unsigned32             *size_p
    621 )
    622 {
    623   ISR_Level                     level;
    624   Message_queue_Buffer_control *the_message;
    625   Thread_Control               *executing;
    626 
    627   executing = _Thread_Executing;
    628   executing->Wait.return_code = RTEMS_SUCCESSFUL;
    629   _ISR_Disable( level );
    630   if ( the_message_queue->number_of_pending_messages != 0 ) {
    631     the_message_queue->number_of_pending_messages -= 1;
    632 
    633     the_message = _Message_queue_Get_pending_message( the_message_queue );
    634     _ISR_Enable( level );
    635     *size_p = the_message->Contents.size;
    636     _Message_queue_Copy_buffer( the_message->Contents.buffer, buffer, *size_p );
    637     _Message_queue_Free_message_buffer(the_message_queue, the_message );
    638     return( TRUE );
    639   }
    640 
    641   if ( _Options_Is_no_wait( option_set ) ) {
    642     _ISR_Enable( level );
    643     executing->Wait.return_code = RTEMS_UNSATISFIED;
    644     return( TRUE );
    645   }
    646 
    647   the_message_queue->Wait_queue.sync = TRUE;
    648   executing->Wait.queue              = &the_message_queue->Wait_queue;
    649   executing->Wait.id                 = the_message_queue->Object.id;
    650   executing->Wait.option             = option_set;
    651   executing->Wait.return_argument    = (void *)buffer;
    652   executing->Wait.return_argument_1  = (void *)size_p;
    653   _ISR_Enable( level );
    654   return FALSE;
    655 }
    656 
    657 /*PAGE
    658  *
    659  *  _Message_queue_Flush_support
    660  *
    661  *  This message manager routine removes all messages from a message queue
    662  *  and returns them to the inactive message pool.
    663  *
    664  *  Input parameters:
    665  *    the_message_queue - pointer to message queue
    666  *
    667  *  Output parameters:
    668  *    returns - number of messages placed on inactive chain
    669  *
    670  *  INTERRUPT LATENCY:
    671  *    only case
    672  */
    673 
    674 unsigned32 _Message_queue_Flush_support(
    675   Message_queue_Control *the_message_queue
    676 )
    677 {
    678   ISR_Level   level;
    679   Chain_Node *inactive_first;
    680   Chain_Node *message_queue_first;
    681   Chain_Node *message_queue_last;
    682   unsigned32  count;
    683 
    684   _ISR_Disable( level );
    685     inactive_first      = the_message_queue->Inactive_messages.first;
    686     message_queue_first = the_message_queue->Pending_messages.first;
    687     message_queue_last  = the_message_queue->Pending_messages.last;
    688 
    689     the_message_queue->Inactive_messages.first = message_queue_first;
    690     message_queue_last->next = inactive_first;
    691     inactive_first->previous = message_queue_last;
    692     message_queue_first->previous          =
    693                _Chain_Head( &the_message_queue->Inactive_messages );
    694 
    695     _Chain_Initialize_empty( &the_message_queue->Pending_messages );
    696 
    697     count = the_message_queue->number_of_pending_messages;
    698     the_message_queue->number_of_pending_messages = 0;
    699   _ISR_Enable( level );
    700   return count;
    701 }
    702 
    703 /*PAGE
    704  *
    705554 *  _Message_queue_Submit
    706555 *
    707  *  This routine implements the directives q_send and q_urgent.  It
    708  *  processes a message that is to be submitted to the designated
    709  *  message queue.  The message will either be processed as a send
    710  *  send message which it will be inserted at the rear of the queue
    711  *  or it will be processed as an urgent message which will be inserted
    712  *  at the front of the queue.
     556 *  This routine implements the directives rtems_message_queue_send
     557 *  and rtems_message_queue_urgent.  It processes a message that is
     558 *  to be submitted to the designated message queue.  The message will
     559 *  either be processed as a send send message which it will be inserted
     560 *  at the rear of the queue or it will be processed as an urgent message
     561 *  which will be inserted at the front of the queue.
    713562 *
    714563 *  Input parameters:
     
    730579)
    731580{
    732   register Message_queue_Control *the_message_queue;
    733   Objects_Locations               location;
    734   Thread_Control                 *the_thread;
    735   Message_queue_Buffer_control   *the_message;
     581  register Message_queue_Control  *the_message_queue;
     582  Objects_Locations                location;
     583  CORE_message_queue_Status        core_status;
    736584
    737585  the_message_queue = _Message_queue_Get( id, &location );
     
    767615
    768616    case OBJECTS_LOCAL:
    769       if (size > the_message_queue->maximum_message_size)
    770       {
    771           _Thread_Enable_dispatch();
    772           return RTEMS_INVALID_SIZE;
    773       }
    774 
    775       /*
    776        * Is there a thread currently waiting on this message queue?
    777        */
    778      
    779       the_thread = _Thread_queue_Dequeue( &the_message_queue->Wait_queue );
    780       if ( the_thread )
    781       {
    782         _Message_queue_Copy_buffer(
    783           buffer,
    784           the_thread->Wait.return_argument,
    785           size
    786         );
    787         *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 = size;
    788        
    789         if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
    790           the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL;
    791 
    792           _Message_queue_MP_Send_response_packet(
    793             MESSAGE_QUEUE_MP_RECEIVE_RESPONSE,
    794             id,
    795             the_thread
    796           );
    797 
    798         }
    799         _Thread_Enable_dispatch();
    800         return RTEMS_SUCCESSFUL;
    801       }
    802 
    803       /*
    804        * No one waiting on this one currently.
    805        * Allocate a message buffer and store it away
    806        */
    807 
    808       if ( the_message_queue->number_of_pending_messages ==
    809            the_message_queue->maximum_pending_messages ) {
    810         _Thread_Enable_dispatch();
    811         return RTEMS_TOO_MANY;
    812       }
    813 
    814       the_message = _Message_queue_Allocate_message_buffer(the_message_queue);
    815       if ( the_message == 0) {
    816         _Thread_Enable_dispatch();
    817         return RTEMS_UNSATISFIED;
    818       }
    819 
    820       _Message_queue_Copy_buffer( buffer, the_message->Contents.buffer, size );
    821       the_message->Contents.size = size;
    822      
    823       the_message_queue->number_of_pending_messages += 1;
    824 
    825617      switch ( submit_type ) {
    826618        case MESSAGE_QUEUE_SEND_REQUEST:
    827           _Message_queue_Append( the_message_queue, the_message );
     619          core_status = _CORE_message_queue_Send(
     620                          &the_message_queue->message_queue,
     621                          buffer,
     622                          size,
     623                          id,
     624                          _Message_queue_Core_message_queue_mp_support
     625                        );
    828626          break;
    829627        case MESSAGE_QUEUE_URGENT_REQUEST:
    830           _Message_queue_Prepend( the_message_queue, the_message );
     628          core_status = _CORE_message_queue_Urgent(
     629                          &the_message_queue->message_queue,
     630                          buffer,
     631                          size,
     632                          id,
     633                          _Message_queue_Core_message_queue_mp_support
     634                        );
    831635          break;
     636        default:
     637          core_status = CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
     638          return RTEMS_INTERNAL_ERROR;   /* should never get here */
    832639      }
    833640
    834641      _Thread_Enable_dispatch();
     642      return _Message_queue_Translate_core_message_queue_return_code(
     643                core_status );
     644         
     645  }
     646  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
     647}
     648
     649/*PAGE
     650 *
     651 *  _Message_queue_Translate_core_message_queue_return_code
     652 *
     653 *  Input parameters:
     654 *    the_message_queue_status - message_queue status code to translate
     655 *
     656 *  Output parameters:
     657 *    rtems status code - translated RTEMS status code
     658 *
     659 */
     660 
     661rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
     662  unsigned32 the_message_queue_status
     663)
     664{
     665  switch ( the_message_queue_status ) {
     666    case  CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL:
    835667      return RTEMS_SUCCESSFUL;
    836          
    837     default:
    838       return RTEMS_INTERNAL_ERROR;       /* And they were such nice boys, too! */
    839   }
    840 }
     668    case  CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE:
     669      return RTEMS_INVALID_SIZE;
     670    case  CORE_MESSAGE_QUEUE_STATUS_TOO_MANY:
     671      return RTEMS_TOO_MANY;
     672    case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED:
     673      return RTEMS_UNSATISFIED;
     674    case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT:
     675      return RTEMS_UNSATISFIED;
     676    case CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED:
     677      return RTEMS_OBJECT_WAS_DELETED;
     678    case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT:
     679      return RTEMS_TIMEOUT;
     680    case THREAD_STATUS_PROXY_BLOCKING:
     681      return THREAD_STATUS_PROXY_BLOCKING;
     682  }
     683  _Internal_error_Occurred(         /* XXX */
     684    INTERNAL_ERROR_RTEMS_API,
     685    TRUE,
     686    the_message_queue_status
     687  );
     688  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
     689}
     690
     691/*PAGE
     692 *
     693 *  _Message_queue_Core_message_queue_mp_support
     694 *
     695 *  Input parameters:
     696 *    the_thread - the remote thread the message was submitted to
     697 *    id         - id of the message queue
     698 *
     699 *  Output parameters: NONE
     700 */
     701 
     702void  _Message_queue_Core_message_queue_mp_support (
     703  Thread_Control *the_thread,
     704  Objects_Id      id
     705)
     706{
     707  the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL;
     708 
     709  _Message_queue_MP_Send_response_packet(
     710    MESSAGE_QUEUE_MP_RECEIVE_RESPONSE,
     711    id,
     712    the_thread
     713  );
     714}
  • cpukit/rtems/src/msgmp.c

    rb3ac6a8d r3652ad35  
    134134      if (buffer) {
    135135          the_packet->Buffer.size = *size_p;
    136           _Message_queue_Copy_buffer(buffer,
    137                                      the_packet->Buffer.buffer,
    138                                      *size_p);
     136          _CORE_message_queue_Copy_buffer(
     137            buffer,
     138            the_packet->Buffer.buffer,
     139            *size_p
     140          );
    139141      }
    140142
     
    311313           the_packet->size;
    312314
    313         _Message_queue_Copy_buffer(
     315        _CORE_message_queue_Copy_buffer(
    314316          the_packet->Buffer.buffer,
    315317          the_thread->Wait.return_argument,
  • cpukit/rtems/src/sem.c

    rb3ac6a8d r3652ad35  
    117117
    118118  if ( !rtems_is_name_valid( name ) )
    119     return ( RTEMS_INVALID_NAME );
     119    return RTEMS_INVALID_NAME;
    120120
    121121  if ( _Attributes_Is_global( attribute_set ) ) {
    122122
    123123    if ( !_System_state_Is_multiprocessing )
    124       return( RTEMS_MP_NOT_CONFIGURED );
     124      return RTEMS_MP_NOT_CONFIGURED;
    125125
    126126    if ( _Attributes_Is_inherit_priority( attribute_set ) )
    127       return( RTEMS_NOT_DEFINED );
     127      return RTEMS_NOT_DEFINED;
    128128
    129129  } else if ( _Attributes_Is_inherit_priority( attribute_set ) ) {
     
    131131    if ( ! ( _Attributes_Is_binary_semaphore( attribute_set ) &&
    132132             _Attributes_Is_priority( attribute_set ) ) )
    133       return( RTEMS_NOT_DEFINED );
     133      return RTEMS_NOT_DEFINED;
    134134
    135135  }
    136136
    137137  if ( _Attributes_Is_binary_semaphore( attribute_set ) && ( count > 1 ) )
    138     return( RTEMS_INVALID_NUMBER );
     138    return RTEMS_INVALID_NUMBER;
    139139
    140140  _Thread_Disable_dispatch();             /* prevents deletion */
     
    144144  if ( !the_semaphore ) {
    145145    _Thread_Enable_dispatch();
    146     return( RTEMS_TOO_MANY );
     146    return RTEMS_TOO_MANY;
    147147  }
    148148
     
    152152    _Semaphore_Free( the_semaphore );
    153153    _Thread_Enable_dispatch();
    154     return( RTEMS_TOO_MANY );
     154    return RTEMS_TOO_MANY;
    155155  }
    156156
     
    211211    );
    212212  _Thread_Enable_dispatch();
    213   return( RTEMS_SUCCESSFUL );
     213  return RTEMS_SUCCESSFUL;
    214214}
    215215
     
    271271  switch ( location ) {
    272272    case OBJECTS_ERROR:
    273       return( RTEMS_INVALID_ID );
     273      return RTEMS_INVALID_ID;
    274274    case OBJECTS_REMOTE:
    275275      _Thread_Dispatch();
    276       return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT );
     276      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
    277277    case OBJECTS_LOCAL:
    278278      if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set) ) {
    279279        if ( _CORE_mutex_Is_locked( &the_semaphore->Core_control.mutex ) ) {
    280280          _Thread_Enable_dispatch();
    281           return( RTEMS_RESOURCE_IN_USE );
     281          return RTEMS_RESOURCE_IN_USE;
    282282        }
    283283        else
     
    311311      }
    312312      _Thread_Enable_dispatch();
    313       return( RTEMS_SUCCESSFUL );
    314   }
    315 
    316   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     313      return RTEMS_SUCCESSFUL;
     314  }
     315
     316  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    317317}
    318318
     
    346346  switch ( location ) {
    347347    case OBJECTS_ERROR:
    348       return( RTEMS_INVALID_ID );
     348      return RTEMS_INVALID_ID;
    349349    case OBJECTS_REMOTE:
    350350      return _Semaphore_MP_Send_request_packet(
     
    368368        );
    369369        _Thread_Enable_dispatch();
    370         return( _Semaphore_Translate_core_mutex_return_code(
    371                   _Thread_Executing->Wait.return_code ) );
     370        return _Semaphore_Translate_core_mutex_return_code(
     371                  _Thread_Executing->Wait.return_code );
    372372      } else {
    373373        _CORE_semaphore_Seize(
     
    378378        );
    379379        _Thread_Enable_dispatch();
    380         return( _Semaphore_Translate_core_semaphore_return_code(
    381                   _Thread_Executing->Wait.return_code ) );
     380        return _Semaphore_Translate_core_semaphore_return_code(
     381                  _Thread_Executing->Wait.return_code );
    382382      }
    383383  }
    384384
    385   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     385  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    386386}
    387387
     
    412412  switch ( location ) {
    413413    case OBJECTS_ERROR:
    414       return( RTEMS_INVALID_ID );
     414      return RTEMS_INVALID_ID;
    415415    case OBJECTS_REMOTE:
    416       return(
    417         _Semaphore_MP_Send_request_packet(
    418           SEMAPHORE_MP_RELEASE_REQUEST,
    419           id,
    420           0,                               /* Not used */
    421           MPCI_DEFAULT_TIMEOUT
    422         )
     416      return _Semaphore_MP_Send_request_packet(
     417        SEMAPHORE_MP_RELEASE_REQUEST,
     418        id,
     419        0,                               /* Not used */
     420        MPCI_DEFAULT_TIMEOUT
    423421      );
    424422    case OBJECTS_LOCAL:
     
    430428                       );
    431429        _Thread_Enable_dispatch();
    432         return( _Semaphore_Translate_core_mutex_return_code( mutex_status ) );
     430        return _Semaphore_Translate_core_mutex_return_code( mutex_status );
    433431      }
    434432      else
     
    439437                           );
    440438        _Thread_Enable_dispatch();
    441         return(
    442           _Semaphore_Translate_core_semaphore_return_code( semaphore_status ) );
    443   }
    444 
    445   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     439        return
     440          _Semaphore_Translate_core_semaphore_return_code( semaphore_status );
     441  }
     442
     443  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    446444}
    447445
     
    464462  switch ( the_mutex_status ) {
    465463    case  CORE_MUTEX_STATUS_SUCCESSFUL:
    466       return( RTEMS_SUCCESSFUL );
     464      return RTEMS_SUCCESSFUL;
    467465    case CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT:
    468       return( RTEMS_UNSATISFIED );
     466      return RTEMS_UNSATISFIED;
    469467    case CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED:
    470       return( RTEMS_INTERNAL_ERROR );
     468      return RTEMS_INTERNAL_ERROR;
    471469    case CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE:
    472       return( RTEMS_NOT_OWNER_OF_RESOURCE );
     470      return RTEMS_NOT_OWNER_OF_RESOURCE;
    473471    case CORE_MUTEX_WAS_DELETED:
    474       return( RTEMS_OBJECT_WAS_DELETED );
     472      return RTEMS_OBJECT_WAS_DELETED;
    475473    case CORE_MUTEX_TIMEOUT:
    476       return( RTEMS_TIMEOUT );
     474      return RTEMS_TIMEOUT;
    477475    case THREAD_STATUS_PROXY_BLOCKING:
    478       return( THREAD_STATUS_PROXY_BLOCKING );
    479   }
    480   _Internal_error_Occurred(
    481     INTERNAL_ERROR_RTEMS_API,
    482     TRUE,
    483     the_mutex_status
    484   );
    485   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     476      return THREAD_STATUS_PROXY_BLOCKING;
     477  }
     478  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    486479}
    487480
     
    504497  switch ( the_semaphore_status ) {
    505498    case  CORE_SEMAPHORE_STATUS_SUCCESSFUL:
    506       return( RTEMS_SUCCESSFUL );
     499      return RTEMS_SUCCESSFUL;
    507500    case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT:
    508       return( RTEMS_UNSATISFIED );
     501      return RTEMS_UNSATISFIED;
    509502    case CORE_SEMAPHORE_WAS_DELETED:
    510       return( RTEMS_OBJECT_WAS_DELETED );
     503      return RTEMS_OBJECT_WAS_DELETED;
    511504    case CORE_SEMAPHORE_TIMEOUT:
    512       return( RTEMS_TIMEOUT );
     505      return RTEMS_TIMEOUT;
    513506    case THREAD_STATUS_PROXY_BLOCKING:
    514       return( THREAD_STATUS_PROXY_BLOCKING );
    515   }
    516   _Internal_error_Occurred(
    517     INTERNAL_ERROR_RTEMS_API,
    518     TRUE,
    519     the_semaphore_status
    520   );
    521   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
    522   return( RTEMS_INTERNAL_ERROR );   /* unreached - only to remove warnings */
     507      return THREAD_STATUS_PROXY_BLOCKING;
     508  }
     509  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
    523510}
    524511
  • cpukit/rtems/src/tasks.c

    rb3ac6a8d r3652ad35  
    115115 
    116116  _ISR_Disable( level );
    117 
    118   signal_set = asr->signals_posted;
    119  
    120   if ( signal_set ) {
    121   /* if ( _ASR_Are_signals_pending( asr ) ) {
    122  
    123     signal_set          = asr->signals_posted; */
     117    signal_set = asr->signals_posted;
    124118    asr->signals_posted = 0;
    125     _ISR_Enable( level );
    126  
    127     asr->nest_level += 1;
    128     rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode );
    129  
    130     (*asr->handler)( signal_set );
    131  
    132     asr->nest_level -= 1;
    133     rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode );
    134   }
    135   else
    136     _ISR_Enable( level );
     119  _ISR_Enable( level );
     120 
     121 
     122  if ( !signal_set ) /* similar to _ASR_Are_signals_pending( asr ) */
     123    return;
     124 
     125  asr->nest_level += 1;
     126  rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode );
     127 
     128  (*asr->handler)( signal_set );
     129
     130  asr->nest_level -= 1;
     131  rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode );
    137132
    138133}
Note: See TracChangeset for help on using the changeset viewer.