From: klueska Date: Sun, 15 Apr 2007 20:33:34 +0000 (+0000) Subject: Update of documentation on ArbiterP X-Git-Tag: tinyos/2.0.1~44 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=d9c5479d38caf5e9b147f5f99c29af63fe6a33ae Update of documentation on ArbiterP --- diff --git a/tos/system/ArbiterP.nc b/tos/system/ArbiterP.nc index e5c0f5ab..9650a707 100644 --- a/tos/system/ArbiterP.nc +++ b/tos/system/ArbiterP.nc @@ -34,7 +34,7 @@ * This component provides the Resource, ResourceRequested, ArbiterInfo, * and ResourceDefaultOwner interfaces and uses the ResourceConfigure interface as * described in TEP 108. It provides arbitration to a shared resource. - * An Queue is used to keep track of which users have put + * A Queue is used to keep track of which users have put * in requests for the resource. Upon the release of the resource by one * of these users, the queue is checked and the next user * that has a pending request will ge granted control of the resource. If @@ -42,13 +42,14 @@ * interface gains access to the resource, and holds onto it until * another user makes a request. * - * @param controller_id -- The unique id of the resource being arbitrated + * @param default_owner_id -- The id of the default owner of this + * resource * * @author Kevin Klues (klues@tkn.tu-berlin.de) * @author Philip Levis */ -generic module ArbiterP(uint8_t controller_id) { +generic module ArbiterP(uint8_t default_owner_id) { provides { interface Resource[uint8_t id]; interface ResourceRequested[uint8_t id]; @@ -64,10 +65,10 @@ generic module ArbiterP(uint8_t controller_id) { implementation { enum {RES_CONTROLLED, RES_GRANTING, RES_IMM_GRANTING, RES_BUSY}; - enum {CONTROLLER_ID = controller_id}; + enum {default_owner_id = default_owner_id}; uint8_t state = RES_CONTROLLED; - norace uint8_t resId = CONTROLLER_ID; + norace uint8_t resId = default_owner_id; norace uint8_t reqResId; task void grantedTask(); @@ -112,7 +113,7 @@ implementation { post grantedTask(); } else { - resId = CONTROLLER_ID; + resId = default_owner_id; state = RES_CONTROLLED; signal ResourceDefaultOwner.granted(); } @@ -124,7 +125,7 @@ implementation { async command error_t ResourceDefaultOwner.release() { atomic { - if(resId == CONTROLLER_ID) { + if(resId == default_owner_id) { if(state == RES_GRANTING) { post grantedTask(); return SUCCESS; @@ -166,7 +167,7 @@ implementation { } async command uint8_t ResourceDefaultOwner.isOwner() { - return call Resource.isOwner[CONTROLLER_ID](); + return call Resource.isOwner[default_owner_id](); } task void grantedTask() { diff --git a/tos/system/SimpleArbiterP.nc b/tos/system/SimpleArbiterP.nc index a3cfcae8..c5e82f29 100644 --- a/tos/system/SimpleArbiterP.nc +++ b/tos/system/SimpleArbiterP.nc @@ -41,8 +41,6 @@ * there are no pending requests, then the resource becomes idle and any * user can put in a request and immediately receive access to the * Resource. - * - * @param resourceName -- The name of the Resource being shared * * @author Kevin Klues (klues@tkn.tu-berlin.de) * @author Philip Levis