[Tinyos-beta-commits] CVS: tinyos-1.x/beta/platform/pxa27x SimpleWDTC.nc, NONE, 1.1 SimpleWDTM.nc, NONE, 1.1 HPLInit.nc, 1.9, 1.10 HPLInitM.nc, 1.2, 1.3 PXA27XPowerModes.h, 1.1, 1.2 PXA27XPowerModesM.nc, 1.1, 1.2 PXA27XUSBClientM.nc, 1.8, 1.9 SleepM.nc, 1.1, 1.2 pxa27x_registers.h, 1.13, 1.14 pxa27xhardware.h, 1.6, 1.7 util.s, 1.4, 1.5

Lama Nachman lnachman at users.sourceforge.net
Thu Dec 8 15:18:02 PST 2005


Update of /cvsroot/tinyos/tinyos-1.x/beta/platform/pxa27x
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26265

Modified Files:
	HPLInit.nc HPLInitM.nc PXA27XPowerModes.h PXA27XPowerModesM.nc 
	PXA27XUSBClientM.nc SleepM.nc pxa27x_registers.h 
	pxa27xhardware.h util.s 
Added Files:
	SimpleWDTC.nc SimpleWDTM.nc 
Log Message:
Updated the platform files from the internal tree on 12/08/05


--- NEW FILE: SimpleWDTC.nc ---
/*									tab:4
 *  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.  By
 *  downloading, copying, installing or using the software you agree to
 *  this license.  If you do not agree to this license, do not download,
 *  install, copy or use the software.
 *
 *  Intel Open Source License 
 *
 *  Copyright (c) 2002 Intel Corporation 
 *  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 Intel Corporation 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 INTEL OR ITS
 *  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.
 * 
 * 
 */
/*
 *
 * Authors: Lama Nachman
 */
configuration SimpleWDTC {

  provides{
    interface StdControl;
  }
}
implementation{
  components SimpleWDTM, TimerC, PXA27XWatchdogM;

  StdControl = SimpleWDTM;
  SimpleWDTM.Timer -> TimerC.Timer[unique("Timer")];
  SimpleWDTM.Reset -> PXA27XWatchdogM;
  SimpleWDTM.PXA27XWatchdog -> PXA27XWatchdogM;
}

--- NEW FILE: SimpleWDTM.nc ---
/*									tab:4
 *  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.  By
 *  downloading, copying, installing or using the software you agree to
 *  this license.  If you do not agree to this license, do not download,
 *  install, copy or use the software.
 *
 *  Intel Open Source License 
 *
 *  Copyright (c) 2002 Intel Corporation 
 *  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 Intel Corporation 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 INTEL OR ITS
 *  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.
 * 
 * 
 */

/*
 *
 * Authors:  Lama Nachman
 */


/*
 * A module that enables the watch dog and feed it periodically based on
 * a timer value.  This basically validates that the timer is running OK
 * and we are not blocked. More specialized checking will be needed for
 * most applications.
 */

#ifndef WDT_INTERVAL
#define WDT_INTERVAL 30000	// 30 seconds
#endif

module SimpleWDTM {
  provides{
    interface StdControl;
  }
  uses {
    interface PXA27XWatchdog;
    interface Reset;
    interface Timer;
  }
}

implementation {
  
  command result_t StdControl.init(){
    call PXA27XWatchdog.init();
    return SUCCESS;
  }

  command result_t StdControl.start(){
    call Timer.start(TIMER_REPEAT, 1500 * WDT_INTERVAL); // have margin
    call PXA27XWatchdog.enableWDT(3250 * WDT_INTERVAL);
    return SUCCESS;
  }
  
  command result_t StdControl.stop(){
    // can't stop WDT once started
    return FAIL;
  }

  event result_t Timer.fired() {
    call PXA27XWatchdog.feedWDT(3250 * WDT_INTERVAL);
  }

}

Index: HPLInit.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/pxa27x/HPLInit.nc,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** HPLInit.nc	18 Oct 2005 21:22:53 -0000	1.9
--- HPLInit.nc	8 Dec 2005 23:17:51 -0000	1.10
***************
*** 84,87 ****
--- 84,88 ----
  {
    components HPLInitM,
+     DVFSC,
      BluSHC,
      TrickleC,
***************
*** 97,100 ****
--- 98,102 ----
    Main.StdControl->PMICC;
    Main.StdControl->SettingsC;
+   HPLInitM.DVFS->DVFSC;
  }
  

Index: HPLInitM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/pxa27x/HPLInitM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** HPLInitM.nc	19 Sep 2005 20:44:53 -0000	1.2
--- HPLInitM.nc	8 Dec 2005 23:17:51 -0000	1.3
***************
*** 78,81 ****
--- 78,82 ----
  module HPLInitM {
    provides command result_t init();
+   uses interface DVFS;
  }
  
***************
*** 95,121 ****
  #if 0
      //PLACE PXA27X into 104MHz mode....valid bus settings
! 
          
-     CCCR = CCCR_L(8) | CCCR_2N(2) | CCCR_A ; 
-     asm volatile (
- 		  "mcr p14,0,%0,c6,c0,0\n\t"
- 		  :
- 		  : "r" (0xb)
- 		  );
  #else
!      // Place PXA27X into 13M w/ PPLL enabled...other bits are ignored...but might be useful later
!     /*********
! 	      Don't early enable PLL here.  Page 3-96 of manual says
! 	      "Write to this bit only when the processor is in 13M mode and the core PLL has
! 	      been disabled by setting CPDIS.  In normal run mode, writing to this bit causes
! 	      unpredictable results"
!     *******/
!     
!     CCCR = (CCCR_CPDIS | CCCR_L(8) | CCCR_2N(2) | CCCR_A);
!     asm volatile (
! 		  "mcr p14,0,%0,c6,c0,0\n\t"
! 		  :
! 		  : "r" (0x2)
! 		  );
  #endif
      
--- 96,105 ----
  #if 0
      //PLACE PXA27X into 104MHz mode....valid bus settings
!     call DVFS.SwitchCoreFreq(104, 104);
          
  #else
!     //PLACE PXA27X into 13 MHz mode
!     call DVFS.SwitchCoreFreq(13, 13);
! 
  #endif
      

Index: PXA27XPowerModes.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/pxa27x/PXA27XPowerModes.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PXA27XPowerModes.h	18 Oct 2005 21:22:53 -0000	1.1
--- PXA27XPowerModes.h	8 Dec 2005 23:17:51 -0000	1.2
***************
*** 69,72 ****
--- 69,73 ----
  #define PXA27XPOWERMODES_H
  
+ // Power Modes
  #define DEEP_SLEEP_MODE 1
  #define SLEEP_MODE 2
***************
*** 76,78 ****
--- 77,84 ----
  #define NORAML_MODE 6
  
+ // Wakeup sources
+ #define WAKEUP_RTC	0x1
+ #define WAKEUP_PMIC	0x2
+ #define WAKEUP_RADIO	0x4
+ 
  #endif //Power Modes

Index: PXA27XPowerModesM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/pxa27x/PXA27XPowerModesM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PXA27XPowerModesM.nc	18 Oct 2005 21:22:53 -0000	1.1
--- PXA27XPowerModesM.nc	8 Dec 2005 23:17:51 -0000	1.2
***************
*** 87,99 ****
  
    // TODO : This should be split to imote2/pxa specific sections
    void EnterDeepSleep() {
  
!     // Enable wakeup from PMIC (GPIO 1, R & F edges) and RTC, TODO : add radio?
!     PWER |= PWER_WERTC;
!     PWER |= PWER_WE1;
!     PFER |= PWER_WE1;
      PRER |= PRER_RE1;
      PFER |= PFER_RE1;
  
      // TODO: Set desired GPIO state
  
--- 87,110 ----
  
    // TODO : This should be split to imote2/pxa specific sections
+ 
    void EnterDeepSleep() {
  
!     DisablePeripherals();
! 
!     // Enable wakeup from PMIC (GPIO 1, R & F edges) and RTC
!     /*
!      * Enable wakeup from PMIC (GPIO 1, R & F edges) and RTC
!      * TODO : get the desired wakeup sources from the caller
!      */
!     PWER = PWER_WERTC | PWER_WE1;	// only enable wakeup from RTC
      PRER |= PRER_RE1;
      PFER |= PFER_RE1;
  
+ #if 0	// Radio
+     PWER |= PWER_WE0;
+     PRER |= PRER_RE0;
+     PFER |= PFER_RE0;
+ #endif
+ 
      // TODO: Set desired GPIO state
  

Index: PXA27XUSBClientM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/pxa27x/PXA27XUSBClientM.nc,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** PXA27XUSBClientM.nc	6 Sep 2005 18:00:32 -0000	1.8
--- PXA27XUSBClientM.nc	8 Dec 2005 23:17:51 -0000	1.9
***************
*** 983,987 ****
       trace("Device Attached %d;\r\n", state);
  #endif
!    UDCCR |= _UDC_bit(UDCCR_UDE);
     
     if((UDCCR & _UDC_bit(UDCCR_EMCE)) != 0)
--- 983,989 ----
       trace("Device Attached %d;\r\n", state);
  #endif
! 	//HACK>>>RA....the assumed convention that _UDC_bit uses has been violated by moving the UDCCR_UDE defnition to pxa27x_registers.h..need to fix
!    UDCCR |= _UDC_bit(UDCCR_UDE-1);
! 
     
     if((UDCCR & _UDC_bit(UDCCR_EMCE)) != 0)

Index: SleepM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/pxa27x/SleepM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SleepM.nc	18 Oct 2005 21:22:53 -0000	1.1
--- SleepM.nc	8 Dec 2005 23:17:51 -0000	1.2
***************
*** 65,68 ****
--- 65,69 ----
      call PMIC.shutDownLDOs();	// TODO : Move this out
      call PXA27XPowerModes.SwitchMode(DEEP_SLEEP_MODE);
+     return SUCCESS;
    }
  }

Index: pxa27x_registers.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/pxa27x/pxa27x_registers.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** pxa27x_registers.h	18 Oct 2005 21:24:42 -0000	1.13
--- pxa27x_registers.h	8 Dec 2005 23:17:51 -0000	1.14
***************
*** 1296,1302 ****
--- 1296,1308 ----
  #define PWER_WE0	(1 << 0)
  
+ #define PRER_RE0	(1 << 0)
  #define PRER_RE1	(1 << 1)
+ #define PRER_RE3	(1 << 3)
+ #define PRER_RE4	(1 << 4)
  
+ #define PFER_RE0	(1 << 0)
  #define PFER_RE1	(1 << 1)
+ #define PFER_RE3	(1 << 3)
+ #define PFER_RE4	(1 << 4)
  
  #define PCFR_RO		(1 << 15)	/* RDH Override */

Index: pxa27xhardware.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/pxa27x/pxa27xhardware.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** pxa27xhardware.h	6 Sep 2005 18:27:20 -0000	1.6
--- pxa27xhardware.h	8 Dec 2005 23:17:51 -0000	1.7
***************
*** 127,140 ****
  inline void TOSH_uwait(uint16_t usec)
  {
!   uint32_t mark = usec;
  
    mark <<= 2;
    mark *= 13;
    mark >>= 2;
  
!   OSCR0 = 0;
! 
!   while (OSCR0 < mark);
! 
  }
  
--- 127,141 ----
  inline void TOSH_uwait(uint16_t usec)
  {
!   uint32_t start,mark = usec;
  
+   //in order to avoid having to reset OSCR0, we need to look at time differences
+   
+   start = OSCR0;
    mark <<= 2;
    mark *= 13;
    mark >>= 2;
  
!   //OSCR0-start should work correctly due to nice properties of underflow
!   while ( (OSCR0 - start) < mark);
  }
  

Index: util.s
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/pxa27x/util.s,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** util.s	10 Sep 2005 01:11:59 -0000	1.4
--- util.s	8 Dec 2005 23:17:51 -0000	1.5
***************
*** 221,225 ****
  	@address 0x04000000 corresponds to static chip select 1
  	STMFD R13!, {R0 - R3, LR}
! 	LDR R1, =0x04000000	
  	MOV R0, #1024
  LOOP1:
--- 221,225 ----
  	@address 0x04000000 corresponds to static chip select 1
  	STMFD R13!, {R0 - R3, LR}
! 	LDR R1, =0x5c000000
  	MOV R0, #1024
  LOOP1:



More information about the Tinyos-beta-commits mailing list