iwlwifi: move channel switch related functions
With the creation of iwl-agn-devices.c, iwl-core.c can be cleaned up a bit more by moving beacon time related functions from iwl-core.c to iwl-agn-devices.c Signed-off-by: Meenakshi Venkataraman <meenakshi.venkataraman@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
This commit is contained in:
parent
3ac40edadc
commit
e381b21432
@ -71,6 +71,80 @@ static void iwl1000_nic_config(struct iwl_priv *priv)
|
||||
~APMG_SVR_VOLTAGE_CONFIG_BIT_MSK);
|
||||
}
|
||||
|
||||
/**
|
||||
* iwl_beacon_time_mask_low - mask of lower 32 bit of beacon time
|
||||
* @priv -- pointer to iwl_priv data structure
|
||||
* @tsf_bits -- number of bits need to shift for masking)
|
||||
*/
|
||||
static inline u32 iwl_beacon_time_mask_low(struct iwl_priv *priv,
|
||||
u16 tsf_bits)
|
||||
{
|
||||
return (1 << tsf_bits) - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* iwl_beacon_time_mask_high - mask of higher 32 bit of beacon time
|
||||
* @priv -- pointer to iwl_priv data structure
|
||||
* @tsf_bits -- number of bits need to shift for masking)
|
||||
*/
|
||||
static inline u32 iwl_beacon_time_mask_high(struct iwl_priv *priv,
|
||||
u16 tsf_bits)
|
||||
{
|
||||
return ((1 << (32 - tsf_bits)) - 1) << tsf_bits;
|
||||
}
|
||||
|
||||
/*
|
||||
* extended beacon time format
|
||||
* time in usec will be changed into a 32-bit value in extended:internal format
|
||||
* the extended part is the beacon counts
|
||||
* the internal part is the time in usec within one beacon interval
|
||||
*/
|
||||
static u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec,
|
||||
u32 beacon_interval)
|
||||
{
|
||||
u32 quot;
|
||||
u32 rem;
|
||||
u32 interval = beacon_interval * TIME_UNIT;
|
||||
|
||||
if (!interval || !usec)
|
||||
return 0;
|
||||
|
||||
quot = (usec / interval) &
|
||||
(iwl_beacon_time_mask_high(priv, IWLAGN_EXT_BEACON_TIME_POS) >>
|
||||
IWLAGN_EXT_BEACON_TIME_POS);
|
||||
rem = (usec % interval) & iwl_beacon_time_mask_low(priv,
|
||||
IWLAGN_EXT_BEACON_TIME_POS);
|
||||
|
||||
return (quot << IWLAGN_EXT_BEACON_TIME_POS) + rem;
|
||||
}
|
||||
|
||||
/* base is usually what we get from ucode with each received frame,
|
||||
* the same as HW timer counter counting down
|
||||
*/
|
||||
static __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base,
|
||||
u32 addon, u32 beacon_interval)
|
||||
{
|
||||
u32 base_low = base & iwl_beacon_time_mask_low(priv,
|
||||
IWLAGN_EXT_BEACON_TIME_POS);
|
||||
u32 addon_low = addon & iwl_beacon_time_mask_low(priv,
|
||||
IWLAGN_EXT_BEACON_TIME_POS);
|
||||
u32 interval = beacon_interval * TIME_UNIT;
|
||||
u32 res = (base & iwl_beacon_time_mask_high(priv,
|
||||
IWLAGN_EXT_BEACON_TIME_POS)) +
|
||||
(addon & iwl_beacon_time_mask_high(priv,
|
||||
IWLAGN_EXT_BEACON_TIME_POS));
|
||||
|
||||
if (base_low > addon_low)
|
||||
res += base_low - addon_low;
|
||||
else if (base_low < addon_low) {
|
||||
res += interval + base_low - addon_low;
|
||||
res += (1 << IWLAGN_EXT_BEACON_TIME_POS);
|
||||
} else
|
||||
res += (1 << IWLAGN_EXT_BEACON_TIME_POS);
|
||||
|
||||
return cpu_to_le32(res);
|
||||
}
|
||||
|
||||
static const struct iwl_sensitivity_ranges iwl1000_sensitivity = {
|
||||
.min_nrg_cck = 95,
|
||||
.auto_corr_min_ofdm = 90,
|
||||
|
@ -783,79 +783,6 @@ int iwl_cmd_echo_test(struct iwl_priv *priv)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* iwl_beacon_time_mask_low - mask of lower 32 bit of beacon time
|
||||
* @priv -- pointer to iwl_priv data structure
|
||||
* @tsf_bits -- number of bits need to shift for masking)
|
||||
*/
|
||||
static inline u32 iwl_beacon_time_mask_low(struct iwl_priv *priv,
|
||||
u16 tsf_bits)
|
||||
{
|
||||
return (1 << tsf_bits) - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* iwl_beacon_time_mask_high - mask of higher 32 bit of beacon time
|
||||
* @priv -- pointer to iwl_priv data structure
|
||||
* @tsf_bits -- number of bits need to shift for masking)
|
||||
*/
|
||||
static inline u32 iwl_beacon_time_mask_high(struct iwl_priv *priv,
|
||||
u16 tsf_bits)
|
||||
{
|
||||
return ((1 << (32 - tsf_bits)) - 1) << tsf_bits;
|
||||
}
|
||||
|
||||
/*
|
||||
* extended beacon time format
|
||||
* time in usec will be changed into a 32-bit value in extended:internal format
|
||||
* the extended part is the beacon counts
|
||||
* the internal part is the time in usec within one beacon interval
|
||||
*/
|
||||
u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec, u32 beacon_interval)
|
||||
{
|
||||
u32 quot;
|
||||
u32 rem;
|
||||
u32 interval = beacon_interval * TIME_UNIT;
|
||||
|
||||
if (!interval || !usec)
|
||||
return 0;
|
||||
|
||||
quot = (usec / interval) &
|
||||
(iwl_beacon_time_mask_high(priv, IWLAGN_EXT_BEACON_TIME_POS) >>
|
||||
IWLAGN_EXT_BEACON_TIME_POS);
|
||||
rem = (usec % interval) & iwl_beacon_time_mask_low(priv,
|
||||
IWLAGN_EXT_BEACON_TIME_POS);
|
||||
|
||||
return (quot << IWLAGN_EXT_BEACON_TIME_POS) + rem;
|
||||
}
|
||||
|
||||
/* base is usually what we get from ucode with each received frame,
|
||||
* the same as HW timer counter counting down
|
||||
*/
|
||||
__le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base,
|
||||
u32 addon, u32 beacon_interval)
|
||||
{
|
||||
u32 base_low = base & iwl_beacon_time_mask_low(priv,
|
||||
IWLAGN_EXT_BEACON_TIME_POS);
|
||||
u32 addon_low = addon & iwl_beacon_time_mask_low(priv,
|
||||
IWLAGN_EXT_BEACON_TIME_POS);
|
||||
u32 interval = beacon_interval * TIME_UNIT;
|
||||
u32 res = (base & iwl_beacon_time_mask_high(priv,
|
||||
IWLAGN_EXT_BEACON_TIME_POS)) +
|
||||
(addon & iwl_beacon_time_mask_high(priv,
|
||||
IWLAGN_EXT_BEACON_TIME_POS));
|
||||
|
||||
if (base_low > addon_low)
|
||||
res += base_low - addon_low;
|
||||
else if (base_low < addon_low) {
|
||||
res += interval + base_low - addon_low;
|
||||
res += (1 << IWLAGN_EXT_BEACON_TIME_POS);
|
||||
} else
|
||||
res += (1 << IWLAGN_EXT_BEACON_TIME_POS);
|
||||
|
||||
return cpu_to_le32(res);
|
||||
}
|
||||
|
||||
void iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state)
|
||||
{
|
||||
struct iwl_priv *priv = IWL_OP_MODE_GET_DVM(op_mode);
|
||||
|
@ -176,10 +176,6 @@ int __must_check iwl_scan_initiate(struct iwl_priv *priv,
|
||||
* S e n d i n g H o s t C o m m a n d s *
|
||||
*****************************************************/
|
||||
|
||||
u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec, u32 beacon_interval);
|
||||
__le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base,
|
||||
u32 addon, u32 beacon_interval);
|
||||
|
||||
extern void iwl_send_bt_config(struct iwl_priv *priv);
|
||||
extern int iwl_send_statistics_request(struct iwl_priv *priv,
|
||||
u8 flags, bool clear);
|
||||
|
Loading…
x
Reference in New Issue
Block a user