RTEMS
tc-message-ident.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 
9 /*
10  * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  * notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  * notice, this list of conditions and the following disclaimer in the
19  * documentation and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 /*
35  * Do not manually edit this file. It is part of the RTEMS quality process
36  * and was automatically generated.
37  *
38  * If you find something that needs to be fixed or worded better please
39  * post a report to an RTEMS mailing list or raise a bug report:
40  *
41  * https://docs.rtems.org/branches/master/user/support/bugs.html
42  *
43  * For information on updating and regenerating please refer to:
44  *
45  * https://docs.rtems.org/branches/master/eng/req/howto.html
46  */
47 
48 #ifdef HAVE_CONFIG_H
49 #include "config.h"
50 #endif
51 
52 #include "tr-object-ident.h"
53 
54 #include <rtems/test.h>
55 
71 static RTEMS_MESSAGE_QUEUE_BUFFER( 1 ) ClassicMessageIdentBuffers[ 1 ];
72 
73 static rtems_message_queue_config ClassicObjectIdentConfig = {
74  .name = ClassicObjectIdentName,
75  .maximum_pending_messages = RTEMS_ARRAY_SIZE( ClassicMessageIdentBuffers ),
76  .maximum_message_size = 1,
77  .storage_area = ClassicMessageIdentBuffers,
78  .storage_size = sizeof( ClassicMessageIdentBuffers ),
79  .attributes = RTEMS_DEFAULT_ATTRIBUTES
80 };
81 
82 static rtems_status_code ClassicMessageIdentAction(
83  rtems_name name,
84  uint32_t node,
85  rtems_id *id
86 )
87 {
88  return rtems_message_queue_ident( name, node, id );
89 }
90 
94 T_TEST_CASE( RtemsMessageValIdent )
95 {
97  rtems_id id_local_object;
98 
100  &ClassicObjectIdentConfig,
101  &id_local_object
102  );
103  T_assert_rsc_success( sc );
104 
106  id_local_object,
107  ClassicMessageIdentAction
108  );
109 
110  sc = rtems_message_queue_delete( id_local_object );
111  T_rsc_success( sc );
112 }
113 
rtems_status_code rtems_message_queue_delete(rtems_id id)
%
Definition: msgqdelete.c:24
#define RTEMS_MESSAGE_QUEUE_BUFFER(_maximum_message_size)
Defines a structure which can be used as a message queue buffer for messages of the specified maximum...
Definition: message.h:171
uint32_t rtems_name
This type is used to represent a Classic API object name.
Definition: types.h:227
#define RTEMS_DEFAULT_ATTRIBUTES
This is the default value for an attribute set.
Definition: attr.h:140
rtems_name name
This member defines the name of the message queue.
Definition: message.h:91
void RtemsReqIdent_Run(rtems_id id_local_object, rtems_status_code(*action)(rtems_name, uint32_t, rtems_id *))
Runs the parameterized test case.
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
This structure defines the configuration of a message queue constructed by rtems_message_queue_constr...
Definition: message.h:87
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
#define RTEMS_ARRAY_SIZE(_array)
Returns the element count of the specified array.
Definition: basedefs.h:459
rtems_status_code rtems_message_queue_ident(rtems_name name, uint32_t node, rtems_id *id)
Identifies a message queue object by the specified object name.
Definition: msgqident.c:44
rtems_status_code rtems_message_queue_construct(const rtems_message_queue_config *config, rtems_id *id)
Constructs a message queue from the specified the message queue configuration.
Definition: msgqconstruct.c:45