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 | #include <rtems/posix/barrierimpl.h> |
---|
37 | #include <rtems/posix/mqueueimpl.h> |
---|
38 | #include <rtems/posix/muteximpl.h> |
---|
39 | #ifdef RTEMS_POSIX_API |
---|
40 | #include <rtems/posix/psignalimpl.h> |
---|
41 | #endif /* RTEMS_POSIX_API */ |
---|
42 | #include <rtems/posix/pthreadimpl.h> |
---|
43 | #include <rtems/posix/rwlockimpl.h> |
---|
44 | #include <rtems/posix/semaphoreimpl.h> |
---|
45 | #include <rtems/posix/shmimpl.h> |
---|
46 | #ifdef RTEMS_POSIX_API |
---|
47 | #include <rtems/posix/timerimpl.h> |
---|
48 | #endif /* RTEMS_POSIX_API */ |
---|
49 | #include <rtems/posix/keyimpl.h> |
---|
50 | #include <rtems/rtems/barrierimpl.h> |
---|
51 | #include <rtems/rtems/dpmemimpl.h> |
---|
52 | #include <rtems/rtems/messageimpl.h> |
---|
53 | #include <rtems/rtems/partimpl.h> |
---|
54 | #include <rtems/rtems/ratemonimpl.h> |
---|
55 | #include <rtems/rtems/regionimpl.h> |
---|
56 | #include <rtems/rtems/semimpl.h> |
---|
57 | #include <rtems/rtems/tasksimpl.h> |
---|
58 | #include <rtems/rtems/timerimpl.h> |
---|
59 | #include <rtems/score/apimutex.h> |
---|
60 | #include <rtems/score/chainimpl.h> |
---|
61 | #include <rtems/score/sysstate.h> |
---|
62 | #include <rtems/score/userextimpl.h> |
---|
63 | #include <rtems/score/wkspace.h> |
---|
64 | |
---|
65 | const char rtems_test_name[] = "SPSYSINIT 1"; |
---|
66 | |
---|
67 | typedef enum { |
---|
68 | BSP_WORK_AREAS_PRE, |
---|
69 | BSP_WORK_AREAS_POST, |
---|
70 | BSP_START_PRE, |
---|
71 | BSP_START_POST, |
---|
72 | CPU_COUNTER_PRE, |
---|
73 | CPU_COUNTER_POST, |
---|
74 | INITIAL_EXTENSIONS_PRE, |
---|
75 | INITIAL_EXTENSIONS_POST, |
---|
76 | DATA_STRUCTURES_PRE, |
---|
77 | DATA_STRUCTURES_POST, |
---|
78 | USER_EXTENSIONS_PRE, |
---|
79 | USER_EXTENSIONS_POST, |
---|
80 | CLASSIC_TASKS_PRE, |
---|
81 | CLASSIC_TASKS_POST, |
---|
82 | CLASSIC_TIMER_PRE, |
---|
83 | CLASSIC_TIMER_POST, |
---|
84 | CLASSIC_SIGNAL_PRE, |
---|
85 | CLASSIC_SIGNAL_POST, |
---|
86 | CLASSIC_EVENT_PRE, |
---|
87 | CLASSIC_EVENT_POST, |
---|
88 | CLASSIC_MESSAGE_QUEUE_PRE, |
---|
89 | CLASSIC_MESSAGE_QUEUE_POST, |
---|
90 | CLASSIC_SEMAPHORE_PRE, |
---|
91 | CLASSIC_SEMAPHORE_POST, |
---|
92 | CLASSIC_PARTITION_PRE, |
---|
93 | CLASSIC_PARTITION_POST, |
---|
94 | CLASSIC_REGION_PRE, |
---|
95 | CLASSIC_REGION_POST, |
---|
96 | CLASSIC_DUAL_PORTED_MEMORY_PRE, |
---|
97 | CLASSIC_DUAL_PORTED_MEMORY_POST, |
---|
98 | CLASSIC_RATE_MONOTONIC_PRE, |
---|
99 | CLASSIC_RATE_MONOTONIC_POST, |
---|
100 | CLASSIC_BARRIER_PRE, |
---|
101 | CLASSIC_BARRIER_POST, |
---|
102 | #ifdef RTEMS_POSIX_API |
---|
103 | POSIX_SIGNALS_PRE, |
---|
104 | POSIX_SIGNALS_POST, |
---|
105 | #endif /* RTEMS_POSIX_API */ |
---|
106 | POSIX_THREADS_PRE, |
---|
107 | POSIX_THREADS_POST, |
---|
108 | POSIX_MESSAGE_QUEUE_PRE, |
---|
109 | POSIX_MESSAGE_QUEUE_POST, |
---|
110 | POSIX_SEMAPHORE_PRE, |
---|
111 | POSIX_SEMAPHORE_POST, |
---|
112 | #ifdef RTEMS_POSIX_API |
---|
113 | POSIX_TIMER_PRE, |
---|
114 | POSIX_TIMER_POST, |
---|
115 | #endif /* RTEMS_POSIX_API */ |
---|
116 | POSIX_SHM_PRE, |
---|
117 | POSIX_SHM_POST, |
---|
118 | POSIX_KEYS_PRE, |
---|
119 | POSIX_KEYS_POST, |
---|
120 | POSIX_CLEANUP_PRE, |
---|
121 | POSIX_CLEANUP_POST, |
---|
122 | IDLE_THREADS_PRE, |
---|
123 | IDLE_THREADS_POST, |
---|
124 | LIBIO_PRE, |
---|
125 | LIBIO_POST, |
---|
126 | ROOT_FILESYSTEM_PRE, |
---|
127 | ROOT_FILESYSTEM_POST, |
---|
128 | BSP_PRE_DRIVERS_PRE, |
---|
129 | BSP_PRE_DRIVERS_POST, |
---|
130 | DEVICE_DRIVERS_PRE, |
---|
131 | DEVICE_DRIVERS_POST, |
---|
132 | CLASSIC_USER_TASKS_PRE, |
---|
133 | CLASSIC_USER_TASKS_POST, |
---|
134 | POSIX_USER_THREADS_PRE, |
---|
135 | POSIX_USER_THREADS_POST, |
---|
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( |
---|
252 | _Objects_Get_maximum_index(&_Thread_Internal_information.Objects) == 0 |
---|
253 | ); |
---|
254 | next_step(DATA_STRUCTURES_PRE); |
---|
255 | } |
---|
256 | |
---|
257 | LAST(RTEMS_SYSINIT_DATA_STRUCTURES) |
---|
258 | { |
---|
259 | assert( |
---|
260 | _Objects_Get_maximum_index(&_Thread_Internal_information.Objects) != 0 |
---|
261 | ); |
---|
262 | next_step(DATA_STRUCTURES_POST); |
---|
263 | } |
---|
264 | |
---|
265 | FIRST(RTEMS_SYSINIT_USER_EXTENSIONS) |
---|
266 | { |
---|
267 | assert(_Objects_Get_maximum_index(&_Extension_Information) == 0); |
---|
268 | next_step(USER_EXTENSIONS_PRE); |
---|
269 | } |
---|
270 | |
---|
271 | LAST(RTEMS_SYSINIT_USER_EXTENSIONS) |
---|
272 | { |
---|
273 | assert(_Objects_Get_maximum_index(&_Extension_Information) != 0); |
---|
274 | next_step(USER_EXTENSIONS_POST); |
---|
275 | } |
---|
276 | |
---|
277 | FIRST(RTEMS_SYSINIT_CLASSIC_TASKS) |
---|
278 | { |
---|
279 | assert(_Objects_Get_maximum_index(&_RTEMS_tasks_Information.Objects) == 0); |
---|
280 | next_step(CLASSIC_TASKS_PRE); |
---|
281 | } |
---|
282 | |
---|
283 | LAST(RTEMS_SYSINIT_CLASSIC_TASKS) |
---|
284 | { |
---|
285 | assert(_Objects_Get_maximum_index(&_RTEMS_tasks_Information.Objects) != 0); |
---|
286 | next_step(CLASSIC_TASKS_POST); |
---|
287 | } |
---|
288 | |
---|
289 | FIRST(RTEMS_SYSINIT_CLASSIC_TIMER) |
---|
290 | { |
---|
291 | assert(_Objects_Get_maximum_index(&_Timer_Information) == 0); |
---|
292 | next_step(CLASSIC_TIMER_PRE); |
---|
293 | } |
---|
294 | |
---|
295 | LAST(RTEMS_SYSINIT_CLASSIC_TIMER) |
---|
296 | { |
---|
297 | assert(_Objects_Get_maximum_index(&_Timer_Information) != 0); |
---|
298 | next_step(CLASSIC_TIMER_POST); |
---|
299 | } |
---|
300 | |
---|
301 | FIRST(RTEMS_SYSINIT_CLASSIC_SIGNAL) |
---|
302 | { |
---|
303 | /* There is nothing to do in case RTEMS_MULTIPROCESSING is not defined */ |
---|
304 | next_step(CLASSIC_SIGNAL_PRE); |
---|
305 | } |
---|
306 | |
---|
307 | LAST(RTEMS_SYSINIT_CLASSIC_SIGNAL) |
---|
308 | { |
---|
309 | next_step(CLASSIC_SIGNAL_POST); |
---|
310 | } |
---|
311 | |
---|
312 | FIRST(RTEMS_SYSINIT_CLASSIC_EVENT) |
---|
313 | { |
---|
314 | /* There is nothing to do in case RTEMS_MULTIPROCESSING is not defined */ |
---|
315 | next_step(CLASSIC_EVENT_PRE); |
---|
316 | } |
---|
317 | |
---|
318 | LAST(RTEMS_SYSINIT_CLASSIC_EVENT) |
---|
319 | { |
---|
320 | next_step(CLASSIC_EVENT_POST); |
---|
321 | } |
---|
322 | |
---|
323 | FIRST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE) |
---|
324 | { |
---|
325 | assert(_Objects_Get_maximum_index(&_Message_queue_Information) == 0); |
---|
326 | next_step(CLASSIC_MESSAGE_QUEUE_PRE); |
---|
327 | } |
---|
328 | |
---|
329 | LAST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE) |
---|
330 | { |
---|
331 | assert(_Objects_Get_maximum_index(&_Message_queue_Information) != 0); |
---|
332 | next_step(CLASSIC_MESSAGE_QUEUE_POST); |
---|
333 | } |
---|
334 | |
---|
335 | FIRST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE) |
---|
336 | { |
---|
337 | assert(_Objects_Get_maximum_index(&_Semaphore_Information) == 0); |
---|
338 | next_step(CLASSIC_SEMAPHORE_PRE); |
---|
339 | } |
---|
340 | |
---|
341 | LAST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE) |
---|
342 | { |
---|
343 | assert(_Objects_Get_maximum_index(&_Semaphore_Information) != 0); |
---|
344 | next_step(CLASSIC_SEMAPHORE_POST); |
---|
345 | } |
---|
346 | |
---|
347 | FIRST(RTEMS_SYSINIT_CLASSIC_PARTITION) |
---|
348 | { |
---|
349 | assert(_Objects_Get_maximum_index(&_Partition_Information) == 0); |
---|
350 | next_step(CLASSIC_PARTITION_PRE); |
---|
351 | } |
---|
352 | |
---|
353 | LAST(RTEMS_SYSINIT_CLASSIC_PARTITION) |
---|
354 | { |
---|
355 | assert(_Objects_Get_maximum_index(&_Partition_Information) != 0); |
---|
356 | next_step(CLASSIC_PARTITION_POST); |
---|
357 | } |
---|
358 | |
---|
359 | FIRST(RTEMS_SYSINIT_CLASSIC_REGION) |
---|
360 | { |
---|
361 | assert(_Objects_Get_maximum_index(&_Region_Information) == 0); |
---|
362 | next_step(CLASSIC_REGION_PRE); |
---|
363 | } |
---|
364 | |
---|
365 | LAST(RTEMS_SYSINIT_CLASSIC_REGION) |
---|
366 | { |
---|
367 | assert(_Objects_Get_maximum_index(&_Region_Information) != 0); |
---|
368 | next_step(CLASSIC_REGION_POST); |
---|
369 | } |
---|
370 | |
---|
371 | FIRST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY) |
---|
372 | { |
---|
373 | assert(_Objects_Get_maximum_index(&_Dual_ported_memory_Information) == 0); |
---|
374 | next_step(CLASSIC_DUAL_PORTED_MEMORY_PRE); |
---|
375 | } |
---|
376 | |
---|
377 | LAST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY) |
---|
378 | { |
---|
379 | assert(_Objects_Get_maximum_index(&_Dual_ported_memory_Information) != 0); |
---|
380 | next_step(CLASSIC_DUAL_PORTED_MEMORY_POST); |
---|
381 | } |
---|
382 | |
---|
383 | FIRST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC) |
---|
384 | { |
---|
385 | assert(_Objects_Get_maximum_index(&_Rate_monotonic_Information) == 0); |
---|
386 | next_step(CLASSIC_RATE_MONOTONIC_PRE); |
---|
387 | } |
---|
388 | |
---|
389 | LAST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC) |
---|
390 | { |
---|
391 | assert(_Objects_Get_maximum_index(&_Rate_monotonic_Information) != 0); |
---|
392 | next_step(CLASSIC_RATE_MONOTONIC_POST); |
---|
393 | } |
---|
394 | |
---|
395 | FIRST(RTEMS_SYSINIT_CLASSIC_BARRIER) |
---|
396 | { |
---|
397 | assert(_Objects_Get_maximum_index(&_Barrier_Information) == 0); |
---|
398 | next_step(CLASSIC_BARRIER_PRE); |
---|
399 | } |
---|
400 | |
---|
401 | LAST(RTEMS_SYSINIT_CLASSIC_BARRIER) |
---|
402 | { |
---|
403 | assert(_Objects_Get_maximum_index(&_Barrier_Information) != 0); |
---|
404 | next_step(CLASSIC_BARRIER_POST); |
---|
405 | } |
---|
406 | |
---|
407 | #ifdef RTEMS_POSIX_API |
---|
408 | FIRST(RTEMS_SYSINIT_POSIX_SIGNALS) |
---|
409 | { |
---|
410 | assert( |
---|
411 | memcmp( |
---|
412 | &_POSIX_signals_Vectors, |
---|
413 | _POSIX_signals_Default_vectors, |
---|
414 | sizeof(_POSIX_signals_Vectors) |
---|
415 | ) != 0 |
---|
416 | ); |
---|
417 | next_step(POSIX_SIGNALS_PRE); |
---|
418 | } |
---|
419 | |
---|
420 | LAST(RTEMS_SYSINIT_POSIX_SIGNALS) |
---|
421 | { |
---|
422 | assert( |
---|
423 | memcmp( |
---|
424 | &_POSIX_signals_Vectors, |
---|
425 | _POSIX_signals_Default_vectors, |
---|
426 | sizeof(_POSIX_signals_Vectors) |
---|
427 | ) == 0 |
---|
428 | ); |
---|
429 | next_step(POSIX_SIGNALS_POST); |
---|
430 | } |
---|
431 | #endif /* RTEMS_POSIX_API */ |
---|
432 | |
---|
433 | FIRST(RTEMS_SYSINIT_POSIX_THREADS) |
---|
434 | { |
---|
435 | assert(_Objects_Get_maximum_index(&_POSIX_Threads_Information.Objects) == 0); |
---|
436 | next_step(POSIX_THREADS_PRE); |
---|
437 | } |
---|
438 | |
---|
439 | LAST(RTEMS_SYSINIT_POSIX_THREADS) |
---|
440 | { |
---|
441 | assert(_Objects_Get_maximum_index(&_POSIX_Threads_Information.Objects) != 0); |
---|
442 | next_step(POSIX_THREADS_POST); |
---|
443 | } |
---|
444 | |
---|
445 | FIRST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE) |
---|
446 | { |
---|
447 | assert(_Objects_Get_maximum_index(&_POSIX_Message_queue_Information) == 0); |
---|
448 | next_step(POSIX_MESSAGE_QUEUE_PRE); |
---|
449 | } |
---|
450 | |
---|
451 | LAST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE) |
---|
452 | { |
---|
453 | assert(_Objects_Get_maximum_index(&_POSIX_Message_queue_Information) != 0); |
---|
454 | next_step(POSIX_MESSAGE_QUEUE_POST); |
---|
455 | } |
---|
456 | |
---|
457 | FIRST(RTEMS_SYSINIT_POSIX_SEMAPHORE) |
---|
458 | { |
---|
459 | assert(_Objects_Get_maximum_index(&_POSIX_Semaphore_Information) == 0); |
---|
460 | next_step(POSIX_SEMAPHORE_PRE); |
---|
461 | } |
---|
462 | |
---|
463 | LAST(RTEMS_SYSINIT_POSIX_SEMAPHORE) |
---|
464 | { |
---|
465 | assert(_Objects_Get_maximum_index(&_POSIX_Semaphore_Information) != 0); |
---|
466 | next_step(POSIX_SEMAPHORE_POST); |
---|
467 | } |
---|
468 | |
---|
469 | #ifdef RTEMS_POSIX_API |
---|
470 | FIRST(RTEMS_SYSINIT_POSIX_TIMER) |
---|
471 | { |
---|
472 | assert(_Objects_Get_maximum_index(&_POSIX_Timer_Information) == 0); |
---|
473 | next_step(POSIX_TIMER_PRE); |
---|
474 | } |
---|
475 | |
---|
476 | LAST(RTEMS_SYSINIT_POSIX_TIMER) |
---|
477 | { |
---|
478 | assert(_Objects_Get_maximum_index(&_POSIX_Timer_Information) != 0); |
---|
479 | next_step(POSIX_TIMER_POST); |
---|
480 | } |
---|
481 | #endif /* RTEMS_POSIX_API */ |
---|
482 | |
---|
483 | FIRST(RTEMS_SYSINIT_POSIX_SHM) |
---|
484 | { |
---|
485 | assert(_Objects_Get_maximum_index(&_POSIX_Shm_Information) == 0); |
---|
486 | next_step(POSIX_SHM_PRE); |
---|
487 | } |
---|
488 | |
---|
489 | LAST(RTEMS_SYSINIT_POSIX_SHM) |
---|
490 | { |
---|
491 | assert(_Objects_Get_maximum_index(&_POSIX_Shm_Information) != 0); |
---|
492 | next_step(POSIX_SHM_POST); |
---|
493 | } |
---|
494 | |
---|
495 | static size_t user_extensions_pre_posix_cleanup; |
---|
496 | |
---|
497 | FIRST(RTEMS_SYSINIT_POSIX_CLEANUP) |
---|
498 | { |
---|
499 | user_extensions_pre_posix_cleanup = |
---|
500 | _Chain_Node_count_unprotected(&_User_extensions_List.Active); |
---|
501 | next_step(POSIX_CLEANUP_PRE); |
---|
502 | } |
---|
503 | |
---|
504 | LAST(RTEMS_SYSINIT_POSIX_CLEANUP) |
---|
505 | { |
---|
506 | assert( |
---|
507 | user_extensions_pre_posix_cleanup + 1 == |
---|
508 | _Chain_Node_count_unprotected(&_User_extensions_List.Active) |
---|
509 | ); |
---|
510 | next_step(POSIX_CLEANUP_POST); |
---|
511 | } |
---|
512 | |
---|
513 | FIRST(RTEMS_SYSINIT_POSIX_KEYS) |
---|
514 | { |
---|
515 | assert(_Objects_Get_maximum_index(&_POSIX_Keys_Information) == 0); |
---|
516 | next_step(POSIX_KEYS_PRE); |
---|
517 | } |
---|
518 | |
---|
519 | LAST(RTEMS_SYSINIT_POSIX_KEYS) |
---|
520 | { |
---|
521 | assert(_Objects_Get_maximum_index(&_POSIX_Keys_Information) != 0); |
---|
522 | next_step(POSIX_KEYS_POST); |
---|
523 | } |
---|
524 | |
---|
525 | FIRST(RTEMS_SYSINIT_IDLE_THREADS) |
---|
526 | { |
---|
527 | assert(_System_state_Is_before_initialization(_System_state_Get())); |
---|
528 | next_step(IDLE_THREADS_PRE); |
---|
529 | } |
---|
530 | |
---|
531 | LAST(RTEMS_SYSINIT_IDLE_THREADS) |
---|
532 | { |
---|
533 | assert(_System_state_Is_before_multitasking(_System_state_Get())); |
---|
534 | next_step(IDLE_THREADS_POST); |
---|
535 | } |
---|
536 | |
---|
537 | FIRST(RTEMS_SYSINIT_LIBIO) |
---|
538 | { |
---|
539 | assert(rtems_libio_iop_free_head == NULL); |
---|
540 | next_step(LIBIO_PRE); |
---|
541 | } |
---|
542 | |
---|
543 | LAST(RTEMS_SYSINIT_LIBIO) |
---|
544 | { |
---|
545 | assert(rtems_libio_iop_free_head == &rtems_libio_iops[0]); |
---|
546 | next_step(LIBIO_POST); |
---|
547 | } |
---|
548 | |
---|
549 | FIRST(RTEMS_SYSINIT_ROOT_FILESYSTEM) |
---|
550 | { |
---|
551 | struct stat st; |
---|
552 | int rv; |
---|
553 | |
---|
554 | rv = stat("/", &st); |
---|
555 | assert(rv == -1); |
---|
556 | next_step(ROOT_FILESYSTEM_PRE); |
---|
557 | } |
---|
558 | |
---|
559 | LAST(RTEMS_SYSINIT_ROOT_FILESYSTEM) |
---|
560 | { |
---|
561 | struct stat st; |
---|
562 | int rv; |
---|
563 | |
---|
564 | rv = stat("/", &st); |
---|
565 | assert(rv == 0); |
---|
566 | next_step(ROOT_FILESYSTEM_POST); |
---|
567 | } |
---|
568 | |
---|
569 | FIRST(RTEMS_SYSINIT_BSP_PRE_DRIVERS) |
---|
570 | { |
---|
571 | /* |
---|
572 | * Since the work performed here is BSP-specific, there is no way to test pre |
---|
573 | * and post conditions. |
---|
574 | */ |
---|
575 | next_step(BSP_PRE_DRIVERS_PRE); |
---|
576 | } |
---|
577 | |
---|
578 | LAST(RTEMS_SYSINIT_BSP_PRE_DRIVERS) |
---|
579 | { |
---|
580 | next_step(BSP_PRE_DRIVERS_POST); |
---|
581 | } |
---|
582 | |
---|
583 | FIRST(RTEMS_SYSINIT_DEVICE_DRIVERS) |
---|
584 | { |
---|
585 | assert(!_IO_All_drivers_initialized); |
---|
586 | next_step(DEVICE_DRIVERS_PRE); |
---|
587 | } |
---|
588 | |
---|
589 | LAST(RTEMS_SYSINIT_DEVICE_DRIVERS) |
---|
590 | { |
---|
591 | assert(_IO_All_drivers_initialized); |
---|
592 | next_step(DEVICE_DRIVERS_POST); |
---|
593 | } |
---|
594 | |
---|
595 | FIRST(RTEMS_SYSINIT_CLASSIC_USER_TASKS) |
---|
596 | { |
---|
597 | _Objects_Allocator_lock(); |
---|
598 | assert(_Objects_Active_count(&_RTEMS_tasks_Information.Objects) == 0); |
---|
599 | _Objects_Allocator_unlock(); |
---|
600 | next_step(CLASSIC_USER_TASKS_PRE); |
---|
601 | } |
---|
602 | |
---|
603 | LAST(RTEMS_SYSINIT_CLASSIC_USER_TASKS) |
---|
604 | { |
---|
605 | _Objects_Allocator_lock(); |
---|
606 | assert(_Objects_Active_count(&_RTEMS_tasks_Information.Objects) == 1); |
---|
607 | _Objects_Allocator_unlock(); |
---|
608 | next_step(CLASSIC_USER_TASKS_POST); |
---|
609 | } |
---|
610 | |
---|
611 | FIRST(RTEMS_SYSINIT_POSIX_USER_THREADS) |
---|
612 | { |
---|
613 | _Objects_Allocator_lock(); |
---|
614 | assert(_Objects_Active_count(&_POSIX_Threads_Information.Objects) == 0); |
---|
615 | _Objects_Allocator_unlock(); |
---|
616 | next_step(POSIX_USER_THREADS_PRE); |
---|
617 | } |
---|
618 | |
---|
619 | LAST(RTEMS_SYSINIT_POSIX_USER_THREADS) |
---|
620 | { |
---|
621 | _Objects_Allocator_lock(); |
---|
622 | assert(_Objects_Active_count(&_POSIX_Threads_Information.Objects) == 1); |
---|
623 | _Objects_Allocator_unlock(); |
---|
624 | next_step(POSIX_USER_THREADS_POST); |
---|
625 | } |
---|
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 | pthread_cleanup_push(NULL, NULL); |
---|
663 | pthread_cleanup_pop(0); |
---|
664 | next_step(INIT_TASK); |
---|
665 | TEST_END(); |
---|
666 | exit(0); |
---|
667 | } |
---|
668 | |
---|
669 | static void *POSIX_Init(void *arg) |
---|
670 | { |
---|
671 | return NULL; |
---|
672 | } |
---|
673 | |
---|
674 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER |
---|
675 | #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER |
---|
676 | |
---|
677 | #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 |
---|
678 | |
---|
679 | #define CONFIGURE_MAXIMUM_BARRIERS 1 |
---|
680 | |
---|
681 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 |
---|
682 | |
---|
683 | #define CONFIGURE_MAXIMUM_PARTITIONS 1 |
---|
684 | |
---|
685 | #define CONFIGURE_MAXIMUM_PERIODS 1 |
---|
686 | |
---|
687 | #define CONFIGURE_MAXIMUM_PORTS 1 |
---|
688 | |
---|
689 | #define CONFIGURE_MAXIMUM_REGIONS 1 |
---|
690 | |
---|
691 | #define CONFIGURE_MAXIMUM_SEMAPHORES 1 |
---|
692 | |
---|
693 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
694 | |
---|
695 | #define CONFIGURE_MAXIMUM_TIMERS 1 |
---|
696 | |
---|
697 | #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1 |
---|
698 | |
---|
699 | #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 1 |
---|
700 | |
---|
701 | #define CONFIGURE_MAXIMUM_POSIX_SHMS 1 |
---|
702 | |
---|
703 | #ifdef RTEMS_POSIX_API |
---|
704 | #define CONFIGURE_MAXIMUM_POSIX_TIMERS 1 |
---|
705 | #endif /* RTEMS_POSIX_API */ |
---|
706 | |
---|
707 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 |
---|
708 | |
---|
709 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE |
---|
710 | |
---|
711 | #define CONFIGURE_MAXIMUM_POSIX_KEYS 1 |
---|
712 | |
---|
713 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
714 | |
---|
715 | #define CONFIGURE_STACK_CHECKER_ENABLED |
---|
716 | |
---|
717 | #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION |
---|
718 | |
---|
719 | #define CONFIGURE_INIT |
---|
720 | |
---|
721 | #include <rtems/confdefs.h> |
---|