Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blip #357

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
42 changes: 31 additions & 11 deletions tos/chips/atm128rfa1/radio/RFA1ActiveMessageC.nc
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,41 @@ configuration RFA1ActiveMessageC

implementation
{
// -------- Active Message

components new ActiveMessageLayerC();
ActiveMessageLayerC.Config -> RadioP;
ActiveMessageLayerC.SubSend -> AutoResourceAcquireLayerC;
ActiveMessageLayerC.SubReceive -> RadioC.TinyosReceive;
ActiveMessageLayerC.SubPacket -> RadioC.TinyosPacket;

AMSend = ActiveMessageLayerC;
Receive = ActiveMessageLayerC.Receive;
Snoop = ActiveMessageLayerC.Snoop;
SendNotifier = ActiveMessageLayerC;
AMPacket = ActiveMessageLayerC;
Packet = ActiveMessageLayerC;

ReceiveDefault = ActiveMessageLayerC.ReceiveDefault;
SnoopDefault = ActiveMessageLayerC.SnoopDefault;

// -------- Automatic RadioSend Resource

#ifndef TFRAMES_ENABLED
components new AutoResourceAcquireLayerC();
AutoResourceAcquireLayerC.Resource -> RadioC.SendResource[unique(RADIO_SEND_RESOURCE)];
#else
components new DummyLayerC() as AutoResourceAcquireLayerC;
#endif
AutoResourceAcquireLayerC -> RadioC.TinyosSend;

// -------- Radio

components RFA1RadioC as RadioC;
components RFA1RadioP as RadioP;

SplitControl = RadioC;

AMSend = RadioC;
Receive = RadioC.Receive;
Snoop = RadioC.Snoop;
SendNotifier = RadioC;

ReceiveDefault = RadioC.ReceiveDefault;
SnoopDefault = RadioC.SnoopDefault;

Packet = RadioC.PacketForActiveMessage;
AMPacket = RadioC;

PacketAcknowledgements = RadioC;
LowPowerListening = RadioC;
PacketLink = RadioC;
Expand Down
113 changes: 113 additions & 0 deletions tos/chips/atm128rfa1/radio/RFA1Ieee154MessageC.nc
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* Copyright (c) 2007, Vanderbilt University
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
* - Neither the name of the copyright holder nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Miklos Maroti
*/

#include <RadioConfig.h>

#ifdef TFRAMES_ENABLED
#error "You cannot use Ieee154MessageC with TFRAMES_ENABLED defined"
#endif

configuration RFA1Ieee154MessageC
{
provides
{
interface SplitControl;
interface Resource as SendResource[uint8_t clint];

interface Ieee154Send;
interface Receive as Ieee154Receive;
interface Ieee154Packet;
interface Packet;

interface Send as BareSend;
interface Receive as BareReceive;
interface Packet as BarePacket;

interface SendNotifier;
interface PacketAcknowledgements;
interface LowPowerListening;
interface PacketLink;
interface RadioChannel;

interface PacketField<uint8_t> as PacketLinkQuality;
interface PacketField<uint8_t> as PacketTransmitPower;
interface PacketField<uint8_t> as PacketRSSI;

interface LocalTime<TRadio> as LocalTimeRadio;
interface PacketTimeStamp<TRadio, uint32_t> as PacketTimeStampRadio;
interface PacketTimeStamp<TMilli, uint32_t> as PacketTimeStampMilli;
}
}

implementation
{
// -------- Ieee154 Message

components new Ieee154MessageLayerC();
Ieee154MessageLayerC.Ieee154PacketLayer -> RadioC;
Ieee154MessageLayerC.SubSend -> RadioC.Ieee154Send;
Ieee154MessageLayerC.SubReceive -> RadioC.Ieee154Receive;
Ieee154MessageLayerC.RadioPacket -> RadioC.Ieee154Packet;

Ieee154Send = Ieee154MessageLayerC.Ieee154Send;
Ieee154Receive = Ieee154MessageLayerC.Ieee154Receive;
Ieee154Packet = Ieee154MessageLayerC.Ieee154Packet;
Packet = Ieee154MessageLayerC.Packet;

BareSend = Ieee154MessageLayerC.BareSend;
BareReceive = Ieee154MessageLayerC.BareReceive;
BarePacket = Ieee154MessageLayerC.BarePacket;

SendNotifier = Ieee154MessageLayerC;

// -------- Radio

components RFA1RadioC as RadioC;

SplitControl = RadioC;
SendResource = RadioC;

PacketAcknowledgements = RadioC;
LowPowerListening = RadioC;
PacketLink = RadioC;
RadioChannel = RadioC;

PacketLinkQuality = RadioC.PacketLinkQuality;
PacketTransmitPower = RadioC.PacketTransmitPower;
PacketRSSI = RadioC.PacketRSSI;

LocalTimeRadio = RadioC;
PacketTimeStampMilli = RadioC;
PacketTimeStampRadio = RadioC;
}
101 changes: 24 additions & 77 deletions tos/chips/atm128rfa1/radio/RFA1RadioC.nc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Miklos Maroti
* Author: Andras Biro
*/

#include <RadioConfig.h>
Expand All @@ -42,30 +41,20 @@ configuration RFA1RadioC
interface SplitControl;

#ifndef IEEE154FRAMES_ENABLED
interface AMSend[am_id_t id];
interface Receive[am_id_t id];
interface Receive as Snoop[am_id_t id];
interface SendNotifier[am_id_t id];

// for TOSThreads
interface Receive as ReceiveDefault[am_id_t id];
interface Receive as SnoopDefault[am_id_t id];

interface AMPacket;
interface Packet as PacketForActiveMessage;
interface BareSend as TinyosSend;
interface BareReceive as TinyosReceive;
interface RadioPacket as TinyosPacket;
#endif

#ifndef TFRAMES_ENABLED
interface Ieee154Send;
interface Receive as Ieee154Receive;
interface SendNotifier as Ieee154Notifier;

interface Resource as SendResource[uint8_t clint];

interface Ieee154Packet;
interface Packet as PacketForIeee154Message;
interface BareSend as Ieee154Send;
interface BareReceive as Ieee154Receive;
interface RadioPacket as Ieee154Packet;
#endif

interface Ieee154PacketLayer;
interface PacketAcknowledgements;
interface LowPowerListening;
interface PacketLink;
Expand Down Expand Up @@ -110,57 +99,11 @@ implementation
components new RadioAlarmC();
RadioAlarmC.Alarm -> RadioDriverLayerC;

// -------- Active Message

#ifndef IEEE154FRAMES_ENABLED
components new ActiveMessageLayerC();
ActiveMessageLayerC.Config -> RadioP;
ActiveMessageLayerC.SubSend -> AutoResourceAcquireLayerC;
ActiveMessageLayerC.SubReceive -> TinyosNetworkLayerC.TinyosReceive;
ActiveMessageLayerC.SubPacket -> TinyosNetworkLayerC.TinyosPacket;

AMSend = ActiveMessageLayerC;
Receive = ActiveMessageLayerC.Receive;
Snoop = ActiveMessageLayerC.Snoop;
SendNotifier = ActiveMessageLayerC;
AMPacket = ActiveMessageLayerC;
PacketForActiveMessage = ActiveMessageLayerC;

ReceiveDefault = ActiveMessageLayerC.ReceiveDefault;
SnoopDefault = ActiveMessageLayerC.SnoopDefault;
#endif

// -------- Automatic RadioSend Resource

#ifndef IEEE154FRAMES_ENABLED
#ifndef TFRAMES_ENABLED
components new AutoResourceAcquireLayerC();
AutoResourceAcquireLayerC.Resource -> SendResourceC.Resource[unique(RADIO_SEND_RESOURCE)];
#else
components new DummyLayerC() as AutoResourceAcquireLayerC;
#endif
AutoResourceAcquireLayerC -> TinyosNetworkLayerC.TinyosSend;
#endif

// -------- RadioSend Resource

#ifndef TFRAMES_ENABLED
components new SimpleFcfsArbiterC(RADIO_SEND_RESOURCE) as SendResourceC;
SendResource = SendResourceC;

// -------- Ieee154 Message

components new Ieee154MessageLayerC();
Ieee154MessageLayerC.Ieee154PacketLayer -> Ieee154PacketLayerC;
Ieee154MessageLayerC.SubSend -> TinyosNetworkLayerC.Ieee154Send;
Ieee154MessageLayerC.SubReceive -> TinyosNetworkLayerC.Ieee154Receive;
Ieee154MessageLayerC.RadioPacket -> TinyosNetworkLayerC.Ieee154Packet;

Ieee154Send = Ieee154MessageLayerC;
Ieee154Receive = Ieee154MessageLayerC;
Ieee154Notifier = Ieee154MessageLayerC;
Ieee154Packet = Ieee154PacketLayerC;
PacketForIeee154Message = Ieee154MessageLayerC;
#endif

// -------- Tinyos Network
Expand All @@ -171,11 +114,25 @@ implementation
TinyosNetworkLayerC.SubReceive -> PacketLinkLayerC;
TinyosNetworkLayerC.SubPacket -> Ieee154PacketLayerC;

#ifndef IEEE154FRAMES_ENABLED
TinyosSend = TinyosNetworkLayerC.TinyosSend;
TinyosReceive = TinyosNetworkLayerC.TinyosReceive;
TinyosPacket = TinyosNetworkLayerC.TinyosPacket;
#endif

#ifndef TFRAMES_ENABLED
Ieee154Send = TinyosNetworkLayerC.Ieee154Send;
Ieee154Receive = TinyosNetworkLayerC.Ieee154Receive;
Ieee154Packet = TinyosNetworkLayerC.Ieee154Packet;
#endif

// -------- IEEE 802.15.4 Packet

components new Ieee154PacketLayerC();
Ieee154PacketLayerC.SubPacket -> PacketLinkLayerC;

Ieee154PacketLayer = Ieee154PacketLayerC;

// -------- UniqueLayer Send part (wired twice)

components new UniqueLayerC();
Expand All @@ -198,7 +155,7 @@ implementation
components new LowPowerListeningLayerC();
LowPowerListeningLayerC.Config -> RadioP;
LowPowerListeningLayerC.PacketAcknowledgements -> SoftwareAckLayerC;
#else
#else
components new LowPowerListeningDummyC() as LowPowerListeningLayerC;
#endif
LowPowerListeningLayerC.SubControl -> MessageBufferLayerC;
Expand Down Expand Up @@ -273,19 +230,9 @@ implementation
components new DummyLayerC() as TrafficMonitorLayerC;
#endif
TrafficMonitorLayerC.Config -> RadioP;
TrafficMonitorLayerC -> RadioDriverDebugLayerC.RadioSend;
TrafficMonitorLayerC -> RadioDriverLayerC.RadioSend;
TrafficMonitorLayerC -> RadioDriverLayerC.RadioReceive;
TrafficMonitorLayerC -> RadioDriverDebugLayerC.RadioState;

// -------- Debug

#ifdef RADIO_DEBUG
components new DebugLayerC("driver") as RadioDriverDebugLayerC;
#else
components new DummyLayerC() as RadioDriverDebugLayerC;
#endif
RadioDriverDebugLayerC.SubState -> RadioDriverLayerC;
RadioDriverDebugLayerC.SubSend -> RadioDriverLayerC;
TrafficMonitorLayerC -> RadioDriverLayerC.RadioState;

// -------- Driver

Expand Down
38 changes: 19 additions & 19 deletions tos/chips/rf212/RF212Ieee154MessageC.nc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

configuration RF212Ieee154MessageC
{
provides
provides
{
interface SplitControl;

Expand Down Expand Up @@ -70,29 +70,29 @@ configuration RF212Ieee154MessageC

implementation
{
components RF212RadioC;
components RF212RadioC as RadioC;

SplitControl = RF212RadioC;
SplitControl = RadioC;

Ieee154Send = RF212RadioC.Ieee154Send;
Ieee154Receive = RF212RadioC.Ieee154Receive;
SendNotifier = RF212RadioC.Ieee154Notifier;
Ieee154Send = RadioC.Ieee154Send;
Ieee154Receive = RadioC.Ieee154Receive;
SendNotifier = RadioC.Ieee154Notifier;

Packet = RF212RadioC.PacketForIeee154Message;
Ieee154Packet = RF212RadioC;
SendResource = RF212RadioC;
Packet = RadioC.PacketForIeee154Message;
Ieee154Packet = RadioC;
SendResource = RadioC;

PacketAcknowledgements = RF212RadioC;
LowPowerListening = RF212RadioC;
PacketLink = RF212RadioC;
PacketAcknowledgements = RadioC;
LowPowerListening = RadioC;
PacketLink = RadioC;

RadioChannel = RF212RadioC;
RadioChannel = RadioC;

PacketLinkQuality = RF212RadioC.PacketLinkQuality;
PacketTransmitPower = RF212RadioC.PacketTransmitPower;
PacketRSSI = RF212RadioC.PacketRSSI;
PacketLinkQuality = RadioC.PacketLinkQuality;
PacketTransmitPower = RadioC.PacketTransmitPower;
PacketRSSI = RadioC.PacketRSSI;

LocalTimeRadio = RF212RadioC;
PacketTimeStampMilli = RF212RadioC;
PacketTimeStampRadio = RF212RadioC;
LocalTimeRadio = RadioC;
PacketTimeStampMilli = RadioC;
PacketTimeStampRadio = RadioC;
}
Loading