X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Flib%2Fmac%2Ftkn154%2FScanP.nc;h=87b5e6df3283e1b4c6c58d9c26763a2466ed0d05;hb=7c8134e8789a99210cc147b3a3379dffeb0f3bae;hp=ce332ba2159931bf557ca2938def680b7a4cf4c9;hpb=dd2eec28b5c692a5319c6e7feb14a67e716f2406;p=tinyos-2.x.git diff --git a/tos/lib/mac/tkn154/ScanP.nc b/tos/lib/mac/tkn154/ScanP.nc index ce332ba2..87b5e6df 100644 --- a/tos/lib/mac/tkn154/ScanP.nc +++ b/tos/lib/mac/tkn154/ScanP.nc @@ -45,6 +45,7 @@ module ScanP interface Init; interface MLME_SCAN; interface MLME_BEACON_NOTIFY; + interface GetNow as IsRadioTokenRequested; } uses { @@ -59,7 +60,7 @@ module ScanP interface Timer as ScanTimer; interface Pool as TxFramePool; interface Pool as TxControlPool; - interface Resource as Token; + interface TransferableResource as RadioToken; interface FrameUtility; interface Leds; } @@ -83,7 +84,7 @@ implementation uint8_t m_resultIndex; ieee154_macPANId_t m_PANID; norace uint32_t m_scanDuration; - bool m_busy = FALSE; + norace bool m_busy = FALSE; void nextIteration(); void continueScanRequest(); @@ -92,10 +93,10 @@ implementation command error_t Init.init() { - // triggered by MLME_RESET; remember: Init will not be called - // while this component owns the Token, so the worst case is + // triggered by MLME_RESET; Note: Init will not be called + // while this component owns the RadioToken, so the worst case is // that a MLME_SCAN was accepted (returned IEEE154_SUCCESS) - // but the Token.granted() has not been signalled + // but the RadioToken.granted() has not been signalled if (m_busy) { m_currentChannelNum = 27; nextIteration(); // signals confirm and resets state @@ -169,13 +170,13 @@ implementation } if (m_resultList == NULL) m_resultListNumEntries = 0; - call Token.request(); + call RadioToken.request(); } dbg_serial("ScanP", "MLME_SCAN.request -> result: %lu\n", (uint32_t) status); return status; } - event void Token.granted() + event void RadioToken.granted() { if (call RadioOff.isOff()) continueScanRequest(); @@ -196,7 +197,7 @@ implementation ieee154_macDSN_t dsn = call MLME_GET.macDSN(); if (!m_busy) { - call Token.release(); + call RadioToken.release(); return; } switch (m_scanType) { @@ -278,8 +279,8 @@ implementation call TxFramePool.put(m_txFrame); } m_txFrame = NULL; - if (call Token.isOwner()) - call Token.release(); + if (call RadioToken.isOwner()) + call RadioToken.release(); m_busy = FALSE; dbg_serial("ScanP", "MLME_SCAN.confirm()\n"); signal MLME_SCAN.confirm ( @@ -288,12 +289,13 @@ implementation IEEE154_SUPPORTED_CHANNELPAGE, m_unscannedChannels, (m_scanType == ENERGY_DETECTION_SCAN) ? m_resultIndex : 0, - (m_scanType == ENERGY_DETECTION_SCAN) ? (uint8_t*) m_resultList : NULL, + (m_scanType == ENERGY_DETECTION_SCAN) ? (int8_t*) m_resultList : NULL, ((m_scanType == ACTIVE_SCAN || m_scanType == PASSIVE_SCAN) && m_macAutoRequest) ? m_resultIndex : 0, ((m_scanType == ACTIVE_SCAN || m_scanType == PASSIVE_SCAN) && m_macAutoRequest) ? (ieee154_PANDescriptor_t*) m_resultList : NULL); } + dbg_serial_flush(); } async event void RadioRx.enableRxDone() @@ -405,6 +407,8 @@ implementation nextIteration(); } + async command token_requested_t IsRadioTokenRequested.getNow(){ return m_busy;} + async event void RadioToken.transferredFrom(uint8_t id){ ASSERT(0);} default event message_t* MLME_BEACON_NOTIFY.indication (message_t *beaconFrame) {return beaconFrame;} default event void MLME_SCAN.confirm ( ieee154_status_t status,