diff options
Diffstat (limited to 'c/src/exec/rtems')
37 files changed, 368 insertions, 241 deletions
diff --git a/c/src/exec/rtems/headers/asr.h b/c/src/exec/rtems/headers/asr.h index 44d03f2802..b2147f8df4 100644 --- a/c/src/exec/rtems/headers/asr.h +++ b/c/src/exec/rtems/headers/asr.h @@ -54,11 +54,11 @@ typedef rtems_asr ( *rtems_asr_entry )( */ typedef struct { - rtems_asr_entry handler; /* address of RTEMS_ASR */ - rtems_mode mode_set; /* RTEMS_ASR mode */ - rtems_signal_set signals_posted; /* signal set */ - rtems_signal_set signals_pending; /* pending signal set */ - unsigned32 nest_level; /* nest level of RTEMS_ASR */ + rtems_asr_entry handler; /* address of RTEMS_ASR */ + Modes_Control mode_set; /* RTEMS_ASR mode */ + rtems_signal_set signals_posted; /* signal set */ + rtems_signal_set signals_pending; /* pending signal set */ + unsigned32 nest_level; /* nest level of RTEMS_ASR */ } ASR_Information; /* diff --git a/c/src/exec/rtems/headers/attr.h b/c/src/exec/rtems/headers/attr.h index a94343e164..950d77f73d 100644 --- a/c/src/exec/rtems/headers/attr.h +++ b/c/src/exec/rtems/headers/attr.h @@ -27,7 +27,7 @@ typedef unsigned32 rtems_attribute; /* constants */ -#define RTEMS_DEFAULT_ATTRIBUTES 0x00000000 +#define RTEMS_DEFAULT_ATTRIBUTES 0x00000000 #define RTEMS_NO_FLOATING_POINT 0x00000000 /* don't use FP HW */ #define RTEMS_FLOATING_POINT 0x00000001 /* utilize coprocessor */ diff --git a/c/src/exec/rtems/headers/modes.h b/c/src/exec/rtems/headers/modes.h index 9e714591ab..b3b05b3f85 100644 --- a/c/src/exec/rtems/headers/modes.h +++ b/c/src/exec/rtems/headers/modes.h @@ -28,7 +28,7 @@ extern "C" { * each a mode set. */ -typedef unsigned32 rtems_mode; +typedef unsigned32 Modes_Control; /* * The following constants define the individual modes and masks @@ -73,7 +73,7 @@ typedef unsigned32 rtems_mode; */ STATIC INLINE unsigned32 RTEMS_INTERRUPT_LEVEL ( - rtems_mode mode_set + Modes_Control mode_set ); /* @@ -86,8 +86,8 @@ STATIC INLINE unsigned32 RTEMS_INTERRUPT_LEVEL ( */ STATIC INLINE boolean _Modes_Mask_changed ( - rtems_mode mode_set, - rtems_mode masks + Modes_Control mode_set, + Modes_Control masks ); /* @@ -100,7 +100,7 @@ STATIC INLINE boolean _Modes_Mask_changed ( */ STATIC INLINE boolean _Modes_Is_asr_disabled ( - rtems_mode mode_set + Modes_Control mode_set ); /* @@ -113,7 +113,7 @@ STATIC INLINE boolean _Modes_Is_asr_disabled ( */ STATIC INLINE boolean _Modes_Is_preempt ( - rtems_mode mode_set + Modes_Control mode_set ); /* @@ -126,7 +126,7 @@ STATIC INLINE boolean _Modes_Is_preempt ( */ STATIC INLINE boolean _Modes_Is_timeslice ( - rtems_mode mode_set + Modes_Control mode_set ); /* @@ -138,7 +138,7 @@ STATIC INLINE boolean _Modes_Is_timeslice ( */ STATIC INLINE ISR_Level _Modes_Get_interrupt_level ( - rtems_mode mode_set + Modes_Control mode_set ); /* @@ -151,7 +151,7 @@ STATIC INLINE ISR_Level _Modes_Get_interrupt_level ( */ STATIC INLINE void _Modes_Set_interrupt_level ( - rtems_mode mode_set + Modes_Control mode_set ); /* @@ -166,11 +166,11 @@ STATIC INLINE void _Modes_Set_interrupt_level ( */ STATIC INLINE void _Modes_Change ( - rtems_mode old_mode_set, - rtems_mode new_mode_set, - rtems_mode mask, - rtems_mode *out_mode_set, - rtems_mode *changed + Modes_Control old_mode_set, + Modes_Control new_mode_set, + Modes_Control mask, + Modes_Control *out_mode_set, + Modes_Control *changed ); #include <rtems/modes.inl> diff --git a/c/src/exec/rtems/headers/sem.h b/c/src/exec/rtems/headers/sem.h index e70253dcb1..ff8abbc773 100644 --- a/c/src/exec/rtems/headers/sem.h +++ b/c/src/exec/rtems/headers/sem.h @@ -82,10 +82,11 @@ void _Semaphore_Manager_initialization( */ rtems_status_code rtems_semaphore_create( - rtems_name name, - unsigned32 count, - rtems_attribute attribute_set, - Objects_Id *id + rtems_name name, + unsigned32 count, + rtems_attribute attribute_set, + rtems_task_priority priority_ceiling, + Objects_Id *id ); /* diff --git a/c/src/exec/rtems/headers/signal.h b/c/src/exec/rtems/headers/signal.h index 2466a8f931..74ff4a57fb 100644 --- a/c/src/exec/rtems/headers/signal.h +++ b/c/src/exec/rtems/headers/signal.h @@ -31,6 +31,7 @@ extern "C" { #include <rtems/modes.h> #include <rtems/object.h> #include <rtems/status.h> +#include <rtems/types.h> /* * rtems_signal_catch @@ -45,7 +46,7 @@ extern "C" { rtems_status_code rtems_signal_catch( rtems_asr_entry asr_handler, - rtems_mode mode_set + rtems_mode mode_set ); /* diff --git a/c/src/exec/rtems/headers/tasks.h b/c/src/exec/rtems/headers/tasks.h index 2f1021f8c9..df623fe175 100644 --- a/c/src/exec/rtems/headers/tasks.h +++ b/c/src/exec/rtems/headers/tasks.h @@ -47,6 +47,7 @@ extern "C" { #include <rtems/states.h> #include <rtems/thread.h> #include <rtems/threadq.h> +#include <rtems/types.h> /* * Constant to be used as the ID of current task @@ -94,12 +95,12 @@ void _RTEMS_tasks_Manager_initialization( */ rtems_status_code rtems_task_create( - rtems_name name, - rtems_task_priority initial_priority, - unsigned32 stack_size, - rtems_mode initial_modes, - rtems_attribute attribute_set, - Objects_Id *id + rtems_name name, + rtems_task_priority initial_priority, + unsigned32 stack_size, + rtems_mode initial_modes, + rtems_attribute attribute_set, + Objects_Id *id ); /* @@ -237,7 +238,7 @@ rtems_status_code rtems_task_resume( */ rtems_status_code rtems_task_set_priority( - Objects_Id id, + Objects_Id id, rtems_task_priority new_priority, rtems_task_priority *old_priority ); @@ -324,6 +325,18 @@ STATIC INLINE void _RTEMS_tasks_Cancel_wait( Thread_Control *the_thread ); +/* + * _RTEMS_Tasks_Priority_to_Core + * + * DESCRIPTION: + * + * This function converts an RTEMS API priority into a core priority. + */ + +STATIC INLINE Priority_Control _RTEMS_Tasks_Priority_to_Core( + rtems_task_priority priority +); + #include <rtems/tasks.inl> #include <rtems/taskmp.h> diff --git a/c/src/exec/rtems/headers/types.h b/c/src/exec/rtems/headers/types.h index 2a5cb6f4fd..e4d7c11065 100644 --- a/c/src/exec/rtems/headers/types.h +++ b/c/src/exec/rtems/headers/types.h @@ -21,6 +21,8 @@ extern "C" { #endif #include <rtems/object.h> +#include <rtems/priority.h> +#include <rtems/modes.h> /* * RTEMS basic type definitions @@ -48,6 +50,19 @@ typedef Context_Control rtems_context; typedef Context_Control_fp rtems_context_fp; typedef CPU_Interrupt_frame rtems_interrupt_frame; +/* + * Define the type for an RTEMS API task priority. + */ + +typedef Priority_Control rtems_task_priority; + +#define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY +/* + * Define the type for an RTEMS API task mode. + */ + +typedef Modes_Control rtems_mode; + #ifdef __cplusplus } #endif diff --git a/c/src/exec/rtems/include/rtems/rtems/asr.h b/c/src/exec/rtems/include/rtems/rtems/asr.h index 44d03f2802..b2147f8df4 100644 --- a/c/src/exec/rtems/include/rtems/rtems/asr.h +++ b/c/src/exec/rtems/include/rtems/rtems/asr.h @@ -54,11 +54,11 @@ typedef rtems_asr ( *rtems_asr_entry )( */ typedef struct { - rtems_asr_entry handler; /* address of RTEMS_ASR */ - rtems_mode mode_set; /* RTEMS_ASR mode */ - rtems_signal_set signals_posted; /* signal set */ - rtems_signal_set signals_pending; /* pending signal set */ - unsigned32 nest_level; /* nest level of RTEMS_ASR */ + rtems_asr_entry handler; /* address of RTEMS_ASR */ + Modes_Control mode_set; /* RTEMS_ASR mode */ + rtems_signal_set signals_posted; /* signal set */ + rtems_signal_set signals_pending; /* pending signal set */ + unsigned32 nest_level; /* nest level of RTEMS_ASR */ } ASR_Information; /* diff --git a/c/src/exec/rtems/include/rtems/rtems/attr.h b/c/src/exec/rtems/include/rtems/rtems/attr.h index a94343e164..950d77f73d 100644 --- a/c/src/exec/rtems/include/rtems/rtems/attr.h +++ b/c/src/exec/rtems/include/rtems/rtems/attr.h @@ -27,7 +27,7 @@ typedef unsigned32 rtems_attribute; /* constants */ -#define RTEMS_DEFAULT_ATTRIBUTES 0x00000000 +#define RTEMS_DEFAULT_ATTRIBUTES 0x00000000 #define RTEMS_NO_FLOATING_POINT 0x00000000 /* don't use FP HW */ #define RTEMS_FLOATING_POINT 0x00000001 /* utilize coprocessor */ diff --git a/c/src/exec/rtems/include/rtems/rtems/modes.h b/c/src/exec/rtems/include/rtems/rtems/modes.h index 9e714591ab..b3b05b3f85 100644 --- a/c/src/exec/rtems/include/rtems/rtems/modes.h +++ b/c/src/exec/rtems/include/rtems/rtems/modes.h @@ -28,7 +28,7 @@ extern "C" { * each a mode set. */ -typedef unsigned32 rtems_mode; +typedef unsigned32 Modes_Control; /* * The following constants define the individual modes and masks @@ -73,7 +73,7 @@ typedef unsigned32 rtems_mode; */ STATIC INLINE unsigned32 RTEMS_INTERRUPT_LEVEL ( - rtems_mode mode_set + Modes_Control mode_set ); /* @@ -86,8 +86,8 @@ STATIC INLINE unsigned32 RTEMS_INTERRUPT_LEVEL ( */ STATIC INLINE boolean _Modes_Mask_changed ( - rtems_mode mode_set, - rtems_mode masks + Modes_Control mode_set, + Modes_Control masks ); /* @@ -100,7 +100,7 @@ STATIC INLINE boolean _Modes_Mask_changed ( */ STATIC INLINE boolean _Modes_Is_asr_disabled ( - rtems_mode mode_set + Modes_Control mode_set ); /* @@ -113,7 +113,7 @@ STATIC INLINE boolean _Modes_Is_asr_disabled ( */ STATIC INLINE boolean _Modes_Is_preempt ( - rtems_mode mode_set + Modes_Control mode_set ); /* @@ -126,7 +126,7 @@ STATIC INLINE boolean _Modes_Is_preempt ( */ STATIC INLINE boolean _Modes_Is_timeslice ( - rtems_mode mode_set + Modes_Control mode_set ); /* @@ -138,7 +138,7 @@ STATIC INLINE boolean _Modes_Is_timeslice ( */ STATIC INLINE ISR_Level _Modes_Get_interrupt_level ( - rtems_mode mode_set + Modes_Control mode_set ); /* @@ -151,7 +151,7 @@ STATIC INLINE ISR_Level _Modes_Get_interrupt_level ( */ STATIC INLINE void _Modes_Set_interrupt_level ( - rtems_mode mode_set + Modes_Control mode_set ); /* @@ -166,11 +166,11 @@ STATIC INLINE void _Modes_Set_interrupt_level ( */ STATIC INLINE void _Modes_Change ( - rtems_mode old_mode_set, - rtems_mode new_mode_set, - rtems_mode mask, - rtems_mode *out_mode_set, - rtems_mode *changed + Modes_Control old_mode_set, + Modes_Control new_mode_set, + Modes_Control mask, + Modes_Control *out_mode_set, + Modes_Control *changed ); #include <rtems/modes.inl> diff --git a/c/src/exec/rtems/include/rtems/rtems/sem.h b/c/src/exec/rtems/include/rtems/rtems/sem.h index e70253dcb1..ff8abbc773 100644 --- a/c/src/exec/rtems/include/rtems/rtems/sem.h +++ b/c/src/exec/rtems/include/rtems/rtems/sem.h @@ -82,10 +82,11 @@ void _Semaphore_Manager_initialization( */ rtems_status_code rtems_semaphore_create( - rtems_name name, - unsigned32 count, - rtems_attribute attribute_set, - Objects_Id *id + rtems_name name, + unsigned32 count, + rtems_attribute attribute_set, + rtems_task_priority priority_ceiling, + Objects_Id *id ); /* diff --git a/c/src/exec/rtems/include/rtems/rtems/signal.h b/c/src/exec/rtems/include/rtems/rtems/signal.h index 2466a8f931..74ff4a57fb 100644 --- a/c/src/exec/rtems/include/rtems/rtems/signal.h +++ b/c/src/exec/rtems/include/rtems/rtems/signal.h @@ -31,6 +31,7 @@ extern "C" { #include <rtems/modes.h> #include <rtems/object.h> #include <rtems/status.h> +#include <rtems/types.h> /* * rtems_signal_catch @@ -45,7 +46,7 @@ extern "C" { rtems_status_code rtems_signal_catch( rtems_asr_entry asr_handler, - rtems_mode mode_set + rtems_mode mode_set ); /* diff --git a/c/src/exec/rtems/include/rtems/rtems/tasks.h b/c/src/exec/rtems/include/rtems/rtems/tasks.h index 2f1021f8c9..df623fe175 100644 --- a/c/src/exec/rtems/include/rtems/rtems/tasks.h +++ b/c/src/exec/rtems/include/rtems/rtems/tasks.h @@ -47,6 +47,7 @@ extern "C" { #include <rtems/states.h> #include <rtems/thread.h> #include <rtems/threadq.h> +#include <rtems/types.h> /* * Constant to be used as the ID of current task @@ -94,12 +95,12 @@ void _RTEMS_tasks_Manager_initialization( */ rtems_status_code rtems_task_create( - rtems_name name, - rtems_task_priority initial_priority, - unsigned32 stack_size, - rtems_mode initial_modes, - rtems_attribute attribute_set, - Objects_Id *id + rtems_name name, + rtems_task_priority initial_priority, + unsigned32 stack_size, + rtems_mode initial_modes, + rtems_attribute attribute_set, + Objects_Id *id ); /* @@ -237,7 +238,7 @@ rtems_status_code rtems_task_resume( */ rtems_status_code rtems_task_set_priority( - Objects_Id id, + Objects_Id id, rtems_task_priority new_priority, rtems_task_priority *old_priority ); @@ -324,6 +325,18 @@ STATIC INLINE void _RTEMS_tasks_Cancel_wait( Thread_Control *the_thread ); +/* + * _RTEMS_Tasks_Priority_to_Core + * + * DESCRIPTION: + * + * This function converts an RTEMS API priority into a core priority. + */ + +STATIC INLINE Priority_Control _RTEMS_Tasks_Priority_to_Core( + rtems_task_priority priority +); + #include <rtems/tasks.inl> #include <rtems/taskmp.h> diff --git a/c/src/exec/rtems/include/rtems/rtems/types.h b/c/src/exec/rtems/include/rtems/rtems/types.h index 2a5cb6f4fd..e4d7c11065 100644 --- a/c/src/exec/rtems/include/rtems/rtems/types.h +++ b/c/src/exec/rtems/include/rtems/rtems/types.h @@ -21,6 +21,8 @@ extern "C" { #endif #include <rtems/object.h> +#include <rtems/priority.h> +#include <rtems/modes.h> /* * RTEMS basic type definitions @@ -48,6 +50,19 @@ typedef Context_Control rtems_context; typedef Context_Control_fp rtems_context_fp; typedef CPU_Interrupt_frame rtems_interrupt_frame; +/* + * Define the type for an RTEMS API task priority. + */ + +typedef Priority_Control rtems_task_priority; + +#define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY +/* + * Define the type for an RTEMS API task mode. + */ + +typedef Modes_Control rtems_mode; + #ifdef __cplusplus } #endif diff --git a/c/src/exec/rtems/inline/modes.inl b/c/src/exec/rtems/inline/modes.inl index 6331a18a3a..8fe964e8d8 100644 --- a/c/src/exec/rtems/inline/modes.inl +++ b/c/src/exec/rtems/inline/modes.inl @@ -23,7 +23,7 @@ */ STATIC INLINE unsigned32 RTEMS_INTERRUPT_LEVEL ( - rtems_mode mode_set + Modes_Control mode_set ) { return mode_set & RTEMS_INTERRUPT_MASK; @@ -36,8 +36,8 @@ STATIC INLINE unsigned32 RTEMS_INTERRUPT_LEVEL ( */ STATIC INLINE boolean _Modes_Mask_changed ( - rtems_mode mode_set, - rtems_mode masks + Modes_Control mode_set, + Modes_Control masks ) { return ( mode_set & masks ); @@ -50,7 +50,7 @@ STATIC INLINE boolean _Modes_Mask_changed ( */ STATIC INLINE boolean _Modes_Is_asr_disabled ( - rtems_mode mode_set + Modes_Control mode_set ) { return ( mode_set & RTEMS_ASR_MASK ); @@ -63,7 +63,7 @@ STATIC INLINE boolean _Modes_Is_asr_disabled ( */ STATIC INLINE boolean _Modes_Is_preempt ( - rtems_mode mode_set + Modes_Control mode_set ) { return ( ( mode_set & RTEMS_PREEMPT_MASK ) == RTEMS_PREEMPT ); @@ -76,7 +76,7 @@ STATIC INLINE boolean _Modes_Is_preempt ( */ STATIC INLINE boolean _Modes_Is_timeslice ( - rtems_mode mode_set + Modes_Control mode_set ) { return ((mode_set & (RTEMS_TIMESLICE_MASK|RTEMS_PREEMPT_MASK)) == @@ -90,7 +90,7 @@ STATIC INLINE boolean _Modes_Is_timeslice ( */ STATIC INLINE ISR_Level _Modes_Get_interrupt_level ( - rtems_mode mode_set + Modes_Control mode_set ) { return ( mode_set & RTEMS_INTERRUPT_MASK ); @@ -103,7 +103,7 @@ STATIC INLINE ISR_Level _Modes_Get_interrupt_level ( */ STATIC INLINE void _Modes_Set_interrupt_level ( - rtems_mode mode_set + Modes_Control mode_set ) { _ISR_Set_level( _Modes_Get_interrupt_level( mode_set ) ); @@ -116,14 +116,14 @@ STATIC INLINE void _Modes_Set_interrupt_level ( */ STATIC INLINE void _Modes_Change ( - rtems_mode old_mode_set, - rtems_mode new_mode_set, - rtems_mode mask, - rtems_mode *out_mode_set, - rtems_mode *changed + Modes_Control old_mode_set, + Modes_Control new_mode_set, + Modes_Control mask, + Modes_Control *out_mode_set, + Modes_Control *changed ) { - rtems_mode _out_mode; + Modes_Control _out_mode; _out_mode = old_mode_set; _out_mode &= ~mask; diff --git a/c/src/exec/rtems/inline/rtems/rtems/modes.inl b/c/src/exec/rtems/inline/rtems/rtems/modes.inl index 6331a18a3a..8fe964e8d8 100644 --- a/c/src/exec/rtems/inline/rtems/rtems/modes.inl +++ b/c/src/exec/rtems/inline/rtems/rtems/modes.inl @@ -23,7 +23,7 @@ */ STATIC INLINE unsigned32 RTEMS_INTERRUPT_LEVEL ( - rtems_mode mode_set + Modes_Control mode_set ) { return mode_set & RTEMS_INTERRUPT_MASK; @@ -36,8 +36,8 @@ STATIC INLINE unsigned32 RTEMS_INTERRUPT_LEVEL ( */ STATIC INLINE boolean _Modes_Mask_changed ( - rtems_mode mode_set, - rtems_mode masks + Modes_Control mode_set, + Modes_Control masks ) { return ( mode_set & masks ); @@ -50,7 +50,7 @@ STATIC INLINE boolean _Modes_Mask_changed ( */ STATIC INLINE boolean _Modes_Is_asr_disabled ( - rtems_mode mode_set + Modes_Control mode_set ) { return ( mode_set & RTEMS_ASR_MASK ); @@ -63,7 +63,7 @@ STATIC INLINE boolean _Modes_Is_asr_disabled ( */ STATIC INLINE boolean _Modes_Is_preempt ( - rtems_mode mode_set + Modes_Control mode_set ) { return ( ( mode_set & RTEMS_PREEMPT_MASK ) == RTEMS_PREEMPT ); @@ -76,7 +76,7 @@ STATIC INLINE boolean _Modes_Is_preempt ( */ STATIC INLINE boolean _Modes_Is_timeslice ( - rtems_mode mode_set + Modes_Control mode_set ) { return ((mode_set & (RTEMS_TIMESLICE_MASK|RTEMS_PREEMPT_MASK)) == @@ -90,7 +90,7 @@ STATIC INLINE boolean _Modes_Is_timeslice ( */ STATIC INLINE ISR_Level _Modes_Get_interrupt_level ( - rtems_mode mode_set + Modes_Control mode_set ) { return ( mode_set & RTEMS_INTERRUPT_MASK ); @@ -103,7 +103,7 @@ STATIC INLINE ISR_Level _Modes_Get_interrupt_level ( */ STATIC INLINE void _Modes_Set_interrupt_level ( - rtems_mode mode_set + Modes_Control mode_set ) { _ISR_Set_level( _Modes_Get_interrupt_level( mode_set ) ); @@ -116,14 +116,14 @@ STATIC INLINE void _Modes_Set_interrupt_level ( */ STATIC INLINE void _Modes_Change ( - rtems_mode old_mode_set, - rtems_mode new_mode_set, - rtems_mode mask, - rtems_mode *out_mode_set, - rtems_mode *changed + Modes_Control old_mode_set, + Modes_Control new_mode_set, + Modes_Control mask, + Modes_Control *out_mode_set, + Modes_Control *changed ) { - rtems_mode _out_mode; + Modes_Control _out_mode; _out_mode = old_mode_set; _out_mode &= ~mask; diff --git a/c/src/exec/rtems/inline/rtems/rtems/tasks.inl b/c/src/exec/rtems/inline/rtems/rtems/tasks.inl index d392b8b370..2aec654571 100644 --- a/c/src/exec/rtems/inline/rtems/rtems/tasks.inl +++ b/c/src/exec/rtems/inline/rtems/rtems/tasks.inl @@ -43,7 +43,10 @@ STATIC INLINE void _RTEMS_tasks_Free ( Thread_Control *the_task ) { - _Objects_Free( &_RTEMS_tasks_Information, &the_task->Object ); + _Objects_Free( + _Objects_Get_information( the_task->Object.id ), + &the_task->Object + ); } /*PAGE @@ -61,6 +64,7 @@ STATIC INLINE void _RTEMS_tasks_Cancel_wait( state = the_thread->current_state; +/* XXX do this with the object class */ if ( _States_Is_waiting_on_thread_queue( state ) ) { if ( _States_Is_waiting_for_rpc_reply( state ) && _States_Is_locally_blocked( state ) ) { @@ -91,5 +95,17 @@ STATIC INLINE void _RTEMS_tasks_Cancel_wait( (void) _Watchdog_Remove( &the_thread->Timer ); } +/*PAGE + * + * _RTEMS_Tasks_Priority_to_Core + */ + +STATIC INLINE Priority_Control _RTEMS_Tasks_Priority_to_Core( + rtems_task_priority priority +) +{ + return (Priority_Control) priority; +} + #endif /* end of include file */ diff --git a/c/src/exec/rtems/inline/tasks.inl b/c/src/exec/rtems/inline/tasks.inl index d392b8b370..2aec654571 100644 --- a/c/src/exec/rtems/inline/tasks.inl +++ b/c/src/exec/rtems/inline/tasks.inl @@ -43,7 +43,10 @@ STATIC INLINE void _RTEMS_tasks_Free ( Thread_Control *the_task ) { - _Objects_Free( &_RTEMS_tasks_Information, &the_task->Object ); + _Objects_Free( + _Objects_Get_information( the_task->Object.id ), + &the_task->Object + ); } /*PAGE @@ -61,6 +64,7 @@ STATIC INLINE void _RTEMS_tasks_Cancel_wait( state = the_thread->current_state; +/* XXX do this with the object class */ if ( _States_Is_waiting_on_thread_queue( state ) ) { if ( _States_Is_waiting_for_rpc_reply( state ) && _States_Is_locally_blocked( state ) ) { @@ -91,5 +95,17 @@ STATIC INLINE void _RTEMS_tasks_Cancel_wait( (void) _Watchdog_Remove( &the_thread->Timer ); } +/*PAGE + * + * _RTEMS_Tasks_Priority_to_Core + */ + +STATIC INLINE Priority_Control _RTEMS_Tasks_Priority_to_Core( + rtems_task_priority priority +) +{ + return (Priority_Control) priority; +} + #endif /* end of include file */ diff --git a/c/src/exec/rtems/macros/modes.inl b/c/src/exec/rtems/macros/modes.inl index f8ac061dce..4c8b35a1e8 100644 --- a/c/src/exec/rtems/macros/modes.inl +++ b/c/src/exec/rtems/macros/modes.inl @@ -88,7 +88,7 @@ #define _Modes_Change( _old_mode_set, _new_mode_set, \ _mask, _out_mode_set, _changed ) \ - { rtems_mode _out_mode; \ + { Modes_Control _out_mode; \ \ _out_mode = (_old_mode_set); \ _out_mode &= ~(_mask); \ diff --git a/c/src/exec/rtems/macros/rtems/rtems/modes.inl b/c/src/exec/rtems/macros/rtems/rtems/modes.inl index f8ac061dce..4c8b35a1e8 100644 --- a/c/src/exec/rtems/macros/rtems/rtems/modes.inl +++ b/c/src/exec/rtems/macros/rtems/rtems/modes.inl @@ -88,7 +88,7 @@ #define _Modes_Change( _old_mode_set, _new_mode_set, \ _mask, _out_mode_set, _changed ) \ - { rtems_mode _out_mode; \ + { Modes_Control _out_mode; \ \ _out_mode = (_old_mode_set); \ _out_mode &= ~(_mask); \ diff --git a/c/src/exec/rtems/macros/rtems/rtems/tasks.inl b/c/src/exec/rtems/macros/rtems/rtems/tasks.inl index 778d4867ca..243d0addc7 100644 --- a/c/src/exec/rtems/macros/rtems/rtems/tasks.inl +++ b/c/src/exec/rtems/macros/rtems/rtems/tasks.inl @@ -83,5 +83,13 @@ (void) _Watchdog_Remove( &(_the_thread)->Timer ); \ } +/*PAGE + * + * _RTEMS_Tasks_Priority_to_Core + */ + +#define _RTEMS_Tasks_Priority_to_Core( _priority ) \ + ((Priority_Control) (_priority)) + #endif /* end of include file */ diff --git a/c/src/exec/rtems/macros/tasks.inl b/c/src/exec/rtems/macros/tasks.inl index 778d4867ca..243d0addc7 100644 --- a/c/src/exec/rtems/macros/tasks.inl +++ b/c/src/exec/rtems/macros/tasks.inl @@ -83,5 +83,13 @@ (void) _Watchdog_Remove( &(_the_thread)->Timer ); \ } +/*PAGE + * + * _RTEMS_Tasks_Priority_to_Core + */ + +#define _RTEMS_Tasks_Priority_to_Core( _priority ) \ + ((Priority_Control) (_priority)) + #endif /* end of include file */ diff --git a/c/src/exec/rtems/optman/no-sem.c b/c/src/exec/rtems/optman/no-sem.c index 52f64c0aa5..d96b1693e2 100644 --- a/c/src/exec/rtems/optman/no-sem.c +++ b/c/src/exec/rtems/optman/no-sem.c @@ -31,10 +31,11 @@ void _Semaphore_Manager_initialization( } rtems_status_code rtems_semaphore_create( - rtems_name name, - unsigned32 count, - rtems_attribute attribute_set, - Objects_Id *id + rtems_name name, + unsigned32 count, + rtems_attribute attribute_set, + rtems_task_priority priority_ceiling, + Objects_Id *id ) { return( RTEMS_NOT_CONFIGURED ); diff --git a/c/src/exec/rtems/optman/no-signal.c b/c/src/exec/rtems/optman/no-signal.c index 50f941887c..fedbf87db3 100644 --- a/c/src/exec/rtems/optman/no-signal.c +++ b/c/src/exec/rtems/optman/no-signal.c @@ -22,14 +22,14 @@ rtems_status_code rtems_signal_catch( rtems_asr_entry handler, - rtems_mode mode_set + rtems_mode mode_set ) { return( RTEMS_NOT_CONFIGURED ); } rtems_status_code rtems_signal_send( - Objects_Id id, + rtems_id id, rtems_signal_set signal_set ) { diff --git a/c/src/exec/rtems/src/event.c b/c/src/exec/rtems/src/event.c index 4390d3ee08..ec14c2aaa9 100644 --- a/c/src/exec/rtems/src/event.c +++ b/c/src/exec/rtems/src/event.c @@ -56,7 +56,7 @@ rtems_status_code rtems_event_send( ) ); case OBJECTS_LOCAL: - _Event_sets_Post( event_in, &the_thread->pending_events ); + _Event_sets_Post( event_in, &the_thread->RTEMS_API->pending_events ); _Event_Surrender( the_thread ); _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL ); @@ -91,13 +91,13 @@ rtems_status_code rtems_event_receive( ) { if ( _Event_sets_Is_empty( event_in ) ) { - *event_out = _Thread_Executing->pending_events; + *event_out = _Thread_Executing->RTEMS_API->pending_events; return( RTEMS_SUCCESSFUL ); } _Thread_Disable_dispatch(); _Event_Seize( event_in, option_set, ticks ); _Thread_Enable_dispatch(); - *event_out = _Thread_Executing->events_out; + *event_out = _Thread_Executing->RTEMS_API->events_out; return( _Thread_Executing->Wait.return_code ); } diff --git a/c/src/exec/rtems/src/mp.c b/c/src/exec/rtems/src/mp.c index ffa53d1da7..c555ffb3f1 100644 --- a/c/src/exec/rtems/src/mp.c +++ b/c/src/exec/rtems/src/mp.c @@ -58,7 +58,7 @@ void rtems_multiprocessing_announce ( void ) _Thread_Disable_dispatch(); _Event_sets_Post( RTEMS_EVENT_0, - &_Internal_threads_System_initialization_thread->pending_events + &_Internal_threads_System_initialization_thread->RTEMS_API->pending_events ); _Event_Surrender( _Internal_threads_System_initialization_thread ); _Thread_Enable_dispatch(); diff --git a/c/src/exec/rtems/src/msg.c b/c/src/exec/rtems/src/msg.c index 6dfd26a8f0..ff4683f880 100644 --- a/c/src/exec/rtems/src/msg.c +++ b/c/src/exec/rtems/src/msg.c @@ -181,7 +181,7 @@ rtems_status_code rtems_message_queue_create( } if ( _Attributes_Is_global( attribute_set ) && - !( _Objects_MP_Open( &_Message_queue_Information, name, + !( _Objects_MP_Allocate_and_open( &_Message_queue_Information, name, the_message_queue->Object.id, FALSE ) ) ) { _Message_queue_Free( the_message_queue ); _Thread_Enable_dispatch(); @@ -195,8 +195,14 @@ rtems_status_code rtems_message_queue_create( _Chain_Initialize_empty( &the_message_queue->Pending_messages ); - _Thread_queue_Initialize( &the_message_queue->Wait_queue, attribute_set, - STATES_WAITING_FOR_MESSAGE ); + _Thread_queue_Initialize( + &the_message_queue->Wait_queue, + OBJECTS_RTEMS_MESSAGE_QUEUES, + _Attributes_Is_priority( attribute_set ) ? + THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, + STATES_WAITING_FOR_MESSAGE, + _Message_queue_MP_Send_extract_proxy + ); _Objects_Open( &_Message_queue_Information, diff --git a/c/src/exec/rtems/src/msgmp.c b/c/src/exec/rtems/src/msgmp.c index 37ce2c9453..48e572c43b 100644 --- a/c/src/exec/rtems/src/msgmp.c +++ b/c/src/exec/rtems/src/msgmp.c @@ -259,7 +259,7 @@ void _Message_queue_MP_Process_packet ( case MESSAGE_QUEUE_MP_ANNOUNCE_CREATE: - ignored = _Objects_MP_Open( + ignored = _Objects_MP_Allocate_and_open( &_Message_queue_Information, the_packet->name, the_packet->Prefix.id, diff --git a/c/src/exec/rtems/src/part.c b/c/src/exec/rtems/src/part.c index a7e4308a13..3d21eed416 100644 --- a/c/src/exec/rtems/src/part.c +++ b/c/src/exec/rtems/src/part.c @@ -107,7 +107,7 @@ rtems_status_code rtems_partition_create( } if ( _Attributes_Is_global( attribute_set ) && - !( _Objects_MP_Open( &_Partition_Information, name, + !( _Objects_MP_Allocate_and_open( &_Partition_Information, name, the_partition->Object.id, FALSE ) ) ) { _Partition_Free( the_partition ); _Thread_Enable_dispatch(); diff --git a/c/src/exec/rtems/src/partmp.c b/c/src/exec/rtems/src/partmp.c index 074165777b..0097844183 100644 --- a/c/src/exec/rtems/src/partmp.c +++ b/c/src/exec/rtems/src/partmp.c @@ -184,7 +184,7 @@ void _Partition_MP_Process_packet ( case PARTITION_MP_ANNOUNCE_CREATE: - ignored = _Objects_MP_Open( + ignored = _Objects_MP_Allocate_and_open( &_Partition_Information, the_packet->name, the_packet->Prefix.id, diff --git a/c/src/exec/rtems/src/region.c b/c/src/exec/rtems/src/region.c index b54493eec7..25aca9cda7 100644 --- a/c/src/exec/rtems/src/region.c +++ b/c/src/exec/rtems/src/region.c @@ -113,7 +113,13 @@ rtems_status_code rtems_region_create( the_region->number_of_used_blocks = 0; _Thread_queue_Initialize( - &the_region->Wait_queue, attribute_set, STATES_WAITING_FOR_SEGMENT ); + &the_region->Wait_queue, + OBJECTS_RTEMS_REGIONS, + _Attributes_Is_priority( attribute_set ) ? + THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, + STATES_WAITING_FOR_SEGMENT, + _Region_MP_Send_extract_proxy + ); _Objects_Open( &_Region_Information, &the_region->Object, &name ); diff --git a/c/src/exec/rtems/src/regionmp.c b/c/src/exec/rtems/src/regionmp.c index 07de556acc..b460e554fe 100644 --- a/c/src/exec/rtems/src/regionmp.c +++ b/c/src/exec/rtems/src/regionmp.c @@ -190,7 +190,7 @@ void _Region_MP_Process_packet ( case REGION_MP_ANNOUNCE_CREATE: - ignored = _Objects_MP_Open( + ignored = _Objects_MP_Allocate_and_open( &_Region_Information, the_packet->name, the_packet->Prefix.id, diff --git a/c/src/exec/rtems/src/sem.c b/c/src/exec/rtems/src/sem.c index d810c205ee..9e87550c31 100644 --- a/c/src/exec/rtems/src/sem.c +++ b/c/src/exec/rtems/src/sem.c @@ -87,10 +87,11 @@ void _Semaphore_Manager_initialization( */ rtems_status_code rtems_semaphore_create( - rtems_name name, - unsigned32 count, - rtems_attribute attribute_set, - Objects_Id *id + rtems_name name, + unsigned32 count, + rtems_attribute attribute_set, + rtems_task_priority priority_ceiling, + Objects_Id *id ) { register Semaphore_Control *the_semaphore; @@ -127,7 +128,7 @@ rtems_status_code rtems_semaphore_create( } if ( _Attributes_Is_global( attribute_set ) && - !( _Objects_MP_Open( &_Semaphore_Information, name, + !( _Objects_MP_Allocate_and_open( &_Semaphore_Information, name, the_semaphore->Object.id, FALSE ) ) ) { _Semaphore_Free( the_semaphore ); _Thread_Enable_dispatch(); @@ -148,8 +149,14 @@ rtems_status_code rtems_semaphore_create( the_semaphore->holder_id = 0; } - _Thread_queue_Initialize( &the_semaphore->Wait_queue, - attribute_set, STATES_WAITING_FOR_SEMAPHORE ); + _Thread_queue_Initialize( + &the_semaphore->Wait_queue, + OBJECTS_RTEMS_SEMAPHORES, + _Attributes_Is_priority( attribute_set ) ? + THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, + STATES_WAITING_FOR_SEMAPHORE, + _Semaphore_MP_Send_extract_proxy + ); _Objects_Open( &_Semaphore_Information, &the_semaphore->Object, &name ); diff --git a/c/src/exec/rtems/src/semmp.c b/c/src/exec/rtems/src/semmp.c index 3be9fafb5f..03ca51a228 100644 --- a/c/src/exec/rtems/src/semmp.c +++ b/c/src/exec/rtems/src/semmp.c @@ -187,7 +187,7 @@ void _Semaphore_MP_Process_packet ( case SEMAPHORE_MP_ANNOUNCE_CREATE: - ignored = _Objects_MP_Open( + ignored = _Objects_MP_Allocate_and_open( &_Semaphore_Information, the_packet->name, the_packet->Prefix.id, diff --git a/c/src/exec/rtems/src/signal.c b/c/src/exec/rtems/src/signal.c index 411df5d86c..8a300d2969 100644 --- a/c/src/exec/rtems/src/signal.c +++ b/c/src/exec/rtems/src/signal.c @@ -37,22 +37,23 @@ */ rtems_status_code rtems_signal_catch( - rtems_asr_entry handler, - rtems_mode mode_set + rtems_asr_entry asr_handler, + rtems_mode mode_set ) { Thread_Control *executing; +/* XXX normalize mode */ executing = _Thread_Executing; _Thread_Disable_dispatch(); /* cannot reschedule while */ /* the thread is inconsistent */ - if ( ! _ASR_Is_null_handler( handler ) ) { - executing->Signal.mode_set = mode_set; - executing->Signal.handler = handler; + if ( !_ASR_Is_null_handler( asr_handler ) ) { + executing->RTEMS_API->Signal.mode_set = mode_set; + executing->RTEMS_API->Signal.handler = asr_handler; } else - _ASR_Initialize( &executing->Signal ); + _ASR_Initialize( &executing->RTEMS_API->Signal ); _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL ); } @@ -91,11 +92,13 @@ rtems_status_code rtems_signal_send( signal_set ); case OBJECTS_LOCAL: - if ( ! _ASR_Is_null_handler( the_thread->Signal.handler ) ) { + if ( ! _ASR_Is_null_handler( the_thread->RTEMS_API->Signal.handler ) ) { if ( _Modes_Is_asr_disabled( the_thread->current_modes ) ) - _ASR_Post_signals( signal_set, &the_thread->Signal.signals_pending ); + _ASR_Post_signals( + signal_set, &the_thread->RTEMS_API->Signal.signals_pending ); else { - _ASR_Post_signals( signal_set, &the_thread->Signal.signals_posted ); + _ASR_Post_signals( + signal_set, &the_thread->RTEMS_API->Signal.signals_posted ); if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) ) _ISR_Signals_to_thread_executing = TRUE; } diff --git a/c/src/exec/rtems/src/taskmp.c b/c/src/exec/rtems/src/taskmp.c index 003c543c5a..2b7fb214c6 100644 --- a/c/src/exec/rtems/src/taskmp.c +++ b/c/src/exec/rtems/src/taskmp.c @@ -193,7 +193,7 @@ void _RTEMS_tasks_MP_Process_packet ( case RTEMS_TASKS_MP_ANNOUNCE_CREATE: - ignored = _Objects_MP_Open( + ignored = _Objects_MP_Allocate_and_open( &_RTEMS_tasks_Information, the_packet->name, the_packet->Prefix.id, diff --git a/c/src/exec/rtems/src/tasks.c b/c/src/exec/rtems/src/tasks.c index 5574a6633e..62bc8c1995 100644 --- a/c/src/exec/rtems/src/tasks.c +++ b/c/src/exec/rtems/src/tasks.c @@ -86,27 +86,35 @@ rtems_status_code rtems_task_create( ) { register Thread_Control *the_thread; - unsigned32 actual_stack_size; - unsigned32 memory_needed; - void *memory; + Objects_MP_Control *the_global_object = NULL; + boolean is_fp; + boolean is_global; rtems_attribute the_attribute_set; + Priority_Control core_priority; + if ( !rtems_is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); + /* + * Core Thread Initialize insures we get the minimum amount of + * stack space. + */ + #if 0 if ( !_Stack_Is_enough( stack_size ) ) return( RTEMS_INVALID_SIZE ); #endif - if ( !_Stack_Is_enough( stack_size ) ) - actual_stack_size = RTEMS_MINIMUM_STACK_SIZE; - else - actual_stack_size = stack_size; + /* + * Validate the RTEMS API priority and convert it to the core priority range. + */ if ( !_Priority_Is_valid( initial_priority ) ) return( RTEMS_INVALID_PRIORITY ); + core_priority = _RTEMS_Tasks_Priority_to_Core( initial_priority ); + /* * Fix the attribute set to match the attributes which * this processor (1) requires and (2) is able to support. @@ -120,11 +128,40 @@ rtems_status_code rtems_task_create( the_attribute_set = _Attributes_Clear( the_attribute_set, ATTRIBUTES_NOT_SUPPORTED ); - if ( _Attributes_Is_global( the_attribute_set ) && - !_Configuration_Is_multiprocessing() ) - return( RTEMS_MP_NOT_CONFIGURED ); + if ( _Attributes_Is_floating_point( the_attribute_set ) ) + is_fp = TRUE; + else + is_fp = FALSE; + + if ( _Attributes_Is_global( the_attribute_set ) ) { + + is_global = TRUE; + + if ( !_Configuration_Is_multiprocessing() ) + return( RTEMS_MP_NOT_CONFIGURED ); - _Thread_Disable_dispatch(); /* to prevent deletion */ + } else + is_global = FALSE; + + /* + * Make sure system is MP if this task is global + */ + + /* + * Disable dispatch for protection + */ + + _Thread_Disable_dispatch(); + + /* + * Allocate the thread control block and -- if the task is global -- + * allocate a global object control block. + * + * NOTE: This routine does not use the combined allocate and open + * global object routine because this results in a lack of + * control over when memory is allocated and can be freed in + * the event of an error. + */ the_thread = _RTEMS_tasks_Allocate(); @@ -133,71 +170,71 @@ rtems_status_code rtems_task_create( return( RTEMS_TOO_MANY ); } - actual_stack_size = _Stack_Adjust_size( actual_stack_size ); - memory_needed = actual_stack_size; + if ( is_global ) { + the_global_object = _Objects_MP_Allocate_global_object(); - if ( _Attributes_Is_floating_point( the_attribute_set ) ) - memory_needed += CONTEXT_FP_SIZE; + if ( _Objects_MP_Is_null_global_object( the_global_object ) ) { + _RTEMS_tasks_Free( the_thread ); + _Thread_Enable_dispatch(); + return( RTEMS_TOO_MANY ); + } + } - memory = _Workspace_Allocate( memory_needed ); +#if 0 + /* + * Allocate and initialize the RTEMS API specific information + */ + + the_thread->RTEMS_API = _Workspace_Allocate( sizeof( RTEMS_API_Control ) ); - if ( !memory ) { + if ( !the_thread->RTEMS_API ) { _RTEMS_tasks_Free( the_thread ); + if ( is_global ) + _Objects_MP_Free_global_object( the_global_object ); _Thread_Enable_dispatch(); return( RTEMS_UNSATISFIED ); } + the_thread->RTEMS_API->pending_events = EVENT_SETS_NONE_PENDING; + _ASR_Initialize( &the_thread->RTEMS_API->Signal ); +#endif + /* - * Stack is put in the lower address regions of the allocated memory. - * The optional floating point context area goes into the higher part - * of the allocated memory. + * Initialize the core thread for this task. */ - _Stack_Initialize( - &the_thread->Start.Initial_stack, memory, actual_stack_size ); - - if ( _Attributes_Is_floating_point( the_attribute_set ) ) - the_thread->fp_context = _Context_Fp_start( memory, actual_stack_size ); - else - the_thread->fp_context = NULL; - - the_thread->Start.fp_context = the_thread->fp_context; +/* XXX normalize mode */ - if ( _Attributes_Is_global( the_attribute_set ) && - !( _Objects_MP_Open( &_RTEMS_tasks_Information, name, - the_thread->Object.id, FALSE ) ) ) { + if ( !_Thread_Initialize( &_RTEMS_tasks_Information, the_thread, + NULL, stack_size, is_fp, core_priority, initial_modes, &name ) ) { + if ( is_global ) + _Objects_MP_Free_global_object( the_global_object ); _RTEMS_tasks_Free( the_thread ); - (void) _Workspace_Free( memory ); _Thread_Enable_dispatch(); - return( RTEMS_TOO_MANY ); + return( RTEMS_UNSATISFIED ); } - the_thread->attribute_set = the_attribute_set; - the_thread->current_state = STATES_DORMANT; - the_thread->current_modes = initial_modes; - the_thread->pending_events = EVENT_SETS_NONE_PENDING; - the_thread->resource_count = 0; - the_thread->real_priority = initial_priority; - the_thread->Start.initial_priority = initial_priority; - the_thread->Start.initial_modes = initial_modes; - - _Thread_Set_priority( the_thread, initial_priority ); - - _ASR_Initialize( &the_thread->Signal ); + *id = the_thread->Object.id; - _Objects_Open( &_RTEMS_tasks_Information, &the_thread->Object, &name ); + if ( is_global ) { - *id = the_thread->Object.id; + the_thread->RTEMS_API->is_global = TRUE; - _User_extensions_Task_create( the_thread ); + _Objects_MP_Open( + &_RTEMS_tasks_Information, + the_global_object, + name, + the_thread->Object.id + ); - if ( _Attributes_Is_global( the_attribute_set ) ) _RTEMS_tasks_MP_Send_process_packet( RTEMS_TASKS_MP_ANNOUNCE_CREATE, the_thread->Object.id, name ); + } + _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL ); } @@ -252,9 +289,9 @@ rtems_status_code rtems_task_ident( */ rtems_status_code rtems_task_start( - Objects_Id id, + rtems_id id, rtems_task_entry entry_point, - unsigned32 argument + unsigned32 argument ) { register Thread_Control *the_thread; @@ -271,17 +308,8 @@ rtems_status_code rtems_task_start( _Thread_Dispatch(); return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT ); case OBJECTS_LOCAL: - if ( _States_Is_dormant( the_thread->current_state ) ) { - - the_thread->Start.entry_point = entry_point; - the_thread->Start.initial_argument = argument; - - _Thread_Load_environment( the_thread ); - - _Thread_Ready( the_thread ); - - _User_extensions_Task_start( the_thread ); - + if ( _Thread_Start( + the_thread, THREAD_START_NUMERIC, entry_point, NULL, argument ) ) { _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL ); } @@ -316,7 +344,7 @@ rtems_status_code rtems_task_restart( ) { register Thread_Control *the_thread; - Objects_Locations location; + Objects_Locations location; the_thread = _Thread_Get( id, &location ); switch ( location ) { @@ -326,32 +354,11 @@ rtems_status_code rtems_task_restart( _Thread_Dispatch(); return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT ); case OBJECTS_LOCAL: - if ( !_States_Is_dormant( the_thread->current_state ) ) { - - _Thread_Set_transient( the_thread ); - _ASR_Initialize( &the_thread->Signal ); - the_thread->pending_events = EVENT_SETS_NONE_PENDING; - the_thread->resource_count = 0; - the_thread->current_modes = the_thread->Start.initial_modes; - the_thread->Start.initial_argument = argument; - - _RTEMS_tasks_Cancel_wait( the_thread ); - - if ( the_thread->current_priority != - the_thread->Start.initial_priority ) { - the_thread->real_priority = the_thread->Start.initial_priority; - _Thread_Set_priority( the_thread, - the_thread->Start.initial_priority ); - } - - _Thread_Load_environment( the_thread ); + if ( _Thread_Restart( the_thread, NULL, argument ) ) { - _Thread_Ready( the_thread ); - - _User_extensions_Task_restart( the_thread ); - - if ( _Thread_Is_executing ( the_thread ) ) - _Thread_Restart_self(); + /* XXX until these are in an API extension they are too late. */ + _ASR_Initialize( &the_thread->RTEMS_API->Signal ); + the_thread->RTEMS_API->pending_events = EVENT_SETS_NONE_PENDING; _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL ); @@ -396,25 +403,14 @@ rtems_status_code rtems_task_delete( _Thread_Dispatch(); return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT ); case OBJECTS_LOCAL: - _Objects_Close( &_RTEMS_tasks_Information, &the_thread->Object ); - - _Thread_Set_state( the_thread, STATES_TRANSIENT ); - - _User_extensions_Task_delete( the_thread ); - -#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE ) - if ( _Thread_Is_allocated_fp( the_thread ) ) - _Thread_Deallocate_fp(); -#endif - the_thread->fp_context = NULL; - - _RTEMS_tasks_Cancel_wait( the_thread ); + _Thread_Close( &_RTEMS_tasks_Information, the_thread ); - (void) _Workspace_Free( the_thread->Start.Initial_stack.area ); + /* XXX */ + (void) _Workspace_Free( the_thread->RTEMS_API ); _RTEMS_tasks_Free( the_thread ); - if ( _Attributes_Is_global( the_thread->attribute_set ) ) { + if ( _Attributes_Is_global( the_thread->RTEMS_API->is_global ) ) { _Objects_MP_Close( &_RTEMS_tasks_Information, the_thread->Object.id ); @@ -551,7 +547,7 @@ rtems_status_code rtems_task_resume( */ rtems_status_code rtems_task_set_priority( - Objects_Id id, + Objects_Id id, rtems_task_priority new_priority, rtems_task_priority *old_priority ) @@ -662,7 +658,7 @@ rtems_status_code rtems_task_get_note( if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) || _Objects_Are_ids_equal( id, _Thread_Executing->Object.id ) ) { - *note = _Thread_Executing->Notepads[ notepad ]; + *note = _Thread_Executing->RTEMS_API->Notepads[ notepad ]; return( RTEMS_SUCCESSFUL ); } @@ -681,7 +677,7 @@ rtems_status_code rtems_task_get_note( 0 /* Not used */ ); case OBJECTS_LOCAL: - *note= the_thread->Notepads[ notepad ]; + *note= the_thread->RTEMS_API->Notepads[ notepad ]; _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL ); } @@ -729,7 +725,7 @@ rtems_status_code rtems_task_set_note( if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) || _Objects_Are_ids_equal( id, _Thread_Executing->Object.id ) ) { - _Thread_Executing->Notepads[ notepad ] = note; + _Thread_Executing->RTEMS_API->Notepads[ notepad ] = note; return( RTEMS_SUCCESSFUL ); } @@ -747,7 +743,7 @@ rtems_status_code rtems_task_set_note( ); case OBJECTS_LOCAL: - the_thread->Notepads[ notepad ] = note; + the_thread->RTEMS_API->Notepads[ notepad ] = note; _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL ); } |