diff options
Diffstat (limited to 'docs/RTOS/html/lowPower.html')
-rw-r--r-- | docs/RTOS/html/lowPower.html | 204 |
1 files changed, 204 insertions, 0 deletions
diff --git a/docs/RTOS/html/lowPower.html b/docs/RTOS/html/lowPower.html new file mode 100644 index 0000000..0434c98 --- /dev/null +++ b/docs/RTOS/html/lowPower.html @@ -0,0 +1,204 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<title>Configuration for Low-Power Modes</title> +<title>CMSIS-RTOS: Configuration for Low-Power Modes</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<link href="cmsis.css" rel="stylesheet" type="text/css" /> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<script type="text/javascript" src="printComponentTabs.js"></script> +<link href="navtree.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="resize.js"></script> +<script type="text/javascript" src="navtree.js"></script> +<script type="text/javascript"> + $(document).ready(initResizable); + $(window).load(resizeHeight); +</script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/search.js"></script> +<script type="text/javascript"> + $(document).ready(function() { searchBox.OnSelectItem(0); }); +</script> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 46px;"> + <td id="projectlogo"><img alt="Logo" src="CMSIS_Logo_Final.png"/></td> + <td style="padding-left: 0.5em;"> + <div id="projectname">CMSIS-RTOS +  <span id="projectnumber">Version 1.03</span> + </div> + <div id="projectbrief">Real-Time Operating System: API and RTX Reference Implementation.</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<div id="CMSISnav" class="tabs1"> + <ul class="tablist"> + <script type="text/javascript"> + <!-- + writeComponentTabs.call(this); + //--> + </script> + </ul> +</div> +<!-- Generated by Doxygen 1.8.6 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> + <div id="navrow1" class="tabs"> + <ul class="tablist"> + <li><a href="index.html"><span>Main Page</span></a></li> + <li class="current"><a href="pages.html"><span>Usage and Description</span></a></li> + <li><a href="modules.html"><span>Reference</span></a></li> + <li> + <div id="MSearchBox" class="MSearchBoxInactive"> + <span class="left"> + <img id="MSearchSelect" src="search/mag_sel.png" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + alt=""/> + <input type="text" id="MSearchField" value="Search" accesskey="S" + onfocus="searchBox.OnSearchFieldFocus(true)" + onblur="searchBox.OnSearchFieldFocus(false)" + onkeyup="searchBox.OnSearchFieldChange(event)"/> + </span><span class="right"> + <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> + </span> + </div> + </li> + </ul> + </div> +</div><!-- top --> +<div id="side-nav" class="ui-resizable side-nav-resizable"> + <div id="nav-tree"> + <div id="nav-tree-contents"> + <div id="nav-sync" class="sync"></div> + </div> + </div> + <div id="splitbar" style="-moz-user-select:none;" + class="ui-resizable-handle"> + </div> +</div> +<script type="text/javascript"> +$(document).ready(function(){initNavTree('lowPower.html','');}); +</script> +<div id="doc-content"> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Pages</a></div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="header"> + <div class="headertitle"> +<div class="title">Configuration for Low-Power Modes </div> </div> +</div><!--header--> +<div class="contents"> +<div class="textblock"><p>The system thread <b>os_idle_demon</b> can be use to switch the system into a low-power mode. The easiest form to enter a low-power mode is the execution of the <code>__WFE</code> function that puts the processor into a sleep mode where it waits for an event.</p> +<p><b>Configuration Example:</b></p> +<div class="fragment"><div class="line"><span class="preprocessor">#include "device.h"</span> <span class="comment">/* Device definitions */</span></div> +<div class="line"> </div> +<div class="line"><span class="keywordtype">void</span> <a class="code" href="group__RTX__Global__Functions.html#gafb4dc4d3dff8343a393726d2860282e4">os_idle_demon</a> (<span class="keywordtype">void</span>) {</div> +<div class="line"> <span class="comment">/* The idle demon is a system thread, running when no other thread is */</span></div> +<div class="line"> <span class="comment">/* ready to run. */</span></div> +<div class="line"> </div> +<div class="line"> <span class="keywordflow">for</span> (;;) {</div> +<div class="line"> __WFE(); <span class="comment">/* Enter sleep mode */</span></div> +<div class="line"> }</div> +<div class="line">}</div> +</div><!-- fragment --><dl class="section note"><dt>Note</dt><dd><code>__WFE()</code> is not available at every Cortex-M implementation. Check device manuals for availability.</dd></dl> +<h1><a class="anchor" id="TickLess"></a> +Tick-less operation</h1> +<p>CMSIS-RTOS RTX provides extension for tick-less operation which is useful for applications that use extensively low-power modes where the SysTick timer is also disabled. To provide a time-tick in such power-saving modes a wake-up timer is used to derive timer intervals. The RTX functions <a class="el" href="group__RTX__Global__Functions.html#ga3e9c57746ccbdfe90464ad50513c569e">os_suspend</a> and <a class="el" href="group__RTX__Global__Functions.html#ga1b85a217d43e6b971ffcf24f8aae1c33">os_resume</a> control the tick-less operation.</p> +<p>Using this functions allows the RTX thread scheduler to stop the periodic kernel tick interrupt. When all active threads are suspended, the system enters power-down and calculates how long it can stay in this power-down mode. In the power-down mode the processor and potentially peripherals can be switched off. Only a wake-up timer must remain powered, because this timer is responsible to wake-up the system after the power-down period expires.</p> +<p>The tick-less operation is controlled from the <a class="el" href="group__RTX__Global__Functions.html#gafb4dc4d3dff8343a393726d2860282e4">os_idle_demon</a> thread. The wake-up timeout value is set before the system enters the power-down mode. The function <a class="el" href="group__RTX__Global__Functions.html#ga3e9c57746ccbdfe90464ad50513c569e">os_suspend</a> calculates the wake-up timeout measured in RTX Timer Ticks; this value is used to setup the wake-up timer that runs during the power-down mode of the system.</p> +<p>Once the system resumes operation (either by a wake-up time out or other interrupts) the RTX thread scheduler is started with the function <a class="el" href="group__RTX__Global__Functions.html#ga1b85a217d43e6b971ffcf24f8aae1c33">os_resume</a>. The parameter <em>sleep_time</em> specifies the time (in RTX Timer Ticks) that the system was in power-down mode.</p> +<p><b>Code</b> <b>Example</b> </p> +<div class="fragment"><div class="line"><span class="preprocessor">#include "LPC11Uxx.h"</span> <span class="comment">/* LPC11Uxx definitions */</span></div> +<div class="line"> </div> +<div class="line"><span class="keywordtype">void</span> <a class="code" href="group__RTX__Global__Functions.html#gafb4dc4d3dff8343a393726d2860282e4">os_idle_demon</a> (<span class="keywordtype">void</span>) {</div> +<div class="line"> <span class="comment">/* The idle demon is a system thread, running when no other thread is */</span></div> +<div class="line"> <span class="comment">/* ready to run. */</span></div> +<div class="line"> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sleep;</div> +<div class="line"> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> tc;</div> +<div class="line"> </div> +<div class="line"> LPC_SYSCON->SYSAHBCLKCTRL |= (1UL << 15) | <span class="comment">/* Enable clock for WWDT */</span></div> +<div class="line"> (1UL << 19); <span class="comment">/* Enable clock for Pin IRQ */</span></div> +<div class="line"> </div> +<div class="line"> LPC_SYSCON->PINTSEL[0] = 1; <span class="comment">/* P0.1 selected as INT0 IRQ */</span></div> +<div class="line"> LPC_SYSCON->STARTERP0 |= (1UL << 0); <span class="comment">/* Enable INT0 wake-up */</span></div> +<div class="line"> LPC_SYSCON->STARTERP1 |= (1UL << 12); <span class="comment">/* Enable WWDT wake-up */</span></div> +<div class="line"> </div> +<div class="line"> LPC_SYSCON->WDTOSCCTRL = (3 << 0) | <span class="comment">/* WDOSC DIVSEL=3 */</span></div> +<div class="line"> (2 << 5); <span class="comment">/* WDOSC FREQ=0.8MHz */</span></div> +<div class="line"> LPC_SYSCON->PDRUNCFG &= ~(1UL << 6); <span class="comment">/* Power-up WDT Oscillator */</span></div> +<div class="line"> LPC_SYSCON->PDSLEEPCFG &= ~(1UL << 6); <span class="comment">/* Power WDT Oscillator in PD */</span></div> +<div class="line"> </div> +<div class="line"> LPC_WWDT->CLKSEL = (1UL << 0) | <span class="comment">/* Select WDOSC as Clock */</span></div> +<div class="line"> (1UL << 31); <span class="comment">/* Lock selection */</span></div> +<div class="line"> LPC_WWDT->WARNINT = 1000; <span class="comment">/* WDT Warning IRQ value */</span></div> +<div class="line"> LPC_WWDT->MOD = (1UL << 0); <span class="comment">/* Enable WDT */</span></div> +<div class="line"> </div> +<div class="line"> NVIC_EnableIRQ(FLEX_INT0_IRQn); <span class="comment">/* Enable INT0 IRQ (wake-up) */</span></div> +<div class="line"> NVIC_EnableIRQ(WDT_IRQn); <span class="comment">/* Enable WWDT IRQ (wake-up) */</span></div> +<div class="line"> </div> +<div class="line"> <span class="keywordflow">for</span> (;;) {</div> +<div class="line"> <span class="comment">/* HERE: include optional user code to be executed when no task runs.*/</span></div> +<div class="line"> sleep = <a class="code" href="group__RTX__Global__Functions.html#ga3e9c57746ccbdfe90464ad50513c569e">os_suspend</a>(); <span class="comment">/* Suspend RTX thread scheduler */</span></div> +<div class="line"> </div> +<div class="line"> <span class="keywordflow">if</span> (sleep) { <span class="comment">/* How long can we sleep? */</span></div> +<div class="line"> <span class="comment">/* "sleep" is in RTX Timer Ticks which is 10ms in this configuration */</span></div> +<div class="line"> </div> +<div class="line"> <span class="comment">/* Setup WDT wake-up: WDT ticks @25kHz (FREQ/2/(DIVSEL+1)/4) */</span></div> +<div class="line"> tc = (sleep * 250) + 1000;</div> +<div class="line"> LPC_WWDT->TC = tc;</div> +<div class="line"> LPC_WWDT->FEED = 0xAA;</div> +<div class="line"> LPC_WWDT->FEED = 0x55;</div> +<div class="line"> </div> +<div class="line"> <span class="comment">/* Enter Power-down mode */</span></div> +<div class="line"> LPC_SYSCON->PDAWAKECFG = LPC_SYSCON->PDRUNCFG; <span class="comment">/* Power after wake-up */</span></div> +<div class="line"> LPC_PMU->PCON = 0x02; <span class="comment">/* Select Power-down mode */</span></div> +<div class="line"> SCB->SCR = (1UL << 2); <span class="comment">/* Set SLEEPDEEP */</span></div> +<div class="line"> __WFE(); <span class="comment">/* Enter Power-down mode */</span></div> +<div class="line"> </div> +<div class="line"> <span class="comment">/* After Wake-up */</span></div> +<div class="line"> sleep = (tc - LPC_WWDT->TV) / 250;</div> +<div class="line"> }</div> +<div class="line"> </div> +<div class="line"> <a class="code" href="group__RTX__Global__Functions.html#ga1b85a217d43e6b971ffcf24f8aae1c33">os_resume</a>(sleep); <span class="comment">/* Resume RTX thread scheduler */</span></div> +<div class="line"> }</div> +<div class="line">}</div> +</div><!-- fragment --><dl class="section note"><dt>Note</dt><dd><code>__WFE()</code> is not available at every Cortex-M implementation. Check device manuals for availability. </dd></dl> +</div></div><!-- contents --> +</div><!-- doc-content --> +<!-- start footer part --> +<div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> + <ul> + <li class="navelem"><a class="el" href="index.html">index</a></li><li class="navelem"><a class="el" href="rtxImplementation.html">RTX Implementation</a></li><li class="navelem"><a class="el" href="configure.html">Configure RTX</a></li> + <li class="footer">Generated on Wed Aug 1 2018 17:12:43 for CMSIS-RTOS by Arm Ltd. All rights reserved. + <!-- + <a href="http://www.doxygen.org/index.html"> + <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 + --> + </li> + </ul> +</div> +</body> +</html> |