Hi,

We want to implement a TDMA based schedule for which we need precise timers. The one shot timer used for sending the first beacon seems a good choice because of its 125microsecond granularity and good precision. When we set the timer for the first time, everything works fine. When we get an interrupt, we immediately set it again to interrupt at some time in the future. This second interrupt does not occur correctly--it occurs almost immediately after setting the timer and then when set again, it occurs at the right time.

We are using the following code in the ath_intr function:

ath_intr(int irq, void *dev_id)
...
ath_hal_getisr(ah, &status);        /* NB: clears ISR too */
...
if (status & HAL_INT_SWBA)
    {   
        log(0, (char *)__func__, 1, ath_hal_gettsf64(ah), "Interrupt!");
        OS_REG_WRITE(ah, 0x8030, 1000000>>7);    //AR_TIMER2 Timer set to fire after 1 second
        OS_REG_WRITE(ah, 0x8020, HAL_BEACON_RESET_TSF | HAL_BEACON_ENA); //AR_BEACON Timer
        OS_REG_WRITE(ah, 0x8020, 10000 | HAL_BEACON_ENA | HAL_BEACON_RESET_TSF); //Set to fire every 10 sec. This should never fire since the one-shot timer will fire earlier and reset the clock to 0.

}
...

The first interrupt is caused by a software timer that executes similar code. Here is the output:

[0] 0,ath_intr,1,102421,Interrupt!       <-- Set by a s/w timer to fire at 102.4ms (this works ok)
[1] 0,ath_intr,1,999957,Interrupt!       <-- First time interrupt is at correct time
[2] 0,ath_intr,1,22,Interrupt!               <-- This interrupt occurs immediately
[3] 0,ath_intr,1,999957,Interrupt!       <-- Again at the right time ...
[4] 0,ath_intr,1,22,Interrupt!
[5] 0,ath_intr,1,999956,Interrupt!
[6] 0,ath_intr,1,22,Interrupt!
... [and so on]


Has anyone seen similar behaviour? Do we have a workaround for this?

Thanks and Regards,
-Ashutosh Dhekne
-Nirav Uchat