* @author Philip Levis
*/
-generic module ArbiterP(uint8_t default_owner_id) {
+generic module ArbiterP(uint8_t default_owner_id) @safe() {
provides {
interface Resource[uint8_t id];
interface ResourceRequested[uint8_t id];
if(state == RES_BUSY && resId == id) {
if(call Queue.isEmpty() == FALSE) {
reqResId = call Queue.dequeue();
+ resId = NO_RES;
state = RES_GRANTING;
post grantedTask();
+ call ResourceConfigure.unconfigure[id]();
}
else {
resId = default_owner_id;
state = RES_CONTROLLED;
+ call ResourceConfigure.unconfigure[id]();
signal ResourceDefaultOwner.granted();
}
- call ResourceConfigure.unconfigure[id]();
+ return SUCCESS;
}
}
return FAIL;