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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [power-change.html] - Diff between revs 28 and 174

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 28 Rev 174
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
<!-- This material may be distributed only subject to the terms      -->
<!-- This material may be distributed only subject to the terms      -->
<!-- and conditions set forth in the Open Publication License, v1.0  -->
<!-- and conditions set forth in the Open Publication License, v1.0  -->
<!-- or later (the latest version is presently available at          -->
<!-- or later (the latest version is presently available at          -->
<!-- http://www.opencontent.org/openpub/).                           -->
<!-- http://www.opencontent.org/openpub/).                           -->
<!-- Distribution of the work or derivative of the work in any       -->
<!-- Distribution of the work or derivative of the work in any       -->
<!-- standard (paper) book form is prohibited unless prior           -->
<!-- standard (paper) book form is prohibited unless prior           -->
<!-- permission is obtained from the copyright holder.               -->
<!-- permission is obtained from the copyright holder.               -->
<HTML
<HTML
><HEAD
><HEAD
><TITLE
><TITLE
>Changing Power Modes</TITLE
>Changing Power Modes</TITLE
><meta name="MSSmartTagsPreventParsing" content="TRUE">
><meta name="MSSmartTagsPreventParsing" content="TRUE">
<META
<META
NAME="GENERATOR"
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
"><LINK
REL="HOME"
REL="HOME"
TITLE="eCos Reference Manual"
TITLE="eCos Reference Manual"
HREF="ecos-ref.html"><LINK
HREF="ecos-ref.html"><LINK
REL="UP"
REL="UP"
TITLE="eCos Power Management Support"
TITLE="eCos Power Management Support"
HREF="services-power.html"><LINK
HREF="services-power.html"><LINK
REL="PREVIOUS"
REL="PREVIOUS"
TITLE="Power Management Information"
TITLE="Power Management Information"
HREF="power-info.html"><LINK
HREF="power-info.html"><LINK
REL="NEXT"
REL="NEXT"
TITLE="Support for Policy Modules"
TITLE="Support for Policy Modules"
HREF="power-policy.html"></HEAD
HREF="power-policy.html"></HEAD
><BODY
><BODY
CLASS="REFENTRY"
CLASS="REFENTRY"
BGCOLOR="#FFFFFF"
BGCOLOR="#FFFFFF"
TEXT="#000000"
TEXT="#000000"
LINK="#0000FF"
LINK="#0000FF"
VLINK="#840084"
VLINK="#840084"
ALINK="#0000FF"
ALINK="#0000FF"
><DIV
><DIV
CLASS="NAVHEADER"
CLASS="NAVHEADER"
><TABLE
><TABLE
SUMMARY="Header navigation table"
SUMMARY="Header navigation table"
WIDTH="100%"
WIDTH="100%"
BORDER="0"
BORDER="0"
CELLPADDING="0"
CELLPADDING="0"
CELLSPACING="0"
CELLSPACING="0"
><TR
><TR
><TH
><TH
COLSPAN="3"
COLSPAN="3"
ALIGN="center"
ALIGN="center"
>eCos Reference Manual</TH
>eCos Reference Manual</TH
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="10%"
WIDTH="10%"
ALIGN="left"
ALIGN="left"
VALIGN="bottom"
VALIGN="bottom"
><A
><A
HREF="power-info.html"
HREF="power-info.html"
ACCESSKEY="P"
ACCESSKEY="P"
>Prev</A
>Prev</A
></TD
></TD
><TD
><TD
WIDTH="80%"
WIDTH="80%"
ALIGN="center"
ALIGN="center"
VALIGN="bottom"
VALIGN="bottom"
></TD
></TD
><TD
><TD
WIDTH="10%"
WIDTH="10%"
ALIGN="right"
ALIGN="right"
VALIGN="bottom"
VALIGN="bottom"
><A
><A
HREF="power-policy.html"
HREF="power-policy.html"
ACCESSKEY="N"
ACCESSKEY="N"
>Next</A
>Next</A
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><HR
><HR
ALIGN="LEFT"
ALIGN="LEFT"
WIDTH="100%"></DIV
WIDTH="100%"></DIV
><H1
><H1
><A
><A
NAME="POWER-CHANGE">Changing Power Modes</H1
NAME="POWER-CHANGE">Changing Power Modes</H1
><DIV
><DIV
CLASS="REFNAMEDIV"
CLASS="REFNAMEDIV"
><A
><A
NAME="AEN15752"
NAME="AEN15752"
></A
></A
><H2
><H2
>Name</H2
>Name</H2
>Changing Power Modes&nbsp;--&nbsp;reducing or increasing power consumption as needed</DIV
>Changing Power Modes&nbsp;--&nbsp;reducing or increasing power consumption as needed</DIV
><DIV
><DIV
CLASS="REFSYNOPSISDIV"
CLASS="REFSYNOPSISDIV"
><A
><A
NAME="AEN15755"><H2
NAME="AEN15755"><H2
>Synopsis</H2
>Synopsis</H2
><DIV
><DIV
CLASS="FUNCSYNOPSIS"
CLASS="FUNCSYNOPSIS"
><A
><A
NAME="AEN15756"><P
NAME="AEN15756"><P
></P
></P
><TABLE
><TABLE
BORDER="5"
BORDER="5"
BGCOLOR="#E0E0F0"
BGCOLOR="#E0E0F0"
WIDTH="70%"
WIDTH="70%"
><TR
><TR
><TD
><TD
><PRE
><PRE
CLASS="FUNCSYNOPSISINFO"
CLASS="FUNCSYNOPSISINFO"
>#include &lt;cyg/power/power.h&gt;</PRE
>#include &lt;cyg/power/power.h&gt;</PRE
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><P
><P
><CODE
><CODE
><CODE
><CODE
CLASS="FUNCDEF"
CLASS="FUNCDEF"
>    void power_set_mode
>    void power_set_mode
  </CODE
  </CODE
>(    PowerMode new_mode
>(    PowerMode new_mode
  );</CODE
  );</CODE
></P
></P
><P
><P
><CODE
><CODE
><CODE
><CODE
CLASS="FUNCDEF"
CLASS="FUNCDEF"
>    void power_set_controller_mode
>    void power_set_controller_mode
  </CODE
  </CODE
>(    PowerController* controller
>(    PowerController* controller
  ,     PowerMode new_mode
  ,     PowerMode new_mode
  );</CODE
  );</CODE
></P
></P
><P
><P
><CODE
><CODE
><CODE
><CODE
CLASS="FUNCDEF"
CLASS="FUNCDEF"
>    void power_set_controller_mode_now
>    void power_set_controller_mode_now
  </CODE
  </CODE
>(    PowerController* controller
>(    PowerController* controller
  ,     PowerMode new_mode
  ,     PowerMode new_mode
  );</CODE
  );</CODE
></P
></P
><P
><P
></P
></P
></DIV
></DIV
></DIV
></DIV
><DIV
><DIV
CLASS="REFSECT1"
CLASS="REFSECT1"
><A
><A
NAME="POWER-CHANGE-GLOBAL"
NAME="POWER-CHANGE-GLOBAL"
></A
></A
><H2
><H2
>Changing the Global Power Mode</H2
>Changing the Global Power Mode</H2
><P
><P
>The primary functionality supported by the power management package is
>The primary functionality supported by the power management package is
to change the system's global power mode. This is achieved by calling
to change the system's global power mode. This is achieved by calling
the function <TT
the function <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
> with a single
> with a single
argument, which should be one of <TT
argument, which should be one of <TT
CLASS="LITERAL"
CLASS="LITERAL"
>PowerMode_Active</TT
>PowerMode_Active</TT
>,
>,
<TT
<TT
CLASS="LITERAL"
CLASS="LITERAL"
>PowerMode_Idle</TT
>PowerMode_Idle</TT
>, <TT
>, <TT
CLASS="LITERAL"
CLASS="LITERAL"
>PowerMode_Sleep</TT
>PowerMode_Sleep</TT
>
>
or <TT
or <TT
CLASS="LITERAL"
CLASS="LITERAL"
>PowerMode_Off</TT
>PowerMode_Off</TT
>. Typically this function will only
>. Typically this function will only
be invoked in certain scenarios:</P
be invoked in certain scenarios:</P
><P
><P
></P
></P
><OL
><OL
TYPE="1"
TYPE="1"
><LI
><LI
><P
><P
>A typical system will contain a policy module which is primarily
>A typical system will contain a policy module which is primarily
responsible for initiating power mode changes, and a thread inside the
responsible for initiating power mode changes, and a thread inside the
power management package. The policy module will call
power management package. The policy module will call
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
>, which has the effect of
>, which has the effect of
manipulating some internal state in the power management package and
manipulating some internal state in the power management package and
waking up its thread. When this thread gets scheduled to run (its
waking up its thread. When this thread gets scheduled to run (its
priority is controlled by a configuration option), it will iterate
priority is controlled by a configuration option), it will iterate
over the power controllers and invoke each controller to change its
over the power controllers and invoke each controller to change its
power mode. There is support for a <A
power mode. There is support for a <A
HREF="power-policy.html#POWER-POLICY-CALLBACK"
HREF="power-policy.html#POWER-POLICY-CALLBACK"
>callback function</A
>callback function</A
>, and for
>, and for
<A
<A
HREF="power-attached.html"
HREF="power-attached.html"
>detached</A
>detached</A
> power controllers.</P
> power controllers.</P
></LI
></LI
><LI
><LI
><P
><P
>After a call to <TT
>After a call to <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
> but before the
> but before the
power management thread has had a chance to iterate over all the
power management thread has had a chance to iterate over all the
controllers, or even before the thread has been rescheduled at all,
controllers, or even before the thread has been rescheduled at all,
the policy module may decide that a different power mode would be more
the policy module may decide that a different power mode would be more
appropriate for the current situation and calls
appropriate for the current situation and calls
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
> again. This has the effect of
> again. This has the effect of
aborting the previous mode change, followed by the power management
aborting the previous mode change, followed by the power management
thread iterating over the power controllers again for the new mode.</P
thread iterating over the power controllers again for the new mode.</P
></LI
></LI
><LI
><LI
><P
><P
>If there is no single policy module responsible for power mode
>If there is no single policy module responsible for power mode
changes, any code can call <TT
changes, any code can call <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
>. If
>. If
there are multiple calls in quick succession, earlier calls will
there are multiple calls in quick succession, earlier calls will
be aborted and the system should end up in the power mode
be aborted and the system should end up in the power mode
corresponding to the last call</P
corresponding to the last call</P
></LI
></LI
><LI
><LI
><P
><P
>As a special case, it is possible for a power controller to call
>As a special case, it is possible for a power controller to call
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
> when invoked by the power
> when invoked by the power
management thread. For example a power controller could decide that it
management thread. For example a power controller could decide that it
is inappropriate for the system to go to sleep because the device it
is inappropriate for the system to go to sleep because the device it
is associated with is still busy. The effect is as if the policy
is associated with is still busy. The effect is as if the policy
module had called <TT
module had called <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
> again before
> again before
the mode change had completed.</P
the mode change had completed.</P
></LI
></LI
></OL
></OL
><P
><P
>If the power management package has been configured not to use a
>If the power management package has been configured not to use a
separate thread then obviously the behaviour is somewhat different.
separate thread then obviously the behaviour is somewhat different.
The call to <TT
The call to <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
> will now iterate over
> will now iterate over
the various power controllers immediately, rather than leaving this to
the various power controllers immediately, rather than leaving this to
a separate thread, and the whole mode change completes before
a separate thread, and the whole mode change completes before
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
> returns. If some other thread or a
> returns. If some other thread or a
DSR calls <TT
DSR calls <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
> concurrently the
> concurrently the
behaviour of the system is undefined. However, it is still legal for a
behaviour of the system is undefined. However, it is still legal for a
power controller to call <TT
power controller to call <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
>:
>:
effectively this is a recursive call; it is detected by the system,
effectively this is a recursive call; it is detected by the system,
and internal state is updated; the recursive
and internal state is updated; the recursive
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
> call now returns, and when the
> call now returns, and when the
power controller returns back to the original
power controller returns back to the original
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
> call it detects what has happened,
> call it detects what has happened,
aborts the previous mode change, and starts a new mode change as
aborts the previous mode change, and starts a new mode change as
requested by the controller.</P
requested by the controller.</P
><P
><P
><TT
><TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
> is normally invoked from thread
> is normally invoked from thread
context. If a separate power management thread is used it can be
context. If a separate power management thread is used it can be
invoked safely from DSR context. If the system is configured not to
invoked safely from DSR context. If the system is configured not to
use such a thread, it may or may not be safe to invoke this function
use such a thread, it may or may not be safe to invoke this function
from DSR context: essentially the function just iterates through
from DSR context: essentially the function just iterates through
the various power controllers, and the documentation or source code of
the various power controllers, and the documentation or source code of
each controller present in the current system will have to be examined
each controller present in the current system will have to be examined
to determine whether or not this can happen safely in DSR context.
to determine whether or not this can happen safely in DSR context.
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
> should never be invoked from
> should never be invoked from
ISR context.</P
ISR context.</P
></DIV
></DIV
><DIV
><DIV
CLASS="REFSECT1"
CLASS="REFSECT1"
><A
><A
NAME="POWER-CHANGE-CONTROLLER"
NAME="POWER-CHANGE-CONTROLLER"
></A
></A
><H2
><H2
>Manipulating an Individual Power Controller</H2
>Manipulating an Individual Power Controller</H2
><P
><P
>In some cases it is desirable to set the power mode of an individual
>In some cases it is desirable to set the power mode of an individual
controller separately from the mode for the system as a whole. For
controller separately from the mode for the system as a whole. For
example if a device is not currently being used then the associated
example if a device is not currently being used then the associated
power controller could be set to <TT
power controller could be set to <TT
CLASS="LITERAL"
CLASS="LITERAL"
>PowerMode_Off</TT
>PowerMode_Off</TT
>,
>,
even while the system as a whole is still active. This can be achieved
even while the system as a whole is still active. This can be achieved
by calling the function
by calling the function
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_controller_mode</TT
>power_set_controller_mode</TT
>. It takes two
>. It takes two
arguments: the first identifies a particular controller; the second
arguments: the first identifies a particular controller; the second
specifies the desired new power mode for that controller. The function
specifies the desired new power mode for that controller. The function
operates in much the same way as <TT
operates in much the same way as <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
>,
>,
for example if a separate power management thread is being used then
for example if a separate power management thread is being used then
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_controller_mode</TT
>power_set_controller_mode</TT
> operates by
> operates by
manipulating some internal state and waking up that thread. The
manipulating some internal state and waking up that thread. The
limitations are also much the same as for
limitations are also much the same as for
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_mode</TT
>power_set_mode</TT
>, so for example
>, so for example
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_controller_mode</TT
>power_set_controller_mode</TT
> should not be invoked
> should not be invoked
from inside ISRs.</P
from inside ISRs.</P
><P
><P
>Manipulating individual controllers is often used in conjunction with
>Manipulating individual controllers is often used in conjunction with
the function <A
the function <A
HREF="power-attached.html"
HREF="power-attached.html"
><TT
><TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_controller_attached</TT
>power_set_controller_attached</TT
></A
></A
>,
>,
allowing the policy module to specify which controllers are affected
allowing the policy module to specify which controllers are affected
by global mode changes.</P
by global mode changes.</P
></DIV
></DIV
><DIV
><DIV
CLASS="REFSECT1"
CLASS="REFSECT1"
><A
><A
NAME="POWER-CHANGE-CONTROLLER-NOW"
NAME="POWER-CHANGE-CONTROLLER-NOW"
></A
></A
><H2
><H2
>Direct Manipulation of a Power Controller</H2
>Direct Manipulation of a Power Controller</H2
><P
><P
>In exceptional circumstances it may be necessary to invoke a power
>In exceptional circumstances it may be necessary to invoke a power
controller directly, bypassing the power management thread and
controller directly, bypassing the power management thread and
higher-level functionality such as <A
higher-level functionality such as <A
HREF="power-policy.html#POWER-POLICY-CALLBACK"
HREF="power-policy.html#POWER-POLICY-CALLBACK"
>callback functions</A
>callback functions</A
>. The
>. The
function <TT
function <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_controller_mode_now</TT
>power_set_controller_mode_now</TT
> allows
> allows
this. It takes two arguments, a controller and a mode, just like
this. It takes two arguments, a controller and a mode, just like
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_controller_mode</TT
>power_set_controller_mode</TT
>.</P
>.</P
><P
><P
>Use of <TT
>Use of <TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>power_set_controller_mode_now</TT
>power_set_controller_mode_now</TT
> is
> is
dangerous. For example no attempt is made to synchronise with any
dangerous. For example no attempt is made to synchronise with any
other power mode changes that might be happening concurrently. A
other power mode changes that might be happening concurrently. A
possible use is when the system gets woken up out of
possible use is when the system gets woken up out of
<SPAN
<SPAN
CLASS="TYPE"
CLASS="TYPE"
>sleep</SPAN
>sleep</SPAN
> mode: depending on the hardware, on which power
> mode: depending on the hardware, on which power
controllers are present, and on the application code it may be
controllers are present, and on the application code it may be
necessary to wake up some power controllers immediately before the
necessary to wake up some power controllers immediately before the
system as a whole is ready to run again.</P
system as a whole is ready to run again.</P
></DIV
></DIV
><DIV
><DIV
CLASS="NAVFOOTER"
CLASS="NAVFOOTER"
><HR
><HR
ALIGN="LEFT"
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
SUMMARY="Footer navigation table"
WIDTH="100%"
WIDTH="100%"
BORDER="0"
BORDER="0"
CELLPADDING="0"
CELLPADDING="0"
CELLSPACING="0"
CELLSPACING="0"
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="left"
ALIGN="left"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="power-info.html"
HREF="power-info.html"
ACCESSKEY="P"
ACCESSKEY="P"
>Prev</A
>Prev</A
></TD
></TD
><TD
><TD
WIDTH="34%"
WIDTH="34%"
ALIGN="center"
ALIGN="center"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="ecos-ref.html"
HREF="ecos-ref.html"
ACCESSKEY="H"
ACCESSKEY="H"
>Home</A
>Home</A
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="right"
ALIGN="right"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="power-policy.html"
HREF="power-policy.html"
ACCESSKEY="N"
ACCESSKEY="N"
>Next</A
>Next</A
></TD
></TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="left"
ALIGN="left"
VALIGN="top"
VALIGN="top"
>Power Management Information</TD
>Power Management Information</TD
><TD
><TD
WIDTH="34%"
WIDTH="34%"
ALIGN="center"
ALIGN="center"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="services-power.html"
HREF="services-power.html"
ACCESSKEY="U"
ACCESSKEY="U"
>Up</A
>Up</A
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="right"
ALIGN="right"
VALIGN="top"
VALIGN="top"
>Support for Policy Modules</TD
>Support for Policy Modules</TD
></TR
></TR
></TABLE
></TABLE
></DIV
></DIV
></BODY
></BODY
></HTML
></HTML
 
 

powered by: WebSVN 2.1.0

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