1 | /* |
---|
2 | * Copyright (c) 2015 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 | #define TESTS_USE_PRINTK |
---|
20 | #include "tmacros.h" |
---|
21 | |
---|
22 | #include <sys/types.h> |
---|
23 | #include <sys/stat.h> |
---|
24 | |
---|
25 | #include <assert.h> |
---|
26 | #include <pthread.h> |
---|
27 | #include <string.h> |
---|
28 | #include <stdlib.h> |
---|
29 | #include <unistd.h> |
---|
30 | |
---|
31 | #include <rtems.h> |
---|
32 | #include <rtems/ioimpl.h> |
---|
33 | #include <rtems/libio_.h> |
---|
34 | #include <rtems/sysinit.h> |
---|
35 | |
---|
36 | #include <rtems/extensionimpl.h> |
---|
37 | #ifdef RTEMS_POSIX_API |
---|
38 | #include <rtems/posix/barrierimpl.h> |
---|
39 | #include <rtems/posix/condimpl.h> |
---|
40 | #include <rtems/posix/mqueueimpl.h> |
---|
41 | #include <rtems/posix/muteximpl.h> |
---|
42 | #include <rtems/posix/psignalimpl.h> |
---|
43 | #include <rtems/posix/pthreadimpl.h> |
---|
44 | #include <rtems/posix/rwlockimpl.h> |
---|
45 | #include <rtems/posix/semaphoreimpl.h> |
---|
46 | #include <rtems/posix/spinlockimpl.h> |
---|
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 | INITIAL_EXTENSIONS_PRE, |
---|
73 | INITIAL_EXTENSIONS_POST, |
---|
74 | DATA_STRUCTURES_PRE, |
---|
75 | DATA_STRUCTURES_POST, |
---|
76 | CPU_SET_PRE, |
---|
77 | CPU_SET_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 | POSIX_THREADS_PRE, |
---|
106 | POSIX_THREADS_POST, |
---|
107 | POSIX_CONDITION_VARIABLE_PRE, |
---|
108 | POSIX_CONDITION_VARIABLE_POST, |
---|
109 | POSIX_MUTEX_PRE, |
---|
110 | POSIX_MUTEX_POST, |
---|
111 | POSIX_MESSAGE_QUEUE_PRE, |
---|
112 | POSIX_MESSAGE_QUEUE_POST, |
---|
113 | POSIX_SEMAPHORE_PRE, |
---|
114 | POSIX_SEMAPHORE_POST, |
---|
115 | POSIX_TIMER_PRE, |
---|
116 | POSIX_TIMER_POST, |
---|
117 | POSIX_BARRIER_PRE, |
---|
118 | POSIX_BARRIER_POST, |
---|
119 | POSIX_RWLOCK_PRE, |
---|
120 | POSIX_RWLOCK_POST, |
---|
121 | POSIX_SPINLOCK_PRE, |
---|
122 | POSIX_SPINLOCK_POST, |
---|
123 | POSIX_CLEANUP_PRE, |
---|
124 | POSIX_CLEANUP_POST, |
---|
125 | #endif /* RTEMS_POSIX_API */ |
---|
126 | POSIX_KEYS_PRE, |
---|
127 | POSIX_KEYS_POST, |
---|
128 | IDLE_THREADS_PRE, |
---|
129 | IDLE_THREADS_POST, |
---|
130 | LIBIO_PRE, |
---|
131 | LIBIO_POST, |
---|
132 | ROOT_FILESYSTEM_PRE, |
---|
133 | ROOT_FILESYSTEM_POST, |
---|
134 | BSP_PRE_DRIVERS_PRE, |
---|
135 | BSP_PRE_DRIVERS_POST, |
---|
136 | DEVICE_DRIVERS_PRE, |
---|
137 | DEVICE_DRIVERS_POST, |
---|
138 | CLASSIC_USER_TASKS_PRE, |
---|
139 | CLASSIC_USER_TASKS_POST, |
---|
140 | #ifdef RTEMS_POSIX_API |
---|
141 | POSIX_USER_THREADS_PRE, |
---|
142 | POSIX_USER_THREADS_POST, |
---|
143 | #endif /* RTEMS_POSIX_API */ |
---|
144 | STD_FILE_DESCRIPTORS_PRE, |
---|
145 | STD_FILE_DESCRIPTORS_POST, |
---|
146 | INIT_TASK, |
---|
147 | DONE |
---|
148 | } init_step; |
---|
149 | |
---|
150 | #define FIRST(x) \ |
---|
151 | static void x##_first(void); \ |
---|
152 | RTEMS_SYSINIT_ITEM( \ |
---|
153 | x##_first, \ |
---|
154 | x, \ |
---|
155 | RTEMS_SYSINIT_ORDER_FIRST \ |
---|
156 | ); \ |
---|
157 | static void x##_first(void) |
---|
158 | |
---|
159 | #define LAST(x) \ |
---|
160 | static void x##_last(void); \ |
---|
161 | RTEMS_SYSINIT_ITEM( \ |
---|
162 | x##_last, \ |
---|
163 | x, \ |
---|
164 | RTEMS_SYSINIT_ORDER_LAST \ |
---|
165 | ); \ |
---|
166 | static void x##_last(void) |
---|
167 | |
---|
168 | static init_step step; |
---|
169 | |
---|
170 | static void next_step(init_step expected) |
---|
171 | { |
---|
172 | assert(step == expected); |
---|
173 | step = expected + 1; |
---|
174 | } |
---|
175 | |
---|
176 | FIRST(RTEMS_SYSINIT_BSP_WORK_AREAS) |
---|
177 | { |
---|
178 | TEST_BEGIN(); |
---|
179 | assert(_Workspace_Area.area_begin == 0); |
---|
180 | next_step(BSP_WORK_AREAS_PRE); |
---|
181 | } |
---|
182 | |
---|
183 | LAST(RTEMS_SYSINIT_BSP_WORK_AREAS) |
---|
184 | { |
---|
185 | assert(_Workspace_Area.area_begin != 0); |
---|
186 | next_step(BSP_WORK_AREAS_POST); |
---|
187 | } |
---|
188 | |
---|
189 | FIRST(RTEMS_SYSINIT_BSP_START) |
---|
190 | { |
---|
191 | /* |
---|
192 | * Since the work performed here is BSP-specific, there is no way to test pre |
---|
193 | * and post conditions. |
---|
194 | */ |
---|
195 | next_step(BSP_START_PRE); |
---|
196 | } |
---|
197 | |
---|
198 | LAST(RTEMS_SYSINIT_BSP_START) |
---|
199 | { |
---|
200 | next_step(BSP_START_POST); |
---|
201 | } |
---|
202 | |
---|
203 | FIRST(RTEMS_SYSINIT_INITIAL_EXTENSIONS) |
---|
204 | { |
---|
205 | assert(_Chain_Is_empty(&_User_extensions_Switches_list)); |
---|
206 | next_step(INITIAL_EXTENSIONS_PRE); |
---|
207 | } |
---|
208 | |
---|
209 | LAST(RTEMS_SYSINIT_INITIAL_EXTENSIONS) |
---|
210 | { |
---|
211 | assert(!_Chain_Is_empty(&_User_extensions_Switches_list)); |
---|
212 | next_step(INITIAL_EXTENSIONS_POST); |
---|
213 | } |
---|
214 | |
---|
215 | FIRST(RTEMS_SYSINIT_DATA_STRUCTURES) |
---|
216 | { |
---|
217 | assert(_RTEMS_Allocator_Mutex == NULL); |
---|
218 | next_step(DATA_STRUCTURES_PRE); |
---|
219 | } |
---|
220 | |
---|
221 | LAST(RTEMS_SYSINIT_DATA_STRUCTURES) |
---|
222 | { |
---|
223 | assert(_RTEMS_Allocator_Mutex != NULL); |
---|
224 | next_step(DATA_STRUCTURES_POST); |
---|
225 | } |
---|
226 | |
---|
227 | FIRST(RTEMS_SYSINIT_CPU_SET) |
---|
228 | { |
---|
229 | /* There is nothing to do in case RTEMS_SMP is not defined */ |
---|
230 | next_step(CPU_SET_PRE); |
---|
231 | } |
---|
232 | |
---|
233 | LAST(RTEMS_SYSINIT_CPU_SET) |
---|
234 | { |
---|
235 | next_step(CPU_SET_POST); |
---|
236 | } |
---|
237 | |
---|
238 | FIRST(RTEMS_SYSINIT_USER_EXTENSIONS) |
---|
239 | { |
---|
240 | assert(_Extension_Information.maximum == 0); |
---|
241 | next_step(USER_EXTENSIONS_PRE); |
---|
242 | } |
---|
243 | |
---|
244 | LAST(RTEMS_SYSINIT_USER_EXTENSIONS) |
---|
245 | { |
---|
246 | assert(_Extension_Information.maximum != 0); |
---|
247 | next_step(USER_EXTENSIONS_POST); |
---|
248 | } |
---|
249 | |
---|
250 | FIRST(RTEMS_SYSINIT_CLASSIC_TASKS) |
---|
251 | { |
---|
252 | assert(_RTEMS_tasks_Information.Objects.maximum == 0); |
---|
253 | next_step(CLASSIC_TASKS_PRE); |
---|
254 | } |
---|
255 | |
---|
256 | LAST(RTEMS_SYSINIT_CLASSIC_TASKS) |
---|
257 | { |
---|
258 | assert(_RTEMS_tasks_Information.Objects.maximum != 0); |
---|
259 | next_step(CLASSIC_TASKS_POST); |
---|
260 | } |
---|
261 | |
---|
262 | FIRST(RTEMS_SYSINIT_CLASSIC_TIMER) |
---|
263 | { |
---|
264 | assert(_Timer_Information.maximum == 0); |
---|
265 | next_step(CLASSIC_TIMER_PRE); |
---|
266 | } |
---|
267 | |
---|
268 | LAST(RTEMS_SYSINIT_CLASSIC_TIMER) |
---|
269 | { |
---|
270 | assert(_Timer_Information.maximum != 0); |
---|
271 | next_step(CLASSIC_TIMER_POST); |
---|
272 | } |
---|
273 | |
---|
274 | FIRST(RTEMS_SYSINIT_CLASSIC_SIGNAL) |
---|
275 | { |
---|
276 | /* There is nothing to do in case RTEMS_MULTIPROCESSING is not defined */ |
---|
277 | next_step(CLASSIC_SIGNAL_PRE); |
---|
278 | } |
---|
279 | |
---|
280 | LAST(RTEMS_SYSINIT_CLASSIC_SIGNAL) |
---|
281 | { |
---|
282 | next_step(CLASSIC_SIGNAL_POST); |
---|
283 | } |
---|
284 | |
---|
285 | FIRST(RTEMS_SYSINIT_CLASSIC_EVENT) |
---|
286 | { |
---|
287 | /* There is nothing to do in case RTEMS_MULTIPROCESSING is not defined */ |
---|
288 | next_step(CLASSIC_EVENT_PRE); |
---|
289 | } |
---|
290 | |
---|
291 | LAST(RTEMS_SYSINIT_CLASSIC_EVENT) |
---|
292 | { |
---|
293 | next_step(CLASSIC_EVENT_POST); |
---|
294 | } |
---|
295 | |
---|
296 | FIRST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE) |
---|
297 | { |
---|
298 | assert(_Message_queue_Information.maximum == 0); |
---|
299 | next_step(CLASSIC_MESSAGE_QUEUE_PRE); |
---|
300 | } |
---|
301 | |
---|
302 | LAST(RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE) |
---|
303 | { |
---|
304 | assert(_Message_queue_Information.maximum != 0); |
---|
305 | next_step(CLASSIC_MESSAGE_QUEUE_POST); |
---|
306 | } |
---|
307 | |
---|
308 | FIRST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE) |
---|
309 | { |
---|
310 | assert(_Semaphore_Information.maximum == 0); |
---|
311 | next_step(CLASSIC_SEMAPHORE_PRE); |
---|
312 | } |
---|
313 | |
---|
314 | LAST(RTEMS_SYSINIT_CLASSIC_SEMAPHORE) |
---|
315 | { |
---|
316 | assert(_Semaphore_Information.maximum != 0); |
---|
317 | next_step(CLASSIC_SEMAPHORE_POST); |
---|
318 | } |
---|
319 | |
---|
320 | FIRST(RTEMS_SYSINIT_CLASSIC_PARTITION) |
---|
321 | { |
---|
322 | assert(_Partition_Information.maximum == 0); |
---|
323 | next_step(CLASSIC_PARTITION_PRE); |
---|
324 | } |
---|
325 | |
---|
326 | LAST(RTEMS_SYSINIT_CLASSIC_PARTITION) |
---|
327 | { |
---|
328 | assert(_Partition_Information.maximum != 0); |
---|
329 | next_step(CLASSIC_PARTITION_POST); |
---|
330 | } |
---|
331 | |
---|
332 | FIRST(RTEMS_SYSINIT_CLASSIC_REGION) |
---|
333 | { |
---|
334 | assert(_Region_Information.maximum == 0); |
---|
335 | next_step(CLASSIC_REGION_PRE); |
---|
336 | } |
---|
337 | |
---|
338 | LAST(RTEMS_SYSINIT_CLASSIC_REGION) |
---|
339 | { |
---|
340 | assert(_Region_Information.maximum != 0); |
---|
341 | next_step(CLASSIC_REGION_POST); |
---|
342 | } |
---|
343 | |
---|
344 | FIRST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY) |
---|
345 | { |
---|
346 | assert(_Dual_ported_memory_Information.maximum == 0); |
---|
347 | next_step(CLASSIC_DUAL_PORTED_MEMORY_PRE); |
---|
348 | } |
---|
349 | |
---|
350 | LAST(RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY) |
---|
351 | { |
---|
352 | assert(_Dual_ported_memory_Information.maximum != 0); |
---|
353 | next_step(CLASSIC_DUAL_PORTED_MEMORY_POST); |
---|
354 | } |
---|
355 | |
---|
356 | FIRST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC) |
---|
357 | { |
---|
358 | assert(_Rate_monotonic_Information.maximum == 0); |
---|
359 | next_step(CLASSIC_RATE_MONOTONIC_PRE); |
---|
360 | } |
---|
361 | |
---|
362 | LAST(RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC) |
---|
363 | { |
---|
364 | assert(_Rate_monotonic_Information.maximum != 0); |
---|
365 | next_step(CLASSIC_RATE_MONOTONIC_POST); |
---|
366 | } |
---|
367 | |
---|
368 | FIRST(RTEMS_SYSINIT_CLASSIC_BARRIER) |
---|
369 | { |
---|
370 | assert(_Barrier_Information.maximum == 0); |
---|
371 | next_step(CLASSIC_BARRIER_PRE); |
---|
372 | } |
---|
373 | |
---|
374 | LAST(RTEMS_SYSINIT_CLASSIC_BARRIER) |
---|
375 | { |
---|
376 | assert(_Barrier_Information.maximum != 0); |
---|
377 | next_step(CLASSIC_BARRIER_POST); |
---|
378 | } |
---|
379 | |
---|
380 | #ifdef RTEMS_POSIX_API |
---|
381 | |
---|
382 | FIRST(RTEMS_SYSINIT_POSIX_SIGNALS) |
---|
383 | { |
---|
384 | assert( |
---|
385 | memcmp( |
---|
386 | &_POSIX_signals_Vectors, |
---|
387 | _POSIX_signals_Default_vectors, |
---|
388 | sizeof(_POSIX_signals_Vectors) |
---|
389 | ) != 0 |
---|
390 | ); |
---|
391 | next_step(POSIX_SIGNALS_PRE); |
---|
392 | } |
---|
393 | |
---|
394 | LAST(RTEMS_SYSINIT_POSIX_SIGNALS) |
---|
395 | { |
---|
396 | assert( |
---|
397 | memcmp( |
---|
398 | &_POSIX_signals_Vectors, |
---|
399 | _POSIX_signals_Default_vectors, |
---|
400 | sizeof(_POSIX_signals_Vectors) |
---|
401 | ) == 0 |
---|
402 | ); |
---|
403 | next_step(POSIX_SIGNALS_POST); |
---|
404 | } |
---|
405 | |
---|
406 | FIRST(RTEMS_SYSINIT_POSIX_THREADS) |
---|
407 | { |
---|
408 | assert(_POSIX_Threads_Information.Objects.maximum == 0); |
---|
409 | next_step(POSIX_THREADS_PRE); |
---|
410 | } |
---|
411 | |
---|
412 | LAST(RTEMS_SYSINIT_POSIX_THREADS) |
---|
413 | { |
---|
414 | assert(_POSIX_Threads_Information.Objects.maximum != 0); |
---|
415 | next_step(POSIX_THREADS_POST); |
---|
416 | } |
---|
417 | |
---|
418 | FIRST(RTEMS_SYSINIT_POSIX_CONDITION_VARIABLE) |
---|
419 | { |
---|
420 | assert(_POSIX_Condition_variables_Information.maximum == 0); |
---|
421 | next_step(POSIX_CONDITION_VARIABLE_PRE); |
---|
422 | } |
---|
423 | |
---|
424 | LAST(RTEMS_SYSINIT_POSIX_CONDITION_VARIABLE) |
---|
425 | { |
---|
426 | assert(_POSIX_Condition_variables_Information.maximum != 0); |
---|
427 | next_step(POSIX_CONDITION_VARIABLE_POST); |
---|
428 | } |
---|
429 | |
---|
430 | FIRST(RTEMS_SYSINIT_POSIX_MUTEX) |
---|
431 | { |
---|
432 | assert(_POSIX_Mutex_Information.maximum == 0); |
---|
433 | next_step(POSIX_MUTEX_PRE); |
---|
434 | } |
---|
435 | |
---|
436 | LAST(RTEMS_SYSINIT_POSIX_MUTEX) |
---|
437 | { |
---|
438 | assert(_POSIX_Mutex_Information.maximum != 0); |
---|
439 | next_step(POSIX_MUTEX_POST); |
---|
440 | } |
---|
441 | |
---|
442 | FIRST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE) |
---|
443 | { |
---|
444 | assert(_POSIX_Message_queue_Information.maximum == 0); |
---|
445 | next_step(POSIX_MESSAGE_QUEUE_PRE); |
---|
446 | } |
---|
447 | |
---|
448 | LAST(RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE) |
---|
449 | { |
---|
450 | assert(_POSIX_Message_queue_Information.maximum != 0); |
---|
451 | next_step(POSIX_MESSAGE_QUEUE_POST); |
---|
452 | } |
---|
453 | |
---|
454 | FIRST(RTEMS_SYSINIT_POSIX_SEMAPHORE) |
---|
455 | { |
---|
456 | assert(_POSIX_Semaphore_Information.maximum == 0); |
---|
457 | next_step(POSIX_SEMAPHORE_PRE); |
---|
458 | } |
---|
459 | |
---|
460 | LAST(RTEMS_SYSINIT_POSIX_SEMAPHORE) |
---|
461 | { |
---|
462 | assert(_POSIX_Semaphore_Information.maximum != 0); |
---|
463 | next_step(POSIX_SEMAPHORE_POST); |
---|
464 | } |
---|
465 | |
---|
466 | FIRST(RTEMS_SYSINIT_POSIX_TIMER) |
---|
467 | { |
---|
468 | assert(_POSIX_Timer_Information.maximum == 0); |
---|
469 | next_step(POSIX_TIMER_PRE); |
---|
470 | } |
---|
471 | |
---|
472 | LAST(RTEMS_SYSINIT_POSIX_TIMER) |
---|
473 | { |
---|
474 | assert(_POSIX_Timer_Information.maximum != 0); |
---|
475 | next_step(POSIX_TIMER_POST); |
---|
476 | } |
---|
477 | |
---|
478 | FIRST(RTEMS_SYSINIT_POSIX_BARRIER) |
---|
479 | { |
---|
480 | assert(_POSIX_Barrier_Information.maximum == 0); |
---|
481 | next_step(POSIX_BARRIER_PRE); |
---|
482 | } |
---|
483 | |
---|
484 | LAST(RTEMS_SYSINIT_POSIX_BARRIER) |
---|
485 | { |
---|
486 | assert(_POSIX_Barrier_Information.maximum != 0); |
---|
487 | next_step(POSIX_BARRIER_POST); |
---|
488 | } |
---|
489 | |
---|
490 | FIRST(RTEMS_SYSINIT_POSIX_RWLOCK) |
---|
491 | { |
---|
492 | assert(_POSIX_RWLock_Information.maximum == 0); |
---|
493 | next_step(POSIX_RWLOCK_PRE); |
---|
494 | } |
---|
495 | |
---|
496 | LAST(RTEMS_SYSINIT_POSIX_RWLOCK) |
---|
497 | { |
---|
498 | assert(_POSIX_RWLock_Information.maximum != 0); |
---|
499 | next_step(POSIX_RWLOCK_POST); |
---|
500 | } |
---|
501 | |
---|
502 | FIRST(RTEMS_SYSINIT_POSIX_SPINLOCK) |
---|
503 | { |
---|
504 | assert(_POSIX_Spinlock_Information.maximum == 0); |
---|
505 | next_step(POSIX_SPINLOCK_PRE); |
---|
506 | } |
---|
507 | |
---|
508 | LAST(RTEMS_SYSINIT_POSIX_SPINLOCK) |
---|
509 | { |
---|
510 | assert(_POSIX_Spinlock_Information.maximum != 0); |
---|
511 | next_step(POSIX_SPINLOCK_POST); |
---|
512 | } |
---|
513 | |
---|
514 | static size_t user_extensions_pre_posix_cleanup; |
---|
515 | |
---|
516 | FIRST(RTEMS_SYSINIT_POSIX_CLEANUP) |
---|
517 | { |
---|
518 | user_extensions_pre_posix_cleanup = |
---|
519 | _Chain_Node_count_unprotected(&_User_extensions_List.Active); |
---|
520 | next_step(POSIX_CLEANUP_PRE); |
---|
521 | } |
---|
522 | |
---|
523 | LAST(RTEMS_SYSINIT_POSIX_CLEANUP) |
---|
524 | { |
---|
525 | assert( |
---|
526 | user_extensions_pre_posix_cleanup + 1 == |
---|
527 | _Chain_Node_count_unprotected(&_User_extensions_List.Active) |
---|
528 | ); |
---|
529 | next_step(POSIX_CLEANUP_POST); |
---|
530 | } |
---|
531 | |
---|
532 | #endif /* RTEMS_POSIX_API */ |
---|
533 | |
---|
534 | FIRST(RTEMS_SYSINIT_POSIX_KEYS) |
---|
535 | { |
---|
536 | assert(_POSIX_Keys_Information.maximum == 0); |
---|
537 | next_step(POSIX_KEYS_PRE); |
---|
538 | } |
---|
539 | |
---|
540 | LAST(RTEMS_SYSINIT_POSIX_KEYS) |
---|
541 | { |
---|
542 | assert(_POSIX_Keys_Information.maximum != 0); |
---|
543 | next_step(POSIX_KEYS_POST); |
---|
544 | } |
---|
545 | |
---|
546 | FIRST(RTEMS_SYSINIT_IDLE_THREADS) |
---|
547 | { |
---|
548 | assert(_System_state_Is_before_initialization(_System_state_Get())); |
---|
549 | next_step(IDLE_THREADS_PRE); |
---|
550 | } |
---|
551 | |
---|
552 | LAST(RTEMS_SYSINIT_IDLE_THREADS) |
---|
553 | { |
---|
554 | assert(_System_state_Is_before_multitasking(_System_state_Get())); |
---|
555 | next_step(IDLE_THREADS_POST); |
---|
556 | } |
---|
557 | |
---|
558 | FIRST(RTEMS_SYSINIT_LIBIO) |
---|
559 | { |
---|
560 | assert(rtems_libio_semaphore == 0); |
---|
561 | next_step(LIBIO_PRE); |
---|
562 | } |
---|
563 | |
---|
564 | LAST(RTEMS_SYSINIT_LIBIO) |
---|
565 | { |
---|
566 | assert(rtems_libio_semaphore != 0); |
---|
567 | next_step(LIBIO_POST); |
---|
568 | } |
---|
569 | |
---|
570 | FIRST(RTEMS_SYSINIT_ROOT_FILESYSTEM) |
---|
571 | { |
---|
572 | struct stat st; |
---|
573 | int rv; |
---|
574 | |
---|
575 | rv = stat("/", &st); |
---|
576 | assert(rv == -1); |
---|
577 | next_step(ROOT_FILESYSTEM_PRE); |
---|
578 | } |
---|
579 | |
---|
580 | LAST(RTEMS_SYSINIT_ROOT_FILESYSTEM) |
---|
581 | { |
---|
582 | struct stat st; |
---|
583 | int rv; |
---|
584 | |
---|
585 | rv = stat("/", &st); |
---|
586 | assert(rv == 0); |
---|
587 | next_step(ROOT_FILESYSTEM_POST); |
---|
588 | } |
---|
589 | |
---|
590 | FIRST(RTEMS_SYSINIT_BSP_PRE_DRIVERS) |
---|
591 | { |
---|
592 | /* |
---|
593 | * Since the work performed here is BSP-specific, there is no way to test pre |
---|
594 | * and post conditions. |
---|
595 | */ |
---|
596 | next_step(BSP_PRE_DRIVERS_PRE); |
---|
597 | } |
---|
598 | |
---|
599 | LAST(RTEMS_SYSINIT_BSP_PRE_DRIVERS) |
---|
600 | { |
---|
601 | next_step(BSP_PRE_DRIVERS_POST); |
---|
602 | } |
---|
603 | |
---|
604 | FIRST(RTEMS_SYSINIT_DEVICE_DRIVERS) |
---|
605 | { |
---|
606 | assert(!_IO_All_drivers_initialized); |
---|
607 | next_step(DEVICE_DRIVERS_PRE); |
---|
608 | } |
---|
609 | |
---|
610 | LAST(RTEMS_SYSINIT_DEVICE_DRIVERS) |
---|
611 | { |
---|
612 | assert(_IO_All_drivers_initialized); |
---|
613 | next_step(DEVICE_DRIVERS_POST); |
---|
614 | } |
---|
615 | |
---|
616 | FIRST(RTEMS_SYSINIT_CLASSIC_USER_TASKS) |
---|
617 | { |
---|
618 | _Objects_Allocator_lock(); |
---|
619 | assert(_Objects_Active_count(&_RTEMS_tasks_Information.Objects) == 0); |
---|
620 | _Objects_Allocator_unlock(); |
---|
621 | next_step(CLASSIC_USER_TASKS_PRE); |
---|
622 | } |
---|
623 | |
---|
624 | LAST(RTEMS_SYSINIT_CLASSIC_USER_TASKS) |
---|
625 | { |
---|
626 | _Objects_Allocator_lock(); |
---|
627 | assert(_Objects_Active_count(&_RTEMS_tasks_Information.Objects) == 1); |
---|
628 | _Objects_Allocator_unlock(); |
---|
629 | next_step(CLASSIC_USER_TASKS_POST); |
---|
630 | } |
---|
631 | |
---|
632 | #ifdef RTEMS_POSIX_API |
---|
633 | |
---|
634 | FIRST(RTEMS_SYSINIT_POSIX_USER_THREADS) |
---|
635 | { |
---|
636 | _Objects_Allocator_lock(); |
---|
637 | assert(_Objects_Active_count(&_POSIX_Threads_Information.Objects) == 0); |
---|
638 | _Objects_Allocator_unlock(); |
---|
639 | next_step(POSIX_USER_THREADS_PRE); |
---|
640 | } |
---|
641 | |
---|
642 | LAST(RTEMS_SYSINIT_POSIX_USER_THREADS) |
---|
643 | { |
---|
644 | _Objects_Allocator_lock(); |
---|
645 | assert(_Objects_Active_count(&_POSIX_Threads_Information.Objects) == 1); |
---|
646 | _Objects_Allocator_unlock(); |
---|
647 | next_step(POSIX_USER_THREADS_POST); |
---|
648 | } |
---|
649 | |
---|
650 | #endif /* RTEMS_POSIX_API */ |
---|
651 | |
---|
652 | FIRST(RTEMS_SYSINIT_STD_FILE_DESCRIPTORS) |
---|
653 | { |
---|
654 | struct stat st; |
---|
655 | int rv; |
---|
656 | |
---|
657 | rv = fstat(0, &st); |
---|
658 | assert(rv == -1); |
---|
659 | next_step(STD_FILE_DESCRIPTORS_PRE); |
---|
660 | } |
---|
661 | |
---|
662 | LAST(RTEMS_SYSINIT_STD_FILE_DESCRIPTORS) |
---|
663 | { |
---|
664 | struct stat st; |
---|
665 | int rv; |
---|
666 | |
---|
667 | rv = fstat(0, &st); |
---|
668 | assert(rv == 0); |
---|
669 | next_step(STD_FILE_DESCRIPTORS_POST); |
---|
670 | } |
---|
671 | |
---|
672 | static void Init(rtems_task_argument arg) |
---|
673 | { |
---|
674 | #ifdef RTEMS_POSIX_API |
---|
675 | pthread_cleanup_push(NULL, NULL); |
---|
676 | pthread_cleanup_pop(0); |
---|
677 | #endif /* RTEMS_POSIX_API */ |
---|
678 | next_step(INIT_TASK); |
---|
679 | TEST_END(); |
---|
680 | exit(0); |
---|
681 | } |
---|
682 | |
---|
683 | #ifdef RTEMS_POSIX_API |
---|
684 | |
---|
685 | static void *POSIX_Init(void *arg) |
---|
686 | { |
---|
687 | return NULL; |
---|
688 | } |
---|
689 | |
---|
690 | #endif /* RTEMS_POSIX_API */ |
---|
691 | |
---|
692 | #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER |
---|
693 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
694 | |
---|
695 | #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1 |
---|
696 | |
---|
697 | #define CONFIGURE_MAXIMUM_BARRIERS 1 |
---|
698 | |
---|
699 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 |
---|
700 | |
---|
701 | #define CONFIGURE_MAXIMUM_PARTITIONS 1 |
---|
702 | |
---|
703 | #define CONFIGURE_MAXIMUM_PERIODS 1 |
---|
704 | |
---|
705 | #define CONFIGURE_MAXIMUM_PORTS 1 |
---|
706 | |
---|
707 | #define CONFIGURE_MAXIMUM_REGIONS 1 |
---|
708 | |
---|
709 | #define CONFIGURE_MAXIMUM_SEMAPHORES 1 |
---|
710 | |
---|
711 | #define CONFIGURE_MAXIMUM_TASKS 1 |
---|
712 | |
---|
713 | #define CONFIGURE_MAXIMUM_TIMERS 1 |
---|
714 | |
---|
715 | #ifdef RTEMS_POSIX_API |
---|
716 | |
---|
717 | #define CONFIGURE_MAXIMUM_POSIX_BARRIERS 1 |
---|
718 | |
---|
719 | #define CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES 1 |
---|
720 | |
---|
721 | #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1 |
---|
722 | |
---|
723 | #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 1 |
---|
724 | |
---|
725 | #define CONFIGURE_MAXIMUM_POSIX_RWLOCKS 1 |
---|
726 | |
---|
727 | #define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 1 |
---|
728 | |
---|
729 | #define CONFIGURE_MAXIMUM_POSIX_SPINLOCKS 1 |
---|
730 | |
---|
731 | #define CONFIGURE_MAXIMUM_POSIX_TIMERS 1 |
---|
732 | |
---|
733 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 |
---|
734 | |
---|
735 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE |
---|
736 | |
---|
737 | #endif /* RTEMS_POSIX_API */ |
---|
738 | |
---|
739 | #define CONFIGURE_MAXIMUM_POSIX_KEYS 1 |
---|
740 | |
---|
741 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
---|
742 | |
---|
743 | #define CONFIGURE_STACK_CHECKER_ENABLED |
---|
744 | |
---|
745 | #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION |
---|
746 | |
---|
747 | #define CONFIGURE_INIT |
---|
748 | |
---|
749 | #include <rtems/confdefs.h> |
---|