RTEMS
tc-space-profile.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 
10 /*
11  * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  * 1. Redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 /*
36  * Do not manually edit this file. It is part of the RTEMS quality process
37  * and was automatically generated.
38  *
39  * If you find something that needs to be fixed or worded better please
40  * post a report to an RTEMS mailing list or raise a bug report:
41  *
42  * https://docs.rtems.org/branches/master/user/support/bugs.html
43  *
44  * For information on updating and regenerating please refer to:
45  *
46  * https://docs.rtems.org/branches/master/eng/req/howto.html
47  */
48 
49 #ifdef HAVE_CONFIG_H
50 #include "config.h"
51 #endif
52 
53 #include <rtems.h>
54 #include <stdlib.h>
55 #include <rtems/malloc.h>
56 
57 #include <rtems/test.h>
58 
95 T_TEST_CASE( TestsuitesValidationCLibrary )
96 {
97  void *p;
98  int s;
99  int d;
100 
101  T_plan(5);
102 
103  p = aligned_alloc(128, 4);
104  T_step_not_null(0, p);
105  T_step_eq_uptr(1, (uintptr_t) p % 128, 0);
106 
107  p = rtems_malloc(4);
108  T_step_not_null(2, p);
109 
110  d = 1;
111  memset(&d, 0, sizeof(d));
112  T_step_eq_int(3, d, 0);
113 
114  s = 1;
115  d = 2;
116  memcpy(&d, &s, sizeof(d));
117  T_step_eq_int(4, d, 1);
118 }
119 
162 T_TEST_CASE( TestsuitesValidationClassicBarrier )
163 {
164  static const rtems_name name = rtems_build_name('B', 'A', 'R', 'R');
166  rtems_id id;
167  rtems_id id2;
168  uint32_t released;
169 
170  T_plan(6);
171 
172  id = 0xffffffff;
174  T_step_rsc_success(0, sc);
175 
176  id2 = 0xffffffff;
177  sc = rtems_barrier_ident(name, &id2);
178  T_step_rsc_success(1, sc);
179  T_step_eq_u32(2, id, id2);
180 
181  released = 1;
182  sc = rtems_barrier_release(id, &released);
183  T_step_rsc_success(3, sc);
184  T_step_eq_u32(4, released, 0);
185 
187  T_step_rsc_success(5, sc);
188 
189  T_check_rtems_barriers(T_EVENT_RUN_INITIALIZE_EARLY, T_case_name());
190 }
191 
rtems_status_code rtems_barrier_release(rtems_id id, uint32_t *released)
%
rtems_status_code rtems_barrier_wait(rtems_id id, rtems_interval timeout)
%
Definition: barrierwait.c:30
void * rtems_malloc(size_t size) RTEMS_MALLOCLIKE RTEMS_ALLOC_SIZE(1) RTEMS_WARN_UNUSED_RESULT
Allocates a memory area of the specified size from the heap.
uint32_t rtems_name
This type is used to represent a Classic API object name.
Definition: types.h:227
#define rtems_build_name(_C1, _C2, _C3, _C4)
%
Definition: object.h:179
rtems_status_code rtems_barrier_create(rtems_name name, rtems_attribute attribute_set, uint32_t maximum_waiters, rtems_id *id)
%
Definition: barriercreate.c:29
#define RTEMS_NO_TIMEOUT
This clock tick interval constant indicates that the calling task is willing to wait potentially fore...
Definition: types.h:237
rtems_status_code rtems_barrier_ident(rtems_name name, rtems_id *id)
Identifies a barrier object by the specified object name.
Definition: barrierident.c:44
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
This header file defines the RTEMS Classic API.
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
#define RTEMS_BARRIER_AUTOMATIC_RELEASE
This attribute constant indicates that a Classic API Barrier object shall use the automatic release p...
Definition: attr.h:101