From d158b0311a7ccc7ed1a49a5bdccdbfedaa9f52aa Mon Sep 17 00:00:00 2001 From: klueska Date: Fri, 13 Jul 2007 23:43:16 +0000 Subject: [PATCH] Moved the apps/tests/TestSharedResources application into the tutorials directory and gave it a new name to fit more appropriately in there. Also modified the tutorial itself to reflect these changes and added / deleted dsome obsolete text from it. --- apps/tests/TestSharedResource/Makefile | 3 -- apps/tutorials/SharedResourceDemo/Makefile | 3 ++ .../SharedResourceDemo}/README.txt | 2 +- .../SharedResourceDemo}/ResourceOperations.nc | 0 .../SharedResourceDemo}/ResourceP.nc | 0 .../SharedResourceDemo}/SharedResourceC.nc | 4 +-- .../SharedResourceDemoAppC.nc} | 4 +-- .../SharedResourceDemoC.nc} | 2 +- .../SharedResourceImplP.nc | 0 .../SharedResourceDemo}/SharedResourceP.nc | 4 +-- doc/html/tutorial/lesson8.html | 28 +++++++++---------- 11 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 apps/tests/TestSharedResource/Makefile create mode 100644 apps/tutorials/SharedResourceDemo/Makefile rename apps/{tests/TestSharedResource => tutorials/SharedResourceDemo}/README.txt (97%) rename apps/{tests/TestSharedResource => tutorials/SharedResourceDemo}/ResourceOperations.nc (100%) rename apps/{tests/TestSharedResource => tutorials/SharedResourceDemo}/ResourceP.nc (100%) rename apps/{tests/TestSharedResource => tutorials/SharedResourceDemo}/SharedResourceC.nc (95%) rename apps/{tests/TestSharedResource/TestSharedResourceAppC.nc => tutorials/SharedResourceDemo/SharedResourceDemoAppC.nc} (96%) rename apps/{tests/TestSharedResource/TestSharedResourceC.nc => tutorials/SharedResourceDemo/SharedResourceDemoC.nc} (99%) rename apps/{tests/TestSharedResource => tutorials/SharedResourceDemo}/SharedResourceImplP.nc (100%) rename apps/{tests/TestSharedResource => tutorials/SharedResourceDemo}/SharedResourceP.nc (94%) diff --git a/apps/tests/TestSharedResource/Makefile b/apps/tests/TestSharedResource/Makefile deleted file mode 100644 index fe39435a..00000000 --- a/apps/tests/TestSharedResource/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -COMPONENT=TestSharedResourceAppC -include $(MAKERULES) - diff --git a/apps/tutorials/SharedResourceDemo/Makefile b/apps/tutorials/SharedResourceDemo/Makefile new file mode 100644 index 00000000..0ba996c4 --- /dev/null +++ b/apps/tutorials/SharedResourceDemo/Makefile @@ -0,0 +1,3 @@ +COMPONENT=SharedResourceDemoAppC +include $(MAKERULES) + diff --git a/apps/tests/TestSharedResource/README.txt b/apps/tutorials/SharedResourceDemo/README.txt similarity index 97% rename from apps/tests/TestSharedResource/README.txt rename to apps/tutorials/SharedResourceDemo/README.txt index 0ab502c0..cafe125b 100644 --- a/apps/tests/TestSharedResource/README.txt +++ b/apps/tutorials/SharedResourceDemo/README.txt @@ -1,4 +1,4 @@ -README for TestSharedResource +README for SharedResourceDemo Author/Contact: tinyos-help@millennium.berkeley.edu @author Kevin Klues diff --git a/apps/tests/TestSharedResource/ResourceOperations.nc b/apps/tutorials/SharedResourceDemo/ResourceOperations.nc similarity index 100% rename from apps/tests/TestSharedResource/ResourceOperations.nc rename to apps/tutorials/SharedResourceDemo/ResourceOperations.nc diff --git a/apps/tests/TestSharedResource/ResourceP.nc b/apps/tutorials/SharedResourceDemo/ResourceP.nc similarity index 100% rename from apps/tests/TestSharedResource/ResourceP.nc rename to apps/tutorials/SharedResourceDemo/ResourceP.nc diff --git a/apps/tests/TestSharedResource/SharedResourceC.nc b/apps/tutorials/SharedResourceDemo/SharedResourceC.nc similarity index 95% rename from apps/tests/TestSharedResource/SharedResourceC.nc rename to apps/tutorials/SharedResourceDemo/SharedResourceC.nc index a6f8468f..5aba6b58 100644 --- a/apps/tests/TestSharedResource/SharedResourceC.nc +++ b/apps/tutorials/SharedResourceDemo/SharedResourceC.nc @@ -32,7 +32,7 @@ * @date $Date$ */ -#define TEST_SHARED_RESOURCE "Test.Shared.Resource" +#define UQ_SHARED_RESOURCE "Shared.Resource" generic configuration SharedResourceC() { provides interface Resource; provides interface ResourceRequested; @@ -43,7 +43,7 @@ implementation { components SharedResourceP; enum { - RESOURCE_ID = unique(TEST_SHARED_RESOURCE) + RESOURCE_ID = unique(UQ_SHARED_RESOURCE) }; Resource = SharedResourceP.Resource[RESOURCE_ID]; diff --git a/apps/tests/TestSharedResource/TestSharedResourceAppC.nc b/apps/tutorials/SharedResourceDemo/SharedResourceDemoAppC.nc similarity index 96% rename from apps/tests/TestSharedResource/TestSharedResourceAppC.nc rename to apps/tutorials/SharedResourceDemo/SharedResourceDemoAppC.nc index bf2975b5..03556470 100644 --- a/apps/tests/TestSharedResource/TestSharedResourceAppC.nc +++ b/apps/tutorials/SharedResourceDemo/SharedResourceDemoAppC.nc @@ -50,10 +50,10 @@ * @date $Date$ */ -configuration TestSharedResourceAppC{ +configuration SharedResourceDemoAppC{ } implementation { - components MainC,LedsC, TestSharedResourceC as App, + components MainC,LedsC, SharedResourceDemoC as App, new TimerMilliC() as Timer0, new TimerMilliC() as Timer1, new TimerMilliC() as Timer2; diff --git a/apps/tests/TestSharedResource/TestSharedResourceC.nc b/apps/tutorials/SharedResourceDemo/SharedResourceDemoC.nc similarity index 99% rename from apps/tests/TestSharedResource/TestSharedResourceC.nc rename to apps/tutorials/SharedResourceDemo/SharedResourceDemoC.nc index 833fe812..cee2b12b 100644 --- a/apps/tests/TestSharedResource/TestSharedResourceC.nc +++ b/apps/tutorials/SharedResourceDemo/SharedResourceDemoC.nc @@ -52,7 +52,7 @@ * @date $Date$ */ -module TestSharedResourceC { +module SharedResourceDemoC { uses { interface Boot; interface Leds; diff --git a/apps/tests/TestSharedResource/SharedResourceImplP.nc b/apps/tutorials/SharedResourceDemo/SharedResourceImplP.nc similarity index 100% rename from apps/tests/TestSharedResource/SharedResourceImplP.nc rename to apps/tutorials/SharedResourceDemo/SharedResourceImplP.nc diff --git a/apps/tests/TestSharedResource/SharedResourceP.nc b/apps/tutorials/SharedResourceDemo/SharedResourceP.nc similarity index 94% rename from apps/tests/TestSharedResource/SharedResourceP.nc rename to apps/tutorials/SharedResourceDemo/SharedResourceP.nc index 4811ed78..00a3211b 100644 --- a/apps/tests/TestSharedResource/SharedResourceP.nc +++ b/apps/tutorials/SharedResourceDemo/SharedResourceP.nc @@ -29,7 +29,7 @@ * @date $Date$ */ -#define TEST_SHARED_RESOURCE "Test.Shared.Resource" +#define UQ_SHARED_RESOURCE "Shared.Resource" configuration SharedResourceP { provides interface Resource[uint8_t id]; provides interface ResourceRequested[uint8_t id]; @@ -37,7 +37,7 @@ configuration SharedResourceP { uses interface ResourceConfigure[uint8_t id]; } implementation { - components new RoundRobinArbiterC(TEST_SHARED_RESOURCE) as Arbiter; + components new RoundRobinArbiterC(UQ_SHARED_RESOURCE) as Arbiter; components new SplitControlPowerManagerC() as PowerManager; components ResourceP; components SharedResourceImplP; diff --git a/doc/html/tutorial/lesson8.html b/doc/html/tutorial/lesson8.html index c48eb4c6..e4dceea5 100644 --- a/doc/html/tutorial/lesson8.html +++ b/doc/html/tutorial/lesson8.html @@ -124,15 +124,15 @@ Specifically, this tutorial will teach users how to:

This section shows you how to gain access to and use shared resources in TinyOS. It walks through the process of making a request through the Resource interface and handling the granted event that is signaled back. We will connect multiple clients to a single shared resources and see how access to each of them gets arbitrated. We also show how to hold onto a resource until another client has requested it by implementing the ResourceRequested interface.

-

To begin, go to the tinyos-2.x/apps/tests/TestSharedResource directory and install this application on a mote. After installing the application you should see three leds flashing in sequence.

+

To begin, go to the tinyos-2.x/apps/tutorials/SharedResourceDemo directory and install this application on a mote. After installing the application you should see three leds flashing in sequence.

-

Let's take a look at the different components contained in this directory to see whats going on. Start with the top level application component: TestSharedResourceAppC

+

Let's take a look at the different components contained in this directory to see whats going on. Start with the top level application component: SharedResourceDemoAppC

-configuration TestSharedResourceAppC{
+configuration SharedResourceDemoAppC{
 }
 implementation {
-  components MainC,LedsC, TestSharedResourceC as App,
+  components MainC,LedsC, SharedResourceDemoC as App,
   new TimerMilliC() as Timer0,
   new TimerMilliC() as Timer1,
   new TimerMilliC() as Timer2;
@@ -157,14 +157,14 @@ implementation {
 
 

Other than the instantiation and wiring of the interfaces provided by the SharedResourceC component, this configuration is identical to the one presented in Lesson 1 for the Blink Application.

-

All shared resources in TinyOS are provided through a generic component similar to the SharedResourceC component. A resource client simply instantiates a new instance of this component and wires to the interfaces it provides. In this application, three instances of the SharedResourceC component are instantiated and wired to three different clients from the TestSharedResourceC component. Each instantiation provides a Resource, ResourceOperations, and ResourceRequested interface, and uses a ResourceConfgigure interface. In this example, no wiring is done to the ResourceConfigure or ResourceRequested interface as wiring to to these interfaces is optional. The ResourceOperations interface is an EXAMPLE of a resource specific interface that a resource may provide to perform operations on it. Calls to commands through this interface will only succeed if the client calling them happens to have access to the resource when they are called. +

All shared resources in TinyOS are provided through a generic component similar to the SharedResourceC component. A resource client simply instantiates a new instance of this component and wires to the interfaces it provides. In this application, three instances of the SharedResourceC component are instantiated and wired to three different clients from the SharedResourceDemoC component. Each instantiation provides a Resource, ResourceOperations, and ResourceRequested interface, and uses a ResourceConfgigure interface. In this example, no wiring is done to the ResourceConfigure or ResourceRequested interface as wiring to to these interfaces is optional. The ResourceOperations interface is an EXAMPLE of a resource specific interface that a resource may provide to perform operations on it. Calls to commands through this interface will only succeed if the client calling them happens to have access to the resource when they are called.

-

Let's take a look at the TestSharedResourceC to see how access is actually granted to a Resource. +

Let's take a look at the SharedResourceDemoC to see how access is actually granted to a Resource.

-module TestSharedResourceC {
+module SharedResourceDemoC {
   uses {
     interface Boot;  
     interface Leds;
@@ -246,7 +246,7 @@ event void Timer2.fired() {
 }
 
-

In this way, requests are continuously put in by each client, allowing the application to continuously flash the LEDs in the order in which requests are being serviced. As stated before, the SharedResourceC component services these requests in a round-robin fashion. If you would like to see the requests serviced in the order they are received (and see the LEDs flash accordingly), you can open up the SharedResourceP component in the apps/tests/TestSharedResource directory and replace the RoundRobinArbiter component with the FcfsArbiter component.

+

In this way, requests are continuously put in by each client, allowing the application to continuously flash the LEDs in the order in which requests are being serviced. As stated before, the SharedResourceC component services these requests in a round-robin fashion. If you would like to see the requests serviced in the order they are received (and see the LEDs flash accordingly), you can open up the SharedResourceP component in the apps/tutorials/SharedResourceDemo directory and replace the RoundRobinArbiter component with the FcfsArbiter component.

@@ -259,7 +259,7 @@ configuration SharedResourceP { uses interface ResourceConfigure[uint8_t id]; } implementation { - components new RoundRobinArbiterC(TEST_SHARED_RESOURCE) as Arbiter; + components new RoundRobinArbiterC(UQ_SHARED_RESOURCE) as Arbiter; ... ... } @@ -275,7 +275,7 @@ configuration SharedResourceP { uses interface ResourceConfigure[uint8_t id]; } implementation { - components new FcfsArbiterC(TEST_SHARED_RESOURCE) as Arbiter; + components new FcfsArbiterC(UQ_SHARED_RESOURCE) as Arbiter; ... ... } @@ -289,7 +289,7 @@ implementation {

Looking through the rest of this component, you can see how its wiring matches the connections shown in Figure 2.

-#define TEST_SHARED_RESOURCE   "Test.Shared.Resource"
+#define UQ_SHARED_RESOURCE   "Shared.Resource"
 configuration SharedResourceP {
 	provides interface Resource[uint8_t id];
 	provides interface ResourceRequested[uint8_t id];
@@ -297,7 +297,7 @@ configuration SharedResourceP {
 	uses interface ResourceConfigure[uint8_t id];
 }
 implementation {
-  components new RoundRobinArbiterC(TEST_SHARED_RESOURCE) as Arbiter;
+  components new RoundRobinArbiterC(UQ_SHARED_RESOURCE) as Arbiter;
   components new SplitControlPowerManagerC() as PowerManager;
   components ResourceP;
   components SharedResourceImplP;
@@ -319,7 +319,7 @@ Four different components are instantiated by this configuration:
 

-components new RoundRobinArbiterC(TEST_SHARED_RESOURCE) as Arbiter;
+components new RoundRobinArbiterC(UQ_SHARED_RESOURCE) as Arbiter;
 components new SplitControlPowerManagerC() as PowerManager;
 components ResourceP;
 components SharedResourceImplP;
@@ -345,7 +345,7 @@ This tutorial has given an overview of how resource arbitration and mechanisms f
 

-While the power managers presented in this tutorial are powerful components for providing power management of shared reosurces, 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 capapble 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. Although the LPL interface used by each radio stack differs somewhat, they are both able to provide energy savings not achieveable through other means. Ultimately we would like to see the components providing this LPL interface implemented as power manager components for the "radio resource" and be wired to the radio in the same way as the other power managers described in this tutorial. The LPL implementation for the cc2420 can be found under tinyos-2.x/tos/chips/cc2420_lpl and the LPL implementation for the cc1000 can be found under tinyos-2.x/tos/chips/cc1000. As these interfaces begin to mature and merge into one, this tutorial will be updated appropriately to accomodate the change. +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 capapble 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. Although the LPL interface used by each radio stack differs somewhat, they are both able to provide energy savings not achieveable through other means. The LPL implementation for the cc2420 can be found under tinyos-2.x/tos/chips/cc2420 and the LPL implementation for the cc1000 can be found under tinyos-2.x/tos/chips/cc1000. As these interfaces begin to mature and merge into one, this tutorial will be updated appropriately to accomodate the change.

-- 2.39.2
RoundRobinArbiterFcfsArbiter