On Sun, 2010-02-28 at 23:08 +0100, Benoit Papillault wrote:

> -     u64 tsf = ath5k_hw_reg_read(ah, AR5K_TSF_U32);
> +     u32 tsf_lower, tsf_upper;
> +
> +     /*
> +      * While reading TSF upper and then lower part, the clock is still
> +      * counting so the lower part can rollover just after reading the
> +      * upper part. In this case, we expect the lower part to be quite
> +      * small (let's say less than 100us) and we would just need to read
> +      * the upper part again to get the correct value.
> +      *
> +      * Tested on AR2425 (AR5001)
> +      */
> +
> +     tsf_upper = ath5k_hw_reg_read(ah, AR5K_TSF_U32);
> +     tsf_lower = ath5k_hw_reg_read(ah, AR5K_TSF_L32);
> +
> +     if (tsf_lower < 100)
> +             tsf_upper = ath5k_hw_reg_read(ah, AR5K_TSF_U32);

You would typically do

do {
   read upper 1
   read lower
   read upper 2
} while (upper 1 != upper 2)

or so but that obviously incurs another read in most cases.

johannes

_______________________________________________
ath5k-devel mailing list
ath5k-devel@lists.ath5k.org
https://lists.ath5k.org/mailman/listinfo/ath5k-devel

Reply via email to