From: sdhsdh Date: Wed, 16 Sep 2009 00:57:20 +0000 (+0000) Subject: - commit necessary prerequisites for rf230 platform support X-Git-Tag: rc_6_tinyos_2_1_1~260 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=30164611e5ab7e8a2b4d24c7d16256c1865b4e20 - commit necessary prerequisites for rf230 platform support --- diff --git a/support/make/blip.extra b/support/make/blip.extra index ae486254..741cb6e3 100644 --- a/support/make/blip.extra +++ b/support/make/blip.extra @@ -18,6 +18,7 @@ PFLAGS+=-I$(LOWPAN_ROOT)/tos/lib/net/blip/interfaces/ PFLAGS+=-I$(LOWPAN_ROOT)/tos/lib/net/blip/nwprog/ PFLAGS+=-I$(LOWPAN_ROOT)/tos/lib/net/blip/shell/ PFLAGS+=-I$(LOWPAN_ROOT)/tos/lib/net/blip/serial/ +PFLAGS+=-I$(LOWPAN_ROOT)/tos/lib/net/blip/platform/ PFLAGS+=$(LOWPAN_ROOT)/support/sdk/c/blip/lib6lowpan/lib6lowpan.c PFLAGS+=$(LOWPAN_ROOT)/support/sdk/c/blip/lib6lowpan/lib6lowpanIP.c diff --git a/tos/lib/net/blip/IPDispatchC.nc b/tos/lib/net/blip/IPDispatchC.nc index 407aca65..a90b7ed1 100644 --- a/tos/lib/net/blip/IPDispatchC.nc +++ b/tos/lib/net/blip/IPDispatchC.nc @@ -39,7 +39,7 @@ configuration IPDispatchC { } } implementation { - components Ieee154MessageC as MessageC, ResourceSendP; + components Ieee154MessageC as MessageC; components MainC, IPDispatchP, IPAddressC, IPRoutingP; components NoLedsC as LedsC; components RandomC; @@ -50,6 +50,7 @@ configuration IPDispatchC { IPDispatchP.Boot -> MainC; + components ResourceSendP; ResourceSendP.SubSend -> MessageC; ResourceSendP.Resource -> MessageC.SendResource[unique(IEEE154_SEND_CLIENT)]; IPDispatchP.Ieee154Send -> ResourceSendP.Ieee154Send; @@ -60,11 +61,10 @@ configuration IPDispatchC { IPDispatchP.LowPowerListening -> MessageC; #endif - components CC2420PacketC; - + components ReadLqiC; IPDispatchP.Ieee154Packet -> MessageC; IPDispatchP.PacketLink -> MessageC; - IPDispatchP.CC2420Packet -> CC2420PacketC; + IPDispatchP.ReadLqi -> ReadLqiC; IPDispatchP.Leds -> LedsC; diff --git a/tos/lib/net/blip/IPDispatchP.nc b/tos/lib/net/blip/IPDispatchP.nc index a83eee85..86556537 100644 --- a/tos/lib/net/blip/IPDispatchP.nc +++ b/tos/lib/net/blip/IPDispatchP.nc @@ -102,7 +102,7 @@ module IPDispatchP { interface Boot; interface SplitControl as RadioControl; - interface CC2420Packet; + interface ReadLqi; interface Packet; #ifndef SIM @@ -486,7 +486,7 @@ module IPDispatchP { // - if not, dispatch from here. metadata.sender = call Ieee154Packet.source(msg); - metadata.lqi = call CC2420Packet.getLqi(msg); + metadata.lqi = call ReadLqi.read(msg); real_payload_length = ntohs(ip->plen); adjustPlen(ip, &u_info); @@ -670,7 +670,7 @@ module IPDispatchP { BLIP_STATS_INCR(stats.rx_total); call IPRouting.reportReception(call Ieee154Packet.source(msg), - call CC2420Packet.getLqi(msg)); + call ReadLqi.read(msg)); lowmsg.headers = getHeaderBitmap(&lowmsg); if (lowmsg.headers == LOWPAN_NALP_PATTERN) { diff --git a/tos/lib/net/blip/ReadLqiC.nc b/tos/lib/net/blip/ReadLqiC.nc new file mode 100644 index 00000000..0e2d57ee --- /dev/null +++ b/tos/lib/net/blip/ReadLqiC.nc @@ -0,0 +1,29 @@ + +/* + * Different platforms have different ways of getting in touch with + * the LQI reading the radio provides. This module wraps the + * different ways in platform-independent logic. + * + * + * @author Stephen Dawson-Haggerty + */ + +configuration ReadLqiC { + provides interface ReadLqi; +} implementation { + +#if defined(PLATFORM_MICAZ) || defined(PLATFORM_TELOSB) || \ + defined(PLATFORM_EPIC) || defined(PLATFORM_SHIMMER) + // cc2420 platforms + components CC2420ReadLqiC, CC2420PacketC; + ReadLqi = CC2420ReadLqiC; + CC2420ReadLqiC.CC2420Packet -> CC2420PacketC; +#elif defined(PLATFORM_IRIS) + components RF230ReadLqiC, RF230Ieee154MessageC; + ReadLqi = RF230ReadLqiC; + RF230ReadLqiC.SubLqi -> RF230Ieee154MessageC.PacketLinkQuality; +#else +#error "No radio support is available for your platform" +#endif + +} diff --git a/tos/lib/net/blip/interfaces/ReadLqi.nc b/tos/lib/net/blip/interfaces/ReadLqi.nc new file mode 100644 index 00000000..0d874f7f --- /dev/null +++ b/tos/lib/net/blip/interfaces/ReadLqi.nc @@ -0,0 +1,4 @@ + +interface ReadLqi { + command uint8_t read(message_t *msg); +} diff --git a/tos/lib/net/blip/platform/CC2420ReadLqiC.nc b/tos/lib/net/blip/platform/CC2420ReadLqiC.nc new file mode 100644 index 00000000..da457eae --- /dev/null +++ b/tos/lib/net/blip/platform/CC2420ReadLqiC.nc @@ -0,0 +1,9 @@ + +module CC2420ReadLqiC { + provides interface ReadLqi; + uses interface CC2420Packet; +} implementation { + command uint8_t ReadLqi.read(message_t *msg) { + return call CC2420Packet.getLqi(msg); + } +} diff --git a/tos/lib/net/blip/platform/RF230ReadLqiC.nc b/tos/lib/net/blip/platform/RF230ReadLqiC.nc new file mode 100644 index 00000000..7a679033 --- /dev/null +++ b/tos/lib/net/blip/platform/RF230ReadLqiC.nc @@ -0,0 +1,9 @@ + +module RF230ReadLqiC { + provides interface ReadLqi; + uses interface PacketField as SubLqi; +} implementation { + command uint8_t ReadLqi.read(message_t *msg) { + return call SubLqi.get(msg); + } +}