1 | /* |
---|
2 | * Copyright (c) 2015, 2018 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * embedded brains GmbH |
---|
5 | * Dornierstr. 4 |
---|
6 | * 82178 Puchheim |
---|
7 | * Germany |
---|
8 | * <rtems@embedded-brains.de> |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.com/license/LICENSE. |
---|
13 | */ |
---|
14 | |
---|
15 | #ifdef HAVE_CONFIG_H |
---|
16 | #include "config.h" |
---|
17 | #endif |
---|
18 | |
---|
19 | #include "tmacros.h" |
---|
20 | |
---|
21 | #include <sys/types.h> |
---|
22 | #include <sys/stat.h> |
---|
23 | |
---|
24 | #include <assert.h> |
---|
25 | #include <pthread.h> |
---|
26 | #include <string.h> |
---|
27 | #include <stdlib.h> |
---|
28 | #include <unistd.h> |
---|
29 | |
---|
30 | #include <rtems.h> |
---|
31 | #include <rtems/ioimpl.h> |
---|
32 | #include <rtems/libio_.h> |
---|
33 | #include <rtems/sysinit.h> |
---|
34 | |
---|
35 | #include <rtems/extensionimpl.h> |
---|
36 | #ifdef RTEMS_POSIX_API |
---|
37 | #include <rtems/posix/barrierimpl.h> |
---|
38 | #include <rtems/posix/mqueueimpl.h> |
---|
39 | #include <rtems/posix/muteximpl.h> |
---|
40 | #include <rtems/posix/psignalimpl.h> |
---|
41 | #include <rtems/posix/pthreadimpl.h> |
---|
42 | #include <rtems/posix/rwlockimpl.h> |
---|
43 | #include <rtems/posix/semaphoreimpl.h> |
---|
44 | #include <rtems/posix/shmimpl.h> |
---|
45 | #include <rtems/posix/timerimpl.h> |
---|
46 | #endif /* RTEMS_POSIX_API */ |
---|
47 | #include <rtems/posix/keyimpl.h> |
---|
48 | #include <rtems/rtems/barrierimpl.h> |
---|
49 | #include <rtems/rtems/dpmemimpl.h> |
---|
50 | #include <rtems/rtems/messageimpl.h> |
---|
51 | #include <rtems/rtems/partimpl.h> |
---|
52 | #include <rtems/rtems/ratemonimpl.h> |
---|
53 | #include <rtems/rtems/regionimpl.h> |
---|
54 | #include <rtems/rtems/semimpl.h> |
---|
55 | #include <rtems/rtems/tasksimpl.h> |
---|
56 | #include <rtems/rtems/timerimpl.h> |
---|
57 | #include <rtems/score/apimutex.h> |
---|
58 | #include <rtems/score/chainimpl.h> |
---|
59 | #include <rtems/score/sysstate.h> |
---|
60 | #include <rtems/score/userextimpl.h> |
---|
61 | #include <rtems/score/wkspace.h> |
---|
62 | |
---|
63 | const char rtems_test_name[] = "SPSYSINIT 1"; |
---|
64 | |
---|
65 | typedef enum { |
---|
66 | BSP_WORK_AREAS_PRE, |
---|
67 | BSP_WORK_AREAS_POST, |
---|
68 | BSP_START_PRE, |
---|
69 | BSP_START_POST, |
---|
70 | CPU_COUNTER_PRE, |
---|
71 | CPU_COUNTER_POST, |
---|
72 | INITIAL_EXTENSIONS_PRE, |
---|
73 | INITIAL_EXTENSIONS_POST, |
---|
74 | DATA_STRUCTURES_PRE, |
---|
75 | DATA_STRUCTURES_POST, |
---|
76 | USER_EXTENSIONS_PRE, |
---|
77 | USER_EXTENSIONS_POST, |
---|
78 | CLASSIC_TASKS_PRE, |
---|
79 | CLASSIC_TASKS_POST, |
---|
80 | CLASSIC_TIMER_PRE, |
---|
81 | CLASSIC_TIMER_POST, |
---|
82 | CLASSIC_SIGNAL_PRE, |
---|
83 | CLASSIC_SIGNAL_POST, |
---|
84 | CLASSIC_EVENT_PRE, |
---|
85 | CLASSIC_EVENT_POST, |
---|
86 | CLASSIC_MESSAGE_QUEUE_PRE, |
---|
87 | CLASSIC_MESSAGE_QUEUE_POST, |
---|
88 | CLASSIC_SEMAPHORE_PRE, |
---|
89 | CLASSIC_SEMAPHORE_POST, |
---|
90 | CLASSIC_PARTITION_PRE, |
---|
91 | CLASSIC_PARTITION_POST, |
---|
92 | CLASSIC_REGION_PRE, |
---|
93 | CLASSIC_REGION_POST, |
---|
94 | CLASSIC_DUAL_PORTED_MEMORY_PRE, |
---|
95 | CLASSIC_DUAL_PORTED_MEMORY_POST, |
---|
96 | CLASSIC_RATE_MONOTONIC_PRE, |
---|
97 | CLASSIC_RATE_MONOTONIC_POST, |
---|
98 | CLASSIC_BARRIER_PRE, |
---|
99 | CLASSIC_BARRIER_POST, |
---|
100 | #ifdef RTEMS_POSIX_API |
---|
101 | POSIX_SIGNALS_PRE, |
---|
102 | POSIX_SIGNALS_POST, |
---|
103 | POSIX_THREADS_PRE, |
---|
104 | POSIX_THREADS_POST, |
---|
105 | POSIX_MESSAGE_QUEUE_PRE, |
---|
106 | POSIX_MESSAGE_QUEUE_POST, |
---|
107 | POSIX_SEMAPHORE_PRE, |
---|
108 | POSIX_SEMAPHORE_POST, |
---|
109 | POSIX_TIMER_PRE, |
---|
110 | POSIX_TIMER_POST, |
---|
111 | POSIX_SHM_PRE, |
---|
112 | POSIX_SHM_POST, |
---|
113 | #endif /* RTEMS_POSIX_API */ |
---|
114 | POSIX_KEYS_PRE, |
---|
115 | POSIX_KEYS_POST, |
---|
116 | #ifdef RTEMS_POSIX_API |
---|
117 | POSIX_CLEANUP_PRE, |
---|
118 | POSIX_CLEANUP_POST, |
---|
119 | #endif /* RTEMS_POSIX_API */ |
---|
120 | IDLE_THREADS_PRE, |
---|
121 | IDLE_THREADS_POST, |
---|
122 | LIBIO_PRE, |
---|
123 | LIBIO_POST, |
---|
124 | ROOT_FILESYSTEM_PRE, |
---|
125 | ROOT_FILESYSTEM_POST, |
---|
126 | BSP_PRE_DRIVERS_PRE, |
---|
127 | BSP_PRE_DRIVERS_POST, |
---|
128 | DEVICE_DRIVERS_PRE, |
---|
129 | DEVICE_DRIVERS_POST, |
---|
130 | CLASSIC_USER_TASKS_PRE, |
---|
131 | CLASSIC_USER_TASKS_POST, |
---|
132 | #ifdef RTEMS_POSIX_API |
---|
133 | POSIX_USER_THREADS_PRE, |
---|
134 | POSIX_USER_THREADS_POST, |
---|
135 | #endif /* RTEMS_POSIX_API */ |
---|
136 | STD_FILE_DESCRIPTORS_PRE, |
---|
137 | STD_FILE_DESCRIPTORS_POST, |
---|
138 | LAST_FIRST, |
---|
139 | LAST_SECOND, |
---|
140 | LAST_THIRD, |
---|
141 | LAST_FOURTH, |
---|
142 | LAST_FIFTH, |
---|
143 | LAST_SIXTH, |
---|
144 | LAST_SEVENTH, |
---|
145 | LAST_EIGHTH, |
---|
146 | LAST_NINETH, |
---|
147 | LAST_TENTH, |
---|
148 | LAST_MIDDLE, |
---|
149 | LAST_LAST, |
---|
150 | INIT_TASK, |
---|
151 | DONE |
---|
152 | } init_step; |
---|
153 | |
---|
154 | #define FIRST(x) \ |
---|
155 | static void x##_first(void); \ |
---|
156 | RTEMS_SYSINIT_ITEM( \ |
---|
157 | x##_first, \ |
---|
158 | x, \ |
---|
159 | RTEMS_SYSINIT_ORDER_FIRST \ |
---|
160 | ); \ |
---|
161 | static void x##_first(void) |
---|
162 | |
---|
163 | #define LAST(x) \ |
---|
164 | static void x##_last(void); \ |
---|
165 | RTEMS_SYSINIT_ITEM( \ |
---|
166 | x##_last, \ |
---|
167 | x, \ |
---|
168 | RTEMS_SYSINIT_ORDER_LAST \ |
---|
169 | ); \ |
---|
170 | static void x##_last(void) |
---|
171 | |
---|
172 | #define LAST_STEP(x) \ |
---|
173 | static void last_##x(void) \ |
---|
174 | { \ |
---|
175 | next_step(LAST_##x); \ |
---|
176 | } \ |
---|
177 | RTEMS_SYSINIT_ITEM( \ |
---|
178 | last_##x, \ |
---|
179 | RTEMS_SYSINIT_LAST, \ |
---|
180 | RTEMS_SYSINIT_ORDER_##x \ |
---|
181 | ) |
---|
182 | |
---|
183 | static init_step step; |
---|
184 | |
---|
185 | static void next_step(init_step expected) |
---|
186 | { |
---|
187 | assert(step == expected); |
---|
188 | step = expected + 1; |
---|
189 | } |
---|
190 | |
---|
191 | FIRST(RTEMS_SYSINIT_BSP_WORK_AREAS) |
---|
192 | { |
---|
193 | assert(_Workspace_Area.area_begin == 0); |
---|
194 | next_step(BSP_WORK_AREAS_PRE); |
---|
195 | } |
---|
196 | |
---|
197 | LAST(RTEMS_SYSINIT_BSP_WORK_AREAS) |
---|
198 | { |
---|
199 | assert(_Workspace_Area.area_begin != 0); |
---|
200 | next_step(BSP_WORK_AREAS_POST); |
---|
201 | } |
---|
202 | |
---|
203 | FIRST(RTEMS_SYSINIT_BSP_START) |
---|
204 | { |
---|
205 | /* |
---|
206 | * Since the work performed here is BSP-specific, there is no way to test pre |
---|
207 | * and post conditions. |
---|
208 | */ |
---|
209 | next_step(BSP_START_PRE); |
---|
210 | } |
---|
211 | |
---|
212 | LAST(RTEMS_SYSINIT_BSP_START) |
---|
213 | { |
---|
214 | /* |
---|
215 | * Some BSPs initialize the printk() support in bsp_start(). So, print begin |
---|
216 | * of test after bsp_start(). |
---|
217 | */ |
---|
218 | TEST_BEGIN(); |
---|
219 | |
---|
220 | next_step(BSP_START_POST); |
---|
221 | } |
---|
222 | |
---|
223 | FIRST(RTEMS_SYSINIT_CPU_COUNTER) |
---|
224 | { |
---|
225 | /* |
---|
226 | * Since the work performed here is BSP-specific, there is no way to test pre |
---|
227 | * and post conditions. |
---|
228 | */ |
---|
229 | next_step(CPU_COUNTER_PRE); |
---|
230 | } |
---|
231 | |
---|
232 | LAST(RTEMS_SYSINIT_CPU_COUNTER) |
---|
233 | { |
---|
234 | next_step(CPU_COUNTER_POST); |
---|
235 | } |
---|
236 | |
---|
237 | FIRST(RTEMS_SYSINIT_INITIAL_EXTENSIONS) |
---|
238 | { |
---|
239 | assert(_Chain_Is_empty(&_User_extensions_Switches_list)); |
---|
240 | next_step(INITIAL_EXTENSIONS_PRE); |
---|
241 | } |
---|
242 | |
---|
243 | LAST(RTEMS_SYSINIT_INITIAL_EXTENSIONS) |
---|
244 | { |
---|
245 | assert(!_Chain_Is_empty(&_User_extensions_Switches_list)); |
---|
246 | next_step(INITIAL_EXTENSIONS_POST); |
---|
247 | } |
---|
248 | |
---|
249 | FIRST(RTEMS_SYSINIT_DATA_STRUCTURES) |
---|
250 | { |
---|
251 | assert(_Thread_Internal_information.Objects.maximum == 0); |
---|
252 | next_step(DATA_STRUCTURES_PRE); |
---|
253 | } |
---|
254 | |
---|
255 | LAST(RTEMS_SYSINIT_DATA_STRUCTURES) |
---|
256 | { |
---|
257 | assert(_Thread_Internal_information.Objects.maximum != 0); |
---|
258 | next_step(DATA_STRUCTURES_POST); |
---|
259 | } |
---|
260 | |
---|
261 | FIRST(RTEMS_SYSINIT_USER_EXTENSIONS) |
---|
262 | { |
---|
263 | assert(_Extension_Information.maximum == 0); |
---|
264 | next_step(USER_EXTENSIONS_PRE); |
---|
265 | } |
---|
266 | |
---|
267 | LAST(RTEMS_SYSINIT_USER_EXTENSIONS) |
---|
268 | { |
---|
269 | assert(_Extension_Information.maximum != 0); |
---|
270 | next_step(USER_EXTENSIONS_POST); |
---|
271 | } |
---|
272 | |
---|
273 | FIRST(RTEMS_SYSINIT_CLASSIC_TASKS) |
---|
274 | { |
---|
275 | assert(_RTEMS_tasks_Information.Objects.maximum == 0); |
---|
276 | next_step(CLASSIC_TASKS_PRE); |
---|
277 | } |
---|
278 | |
---|
279 | LAST(RTEMS_SYSINIT_CLASSIC_TASKS) |
---|
280 | { |
---|
281 | assert(_RTEMS_tasks_Information.Objects.maximum != 0); |
---|
282 | next_step(CLASSIC_TASKS_POST); |
---|
283 | } |
---|
284 | |
---|
285 | FIRST(RTEMS_SYSINIT_CLASSIC_TIMER) |
---|
286 | { |
---|
287 | assert(_Timer_Information.maximum == 0); |
---|
288 | next_step(CLASSIC_TIMER_PRE); |
---|
289 | } |
---|
290 | |
---|
291 | LAST(RTEMS_SYSINIT_CLASSIC_TIMER) |
---|
292 | { |
---|
293 | assert(_Timer_Information.maximum != 0); |
---|
294 | next_step(CLASSIC_TIMER_POST); |
---|
295 | } |
---|
296 | |
---|
297 | FIRST(RTEMS_SYSINIT_CLASSIC_SIGNAL) |
---|
298 | { |
---|
299 | /* There is nothing to do in case RTEMS_MULTIPROCESSING is not defined */ |
---|
300 | next_step(CLASSIC_SIGNAL_PRE); |
---|
301 | } |
---|
302 | |
---|
303 | LAST(RTEMS_SYSINIT_CLASSIC_SIGNAL) |
---|
304 | { |
---|
305 | next_step(CLASSIC_SIGNAL_POST); |
---|
306 | } |
---|
307 | |
---|
308 | FIRST(RTEMS_SYSINIT_CLASSIC_EVENT) |
---|
309 | { |
---|
310 | /* There is nothing to do in case RTEMS_MULTIPROCESSING is not defined */ |
---|
311 | next_step(CLASSIC_EVENT_PRE); |
---|
312 | } |
---|
313 | |
---|
314 | LAST(RTEMS_SYSINIT_CLASSIC_EVENT) |
---|
315 | { |
---|
316 | next_step(CLASSIC_EVENT_POST); |
---|
317 | } |
---|
318 | |
---|
319 | FIRST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE) |
---|
320 | { |
---|
321 | assert(_Message_queue_Information.maximum == 0); |
---|
322 | next_step(CLASSIC_MESSAGE_QUEUE_PRE); |
---|
323 | } |
---|
324 | |
---|
325 | LAST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE) |
---|
326 | { |
---|
327 | assert(_Message_queue_Information.maximum != 0); |
---|
328 | next_step(CLASSIC_MESSAGE_QUEUE_POST); |
---|
329 | } |
---|
330 | |
---|
331 | FIRST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE) |
---|
332 | { |
---|
333 | assert(_Semaphore_Information.maximum == 0); |
---|
334 | next_step(CLASSIC_SEMAPHORE_PRE); |
---|
335 | } |
---|
336 | |
---|
337 | LAST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE) |
---|
338 | { |
---|
339 | assert(_Semaphore_Information.maximum != 0); |
---|
340 | next_step(CLASSIC_SEMAPHORE_POST); |
---|
341 | } |
---|
342 | |
---|
343 | FIRST(RTEMS_SYSINIT_CLASSIC_PARTITION) |
---|
344 | { |
---|
345 | assert(_Partition_Information.maximum == 0); |
---|
346 | next_step(CLASSIC_PARTITION_PRE); |
---|
347 | } |
---|
348 | |
---|
349 | LAST(RTEMS_SYSINIT_CLASSIC_PARTITION) |
---|
350 | { |
---|
351 | assert(_Partition_Information.maximum != 0); |
---|
352 | next_step(CLASSIC_PARTITION_POST); |
---|
353 | } |
---|
354 | |
---|
355 | FIRST(RTEMS_SYSINIT_CLASSIC_REGION) |
---|
356 | { |
---|
357 | assert(_Region_Information.maximum == 0); |
---|
358 | next_step(CLASSIC_REGION_PRE); |
---|
359 | } |
---|
360 | |
---|
361 | LAST(RTEMS_SYSINIT_CLASSIC_REGION) |
---|
362 | { |
---|
363 | assert(_Region_Information.maximum != 0); |
---|
364 | next_step(CLASSIC_REGION_POST); |
---|
365 | } |
---|
366 | |
---|
367 | FIRST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY) |
---|
368 | { |
---|
369 | assert(_Dual_ported_memory_Information.maximum == 0); |
---|
370 | next_step(CLASSIC_DUAL_PORTED_MEMORY_PRE); |
---|
371 | } |
---|
372 | |
---|
373 | LAST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY) |
---|
374 | { |
---|
375 | assert(_Dual_ported_memory_Information.maximum != 0); |
---|
376 | next_step(CLASSIC_DUAL_PORTED_MEMORY_POST); |
---|
377 | } |
---|
378 | |
---|
379 | FIRST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC) |
---|
380 | { |
---|
381 | assert(_Rate_monotonic_Information.maximum == 0); |
---|
382 | next_step(CLASSIC_RATE_MONOTONIC_PRE); |
---|
383 | } |
---|
384 | |
---|
385 | LAST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC) |
---|
386 | { |
---|
387 | assert(_Rate_monotonic_Information.maximum != 0); |
---|
388 | next_step(CLASSIC_RATE_MONOTONIC_POST); |
---|
389 | } |
---|
390 | |
---|
391 | FIRST(RTEMS_SYSINIT_CLASSIC_BARRIER) |
---|
392 | { |
---|
393 | assert(_Barrier_Information.maximum == 0); |
---|
394 | next_step(CLASSIC_BARRIER_PRE); |
---|
395 | } |
---|
396 | |
---|
397 | LAST(RTEMS_SYSINIT_CLASSIC_BARRIER) |
---|
398 | { |
---|
399 | assert(_Barrier_Information.maximum != 0); |
---|
400 | next_step(CLASSIC_BARRIER_POST); |
---|
401 | } |
---|
402 | |
---|
403 | #ifdef RTEMS_POSIX_API |
---|
404 | |
---|
405 | FIRST(RTEMS_SYSINIT_POSIX_SIGNALS) |
---|
406 | { |
---|
407 | assert( |
---|
408 | memcmp( |
---|
409 | &_POSIX_signals_Vectors, |
---|
410 | _POSIX_signals_Default_vectors, |
---|
411 | sizeof(_POSIX_signals_Vectors) |
---|
412 | ) != 0 |
---|
413 | ); |
---|
414 | next_step(POSIX_SIGNALS_PRE); |
---|
415 | } |
---|
416 | |
---|
417 | LAST(RTEMS_SYSINIT_POSIX_SIGNALS) |
---|
418 | { |
---|
419 | assert( |
---|
420 | memcmp( |
---|
421 | &_POSIX_signals_Vectors, |
---|
422 | _POSIX_signals_Default_vectors, |
---|
423 | sizeof(_POSIX_signals_Vectors) |
---|
424 | ) == 0 |
---|
425 | ); |
---|
426 | next_step(POSIX_SIGNALS_POST); |
---|
427 | } |
---|
428 | |
---|
429 | FIRST(RTEMS_SYSINIT_POSIX_THREADS) |
---|
430 | { |
---|
431 | assert(_POSIX_Threads_Information.Objects.maximum == 0); |
---|
432 | next_step(POSIX_THREADS_PRE); |
---|
433 | } |
---|
434 | |
---|
435 | LAST(RTEMS_SYSINIT_POSIX_THREADS) |
---|
436 | { |
---|
437 | assert(_POSIX_Threads_Information.Objects.maximum != 0); |
---|
438 | next_step(POSIX_THREADS_POST); |
---|
439 | } |
---|
440 | |
---|
441 | FIRST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE) |
---|
442 | { |
---|
443 | assert(_POSIX_Message_queue_Information.maximum == 0); |
---|
444 | next_step(POSIX_MESSAGE_QUEUE_PRE); |
---|
445 | } |
---|
446 | |
---|
447 | LAST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE) |
---|
448 | { |
---|
449 | assert(_POSIX_Message_queue_Information.maximum != 0); |
---|
450 | next_step(POSIX_MESSAGE_QUEUE_POST); |
---|
451 | } |
---|
452 | |
---|
453 | FIRST(RTEMS_SYSINIT_POSIX_SEMAPHORE) |
---|
454 | { |
---|
455 | assert(_POSIX_Semaphore_Information.maximum == 0); |
---|
456 | next_step(POSIX_SEMAPHORE_PRE); |
---|
457 | } |
---|
458 | |
---|
459 | LAST(RTEMS_SYSINIT_POSIX_SEMAPHORE) |
---|
460 | { |
---|
461 | assert(_POSIX_Semaphore_Information.maximum != 0); |
---|
462 | next_step(POSIX_SEMAPHORE_POST); |
---|
463 | } |
---|
464 | |
---|
465 | FIRST(RTEMS_SYSINIT_POSIX_TIMER) |
---|
466 | { |
---|
467 | assert(_POSIX_Timer_Information.maximum == 0); |
---|
468 | next_step(POSIX_TIMER_PRE); |
---|
469 | } |
---|
470 | |
---|
471 | LAST(RTEMS_SYSINIT_POSIX_TIMER) |
---|
472 | { |
---|
473 | assert(_POSIX_Timer_Information.maximum != 0); |
---|
474 | next_step(POSIX_TIMER_POST); |
---|
475 | } |
---|
476 | |
---|
477 | FIRST(RTEMS_SYSINIT_POSIX_SHM) |
---|
478 | { |
---|
479 | assert(_POSIX_Shm_Information.maximum == 0); |
---|
480 | next_step(POSIX_SHM_PRE); |
---|
481 | } |
---|
482 | |
---|
483 | LAST(RTEMS_SYSINIT_POSIX_SHM) |
---|
484 | { |
---|
485 | assert(_POSIX_Shm_Information.maximum != 0); |
---|
486 | next_step(POSIX_SHM_POST); |
---|
487 | } |
---|
488 | |
---|
489 | static size_t user_extensions_pre_posix_cleanup; |
---|
490 | |
---|
491 | FIRST(RTEMS_SYSINIT_POSIX_CLEANUP) |
---|
492 | { |
---|
493 | user_extensions_pre_posix_cleanup = |
---|
494 | _Chain_Node_count_unprotected(&_User_extensions_List.Active); |
---|
495 | next_step(POSIX_CLEANUP_PRE); |
---|
496 | } |
---|
497 | |
---|
498 | LAST(RTEMS_SYSINIT_POSIX_CLEANUP) |
---|
499 | { |
---|
500 | assert( |
---|
501 | user_extensions_pre_posix_cleanup + 1 == |
---|
502 | _Chain_Node_count_unprotected(&_User_extensions_List.Active) |
---|
503 | ); |
---|
504 | next_step(POSIX_CLEANUP_POST); |
---|
505 | } |
---|
506 | |
---|
507 | #endif /* RTEMS_POSIX_API */ |
---|
508 | |
---|
509 | FIRST(RTEMS_SYSINIT_POSIX_KEYS) |
---|
510 | { |
---|
511 | assert(_POSIX_Keys_Information.maximum == 0); |
---|
512 | next_step(POSIX_KEYS_PRE); |
---|
513 | } |
---|
514 | |
---|
515 | LAST(RTEMS_SYSINIT_POSIX_KEYS) |
---|
516 | { |
---|
517 | assert(_POSIX_Keys_Information.maximum != 0); |
---|
518 | next_step(POSIX_KEYS_POST); |
---|
519 | } |
---|
520 | |
---|
521 | FIRST(RTEMS_SYSINIT_IDLE_THREADS) |
---|
522 | { |
---|
523 | assert(_System_state_Is_before_initialization(_System_state_Get())); |
---|
524 | next_step(IDLE_THREADS_PRE); |
---|
525 | } |
---|
526 | |
---|
527 | LAST(RTEMS_SYSINIT_IDLE_THREADS) |
---|
528 | { |
---|
529 | assert(_System_state_Is_before_multitasking(_System_state_Get())); |
---|
530 | next_step(IDLE_THREADS_POST); |
---|
531 | } |
---|
532 | |
---|
533 | FIRST(RTEMS_SYSINIT_LIBIO) |
---|
534 | { |
---|
535 | assert(rtems_libio_iop_free_head == NULL); |
---|
536 | next_step(LIBIO_PRE); |
---|
537 | } |
---|
538 | |
---|
539 | LAST(RTEMS_SYSINIT_LIBIO) |
---|
540 | { |
---|
541 | assert(rtems_libio_iop_free_head == &rtems_libio_iops[0]); |
---|
542 | next_step(LIBIO_POST); |
---|
543 | } |
---|
544 | |
---|
545 | FIRST(RTEMS_SYSINIT_ROOT_FILESYSTEM) |
---|
546 | { |
---|
547 | struct stat st; |
---|
548 | int rv; |
---|
549 | |
---|
550 | rv = stat("/", &st); |
---|
551 | assert(rv == -1); |
---|
552 | next_step(ROOT_FILESYSTEM_PRE); |
---|
553 | } |
---|
554 | |
---|
555 | LAST(RTEMS_SYSINIT_ROOT_FILESYSTEM) |
---|
556 | { |
---|
557 | struct stat st; |
---|
558 | int rv; |
---|
559 | |
---|
560 | rv = stat("/", &st); |
---|
561 | assert(rv == 0); |
---|
562 | next_step(ROOT_FILESYSTEM_POST); |
---|
563 | } |
---|
564 | |
---|
565 | FIRST(RTEMS_SYSINIT_BSP_PRE_DRIVERS) |
---|
566 | { |
---|
567 | /* |
---|
568 | * Since the work performed here is BSP-specific, there is no way to test pre |
---|
569 | * and post conditions. |
---|
570 | */ |
---|
571 | next_step(BSP_PRE_DRIVERS_PRE); |
---|
572 | } |
---|
573 | |
---|
574 | LAST(RTEMS_SYSINIT_BSP_PRE_DRIVERS) |
---|
575 | { |
---|
576 | next_step(BSP_PRE_DRIVERS_POST); |
---|
577 | } |
---|
578 | |
---|
579 | FIRST(RTEMS_SYSINIT_DEVICE_DRIVERS) |
---|
580 | { |
---|
581 | assert(!_IO_All_drivers_initialized); |
---|
582 | next_step(DEVICE_DRIVERS_PRE); |
---|
583 | } |
---|
584 | |
---|
585 | LAST(RTEMS_SYSINIT_DEVICE_DRIVERS) |
---|
586 | { |
---|
587 | assert(_IO_All_drivers_initialized); |
---|
588 | next_step(DEVICE_DRIVERS_POST); |
---|
589 | } |
---|
590 | |
---|
591 | FIRST(RTEMS_SYSINIT_CLASSIC_USER_TASKS) |
---|
592 | { |
---|
593 | _Objects_Allocator_lock(); |
---|
594 | assert(_Objects_Active_count(&_RTEMS_tasks_Information.Objects) == 0); |
---|
595 | _Objects_Allocator_unlock(); |
---|
596 | next_step(CLASSIC_USER_TASKS_PRE); |
---|
597 | } |
---|
598 | |
---|
599 | LAST(RTEMS_SYSINIT_CLASSIC_USER_TASKS) |
---|
600 | { |
---|
601 | _Objects_Allocator_lock(); |
---|
602 | assert(_Objects_Active_count(&_RTEMS_tasks_Information.Objects) == 1); |
---|
603 | _Objects_Allocator_unlock(); |
---|
604 | next_step(CLASSIC_USER_TASKS_POST); |
---|
605 | } |
---|
606 | |
---|
607 | #ifdef RTEMS_POSIX_API |
---|
608 | |
---|
609 | FIRST(RTEMS_SYSINIT_POSIX_USER_THREADS) |
---|
610 | { |
---|
611 | _Objects_Allocator_lock(); |
---|
612 | assert(_Objects_Active_count(&_POSIX_Threads_Information.Objects) == 0); |
---|
613 | _Objects_Allocator_unlock(); |
---|
614 | next_step(POSIX_USER_THREADS_PRE); |
---|
615 | } |
---|
616 | |
---|
617 | LAST(RTEMS_SYSINIT_POSIX_USER_THREADS) |
---|
618 | { |
---|
619 | _Objects_Allocator_lock(); |
---|
620 | assert(_Objects_Active_count(&_POSIX_Threads_Information.Objects) == 1); |
---|
621 | _Objects_Allocator_unlock(); |
---|
622 | next_step(POSIX_USER_THREADS_POST); |
---|
623 | } |
---|
624 | |
---|
625 | #endif /* RTEMS_POSIX_API */ |
---|
626 | |
---|
627 | FIRST(RTEMS_SYSINIT_STD_FILE_DESCRIPTORS) |
---|
628 | { |
---|
629 | struct stat st; |
---|
630 | int rv; |
---|
631 | |
---|
632 | rv = fstat(0, &st); |
---|
633 | assert(rv == -1); |
---|
634 | next_step(STD_FILE_DESCRIPTORS_PRE); |
---|
635 | } |
---|
636 | |
---|
637 | LAST(RTEMS_SYSINIT_STD_FILE_DESCRIPTORS) |
---|
638 | { |
---|
639 | struct stat st; |
---|
640 | int rv; |
---|
641 | |
---|
642 | rv = fstat(0, &st); |
---|
643 | assert(rv == 0); |
---|
644 | next_step(STD_FILE_DESCRIPTORS_POST); |
---|
645 | } |
---|
646 | |
---|
647 | LAST_STEP(FIRST); |
---|
648 | LAST_STEP(SECOND); |
---|
649 | LAST_STEP(THIRD); |
---|
650 | LAST_STEP(FOURTH); |
---|
651 | LAST_STEP(FIFTH); |
---|
652 | LAST_STEP(SIXTH); |
---|
653 | LAST_STEP(SEVENTH); |
---|
654 | LAST_STEP(EIGHTH); |
---|
655 | LAST_STEP(NINETH); |
---|
656 | LAST_STEP(TENTH); |
---|
657 | LAST_STEP(MIDDLE); |
---|
658 | LAST_STEP(LAST); |
---|
659 | |
---|
660 | static void Init(rtems_task_argument arg) |
---|
661 | { |
---|
662 | #ifdef RTEMS_POSIX_API |
---|
663 | pthread_cleanup_push(NULL, NULL); |
---|
664 | pthread_cleanup_pop(0); |
---|
665 | #endif /* RTEMS_POSIX_API */ |
---|
666 | next_step(INIT_TASK); |
---|
667 | TEST_END(); |
---|
668 | exit(0); |
---|
669 | } |
---|
670 | |
---|
671 | #ifdef RTEMS_POSIX_API |
---|
672 | |
---|
673 | static void *POSIX_Init(void *arg) |
---|
674 | { |
---|
675 | return NULL; |
---|
676 | } |
---|
677 | |
---|
678 | #endif /* RTEMS_POSIX_API */ |
---|
679 | |
---|
680 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER |
---|
681 | #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER |
---|
682 | |
---|
683 | #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 |
---|
684 | |
---|
685 | #define CONFIGURE_MAXIMUM_BARRIERS 1 |
---|
686 | |
---|
687 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 |
---|
688 | |
---|
689 | #define CONFIGURE_MAXIMUM_PARTITIONS 1 |
---|
690 | |
---|
691 | #define CONFIGURE_MAXIMUM_PERIODS 1 |
---|
692 | |
---|
693 | #define CONFIGURE_MAXIMUM_PORTS 1 |
---|
694 | |
---|
695 | #define CONFIGURE_MAXIMUM_REGIONS 1 |
---|
696 | |
---|
697 | #define CONFIGURE_MAXIMUM_SEMAPHORES 1 |
---|
698 | |
---|
699 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
700 | |
---|
701 | #define CONFIGURE_MAXIMUM_TIMERS 1 |
---|
702 | |
---|
703 | #ifdef RTEMS_POSIX_API |
---|
704 | |
---|
705 | #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1 |
---|
706 | |
---|
707 | |
---|
708 | #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 1 |
---|
709 | |
---|
710 | #define CONFIGURE_MAXIMUM_POSIX_SHMS 1 |
---|
711 | |
---|
712 | #define CONFIGURE_MAXIMUM_POSIX_TIMERS 1 |
---|
713 | |
---|
714 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 |
---|
715 | |
---|
716 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE |
---|
717 | |
---|
718 | #endif /* RTEMS_POSIX_API */ |
---|
719 | |
---|
720 | #define CONFIGURE_MAXIMUM_POSIX_KEYS 1 |
---|
721 | |
---|
722 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
723 | |
---|
724 | #define CONFIGURE_STACK_CHECKER_ENABLED |
---|
725 | |
---|
726 | #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION |
---|
727 | |
---|
728 | #define CONFIGURE_INIT |
---|
729 | |
---|
730 | #include <rtems/confdefs.h> |
---|