Changeset 4a4f41e in rtems


Ignore:
Timestamp:
Sep 23, 2020, 2:47:58 PM (2 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
febc6604
Parents:
24ea1ce
git-author:
Sebastian Huber <sebastian.huber@…> (09/23/20 14:47:58)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/28/20 05:16:01)
Message:

rtems: Add rtems_message_queue_construct()

In contrast to message queues created by rtems_message_queue_create(), the
message queues constructed by this directive use a user-provided message buffer
storage area.

Add RTEMS_MESSAGE_QUEUE_BUFFER() to define a message buffer type for message
buffer storage areas.

Update #4007.

Files:
2 added
15 edited

Legend:

Unmodified
Added
Removed
  • cpukit/Makefile.am

    r24ea1ce r4a4f41e  
    707707librtemscpu_a_SOURCES += rtems/src/msg.c
    708708librtemscpu_a_SOURCES += rtems/src/msgqbroadcast.c
     709librtemscpu_a_SOURCES += rtems/src/msgqconstruct.c
    709710librtemscpu_a_SOURCES += rtems/src/msgqcreate.c
    710711librtemscpu_a_SOURCES += rtems/src/msgqdelete.c
     
    840841librtemscpu_a_SOURCES += score/src/coremsgseize.c
    841842librtemscpu_a_SOURCES += score/src/coremsgsubmit.c
     843librtemscpu_a_SOURCES += score/src/coremsgwkspace.c
    842844librtemscpu_a_SOURCES += score/src/coremutexseize.c
    843845librtemscpu_a_SOURCES += score/src/percpu.c
  • cpukit/include/rtems/rtems/message.h

    r24ea1ce r4a4f41e  
    2222#include <rtems/rtems/status.h>
    2323#include <rtems/rtems/types.h>
     24#include <rtems/score/coremsgbuffer.h>
    2425
    2526#ifdef __cplusplus
     
    3637 */
    3738/**@{*/
     39
     40/**
     41 * @brief This structure defines the configuration of a message queue
     42 *   constructed by rtems_message_queue_construct().
     43 */
     44typedef struct {
     45  /**
     46   * @brief This member defines the name of the message queue.
     47   */
     48  rtems_name name;
     49
     50  /**
     51   * @brief This member defines the maximum number of pending messages supported
     52   *   by the message queue.
     53   */
     54  uint32_t maximum_pending_messages;
     55
     56  /**
     57   * @brief This member defines the maximum message size supported by the message
     58   *   queue.
     59   */
     60  size_t maximum_message_size;
     61
     62  /**
     63   * @brief This member shall point to the message buffer storage area begin.
     64   *
     65   * The message buffer storage area for the message queue shall be an array of
     66   * the type defined by RTEMS_MESSAGE_QUEUE_BUFFER() with a maximum message size
     67   * equal to the maximum message size of this configuration.
     68   */
     69  void *storage_area;
     70
     71  /**
     72   * @brief This member defines size of the message buffer storage area in bytes.
     73   */
     74  size_t storage_size;
     75
     76  /**
     77   * @brief This member defines the optional handler to free the message buffer
     78   *   storage area.
     79   *
     80   * It is called when the message queue is deleted.  It is called from task
     81   * context under protection of the object allocator lock.  It is allowed to
     82   * call free() in this handler.  If handler is NULL, then no action will be
     83   * performed.
     84   */
     85  void ( *storage_free )( void * );
     86
     87  /**
     88   * @brief This member defines the attributes of the message queue.
     89   */
     90  rtems_attribute attributes;
     91} rtems_message_queue_config;
     92
     93/**
     94 * @brief Defines a structure which can be used as a message queue buffer for
     95 *   messages of the specified maximum size.
     96 *
     97 * Use this macro to define the message buffer storage area for
     98 * rtems_message_queue_construct().
     99 *
     100 * @param _maximum_message_size is the maximum message size in bytes.
     101 */
     102#define RTEMS_MESSAGE_QUEUE_BUFFER( _maximum_message_size ) \
     103  struct { \
     104    CORE_message_queue_Buffer _buffer; \
     105    char _message[ _maximum_message_size ]; \
     106  }
     107
     108/**
     109 * @brief Constructs a message queue from the specified the message queue
     110 *   configuration.
     111 *
     112 * In contrast to message queues created by rtems_message_queue_create(), the
     113 * message queues constructed by this directive use a user-provided message
     114 * buffer storage area.
     115 *
     116 * This directive is intended for applications which do not want to use the
     117 * RTEMS Workspace and instead statically allocate all operating system
     118 * resources.  An application based solely on static allocation can avoid any
     119 * runtime memory allocators.  This can simplify the application architecture
     120 * as well as any analysis that may be required.
     121 *
     122 * The value for #CONFIGURE_MESSAGE_BUFFER_MEMORY should not include memory for
     123 * message queues constructed by rtems_message_queue_construct().
     124 *
     125 * @param config is the message queue configuration.
     126 *
     127 * @param[out] id is the pointer to an object identifier variable.  The
     128 *   identifier of the constructed message queue object will be stored in this
     129 *   variable, in case of a successful operation.
     130 *
     131 * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
     132 *
     133 * @retval ::RTEMS_INVALID_ADDRESS The id parameter was NULL.
     134 *
     135 * @retval ::RTEMS_INVALID_NAME The message queue name in the configuration was
     136 *   invalid.
     137 *
     138 * @retval ::RTEMS_INVALID_NUMBER The maximum number of pending messages in the
     139 *   configuration was zero.
     140 *
     141 * @retval ::RTEMS_INVALID_SIZE The maximum message size in the configuration
     142 *   was zero.
     143 *
     144 * @retval ::RTEMS_TOO_MANY There was no inactive message queue object
     145 *   available to construct a message queue.
     146 *
     147 * @retval ::RTEMS_TOO_MANY In multiprocessing configurations, there was no
     148 *   inactive global object available to construct a global message queue.
     149 *
     150 * @retval ::RTEMS_INVALID_SIZE The maximum message size in the configuration
     151 *   was too big and resulted in integer overflows in calculations carried out
     152 *   to determine the size of the message buffer area.
     153 *
     154 * @retval ::RTEMS_INVALID_NUMBER The maximum number of pending messages in the
     155 *   configuration was too big and resulted in integer overflows in
     156 *   calculations carried out to determine the size of the message buffer area.
     157 *
     158 * @retval ::RTEMS_UNSATISFIED The message queue storage area begin pointer in
     159 *   the configuration was NULL.
     160 *
     161 * @retval ::RTEMS_UNSATISFIED The message queue storage area size in the
     162 *   configuration was not equal to the size calculated from the maximum number
     163 *   of pending messages and the maximum message size.
     164 */
     165rtems_status_code rtems_message_queue_construct(
     166  const rtems_message_queue_config *config,
     167  rtems_id                         *id
     168);
    38169
    39170/**
  • cpukit/include/rtems/rtems/messageimpl.h

    r24ea1ce r4a4f41e  
    102102}
    103103
     104/**
     105 * @brief Creates a message queue.
     106 *
     107 * @param config is the message queue configuration.
     108 *
     109 * @param[out] id contains the object identifier if the operation was
     110 *   successful.
     111 *
     112 * @param allocate_buffers is the message buffer storage area allocation
     113 *   handler.
     114 */
     115rtems_status_code _Message_queue_Create(
     116  const rtems_message_queue_config    *config,
     117  rtems_id                            *id,
     118  CORE_message_queue_Allocate_buffers  allocate_buffers
     119);
     120
    104121/**@}*/
    105122
  • cpukit/include/rtems/score/coremsg.h

    r24ea1ce r4a4f41e  
    125125   */
    126126  CORE_message_queue_Buffer         *message_buffers;
     127
     128  /**
     129   * @brief This member contains the optional message buffer storage area free
     130   * handler.
     131   *
     132   * It may be NULL.  In this case no action is performed to free the message
     133   * buffer storage area.
     134   */
     135  void                            ( *free_message_buffers )( void * );
     136
    127137  #if defined(RTEMS_SCORE_COREMSG_ENABLE_NOTIFICATION)
    128138    /** This is the routine invoked when the message queue transitions
  • cpukit/include/rtems/score/coremsgimpl.h

    r24ea1ce r4a4f41e  
    7070
    7171/**
     72 * @brief This handler shall allocate the message buffer storage area for a
     73 *   message queue.
     74 *
     75 * The handler shall set the CORE_message_queue_Control::free_message_buffers
     76 * member.
     77 *
     78 * @param[out] the_message_queue is the message queue control.
     79 *
     80 * @param size is the message buffer storage area size to allocate.
     81 *
     82 * @param arg is the handler argument.
     83 *
     84 * @retval NULL The allocation failed.
     85 *
     86 * @return Otherwise the pointer to the allocated message buffer storage area
     87 *   begin shall be returned.
     88 */
     89typedef void *( *CORE_message_queue_Allocate_buffers )(
     90  CORE_message_queue_Control *the_message_queue,
     91  size_t                      size,
     92  const void                 *arg
     93);
     94
     95/**
     96 * @brief This handler allocates the message buffer storage area for a message
     97 *   queue from the RTEMS Workspace.
     98 *
     99 * The handler sets the CORE_message_queue_Control::free_message_buffers
     100 * to _Workspace_Free().
     101 *
     102 * @param[out] the_message_queue is the message queue control.
     103 *
     104 * @param size is the message buffer storage area size to allocate.
     105 *
     106 * @param arg is the unused handler argument.
     107 *
     108 * @retval NULL The allocation failed.
     109 *
     110 * @return Otherwise the pointer to the allocated message buffer storage area
     111 *   begin is returned.
     112 */
     113void *_CORE_message_queue_Workspace_allocate(
     114  CORE_message_queue_Control *the_message_queue,
     115  size_t                      size,
     116  const void                 *arg
     117);
     118
     119/**
    72120 * @brief Initializes a message queue.
    73121 *
     
    82130 *   sent to this message queue instance.
    83131 *
     132 * @param allocate_buffers is the message buffer storage area allocation
     133 *   handler.
     134 *
     135 * @param arg is the message buffer storage area allocation handler argument.
     136 *
    84137 * @retval STATUS_SUCCESSFUL The message queue was initialized.
    85138 *
     
    87140 *   pending messages or maximum message size produced an integer overflow.
    88141 *
    89  * @retval STATUS_MESSAGE_QUEUE_NO_MEMORY There was not enough memory to
    90  *   allocate the message buffers.
     142 * @retval STATUS_MESSAGE_QUEUE_NO_MEMORY The message buffer storage area
     143 *   allocation failed.
    91144 */
    92145Status_Control _CORE_message_queue_Initialize(
    93   CORE_message_queue_Control     *the_message_queue,
    94   CORE_message_queue_Disciplines  discipline,
    95   uint32_t                        maximum_pending_messages,
    96   size_t                          maximum_message_size
     146  CORE_message_queue_Control          *the_message_queue,
     147  CORE_message_queue_Disciplines       discipline,
     148  uint32_t                             maximum_pending_messages,
     149  size_t                               maximum_message_size,
     150  CORE_message_queue_Allocate_buffers  allocate_buffers,
     151  const void                          *arg
    97152);
    98153
  • cpukit/posix/src/mqueueopen.c

    r24ea1ce r4a4f41e  
    103103    CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO,
    104104    attr->mq_maxmsg,
    105     attr->mq_msgsize
     105    attr->mq_msgsize,
     106    _CORE_message_queue_Workspace_allocate,
     107    NULL
    106108  );
    107109
  • cpukit/rtems/src/msgqcreate.c

    r24ea1ce r4a4f41e  
     1/* SPDX-License-Identifier: BSD-2-Clause */
     2
    13/**
    2  *  @file
     4 * @file
    35 *
    4  *  @brief RTEMS Create Message Queue
    5  *  @ingroup ClassicMessageQueue
     6 * @ingroup ClassicMessageQueueImpl
     7 *
     8 * @brief This source file contains the implementation of
     9 *   rtems_message_queue_create().
    610 */
    711
    812/*
    9  *  COPYRIGHT (c) 1989-2014.
    10  *  On-Line Applications Research Corporation (OAR).
     13 * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
    1114 *
    12  *  The license and distribution terms for this file may be
    13  *  found in the file LICENSE in this distribution or at
    14  *  http://www.rtems.org/license/LICENSE.
     15 * Redistribution and use in source and binary forms, with or without
     16 * modification, are permitted provided that the following conditions
     17 * are met:
     18 * 1. Redistributions of source code must retain the above copyright
     19 *    notice, this list of conditions and the following disclaimer.
     20 * 2. Redistributions in binary form must reproduce the above copyright
     21 *    notice, this list of conditions and the following disclaimer in the
     22 *    documentation and/or other materials provided with the distribution.
     23 *
     24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
     28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     34 * POSSIBILITY OF SUCH DAMAGE.
    1535 */
    1636
     
    2040
    2141#include <rtems/rtems/messageimpl.h>
    22 #include <rtems/rtems/status.h>
    23 #include <rtems/rtems/attrimpl.h>
    24 #include <rtems/rtems/options.h>
    25 #include <rtems/rtems/support.h>
    26 #include <rtems/score/sysstate.h>
    27 #include <rtems/score/chain.h>
    28 #include <rtems/score/isr.h>
    2942#include <rtems/score/coremsgimpl.h>
    30 #include <rtems/score/thread.h>
    31 #include <rtems/score/wkspace.h>
    32 #include <rtems/sysinit.h>
     43
     44#include <string.h>
    3345
    3446rtems_status_code rtems_message_queue_create(
     
    4052)
    4153{
    42   Message_queue_Control          *the_message_queue;
    43   CORE_message_queue_Disciplines  discipline;
    44   Status_Control                  status;
    45 #if defined(RTEMS_MULTIPROCESSING)
    46   bool                            is_global;
    47 #endif
     54  rtems_message_queue_config config;
    4855
    49   if ( !rtems_is_name_valid( name ) )
    50     return RTEMS_INVALID_NAME;
     56  memset( &config, 0, sizeof( config ) );
     57  config.name = name;
     58  config.maximum_pending_messages = count;
     59  config.maximum_message_size = max_message_size;
     60  config.attributes = attribute_set;
    5161
    52   if ( !id )
    53     return RTEMS_INVALID_ADDRESS;
    54 
    55 #if defined(RTEMS_MULTIPROCESSING)
    56   if ( _System_state_Is_multiprocessing ) {
    57     is_global = _Attributes_Is_global( attribute_set );
    58   } else {
    59     is_global = false;
    60   }
    61 #endif
    62 
    63   if ( count == 0 )
    64       return RTEMS_INVALID_NUMBER;
    65 
    66   if ( max_message_size == 0 )
    67       return RTEMS_INVALID_SIZE;
    68 
    69 #if defined(RTEMS_MULTIPROCESSING)
    70 #if 1
    71   /*
    72    * I am not 100% sure this should be an error.
    73    * It seems reasonable to create a que with a large max size,
    74    * and then just send smaller msgs from remote (or all) nodes.
    75    */
    76   if ( is_global ) {
    77     size_t max_packet_payload_size = _MPCI_table->maximum_packet_size
    78       - MESSAGE_QUEUE_MP_PACKET_SIZE;
    79 
    80     if ( max_message_size > max_packet_payload_size ) {
    81       return RTEMS_INVALID_SIZE;
    82     }
    83   }
    84 #endif
    85 #endif
    86 
    87   the_message_queue = _Message_queue_Allocate();
    88 
    89   if ( !the_message_queue ) {
    90     _Objects_Allocator_unlock();
    91     return RTEMS_TOO_MANY;
    92   }
    93 
    94 #if defined(RTEMS_MULTIPROCESSING)
    95   if ( is_global &&
    96     !( _Objects_MP_Allocate_and_open( &_Message_queue_Information,
    97                               name, the_message_queue->Object.id, false ) ) ) {
    98     _Message_queue_Free( the_message_queue );
    99     _Objects_Allocator_unlock();
    100     return RTEMS_TOO_MANY;
    101   }
    102 
    103   the_message_queue->is_global = is_global;
    104 #endif
    105 
    106   if (_Attributes_Is_priority( attribute_set ) )
    107     discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY;
    108   else
    109     discipline = CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO;
    110 
    111   status = _CORE_message_queue_Initialize(
    112     &the_message_queue->message_queue,
    113     discipline,
    114     count,
    115     max_message_size
     62  return _Message_queue_Create(
     63    &config,
     64    id,
     65    _CORE_message_queue_Workspace_allocate
    11666  );
    117 
    118   if ( status != STATUS_SUCCESSFUL ) {
    119 #if defined(RTEMS_MULTIPROCESSING)
    120     if ( is_global )
    121         _Objects_MP_Close(
    122           &_Message_queue_Information, the_message_queue->Object.id);
    123 #endif
    124 
    125     _Message_queue_Free( the_message_queue );
    126     _Objects_Allocator_unlock();
    127     return STATUS_GET_CLASSIC( status );
    128   }
    129 
    130   _Objects_Open(
    131     &_Message_queue_Information,
    132     &the_message_queue->Object,
    133     (Objects_Name) name
    134   );
    135 
    136   *id = the_message_queue->Object.id;
    137 
    138 #if defined(RTEMS_MULTIPROCESSING)
    139   if ( is_global )
    140     _Message_queue_MP_Send_process_packet(
    141       MESSAGE_QUEUE_MP_ANNOUNCE_CREATE,
    142       the_message_queue->Object.id,
    143       name,
    144       0
    145     );
    146 #endif
    147 
    148   _Objects_Allocator_unlock();
    149   return RTEMS_SUCCESSFUL;
    15067}
    151 
    152 static void _Message_queue_Manager_initialization( void )
    153 {
    154   _Objects_Initialize_information( &_Message_queue_Information);
    155 }
    156 
    157 RTEMS_SYSINIT_ITEM(
    158   _Message_queue_Manager_initialization,
    159   RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE,
    160   RTEMS_SYSINIT_ORDER_MIDDLE
    161 );
  • cpukit/score/src/coremsg.c

    r24ea1ce r4a4f41e  
    2121#include <rtems/score/coremsgimpl.h>
    2222#include <rtems/score/assert.h>
    23 #include <rtems/score/wkspace.h>
    2423
    2524#define MESSAGE_SIZE_LIMIT \
     
    3332
    3433Status_Control _CORE_message_queue_Initialize(
    35   CORE_message_queue_Control     *the_message_queue,
    36   CORE_message_queue_Disciplines  discipline,
    37   uint32_t                        maximum_pending_messages,
    38   size_t                          maximum_message_size
     34  CORE_message_queue_Control          *the_message_queue,
     35  CORE_message_queue_Disciplines       discipline,
     36  uint32_t                             maximum_pending_messages,
     37  size_t                               maximum_message_size,
     38  CORE_message_queue_Allocate_buffers  allocate_buffers,
     39  const void                          *arg
    3940)
    4041{
     
    5758  }
    5859
    59   the_message_queue->message_buffers = _Workspace_Allocate(
    60     (size_t) maximum_pending_messages * buffer_size
     60  the_message_queue->message_buffers = ( *allocate_buffers )(
     61    the_message_queue,
     62    (size_t) maximum_pending_messages * buffer_size,
     63    arg
    6164  );
    6265
  • cpukit/score/src/coremsgclose.c

    r24ea1ce r4a4f41e  
    2020
    2121#include <rtems/score/coremsgimpl.h>
    22 #include <rtems/score/wkspace.h>
    2322
    2423static Thread_Control *_CORE_message_queue_Was_deleted(
     
    5150  );
    5251
    53   (void) _Workspace_Free( the_message_queue->message_buffers );
     52  if ( the_message_queue->free_message_buffers != NULL ) {
     53    ( *the_message_queue->free_message_buffers )(
     54      the_message_queue->message_buffers
     55    );
     56  }
    5457
    5558  _Thread_queue_Destroy( &the_message_queue->Wait_queue );
  • spec/build/cpukit/librtemscpu.yml

    r24ea1ce r4a4f41e  
    11991199- cpukit/rtems/src/msg.c
    12001200- cpukit/rtems/src/msgqbroadcast.c
     1201- cpukit/rtems/src/msgqconstruct.c
    12011202- cpukit/rtems/src/msgqcreate.c
    12021203- cpukit/rtems/src/msgqdelete.c
     
    13771378- cpukit/score/src/coremsgseize.c
    13781379- cpukit/score/src/coremsgsubmit.c
     1380- cpukit/score/src/coremsgwkspace.c
    13791381- cpukit/score/src/coremutexseize.c
    13801382- cpukit/score/src/corerwlock.c
  • testsuites/mptests/mp09/initimpl.h

    r24ea1ce r4a4f41e  
    2727#include "system.h"
    2828
     29#if CONFIGURE_MP_NODE_NUMBER == 1
     30
     31#define MESSAGE_SIZE 1
     32
     33static RTEMS_MESSAGE_QUEUE_BUFFER( MESSAGE_SIZE ) buffers[ 1 ];
     34
     35static const rtems_message_queue_config config = {
     36  .name = rtems_build_name( 'M', 'S', 'G', '2' ),
     37  .maximum_pending_messages = RTEMS_ARRAY_SIZE( buffers ),
     38  .maximum_message_size = MESSAGE_SIZE,
     39  .storage_area = buffers,
     40  .storage_size = sizeof( buffers ),
     41  .attributes = RTEMS_GLOBAL
     42};
     43
     44#endif
     45
    2946rtems_task Init(
    3047  rtems_task_argument argument
     
    4158  Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
    4259
    43   Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' );
     60  Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', '1' );
     61  Queue_name[ 2 ] = rtems_build_name( 'M', 'S', 'G', '2' );
    4462
    4563  if ( rtems_object_get_local_node() == 1 ) {
    4664    puts( "Creating Message Queue (Global)" );
     65
     66#if CONFIGURE_MP_NODE_NUMBER == 1
     67    status = rtems_message_queue_construct( &config, &Queue_id[ 2 ] );
     68    directive_failed( status, "rtems_message_queue_construct" );
     69#endif
     70
    4771    status = rtems_message_queue_create(
    4872      Queue_name[ 1 ],
  • testsuites/mptests/mp09/system.h

    r24ea1ce r4a4f41e  
    3535#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
    3636
    37 #define CONFIGURE_MAXIMUM_TASKS               2
    38 #define CONFIGURE_MAXIMUM_TIMERS              1
    39 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES      1
    40 #define CONFIGURE_MESSAGE_BUFFER_MEMORY \
    41   CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 3, 16 )
     37#define CONFIGURE_MAXIMUM_TASKS 2
     38#define CONFIGURE_MAXIMUM_TIMER 1
     39
     40#if CONFIGURE_MP_NODE_NUMBER == 1
     41  #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
     42  #define CONFIGURE_MESSAGE_BUFFER_MEMORY \
     43    CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 3, 16 )
     44#endif
    4245
    4346#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
     
    5053TEST_EXTERN rtems_name Task_name[ 4 ];   /* array of task names */
    5154
    52 TEST_EXTERN rtems_id   Queue_id[ 2 ];    /* array of message queue ids */
    53 TEST_EXTERN rtems_name Queue_name[ 2 ];  /* array of message queue names */
     55TEST_EXTERN rtems_id   Queue_id[ 3 ];    /* array of message queue ids */
     56TEST_EXTERN rtems_name Queue_name[ 3 ];  /* array of message queue names */
    5457
    5558extern char buffer1[16];
  • testsuites/mptests/mp09/task1.c

    r24ea1ce r4a4f41e  
    5050  } while ( !rtems_is_status_successful( status ) );
    5151
     52  status = rtems_message_queue_ident(
     53    Queue_name[ 2 ],
     54    RTEMS_SEARCH_ALL_NODES,
     55    &Queue_id[ 2 ]
     56  );
     57  directive_failed( status, "rtems_message_queue_ident" );
     58
    5259  if ( rtems_object_get_local_node() == 2 ) {
     60    status = rtems_message_queue_delete( Queue_id[ 2 ] );
     61    fatal_directive_status(
     62      status,
     63      RTEMS_ILLEGAL_ON_REMOTE_OBJECT,
     64      "rtems_message_queue_delete"
     65    );
    5366    status = rtems_message_queue_delete( Queue_id[ 1 ] );
    5467    fatal_directive_status(
     
    104117    status = rtems_message_queue_delete( Queue_id[ 1 ] );
    105118    directive_failed( status, "rtems_message_queue_delete" );
     119
     120    status = rtems_message_queue_delete( Queue_id[ 2 ] );
     121    directive_failed( status, "rtems_message_queue_delete" );
    106122  }
    107123
  • testsuites/sptests/sp13/init.c

    r24ea1ce r4a4f41e  
    2828
    2929const char rtems_test_name[] = "SP 13";
     30
     31static RTEMS_MESSAGE_QUEUE_BUFFER( MESSAGE_SIZE ) Queue_3_buffers[ 100 ];
     32
     33static const rtems_message_queue_config Queue_3_config = {
     34  .name = rtems_build_name( 'Q', '3', ' ', ' ' ),
     35  .maximum_pending_messages = RTEMS_ARRAY_SIZE( Queue_3_buffers ),
     36  .maximum_message_size = MESSAGE_SIZE,
     37  .storage_area = Queue_3_buffers,
     38  .storage_size = sizeof( Queue_3_buffers ),
     39  .attributes = RTEMS_GLOBAL
     40};
    3041
    3142rtems_task Init(
     
    102113  directive_failed( status, "rtems_message_queue_create of Q2" );
    103114
    104   status = rtems_message_queue_create(
    105     Queue_name[ 3 ],
    106     100,
    107     MESSAGE_SIZE,
    108     RTEMS_GLOBAL,
    109     &Queue_id[ 3 ]
    110   );
    111   directive_failed( status, "rtems_message_queue_create of Q3" );
     115  status = rtems_message_queue_construct( &Queue_3_config, &Queue_id[ 3 ] );
     116  directive_failed( status, "rtems_message_queue_construct of Q3" );
    112117
    113118  rtems_task_exit();
  • testsuites/sptests/sp13/system.h

    r24ea1ce r4a4f41e  
    9292   /* Q1 */ CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 100, MESSAGE_SIZE ) + \
    9393   /* Q2 */ CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 10, MESSAGE_SIZE ) + \
    94    /* Q3 */ CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 100, MESSAGE_SIZE ) + \
     94   /* Q3 is statically allocated */ \
    9595   /* Q1 */ CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 100, 20 ) + \
    9696   /* Q1 */ CONFIGURE_MESSAGE_BUFFERS_FOR_QUEUE( 2,  1030 )
Note: See TracChangeset for help on using the changeset viewer.