OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [doc/] [porting/] [idlethread.t] - Diff between revs 1026 and 1765

Only display areas with differences | Details | Blame | View Log

Rev 1026 Rev 1765
@c
@c
@c  COPYRIGHT (c) 1988-2002.
@c  COPYRIGHT (c) 1988-2002.
@c  On-Line Applications Research Corporation (OAR).
@c  On-Line Applications Research Corporation (OAR).
@c  All rights reserved.
@c  All rights reserved.
@c
@c
@c  idlethread.t,v 1.5 2002/01/17 21:47:45 joel Exp
@c  idlethread.t,v 1.5 2002/01/17 21:47:45 joel Exp
@c
@c
@chapter IDLE Thread
@chapter IDLE Thread
@section Does Idle Thread Have a Floating Point Context?
@section Does Idle Thread Have a Floating Point Context?
The setting of the macro CPU_IDLE_TASK_IS_FP is based on the answer to the
The setting of the macro CPU_IDLE_TASK_IS_FP is based on the answer to the
question:  Should the IDLE task have a floating point context?  If the
question:  Should the IDLE task have a floating point context?  If the
answer to this question is TRUE, then the IDLE task has a floating point
answer to this question is TRUE, then the IDLE task has a floating point
context associated.  This is equivalent to creating a task in the Classic
context associated.  This is equivalent to creating a task in the Classic
API (using rtems_task_create) as a RTEMS_FLOATING_POINT task.  If
API (using rtems_task_create) as a RTEMS_FLOATING_POINT task.  If
CPU_IDLE_TASK_IS_FP is set to TRUE, then a floating point context switch
CPU_IDLE_TASK_IS_FP is set to TRUE, then a floating point context switch
occurs when the IDLE task is switched in and out.  This adds to the
occurs when the IDLE task is switched in and out.  This adds to the
execution overhead of the system but is necessary on some ports.
execution overhead of the system but is necessary on some ports.
If FALSE, then the IDLE task does not have a floating point context.
If FALSE, then the IDLE task does not have a floating point context.
NOTE: Setting CPU_IDLE_TASK_IS_FP to TRUE negatively impacts the time
NOTE: Setting CPU_IDLE_TASK_IS_FP to TRUE negatively impacts the time
required to preempt the IDLE task from an interrupt because the floating
required to preempt the IDLE task from an interrupt because the floating
point context must be saved as part of the preemption.
point context must be saved as part of the preemption.
The following illustrates how to set this macro:
The following illustrates how to set this macro:
@example
@example
#define CPU_IDLE_TASK_IS_FP      FALSE
#define CPU_IDLE_TASK_IS_FP      FALSE
@end example
@end example
@section CPU Dependent Idle Thread Body
@section CPU Dependent Idle Thread Body
@subsection CPU_PROVIDES_IDLE_THREAD_BODY Macro Setting
@subsection CPU_PROVIDES_IDLE_THREAD_BODY Macro Setting
The CPU_PROVIDES_IDLE_THREAD_BODY macro setting is based upon the answer
The CPU_PROVIDES_IDLE_THREAD_BODY macro setting is based upon the answer
to the question:  Does this port provide a CPU dependent IDLE task
to the question:  Does this port provide a CPU dependent IDLE task
implementation?  If the answer to this question is yes, then the
implementation?  If the answer to this question is yes, then the
CPU_PROVIDES_IDLE_THREAD_BODY macro should be set to TRUE, and the routine
CPU_PROVIDES_IDLE_THREAD_BODY macro should be set to TRUE, and the routine
_CPU_Thread_Idle_body must be provided.  This routine overrides the
_CPU_Thread_Idle_body must be provided.  This routine overrides the
default IDLE thread body of _Thread_Idle_body.  If the
default IDLE thread body of _Thread_Idle_body.  If the
CPU_PROVIDES_IDLE_THREAD_BODY macro is set to FALSE, then the generic
CPU_PROVIDES_IDLE_THREAD_BODY macro is set to FALSE, then the generic
_Thread_Idle_body is the default IDLE thread body for this port.
_Thread_Idle_body is the default IDLE thread body for this port.
Regardless of whether or not a CPU dependent IDLE thread implementation is
Regardless of whether or not a CPU dependent IDLE thread implementation is
provided, the BSP can still override it.
provided, the BSP can still override it.
This is intended to allow for supporting processors which have a low power
This is intended to allow for supporting processors which have a low power
or idle mode.  When the IDLE thread is executed, then the CPU can be
or idle mode.  When the IDLE thread is executed, then the CPU can be
powered down when the processor is idle.
powered down when the processor is idle.
The order of precedence for selecting the IDLE thread body is:
The order of precedence for selecting the IDLE thread body is:
@enumerate
@enumerate
@item BSP provided
@item BSP provided
@item CPU dependent (if provided)
@item CPU dependent (if provided)
@item generic (if no BSP and no CPU dependent)
@item generic (if no BSP and no CPU dependent)
@end enumerate
@end enumerate
The following illustrates setting the CPU_PROVIDES_IDLE_THREAD_BODY macro:
The following illustrates setting the CPU_PROVIDES_IDLE_THREAD_BODY macro:
@example
@example
#define CPU_PROVIDES_IDLE_THREAD_BODY    TRUE
#define CPU_PROVIDES_IDLE_THREAD_BODY    TRUE
@end example
@end example
Implementation details of a CPU model specific IDLE thread body are in the
Implementation details of a CPU model specific IDLE thread body are in the
next section.
next section.
@subsection Idle Thread Body
@subsection Idle Thread Body
The _CPU_Thread_Idle_body routine only needs to be provided if the porter
The _CPU_Thread_Idle_body routine only needs to be provided if the porter
wishes to include a CPU dependent IDLE thread body.  If the port includes
wishes to include a CPU dependent IDLE thread body.  If the port includes
a CPU dependent implementation of the IDLE thread body, then the
a CPU dependent implementation of the IDLE thread body, then the
CPU_PROVIDES_IDLE_THREAD_BODY macro should be defined to TRUE.  This
CPU_PROVIDES_IDLE_THREAD_BODY macro should be defined to TRUE.  This
routine is prototyped as follows:
routine is prototyped as follows:
@example
@example
void _CPU_Thread_Idle_body( void );
void _CPU_Thread_Idle_body( void );
@end example
@end example
As mentioned above, RTEMS does not require that a CPU dependent IDLE
As mentioned above, RTEMS does not require that a CPU dependent IDLE
thread body be provided as part of the port.  If
thread body be provided as part of the port.  If
CPU_PROVIDES_IDLE_THREAD_BODY is defined to FALSE, then the CPU
CPU_PROVIDES_IDLE_THREAD_BODY is defined to FALSE, then the CPU
independent algorithm is used.  This algorithm consists of a "branch to
independent algorithm is used.  This algorithm consists of a "branch to
self" which is implemented in the XXX routine as follows.
self" which is implemented in the XXX routine as follows.
@example
@example
XXX check name and exact implementation
XXX check name and exact implementation
void _Thread_Idle_body( void )
void _Thread_Idle_body( void )
@{
@{
  while( 1 ) ;
  while( 1 ) ;
@}
@}
@end example
@end example
If the CPU dependent IDLE thread body is implementation centers upon using
If the CPU dependent IDLE thread body is implementation centers upon using
a "halt", "idle", or "shutdown" instruction, then don't forget to put it
a "halt", "idle", or "shutdown" instruction, then don't forget to put it
in an infinite loop as the CPU will have to reexecute this instruction
in an infinite loop as the CPU will have to reexecute this instruction
each time the IDLE thread is dispatched.
each time the IDLE thread is dispatched.
@example
@example
void _CPU_Thread_Idle_body( void )
void _CPU_Thread_Idle_body( void )
@{
@{
  for( ; ; )
  for( ; ; )
    /* insert your "halt" instruction here */ ;
    /* insert your "halt" instruction here */ ;
@}
@}
@end example
@end example
Be warned. Some processors with onboard DMA have been known to stop the
Be warned. Some processors with onboard DMA have been known to stop the
DMA if the CPU were put in IDLE mode.  This might also be a problem with
DMA if the CPU were put in IDLE mode.  This might also be a problem with
other on-chip peripherals.  So use this hook with caution.
other on-chip peripherals.  So use this hook with caution.
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.