/* * Example initialization file - spawns 2 native FPU tasks * */ #define CONFIGURE_INIT #define TASKS 4 #define DEFINE_VARS #include "system.h" #include #include rtems_task Init(rtems_task_argument argument) { rtems_status_code status; rtems_name Task_name[TASKS]; /* task names */ rtems_id Task_id[TASKS]; /* task ids */ int i; memcheck(); all_OK = 1; g_init_task_id = rtems_task_self(); for(i = 0; i < TASKS; i++) { // Initialize Task name Task_name[i] = rtems_build_name('T', 'T', "0" + i / 10, "0" + i % 10); // Create Task status = rtems_task_create( Task_name[i], (rtems_task_priority) 2, RTEMS_MINIMUM_STACK_SIZE, #ifndef BSP_leon2 // LEON3/LEON4 system - use full SMP RTEMS_DEFAULT_MODES, #else // LEON2 system - emulate SMP via Linux/Windows-like // handling of tasks with same priority (i.e. pre-emption) RTEMS_DEFAULT_MODES | RTEMS_TIMESLICE, #endif (i%2) == 0 ? RTEMS_FLOATING_POINT : RTEMS_DEFAULT_ATTRIBUTES, &Task_id[i]); if (status != RTEMS_SUCCESSFUL) { printf( "[MAIN] Failed to rtems_task_create... status:%0x\n", status); rtems_task_delete(RTEMS_SELF); } // Start Task status = rtems_task_start( Task_id[i], (i%2) == 0 ? Task1_EntryPoint : Task2_EntryPoint, i); } // To give coverage code the opportunity to work, wait for children tasks // to die first. RTEMS events are used for synchronization. { printf("[MAIN] Waiting for testing tasks to complete...\n"); rtems_option options = (RTEMS_EVENT_ANY | RTEMS_WAIT); rtems_event_set in = 0; for (i=0; i