Changeset 3635
- Timestamp:
- 05/16/08 18:09:36 (5 months ago)
- Files:
-
- madwifi/trunk/ath/if_ath.c (modified) (4 diffs)
- madwifi/trunk/net80211/ieee80211_var.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
madwifi/trunk/ath/if_ath.c
r3634 r3635 5259 5259 u_int32_t tsftu; 5260 5260 5261 tsftu = hw_tsf >> 10; /* NB: 64 -> 32: See note far above. */5261 tsftu = IEEE80211_TSF_TO_TU(hw_tsf); 5262 5262 slot = ((tsftu % ic->ic_lintval) * ath_maxvaps) / ic->ic_lintval; 5263 5263 vap = sc->sc_bslot[(slot + 1) % ath_maxvaps]; … … 5453 5453 * Note : TBTT is Target Beacon Transmission Time (see IEEE 802.11-1999: 4 & 5454 5454 * 11.2.1.3). 5455 *5456 * Note: TSF is right shifter by 10 and then put into a 32-bit int, which will5457 * truncate. This does not affect the calculation as long as no more than one5458 * overflow/wraparound occurs between beacons. This is not going to happen as5459 * (2^(32 + 10 - 1) - 1)us is a really long time.5460 5455 */ 5461 5456 static void … … 5477 5472 hw_tsf = ath_hal_gettsf64(ah); 5478 5473 tsf = le64_to_cpu(ni->ni_tstamp.tsf); 5479 hw_tsftu = hw_tsf >> 10;5480 tsftu = tsf >> 10; /* NB: 64 -> 32. See note above. */5474 hw_tsftu = IEEE80211_TSF_TO_TU(hw_tsf); 5475 tsftu = IEEE80211_TSF_TO_TU(tsf); 5481 5476 5482 5477 /* We should reset hw TSF only once, so we increment … … 6502 6497 * RUN -> RUN when this happens. */ 6503 6498 hw_tsf = ath_hal_gettsf64(sc->sc_ah); 6504 hw_tu = hw_tsf >> 10;6499 hw_tu = IEEE80211_TSF_TO_TU(hw_tsf); 6505 6500 6506 6501 beacon_tsf = le64_to_cpu(ni->ni_tstamp.tsf); 6507 beacon_tu = beacon_tsf >> 10;6502 beacon_tu = IEEE80211_TSF_TO_TU(beacon_tsf); 6508 6503 6509 6504 DPRINTF(sc, ATH_DEBUG_BEACON, madwifi/trunk/net80211/ieee80211_var.h
r3634 r3635 122 122 DEV_NAME(_v->iv_ic->ic_dev)) 123 123 124 /* 125 * TU conversions: 126 * 127 * TU is a 32bit value and defined by IEEE802.11 (page 6) as "A measurement of 128 * time equal to 1024 usec (microseconds)". 129 * 130 * TSF is a 64bit value in usec, therefore if we right shift it by 10 bit this 131 * will directly convert it to TU. The rest is truncated to fit into 32 bit. 132 */ 133 #define IEEE80211_TSF_TO_TU(_tsf) ((u_int32_t)((_tsf) >> 10)) 124 134 #define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024) 125 135 #define IEEE80211_TU_TO_MS(x) (((x) * 1024) / 1000)
