[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/mac/tkn154 BeaconSynchronizeP.nc, 1.5, 1.6 BeaconTransmitP.nc, 1.4, 1.5 CsmaP.nc, 1.2, 1.3 PibP.nc, 1.3, 1.4 RxEnableP.nc, 1.3, 1.4 SimpleTransferArbiterP.nc, 1.1, 1.2 TKN154P.nc, 1.4, 1.5 TKN154_DEBUG.h, 1.2, 1.3
Jan-Hinrich Hauer
janhauer at users.sourceforge.net
Thu Oct 23 09:09:30 PDT 2008
Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv6388
Modified Files:
BeaconSynchronizeP.nc BeaconTransmitP.nc CsmaP.nc PibP.nc
RxEnableP.nc SimpleTransferArbiterP.nc TKN154P.nc
TKN154_DEBUG.h
Log Message:
Fixed a bug with the resource transfer
Index: BeaconSynchronizeP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/BeaconSynchronizeP.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** BeaconSynchronizeP.nc 21 Oct 2008 17:29:00 -0000 1.5
--- BeaconSynchronizeP.nc 23 Oct 2008 16:09:28 -0000 1.6
***************
*** 72,79 ****
interface RadioRx as BeaconRx;
interface RadioOff;
! interface Get<bool> as IsBeaconEnabledPAN;
interface DataRequest;
interface FrameRx as CoordRealignmentRx;
interface Resource as Token;
interface ResourceTransferred as TokenTransferred;
interface ResourceTransfer as TokenToCap;
--- 72,80 ----
interface RadioRx as BeaconRx;
interface RadioOff;
! interface GetNow<bool> as IsBeaconEnabledPAN;
interface DataRequest;
interface FrameRx as CoordRealignmentRx;
interface Resource as Token;
+ interface GetNow<bool> as IsTokenRequested;
interface ResourceTransferred as TokenTransferred;
interface ResourceTransfer as TokenToCap;
***************
*** 158,162 ****
currentChannelBit <<= logicalChannel;
if (!(currentChannelBit & supportedChannels) || (call MLME_GET.macPANId() == 0xFFFF) ||
! (channelPage != IEEE154_SUPPORTED_CHANNELPAGE) || !call IsBeaconEnabledPAN.get())
return IEEE154_INVALID_PARAMETER;
--- 159,163 ----
currentChannelBit <<= logicalChannel;
if (!(currentChannelBit & supportedChannels) || (call MLME_GET.macPANId() == 0xFFFF) ||
! (channelPage != IEEE154_SUPPORTED_CHANNELPAGE) || !call IsBeaconEnabledPAN.getNow())
return IEEE154_INVALID_PARAMETER;
***************
*** 172,176 ****
m_updatePending = TRUE;
call Debug.log(LEVEL_INFO,SyncP_RESOURCE_REQUEST, 0, 0, 0);
! call Token.request();
}
call Debug.flush();
--- 173,182 ----
m_updatePending = TRUE;
call Debug.log(LEVEL_INFO,SyncP_RESOURCE_REQUEST, 0, 0, 0);
! atomic {
! // if we are tracking then we'll get the Token automatically,
! // otherwise request it now
! if (!m_tracking && !call Token.isOwner())
! call Token.request();
! }
}
call Debug.flush();
***************
*** 192,196 ****
event void Token.granted()
{
- call Debug.flush();
call Debug.log(LEVEL_INFO,SyncP_GOT_RESOURCE, m_lastBeaconRxTime+m_beaconInterval,
m_beaconInterval, (m_updatePending<<1)+m_tracking);
--- 198,201 ----
***************
*** 210,213 ****
--- 215,219 ----
}
getNextBeacon();
+ call Debug.flush();
}
***************
*** 219,227 ****
m_state = S_PREPARE;
if (!m_tracking){
call Debug.log(LEVEL_INFO,SyncP_RELEASE_RESOURCE, 0, 0, 0);
call Token.release();
return;
}
! while (call TimeCalc.hasExpired(m_lastBeaconRxTime, m_dt)){ // missed a beacon
missed = TRUE;
call Debug.log(LEVEL_INFO,SyncP_BEACON_MISSED_1, m_lastBeaconRxTime, m_dt, missed);
--- 225,234 ----
m_state = S_PREPARE;
if (!m_tracking){
+ // nothing to do, just give up the token
call Debug.log(LEVEL_INFO,SyncP_RELEASE_RESOURCE, 0, 0, 0);
call Token.release();
return;
}
! while (call TimeCalc.hasExpired(m_lastBeaconRxTime, m_dt)){ // missed a beacon!
missed = TRUE;
call Debug.log(LEVEL_INFO,SyncP_BEACON_MISSED_1, m_lastBeaconRxTime, m_dt, missed);
***************
*** 248,252 ****
async event void TokenTransferred.transferred()
{
! if (m_updatePending)
post signalGrantedTask();
else
--- 255,264 ----
async event void TokenTransferred.transferred()
{
! if (call IsTokenRequested.getNow()){
! // some other component needs the token - we give it up for now,
! // but make another request to get it back later
! call Token.request();
! call Token.release();
! } else if (m_updatePending)
post signalGrantedTask();
else
***************
*** 328,335 ****
task void processBeaconTask()
{
-
// valid beacon timestamp is pre-condition for slotted CSMA-CA
if (m_beaconSwapBufferReady || !call Frame.isTimestampValid(m_beaconBufferPtr)){
// missed a beacon!
m_numBeaconsLost++;
m_dt += m_beaconInterval;
--- 340,347 ----
task void processBeaconTask()
{
// valid beacon timestamp is pre-condition for slotted CSMA-CA
if (m_beaconSwapBufferReady || !call Frame.isTimestampValid(m_beaconBufferPtr)){
// missed a beacon!
+ m_sfSlotDuration = 0; // CAP len will be 0
m_numBeaconsLost++;
m_dt += m_beaconInterval;
***************
*** 393,401 ****
m_tracking = FALSE;
call Debug.log(LEVEL_INFO,SyncP_RELEASE_RESOURCE, 0, 0, 0);
call Token.release();
} else {
! error_t req = call Token.request();
! call Debug.log(LEVEL_INFO,SyncP_TRANSFER_RESOURCE, req, 0, 0);
! call TokenToCap.transfer();
}
--- 405,414 ----
m_tracking = FALSE;
call Debug.log(LEVEL_INFO,SyncP_RELEASE_RESOURCE, 0, 0, 0);
+ if (m_updatePending) // there is already a new request pending...
+ call Token.request();
call Token.release();
} else {
! call Debug.log(LEVEL_INFO,SyncP_TRANSFER_RESOURCE, 0, 0, 0);
! call TokenToCap.transfer(); // borrow Token to CAP/CFP module, we'll get it back afterwards
}
Index: BeaconTransmitP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/BeaconTransmitP.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** BeaconTransmitP.nc 21 Oct 2008 17:29:00 -0000 1.4
--- BeaconTransmitP.nc 23 Oct 2008 16:09:28 -0000 1.5
***************
*** 66,70 ****
interface Timer<TSymbolIEEE802154> as BeaconPayloadUpdateTimer;
interface RadioOff;
! interface Get<bool> as IsBeaconEnabledPAN;
interface RadioTx as BeaconTx;
interface MLME_GET;
--- 66,70 ----
interface Timer<TSymbolIEEE802154> as BeaconPayloadUpdateTimer;
interface RadioOff;
! interface GetNow<bool> as IsBeaconEnabledPAN;
interface RadioTx as BeaconTx;
interface MLME_GET;
***************
*** 73,76 ****
--- 73,77 ----
interface ResourceTransferred as TokenTransferred;
interface ResourceTransfer as TokenToBroadcast;
+ interface GetNow<bool> as IsTokenRequested;
interface FrameTx as RealignmentBeaconEnabledTx;
interface FrameTx as RealignmentNonBeaconEnabledTx;
***************
*** 230,235 ****
else if (m_requests & (REQUEST_CONFIRM_PENDING | REQUEST_UPDATE_SF))
status = IEEE154_TRANSACTION_OVERFLOW;
! else if ((call IsBeaconEnabledPAN.get() && beaconOrder > 14) ||
! (!call IsBeaconEnabledPAN.get() && beaconOrder < 15))
status = IEEE154_INVALID_PARAMETER;
else {
--- 231,236 ----
else if (m_requests & (REQUEST_CONFIRM_PENDING | REQUEST_UPDATE_SF))
status = IEEE154_TRANSACTION_OVERFLOW;
! else if ((call IsBeaconEnabledPAN.getNow() && beaconOrder == 15) ||
! (!call IsBeaconEnabledPAN.getNow() && beaconOrder < 15))
status = IEEE154_INVALID_PARAMETER;
else {
***************
*** 254,258 ****
m_requests |= REQUEST_REALIGNMENT;
if (m_beaconOrder == 15) // only request token if we're not already transmitting beacons
! call Token.request();
}
return status;
--- 255,259 ----
m_requests |= REQUEST_REALIGNMENT;
if (m_beaconOrder == 15) // only request token if we're not already transmitting beacons
! call Token.request(); // otherwise we'll get it eventually and update the superframe then
}
return status;
***************
*** 414,418 ****
async event void TokenTransferred.transferred()
{
! post grantedTask();
}
--- 415,425 ----
async event void TokenTransferred.transferred()
{
! if (call IsTokenRequested.getNow()){
! // some other component needs the token - we give it up for now,
! // but make another request to get it back later
! call Token.request();
! call Token.release();
! } else
! post grantedTask();
}
***************
*** 429,433 ****
call Debug.log(LEVEL_CRITICAL, StartP_OWNER_TOO_FAST, 0, 0, 0);
return;
! } else if (m_beaconOrder > 14){
call Token.release();
} else {
--- 436,440 ----
call Debug.log(LEVEL_CRITICAL, StartP_OWNER_TOO_FAST, 0, 0, 0);
return;
! } else if (m_beaconOrder == 15){
call Token.release();
} else {
***************
*** 536,541 ****
} else
m_BLELen = 0;
! call Token.request(); // register another request, before ...
! call TokenToBroadcast.transfer(); // ... we let Broadcast module take over
post txDoneTask();
}
--- 543,547 ----
} else
m_BLELen = 0;
! call TokenToBroadcast.transfer(); // borrow Token to Broadcast/CAP/CFP module, we'll get it back afterwards
post txDoneTask();
}
Index: CsmaP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/CsmaP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CsmaP.nc 21 Oct 2008 17:29:00 -0000 1.2
--- CsmaP.nc 23 Oct 2008 16:09:28 -0000 1.3
***************
*** 73,80 ****
interface Alarm<TSymbolIEEE802154,uint32_t> as BroadcastAlarm;
interface Resource as Token;
interface ResourceTransfer as TokenToCfp;
interface ResourceTransferred as TokenTransferred;
- interface ResourceRequested as TokenRequested;
- interface GetNow<bool> as IsTokenRequested;
interface GetNow<uint32_t> as CapStart;
interface GetNow<ieee154_reftime_t*> as CapStartRefTime;
--- 73,79 ----
interface Alarm<TSymbolIEEE802154,uint32_t> as BroadcastAlarm;
interface Resource as Token;
+ interface GetNow<bool> as IsTokenRequested;
interface ResourceTransfer as TokenToCfp;
interface ResourceTransferred as TokenTransferred;
interface GetNow<uint32_t> as CapStart;
interface GetNow<ieee154_reftime_t*> as CapStartRefTime;
***************
*** 90,94 ****
interface RadioRx;
interface RadioOff;
! interface Get<bool> as IsBeaconEnabledPAN;
interface MLME_GET;
interface MLME_SET;
--- 89,93 ----
interface RadioRx;
interface RadioOff;
! interface GetNow<bool> as IsBeaconEnabledPAN;
interface MLME_GET;
interface MLME_SET;
***************
*** 139,143 ****
norace bool m_broadcastRxPending;
norace ieee154_macMaxFrameTotalWaitTime_t m_macMaxFrameTotalWaitTime;
- norace bool m_isBeaconEnabledPAN;
uint16_t generateRandomBackoff(uint8_t BE);
--- 138,141 ----
***************
*** 157,164 ****
command error_t Reset.init()
{
- if (call Token.isOwner()){
- call Leds.led0On(); // internal error
- return FAIL;
- }
if (m_currentFrame)
signal FrameTx.transmitDone(m_currentFrame, IEEE154_TRANSACTION_OVERFLOW);
--- 155,158 ----
***************
*** 168,173 ****
signalTxBroadcastDone(m_bcastFrame, IEEE154_TRANSACTION_OVERFLOW);
m_currentFrame = m_lastFrame = m_bcastFrame = NULL;
- m_macMaxFrameTotalWaitTime = call MLME_GET.macMaxFrameTotalWaitTime();
- m_isBeaconEnabledPAN = call IsBeaconEnabledPAN.get();
stopAllAlarms();
return SUCCESS;
--- 162,165 ----
***************
*** 178,186 ****
// we got the token, i.e. CAP has just started
uint32_t actualCapLen = call CapLen.getNow();
! if (m_isBeaconEnabledPAN && (DEVICE_ROLE && !call IsTrackingBeacons.getNow())){
! // rare case: we're on a beacon-enabled PAN, not tracking beacons, searched
! // and didn't find a beacon for aBaseSuperframeDuration*(2n+1) symbols
// -> transmit current frame using unslotted CSMA-CA
m_numCCA = 1;
} else if (actualCapLen < IEEE154_RADIO_GUARD_TIME){
call Debug.log(LEVEL_IMPORTANT, CapP_TOO_SHORT, superframeDirection, actualCapLen, IEEE154_RADIO_GUARD_TIME);
--- 170,185 ----
// we got the token, i.e. CAP has just started
uint32_t actualCapLen = call CapLen.getNow();
! if (!call IsBeaconEnabledPAN.getNow()){
! call Leds.led0On(); // internal error!
! call TokenToCfp.transfer();
! call Debug.log(LEVEL_IMPORTANT, CapP_INTERNAL_ERROR, 0,0,0);
! } else if (DEVICE_ROLE && actualCapLen == 0){
! // very rare case:
! // this can only happen, if we're on a beacon-enabled PAN, not tracking beacons,
! // and searched but didn't find a beacon for aBaseSuperframeDuration*(2n+1) symbols
// -> transmit current frame using unslotted CSMA-CA
m_numCCA = 1;
+ updateState();
+ return;
} else if (actualCapLen < IEEE154_RADIO_GUARD_TIME){
call Debug.log(LEVEL_IMPORTANT, CapP_TOO_SHORT, superframeDirection, actualCapLen, IEEE154_RADIO_GUARD_TIME);
***************
*** 217,221 ****
else {
setCurrentFrame(frame);
! if (!m_isBeaconEnabledPAN){
call Token.request(); // prepare for unslotted CSMA-CA
} else {
--- 216,220 ----
else {
setCurrentFrame(frame);
! if (!call IsBeaconEnabledPAN.getNow()){
call Token.request(); // prepare for unslotted CSMA-CA
} else {
***************
*** 271,275 ****
m_macMinBE = 2;
m_BE = m_macMinBE;
! if (m_isBeaconEnabledPAN)
m_numCCA = 2;
else
--- 270,274 ----
m_macMinBE = 2;
m_BE = m_macMinBE;
! if (call IsBeaconEnabledPAN.getNow())
m_numCCA = 2;
else
***************
*** 338,342 ****
// Check 1: for beacon-enabled PANs, has the CAP finished?
! if (m_isBeaconEnabledPAN
&& (COORD_ROLE || call IsTrackingBeacons.getNow()) // FALSE only if device could't find a beacon
&& (call TimeCalc.hasExpired(call CapStart.getNow(), call CapLen.getNow()-IEEE154_RADIO_GUARD_TIME) ||
--- 337,341 ----
// Check 1: for beacon-enabled PANs, has the CAP finished?
! if (call IsBeaconEnabledPAN.getNow()
&& (COORD_ROLE || call IsTrackingBeacons.getNow()) // FALSE only if device could't find a beacon
&& (call TimeCalc.hasExpired(call CapStart.getNow(), call CapLen.getNow()-IEEE154_RADIO_GUARD_TIME) ||
***************
*** 376,384 ****
// Check 4: is some other operation (like MLME-SCAN or MLME-RESET) pending?
! else if (call IsTokenRequested.getNow()) {
if (call RadioOff.isOff()) {
! stopAllAlarms(); // may still fire, locked through isOwner()
! call Token.release();
! next = DO_NOTHING;
} else
next = SWITCH_OFF;
--- 375,385 ----
// Check 4: is some other operation (like MLME-SCAN or MLME-RESET) pending?
! else if (call IsTokenRequested.getNow() && call IsBeaconEnabledPAN.getNow()) {
if (call RadioOff.isOff()) {
! stopAllAlarms(); // may still fire, but is locked through isOwner()
! // nothing more to do... just release the Token
! m_lock = FALSE; // unlock
! call TokenToCfp.transfer();
! return;
} else
next = SWITCH_OFF;
***************
*** 412,419 ****
else {
next = trySwitchOff();
! if (next == DO_NOTHING && (!m_isBeaconEnabledPAN || (DEVICE_ROLE && !call IsTrackingBeacons.getNow()))){
// nothing more to do... just release the Token
m_lock = FALSE; // unlock
! call TokenToCfp.transfer();
return;
}
--- 413,422 ----
else {
next = trySwitchOff();
! if (next == DO_NOTHING &&
! (!call IsBeaconEnabledPAN.getNow() || (DEVICE_ROLE && call CapLen.getNow() == 0))){
// nothing more to do... just release the Token
+ stopAllAlarms(); // may still fire, but is locked through isOwner()
m_lock = FALSE; // unlock
! call Token.release();
return;
}
***************
*** 704,732 ****
event void Token.granted()
{
! // will not happen
! }
!
! task void tokenRequestedTask()
! {
! signal TokenRequested.requested();
! }
!
! async event void TokenRequested.requested()
! {
! // TODO: this event can be generated by the BeaconTransmitP or
! // BeaconSynchronizeP component - in this case the Token should
! // probably not be released!
! atomic {
! if (call Token.isOwner()){
! if (!m_lock && !(DEVICE_ROLE && m_indirectTxPending) && !(COORD_ROLE && m_bcastFrame))
! call Token.release();
! else
! post tokenRequestedTask();
! }
! }
}
- async event void TokenRequested.immediateRequested() {}
-
default event void FrameTx.transmitDone(ieee154_txframe_t *data, ieee154_status_t status){}
default event message_t* FrameRx.received[uint8_t client](message_t* data){return data;}
--- 707,714 ----
event void Token.granted()
{
! // the current frame should be transmitted using unslotted CSMA-CA
! updateState();
}
default event void FrameTx.transmitDone(ieee154_txframe_t *data, ieee154_status_t status){}
default event message_t* FrameRx.received[uint8_t client](message_t* data){return data;}
Index: PibP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/PibP.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PibP.nc 21 Oct 2008 17:29:00 -0000 1.3
--- PibP.nc 23 Oct 2008 16:09:28 -0000 1.4
***************
*** 51,55 ****
interface Set<ieee154_macPanCoordinator_t> as SetMacPanCoordinator;
interface Get<ieee154_macPanCoordinator_t> as IsMacPanCoordinator;
! interface Get<bool> as IsBeaconEnabledPAN;
interface FrameUtility;
interface IEEE154Frame as Frame;
--- 51,55 ----
interface Set<ieee154_macPanCoordinator_t> as SetMacPanCoordinator;
interface Get<ieee154_macPanCoordinator_t> as IsMacPanCoordinator;
! interface GetNow<bool> as IsBeaconEnabledPAN;
interface FrameUtility;
interface IEEE154Frame as Frame;
***************
*** 78,82 ****
uint8_t m_numResetClientPending;
bool m_setDefaultPIB;
! uint8_t m_panType;
uint8_t m_resetSpin;
--- 78,83 ----
uint8_t m_numResetClientPending;
bool m_setDefaultPIB;
! norace uint8_t m_panType;
! uint8_t m_updatePANType;
uint8_t m_resetSpin;
***************
*** 177,181 ****
return IEEE154_TRANSACTION_OVERFLOW; // must first cancel promiscuous mode!
m_setDefaultPIB = SetDefaultPIB;
! m_panType = PANType;
if (!call Token.isOwner())
call Token.request();
--- 178,182 ----
return IEEE154_TRANSACTION_OVERFLOW; // must first cancel promiscuous mode!
m_setDefaultPIB = SetDefaultPIB;
! m_updatePANType = PANType;
if (!call Token.isOwner())
call Token.request();
***************
*** 203,208 ****
event void RadioControl.stopDone(error_t error)
{
! call CapReset.init(); // resets the CAP component(s)
! call CapQueueReset.init(); // resets the CAP queue component(s)
call MacReset.init(); // resets the remaining components
m_resetSpin = 5;
--- 204,210 ----
event void RadioControl.stopDone(error_t error)
{
! m_panType = m_updatePANType;
! call CapReset.init(); // resets the CAP component(s), spool out frames
! call CapQueueReset.init(); // resets the CAP queue component(s), spool out frames
call MacReset.init(); // resets the remaining components
m_resetSpin = 5;
***************
*** 1048,1052 ****
}
! command bool IsBeaconEnabledPAN.get()
{
return (m_panType == BEACON_ENABLED_PAN);
--- 1050,1054 ----
}
! async command bool IsBeaconEnabledPAN.getNow()
{
return (m_panType == BEACON_ENABLED_PAN);
Index: RxEnableP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/RxEnableP.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** RxEnableP.nc 21 Oct 2008 17:29:00 -0000 1.3
--- RxEnableP.nc 23 Oct 2008 16:09:28 -0000 1.4
***************
*** 49,53 ****
interface Ieee802154Debug as Debug;
interface Timer<TSymbolIEEE802154> as RxEnableTimer;
! interface Get<bool> as IsBeaconEnabledPAN;
interface Get<ieee154_macPanCoordinator_t> as IsMacPanCoordinator;
interface GetNow<bool> as IsTrackingBeacons;
--- 49,53 ----
interface Ieee802154Debug as Debug;
interface Timer<TSymbolIEEE802154> as RxEnableTimer;
! interface GetNow<bool> as IsBeaconEnabledPAN;
interface Get<ieee154_macPanCoordinator_t> as IsMacPanCoordinator;
interface GetNow<bool> as IsTrackingBeacons;
***************
*** 96,100 ****
if (RxOnTime > 0xFFFFFF || RxOnDuration > 0xFFFFFF)
return IEEE154_INVALID_PARAMETER;
! if (call IsBeaconEnabledPAN.get()){
if (call IsSendingBeacons.getNow() && call IsMacPanCoordinator.get()){
// for OUTGOING SUPERFRAME
--- 96,100 ----
if (RxOnTime > 0xFFFFFF || RxOnDuration > 0xFFFFFF)
return IEEE154_INVALID_PARAMETER;
! if (call IsBeaconEnabledPAN.getNow()){
if (call IsSendingBeacons.getNow() && call IsMacPanCoordinator.get()){
// for OUTGOING SUPERFRAME
Index: SimpleTransferArbiterP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/SimpleTransferArbiterP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SimpleTransferArbiterP.nc 16 Jun 2008 18:00:29 -0000 1.1
--- SimpleTransferArbiterP.nc 23 Oct 2008 16:09:28 -0000 1.2
***************
*** 69,83 ****
norace uint8_t resId = NO_RES;
norace uint8_t reqResId;
- norace uint8_t numTransfers;
- norace bool reqWhileTransferred;
task void grantedTask();
- task void checkResourceRequestedTask();
async command error_t Resource.request[uint8_t id]() {
signal ResourceRequested.requested[resId]();
atomic {
- if (numTransfers > 0)
- reqWhileTransferred = TRUE;
if(state == RES_IDLE) {
state = RES_GRANTING;
--- 69,78 ----
***************
*** 107,112 ****
atomic {
if(state == RES_BUSY && resId == id) {
- numTransfers = 0;
- reqWhileTransferred = FALSE;
if(call Queue.isEmpty() == FALSE) {
reqResId = call Queue.dequeue();
--- 102,105 ----
***************
*** 130,140 ****
async command bool IsResourceRequested.getNow()
{
! return reqWhileTransferred;
! }
!
! task void checkResourceRequestedTask()
! {
! if (numTransfers && reqWhileTransferred)
! signal ResourceRequested.requested[resId]();
}
--- 123,127 ----
async command bool IsResourceRequested.getNow()
{
! return !(call Queue.isEmpty());
}
***************
*** 143,161 ****
atomic {
if (call ArbiterInfo.userId() == fromClient){
- numTransfers += 1;
call ResourceConfigure.unconfigure[fromClient]();
call ResourceConfigure.configure[resId]();
resId = toClient;
- post checkResourceRequestedTask();
return SUCCESS;
}
! }
return FAIL;
}
-
- async command error_t ResourceTransferControl.release(uint8_t client)
- {
- return call Resource.release[client]();
- }
/**
--- 130,141 ----
atomic {
if (call ArbiterInfo.userId() == fromClient){
call ResourceConfigure.unconfigure[fromClient]();
call ResourceConfigure.configure[resId]();
resId = toClient;
return SUCCESS;
}
! }
return FAIL;
}
/**
Index: TKN154P.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/TKN154P.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TKN154P.nc 21 Oct 2008 17:29:00 -0000 1.4
--- TKN154P.nc 23 Oct 2008 16:09:28 -0000 1.5
***************
*** 256,259 ****
--- 256,260 ----
BeaconTransmitP.SetMacPanCoordinator -> PibP.SetMacPanCoordinator;
BeaconTransmitP.Token -> BeaconTxRadioClient;
+ BeaconTransmitP.IsTokenRequested -> BeaconTxRadioClient;
BeaconTransmitP.TokenTransferred -> BeaconTxRadioClient;
BeaconTransmitP.TokenToBroadcast -> BeaconTxRadioClient;
***************
*** 292,295 ****
--- 293,297 ----
BeaconSynchronizeP.DataRequest -> PollP.DataRequest[SYNC_CLIENT];
BeaconSynchronizeP.Token -> SyncRadioClient;
+ BeaconSynchronizeP.IsTokenRequested -> SyncRadioClient;
BeaconSynchronizeP.TokenTransferred -> SyncRadioClient;
BeaconSynchronizeP.TokenToCap -> SyncRadioClient;
***************
*** 429,436 ****
DeviceCap.BroadcastAlarm = Alarm6;
DeviceCap.Token -> DeviceCapRadioClient;
DeviceCap.TokenToCfp -> DeviceCapRadioClient;
DeviceCap.TokenTransferred -> DeviceCapRadioClient;
- DeviceCap.TokenRequested -> DeviceCapRadioClient;
- DeviceCap.IsTokenRequested -> DeviceCapRadioClient;
DeviceCap.CapStart -> BeaconSynchronizeP.CapStart;
DeviceCap.CapStartRefTime -> BeaconSynchronizeP.CapStartRefTime;
--- 431,437 ----
DeviceCap.BroadcastAlarm = Alarm6;
DeviceCap.Token -> DeviceCapRadioClient;
+ DeviceCap.IsTokenRequested -> DeviceCapRadioClient;
DeviceCap.TokenToCfp -> DeviceCapRadioClient;
DeviceCap.TokenTransferred -> DeviceCapRadioClient;
DeviceCap.CapStart -> BeaconSynchronizeP.CapStart;
DeviceCap.CapStartRefTime -> BeaconSynchronizeP.CapStartRefTime;
***************
*** 465,469 ****
CoordCap.TokenToCfp -> CoordCapRadioClient;
CoordCap.TokenTransferred -> CoordCapRadioClient;
- CoordCap.TokenRequested -> CoordCapRadioClient;
CoordCap.IsTokenRequested -> CoordCapRadioClient;
CoordCap.CapStart -> BeaconTransmitP.CapStart;
--- 466,469 ----
***************
*** 493,497 ****
components new RadioClientC() as DeviceCfpRadioClient;
PibP.MacReset -> DeviceCfp;
- DeviceCfp.Token -> DeviceCfpRadioClient;
DeviceCfp.TokenTransferred -> DeviceCfpRadioClient;
DeviceCfp.TokenRequested -> DeviceCfpRadioClient;
--- 493,496 ----
***************
*** 516,522 ****
components new RadioClientC() as CoordCfpRadioClient;
PibP.MacReset -> CoordCfp;
- CoordCfp.Token -> CoordCfpRadioClient;
CoordCfp.TokenTransferred -> CoordCfpRadioClient;
CoordCfp.TokenRequested -> CoordCfpRadioClient;
CoordCfp.TokenToBeaconTransmit -> CoordCfpRadioClient;
CoordCfp.IsTrackingBeacons -> BeaconSynchronizeP.IsTrackingBeacons;
--- 515,521 ----
components new RadioClientC() as CoordCfpRadioClient;
PibP.MacReset -> CoordCfp;
CoordCfp.TokenTransferred -> CoordCfpRadioClient;
CoordCfp.TokenRequested -> CoordCfpRadioClient;
+ CoordCfp.IsTokenRequested -> CoordCfpRadioClient;
CoordCfp.TokenToBeaconTransmit -> CoordCfpRadioClient;
CoordCfp.IsTrackingBeacons -> BeaconSynchronizeP.IsTrackingBeacons;
Index: TKN154_DEBUG.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/mac/tkn154/TKN154_DEBUG.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** TKN154_DEBUG.h 21 Oct 2008 17:29:00 -0000 1.2
--- TKN154_DEBUG.h 23 Oct 2008 16:09:28 -0000 1.3
***************
*** 135,138 ****
--- 135,139 ----
#define CapP_SET_CAP_END 1
#define CapP_CAP_END_FIRED 2
+ #define CapP_INTERNAL_ERROR 3
#define DeviceCapTransmitP_CONTINUE 0
More information about the Tinyos-2-commits
mailing list