27 #include <asm/unaligned.h>
82 static const unsigned int ack_rates_high[] =
116 int sifs, preamble, plcp_bits, sym_time;
123 NULL, band, len, rate);
158 bits = plcp_bits + (len << 3);
160 symbol_bits = bitrate * sym_time;
163 dur = sifs + preamble + (sym_time * symbols);
176 unsigned int slot_time;
275 ath5k_hw_write_rate_duration(
struct ath5k_hw *
ah)
283 for (i = 0; i < ah->
sbands[band].n_bitrates; i++) {
288 rate = &ah->
sbands[band].bitrates[ack_rates_high[
i]];
291 rate = &ah->
sbands[band].bitrates[0];
294 rate = &ah->
sbands[band].bitrates[4];
308 ath5k_hw_reg_write(ah, tx_time, reg);
314 ath5k_hw_reg_write(ah, tx_time,
325 ath5k_hw_set_ack_timeout(
struct ath5k_hw *ah,
unsigned int timeout)
343 ath5k_hw_set_cts_timeout(
struct ath5k_hw *ah,
unsigned int timeout)
377 pcu_reg = ath5k_hw_reg_read(ah,
AR5K_STA_ID1) & 0xffff0000;
380 high_id = get_unaligned_le16(mac + 4);
383 ath5k_hw_reg_write(ah, pcu_reg | high_id,
AR5K_STA_ID1);
410 ath5k_hw_reg_write(ah,
413 ath5k_hw_reg_write(ah,
414 get_unaligned_le16(common->
curbssid + 4) |
418 if (common->
curaid == 0) {
424 tim_offset ? tim_offset + 4 : 0);
526 filter &= ~AR5K_RX_FILTER_RADARERR;
550 #define ATH5K_MAX_TSF_READ 10
561 u32 tsf_lower, tsf_upper1, tsf_upper2;
584 if (tsf_upper2 == tsf_upper1)
586 tsf_upper1 = tsf_upper2;
591 WARN_ON(i == ATH5K_MAX_TSF_READ);
593 return ((
u64)tsf_upper1 << 32) | tsf_lower;
596 #undef ATH5K_MAX_TSF_READ
608 ath5k_hw_reg_write(ah, tsf64 & 0xffffffff,
AR5K_TSF_L32);
609 ath5k_hw_reg_write(ah, (tsf64 >> 32) & 0xffffffff,
AR5K_TSF_U32);
647 u32 timer1, timer2, timer3;
683 timer3 = next_beacon + 1;
737 ath5k_check_timer_win(
int a,
int b,
int window,
int intval)
745 if ((b - a == window) ||
746 (a - b == intval - window) ||
747 ((a | 0x10000) - b == intval - window) ||
748 ((b | 0x10000) - a == window))
795 unsigned int nbtt, atim,
dma;
805 if (ath5k_check_timer_win(nbtt, atim, 1, intval) &&
825 int cts_timeout = ack_timeout;
828 ath5k_hw_set_ack_timeout(ah, ack_timeout);
829 ath5k_hw_set_cts_timeout(ah, cts_timeout);
876 u32 pcu_reg, beacon_reg, low_id, high_id;
881 pcu_reg = ath5k_hw_reg_read(ah,
AR5K_STA_ID1) & 0xffff0000;
927 high_id = get_unaligned_le16(common->
macaddr + 4);
929 ath5k_hw_reg_write(ah, pcu_reg | high_id,
AR5K_STA_ID1);
935 ath5k_hw_reg_write(ah, beacon_reg,
AR5K_BCR);
964 ath5k_hw_write_rate_duration(ah);
987 ath5k_hw_reg_write(ah,