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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [doc/] [porting/] [idlethread.t] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
@c
2
@c  COPYRIGHT (c) 1988-2002.
3
@c  On-Line Applications Research Corporation (OAR).
4
@c  All rights reserved.
5
@c
6
@c  idlethread.t,v 1.5 2002/01/17 21:47:45 joel Exp
7
@c
8
 
9
@chapter IDLE Thread
10
 
11
@section Does Idle Thread Have a Floating Point Context?
12
 
13
The setting of the macro CPU_IDLE_TASK_IS_FP is based on the answer to the
14
question:  Should the IDLE task have a floating point context?  If the
15
answer to this question is TRUE, then the IDLE task has a floating point
16
context associated.  This is equivalent to creating a task in the Classic
17
API (using rtems_task_create) as a RTEMS_FLOATING_POINT task.  If
18
CPU_IDLE_TASK_IS_FP is set to TRUE, then a floating point context switch
19
occurs when the IDLE task is switched in and out.  This adds to the
20
execution overhead of the system but is necessary on some ports.
21
 
22
If FALSE, then the IDLE task does not have a floating point context.
23
 
24
NOTE: Setting CPU_IDLE_TASK_IS_FP to TRUE negatively impacts the time
25
required to preempt the IDLE task from an interrupt because the floating
26
point context must be saved as part of the preemption.
27
 
28
The following illustrates how to set this macro:
29
 
30
@example
31
#define CPU_IDLE_TASK_IS_FP      FALSE
32
@end example
33
 
34
@section CPU Dependent Idle Thread Body
35
 
36
@subsection CPU_PROVIDES_IDLE_THREAD_BODY Macro Setting
37
 
38
The CPU_PROVIDES_IDLE_THREAD_BODY macro setting is based upon the answer
39
to the question:  Does this port provide a CPU dependent IDLE task
40
implementation?  If the answer to this question is yes, then the
41
CPU_PROVIDES_IDLE_THREAD_BODY macro should be set to TRUE, and the routine
42
_CPU_Thread_Idle_body must be provided.  This routine overrides the
43
default IDLE thread body of _Thread_Idle_body.  If the
44
CPU_PROVIDES_IDLE_THREAD_BODY macro is set to FALSE, then the generic
45
_Thread_Idle_body is the default IDLE thread body for this port.
46
Regardless of whether or not a CPU dependent IDLE thread implementation is
47
provided, the BSP can still override it.
48
 
49
This is intended to allow for supporting processors which have a low power
50
or idle mode.  When the IDLE thread is executed, then the CPU can be
51
powered down when the processor is idle.
52
 
53
The order of precedence for selecting the IDLE thread body is:
54
 
55
@enumerate
56
@item BSP provided
57
 
58
@item CPU dependent (if provided)
59
 
60
@item generic (if no BSP and no CPU dependent)
61
 
62
@end enumerate
63
 
64
The following illustrates setting the CPU_PROVIDES_IDLE_THREAD_BODY macro:
65
 
66
@example
67
#define CPU_PROVIDES_IDLE_THREAD_BODY    TRUE
68
@end example
69
 
70
Implementation details of a CPU model specific IDLE thread body are in the
71
next section.
72
 
73
@subsection Idle Thread Body
74
 
75
The _CPU_Thread_Idle_body routine only needs to be provided if the porter
76
wishes to include a CPU dependent IDLE thread body.  If the port includes
77
a CPU dependent implementation of the IDLE thread body, then the
78
CPU_PROVIDES_IDLE_THREAD_BODY macro should be defined to TRUE.  This
79
routine is prototyped as follows:
80
 
81
@example
82
void _CPU_Thread_Idle_body( void );
83
@end example
84
 
85
As mentioned above, RTEMS does not require that a CPU dependent IDLE
86
thread body be provided as part of the port.  If
87
CPU_PROVIDES_IDLE_THREAD_BODY is defined to FALSE, then the CPU
88
independent algorithm is used.  This algorithm consists of a "branch to
89
self" which is implemented in the XXX routine as follows.
90
 
91
@example
92
XXX check name and exact implementation
93
void _Thread_Idle_body( void )
94
@{
95
  while( 1 ) ;
96
@}
97
@end example
98
 
99
If the CPU dependent IDLE thread body is implementation centers upon using
100
a "halt", "idle", or "shutdown" instruction, then don't forget to put it
101
in an infinite loop as the CPU will have to reexecute this instruction
102
each time the IDLE thread is dispatched.
103
 
104
@example
105
void _CPU_Thread_Idle_body( void )
106
@{
107
 
108
  for( ; ; )
109
    /* insert your "halt" instruction here */ ;
110
@}
111
@end example
112
 
113
Be warned. Some processors with onboard DMA have been known to stop the
114
DMA if the CPU were put in IDLE mode.  This might also be a problem with
115
other on-chip peripherals.  So use this hook with caution.
116
 

powered by: WebSVN 2.1.0

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