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