diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-06-21 17:12:40 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-06-22 14:00:28 +0200 |
commit | c82835a231351377866ceb82826010ba0485255d (patch) | |
tree | a6a891207d89e37f01bc54cf276e4c6cac9c6236 /cpukit/rtems/src/taskcreate.c | |
parent | posix: Generalize _POSIX_Priority_To_core() (diff) | |
download | rtems-c82835a231351377866ceb82826010ba0485255d.tar.bz2 |
rtems: Rework RTEMS API to SuperCore priority
Use same structure as POSIX API for thread priority conversion to/from
SuperCore.
Diffstat (limited to 'cpukit/rtems/src/taskcreate.c')
-rw-r--r-- | cpukit/rtems/src/taskcreate.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/cpukit/rtems/src/taskcreate.c b/cpukit/rtems/src/taskcreate.c index 5d9f9dda91..e231d4a0c3 100644 --- a/cpukit/rtems/src/taskcreate.c +++ b/cpukit/rtems/src/taskcreate.c @@ -37,6 +37,7 @@ rtems_status_code rtems_task_create( ) { Thread_Control *the_thread; + const Scheduler_Control *scheduler; bool is_fp; #if defined(RTEMS_MULTIPROCESSING) Objects_MP_Control *the_global_object = NULL; @@ -44,7 +45,8 @@ rtems_status_code rtems_task_create( #endif bool status; rtems_attribute the_attribute_set; - Priority_Control core_priority; + bool valid; + Priority_Control priority; RTEMS_API_Control *api; ASR_Information *asr; @@ -83,11 +85,17 @@ rtems_status_code rtems_task_create( */ if ( !_Attributes_Is_system_task( the_attribute_set ) ) { - if ( !_RTEMS_tasks_Priority_is_valid( initial_priority ) ) + if ( initial_priority == PRIORITY_MINIMUM ) { return RTEMS_INVALID_PRIORITY; + } } - core_priority = _RTEMS_tasks_Priority_to_Core( initial_priority ); + scheduler = _Scheduler_Get_by_CPU_index( _SMP_Get_current_processor() ); + + priority = _RTEMS_Priority_To_core( scheduler, initial_priority, &valid ); + if ( !valid ) { + return RTEMS_INVALID_PRIORITY; + } #if defined(RTEMS_MULTIPROCESSING) if ( _Attributes_Is_global( the_attribute_set ) ) { @@ -136,11 +144,11 @@ rtems_status_code rtems_task_create( status = _Thread_Initialize( &_RTEMS_tasks_Information, the_thread, - _Scheduler_Get_by_CPU_index( _SMP_Get_current_processor() ), + scheduler, NULL, stack_size, is_fp, - core_priority, + priority, _Modes_Is_preempt(initial_modes) ? true : false, _Modes_Is_timeslice(initial_modes) ? THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE : |