RTEMS
ts-validation-0.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 <rtems.h>
53 #include <rtems/bspIo.h>
54 #include <rtems/sysinit.h>
55 
56 #include <rtems/test.h>
57 
72 #include <rtems/test-info.h>
73 #include <rtems/testopts.h>
74 
75 const char rtems_test_name[] = "Validation0";
76 
77 static char buffer[ 512 ];
78 
79 static const T_action actions[] = {
80  T_report_hash_sha256,
81  T_check_task_context,
82  T_check_rtems_barriers,
83  T_check_rtems_extensions,
84  T_check_rtems_message_queues,
85  T_check_rtems_partitions,
86  T_check_rtems_periods,
87  T_check_rtems_semaphores,
88  T_check_rtems_tasks,
89  T_check_rtems_timers
90 };
91 
92 static const T_config test_config = {
93  .name = rtems_test_name,
94  .buf = buffer,
95  .buf_size = sizeof( buffer ),
96  .putchar = rtems_put_char,
97  .verbosity = RTEMS_TEST_VERBOSITY,
98  .now = T_now_clock,
99  .action_count = T_ARRAY_SIZE( actions ),
100  .actions = actions
101 };
102 
103 static void runner_task( rtems_task_argument arg )
104 {
105  int exit_code;
106 
107  (void) arg;
108 
109  rtems_test_begin( rtems_test_name, TEST_STATE );
110  T_register();
111  exit_code = T_main( &test_config );
112 
113  if ( exit_code == 0 ) {
115  }
116 
117  rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, (uint32_t) exit_code );
118 }
119 
120 #define MAX_TLS_SIZE RTEMS_ALIGN_UP( 64, RTEMS_TASK_STORAGE_ALIGNMENT )
121 
122 #define ATTRIBUTES RTEMS_FLOATING_POINT
123 
125 static char runner_task_storage[
127  MAX_TLS_SIZE + RTEMS_MINIMUM_STACK_SIZE,
128  ATTRIBUTES
129  )
130 ];
131 
132 static const rtems_task_config runner_task_config = {
133  .name = rtems_build_name( 'R', 'U', 'N', ' ' ),
134  .initial_priority = 1,
135  .storage_area = runner_task_storage,
136  .storage_size = sizeof( runner_task_storage ),
137  .maximum_thread_local_storage_size = MAX_TLS_SIZE,
138  .initial_modes = RTEMS_DEFAULT_MODES,
139  .attributes = ATTRIBUTES
140 };
141 
142 static void init_runner_task(void)
143 {
144  rtems_id id;
146 
147  sc = rtems_task_construct( &runner_task_config, &id );
148  if ( sc != RTEMS_SUCCESSFUL ) {
150  }
151 
152  sc = rtems_task_start( id, runner_task, 0 );
153  if ( sc != RTEMS_SUCCESSFUL ) {
155  }
156 }
157 
158 RTEMS_SYSINIT_ITEM(
159  init_runner_task,
160  RTEMS_SYSINIT_CLASSIC_USER_TASKS,
161  RTEMS_SYSINIT_ORDER_MIDDLE
162 );
163 
164 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
165 
166 #define CONFIGURE_MAXIMUM_PROCESSORS 4
167 
168 #define CONFIGURE_MAXIMUM_BARRIERS 3
169 
170 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 3
171 
172 #define CONFIGURE_MAXIMUM_PARTITIONS 3
173 
174 #define CONFIGURE_MAXIMUM_PERIODS 3
175 
176 #define CONFIGURE_MAXIMUM_SEMAPHORES 3
177 
178 #define CONFIGURE_MAXIMUM_TASKS 3
179 
180 #define CONFIGURE_MINIMUM_TASKS_WITH_USER_PROVIDED_STORAGE \
181  CONFIGURE_MAXIMUM_TASKS
182 
183 #define CONFIGURE_MAXIMUM_TIMERS 3
184 
185 #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 3
186 
187 #define CONFIGURE_MICROSECONDS_PER_TICK 1000
188 
189 #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 0
190 
191 #define CONFIGURE_DISABLE_NEWLIB_REENTRANCY
192 
193 #define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
194 
195 #define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION
196 
197 #define CONFIGURE_IDLE_TASK_BODY _CPU_Thread_Idle_body
198 
199 #if defined(RTEMS_SMP)
200 
201 #define CONFIGURE_SCHEDULER_EDF_SMP
202 
203 #include <rtems/scheduler.h>
204 
205 RTEMS_SCHEDULER_EDF_SMP(a);
206 
207 RTEMS_SCHEDULER_EDF_SMP(b);
208 
209 RTEMS_SCHEDULER_EDF_SMP(c);
210 
211 #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
212  RTEMS_SCHEDULER_TABLE_EDF_SMP(a, rtems_build_name('A', ' ', ' ', ' ')), \
213  RTEMS_SCHEDULER_TABLE_EDF_SMP(b, rtems_build_name('B', ' ', ' ', ' ')), \
214  RTEMS_SCHEDULER_TABLE_EDF_SMP(c, rtems_build_name('C', ' ', ' ', ' '))
215 
216 #define CONFIGURE_SCHEDULER_ASSIGNMENTS \
217  RTEMS_SCHEDULER_ASSIGN(0, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_MANDATORY), \
218  RTEMS_SCHEDULER_ASSIGN(1, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL), \
219  RTEMS_SCHEDULER_ASSIGN(2, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL), \
220  RTEMS_SCHEDULER_ASSIGN(2, RTEMS_SCHEDULER_ASSIGN_PROCESSOR_OPTIONAL)
221 
222 #endif /* RTEMS_SMP */
223 
224 #define CONFIGURE_INIT
225 
226 #include <rtems/confdefs.h>
227 
static RTEMS_NO_RETURN void rtems_fatal(rtems_fatal_source fatal_source, rtems_fatal_code error_code)
%
Definition: fatal.h:162
Evaluate Configuration Options.
rtems_name name
This member defines the name of the task.
Definition: tasks.h:138
#define rtems_build_name(_C1, _C2, _C3, _C4)
%
Definition: object.h:179
int rtems_test_begin(const char *name, const RTEMS_TEST_STATE state)
Prints a begin of test message using printf().
Definition: testbeginend.c:38
const char rtems_test_name[]
Each test must define a test name string.
This structure defines the configuration of a task constructed by rtems_task_construct().
Definition: tasks.h:134
rtems_status_code rtems_task_start(rtems_id id, rtems_task_entry entry_point, rtems_task_argument argument)
%
Definition: taskstart.c:25
Scheduler Configuration API.
CPU_Uint32ptr rtems_task_argument
This type is used to represent task argument values.
Definition: tasks.h:115
int rtems_test_end(const char *name)
Prints an end of test message using printf().
Definition: testbeginend.c:75
This status code indicates successful completion.
Definition: status.h:86
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
#define RTEMS_ALIGNED(_alignment)
Instructs the compiler in a declaration or definition to enforce the specified alignment.
Definition: basedefs.h:389
#define RTEMS_MINIMUM_STACK_SIZE
%
Definition: tasks.h:973
Fatal source of exit().
Definition: interr.h:84
This header file defines the RTEMS Classic API.
Interface to Kernel Print Methods.
void rtems_put_char(int c, void *arg)
Puts the character via rtems_putc().
#define RTEMS_TASK_STORAGE_SIZE(_size, _attributes)
Returns the recommended task storage area size for the specified size and task attributes.
Definition: tasks.h:1157
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
#define RTEMS_DEFAULT_MODES
This task mode constant represents the default mode set.
Definition: modes.h:137
rtems_status_code rtems_task_construct(const rtems_task_config *config, rtems_id *id)
Constructs a task from the specified the task configuration.
Definition: taskconstruct.c:73
#define RTEMS_TASK_STORAGE_ALIGNMENT
This constant defines the recommended alignment of a task storage area in bytes.
Definition: tasks.h:1135