]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
add timer 0 threshold for ext standby vs power save sleep mode selection
authoridgay <idgay>
Fri, 11 Aug 2006 20:48:19 +0000 (20:48 +0000)
committeridgay <idgay>
Fri, 11 Aug 2006 20:48:19 +0000 (20:48 +0000)
tos/platforms/mica/MicaTimer.h
tos/platforms/mica2/hardware.h
tos/platforms/mica2dot/hardware.h
tos/platforms/micaz/hardware.h

index 63a6a164d62769a4f06fd5632811b22d1b38d8b4..548ffd954e14dc4b89c183437e7c2b28c79ef816 100644 (file)
    the platform's MHZ rate.
 
    Note that the timers thus obtained will not be exactly at 32768Hz or
    the platform's MHZ rate.
 
    Note that the timers thus obtained will not be exactly at 32768Hz or
-   1MHz, because the clock doesn't divide by a power of two to those frequencies,
-   and/or the clock frequency is not accurate. If you need more accurate timing,
-   you should use the calibration functions offered by the Atm128Calibrate interface
-   provided by PlatformC.
+   1MHz, because the clock doesn't divide by a power of two to those
+   frequencies, and/or the clock frequency is not accurate. If you need
+   more accurate timing, you should use the calibration functions
+   offered by the Atm128Calibrate interface provided by PlatformC.
+
+   This file also defines EXT_STANDBY_T0_THRESHOLD, a threshold on
+   remaining time till the next timer 0 interrupt under which the mote
+   should sleep in ext standby rather than power save. This is only
+   important when not using the internal oscillator.  Wake up from power
+   save takes 65536 cycles (6 cycles for ext standby), which is, e.g.,
+   ~9.4ms at 7Mhz.
 */
 
 #include <Timer.h>
 */
 
 #include <Timer.h>
@@ -64,7 +71,8 @@ enum {
   MICA_PRESCALER_ONE = ATM128_CLK16_DIVIDE_8,
   MICA_DIVIDE_ONE_FOR_32KHZ_LOG2 = 2,
   MICA_PRESCALER_THREE = ATM128_CLK16_NORMAL,
   MICA_PRESCALER_ONE = ATM128_CLK16_DIVIDE_8,
   MICA_DIVIDE_ONE_FOR_32KHZ_LOG2 = 2,
   MICA_PRESCALER_THREE = ATM128_CLK16_NORMAL,
-  MICA_DIVIDE_THREE_FOR_MICRO_LOG2 = 0
+  MICA_DIVIDE_THREE_FOR_MICRO_LOG2 = 0,
+  EXT_STANDBY_T0_THRESHOLD = 80,
 };
 
 #elif MHZ == 2
 };
 
 #elif MHZ == 2
@@ -77,7 +85,8 @@ enum {
   MICA_PRESCALER_ONE = ATM128_CLK16_DIVIDE_64,
   MICA_DIVIDE_ONE_FOR_32KHZ_LOG2 = 0,
   MICA_PRESCALER_THREE = ATM128_CLK16_NORMAL,
   MICA_PRESCALER_ONE = ATM128_CLK16_DIVIDE_64,
   MICA_DIVIDE_ONE_FOR_32KHZ_LOG2 = 0,
   MICA_PRESCALER_THREE = ATM128_CLK16_NORMAL,
-  MICA_DIVIDE_THREE_FOR_MICRO_LOG2 = 1
+  MICA_DIVIDE_THREE_FOR_MICRO_LOG2 = 1,
+  EXT_STANDBY_T0_THRESHOLD = 40
 };
 
 #elif MHZ == 4
 };
 
 #elif MHZ == 4
@@ -90,7 +99,8 @@ enum {
   MICA_PRESCALER_ONE = ATM128_CLK16_DIVIDE_64,
   MICA_DIVIDE_ONE_FOR_32KHZ_LOG2 = 1,
   MICA_PRESCALER_THREE = ATM128_CLK16_NORMAL,
   MICA_PRESCALER_ONE = ATM128_CLK16_DIVIDE_64,
   MICA_DIVIDE_ONE_FOR_32KHZ_LOG2 = 1,
   MICA_PRESCALER_THREE = ATM128_CLK16_NORMAL,
-  MICA_DIVIDE_THREE_FOR_MICRO_LOG2 = 2
+  MICA_DIVIDE_THREE_FOR_MICRO_LOG2 = 2,
+  EXT_STANDBY_T0_THRESHOLD = 24
 };
 
 #elif MHZ == 8
 };
 
 #elif MHZ == 8
@@ -103,7 +113,8 @@ enum {
   MICA_PRESCALER_ONE = ATM128_CLK16_DIVIDE_256,
   MICA_DIVIDE_ONE_FOR_32KHZ_LOG2 = 0,
   MICA_PRESCALER_THREE = ATM128_CLK16_DIVIDE_8,
   MICA_PRESCALER_ONE = ATM128_CLK16_DIVIDE_256,
   MICA_DIVIDE_ONE_FOR_32KHZ_LOG2 = 0,
   MICA_PRESCALER_THREE = ATM128_CLK16_DIVIDE_8,
-  MICA_DIVIDE_THREE_FOR_MICRO_LOG2 = 0
+  MICA_DIVIDE_THREE_FOR_MICRO_LOG2 = 0,
+  EXT_STANDBY_T0_THRESHOLD = 12
 };
 
 #else
 };
 
 #else
index 54a81d291201b34c8015b1f9d99265643035f1a0..28bf70857f0c5e8f086d38664cb7dd60079fff92 100644 (file)
 #ifndef HARDWARE_H
 #define HARDWARE_H
 
 #ifndef HARDWARE_H
 #define HARDWARE_H
 
+#ifndef MHZ
+/* Clock rate is ~8MHz except if specified by user 
+   (this value must be a power of 2, see MicaTimer.h and MeasureClockC.nc) */
+#define MHZ 8
+#endif
+
 #include <atm128hardware.h>
 #include <Atm128Adc.h>
 #include <atm128hardware.h>
 #include <Atm128Adc.h>
+#include <MicaTimer.h>
 
 // A/D channels
 enum {
 
 // A/D channels
 enum {
@@ -51,12 +58,6 @@ enum {
   CHANNEL_BATTERY    = ATM128_ADC_SNGL_ADC7,
 };
 
   CHANNEL_BATTERY    = ATM128_ADC_SNGL_ADC7,
 };
 
-#ifndef MHZ
-/* Clock rate is ~8MHz except if specified by user 
-   (this value must be a power of 2, see MicaTimer.h and MeasureClockC.nc) */
-#define MHZ 8
-#endif
-
 enum {
   PLATFORM_BAUDRATE = 57600L
 };
 enum {
   PLATFORM_BAUDRATE = 57600L
 };
index f2e9c07addd4b84f2e40cd43800a454fa3238519..918514f36913a3b04b601a90d6f8c66bb1677728 100644 (file)
 #ifndef HARDWARE_H
 #define HARDWARE_H
 
 #ifndef HARDWARE_H
 #define HARDWARE_H
 
+#ifndef MHZ
+/* Clock rate is 4MHz except if specified by user 
+   (this value must be a power of 2, see MicaTimer.h and MeasureClockC.nc) */
+#define MHZ 4
+#endif
+
 #include <atm128hardware.h>
 #include <Atm128Adc.h>
 #include <atm128hardware.h>
 #include <Atm128Adc.h>
+#include <MicaTimer.h>
 
 // A/D channels
 enum {
 
 // A/D channels
 enum {
@@ -50,12 +57,6 @@ enum {
   CHANNEL_BATTERY_THERMISTOR = ATM128_ADC_SNGL_ADC1
 };
 
   CHANNEL_BATTERY_THERMISTOR = ATM128_ADC_SNGL_ADC1
 };
 
-#ifndef MHZ
-/* Clock rate is 4MHz except if specified by user 
-   (this value must be a power of 2, see MicaTimer.h and MeasureClockC.nc) */
-#define MHZ 4
-#endif
-
 enum {
   PLATFORM_BAUDRATE = 19200L
 };
 enum {
   PLATFORM_BAUDRATE = 19200L
 };
index caba7f0c5574c56f59d47f772edf1aeba9e7d6e1..1720f58e46a5048cd8eed81aee483993ede2cbb7 100644 (file)
@@ -49,6 +49,7 @@
 
 #include <atm128hardware.h>
 #include <Atm128Adc.h>
 
 #include <atm128hardware.h>
 #include <Atm128Adc.h>
+#include <MicaTimer.h>
 
 // A/D channels
 enum {
 
 // A/D channels
 enum {