[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/atm1281/timer Atm1281AlarmAsyncP.nc, 1.1, 1.2 HplAtm1281Timer1P.nc, 1.1, 1.2 HplAtm1281Timer2AsyncP.nc, 1.1, 1.2 HplAtm1281Timer3P.nc, 1.1, 1.2
Janos Sallai
sallai at users.sourceforge.net
Mon Jul 7 12:52:55 PDT 2008
Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/atm1281/timer
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13394/timer
Modified Files:
Atm1281AlarmAsyncP.nc HplAtm1281Timer1P.nc
HplAtm1281Timer2AsyncP.nc HplAtm1281Timer3P.nc
Log Message:
added safe tinyos annotations
Index: Atm1281AlarmAsyncP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm1281/timer/Atm1281AlarmAsyncP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Atm1281AlarmAsyncP.nc 5 Nov 2007 20:36:42 -0000 1.1
--- Atm1281AlarmAsyncP.nc 7 Jul 2008 19:52:52 -0000 1.2
***************
*** 4,10 ****
* All rights reserved.
*
! * This file is distributed under the terms in the attached INTEL-LICENSE
* file. If you do not find these files, copies can be found by writing to
! * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
*/
--- 4,10 ----
* All rights reserved.
*
! * This file is distributed under the terms in the attached INTEL-LICENSE
* file. If you do not find these files, copies can be found by writing to
! * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
*/
***************
*** 18,27 ****
* 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
--- 18,27 ----
* 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
***************
*** 31,35 ****
*
*/
!
/**
* Build a 32-bit alarm and counter from the atmega1281's 8-bit timer 2
--- 31,35 ----
*
*/
!
/**
* Build a 32-bit alarm and counter from the atmega1281's 8-bit timer 2
***************
*** 37,41 ****
* component and the generic timer components runs into problems
* apparently related to letting timer 2 overflow.
! *
* So, instead, this version (inspired by the 1.x code and a remark from
* Martin Turon) directly builds a 32-bit alarm and counter on top of timer 2
--- 37,41 ----
* component and the generic timer components runs into problems
* apparently related to letting timer 2 overflow.
! *
* So, instead, this version (inspired by the 1.x code and a remark from
* Martin Turon) directly builds a 32-bit alarm and counter on top of timer 2
***************
*** 45,49 ****
* @author Janos Sallai <janos.sallai at vanderbilt.edu>
*/
! generic module Atm1281AlarmAsyncP(typedef precision, int divider) {
provides {
interface Init;
--- 45,49 ----
* @author Janos Sallai <janos.sallai at vanderbilt.edu>
*/
! generic module Atm1281AlarmAsyncP(typedef precision, int divider) @safe() {
provides {
interface Init;
***************
*** 81,85 ****
Atm128_TCCR2A_t x;
Atm128_TCCR2B_t y;
!
call TimerAsync.setTimer2Asynchronous();
x.flat = 0;
--- 81,85 ----
Atm128_TCCR2A_t x;
Atm128_TCCR2B_t y;
!
call TimerAsync.setTimer2Asynchronous();
x.flat = 0;
***************
*** 96,100 ****
}
! /* Set compare register for timer 2 to n. But increment n by 1 if TCNT2
reaches this value before we can set the compare register.
*/
--- 96,100 ----
}
! /* Set compare register for timer 2 to n. But increment n by 1 if TCNT2
reaches this value before we can set the compare register.
*/
***************
*** 104,108 ****
if (n == call Timer.get())
n++;
! /* Support for overflow. Force interrupt at wrap around value.
This does not cause a backwards-in-time value as we do this
every time we set OCR2A. */
--- 104,108 ----
if (n == call Timer.get())
n++;
! /* Support for overflow. Force interrupt at wrap around value.
This does not cause a backwards-in-time value as we do this
every time we set OCR2A. */
***************
*** 184,188 ****
if (overflowed)
signal Counter.overflow();
! }
async command uint32_t Counter.get() {
--- 184,188 ----
if (overflowed)
signal Counter.overflow();
! }
async command uint32_t Counter.get() {
***************
*** 213,217 ****
}
! async command void Counter.clearOverflow() {
atomic
if (call Counter.isOverflowPending())
--- 213,217 ----
}
! async command void Counter.clearOverflow() {
atomic
if (call Counter.isOverflowPending())
Index: HplAtm1281Timer1P.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm1281/timer/HplAtm1281Timer1P.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** HplAtm1281Timer1P.nc 5 Nov 2007 20:36:42 -0000 1.1
--- HplAtm1281Timer1P.nc 7 Jul 2008 19:52:52 -0000 1.2
***************
*** 7,22 ****
* 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 CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS 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 CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
! * DAMAGE.
*
* CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
! * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
! * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
! * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY
! * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS.
*/
--- 7,22 ----
* 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 CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS 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 CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
! * DAMAGE.
*
* CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
! * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
! * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
! * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY
! * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS.
*/
***************
*** 30,39 ****
* 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
--- 30,39 ----
* 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
***************
*** 53,57 ****
#include <Atm128Timer.h>
! module HplAtm1281Timer1P
{
provides {
--- 53,57 ----
#include <Atm128Timer.h>
! module HplAtm1281Timer1P @safe()
{
provides {
***************
*** 80,133 ****
//=== Write a new timer scale. ========================================
! async command void Timer.setScale(uint8_t s) {
Atm128_TCCRB_t x = (Atm128_TCCRB_t) call TimerCtrl.getControlB();
x.bits.cs = s;
! call TimerCtrl.setControlB(x.flat);
}
//=== Read the control registers. =====================================
! async command uint8_t TimerCtrl.getControlA() {
! return TCCR1A;
}
! async command uint8_t TimerCtrl.getControlB() {
! return TCCR1B;
}
! async command uint8_t TimerCtrl.getControlC() {
! return TCCR1C;
}
//=== Write the control registers. ====================================
! async command void TimerCtrl.setControlA( uint8_t x ) {
! TCCR1A = x;
}
! async command void TimerCtrl.setControlB( uint8_t x ) {
! TCCR1B = x;
}
! async command void TimerCtrl.setControlC( uint8_t x ) {
! TCCR1C = x;
}
//=== Read the interrupt mask. =====================================
! async command uint8_t TimerCtrl.getInterruptMask() {
! return TIMSK1;
}
//=== Write the interrupt mask. ====================================
! async command void TimerCtrl.setInterruptMask( uint8_t x ) {
! TIMSK1 = x;
}
//=== Read the interrupt flags. =====================================
! async command uint8_t TimerCtrl.getInterruptFlag() {
! return TIFR1;
}
//=== Write the interrupt flags. ====================================
! async command void TimerCtrl.setInterruptFlag( uint8_t x ) {
! TIFR1 = x;
}
--- 80,133 ----
//=== Write a new timer scale. ========================================
! async command void Timer.setScale(uint8_t s) {
Atm128_TCCRB_t x = (Atm128_TCCRB_t) call TimerCtrl.getControlB();
x.bits.cs = s;
! call TimerCtrl.setControlB(x.flat);
}
//=== Read the control registers. =====================================
! async command uint8_t TimerCtrl.getControlA() {
! return TCCR1A;
}
! async command uint8_t TimerCtrl.getControlB() {
! return TCCR1B;
}
! async command uint8_t TimerCtrl.getControlC() {
! return TCCR1C;
}
//=== Write the control registers. ====================================
! async command void TimerCtrl.setControlA( uint8_t x ) {
! TCCR1A = x;
}
! async command void TimerCtrl.setControlB( uint8_t x ) {
! TCCR1B = x;
}
! async command void TimerCtrl.setControlC( uint8_t x ) {
! TCCR1C = x;
}
//=== Read the interrupt mask. =====================================
! async command uint8_t TimerCtrl.getInterruptMask() {
! return TIMSK1;
}
//=== Write the interrupt mask. ====================================
! async command void TimerCtrl.setInterruptMask( uint8_t x ) {
! TIMSK1 = x;
}
//=== Read the interrupt flags. =====================================
! async command uint8_t TimerCtrl.getInterruptFlag() {
! return TIFR1;
}
//=== Write the interrupt flags. ====================================
! async command void TimerCtrl.setInterruptFlag( uint8_t x ) {
! TIFR1 = x;
}
***************
*** 154,171 ****
async command void CompareC.stop() { CLR_BIT(TIMSK1,OCIE1C); }
! async command bool Timer.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.tov;
}
! async command bool Capture.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.icf;
}
! async command bool CompareA.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.ocfa;
}
! async command bool CompareB.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.ocfb;
}
! async command bool CompareC.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.ocfc;
}
--- 154,171 ----
async command void CompareC.stop() { CLR_BIT(TIMSK1,OCIE1C); }
! async command bool Timer.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.tov;
}
! async command bool Capture.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.icf;
}
! async command bool CompareA.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.ocfa;
}
! async command bool CompareB.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.ocfb;
}
! async command bool CompareC.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.ocfc;
}
Index: HplAtm1281Timer2AsyncP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm1281/timer/HplAtm1281Timer2AsyncP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** HplAtm1281Timer2AsyncP.nc 5 Nov 2007 20:36:43 -0000 1.1
--- HplAtm1281Timer2AsyncP.nc 7 Jul 2008 19:52:52 -0000 1.2
***************
*** 6,21 ****
* 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 CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS 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 CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
! * DAMAGE.
*
* CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
! * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
! * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
! * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY
! * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS.
*/
--- 6,21 ----
* 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 CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS 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 CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
! * DAMAGE.
*
* CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
! * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
! * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
! * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY
! * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS.
*/
***************
*** 29,38 ****
* 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
--- 29,38 ----
* 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
***************
*** 56,60 ****
#include <Atm128Timer.h>
! module HplAtm1281Timer2AsyncP
{
provides {
--- 56,60 ----
#include <Atm128Timer.h>
! module HplAtm1281Timer2AsyncP @safe()
{
provides {
***************
*** 93,142 ****
//=== Write a new timer scale. ========================================
! async command void Timer.setScale(uint8_t s) {
Atm128_TCCR2B_t x = (Atm128_TCCR2B_t) call TimerCtrl.getControlB();
x.bits.cs = s;
! call TimerCtrl.setControlB(x.flat);
}
//=== Read the control registers. =====================================
! async command uint8_t TimerCtrl.getControlA() {
! return TCCR2A;
}
! async command uint8_t TimerCtrl.getControlB() {
! return TCCR2B;
}
//=== Write the control registers. ====================================
! async command void TimerCtrl.setControlA( uint8_t x ) {
while (ASSR & 1 << TCR2AUB)
;
! TCCR2A = ((Atm128_TCCR2A_t)x).flat;
}
! async command void TimerCtrl.setControlB( uint8_t x ) {
while (ASSR & 1 << TCR2BUB)
;
! TCCR2B = ((Atm128_TCCR2B_t)x).flat;
}
//=== Read the interrupt mask. =====================================
! async command uint8_t TimerCtrl.getInterruptMask() {
! return TIMSK2;
}
//=== Write the interrupt mask. ====================================
! async command void TimerCtrl.setInterruptMask( uint8_t x ) {
! TIMSK2 = x;
}
//=== Read the interrupt flags. =====================================
! async command uint8_t TimerCtrl.getInterruptFlag() {
! return TIFR2;
}
//=== Write the interrupt flags. ====================================
! async command void TimerCtrl.setInterruptFlag( uint8_t x ) {
! TIFR2 = x;
}
--- 93,142 ----
//=== Write a new timer scale. ========================================
! async command void Timer.setScale(uint8_t s) {
Atm128_TCCR2B_t x = (Atm128_TCCR2B_t) call TimerCtrl.getControlB();
x.bits.cs = s;
! call TimerCtrl.setControlB(x.flat);
}
//=== Read the control registers. =====================================
! async command uint8_t TimerCtrl.getControlA() {
! return TCCR2A;
}
! async command uint8_t TimerCtrl.getControlB() {
! return TCCR2B;
}
//=== Write the control registers. ====================================
! async command void TimerCtrl.setControlA( uint8_t x ) {
while (ASSR & 1 << TCR2AUB)
;
! TCCR2A = ((Atm128_TCCR2A_t)x).flat;
}
! async command void TimerCtrl.setControlB( uint8_t x ) {
while (ASSR & 1 << TCR2BUB)
;
! TCCR2B = ((Atm128_TCCR2B_t)x).flat;
}
//=== Read the interrupt mask. =====================================
! async command uint8_t TimerCtrl.getInterruptMask() {
! return TIMSK2;
}
//=== Write the interrupt mask. ====================================
! async command void TimerCtrl.setInterruptMask( uint8_t x ) {
! TIMSK2 = x;
}
//=== Read the interrupt flags. =====================================
! async command uint8_t TimerCtrl.getInterruptFlag() {
! return TIFR2;
}
//=== Write the interrupt flags. ====================================
! async command void TimerCtrl.setInterruptFlag( uint8_t x ) {
! TIFR2 = x;
}
***************
*** 147,169 ****
bool overflowed() {
! return ((Atm128_TIFR2_t)call TimerCtrl.getInterruptFlag()).bits.tov;
}
! async command bool Timer.test() {
return overflowed();
}
!
! async command bool Timer.isOn() {
! return ((Atm128_TIMSK2_t)call TimerCtrl.getInterruptMask()).bits.toie;
}
!
async command void Compare.reset() { TIFR2 = 1 << OCF2A; }
async command void Compare.start() { SET_BIT(TIMSK2,OCIE2A); }
async command void Compare.stop() { CLR_BIT(TIMSK2,OCIE2A); }
! async command bool Compare.test() {
! return ((Atm128_TIFR2_t)call TimerCtrl.getInterruptFlag()).bits.ocfa;
}
! async command bool Compare.isOn() {
! return ((Atm128_TIMSK2_t)call TimerCtrl.getInterruptMask()).bits.ociea;
}
--- 147,169 ----
bool overflowed() {
! return ((Atm128_TIFR2_t)call TimerCtrl.getInterruptFlag()).bits.tov;
}
! async command bool Timer.test() {
return overflowed();
}
!
! async command bool Timer.isOn() {
! return ((Atm128_TIMSK2_t)call TimerCtrl.getInterruptMask()).bits.toie;
}
!
async command void Compare.reset() { TIFR2 = 1 << OCF2A; }
async command void Compare.start() { SET_BIT(TIMSK2,OCIE2A); }
async command void Compare.stop() { CLR_BIT(TIMSK2,OCIE2A); }
! async command bool Compare.test() {
! return ((Atm128_TIFR2_t)call TimerCtrl.getInterruptFlag()).bits.ocfa;
}
! async command bool Compare.isOn() {
! return ((Atm128_TIMSK2_t)call TimerCtrl.getInterruptMask()).bits.ociea;
}
***************
*** 172,181 ****
//=== Write the compare registers. ====================================
! async command void Compare.set(uint8_t t) {
atomic
{
while (ASSR & 1 << OCR2AUB)
;
! OCR2A = t;
}
}
--- 172,181 ----
//=== Write the compare registers. ====================================
! async command void Compare.set(uint8_t t) {
atomic
{
while (ASSR & 1 << OCR2AUB)
;
! OCR2A = t;
}
}
***************
*** 196,204 ****
* Please refer to TEP 112 and the atm128 datasheet for details.
*/
!
async command mcu_power_t McuPowerOverride.lowestState() {
uint8_t diff;
// We need to make sure that the sleep wakeup latency will not
! // cause us to miss a timer. POWER_SAVE
if (TIMSK2 & (1 << OCIE2A | 1 << TOIE2)) {
// need to wait for timer 2 updates propagate before sleeping
--- 196,204 ----
* Please refer to TEP 112 and the atm128 datasheet for details.
*/
!
async command mcu_power_t McuPowerOverride.lowestState() {
uint8_t diff;
// We need to make sure that the sleep wakeup latency will not
! // cause us to miss a timer. POWER_SAVE
if (TIMSK2 & (1 << OCIE2A | 1 << TOIE2)) {
// need to wait for timer 2 updates propagate before sleeping
***************
*** 210,214 ****
diff = OCR2A - TCNT2;
if (diff < EXT_STANDBY_T0_THRESHOLD ||
! TCNT2 > 256 - EXT_STANDBY_T0_THRESHOLD)
return ATM128_POWER_EXT_STANDBY;
return ATM128_POWER_SAVE;
--- 210,214 ----
diff = OCR2A - TCNT2;
if (diff < EXT_STANDBY_T0_THRESHOLD ||
! TCNT2 > 256 - EXT_STANDBY_T0_THRESHOLD)
return ATM128_POWER_EXT_STANDBY;
return ATM128_POWER_SAVE;
***************
*** 223,227 ****
stabiliseTimer2();
// __nesc_enable_interrupt();
!
signal Compare.fired();
}
--- 223,227 ----
stabiliseTimer2();
// __nesc_enable_interrupt();
!
signal Compare.fired();
}
Index: HplAtm1281Timer3P.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm1281/timer/HplAtm1281Timer3P.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** HplAtm1281Timer3P.nc 5 Nov 2007 20:36:43 -0000 1.1
--- HplAtm1281Timer3P.nc 7 Jul 2008 19:52:52 -0000 1.2
***************
*** 7,22 ****
* 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 CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS 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 CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
! * DAMAGE.
*
* CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
! * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
! * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
! * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY
! * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS.
*/
--- 7,22 ----
* 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 CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS 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 CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
! * DAMAGE.
*
* CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
! * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
! * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
! * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY
! * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS.
*/
***************
*** 30,39 ****
* 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
--- 30,39 ----
* 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
***************
*** 53,57 ****
#include <Atm128Timer.h>
! module HplAtm1281Timer3P
{
provides {
--- 53,57 ----
#include <Atm128Timer.h>
! module HplAtm1281Timer3P @safe()
{
provides {
***************
*** 80,133 ****
//=== Write a new timer scale. ========================================
! async command void Timer.setScale(uint8_t s) {
Atm128_TCCRB_t x = (Atm128_TCCRB_t) call TimerCtrl.getControlB();
x.bits.cs = s;
! call TimerCtrl.setControlB(x.flat);
}
//=== Read the control registers. =====================================
! async command uint8_t TimerCtrl.getControlA() {
! return TCCR3A;
}
! async command uint8_t TimerCtrl.getControlB() {
! return TCCR3B;
}
! async command uint8_t TimerCtrl.getControlC() {
! return TCCR3C;
}
//=== Write the control registers. ====================================
! async command void TimerCtrl.setControlA( uint8_t x ) {
! TCCR3A = x;
}
! async command void TimerCtrl.setControlB( uint8_t x ) {
! TCCR3B = x;
}
! async command void TimerCtrl.setControlC( uint8_t x ) {
! TCCR3C = x;
}
//=== Read the interrupt mask. =====================================
! async command uint8_t TimerCtrl.getInterruptMask() {
! return TIMSK3;
}
//=== Write the interrupt mask. ====================================
! async command void TimerCtrl.setInterruptMask( uint8_t x ) {
! TIMSK3 = x;
}
//=== Read the interrupt flags. =====================================
! async command uint8_t TimerCtrl.getInterruptFlag() {
! return TIFR3;
}
//=== Write the interrupt flags. ====================================
! async command void TimerCtrl.setInterruptFlag( uint8_t x ) {
! TIFR3 = x;
}
--- 80,133 ----
//=== Write a new timer scale. ========================================
! async command void Timer.setScale(uint8_t s) {
Atm128_TCCRB_t x = (Atm128_TCCRB_t) call TimerCtrl.getControlB();
x.bits.cs = s;
! call TimerCtrl.setControlB(x.flat);
}
//=== Read the control registers. =====================================
! async command uint8_t TimerCtrl.getControlA() {
! return TCCR3A;
}
! async command uint8_t TimerCtrl.getControlB() {
! return TCCR3B;
}
! async command uint8_t TimerCtrl.getControlC() {
! return TCCR3C;
}
//=== Write the control registers. ====================================
! async command void TimerCtrl.setControlA( uint8_t x ) {
! TCCR3A = x;
}
! async command void TimerCtrl.setControlB( uint8_t x ) {
! TCCR3B = x;
}
! async command void TimerCtrl.setControlC( uint8_t x ) {
! TCCR3C = x;
}
//=== Read the interrupt mask. =====================================
! async command uint8_t TimerCtrl.getInterruptMask() {
! return TIMSK3;
}
//=== Write the interrupt mask. ====================================
! async command void TimerCtrl.setInterruptMask( uint8_t x ) {
! TIMSK3 = x;
}
//=== Read the interrupt flags. =====================================
! async command uint8_t TimerCtrl.getInterruptFlag() {
! return TIFR3;
}
//=== Write the interrupt flags. ====================================
! async command void TimerCtrl.setInterruptFlag( uint8_t x ) {
! TIFR3 = x;
}
***************
*** 154,171 ****
async command void CompareC.stop() { CLR_BIT(TIMSK3,OCIE3C); }
! async command bool Timer.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.tov;
}
! async command bool Capture.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.icf;
}
! async command bool CompareA.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.ocfa;
}
! async command bool CompareB.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.ocfb;
}
! async command bool CompareC.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.ocfc;
}
--- 154,171 ----
async command void CompareC.stop() { CLR_BIT(TIMSK3,OCIE3C); }
! async command bool Timer.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.tov;
}
! async command bool Capture.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.icf;
}
! async command bool CompareA.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.ocfa;
}
! async command bool CompareB.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.ocfb;
}
! async command bool CompareC.test() {
! return ((Atm128_TIFR_t)call TimerCtrl.getInterruptFlag()).bits.ocfc;
}
More information about the Tinyos-2-commits
mailing list