From 7cb3053eaa216416d4833656f2ffbee14a5c0970 Mon Sep 17 00:00:00 2001 From: mmaroti Date: Tue, 10 Mar 2009 20:37:58 +0000 Subject: [PATCH] moving files from rf230 to rf2xx, prepare the support of rf212 --- tos/chips/rf230/RF2xx.h | 157 --------- tos/chips/rf230/RF2xxActiveMessageP.nc | 299 ------------------ tos/chips/rf230/RF2xxDriverLayerC.nc | 78 ----- .../layers}/ActiveMessageConfig.nc | 0 .../layers}/ActiveMessageLayerC.nc | 0 .../{rf230 => rf2xx/layers}/CsmaConfig.nc | 0 .../{rf230 => rf2xx/layers}/CsmaLayerC.nc | 0 .../{rf230 => rf2xx/layers}/CsmaLayerP.nc | 0 .../{rf230 => rf2xx/layers}/DummyConfig.nc | 0 .../{rf230 => rf2xx/layers}/DummyLayerC.nc | 0 .../{rf230 => rf2xx/layers}/DummyLayerP.nc | 0 .../layers/GenericTimeSyncMessage.h} | 6 +- .../layers/GenericTimeSyncMessageC.nc} | 44 +-- .../layers/GenericTimeSyncMessageP.nc} | 10 +- .../layers}/IEEE154NetworkLayerC.nc | 0 .../layers}/IEEE154NetworkLayerP.nc | 0 .../layers}/LowPowerListeningLayerC.nc | 0 .../layers}/LowPowerListeningLayerP.nc | 0 .../layers}/MessageBufferLayerC.nc | 0 .../layers}/MessageBufferLayerP.nc | 0 .../layers}/RandomCollisionConfig.nc | 0 .../layers}/RandomCollisionLayerC.nc | 0 .../layers}/RandomCollisionLayerP.nc | 0 .../layers}/SlottedCollisionConfig.nc | 0 .../layers}/SlottedCollisionLayerC.nc | 2 +- .../layers}/SlottedCollisionLayerP.nc | 4 +- .../layers}/SoftwareAckConfig.nc | 0 .../layers}/SoftwareAckLayerC.nc | 0 .../layers}/SoftwareAckLayerP.nc | 0 .../layers}/TrafficMonitorConfig.nc | 0 .../layers}/TrafficMonitorLayerC.nc | 2 +- .../layers}/TrafficMonitorLayerP.nc | 4 +- .../{rf230 => rf2xx/layers}/UniqueConfig.nc | 0 .../{rf230 => rf2xx/layers}/UniqueLayerC.nc | 0 .../{rf230 => rf2xx/layers}/UniqueLayerP.nc | 0 tos/chips/rf2xx/rf230/RF230.h | 153 +++++++++ .../rf230/RF230ActiveMessageC.nc} | 64 ++-- tos/chips/rf2xx/rf230/RF230ActiveMessageP.nc | 2 +- .../rf230/RF230DriverConfig.nc} | 4 +- tos/chips/rf2xx/rf230/RF230DriverLayerC.nc | 78 +++++ .../rf230/RF230DriverLayerP.nc} | 153 +++++---- .../rf230/RF230Packet.h} | 34 +- .../rf230/RF230PacketC.nc} | 28 +- .../rf230/RF230PacketP.nc} | 57 ++-- .../{rf230 => rf2xx/util}/IEEE154Packet.h | 0 .../{rf230 => rf2xx/util}/IEEE154Packet.nc | 0 .../{rf230 => rf2xx/util}/IEEE154PacketC.nc | 0 .../{rf230 => rf2xx/util}/IEEE154PacketP.nc | 0 .../{rf230 => rf2xx/util}/Neighborhood.h | 0 .../{rf230 => rf2xx/util}/Neighborhood.nc | 0 .../{rf230 => rf2xx/util}/NeighborhoodC.nc | 0 .../{rf230 => rf2xx/util}/NeighborhoodFlag.nc | 0 .../util}/NeighborhoodFlagC.nc | 0 .../{rf230 => rf2xx/util}/NeighborhoodP.nc | 0 .../{rf230 => rf2xx/util}/PacketField.nc | 0 tos/chips/{rf230 => rf2xx/util}/RadioAlarm.nc | 0 .../{rf230 => rf2xx/util}/RadioAlarmC.nc | 0 .../{rf230 => rf2xx/util}/RadioAlarmP.nc | 0 tos/chips/{rf230 => rf2xx/util}/RadioAssert.h | 2 +- tos/chips/{rf230 => rf2xx/util}/RadioCCA.nc | 0 .../{rf230 => rf2xx/util}/RadioChannel.nc | 0 .../{rf230 => rf2xx/util}/RadioReceive.nc | 0 tos/chips/{rf230 => rf2xx/util}/RadioSend.nc | 0 tos/chips/{rf230 => rf2xx/util}/RadioState.nc | 0 tos/chips/{rf230 => rf2xx/util}/Tasklet.h | 0 tos/chips/{rf230 => rf2xx/util}/Tasklet.nc | 0 tos/chips/{rf230 => rf2xx/util}/TaskletC.nc | 0 tos/platforms/iris/.platform | 5 +- tos/platforms/iris/ActiveMessageC.nc | 4 +- tos/platforms/iris/TimeSyncMessageC.nc | 28 +- .../rf230/{HplRF2xxC.nc => HplRF230C.nc} | 16 +- .../rf230/{HplRF2xxP.nc => HplRF230P.nc} | 4 +- tos/platforms/iris/chips/rf230/RadioAlarm.h | 40 --- .../chips/rf230/{HplRF2xx.h => RadioConfig.h} | 39 ++- tos/platforms/iris/platform_message.h | 8 +- 75 files changed, 499 insertions(+), 826 deletions(-) delete mode 100644 tos/chips/rf230/RF2xx.h delete mode 100644 tos/chips/rf230/RF2xxActiveMessageP.nc delete mode 100644 tos/chips/rf230/RF2xxDriverLayerC.nc rename tos/chips/{rf230 => rf2xx/layers}/ActiveMessageConfig.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/ActiveMessageLayerC.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/CsmaConfig.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/CsmaLayerC.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/CsmaLayerP.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/DummyConfig.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/DummyLayerC.nc (100%) rename tos/chips/{rf230 => rf2xx/layers}/DummyLayerP.nc (100%) rename tos/chips/{rf230/TimeSyncMessage.h => rf2xx/layers/GenericTimeSyncMessage.h} (91%) rename tos/chips/{rf230/RF2xxTimeSyncMessageC.nc => rf2xx/layers/GenericTimeSyncMessageC.nc} (60%) rename tos/chips/{rf230/RF2xxTimeSyncMessageP.nc => rf2xx/layers/GenericTimeSyncMessageP.nc} (95%) rename tos/chips/{rf230 => rf2xx/layers}/IEEE154NetworkLayerC.nc (100%) rename tos/chips/{rf230 => rf2xx/layers}/IEEE154NetworkLayerP.nc (100%) rename tos/chips/{rf230 => rf2xx/layers}/LowPowerListeningLayerC.nc (100%) rename tos/chips/{rf230 => rf2xx/layers}/LowPowerListeningLayerP.nc (100%) rename tos/chips/{rf230 => rf2xx/layers}/MessageBufferLayerC.nc (100%) rename tos/chips/{rf230 => rf2xx/layers}/MessageBufferLayerP.nc (100%) rename tos/chips/{rf230 => rf2xx/layers}/RandomCollisionConfig.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/RandomCollisionLayerC.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/RandomCollisionLayerP.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/SlottedCollisionConfig.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/SlottedCollisionLayerC.nc (98%) rename tos/chips/{rf230 => rf2xx/layers}/SlottedCollisionLayerP.nc (99%) rename tos/chips/{rf230 => rf2xx/layers}/SoftwareAckConfig.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/SoftwareAckLayerC.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/SoftwareAckLayerP.nc (100%) rename tos/chips/{rf230 => rf2xx/layers}/TrafficMonitorConfig.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/TrafficMonitorLayerC.nc (99%) rename tos/chips/{rf230 => rf2xx/layers}/TrafficMonitorLayerP.nc (99%) rename tos/chips/{rf230 => rf2xx/layers}/UniqueConfig.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/UniqueLayerC.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/layers}/UniqueLayerP.nc (100%) mode change 100644 => 100755 create mode 100644 tos/chips/rf2xx/rf230/RF230.h rename tos/chips/{rf230/RF2xxActiveMessageC.nc => rf2xx/rf230/RF230ActiveMessageC.nc} (72%) rename tos/chips/{rf230/RF2xxDriverConfig.nc => rf2xx/rf230/RF230DriverConfig.nc} (97%) create mode 100644 tos/chips/rf2xx/rf230/RF230DriverLayerC.nc rename tos/chips/{rf230/RF2xxDriverLayerP.nc => rf2xx/rf230/RF230DriverLayerP.nc} (80%) rename tos/chips/{rf230/RF2xxPacket.h => rf2xx/rf230/RF230Packet.h} (68%) rename tos/chips/{rf230/RF2xxPacketC.nc => rf2xx/rf230/RF230PacketC.nc} (72%) rename tos/chips/{rf230/RF2xxPacketP.nc => rf2xx/rf230/RF230PacketP.nc} (81%) rename tos/chips/{rf230 => rf2xx/util}/IEEE154Packet.h (100%) rename tos/chips/{rf230 => rf2xx/util}/IEEE154Packet.nc (100%) rename tos/chips/{rf230 => rf2xx/util}/IEEE154PacketC.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/IEEE154PacketP.nc (100%) rename tos/chips/{rf230 => rf2xx/util}/Neighborhood.h (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/Neighborhood.nc (100%) rename tos/chips/{rf230 => rf2xx/util}/NeighborhoodC.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/NeighborhoodFlag.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/NeighborhoodFlagC.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/NeighborhoodP.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/PacketField.nc (100%) rename tos/chips/{rf230 => rf2xx/util}/RadioAlarm.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/RadioAlarmC.nc (100%) rename tos/chips/{rf230 => rf2xx/util}/RadioAlarmP.nc (100%) rename tos/chips/{rf230 => rf2xx/util}/RadioAssert.h (98%) rename tos/chips/{rf230 => rf2xx/util}/RadioCCA.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/RadioChannel.nc (100%) rename tos/chips/{rf230 => rf2xx/util}/RadioReceive.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/RadioSend.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/RadioState.nc (100%) rename tos/chips/{rf230 => rf2xx/util}/Tasklet.h (100%) rename tos/chips/{rf230 => rf2xx/util}/Tasklet.nc (100%) mode change 100644 => 100755 rename tos/chips/{rf230 => rf2xx/util}/TaskletC.nc (100%) mode change 100644 => 100755 rename tos/platforms/iris/chips/rf230/{HplRF2xxC.nc => HplRF230C.nc} (87%) rename tos/platforms/iris/chips/rf230/{HplRF2xxP.nc => HplRF230P.nc} (98%) delete mode 100644 tos/platforms/iris/chips/rf230/RadioAlarm.h rename tos/platforms/iris/chips/rf230/{HplRF2xx.h => RadioConfig.h} (73%) diff --git a/tos/chips/rf230/RF2xx.h b/tos/chips/rf230/RF2xx.h deleted file mode 100644 index a694df88..00000000 --- a/tos/chips/rf230/RF2xx.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2007, Vanderbilt University - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice, the following - * two paragraphs and the author appear in all copies of this software. - * - * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT - * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - * - * Author: Miklos Maroti - */ - -#ifndef __RF2XX_H__ -#define __RF2XX_H__ - -/* Set RF2XX_CHIPSET to one of these to enable specific features */ -#define RF230_CHIPSET 0 -#define RF212_CHIPSET 1 - -enum rf2xx_registers_enum -{ - RF2XX_TRX_STATUS = 0x01, - RF2XX_TRX_STATE = 0x02, - RF2XX_TRX_CTRL_0 = 0x03, - RF2XX_PHY_TX_PWR = 0x05, - RF2XX_PHY_RSSI = 0x06, - RF2XX_PHY_ED_LEVEL = 0x07, - RF2XX_PHY_CC_CCA = 0x08, - RF2XX_CCA_THRES = 0x09, - RF2XX_IRQ_MASK = 0x0E, - RF2XX_IRQ_STATUS = 0x0F, - RF2XX_VREG_CTRL = 0x10, - RF2XX_BATMON = 0x11, - RF2XX_XOSC_CTRL = 0x12, - RF2XX_PLL_CF = 0x1A, - RF2XX_PLL_DCU = 0x1B, - RF2XX_PART_NUM = 0x1C, - RF2XX_VERSION_NUM = 0x1D, - RF2XX_MAN_ID_0 = 0x1E, - RF2XX_MAN_ID_1 = 0x1F, - RF2XX_SHORT_ADDR_0 = 0x20, - RF2XX_SHORT_ADDR_1 = 0x21, - RF2XX_PAN_ID_0 = 0x22, - RF2XX_PAN_ID_1 = 0x23, - RF2XX_IEEE_ADDR_0 = 0x24, - RF2XX_IEEE_ADDR_1 = 0x25, - RF2XX_IEEE_ADDR_2 = 0x26, - RF2XX_IEEE_ADDR_3 = 0x27, - RF2XX_IEEE_ADDR_4 = 0x28, - RF2XX_IEEE_ADDR_5 = 0x29, - RF2XX_IEEE_ADDR_6 = 0x2A, - RF2XX_IEEE_ADDR_7 = 0x2B, - RF2XX_XAH_CTRL = 0x2C, - RF2XX_CSMA_SEED_0 = 0x2D, - RF2XX_CSMA_SEED_1 = 0x2E, -}; - -enum rf2xx_trx_register_enums -{ - RF2XX_CCA_DONE = 1 << 7, - RF2XX_CCA_STATUS = 1 << 6, - RF2XX_TRX_STATUS_MASK = 0x1F, - RF2XX_P_ON = 0, - RF2XX_BUSY_RX = 1, - RF2XX_BUSY_TX = 2, - RF2XX_RX_ON = 6, - RF2XX_TRX_OFF = 8, - RF2XX_PLL_ON = 9, - RF2XX_SLEEP = 15, - RF2XX_BUSY_RX_AACK = 16, - RF2XX_BUSR_TX_ARET = 17, - RF2XX_RX_AACK_ON = 22, - RF2XX_TX_ARET_ON = 25, - RF2XX_RX_ON_NOCLK = 28, - RF2XX_AACK_ON_NOCLK = 29, - RF2XX_BUSY_RX_AACK_NOCLK = 30, - RF2XX_STATE_TRANSITION_IN_PROGRESS = 31, - RF2XX_TRAC_STATUS_MASK = 0xE0, - RF2XX_TRAC_SUCCESS = 0, - RF2XX_TRAC_CHANNEL_ACCESS_FAILURE = 3 << 5, - RF2XX_TRAC_NO_ACK = 5 << 5, - RF2XX_TRX_CMD_MASK = 0x1F, - RF2XX_NOP = 0, - RF2XX_TX_START = 2, - RF2XX_FORCE_TRX_OFF = 3, -}; - -enum rf2xx_phy_register_enums -{ - RF2XX_TX_AUTO_CRC_ON = 1 << 7, - RF2XX_TX_PWR_MASK = 0x0F, - RF2XX_TX_PWR_DEFAULT = 0, - RF2XX_RSSI_MASK = 0x1F, - RF2XX_CCA_REQUEST = 1 << 7, - RF2XX_CCA_MODE_0 = 0 << 5, - RF2XX_CCA_MODE_1 = 1 << 5, - RF2XX_CCA_MODE_2 = 2 << 5, - RF2XX_CCA_MODE_3 = 3 << 5, - RF2XX_CHANNEL_DEFAULT = 11, - RF2XX_CHANNEL_MASK = 0x1F, - RF2XX_CCA_CS_THRES_SHIFT = 4, - RF2XX_CCA_ED_THRES_SHIFT = 0, -}; - -enum rf2xx_irq_register_enums -{ - RF2XX_IRQ_BAT_LOW = 1 << 7, - RF2XX_IRQ_TRX_UR = 1 << 6, - RF2XX_IRQ_TRX_END = 1 << 3, - RF2XX_IRQ_RX_START = 1 << 2, - RF2XX_IRQ_PLL_UNLOCK = 1 << 1, - RF2XX_IRQ_PLL_LOCK = 1 << 0, -}; - -enum rf2xx_control_register_enums -{ - RF2XX_AVREG_EXT = 1 << 7, - RF2XX_AVDD_OK = 1 << 6, - RF2XX_DVREG_EXT = 1 << 3, - RF2XX_DVDD_OK = 1 << 2, - RF2XX_BATMON_OK = 1 << 5, - RF2XX_BATMON_VHR = 1 << 4, - RF2XX_BATMON_VTH_MASK = 0x0F, - RF2XX_XTAL_MODE_OFF = 0 << 4, - RF2XX_XTAL_MODE_EXTERNAL = 4 << 4, - RF2XX_XTAL_MODE_INTERNAL = 15 << 4, -}; - -enum rf2xx_pll_register_enums -{ - RF2XX_PLL_CF_START = 1 << 7, - RF2XX_PLL_DCU_START = 1 << 7, -}; - -enum rf2xx_spi_command_enums -{ - RF2XX_CMD_REGISTER_READ = 0x80, - RF2XX_CMD_REGISTER_WRITE = 0xC0, - RF2XX_CMD_REGISTER_MASK = 0x3F, - RF2XX_CMD_FRAME_READ = 0x20, - RF2XX_CMD_FRAME_WRITE = 0x60, - RF2XX_CMD_SRAM_READ = 0x00, - RF2XX_CMD_SRAM_WRITE = 0x40, -}; - -#endif//__RF2XX_H__ diff --git a/tos/chips/rf230/RF2xxActiveMessageP.nc b/tos/chips/rf230/RF2xxActiveMessageP.nc deleted file mode 100644 index edc5b8f6..00000000 --- a/tos/chips/rf230/RF2xxActiveMessageP.nc +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright (c) 2007, Vanderbilt University - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice, the following - * two paragraphs and the author appear in all copies of this software. - * - * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT - * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - * - * Author: Miklos Maroti - */ - -#include -#include -#include -#include - -module RF2xxActiveMessageP -{ - provides - { - interface RF2xxDriverConfig; - interface SoftwareAckConfig; - interface UniqueConfig; - interface CsmaConfig; - interface TrafficMonitorConfig; - interface RandomCollisionConfig; - interface SlottedCollisionConfig; - interface ActiveMessageConfig; - interface DummyConfig; - } - - uses - { - interface IEEE154Packet; - interface Packet; - interface RadioAlarm; - } -} - -implementation -{ -/*----------------- RF2xxDriverConfig -----------------*/ - - async command uint8_t RF2xxDriverConfig.getLength(message_t* msg) - { - return call IEEE154Packet.getLength(msg); - } - - async command void RF2xxDriverConfig.setLength(message_t* msg, uint8_t len) - { - call IEEE154Packet.setLength(msg, len); - } - - async command uint8_t* RF2xxDriverConfig.getPayload(message_t* msg) - { - return ((uint8_t*)(call IEEE154Packet.getHeader(msg))) + 1; - } - - inline rf2xxpacket_metadata_t* getMeta(message_t* msg) - { - return (rf2xxpacket_metadata_t*)(msg->metadata); - } - - async command uint8_t RF2xxDriverConfig.getHeaderLength() - { - // we need the fcf, dsn, destpan and dest - return 7; - } - - async command uint8_t RF2xxDriverConfig.getMaxLength() - { - // note, that the ieee154_footer_t is not stored, but we should include it here - return sizeof(rf2xxpacket_header_t) - 1 + TOSH_DATA_LENGTH + sizeof(ieee154_footer_t); - } - - async command uint8_t RF2xxDriverConfig.getDefaultChannel() - { - return RF2XX_DEF_CHANNEL; - } - - async command bool RF2xxDriverConfig.requiresRssiCca(message_t* msg) - { - return call IEEE154Packet.isDataFrame(msg); - } - -/*----------------- SoftwareAckConfig -----------------*/ - - async command bool SoftwareAckConfig.requiresAckWait(message_t* msg) - { - return call IEEE154Packet.requiresAckWait(msg); - } - - async command bool SoftwareAckConfig.isAckPacket(message_t* msg) - { - return call IEEE154Packet.isAckFrame(msg); - } - - async command bool SoftwareAckConfig.verifyAckPacket(message_t* data, message_t* ack) - { - return call IEEE154Packet.verifyAckReply(data, ack); - } - - async command bool SoftwareAckConfig.requiresAckReply(message_t* msg) - { - return call IEEE154Packet.requiresAckReply(msg); - } - - async command void SoftwareAckConfig.createAckPacket(message_t* data, message_t* ack) - { - call IEEE154Packet.createAckReply(data, ack); - } - - async command void SoftwareAckConfig.setAckReceived(message_t* msg, bool acked) - { - if( acked ) - getMeta(msg)->flags |= RF2XXPACKET_WAS_ACKED; - else - getMeta(msg)->flags &= ~RF2XXPACKET_WAS_ACKED; - } - - async command uint16_t SoftwareAckConfig.getAckTimeout() - { - return (uint16_t)(800 * RADIO_ALARM_MICROSEC); - } - - tasklet_async command void SoftwareAckConfig.reportChannelError() - { - signal TrafficMonitorConfig.channelError(); - } - -/*----------------- UniqueConfig -----------------*/ - - async command uint8_t UniqueConfig.getSequenceNumber(message_t* msg) - { - return call IEEE154Packet.getDSN(msg); - } - - async command void UniqueConfig.setSequenceNumber(message_t* msg, uint8_t dsn) - { - call IEEE154Packet.setDSN(msg, dsn); - } - - async command am_addr_t UniqueConfig.getSender(message_t* msg) - { - return call IEEE154Packet.getSrcAddr(msg); - } - - tasklet_async command void UniqueConfig.reportChannelError() - { - signal TrafficMonitorConfig.channelError(); - } - -/*----------------- ActiveMessageConfig -----------------*/ - - command error_t ActiveMessageConfig.checkPacket(message_t* msg) - { - // the user forgot to call clear, we should return EINVAL - if( ! call IEEE154Packet.isDataFrame(msg) ) - call Packet.clear(msg); - - return SUCCESS; - } - -/*----------------- CsmaConfig -----------------*/ - - async command bool CsmaConfig.requiresSoftwareCCA(message_t* msg) - { - return call IEEE154Packet.isDataFrame(msg); - } - -/*----------------- TrafficMonitorConfig -----------------*/ - - enum - { - TRAFFIC_UPDATE_PERIOD = 100, // in milliseconds - TRAFFIC_MAX_BYTES = (uint16_t)(TRAFFIC_UPDATE_PERIOD * 1000UL / 32), // 3125 - }; - - async command uint16_t TrafficMonitorConfig.getUpdatePeriod() - { - return TRAFFIC_UPDATE_PERIOD; - } - - async command uint16_t TrafficMonitorConfig.getChannelTime(message_t* msg) - { - /* We count in bytes, one byte is 32 microsecond. We are conservative here. - * - * pure airtime: preable (4 bytes), SFD (1 byte), length (1 byte), payload + CRC (len bytes) - * frame separation: 5-10 bytes - * ack required: 8-16 byte separation, 11 bytes airtime, 5-10 bytes separation - */ - - uint8_t len = call IEEE154Packet.getLength(msg); - return call IEEE154Packet.getAckRequired(msg) ? len + 6 + 16 + 11 + 10 : len + 6 + 10; - } - - async command am_addr_t TrafficMonitorConfig.getSender(message_t* msg) - { - return call IEEE154Packet.getSrcAddr(msg); - } - - tasklet_async command void TrafficMonitorConfig.timerTick() - { - signal SlottedCollisionConfig.timerTick(); - } - -/*----------------- RandomCollisionConfig -----------------*/ - - /* - * We try to use the same values as in CC2420 - * - * CC2420_MIN_BACKOFF = 10 jiffies = 320 microsec - * CC2420_BACKOFF_PERIOD = 10 jiffies - * initial backoff = 0x1F * CC2420_BACKOFF_PERIOD = 310 jiffies = 9920 microsec - * congestion backoff = 0x7 * CC2420_BACKOFF_PERIOD = 70 jiffies = 2240 microsec - */ - - async command uint16_t RandomCollisionConfig.getMinimumBackoff() - { - return (uint16_t)(320 * RADIO_ALARM_MICROSEC); - } - - async command uint16_t RandomCollisionConfig.getInitialBackoff(message_t* msg) - { - return (uint16_t)(9920 * RADIO_ALARM_MICROSEC); - } - - async command uint16_t RandomCollisionConfig.getCongestionBackoff(message_t* msg) - { - return (uint16_t)(2240 * RADIO_ALARM_MICROSEC); - } - - async command uint16_t RandomCollisionConfig.getTransmitBarrier(message_t* msg) - { - uint16_t time; - - // TODO: maybe we should use the embedded timestamp of the message - time = call RadioAlarm.getNow(); - - // estimated response time (download the message, etc) is 5-8 bytes - if( call IEEE154Packet.requiresAckReply(msg) ) - time += (uint16_t)(32 * (-5 + 16 + 11 + 5) * RADIO_ALARM_MICROSEC); - else - time += (uint16_t)(32 * (-5 + 5) * RADIO_ALARM_MICROSEC); - - return time; - } - - tasklet_async event void RadioAlarm.fired() { } - -/*----------------- SlottedCollisionConfig -----------------*/ - - async command uint16_t SlottedCollisionConfig.getInitialDelay() - { - return 300; - } - - async command uint8_t SlottedCollisionConfig.getScheduleExponent() - { - return 11; - } - - async command uint16_t SlottedCollisionConfig.getTransmitTime(message_t* msg) - { - // TODO: check if the timestamp is correct - return getMeta(msg)->timestamp; - } - - async command uint16_t SlottedCollisionConfig.getCollisionWindowStart(message_t* msg) - { - // the preamble (4 bytes), SFD (1 byte), plus two extra for safety - return getMeta(msg)->timestamp - (uint16_t)(7 * 32 * RADIO_ALARM_MICROSEC); - } - - async command uint16_t SlottedCollisionConfig.getCollisionWindowLength(message_t* msg) - { - return (uint16_t)(2 * 7 * 32 * RADIO_ALARM_MICROSEC); - } - - default tasklet_async event void SlottedCollisionConfig.timerTick() { } - -/*----------------- Dummy -----------------*/ - - async command void DummyConfig.nothing() - { - } -} diff --git a/tos/chips/rf230/RF2xxDriverLayerC.nc b/tos/chips/rf230/RF2xxDriverLayerC.nc deleted file mode 100644 index 5ce75ebf..00000000 --- a/tos/chips/rf230/RF2xxDriverLayerC.nc +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2007, Vanderbilt University - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice, the following - * two paragraphs and the author appear in all copies of this software. - * - * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT - * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - * - * Author: Miklos Maroti - */ - -configuration RF2xxDriverLayerC -{ - provides - { - interface RadioState; - interface RadioSend; - interface RadioReceive; - interface RadioCCA; - } - - uses interface RF2xxDriverConfig; -} - -implementation -{ - components RF2xxDriverLayerP, HplRF2xxC, BusyWaitMicroC, TaskletC, MainC, RadioAlarmC, RF2xxPacketC, LocalTimeMicroC as LocalTimeRadioC; - - RadioState = RF2xxDriverLayerP; - RadioSend = RF2xxDriverLayerP; - RadioReceive = RF2xxDriverLayerP; - RadioCCA = RF2xxDriverLayerP; - - RF2xxDriverConfig = RF2xxDriverLayerP; - - RF2xxDriverLayerP.PacketLinkQuality -> RF2xxPacketC.PacketLinkQuality; - RF2xxDriverLayerP.PacketTransmitPower -> RF2xxPacketC.PacketTransmitPower; - RF2xxDriverLayerP.PacketRSSI -> RF2xxPacketC.PacketRSSI; - RF2xxDriverLayerP.PacketTimeSyncOffset -> RF2xxPacketC.PacketTimeSyncOffset; - RF2xxDriverLayerP.PacketTimeStamp -> RF2xxPacketC; - RF2xxDriverLayerP.LocalTime -> LocalTimeRadioC; - - RF2xxDriverLayerP.RadioAlarm -> RadioAlarmC.RadioAlarm[unique("RadioAlarm")]; - RadioAlarmC.Alarm -> HplRF2xxC.Alarm; - - RF2xxDriverLayerP.SELN -> HplRF2xxC.SELN; - RF2xxDriverLayerP.SpiResource -> HplRF2xxC.SpiResource; - RF2xxDriverLayerP.FastSpiByte -> HplRF2xxC; - - RF2xxDriverLayerP.SLP_TR -> HplRF2xxC.SLP_TR; - RF2xxDriverLayerP.RSTN -> HplRF2xxC.RSTN; - - RF2xxDriverLayerP.IRQ -> HplRF2xxC.IRQ; - RF2xxDriverLayerP.Tasklet -> TaskletC; - RF2xxDriverLayerP.BusyWait -> BusyWaitMicroC; - -#ifdef RF2XX_DEBUG - components DiagMsgC; - RF2xxDriverLayerP.DiagMsg -> DiagMsgC; -#endif - - MainC.SoftwareInit -> RF2xxDriverLayerP.SoftwareInit; - - components RealMainP; - RealMainP.PlatformInit -> RF2xxDriverLayerP.PlatformInit; -} diff --git a/tos/chips/rf230/ActiveMessageConfig.nc b/tos/chips/rf2xx/layers/ActiveMessageConfig.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/ActiveMessageConfig.nc rename to tos/chips/rf2xx/layers/ActiveMessageConfig.nc diff --git a/tos/chips/rf230/ActiveMessageLayerC.nc b/tos/chips/rf2xx/layers/ActiveMessageLayerC.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/ActiveMessageLayerC.nc rename to tos/chips/rf2xx/layers/ActiveMessageLayerC.nc diff --git a/tos/chips/rf230/CsmaConfig.nc b/tos/chips/rf2xx/layers/CsmaConfig.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/CsmaConfig.nc rename to tos/chips/rf2xx/layers/CsmaConfig.nc diff --git a/tos/chips/rf230/CsmaLayerC.nc b/tos/chips/rf2xx/layers/CsmaLayerC.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/CsmaLayerC.nc rename to tos/chips/rf2xx/layers/CsmaLayerC.nc diff --git a/tos/chips/rf230/CsmaLayerP.nc b/tos/chips/rf2xx/layers/CsmaLayerP.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/CsmaLayerP.nc rename to tos/chips/rf2xx/layers/CsmaLayerP.nc diff --git a/tos/chips/rf230/DummyConfig.nc b/tos/chips/rf2xx/layers/DummyConfig.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/DummyConfig.nc rename to tos/chips/rf2xx/layers/DummyConfig.nc diff --git a/tos/chips/rf230/DummyLayerC.nc b/tos/chips/rf2xx/layers/DummyLayerC.nc similarity index 100% rename from tos/chips/rf230/DummyLayerC.nc rename to tos/chips/rf2xx/layers/DummyLayerC.nc diff --git a/tos/chips/rf230/DummyLayerP.nc b/tos/chips/rf2xx/layers/DummyLayerP.nc similarity index 100% rename from tos/chips/rf230/DummyLayerP.nc rename to tos/chips/rf2xx/layers/DummyLayerP.nc diff --git a/tos/chips/rf230/TimeSyncMessage.h b/tos/chips/rf2xx/layers/GenericTimeSyncMessage.h similarity index 91% rename from tos/chips/rf230/TimeSyncMessage.h rename to tos/chips/rf2xx/layers/GenericTimeSyncMessage.h index 38fba022..6f2247ff 100644 --- a/tos/chips/rf230/TimeSyncMessage.h +++ b/tos/chips/rf2xx/layers/GenericTimeSyncMessage.h @@ -21,8 +21,8 @@ * Author: Miklos Maroti */ -#ifndef __TIMESYNCMESSAGE_H__ -#define __TIMESYNCMESSAGE_H__ +#ifndef __GENERICTIMESYNCMESSAGE_H__ +#define __GENERICTIMESYNCMESSAGE_H__ // this value is sent in the air typedef nx_int32_t timesync_relative_t; @@ -30,4 +30,4 @@ typedef nx_int32_t timesync_relative_t; // this value is stored in memory typedef uint32_t timesync_absolute_t; -#endif//__TIMESYNCMESSAGE_H__ +#endif//__GENERICTIMESYNCMESSAGE_H__ diff --git a/tos/chips/rf230/RF2xxTimeSyncMessageC.nc b/tos/chips/rf2xx/layers/GenericTimeSyncMessageC.nc similarity index 60% rename from tos/chips/rf230/RF2xxTimeSyncMessageC.nc rename to tos/chips/rf2xx/layers/GenericTimeSyncMessageC.nc index 88da07e5..d684a83e 100644 --- a/tos/chips/rf230/RF2xxTimeSyncMessageC.nc +++ b/tos/chips/rf2xx/layers/GenericTimeSyncMessageC.nc @@ -23,9 +23,9 @@ #include #include -#include +#include -configuration RF2xxTimeSyncMessageC +configuration GenericTimeSyncMessageC { provides { @@ -42,31 +42,37 @@ configuration RF2xxTimeSyncMessageC interface TimeSyncAMSend as TimeSyncAMSendMilli[am_id_t id]; interface TimeSyncPacket as TimeSyncPacketMilli; } + + uses + { + interface PacketField as PacketTimeSyncOffset; + interface LocalTime as LocalTimeRadio; + } } implementation { - components RF2xxTimeSyncMessageP, RF2xxActiveMessageC, LocalTimeMilliC, LocalTimeMicroC as LocalTimeRadioC, RF2xxPacketC; + components GenericTimeSyncMessageP, ActiveMessageC, LocalTimeMilliC; - TimeSyncAMSendRadio = RF2xxTimeSyncMessageP; - TimeSyncPacketRadio = RF2xxTimeSyncMessageP; + TimeSyncAMSendRadio = GenericTimeSyncMessageP; + TimeSyncPacketRadio = GenericTimeSyncMessageP; - TimeSyncAMSendMilli = RF2xxTimeSyncMessageP; - TimeSyncPacketMilli = RF2xxTimeSyncMessageP; + TimeSyncAMSendMilli = GenericTimeSyncMessageP; + TimeSyncPacketMilli = GenericTimeSyncMessageP; - Packet = RF2xxTimeSyncMessageP; - RF2xxTimeSyncMessageP.SubSend -> RF2xxActiveMessageC.AMSend; - RF2xxTimeSyncMessageP.SubPacket -> RF2xxActiveMessageC.Packet; + Packet = GenericTimeSyncMessageP; + GenericTimeSyncMessageP.SubSend -> ActiveMessageC.AMSend; + GenericTimeSyncMessageP.SubPacket -> ActiveMessageC.Packet; - RF2xxTimeSyncMessageP.PacketTimeStampRadio -> RF2xxActiveMessageC; - RF2xxTimeSyncMessageP.PacketTimeStampMilli -> RF2xxActiveMessageC; - RF2xxTimeSyncMessageP.LocalTimeRadio -> LocalTimeRadioC; - RF2xxTimeSyncMessageP.LocalTimeMilli -> LocalTimeMilliC; + GenericTimeSyncMessageP.PacketTimeStampRadio -> ActiveMessageC; + GenericTimeSyncMessageP.PacketTimeStampMilli -> ActiveMessageC; + GenericTimeSyncMessageP.LocalTimeRadio = LocalTimeRadio; + GenericTimeSyncMessageP.LocalTimeMilli -> LocalTimeMilliC; - RF2xxTimeSyncMessageP.PacketTimeSyncOffset -> RF2xxPacketC.PacketTimeSyncOffset; + GenericTimeSyncMessageP.PacketTimeSyncOffset = PacketTimeSyncOffset; - SplitControl = RF2xxActiveMessageC; - Receive = RF2xxActiveMessageC.Receive; - Snoop = RF2xxActiveMessageC.Snoop; - AMPacket = RF2xxActiveMessageC; + SplitControl = ActiveMessageC; + Receive = ActiveMessageC.Receive; + Snoop = ActiveMessageC.Snoop; + AMPacket = ActiveMessageC; } diff --git a/tos/chips/rf230/RF2xxTimeSyncMessageP.nc b/tos/chips/rf2xx/layers/GenericTimeSyncMessageP.nc similarity index 95% rename from tos/chips/rf230/RF2xxTimeSyncMessageP.nc rename to tos/chips/rf2xx/layers/GenericTimeSyncMessageP.nc index fd5dfc88..ba508ad7 100644 --- a/tos/chips/rf230/RF2xxTimeSyncMessageP.nc +++ b/tos/chips/rf2xx/layers/GenericTimeSyncMessageP.nc @@ -21,10 +21,10 @@ * Author: Miklos Maroti */ -#include -#include +#include +#include -module RF2xxTimeSyncMessageP +module GenericTimeSyncMessageP { provides { @@ -121,7 +121,7 @@ implementation command error_t TimeSyncAMSendMilli.send[am_id_t id](am_addr_t addr, message_t* msg, uint8_t len, uint32_t event_time) { // compute elapsed time in millisecond - event_time = ((int32_t)(event_time - call LocalTimeMilli.get()) << 10) + call LocalTimeRadio.get(); + event_time = ((int32_t)(event_time - call LocalTimeMilli.get()) << RADIO_ALARM_MILLI_EXP) + call LocalTimeRadio.get(); return call TimeSyncAMSendRadio.send[id](addr, msg, len, event_time); } @@ -182,6 +182,6 @@ implementation { timesync_relative_t* timesync = getFooter(msg); - return ((int32_t)(*timesync) >> 10) + call PacketTimeStampMilli.timestamp(msg); + return ((int32_t)(*timesync) >> RADIO_ALARM_MILLI_EXP) + call PacketTimeStampMilli.timestamp(msg); } } diff --git a/tos/chips/rf230/IEEE154NetworkLayerC.nc b/tos/chips/rf2xx/layers/IEEE154NetworkLayerC.nc similarity index 100% rename from tos/chips/rf230/IEEE154NetworkLayerC.nc rename to tos/chips/rf2xx/layers/IEEE154NetworkLayerC.nc diff --git a/tos/chips/rf230/IEEE154NetworkLayerP.nc b/tos/chips/rf2xx/layers/IEEE154NetworkLayerP.nc similarity index 100% rename from tos/chips/rf230/IEEE154NetworkLayerP.nc rename to tos/chips/rf2xx/layers/IEEE154NetworkLayerP.nc diff --git a/tos/chips/rf230/LowPowerListeningLayerC.nc b/tos/chips/rf2xx/layers/LowPowerListeningLayerC.nc similarity index 100% rename from tos/chips/rf230/LowPowerListeningLayerC.nc rename to tos/chips/rf2xx/layers/LowPowerListeningLayerC.nc diff --git a/tos/chips/rf230/LowPowerListeningLayerP.nc b/tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc similarity index 100% rename from tos/chips/rf230/LowPowerListeningLayerP.nc rename to tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc diff --git a/tos/chips/rf230/MessageBufferLayerC.nc b/tos/chips/rf2xx/layers/MessageBufferLayerC.nc similarity index 100% rename from tos/chips/rf230/MessageBufferLayerC.nc rename to tos/chips/rf2xx/layers/MessageBufferLayerC.nc diff --git a/tos/chips/rf230/MessageBufferLayerP.nc b/tos/chips/rf2xx/layers/MessageBufferLayerP.nc similarity index 100% rename from tos/chips/rf230/MessageBufferLayerP.nc rename to tos/chips/rf2xx/layers/MessageBufferLayerP.nc diff --git a/tos/chips/rf230/RandomCollisionConfig.nc b/tos/chips/rf2xx/layers/RandomCollisionConfig.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/RandomCollisionConfig.nc rename to tos/chips/rf2xx/layers/RandomCollisionConfig.nc diff --git a/tos/chips/rf230/RandomCollisionLayerC.nc b/tos/chips/rf2xx/layers/RandomCollisionLayerC.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/RandomCollisionLayerC.nc rename to tos/chips/rf2xx/layers/RandomCollisionLayerC.nc diff --git a/tos/chips/rf230/RandomCollisionLayerP.nc b/tos/chips/rf2xx/layers/RandomCollisionLayerP.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/RandomCollisionLayerP.nc rename to tos/chips/rf2xx/layers/RandomCollisionLayerP.nc diff --git a/tos/chips/rf230/SlottedCollisionConfig.nc b/tos/chips/rf2xx/layers/SlottedCollisionConfig.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/SlottedCollisionConfig.nc rename to tos/chips/rf2xx/layers/SlottedCollisionConfig.nc diff --git a/tos/chips/rf230/SlottedCollisionLayerC.nc b/tos/chips/rf2xx/layers/SlottedCollisionLayerC.nc similarity index 98% rename from tos/chips/rf230/SlottedCollisionLayerC.nc rename to tos/chips/rf2xx/layers/SlottedCollisionLayerC.nc index fb3962b3..5a6502b3 100644 --- a/tos/chips/rf230/SlottedCollisionLayerC.nc +++ b/tos/chips/rf2xx/layers/SlottedCollisionLayerC.nc @@ -50,7 +50,7 @@ implementation SlottedCollisionLayerP.Random -> RandomC; MainC.SoftwareInit -> SlottedCollisionLayerP; -#ifdef RF2XX_DEBUG +#ifdef RADIO_DEBUG components DiagMsgC; SlottedCollisionLayerP.DiagMsg -> DiagMsgC; #endif diff --git a/tos/chips/rf230/SlottedCollisionLayerP.nc b/tos/chips/rf2xx/layers/SlottedCollisionLayerP.nc similarity index 99% rename from tos/chips/rf230/SlottedCollisionLayerP.nc rename to tos/chips/rf2xx/layers/SlottedCollisionLayerP.nc index 4a7eaff6..500fef86 100644 --- a/tos/chips/rf230/SlottedCollisionLayerP.nc +++ b/tos/chips/rf2xx/layers/SlottedCollisionLayerP.nc @@ -39,7 +39,7 @@ module SlottedCollisionLayerP interface RadioAlarm; interface Random; interface SlottedCollisionConfig as Config; -#ifdef RF2XX_DEBUG +#ifdef RADIO_DEBUG interface DiagMsg; #endif } @@ -252,7 +252,7 @@ implementation return SUCCESS; } -#ifdef RF2XX_DEBUG +#ifdef RADIO_DEBUG tasklet_norace uint8_t count; void printStats() { diff --git a/tos/chips/rf230/SoftwareAckConfig.nc b/tos/chips/rf2xx/layers/SoftwareAckConfig.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/SoftwareAckConfig.nc rename to tos/chips/rf2xx/layers/SoftwareAckConfig.nc diff --git a/tos/chips/rf230/SoftwareAckLayerC.nc b/tos/chips/rf2xx/layers/SoftwareAckLayerC.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/SoftwareAckLayerC.nc rename to tos/chips/rf2xx/layers/SoftwareAckLayerC.nc diff --git a/tos/chips/rf230/SoftwareAckLayerP.nc b/tos/chips/rf2xx/layers/SoftwareAckLayerP.nc similarity index 100% rename from tos/chips/rf230/SoftwareAckLayerP.nc rename to tos/chips/rf2xx/layers/SoftwareAckLayerP.nc diff --git a/tos/chips/rf230/TrafficMonitorConfig.nc b/tos/chips/rf2xx/layers/TrafficMonitorConfig.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/TrafficMonitorConfig.nc rename to tos/chips/rf2xx/layers/TrafficMonitorConfig.nc diff --git a/tos/chips/rf230/TrafficMonitorLayerC.nc b/tos/chips/rf2xx/layers/TrafficMonitorLayerC.nc similarity index 99% rename from tos/chips/rf230/TrafficMonitorLayerC.nc rename to tos/chips/rf2xx/layers/TrafficMonitorLayerC.nc index bad50e12..6bab73f6 100644 --- a/tos/chips/rf230/TrafficMonitorLayerC.nc +++ b/tos/chips/rf2xx/layers/TrafficMonitorLayerC.nc @@ -57,7 +57,7 @@ implementation TrafficMonitorLayerP.NeighborhoodFlag -> NeighborhoodFlagC; TrafficMonitorLayerP.Tasklet -> TaskletC; -#ifdef RF2XX_DEBUG +#ifdef RADIO_DEBUG components DiagMsgC; TrafficMonitorLayerP.DiagMsg -> DiagMsgC; #endif diff --git a/tos/chips/rf230/TrafficMonitorLayerP.nc b/tos/chips/rf2xx/layers/TrafficMonitorLayerP.nc similarity index 99% rename from tos/chips/rf230/TrafficMonitorLayerP.nc rename to tos/chips/rf2xx/layers/TrafficMonitorLayerP.nc index ff9a42a3..b5f152ad 100644 --- a/tos/chips/rf230/TrafficMonitorLayerP.nc +++ b/tos/chips/rf2xx/layers/TrafficMonitorLayerP.nc @@ -50,7 +50,7 @@ module TrafficMonitorLayerP interface Neighborhood; interface NeighborhoodFlag; interface Tasklet; -#ifdef RF2XX_DEBUG +#ifdef RADIO_DEBUG interface DiagMsg; #endif } @@ -153,7 +153,7 @@ implementation call Tasklet.resume(); -#ifdef RF2XX_DEBUG +#ifdef RADIO_DEBUG if( ++debugCounter >= 10 && call DiagMsg.record() ) { debugCounter = 0; diff --git a/tos/chips/rf230/UniqueConfig.nc b/tos/chips/rf2xx/layers/UniqueConfig.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/UniqueConfig.nc rename to tos/chips/rf2xx/layers/UniqueConfig.nc diff --git a/tos/chips/rf230/UniqueLayerC.nc b/tos/chips/rf2xx/layers/UniqueLayerC.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/UniqueLayerC.nc rename to tos/chips/rf2xx/layers/UniqueLayerC.nc diff --git a/tos/chips/rf230/UniqueLayerP.nc b/tos/chips/rf2xx/layers/UniqueLayerP.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/UniqueLayerP.nc rename to tos/chips/rf2xx/layers/UniqueLayerP.nc diff --git a/tos/chips/rf2xx/rf230/RF230.h b/tos/chips/rf2xx/rf230/RF230.h new file mode 100644 index 00000000..781a1330 --- /dev/null +++ b/tos/chips/rf2xx/rf230/RF230.h @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2007, Vanderbilt University + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT + * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Author: Miklos Maroti + */ + +#ifndef __RF230_H__ +#define __RF230_H__ + +enum rf230_registers_enum +{ + RF230_TRX_STATUS = 0x01, + RF230_TRX_STATE = 0x02, + RF230_TRX_CTRL_0 = 0x03, + RF230_PHY_TX_PWR = 0x05, + RF230_PHY_RSSI = 0x06, + RF230_PHY_ED_LEVEL = 0x07, + RF230_PHY_CC_CCA = 0x08, + RF230_CCA_THRES = 0x09, + RF230_IRQ_MASK = 0x0E, + RF230_IRQ_STATUS = 0x0F, + RF230_VREG_CTRL = 0x10, + RF230_BATMON = 0x11, + RF230_XOSC_CTRL = 0x12, + RF230_PLL_CF = 0x1A, + RF230_PLL_DCU = 0x1B, + RF230_PART_NUM = 0x1C, + RF230_VERSION_NUM = 0x1D, + RF230_MAN_ID_0 = 0x1E, + RF230_MAN_ID_1 = 0x1F, + RF230_SHORT_ADDR_0 = 0x20, + RF230_SHORT_ADDR_1 = 0x21, + RF230_PAN_ID_0 = 0x22, + RF230_PAN_ID_1 = 0x23, + RF230_IEEE_ADDR_0 = 0x24, + RF230_IEEE_ADDR_1 = 0x25, + RF230_IEEE_ADDR_2 = 0x26, + RF230_IEEE_ADDR_3 = 0x27, + RF230_IEEE_ADDR_4 = 0x28, + RF230_IEEE_ADDR_5 = 0x29, + RF230_IEEE_ADDR_6 = 0x2A, + RF230_IEEE_ADDR_7 = 0x2B, + RF230_XAH_CTRL = 0x2C, + RF230_CSMA_SEED_0 = 0x2D, + RF230_CSMA_SEED_1 = 0x2E, +}; + +enum rf230_trx_register_enums +{ + RF230_CCA_DONE = 1 << 7, + RF230_CCA_STATUS = 1 << 6, + RF230_TRX_STATUS_MASK = 0x1F, + RF230_P_ON = 0, + RF230_BUSY_RX = 1, + RF230_BUSY_TX = 2, + RF230_RX_ON = 6, + RF230_TRX_OFF = 8, + RF230_PLL_ON = 9, + RF230_SLEEP = 15, + RF230_BUSY_RX_AACK = 16, + RF230_BUSR_TX_ARET = 17, + RF230_RX_AACK_ON = 22, + RF230_TX_ARET_ON = 25, + RF230_RX_ON_NOCLK = 28, + RF230_AACK_ON_NOCLK = 29, + RF230_BUSY_RX_AACK_NOCLK = 30, + RF230_STATE_TRANSITION_IN_PROGRESS = 31, + RF230_TRAC_STATUS_MASK = 0xE0, + RF230_TRAC_SUCCESS = 0, + RF230_TRAC_CHANNEL_ACCESS_FAILURE = 3 << 5, + RF230_TRAC_NO_ACK = 5 << 5, + RF230_TRX_CMD_MASK = 0x1F, + RF230_NOP = 0, + RF230_TX_START = 2, + RF230_FORCE_TRX_OFF = 3, +}; + +enum rf230_phy_register_enums +{ + RF230_TX_AUTO_CRC_ON = 1 << 7, + RF230_TX_PWR_MASK = 0x0F, + RF230_TX_PWR_DEFAULT = 0, + RF230_RSSI_MASK = 0x1F, + RF230_CCA_REQUEST = 1 << 7, + RF230_CCA_MODE_0 = 0 << 5, + RF230_CCA_MODE_1 = 1 << 5, + RF230_CCA_MODE_2 = 2 << 5, + RF230_CCA_MODE_3 = 3 << 5, + RF230_CHANNEL_DEFAULT = 11, + RF230_CHANNEL_MASK = 0x1F, + RF230_CCA_CS_THRES_SHIFT = 4, + RF230_CCA_ED_THRES_SHIFT = 0, +}; + +enum rf230_irq_register_enums +{ + RF230_IRQ_BAT_LOW = 1 << 7, + RF230_IRQ_TRX_UR = 1 << 6, + RF230_IRQ_TRX_END = 1 << 3, + RF230_IRQ_RX_START = 1 << 2, + RF230_IRQ_PLL_UNLOCK = 1 << 1, + RF230_IRQ_PLL_LOCK = 1 << 0, +}; + +enum rf230_control_register_enums +{ + RF230_AVREG_EXT = 1 << 7, + RF230_AVDD_OK = 1 << 6, + RF230_DVREG_EXT = 1 << 3, + RF230_DVDD_OK = 1 << 2, + RF230_BATMON_OK = 1 << 5, + RF230_BATMON_VHR = 1 << 4, + RF230_BATMON_VTH_MASK = 0x0F, + RF230_XTAL_MODE_OFF = 0 << 4, + RF230_XTAL_MODE_EXTERNAL = 4 << 4, + RF230_XTAL_MODE_INTERNAL = 15 << 4, +}; + +enum rf230_pll_register_enums +{ + RF230_PLL_CF_START = 1 << 7, + RF230_PLL_DCU_START = 1 << 7, +}; + +enum rf230_spi_command_enums +{ + RF230_CMD_REGISTER_READ = 0x80, + RF230_CMD_REGISTER_WRITE = 0xC0, + RF230_CMD_REGISTER_MASK = 0x3F, + RF230_CMD_FRAME_READ = 0x20, + RF230_CMD_FRAME_WRITE = 0x60, + RF230_CMD_SRAM_READ = 0x00, + RF230_CMD_SRAM_WRITE = 0x40, +}; + +#endif//__RF230_H__ diff --git a/tos/chips/rf230/RF2xxActiveMessageC.nc b/tos/chips/rf2xx/rf230/RF230ActiveMessageC.nc similarity index 72% rename from tos/chips/rf230/RF2xxActiveMessageC.nc rename to tos/chips/rf2xx/rf230/RF230ActiveMessageC.nc index 0e58c6e1..46c2f575 100644 --- a/tos/chips/rf230/RF2xxActiveMessageC.nc +++ b/tos/chips/rf2xx/rf230/RF230ActiveMessageC.nc @@ -21,9 +21,9 @@ * Author: Miklos Maroti */ -#include +#include -configuration RF2xxActiveMessageC +configuration RF230ActiveMessageC { provides { @@ -50,24 +50,24 @@ configuration RF2xxActiveMessageC implementation { - components RF2xxActiveMessageP, RF2xxPacketC, IEEE154PacketC, RadioAlarmC; + components RF230ActiveMessageP, RF230PacketC, IEEE154PacketC, RadioAlarmC; -#ifdef RF2XX_DEBUG +#ifdef RADIO_DEBUG components AssertC; #endif - RF2xxActiveMessageP.IEEE154Packet -> IEEE154PacketC; - RF2xxActiveMessageP.Packet -> RF2xxPacketC; - RF2xxActiveMessageP.RadioAlarm -> RadioAlarmC.RadioAlarm[unique("RadioAlarm")]; - - Packet = RF2xxPacketC; - AMPacket = RF2xxPacketC; - PacketAcknowledgements = RF2xxPacketC; - PacketLinkQuality = RF2xxPacketC.PacketLinkQuality; - PacketTransmitPower = RF2xxPacketC.PacketTransmitPower; - PacketRSSI = RF2xxPacketC.PacketRSSI; - PacketTimeStampRadio = RF2xxPacketC; - PacketTimeStampMilli = RF2xxPacketC; + RF230ActiveMessageP.IEEE154Packet -> IEEE154PacketC; + RF230ActiveMessageP.Packet -> RF230PacketC; + RF230ActiveMessageP.RadioAlarm -> RadioAlarmC.RadioAlarm[unique("RadioAlarm")]; + + Packet = RF230PacketC; + AMPacket = RF230PacketC; + PacketAcknowledgements = RF230PacketC; + PacketLinkQuality = RF230PacketC.PacketLinkQuality; + PacketTransmitPower = RF230PacketC.PacketTransmitPower; + PacketRSSI = RF230PacketC.PacketRSSI; + PacketTimeStampRadio = RF230PacketC; + PacketTimeStampMilli = RF230PacketC; LowPowerListening = LowPowerListeningLayerC; RadioChannel = MessageBufferLayerC; @@ -85,21 +85,21 @@ implementation components MessageBufferLayerC; components UniqueLayerC; components TrafficMonitorLayerC; -#ifdef RF2XX_SLOTTED_MAC +#ifdef SLOTTED_MAC components SlottedCollisionLayerC as CollisionAvoidanceLayerC; #else components RandomCollisionLayerC as CollisionAvoidanceLayerC; #endif components SoftwareAckLayerC; components new DummyLayerC() as CsmaLayerC; - components RF2xxDriverLayerC; + components RF230DriverLayerC; SplitControl = LowPowerListeningLayerC; AMSend = ActiveMessageLayerC; Receive = ActiveMessageLayerC.Receive; Snoop = ActiveMessageLayerC.Snoop; - ActiveMessageLayerC.Config -> RF2xxActiveMessageP; + ActiveMessageLayerC.Config -> RF230ActiveMessageP; ActiveMessageLayerC.AMPacket -> IEEE154PacketC; ActiveMessageLayerC.SubSend -> IEEE154NetworkLayerC; ActiveMessageLayerC.SubReceive -> IEEE154NetworkLayerC; @@ -108,41 +108,41 @@ implementation IEEE154NetworkLayerC.SubReceive -> LowPowerListeningLayerC; // the UniqueLayer is wired at two points - UniqueLayerC.Config -> RF2xxActiveMessageP; + UniqueLayerC.Config -> RF230ActiveMessageP; UniqueLayerC.SubSend -> LowPowerListeningLayerC; LowPowerListeningLayerC.SubControl -> MessageBufferLayerC; LowPowerListeningLayerC.SubSend -> MessageBufferLayerC; LowPowerListeningLayerC.SubReceive -> MessageBufferLayerC; #ifdef LOW_POWER_LISTENING - LowPowerListeningLayerC.PacketSleepInterval -> RF2xxPacketC; + LowPowerListeningLayerC.PacketSleepInterval -> RF230PacketC; LowPowerListeningLayerC.IEEE154Packet -> IEEE154PacketC; - LowPowerListeningLayerC.PacketAcknowledgements -> RF2xxPacketC; + LowPowerListeningLayerC.PacketAcknowledgements -> RF230PacketC; #endif - MessageBufferLayerC.Packet -> RF2xxPacketC; + MessageBufferLayerC.Packet -> RF230PacketC; MessageBufferLayerC.RadioSend -> TrafficMonitorLayerC; MessageBufferLayerC.RadioReceive -> UniqueLayerC; MessageBufferLayerC.RadioState -> TrafficMonitorLayerC; UniqueLayerC.SubReceive -> TrafficMonitorLayerC; - TrafficMonitorLayerC.Config -> RF2xxActiveMessageP; + TrafficMonitorLayerC.Config -> RF230ActiveMessageP; TrafficMonitorLayerC.SubSend -> CollisionAvoidanceLayerC; TrafficMonitorLayerC.SubReceive -> CollisionAvoidanceLayerC; - TrafficMonitorLayerC.SubState -> RF2xxDriverLayerC; + TrafficMonitorLayerC.SubState -> RF230DriverLayerC; - CollisionAvoidanceLayerC.Config -> RF2xxActiveMessageP; + CollisionAvoidanceLayerC.Config -> RF230ActiveMessageP; CollisionAvoidanceLayerC.SubSend -> SoftwareAckLayerC; CollisionAvoidanceLayerC.SubReceive -> SoftwareAckLayerC; - SoftwareAckLayerC.Config -> RF2xxActiveMessageP; + SoftwareAckLayerC.Config -> RF230ActiveMessageP; SoftwareAckLayerC.SubSend -> CsmaLayerC; - SoftwareAckLayerC.SubReceive -> RF2xxDriverLayerC; + SoftwareAckLayerC.SubReceive -> RF230DriverLayerC; - CsmaLayerC.Config -> RF2xxActiveMessageP; - CsmaLayerC -> RF2xxDriverLayerC.RadioSend; - CsmaLayerC -> RF2xxDriverLayerC.RadioCCA; + CsmaLayerC.Config -> RF230ActiveMessageP; + CsmaLayerC -> RF230DriverLayerC.RadioSend; + CsmaLayerC -> RF230DriverLayerC.RadioCCA; - RF2xxDriverLayerC.RF2xxDriverConfig -> RF2xxActiveMessageP; + RF230DriverLayerC.RF230DriverConfig -> RF230ActiveMessageP; } diff --git a/tos/chips/rf2xx/rf230/RF230ActiveMessageP.nc b/tos/chips/rf2xx/rf230/RF230ActiveMessageP.nc index 71b13307..58f65840 100644 --- a/tos/chips/rf2xx/rf230/RF230ActiveMessageP.nc +++ b/tos/chips/rf2xx/rf230/RF230ActiveMessageP.nc @@ -268,7 +268,7 @@ implementation async command uint8_t SlottedCollisionConfig.getScheduleExponent() { - return 11; + return 1 + RADIO_ALARM_MILLI_EXP; } async command uint16_t SlottedCollisionConfig.getTransmitTime(message_t* msg) diff --git a/tos/chips/rf230/RF2xxDriverConfig.nc b/tos/chips/rf2xx/rf230/RF230DriverConfig.nc similarity index 97% rename from tos/chips/rf230/RF2xxDriverConfig.nc rename to tos/chips/rf2xx/rf230/RF230DriverConfig.nc index 47f73378..1b6b04f4 100644 --- a/tos/chips/rf230/RF2xxDriverConfig.nc +++ b/tos/chips/rf2xx/rf230/RF230DriverConfig.nc @@ -23,9 +23,9 @@ /** * This interface needs to be implemented by the MAC to control the behaviour - * of the RF2xxDriverLayerC component. + * of the RF230DriverLayerC component. */ -interface RF2xxDriverConfig +interface RF230DriverConfig { /** * Returns the length of the PHY payload (including the FCF field). diff --git a/tos/chips/rf2xx/rf230/RF230DriverLayerC.nc b/tos/chips/rf2xx/rf230/RF230DriverLayerC.nc new file mode 100644 index 00000000..021e0982 --- /dev/null +++ b/tos/chips/rf2xx/rf230/RF230DriverLayerC.nc @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2007, Vanderbilt University + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose, without fee, and without written agreement is + * hereby granted, provided that the above copyright notice, the following + * two paragraphs and the author appear in all copies of this software. + * + * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT + * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT + * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Author: Miklos Maroti + */ + +configuration RF230DriverLayerC +{ + provides + { + interface RadioState; + interface RadioSend; + interface RadioReceive; + interface RadioCCA; + } + + uses interface RF230DriverConfig; +} + +implementation +{ + components RF230DriverLayerP, HplRF230C, BusyWaitMicroC, TaskletC, MainC, RadioAlarmC, RF230PacketC, LocalTimeMicroC as LocalTimeRadioC; + + RadioState = RF230DriverLayerP; + RadioSend = RF230DriverLayerP; + RadioReceive = RF230DriverLayerP; + RadioCCA = RF230DriverLayerP; + + RF230DriverConfig = RF230DriverLayerP; + + RF230DriverLayerP.PacketLinkQuality -> RF230PacketC.PacketLinkQuality; + RF230DriverLayerP.PacketTransmitPower -> RF230PacketC.PacketTransmitPower; + RF230DriverLayerP.PacketRSSI -> RF230PacketC.PacketRSSI; + RF230DriverLayerP.PacketTimeSyncOffset -> RF230PacketC.PacketTimeSyncOffset; + RF230DriverLayerP.PacketTimeStamp -> RF230PacketC; + RF230DriverLayerP.LocalTime -> LocalTimeRadioC; + + RF230DriverLayerP.RadioAlarm -> RadioAlarmC.RadioAlarm[unique("RadioAlarm")]; + RadioAlarmC.Alarm -> HplRF230C.Alarm; + + RF230DriverLayerP.SELN -> HplRF230C.SELN; + RF230DriverLayerP.SpiResource -> HplRF230C.SpiResource; + RF230DriverLayerP.FastSpiByte -> HplRF230C; + + RF230DriverLayerP.SLP_TR -> HplRF230C.SLP_TR; + RF230DriverLayerP.RSTN -> HplRF230C.RSTN; + + RF230DriverLayerP.IRQ -> HplRF230C.IRQ; + RF230DriverLayerP.Tasklet -> TaskletC; + RF230DriverLayerP.BusyWait -> BusyWaitMicroC; + +#ifdef RADIO_DEBUG + components DiagMsgC; + RF230DriverLayerP.DiagMsg -> DiagMsgC; +#endif + + MainC.SoftwareInit -> RF230DriverLayerP.SoftwareInit; + + components RealMainP; + RealMainP.PlatformInit -> RF230DriverLayerP.PlatformInit; +} diff --git a/tos/chips/rf230/RF2xxDriverLayerP.nc b/tos/chips/rf2xx/rf230/RF230DriverLayerP.nc similarity index 80% rename from tos/chips/rf230/RF2xxDriverLayerP.nc rename to tos/chips/rf2xx/rf230/RF230DriverLayerP.nc index c23a8222..c7e59fb2 100644 --- a/tos/chips/rf230/RF2xxDriverLayerP.nc +++ b/tos/chips/rf2xx/rf230/RF230DriverLayerP.nc @@ -21,14 +21,13 @@ * Author: Miklos Maroti */ -#include -#include +#include #include #include -#include -#include +#include +#include -module RF2xxDriverLayerP +module RF230DriverLayerP { provides { @@ -63,11 +62,11 @@ module RF2xxDriverLayerP interface PacketTimeStamp; interface LocalTime; - interface RF2xxDriverConfig; + interface RF230DriverConfig; interface Tasklet; interface RadioAlarm; -#ifdef RF2XX_DEBUG +#ifdef RADIO_DEBUG interface DiagMsg; #endif } @@ -123,10 +122,10 @@ implementation inline void writeRegister(uint8_t reg, uint8_t value) { ASSERT( call SpiResource.isOwner() ); - ASSERT( reg == (reg & RF2XX_CMD_REGISTER_MASK) ); + ASSERT( reg == (reg & RF230_CMD_REGISTER_MASK) ); call SELN.clr(); - call FastSpiByte.splitWrite(RF2XX_CMD_REGISTER_WRITE | reg); + call FastSpiByte.splitWrite(RF230_CMD_REGISTER_WRITE | reg); call FastSpiByte.splitReadWrite(value); call FastSpiByte.splitRead(); call SELN.set(); @@ -135,10 +134,10 @@ implementation inline uint8_t readRegister(uint8_t reg) { ASSERT( call SpiResource.isOwner() ); - ASSERT( reg == (reg & RF2XX_CMD_REGISTER_MASK) ); + ASSERT( reg == (reg & RF230_CMD_REGISTER_MASK) ); call SELN.clr(); - call FastSpiByte.splitWrite(RF2XX_CMD_REGISTER_READ | reg); + call FastSpiByte.splitWrite(RF230_CMD_REGISTER_READ | reg); call FastSpiByte.splitReadWrite(0); reg = call FastSpiByte.splitRead(); call SELN.set(); @@ -168,11 +167,11 @@ implementation ASSERT( state == STATE_RX_ON ); cmd = CMD_NONE; - cca = readRegister(RF2XX_TRX_STATUS); + cca = readRegister(RF230_TRX_STATUS); - ASSERT( (cca & RF2XX_TRX_STATUS_MASK) == RF2XX_RX_ON ); + ASSERT( (cca & RF230_TRX_STATUS_MASK) == RF230_RX_ON ); - signal RadioCCA.done( (cca & RF2XX_CCA_DONE) ? ((cca & RF2XX_CCA_STATUS) ? SUCCESS : EBUSY) : FAIL ); + signal RadioCCA.done( (cca & RF230_CCA_DONE) ? ((cca & RF230_CCA_STATUS) ? SUCCESS : EBUSY) : FAIL ); } else ASSERT(FALSE); @@ -216,18 +215,18 @@ implementation call BusyWait.wait(6); call RSTN.set(); - writeRegister(RF2XX_TRX_CTRL_0, RF2XX_TRX_CTRL_0_VALUE); - writeRegister(RF2XX_TRX_STATE, RF2XX_TRX_OFF); + writeRegister(RF230_TRX_CTRL_0, RF230_TRX_CTRL_0_VALUE); + writeRegister(RF230_TRX_STATE, RF230_TRX_OFF); call BusyWait.wait(510); - writeRegister(RF2XX_IRQ_MASK, RF2XX_IRQ_TRX_UR | RF2XX_IRQ_PLL_LOCK | RF2XX_IRQ_TRX_END | RF2XX_IRQ_RX_START); - writeRegister(RF2XX_CCA_THRES, RF2XX_CCA_THRES_VALUE); - writeRegister(RF2XX_PHY_TX_PWR, RF2XX_TX_AUTO_CRC_ON | RF2XX_TX_PWR_DEFAULT); + writeRegister(RF230_IRQ_MASK, RF230_IRQ_TRX_UR | RF230_IRQ_PLL_LOCK | RF230_IRQ_TRX_END | RF230_IRQ_RX_START); + writeRegister(RF230_CCA_THRES, RF230_CCA_THRES_VALUE); + writeRegister(RF230_PHY_TX_PWR, RF230_TX_AUTO_CRC_ON | RF230_TX_PWR_DEFAULT); - txPower = RF2XX_TX_PWR_DEFAULT; - channel = call RF2xxDriverConfig.getDefaultChannel() & RF2XX_CHANNEL_MASK; - writeRegister(RF2XX_PHY_CC_CCA, RF2XX_CCA_MODE_VALUE | channel); + txPower = RF230_TX_PWR_DEFAULT; + channel = call RF230DriverConfig.getDefaultChannel() & RF230_CHANNEL_MASK; + writeRegister(RF230_PHY_CC_CCA, RF230_CCA_MODE_VALUE | channel); call SLP_TR.set(); state = STATE_SLEEP; @@ -275,7 +274,7 @@ implementation tasklet_async command error_t RadioState.setChannel(uint8_t c) { - c &= RF2XX_CHANNEL_MASK; + c &= RF230_CHANNEL_MASK; if( cmd != CMD_NONE ) return EBUSY; @@ -296,7 +295,7 @@ implementation if( isSpiAcquired() ) { - writeRegister(RF2XX_PHY_CC_CCA, RF2XX_CCA_MODE_VALUE | channel); + writeRegister(RF230_PHY_CC_CCA, RF230_CCA_MODE_VALUE | channel); if( state == STATE_RX_ON ) state = STATE_TRX_OFF_2_RX_ON; @@ -321,19 +320,19 @@ implementation { ASSERT( ! radioIrq ); - readRegister(RF2XX_IRQ_STATUS); // clear the interrupt register + readRegister(RF230_IRQ_STATUS); // clear the interrupt register call IRQ.captureRisingEdge(); // setChannel was ignored in SLEEP because the SPI was not working, so do it here - writeRegister(RF2XX_PHY_CC_CCA, RF2XX_CCA_MODE_VALUE | channel); + writeRegister(RF230_PHY_CC_CCA, RF230_CCA_MODE_VALUE | channel); - writeRegister(RF2XX_TRX_STATE, RF2XX_RX_ON); + writeRegister(RF230_TRX_STATE, RF230_RX_ON); state = STATE_TRX_OFF_2_RX_ON; } else if( (cmd == CMD_TURNOFF || cmd == CMD_STANDBY) && state == STATE_RX_ON && isSpiAcquired() ) { - writeRegister(RF2XX_TRX_STATE, RF2XX_FORCE_TRX_OFF); + writeRegister(RF230_TRX_STATE, RF230_FORCE_TRX_OFF); call IRQ.disable(); radioIrq = FALSE; @@ -407,28 +406,28 @@ implementation return EBUSY; length = (call PacketTransmitPower.isSet(msg) ? - call PacketTransmitPower.get(msg) : RF2XX_DEF_RFPOWER) & RF2XX_TX_PWR_MASK; + call PacketTransmitPower.get(msg) : RF230_DEF_RFPOWER) & RF230_TX_PWR_MASK; if( length != txPower ) { txPower = length; - writeRegister(RF2XX_PHY_TX_PWR, RF2XX_TX_AUTO_CRC_ON | txPower); + writeRegister(RF230_PHY_TX_PWR, RF230_TX_AUTO_CRC_ON | txPower); } - if( call RF2xxDriverConfig.requiresRssiCca(msg) - && (readRegister(RF2XX_PHY_RSSI) & RF2XX_RSSI_MASK) > ((rssiClear + rssiBusy) >> 3) ) + if( call RF230DriverConfig.requiresRssiCca(msg) + && (readRegister(RF230_PHY_RSSI) & RF230_RSSI_MASK) > ((rssiClear + rssiBusy) >> 3) ) return EBUSY; - writeRegister(RF2XX_TRX_STATE, RF2XX_PLL_ON); + writeRegister(RF230_TRX_STATE, RF230_PLL_ON); // do something useful, just to wait a little time32 = call LocalTime.get(); timesync = call PacketTimeSyncOffset.isSet(msg) ? msg->data + call PacketTimeSyncOffset.get(msg) : 0; // we have missed an incoming message in this short amount of time - if( (readRegister(RF2XX_TRX_STATUS) & RF2XX_TRX_STATUS_MASK) != RF2XX_PLL_ON ) + if( (readRegister(RF230_TRX_STATUS) & RF230_TRX_STATUS_MASK) != RF230_PLL_ON ) { - ASSERT( (readRegister(RF2XX_TRX_STATUS) & RF2XX_TRX_STATUS_MASK) == RF2XX_BUSY_RX ); + ASSERT( (readRegister(RF230_TRX_STATUS) & RF230_TRX_STATUS_MASK) == RF230_BUSY_RX ); state = STATE_PLL_ON_2_RX_ON; return EBUSY; @@ -444,10 +443,10 @@ implementation ASSERT( ! radioIrq ); call SELN.clr(); - call FastSpiByte.splitWrite(RF2XX_CMD_FRAME_WRITE); + call FastSpiByte.splitWrite(RF230_CMD_FRAME_WRITE); - length = call RF2xxDriverConfig.getLength(msg); - data = call RF2xxDriverConfig.getPayload(msg); + length = call RF230DriverConfig.getLength(msg); + data = call RF230DriverConfig.getPayload(msg); // length | data[0] ... data[length-3] | automatically generated FCS call FastSpiByte.splitReadWrite(length); @@ -455,7 +454,7 @@ implementation // the FCS is atomatically generated (2 bytes) length -= 2; - header = call RF2xxDriverConfig.getHeaderLength(); + header = call RF230DriverConfig.getHeaderLength(); if( header > length ) header = length; @@ -482,7 +481,7 @@ implementation call SELN.set(); /* - * There is a very small window (~1 microsecond) when the RF2xx went + * There is a very small window (~1 microsecond) when the RF230 went * into PLL_ON state but was somehow not properly initialized because * of an incoming message and could not go into BUSY_TX. I think the * radio can even receive a message, and generate a TRX_UR interrupt @@ -494,12 +493,12 @@ implementation */ // go back to RX_ON state when finished - writeRegister(RF2XX_TRX_STATE, RF2XX_RX_ON); + writeRegister(RF230_TRX_STATE, RF230_RX_ON); -#ifdef RF2XX_DEBUG_MESSAGES +#ifdef RADIO_DEBUG_MESSAGES if( call DiagMsg.record() ) { - length = call RF2xxDriverConfig.getLength(msg); + length = call RF230DriverConfig.getLength(msg); call DiagMsg.str("tx"); call DiagMsg.uint16(time); @@ -532,10 +531,10 @@ implementation return EBUSY; // see Errata B7 of the datasheet - // writeRegister(RF2XX_TRX_STATE, RF2XX_PLL_ON); - // writeRegister(RF2XX_TRX_STATE, RF2XX_RX_ON); + // writeRegister(RF230_TRX_STATE, RF230_PLL_ON); + // writeRegister(RF230_TRX_STATE, RF230_RX_ON); - writeRegister(RF2XX_PHY_CC_CCA, RF2XX_CCA_REQUEST | RF2XX_CCA_MODE_VALUE | channel); + writeRegister(RF230_PHY_CC_CCA, RF230_CCA_REQUEST | RF230_CCA_MODE_VALUE | channel); call RadioAlarm.wait(CCA_REQUEST_TIME); cmd = CMD_CCA; @@ -552,13 +551,13 @@ implementation uint16_t crc; call SELN.clr(); - call FastSpiByte.write(RF2XX_CMD_FRAME_READ); + call FastSpiByte.write(RF230_CMD_FRAME_READ); // read the length byte length = call FastSpiByte.write(0); // if correct length - if( length >= 3 && length <= call RF2xxDriverConfig.getMaxLength() ) + if( length >= 3 && length <= call RF230DriverConfig.getMaxLength() ) { uint8_t read; uint8_t* data; @@ -566,31 +565,31 @@ implementation // initiate the reading call FastSpiByte.splitWrite(0); - call RF2xxDriverConfig.setLength(rxMsg, length); - data = call RF2xxDriverConfig.getPayload(rxMsg); + call RF230DriverConfig.setLength(rxMsg, length); + data = call RF230DriverConfig.getPayload(rxMsg); crc = 0; // we do not store the CRC field length -= 2; - read = call RF2xxDriverConfig.getHeaderLength(); + read = call RF230DriverConfig.getHeaderLength(); if( length < read ) read = length; length -= read; do { - crc = RF2XX_CRCBYTE_COMMAND(crc, *(data++) = call FastSpiByte.splitReadWrite(0)); + crc = RF230_CRCBYTE_COMMAND(crc, *(data++) = call FastSpiByte.splitReadWrite(0)); } while( --read != 0 ); if( signal RadioReceive.header(rxMsg) ) { while( length-- != 0 ) - crc = RF2XX_CRCBYTE_COMMAND(crc, *(data++) = call FastSpiByte.splitReadWrite(0)); + crc = RF230_CRCBYTE_COMMAND(crc, *(data++) = call FastSpiByte.splitReadWrite(0)); - crc = RF2XX_CRCBYTE_COMMAND(crc, call FastSpiByte.splitReadWrite(0)); - crc = RF2XX_CRCBYTE_COMMAND(crc, call FastSpiByte.splitReadWrite(0)); + crc = RF230_CRCBYTE_COMMAND(crc, call FastSpiByte.splitReadWrite(0)); + crc = RF230_CRCBYTE_COMMAND(crc, call FastSpiByte.splitReadWrite(0)); call PacketLinkQuality.set(rxMsg, call FastSpiByte.splitRead()); } @@ -603,17 +602,17 @@ implementation call SELN.set(); state = STATE_RX_ON; -#ifdef RF2XX_DEBUG_MESSAGES +#ifdef RADIO_DEBUG_MESSAGES if( call DiagMsg.record() ) { - length = call RF2xxDriverConfig.getLength(rxMsg); + length = call RF230DriverConfig.getLength(rxMsg); call DiagMsg.str("rx"); call DiagMsg.uint32(call PacketTimeStamp.isValid(rxMsg) ? call PacketTimeStamp.timestamp(rxMsg) : 0); call DiagMsg.uint16(call RadioAlarm.getNow()); call DiagMsg.uint8(crc != 0); call DiagMsg.uint8(length); - call DiagMsg.hex8s(call RF2xxDriverConfig.getPayload(rxMsg), length - 2); + call DiagMsg.hex8s(call RF230DriverConfig.getPayload(rxMsg), length - 2); call DiagMsg.send(); } #endif @@ -651,18 +650,18 @@ implementation atomic time = capturedTime; radioIrq = FALSE; - irq = readRegister(RF2XX_IRQ_STATUS); + irq = readRegister(RF230_IRQ_STATUS); -#ifdef RF2XX_DEBUG +#ifdef RADIO_DEBUG // TODO: handle this interrupt - if( irq & RF2XX_IRQ_TRX_UR ) + if( irq & RF230_IRQ_TRX_UR ) { if( call DiagMsg.record() ) { call DiagMsg.str("assert ur"); call DiagMsg.uint16(call RadioAlarm.getNow()); - call DiagMsg.hex8(readRegister(RF2XX_TRX_STATUS)); - call DiagMsg.hex8(readRegister(RF2XX_TRX_STATE)); + call DiagMsg.hex8(readRegister(RF230_TRX_STATUS)); + call DiagMsg.hex8(readRegister(RF230_TRX_STATE)); call DiagMsg.hex8(irq); call DiagMsg.uint8(state); call DiagMsg.uint8(cmd); @@ -671,7 +670,7 @@ implementation } #endif - if( irq & RF2XX_IRQ_PLL_LOCK ) + if( irq & RF230_IRQ_PLL_LOCK ) { if( cmd == CMD_TURNON || cmd == CMD_CHANNEL ) { @@ -688,7 +687,7 @@ implementation ASSERT(FALSE); } - if( irq & RF2XX_IRQ_RX_START ) + if( irq & RF230_IRQ_RX_START ) { if( cmd == CMD_CCA ) { @@ -701,11 +700,11 @@ implementation ASSERT( state == STATE_RX_ON || state == STATE_PLL_ON_2_RX_ON ); // the most likely place for busy channel, with no TRX_END interrupt - if( irq == RF2XX_IRQ_RX_START ) + if( irq == RF230_IRQ_RX_START ) { - temp = readRegister(RF2XX_PHY_RSSI) & RF2XX_RSSI_MASK; + temp = readRegister(RF230_PHY_RSSI) & RF230_RSSI_MASK; rssiBusy += temp - (rssiBusy >> 2); -#ifndef RF2XX_RSSI_ENERGY +#ifndef RF230_RSSI_ENERGY call PacketRSSI.set(rxMsg, temp); } else @@ -722,7 +721,7 @@ implementation * we could not be after a transmission, because then cmd = * CMD_TRANSMIT. */ - if( irq == RF2XX_IRQ_RX_START ) // just to be cautious + if( irq == RF230_IRQ_RX_START ) // just to be cautious { time32 = call LocalTime.get(); time32 += (int16_t)(time - RX_SFD_DELAY) - (int16_t)(time32); @@ -737,7 +736,7 @@ implementation ASSERT( cmd == CMD_TURNOFF ); } - if( irq & RF2XX_IRQ_TRX_END ) + if( irq & RF230_IRQ_TRX_END ) { if( cmd == CMD_TRANSMIT ) { @@ -748,28 +747,28 @@ implementation signal RadioSend.sendDone(SUCCESS); // TODO: we could have missed a received message - ASSERT( ! (irq & RF2XX_IRQ_RX_START) ); + ASSERT( ! (irq & RF230_IRQ_RX_START) ); } else if( cmd == CMD_RECEIVE ) { ASSERT( state == STATE_RX_ON || state == STATE_PLL_ON_2_RX_ON ); -#ifdef RF2XX_RSSI_ENERGY - if( irq == RF2XX_IRQ_TRX_END ) - call PacketRSSI.set(rxMsg, readRegister(RF2XX_PHY_ED_LEVEL)); +#ifdef RF230_RSSI_ENERGY + if( irq == RF230_IRQ_TRX_END ) + call PacketRSSI.set(rxMsg, readRegister(RF230_PHY_ED_LEVEL)); else call PacketRSSI.clear(rxMsg); #endif if( state == STATE_PLL_ON_2_RX_ON ) { - ASSERT( (readRegister(RF2XX_TRX_STATUS) & RF2XX_TRX_STATUS_MASK) == RF2XX_PLL_ON ); + ASSERT( (readRegister(RF230_TRX_STATUS) & RF230_TRX_STATUS_MASK) == RF230_PLL_ON ); - writeRegister(RF2XX_TRX_STATE, RF2XX_RX_ON); + writeRegister(RF230_TRX_STATE, RF230_RX_ON); state = STATE_RX_ON; } else { // the most likely place for clear channel (hope to avoid acks) - rssiClear += (readRegister(RF2XX_PHY_RSSI) & RF2XX_RSSI_MASK) - (rssiClear >> 2); + rssiClear += (readRegister(RF230_PHY_RSSI) & RF230_RSSI_MASK) - (rssiClear >> 2); } cmd = CMD_DOWNLOAD; diff --git a/tos/chips/rf230/RF2xxPacket.h b/tos/chips/rf2xx/rf230/RF230Packet.h similarity index 68% rename from tos/chips/rf230/RF2xxPacket.h rename to tos/chips/rf2xx/rf230/RF230Packet.h index d3b6898b..f12e3e5b 100644 --- a/tos/chips/rf230/RF2xxPacket.h +++ b/tos/chips/rf2xx/rf230/RF230Packet.h @@ -21,19 +21,19 @@ * Author: Miklos Maroti */ -#ifndef __RF2XXPACKET_H__ -#define __RF2XXPACKET_H__ +#ifndef __RF230PACKET_H__ +#define __RF230PACKET_H__ #include -typedef ieee154_header_t rf2xxpacket_header_t; +typedef ieee154_header_t rf230packet_header_t; -typedef nx_struct rf2xxpacket_footer_t +typedef nx_struct rf230packet_footer_t { // the time stamp is not recorded here, time stamped messaged cannot have max length -} rf2xxpacket_footer_t; +} rf230packet_footer_t; -typedef struct rf2xxpacket_metadata_t +typedef struct rf230packet_metadata_t { uint8_t flags; uint8_t lqi; @@ -42,18 +42,18 @@ typedef struct rf2xxpacket_metadata_t uint16_t lpl_sleepint; #endif uint32_t timestamp; -} rf2xxpacket_metadata_t; +} rf230packet_metadata_t; -enum rf2xxpacket_metadata_flags +enum rf230packet_metadata_flags { - RF2XXPACKET_WAS_ACKED = 0x01, // PacketAcknowledgements - RF2XXPACKET_TIMESTAMP = 0x02, // PacketTimeStamp - RF2XXPACKET_TXPOWER = 0x04, // PacketTransmitPower - RF2XXPACKET_RSSI = 0x08, // PacketRSSI - RF2XXPACKET_TIMESYNC = 0x10, // PacketTimeSync (update timesync_footer) - RF2XXPACKET_LPL_SLEEPINT = 0x20, // LowPowerListening - - RF2XXPACKET_CLEAR_METADATA = 0x00, + RF230PACKET_WAS_ACKED = 0x01, // PacketAcknowledgements + RF230PACKET_TIMESTAMP = 0x02, // PacketTimeStamp + RF230PACKET_TXPOWER = 0x04, // PacketTransmitPower + RF230PACKET_RSSI = 0x08, // PacketRSSI + RF230PACKET_TIMESYNC = 0x10, // PacketTimeSync (update timesync_footer) + RF230PACKET_LPL_SLEEPINT = 0x20, // LowPowerListening + + RF230PACKET_CLEAR_METADATA = 0x00, }; -#endif//__RF2XXPACKET_H__ +#endif//__RF230PACKET_H__ diff --git a/tos/chips/rf230/RF2xxPacketC.nc b/tos/chips/rf2xx/rf230/RF230PacketC.nc similarity index 72% rename from tos/chips/rf230/RF2xxPacketC.nc rename to tos/chips/rf2xx/rf230/RF230PacketC.nc index 70b9add2..9d09b314 100644 --- a/tos/chips/rf230/RF2xxPacketC.nc +++ b/tos/chips/rf2xx/rf230/RF230PacketC.nc @@ -21,7 +21,7 @@ * Author: Miklos Maroti */ -configuration RF2xxPacketC +configuration RF230PacketC { provides { @@ -41,22 +41,22 @@ configuration RF2xxPacketC implementation { - components RF2xxPacketP, IEEE154PacketC, LocalTimeMicroC, LocalTimeMilliC; + components RF230PacketP, IEEE154PacketC, LocalTimeMicroC, LocalTimeMilliC; - RF2xxPacketP.IEEE154Packet -> IEEE154PacketC; - RF2xxPacketP.LocalTimeRadio -> LocalTimeMicroC; - RF2xxPacketP.LocalTimeMilli -> LocalTimeMilliC; + RF230PacketP.IEEE154Packet -> IEEE154PacketC; + RF230PacketP.LocalTimeRadio -> LocalTimeMicroC; + RF230PacketP.LocalTimeMilli -> LocalTimeMilliC; - Packet = RF2xxPacketP; + Packet = RF230PacketP; AMPacket = IEEE154PacketC; - PacketAcknowledgements = RF2xxPacketP; - PacketLinkQuality = RF2xxPacketP.PacketLinkQuality; - PacketTransmitPower = RF2xxPacketP.PacketTransmitPower; - PacketRSSI = RF2xxPacketP.PacketRSSI; - PacketSleepInterval = RF2xxPacketP.PacketSleepInterval; - PacketTimeSyncOffset = RF2xxPacketP.PacketTimeSyncOffset; + PacketAcknowledgements = RF230PacketP; + PacketLinkQuality = RF230PacketP.PacketLinkQuality; + PacketTransmitPower = RF230PacketP.PacketTransmitPower; + PacketRSSI = RF230PacketP.PacketRSSI; + PacketSleepInterval = RF230PacketP.PacketSleepInterval; + PacketTimeSyncOffset = RF230PacketP.PacketTimeSyncOffset; - PacketTimeStampRadio = RF2xxPacketP; - PacketTimeStampMilli = RF2xxPacketP; + PacketTimeStampRadio = RF230PacketP; + PacketTimeStampMilli = RF230PacketP; } diff --git a/tos/chips/rf230/RF2xxPacketP.nc b/tos/chips/rf2xx/rf230/RF230PacketP.nc similarity index 81% rename from tos/chips/rf230/RF2xxPacketP.nc rename to tos/chips/rf2xx/rf230/RF230PacketP.nc index 5a727575..383cad78 100644 --- a/tos/chips/rf230/RF2xxPacketP.nc +++ b/tos/chips/rf2xx/rf230/RF230PacketP.nc @@ -21,10 +21,11 @@ * Author: Miklos Maroti */ -#include -#include +#include +#include +#include -module RF2xxPacketP +module RF230PacketP { provides { @@ -54,13 +55,13 @@ implementation enum { PACKET_LENGTH_INCREASE = - sizeof(rf2xxpacket_header_t) - 1 // the 8-bit length field is not counted + sizeof(rf230packet_header_t) - 1 // the 8-bit length field is not counted + sizeof(ieee154_footer_t), // the CRC is not stored in memory }; - inline rf2xxpacket_metadata_t* getMeta(message_t* msg) + inline rf230packet_metadata_t* getMeta(message_t* msg) { - return (rf2xxpacket_metadata_t*)(msg->metadata); + return (rf230packet_metadata_t*)(msg->metadata); } /*----------------- Packet -----------------*/ @@ -69,7 +70,7 @@ implementation { call IEEE154Packet.createDataFrame(msg); - getMeta(msg)->flags = RF2XXPACKET_CLEAR_METADATA; + getMeta(msg)->flags = RF230PACKET_CLEAR_METADATA; } inline command void Packet.setPayloadLength(message_t* msg, uint8_t len) @@ -113,7 +114,7 @@ implementation async command bool PacketAcknowledgements.wasAcked(message_t* msg) { - return getMeta(msg)->flags & RF2XXPACKET_WAS_ACKED; + return getMeta(msg)->flags & RF230PACKET_WAS_ACKED; } /*----------------- PacketLinkQuality -----------------*/ @@ -141,7 +142,7 @@ implementation async command bool PacketTimeStampRadio.isValid(message_t* msg) { - return getMeta(msg)->flags & RF2XXPACKET_TIMESTAMP; + return getMeta(msg)->flags & RF230PACKET_TIMESTAMP; } async command uint32_t PacketTimeStampRadio.timestamp(message_t* msg) @@ -151,12 +152,12 @@ implementation async command void PacketTimeStampRadio.clear(message_t* msg) { - getMeta(msg)->flags &= ~RF2XXPACKET_TIMESTAMP; + getMeta(msg)->flags &= ~RF230PACKET_TIMESTAMP; } async command void PacketTimeStampRadio.set(message_t* msg, uint32_t value) { - getMeta(msg)->flags |= RF2XXPACKET_TIMESTAMP; + getMeta(msg)->flags |= RF230PACKET_TIMESTAMP; getMeta(msg)->timestamp = value; } @@ -171,8 +172,7 @@ implementation { int32_t offset = call PacketTimeStampRadio.timestamp(msg) - call LocalTimeRadio.get(); - // TODO: Make the shift constant configurable - return (offset >> 10) + call LocalTimeMilli.get(); + return (offset >> RADIO_ALARM_MILLI_EXP) + call LocalTimeMilli.get(); } async command void PacketTimeStampMilli.clear(message_t* msg) @@ -182,8 +182,7 @@ implementation async command void PacketTimeStampMilli.set(message_t* msg, uint32_t value) { - // TODO: Make the shift constant configurable - int32_t offset = (value - call LocalTimeMilli.get()) << 10; + int32_t offset = (value - call LocalTimeMilli.get()) << RADIO_ALARM_MILLI_EXP; call PacketTimeStampRadio.set(msg, offset + call LocalTimeRadio.get()); } @@ -192,7 +191,7 @@ implementation async command bool PacketTransmitPower.isSet(message_t* msg) { - return getMeta(msg)->flags & RF2XXPACKET_TXPOWER; + return getMeta(msg)->flags & RF230PACKET_TXPOWER; } async command uint8_t PacketTransmitPower.get(message_t* msg) @@ -202,13 +201,13 @@ implementation async command void PacketTransmitPower.clear(message_t* msg) { - getMeta(msg)->flags &= ~RF2XXPACKET_TXPOWER; + getMeta(msg)->flags &= ~RF230PACKET_TXPOWER; } async command void PacketTransmitPower.set(message_t* msg, uint8_t value) { - getMeta(msg)->flags &= ~RF2XXPACKET_RSSI; - getMeta(msg)->flags |= RF2XXPACKET_TXPOWER; + getMeta(msg)->flags &= ~RF230PACKET_RSSI; + getMeta(msg)->flags |= RF230PACKET_TXPOWER; getMeta(msg)->power = value; } @@ -216,7 +215,7 @@ implementation async command bool PacketRSSI.isSet(message_t* msg) { - return getMeta(msg)->flags & RF2XXPACKET_RSSI; + return getMeta(msg)->flags & RF230PACKET_RSSI; } async command uint8_t PacketRSSI.get(message_t* msg) @@ -226,13 +225,13 @@ implementation async command void PacketRSSI.clear(message_t* msg) { - getMeta(msg)->flags &= ~RF2XXPACKET_RSSI; + getMeta(msg)->flags &= ~RF230PACKET_RSSI; } async command void PacketRSSI.set(message_t* msg, uint8_t value) { - getMeta(msg)->flags &= ~RF2XXPACKET_TXPOWER; - getMeta(msg)->flags |= RF2XXPACKET_RSSI; + getMeta(msg)->flags &= ~RF230PACKET_TXPOWER; + getMeta(msg)->flags |= RF230PACKET_RSSI; getMeta(msg)->power = value; } @@ -240,7 +239,7 @@ implementation async command bool PacketTimeSyncOffset.isSet(message_t* msg) { - return getMeta(msg)->flags & RF2XXPACKET_TIMESYNC; + return getMeta(msg)->flags & RF230PACKET_TIMESYNC; } async command uint8_t PacketTimeSyncOffset.get(message_t* msg) @@ -250,20 +249,20 @@ implementation async command void PacketTimeSyncOffset.clear(message_t* msg) { - getMeta(msg)->flags &= ~RF2XXPACKET_TIMESYNC; + getMeta(msg)->flags &= ~RF230PACKET_TIMESYNC; } async command void PacketTimeSyncOffset.set(message_t* msg, uint8_t value) { // the value is ignored, the offset always points to the timesync footer at the end of the payload - getMeta(msg)->flags |= RF2XXPACKET_TIMESYNC; + getMeta(msg)->flags |= RF230PACKET_TIMESYNC; } /*----------------- PacketSleepInterval -----------------*/ async command bool PacketSleepInterval.isSet(message_t* msg) { - return getMeta(msg)->flags & RF2XXPACKET_LPL_SLEEPINT; + return getMeta(msg)->flags & RF230PACKET_LPL_SLEEPINT; } async command uint16_t PacketSleepInterval.get(message_t* msg) @@ -277,12 +276,12 @@ implementation async command void PacketSleepInterval.clear(message_t* msg) { - getMeta(msg)->flags &= ~RF2XXPACKET_LPL_SLEEPINT; + getMeta(msg)->flags &= ~RF230PACKET_LPL_SLEEPINT; } async command void PacketSleepInterval.set(message_t* msg, uint16_t value) { - getMeta(msg)->flags |= RF2XXPACKET_LPL_SLEEPINT; + getMeta(msg)->flags |= RF230PACKET_LPL_SLEEPINT; #ifdef LOW_POWER_LISTENING getMeta(msg)->lpl_sleepint = value; diff --git a/tos/chips/rf230/IEEE154Packet.h b/tos/chips/rf2xx/util/IEEE154Packet.h similarity index 100% rename from tos/chips/rf230/IEEE154Packet.h rename to tos/chips/rf2xx/util/IEEE154Packet.h diff --git a/tos/chips/rf230/IEEE154Packet.nc b/tos/chips/rf2xx/util/IEEE154Packet.nc similarity index 100% rename from tos/chips/rf230/IEEE154Packet.nc rename to tos/chips/rf2xx/util/IEEE154Packet.nc diff --git a/tos/chips/rf230/IEEE154PacketC.nc b/tos/chips/rf2xx/util/IEEE154PacketC.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/IEEE154PacketC.nc rename to tos/chips/rf2xx/util/IEEE154PacketC.nc diff --git a/tos/chips/rf230/IEEE154PacketP.nc b/tos/chips/rf2xx/util/IEEE154PacketP.nc similarity index 100% rename from tos/chips/rf230/IEEE154PacketP.nc rename to tos/chips/rf2xx/util/IEEE154PacketP.nc diff --git a/tos/chips/rf230/Neighborhood.h b/tos/chips/rf2xx/util/Neighborhood.h old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/Neighborhood.h rename to tos/chips/rf2xx/util/Neighborhood.h diff --git a/tos/chips/rf230/Neighborhood.nc b/tos/chips/rf2xx/util/Neighborhood.nc similarity index 100% rename from tos/chips/rf230/Neighborhood.nc rename to tos/chips/rf2xx/util/Neighborhood.nc diff --git a/tos/chips/rf230/NeighborhoodC.nc b/tos/chips/rf2xx/util/NeighborhoodC.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/NeighborhoodC.nc rename to tos/chips/rf2xx/util/NeighborhoodC.nc diff --git a/tos/chips/rf230/NeighborhoodFlag.nc b/tos/chips/rf2xx/util/NeighborhoodFlag.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/NeighborhoodFlag.nc rename to tos/chips/rf2xx/util/NeighborhoodFlag.nc diff --git a/tos/chips/rf230/NeighborhoodFlagC.nc b/tos/chips/rf2xx/util/NeighborhoodFlagC.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/NeighborhoodFlagC.nc rename to tos/chips/rf2xx/util/NeighborhoodFlagC.nc diff --git a/tos/chips/rf230/NeighborhoodP.nc b/tos/chips/rf2xx/util/NeighborhoodP.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/NeighborhoodP.nc rename to tos/chips/rf2xx/util/NeighborhoodP.nc diff --git a/tos/chips/rf230/PacketField.nc b/tos/chips/rf2xx/util/PacketField.nc similarity index 100% rename from tos/chips/rf230/PacketField.nc rename to tos/chips/rf2xx/util/PacketField.nc diff --git a/tos/chips/rf230/RadioAlarm.nc b/tos/chips/rf2xx/util/RadioAlarm.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/RadioAlarm.nc rename to tos/chips/rf2xx/util/RadioAlarm.nc diff --git a/tos/chips/rf230/RadioAlarmC.nc b/tos/chips/rf2xx/util/RadioAlarmC.nc similarity index 100% rename from tos/chips/rf230/RadioAlarmC.nc rename to tos/chips/rf2xx/util/RadioAlarmC.nc diff --git a/tos/chips/rf230/RadioAlarmP.nc b/tos/chips/rf2xx/util/RadioAlarmP.nc similarity index 100% rename from tos/chips/rf230/RadioAlarmP.nc rename to tos/chips/rf2xx/util/RadioAlarmP.nc diff --git a/tos/chips/rf230/RadioAssert.h b/tos/chips/rf2xx/util/RadioAssert.h similarity index 98% rename from tos/chips/rf230/RadioAssert.h rename to tos/chips/rf2xx/util/RadioAssert.h index 0194f21e..79ff1802 100644 --- a/tos/chips/rf230/RadioAssert.h +++ b/tos/chips/rf2xx/util/RadioAssert.h @@ -24,7 +24,7 @@ #ifndef __RADIOASSERT_H__ #define __RADIOASSERT_H__ -#ifdef RF2XX_DEBUG +#ifdef RADIO_DEBUG void assert(bool condition, const char* file, uint16_t line); #define ASSERT(COND) assert(COND, __FILE__, __LINE__) diff --git a/tos/chips/rf230/RadioCCA.nc b/tos/chips/rf2xx/util/RadioCCA.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/RadioCCA.nc rename to tos/chips/rf2xx/util/RadioCCA.nc diff --git a/tos/chips/rf230/RadioChannel.nc b/tos/chips/rf2xx/util/RadioChannel.nc similarity index 100% rename from tos/chips/rf230/RadioChannel.nc rename to tos/chips/rf2xx/util/RadioChannel.nc diff --git a/tos/chips/rf230/RadioReceive.nc b/tos/chips/rf2xx/util/RadioReceive.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/RadioReceive.nc rename to tos/chips/rf2xx/util/RadioReceive.nc diff --git a/tos/chips/rf230/RadioSend.nc b/tos/chips/rf2xx/util/RadioSend.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/RadioSend.nc rename to tos/chips/rf2xx/util/RadioSend.nc diff --git a/tos/chips/rf230/RadioState.nc b/tos/chips/rf2xx/util/RadioState.nc similarity index 100% rename from tos/chips/rf230/RadioState.nc rename to tos/chips/rf2xx/util/RadioState.nc diff --git a/tos/chips/rf230/Tasklet.h b/tos/chips/rf2xx/util/Tasklet.h similarity index 100% rename from tos/chips/rf230/Tasklet.h rename to tos/chips/rf2xx/util/Tasklet.h diff --git a/tos/chips/rf230/Tasklet.nc b/tos/chips/rf2xx/util/Tasklet.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/Tasklet.nc rename to tos/chips/rf2xx/util/Tasklet.nc diff --git a/tos/chips/rf230/TaskletC.nc b/tos/chips/rf2xx/util/TaskletC.nc old mode 100644 new mode 100755 similarity index 100% rename from tos/chips/rf230/TaskletC.nc rename to tos/chips/rf2xx/util/TaskletC.nc diff --git a/tos/platforms/iris/.platform b/tos/platforms/iris/.platform index 26d4d13f..1f97d154 100644 --- a/tos/platforms/iris/.platform +++ b/tos/platforms/iris/.platform @@ -13,8 +13,9 @@ push( @includes, qw( %T/platforms/micaz %T/platforms/mica %T/platforms/iris/chips/rf230 - %T/chips/rf230 - %T/chips/cc2420 + %T/chips/rf2xx/rf230 + %T/chips/rf2xx/layers + %T/chips/rf2xx/util %T/platforms/iris/chips/at45db %T/platforms/mica2/chips/at45db %T/platforms/mica/chips/at45db diff --git a/tos/platforms/iris/ActiveMessageC.nc b/tos/platforms/iris/ActiveMessageC.nc index f16da57a..649ae6f3 100644 --- a/tos/platforms/iris/ActiveMessageC.nc +++ b/tos/platforms/iris/ActiveMessageC.nc @@ -43,7 +43,7 @@ configuration ActiveMessageC implementation { - components RF2xxActiveMessageC as MAC; + components RF230ActiveMessageC as MAC; SplitControl = MAC; AMSend = MAC; @@ -53,7 +53,7 @@ implementation AMPacket = MAC; PacketAcknowledgements = MAC; - LowPowerListening = MAC; + LowPowerListening = MAC; PacketTimeStampMilli = MAC; PacketTimeStampMicro = MAC; } diff --git a/tos/platforms/iris/TimeSyncMessageC.nc b/tos/platforms/iris/TimeSyncMessageC.nc index 4bca9f68..2acab4c0 100644 --- a/tos/platforms/iris/TimeSyncMessageC.nc +++ b/tos/platforms/iris/TimeSyncMessageC.nc @@ -21,7 +21,7 @@ * Author: Miklos Maroti */ -#include +#include configuration TimeSyncMessageC { @@ -44,17 +44,19 @@ configuration TimeSyncMessageC implementation { - components RF2xxTimeSyncMessageC; + components GenericTimeSyncMessageC as MAC, LocalTimeMicroC, RF230PacketC; - SplitControl = RF2xxTimeSyncMessageC; - - Receive = RF2xxTimeSyncMessageC.Receive; - Snoop = RF2xxTimeSyncMessageC.Snoop; - Packet = RF2xxTimeSyncMessageC; - AMPacket = RF2xxTimeSyncMessageC; - - TimeSyncAMSendRadio = RF2xxTimeSyncMessageC; - TimeSyncPacketRadio = RF2xxTimeSyncMessageC; - TimeSyncAMSendMilli = RF2xxTimeSyncMessageC; - TimeSyncPacketMilli = RF2xxTimeSyncMessageC; + SplitControl = MAC; + Receive = MAC.Receive; + Snoop = MAC.Snoop; + Packet = MAC; + AMPacket = MAC; + + TimeSyncAMSendRadio = MAC; + TimeSyncPacketRadio = MAC; + TimeSyncAMSendMilli = MAC; + TimeSyncPacketMilli = MAC; + + MAC.PacketTimeSyncOffset -> RF230PacketC.PacketTimeSyncOffset; + MAC.LocalTimeRadio -> LocalTimeMicroC; } diff --git a/tos/platforms/iris/chips/rf230/HplRF2xxC.nc b/tos/platforms/iris/chips/rf230/HplRF230C.nc similarity index 87% rename from tos/platforms/iris/chips/rf230/HplRF2xxC.nc rename to tos/platforms/iris/chips/rf230/HplRF230C.nc index 8d9a27fc..3753b483 100644 --- a/tos/platforms/iris/chips/rf230/HplRF2xxC.nc +++ b/tos/platforms/iris/chips/rf230/HplRF230C.nc @@ -21,9 +21,9 @@ * Author: Miklos Maroti */ -#include +#include -configuration HplRF2xxC +configuration HplRF230C { provides { @@ -41,11 +41,11 @@ configuration HplRF2xxC implementation { - components HplRF2xxP; - IRQ = HplRF2xxP.IRQ; + components HplRF230P; + IRQ = HplRF230P.IRQ; - HplRF2xxP.PortCLKM -> IO.PortD6; - HplRF2xxP.PortIRQ -> IO.PortD4; + HplRF230P.PortCLKM -> IO.PortD6; + HplRF230P.PortIRQ -> IO.PortD4; components Atm128SpiC as SpiC; SpiResource = SpiC.Resource[unique("Atm128SpiC.Resource")]; @@ -57,11 +57,11 @@ implementation SELN = IO.PortB0; components HplAtm128Timer1C as TimerC; - HplRF2xxP.Capture -> TimerC.Capture; + HplRF230P.Capture -> TimerC.Capture; components new AlarmOne16C() as AlarmC; Alarm = AlarmC; components RealMainP; - RealMainP.PlatformInit -> HplRF2xxP.PlatformInit; + RealMainP.PlatformInit -> HplRF230P.PlatformInit; } diff --git a/tos/platforms/iris/chips/rf230/HplRF2xxP.nc b/tos/platforms/iris/chips/rf230/HplRF230P.nc similarity index 98% rename from tos/platforms/iris/chips/rf230/HplRF2xxP.nc rename to tos/platforms/iris/chips/rf230/HplRF230P.nc index 3a06d1c2..761a2a96 100644 --- a/tos/platforms/iris/chips/rf230/HplRF2xxP.nc +++ b/tos/platforms/iris/chips/rf230/HplRF230P.nc @@ -21,9 +21,7 @@ * Author: Miklos Maroti */ -#include "Atm128Spi.h" - -module HplRF2xxP +module HplRF230P { provides { diff --git a/tos/platforms/iris/chips/rf230/RadioAlarm.h b/tos/platforms/iris/chips/rf230/RadioAlarm.h deleted file mode 100644 index 42b3d53c..00000000 --- a/tos/platforms/iris/chips/rf230/RadioAlarm.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2007, Vanderbilt University - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice, the following - * two paragraphs and the author appear in all copies of this software. - * - * IN NO EVENT SHALL THE VANDERBILT UNIVERSITY BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE VANDERBILT - * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE VANDERBILT UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE VANDERBILT UNIVERSITY HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - * - * Author: Miklos Maroti - */ - -#ifndef __RADIOALARM_H__ -#define __RADIOALARM_H__ - -#include - -/** - * This is the timer type of the radio alarm interface - */ -typedef TOne TRadio; - -/** - * The number of radio alarm ticks per one microsecond (0.9216). - * We use integers and no parentheses just to make deputy happy. - */ -#define RADIO_ALARM_MICROSEC (7372800UL / MHZ / 32) * (1 << MICA_DIVIDE_ONE_FOR_32KHZ_LOG2) / 1000000UL - -#endif//__RADIOALARM_H__ diff --git a/tos/platforms/iris/chips/rf230/HplRF2xx.h b/tos/platforms/iris/chips/rf230/RadioConfig.h similarity index 73% rename from tos/platforms/iris/chips/rf230/HplRF2xx.h rename to tos/platforms/iris/chips/rf230/RadioConfig.h index e312080f..703f2ea7 100644 --- a/tos/platforms/iris/chips/rf230/HplRF2xx.h +++ b/tos/platforms/iris/chips/rf230/RadioConfig.h @@ -21,10 +21,11 @@ * Author: Miklos Maroti */ -#ifndef __HPLRF2XX_H__ -#define __HPLRF2XX_H__ +#ifndef __RADIOCONFIG_H__ +#define __RADIOCONFIG_H__ -#include +#include +#include #include enum @@ -33,19 +34,19 @@ enum * This is the value of the TRX_CTRL_0 register * which configures the output pin currents and the CLKM clock */ - RF2XX_TRX_CTRL_0_VALUE = 0, + RF230_TRX_CTRL_0_VALUE = 0, /** * This is the default value of the CCA_MODE field in the PHY_CC_CCA register * which is used to configure the default mode of the clear channel assesment */ - RF2XX_CCA_MODE_VALUE = RF2XX_CCA_MODE_3, + RF230_CCA_MODE_VALUE = RF230_CCA_MODE_3, /** * This is the value of the CCA_THRES register that controls the * energy levels used for clear channel assesment */ - RF2XX_CCA_THRES_VALUE = 0xC7, + RF230_CCA_THRES_VALUE = 0xC7, }; /* This is the default value of the TX_PWR field of the PHY_TX_PWR register. */ @@ -53,24 +54,34 @@ enum #define RF230_DEF_RFPOWER 0 #endif -#define RF2XX_DEF_RFPOWER RF230_DEF_RFPOWER - /* This is the default value of the CHANNEL field of the PHY_CC_CCA register. */ #ifndef RF230_DEF_CHANNEL #define RF230_DEF_CHANNEL 11 #endif -#define RF2XX_DEF_CHANNEL RF230_DEF_CHANNEL - -#define RF2XX_CHIPSET RF230_CHIPSET - /* * This is the command used to calculate the CRC for the RF230 chip. * TODO: Check why the default crcByte implementation is in a different endianness */ -inline uint16_t RF2XX_CRCBYTE_COMMAND(uint16_t crc, uint8_t data) +inline uint16_t RF230_CRCBYTE_COMMAND(uint16_t crc, uint8_t data) { return _crc_ccitt_update(crc, data); } -#endif//__HPLRF2XX_H__ +/** + * This is the timer type of the radio alarm interface + */ +typedef TOne TRadio; + +/** + * The number of radio alarm ticks per one microsecond (0.9216). + * We use integers and no parentheses just to make deputy happy. + */ +#define RADIO_ALARM_MICROSEC (7372800UL / MHZ / 32) * (1 << MICA_DIVIDE_ONE_FOR_32KHZ_LOG2) / 1000000UL + +/** + * The base two logarithm of the number of radio alarm ticks per one millisecond + */ +#define RADIO_ALARM_MILLI_EXP 10 + +#endif//__RADIOCONFIG_H__ diff --git a/tos/platforms/iris/platform_message.h b/tos/platforms/iris/platform_message.h index cdf078ae..e3245c96 100644 --- a/tos/platforms/iris/platform_message.h +++ b/tos/platforms/iris/platform_message.h @@ -23,20 +23,20 @@ #ifndef PLATFORM_MESSAGE_H #define PLATFORM_MESSAGE_H -#include +#include #include typedef union message_header { - rf2xxpacket_header_t rf2xx; + rf230packet_header_t rf230; serial_header_t serial; } message_header_t; typedef union message_footer { - rf2xxpacket_footer_t rf2xx; + rf230packet_footer_t rf230; } message_footer_t; typedef union message_metadata { - rf2xxpacket_metadata_t rf2xx; + rf230packet_metadata_t rf230; } message_metadata_t; #endif -- 2.39.2