[Tinyos-2-commits] [tinyos-main] r5753 committed - atm128rfa1: configurable external power amplifier logic, moved RadioCo...

tinyos-main at googlecode.com tinyos-main at googlecode.com
Mon Sep 19 01:08:13 PDT 2011


Revision: 5753
Author:   mmaroti
Date:     Mon Sep 19 01:07:18 2011
Log:      atm128rfa1: configurable external power amplifier logic, moved  
RadioConfig.h to the platform files
http://code.google.com/p/tinyos-main/source/detail?r=5753

Added:
  /trunk/tos/platforms/ucmini/RadioConfig.h
Deleted:
  /trunk/tos/chips/atm128rfa1/radio/RadioConfig.h
Modified:
  /trunk/tos/chips/atm128rfa1/radio/RFA1DriverLayerP.nc

=======================================
--- /dev/null
+++ /trunk/tos/platforms/ucmini/RadioConfig.h	Mon Sep 19 01:07:18 2011
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2007, Vanderbilt University
+ * Copyright (c) 2010, Univeristy of Szeged
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the
+ *   distribution.
+ * - Neither the name of the copyright holder nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Author: Miklos Maroti
+ * Author: Andras Biro
+ */
+
+#ifndef __RADIOCONFIG_H__
+#define __RADIOCONFIG_H__
+
+#include <RFA1DriverLayer.h>
+#include "TimerConfig.h"
+
+enum
+{
+	/**
+	 * 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
+	 */
+	RFA1_CCA_MODE_VALUE = CCA_CS<<CCA_MODE0,
+
+	/**
+	 * This is the value of the CCA_THRES register that controls the
+	 * energy levels used for clear channel assesment
+	 */
+	RFA1_CCA_THRES_VALUE = 0xC7,	//TODO to avr-libc values
+
+	RFA1_PA_BUF_LT=3<<PA_BUF_LT0,
+	RFA1_PA_LT=0<<PA_LT0,
+};
+
+/* This is the default value of the TX_PWR field of the PHY_TX_PWR  
register. */
+#ifndef RFA1_DEF_RFPOWER
+#define RFA1_DEF_RFPOWER	0
+#endif
+
+/* This is the default value of the CHANNEL field of the PHY_CC_CCA  
register. */
+#ifndef RFA1_DEF_CHANNEL
+#define RFA1_DEF_CHANNEL	11
+#endif
+
+/* The number of microseconds a sending mote will wait for an  
acknowledgement */
+#ifndef SOFTWAREACK_TIMEOUT
+#define SOFTWAREACK_TIMEOUT	1000
+#endif
+
+/**
+ * This is the timer type of the radio alarm interface
+ */
+typedef T62khz TRadio;
+typedef uint32_t tradio_size;
+
+/**
+ * The number of radio alarm ticks per one microsecond
+ */
+#define RADIO_ALARM_MICROSEC	0.0625
+
+/**
+ * The base two logarithm of the number of radio alarm ticks per one  
millisecond
+ */
+#define RADIO_ALARM_MILLI_EXP	6
+
+#endif//__RADIOCONFIG_H__
=======================================
--- /trunk/tos/chips/atm128rfa1/radio/RadioConfig.h	Sun Sep  4 02:04:37 2011
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2007, Vanderbilt University
- * Copyright (c) 2010, Univeristy of Szeged
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the
- *   distribution.
- * - Neither the name of the copyright holder nor the names of
- *   its contributors may be used to endorse or promote products derived
- *   from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Author: Miklos Maroti
- * Author: Andras Biro
- */
-
-#ifndef __RADIOCONFIG_H__
-#define __RADIOCONFIG_H__
-
-#include <RFA1DriverLayer.h>
-#include "TimerConfig.h"
-
-enum
-{
-	/**
-	 * 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
-	 */
-	RFA1_CCA_MODE_VALUE = CCA_CS<<CCA_MODE0,
-
-	/**
-	 * This is the value of the CCA_THRES register that controls the
-	 * energy levels used for clear channel assesment
-	 */
-	RFA1_CCA_THRES_VALUE = 0xC7,	//TODO to avr-libc values
-
-	RFA1_PA_BUF_LT=3<<PA_BUF_LT0,
-	RFA1_PA_LT=0<<PA_LT0,
-};
-
-/* This is the default value of the TX_PWR field of the PHY_TX_PWR  
register. */
-#ifndef RFA1_DEF_RFPOWER
-#define RFA1_DEF_RFPOWER	0
-#endif
-
-/* This is the default value of the CHANNEL field of the PHY_CC_CCA  
register. */
-#ifndef RFA1_DEF_CHANNEL
-#define RFA1_DEF_CHANNEL	11
-#endif
-
-/* The number of microseconds a sending mote will wait for an  
acknowledgement */
-#ifndef SOFTWAREACK_TIMEOUT
-#define SOFTWAREACK_TIMEOUT	1000
-#endif
-
-/**
- * This is the timer type of the radio alarm interface
- */
-typedef T62khz TRadio;
-typedef uint32_t tradio_size;
-
-/**
- * The number of radio alarm ticks per one microsecond
- */
-#define RADIO_ALARM_MICROSEC	0.0625
-
-/**
- * The base two logarithm of the number of radio alarm ticks per one  
millisecond
- */
-#define RADIO_ALARM_MILLI_EXP	6
-
-#endif//__RADIOCONFIG_H__
=======================================
--- /trunk/tos/chips/atm128rfa1/radio/RFA1DriverLayerP.nc	Sun Sep  4  
02:04:37 2011
+++ /trunk/tos/chips/atm128rfa1/radio/RFA1DriverLayerP.nc	Mon Sep 19  
01:07:18 2011
@@ -177,13 +177,18 @@
    {
      CCA_THRES=RFA1_CCA_THRES_VALUE;

-    //TODO PA_EXT settings with defines
-    PHY_TX_PWR=RFA1_PA_BUF_LT | RFA1_PA_LT |  
(RFA1_DEF_RFPOWER&RFA1_TX_PWR_MASK)<<TX_PWR0;
+#ifdef RFA1_ENABLE_PA
+    SET_BIT(DDRG,0);	// DIG3
+    CLR_BIT(PORTG,0);
+    SET_BIT(DDRF, 3);	// DIG0
+    CLR_BIT(PORTF, 3);
+#endif
+    PHY_TX_PWR = RFA1_PA_BUF_LT | RFA1_PA_LT |  
(RFA1_DEF_RFPOWER&RFA1_TX_PWR_MASK)<<TX_PWR0;

      txPower = RFA1_DEF_RFPOWER & RFA1_TX_PWR_MASK;
      channel = RFA1_DEF_CHANNEL & RFA1_CHANNEL_MASK;
      TRX_CTRL_1 |= 1<<TX_AUTO_CRC_ON;
-    PHY_CC_CCA=RFA1_CCA_MODE_VALUE|channel;
+    PHY_CC_CCA = RFA1_CCA_MODE_VALUE | channel;

      SET_BIT(TRXPR,SLPTR);

@@ -253,14 +258,18 @@
        IRQ_MASK = 1<<PLL_LOCK_EN | 1<<TX_END_EN | 1<<RX_END_EN | 1<<  
RX_START_EN | 1<<CCA_ED_DONE_EN;
        call McuPowerState.update();

-      // setChannel was ignored in SLEEP because the SPI was not working,  
so do it here
-      PHY_CC_CCA = RFA1_CCA_MODE_VALUE | channel;
-
        TRX_STATE = CMD_RX_ON;
+#ifdef RFA1_ENABLE_PA
+      SET_BIT(TRX_CTRL_1, PA_EXT_EN);
+#endif
+
        state = STATE_TRX_OFF_2_RX_ON;
      }
      else if( (cmd == CMD_TURNOFF || cmd == CMD_STANDBY) && state ==  
STATE_RX_ON )
      {
+#ifdef RFA1_ENABLE_PA
+      CLR_BIT(TRX_CTRL_1, PA_EXT_EN);
+#endif
        TRX_STATE = CMD_FORCE_TRX_OFF;

        IRQ_MASK = 0;


More information about the Tinyos-2-commits mailing list