From 228a941bc357483e1fb939530b8d36903b60e2e7 Mon Sep 17 00:00:00 2001 From: janhauer Date: Sat, 2 Aug 2008 16:56:21 +0000 Subject: [PATCH] - changed component names - added note about documentation --- tos/lib/mac/tkn154/{CapP.nc => CsmaP.nc} | 30 ++++++++-------- .../tkn154/{CapQueueP.nc => CsmaQueueP.nc} | 18 +++++----- tos/lib/mac/tkn154/README.txt | 11 +++--- tos/lib/mac/tkn154/RadioClientC.nc | 18 +++++----- ...eDispatchImplP.nc => RadioControlImplP.nc} | 2 +- .../{FrameDispatchP.nc => RadioControlP.nc} | 24 ++++++------- tos/lib/mac/tkn154/TKN154P.nc | 36 +++++++++---------- .../tkn154/dummies/{NoCapP.nc => NoCsmaP.nc} | 6 ++-- .../{NoCapQueueP.nc => NoCsmaQueueP.nc} | 6 ++-- 9 files changed, 77 insertions(+), 74 deletions(-) rename tos/lib/mac/tkn154/{CapP.nc => CsmaP.nc} (96%) rename tos/lib/mac/tkn154/{CapQueueP.nc => CsmaQueueP.nc} (92%) rename tos/lib/mac/tkn154/{FrameDispatchImplP.nc => RadioControlImplP.nc} (99%) rename tos/lib/mac/tkn154/{FrameDispatchP.nc => RadioControlP.nc} (85%) rename tos/lib/mac/tkn154/dummies/{NoCapP.nc => NoCsmaP.nc} (97%) rename tos/lib/mac/tkn154/dummies/{NoCapQueueP.nc => NoCsmaQueueP.nc} (94%) diff --git a/tos/lib/mac/tkn154/CapP.nc b/tos/lib/mac/tkn154/CsmaP.nc similarity index 96% rename from tos/lib/mac/tkn154/CapP.nc rename to tos/lib/mac/tkn154/CsmaP.nc index 2fec1c0a..b32714cb 100644 --- a/tos/lib/mac/tkn154/CapP.nc +++ b/tos/lib/mac/tkn154/CsmaP.nc @@ -37,24 +37,27 @@ #include "TKN154_MAC.h" /** - * This module is responsible for sending/receiving frames during the - * contention access period (CAP in beacon-enabled mode). It does slightly - * different things depending on whether it is the CAP for an outgoing + * This module implements the slotted and unslotted CSMA-CA algorithm. + * Unslotted CSMA-CA is used in nonbeacon-enabled PANs, slotted CSMA-CA is used + * in beacon-enabled PANs. In a beacon-enabled PAN this module is responsible + * for channel access during the contention access period (CAP). It does + * slightly different things depending on whether it is the CAP for an outgoing * superframe (superframeDirection = OUTGOING_SUPERFRAME), i.e. the CAP from * the perspective of a coordinator after it has transmitted its own beacon; or * for an incoming superframe (superframeDirection = INCOMING_SUPERFRAME), i.e. * the CAP from the perspective of a device after it has received a beacon from - * its coordinator (e.g. in the CAP a coordinator will usually listen for - * incoming frames from the devices, and a device will usually switch the - * radio off unless it has a frame to transmit). + * its coordinator; for example, in the CAP a coordinator will usually listen for + * incoming frames from the devices, and a device will usually switch the radio + * off unless it has a frame to transmit. In nonbeacon-enabled PANs the + * superframeDirection parameter is ignored. */ -generic module CapP(uint8_t superframeDirection) +generic module CsmaP(uint8_t superframeDirection) { provides { interface Init as Reset; - interface FrameTx as CapTx; + interface FrameTx as FrameTx; interface FrameRx as FrameRx[uint8_t frameType]; interface FrameExtracted as FrameExtracted[uint8_t frameType]; interface FrameTxNow as BroadcastTx; @@ -158,9 +161,9 @@ implementation return FAIL; } if (m_currentFrame) - signal CapTx.transmitDone(m_currentFrame, IEEE154_TRANSACTION_OVERFLOW); + signal FrameTx.transmitDone(m_currentFrame, IEEE154_TRANSACTION_OVERFLOW); if (m_lastFrame) - signal CapTx.transmitDone(m_lastFrame, IEEE154_TRANSACTION_OVERFLOW); + signal FrameTx.transmitDone(m_lastFrame, IEEE154_TRANSACTION_OVERFLOW); if (m_bcastFrame) signalTxBroadcastDone(m_bcastFrame, IEEE154_TRANSACTION_OVERFLOW); m_currentFrame = m_lastFrame = m_bcastFrame = NULL; @@ -211,9 +214,8 @@ implementation call Debug.flush(); } - command ieee154_status_t CapTx.transmit(ieee154_txframe_t *frame) + command ieee154_status_t FrameTx.transmit(ieee154_txframe_t *frame) { - // this frame (DATA or COMMAND) should be transmitted in the CAP if (m_currentFrame != NULL) return IEEE154_TRANSACTION_OVERFLOW; else { @@ -616,7 +618,7 @@ implementation m_lastFrame = NULL; // only now can a next transmission begin m_indirectTxPending = FALSE; if (lastFrame) - signal CapTx.transmitDone(lastFrame, m_result); + signal FrameTx.transmitDone(lastFrame, m_result); updateState(); } @@ -728,7 +730,7 @@ implementation async event void TokenRequested.immediateRequested() {} - default event void CapTx.transmitDone(ieee154_txframe_t *data, ieee154_status_t status){} + 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;} default async command bool IsRxEnableActive.getNow(){return FALSE;} diff --git a/tos/lib/mac/tkn154/CapQueueP.nc b/tos/lib/mac/tkn154/CsmaQueueP.nc similarity index 92% rename from tos/lib/mac/tkn154/CapQueueP.nc rename to tos/lib/mac/tkn154/CsmaQueueP.nc index b3104d4c..f89c762a 100644 --- a/tos/lib/mac/tkn154/CapQueueP.nc +++ b/tos/lib/mac/tkn154/CsmaQueueP.nc @@ -33,7 +33,7 @@ * ======================================================================== */ #include "TKN154_MAC.h" -generic module CapQueueP() { +generic module CsmaQueueP() { provides { interface Init as Reset; @@ -42,13 +42,13 @@ generic module CapQueueP() { interface Purge; } uses { interface Queue; - interface FrameTx as CapTx; + interface FrameTx as FrameTxCsma; interface FrameRx as SubFrameExtracted; } } implementation { - task void tryCapTxTask(); + task void txTask(); bool m_busy; uint8_t m_client; @@ -68,12 +68,12 @@ implementation if (call Queue.enqueue(txFrame) != SUCCESS) return IEEE154_TRANSACTION_OVERFLOW; else { - post tryCapTxTask(); + post txTask(); return IEEE154_SUCCESS; } } - task void tryCapTxTask() + task void txTask() { if (!m_busy && call Queue.size()){ ieee154_txframe_t *txFrame = call Queue.head(); @@ -81,21 +81,21 @@ implementation // was purged call Queue.dequeue(); signal Purge.purgeDone(txFrame, IEEE154_SUCCESS); - post tryCapTxTask(); + post txTask(); } m_client = txFrame->client; - if (call CapTx.transmit(txFrame) == IEEE154_SUCCESS){ + if (call FrameTxCsma.transmit(txFrame) == IEEE154_SUCCESS){ m_busy = TRUE; } } } - event void CapTx.transmitDone(ieee154_txframe_t *txFrame, ieee154_status_t status) + event void FrameTxCsma.transmitDone(ieee154_txframe_t *txFrame, ieee154_status_t status) { call Queue.dequeue(); m_busy = FALSE; signal FrameTx.transmitDone[txFrame->client](txFrame, status); - post tryCapTxTask(); + post txTask(); } event message_t* SubFrameExtracted.received(message_t* frame) diff --git a/tos/lib/mac/tkn154/README.txt b/tos/lib/mac/tkn154/README.txt index e9b4bd3e..b5377075 100644 --- a/tos/lib/mac/tkn154/README.txt +++ b/tos/lib/mac/tkn154/README.txt @@ -10,16 +10,17 @@ TelosB the timing in beacon-enabled mode is not standard compliant). Status 6/16/08 -------------- -missing functionality: +Missing functionality: - security (not planned) - GTS (not planned) - PAN ID conflict resolution - multiple indirect transmissions to the same destination -missing documentation: -- overview on the architecture of TKN15.4 -- guidance on porting TKN15.4 to a new platform -- ... +Documentation +------------- + +A technical report on TKN15.4 is under way and will be available at: +http://www.tkn.tu-berlin.de/publications/reports.jsp Implementation -------------- diff --git a/tos/lib/mac/tkn154/RadioClientC.nc b/tos/lib/mac/tkn154/RadioClientC.nc index 53b6e9b7..551679c2 100644 --- a/tos/lib/mac/tkn154/RadioClientC.nc +++ b/tos/lib/mac/tkn154/RadioClientC.nc @@ -56,20 +56,20 @@ implementation CLIENT = unique(IEEE802154_RADIO_RESOURCE), }; - components FrameDispatchP; - RadioRx = FrameDispatchP.RadioRx[CLIENT]; - RadioTx = FrameDispatchP.RadioTx[CLIENT]; - RadioOff = FrameDispatchP.RadioOff[CLIENT]; - Token = FrameDispatchP.Token[CLIENT]; - IsResourceRequested = FrameDispatchP.IsResourceRequested; - TokenRequested = FrameDispatchP.TokenRequested[CLIENT]; + components RadioControlP; + RadioRx = RadioControlP.RadioRx[CLIENT]; + RadioTx = RadioControlP.RadioTx[CLIENT]; + RadioOff = RadioControlP.RadioOff[CLIENT]; + Token = RadioControlP.Token[CLIENT]; + IsResourceRequested = RadioControlP.IsResourceRequested; + TokenRequested = RadioControlP.TokenRequested[CLIENT]; components new TransferClientP(CLIENT); ResourceTransfer = TransferClientP; ResourceTransferred = TransferClientP; TransferTo = TransferClientP; TransferFrom = TransferClientP; - TransferClientP.ResourceTransferControl -> FrameDispatchP; - TransferClientP.Leds -> FrameDispatchP; + TransferClientP.ResourceTransferControl -> RadioControlP; + TransferClientP.Leds -> RadioControlP; } diff --git a/tos/lib/mac/tkn154/FrameDispatchImplP.nc b/tos/lib/mac/tkn154/RadioControlImplP.nc similarity index 99% rename from tos/lib/mac/tkn154/FrameDispatchImplP.nc rename to tos/lib/mac/tkn154/RadioControlImplP.nc index c9527132..189d8761 100644 --- a/tos/lib/mac/tkn154/FrameDispatchImplP.nc +++ b/tos/lib/mac/tkn154/RadioControlImplP.nc @@ -34,7 +34,7 @@ */ #include "TKN154_MAC.h" #include "TKN154_DEBUG.h" -module FrameDispatchImplP +module RadioControlImplP { provides { diff --git a/tos/lib/mac/tkn154/FrameDispatchP.nc b/tos/lib/mac/tkn154/RadioControlP.nc similarity index 85% rename from tos/lib/mac/tkn154/FrameDispatchP.nc rename to tos/lib/mac/tkn154/RadioControlP.nc index 7f69f9e8..ad9d541b 100644 --- a/tos/lib/mac/tkn154/FrameDispatchP.nc +++ b/tos/lib/mac/tkn154/RadioControlP.nc @@ -33,7 +33,7 @@ * ======================================================================== */ #include "TKN154_MAC.h" -configuration FrameDispatchP +configuration RadioControlP { provides { @@ -56,16 +56,16 @@ configuration FrameDispatchP } implementation { - components FrameDispatchImplP; - RadioRx = FrameDispatchImplP.MacRx; - RadioTx = FrameDispatchImplP.MacTx; - RadioOff = FrameDispatchImplP.MacRadioOff; - PhyRx = FrameDispatchImplP.PhyRx; - PhyTx = FrameDispatchImplP.PhyTx; - PhyRadioOff = FrameDispatchImplP.PhyRadioOff; - RadioPromiscuousMode = FrameDispatchImplP; - Leds = FrameDispatchImplP; - Debug = FrameDispatchImplP; + components RadioControlImplP; + RadioRx = RadioControlImplP.MacRx; + RadioTx = RadioControlImplP.MacTx; + RadioOff = RadioControlImplP.MacRadioOff; + PhyRx = RadioControlImplP.PhyRx; + PhyTx = RadioControlImplP.PhyTx; + PhyRadioOff = RadioControlImplP.PhyRadioOff; + RadioPromiscuousMode = RadioControlImplP; + Leds = RadioControlImplP; + Debug = RadioControlImplP; LedsRadioClient = Leds; components new SimpleRoundRobinTransferArbiterC(IEEE802154_RADIO_RESOURCE) as Arbiter; @@ -73,5 +73,5 @@ implementation TokenRequested = Arbiter; TokenTransferControl = Arbiter; IsResourceRequested = Arbiter; - FrameDispatchImplP.ArbiterInfo -> Arbiter; + RadioControlImplP.ArbiterInfo -> Arbiter; } diff --git a/tos/lib/mac/tkn154/TKN154P.nc b/tos/lib/mac/tkn154/TKN154P.nc index 622c6f64..057ff220 100644 --- a/tos/lib/mac/tkn154/TKN154P.nc +++ b/tos/lib/mac/tkn154/TKN154P.nc @@ -121,27 +121,27 @@ implementation RxEnableP, IndirectTxP, PibP, - FrameDispatchP, + RadioControlP, #ifndef IEEE154_BEACON_SYNC_DISABLED BeaconSynchronizeP, - new CapQueueP() as DeviceCapQueue, - new CapP(INCOMING_SUPERFRAME) as DeviceCap, + new CsmaQueueP() as DeviceCapQueue, + new CsmaP(INCOMING_SUPERFRAME) as DeviceCap, #else NoBeaconSynchronizeP as BeaconSynchronizeP, - new NoCapQueueP() as DeviceCapQueue, - new NoCapP() as DeviceCap, + new NoCsmaQueueP() as DeviceCapQueue, + new NoCsmaP() as DeviceCap, #endif NoDeviceCfpP as DeviceCfp, #ifndef IEEE154_BEACON_TX_DISABLED BeaconTransmitP, - new CapQueueP() as CoordCapQueue, - new CapP(OUTGOING_SUPERFRAME) as CoordCap, + new CsmaQueueP() as CoordCapQueue, + new CsmaP(OUTGOING_SUPERFRAME) as CoordCap, #else NoBeaconTransmitP as BeaconTransmitP, - new NoCapQueueP() as CoordCapQueue, - new NoCapP() as CoordCap, + new NoCsmaQueueP() as CoordCapQueue, + new NoCsmaP() as CoordCap, #endif NoCoordCfpP as CoordCfp, @@ -369,11 +369,11 @@ implementation PibP.CapQueueReset -> DeviceCapQueue; DeviceCapQueue.Queue -> DeviceCapQueueC; - DeviceCapQueue.CapTx -> DeviceCap; + DeviceCapQueue.FrameTxCsma -> DeviceCap; PibP.CapQueueReset -> CoordCapQueue; CoordCapQueue.Queue -> CoordCapQueueC; - CoordCapQueue.CapTx -> CoordCap; + CoordCapQueue.FrameTxCsma -> CoordCap; components new RadioClientC() as DeviceCapRadioClient; PibP.CapReset -> DeviceCap; @@ -516,12 +516,12 @@ implementation PibP.Token -> PibRadioClient; PibP.RadioOff -> PibRadioClient; -/* ---------------------------- Dispatcher ---------------------------- */ +/* ------------------------- Radio Control ---------------------------- */ - FrameDispatchP.PhyTx = RadioTx; - FrameDispatchP.PhyRx = RadioRx; - FrameDispatchP.PhyRadioOff = RadioOff; - FrameDispatchP.RadioPromiscuousMode -> RxEnableP; - FrameDispatchP.Leds = Leds; - FrameDispatchP.Debug = Ieee802154Debug[RADIORXTX_CLIENT]; + RadioControlP.PhyTx = RadioTx; + RadioControlP.PhyRx = RadioRx; + RadioControlP.PhyRadioOff = RadioOff; + RadioControlP.RadioPromiscuousMode -> RxEnableP; + RadioControlP.Leds = Leds; + RadioControlP.Debug = Ieee802154Debug[RADIORXTX_CLIENT]; } diff --git a/tos/lib/mac/tkn154/dummies/NoCapP.nc b/tos/lib/mac/tkn154/dummies/NoCsmaP.nc similarity index 97% rename from tos/lib/mac/tkn154/dummies/NoCapP.nc rename to tos/lib/mac/tkn154/dummies/NoCsmaP.nc index ef3cff84..7f47303c 100644 --- a/tos/lib/mac/tkn154/dummies/NoCapP.nc +++ b/tos/lib/mac/tkn154/dummies/NoCsmaP.nc @@ -36,12 +36,12 @@ #include "TKN154_PHY.h" #include "TKN154_MAC.h" -generic module NoCapP() +generic module NoCsmaP() { provides { interface Init as Reset; - interface FrameTx as CapTx; + interface FrameTx as FrameTx; interface FrameRx as FrameRx[uint8_t frameType]; interface FrameExtracted as FrameExtracted[uint8_t frameType]; interface FrameTxNow as BroadcastTx; @@ -95,7 +95,7 @@ implementation call TokenToCfp.transfer(); } - command ieee154_status_t CapTx.transmit(ieee154_txframe_t *frame) + command ieee154_status_t FrameTx.transmit(ieee154_txframe_t *frame) { return IEEE154_TRANSACTION_OVERFLOW; } diff --git a/tos/lib/mac/tkn154/dummies/NoCapQueueP.nc b/tos/lib/mac/tkn154/dummies/NoCsmaQueueP.nc similarity index 94% rename from tos/lib/mac/tkn154/dummies/NoCapQueueP.nc rename to tos/lib/mac/tkn154/dummies/NoCsmaQueueP.nc index 7796ad16..b8e7554a 100644 --- a/tos/lib/mac/tkn154/dummies/NoCapQueueP.nc +++ b/tos/lib/mac/tkn154/dummies/NoCsmaQueueP.nc @@ -33,7 +33,7 @@ * ======================================================================== */ #include "TKN154_MAC.h" -generic module NoCapQueueP() +generic module NoCsmaQueueP() { provides { @@ -45,7 +45,7 @@ generic module NoCapQueueP() uses { interface Queue; - interface FrameTx as CapTx; + interface FrameTx as FrameTxCsma; interface FrameRx as SubFrameExtracted; } } @@ -61,7 +61,7 @@ implementation return IEEE154_TRANSACTION_OVERFLOW; } - event void CapTx.transmitDone(ieee154_txframe_t *data, ieee154_status_t status) { } + event void FrameTxCsma.transmitDone(ieee154_txframe_t *data, ieee154_status_t status) { } event message_t* SubFrameExtracted.received(message_t* frame) { return frame; } -- 2.39.2