forked from Imagelibrary/rtems
Added unused priority ceiling parameter to rtems_semaphore_create.
Rearranged code to created thread handler routines to initialize, start, restart, and "close/delete" a thread. Made internal threads their own object class. This now uses the thread support routines for starting and initializing a thread. Insured deleted tasks are freed to the Inactive pool associated with the correct Information block. Added an RTEMS API specific data area to the thread control block. Beginnings of removing the word "rtems" from the core.
This commit is contained in:
@@ -111,10 +111,13 @@ rtems_libio_init(void)
|
||||
rtems_libio_last_iop = rtems_libio_iops + (rtems_libio_number_iops - 1);
|
||||
}
|
||||
|
||||
rc = rtems_semaphore_create(RTEMS_LIBIO_SEM,
|
||||
rc = rtems_semaphore_create(
|
||||
RTEMS_LIBIO_SEM,
|
||||
1,
|
||||
RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||
&rtems_libio_semaphore);
|
||||
RTEMS_NO_PRIORITY,
|
||||
&rtems_libio_semaphore
|
||||
);
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
rtems_fatal_error_occurred(rc);
|
||||
}
|
||||
@@ -199,9 +202,13 @@ rtems_libio_allocate(void)
|
||||
* Got one; create a semaphore for it
|
||||
*/
|
||||
|
||||
rc = rtems_semaphore_create(RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops),
|
||||
1, RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||
&iop->sem);
|
||||
rc = rtems_semaphore_create(
|
||||
RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops),
|
||||
1,
|
||||
RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&iop->sem
|
||||
);
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
goto failed;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ typedef rtems_asr ( *rtems_asr_entry )(
|
||||
|
||||
typedef struct {
|
||||
rtems_asr_entry handler; /* address of RTEMS_ASR */
|
||||
rtems_mode mode_set; /* RTEMS_ASR mode */
|
||||
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 */
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -85,6 +85,7 @@ rtems_status_code rtems_semaphore_create(
|
||||
rtems_name name,
|
||||
unsigned32 count,
|
||||
rtems_attribute attribute_set,
|
||||
rtems_task_priority priority_ceiling,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -55,7 +55,7 @@ typedef rtems_asr ( *rtems_asr_entry )(
|
||||
|
||||
typedef struct {
|
||||
rtems_asr_entry handler; /* address of RTEMS_ASR */
|
||||
rtems_mode mode_set; /* RTEMS_ASR mode */
|
||||
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 */
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -85,6 +85,7 @@ rtems_status_code rtems_semaphore_create(
|
||||
rtems_name name,
|
||||
unsigned32 count,
|
||||
rtems_attribute attribute_set,
|
||||
rtems_task_priority priority_ceiling,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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); \
|
||||
|
||||
@@ -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); \
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -34,6 +34,7 @@ rtems_status_code rtems_semaphore_create(
|
||||
rtems_name name,
|
||||
unsigned32 count,
|
||||
rtems_attribute attribute_set,
|
||||
rtems_task_priority priority_ceiling,
|
||||
Objects_Id *id
|
||||
)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ rtems_status_code rtems_signal_catch(
|
||||
}
|
||||
|
||||
rtems_status_code rtems_signal_send(
|
||||
Objects_Id id,
|
||||
rtems_id id,
|
||||
rtems_signal_set signal_set
|
||||
)
|
||||
{
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -90,6 +90,7 @@ rtems_status_code rtems_semaphore_create(
|
||||
rtems_name name,
|
||||
unsigned32 count,
|
||||
rtems_attribute attribute_set,
|
||||
rtems_task_priority priority_ceiling,
|
||||
Objects_Id *id
|
||||
)
|
||||
{
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -37,22 +37,23 @@
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_signal_catch(
|
||||
rtems_asr_entry handler,
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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() )
|
||||
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
|
||||
*/
|
||||
|
||||
if ( !memory ) {
|
||||
the_thread->RTEMS_API = _Workspace_Allocate( sizeof( RTEMS_API_Control ) );
|
||||
|
||||
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
|
||||
|
||||
/*
|
||||
* Initialize the core thread for this task.
|
||||
*/
|
||||
|
||||
/* XXX normalize mode */
|
||||
|
||||
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 );
|
||||
_Thread_Enable_dispatch();
|
||||
return( RTEMS_UNSATISFIED );
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
_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;
|
||||
|
||||
if ( _Attributes_Is_global( the_attribute_set ) &&
|
||||
!( _Objects_MP_Open( &_RTEMS_tasks_Information, name,
|
||||
the_thread->Object.id, FALSE ) ) ) {
|
||||
_RTEMS_tasks_Free( the_thread );
|
||||
(void) _Workspace_Free( memory );
|
||||
_Thread_Enable_dispatch();
|
||||
return( RTEMS_TOO_MANY );
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
_Objects_Open( &_RTEMS_tasks_Information, &the_thread->Object, &name );
|
||||
|
||||
*id = the_thread->Object.id;
|
||||
|
||||
_User_extensions_Task_create( the_thread );
|
||||
if ( is_global ) {
|
||||
|
||||
the_thread->RTEMS_API->is_global = TRUE;
|
||||
|
||||
_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,7 +289,7 @@ 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
|
||||
)
|
||||
@@ -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 );
|
||||
}
|
||||
@@ -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 ) ) {
|
||||
if ( _Thread_Restart( the_thread, NULL, argument ) ) {
|
||||
|
||||
_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 );
|
||||
|
||||
_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_Close( &_RTEMS_tasks_Information, the_thread );
|
||||
|
||||
_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 );
|
||||
|
||||
(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 );
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ typedef struct {
|
||||
rtems_mp_packet_classes the_class;
|
||||
Objects_Id id;
|
||||
Objects_Id source_tid;
|
||||
rtems_task_priority source_priority;
|
||||
Priority_Control source_priority;
|
||||
rtems_status_code return_code;
|
||||
unsigned32 length;
|
||||
unsigned32 to_convert;
|
||||
|
||||
@@ -348,6 +348,19 @@ Objects_Control *_Objects_Get_next(
|
||||
Objects_Id *next_id_p
|
||||
);
|
||||
|
||||
/*
|
||||
* _Objects_Get_information
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* Returns the information control block for the class of objects
|
||||
* corresponding to this id.
|
||||
*/
|
||||
|
||||
Objects_Information *_Objects_Get_information(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
/*
|
||||
* _Objects_Build_id
|
||||
*
|
||||
@@ -403,6 +416,19 @@ STATIC INLINE unsigned32 rtems_get_index(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
/*
|
||||
* _Objects_Is_class_valid
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the class is valid.
|
||||
*
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _Objects_Is_class_valid(
|
||||
Objects_Classes the_class
|
||||
);
|
||||
|
||||
/*
|
||||
* _Objects_Is_local_node
|
||||
*
|
||||
|
||||
@@ -81,18 +81,35 @@ STATIC INLINE boolean _Objects_MP_Is_null_global_object (
|
||||
Objects_MP_Control *the_object
|
||||
);
|
||||
|
||||
/*
|
||||
/*PAGE
|
||||
*
|
||||
* _Objects_MP_Open
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine place the specified global object in the
|
||||
* specified information table.
|
||||
*/
|
||||
|
||||
void _Objects_MP_Open (
|
||||
Objects_Information *information,
|
||||
Objects_MP_Control *the_global_object,
|
||||
unsigned32 the_name, /* XXX -- wrong for variable */
|
||||
Objects_Id the_id
|
||||
);
|
||||
|
||||
/*
|
||||
* _Objects_MP_Allocate_and_open
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine allocates a global object control block
|
||||
* and places it in the specified information table. If the
|
||||
* allocation fails, then is_fatal_error determines the
|
||||
* error processing actions taken.
|
||||
*/
|
||||
|
||||
boolean _Objects_MP_Open (
|
||||
boolean _Objects_MP_Allocate_and_open (
|
||||
Objects_Information *information,
|
||||
unsigned32 the_name, /* XXX -- wrong for variable length */
|
||||
Objects_Id the_id,
|
||||
|
||||
@@ -29,7 +29,7 @@ extern "C" {
|
||||
* NOTE: Priority 0 is reserved for internal threads only.
|
||||
*/
|
||||
|
||||
typedef unsigned32 rtems_task_priority;
|
||||
typedef unsigned32 Priority_Control;
|
||||
|
||||
#define RTEMS_MINIMUM_PRIORITY 1 /* highest thread priority */
|
||||
#define RTEMS_MAXIMUM_PRIORITY 255 /* lowest thread priority */
|
||||
@@ -92,7 +92,7 @@ STATIC INLINE void _Priority_Handler_initialization( void );
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _Priority_Is_valid (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -104,7 +104,7 @@ STATIC INLINE boolean _Priority_Is_valid (
|
||||
*/
|
||||
|
||||
STATIC INLINE unsigned32 _Priority_Major (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -116,7 +116,7 @@ STATIC INLINE unsigned32 _Priority_Major (
|
||||
*/
|
||||
|
||||
STATIC INLINE unsigned32 _Priority_Minor (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -155,7 +155,7 @@ STATIC INLINE void _Priority_Remove_from_bit_map (
|
||||
* ready thread.
|
||||
*/
|
||||
|
||||
STATIC INLINE rtems_task_priority _Priority_Get_highest( void );
|
||||
STATIC INLINE Priority_Control _Priority_Get_highest( void );
|
||||
|
||||
/*
|
||||
* _Priority_Initialize_information
|
||||
@@ -169,7 +169,7 @@ STATIC INLINE rtems_task_priority _Priority_Get_highest( void );
|
||||
|
||||
STATIC INLINE void _Priority_Initialize_information(
|
||||
Priority_Information *the_priority_map,
|
||||
rtems_task_priority new_priority
|
||||
Priority_Control new_priority
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -182,7 +182,7 @@ STATIC INLINE void _Priority_Initialize_information(
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _Priority_Is_group_empty (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
);
|
||||
|
||||
#include <rtems/priority.inl>
|
||||
|
||||
@@ -86,22 +86,30 @@ typedef rtems_task ( *rtems_task_entry )(
|
||||
rtems_task_argument
|
||||
);
|
||||
|
||||
typedef Thread ( *Thread_Entry )(
|
||||
Thread_Argument
|
||||
);
|
||||
typedef Thread ( *Thread_Entry )( );
|
||||
|
||||
/*
|
||||
* The following structure contains the information which defines
|
||||
* the starting state of a thread.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
THREAD_START_NUMERIC,
|
||||
THREAD_START_POINTER,
|
||||
THREAD_START_BOTH_POINTER_FIRST,
|
||||
THREAD_START_BOTH_NUMERIC_FIRST
|
||||
} Thread_Start_types;
|
||||
|
||||
typedef struct {
|
||||
Thread_Entry entry_point; /* starting thread address */
|
||||
unsigned32 initial_argument; /* initial argument */
|
||||
rtems_mode initial_modes; /* initial mode */
|
||||
rtems_task_priority initial_priority; /* initial priority */
|
||||
void *fp_context; /* initial FP context area address */
|
||||
Thread_Start_types prototype; /* how task is invoked */
|
||||
void *pointer_argument; /* pointer argument */
|
||||
unsigned32 numeric_argument; /* numeric argument */
|
||||
Modes_Control initial_modes; /* initial mode */
|
||||
Priority_Control initial_priority; /* initial priority */
|
||||
Stack_Control Initial_stack; /* stack information */
|
||||
void *fp_context; /* initial FP context area address */
|
||||
void *stack; /* initial FP context area address */
|
||||
} Thread_Start_information;
|
||||
|
||||
/*
|
||||
@@ -134,8 +142,8 @@ typedef struct {
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
States_Control current_state;
|
||||
rtems_task_priority current_priority;
|
||||
rtems_task_priority real_priority;
|
||||
Priority_Control current_priority;
|
||||
Priority_Control real_priority;
|
||||
unsigned32 resource_count;
|
||||
Thread_Wait_information Wait;
|
||||
Watchdog_Control Timer;
|
||||
@@ -153,11 +161,21 @@ typedef struct {
|
||||
* memory images for the shared part.
|
||||
*/
|
||||
|
||||
/* XXX structure in wrong file .. API .. not core */
|
||||
|
||||
typedef struct {
|
||||
boolean is_global;
|
||||
unsigned32 Notepads[ RTEMS_NUMBER_NOTEPADS ];
|
||||
rtems_event_set pending_events;
|
||||
rtems_event_set events_out;
|
||||
ASR_Information Signal;
|
||||
} RTEMS_API_Control;
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
States_Control current_state;
|
||||
rtems_task_priority current_priority;
|
||||
rtems_task_priority real_priority;
|
||||
Priority_Control current_priority;
|
||||
Priority_Control real_priority;
|
||||
unsigned32 resource_count;
|
||||
Thread_Wait_information Wait;
|
||||
Watchdog_Control Timer;
|
||||
@@ -165,15 +183,11 @@ typedef struct {
|
||||
/****************** end of common block ********************/
|
||||
Chain_Control *ready;
|
||||
Priority_Information Priority_map;
|
||||
rtems_event_set pending_events;
|
||||
rtems_event_set events_out;
|
||||
Thread_Start_information Start;
|
||||
ASR_Information Signal;
|
||||
rtems_mode current_modes;
|
||||
rtems_attribute attribute_set;
|
||||
Modes_Control current_modes;
|
||||
Context_Control Registers;
|
||||
void *fp_context;
|
||||
unsigned32 Notepads[ RTEMS_NUMBER_NOTEPADS ];
|
||||
RTEMS_API_Control *RTEMS_API;
|
||||
void *extension;
|
||||
} Thread_Control;
|
||||
|
||||
@@ -304,6 +318,71 @@ STATIC INLINE void _Thread_Dispatch_initialization( void );
|
||||
|
||||
void _Thread_Dispatch( void );
|
||||
|
||||
/*
|
||||
* _Thread_Initialize
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
boolean _Thread_Initialize(
|
||||
Objects_Information *information,
|
||||
Thread_Control *the_thread,
|
||||
void *stack_area, /* NULL if to be allocated */
|
||||
unsigned32 stack_size, /* insure it is >= min */
|
||||
boolean is_fp, /* TRUE if thread uses FP */
|
||||
Priority_Control priority,
|
||||
Modes_Control mode,
|
||||
Objects_Name name
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* _Thread_Start
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
boolean _Thread_Start(
|
||||
Thread_Control *the_thread,
|
||||
Thread_Start_types the_prototype,
|
||||
void *entry_point,
|
||||
void *pointer_argument,
|
||||
unsigned32 numeric_argument
|
||||
);
|
||||
|
||||
/*
|
||||
* _Thread_Restart
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
/* XXX multiple task arg profiles */
|
||||
|
||||
boolean _Thread_Restart(
|
||||
Thread_Control *the_thread,
|
||||
void *pointer_argument,
|
||||
unsigned32 numeric_argument
|
||||
);
|
||||
|
||||
/*
|
||||
* _Thread_Close
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
void _Thread_Close(
|
||||
Objects_Information *information,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _Thread_Ready
|
||||
*
|
||||
@@ -493,7 +572,7 @@ void _Thread_Delay_ended(
|
||||
|
||||
void _Thread_Change_priority (
|
||||
Thread_Control *the_thread,
|
||||
rtems_task_priority new_priority
|
||||
Priority_Control new_priority
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -507,7 +586,7 @@ void _Thread_Change_priority (
|
||||
|
||||
void _Thread_Set_priority(
|
||||
Thread_Control *the_thread,
|
||||
rtems_task_priority new_priority
|
||||
Priority_Control new_priority
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -524,9 +603,9 @@ void _Thread_Set_priority(
|
||||
*/
|
||||
|
||||
boolean _Thread_Change_mode(
|
||||
rtems_mode new_mode_set,
|
||||
rtems_mode mask,
|
||||
rtems_mode *old_mode_set
|
||||
Modes_Control new_mode_set,
|
||||
Modes_Control mask,
|
||||
Modes_Control *old_mode_set
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
@@ -36,6 +36,19 @@ typedef void ( *Thread_queue_Flush_callout )(
|
||||
Thread_Control *
|
||||
);
|
||||
|
||||
/*
|
||||
* The following type defines the callout used when a local task
|
||||
* is extracted from a remote thread queue (i.e. it's proxy must
|
||||
* extracted from the remote queue).
|
||||
*/
|
||||
|
||||
typedef void ( *Thread_queue_Extract_callout )(
|
||||
Thread_Control *
|
||||
);
|
||||
|
||||
EXTERN Thread_queue_Extract_callout
|
||||
_Thread_queue_Extract_table[ OBJECTS_CLASSES_LAST + 1 ];
|
||||
|
||||
/*
|
||||
* _Thread_queue_Dequeue
|
||||
*
|
||||
@@ -79,6 +92,20 @@ void _Thread_queue_Extract(
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _Thread_queue_Extract_with_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine extracts the_thread from the_thread_queue
|
||||
* and insures that if there is a proxy for this task on
|
||||
* another node, it is also dealt with.
|
||||
*/
|
||||
|
||||
boolean _Thread_queue_Extract_with_proxy(
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _Thread_queue_First
|
||||
*
|
||||
@@ -119,8 +146,10 @@ void _Thread_queue_Flush(
|
||||
|
||||
void _Thread_queue_Initialize(
|
||||
Thread_queue_Control *the_thread_queue,
|
||||
rtems_attribute attribute_set,
|
||||
States_Control state
|
||||
Objects_Classes the_class,
|
||||
Thread_queue_Disciplines the_discipline,
|
||||
States_Control state,
|
||||
Thread_queue_Extract_callout proxy_extract_callout
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
@@ -31,8 +31,8 @@ extern "C" {
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
THREAD_QUEUE_DATA_FIFO_DISCIPLINE, /* RTEMS_FIFO queue discipline */
|
||||
THREAD_QUEUE_DATA_PRIORITY_DISCIPLINE /* RTEMS_PRIORITY queue discipline */
|
||||
THREAD_QUEUE_DISCIPLINE_FIFO, /* RTEMS_FIFO queue discipline */
|
||||
THREAD_QUEUE_DISCIPLINE_PRIORITY /* RTEMS_PRIORITY queue discipline */
|
||||
} Thread_queue_Disciplines;
|
||||
|
||||
/*
|
||||
@@ -63,7 +63,7 @@ typedef struct {
|
||||
*/
|
||||
|
||||
STATIC INLINE unsigned32 _Thread_queue_Header_number (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -77,7 +77,7 @@ STATIC INLINE unsigned32 _Thread_queue_Header_number (
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _Thread_queue_Is_reverse_search (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
);
|
||||
|
||||
#include <rtems/tqdata.inl>
|
||||
|
||||
@@ -64,7 +64,7 @@ typedef struct {
|
||||
rtems_mp_packet_classes the_class;
|
||||
Objects_Id id;
|
||||
Objects_Id source_tid;
|
||||
rtems_task_priority source_priority;
|
||||
Priority_Control source_priority;
|
||||
rtems_status_code return_code;
|
||||
unsigned32 length;
|
||||
unsigned32 to_convert;
|
||||
|
||||
@@ -348,6 +348,19 @@ Objects_Control *_Objects_Get_next(
|
||||
Objects_Id *next_id_p
|
||||
);
|
||||
|
||||
/*
|
||||
* _Objects_Get_information
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* Returns the information control block for the class of objects
|
||||
* corresponding to this id.
|
||||
*/
|
||||
|
||||
Objects_Information *_Objects_Get_information(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
/*
|
||||
* _Objects_Build_id
|
||||
*
|
||||
@@ -403,6 +416,19 @@ STATIC INLINE unsigned32 rtems_get_index(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
/*
|
||||
* _Objects_Is_class_valid
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the class is valid.
|
||||
*
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _Objects_Is_class_valid(
|
||||
Objects_Classes the_class
|
||||
);
|
||||
|
||||
/*
|
||||
* _Objects_Is_local_node
|
||||
*
|
||||
|
||||
@@ -81,18 +81,35 @@ STATIC INLINE boolean _Objects_MP_Is_null_global_object (
|
||||
Objects_MP_Control *the_object
|
||||
);
|
||||
|
||||
/*
|
||||
/*PAGE
|
||||
*
|
||||
* _Objects_MP_Open
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine place the specified global object in the
|
||||
* specified information table.
|
||||
*/
|
||||
|
||||
void _Objects_MP_Open (
|
||||
Objects_Information *information,
|
||||
Objects_MP_Control *the_global_object,
|
||||
unsigned32 the_name, /* XXX -- wrong for variable */
|
||||
Objects_Id the_id
|
||||
);
|
||||
|
||||
/*
|
||||
* _Objects_MP_Allocate_and_open
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine allocates a global object control block
|
||||
* and places it in the specified information table. If the
|
||||
* allocation fails, then is_fatal_error determines the
|
||||
* error processing actions taken.
|
||||
*/
|
||||
|
||||
boolean _Objects_MP_Open (
|
||||
boolean _Objects_MP_Allocate_and_open (
|
||||
Objects_Information *information,
|
||||
unsigned32 the_name, /* XXX -- wrong for variable length */
|
||||
Objects_Id the_id,
|
||||
|
||||
@@ -29,7 +29,7 @@ extern "C" {
|
||||
* NOTE: Priority 0 is reserved for internal threads only.
|
||||
*/
|
||||
|
||||
typedef unsigned32 rtems_task_priority;
|
||||
typedef unsigned32 Priority_Control;
|
||||
|
||||
#define RTEMS_MINIMUM_PRIORITY 1 /* highest thread priority */
|
||||
#define RTEMS_MAXIMUM_PRIORITY 255 /* lowest thread priority */
|
||||
@@ -92,7 +92,7 @@ STATIC INLINE void _Priority_Handler_initialization( void );
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _Priority_Is_valid (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -104,7 +104,7 @@ STATIC INLINE boolean _Priority_Is_valid (
|
||||
*/
|
||||
|
||||
STATIC INLINE unsigned32 _Priority_Major (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -116,7 +116,7 @@ STATIC INLINE unsigned32 _Priority_Major (
|
||||
*/
|
||||
|
||||
STATIC INLINE unsigned32 _Priority_Minor (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -155,7 +155,7 @@ STATIC INLINE void _Priority_Remove_from_bit_map (
|
||||
* ready thread.
|
||||
*/
|
||||
|
||||
STATIC INLINE rtems_task_priority _Priority_Get_highest( void );
|
||||
STATIC INLINE Priority_Control _Priority_Get_highest( void );
|
||||
|
||||
/*
|
||||
* _Priority_Initialize_information
|
||||
@@ -169,7 +169,7 @@ STATIC INLINE rtems_task_priority _Priority_Get_highest( void );
|
||||
|
||||
STATIC INLINE void _Priority_Initialize_information(
|
||||
Priority_Information *the_priority_map,
|
||||
rtems_task_priority new_priority
|
||||
Priority_Control new_priority
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -182,7 +182,7 @@ STATIC INLINE void _Priority_Initialize_information(
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _Priority_Is_group_empty (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
);
|
||||
|
||||
#include <rtems/priority.inl>
|
||||
|
||||
@@ -86,22 +86,30 @@ typedef rtems_task ( *rtems_task_entry )(
|
||||
rtems_task_argument
|
||||
);
|
||||
|
||||
typedef Thread ( *Thread_Entry )(
|
||||
Thread_Argument
|
||||
);
|
||||
typedef Thread ( *Thread_Entry )( );
|
||||
|
||||
/*
|
||||
* The following structure contains the information which defines
|
||||
* the starting state of a thread.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
THREAD_START_NUMERIC,
|
||||
THREAD_START_POINTER,
|
||||
THREAD_START_BOTH_POINTER_FIRST,
|
||||
THREAD_START_BOTH_NUMERIC_FIRST
|
||||
} Thread_Start_types;
|
||||
|
||||
typedef struct {
|
||||
Thread_Entry entry_point; /* starting thread address */
|
||||
unsigned32 initial_argument; /* initial argument */
|
||||
rtems_mode initial_modes; /* initial mode */
|
||||
rtems_task_priority initial_priority; /* initial priority */
|
||||
void *fp_context; /* initial FP context area address */
|
||||
Thread_Start_types prototype; /* how task is invoked */
|
||||
void *pointer_argument; /* pointer argument */
|
||||
unsigned32 numeric_argument; /* numeric argument */
|
||||
Modes_Control initial_modes; /* initial mode */
|
||||
Priority_Control initial_priority; /* initial priority */
|
||||
Stack_Control Initial_stack; /* stack information */
|
||||
void *fp_context; /* initial FP context area address */
|
||||
void *stack; /* initial FP context area address */
|
||||
} Thread_Start_information;
|
||||
|
||||
/*
|
||||
@@ -134,8 +142,8 @@ typedef struct {
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
States_Control current_state;
|
||||
rtems_task_priority current_priority;
|
||||
rtems_task_priority real_priority;
|
||||
Priority_Control current_priority;
|
||||
Priority_Control real_priority;
|
||||
unsigned32 resource_count;
|
||||
Thread_Wait_information Wait;
|
||||
Watchdog_Control Timer;
|
||||
@@ -153,11 +161,21 @@ typedef struct {
|
||||
* memory images for the shared part.
|
||||
*/
|
||||
|
||||
/* XXX structure in wrong file .. API .. not core */
|
||||
|
||||
typedef struct {
|
||||
boolean is_global;
|
||||
unsigned32 Notepads[ RTEMS_NUMBER_NOTEPADS ];
|
||||
rtems_event_set pending_events;
|
||||
rtems_event_set events_out;
|
||||
ASR_Information Signal;
|
||||
} RTEMS_API_Control;
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
States_Control current_state;
|
||||
rtems_task_priority current_priority;
|
||||
rtems_task_priority real_priority;
|
||||
Priority_Control current_priority;
|
||||
Priority_Control real_priority;
|
||||
unsigned32 resource_count;
|
||||
Thread_Wait_information Wait;
|
||||
Watchdog_Control Timer;
|
||||
@@ -165,15 +183,11 @@ typedef struct {
|
||||
/****************** end of common block ********************/
|
||||
Chain_Control *ready;
|
||||
Priority_Information Priority_map;
|
||||
rtems_event_set pending_events;
|
||||
rtems_event_set events_out;
|
||||
Thread_Start_information Start;
|
||||
ASR_Information Signal;
|
||||
rtems_mode current_modes;
|
||||
rtems_attribute attribute_set;
|
||||
Modes_Control current_modes;
|
||||
Context_Control Registers;
|
||||
void *fp_context;
|
||||
unsigned32 Notepads[ RTEMS_NUMBER_NOTEPADS ];
|
||||
RTEMS_API_Control *RTEMS_API;
|
||||
void *extension;
|
||||
} Thread_Control;
|
||||
|
||||
@@ -304,6 +318,71 @@ STATIC INLINE void _Thread_Dispatch_initialization( void );
|
||||
|
||||
void _Thread_Dispatch( void );
|
||||
|
||||
/*
|
||||
* _Thread_Initialize
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
boolean _Thread_Initialize(
|
||||
Objects_Information *information,
|
||||
Thread_Control *the_thread,
|
||||
void *stack_area, /* NULL if to be allocated */
|
||||
unsigned32 stack_size, /* insure it is >= min */
|
||||
boolean is_fp, /* TRUE if thread uses FP */
|
||||
Priority_Control priority,
|
||||
Modes_Control mode,
|
||||
Objects_Name name
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
* _Thread_Start
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
boolean _Thread_Start(
|
||||
Thread_Control *the_thread,
|
||||
Thread_Start_types the_prototype,
|
||||
void *entry_point,
|
||||
void *pointer_argument,
|
||||
unsigned32 numeric_argument
|
||||
);
|
||||
|
||||
/*
|
||||
* _Thread_Restart
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
/* XXX multiple task arg profiles */
|
||||
|
||||
boolean _Thread_Restart(
|
||||
Thread_Control *the_thread,
|
||||
void *pointer_argument,
|
||||
unsigned32 numeric_argument
|
||||
);
|
||||
|
||||
/*
|
||||
* _Thread_Close
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
void _Thread_Close(
|
||||
Objects_Information *information,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _Thread_Ready
|
||||
*
|
||||
@@ -493,7 +572,7 @@ void _Thread_Delay_ended(
|
||||
|
||||
void _Thread_Change_priority (
|
||||
Thread_Control *the_thread,
|
||||
rtems_task_priority new_priority
|
||||
Priority_Control new_priority
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -507,7 +586,7 @@ void _Thread_Change_priority (
|
||||
|
||||
void _Thread_Set_priority(
|
||||
Thread_Control *the_thread,
|
||||
rtems_task_priority new_priority
|
||||
Priority_Control new_priority
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -524,9 +603,9 @@ void _Thread_Set_priority(
|
||||
*/
|
||||
|
||||
boolean _Thread_Change_mode(
|
||||
rtems_mode new_mode_set,
|
||||
rtems_mode mask,
|
||||
rtems_mode *old_mode_set
|
||||
Modes_Control new_mode_set,
|
||||
Modes_Control mask,
|
||||
Modes_Control *old_mode_set
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
@@ -36,6 +36,19 @@ typedef void ( *Thread_queue_Flush_callout )(
|
||||
Thread_Control *
|
||||
);
|
||||
|
||||
/*
|
||||
* The following type defines the callout used when a local task
|
||||
* is extracted from a remote thread queue (i.e. it's proxy must
|
||||
* extracted from the remote queue).
|
||||
*/
|
||||
|
||||
typedef void ( *Thread_queue_Extract_callout )(
|
||||
Thread_Control *
|
||||
);
|
||||
|
||||
EXTERN Thread_queue_Extract_callout
|
||||
_Thread_queue_Extract_table[ OBJECTS_CLASSES_LAST + 1 ];
|
||||
|
||||
/*
|
||||
* _Thread_queue_Dequeue
|
||||
*
|
||||
@@ -79,6 +92,20 @@ void _Thread_queue_Extract(
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _Thread_queue_Extract_with_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine extracts the_thread from the_thread_queue
|
||||
* and insures that if there is a proxy for this task on
|
||||
* another node, it is also dealt with.
|
||||
*/
|
||||
|
||||
boolean _Thread_queue_Extract_with_proxy(
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _Thread_queue_First
|
||||
*
|
||||
@@ -119,8 +146,10 @@ void _Thread_queue_Flush(
|
||||
|
||||
void _Thread_queue_Initialize(
|
||||
Thread_queue_Control *the_thread_queue,
|
||||
rtems_attribute attribute_set,
|
||||
States_Control state
|
||||
Objects_Classes the_class,
|
||||
Thread_queue_Disciplines the_discipline,
|
||||
States_Control state,
|
||||
Thread_queue_Extract_callout proxy_extract_callout
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
@@ -31,8 +31,8 @@ extern "C" {
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
THREAD_QUEUE_DATA_FIFO_DISCIPLINE, /* RTEMS_FIFO queue discipline */
|
||||
THREAD_QUEUE_DATA_PRIORITY_DISCIPLINE /* RTEMS_PRIORITY queue discipline */
|
||||
THREAD_QUEUE_DISCIPLINE_FIFO, /* RTEMS_FIFO queue discipline */
|
||||
THREAD_QUEUE_DISCIPLINE_PRIORITY /* RTEMS_PRIORITY queue discipline */
|
||||
} Thread_queue_Disciplines;
|
||||
|
||||
/*
|
||||
@@ -63,7 +63,7 @@ typedef struct {
|
||||
*/
|
||||
|
||||
STATIC INLINE unsigned32 _Thread_queue_Header_number (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -77,7 +77,7 @@ STATIC INLINE unsigned32 _Thread_queue_Header_number (
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _Thread_queue_Is_reverse_search (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
);
|
||||
|
||||
#include <rtems/tqdata.inl>
|
||||
|
||||
@@ -74,6 +74,19 @@ STATIC INLINE unsigned32 rtems_get_index(
|
||||
return (id >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Objects_Is_class_valid
|
||||
*
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _Objects_Is_class_valid(
|
||||
Objects_Classes the_class
|
||||
)
|
||||
{
|
||||
return the_class <= OBJECTS_CLASSES_LAST;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Objects_Is_local_node
|
||||
|
||||
@@ -41,7 +41,7 @@ STATIC INLINE void _Priority_Handler_initialization( void )
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _Priority_Is_valid (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
)
|
||||
{
|
||||
return ( ( the_priority >= RTEMS_MINIMUM_PRIORITY ) &&
|
||||
@@ -55,7 +55,7 @@ STATIC INLINE boolean _Priority_Is_valid (
|
||||
*/
|
||||
|
||||
STATIC INLINE unsigned32 _Priority_Major (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
)
|
||||
{
|
||||
return ( the_priority / 16 );
|
||||
@@ -68,7 +68,7 @@ STATIC INLINE unsigned32 _Priority_Major (
|
||||
*/
|
||||
|
||||
STATIC INLINE unsigned32 _Priority_Minor (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
)
|
||||
{
|
||||
return ( the_priority % 16 );
|
||||
@@ -109,7 +109,7 @@ STATIC INLINE void _Priority_Remove_from_bit_map (
|
||||
*
|
||||
*/
|
||||
|
||||
STATIC INLINE rtems_task_priority _Priority_Get_highest( void )
|
||||
STATIC INLINE Priority_Control _Priority_Get_highest( void )
|
||||
{
|
||||
Priority_Bit_map_control minor;
|
||||
Priority_Bit_map_control major;
|
||||
@@ -129,7 +129,7 @@ STATIC INLINE rtems_task_priority _Priority_Get_highest( void )
|
||||
|
||||
STATIC INLINE void _Priority_Initialize_information(
|
||||
Priority_Information *the_priority_map,
|
||||
rtems_task_priority new_priority
|
||||
Priority_Control new_priority
|
||||
)
|
||||
{
|
||||
Priority_Bit_map_control major;
|
||||
@@ -158,7 +158,7 @@ STATIC INLINE void _Priority_Initialize_information(
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _Priority_Is_group_empty (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
)
|
||||
{
|
||||
return the_priority == 0;
|
||||
|
||||
@@ -74,6 +74,19 @@ STATIC INLINE unsigned32 rtems_get_index(
|
||||
return (id >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Objects_Is_class_valid
|
||||
*
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _Objects_Is_class_valid(
|
||||
Objects_Classes the_class
|
||||
)
|
||||
{
|
||||
return the_class <= OBJECTS_CLASSES_LAST;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Objects_Is_local_node
|
||||
|
||||
@@ -41,7 +41,7 @@ STATIC INLINE void _Priority_Handler_initialization( void )
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _Priority_Is_valid (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
)
|
||||
{
|
||||
return ( ( the_priority >= RTEMS_MINIMUM_PRIORITY ) &&
|
||||
@@ -55,7 +55,7 @@ STATIC INLINE boolean _Priority_Is_valid (
|
||||
*/
|
||||
|
||||
STATIC INLINE unsigned32 _Priority_Major (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
)
|
||||
{
|
||||
return ( the_priority / 16 );
|
||||
@@ -68,7 +68,7 @@ STATIC INLINE unsigned32 _Priority_Major (
|
||||
*/
|
||||
|
||||
STATIC INLINE unsigned32 _Priority_Minor (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
)
|
||||
{
|
||||
return ( the_priority % 16 );
|
||||
@@ -109,7 +109,7 @@ STATIC INLINE void _Priority_Remove_from_bit_map (
|
||||
*
|
||||
*/
|
||||
|
||||
STATIC INLINE rtems_task_priority _Priority_Get_highest( void )
|
||||
STATIC INLINE Priority_Control _Priority_Get_highest( void )
|
||||
{
|
||||
Priority_Bit_map_control minor;
|
||||
Priority_Bit_map_control major;
|
||||
@@ -129,7 +129,7 @@ STATIC INLINE rtems_task_priority _Priority_Get_highest( void )
|
||||
|
||||
STATIC INLINE void _Priority_Initialize_information(
|
||||
Priority_Information *the_priority_map,
|
||||
rtems_task_priority new_priority
|
||||
Priority_Control new_priority
|
||||
)
|
||||
{
|
||||
Priority_Bit_map_control major;
|
||||
@@ -158,7 +158,7 @@ STATIC INLINE void _Priority_Initialize_information(
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _Priority_Is_group_empty (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
)
|
||||
{
|
||||
return the_priority == 0;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
STATIC INLINE unsigned32 _Thread_queue_Header_number (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
)
|
||||
{
|
||||
return ( the_priority >> 6 );
|
||||
@@ -37,7 +37,7 @@ STATIC INLINE unsigned32 _Thread_queue_Header_number (
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _Thread_queue_Is_reverse_search (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
)
|
||||
{
|
||||
return ( the_priority & 0x20 );
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
STATIC INLINE unsigned32 _Thread_queue_Header_number (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
)
|
||||
{
|
||||
return ( the_priority >> 6 );
|
||||
@@ -37,7 +37,7 @@ STATIC INLINE unsigned32 _Thread_queue_Header_number (
|
||||
*/
|
||||
|
||||
STATIC INLINE boolean _Thread_queue_Is_reverse_search (
|
||||
rtems_task_priority the_priority
|
||||
Priority_Control the_priority
|
||||
)
|
||||
{
|
||||
return ( the_priority & 0x20 );
|
||||
|
||||
@@ -55,6 +55,15 @@
|
||||
#define rtems_get_index( _id ) \
|
||||
(((_id) >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS)
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Objects_Is_class_valid
|
||||
*
|
||||
*/
|
||||
|
||||
#define _Objects_Is_class_valid( _the_class ) \
|
||||
( (_the_class) <= OBJECTS_CLASSES_LAST )
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Objects_Is_local_node
|
||||
|
||||
@@ -55,6 +55,15 @@
|
||||
#define rtems_get_index( _id ) \
|
||||
(((_id) >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS)
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Objects_Is_class_valid
|
||||
*
|
||||
*/
|
||||
|
||||
#define _Objects_Is_class_valid( _the_class ) \
|
||||
( (_the_class) <= OBJECTS_CLASSES_LAST )
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Objects_Is_local_node
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
|
||||
#define _Thread_Calculate_heir() \
|
||||
{ \
|
||||
rtems_task_priority highest; \
|
||||
Priority_Control highest; \
|
||||
\
|
||||
_Priority_Get_highest( highest ); \
|
||||
\
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
|
||||
#define _Thread_Calculate_heir() \
|
||||
{ \
|
||||
rtems_task_priority highest; \
|
||||
Priority_Control highest; \
|
||||
\
|
||||
_Priority_Get_highest( highest ); \
|
||||
\
|
||||
|
||||
@@ -36,8 +36,10 @@ void _MPCI_Handler_initialization ( void )
|
||||
{
|
||||
_Thread_queue_Initialize(
|
||||
&_MPCI_Remote_blocked_threads,
|
||||
RTEMS_FIFO,
|
||||
STATES_WAITING_FOR_RPC_REPLY
|
||||
OBJECTS_NO_CLASS,
|
||||
THREAD_QUEUE_DISCIPLINE_FIFO,
|
||||
STATES_WAITING_FOR_RPC_REPLY,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -476,3 +476,25 @@ final:
|
||||
*next_id_p = RTEMS_OBJECT_ID_FINAL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Objects_Get_information
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
Objects_Information *_Objects_Get_information(
|
||||
Objects_Id id
|
||||
)
|
||||
{
|
||||
Objects_Classes the_class;
|
||||
|
||||
the_class = rtems_get_class( id );
|
||||
|
||||
if ( !_Objects_Is_class_valid( the_class ) )
|
||||
return NULL;
|
||||
|
||||
return _Objects_Information_table[ the_class ];
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,30 @@ void _Objects_MP_Handler_initialization (
|
||||
*
|
||||
*/
|
||||
|
||||
boolean _Objects_MP_Open (
|
||||
void _Objects_MP_Open (
|
||||
Objects_Information *information,
|
||||
Objects_MP_Control *the_global_object,
|
||||
unsigned32 the_name, /* XXX -- wrong for variable */
|
||||
Objects_Id the_id
|
||||
)
|
||||
{
|
||||
the_global_object->Object.id = the_id;
|
||||
the_global_object->name = the_name;
|
||||
|
||||
_Chain_Prepend(
|
||||
&information->global_table[ rtems_get_node( the_id ) ],
|
||||
&the_global_object->Object.Node
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Objects_MP_Allocate_and_open
|
||||
*
|
||||
*/
|
||||
|
||||
boolean _Objects_MP_Allocate_and_open (
|
||||
Objects_Information *information,
|
||||
unsigned32 the_name, /* XXX -- wrong for variable */
|
||||
Objects_Id the_id,
|
||||
@@ -70,13 +93,7 @@ boolean _Objects_MP_Open (
|
||||
|
||||
}
|
||||
|
||||
the_global_object->Object.id = the_id;
|
||||
the_global_object->name = the_name;
|
||||
|
||||
_Chain_Prepend(
|
||||
&information->global_table[ rtems_get_node( the_id ) ],
|
||||
&the_global_object->Object.Node
|
||||
);
|
||||
_Objects_MP_Open( information, the_global_object, the_name, the_id );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ void _Thread_Dispatch( void )
|
||||
Thread_Control *heir;
|
||||
ISR_Level level;
|
||||
rtems_signal_set signal_set;
|
||||
rtems_mode previous_mode;
|
||||
Modes_Control previous_mode;
|
||||
|
||||
executing = _Thread_Executing;
|
||||
_ISR_Disable( level );
|
||||
@@ -199,19 +199,19 @@ void _Thread_Dispatch( void )
|
||||
|
||||
_Thread_Dispatch_disable_level = 0;
|
||||
|
||||
if ( _ASR_Are_signals_pending( &executing->Signal ) ) {
|
||||
signal_set = executing->Signal.signals_posted;
|
||||
executing->Signal.signals_posted = 0;
|
||||
if ( _ASR_Are_signals_pending( &executing->RTEMS_API->Signal ) ) {
|
||||
signal_set = executing->RTEMS_API->Signal.signals_posted;
|
||||
executing->RTEMS_API->Signal.signals_posted = 0;
|
||||
_ISR_Enable( level );
|
||||
|
||||
executing->Signal.nest_level += 1;
|
||||
if (_Thread_Change_mode( executing->Signal.mode_set,
|
||||
executing->RTEMS_API->Signal.nest_level += 1;
|
||||
if (_Thread_Change_mode( executing->RTEMS_API->Signal.mode_set,
|
||||
RTEMS_ALL_MODE_MASKS, &previous_mode ))
|
||||
_Thread_Dispatch();
|
||||
|
||||
(*executing->Signal.handler)( signal_set );
|
||||
(*executing->RTEMS_API->Signal.handler)( signal_set );
|
||||
|
||||
executing->Signal.nest_level -= 1;
|
||||
executing->RTEMS_API->Signal.nest_level -= 1;
|
||||
if (_Thread_Change_mode( previous_mode,
|
||||
RTEMS_ALL_MODE_MASKS, &previous_mode ))
|
||||
_Thread_Dispatch();
|
||||
@@ -220,6 +220,257 @@ void _Thread_Dispatch( void )
|
||||
_ISR_Enable( level );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Thread_Initialize
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
boolean _Thread_Initialize(
|
||||
Objects_Information *information,
|
||||
Thread_Control *the_thread,
|
||||
void *stack_area, /* NULL if to be allocated */
|
||||
unsigned32 stack_size, /* insure it is >= min */
|
||||
boolean is_fp, /* TRUE if thread uses FP */
|
||||
Priority_Control priority,
|
||||
Modes_Control mode,
|
||||
Objects_Name name
|
||||
|
||||
)
|
||||
{
|
||||
unsigned32 actual_stack_size;
|
||||
void *stack;
|
||||
void *fp_area;
|
||||
|
||||
/*
|
||||
* Allocate and Initialize the stack for this thread.
|
||||
*/
|
||||
|
||||
if ( !_Stack_Is_enough( stack_size ) )
|
||||
actual_stack_size = RTEMS_MINIMUM_STACK_SIZE;
|
||||
else
|
||||
actual_stack_size = stack_size;
|
||||
|
||||
actual_stack_size = _Stack_Adjust_size( actual_stack_size );
|
||||
stack = stack_area;
|
||||
|
||||
if ( !stack ) {
|
||||
stack = _Workspace_Allocate( actual_stack_size );
|
||||
|
||||
if ( !stack )
|
||||
return FALSE;
|
||||
|
||||
the_thread->Start.stack = stack;
|
||||
} else
|
||||
the_thread->Start.stack = NULL;
|
||||
|
||||
_Stack_Initialize(
|
||||
&the_thread->Start.Initial_stack,
|
||||
stack,
|
||||
actual_stack_size
|
||||
);
|
||||
|
||||
/*
|
||||
* Allocate the floating point area for this thread
|
||||
*/
|
||||
|
||||
if ( is_fp ) {
|
||||
|
||||
fp_area = _Workspace_Allocate( CONTEXT_FP_SIZE );
|
||||
if ( !fp_area ) {
|
||||
(void) _Workspace_Free( stack );
|
||||
return FALSE;
|
||||
}
|
||||
fp_area = _Context_Fp_start( fp_area, 0 );
|
||||
|
||||
} else
|
||||
fp_area = NULL;
|
||||
|
||||
the_thread->fp_context = fp_area;
|
||||
the_thread->Start.fp_context = fp_area;
|
||||
|
||||
/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
|
||||
/*
|
||||
* Allocate and initialize the RTEMS API specific information
|
||||
*/
|
||||
|
||||
the_thread->RTEMS_API = _Workspace_Allocate( sizeof( RTEMS_API_Control ) );
|
||||
|
||||
if ( !the_thread->RTEMS_API ) {
|
||||
/* XXX when in task_create
|
||||
_RTEMS_tasks_Free( the_thread );
|
||||
_Objects_MP_Free_global_object( the_global_object );
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
return( RTEMS_UNSATISFIED );
|
||||
*/
|
||||
(void) _Workspace_Free( stack );
|
||||
(void) _Workspace_Free( fp_area );
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
the_thread->RTEMS_API->is_global = FALSE;
|
||||
the_thread->RTEMS_API->pending_events = EVENT_SETS_NONE_PENDING;
|
||||
_ASR_Initialize( &the_thread->RTEMS_API->Signal );
|
||||
|
||||
/* XXX should not be here .... */
|
||||
|
||||
/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
|
||||
|
||||
/*
|
||||
* General initialization
|
||||
*/
|
||||
|
||||
the_thread->current_state = STATES_DORMANT;
|
||||
the_thread->current_modes = mode;
|
||||
the_thread->resource_count = 0;
|
||||
the_thread->real_priority = priority;
|
||||
the_thread->Start.initial_priority = priority;
|
||||
the_thread->Start.initial_modes = mode;
|
||||
|
||||
_Thread_Set_priority( the_thread, priority );
|
||||
|
||||
/*
|
||||
* Open the object
|
||||
*/
|
||||
|
||||
_Objects_Open( information, &the_thread->Object, name );
|
||||
|
||||
/*
|
||||
* Invoke create extensions
|
||||
*/
|
||||
|
||||
_User_extensions_Task_create( the_thread );
|
||||
/* XXX if this fails ... */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* _Thread_Start
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
boolean _Thread_Start(
|
||||
Thread_Control *the_thread,
|
||||
Thread_Start_types the_prototype,
|
||||
void *entry_point,
|
||||
void *pointer_argument,
|
||||
unsigned32 numeric_argument
|
||||
)
|
||||
{
|
||||
if ( _States_Is_dormant( the_thread->current_state ) ) {
|
||||
|
||||
the_thread->Start.entry_point = entry_point;
|
||||
|
||||
the_thread->Start.prototype = the_prototype;
|
||||
the_thread->Start.pointer_argument = pointer_argument;
|
||||
the_thread->Start.numeric_argument = numeric_argument;
|
||||
|
||||
_Thread_Load_environment( the_thread );
|
||||
|
||||
_Thread_Ready( the_thread );
|
||||
|
||||
_User_extensions_Task_start( the_thread );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* _Thread_Restart
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
boolean _Thread_Restart(
|
||||
Thread_Control *the_thread,
|
||||
void *pointer_argument,
|
||||
unsigned32 numeric_argument
|
||||
)
|
||||
{
|
||||
if ( !_States_Is_dormant( the_thread->current_state ) ) {
|
||||
|
||||
_Thread_Set_transient( the_thread );
|
||||
the_thread->resource_count = 0;
|
||||
the_thread->current_modes = the_thread->Start.initial_modes;
|
||||
|
||||
the_thread->Start.pointer_argument = pointer_argument;
|
||||
the_thread->Start.numeric_argument = numeric_argument;
|
||||
|
||||
if ( !_Thread_queue_Extract_with_proxy( the_thread ) ) {
|
||||
|
||||
if ( _Watchdog_Is_active( &the_thread->Timer ) )
|
||||
(void) _Watchdog_Remove( &the_thread->Timer );
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
_Thread_Ready( the_thread );
|
||||
|
||||
_User_extensions_Task_restart( the_thread );
|
||||
|
||||
if ( _Thread_Is_executing ( the_thread ) )
|
||||
_Thread_Restart_self();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* _Thread_Close
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
void _Thread_Close(
|
||||
Objects_Information *information,
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
_Objects_Close( information, &the_thread->Object );
|
||||
|
||||
_Thread_Set_state( the_thread, STATES_TRANSIENT );
|
||||
|
||||
if ( !_Thread_queue_Extract_with_proxy( the_thread ) ) {
|
||||
|
||||
if ( _Watchdog_Is_active( &the_thread->Timer ) )
|
||||
(void) _Watchdog_Remove( &the_thread->Timer );
|
||||
}
|
||||
|
||||
_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;
|
||||
|
||||
(void) _Workspace_Free( the_thread->Start.fp_context );
|
||||
|
||||
if ( the_thread->Start.stack )
|
||||
(void) _Workspace_Free( the_thread->Start.stack );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Thread_Ready
|
||||
@@ -595,7 +846,26 @@ void _Thread_Handler( void )
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
(*executing->Start.entry_point)( executing->Start.initial_argument );
|
||||
switch ( executing->Start.prototype ) {
|
||||
case THREAD_START_NUMERIC:
|
||||
(*executing->Start.entry_point)( executing->Start.numeric_argument );
|
||||
break;
|
||||
case THREAD_START_POINTER:
|
||||
(*executing->Start.entry_point)( executing->Start.pointer_argument );
|
||||
break;
|
||||
case THREAD_START_BOTH_POINTER_FIRST:
|
||||
(*executing->Start.entry_point)(
|
||||
executing->Start.pointer_argument,
|
||||
executing->Start.numeric_argument
|
||||
);
|
||||
break;
|
||||
case THREAD_START_BOTH_NUMERIC_FIRST:
|
||||
(*executing->Start.entry_point)(
|
||||
executing->Start.numeric_argument,
|
||||
executing->Start.pointer_argument
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
_User_extensions_Task_exitted( executing );
|
||||
|
||||
@@ -655,7 +925,7 @@ void _Thread_Delay_ended(
|
||||
|
||||
void _Thread_Change_priority(
|
||||
Thread_Control *the_thread,
|
||||
rtems_task_priority new_priority
|
||||
Priority_Control new_priority
|
||||
)
|
||||
{
|
||||
ISR_Level level;
|
||||
@@ -705,7 +975,7 @@ void _Thread_Change_priority(
|
||||
|
||||
void _Thread_Set_priority(
|
||||
Thread_Control *the_thread,
|
||||
rtems_task_priority new_priority
|
||||
Priority_Control new_priority
|
||||
)
|
||||
{
|
||||
the_thread->current_priority = new_priority;
|
||||
@@ -735,13 +1005,13 @@ void _Thread_Set_priority(
|
||||
*/
|
||||
|
||||
boolean _Thread_Change_mode(
|
||||
unsigned32 new_mode_set,
|
||||
unsigned32 mask,
|
||||
unsigned32 *old_mode_set
|
||||
Modes_Control new_mode_set,
|
||||
Modes_Control mask,
|
||||
Modes_Control *old_mode_set
|
||||
)
|
||||
{
|
||||
rtems_mode changed;
|
||||
rtems_mode threads_new_mode_set;
|
||||
Modes_Control changed;
|
||||
Modes_Control threads_new_mode_set;
|
||||
Thread_Control *executing;
|
||||
boolean need_dispatch;
|
||||
|
||||
@@ -754,7 +1024,7 @@ boolean _Thread_Change_mode(
|
||||
_Modes_Set_interrupt_level( threads_new_mode_set );
|
||||
|
||||
if ( _Modes_Mask_changed( changed, RTEMS_ASR_MASK ) )
|
||||
_ASR_Swap_signals( &executing->Signal );
|
||||
_ASR_Swap_signals( &executing->RTEMS_API->Signal );
|
||||
|
||||
executing->current_modes = threads_new_mode_set;
|
||||
need_dispatch = TRUE;
|
||||
@@ -765,7 +1035,7 @@ boolean _Thread_Change_mode(
|
||||
|
||||
_Context_Switch_necessary = TRUE;
|
||||
|
||||
else if ( !_ASR_Are_signals_pending( &executing->Signal ) )
|
||||
else if ( !_ASR_Are_signals_pending( &executing->RTEMS_API->Signal ) )
|
||||
|
||||
need_dispatch = FALSE;
|
||||
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
*
|
||||
* Input parameters:
|
||||
* the_thread_queue - pointer to a threadq header
|
||||
* attribute_set - used to determine queueing discipline
|
||||
* the_class - class of the object to which this belongs
|
||||
* discipline - queueing discipline
|
||||
* state - state of waiting threads
|
||||
*
|
||||
* Output parameters: NONE
|
||||
@@ -38,25 +39,30 @@
|
||||
|
||||
void _Thread_queue_Initialize(
|
||||
Thread_queue_Control *the_thread_queue,
|
||||
rtems_attribute attribute_set,
|
||||
States_Control state
|
||||
Objects_Classes the_class,
|
||||
Thread_queue_Disciplines the_discipline,
|
||||
States_Control state,
|
||||
Thread_queue_Extract_callout proxy_extract_callout
|
||||
)
|
||||
{
|
||||
unsigned32 index;
|
||||
|
||||
if ( _Attributes_Is_priority( attribute_set ) ) {
|
||||
the_thread_queue->discipline = THREAD_QUEUE_DATA_PRIORITY_DISCIPLINE;
|
||||
_Thread_queue_Extract_table[ the_class ] = proxy_extract_callout;
|
||||
|
||||
the_thread_queue->state = state;
|
||||
the_thread_queue->discipline = the_discipline;
|
||||
|
||||
switch ( the_discipline ) {
|
||||
case THREAD_QUEUE_DISCIPLINE_FIFO:
|
||||
_Chain_Initialize_empty( &the_thread_queue->Queues.Fifo );
|
||||
break;
|
||||
case THREAD_QUEUE_DISCIPLINE_PRIORITY:
|
||||
for( index=0 ;
|
||||
index < TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS ;
|
||||
index++)
|
||||
_Chain_Initialize_empty( &the_thread_queue->Queues.Priority[index] );
|
||||
break;
|
||||
}
|
||||
else {
|
||||
the_thread_queue->discipline = THREAD_QUEUE_DATA_FIFO_DISCIPLINE;
|
||||
_Chain_Initialize_empty( &the_thread_queue->Queues.Fifo );
|
||||
}
|
||||
|
||||
the_thread_queue->state = state;
|
||||
|
||||
}
|
||||
|
||||
@@ -107,10 +113,10 @@ void _Thread_queue_Enqueue(
|
||||
}
|
||||
|
||||
switch( the_thread_queue->discipline ) {
|
||||
case THREAD_QUEUE_DATA_FIFO_DISCIPLINE:
|
||||
case THREAD_QUEUE_DISCIPLINE_FIFO:
|
||||
_Thread_queue_Enqueue_fifo( the_thread_queue, the_thread, timeout );
|
||||
break;
|
||||
case THREAD_QUEUE_DATA_PRIORITY_DISCIPLINE:
|
||||
case THREAD_QUEUE_DISCIPLINE_PRIORITY:
|
||||
_Thread_queue_Enqueue_priority(
|
||||
the_thread_queue, the_thread, timeout );
|
||||
break;
|
||||
@@ -144,10 +150,10 @@ Thread_Control *_Thread_queue_Dequeue(
|
||||
ISR_Level level;
|
||||
|
||||
switch ( the_thread_queue->discipline ) {
|
||||
case THREAD_QUEUE_DATA_FIFO_DISCIPLINE:
|
||||
case THREAD_QUEUE_DISCIPLINE_FIFO:
|
||||
the_thread = _Thread_queue_Dequeue_fifo( the_thread_queue );
|
||||
break;
|
||||
case THREAD_QUEUE_DATA_PRIORITY_DISCIPLINE:
|
||||
case THREAD_QUEUE_DISCIPLINE_PRIORITY:
|
||||
the_thread = _Thread_queue_Dequeue_priority( the_thread_queue );
|
||||
break;
|
||||
default: /* this is only to prevent warnings */
|
||||
@@ -169,6 +175,45 @@ Thread_Control *_Thread_queue_Dequeue(
|
||||
return( _Thread_Executing );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Thread_queue_Extract_with_proxy
|
||||
*
|
||||
* This routine extracts the_thread from the_thread_queue
|
||||
* and insures that if there is a proxy for this task on
|
||||
* another node, it is also dealt with.
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
boolean _Thread_queue_Extract_with_proxy(
|
||||
Thread_Control *the_thread
|
||||
)
|
||||
{
|
||||
States_Control state;
|
||||
Objects_Classes the_class;
|
||||
Thread_queue_Extract_callout proxy_extract_callout;
|
||||
|
||||
state = the_thread->current_state;
|
||||
|
||||
if ( _States_Is_waiting_on_thread_queue( state ) ) {
|
||||
if ( _States_Is_waiting_for_rpc_reply( state ) &&
|
||||
_States_Is_locally_blocked( state ) ) {
|
||||
|
||||
the_class = rtems_get_class( the_thread->Wait.id );
|
||||
|
||||
proxy_extract_callout = _Thread_queue_Extract_table[ the_class ];
|
||||
|
||||
if ( proxy_extract_callout )
|
||||
(*proxy_extract_callout)( the_thread );
|
||||
}
|
||||
_Thread_queue_Extract( the_thread->Wait.queue, the_thread );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Thread_queue_Extract
|
||||
@@ -191,10 +236,10 @@ void _Thread_queue_Extract(
|
||||
)
|
||||
{
|
||||
switch ( the_thread_queue->discipline ) {
|
||||
case THREAD_QUEUE_DATA_FIFO_DISCIPLINE:
|
||||
case THREAD_QUEUE_DISCIPLINE_FIFO:
|
||||
_Thread_queue_Extract_fifo( the_thread_queue, the_thread );
|
||||
break;
|
||||
case THREAD_QUEUE_DATA_PRIORITY_DISCIPLINE:
|
||||
case THREAD_QUEUE_DISCIPLINE_PRIORITY:
|
||||
_Thread_queue_Extract_priority( the_thread_queue, the_thread );
|
||||
break;
|
||||
}
|
||||
@@ -248,10 +293,10 @@ Thread_Control *_Thread_queue_First(
|
||||
Thread_Control *the_thread;
|
||||
|
||||
switch ( the_thread_queue->discipline ) {
|
||||
case THREAD_QUEUE_DATA_FIFO_DISCIPLINE:
|
||||
case THREAD_QUEUE_DISCIPLINE_FIFO:
|
||||
the_thread = _Thread_queue_First_fifo( the_thread_queue );
|
||||
break;
|
||||
case THREAD_QUEUE_DATA_PRIORITY_DISCIPLINE:
|
||||
case THREAD_QUEUE_DISCIPLINE_PRIORITY:
|
||||
the_thread = _Thread_queue_First_priority( the_thread_queue );
|
||||
break;
|
||||
default: /* this is only to prevent warnings */
|
||||
@@ -437,16 +482,17 @@ void _Thread_queue_Extract_fifo(
|
||||
|
||||
if ( !_Watchdog_Is_active( &the_thread->Timer ) ) {
|
||||
_ISR_Enable( level );
|
||||
_Thread_Unblock( the_thread );
|
||||
} else {
|
||||
_Watchdog_Deactivate( &the_thread->Timer );
|
||||
_ISR_Enable( level );
|
||||
(void) _Watchdog_Remove( &the_thread->Timer );
|
||||
_Thread_Unblock( the_thread );
|
||||
}
|
||||
|
||||
_Thread_Unblock( the_thread );
|
||||
|
||||
if ( !_Objects_Is_local_id( the_thread->Object.id ) )
|
||||
_Thread_MP_Free_proxy( the_thread );
|
||||
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
@@ -498,7 +544,7 @@ void _Thread_queue_Enqueue_priority(
|
||||
rtems_interval timeout
|
||||
)
|
||||
{
|
||||
rtems_task_priority search_priority;
|
||||
Priority_Control search_priority;
|
||||
Thread_Control *search_thread;
|
||||
ISR_Level level;
|
||||
Chain_Control *header;
|
||||
@@ -507,7 +553,7 @@ void _Thread_queue_Enqueue_priority(
|
||||
Chain_Node *next_node;
|
||||
Chain_Node *previous_node;
|
||||
Chain_Node *search_node;
|
||||
rtems_task_priority priority;
|
||||
Priority_Control priority;
|
||||
States_Control block_state;
|
||||
|
||||
_Chain_Initialize_empty( &the_thread->Wait.Block2n );
|
||||
|
||||
@@ -16,8 +16,12 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <bsp.h>
|
||||
#include <clockdrv.h>
|
||||
|
||||
void Clock_exit( void );
|
||||
rtems_isr Clock_isr( rtems_vector_number vector );
|
||||
|
||||
|
||||
/*
|
||||
* The interrupt vector number associated with the clock tick device
|
||||
@@ -30,6 +34,7 @@
|
||||
* Clock_driver_ticks is a monotonically increasing counter of the
|
||||
* number of clock ticks since the driver was initialized.
|
||||
*/
|
||||
|
||||
volatile rtems_unsigned32 Clock_driver_ticks;
|
||||
|
||||
/*
|
||||
@@ -42,29 +47,19 @@ volatile rtems_unsigned32 Clock_driver_ticks;
|
||||
|
||||
rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
|
||||
|
||||
/*
|
||||
* These are set by clock driver during its init
|
||||
*/
|
||||
|
||||
rtems_device_major_number rtems_clock_major = ~0;
|
||||
rtems_device_minor_number rtems_clock_minor;
|
||||
|
||||
/*
|
||||
* The previous ISR on this clock tick interrupt vector.
|
||||
*/
|
||||
|
||||
rtems_isr_entry Old_ticker;
|
||||
|
||||
/*
|
||||
* Clock_initialize
|
||||
*
|
||||
* Device driver entry point for clock tick driver initialization.
|
||||
*/
|
||||
|
||||
rtems_device_driver Clock_initialize(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp,
|
||||
rtems_id tid,
|
||||
rtems_unsigned32 *rval
|
||||
)
|
||||
{
|
||||
Install_clock( Clock_isr );
|
||||
}
|
||||
|
||||
/*
|
||||
* Reinstall_clock
|
||||
*
|
||||
@@ -141,3 +136,55 @@ void Clock_exit( void )
|
||||
/* XXX: If necessary, restore the old vector */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clock_initialize
|
||||
*
|
||||
* Device driver entry point for clock tick driver initialization.
|
||||
*/
|
||||
|
||||
rtems_device_driver Clock_initialize(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
Install_clock((rtems_isr_entry) Clock_isr);
|
||||
|
||||
/*
|
||||
* make major/minor avail to others such as shared memory driver
|
||||
*/
|
||||
rtems_clock_major = major;
|
||||
rtems_clock_minor = minor;
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_device_driver Clock_control(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
rtems_libio_ioctl_args_t *args = pargp;
|
||||
|
||||
if (args == 0)
|
||||
goto done;
|
||||
|
||||
/*
|
||||
* This is hokey, but until we get a defined interface
|
||||
* to do this, it will just be this simple...
|
||||
*/
|
||||
|
||||
if (args->command == rtems_build_name('I', 'S', 'R', ' '))
|
||||
{
|
||||
Clock_isr(CLOCK_VECTOR);
|
||||
}
|
||||
else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
|
||||
{
|
||||
ReInstall_clock(args->buffer);
|
||||
}
|
||||
|
||||
done:
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems.h>
|
||||
#include <clockdrv.h>
|
||||
|
||||
/*
|
||||
* Define the time limits for RTEMS Test Suite test durations.
|
||||
@@ -67,6 +68,20 @@ extern "C" {
|
||||
|
||||
extern rtems_configuration_table BSP_Configuration;
|
||||
|
||||
/*
|
||||
* Console driver init
|
||||
*/
|
||||
|
||||
rtems_device_driver console_initialize(
|
||||
rtems_device_major_number, rtems_device_minor_number minor, void *);
|
||||
|
||||
#define CONSOLE_DRIVER_TABLE_ENTRY \
|
||||
{ console_initialize, NULL, NULL, NULL, NULL, NULL }
|
||||
|
||||
/*
|
||||
* NOTE: Use the standard Clock driver entry
|
||||
*/
|
||||
|
||||
/* functions */
|
||||
|
||||
void bsp_cleanup( void );
|
||||
|
||||
@@ -111,10 +111,13 @@ rtems_libio_init(void)
|
||||
rtems_libio_last_iop = rtems_libio_iops + (rtems_libio_number_iops - 1);
|
||||
}
|
||||
|
||||
rc = rtems_semaphore_create(RTEMS_LIBIO_SEM,
|
||||
rc = rtems_semaphore_create(
|
||||
RTEMS_LIBIO_SEM,
|
||||
1,
|
||||
RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||
&rtems_libio_semaphore);
|
||||
RTEMS_NO_PRIORITY,
|
||||
&rtems_libio_semaphore
|
||||
);
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
rtems_fatal_error_occurred(rc);
|
||||
}
|
||||
@@ -199,9 +202,13 @@ rtems_libio_allocate(void)
|
||||
* Got one; create a semaphore for it
|
||||
*/
|
||||
|
||||
rc = rtems_semaphore_create(RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops),
|
||||
1, RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||
&iop->sem);
|
||||
rc = rtems_semaphore_create(
|
||||
RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops),
|
||||
1,
|
||||
RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&iop->sem
|
||||
);
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
goto failed;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ void MY_task_set_note(
|
||||
unsigned32 note
|
||||
)
|
||||
{
|
||||
the_thread->Notepads[ notepad ] = note;
|
||||
the_thread->RTEMS_API->Notepads[ notepad ] = note;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ unsigned32 MY_task_get_note(
|
||||
unsigned32 notepad
|
||||
)
|
||||
{
|
||||
return the_thread->Notepads[ notepad ];
|
||||
return the_thread->RTEMS_API->Notepads[ notepad ];
|
||||
}
|
||||
|
||||
void *MY_CPU_Context_FP_start(
|
||||
|
||||
@@ -21,16 +21,16 @@ rtems_monitor_task_canonical(
|
||||
Thread_Control *rtems_thread = (Thread_Control *) thread_void;
|
||||
|
||||
canonical_task->entry = rtems_thread->Start.entry_point;
|
||||
canonical_task->argument = rtems_thread->Start.initial_argument;
|
||||
canonical_task->argument = rtems_thread->Start.numeric_argument;
|
||||
canonical_task->stack = rtems_thread->Start.Initial_stack.area;
|
||||
canonical_task->stack_size = rtems_thread->Start.Initial_stack.size;
|
||||
canonical_task->priority = rtems_thread->current_priority;
|
||||
canonical_task->state = rtems_thread->current_state;
|
||||
canonical_task->wait_id = rtems_thread->Wait.id;
|
||||
canonical_task->events = rtems_thread->pending_events;
|
||||
canonical_task->events = rtems_thread->RTEMS_API->pending_events;
|
||||
canonical_task->modes = rtems_thread->current_modes;
|
||||
canonical_task->attributes = rtems_thread->attribute_set;
|
||||
(void) memcpy(canonical_task->notepad, rtems_thread->Notepads, sizeof(canonical_task->notepad));
|
||||
canonical_task->attributes = 0 /* XXX FIX ME rtems_thread->RTEMS_API->attribute_set */;
|
||||
(void) memcpy(canonical_task->notepad, rtems_thread->RTEMS_API->Notepads, sizeof(canonical_task->notepad));
|
||||
(void) memcpy(&canonical_task->wait_args, &rtems_thread->Wait.Extra, sizeof(canonical_task->wait_args));
|
||||
}
|
||||
|
||||
|
||||
@@ -433,7 +433,7 @@ void Stack_check_Dump_usage( void )
|
||||
class_index++ ) {
|
||||
information = _Objects_Information_table[ class_index ];
|
||||
if ( information && information->is_thread ) {
|
||||
for ( i=1 ; i < information->maximum ; i++ ) {
|
||||
for ( i=1 ; i <= information->maximum ; i++ ) {
|
||||
the_thread = (Thread_Control *)information->local_table[ i ];
|
||||
Stack_check_Dump_threads_usage( the_thread );
|
||||
if ( the_thread == _Thread_Executing )
|
||||
|
||||
@@ -21,16 +21,16 @@ rtems_monitor_task_canonical(
|
||||
Thread_Control *rtems_thread = (Thread_Control *) thread_void;
|
||||
|
||||
canonical_task->entry = rtems_thread->Start.entry_point;
|
||||
canonical_task->argument = rtems_thread->Start.initial_argument;
|
||||
canonical_task->argument = rtems_thread->Start.numeric_argument;
|
||||
canonical_task->stack = rtems_thread->Start.Initial_stack.area;
|
||||
canonical_task->stack_size = rtems_thread->Start.Initial_stack.size;
|
||||
canonical_task->priority = rtems_thread->current_priority;
|
||||
canonical_task->state = rtems_thread->current_state;
|
||||
canonical_task->wait_id = rtems_thread->Wait.id;
|
||||
canonical_task->events = rtems_thread->pending_events;
|
||||
canonical_task->events = rtems_thread->RTEMS_API->pending_events;
|
||||
canonical_task->modes = rtems_thread->current_modes;
|
||||
canonical_task->attributes = rtems_thread->attribute_set;
|
||||
(void) memcpy(canonical_task->notepad, rtems_thread->Notepads, sizeof(canonical_task->notepad));
|
||||
canonical_task->attributes = 0 /* XXX FIX ME rtems_thread->RTEMS_API->attribute_set */;
|
||||
(void) memcpy(canonical_task->notepad, rtems_thread->RTEMS_API->Notepads, sizeof(canonical_task->notepad));
|
||||
(void) memcpy(&canonical_task->wait_args, &rtems_thread->Wait.Extra, sizeof(canonical_task->wait_args));
|
||||
}
|
||||
|
||||
|
||||
@@ -433,7 +433,7 @@ void Stack_check_Dump_usage( void )
|
||||
class_index++ ) {
|
||||
information = _Objects_Information_table[ class_index ];
|
||||
if ( information && information->is_thread ) {
|
||||
for ( i=1 ; i < information->maximum ; i++ ) {
|
||||
for ( i=1 ; i <= information->maximum ; i++ ) {
|
||||
the_thread = (Thread_Control *)information->local_table[ i ];
|
||||
Stack_check_Dump_threads_usage( the_thread );
|
||||
if ( the_thread == _Thread_Executing )
|
||||
|
||||
@@ -34,6 +34,7 @@ rtems_status_code rtems_semaphore_create(
|
||||
rtems_name name,
|
||||
unsigned32 count,
|
||||
rtems_attribute attribute_set,
|
||||
rtems_task_priority priority_ceiling,
|
||||
Objects_Id *id
|
||||
)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ rtems_status_code rtems_signal_catch(
|
||||
}
|
||||
|
||||
rtems_status_code rtems_signal_send(
|
||||
Objects_Id id,
|
||||
rtems_id id,
|
||||
rtems_signal_set signal_set
|
||||
)
|
||||
{
|
||||
|
||||
@@ -50,6 +50,7 @@ rtems_task Init(
|
||||
Semaphore_name[ 1 ],
|
||||
1,
|
||||
RTEMS_GLOBAL,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id[ 1 ]
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create" );
|
||||
|
||||
@@ -69,6 +69,7 @@ rtems_task Init(
|
||||
Semaphore_name[ 1 ],
|
||||
0,
|
||||
RTEMS_GLOBAL | RTEMS_PRIORITY,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id[ 1 ]
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create" );
|
||||
|
||||
@@ -85,6 +85,7 @@ rtems_task Init(
|
||||
Semaphore_name[ 1 ],
|
||||
1,
|
||||
RTEMS_GLOBAL,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&junk_id
|
||||
);
|
||||
fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_semaphore_create" );
|
||||
|
||||
@@ -62,6 +62,7 @@ rtems_task Init(
|
||||
Semaphore_name[ 1 ],
|
||||
1,
|
||||
RTEMS_GLOBAL | RTEMS_PRIORITY,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id[ 1 ]
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create" );
|
||||
|
||||
@@ -94,6 +94,7 @@ rtems_task Init(
|
||||
Semaphore_name[ 1 ],
|
||||
1,
|
||||
RTEMS_GLOBAL,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id[ 1 ]
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create" );
|
||||
|
||||
@@ -23,7 +23,13 @@ void Screen5()
|
||||
{
|
||||
rtems_status_code status;
|
||||
|
||||
status = rtems_semaphore_create( 0, 1, RTEMS_DEFAULT_ATTRIBUTES, &Junk_id );
|
||||
status = rtems_semaphore_create(
|
||||
0,
|
||||
1,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Junk_id
|
||||
);
|
||||
fatal_directive_status(
|
||||
status,
|
||||
RTEMS_INVALID_NAME,
|
||||
@@ -35,6 +41,7 @@ void Screen5()
|
||||
Semaphore_name[ 1 ],
|
||||
1,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id[ 1 ]
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create" );
|
||||
@@ -44,6 +51,7 @@ void Screen5()
|
||||
Semaphore_name[ 2 ],
|
||||
1,
|
||||
RTEMS_BINARY_SEMAPHORE,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id[ 2 ]
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create" );
|
||||
@@ -54,7 +62,9 @@ void Screen5()
|
||||
Semaphore_name[ 3 ],
|
||||
1,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
&Junk_id);
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Junk_id
|
||||
);
|
||||
} while (status == RTEMS_SUCCESSFUL);
|
||||
|
||||
fatal_directive_status(
|
||||
@@ -68,6 +78,7 @@ void Screen5()
|
||||
Semaphore_name[ 1 ],
|
||||
1,
|
||||
RTEMS_INHERIT_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_FIFO,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Junk_id
|
||||
);
|
||||
fatal_directive_status(
|
||||
@@ -81,6 +92,7 @@ void Screen5()
|
||||
Semaphore_name[ 1 ],
|
||||
1,
|
||||
RTEMS_INHERIT_PRIORITY | RTEMS_COUNTING_SEMAPHORE | RTEMS_PRIORITY,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Junk_id
|
||||
);
|
||||
fatal_directive_status(
|
||||
@@ -94,6 +106,7 @@ void Screen5()
|
||||
Semaphore_name[ 1 ],
|
||||
2,
|
||||
RTEMS_BINARY_SEMAPHORE,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Junk_id
|
||||
);
|
||||
fatal_directive_status(
|
||||
@@ -107,6 +120,7 @@ void Screen5()
|
||||
Semaphore_name[ 3 ],
|
||||
1,
|
||||
RTEMS_GLOBAL,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Junk_id
|
||||
);
|
||||
fatal_directive_status(
|
||||
|
||||
@@ -56,6 +56,7 @@ rtems_task Init(
|
||||
Semaphore_name[ 1 ],
|
||||
1,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id[ 1 ]
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create of SM1" );
|
||||
@@ -64,6 +65,7 @@ rtems_task Init(
|
||||
Semaphore_name[ 2 ],
|
||||
0,
|
||||
RTEMS_PRIORITY,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id[ 2 ]
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create of SM2" );
|
||||
@@ -72,6 +74,7 @@ rtems_task Init(
|
||||
Semaphore_name[ 3 ],
|
||||
1,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id[ 3 ]
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create of SM3" );
|
||||
@@ -94,6 +97,7 @@ pause();
|
||||
Semaphore_name[ 2 ],
|
||||
0,
|
||||
RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id[ 2 ]
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create of priority inherit SM2" );
|
||||
@@ -110,6 +114,7 @@ pause();
|
||||
Semaphore_name[ 2 ],
|
||||
1,
|
||||
RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id[ 2 ]
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create of priority inherit SM2" );
|
||||
@@ -125,6 +130,7 @@ pause();
|
||||
Semaphore_name[ 2 ],
|
||||
0,
|
||||
RTEMS_PRIORITY,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id[ 2 ]
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create of priority SM2" );
|
||||
|
||||
@@ -82,6 +82,7 @@ rtems_task Test_task(
|
||||
name,
|
||||
OPERATION_COUNT,
|
||||
RTEMS_DEFAULT_MODES,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&smid
|
||||
);
|
||||
end_time = Read_timer();
|
||||
@@ -110,6 +111,7 @@ rtems_task Test_task(
|
||||
name,
|
||||
OPERATION_COUNT,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&smid
|
||||
);
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@ void test_init()
|
||||
rtems_build_name( 'S', 'M', '1', ' '),
|
||||
0,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create of SM1" );
|
||||
|
||||
@@ -71,6 +71,7 @@ rtems_task test_init(
|
||||
rtems_build_name( 'S', 'M', '1', '\0'),
|
||||
0,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create of SM1" );
|
||||
|
||||
@@ -77,6 +77,7 @@ void test_init()
|
||||
rtems_build_name( 'S', 'M', '1', ' ' ),
|
||||
0,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create of SM1" );
|
||||
|
||||
@@ -82,6 +82,7 @@ rtems_task Task_1(
|
||||
index,
|
||||
OPERATION_COUNT,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&id
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create" );
|
||||
|
||||
@@ -41,6 +41,7 @@ rtems_task Init(
|
||||
rtems_build_name( 'S', 'M', '1', ' ') ,
|
||||
0,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create of SM1" );
|
||||
|
||||
@@ -141,6 +141,7 @@ rtems_task Init(
|
||||
rtems_build_name( 'S', 'E', 'M', '1' ),
|
||||
OPERATION_COUNT,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&Semaphore_id
|
||||
);
|
||||
directive_failed( status, "rtems_semaphore_create" );
|
||||
|
||||
@@ -172,8 +172,8 @@
|
||||
#define rtems_region_return_segment( rnid, segaddr ) \
|
||||
Empty_directive( rnid, segaddr )
|
||||
|
||||
#define rtems_semaphore_create( name, count, attr, smid ) \
|
||||
Empty_directive( name, count, attr, smid )
|
||||
#define rtems_semaphore_create( name, count, attr, priceil, smid ) \
|
||||
Empty_directive( name, count, attr, priceil, smid )
|
||||
#define rtems_semaphore_delete( smid ) \
|
||||
Empty_directive( smid )
|
||||
#define rtems_semaphore_ident( name, node, smid ) \
|
||||
|
||||
@@ -510,6 +510,7 @@ pause();
|
||||
name,
|
||||
128,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&id
|
||||
);
|
||||
end_time = Read_timer();
|
||||
|
||||
@@ -111,10 +111,13 @@ rtems_libio_init(void)
|
||||
rtems_libio_last_iop = rtems_libio_iops + (rtems_libio_number_iops - 1);
|
||||
}
|
||||
|
||||
rc = rtems_semaphore_create(RTEMS_LIBIO_SEM,
|
||||
rc = rtems_semaphore_create(
|
||||
RTEMS_LIBIO_SEM,
|
||||
1,
|
||||
RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||
&rtems_libio_semaphore);
|
||||
RTEMS_NO_PRIORITY,
|
||||
&rtems_libio_semaphore
|
||||
);
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
rtems_fatal_error_occurred(rc);
|
||||
}
|
||||
@@ -199,9 +202,13 @@ rtems_libio_allocate(void)
|
||||
* Got one; create a semaphore for it
|
||||
*/
|
||||
|
||||
rc = rtems_semaphore_create(RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops),
|
||||
1, RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||
&iop->sem);
|
||||
rc = rtems_semaphore_create(
|
||||
RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops),
|
||||
1,
|
||||
RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&iop->sem
|
||||
);
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
goto failed;
|
||||
|
||||
|
||||
@@ -21,16 +21,16 @@ rtems_monitor_task_canonical(
|
||||
Thread_Control *rtems_thread = (Thread_Control *) thread_void;
|
||||
|
||||
canonical_task->entry = rtems_thread->Start.entry_point;
|
||||
canonical_task->argument = rtems_thread->Start.initial_argument;
|
||||
canonical_task->argument = rtems_thread->Start.numeric_argument;
|
||||
canonical_task->stack = rtems_thread->Start.Initial_stack.area;
|
||||
canonical_task->stack_size = rtems_thread->Start.Initial_stack.size;
|
||||
canonical_task->priority = rtems_thread->current_priority;
|
||||
canonical_task->state = rtems_thread->current_state;
|
||||
canonical_task->wait_id = rtems_thread->Wait.id;
|
||||
canonical_task->events = rtems_thread->pending_events;
|
||||
canonical_task->events = rtems_thread->RTEMS_API->pending_events;
|
||||
canonical_task->modes = rtems_thread->current_modes;
|
||||
canonical_task->attributes = rtems_thread->attribute_set;
|
||||
(void) memcpy(canonical_task->notepad, rtems_thread->Notepads, sizeof(canonical_task->notepad));
|
||||
canonical_task->attributes = 0 /* XXX FIX ME rtems_thread->RTEMS_API->attribute_set */;
|
||||
(void) memcpy(canonical_task->notepad, rtems_thread->RTEMS_API->Notepads, sizeof(canonical_task->notepad));
|
||||
(void) memcpy(&canonical_task->wait_args, &rtems_thread->Wait.Extra, sizeof(canonical_task->wait_args));
|
||||
}
|
||||
|
||||
|
||||
@@ -433,7 +433,7 @@ void Stack_check_Dump_usage( void )
|
||||
class_index++ ) {
|
||||
information = _Objects_Information_table[ class_index ];
|
||||
if ( information && information->is_thread ) {
|
||||
for ( i=1 ; i < information->maximum ; i++ ) {
|
||||
for ( i=1 ; i <= information->maximum ; i++ ) {
|
||||
the_thread = (Thread_Control *)information->local_table[ i ];
|
||||
Stack_check_Dump_threads_usage( the_thread );
|
||||
if ( the_thread == _Thread_Executing )
|
||||
|
||||
@@ -55,7 +55,7 @@ typedef rtems_asr ( *rtems_asr_entry )(
|
||||
|
||||
typedef struct {
|
||||
rtems_asr_entry handler; /* address of RTEMS_ASR */
|
||||
rtems_mode mode_set; /* RTEMS_ASR mode */
|
||||
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 */
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -85,6 +85,7 @@ rtems_status_code rtems_semaphore_create(
|
||||
rtems_name name,
|
||||
unsigned32 count,
|
||||
rtems_attribute attribute_set,
|
||||
rtems_task_priority priority_ceiling,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user