]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Make Msp430ClockC a generic so that the target DCO clock and the ACLK can be
authorsmckown <smckown@4bc1554a-c7f2-4f65-a403-e0be01f0239c>
Tue, 9 Sep 2008 14:17:06 +0000 (14:17 +0000)
committerR. Steve McKown <rsmckown@gmail.com>
Tue, 1 Dec 2009 03:00:52 +0000 (20:00 -0700)
passed in as instantiation variables.  This provides a more TinyOS savvy
mechanism to set desired clocks as opposed to the prior method which involved
overriding macros defined in Msp430DcoSpec.h.  This and other enhancements to
the clock initialization has also slightly reduced executable sizes.  Below
is the Blink application from TinyOS 2.1.0, compiled with the plain vanilla
2.1.0 and with the clock init modifications for all msp430 platforms in the
standard distribution:

Compiled ROM sizes in bytes

|| Platform  || 2.1.0 || updated ||
||           ||       ||         ||
|| eyesIFX   || 2570  || 2510    ||
|| shimmer   || 2522  || 2462    ||
|| telosa    || 2538  || 2478    ||
|| telosb    || 2634  || 2574    ||
|| tinynode  || 2896  || 2838    ||

tos/chips/msp430/clock/Msp430ClockC.nc
tos/chips/msp430/clock/Msp430ClockP.nc
tos/chips/msp430/clock/Msp430DcoSpec.h [deleted file]
tos/platforms/eyesIFX/.family
tos/platforms/eyesIFX/PlatformC.nc
tos/platforms/shimmer/MoteClockC.nc
tos/platforms/telosa/MoteClockC.nc
tos/platforms/telosb/MoteClockC.nc
tos/platforms/tinynode/PlatformC.nc
tos/platforms/tmicore/MoteClockC.nc
tos/platforms/tmicore/MoteClockP.nc

index 5249fbe0ac6ba1f8de65d0e52ae6788ecc08ed22..ec37861a102daeb778863254eabfd225d74ad136 100644 (file)
  * @author Cory Sharp <cssharp@eecs.berkeley.edu>
  */
 
-configuration Msp430ClockC
+generic configuration Msp430ClockC(uint16_t TARGET_DCO_KHZ, uint16_t ACLK_KHZ)
 {
   provides interface Init;
   provides interface Msp430ClockInit;
 }
 implementation
 {
-  components Msp430ClockP, Msp430TimerC;
+  components new Msp430ClockP(TARGET_DCO_KHZ, ACLK_KHZ);
 
   Init = Msp430ClockP;
   Msp430ClockInit = Msp430ClockP;
index e700dd5229af831ce7d7dd14b1537df49e46b020..4304345305864e121fb65e5ceffe9fec710810fe 100644 (file)
  * @author Vlado Handziski <handzisk@tkn.tu-berlind.de>
  */
 
-#include <Msp430DcoSpec.h>
-
 #include "Msp430Timer.h"
 
-module Msp430ClockP @safe()
+generic module Msp430ClockP(uint16_t TARGET_DCO_KHZ, uint16_t ACLK_KHZ) @safe()
 {
   provides interface Init;
   provides interface Msp430ClockInit;
diff --git a/tos/chips/msp430/clock/Msp430DcoSpec.h b/tos/chips/msp430/clock/Msp430DcoSpec.h
deleted file mode 100644 (file)
index 84ce060..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- mode:c++; indent-tabs-mode: nil -*-
- * Copyright (c) 2007, Technische Universitaet Berlin
- * 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 Technische Universitaet Berlin 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
- * OWNER 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.
- */
-
-/**
- * Specify the target cpu clock speed of your platform by overriding this file.
- *
- * Be aware that tinyos relies on binary 4MHz, that is 4096 binary kHz.  Some
- * platforms have an external high frequency oscilator to generate the SMCLK
- * (e.g. eyesIFX, and possibly future ZigBee compliant nodes). These
- * oscillators provide metric frequencies, but may not run in power down
- * modes. Here, we need to switch the SMCLK source, which is easier if
- * the external and thd DCO source frequency are the same.
- * 
- * @author: Andreas Koepke (koepke@tkn.tu-berlin.de)
- */
-
-
-#ifndef MS430DCOSPEC_H
-#define MS430DCOSPEC_H
-
-#define TARGET_DCO_KHZ 4096 // the target DCO clock rate in binary kHz
-#define ACLK_KHZ 32 // the ACLK rate in binary kHz
-#endif
index fa237c92510c24930c4d924d78daed0c99af9254..f40d14fe27a258a5b5b651b8fb948860451372dd 100644 (file)
@@ -17,6 +17,7 @@ push( @includes, qw(
   %T/chips/ad5200
   %T/chips/msp430
   %T/chips/msp430/adc12
+  %T/chips/msp430/clock
   %T/chips/msp430/dma
   %T/chips/msp430/pins
   %T/chips/msp430/sensors
index 4beccbf449d78d62d6987a2a660ff06fa51957d3..e8192c075de393be42c46b715e73d89e47105b6f 100644 (file)
@@ -32,7 +32,7 @@ configuration PlatformC
 implementation
 {
   components PlatformP
-    , Msp430ClockC
+    , new Msp430ClockC(4096, 32)
     ;
 
   Init = PlatformP;
index 12df90bdd072afdc5a34a1ba65da9a176b588a10..ef2ade675f4ebdc5f48e8952907c108b11fffb3f 100644 (file)
@@ -41,7 +41,7 @@ configuration MoteClockC
 implementation
 
 {
-  components Msp430ClockC;
+  components new Msp430ClockC(4096, 32);
   
   MoteClockInit = Msp430ClockC.Init;
 }
index 12df90bdd072afdc5a34a1ba65da9a176b588a10..ef2ade675f4ebdc5f48e8952907c108b11fffb3f 100644 (file)
@@ -41,7 +41,7 @@ configuration MoteClockC
 implementation
 
 {
-  components Msp430ClockC;
+  components new Msp430ClockC(4096, 32);
   
   MoteClockInit = Msp430ClockC.Init;
 }
index 4fe3391019467a5f184fc62243e31fb7a976cd63..f857621823a495155aa70a08c8bf86892bb48ce7 100644 (file)
@@ -41,7 +41,7 @@ configuration MoteClockC
 implementation
 
 {
-  components Msp430ClockC, MoteClockP;
+  components new Msp430ClockC(4096, 32), MoteClockP;
   
   MoteClockInit = Msp430ClockC.Init;
   //MoteClockP.Msp430ClockInit -> Msp430ClockC;
index 73b1e2488b625bbe31c345cb68b0189cf95694f2..2435334aa505b45a72ec8c26b9de4e7ecb4423ce 100644 (file)
@@ -32,7 +32,7 @@ configuration PlatformC
 implementation
 {
   components PlatformP
-    , Msp430ClockC
+    , new Msp430ClockC(4096, 32)
     ;
 
   Init = PlatformP;
index e838b5e5ef108de858cbc5369318b6ff61561b63..dca0774261a1c0553374bdfab89c8049fb235741 100644 (file)
@@ -42,7 +42,7 @@ implementation {
   components MoteClockP;
   MoteClockInit = MoteClockP.Init;
 
-  components Msp430ClockC;
+  components new Msp430ClockC(8192, 32);
   MoteClockP.SubInit -> Msp430ClockC.Init;
   MoteClockP.Msp430ClockInit -> Msp430ClockC;
 }
index 3502a0a4f9c58b7fa996463933697626489ecec8..84acca22aea9d278c2628f310c8a3faafff65a5e 100644 (file)
  * @author R. Steve McKown <smckown@gmail.com>
  */
  
-//#include "msp430hardware.h"
 #include "Msp430Timer.h"
 
-#define MS430DCOSPEC_H
-#define TARGET_DCO_KHZ 8192 // the target DCO clock rate in binary kHz
-//#define TARGET_DCO_KHZ 4096 // the target DCO clock rate in binary kHz
-#define ACLK_KHZ 32 // the ACLK rate in binary kHz
-
 module MoteClockP {
   provides interface Init;
   uses {