X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=doc%2Fhtml%2Ftutorial%2Flesson8.html;h=e4dceea540bba9db44cd51d392c2a70cf26fe3d1;hb=d158b0311a7ccc7ed1a49a5bdccdbfedaa9f52aa;hp=c48eb4c65f606d294f50ba25eb386f8dfbc63295;hpb=5f0ec21691b6606eaa93bfac2cbc51ddfde43f25;p=tinyos-2.x.git 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 theSharedResourceC
component are instantiated and wired to three different clients from theTestSharedResourceC
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 theSharedResourceC
component are instantiated and wired to three different clients from theSharedResourceDemoC
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 theSharedResourceP
component in the apps/tests/TestSharedResource directory and replace theRoundRobinArbiter
component with theFcfsArbiter
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 theSharedResourceP
component in the apps/tutorials/SharedResourceDemo directory and replace theRoundRobinArbiter
component with theFcfsArbiter
component.
RoundRobinArbiter | FcfsArbiter |