[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/atm128/timer Atm128AlarmAsyncP.nc, 1.5, 1.6 HplAtm128Timer0AsyncP.nc, 1.2, 1.3 HplAtm128TimerAsync.nc, 1.1, 1.2

David Gay idgay at users.sourceforge.net
Thu Mar 29 14:29:37 PDT 2007


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/atm128/timer
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv27452

Modified Files:
	Atm128AlarmAsyncP.nc HplAtm128Timer0AsyncP.nc 
	HplAtm128TimerAsync.nc 
Log Message:
some low-level optimisation


Index: Atm128AlarmAsyncP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmAsyncP.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Atm128AlarmAsyncP.nc	29 Mar 2007 21:07:25 -0000	1.5
--- Atm128AlarmAsyncP.nc	29 Mar 2007 21:29:33 -0000	1.6
***************
*** 38,42 ****
    uint8_t set; 			/* Is the alarm set? */
    uint32_t t0, dt;		/* Time of the next alarm */
!   uint32_t base;		/* base+TCNT0 is the current time if no
  				   interrupt is pending. See Counter.get()
  				   for the full details. */
--- 38,42 ----
    uint8_t set; 			/* Is the alarm set? */
    uint32_t t0, dt;		/* Time of the next alarm */
!   norace uint32_t base;		/* base+TCNT0 is the current time if no
  				   interrupt is pending. See Counter.get()
  				   for the full details. */
***************
*** 64,69 ****
  	call Compare.set(MAXT); /* setInterrupt needs a valid value here */
  	call Compare.start();
- 	setInterrupt();
        }
      return SUCCESS;
    }
--- 64,69 ----
  	call Compare.set(MAXT); /* setInterrupt needs a valid value here */
  	call Compare.start();
        }
+     setInterrupt();
      return SUCCESS;
    }
***************
*** 85,93 ****
    }
  
-   void fire() {
-     __nesc_enable_interrupt();
-     signal Alarm.fired();
-   }
- 
    /* Update the compare register to trigger an interrupt at the
       appropriate time based on the current alarm settings
--- 85,88 ----
***************
*** 129,133 ****
  		if (alarm_in > MAXT)
  		  newOcr0 = MAXT;
! 		else if (alarm_in < MINDT)
  		  newOcr0 = MINDT;
  		else
--- 124,128 ----
  		if (alarm_in > MAXT)
  		  newOcr0 = MAXT;
! 		else if ((uint8_t)alarm_in < MINDT) // alarm_in < MAXT ...
  		  newOcr0 = MINDT;
  		else
***************
*** 139,156 ****
        }
      if (fired)
!       fire();
!   }
! 
!   void overflow() {
!     __nesc_enable_interrupt();
!     signal Counter.overflow();
    }
  
    async event void Compare.fired() {
      /* Compare register fired. Update time knowledge */
!     base += call Compare.get() + 1; // interrupt is 1ms late
      setInterrupt();
!     if (!base)
!       overflow();
    }  
  
--- 134,150 ----
        }
      if (fired)
!       signal Alarm.fired();
    }
  
    async event void Compare.fired() {
+     int overflowed;
+ 
      /* Compare register fired. Update time knowledge */
!     base += call Compare.get() + 1U; // interrupt is 1ms late
!     overflowed = !base;
!     __nesc_enable_interrupt();
      setInterrupt();
!     if (overflowed)
!       signal Counter.overflow();
    }  
  
***************
*** 188,193 ****
  	  base = 0;
  	  call Compare.reset();
- 	  setInterrupt();
  	}
    }
  
--- 182,189 ----
  	  base = 0;
  	  call Compare.reset();
  	}
+       else
+ 	return;
+     setInterrupt();
    }
  

Index: HplAtm128Timer0AsyncP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm128/timer/HplAtm128Timer0AsyncP.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** HplAtm128Timer0AsyncP.nc	29 Mar 2007 21:07:25 -0000	1.2
--- HplAtm128Timer0AsyncP.nc	29 Mar 2007 21:29:33 -0000	1.3
***************
*** 200,212 ****
    }
  
!   async command bool TimerAsync.controlBusy() {
      return (ASSR & (1 << TCR0UB)) != 0;
    }
  
!   async command bool TimerAsync.compareBusy() {
      return (ASSR & (1 << OCR0UB)) != 0;
    }
  
!   async command bool TimerAsync.countBusy() {
      return (ASSR & (1 << TCN0UB)) != 0;
    }
--- 200,212 ----
    }
  
!   async command int TimerAsync.controlBusy() {
      return (ASSR & (1 << TCR0UB)) != 0;
    }
  
!   async command int TimerAsync.compareBusy() {
      return (ASSR & (1 << OCR0UB)) != 0;
    }
  
!   async command int TimerAsync.countBusy() {
      return (ASSR & (1 << TCN0UB)) != 0;
    }

Index: HplAtm128TimerAsync.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/atm128/timer/HplAtm128TimerAsync.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** HplAtm128TimerAsync.nc	29 Mar 2007 21:07:25 -0000	1.1
--- HplAtm128TimerAsync.nc	29 Mar 2007 21:29:33 -0000	1.2
***************
*** 36,40 ****
     * @return TRUE if TCCR0 is busy, FALSE otherwise (can be updated)
     */
!   async command bool controlBusy();
  
    /**
--- 36,40 ----
     * @return TRUE if TCCR0 is busy, FALSE otherwise (can be updated)
     */
!   async command int controlBusy();
  
    /**
***************
*** 42,46 ****
     * @return TRUE if OCR0 is busy, FALSE otherwise (can be updated)
     */
!   async command bool compareBusy();
  
    /**
--- 42,46 ----
     * @return TRUE if OCR0 is busy, FALSE otherwise (can be updated)
     */
!   async command int compareBusy();
  
    /**
***************
*** 48,52 ****
     * @return TRUE if TCNT0 is busy, FALSE otherwise (can be updated)
     */
!   async command bool countBusy();
  
  }
--- 48,52 ----
     * @return TRUE if TCNT0 is busy, FALSE otherwise (can be updated)
     */
!   async command int countBusy();
  
  }



More information about the Tinyos-2-commits mailing list