[Tinyos-2-commits] CVS: tinyos-2.x/tos/system/arbiters ArbiterP.nc, 1.1.2.2, 1.1.2.3 FcfsArbiterC.nc, 1.1.2.1, 1.1.2.2

Kevin Klues klueska at users.sourceforge.net
Wed Jun 7 03:47:19 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/tos/system/arbiters
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv30188/tos/system/arbiters

Modified Files:
      Tag: tos-2-resource-pm-eval-cand
	ArbiterP.nc FcfsArbiterC.nc 
Log Message:
changes to the Resource and PowerManager interfaces as discussed in the meeting on may 19th.

Index: ArbiterP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/system/arbiters/Attic/ArbiterP.nc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** ArbiterP.nc	22 May 2006 22:39:13 -0000	1.1.2.2
--- ArbiterP.nc	7 Jun 2006 10:47:17 -0000	1.1.2.3
***************
*** 49,59 ****
   * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
- 
- /*
-  * - Revision -------------------------------------------------------------
-  * $Revision$
-  * $Date$ 
-  * ======================================================================== 
-  */
   
  /**
--- 49,52 ----
***************
*** 86,90 ****
    uses {
      interface ResourceConfigure[uint8_t id];
!     interface Queue<uint8_t>;
    }
  }
--- 79,83 ----
    uses {
      interface ResourceConfigure[uint8_t id];
!     interface AsyncQueue<uint8_t> as Queue;
    }
  }
***************
*** 118,138 ****
      be returned to the caller.
    */
!   command error_t Resource.request[uint8_t id]() {
!     if(state == RES_IDLE) {
!       atomic state = RES_GRANTING;
!       atomic reqResId = id;
!       post grantedTask();
!       return SUCCESS;
      }
-     return call Queue.enqueue(id);
    }
  
!   command error_t ImmediateResource.request[uint8_t id]() {
!     if(state == RES_IDLE) {
!       atomic state = RES_BUSY;
!       atomic resId = id;
!       return SUCCESS;
      }
-     return FAIL;
    }    
     
--- 111,135 ----
      be returned to the caller.
    */
!   async command error_t Resource.request[uint8_t id]() {
!     atomic {
!       if(state == RES_IDLE) {
!         state = RES_GRANTING;
!         reqResId = id;
!         post grantedTask();
!         return SUCCESS;
!       }
!       return call Queue.enqueue(id);
      }
    }
  
!   async command error_t ImmediateResource.request[uint8_t id]() {
!     atomic {
!       if(state == RES_IDLE) {
!         state = RES_BUSY;
!         resId = id;
!         return SUCCESS;
!       }
!       return FAIL;
      }
    }    
     
***************
*** 149,165 ****
      the resource.
    */
!   command void Resource.release[uint8_t id]() {
!     if(state == RES_BUSY && resId == id) {
!       reqResId = call Queue.dequeue();
!       if(reqResId != NO_RES) {
!         atomic state = RES_GRANTING;
!         post grantedTask();
!       }
!       else {
!         atomic resId = NO_RES;
!         atomic state = RES_IDLE;
        }
  	    call ResourceConfigure.unconfigure[id]();
      }
    }
      
--- 146,174 ----
      the resource.
    */
!   command error_t Resource.release[uint8_t id]() {
!     bool released = FALSE;
!     atomic {
!       if(state == RES_BUSY && resId == id) {
!         reqResId = call Queue.dequeue();
!         if(reqResId != NO_RES) {
!           state = RES_GRANTING;
!           post grantedTask();
!         }
!         else {
!           resId = NO_RES;
!           state = RES_IDLE;
!         }
!         released = TRUE;
        }
+     }
+     if(released == TRUE) {
  	    call ResourceConfigure.unconfigure[id]();
+       return SUCCESS;
      }
+     return FAIL;
+   }
+ 
+   async command error_t ImmediateResource.release[uint8_t id]() {
+       return call Resource.release[id]();
    }
      
***************
*** 185,189 ****
  
    /**
!    * Returns my user id.
     */      
    async command uint8_t Resource.isOwner[uint8_t id]() {
--- 194,198 ----
  
    /**
!    * Returns whether you are the current owner of the resource or not
     */      
    async command uint8_t Resource.isOwner[uint8_t id]() {
***************
*** 199,204 ****
    
    task void grantedTask() {
!     atomic resId = reqResId;
!     atomic state = RES_BUSY;
      call ResourceConfigure.configure[resId]();
      signal Resource.granted[resId]();
--- 208,215 ----
    
    task void grantedTask() {
!     atomic {
!       resId = reqResId;
!       state = RES_BUSY;
!     }
      call ResourceConfigure.configure[resId]();
      signal Resource.granted[resId]();
***************
*** 208,213 ****
    default event void Resource.granted[uint8_t id]() {
    }
-   default event void ImmediateResource.granted[uint8_t id]() {
-   }
    default async command void ResourceConfigure.configure[uint8_t id]() {
    }
--- 219,222 ----

Index: FcfsArbiterC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/system/arbiters/Attic/FcfsArbiterC.nc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** FcfsArbiterC.nc	15 May 2006 18:15:34 -0000	1.1.2.1
--- FcfsArbiterC.nc	7 Jun 2006 10:47:17 -0000	1.1.2.2
***************
*** 49,59 ****
   * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
- 
- /*
-  * - Revision -------------------------------------------------------------
-  * $Revision$
-  * $Date$ 
-  * ======================================================================== 
-  */
   
  /**
--- 49,52 ----
***************
*** 81,85 ****
    provides {
      interface Resource[uint8_t id];
!     interface ResourceController;
      interface ArbiterInfo;
    }
--- 74,78 ----
    provides {
      interface Resource[uint8_t id];
!     interface ImmediateResource[uint8_t id];
      interface ArbiterInfo;
    }
***************
*** 87,97 ****
  implementation {
    components MainC;
!   components new FcfsQueueC(uniqueCount(resourceName)) as Queue;
!   components new ArbiterP(uniqueCount(resourceName)) as Arbiter;
  
    MainC.SoftwareInit -> Queue;
  
    Resource = Arbiter;
!   ResourceController = Arbiter;
    ArbiterInfo = Arbiter;
  
--- 80,90 ----
  implementation {
    components MainC;
!   components new AsyncFcfsQueueC(uniqueCount(resourceName)) as Queue;
!   components new ArbiterP() as Arbiter;
  
    MainC.SoftwareInit -> Queue;
  
    Resource = Arbiter;
!   ImmediateResource = Arbiter;
    ArbiterInfo = Arbiter;
  



More information about the Tinyos-2-commits mailing list