[Tinyos-beta-commits] CVS: tinyos-1.x/beta/teps/txt tep108.txt, 1.4, 1.5

David Gay idgay at users.sourceforge.net
Thu May 19 15:36:49 PDT 2005


Update of /cvsroot/tinyos/tinyos-1.x/beta/teps/txt
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6188

Modified Files:
	tep108.txt 
Log Message:
resouce reservation update w/ a separate immediate request command


Index: tep108.txt
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/teps/txt/tep108.txt,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** tep108.txt	19 Apr 2005 22:07:55 -0000	1.4
--- tep108.txt	19 May 2005 22:36:47 -0000	1.5
***************
*** 100,129 ****
  The resource interface is defined as follows:
  
! interface Resource {
!   /**
!    * Request access to a shared resource. You must call release()
!    * when you are done with it.
!    * @return SUCCESS You have the resource.
!    *         EBUSY The resource is busy. The granted() event will
!    *               be signaled when you have the resource.
!    */
!   command error_t request();
  
!   /**
!    * You have received access to this resource.
!    */
!   event void granted();
  
!   /**
!    * Release a shared resource you previously acquired.
!    */
!   command void release();
  
!   /**
!    * Some other component has requested this resource. You might
!    * want to consider releasing it.
!    */
!   event void requested();
! }
  
  This Resource interface is offered as a parameterised interface by services
--- 100,139 ----
  The resource interface is defined as follows:
  
!   interface Resource {
!     /**
!      * Request access to a shared resource. You must call release()
!      * when you are done with it.
!      * @return SUCCESS Request accepted. The granted() event will
!      *           be signaled when you have the resource.
!      *         EBUSY You have already requested this resource via this
!      *           interface.    
!      */
!     async command error_t request();
  
!     /**
!      * Request immediate access to a shared resource. You must call 
!      * release() when you are done with it. 
!      * @return SUCCESS You now have the resource.
!      *         EBUSY The resource is busy.
!      */
!     async command error_t immediateRequest();
  
!     /**
!      * You have received access to this resource. Note that this event
!      * is NOT signaled when immediateRequest() succeeds.
!      */
!     event void granted();
  
!     /**
!      * Release a shared resource you previously acquired.
!      */
!     async command void release();
! 
!     /**
!      * Some other component has requested this resource. You might
!      * want to consider releasing it.
!      */
!     event void requested();
!   }
  
  This Resource interface is offered as a parameterised interface by services
***************
*** 134,167 ****
  like this:
  
! #define I2CPACKET_RESOURCE "I2CPacket.Resource"
! configuration I2CPacketC {
!   provides {
!     /**
!      * For reserving the I2C bus. 'id' is the client id, obtained
!      * via unique(I2C_RESOURCE)
!      */
!     interface Resource[uint8_t id];
  
!     /**
!      * Actual I2C packet interface. 'busId' is the I2C
!      * bus identifer of the device you wish to use.
!      */
!     interface I2CPacket[uint8_t busId];
!   }
! } ...
  
  Clients of the I2C service would use it as follows:
! module I2CUserM {
!   uses interface Resource as I2CResource;
!   uses interface I2CPacket;
! } ...
  
- configuration I2CUserC { }
- implementation {
-   components I2CUserM, I2CPacketC;
  
!   I2CUserM.I2CResource -> I2CPacketC.Resource[unique(I2C_RESOURCE)];
!   I2CUserM.I2CPacket -> I2CPacket.I2CPacket[0x73]; // using I2C device 0x73
! }
  
  A final note: in some cases, resource reservation will correspond to
--- 144,192 ----
  like this:
  
!   #include "I2CPacketC.h"
!   configuration I2CPacketC {
!     provides {
!       /**
!        * For reserving the I2C bus. 'id' is the client id, obtained
!        * via unique(I2C_RESOURCE)
!        */
!       interface Resource[uint8_t id];
  
!       /**
!        * Actual I2C packet interface. 'busId' is the I2C
!        * bus identifer of the device you wish to use.
!        */
!       interface I2CPacket[uint8_t busId];
!     }
!   } ...
! 
! where I2CPacketC.h contains the #define for the resource:
!   #ifndef I2CPACKETC_H
!   #define I2CPACKETC_H
! 
!   #define I2CPACKET_RESOURCE "I2CPacket.Resource"
! 
!   #endif
! 
! The #define for the unique string must be placed in a separate file
! because of the way nesC files are preprocessed: referring to I2CPacketC
! isn't enough to ensure that macros #define'd in I2CPacketC are visible
! in the referring component.
  
  Clients of the I2C service would use it as follows:
!   module I2CUserM {
!     uses interface Resource as I2CResource;
!     uses interface I2CPacket;
!   } ...
  
  
!   #include "I2CPacketC.h"
!   configuration I2CUserC { }
!   implementation {
!     components I2CUserM, I2CPacketC;
! 
!     I2CUserM.I2CResource -> I2CPacketC.Resource[unique(I2C_RESOURCE)];
!     I2CUserM.I2CPacket -> I2CPacket.I2CPacket[0x73]; // using I2C device 0x73
!   }
  
  A final note: in some cases, resource reservation will correspond to



More information about the Tinyos-beta-commits mailing list