?? resource arbitration and power management - tinyos documentation wiki.htm
字號:
implementation {
components new RoundRobinArbiterC(UQ_SHARED_RESOURCE) as Arbiter;
components new SplitControlPowerManagerC() as PowerManager;
components ResourceP;
components SharedResourceImplP;
ResourceOperations = SharedResourceImplP;
Resource = Arbiter;
ResourceRequested = Arbiter;
ResourceConfigure = Arbiter;
SharedResourceImplP.ArbiterInfo -> Arbiter;
PowerManager.ResourceDefaultOwner -> Arbiter;
PowerManager.SplitControl -> ResourceP;
SharedResourceImplP.ResourceOperations -> ResourceP;
}
</PRE>
<P>Four different components are instantiated by this configuration: </P><PRE>components new RoundRobinArbiterC(UQ_SHARED_RESOURCE) as Arbiter;
components new SplitControlPowerManagerC() as PowerManager;
components ResourceP;
components SharedResourceImplP;
</PRE>
<P>As we've already seen, the <TT>RoundRobinArbiterC</TT> component is used to
provide arbitration between clients using <TT>SharedResourceC</TT>. The
<TT>SplitControlPowerManagerC</TT> component is used to perform automatic power
management of the resource to turn it on whenever a new client requests its use
and shut it down whenever it goes idle. The <TT>ResourceP</TT> component is the
implementation of a dedicated resource which provides a <TT>SplitControl</TT>
interface and a <TT>ResourceOperations</TT> interface. This dedicated resource
is wrapped by the <TT>SharedResourceImplP</TT> component in order to provide
protected shared access to it. <TT>SharedResourceImplP</TT> wraps all the
commands provided by the dedicated resource, and uses the <TT>ArbiterInfo</TT>
interface to keep clients from calling them without first being granted access
to the resource. </P>
<P>If you would like to see more examples of how to use the different arbiters
and power managers provided in the default TinyOS distribution, please refer to
the test applications located in <TT>tinyos-2.x/apps/tests/TestArbiter</TT> and
<TT>tinyos-2.x/apps/tests/TestPowerManager</TT>. This tutorial has provided
enough background information on how to use these components in order for you to
sift through these applications on your own. </P><A name=Conclusion></A>
<H1><SPAN class=mw-headline>Conclusion</SPAN></H1>
<P>This tutorial has given an overview of how resource arbitration and
mechanisms for performing power management on those resources is provided in
TinyOS. It walked us through the steps necessary for: </P>
<OL>
<LI>Wiring in a shared resource for use by a client.
<LI>Using the <TT>Resource</TT> interface to gain access to a shared resource.
<LI>Changing the arbitration policy used by a particular shared resource.
<LI>Wrapping a dedicated resource and wiring in a power manager in order to
create a shared resource. </LI></OL>
<P>While the power managers presented in this tutorial are powerful components
for providing power management of shared resources, they are not the only power
management mechanisms provided by TinyOS. Microcontroller power management is
also preformed as outlined in TEP115. Whenever the task queue empties, the
lowest power state that the microcontroller is capable of dropping to is
automatically calculated and then switched to. In this way, the user is not
burdened with explicity controlling these power states. The cc1000 and cc2420
radio implementations also provide "Low Power Listening" (LPL) interfaces for
controlling their duty cycles. The LPL implementation for the cc2420 can be
found under <TT>tinyos-2.x/tos/chips/cc2420</TT> and the LPL implementation for
the cc1000 can be found under <TT>tinyos-2.x/tos/chips/cc1000</TT>. Take a look
at <A title="Writing Low-Power Applications"
href="http://docs.tinyos.net/index.php/Writing_Low-Power_Applications">lesson
16</A> to see how this interface is used. </P><A name=Related_Documentation></A>
<H1><SPAN class=mw-headline>Related Documentation</SPAN></H1>
<UL>
<LI><A class="external text"
title=http://csl.stanford.edu/~pal/pubs/tinyos-programming-1-0.pdf
href="http://csl.stanford.edu/~pal/pubs/tinyos-programming-1-0.pdf"
rel=nofollow>TinyOS Programming Guide <I>Sections 6.2 and 7.4</I></A>
<LI><A class="external text"
title=http://www.tinyos.net/tinyos-2.x/doc/html/tep108.html
href="http://www.tinyos.net/tinyos-2.x/doc/html/tep108.html" rel=nofollow>TEP
108: Resource Arbitration</A>
<LI><A class="external text"
title=http://www.tinyos.net/tinyos-2.x/doc/html/tep112.html
href="http://www.tinyos.net/tinyos-2.x/doc/html/tep112.html" rel=nofollow>TEP
112: Microcontroller Power Management</A>
<LI><A class="external text"
title=http://www.tinyos.net/tinyos-2.x/doc/html/tep115.html
href="http://www.tinyos.net/tinyos-2.x/doc/html/tep115.html" rel=nofollow>TEP
115: Power Management of Non-Virtualized Devices</A> </LI></UL>
<HR>
<P><BR></P>
<HR>
<CENTER>
<P>< <B><A title=Storage
href="http://docs.tinyos.net/index.php/Storage">Previous Lesson</A></B> | <B><A
title=""
href="http://docs.tinyos.net/index.php/Resource_Arbitration_and_Power_Management#Introduction">Top</A></B>
| <B><A class=new title=Concurrency
href="http://docs.tinyos.net/index.php?title=Concurrency&action=edit">Next
Lesson</A> ></B> </P></CENTER><!-- Saved in parser cache with key tinyosdocs:pcache:idhash:14-0!1!0!!en!2!edit=0 and timestamp 20080401154731 -->
<DIV class=printfooter>Retrieved from "<A
href="http://docs.tinyos.net/index.php/Resource_Arbitration_and_Power_Management">http://docs.tinyos.net/index.php/Resource_Arbitration_and_Power_Management</A>"</DIV><!-- end content -->
<DIV class=visualClear></DIV></DIV></DIV></DIV>
<DIV id=column-one>
<DIV class=portlet id=p-cactions>
<H5>Views</H5>
<DIV class=pBody>
<UL>
<LI class=selected id=ca-nstab-main><A title="View the content page [c]"
accessKey=c
href="http://docs.tinyos.net/index.php/Resource_Arbitration_and_Power_Management">Article</A>
<LI class=new id=ca-talk><A title="Discussion about the content page [t]"
accessKey=t
href="http://docs.tinyos.net/index.php?title=Talk:Resource_Arbitration_and_Power_Management&action=edit">Discussion</A>
<LI id=ca-viewsource><A
title="This page is protected. You can view its source. [e]" accessKey=e
href="http://docs.tinyos.net/index.php?title=Resource_Arbitration_and_Power_Management&action=edit">View
source</A>
<LI id=ca-history><A title="Past versions of this page. [h]" accessKey=h
href="http://docs.tinyos.net/index.php?title=Resource_Arbitration_and_Power_Management&action=history">History</A>
</LI></UL></DIV></DIV>
<DIV class=portlet id=p-personal>
<H5>Personal tools</H5>
<DIV class=pBody>
<UL>
<LI id=pt-login><A
title="You are encouraged to log in, it is not mandatory however. [o]"
accessKey=o
href="http://docs.tinyos.net/index.php?title=Special:Userlogin&returnto=Resource_Arbitration_and_Power_Management">Log
in / create account</A> </LI></UL></DIV></DIV>
<DIV class=portlet id=p-logo><A title="Visit the Main Page [z]"
style="BACKGROUND-IMAGE: url(/images/tos-jwall-small.jpg)" accessKey=z
href="http://docs.tinyos.net/index.php/Main_Page"></A></DIV>
<SCRIPT type=text/javascript> if (window.isMSIE55) fixalpha(); </SCRIPT>
<DIV class=portlet id=p-navigation>
<H5>Navigation</H5>
<DIV class=pBody>
<UL>
<LI id=n-mainpage><A title="Visit the Main Page [z]" accessKey=z
href="http://docs.tinyos.net/index.php/Main_Page">Main Page</A>
<LI id=n-portal><A
title="About the project, what you can do, where to find things"
href="http://docs.tinyos.net/index.php/TinyOS_Documentation_Wiki:Community_Portal">Community
portal</A>
<LI id=n-currentevents><A
title="Find background information on current events"
href="http://docs.tinyos.net/index.php/Current_events">Current events</A>
<LI id=n-recentchanges><A title="The list of recent changes in the wiki. [r]"
accessKey=r
href="http://docs.tinyos.net/index.php/Special:Recentchanges">Recent
changes</A>
<LI id=n-randompage><A title="Load a random page [x]" accessKey=x
href="http://docs.tinyos.net/index.php/Special:Random">Random page</A>
<LI id=n-help><A title="The place to find out."
href="http://docs.tinyos.net/index.php/Help:Contents">Help</A>
<LI id=n-sitesupport><A title="Support us"
href="http://docs.tinyos.net/index.php/TinyOS_Documentation_Wiki:Site_support">Donations</A>
</LI></UL></DIV></DIV>
<DIV class=portlet id=p-search>
<H5><LABEL for=searchInput>Search</LABEL></H5>
<DIV class=pBody id=searchBody>
<FORM id=searchform action=/index.php/Special:Search>
<DIV><INPUT id=searchInput title="Search TinyOS Documentation Wiki [f]"
accessKey=f name=search> <INPUT class=searchButton id=searchGoButton type=submit value=Go name=go> <INPUT class=searchButton id=mw-searchButton type=submit value=Search name=fulltext>
</DIV></FORM></DIV></DIV>
<DIV class=portlet id=p-tb>
<H5>Toolbox</H5>
<DIV class=pBody>
<UL>
<LI id=t-whatlinkshere><A title="List of all wiki pages that link here [j]"
accessKey=j
href="http://docs.tinyos.net/index.php/Special:Whatlinkshere/Resource_Arbitration_and_Power_Management">What
links here</A>
<LI id=t-recentchangeslinked><A
title="Recent changes in pages linked from this page [k]" accessKey=k
href="http://docs.tinyos.net/index.php/Special:Recentchangeslinked/Resource_Arbitration_and_Power_Management">Related
changes</A>
<LI id=t-upload><A title="Upload images or media files [u]" accessKey=u
href="http://docs.tinyos.net/index.php/Special:Upload">Upload file</A>
<LI id=t-specialpages><A title="List of all special pages [q]" accessKey=q
href="http://docs.tinyos.net/index.php/Special:Specialpages">Special pages</A>
<LI id=t-print><A title="Printable version of this page [p]" accessKey=p
href="http://docs.tinyos.net/index.php?title=Resource_Arbitration_and_Power_Management&printable=yes">Printable
version</A>
<LI id=t-permalink><A title="Permanent link to this version of the page"
href="http://docs.tinyos.net/index.php?title=Resource_Arbitration_and_Power_Management&oldid=285">Permanent
link</A> </LI></UL></DIV></DIV></DIV><!-- end of the left (by default at least) column -->
<DIV class=visualClear></DIV>
<DIV id=footer>
<DIV id=f-poweredbyico><A href="http://www.mediawiki.org/"><IMG
alt="Powered by MediaWiki"
src="Resource Arbitration and Power Management - TinyOS Documentation Wiki.files/poweredby_mediawiki_88x31.png"></A></DIV>
<UL id=f-list>
<LI id=lastmod>This page was last modified 21:01, 28 December 2007.
<LI id=viewcount>This page has been accessed 504 times.
<LI id=privacy><A title="TinyOS Documentation Wiki:Privacy policy"
href="http://docs.tinyos.net/index.php/TinyOS_Documentation_Wiki:Privacy_policy">Privacy
policy</A>
<LI id=about><A title="TinyOS Documentation Wiki:About"
href="http://docs.tinyos.net/index.php/TinyOS_Documentation_Wiki:About">About
TinyOS Documentation Wiki</A>
<LI id=disclaimer><A title="TinyOS Documentation Wiki:General disclaimer"
href="http://docs.tinyos.net/index.php/TinyOS_Documentation_Wiki:General_disclaimer">Disclaimers</A>
</LI></UL></DIV>
<SCRIPT type=text/javascript>if (window.runOnloadHook) runOnloadHook();</SCRIPT>
</DIV><!-- Served in 0.366 secs. --></BODY></HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -