[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/atm1281 McuSleepC.nc, 1.2, 1.3 atm128hardware.h, 1.2, 1.3
Janos Sallai
sallai at users.sourceforge.net
Mon Jul 7 12:52:54 PDT 2008
Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/atm1281
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13394
Modified Files:
McuSleepC.nc atm128hardware.h
Log Message:
added safe tinyos annotations
Index: McuSleepC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm1281/McuSleepC.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** McuSleepC.nc 14 Dec 2007 20:29:36 -0000 1.2
--- McuSleepC.nc 7 Jul 2008 19:52:52 -0000 1.3
***************
*** 9,13 ****
* notice, the following two paragraphs and the author appear in all
* copies of this software.
! *
* IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
--- 9,13 ----
* notice, the following two paragraphs and the author appear in all
* copies of this software.
! *
* IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
***************
*** 15,19 ****
* IF STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
! *
* STANFORD UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
--- 15,19 ----
* IF STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
! *
* STANFORD UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
***************
*** 32,41 ****
* 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
--- 32,41 ----
* 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
***************
*** 61,65 ****
*/
! module McuSleepC {
provides {
interface McuSleep;
--- 61,65 ----
*/
! module McuSleepC @safe() {
provides {
interface McuSleep;
***************
*** 85,89 ****
(1 << SM2) | (1 << SM1),
(1 << SM1)};
!
mcu_power_t getPowerState() {
// Note: we go to sleep even if timer 0, 1, 3, 4, or 5's overflow
--- 85,89 ----
(1 << SM2) | (1 << SM1),
(1 << SM1)};
!
mcu_power_t getPowerState() {
// Note: we go to sleep even if timer 0, 1, 3, 4, or 5's overflow
***************
*** 91,98 ****
// "Alarm"s while still having power management. (see TEP102 Appendix C)
// Input capture and output compare for timer 4 and 5 are not functional
! // on the atm1281.
// Are there any input capture or output compare interrupts enabled
! // for timers 0, 1 or 3?
if (
TIMSK0 & (1 << OCIE0A | 1 << OCIE0B ) ||
--- 91,98 ----
// "Alarm"s while still having power management. (see TEP102 Appendix C)
// Input capture and output compare for timer 4 and 5 are not functional
! // on the atm1281.
// Are there any input capture or output compare interrupts enabled
! // for timers 0, 1 or 3?
if (
TIMSK0 & (1 << OCIE0A | 1 << OCIE0B ) ||
***************
*** 101,107 ****
) {
return ATM128_POWER_IDLE;
! }
// SPI (Radio stack)
! else if (bit_is_set(SPCR, SPIE)) {
return ATM128_POWER_IDLE;
}
--- 101,107 ----
) {
return ATM128_POWER_IDLE;
! }
// SPI (Radio stack)
! else if (bit_is_set(SPCR, SPIE)) {
return ATM128_POWER_IDLE;
}
***************
*** 116,122 ****
else if (bit_is_set(TWCR, TWEN)){
return ATM128_POWER_IDLE;
! }
// ADC is enabled
! else if (bit_is_set(ADCSRA, ADEN)) {
return ATM128_POWER_ADC_NR;
}
--- 116,122 ----
else if (bit_is_set(TWCR, TWEN)){
return ATM128_POWER_IDLE;
! }
// ADC is enabled
! else if (bit_is_set(ADCSRA, ADEN)) {
return ATM128_POWER_ADC_NR;
}
***************
*** 131,139 ****
powerState = mcombine(getPowerState(), call McuPowerOverride.lowestState());
SMCR =
! (SMCR & 0xf0) | 1 << SE | read_uint8_t(&atm128PowerBits[powerState]);
sei();
asm volatile ("sleep");
cli();
!
CLR_BIT(SMCR, SE);
}
--- 131,139 ----
powerState = mcombine(getPowerState(), call McuPowerOverride.lowestState());
SMCR =
! (SMCR & 0xf0) | 1 << SE | read_uint8_t(&atm128PowerBits[powerState]);
sei();
asm volatile ("sleep");
cli();
!
CLR_BIT(SMCR, SE);
}
Index: atm128hardware.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm1281/atm128hardware.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** atm128hardware.h 11 Jun 2008 00:46:23 -0000 1.2
--- atm128hardware.h 7 Jul 2008 19:52:52 -0000 1.3
***************
*** 1,3 ****
! /*
* IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. By
* downloading, copying, installing or using the software you agree to
--- 1,3 ----
! /*
* IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. By
* downloading, copying, installing or using the software you agree to
***************
*** 7,11 ****
* Copyright (c) 2004-2005 Crossbow Technology, Inc.
* Copyright (c) 2002-2003 Intel Corporation.
! * Copyright (c) 2000-2003 The Regents of the University of California.
* All rights reserved.
*
--- 7,11 ----
* Copyright (c) 2004-2005 Crossbow Technology, Inc.
* Copyright (c) 2002-2003 Intel Corporation.
! * Copyright (c) 2000-2003 The Regents of the University of California.
* All rights reserved.
*
***************
*** 40,49 ****
* 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
--- 40,49 ----
* 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
***************
*** 103,111 ****
/* Enables interrupts. */
! inline void __nesc_enable_interrupt() {
sei();
}
/* Disables all interrupts. */
! inline void __nesc_disable_interrupt() {
cli();
}
--- 103,111 ----
/* Enables interrupts. */
! inline void __nesc_enable_interrupt() @safe() {
sei();
}
/* Disables all interrupts. */
! inline void __nesc_disable_interrupt() @safe() {
cli();
}
***************
*** 123,128 ****
/* Saves current interrupt mask state and disables interrupts. */
! inline __nesc_atomic_t
! __nesc_atomic_start(void) @spontaneous()
{
__nesc_atomic_t result = SREG;
--- 123,128 ----
/* Saves current interrupt mask state and disables interrupts. */
! inline __nesc_atomic_t
! __nesc_atomic_start(void) @spontaneous() @safe()
{
__nesc_atomic_t result = SREG;
***************
*** 133,138 ****
/* Restores interrupt mask to original state. */
! inline void
! __nesc_atomic_end(__nesc_atomic_t original_SREG) @spontaneous()
{
asm volatile("" : : : "memory"); /* ensure atomic section effect visibility */
--- 133,138 ----
/* Restores interrupt mask to original state. */
! inline void
! __nesc_atomic_end(__nesc_atomic_t original_SREG) @spontaneous() @safe()
{
asm volatile("" : : : "memory"); /* ensure atomic section effect visibility */
***************
*** 151,159 ****
ATM128_POWER_SAVE = 3,
ATM128_POWER_STANDBY = 4,
! ATM128_POWER_DOWN = 5,
};
/* Combine function. */
! mcu_power_t mcombine(mcu_power_t m1, mcu_power_t m2) {
return (m1 < m2)? m1: m2;
}
--- 151,159 ----
ATM128_POWER_SAVE = 3,
ATM128_POWER_STANDBY = 4,
! ATM128_POWER_DOWN = 5,
};
/* Combine function. */
! mcu_power_t mcombine(mcu_power_t m1, mcu_power_t m2) @safe() {
return (m1 < m2)? m1: m2;
}
More information about the Tinyos-2-commits
mailing list