[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/rf230 DefaultMacC.nc, 1.7, 1.8 DefaultPacket.h, 1.4, 1.5 DefaultPacketC.nc, 1.4, 1.5 DefaultPacketP.nc, 1.5, 1.6 RF230LayerC.nc, 1.5, 1.6 RF230LayerP.nc, 1.12, 1.13
Miklos Maroti
mmaroti at users.sourceforge.net
Tue May 13 12:48:04 PDT 2008
Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/rf230
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19276/tos/chips/rf230
Modified Files:
DefaultMacC.nc DefaultPacket.h DefaultPacketC.nc
DefaultPacketP.nc RF230LayerC.nc RF230LayerP.nc
Log Message:
IRIS: add TXPOWER and RSSI to the metadata
Index: DefaultMacC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf230/DefaultMacC.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** DefaultMacC.nc 24 Apr 2008 22:04:10 -0000 1.7
--- DefaultMacC.nc 13 May 2008 19:48:00 -0000 1.8
***************
*** 40,43 ****
--- 40,45 ----
interface PacketField<uint8_t> as PacketLinkQuality;
+ interface PacketField<uint8_t> as PacketTransmitPower;
+ interface PacketField<uint8_t> as PacketRSSI;
interface PacketTimeStamp<TRF230, uint16_t>;
***************
*** 62,65 ****
--- 64,69 ----
PacketAcknowledgements = DefaultPacketC;
PacketLinkQuality = DefaultPacketC.PacketLinkQuality;
+ PacketTransmitPower = DefaultPacketC.PacketTransmitPower;
+ PacketRSSI = DefaultPacketC.PacketRSSI;
PacketTimeStamp = DefaultPacketC.PacketTimeStamp;
LowPowerListening = LowPowerListeningLayerC;
***************
*** 130,133 ****
--- 134,138 ----
RF230LayerC.PacketLinkQuality -> DefaultPacketC.PacketLinkQuality;
RF230LayerC.PacketTransmitPower -> DefaultPacketC.PacketTransmitPower;
+ RF230LayerC.PacketRSSI -> DefaultPacketC.PacketRSSI;
RF230LayerC.PacketTimeStamp -> DefaultPacketC.PacketTimeStamp;
}
Index: DefaultPacket.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf230/DefaultPacket.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** DefaultPacket.h 29 Mar 2008 20:10:33 -0000 1.4
--- DefaultPacket.h 13 May 2008 19:48:00 -0000 1.5
***************
*** 39,42 ****
--- 39,43 ----
nx_uint8_t flags;
nx_uint8_t lqi;
+ nx_uint8_t power; // shared between TXPOWER and RSSI
nx_uint16_t timestamp;
} defpacket_metadata_t;
***************
*** 47,50 ****
--- 48,53 ----
DEFPACKET_TIMESTAMP = 0x02, // PacketTimeStamp
DEFPACKET_LAST_TOUCH = 0x04, // PacketLastTouch.touch
+ DEFPACKET_TXPOWER = 0x10, // PacketTransmitPower
+ DEFPACKET_RSSI = 0x20, // PacketRSSI
DEFPACKET_CLEAR_METADATA = 0x00,
Index: DefaultPacketC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf230/DefaultPacketC.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** DefaultPacketC.nc 21 Apr 2008 20:58:08 -0000 1.4
--- DefaultPacketC.nc 13 May 2008 19:48:00 -0000 1.5
***************
*** 33,36 ****
--- 33,37 ----
interface PacketField<uint8_t> as PacketLinkQuality;
interface PacketField<uint8_t> as PacketTransmitPower;
+ interface PacketField<uint8_t> as PacketRSSI;
interface PacketField<uint16_t> as PacketSleepInterval;
***************
*** 53,56 ****
--- 54,58 ----
PacketLinkQuality = DefaultPacketP.PacketLinkQuality;
PacketTransmitPower = DefaultPacketP.PacketTransmitPower;
+ PacketRSSI = DefaultPacketP.PacketRSSI;
PacketSleepInterval = DefaultPacketP.PacketSleepInterval;
PacketTimeStamp = DefaultPacketP;
Index: DefaultPacketP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf230/DefaultPacketP.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** DefaultPacketP.nc 7 May 2008 21:33:13 -0000 1.5
--- DefaultPacketP.nc 13 May 2008 19:48:00 -0000 1.6
***************
*** 32,35 ****
--- 32,36 ----
interface PacketField<uint8_t> as PacketLinkQuality;
interface PacketField<uint8_t> as PacketTransmitPower;
+ interface PacketField<uint8_t> as PacketRSSI;
interface PacketField<uint16_t> as PacketSleepInterval;
***************
*** 163,203 ****
}
- /*----------------- Global fields -----------------*/
-
- norace uint8_t flags;
- enum
- {
- FLAG_TXPOWER = 0x01,
- FLAG_SLEEPINT = 0x02,
- };
-
- norace uint8_t transmitPower;
-
- // TODO: Move sleepInterval into the metadata
- norace uint16_t sleepInterval;
-
/*----------------- PacketTransmitPower -----------------*/
async command bool PacketTransmitPower.isSet(message_t* msg)
{
! return flags & FLAG_TXPOWER;
}
async command uint8_t PacketTransmitPower.get(message_t* msg)
{
! return transmitPower;
}
async command void PacketTransmitPower.clear(message_t* msg)
{
! flags &= ~FLAG_TXPOWER;
}
async command void PacketTransmitPower.set(message_t* msg, uint8_t value)
{
! flags |= FLAG_TXPOWER;
! transmitPower = value;
}
/*----------------- PacketSleepInterval -----------------*/
--- 164,226 ----
}
/*----------------- PacketTransmitPower -----------------*/
async command bool PacketTransmitPower.isSet(message_t* msg)
{
! return getMeta(msg)->flags & DEFPACKET_TXPOWER;
}
async command uint8_t PacketTransmitPower.get(message_t* msg)
{
! return getMeta(msg)->power;
}
async command void PacketTransmitPower.clear(message_t* msg)
{
! getMeta(msg)->flags &= ~DEFPACKET_TXPOWER;
}
async command void PacketTransmitPower.set(message_t* msg, uint8_t value)
{
! getMeta(msg)->flags &= ~DEFPACKET_RSSI;
! getMeta(msg)->flags |= DEFPACKET_TXPOWER;
! getMeta(msg)->power = value;
}
+ /*----------------- PacketRSSI -----------------*/
+
+ async command bool PacketRSSI.isSet(message_t* msg)
+ {
+ return getMeta(msg)->flags & DEFPACKET_RSSI;
+ }
+
+ async command uint8_t PacketRSSI.get(message_t* msg)
+ {
+ return getMeta(msg)->power;
+ }
+
+ async command void PacketRSSI.clear(message_t* msg)
+ {
+ getMeta(msg)->flags &= ~DEFPACKET_RSSI;
+ }
+
+ async command void PacketRSSI.set(message_t* msg, uint8_t value)
+ {
+ getMeta(msg)->flags &= ~DEFPACKET_TXPOWER;
+ getMeta(msg)->flags |= DEFPACKET_RSSI;
+ getMeta(msg)->power = value;
+ }
+
+ /*----------------- Global fields -----------------*/
+
+ norace uint8_t flags;
+ enum
+ {
+ FLAG_SLEEPINT = 0x01,
+ };
+
+ // TODO: Move sleepInterval into the metadata
+ norace uint16_t sleepInterval;
+
/*----------------- PacketSleepInterval -----------------*/
Index: RF230LayerC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf230/RF230LayerC.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** RF230LayerC.nc 21 Apr 2008 20:58:08 -0000 1.5
--- RF230LayerC.nc 13 May 2008 19:48:00 -0000 1.6
***************
*** 37,42 ****
--- 37,44 ----
{
interface RF230Config;
+
interface PacketField<uint8_t> as PacketLinkQuality;
interface PacketField<uint8_t> as PacketTransmitPower;
+ interface PacketField<uint8_t> as PacketRSSI;
interface PacketTimeStamp<TRF230, uint16_t>;
***************
*** 57,60 ****
--- 59,63 ----
PacketLinkQuality = RF230LayerP.PacketLinkQuality;
PacketTransmitPower = RF230LayerP.PacketTransmitPower;
+ PacketRSSI = RF230LayerP.PacketRSSI;
PacketTimeStamp = RF230LayerP.PacketTimeStamp;
Index: RF230LayerP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/rf230/RF230LayerP.nc,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** RF230LayerP.nc 8 May 2008 21:31:13 -0000 1.12
--- RF230LayerP.nc 13 May 2008 19:48:00 -0000 1.13
***************
*** 55,62 ****
interface BusyWait<TMicro, uint16_t>;
- interface RF230Config;
interface PacketField<uint8_t> as PacketLinkQuality;
interface PacketField<uint8_t> as PacketTransmitPower;
interface PacketTimeStamp<TRF230, uint16_t>;
interface Tasklet;
interface RadioAlarm;
--- 55,64 ----
interface BusyWait<TMicro, uint16_t>;
interface PacketField<uint8_t> as PacketLinkQuality;
interface PacketField<uint8_t> as PacketTransmitPower;
+ interface PacketField<uint8_t> as PacketRSSI;
interface PacketTimeStamp<TRF230, uint16_t>;
+
+ interface RF230Config;
interface Tasklet;
interface RadioAlarm;
***************
*** 623,626 ****
--- 625,629 ----
uint16_t time;
uint8_t irq;
+ uint8_t temp;
atomic time = capturedTime;
***************
*** 675,680 ****
ASSERT( state == STATE_RX_ON || state == STATE_PLL_ON_2_RX_ON );
! // the most likely place for busy channel
! rssiBusy += readRegister(RF230_PHY_RSSI) - (rssiBusy >> 2);
/*
--- 678,691 ----
ASSERT( state == STATE_RX_ON || state == STATE_PLL_ON_2_RX_ON );
! // the most likely place for busy channel, with no TRX_END
! if( irq == RF230_IRQ_RX_START )
! {
! temp = readRegister(RF230_PHY_RSSI);
!
! rssiBusy += temp - (rssiBusy >> 2);
! call PacketRSSI.set(rxMsg, temp);
! }
! else
! call PacketRSSI.clear(rxMsg);
/*
More information about the Tinyos-2-commits
mailing list