diff --git a/Makefile b/Makefile
index fc2ec07..9ac57ab 100755
--- a/Makefile
+++ b/Makefile
@@ -206,10 +206,7 @@ _OUTSRC_FILES := hal/phydm/phydm_debug.o \
hal/phydm/phydm_cfotracking.o\
hal/phydm/phydm_noisemonitor.o\
hal/phydm/phydm_acs.o\
- hal/phydm/phydm_beamforming.o\
hal/phydm/phydm_dfs.o\
- hal/phydm/txbf/halcomtxbf.o\
- hal/phydm/txbf/haltxbfinterface.o\
hal/phydm/txbf/phydm_hal_txbf_api.o\
hal/phydm/phydm_adc_sampling.o\
hal/phydm/phydm_kfree.o\
diff --git a/hal/phydm/hal8188erateadaptive.c b/hal/phydm/hal8188erateadaptive.c
index 1257de7..2919ffd 100644
--- a/hal/phydm/hal8188erateadaptive.c
+++ b/hal/phydm/hal8188erateadaptive.c
@@ -66,50 +66,7 @@ static u8 RETRY_PENALTY_IDX[2][RATESIZE] = {{
};
#endif
-
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
-static u8 RETRY_PENALTY_IDX[2][RATESIZE] = {{
- 4, 4, 4, 5, 4, 4, 5, 7, 7, 7, 8, 0x0a, /* SS>TH */
-#if (DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE)
- 4, 4, 4, 4, 0x0d, 0x0d, 0x0f, 0x0f,
-#else
- 4, 4, 4, 4, 6, 0x0a, 0x0b, 0x0d,
-#endif
- 5, 5, 7, 7, 8, 0x0b, 0x0d, 0x0f
- }, /* 0329 R01 */
- {
- 0x0a, 0x0a, 0x0a, 0x0a, 0x0c, 0x0c, 0x0e, 0x10, 0x11, 0x12, 0x12, 0x13, /* SS
TH */
- 0x13, 0x13, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15,
- 0x11, 0x11, 0x12, 0x13, 0x13, 0x13, 0x14, 0x15
- };
-
-static u8 RSSI_THRESHOLD[RATESIZE] = {0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0x24, 0x26, 0x2a,
- 0x17, 0x1a, 0x1c, 0x1f, 0x23, 0x28, 0x2a, 0x2c,
- 0, 0, 0, 0x1f, 0x23, 0x28, 0x2a, 0x2c
- };
-#else
-
/* wilson modify */
-#if 0
-static u8 RETRY_PENALTY_IDX[2][RATESIZE] = {{
- 4, 4, 4, 5, 4, 4, 5, 7, 7, 7, 8, 0x0a, /* SS>TH */
- 4, 4, 4, 4, 6, 0x0a, 0x0b, 0x0d,
- 5, 5, 7, 7, 8, 0x0b, 0x0d, 0x0f
- }, /* 0329 R01 */
- {
- 0x0a, 0x0a, 0x0b, 0x0c, 0x0a, 0x0a, 0x0b, 0x0c, 0x0d, 0x10, 0x13, 0x14, /* SS | TH */
@@ -134,20 +91,6 @@ static u8 RSSI_THRESHOLD[RATESIZE] = {0, 0, 0, 0,
0, 0, 0, 0x1f, 0x23, 0x28, 0x2a, 0x2c
};
-#endif
-
-/*static u8 RSSI_THRESHOLD[RATESIZE] = {0,0,0,0,
- 0,0,0,0,0,0x24,0x26,0x2a,
- 0x1a,0x1c,0x1e,0x21,0x24,0x2a,0x2b,0x2d,
- 0,0,0,0x1f,0x23,0x28,0x2a,0x2c};*/
-/*static u16 N_THRESHOLD_HIGH[RATESIZE] = {4,4,8,16,
- 24,36,48,72,96,144,192,216,
- 60,80,100,160,240,400,560,640,
- 300,320,480,720,1000,1200,1600,2000};
-static u16 N_THRESHOLD_LOW[RATESIZE] = {2,2,4,8,
- 12,18,24,36,48,72,96,108,
- 30,40,50,80,120,200,280,320,
- 150,160,240,360,500,600,800,1000};*/
static u16 N_THRESHOLD_HIGH[RATESIZE] = {4, 4, 8, 16,
24, 36, 48, 72, 96, 144, 192, 216,
60, 80, 100, 160, 240, 400, 600, 800,
@@ -201,73 +144,6 @@ static u16 dynamic_tx_rpt_timing[6] = {0x186a, 0x30d4, 0x493e, 0x61a8, 0x7a12, 0
/* End rate adaptive parameters */
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP) && \
- ((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
-static int
-odm_ra_learn_bounding(
- struct PHY_DM_STRUCT *p_dm_odm,
- struct _odm_ra_info_ *p_ra_info
-)
-{
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, (" odm_ra_learn_bounding\n"));
- if (DM_RA_RATE_UP != p_ra_info->rate_direction) {
- /* Check if previous RA adjustment trend as +++--- or ++++----*/
- if (((3 == p_ra_info->rate_up_counter && p_ra_info->bounding_learning_time <= 10)
- || (4 == p_ra_info->rate_up_counter && p_ra_info->bounding_learning_time <= 16))
- && (p_ra_info->rate_up_counter == p_ra_info->rate_down_counter)) {
- if (1 != p_ra_info->bounding_type) {
- p_ra_info->bounding_type = 1;
- p_ra_info->bounding_counter = 0;
- }
- p_ra_info->bounding_counter++;
- /* Check if previous RA adjustment trend as ++--*/
- } else if ((2 == p_ra_info->rate_up_counter) && (p_ra_info->bounding_learning_time <= 7)
- && (p_ra_info->rate_up_counter == p_ra_info->rate_down_counter)) {
- if (2 != p_ra_info->bounding_type) {
- p_ra_info->bounding_type = 2;
- p_ra_info->bounding_counter = 0;
- }
- p_ra_info->bounding_counter++;
- /* Check if previous RA adjustment trend as +++++-----*/
- } else if ((5 == p_ra_info->rate_up_counter) && (p_ra_info->bounding_learning_time <= 17)
- && (p_ra_info->rate_up_counter == p_ra_info->rate_down_counter)) {
- if (3 != p_ra_info->bounding_type) {
- p_ra_info->bounding_type = 3;
- p_ra_info->bounding_counter = 0;
- }
- p_ra_info->bounding_counter++;
- } else
- p_ra_info->bounding_type = 0;
-
- p_ra_info->rate_down_counter = 0;
- p_ra_info->rate_up_counter = 0;
- p_ra_info->bounding_learning_time = 1;
- } else if (p_ra_info->bounding_type) {
- /* Check if RA adjustment trend as +++---++(+) or ++++----++(+)*/
- if ((1 == p_ra_info->bounding_type) && (1 == p_ra_info->bounding_counter)
- && (2 == p_ra_info->rate_up_counter)) {
- p_ra_info->bounding_type = 0;
- if (p_ra_info->bounding_learning_time <= 5)
- return 1;
- /* Check if RA adjustment trend as ++--++--+(+)*/
- } else if ((2 == p_ra_info->bounding_type) && (2 == p_ra_info->bounding_counter)
- && (1 == p_ra_info->rate_up_counter)) {
- p_ra_info->bounding_type = 0;
- if (p_ra_info->bounding_learning_time <= 2)
- return 1;
- /* Check if RA adjustment trend as +++++-----++(+)*/
- } else if ((3 == p_ra_info->bounding_type) && (1 == p_ra_info->bounding_counter)
- && (2 == p_ra_info->rate_up_counter)) {
- p_ra_info->bounding_type = 0;
- if (p_ra_info->bounding_learning_time <= 4)
- return 1;
- }
- }
-
- return 0;
-}
-#endif
-
static void
odm_set_tx_rpt_timing_8188e(
struct PHY_DM_STRUCT *p_dm_odm,
@@ -325,19 +201,6 @@ odm_rate_down_8188e(
if (rate_id > 0) {
for (i = rate_id - 1; i >= lowest_rate; i--) {
if (p_ra_info->ra_use_rate & BIT(i)) {
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP) && \
- ((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
- p_ra_info->rate_down_counter++;
- p_ra_info->rate_direction = DM_RA_RATE_DOWN;
-
- /* Learning +(0)-(-)(-)+ and ++(0)--(-)(-)(0)+ after the persistence of learned TX rate expire*/
- if (0xFF == p_ra_info->rate_down_start_time) {
- if ((0 == p_ra_info->rate_up_counter) || (p_ra_info->rate_up_counter + 2 < p_ra_info->bounding_learning_time))
- p_ra_info->rate_down_start_time = 0;
- else
- p_ra_info->rate_down_start_time = p_ra_info->bounding_learning_time;
- }
-#endif
rate_id = i;
goto rate_down_finish;
@@ -347,36 +210,14 @@ odm_rate_down_8188e(
} else if (rate_id <= lowest_rate)
rate_id = lowest_rate;
rate_down_finish:
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP) && \
- ((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
- /*if (p_ra_info->RTY[2] >= 100) {
- p_ra_info->ra_waiting_counter = 2;
+ if (p_ra_info->ra_waiting_counter == 1) {
+ p_ra_info->ra_waiting_counter += 1;
p_ra_info->ra_pending_counter += 1;
- } else */if ((0 != p_ra_info->rate_down_start_time) && (0xFF != p_ra_info->rate_down_start_time)) {
- /* Learning +(0)-(-)(-)+ and ++(0)--(-)(-)(0)+ after the persistence of learned TX rate expire*/
- if (p_ra_info->rate_down_counter < p_ra_info->rate_up_counter) {
-
- } else if (p_ra_info->rate_down_counter == p_ra_info->rate_up_counter) {
- p_ra_info->ra_waiting_counter = 2;
- p_ra_info->ra_pending_counter += 1;
- } else if (p_ra_info->rate_down_counter <= p_ra_info->rate_up_counter + 2)
- rate_id = p_ra_info->pre_rate;
- else {
- p_ra_info->ra_waiting_counter = 0;
- p_ra_info->ra_pending_counter = 0;
- p_ra_info->rate_down_start_time = 0;
- }
- } else
-#endif
- if (p_ra_info->ra_waiting_counter == 1) {
- p_ra_info->ra_waiting_counter += 1;
- p_ra_info->ra_pending_counter += 1;
- } else if (p_ra_info->ra_waiting_counter == 0) {
- } else {
- p_ra_info->ra_waiting_counter = 0;
- p_ra_info->ra_pending_counter = 0;
- }
-
+ } else if (p_ra_info->ra_waiting_counter == 0) {
+ } else {
+ p_ra_info->ra_waiting_counter = 0;
+ p_ra_info->ra_pending_counter = 0;
+ }
if (p_ra_info->ra_pending_counter >= 4)
p_ra_info->ra_pending_counter = 4;
p_ra_info->ra_drop_after_down = 1;
@@ -413,10 +254,6 @@ odm_rate_up_8188e(
p_ra_info->ra_pending_counter = 0;
} else if (p_ra_info->ra_waiting_counter > 1) {
p_ra_info->pre_rssi_sta_ra = p_ra_info->rssi_sta_ra;
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP) && \
- ((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
- p_ra_info->rate_down_start_time = 0;
-#endif
goto rate_up_finish;
}
odm_set_tx_rpt_timing_8188e(p_dm_odm, p_ra_info, 0);
@@ -425,16 +262,6 @@ odm_rate_up_8188e(
if (rate_id < highest_rate) {
for (i = rate_id + 1; i <= highest_rate; i++) {
if (p_ra_info->ra_use_rate & BIT(i)) {
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP) && \
- ((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
- if (odm_ra_learn_bounding(p_dm_odm, p_ra_info)) {
- p_ra_info->ra_waiting_counter = 2;
- p_ra_info->ra_pending_counter = 1;
- goto rate_up_finish;
- }
- p_ra_info->rate_up_counter++;
- p_ra_info->rate_direction = DM_RA_RATE_UP;
-#endif
rate_id = i;
goto rate_up_finish;
}
@@ -451,15 +278,6 @@ rate_up_finish:
/* if(p_ra_info->ra_waiting_counter==10) */
if (p_ra_info->ra_waiting_counter == (4 + pending_for_rate_up_fail[p_ra_info->ra_pending_counter])) {
p_ra_info->ra_waiting_counter = 0;
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP) && \
- ((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
- /* Mark persistence expiration state*/
- p_ra_info->rate_down_start_time = 0xFF;
- /* Clear state to avoid wrong bounding check*/
- p_ra_info->rate_down_counter = 0;
- p_ra_info->rate_up_counter = 0;
- p_ra_info->rate_direction = 0;
-#endif
} else
p_ra_info->ra_waiting_counter++;
@@ -491,35 +309,17 @@ odm_rate_decision_8188e(
ODM_RT_TRACE(p_dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, ("=====>odm_rate_decision_8188e()\n"));
if (p_ra_info->active && (p_ra_info->TOTAL > 0)) { /* STA used and data packet exits */
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP) && \
- ((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
- if (((p_ra_info->rssi_sta_ra <= 17) && (p_ra_info->rssi_sta_ra > p_ra_info->pre_rssi_sta_ra))
- || ((p_ra_info->pre_rssi_sta_ra <= 17) && (p_ra_info->pre_rssi_sta_ra > p_ra_info->rssi_sta_ra))) {
- /* don't reset state in low signal due to the power different between CCK and MCS is large.*/
- } else
-#endif
- if (p_ra_info->ra_drop_after_down) {
- p_ra_info->ra_drop_after_down--;
- odm_reset_ra_counter_8188e(p_ra_info);
- return;
- }
+ if (p_ra_info->ra_drop_after_down) {
+ p_ra_info->ra_drop_after_down--;
+ odm_reset_ra_counter_8188e(p_ra_info);
+ return;
+ }
if ((p_ra_info->rssi_sta_ra < (p_ra_info->pre_rssi_sta_ra - 3)) || (p_ra_info->rssi_sta_ra > (p_ra_info->pre_rssi_sta_ra + 3))) {
p_ra_info->pre_rssi_sta_ra = p_ra_info->rssi_sta_ra;
p_ra_info->ra_waiting_counter = 0;
p_ra_info->ra_pending_counter = 0;
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP) && \
- ((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
- p_ra_info->bounding_type = 0;
-#endif
}
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- if (0xff != p_dm_odm->priv->pshare->rf_ft_var.txforce) {
- p_ra_info->pre_rate = p_dm_odm->priv->pshare->rf_ft_var.txforce;
- odm_reset_ra_counter_8188e(p_ra_info);
- }
-#endif
-
/* Start RA decision */
if (p_ra_info->pre_rate > p_ra_info->highest_rate)
rate_id = p_ra_info->highest_rate;
@@ -567,21 +367,11 @@ odm_rate_decision_8188e(
ODM_RT_TRACE(p_dm_odm, ODM_COMP_RATE_ADAPTIVE | ODM_COMP_INIT, ODM_DBG_LOUD,
(" RssiStaRa= %d rty_pt_id=%d penalty_id1=0x%x penalty_id2=0x%x rate_id=%d nsc_down=%d nsc_up=%d SGI=%d\n",
p_ra_info->rssi_sta_ra, rty_pt_id, penalty_id1, penalty_id2, rate_id, p_ra_info->nsc_down, p_ra_info->nsc_up, p_ra_info->rate_sgi));
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP) && \
- ((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
- if (0xFF != p_ra_info->bounding_learning_time)
- p_ra_info->bounding_learning_time++;
-#endif
if ((p_ra_info->nsc_down < N_THRESHOLD_LOW[rate_id]) || (p_ra_info->DROP > DROPING_NECESSARY[rate_id]))
odm_rate_down_8188e(p_dm_odm, p_ra_info);
/* else if ((p_ra_info->nsc_up > N_THRESHOLD_HIGH[rate_id])&&(pool_retrynsc_up > N_THRESHOLD_HIGH[rate_id])
odm_rate_up_8188e(p_dm_odm, p_ra_info);
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP) && \
- ((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
- else if ((p_ra_info->RTY[2] >= 100) && (ODM_BW20M == *p_dm_odm->p_band_width))
- odm_rate_down_8188e(p_dm_odm, p_ra_info);
-#endif
if ((p_ra_info->decision_rate) == (p_ra_info->pre_rate))
dynamic_tx_rpt_timing_counter += 1;
@@ -748,7 +538,6 @@ odm_pt_try_state_8188e(
}
p_ra_info->pt_pre_rate = p_ra_info->decision_rate;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
/* Disable power training when noisy environment */
if (p_dm_odm->is_disable_power_training) {
ODM_RT_TRACE(p_dm_odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("odm_pt_try_state_8188e(): Disable power training when noisy environment\n"));
@@ -756,7 +545,6 @@ odm_pt_try_state_8188e(
p_ra_info->ra_stage = 0;
p_ra_info->pt_stop_count = 0;
}
-#endif
}
static void
@@ -813,11 +601,7 @@ odm_ra_tx_rpt_timer_setting(
if (p_dm_odm->currmin_rpt_time != min_rpt_time) {
ODM_RT_TRACE(p_dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD,
(" currmin_rpt_time =0x%04x min_rpt_time=0x%04x\n", p_dm_odm->currmin_rpt_time, min_rpt_time));
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_AP))
- odm_ra_set_tx_rpt_time(p_dm_odm, min_rpt_time);
-#else
rtw_rpt_timer_cfg_cmd(p_dm_odm->adapter, min_rpt_time);
-#endif
p_dm_odm->currmin_rpt_time = min_rpt_time;
}
ODM_RT_TRACE(p_dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, (" <=====odm_ra_tx_rpt_timer_setting()\n"));
@@ -906,16 +690,6 @@ odm_ra_info_init(
p_ra_info->pt_pre_rssi = 0;
p_ra_info->pt_mode_ss = 0;
p_ra_info->ra_stage = 0;
-#endif
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP) && \
- ((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
- p_ra_info->rate_down_counter = 0;
- p_ra_info->rate_up_counter = 0;
- p_ra_info->rate_direction = 0;
- p_ra_info->bounding_type = 0;
- p_ra_info->bounding_counter = 0;
- p_ra_info->bounding_learning_time = 0;
- p_ra_info->rate_down_start_time = 0;
#endif
return 0;
}
@@ -935,8 +709,6 @@ odm_ra_info_init_all(
/* Redifine arrays for I-cut NIC */
if (p_dm_odm->cut_version == ODM_CUT_I) {
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
-
u8 i;
u8 RETRY_PENALTY_IDX_S[2][RATESIZE] = {{
4, 4, 4, 5,
@@ -965,79 +737,10 @@ odm_ra_info_init_all(
RETRY_PENALTY_UP_IDX[i] = RETRY_PENALTY_UP_IDX_S[i];
}
return 0;
-#endif
}
-
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)/* This is for non-I-cut */
- {
- struct _ADAPTER *adapter = p_dm_odm->adapter;
-
- /* dbg_print("adapter->mgnt_info.reg_ra_lvl = %d\n", adapter->mgnt_info.reg_ra_lvl); */
-
- /* */
- /* 2012/09/14 MH Add for different Ra pattern init. For TPLINK case, we */
- /* need to to adjust different RA pattern for middle range RA. 20-30dB degarde */
- /* 88E rate adptve will raise too slow. */
- /* */
- if (adapter->MgntInfo.RegRALvl == 0) {
- RETRY_PENALTY_UP_IDX[11] = 0x14;
-
- RETRY_PENALTY_UP_IDX[17] = 0x13;
- RETRY_PENALTY_UP_IDX[18] = 0x14;
- RETRY_PENALTY_UP_IDX[19] = 0x15;
-
- RETRY_PENALTY_UP_IDX[23] = 0x13;
- RETRY_PENALTY_UP_IDX[24] = 0x13;
- RETRY_PENALTY_UP_IDX[25] = 0x13;
- RETRY_PENALTY_UP_IDX[26] = 0x14;
- RETRY_PENALTY_UP_IDX[27] = 0x15;
- } else if (adapter->MgntInfo.RegRALvl == 1) {
- RETRY_PENALTY_UP_IDX[17] = 0x13;
- RETRY_PENALTY_UP_IDX[18] = 0x13;
- RETRY_PENALTY_UP_IDX[19] = 0x14;
-
- RETRY_PENALTY_UP_IDX[23] = 0x12;
- RETRY_PENALTY_UP_IDX[24] = 0x13;
- RETRY_PENALTY_UP_IDX[25] = 0x13;
- RETRY_PENALTY_UP_IDX[26] = 0x13;
- RETRY_PENALTY_UP_IDX[27] = 0x14;
- } else if (adapter->MgntInfo.RegRALvl == 2) {
- /* Compile flag default is lvl2, we need not to update. */
- } else if (adapter->MgntInfo.RegRALvl >= 0x80) {
- u8 index = 0, offset = adapter->MgntInfo.RegRALvl - 0x80;
-
- /* Reset to default rate adaptive value. */
- RETRY_PENALTY_UP_IDX[11] = 0x14;
-
- RETRY_PENALTY_UP_IDX[17] = 0x13;
- RETRY_PENALTY_UP_IDX[18] = 0x14;
- RETRY_PENALTY_UP_IDX[19] = 0x15;
-
- RETRY_PENALTY_UP_IDX[23] = 0x13;
- RETRY_PENALTY_UP_IDX[24] = 0x13;
- RETRY_PENALTY_UP_IDX[25] = 0x13;
- RETRY_PENALTY_UP_IDX[26] = 0x14;
- RETRY_PENALTY_UP_IDX[27] = 0x15;
-
- if (adapter->MgntInfo.RegRALvl >= 0x90) {
- offset = adapter->MgntInfo.RegRALvl - 0x90;
- /* Lazy mode. */
- for (index = 0; index < 28; index++)
- RETRY_PENALTY_UP_IDX[index] += (offset);
- } else {
- /* Aggrasive side. */
- for (index = 0; index < 28; index++)
- RETRY_PENALTY_UP_IDX[index] -= (offset);
- }
-
- }
- }
-#endif
return 0;
}
-
u8
odm_ra_get_sgi_8188e(
struct PHY_DM_STRUCT *p_dm_odm,
@@ -1140,14 +843,7 @@ odm_ra_set_tx_rpt_time(
u16 min_rpt_time
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- if (min_rpt_time != 0xffff) {
- notify_tx_report_interval_change(p_dm_odm->priv, min_rpt_time);
- }
-#else
odm_write_2byte(p_dm_odm, REG_TX_RPT_TIME, min_rpt_time);
-#endif
-
}
void odm_ra_tx_rpt2_handle_8188e(struct PHY_DM_STRUCT *p_dm_odm,
diff --git a/hal/phydm/hal8188erateadaptive.h b/hal/phydm/hal8188erateadaptive.h
index e42b1ed..2aee71f 100644
--- a/hal/phydm/hal8188erateadaptive.h
+++ b/hal/phydm/hal8188erateadaptive.h
@@ -16,95 +16,50 @@ Major Change History:
--*/
/* rate adaptive define */
-#define PERENTRY 23
-#define RETRYSIZE 5
-#define RATESIZE 28
+#define PERENTRY 23
+#define RETRYSIZE 5
+#define RATESIZE 28
#define TX_RPT2_ITEM_SIZE 8
-#define DM_RA_RATE_UP 1
-#define DM_RA_RATE_DOWN 2
+#define DM_RA_RATE_UP 1
+#define DM_RA_RATE_DOWN 2
-#if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
- /*
- * TX report 2 format in Rx desc
- * */
- #define GET_TX_RPT2_DESC_PKT_LEN_88E(__prx_status_desc) LE_BITS_TO_4BYTE(__prx_status_desc, 0, 9)
- #define GET_TX_RPT2_DESC_MACID_VALID_1_88E(__prx_status_desc) LE_BITS_TO_4BYTE(__prx_status_desc+16, 0, 32)
- #define GET_TX_RPT2_DESC_MACID_VALID_2_88E(__prx_status_desc) LE_BITS_TO_4BYTE(__prx_status_desc+20, 0, 32)
+/* TX report 2 format in Rx desc */
+#define GET_TX_RPT2_DESC_PKT_LEN_88E(__prx_status_desc) \
+ LE_BITS_TO_4BYTE(__prx_status_desc, 0, 9)
+#define GET_TX_RPT2_DESC_MACID_VALID_1_88E(__prx_status_desc) \
+ LE_BITS_TO_4BYTE(__prx_status_desc+16, 0, 32)
+#define GET_TX_RPT2_DESC_MACID_VALID_2_88E(__prx_status_desc) \
+ LE_BITS_TO_4BYTE(__prx_status_desc+20, 0, 32)
- #define GET_TX_REPORT_TYPE1_RERTY_0(__paddr) LE_BITS_TO_4BYTE(__paddr, 0, 16)
- #define GET_TX_REPORT_TYPE1_RERTY_1(__paddr) LE_BITS_TO_1BYTE(__paddr+2, 0, 8)
- #define GET_TX_REPORT_TYPE1_RERTY_2(__paddr) LE_BITS_TO_1BYTE(__paddr+3, 0, 8)
- #define GET_TX_REPORT_TYPE1_RERTY_3(__paddr) LE_BITS_TO_1BYTE(__paddr+4, 0, 8)
- #define GET_TX_REPORT_TYPE1_RERTY_4(__paddr) LE_BITS_TO_1BYTE(__paddr+4+1, 0, 8)
- #define GET_TX_REPORT_TYPE1_DROP_0(__paddr) LE_BITS_TO_1BYTE(__paddr+4+2, 0, 8)
- #define GET_TX_REPORT_TYPE1_DROP_1(__paddr) LE_BITS_TO_1BYTE(__paddr+4+3, 0, 8)
-#endif
+#define GET_TX_REPORT_TYPE1_RERTY_0(__paddr) \
+ LE_BITS_TO_4BYTE(__paddr, 0, 16)
+#define GET_TX_REPORT_TYPE1_RERTY_1(__paddr) \
+ LE_BITS_TO_1BYTE(__paddr+2, 0, 8)
+#define GET_TX_REPORT_TYPE1_RERTY_2(__paddr) \
+ LE_BITS_TO_1BYTE(__paddr+3, 0, 8)
+#define GET_TX_REPORT_TYPE1_RERTY_3(__paddr) \
+ LE_BITS_TO_1BYTE(__paddr+4, 0, 8)
+#define GET_TX_REPORT_TYPE1_RERTY_4(__paddr) \
+ LE_BITS_TO_1BYTE(__paddr+4+1, 0, 8)
+#define GET_TX_REPORT_TYPE1_DROP_0(__paddr) \
+ LE_BITS_TO_1BYTE(__paddr+4+2, 0, 8)
+#define GET_TX_REPORT_TYPE1_DROP_1(__paddr) \
+ LE_BITS_TO_1BYTE(__paddr+4+3, 0, 8)
/* End rate adaptive define */
-void
-odm_ra_support_init(
- struct PHY_DM_STRUCT *p_dm_odm
-);
+void odm_ra_support_init(struct PHY_DM_STRUCT *p_dm_odm);
+int odm_ra_info_init_all(struct PHY_DM_STRUCT *p_dm_odm);
+int odm_ra_info_init(struct PHY_DM_STRUCT *p_dm_odm, u32 mac_id);
+u8 odm_ra_get_sgi_8188e(struct PHY_DM_STRUCT *p_dm_odm, u8 mac_id);
+u8 odm_ra_get_decision_rate_8188e(struct PHY_DM_STRUCT *p_dm_odm, u8 mac_id);
+u8 odm_ra_get_hw_pwr_status_8188e(struct PHY_DM_STRUCT *p_dm_odm, u8 mac_id);
+void odm_ra_update_rate_info_8188e(struct PHY_DM_STRUCT *p_dm_odm, u8 mac_id,
+ u8 rate_id, u32 rate_mask, u8 sgi_enable);
+void odm_ra_set_rssi_8188e(struct PHY_DM_STRUCT *p_dm_odm, u8 mac_id, u8 rssi);
+void odm_ra_tx_rpt2_handle_8188e(struct PHY_DM_STRUCT *p_dm_odm, u8 *tx_rpt_buf,
+ __le16 tx_rpt_len, u32 mac_id_valid_entry0, u32 mac_id_valid_entry1);
+void odm_ra_set_tx_rpt_time(struct PHY_DM_STRUCT *p_dm_odm, u16 min_rpt_time);
-int
-odm_ra_info_init_all(
- struct PHY_DM_STRUCT *p_dm_odm
-);
-
-int
-odm_ra_info_init(
- struct PHY_DM_STRUCT *p_dm_odm,
- u32 mac_id
-);
-
-u8
-odm_ra_get_sgi_8188e(
- struct PHY_DM_STRUCT *p_dm_odm,
- u8 mac_id
-);
-
-u8
-odm_ra_get_decision_rate_8188e(
- struct PHY_DM_STRUCT *p_dm_odm,
- u8 mac_id
-);
-
-u8
-odm_ra_get_hw_pwr_status_8188e(
- struct PHY_DM_STRUCT *p_dm_odm,
- u8 mac_id
-);
-void
-odm_ra_update_rate_info_8188e(
- struct PHY_DM_STRUCT *p_dm_odm,
- u8 mac_id,
- u8 rate_id,
- u32 rate_mask,
- u8 sgi_enable
-);
-
-void
-odm_ra_set_rssi_8188e(
- struct PHY_DM_STRUCT *p_dm_odm,
- u8 mac_id,
- u8 rssi
-);
-
-void
-odm_ra_tx_rpt2_handle_8188e(
- struct PHY_DM_STRUCT *p_dm_odm,
- u8 *tx_rpt_buf,
- __le16 tx_rpt_len,
- u32 mac_id_valid_entry0,
- u32 mac_id_valid_entry1
-);
-
-
-void
-odm_ra_set_tx_rpt_time(
- struct PHY_DM_STRUCT *p_dm_odm,
- u16 min_rpt_time
-);
#endif
diff --git a/hal/phydm/halhwimg8188e_bb.c b/hal/phydm/halhwimg8188e_bb.c
index c131c23..c41c617 100644
--- a/hal/phydm/halhwimg8188e_bb.c
+++ b/hal/phydm/halhwimg8188e_bb.c
@@ -1729,14 +1729,6 @@ odm_read_and_config_mp_8188e_phy_reg_pg(
u32 array_len = sizeof(array_mp_8188e_phy_reg_pg) / sizeof(u32);
u32 *array = array_mp_8188e_phy_reg_pg;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
-
- PlatformZeroMemory(p_hal_data->BufOfLinesPwrByRate, MAX_LINES_HWCONFIG_TXT * MAX_BYTES_LINE_HWCONFIG_TXT);
- p_hal_data->nLinesReadPwrByRate = array_len / 6;
-#endif
-
ODM_RT_TRACE(p_dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> odm_read_and_config_mp_8188e_phy_reg_pg\n"));
p_dm_odm->phy_reg_pg_version = 1;
@@ -1751,14 +1743,7 @@ odm_read_and_config_mp_8188e_phy_reg_pg(
u32 v6 = array[i + 5];
odm_config_bb_phy_reg_pg_8188e(p_dm_odm, v1, v2, v3, v4, v5, v6);
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- rsprintf((char *)p_hal_data->BufOfLinesPwrByRate[i / 6], 100, "%s, %s, %s, 0x%X, 0x%08X, 0x%08X,",
- (v1 == 0 ? "2.4G" : " 5G"), (v2 == 0 ? "A" : "B"), (v3 == 0 ? "1Tx" : "2Tx"), v4, v5, v6);
-#endif
}
}
-
-
#endif /* end of HWIMG_SUPPORT*/
diff --git a/hal/phydm/halphyrf_8188e_ce.c b/hal/phydm/halphyrf_8188e_ce.c
index b0dc44a..beae409 100644
--- a/hal/phydm/halphyrf_8188e_ce.c
+++ b/hal/phydm/halphyrf_8188e_ce.c
@@ -113,43 +113,13 @@ void do_iqk_8188e(
)
{
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
struct _ADAPTER *adapter = p_dm_odm->adapter;
HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
-#endif
odm_reset_iqk_result(p_dm_odm);
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)
-#if USE_WORKITEM
- platform_acquire_mutex(&p_hal_data->mx_chnl_bw_control);
-#else
- platform_acquire_spin_lock(adapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK);
-#endif
-#elif ((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
- platform_acquire_mutex(&p_hal_data->mx_chnl_bw_control);
-#endif
-#endif
-
p_dm_odm->rf_calibrate_info.thermal_value_iqk = thermal_value;
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- phy_iq_calibrate_8188e(p_dm_odm, false);
-#else
phy_iq_calibrate_8188e(adapter, false);
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)
-#if USE_WORKITEM
- platform_release_mutex(&p_hal_data->mx_chnl_bw_control);
-#else
- platform_release_spin_lock(adapter, RT_CHANNEL_AND_BANDWIDTH_SPINLOCK);
-#endif
-#elif ((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
- platform_release_mutex(&p_hal_data->mx_chnl_bw_control);
-#endif
-#endif
}
/*-----------------------------------------------------------------------------
@@ -189,30 +159,16 @@ odm_tx_pwr_track_set_pwr88_e(
struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm_odm->rf_calibrate_info);
if (p_dm_odm->mp_mode == true) {
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-#if (MP_DRIVER == 1)
- PMPT_CONTEXT p_mpt_ctx = &(adapter->mpt_ctx);
-
- tx_rate = mpt_to_mgnt_rate(p_mpt_ctx->mpt_rate_index);
-#endif
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
PMPT_CONTEXT p_mpt_ctx = &(adapter->mppriv.mpt_ctx);
tx_rate = mpt_to_mgnt_rate(p_mpt_ctx->mpt_rate_index);
-#endif
-#endif
} else {
u16 rate = *(p_dm_odm->p_forced_data_rate);
if (!rate) { /*auto rate*/
if (rate != 0xFF) {
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- tx_rate = adapter->HalFunc.GetHwRateFromMRateHandler(p_dm_odm->tx_rate);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
if (p_dm_odm->number_linked_client != 0)
tx_rate = hw_rate_to_m_rate(p_dm_odm->tx_rate);
-#endif
}
} else /*force rate*/
tx_rate = (u8)rate;
@@ -252,8 +208,6 @@ odm_tx_pwr_track_set_pwr88_e(
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("odm_TxPwrTrackSetPwr88E CH=%d\n", *(p_dm_odm->p_channel)));
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
-
if (p_dm_odm->mp_mode == true) {
pwr = phy_query_bb_reg(adapter, REG_TX_AGC_A_RATE18_06, 0xFF);
pwr += p_dm_odm->rf_calibrate_info.power_index_offset[ODM_RF_PATH_A];
@@ -283,13 +237,6 @@ odm_tx_pwr_track_set_pwr88_e(
phy_set_tx_power_index_by_rate_section(adapter, ODM_RF_PATH_A, *p_dm_odm->p_channel, HT_MCS0_MCS7);
}
}
-
-#endif
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- /* phy_rf6052_set_cck_tx_power(p_dm_odm->priv, *(p_dm_odm->p_channel)); */
- /* phy_rf6052_set_ofdm_tx_power(p_dm_odm->priv, *(p_dm_odm->p_channel)); */
-#endif
-
} else if (method == BBSWING) {
final_ofdm_swing_index = p_rf_calibrate_info->default_ofdm_index + p_rf_calibrate_info->absolute_ofdm_swing_idx[rf_path];
final_cck_swing_index = p_rf_calibrate_info->default_cck_index + p_rf_calibrate_info->absolute_ofdm_swing_idx[rf_path];
@@ -495,30 +442,16 @@ get_delta_swing_table_8188e(
u8 channel = *p_dm_odm->p_channel;
if (p_dm_odm->mp_mode == true) {
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-#if (MP_DRIVER == 1)
- PMPT_CONTEXT p_mpt_ctx = &(adapter->mpt_ctx);
-
- tx_rate = mpt_to_mgnt_rate(p_mpt_ctx->mpt_rate_index);
-#endif
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
PMPT_CONTEXT p_mpt_ctx = &(adapter->mppriv.mpt_ctx);
tx_rate = mpt_to_mgnt_rate(p_mpt_ctx->mpt_rate_index);
-#endif
-#endif
} else {
u16 rate = *(p_dm_odm->p_forced_data_rate);
if (!rate) { /*auto rate*/
if (rate != 0xFF) {
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- tx_rate = adapter->HalFunc.GetHwRateFromMRateHandler(p_dm_odm->tx_rate);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
if (p_dm_odm->number_linked_client != 0)
tx_rate = hw_rate_to_m_rate(p_dm_odm->tx_rate);
-#endif
}
} else /*force rate*/
tx_rate = (u8)rate;
diff --git a/hal/phydm/halphyrf_8188e_ce.h b/hal/phydm/halphyrf_8188e_ce.h
index f45dd95..da552ca 100644
--- a/hal/phydm/halphyrf_8188e_ce.h
+++ b/hal/phydm/halphyrf_8188e_ce.h
@@ -60,14 +60,9 @@ odm_tx_pwr_track_set_pwr88_e(
void
phy_iq_calibrate_8188e(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- struct PHY_DM_STRUCT *p_dm_odm,
-#else
struct _ADAPTER *adapter,
-#endif
bool is_recovery);
-
/*
* LC calibrate
* */
@@ -75,19 +70,6 @@ void
phy_lc_calibrate_8188e(
void *p_dm_void
);
-#if 0
-/*
- * AP calibrate
- * */
-void
-phy_ap_calibrate_8188e(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- struct PHY_DM_STRUCT *p_dm_odm,
-#else
- struct _ADAPTER *p_adapter,
-#endif
- s8 delta);
-#endif
void
phy_digital_predistortion_8188e(struct _ADAPTER *p_adapter);
@@ -95,11 +77,7 @@ phy_digital_predistortion_8188e(struct _ADAPTER *p_adapter);
void
_phy_save_adda_registers(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- struct PHY_DM_STRUCT *p_dm_odm,
-#else
struct _ADAPTER *p_adapter,
-#endif
u32 *adda_reg,
u32 *adda_backup,
u32 register_num
@@ -107,11 +85,7 @@ _phy_save_adda_registers(
void
_phy_path_adda_on(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- struct PHY_DM_STRUCT *p_dm_odm,
-#else
struct _ADAPTER *p_adapter,
-#endif
u32 *adda_reg,
bool is_path_a_on,
bool is2T
@@ -119,11 +93,7 @@ _phy_path_adda_on(
void
_phy_mac_setting_calibration(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- struct PHY_DM_STRUCT *p_dm_odm,
-#else
struct _ADAPTER *p_adapter,
-#endif
u32 *mac_reg,
u32 *mac_backup
);
@@ -131,11 +101,7 @@ _phy_mac_setting_calibration(
void
_phy_path_a_stand_by(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- struct PHY_DM_STRUCT *p_dm_odm
-#else
struct _ADAPTER *p_adapter
-#endif
);
diff --git a/hal/phydm/halphyrf_ap.c b/hal/phydm/halphyrf_ap.c
deleted file mode 100644
index 960b599..0000000
--- a/hal/phydm/halphyrf_ap.c
+++ /dev/null
@@ -1,2661 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-
-#include "mp_precomp.h"
-#include "phydm_precomp.h"
-
-#ifndef index_mapping_NUM_88E
- #define index_mapping_NUM_88E 15
-#endif
-
-/* #if(DM_ODM_SUPPORT_TYPE & ODM_WIN) */
-
-#define CALCULATE_SWINGTALBE_OFFSET(_offset, _direction, _size, _delta_thermal) \
- do {\
- for (_offset = 0; _offset < _size; _offset++) { \
- \
- if (_delta_thermal < thermal_threshold[_direction][_offset]) { \
- \
- if (_offset != 0)\
- _offset--;\
- break;\
- } \
- } \
- if (_offset >= _size)\
- _offset = _size-1;\
- } while (0)
-
-
-void configure_txpower_track(
- void *p_dm_void,
- struct _TXPWRTRACK_CFG *p_config
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if RTL8812A_SUPPORT
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- /* if (IS_HARDWARE_TYPE_8812(p_dm_odm->adapter)) */
- if (p_dm_odm->support_ic_type == ODM_RTL8812)
- configure_txpower_track_8812a(p_config);
- /* else */
-#endif
-#endif
-
-#if RTL8814A_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8814A)
- configure_txpower_track_8814a(p_config);
-#endif
-
-
-#if RTL8188E_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8188E)
- configure_txpower_track_8188e(p_config);
-#endif
-
-#if RTL8197F_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8197F)
- configure_txpower_track_8197f(p_config);
-#endif
-
-#if RTL8822B_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8822B)
- configure_txpower_track_8822b(p_config);
-#endif
-
-
-}
-
-#if (RTL8192E_SUPPORT == 1)
-void
-odm_txpowertracking_callback_thermal_meter_92e(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- void *p_dm_void
-#else
- struct _ADAPTER *adapter
-#endif
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 thermal_value = 0, delta, delta_IQK, delta_LCK, channel, is_decrease, rf_mimo_mode;
- u8 thermal_value_avg_count = 0;
- u8 OFDM_min_index = 10; /* OFDM BB Swing should be less than +2.5dB, which is required by Arthur */
- s8 OFDM_index[2], index ;
- u32 thermal_value_avg = 0, reg0x18;
- u32 i = 0, j = 0, rf;
- s32 value32, CCK_index = 0, ele_A, ele_D, ele_C, X, Y;
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
-
- rf_mimo_mode = p_dm_odm->rf_type;
- /* ODM_RT_TRACE(p_dm_odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("%s:%d rf_mimo_mode:%d\n", __func__, __LINE__, rf_mimo_mode)); */
-
-#ifdef MP_TEST
- if ((OPMODE & WIFI_MP_STATE) || priv->pshare->rf_ft_var.mp_specific) {
- channel = priv->pshare->working_channel;
- if (priv->pshare->mp_txpwr_tracking == false)
- return;
- } else
-#endif
- {
- channel = (priv->pmib->dot11RFEntry.dot11channel);
- }
-
- thermal_value = (unsigned char)odm_get_rf_reg(p_dm_odm, RF_PATH_A, ODM_RF_T_METER_92E, 0xfc00); /* 0x42: RF Reg[15:10] 88E */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("\nReadback Thermal Meter = 0x%x pre thermal meter 0x%x EEPROMthermalmeter 0x%x\n", thermal_value, priv->pshare->thermal_value, priv->pmib->dot11RFEntry.ther));
-
-
- switch (rf_mimo_mode) {
- case MIMO_1T1R:
- rf = 1;
- break;
- case MIMO_2T2R:
- rf = 2;
- break;
- default:
- rf = 2;
- break;
- }
-
- /* Query OFDM path A default setting Bit[31:21] */
- ele_D = phy_query_bb_reg(priv, REG_OFDM_0_XA_TX_IQ_IMBALANCE, MASKOFDM_D);
- for (i = 0; i < OFDM_TABLE_SIZE_92E; i++) {
- if (ele_D == (ofdm_swing_table_92e[i] >> 22)) {
- OFDM_index[0] = (unsigned char)i;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("PathA 0xC80[31:22] = 0x%x, OFDM_index=%d\n", ele_D, OFDM_index[0]));
- break;
- }
- }
-
- /* Query OFDM path B default setting */
- if (rf_mimo_mode == MIMO_2T2R) {
- ele_D = phy_query_bb_reg(priv, REG_OFDM_0_XB_TX_IQ_IMBALANCE, MASKOFDM_D);
- for (i = 0; i < OFDM_TABLE_SIZE_92E; i++) {
- if (ele_D == (ofdm_swing_table_92e[i] >> 22)) {
- OFDM_index[1] = (unsigned char)i;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("PathB 0xC88[31:22] = 0x%x, OFDM_index=%d\n", ele_D, OFDM_index[1]));
- break;
- }
- }
- }
-
- /* calculate average thermal meter */
- {
- priv->pshare->thermal_value_avg_88xx[priv->pshare->thermal_value_avg_index_88xx] = thermal_value;
- priv->pshare->thermal_value_avg_index_88xx++;
- if (priv->pshare->thermal_value_avg_index_88xx == AVG_THERMAL_NUM_88XX)
- priv->pshare->thermal_value_avg_index_88xx = 0;
-
- for (i = 0; i < AVG_THERMAL_NUM_88XX; i++) {
- if (priv->pshare->thermal_value_avg_88xx[i]) {
- thermal_value_avg += priv->pshare->thermal_value_avg_88xx[i];
- thermal_value_avg_count++;
- }
- }
-
- if (thermal_value_avg_count) {
- thermal_value = (unsigned char)(thermal_value_avg / thermal_value_avg_count);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("AVG Thermal Meter = 0x%x\n", thermal_value));
- }
- }
-
- /* Initialize */
- if (!priv->pshare->thermal_value) {
- priv->pshare->thermal_value = priv->pmib->dot11RFEntry.ther;
- priv->pshare->thermal_value_iqk = thermal_value;
- priv->pshare->thermal_value_lck = thermal_value;
- }
-
- if (thermal_value != priv->pshare->thermal_value) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("\n******** START POWER TRACKING ********\n"));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("\nReadback Thermal Meter = 0x%x pre thermal meter 0x%x EEPROMthermalmeter 0x%x\n", thermal_value, priv->pshare->thermal_value, priv->pmib->dot11RFEntry.ther));
-
- delta = RTL_ABS(thermal_value, priv->pmib->dot11RFEntry.ther);
- delta_IQK = RTL_ABS(thermal_value, priv->pshare->thermal_value_iqk);
- delta_LCK = RTL_ABS(thermal_value, priv->pshare->thermal_value_lck);
- is_decrease = ((thermal_value < priv->pmib->dot11RFEntry.ther) ? 1 : 0);
-
-#ifdef _TRACKING_TABLE_FILE
- if (priv->pshare->rf_ft_var.pwr_track_file) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("diff: (%s)%d ==> get index from table : %d)\n", (is_decrease ? "-" : "+"), delta, get_tx_tracking_index(priv, channel, i, delta, is_decrease, 0)));
-
- if (is_decrease) {
- for (i = 0; i < rf; i++) {
- OFDM_index[i] = priv->pshare->OFDM_index0[i] + get_tx_tracking_index(priv, channel, i, delta, is_decrease, 0);
- OFDM_index[i] = ((OFDM_index[i] > (OFDM_TABLE_SIZE_92E- 1)) ? (OFDM_TABLE_SIZE_92E - 1) : OFDM_index[i]);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, (">>> decrese power ---> new OFDM_INDEX:%d (%d + %d)\n", OFDM_index[i], priv->pshare->OFDM_index0[i], get_tx_tracking_index(priv, channel, i, delta, is_decrease, 0)));
- CCK_index = priv->pshare->CCK_index0 + get_tx_tracking_index(priv, channel, i, delta, is_decrease, 1);
- CCK_index = ((CCK_index > (CCK_TABLE_SIZE_92E - 1)) ? (CCK_TABLE_SIZE_92E - 1) : CCK_index);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, (">>> Decrese power ---> new CCK_INDEX:%d (%d + %d)\n", CCK_index, priv->pshare->CCK_index0, get_tx_tracking_index(priv, channel, i, delta, is_decrease, 1)));
- }
- } else {
- for (i = 0; i < rf; i++) {
- OFDM_index[i] = priv->pshare->OFDM_index0[i] - get_tx_tracking_index(priv, channel, i, delta, is_decrease, 0);
- OFDM_index[i] = ((OFDM_index[i] < OFDM_min_index) ? OFDM_min_index : OFDM_index[i]);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, (">>> Increse power ---> new OFDM_INDEX:%d (%d - %d)\n", OFDM_index[i], priv->pshare->OFDM_index0[i], get_tx_tracking_index(priv, channel, i, delta, is_decrease, 0)));
- CCK_index = priv->pshare->CCK_index0 - get_tx_tracking_index(priv, channel, i, delta, is_decrease, 1);
- CCK_index = ((CCK_index < 0) ? 0 : CCK_index);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, (">>> Increse power ---> new CCK_INDEX:%d (%d - %d)\n", CCK_index, priv->pshare->CCK_index0, get_tx_tracking_index(priv, channel, i, delta, is_decrease, 1)));
- }
- }
- }
-#endif /* CFG_TRACKING_TABLE_FILE */
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("ofdm_swing_table_92e[(unsigned int)OFDM_index[0]] = %x\n", ofdm_swing_table_92e[(unsigned int)OFDM_index[0]]));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("ofdm_swing_table_92e[(unsigned int)OFDM_index[1]] = %x\n", ofdm_swing_table_92e[(unsigned int)OFDM_index[1]]));
-
- /* Adujst OFDM Ant_A according to IQK result */
- ele_D = (ofdm_swing_table_92e[(unsigned int)OFDM_index[0]] & 0xFFC00000) >> 22;
- X = priv->pshare->rege94;
- Y = priv->pshare->rege9c;
-
- if (X != 0) {
- if ((X & 0x00000200) != 0)
- X = X | 0xFFFFFC00;
- ele_A = ((X * ele_D) >> 8) & 0x000003FF;
-
- /* new element C = element D x Y */
- if ((Y & 0x00000200) != 0)
- Y = Y | 0xFFFFFC00;
- ele_C = ((Y * ele_D) >> 8) & 0x000003FF;
-
- /* wirte new elements A, C, D to regC80 and regC94, element B is always 0 */
- value32 = (ele_D << 22) | ((ele_C & 0x3F) << 16) | ele_A;
- phy_set_bb_reg(priv, REG_OFDM_0_XA_TX_IQ_IMBALANCE, MASKDWORD, value32);
-
- value32 = (ele_C & 0x000003C0) >> 6;
- phy_set_bb_reg(priv, REG_OFDM_0_XC_TX_AFE, MASKH4BITS, value32);
-
- value32 = ((X * ele_D) >> 7) & 0x01;
- phy_set_bb_reg(priv, REG_OFDM_0_ECCA_THRESHOLD, BIT(24), value32);
- } else {
- phy_set_bb_reg(priv, REG_OFDM_0_XA_TX_IQ_IMBALANCE, MASKDWORD, ofdm_swing_table_92e[(unsigned int)OFDM_index[0]]);
- phy_set_bb_reg(priv, REG_OFDM_0_XC_TX_AFE, MASKH4BITS, 0x00);
- phy_set_bb_reg(priv, REG_OFDM_0_ECCA_THRESHOLD, BIT(24), 0x00);
- }
-
- set_CCK_swing_index(priv, CCK_index);
-
- if (rf == 2) {
- ele_D = (ofdm_swing_table_92e[(unsigned int)OFDM_index[1]] & 0xFFC00000) >> 22;
- X = priv->pshare->regeb4;
- Y = priv->pshare->regebc;
-
- if (X != 0) {
- if ((X & 0x00000200) != 0) /* consider minus */
- X = X | 0xFFFFFC00;
- ele_A = ((X * ele_D) >> 8) & 0x000003FF;
-
- /* new element C = element D x Y */
- if ((Y & 0x00000200) != 0)
- Y = Y | 0xFFFFFC00;
- ele_C = ((Y * ele_D) >> 8) & 0x00003FF;
-
- /* wirte new elements A, C, D to regC88 and regC9C, element B is always 0 */
- value32 = (ele_D << 22) | ((ele_C & 0x3F) << 16) | ele_A;
- phy_set_bb_reg(priv, REG_OFDM_0_XB_TX_IQ_IMBALANCE, MASKDWORD, value32);
-
- value32 = (ele_C & 0x000003C0) >> 6;
- phy_set_bb_reg(priv, REG_OFDM_0_XD_TX_AFE, MASKH4BITS, value32);
-
- value32 = ((X * ele_D) >> 7) & 0x01;
- phy_set_bb_reg(priv, REG_OFDM_0_ECCA_THRESHOLD, BIT(28), value32);
- } else {
- phy_set_bb_reg(priv, REG_OFDM_0_XB_TX_IQ_IMBALANCE, MASKDWORD, ofdm_swing_table_92e[(unsigned int)OFDM_index[1]]);
- phy_set_bb_reg(priv, REG_OFDM_0_XD_TX_AFE, MASKH4BITS, 0x00);
- phy_set_bb_reg(priv, REG_OFDM_0_ECCA_THRESHOLD, BIT(28), 0x00);
- }
-
- }
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("0xc80 = 0x%x\n", phy_query_bb_reg(priv, REG_OFDM_0_XA_TX_IQ_IMBALANCE, MASKDWORD)));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("0xc88 = 0x%x\n", phy_query_bb_reg(priv, REG_OFDM_0_XB_TX_IQ_IMBALANCE, MASKDWORD)));
-
- if (delta_IQK > 3) {
- priv->pshare->thermal_value_iqk = thermal_value;
-#ifdef MP_TEST
- if (!(priv->pshare->rf_ft_var.mp_specific && (OPMODE & (WIFI_MP_CTX_BACKGROUND | WIFI_MP_CTX_PACKET))))
-#endif
- phy_iq_calibrate_8192e(p_dm_odm, false);
- }
-
- if (delta_LCK > 8) {
- RTL_W8(0x522, 0xff);
- reg0x18 = phy_query_rf_reg(priv, RF_PATH_A, 0x18, MASK20BITS, 1);
- phy_set_rf_reg(priv, RF_PATH_A, 0xB4, BIT(14), 1);
- phy_set_rf_reg(priv, RF_PATH_A, 0x18, BIT(15), 1);
- delay_ms(1);
- phy_set_rf_reg(priv, RF_PATH_A, 0xB4, BIT(14), 0);
- phy_set_rf_reg(priv, RF_PATH_A, 0x18, MASK20BITS, reg0x18);
- RTL_W8(0x522, 0x0);
- priv->pshare->thermal_value_lck = thermal_value;
- }
- }
-
- /* update thermal meter value */
- priv->pshare->thermal_value = thermal_value;
- for (i = 0 ; i < rf ; i++)
- priv->pshare->OFDM_index[i] = OFDM_index[i];
- priv->pshare->CCK_index = CCK_index;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("\n******** END:%s() ********\n", __func__));
-}
-#endif
-
-
-
-#if (RTL8197F_SUPPORT == 1 || RTL8822B_SUPPORT == 1)
-void
-odm_txpowertracking_callback_thermal_meter_jaguar_series3(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- void *p_dm_void
-#else
- struct _ADAPTER *adapter
-#endif
-)
-{
-#if 1
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 thermal_value = 0, delta, delta_LCK, delta_IQK, channel, is_increase;
- u8 thermal_value_avg_count = 0, p = 0, i = 0;
- u32 thermal_value_avg = 0;
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
- struct _TXPWRTRACK_CFG c;
- struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm_odm->rf_calibrate_info);
-
- /*4 1. The following TWO tables decide the final index of OFDM/CCK swing table.*/
- u8 *delta_swing_table_idx_tup_a = NULL, *delta_swing_table_idx_tdown_a = NULL;
- u8 *delta_swing_table_idx_tup_b = NULL, *delta_swing_table_idx_tdown_b = NULL;
- u8 *delta_swing_table_idx_tup_cck_a = NULL, *delta_swing_table_idx_tdown_cck_a = NULL;
- u8 *delta_swing_table_idx_tup_cck_b = NULL, *delta_swing_table_idx_tdown_cck_b = NULL;
- /*for 8814 add by Yu Chen*/
- u8 *delta_swing_table_idx_tup_c = NULL, *delta_swing_table_idx_tdown_c = NULL;
- u8 *delta_swing_table_idx_tup_d = NULL, *delta_swing_table_idx_tdown_d = NULL;
- u8 *delta_swing_table_idx_tup_cck_c = NULL, *delta_swing_table_idx_tdown_cck_c = NULL;
- u8 *delta_swing_table_idx_tup_cck_d = NULL, *delta_swing_table_idx_tdown_cck_d = NULL;
-
-#ifdef MP_TEST
- if ((OPMODE & WIFI_MP_STATE) || priv->pshare->rf_ft_var.mp_specific) {
- channel = priv->pshare->working_channel;
- if (priv->pshare->mp_txpwr_tracking == false)
- return;
- } else
-#endif
- {
- channel = (priv->pmib->dot11RFEntry.dot11channel);
- }
-
- configure_txpower_track(p_dm_odm, &c);
-
- (*c.get_delta_all_swing_table)(p_dm_odm, (u8 **)&delta_swing_table_idx_tup_a, (u8 **)&delta_swing_table_idx_tdown_a,
- (u8 **)&delta_swing_table_idx_tup_b, (u8 **)&delta_swing_table_idx_tdown_b,
- (u8 **)&delta_swing_table_idx_tup_cck_a, (u8 **)&delta_swing_table_idx_tdown_cck_a,
- (u8 **)&delta_swing_table_idx_tup_cck_b, (u8 **)&delta_swing_table_idx_tdown_cck_b);
-
- thermal_value = (u8)odm_get_rf_reg(p_dm_odm, ODM_RF_PATH_A, c.thermal_reg_addr, 0xfc00); /*0x42: RF Reg[15:10] 88E*/
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("Readback Thermal Meter = 0x%x(%d) EEPROMthermalmeter 0x%x(%d)\n"
- , thermal_value, thermal_value, priv->pmib->dot11RFEntry.ther, priv->pmib->dot11RFEntry.ther));
-
- /* Initialize */
- if (!p_dm_odm->rf_calibrate_info.thermal_value)
- p_dm_odm->rf_calibrate_info.thermal_value = priv->pmib->dot11RFEntry.ther;
-
- if (!p_dm_odm->rf_calibrate_info.thermal_value_lck)
- p_dm_odm->rf_calibrate_info.thermal_value_lck = priv->pmib->dot11RFEntry.ther;
-
- if (!p_dm_odm->rf_calibrate_info.thermal_value_iqk)
- p_dm_odm->rf_calibrate_info.thermal_value_iqk = priv->pmib->dot11RFEntry.ther;
-
- /* calculate average thermal meter */
- p_dm_odm->rf_calibrate_info.thermal_value_avg[p_dm_odm->rf_calibrate_info.thermal_value_avg_index] = thermal_value;
- p_dm_odm->rf_calibrate_info.thermal_value_avg_index++;
-
- if (p_dm_odm->rf_calibrate_info.thermal_value_avg_index == c.average_thermal_num) /*Average times = c.average_thermal_num*/
- p_dm_odm->rf_calibrate_info.thermal_value_avg_index = 0;
-
- for (i = 0; i < c.average_thermal_num; i++) {
- if (p_dm_odm->rf_calibrate_info.thermal_value_avg[i]) {
- thermal_value_avg += p_dm_odm->rf_calibrate_info.thermal_value_avg[i];
- thermal_value_avg_count++;
- }
- }
-
- if (thermal_value_avg_count) {/*Calculate Average thermal_value after average enough times*/
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("thermal_value_avg=0x%x(%d) thermal_value_avg_count = %d\n"
- , thermal_value_avg, thermal_value_avg, thermal_value_avg_count));
-
- thermal_value = (u8)(thermal_value_avg / thermal_value_avg_count);
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("AVG Thermal Meter = 0x%X(%d), EEPROMthermalmeter = 0x%X(%d)\n", thermal_value, thermal_value, priv->pmib->dot11RFEntry.ther, priv->pmib->dot11RFEntry.ther));
- }
-
- /*4 Calculate delta, delta_LCK, delta_IQK.*/
- delta = RTL_ABS(thermal_value, priv->pmib->dot11RFEntry.ther);
- delta_LCK = RTL_ABS(thermal_value, p_dm_odm->rf_calibrate_info.thermal_value_lck);
- delta_IQK = RTL_ABS(thermal_value, p_dm_odm->rf_calibrate_info.thermal_value_iqk);
- is_increase = ((thermal_value < priv->pmib->dot11RFEntry.ther) ? 0 : 1);
-
- if (delta > 29) { /* power track table index(thermal diff.) upper bound*/
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("delta(%d) > 29, set delta to 29\n", delta));
- delta = 29;
- }
-
-
- /*4 if necessary, do LCK.*/
-
- if (delta_LCK > c.threshold_iqk) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("delta_LCK(%d) >= threshold_iqk(%d)\n", delta_LCK, c.threshold_iqk));
- p_dm_odm->rf_calibrate_info.thermal_value_lck = thermal_value;
- if (c.phy_lc_calibrate)
- (*c.phy_lc_calibrate)(p_dm_odm);
- }
-
- if (delta_IQK > c.threshold_iqk) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("delta_IQK(%d) >= threshold_iqk(%d)\n", delta_IQK, c.threshold_iqk));
- p_dm_odm->rf_calibrate_info.thermal_value_iqk = thermal_value;
- if (c.do_iqk)
- (*c.do_iqk)(p_dm_odm, true, 0, 0);
- }
-
- if (!priv->pmib->dot11RFEntry.ther) /*Don't do power tracking since no calibrated thermal value*/
- return;
-
- /*4 Do Power Tracking*/
-
- if (thermal_value != p_dm_odm->rf_calibrate_info.thermal_value) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("\n\n******** START POWER TRACKING ********\n"));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("Readback Thermal Meter = 0x%x pre thermal meter 0x%x EEPROMthermalmeter 0x%x\n",
- thermal_value, p_dm_odm->rf_calibrate_info.thermal_value, priv->pmib->dot11RFEntry.ther));
-
-#ifdef _TRACKING_TABLE_FILE
- if (priv->pshare->rf_ft_var.pwr_track_file) {
- if (is_increase) { /*thermal is higher than base*/
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
- switch (p) {
- case ODM_RF_PATH_B:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tup_b[%d] = %d delta_swing_table_idx_tup_cck_b[%d] = %d\n", delta, delta_swing_table_idx_tup_b[delta], delta, delta_swing_table_idx_tup_cck_b[delta]));
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_b[delta];
- p_rf_calibrate_info->absolute_cck_swing_idx[p] = delta_swing_table_idx_tup_cck_b[delta];
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is higher and pRF->absolute_ofdm_swing_idx[ODM_RF_PATH_B] = %d pRF->absolute_cck_swing_idx[ODM_RF_PATH_B] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p], p_rf_calibrate_info->absolute_cck_swing_idx[p]));
- break;
-
- case ODM_RF_PATH_C:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tup_c[%d] = %d delta_swing_table_idx_tup_cck_c[%d] = %d\n", delta, delta_swing_table_idx_tup_c[delta], delta, delta_swing_table_idx_tup_cck_c[delta]));
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_c[delta];
- p_rf_calibrate_info->absolute_cck_swing_idx[p] = delta_swing_table_idx_tup_cck_c[delta];
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is higher and pRF->absolute_ofdm_swing_idx[ODM_RF_PATH_C] = %d pRF->absolute_cck_swing_idx[ODM_RF_PATH_C] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p], p_rf_calibrate_info->absolute_cck_swing_idx[p]));
- break;
-
- case ODM_RF_PATH_D:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tup_d[%d] = %d delta_swing_table_idx_tup_cck_d[%d] = %d\n", delta, delta_swing_table_idx_tup_d[delta], delta, delta_swing_table_idx_tup_cck_d[delta]));
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_d[delta];
- p_rf_calibrate_info->absolute_cck_swing_idx[p] = delta_swing_table_idx_tup_cck_d[delta];
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is higher and pRF->absolute_ofdm_swing_idx[ODM_RF_PATH_D] = %d pRF->absolute_cck_swing_idx[ODM_RF_PATH_D] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p], p_rf_calibrate_info->absolute_cck_swing_idx[p]));
- break;
- default:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tup_a[%d] = %d delta_swing_table_idx_tup_cck_a[%d] = %d\n", delta, delta_swing_table_idx_tup_a[delta], delta, delta_swing_table_idx_tup_cck_a[delta]));
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_a[delta];
- p_rf_calibrate_info->absolute_cck_swing_idx[p] = delta_swing_table_idx_tup_cck_a[delta];
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is higher and pRF->absolute_ofdm_swing_idx[ODM_RF_PATH_A] = %d pRF->absolute_cck_swing_idx[ODM_RF_PATH_A] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p], p_rf_calibrate_info->absolute_cck_swing_idx[p]));
- break;
- }
- }
- } else { /* thermal is lower than base*/
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
- switch (p) {
- case ODM_RF_PATH_B:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tdown_b[%d] = %d delta_swing_table_idx_tdown_cck_b[%d] = %d\n", delta, delta_swing_table_idx_tdown_b[delta], delta, delta_swing_table_idx_tdown_cck_b[delta]));
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_b[delta];
- p_rf_calibrate_info->absolute_cck_swing_idx[p] = -1 * delta_swing_table_idx_tdown_cck_b[delta];
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is lower and pRF->absolute_ofdm_swing_idx[ODM_RF_PATH_B] = %d pRF->absolute_cck_swing_idx[ODM_RF_PATH_B] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p], p_rf_calibrate_info->absolute_cck_swing_idx[p]));
- break;
-
- case ODM_RF_PATH_C:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tdown_c[%d] = %d delta_swing_table_idx_tdown_cck_c[%d] = %d\n", delta, delta_swing_table_idx_tdown_c[delta], delta, delta_swing_table_idx_tdown_cck_c[delta]));
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_c[delta];
- p_rf_calibrate_info->absolute_cck_swing_idx[p] = -1 * delta_swing_table_idx_tdown_cck_c[delta];
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is lower and pRF->absolute_ofdm_swing_idx[ODM_RF_PATH_C] = %d pRF->absolute_cck_swing_idx[ODM_RF_PATH_C] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p], p_rf_calibrate_info->absolute_cck_swing_idx[p]));
- break;
-
- case ODM_RF_PATH_D:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tdown_d[%d] = %d delta_swing_table_idx_tdown_cck_d[%d] = %d\n", delta, delta_swing_table_idx_tdown_d[delta], delta, delta_swing_table_idx_tdown_cck_d[delta]));
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_d[delta];
- p_rf_calibrate_info->absolute_cck_swing_idx[p] = -1 * delta_swing_table_idx_tdown_cck_d[delta];
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is lower and pRF->absolute_ofdm_swing_idx[ODM_RF_PATH_D] = %d pRF->absolute_cck_swing_idx[ODM_RF_PATH_D] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p], p_rf_calibrate_info->absolute_cck_swing_idx[p]));
- break;
-
- default:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tdown_a[%d] = %d delta_swing_table_idx_tdown_cck_a[%d] = %d\n", delta, delta_swing_table_idx_tdown_a[delta], delta, delta_swing_table_idx_tdown_cck_a[delta]));
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_a[delta];
- p_rf_calibrate_info->absolute_cck_swing_idx[p] = -1 * delta_swing_table_idx_tdown_cck_a[delta];
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is lower and pRF->absolute_ofdm_swing_idx[ODM_RF_PATH_A] = %d pRF->absolute_cck_swing_idx[ODM_RF_PATH_A] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p], p_rf_calibrate_info->absolute_cck_swing_idx[p]));
- break;
- }
- }
- }
-
- if (is_increase) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, (">>> increse power --->\n"));
- if (GET_CHIP_VER(priv) == VERSION_8197F) {
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, BBSWING, p, 0);
- } else if (GET_CHIP_VER(priv) == VERSION_8822B) {
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_MODE, p, 0);
- }
- } else {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, (">>> decrese power --->\n"));
- if (GET_CHIP_VER(priv) == VERSION_8197F) {
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, BBSWING, p, 0);
- } else if (GET_CHIP_VER(priv) == VERSION_8822B) {
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_MODE, p, 0);
- }
- }
- }
-#endif
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("\n******** END:%s() ********\n\n", __func__));
- /*update thermal meter value*/
- p_dm_odm->rf_calibrate_info.thermal_value = thermal_value;
-
- }
-
-#endif
-}
-#endif
-
-/*#if (RTL8814A_SUPPORT == 1)*/
-#if (RTL8814A_SUPPORT == 1)
-
-void
-odm_txpowertracking_callback_thermal_meter_jaguar_series2(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- void *p_dm_void
-#else
- struct _ADAPTER *adapter
-#endif
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 thermal_value = 0, delta, delta_LCK, delta_IQK, channel, is_increase;
- u8 thermal_value_avg_count = 0, p = 0, i = 0;
- u32 thermal_value_avg = 0, reg0x18;
- u32 bb_swing_reg[4] = {REG_A_TX_SCALE_JAGUAR, REG_B_TX_SCALE_JAGUAR, REG_C_TX_SCALE_JAGUAR2, REG_D_TX_SCALE_JAGUAR2};
- s32 ele_D;
- u32 bb_swing_idx;
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
- struct _TXPWRTRACK_CFG c;
- bool is_tssi_enable = false;
- struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm_odm->rf_calibrate_info);
-
- /* 4 1. The following TWO tables decide the final index of OFDM/CCK swing table. */
- u8 *delta_swing_table_idx_tup_a = NULL, *delta_swing_table_idx_tdown_a = NULL;
- u8 *delta_swing_table_idx_tup_b = NULL, *delta_swing_table_idx_tdown_b = NULL;
- /* for 8814 add by Yu Chen */
- u8 *delta_swing_table_idx_tup_c = NULL, *delta_swing_table_idx_tdown_c = NULL;
- u8 *delta_swing_table_idx_tup_d = NULL, *delta_swing_table_idx_tdown_d = NULL;
-
-#ifdef MP_TEST
- if ((OPMODE & WIFI_MP_STATE) || priv->pshare->rf_ft_var.mp_specific) {
- channel = priv->pshare->working_channel;
- if (priv->pshare->mp_txpwr_tracking == false)
- return;
- } else
-#endif
- {
- channel = (priv->pmib->dot11RFEntry.dot11channel);
- }
-
- configure_txpower_track(p_dm_odm, &c);
- p_rf_calibrate_info->default_ofdm_index = priv->pshare->OFDM_index0[ODM_RF_PATH_A];
-
- (*c.get_delta_swing_table)(p_dm_odm, (u8 **)&delta_swing_table_idx_tup_a, (u8 **)&delta_swing_table_idx_tdown_a,
- (u8 **)&delta_swing_table_idx_tup_b, (u8 **)&delta_swing_table_idx_tdown_b);
-
- if (p_dm_odm->support_ic_type & ODM_RTL8814A) /* for 8814 path C & D */
- (*c.get_delta_swing_table8814only)(p_dm_odm, (u8 **)&delta_swing_table_idx_tup_c, (u8 **)&delta_swing_table_idx_tdown_c,
- (u8 **)&delta_swing_table_idx_tup_d, (u8 **)&delta_swing_table_idx_tdown_d);
-
- thermal_value = (u8)odm_get_rf_reg(p_dm_odm, ODM_RF_PATH_A, c.thermal_reg_addr, 0xfc00); /* 0x42: RF Reg[15:10] 88E */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("\nReadback Thermal Meter = 0x%x, pre thermal meter 0x%x, EEPROMthermalmeter 0x%x\n", thermal_value, p_dm_odm->rf_calibrate_info.thermal_value, priv->pmib->dot11RFEntry.ther));
-
- /* Initialize */
- if (!p_dm_odm->rf_calibrate_info.thermal_value)
- p_dm_odm->rf_calibrate_info.thermal_value = priv->pmib->dot11RFEntry.ther;
-
- if (!p_dm_odm->rf_calibrate_info.thermal_value_lck)
- p_dm_odm->rf_calibrate_info.thermal_value_lck = priv->pmib->dot11RFEntry.ther;
-
- if (!p_dm_odm->rf_calibrate_info.thermal_value_iqk)
- p_dm_odm->rf_calibrate_info.thermal_value_iqk = priv->pmib->dot11RFEntry.ther;
-
- is_tssi_enable = (bool)odm_get_rf_reg(p_dm_odm, ODM_RF_PATH_A, REG_RF_TX_GAIN_OFFSET, BIT(7)); /* check TSSI enable */
-
- /* 4 Query OFDM BB swing default setting Bit[31:21] */
- for (p = ODM_RF_PATH_A ; p < c.rf_path_count ; p++) {
- ele_D = odm_get_bb_reg(p_dm_odm, bb_swing_reg[p], 0xffe00000);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("0x%x:0x%x ([31:21] = 0x%x)\n", bb_swing_reg[p], odm_get_bb_reg(p_dm_odm, bb_swing_reg[p], MASKDWORD), ele_D));
-
- for (bb_swing_idx = 0; bb_swing_idx < TXSCALE_TABLE_SIZE; bb_swing_idx++) {/* 4 */
- if (ele_D == tx_scaling_table_jaguar[bb_swing_idx]) {
- p_dm_odm->rf_calibrate_info.OFDM_index[p] = (u8)bb_swing_idx;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("OFDM_index[%d]=%d\n", p, p_dm_odm->rf_calibrate_info.OFDM_index[p]));
- break;
- }
- }
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("kfree_offset[%d]=%d\n", p, p_rf_calibrate_info->kfree_offset[p]));
-
- }
-
- /* calculate average thermal meter */
- p_dm_odm->rf_calibrate_info.thermal_value_avg[p_dm_odm->rf_calibrate_info.thermal_value_avg_index] = thermal_value;
- p_dm_odm->rf_calibrate_info.thermal_value_avg_index++;
- if (p_dm_odm->rf_calibrate_info.thermal_value_avg_index == c.average_thermal_num) /* Average times = c.average_thermal_num */
- p_dm_odm->rf_calibrate_info.thermal_value_avg_index = 0;
-
- for (i = 0; i < c.average_thermal_num; i++) {
- if (p_dm_odm->rf_calibrate_info.thermal_value_avg[i]) {
- thermal_value_avg += p_dm_odm->rf_calibrate_info.thermal_value_avg[i];
- thermal_value_avg_count++;
- }
- }
-
- if (thermal_value_avg_count) { /* Calculate Average thermal_value after average enough times */
- thermal_value = (u8)(thermal_value_avg / thermal_value_avg_count);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("AVG Thermal Meter = 0x%X, EEPROMthermalmeter = 0x%X\n", thermal_value, priv->pmib->dot11RFEntry.ther));
- }
-
- /* 4 Calculate delta, delta_LCK, delta_IQK. */
- delta = RTL_ABS(thermal_value, priv->pmib->dot11RFEntry.ther);
- delta_LCK = RTL_ABS(thermal_value, p_dm_odm->rf_calibrate_info.thermal_value_lck);
- delta_IQK = RTL_ABS(thermal_value, p_dm_odm->rf_calibrate_info.thermal_value_iqk);
- is_increase = ((thermal_value < priv->pmib->dot11RFEntry.ther) ? 0 : 1);
-
- /* 4 if necessary, do LCK. */
- if (!(p_dm_odm->support_ic_type & ODM_RTL8821)) {
- if (delta_LCK > c.threshold_iqk) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("delta_LCK(%d) >= threshold_iqk(%d)\n", delta_LCK, c.threshold_iqk));
- p_dm_odm->rf_calibrate_info.thermal_value_lck = thermal_value;
-
- /*Use RTLCK, so close power tracking driver LCK*/
-#if (RTL8814A_SUPPORT != 1)
- if (!(p_dm_odm->support_ic_type & ODM_RTL8814A)) {
- if (c.phy_lc_calibrate)
- (*c.phy_lc_calibrate)(p_dm_odm);
- }
-#endif
- }
- }
-
- if (delta_IQK > c.threshold_iqk) {
- panic_printk("%s(%d)\n", __func__, __LINE__);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("delta_IQK(%d) >= threshold_iqk(%d)\n", delta_IQK, c.threshold_iqk));
- p_dm_odm->rf_calibrate_info.thermal_value_iqk = thermal_value;
- if (c.do_iqk)
- (*c.do_iqk)(p_dm_odm, true, 0, 0);
- }
-
- if (!priv->pmib->dot11RFEntry.ther) /*Don't do power tracking since no calibrated thermal value*/
- return;
-
- /* 4 Do Power Tracking */
-
- if (is_tssi_enable == true) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter PURE TSSI MODE**********\n"));
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, TSSI_MODE, p, 0);
- } else if (thermal_value != p_dm_odm->rf_calibrate_info.thermal_value) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("\n******** START POWER TRACKING ********\n"));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("\nReadback Thermal Meter = 0x%x pre thermal meter 0x%x EEPROMthermalmeter 0x%x\n", thermal_value, p_dm_odm->rf_calibrate_info.thermal_value, priv->pmib->dot11RFEntry.ther));
-
-#ifdef _TRACKING_TABLE_FILE
- if (priv->pshare->rf_ft_var.pwr_track_file) {
- if (is_increase) { /* thermal is higher than base */
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
- switch (p) {
- case ODM_RF_PATH_B:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tup_b[%d] = %d\n", delta, delta_swing_table_idx_tup_b[delta]));
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_b[delta]; /* Record delta swing for mix mode power tracking */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is higher and p_dm_odm->absolute_ofdm_swing_idx[ODM_RF_PATH_B] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
- break;
-
- case ODM_RF_PATH_C:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tup_c[%d] = %d\n", delta, delta_swing_table_idx_tup_c[delta]));
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_c[delta]; /* Record delta swing for mix mode power tracking */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is higher and p_dm_odm->absolute_ofdm_swing_idx[ODM_RF_PATH_C] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
- break;
-
- case ODM_RF_PATH_D:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tup_d[%d] = %d\n", delta, delta_swing_table_idx_tup_d[delta]));
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_d[delta]; /* Record delta swing for mix mode power tracking */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is higher and p_dm_odm->absolute_ofdm_swing_idx[ODM_RF_PATH_D] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
- break;
-
- default:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tup_a[%d] = %d\n", delta, delta_swing_table_idx_tup_a[delta]));
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_a[delta]; /* Record delta swing for mix mode power tracking */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is higher and p_dm_odm->absolute_ofdm_swing_idx[ODM_RF_PATH_A] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
- break;
- }
- }
- } else { /* thermal is lower than base */
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
- switch (p) {
- case ODM_RF_PATH_B:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tdown_b[%d] = %d\n", delta, delta_swing_table_idx_tdown_b[delta]));
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_b[delta]; /* Record delta swing for mix mode power tracking */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is lower and p_dm_odm->absolute_ofdm_swing_idx[ODM_RF_PATH_B] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
- break;
-
- case ODM_RF_PATH_C:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tdown_c[%d] = %d\n", delta, delta_swing_table_idx_tdown_c[delta]));
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_c[delta]; /* Record delta swing for mix mode power tracking */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is lower and p_dm_odm->absolute_ofdm_swing_idx[ODM_RF_PATH_C] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
- break;
-
- case ODM_RF_PATH_D:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tdown_d[%d] = %d\n", delta, delta_swing_table_idx_tdown_d[delta]));
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_d[delta]; /* Record delta swing for mix mode power tracking */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is lower and p_dm_odm->absolute_ofdm_swing_idx[ODM_RF_PATH_D] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
- break;
-
- default:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tdown_a[%d] = %d\n", delta, delta_swing_table_idx_tdown_a[delta]));
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_a[delta]; /* Record delta swing for mix mode power tracking */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is lower and p_dm_odm->absolute_ofdm_swing_idx[ODM_RF_PATH_A] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
- break;
- }
- }
- }
-
- if (is_increase) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, (">>> increse power --->\n"));
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_MODE, p, 0);
- } else {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, (">>> decrese power --->\n"));
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_MODE, p, 0);
- }
- }
-#endif
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("\n******** END:%s() ********\n", __func__));
- /* update thermal meter value */
- p_dm_odm->rf_calibrate_info.thermal_value = thermal_value;
-
- }
-}
-#endif
-
-#if (RTL8812A_SUPPORT == 1 || RTL8881A_SUPPORT == 1)
-void
-odm_txpowertracking_callback_thermal_meter_jaguar_series(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- void *p_dm_void
-#else
- struct _ADAPTER *adapter
-#endif
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- unsigned char thermal_value = 0, delta, delta_LCK, channel, is_decrease;
- unsigned char thermal_value_avg_count = 0;
- unsigned int thermal_value_avg = 0, reg0x18;
- unsigned int bb_swing_reg[4] = {0xc1c, 0xe1c, 0x181c, 0x1a1c};
- int ele_D, value32;
- char OFDM_index[2], index;
- unsigned int i = 0, j = 0, rf_path, max_rf_path = 2, rf;
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
- unsigned char OFDM_min_index = 7; /* OFDM BB Swing should be less than +2.5dB, which is required by Arthur and Mimic */
-
-
-
-#ifdef MP_TEST
- if ((OPMODE & WIFI_MP_STATE) || priv->pshare->rf_ft_var.mp_specific) {
- channel = priv->pshare->working_channel;
- if (priv->pshare->mp_txpwr_tracking == false)
- return;
- } else
-#endif
- {
- channel = (priv->pmib->dot11RFEntry.dot11channel);
- }
-
-#if RTL8881A_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8881A) {
- max_rf_path = 1;
- if ((get_bonding_type_8881A() == BOND_8881AM || get_bonding_type_8881A() == BOND_8881AN)
- && priv->pshare->rf_ft_var.use_intpa8881A && (*p_dm_odm->p_band_type == ODM_BAND_2_4G))
- OFDM_min_index = 6; /* intPA - upper bond set to +3 dB (base: -2 dB)ot11RFEntry.phy_band_select == PHY_BAND_2G)) */
- else
- OFDM_min_index = 10; /* OFDM BB Swing should be less than +1dB, which is required by Arthur and Mimic */
- }
-#endif
-
-
- thermal_value = (unsigned char)phy_query_rf_reg(priv, RF_PATH_A, 0x42, 0xfc00, 1); /* 0x42: RF Reg[15:10] 88E */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("\nReadback Thermal Meter = 0x%x pre thermal meter 0x%x EEPROMthermalmeter 0x%x\n", thermal_value, priv->pshare->thermal_value, priv->pmib->dot11RFEntry.ther));
-
-
- /* 4 Query OFDM BB swing default setting Bit[31:21] */
- for (rf_path = 0 ; rf_path < max_rf_path ; rf_path++) {
- ele_D = phy_query_bb_reg(priv, bb_swing_reg[rf_path], 0xffe00000);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("0x%x:0x%x ([31:21] = 0x%x)\n", bb_swing_reg[rf_path], phy_query_bb_reg(priv, bb_swing_reg[rf_path], MASKDWORD), ele_D));
- for (i = 0; i < OFDM_TABLE_SIZE_8812; i++) {/* 4 */
- if (ele_D == ofdm_swing_table_8812[i]) {
- OFDM_index[rf_path] = (unsigned char)i;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("OFDM_index[%d]=%d\n", rf_path, OFDM_index[rf_path]));
- break;
- }
- }
- }
-#if 0
- /* Query OFDM path A default setting Bit[31:21] */
- ele_D = phy_query_bb_reg(priv, 0xc1c, 0xffe00000);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("0xc1c:0x%x ([31:21] = 0x%x)\n", phy_query_bb_reg(priv, 0xc1c, MASKDWORD), ele_D));
- for (i = 0; i < OFDM_TABLE_SIZE_8812; i++) {/* 4 */
- if (ele_D == ofdm_swing_table_8812[i]) {
- OFDM_index[0] = (unsigned char)i;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("OFDM_index[0]=%d\n", OFDM_index[0]));
- break;
- }
- }
- /* Query OFDM path B default setting */
- if (rf == 2) {
- ele_D = phy_query_bb_reg(priv, 0xe1c, 0xffe00000);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("0xe1c:0x%x ([32:21] = 0x%x)\n", phy_query_bb_reg(priv, 0xe1c, MASKDWORD), ele_D));
- for (i = 0; i < OFDM_TABLE_SIZE_8812; i++) {
- if (ele_D == ofdm_swing_table_8812[i]) {
- OFDM_index[1] = (unsigned char)i;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("OFDM_index[1]=%d\n", OFDM_index[1]));
- break;
- }
- }
- }
-#endif
- /* Initialize */
- if (!priv->pshare->thermal_value) {
- priv->pshare->thermal_value = priv->pmib->dot11RFEntry.ther;
- priv->pshare->thermal_value_lck = thermal_value;
- }
-
- /* calculate average thermal meter */
- {
- priv->pshare->thermal_value_avg_8812[priv->pshare->thermal_value_avg_index_8812] = thermal_value;
- priv->pshare->thermal_value_avg_index_8812++;
- if (priv->pshare->thermal_value_avg_index_8812 == AVG_THERMAL_NUM_8812)
- priv->pshare->thermal_value_avg_index_8812 = 0;
-
- for (i = 0; i < AVG_THERMAL_NUM_8812; i++) {
- if (priv->pshare->thermal_value_avg_8812[i]) {
- thermal_value_avg += priv->pshare->thermal_value_avg_8812[i];
- thermal_value_avg_count++;
- }
- }
-
- if (thermal_value_avg_count) {
- thermal_value = (unsigned char)(thermal_value_avg / thermal_value_avg_count);
- /* printk("AVG Thermal Meter = 0x%x\n", thermal_value); */
- }
- }
-
-
- /* 4 If necessary, do power tracking */
-
- if (!priv->pmib->dot11RFEntry.ther) /*Don't do power tracking since no calibrated thermal value*/
- return;
-
- if (thermal_value != priv->pshare->thermal_value) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("\n******** START POWER TRACKING ********\n"));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("\nReadback Thermal Meter = 0x%x pre thermal meter 0x%x EEPROMthermalmeter 0x%x\n", thermal_value, priv->pshare->thermal_value, priv->pmib->dot11RFEntry.ther));
- delta = RTL_ABS(thermal_value, priv->pmib->dot11RFEntry.ther);
- delta_LCK = RTL_ABS(thermal_value, priv->pshare->thermal_value_lck);
- is_decrease = ((thermal_value < priv->pmib->dot11RFEntry.ther) ? 1 : 0);
- /* if (*p_dm_odm->p_band_type == ODM_BAND_5G) */
- {
-#ifdef _TRACKING_TABLE_FILE
- if (priv->pshare->rf_ft_var.pwr_track_file) {
- for (rf_path = 0; rf_path < max_rf_path; rf_path++) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("diff: (%s)%d ==> get index from table : %d)\n", (is_decrease ? "-" : "+"), delta, get_tx_tracking_index(priv, channel, rf_path, delta, is_decrease, 0)));
- if (is_decrease) {
- OFDM_index[rf_path] = priv->pshare->OFDM_index0[rf_path] + get_tx_tracking_index(priv, channel, rf_path, delta, is_decrease, 0);
- OFDM_index[rf_path] = ((OFDM_index[rf_path] > (OFDM_TABLE_SIZE_8812 - 1)) ? (OFDM_TABLE_SIZE_8812 - 1) : OFDM_index[rf_path]);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, (">>> decrese power ---> new OFDM_INDEX:%d (%d + %d)\n", OFDM_index[rf_path], priv->pshare->OFDM_index0[rf_path], get_tx_tracking_index(priv, channel, rf_path, delta, is_decrease, 0)));
-#if 0/* RTL8881A_SUPPORT */
- if (p_dm_odm->support_ic_type == ODM_RTL8881A) {
- if (priv->pshare->rf_ft_var.pwrtrk_tx_agc_enable) {
- if (priv->pshare->add_tx_agc) { /* tx_agc has been added */
- add_tx_power88xx_ac(priv, 0);
- priv->pshare->add_tx_agc = 0;
- priv->pshare->add_tx_agc_index = 0;
- }
- }
- }
-#endif
- } else {
-
- OFDM_index[rf_path] = priv->pshare->OFDM_index0[rf_path] - get_tx_tracking_index(priv, channel, rf_path, delta, is_decrease, 0);
-#if 0/* RTL8881A_SUPPORT */
- if (p_dm_odm->support_ic_type == ODM_RTL8881A) {
- if (priv->pshare->rf_ft_var.pwrtrk_tx_agc_enable) {
- if (OFDM_index[i] < OFDM_min_index) {
- priv->pshare->add_tx_agc_index = (OFDM_min_index - OFDM_index[i]) / 2; /* Calculate Remnant tx_agc value, 2 index for 1 tx_agc */
- add_tx_power88xx_ac(priv, priv->pshare->add_tx_agc_index);
- priv->pshare->add_tx_agc = 1; /* add_tx_agc Flag = 1 */
- OFDM_index[i] = OFDM_min_index;
- } else {
- if (priv->pshare->add_tx_agc) { /* tx_agc been added */
- priv->pshare->add_tx_agc = 0;
- priv->pshare->add_tx_agc_index = 0;
- add_tx_power88xx_ac(priv, 0); /* minus the added TPI */
- }
- }
- }
- }
-#else
- OFDM_index[rf_path] = ((OFDM_index[rf_path] < OFDM_min_index) ? OFDM_min_index : OFDM_index[rf_path]);
-#endif
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, (">>> increse power ---> new OFDM_INDEX:%d (%d - %d)\n", OFDM_index[rf_path], priv->pshare->OFDM_index0[rf_path], get_tx_tracking_index(priv, channel, rf_path, delta, is_decrease, 0)));
- }
- }
- }
-#endif
- /* 4 Set new BB swing index */
- for (rf_path = 0; rf_path < max_rf_path; rf_path++) {
- phy_set_bb_reg(priv, bb_swing_reg[rf_path], 0xffe00000, ofdm_swing_table_8812[(unsigned int)OFDM_index[rf_path]]);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("Readback 0x%x[31:21] = 0x%x, OFDM_index:%d\n", bb_swing_reg[rf_path], phy_query_bb_reg(priv, bb_swing_reg[rf_path], 0xffe00000), OFDM_index[rf_path]));
- }
-
- }
- if (delta_LCK > 8) {
- RTL_W8(0x522, 0xff);
- reg0x18 = phy_query_rf_reg(priv, RF_PATH_A, 0x18, MASK20BITS, 1);
- phy_set_rf_reg(priv, RF_PATH_A, 0xB4, BIT(14), 1);
- phy_set_rf_reg(priv, RF_PATH_A, 0x18, BIT(15), 1);
- delay_ms(200); /* frequency deviation */
- phy_set_rf_reg(priv, RF_PATH_A, 0xB4, BIT(14), 0);
- phy_set_rf_reg(priv, RF_PATH_A, 0x18, MASK20BITS, reg0x18);
- RTL_W8(0x522, 0x0);
- priv->pshare->thermal_value_lck = thermal_value;
- }
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("\n******** END:%s() ********\n", __func__));
-
- /* update thermal meter value */
- priv->pshare->thermal_value = thermal_value;
- for (rf_path = 0; rf_path < max_rf_path; rf_path++)
- priv->pshare->OFDM_index[rf_path] = OFDM_index[rf_path];
- }
-}
-
-#endif
-
-
-void
-odm_txpowertracking_callback_thermal_meter(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- void *p_dm_void
-#else
- struct _ADAPTER *adapter
-#endif
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm_odm->rf_calibrate_info);
-
-
-#if (RTL8197F_SUPPORT == 1 || RTL8822B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8197F || p_dm_odm->support_ic_type == ODM_RTL8822B) {
- odm_txpowertracking_callback_thermal_meter_jaguar_series3(p_dm_odm);
- return;
- }
-#endif
-#if (RTL8814A_SUPPORT == 1) /*use this function to do power tracking after 8814 by YuChen*/
- if (p_dm_odm->support_ic_type & ODM_RTL8814A) {
- odm_txpowertracking_callback_thermal_meter_jaguar_series2(p_dm_odm);
- return;
- }
-#endif
-#if (RTL8881A_SUPPORT || RTL8812A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type & ODM_RTL8812 || p_dm_odm->support_ic_type & ODM_RTL8881A) {
- odm_txpowertracking_callback_thermal_meter_jaguar_series(p_dm_odm);
- return;
- }
-#endif
-
-#if (RTL8192E_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8192E) {
- odm_txpowertracking_callback_thermal_meter_92e(p_dm_odm);
- return;
- }
-#endif
-
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- /* PMGNT_INFO p_mgnt_info = &adapter->mgnt_info; */
-#endif
-
-
- u8 thermal_value = 0, delta, delta_LCK, delta_IQK, offset;
- u8 thermal_value_avg_count = 0;
- u32 thermal_value_avg = 0;
- /* s32 ele_A=0, ele_D, TempCCk, X, value32;
- * s32 Y, ele_C=0;
- * s8 OFDM_index[2], CCK_index=0, OFDM_index_old[2]={0,0}, CCK_index_old=0, index;
- * s8 deltaPowerIndex = 0; */
- u32 i = 0;/* , j = 0; */
- bool is2T = false;
- /* bool bInteralPA = false; */
-
- u8 OFDM_max_index = 34, rf = (is2T) ? 2 : 1; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */
- u8 indexforchannel = 0;/*get_right_chnl_place_for_iqk(p_hal_data->current_channel)*/
- enum _POWER_DEC_INC { POWER_DEC, POWER_INC };
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->odmpriv;
-#endif
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-#endif
-
- struct _TXPWRTRACK_CFG c;
-
-
- /* 4 1. The following TWO tables decide the final index of OFDM/CCK swing table. */
- s8 delta_swing_table_idx[2][index_mapping_NUM_88E] = {
- /* {{Power decreasing(lower temperature)}, {Power increasing(higher temperature)}} */
- {0, 0, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11}, {0, 0, 1, 2, 3, 4, 4, 4, 4, 5, 7, 8, 9, 9, 10}
- };
- u8 thermal_threshold[2][index_mapping_NUM_88E] = {
- /* {{Power decreasing(lower temperature)}, {Power increasing(higher temperature)}} */
- {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 27}, {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 25, 25}
- };
-
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
-#endif
-
- /* 4 2. Initilization ( 7 steps in total ) */
-
- configure_txpower_track(p_dm_odm, &c);
-
- p_dm_odm->rf_calibrate_info.txpowertracking_callback_cnt++; /* cosa add for debug */
- p_dm_odm->rf_calibrate_info.is_txpowertracking_init = true;
-
-#if (MP_DRIVER == 1)
- p_dm_odm->rf_calibrate_info.txpowertrack_control = p_hal_data->txpowertrack_control; /* We should keep updating the control variable according to HalData.
- * rf_calibrate_info.rega24 will be initialized when ODM HW configuring, but MP configures with para files. */
- p_dm_odm->rf_calibrate_info.rega24 = 0x090e1317;
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP) && defined(MP_TEST)
- if ((OPMODE & WIFI_MP_STATE) || p_dm_odm->priv->pshare->rf_ft_var.mp_specific) {
- if (p_dm_odm->priv->pshare->mp_txpwr_tracking == false)
- return;
- }
-#endif
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("===>odm_txpowertracking_callback_thermal_meter_8188e, p_dm_odm->bb_swing_idx_cck_base: %d, p_dm_odm->bb_swing_idx_ofdm_base: %d\n", p_rf_calibrate_info->bb_swing_idx_cck_base, p_rf_calibrate_info->bb_swing_idx_ofdm_base));
- /*
- if (!p_dm_odm->rf_calibrate_info.tm_trigger) {
- odm_set_rf_reg(p_dm_odm, RF_PATH_A, c.thermal_reg_addr, BIT(17) | BIT(16), 0x3);
- p_dm_odm->rf_calibrate_info.tm_trigger = 1;
- return;
- }
- */
- thermal_value = (u8)odm_get_rf_reg(p_dm_odm, RF_PATH_A, c.thermal_reg_addr, 0xfc00); /* 0x42: RF Reg[15:10] 88E */
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- if (!thermal_value || !p_dm_odm->rf_calibrate_info.txpowertrack_control)
-#else
- if (!p_dm_odm->rf_calibrate_info.txpowertrack_control)
-#endif
- return;
-
- /* 4 3. Initialize ThermalValues of rf_calibrate_info */
-
- if (!p_dm_odm->rf_calibrate_info.thermal_value) {
- p_dm_odm->rf_calibrate_info.thermal_value_lck = thermal_value;
- p_dm_odm->rf_calibrate_info.thermal_value_iqk = thermal_value;
- }
-
- if (p_dm_odm->rf_calibrate_info.is_reloadtxpowerindex)
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("reload ofdm index for band switch\n"));
-
- /* 4 4. Calculate average thermal meter */
-
- p_dm_odm->rf_calibrate_info.thermal_value_avg[p_dm_odm->rf_calibrate_info.thermal_value_avg_index] = thermal_value;
- p_dm_odm->rf_calibrate_info.thermal_value_avg_index++;
- if (p_dm_odm->rf_calibrate_info.thermal_value_avg_index == c.average_thermal_num)
- p_dm_odm->rf_calibrate_info.thermal_value_avg_index = 0;
-
- for (i = 0; i < c.average_thermal_num; i++) {
- if (p_dm_odm->rf_calibrate_info.thermal_value_avg[i]) {
- thermal_value_avg += p_dm_odm->rf_calibrate_info.thermal_value_avg[i];
- thermal_value_avg_count++;
- }
- }
-
- if (thermal_value_avg_count) {
- /* Give the new thermo value a weighting */
- thermal_value_avg += (thermal_value * 4);
-
- thermal_value = (u8)(thermal_value_avg / (thermal_value_avg_count + 4));
- p_rf_calibrate_info->thermal_value_delta = thermal_value - priv->pmib->dot11RFEntry.ther;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("AVG Thermal Meter = 0x%x\n", thermal_value));
- }
-
- /* 4 5. Calculate delta, delta_LCK, delta_IQK. */
-
- delta = (thermal_value > p_dm_odm->rf_calibrate_info.thermal_value) ? (thermal_value - p_dm_odm->rf_calibrate_info.thermal_value) : (p_dm_odm->rf_calibrate_info.thermal_value - thermal_value);
- delta_LCK = (thermal_value > p_dm_odm->rf_calibrate_info.thermal_value_lck) ? (thermal_value - p_dm_odm->rf_calibrate_info.thermal_value_lck) : (p_dm_odm->rf_calibrate_info.thermal_value_lck - thermal_value);
- delta_IQK = (thermal_value > p_dm_odm->rf_calibrate_info.thermal_value_iqk) ? (thermal_value - p_dm_odm->rf_calibrate_info.thermal_value_iqk) : (p_dm_odm->rf_calibrate_info.thermal_value_iqk - thermal_value);
-
- /* 4 6. If necessary, do LCK. */
- if (!(p_dm_odm->support_ic_type & ODM_RTL8821)) {
- /*if((delta_LCK > p_hal_data->delta_lck) && (p_hal_data->delta_lck != 0))*/
- if (delta_LCK >= c.threshold_iqk) {
- /*Delta temperature is equal to or larger than 20 centigrade.*/
- p_dm_odm->rf_calibrate_info.thermal_value_lck = thermal_value;
- (*c.phy_lc_calibrate)(p_dm_odm);
- }
- }
-
- /* 3 7. If necessary, move the index of swing table to adjust Tx power. */
-
- if (delta > 0 && p_dm_odm->rf_calibrate_info.txpowertrack_control) {
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
- delta = thermal_value > p_hal_data->eeprom_thermal_meter ? (thermal_value - p_hal_data->eeprom_thermal_meter) : (p_hal_data->eeprom_thermal_meter - thermal_value);
-#else
- delta = (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther) ? (thermal_value - p_dm_odm->priv->pmib->dot11RFEntry.ther) : (p_dm_odm->priv->pmib->dot11RFEntry.ther - thermal_value);
-#endif
-
-
- /* 4 7.1 The Final Power index = BaseIndex + power_index_offset */
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
- if (thermal_value > p_hal_data->eeprom_thermal_meter) {
-#else
- if (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther) {
-#endif
- CALCULATE_SWINGTALBE_OFFSET(offset, POWER_INC, index_mapping_NUM_88E, delta);
- p_dm_odm->rf_calibrate_info.delta_power_index_last = p_dm_odm->rf_calibrate_info.delta_power_index;
- p_dm_odm->rf_calibrate_info.delta_power_index = delta_swing_table_idx[POWER_INC][offset];
-
- } else {
-
- CALCULATE_SWINGTALBE_OFFSET(offset, POWER_DEC, index_mapping_NUM_88E, delta);
- p_dm_odm->rf_calibrate_info.delta_power_index_last = p_dm_odm->rf_calibrate_info.delta_power_index;
- p_dm_odm->rf_calibrate_info.delta_power_index = (-1) * delta_swing_table_idx[POWER_DEC][offset];
- }
-
- if (p_dm_odm->rf_calibrate_info.delta_power_index == p_dm_odm->rf_calibrate_info.delta_power_index_last)
- p_dm_odm->rf_calibrate_info.power_index_offset = 0;
- else
- p_dm_odm->rf_calibrate_info.power_index_offset = p_dm_odm->rf_calibrate_info.delta_power_index - p_dm_odm->rf_calibrate_info.delta_power_index_last;
-
- for (i = 0; i < rf; i++)
- p_dm_odm->rf_calibrate_info.OFDM_index[i] = p_rf_calibrate_info->bb_swing_idx_ofdm_base + p_dm_odm->rf_calibrate_info.power_index_offset;
- p_dm_odm->rf_calibrate_info.CCK_index = p_rf_calibrate_info->bb_swing_idx_cck_base + p_dm_odm->rf_calibrate_info.power_index_offset;
-
- p_rf_calibrate_info->bb_swing_idx_cck = p_dm_odm->rf_calibrate_info.CCK_index;
- p_rf_calibrate_info->bb_swing_idx_ofdm[RF_PATH_A] = p_dm_odm->rf_calibrate_info.OFDM_index[RF_PATH_A];
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("The 'CCK' final index(%d) = BaseIndex(%d) + power_index_offset(%d)\n", p_rf_calibrate_info->bb_swing_idx_cck, p_rf_calibrate_info->bb_swing_idx_cck_base, p_dm_odm->rf_calibrate_info.power_index_offset));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("The 'OFDM' final index(%d) = BaseIndex(%d) + power_index_offset(%d)\n", p_rf_calibrate_info->bb_swing_idx_ofdm[RF_PATH_A], p_rf_calibrate_info->bb_swing_idx_ofdm_base, p_dm_odm->rf_calibrate_info.power_index_offset));
-
- /* 4 7.1 Handle boundary conditions of index. */
-
-
- for (i = 0; i < rf; i++) {
- if (p_dm_odm->rf_calibrate_info.OFDM_index[i] > OFDM_max_index)
- p_dm_odm->rf_calibrate_info.OFDM_index[i] = OFDM_max_index;
- else if (p_dm_odm->rf_calibrate_info.OFDM_index[i] < 0)
- p_dm_odm->rf_calibrate_info.OFDM_index[i] = 0;
- }
-
- if (p_dm_odm->rf_calibrate_info.CCK_index > c.swing_table_size_cck - 1)
- p_dm_odm->rf_calibrate_info.CCK_index = c.swing_table_size_cck - 1;
- else if (p_dm_odm->rf_calibrate_info.CCK_index < 0)
- p_dm_odm->rf_calibrate_info.CCK_index = 0;
- } else {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("The thermal meter is unchanged or TxPowerTracking OFF: thermal_value: %d, p_dm_odm->rf_calibrate_info.thermal_value: %d)\n", thermal_value, p_dm_odm->rf_calibrate_info.thermal_value));
- p_dm_odm->rf_calibrate_info.power_index_offset = 0;
- }
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("TxPowerTracking: [CCK] Swing Current index: %d, Swing base index: %d\n", p_dm_odm->rf_calibrate_info.CCK_index, p_rf_calibrate_info->bb_swing_idx_cck_base));
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("TxPowerTracking: [OFDM] Swing Current index: %d, Swing base index: %d\n", p_dm_odm->rf_calibrate_info.OFDM_index[RF_PATH_A], p_rf_calibrate_info->bb_swing_idx_ofdm_base));
-
- if (p_dm_odm->rf_calibrate_info.power_index_offset != 0 && p_dm_odm->rf_calibrate_info.txpowertrack_control) {
- /* 4 7.2 Configure the Swing Table to adjust Tx Power. */
-
- p_dm_odm->rf_calibrate_info.is_tx_power_changed = true; /* Always true after Tx Power is adjusted by power tracking. */
- /* */
- /* 2012/04/23 MH According to Luke's suggestion, we can not write BB digital */
- /* to increase TX power. Otherwise, EVM will be bad. */
- /* */
- /* 2012/04/25 MH Add for tx power tracking to set tx power in tx agc for 88E. */
- if (thermal_value > p_dm_odm->rf_calibrate_info.thermal_value) {
- /* ODM_RT_TRACE(p_dm_odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, */
- /* ("Temperature Increasing: delta_pi: %d, delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", */
- /* p_dm_odm->rf_calibrate_info.power_index_offset, delta, thermal_value, p_hal_data->eeprom_thermal_meter, p_dm_odm->rf_calibrate_info.thermal_value)); */
- } else if (thermal_value < p_dm_odm->rf_calibrate_info.thermal_value) { /* Low temperature */
- /* ODM_RT_TRACE(p_dm_odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, */
- /* ("Temperature Decreasing: delta_pi: %d, delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", */
- /* p_dm_odm->rf_calibrate_info.power_index_offset, delta, thermal_value, p_hal_data->eeprom_thermal_meter, p_dm_odm->rf_calibrate_info.thermal_value)); */
- }
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- if (thermal_value > p_hal_data->eeprom_thermal_meter)
-#else
- if (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther)
-#endif
- {
- /* ODM_RT_TRACE(p_dm_odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("Temperature(%d) hugher than PG value(%d), increases the power by tx_agc\n", thermal_value, p_hal_data->eeprom_thermal_meter)); */
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, TXAGC, 0, 0);
- } else {
- /* ODM_RT_TRACE(p_dm_odm,ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,("Temperature(%d) lower than PG value(%d), increases the power by tx_agc\n", thermal_value, p_hal_data->eeprom_thermal_meter)); */
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, BBSWING, RF_PATH_A, indexforchannel);
- if (is2T)
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, BBSWING, RF_PATH_B, indexforchannel);
- }
-
- p_rf_calibrate_info->bb_swing_idx_cck_base = p_rf_calibrate_info->bb_swing_idx_cck;
- p_rf_calibrate_info->bb_swing_idx_ofdm_base = p_rf_calibrate_info->bb_swing_idx_ofdm[RF_PATH_A];
- p_dm_odm->rf_calibrate_info.thermal_value = thermal_value;
-
- }
-
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- /* if((delta_IQK > p_hal_data->delta_iqk) && (p_hal_data->delta_iqk != 0)) */
- if ((delta_IQK >= 8)) /* Delta temperature is equal to or larger than 20 centigrade. */
- (*c.do_iqk)(p_dm_odm, delta_IQK, thermal_value, 8);
-#endif
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("<===dm_TXPowerTrackingCallback_ThermalMeter_8188E\n"));
-
- p_dm_odm->rf_calibrate_info.tx_powercount = 0;
-}
-
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-
-
-void
-phy_path_a_stand_by(
- struct _ADAPTER *p_adapter
-)
-{
- RTPRINT(FINIT, INIT_IQK, ("path-A standby mode!\n"));
-
- phy_set_bb_reg(p_adapter, REG_FPGA0_IQK, 0xffffff00, 0x0);
- phy_set_bb_reg(p_adapter, 0x840, MASKDWORD, 0x00010000);
- phy_set_bb_reg(p_adapter, REG_FPGA0_IQK, 0xffffff00, 0x808000);
-}
-
-/* 1 7. IQK
- * #define MAX_TOLERANCE 5
- * #define IQK_DELAY_TIME 1 */ /* ms */
-
-u8 /* bit0 = 1 => Tx OK, bit1 = 1 => Rx OK */
-phy_path_a_iqk_8192c(
- struct _ADAPTER *p_adapter,
- bool config_path_b
-)
-{
-
- u32 reg_eac, reg_e94, reg_e9c, reg_ea4;
- u8 result = 0x00;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter);
-
- RTPRINT(FINIT, INIT_IQK, ("path A IQK!\n"));
-
- /* path-A IQK setting */
- RTPRINT(FINIT, INIT_IQK, ("path-A IQK setting!\n"));
- if (p_adapter->interface_index == 0) {
- phy_set_bb_reg(p_adapter, REG_TX_IQK_TONE_A, MASKDWORD, 0x10008c1f);
- phy_set_bb_reg(p_adapter, REG_RX_IQK_TONE_A, MASKDWORD, 0x10008c1f);
- } else {
- phy_set_bb_reg(p_adapter, REG_TX_IQK_TONE_A, MASKDWORD, 0x10008c22);
- phy_set_bb_reg(p_adapter, REG_RX_IQK_TONE_A, MASKDWORD, 0x10008c22);
- }
-
- phy_set_bb_reg(p_adapter, REG_TX_IQK_PI_A, MASKDWORD, 0x82140102);
-
- phy_set_bb_reg(p_adapter, REG_RX_IQK_PI_A, MASKDWORD, config_path_b ? 0x28160202 :
- IS_81xxC_VENDOR_UMC_B_CUT(p_hal_data->version_id) ? 0x28160202 : 0x28160502);
-
- /* path-B IQK setting */
- if (config_path_b) {
- phy_set_bb_reg(p_adapter, REG_TX_IQK_TONE_B, MASKDWORD, 0x10008c22);
- phy_set_bb_reg(p_adapter, REG_RX_IQK_TONE_B, MASKDWORD, 0x10008c22);
- phy_set_bb_reg(p_adapter, REG_TX_IQK_PI_B, MASKDWORD, 0x82140102);
- phy_set_bb_reg(p_adapter, REG_RX_IQK_PI_B, MASKDWORD, 0x28160202);
- }
-
- /* LO calibration setting */
- RTPRINT(FINIT, INIT_IQK, ("LO calibration setting!\n"));
- phy_set_bb_reg(p_adapter, REG_IQK_AGC_RSP, MASKDWORD, 0x001028d1);
-
- /* One shot, path A LOK & IQK */
- RTPRINT(FINIT, INIT_IQK, ("One shot, path A LOK & IQK!\n"));
- phy_set_bb_reg(p_adapter, REG_IQK_AGC_PTS, MASKDWORD, 0xf9000000);
- phy_set_bb_reg(p_adapter, REG_IQK_AGC_PTS, MASKDWORD, 0xf8000000);
-
- /* delay x ms */
- RTPRINT(FINIT, INIT_IQK, ("delay %d ms for One shot, path A LOK & IQK.\n", IQK_DELAY_TIME));
- platform_stall_execution(IQK_DELAY_TIME * 1000);
-
- /* Check failed */
- reg_eac = phy_query_bb_reg(p_adapter, REG_RX_POWER_AFTER_IQK_A_2, MASKDWORD);
- RTPRINT(FINIT, INIT_IQK, ("0xeac = 0x%x\n", reg_eac));
- reg_e94 = phy_query_bb_reg(p_adapter, REG_TX_POWER_BEFORE_IQK_A, MASKDWORD);
- RTPRINT(FINIT, INIT_IQK, ("0xe94 = 0x%x\n", reg_e94));
- reg_e9c = phy_query_bb_reg(p_adapter, REG_TX_POWER_AFTER_IQK_A, MASKDWORD);
- RTPRINT(FINIT, INIT_IQK, ("0xe9c = 0x%x\n", reg_e9c));
- reg_ea4 = phy_query_bb_reg(p_adapter, REG_RX_POWER_BEFORE_IQK_A_2, MASKDWORD);
- RTPRINT(FINIT, INIT_IQK, ("0xea4 = 0x%x\n", reg_ea4));
-
- if (!(reg_eac & BIT(28)) &&
- (((reg_e94 & 0x03FF0000) >> 16) != 0x142) &&
- (((reg_e9c & 0x03FF0000) >> 16) != 0x42))
- result |= 0x01;
- else /* if Tx not OK, ignore Rx */
- return result;
-
- if (!(reg_eac & BIT(27)) && /* if Tx is OK, check whether Rx is OK */
- (((reg_ea4 & 0x03FF0000) >> 16) != 0x132) &&
- (((reg_eac & 0x03FF0000) >> 16) != 0x36))
- result |= 0x02;
- else
- RTPRINT(FINIT, INIT_IQK, ("path A Rx IQK fail!!\n"));
-
- return result;
-
-
-}
-
-u8 /* bit0 = 1 => Tx OK, bit1 = 1 => Rx OK */
-phy_path_b_iqk_8192c(
- struct _ADAPTER *p_adapter
-)
-{
- u32 reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc;
- u8 result = 0x00;
- RTPRINT(FINIT, INIT_IQK, ("path B IQK!\n"));
-
- /* One shot, path B LOK & IQK */
- RTPRINT(FINIT, INIT_IQK, ("One shot, path A LOK & IQK!\n"));
- phy_set_bb_reg(p_adapter, REG_IQK_AGC_CONT, MASKDWORD, 0x00000002);
- phy_set_bb_reg(p_adapter, REG_IQK_AGC_CONT, MASKDWORD, 0x00000000);
-
- /* delay x ms */
- RTPRINT(FINIT, INIT_IQK, ("delay %d ms for One shot, path B LOK & IQK.\n", IQK_DELAY_TIME));
- platform_stall_execution(IQK_DELAY_TIME * 1000);
-
- /* Check failed */
- reg_eac = phy_query_bb_reg(p_adapter, REG_RX_POWER_AFTER_IQK_A_2, MASKDWORD);
- RTPRINT(FINIT, INIT_IQK, ("0xeac = 0x%x\n", reg_eac));
- reg_eb4 = phy_query_bb_reg(p_adapter, REG_TX_POWER_BEFORE_IQK_B, MASKDWORD);
- RTPRINT(FINIT, INIT_IQK, ("0xeb4 = 0x%x\n", reg_eb4));
- reg_ebc = phy_query_bb_reg(p_adapter, REG_TX_POWER_AFTER_IQK_B, MASKDWORD);
- RTPRINT(FINIT, INIT_IQK, ("0xebc = 0x%x\n", reg_ebc));
- reg_ec4 = phy_query_bb_reg(p_adapter, REG_RX_POWER_BEFORE_IQK_B_2, MASKDWORD);
- RTPRINT(FINIT, INIT_IQK, ("0xec4 = 0x%x\n", reg_ec4));
- reg_ecc = phy_query_bb_reg(p_adapter, REG_RX_POWER_AFTER_IQK_B_2, MASKDWORD);
- RTPRINT(FINIT, INIT_IQK, ("0xecc = 0x%x\n", reg_ecc));
-
- if (!(reg_eac & BIT(31)) &&
- (((reg_eb4 & 0x03FF0000) >> 16) != 0x142) &&
- (((reg_ebc & 0x03FF0000) >> 16) != 0x42))
- result |= 0x01;
- else
- return result;
-
- if (!(reg_eac & BIT(30)) &&
- (((reg_ec4 & 0x03FF0000) >> 16) != 0x132) &&
- (((reg_ecc & 0x03FF0000) >> 16) != 0x36))
- result |= 0x02;
- else
- RTPRINT(FINIT, INIT_IQK, ("path B Rx IQK fail!!\n"));
-
-
- return result;
-
-}
-
-void
-phy_path_a_fill_iqk_matrix(
- struct _ADAPTER *p_adapter,
- bool is_iqk_ok,
- s32 result[][8],
- u8 final_candidate,
- bool is_tx_only
-)
-{
- u32 oldval_0, X, TX0_A, reg;
- s32 Y, TX0_C;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter);
-
- RTPRINT(FINIT, INIT_IQK, ("path A IQ Calibration %s !\n", (is_iqk_ok) ? "Success" : "Failed"));
-
- if (final_candidate == 0xFF)
- return;
-
- else if (is_iqk_ok) {
- oldval_0 = (phy_query_bb_reg(p_adapter, REG_OFDM_0_XA_TX_IQ_IMBALANCE, MASKDWORD) >> 22) & 0x3FF;
-
- X = result[final_candidate][0];
- if ((X & 0x00000200) != 0)
- X = X | 0xFFFFFC00;
- TX0_A = (X * oldval_0) >> 8;
- RTPRINT(FINIT, INIT_IQK, ("X = 0x%x, TX0_A = 0x%x, oldval_0 0x%x\n", X, TX0_A, oldval_0));
- phy_set_bb_reg(p_adapter, REG_OFDM_0_XA_TX_IQ_IMBALANCE, 0x3FF, TX0_A);
- phy_set_bb_reg(p_adapter, REG_OFDM_0_ECCA_THRESHOLD, BIT(31), ((X * oldval_0 >> 7) & 0x1));
-
- Y = result[final_candidate][1];
- if ((Y & 0x00000200) != 0)
- Y = Y | 0xFFFFFC00;
-
- /* path B IQK result + 3 */
- if (p_adapter->interface_index == 1 && p_hal_data->current_band_type == BAND_ON_5G)
- Y += 3;
-
- TX0_C = (Y * oldval_0) >> 8;
- RTPRINT(FINIT, INIT_IQK, ("Y = 0x%x, TX = 0x%x\n", Y, TX0_C));
- phy_set_bb_reg(p_adapter, REG_OFDM_0_XC_TX_AFE, 0xF0000000, ((TX0_C & 0x3C0) >> 6));
- phy_set_bb_reg(p_adapter, REG_OFDM_0_XA_TX_IQ_IMBALANCE, 0x003F0000, (TX0_C & 0x3F));
- phy_set_bb_reg(p_adapter, REG_OFDM_0_ECCA_THRESHOLD, BIT(29), ((Y * oldval_0 >> 7) & 0x1));
-
- if (is_tx_only) {
- RTPRINT(FINIT, INIT_IQK, ("phy_path_a_fill_iqk_matrix only Tx OK\n"));
- return;
- }
-
- reg = result[final_candidate][2];
- phy_set_bb_reg(p_adapter, REG_OFDM_0_XA_RX_IQ_IMBALANCE, 0x3FF, reg);
-
- reg = result[final_candidate][3] & 0x3F;
- phy_set_bb_reg(p_adapter, REG_OFDM_0_XA_RX_IQ_IMBALANCE, 0xFC00, reg);
-
- reg = (result[final_candidate][3] >> 6) & 0xF;
- phy_set_bb_reg(p_adapter, REG_OFDM_0_RX_IQ_EXT_ANTA, 0xF0000000, reg);
- }
-}
-
-void
-phy_path_b_fill_iqk_matrix(
- struct _ADAPTER *p_adapter,
- bool is_iqk_ok,
- s32 result[][8],
- u8 final_candidate,
- bool is_tx_only /* do Tx only */
-)
-{
- u32 oldval_1, X, TX1_A, reg;
- s32 Y, TX1_C;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter);
-
- RTPRINT(FINIT, INIT_IQK, ("path B IQ Calibration %s !\n", (is_iqk_ok) ? "Success" : "Failed"));
-
- if (final_candidate == 0xFF)
- return;
-
- else if (is_iqk_ok) {
- oldval_1 = (phy_query_bb_reg(p_adapter, REG_OFDM_0_XB_TX_IQ_IMBALANCE, MASKDWORD) >> 22) & 0x3FF;
-
- X = result[final_candidate][4];
- if ((X & 0x00000200) != 0)
- X = X | 0xFFFFFC00;
- TX1_A = (X * oldval_1) >> 8;
- RTPRINT(FINIT, INIT_IQK, ("X = 0x%x, TX1_A = 0x%x\n", X, TX1_A));
- phy_set_bb_reg(p_adapter, REG_OFDM_0_XB_TX_IQ_IMBALANCE, 0x3FF, TX1_A);
- phy_set_bb_reg(p_adapter, REG_OFDM_0_ECCA_THRESHOLD, BIT(27), ((X * oldval_1 >> 7) & 0x1));
-
- Y = result[final_candidate][5];
- if ((Y & 0x00000200) != 0)
- Y = Y | 0xFFFFFC00;
- if (p_hal_data->current_band_type == BAND_ON_5G)
- Y += 3; /* temp modify for preformance */
- TX1_C = (Y * oldval_1) >> 8;
- RTPRINT(FINIT, INIT_IQK, ("Y = 0x%x, TX1_C = 0x%x\n", Y, TX1_C));
- phy_set_bb_reg(p_adapter, REG_OFDM_0_XD_TX_AFE, 0xF0000000, ((TX1_C & 0x3C0) >> 6));
- phy_set_bb_reg(p_adapter, REG_OFDM_0_XB_TX_IQ_IMBALANCE, 0x003F0000, (TX1_C & 0x3F));
- phy_set_bb_reg(p_adapter, REG_OFDM_0_ECCA_THRESHOLD, BIT(25), ((Y * oldval_1 >> 7) & 0x1));
-
- if (is_tx_only)
- return;
-
- reg = result[final_candidate][6];
- phy_set_bb_reg(p_adapter, REG_OFDM_0_XB_RX_IQ_IMBALANCE, 0x3FF, reg);
-
- reg = result[final_candidate][7] & 0x3F;
- phy_set_bb_reg(p_adapter, REG_OFDM_0_XB_RX_IQ_IMBALANCE, 0xFC00, reg);
-
- reg = (result[final_candidate][7] >> 6) & 0xF;
- phy_set_bb_reg(p_adapter, REG_OFDM_0_AGC_RSSI_TABLE, 0x0000F000, reg);
- }
-}
-
-
-bool
-phy_simularity_compare_92c(
- struct _ADAPTER *p_adapter,
- s32 result[][8],
- u8 c1,
- u8 c2
-)
-{
- u32 i, j, diff, simularity_bit_map, bound = 0;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter);
- u8 final_candidate[2] = {0xFF, 0xFF}; /* for path A and path B */
- bool is_result = true, is2T = IS_92C_SERIAL(p_hal_data->version_id);
-
- if (is2T)
- bound = 8;
- else
- bound = 4;
-
- simularity_bit_map = 0;
-
- for (i = 0; i < bound; i++) {
- diff = (result[c1][i] > result[c2][i]) ? (result[c1][i] - result[c2][i]) : (result[c2][i] - result[c1][i]);
- if (diff > MAX_TOLERANCE) {
- if ((i == 2 || i == 6) && !simularity_bit_map) {
- if (result[c1][i] + result[c1][i + 1] == 0)
- final_candidate[(i / 4)] = c2;
- else if (result[c2][i] + result[c2][i + 1] == 0)
- final_candidate[(i / 4)] = c1;
- else
- simularity_bit_map = simularity_bit_map | (1 << i);
- } else
- simularity_bit_map = simularity_bit_map | (1 << i);
- }
- }
-
- if (simularity_bit_map == 0) {
- for (i = 0; i < (bound / 4); i++) {
- if (final_candidate[i] != 0xFF) {
- for (j = i * 4; j < (i + 1) * 4 - 2; j++)
- result[3][j] = result[final_candidate[i]][j];
- is_result = false;
- }
- }
- return is_result;
- } else if (!(simularity_bit_map & 0x0F)) { /* path A OK */
- for (i = 0; i < 4; i++)
- result[3][i] = result[c1][i];
- return false;
- } else if (!(simularity_bit_map & 0xF0) && is2T) { /* path B OK */
- for (i = 4; i < 8; i++)
- result[3][i] = result[c1][i];
- return false;
- } else
- return false;
-
-}
-
-/*
-return false => do IQK again
-*/
-bool
-phy_simularity_compare(
- struct _ADAPTER *p_adapter,
- s32 result[][8],
- u8 c1,
- u8 c2
-)
-{
- return phy_simularity_compare_92c(p_adapter, result, c1, c2);
-
-}
-
-void
-_phy_iq_calibrate_8192c(
- struct _ADAPTER *p_adapter,
- s32 result[][8],
- u8 t,
- bool is2T
-)
-{
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter);
- u32 i;
- u8 path_aok, path_bok;
- u32 ADDA_REG[IQK_ADDA_REG_NUM] = {
- REG_FPGA0_XCD_SWITCH_CONTROL, REG_BLUE_TOOTH,
- REG_RX_WAIT_CCA, REG_TX_CCK_RFON,
- REG_TX_CCK_BBON, REG_TX_OFDM_RFON,
- REG_TX_OFDM_BBON, REG_TX_TO_RX,
- REG_TX_TO_TX, REG_RX_CCK,
- REG_RX_OFDM, REG_RX_WAIT_RIFS,
- REG_RX_TO_RX, REG_STANDBY,
- REG_SLEEP, REG_PMPD_ANAEN
- };
- u32 IQK_MAC_REG[IQK_MAC_REG_NUM] = {
- REG_TXPAUSE, REG_BCN_CTRL,
- REG_BCN_CTRL_1, REG_GPIO_MUXCFG
- };
-
- /* since 92C & 92D have the different define in IQK_BB_REG */
- u32 IQK_BB_REG_92C[IQK_BB_REG_NUM] = {
- REG_OFDM_0_TRX_PATH_ENABLE, REG_OFDM_0_TR_MUX_PAR,
- REG_FPGA0_XCD_RF_INTERFACE_SW, REG_CONFIG_ANT_A, REG_CONFIG_ANT_B,
- REG_FPGA0_XAB_RF_INTERFACE_SW, REG_FPGA0_XA_RF_INTERFACE_OE,
- REG_FPGA0_XB_RF_INTERFACE_OE, /*REG_FPGA0_RFMOD*/ REG_CCK_0_AFE_SETTING
- };
-
- u32 IQK_BB_REG_92D[IQK_BB_REG_NUM_92D] = { /* for normal */
- REG_FPGA0_XAB_RF_INTERFACE_SW, REG_FPGA0_XA_RF_INTERFACE_OE,
- REG_FPGA0_XB_RF_INTERFACE_OE, REG_OFDM_0_TR_MUX_PAR,
- REG_FPGA0_XCD_RF_INTERFACE_SW, REG_OFDM_0_TRX_PATH_ENABLE,
- /*REG_FPGA0_RFMOD*/ REG_CCK_0_AFE_SETTING, REG_FPGA0_ANALOG_PARAMETER4,
- REG_OFDM_0_XA_AGC_CORE1, REG_OFDM_0_XB_AGC_CORE1
- };
-#if MP_DRIVER
- const u32 retry_count = 9;
-#else
- const u32 retry_count = 2;
-#endif
- /* Neil Chen--2011--05--19--
- * 3 path Div */
- u8 rf_path_switch = 0x0;
-
- /* Note: IQ calibration must be performed after loading */
- /* PHY_REG.txt , and radio_a, radio_b.txt */
-
- u32 bbvalue;
-
- if (t == 0) {
- /* bbvalue = phy_query_bb_reg(p_adapter, REG_FPGA0_RFMOD, MASKDWORD); */
- /* RTPRINT(FINIT, INIT_IQK, ("_phy_iq_calibrate_8192c()==>0x%08x\n",bbvalue)); */
-
- RTPRINT(FINIT, INIT_IQK, ("IQ Calibration for %s\n", (is2T ? "2T2R" : "1T1R")));
-
- /* Save ADDA parameters, turn path A ADDA on */
- phy_save_adda_registers(p_adapter, ADDA_REG, p_hal_data->ADDA_backup, IQK_ADDA_REG_NUM);
- phy_save_mac_registers(p_adapter, IQK_MAC_REG, p_hal_data->IQK_MAC_backup);
- phy_save_adda_registers(p_adapter, IQK_BB_REG_92C, p_hal_data->IQK_BB_backup, IQK_BB_REG_NUM);
- }
-
- phy_path_adda_on(p_adapter, ADDA_REG, true, is2T);
-
- if (t == 0)
- p_hal_data->is_rf_pi_enable = (u8)phy_query_bb_reg(p_adapter, REG_FPGA0_XA_HSSI_PARAMETER1, BIT(8));
-
- if (!p_hal_data->is_rf_pi_enable) {
- /* Switch BB to PI mode to do IQ Calibration. */
- phy_pi_mode_switch(p_adapter, true);
- }
-
- /* MAC settings */
- phy_mac_setting_calibration(p_adapter, IQK_MAC_REG, p_hal_data->IQK_MAC_backup);
-
- /* phy_set_bb_reg(p_adapter, REG_FPGA0_RFMOD, BIT24, 0x00); */
- phy_set_bb_reg(p_adapter, REG_CCK_0_AFE_SETTING, MASKDWORD, (0x0f000000 | (phy_query_bb_reg(p_adapter, REG_CCK_0_AFE_SETTING, MASKDWORD))));
- phy_set_bb_reg(p_adapter, REG_OFDM_0_TRX_PATH_ENABLE, MASKDWORD, 0x03a05600);
- phy_set_bb_reg(p_adapter, REG_OFDM_0_TR_MUX_PAR, MASKDWORD, 0x000800e4);
- phy_set_bb_reg(p_adapter, REG_FPGA0_XCD_RF_INTERFACE_SW, MASKDWORD, 0x22204000);
- {
- phy_set_bb_reg(p_adapter, REG_FPGA0_XAB_RF_INTERFACE_SW, BIT(10), 0x01);
- phy_set_bb_reg(p_adapter, REG_FPGA0_XAB_RF_INTERFACE_SW, BIT(26), 0x01);
- phy_set_bb_reg(p_adapter, REG_FPGA0_XA_RF_INTERFACE_OE, BIT(10), 0x00);
- phy_set_bb_reg(p_adapter, REG_FPGA0_XB_RF_INTERFACE_OE, BIT(10), 0x00);
- }
-
- if (is2T) {
- phy_set_bb_reg(p_adapter, REG_FPGA0_XA_LSSI_PARAMETER, MASKDWORD, 0x00010000);
- phy_set_bb_reg(p_adapter, REG_FPGA0_XB_LSSI_PARAMETER, MASKDWORD, 0x00010000);
- }
-
- {
- /* Page B init */
- phy_set_bb_reg(p_adapter, REG_CONFIG_ANT_A, MASKDWORD, 0x00080000);
-
- if (is2T)
- phy_set_bb_reg(p_adapter, REG_CONFIG_ANT_B, MASKDWORD, 0x00080000);
- }
- /* IQ calibration setting */
- RTPRINT(FINIT, INIT_IQK, ("IQK setting!\n"));
- phy_set_bb_reg(p_adapter, REG_FPGA0_IQK, 0xffffff00, 0x808000);
- phy_set_bb_reg(p_adapter, REG_TX_IQK, MASKDWORD, 0x01007c00);
- phy_set_bb_reg(p_adapter, REG_RX_IQK, MASKDWORD, 0x01004800);
-
- for (i = 0 ; i < retry_count ; i++) {
- path_aok = phy_path_a_iqk_8192c(p_adapter, is2T);
- if (path_aok == 0x03) {
- RTPRINT(FINIT, INIT_IQK, ("path A IQK Success!!\n"));
- result[t][0] = (phy_query_bb_reg(p_adapter, REG_TX_POWER_BEFORE_IQK_A, MASKDWORD) & 0x3FF0000) >> 16;
- result[t][1] = (phy_query_bb_reg(p_adapter, REG_TX_POWER_AFTER_IQK_A, MASKDWORD) & 0x3FF0000) >> 16;
- result[t][2] = (phy_query_bb_reg(p_adapter, REG_RX_POWER_BEFORE_IQK_A_2, MASKDWORD) & 0x3FF0000) >> 16;
- result[t][3] = (phy_query_bb_reg(p_adapter, REG_RX_POWER_AFTER_IQK_A_2, MASKDWORD) & 0x3FF0000) >> 16;
- break;
- } else if (i == (retry_count - 1) && path_aok == 0x01) { /* Tx IQK OK */
- RTPRINT(FINIT, INIT_IQK, ("path A IQK Only Tx Success!!\n"));
-
- result[t][0] = (phy_query_bb_reg(p_adapter, REG_TX_POWER_BEFORE_IQK_A, MASKDWORD) & 0x3FF0000) >> 16;
- result[t][1] = (phy_query_bb_reg(p_adapter, REG_TX_POWER_AFTER_IQK_A, MASKDWORD) & 0x3FF0000) >> 16;
- }
- }
-
- if (0x00 == path_aok)
- RTPRINT(FINIT, INIT_IQK, ("path A IQK failed!!\n"));
-
- if (is2T) {
- phy_path_a_stand_by(p_adapter);
-
- /* Turn path B ADDA on */
- phy_path_adda_on(p_adapter, ADDA_REG, false, is2T);
-
- for (i = 0 ; i < retry_count ; i++) {
- path_bok = phy_path_b_iqk_8192c(p_adapter);
- if (path_bok == 0x03) {
- RTPRINT(FINIT, INIT_IQK, ("path B IQK Success!!\n"));
- result[t][4] = (phy_query_bb_reg(p_adapter, REG_TX_POWER_BEFORE_IQK_B, MASKDWORD) & 0x3FF0000) >> 16;
- result[t][5] = (phy_query_bb_reg(p_adapter, REG_TX_POWER_AFTER_IQK_B, MASKDWORD) & 0x3FF0000) >> 16;
- result[t][6] = (phy_query_bb_reg(p_adapter, REG_RX_POWER_BEFORE_IQK_B_2, MASKDWORD) & 0x3FF0000) >> 16;
- result[t][7] = (phy_query_bb_reg(p_adapter, REG_RX_POWER_AFTER_IQK_B_2, MASKDWORD) & 0x3FF0000) >> 16;
- break;
- } else if (i == (retry_count - 1) && path_bok == 0x01) { /* Tx IQK OK */
- RTPRINT(FINIT, INIT_IQK, ("path B Only Tx IQK Success!!\n"));
- result[t][4] = (phy_query_bb_reg(p_adapter, REG_TX_POWER_BEFORE_IQK_B, MASKDWORD) & 0x3FF0000) >> 16;
- result[t][5] = (phy_query_bb_reg(p_adapter, REG_TX_POWER_AFTER_IQK_B, MASKDWORD) & 0x3FF0000) >> 16;
- }
- }
-
- if (0x00 == path_bok)
- RTPRINT(FINIT, INIT_IQK, ("path B IQK failed!!\n"));
- }
-
- /* Back to BB mode, load original value */
- RTPRINT(FINIT, INIT_IQK, ("IQK:Back to BB mode, load original value!\n"));
- phy_set_bb_reg(p_adapter, REG_FPGA0_IQK, 0xffffff00, 0);
-
- if (t != 0) {
- if (!p_hal_data->is_rf_pi_enable) {
- /* Switch back BB to SI mode after finish IQ Calibration. */
- phy_pi_mode_switch(p_adapter, false);
- }
-
- /* Reload ADDA power saving parameters */
- phy_reload_adda_registers(p_adapter, ADDA_REG, p_hal_data->ADDA_backup, IQK_ADDA_REG_NUM);
-
- /* Reload MAC parameters */
- phy_reload_mac_registers(p_adapter, IQK_MAC_REG, p_hal_data->IQK_MAC_backup);
-
- /* Reload BB parameters */
- phy_reload_adda_registers(p_adapter, IQK_BB_REG_92C, p_hal_data->IQK_BB_backup, IQK_BB_REG_NUM);
-
- /*Restore RX initial gain*/
- phy_set_bb_reg(p_adapter, REG_FPGA0_XA_LSSI_PARAMETER, MASKDWORD, 0x00032ed3);
- if (is2T)
- phy_set_bb_reg(p_adapter, REG_FPGA0_XB_LSSI_PARAMETER, MASKDWORD, 0x00032ed3);
- /* load 0xe30 IQC default value */
- phy_set_bb_reg(p_adapter, REG_TX_IQK_TONE_A, MASKDWORD, 0x01008c00);
- phy_set_bb_reg(p_adapter, REG_RX_IQK_TONE_A, MASKDWORD, 0x01008c00);
-
- }
- RTPRINT(FINIT, INIT_IQK, ("_phy_iq_calibrate_8192c() <==\n"));
-
-}
-
-
-void
-_phy_lccalibrate92c(
- struct _ADAPTER *p_adapter,
- bool is2T
-)
-{
- u8 tmp_reg;
- u32 rf_amode = 0, rf_bmode = 0, lc_cal;
- /* HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter); */
-
- /* Check continuous TX and Packet TX */
- tmp_reg = platform_efio_read_1byte(p_adapter, 0xd03);
-
- if ((tmp_reg & 0x70) != 0) /* Deal with contisuous TX case */
- platform_efio_write_1byte(p_adapter, 0xd03, tmp_reg & 0x8F); /* disable all continuous TX */
- else /* Deal with Packet TX case */
- platform_efio_write_1byte(p_adapter, REG_TXPAUSE, 0xFF); /* block all queues */
-
- if ((tmp_reg & 0x70) != 0) {
- /* 1. Read original RF mode */
- /* path-A */
- rf_amode = phy_query_rf_reg(p_adapter, RF_PATH_A, RF_AC, MASK12BITS);
-
- /* path-B */
- if (is2T)
- rf_bmode = phy_query_rf_reg(p_adapter, RF_PATH_B, RF_AC, MASK12BITS);
-
- /* 2. Set RF mode = standby mode */
- /* path-A */
- phy_set_rf_reg(p_adapter, RF_PATH_A, RF_AC, MASK12BITS, (rf_amode & 0x8FFFF) | 0x10000);
-
- /* path-B */
- if (is2T)
- phy_set_rf_reg(p_adapter, RF_PATH_B, RF_AC, MASK12BITS, (rf_bmode & 0x8FFFF) | 0x10000);
- }
-
- /* 3. Read RF reg18 */
- lc_cal = phy_query_rf_reg(p_adapter, RF_PATH_A, RF_CHNLBW, MASK12BITS);
-
- /* 4. Set LC calibration begin bit15 */
- phy_set_rf_reg(p_adapter, RF_PATH_A, RF_CHNLBW, MASK12BITS, lc_cal | 0x08000);
-
- delay_ms(100);
-
-
- /* Restore original situation */
- if ((tmp_reg & 0x70) != 0) { /* Deal with contisuous TX case */
- /* path-A */
- platform_efio_write_1byte(p_adapter, 0xd03, tmp_reg);
- phy_set_rf_reg(p_adapter, RF_PATH_A, RF_AC, MASK12BITS, rf_amode);
-
- /* path-B */
- if (is2T)
- phy_set_rf_reg(p_adapter, RF_PATH_B, RF_AC, MASK12BITS, rf_bmode);
- } else /* Deal with Packet TX case */
- platform_efio_write_1byte(p_adapter, REG_TXPAUSE, 0x00);
-}
-
-
-void
-phy_lc_calibrate(
- struct _ADAPTER *p_adapter,
- bool is2T
-)
-{
- _phy_lccalibrate92c(p_adapter, is2T);
-}
-
-
-
-/* Analog Pre-distortion calibration */
-#define APK_BB_REG_NUM 8
-#define APK_CURVE_REG_NUM 4
-#define PATH_NUM 2
-
-void
-_phy_ap_calibrate_8192c(
- struct _ADAPTER *p_adapter,
- s8 delta,
- bool is2T
-)
-{
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter);
-
- u32 reg_d[PATH_NUM];
- u32 tmp_reg, index, offset, i, apkbound;
- u8 path, pathbound = PATH_NUM;
- u32 BB_backup[APK_BB_REG_NUM];
- u32 BB_REG[APK_BB_REG_NUM] = {
- REG_FPGA1_TX_BLOCK, REG_OFDM_0_TRX_PATH_ENABLE,
- REG_FPGA0_RFMOD, REG_OFDM_0_TR_MUX_PAR,
- REG_FPGA0_XCD_RF_INTERFACE_SW, REG_FPGA0_XAB_RF_INTERFACE_SW,
- REG_FPGA0_XA_RF_INTERFACE_OE, REG_FPGA0_XB_RF_INTERFACE_OE
- };
- u32 BB_AP_MODE[APK_BB_REG_NUM] = {
- 0x00000020, 0x00a05430, 0x02040000,
- 0x000800e4, 0x00204000
- };
- u32 BB_normal_AP_MODE[APK_BB_REG_NUM] = {
- 0x00000020, 0x00a05430, 0x02040000,
- 0x000800e4, 0x22204000
- };
-
- u32 AFE_backup[IQK_ADDA_REG_NUM];
- u32 AFE_REG[IQK_ADDA_REG_NUM] = {
- REG_FPGA0_XCD_SWITCH_CONTROL, REG_BLUE_TOOTH,
- REG_RX_WAIT_CCA, REG_TX_CCK_RFON,
- REG_TX_CCK_BBON, REG_TX_OFDM_RFON,
- REG_TX_OFDM_BBON, REG_TX_TO_RX,
- REG_TX_TO_TX, REG_RX_CCK,
- REG_RX_OFDM, REG_RX_WAIT_RIFS,
- REG_RX_TO_RX, REG_STANDBY,
- REG_SLEEP, REG_PMPD_ANAEN
- };
-
- u32 MAC_backup[IQK_MAC_REG_NUM];
- u32 MAC_REG[IQK_MAC_REG_NUM] = {
- REG_TXPAUSE, REG_BCN_CTRL,
- REG_BCN_CTRL_1, REG_GPIO_MUXCFG
- };
-
- u32 APK_RF_init_value[PATH_NUM][APK_BB_REG_NUM] = {
- {0x0852c, 0x1852c, 0x5852c, 0x1852c, 0x5852c},
- {0x2852e, 0x0852e, 0x3852e, 0x0852e, 0x0852e}
- };
-
- u32 APK_normal_RF_init_value[PATH_NUM][APK_BB_REG_NUM] = {
- {0x0852c, 0x0a52c, 0x3a52c, 0x5a52c, 0x5a52c}, /* path settings equal to path b settings */
- {0x0852c, 0x0a52c, 0x5a52c, 0x5a52c, 0x5a52c}
- };
-
- u32 APK_RF_value_0[PATH_NUM][APK_BB_REG_NUM] = {
- {0x52019, 0x52014, 0x52013, 0x5200f, 0x5208d},
- {0x5201a, 0x52019, 0x52016, 0x52033, 0x52050}
- };
-
- u32 APK_normal_RF_value_0[PATH_NUM][APK_BB_REG_NUM] = {
- {0x52019, 0x52017, 0x52010, 0x5200d, 0x5206a}, /* path settings equal to path b settings */
- {0x52019, 0x52017, 0x52010, 0x5200d, 0x5206a}
- };
-#if 0
- u32 APK_RF_value_A[PATH_NUM][APK_BB_REG_NUM] = {
- {0x1adb0, 0x1adb0, 0x1ada0, 0x1ad90, 0x1ad80},
- {0x00fb0, 0x00fb0, 0x00fa0, 0x00f90, 0x00f80}
- };
-#endif
- u32 AFE_on_off[PATH_NUM] = {
- 0x04db25a4, 0x0b1b25a4
- }; /* path A on path B off / path A off path B on */
-
- u32 APK_offset[PATH_NUM] = {
- REG_CONFIG_ANT_A, REG_CONFIG_ANT_B
- };
-
- u32 APK_normal_offset[PATH_NUM] = {
- REG_CONFIG_PMPD_ANT_A, REG_CONFIG_PMPD_ANT_B
- };
-
- u32 APK_value[PATH_NUM] = {
- 0x92fc0000, 0x12fc0000
- };
-
- u32 APK_normal_value[PATH_NUM] = {
- 0x92680000, 0x12680000
- };
-
- s8 APK_delta_mapping[APK_BB_REG_NUM][13] = {
- {-4, -3, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6},
- {-4, -3, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6},
- {-6, -4, -2, -2, -1, -1, 0, 1, 2, 3, 4, 5, 6},
- {-1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6},
- {-11, -9, -7, -5, -3, -1, 0, 0, 0, 0, 0, 0, 0}
- };
-
- u32 APK_normal_setting_value_1[13] = {
- 0x01017018, 0xf7ed8f84, 0x1b1a1816, 0x2522201e, 0x322e2b28,
- 0x433f3a36, 0x5b544e49, 0x7b726a62, 0xa69a8f84, 0xdfcfc0b3,
- 0x12680000, 0x00880000, 0x00880000
- };
-
- u32 APK_normal_setting_value_2[16] = {
- 0x01c7021d, 0x01670183, 0x01000123, 0x00bf00e2, 0x008d00a3,
- 0x0068007b, 0x004d0059, 0x003a0042, 0x002b0031, 0x001f0025,
- 0x0017001b, 0x00110014, 0x000c000f, 0x0009000b, 0x00070008,
- 0x00050006
- };
-
- u32 APK_result[PATH_NUM][APK_BB_REG_NUM]; /* val_1_1a, val_1_2a, val_2a, val_3a, val_4a
- * u32 AP_curve[PATH_NUM][APK_CURVE_REG_NUM]; */
-
- s32 BB_offset, delta_V, delta_offset;
-
-#if MP_DRIVER == 1
- PMPT_CONTEXT p_mpt_ctx = &(p_adapter->mpt_ctx);
-
- p_mpt_ctx->APK_bound[0] = 45;
- p_mpt_ctx->APK_bound[1] = 52;
-#endif
-
- RTPRINT(FINIT, INIT_IQK, ("==>_phy_ap_calibrate_8192c() delta %d\n", delta));
- RTPRINT(FINIT, INIT_IQK, ("AP Calibration for %s\n", (is2T ? "2T2R" : "1T1R")));
- if (!is2T)
- pathbound = 1;
-
- /* 2 FOR NORMAL CHIP SETTINGS */
-
- /* Temporarily do not allow normal driver to do the following settings because these offset
- * and value will cause RF internal PA to be unpredictably disabled by HW, such that RF Tx signal
- * will disappear after disable/enable card many times on 88CU. RF SD and DD have not find the
- * root cause, so we remove these actions temporarily. Added by tynli and SD3 Allen. 2010.05.31. */
-#if MP_DRIVER != 1
- return;
-#endif
- /* settings adjust for normal chip */
- for (index = 0; index < PATH_NUM; index++) {
- APK_offset[index] = APK_normal_offset[index];
- APK_value[index] = APK_normal_value[index];
- AFE_on_off[index] = 0x6fdb25a4;
- }
-
- for (index = 0; index < APK_BB_REG_NUM; index++) {
- for (path = 0; path < pathbound; path++) {
- APK_RF_init_value[path][index] = APK_normal_RF_init_value[path][index];
- APK_RF_value_0[path][index] = APK_normal_RF_value_0[path][index];
- }
- BB_AP_MODE[index] = BB_normal_AP_MODE[index];
- }
-
- apkbound = 6;
-
- /* save BB default value */
- for (index = 0; index < APK_BB_REG_NUM ; index++) {
- if (index == 0) /* skip */
- continue;
- BB_backup[index] = phy_query_bb_reg(p_adapter, BB_REG[index], MASKDWORD);
- }
-
- /* save MAC default value */
- phy_save_mac_registers(p_adapter, MAC_REG, MAC_backup);
-
- /* save AFE default value */
- phy_save_adda_registers(p_adapter, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
-
- for (path = 0; path < pathbound; path++) {
-
-
- if (path == RF_PATH_A) {
- /* path A APK */
- /* load APK setting */
- /* path-A */
- offset = REG_PDP_ANT_A;
- for (index = 0; index < 11; index++) {
- phy_set_bb_reg(p_adapter, offset, MASKDWORD, APK_normal_setting_value_1[index]);
- RTPRINT(FINIT, INIT_IQK, ("_phy_ap_calibrate_8192c() offset 0x%x value 0x%x\n", offset, phy_query_bb_reg(p_adapter, offset, MASKDWORD)));
-
- offset += 0x04;
- }
-
- phy_set_bb_reg(p_adapter, REG_CONFIG_PMPD_ANT_B, MASKDWORD, 0x12680000);
-
- offset = REG_CONFIG_ANT_A;
- for (; index < 13; index++) {
- phy_set_bb_reg(p_adapter, offset, MASKDWORD, APK_normal_setting_value_1[index]);
- RTPRINT(FINIT, INIT_IQK, ("_phy_ap_calibrate_8192c() offset 0x%x value 0x%x\n", offset, phy_query_bb_reg(p_adapter, offset, MASKDWORD)));
-
- offset += 0x04;
- }
-
- /* page-B1 */
- phy_set_bb_reg(p_adapter, REG_FPGA0_IQK, 0xffffff00, 0x400000);
-
- /* path A */
- offset = REG_PDP_ANT_A;
- for (index = 0; index < 16; index++) {
- phy_set_bb_reg(p_adapter, offset, MASKDWORD, APK_normal_setting_value_2[index]);
- RTPRINT(FINIT, INIT_IQK, ("_phy_ap_calibrate_8192c() offset 0x%x value 0x%x\n", offset, phy_query_bb_reg(p_adapter, offset, MASKDWORD)));
-
- offset += 0x04;
- }
- phy_set_bb_reg(p_adapter, REG_FPGA0_IQK, 0xffffff00, 0);
- } else if (path == RF_PATH_B) {
- /* path B APK */
- /* load APK setting */
- /* path-B */
- offset = REG_PDP_ANT_B;
- for (index = 0; index < 10; index++) {
- phy_set_bb_reg(p_adapter, offset, MASKDWORD, APK_normal_setting_value_1[index]);
- RTPRINT(FINIT, INIT_IQK, ("_phy_ap_calibrate_8192c() offset 0x%x value 0x%x\n", offset, phy_query_bb_reg(p_adapter, offset, MASKDWORD)));
-
- offset += 0x04;
- }
- phy_set_bb_reg(p_adapter, REG_CONFIG_PMPD_ANT_A, MASKDWORD, 0x12680000);
-
- phy_set_bb_reg(p_adapter, REG_CONFIG_PMPD_ANT_B, MASKDWORD, 0x12680000);
-
- offset = REG_CONFIG_ANT_A;
- index = 11;
- for (; index < 13; index++) { /* offset 0xb68, 0xb6c */
- phy_set_bb_reg(p_adapter, offset, MASKDWORD, APK_normal_setting_value_1[index]);
- RTPRINT(FINIT, INIT_IQK, ("_phy_ap_calibrate_8192c() offset 0x%x value 0x%x\n", offset, phy_query_bb_reg(p_adapter, offset, MASKDWORD)));
-
- offset += 0x04;
- }
-
- /* page-B1 */
- phy_set_bb_reg(p_adapter, REG_FPGA0_IQK, 0xffffff00, 0x400000);
-
- /* path B */
- offset = 0xb60;
- for (index = 0; index < 16; index++) {
- phy_set_bb_reg(p_adapter, offset, MASKDWORD, APK_normal_setting_value_2[index]);
- RTPRINT(FINIT, INIT_IQK, ("_phy_ap_calibrate_8192c() offset 0x%x value 0x%x\n", offset, phy_query_bb_reg(p_adapter, offset, MASKDWORD)));
-
- offset += 0x04;
- }
- phy_set_bb_reg(p_adapter, REG_FPGA0_IQK, 0xffffff00, 0);
- }
-
- /* save RF default value */
- reg_d[path] = phy_query_rf_reg(p_adapter, path, RF_TXBIAS_A, RFREGOFFSETMASK);
-
- /* path A AFE all on, path B AFE All off or vise versa */
- for (index = 0; index < IQK_ADDA_REG_NUM ; index++)
- phy_set_bb_reg(p_adapter, AFE_REG[index], MASKDWORD, AFE_on_off[path]);
- RTPRINT(FINIT, INIT_IQK, ("_phy_ap_calibrate_8192c() offset 0xe70 %x\n", phy_query_bb_reg(p_adapter, REG_RX_WAIT_CCA, MASKDWORD)));
-
- /* BB to AP mode */
- if (path == 0) {
- for (index = 0; index < APK_BB_REG_NUM ; index++) {
-
- if (index == 0) /* skip */
- continue;
- else if (index < 5)
- phy_set_bb_reg(p_adapter, BB_REG[index], MASKDWORD, BB_AP_MODE[index]);
- else if (BB_REG[index] == 0x870)
- phy_set_bb_reg(p_adapter, BB_REG[index], MASKDWORD, BB_backup[index] | BIT(10) | BIT(26));
- else
- phy_set_bb_reg(p_adapter, BB_REG[index], BIT(10), 0x0);
- }
-
- phy_set_bb_reg(p_adapter, REG_TX_IQK_TONE_A, MASKDWORD, 0x01008c00);
- phy_set_bb_reg(p_adapter, REG_RX_IQK_TONE_A, MASKDWORD, 0x01008c00);
- } else { /* path B */
- phy_set_bb_reg(p_adapter, REG_TX_IQK_TONE_B, MASKDWORD, 0x01008c00);
- phy_set_bb_reg(p_adapter, REG_RX_IQK_TONE_B, MASKDWORD, 0x01008c00);
-
- }
-
- RTPRINT(FINIT, INIT_IQK, ("_phy_ap_calibrate_8192c() offset 0x800 %x\n", phy_query_bb_reg(p_adapter, 0x800, MASKDWORD)));
-
- /* MAC settings */
- phy_mac_setting_calibration(p_adapter, MAC_REG, MAC_backup);
-
- if (path == RF_PATH_A) /* path B to standby mode */
- phy_set_rf_reg(p_adapter, RF_PATH_B, RF_AC, RFREGOFFSETMASK, 0x10000);
- else { /* path A to standby mode */
- phy_set_rf_reg(p_adapter, RF_PATH_A, RF_AC, RFREGOFFSETMASK, 0x10000);
- phy_set_rf_reg(p_adapter, RF_PATH_A, RF_MODE1, RFREGOFFSETMASK, 0x1000f);
- phy_set_rf_reg(p_adapter, RF_PATH_A, RF_MODE2, RFREGOFFSETMASK, 0x20103);
- }
-
- delta_offset = ((delta + 14) / 2);
- if (delta_offset < 0)
- delta_offset = 0;
- else if (delta_offset > 12)
- delta_offset = 12;
-
- /* AP calibration */
- for (index = 0; index < APK_BB_REG_NUM; index++) {
- if (index != 1) /* only DO PA11+PAD01001, AP RF setting */
- continue;
-
- tmp_reg = APK_RF_init_value[path][index];
-#if 1
- if (!p_hal_data->is_apk_thermal_meter_ignore) {
- BB_offset = (tmp_reg & 0xF0000) >> 16;
-
- if (!(tmp_reg & BIT(15))) /* sign bit 0 */
- BB_offset = -BB_offset;
-
- delta_V = APK_delta_mapping[index][delta_offset];
-
- BB_offset += delta_V;
-
- RTPRINT(FINIT, INIT_IQK, ("_phy_ap_calibrate_8192c() APK index %d tmp_reg 0x%x delta_V %d delta_offset %d\n", index, tmp_reg, delta_V, delta_offset));
-
- if (BB_offset < 0) {
- tmp_reg = tmp_reg & (~BIT(15));
- BB_offset = -BB_offset;
- } else
- tmp_reg = tmp_reg | BIT(15);
- tmp_reg = (tmp_reg & 0xFFF0FFFF) | (BB_offset << 16);
- }
-#endif
-
-#if DEV_BUS_TYPE == RT_PCI_INTERFACE
- if (IS_81xxC_VENDOR_UMC_B_CUT(p_hal_data->version_id))
- phy_set_rf_reg(p_adapter, path, RF_IPA_A, RFREGOFFSETMASK, 0x894ae);
- else
-#endif
- phy_set_rf_reg(p_adapter, path, RF_IPA_A, RFREGOFFSETMASK, 0x8992e);
- RTPRINT(FINIT, INIT_IQK, ("_phy_ap_calibrate_8192c() offset 0xc %x\n", phy_query_rf_reg(p_adapter, path, RF_IPA_A, RFREGOFFSETMASK)));
- phy_set_rf_reg(p_adapter, path, RF_AC, RFREGOFFSETMASK, APK_RF_value_0[path][index]);
- RTPRINT(FINIT, INIT_IQK, ("_phy_ap_calibrate_8192c() offset 0x0 %x\n", phy_query_rf_reg(p_adapter, path, RF_AC, RFREGOFFSETMASK)));
- phy_set_rf_reg(p_adapter, path, RF_TXBIAS_A, RFREGOFFSETMASK, tmp_reg);
- RTPRINT(FINIT, INIT_IQK, ("_phy_ap_calibrate_8192c() offset 0xd %x\n", phy_query_rf_reg(p_adapter, path, RF_TXBIAS_A, RFREGOFFSETMASK)));
-
- /* PA11+PAD01111, one shot */
- i = 0;
- do {
- phy_set_bb_reg(p_adapter, REG_FPGA0_IQK, 0xffffff00, 0x800000);
- {
- phy_set_bb_reg(p_adapter, APK_offset[path], MASKDWORD, APK_value[0]);
- RTPRINT(FINIT, INIT_IQK, ("_phy_ap_calibrate_8192c() offset 0x%x value 0x%x\n", APK_offset[path], phy_query_bb_reg(p_adapter, APK_offset[path], MASKDWORD)));
- delay_ms(3);
- phy_set_bb_reg(p_adapter, APK_offset[path], MASKDWORD, APK_value[1]);
- RTPRINT(FINIT, INIT_IQK, ("_phy_ap_calibrate_8192c() offset 0x%x value 0x%x\n", APK_offset[path], phy_query_bb_reg(p_adapter, APK_offset[path], MASKDWORD)));
-
- delay_ms(20);
- }
- phy_set_bb_reg(p_adapter, REG_FPGA0_IQK, 0xffffff00, 0);
-
- if (path == RF_PATH_A)
- tmp_reg = phy_query_bb_reg(p_adapter, REG_APK, 0x03E00000);
- else
- tmp_reg = phy_query_bb_reg(p_adapter, REG_APK, 0xF8000000);
- RTPRINT(FINIT, INIT_IQK, ("_phy_ap_calibrate_8192c() offset 0xbd8[25:21] %x\n", tmp_reg));
-
-
- i++;
- } while (tmp_reg > apkbound && i < 4);
-
- APK_result[path][index] = tmp_reg;
- }
- }
-
- /* reload MAC default value */
- phy_reload_mac_registers(p_adapter, MAC_REG, MAC_backup);
-
- /* reload BB default value */
- for (index = 0; index < APK_BB_REG_NUM ; index++) {
-
- if (index == 0) /* skip */
- continue;
- phy_set_bb_reg(p_adapter, BB_REG[index], MASKDWORD, BB_backup[index]);
- }
-
- /* reload AFE default value */
- phy_reload_adda_registers(p_adapter, AFE_REG, AFE_backup, IQK_ADDA_REG_NUM);
-
- /* reload RF path default value */
- for (path = 0; path < pathbound; path++) {
- phy_set_rf_reg(p_adapter, path, RF_TXBIAS_A, RFREGOFFSETMASK, reg_d[path]);
- if (path == RF_PATH_B) {
- phy_set_rf_reg(p_adapter, RF_PATH_A, RF_MODE1, RFREGOFFSETMASK, 0x1000f);
- phy_set_rf_reg(p_adapter, RF_PATH_A, RF_MODE2, RFREGOFFSETMASK, 0x20101);
- }
-
- /* note no index == 0 */
- if (APK_result[path][1] > 6)
- APK_result[path][1] = 6;
- RTPRINT(FINIT, INIT_IQK, ("apk path %d result %d 0x%x \t", path, 1, APK_result[path][1]));
- }
-
- RTPRINT(FINIT, INIT_IQK, ("\n"));
-
-
- for (path = 0; path < pathbound; path++) {
- phy_set_rf_reg(p_adapter, path, RF_BS_PA_APSET_G1_G4, RFREGOFFSETMASK,
- ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (APK_result[path][1] << 5) | APK_result[path][1]));
- if (path == RF_PATH_A)
- phy_set_rf_reg(p_adapter, path, RF_BS_PA_APSET_G5_G8, RFREGOFFSETMASK,
- ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (0x00 << 5) | 0x05));
- else
- phy_set_rf_reg(p_adapter, path, RF_BS_PA_APSET_G5_G8, RFREGOFFSETMASK,
- ((APK_result[path][1] << 15) | (APK_result[path][1] << 10) | (0x02 << 5) | 0x05));
-
- phy_set_rf_reg(p_adapter, path, RF_BS_PA_APSET_G9_G11, RFREGOFFSETMASK, ((0x08 << 15) | (0x08 << 10) | (0x08 << 5) | 0x08));
- }
-
- p_hal_data->is_ap_kdone = true;
-
- RTPRINT(FINIT, INIT_IQK, ("<==_phy_ap_calibrate_8192c()\n"));
-}
-
-
-void
-phy_iq_calibrate_8192c(
- struct _ADAPTER *p_adapter,
- bool is_recovery
-)
-{
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter);
- s32 result[4][8]; /* last is final result */
- u8 i, final_candidate, indexforchannel;
- bool is_patha_ok, is_pathb_ok;
- s32 rege94, rege9c, regea4, regeac, regeb4, regebc, regec4, regecc, reg_tmp = 0;
- bool is12simular, is13simular, is23simular;
- bool is_start_cont_tx = false, is_single_tone = false, is_carrier_suppression = false;
- u32 IQK_BB_REG_92C[IQK_BB_REG_NUM] = {
- REG_OFDM_0_XA_RX_IQ_IMBALANCE, REG_OFDM_0_XB_RX_IQ_IMBALANCE,
- REG_OFDM_0_ECCA_THRESHOLD, REG_OFDM_0_AGC_RSSI_TABLE,
- REG_OFDM_0_XA_TX_IQ_IMBALANCE, REG_OFDM_0_XB_TX_IQ_IMBALANCE,
- REG_OFDM_0_XC_TX_AFE, REG_OFDM_0_XD_TX_AFE,
- REG_OFDM_0_RX_IQ_EXT_ANTA
- };
-
- if (odm_check_power_status(p_adapter) == false)
- return;
-
-#if MP_DRIVER == 1
- is_start_cont_tx = p_adapter->mpt_ctx.is_start_cont_tx;
- is_single_tone = p_adapter->mpt_ctx.is_single_tone;
- is_carrier_suppression = p_adapter->mpt_ctx.is_carrier_suppression;
-#endif
-
- /* ignore IQK when continuous Tx */
- if (is_start_cont_tx || is_single_tone || is_carrier_suppression)
- return;
-
-#ifdef DISABLE_BB_RF
- return;
-#endif
- if (p_adapter->is_slave_of_dmsp)
- return;
-
- if (is_recovery) {
- phy_reload_adda_registers(p_adapter, IQK_BB_REG_92C, p_hal_data->IQK_BB_backup_recover, 9);
- return;
-
- }
-
- RTPRINT(FINIT, INIT_IQK, ("IQK:Start!!!\n"));
-
- for (i = 0; i < 8; i++) {
- result[0][i] = 0;
- result[1][i] = 0;
- result[2][i] = 0;
- result[3][i] = 0;
- }
- final_candidate = 0xff;
- is_patha_ok = false;
- is_pathb_ok = false;
- is12simular = false;
- is23simular = false;
- is13simular = false;
-
- acquire_cck_and_rw_page_a_control(p_adapter);
- /*RT_TRACE(COMP_INIT,DBG_LOUD,("Acquire Mutex in IQCalibrate\n"));*/
- for (i = 0; i < 3; i++) {
- /*For 88C 1T1R*/
- _phy_iq_calibrate_8192c(p_adapter, result, i, false);
-
- if (i == 1) {
- is12simular = phy_simularity_compare(p_adapter, result, 0, 1);
- if (is12simular) {
- final_candidate = 0;
- break;
- }
- }
-
- if (i == 2) {
- is13simular = phy_simularity_compare(p_adapter, result, 0, 2);
- if (is13simular) {
- final_candidate = 0;
- break;
- }
-
- is23simular = phy_simularity_compare(p_adapter, result, 1, 2);
- if (is23simular)
- final_candidate = 1;
- else {
- for (i = 0; i < 8; i++)
- reg_tmp += result[3][i];
-
- if (reg_tmp != 0)
- final_candidate = 3;
- else
- final_candidate = 0xFF;
- }
- }
- }
- /* RT_TRACE(COMP_INIT,DBG_LOUD,("Release Mutex in IQCalibrate\n")); */
- release_cck_and_rw_pagea_control(p_adapter);
-
- for (i = 0; i < 4; i++) {
- rege94 = result[i][0];
- rege9c = result[i][1];
- regea4 = result[i][2];
- regeac = result[i][3];
- regeb4 = result[i][4];
- regebc = result[i][5];
- regec4 = result[i][6];
- regecc = result[i][7];
- RTPRINT(FINIT, INIT_IQK, ("IQK: rege94=%x rege9c=%x regea4=%x regeac=%x regeb4=%x regebc=%x regec4=%x regecc=%x\n ", rege94, rege9c, regea4, regeac, regeb4, regebc, regec4, regecc));
- }
-
- if (final_candidate != 0xff) {
- p_hal_data->rege94 = rege94 = result[final_candidate][0];
- p_hal_data->rege9c = rege9c = result[final_candidate][1];
- regea4 = result[final_candidate][2];
- regeac = result[final_candidate][3];
- p_hal_data->regeb4 = regeb4 = result[final_candidate][4];
- p_hal_data->regebc = regebc = result[final_candidate][5];
- regec4 = result[final_candidate][6];
- regecc = result[final_candidate][7];
- RTPRINT(FINIT, INIT_IQK, ("IQK: final_candidate is %x\n", final_candidate));
- RTPRINT(FINIT, INIT_IQK, ("IQK: rege94=%x rege9c=%x regea4=%x regeac=%x regeb4=%x regebc=%x regec4=%x regecc=%x\n ", rege94, rege9c, regea4, regeac, regeb4, regebc, regec4, regecc));
- is_patha_ok = is_pathb_ok = true;
- } else {
- rege94 = regeb4 = p_hal_data->rege94 = p_hal_data->regeb4 = 0x100; /* X default value */
- rege9c = regebc = p_hal_data->rege9c = p_hal_data->regebc = 0x0; /* Y default value */
- }
-
- if ((rege94 != 0)/*&&(regea4 != 0)*/) {
- if (p_hal_data->current_band_type == BAND_ON_5G)
- phy_path_a_fill_iqk_matrix_5g_normal(p_adapter, is_patha_ok, result, final_candidate, (regea4 == 0));
- else
- phy_path_a_fill_iqk_matrix(p_adapter, is_patha_ok, result, final_candidate, (regea4 == 0));
-
- }
-
- if (IS_92C_SERIAL(p_hal_data->version_id) || IS_92D_SINGLEPHY(p_hal_data->version_id)) {
- if ((regeb4 != 0)/*&&(regec4 != 0)*/) {
- if (p_hal_data->current_band_type == BAND_ON_5G)
- phy_path_b_fill_iqk_matrix_5g_normal(p_adapter, is_pathb_ok, result, final_candidate, (regec4 == 0));
- else
- phy_path_b_fill_iqk_matrix(p_adapter, is_pathb_ok, result, final_candidate, (regec4 == 0));
- }
- }
-
- phy_save_adda_registers(p_adapter, IQK_BB_REG_92C, p_hal_data->IQK_BB_backup_recover, 9);
-
-}
-
-
-void
-phy_lc_calibrate_8192c(
- struct _ADAPTER *p_adapter
-)
-{
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter);
- bool is_start_cont_tx = false, is_single_tone = false, is_carrier_suppression = false;
- PMGNT_INFO p_mgnt_info = &p_adapter->MgntInfo;
- PMGNT_INFO p_mgnt_info_buddy_adapter;
- u32 timeout = 2000, timecount = 0;
- struct _ADAPTER *buddy_adapter = p_adapter->buddy_adapter;
-
-#if MP_DRIVER == 1
- is_start_cont_tx = p_adapter->mpt_ctx.is_start_cont_tx;
- is_single_tone = p_adapter->mpt_ctx.is_single_tone;
- is_carrier_suppression = p_adapter->mpt_ctx.is_carrier_suppression;
-#endif
-
-#ifdef DISABLE_BB_RF
- return;
-#endif
-
- /* ignore LCK when continuous Tx */
- if (is_start_cont_tx || is_single_tone || is_carrier_suppression)
- return;
-
- if (buddy_adapter != NULL &&
- ((p_adapter->interface_index == 0 && p_hal_data->current_band_type == BAND_ON_2_4G) ||
- (p_adapter->interface_index == 1 && p_hal_data->current_band_type == BAND_ON_5G))) {
- p_mgnt_info_buddy_adapter = &buddy_adapter->MgntInfo;
- while (p_mgnt_info_buddy_adapter->is_scan_in_progress && timecount < timeout) {
- delay_ms(50);
- timecount += 50;
- }
- }
-
- while (p_mgnt_info->is_scan_in_progress && timecount < timeout) {
- delay_ms(50);
- timecount += 50;
- }
-
- p_hal_data->is_lck_in_progress = true;
-
- RTPRINT(FINIT, INIT_IQK, ("LCK:Start!!!interface %d currentband %x delay %d ms\n", p_adapter->interface_index, p_hal_data->current_band_type, timecount));
-
- /* if(IS_92C_SERIAL(p_hal_data->version_id) || IS_92D_SINGLEPHY(p_hal_data->version_id)) */
- if (IS_2T2R(p_hal_data->version_id))
- phy_lc_calibrate(p_adapter, true);
- else {
- /* For 88C 1T1R */
- phy_lc_calibrate(p_adapter, false);
- }
-
- p_hal_data->is_lck_in_progress = false;
-
- RTPRINT(FINIT, INIT_IQK, ("LCK:Finish!!!interface %d\n", p_adapter->interface_index));
-
-
-}
-
-void
-phy_ap_calibrate_8192c(
- struct _ADAPTER *p_adapter,
- s8 delta
-)
-{
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter);
-
- /* default disable APK, because Tx NG issue, suggest by Jenyu, 2011.11.25 */
- return;
-
-#ifdef DISABLE_BB_RF
- return;
-#endif
-
-#if FOR_BRAZIL_PRETEST != 1
- if (p_hal_data->is_ap_kdone)
-#endif
- return;
-
- if (IS_92C_SERIAL(p_hal_data->version_id))
- _phy_ap_calibrate_8192c(p_adapter, delta, true);
- else {
- /* For 88C 1T1R */
- _phy_ap_calibrate_8192c(p_adapter, delta, false);
- }
-}
-
-
-#endif
-
-
-/* 3============================================================
- * 3 IQ Calibration
- * 3============================================================ */
-
-void
-odm_reset_iqk_result(
- void *p_dm_void
-)
-{
- return;
-}
-#if 1/* !(DM_ODM_SUPPORT_TYPE & ODM_AP) */
-u8 odm_get_right_chnl_place_for_iqk(u8 chnl)
-{
- u8 channel_all[ODM_TARGET_CHNL_NUM_2G_5G] = {
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 149, 151, 153, 155, 157, 159, 161, 163, 165
- };
- u8 place = chnl;
-
-
- if (chnl > 14) {
- for (place = 14; place < sizeof(channel_all); place++) {
- if (channel_all[place] == chnl)
- return place - 13;
- }
- }
- return 0;
-
-}
-#endif
-
-void
-odm_iq_calibrate(
- struct PHY_DM_STRUCT *p_dm_odm
-)
-{
- struct _ADAPTER *adapter = p_dm_odm->adapter;
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if (*p_dm_odm->p_is_fcs_mode_enable)
- return;
-#endif
-
-
-
- if (p_dm_odm->is_linked) {
- if ((*p_dm_odm->p_channel != p_dm_odm->pre_channel) && (!*p_dm_odm->p_is_scan_in_process)) {
- p_dm_odm->pre_channel = *p_dm_odm->p_channel;
- p_dm_odm->linked_interval = 0;
- }
-
- if (p_dm_odm->linked_interval < 3)
- p_dm_odm->linked_interval++;
-
- if (p_dm_odm->linked_interval == 2) {
-
-#if (RTL8814A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8814A)
- phy_iq_calibrate_8814a(p_dm_odm, false);
-#endif
-
-#if (RTL8822B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8822B)
- phy_iq_calibrate_8822b(p_dm_odm, false);
-#endif
-
-#if (RTL8821C_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8821C)
- phy_iq_calibrate_8821c(p_dm_odm, false);
-#endif
-
-#if (RTL8821A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8821)
- phy_iq_calibrate_8821a(p_dm_odm, false);
-#endif
-
-#if (RTL8812A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8812)
- _phy_iq_calibrate_8812a(p_dm_odm, false);
-#endif
- }
- } else
- p_dm_odm->linked_interval = 0;
-
-}
-
-void phydm_rf_init(void *p_dm_void)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- odm_txpowertracking_init(p_dm_odm);
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
- odm_clear_txpowertracking_state(p_dm_odm);
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-#if (RTL8814A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type & ODM_RTL8814A)
- phy_iq_calibrate_8814a_init(p_dm_odm);
-#endif
-#endif
-
-}
-
-void phydm_rf_watchdog(void *p_dm_void)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
- odm_txpowertracking_check(p_dm_odm);
- if (p_dm_odm->support_ic_type & ODM_IC_11AC_SERIES)
- odm_iq_calibrate(p_dm_odm);
-#endif
-}
diff --git a/hal/phydm/halphyrf_ap.h b/hal/phydm/halphyrf_ap.h
index 30017f1..4ab2b96 100644
--- a/hal/phydm/halphyrf_ap.h
+++ b/hal/phydm/halphyrf_ap.h
@@ -22,17 +22,6 @@
#define __HAL_PHY_RF_H__
#include "phydm_powertracking_ap.h"
-#if (RTL8814A_SUPPORT == 1)
- #include "rtl8814a/phydm_iqk_8814a.h"
-#endif
-
-#if (RTL8822B_SUPPORT == 1)
- #include "rtl8822b/phydm_iqk_8822b.h"
-#endif
-
-#if (RTL8821C_SUPPORT == 1)
- #include "rtl8822b/phydm_iqk_8821c.h"
-#endif
enum pwrtrack_method {
BBSWING,
@@ -75,52 +64,25 @@ configure_txpower_track(
void
odm_txpowertracking_callback_thermal_meter(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- void *p_dm_void
-#else
struct _ADAPTER *adapter
-#endif
);
-#if (RTL8192E_SUPPORT == 1)
-void
-odm_txpowertracking_callback_thermal_meter_92e(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- void *p_dm_void
-#else
- struct _ADAPTER *adapter
-#endif
-);
-#endif
-
#if (RTL8814A_SUPPORT == 1)
void
odm_txpowertracking_callback_thermal_meter_jaguar_series2(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- void *p_dm_void
-#else
struct _ADAPTER *adapter
-#endif
);
#elif ODM_IC_11AC_SERIES_SUPPORT
void
odm_txpowertracking_callback_thermal_meter_jaguar_series(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- void *p_dm_void
-#else
struct _ADAPTER *adapter
-#endif
);
#elif (RTL8197F_SUPPORT == 1 || RTL8822B_SUPPORT == 1)
void
odm_txpowertracking_callback_thermal_meter_jaguar_series3(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- void *p_dm_void
-#else
struct _ADAPTER *adapter
-#endif
);
#endif
@@ -128,41 +90,8 @@ odm_txpowertracking_callback_thermal_meter_jaguar_series3(
#define IS_CCK_RATE(_rate) (ODM_MGN_1M == _rate || _rate == ODM_MGN_2M || _rate == ODM_MGN_5_5M || _rate == ODM_MGN_11M)
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-#define MAX_TOLERANCE 5
-#define IQK_DELAY_TIME 1 /* ms */
-
-/*
-* BB/MAC/RF other monitor API
-* */
-
-void phy_set_monitor_mode8192c(struct _ADAPTER *p_adapter,
- bool is_enable_monitor_mode);
-
-/*
- * IQ calibrate
- * */
-void
-phy_iq_calibrate_8192c(struct _ADAPTER *p_adapter,
- bool is_recovery);
-
-/*
- * LC calibrate
- * */
-void
-phy_lc_calibrate_8192c(struct _ADAPTER *p_adapter);
-
-/*
- * AP calibrate
- * */
-void
-phy_ap_calibrate_8192c(struct _ADAPTER *p_adapter,
- s8 delta);
-#endif
-
#define ODM_TARGET_CHNL_NUM_2G_5G 59
-
void
odm_reset_iqk_result(
void *p_dm_void
diff --git a/hal/phydm/halphyrf_ce.c b/hal/phydm/halphyrf_ce.c
index cc194ae..07da53a 100644
--- a/hal/phydm/halphyrf_ce.c
+++ b/hal/phydm/halphyrf_ce.c
@@ -144,37 +144,22 @@ odm_clear_txpowertracking_state(
void
odm_txpowertracking_callback_thermal_meter(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- struct PHY_DM_STRUCT *p_dm_odm
-#else
struct _ADAPTER *adapter
-#endif
)
{
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->odmpriv;
-#endif
-#endif
-
struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm_odm->rf_calibrate_info);
-
u8 thermal_value = 0, delta, delta_LCK, delta_IQK, p = 0, i = 0;
s8 diff_DPK[4] = {0};
u8 thermal_value_avg_count = 0;
u32 thermal_value_avg = 0, regc80, regcd0, regcd4, regab4;
-
u8 OFDM_min_index = 0; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */
u8 indexforchannel = 0; /* get_right_chnl_place_for_iqk(p_hal_data->current_channel) */
u8 power_tracking_type = p_hal_data->rf_power_tracking_type;
u8 xtal_offset_eanble = 0;
-
struct _TXPWRTRACK_CFG c;
-
/* 4 1. The following TWO tables decide the final index of OFDM/CCK swing table. */
u8 *delta_swing_table_idx_tup_a = NULL;
u8 *delta_swing_table_idx_tdown_a = NULL;
@@ -209,14 +194,8 @@ odm_txpowertracking_callback_thermal_meter(
/*p_rf_calibrate_info->txpowertrack_control = p_hal_data->txpowertrack_control;
We should keep updating the control variable according to HalData.
rf_calibrate_info.rega24 will be initialized when ODM HW configuring, but MP configures with para files. */
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-#if (MP_DRIVER == 1)
- p_rf_calibrate_info->rega24 = 0x090e1317;
-#endif
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
if (p_dm_odm->mp_mode == true)
p_rf_calibrate_info->rega24 = 0x090e1317;
-#endif
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
("===>odm_txpowertracking_callback_thermal_meter\n p_rf_calibrate_info->bb_swing_idx_cck_base: %d, p_rf_calibrate_info->bb_swing_idx_ofdm_base[A]: %d, p_rf_calibrate_info->default_ofdm_index: %d\n",
@@ -316,22 +295,13 @@ odm_txpowertracking_callback_thermal_meter(
if (delta > 0 && p_rf_calibrate_info->txpowertrack_control) {
/* "delta" here is used to record the absolute value of differrence. */
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
delta = thermal_value > p_hal_data->eeprom_thermal_meter ? (thermal_value - p_hal_data->eeprom_thermal_meter) : (p_hal_data->eeprom_thermal_meter - thermal_value);
-#else
- delta = (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther) ? (thermal_value - p_dm_odm->priv->pmib->dot11RFEntry.ther) : (p_dm_odm->priv->pmib->dot11RFEntry.ther - thermal_value);
-#endif
if (delta >= TXPWR_TRACK_TABLE_SIZE)
delta = TXPWR_TRACK_TABLE_SIZE - 1;
/*4 7.1 The Final Power index = BaseIndex + power_index_offset*/
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
if (thermal_value > p_hal_data->eeprom_thermal_meter) {
-#else
- if (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther) {
-#endif
-
for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
p_rf_calibrate_info->delta_power_index_last[p] = p_rf_calibrate_info->delta_power_index[p]; /*recording poer index offset*/
switch (p) {
@@ -556,12 +526,7 @@ odm_txpowertracking_callback_thermal_meter(
}
}
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- if (thermal_value > p_hal_data->eeprom_thermal_meter)
-#else
- if (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther)
-#endif
- {
+ if (thermal_value > p_hal_data->eeprom_thermal_meter) {
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
("Temperature(%d) higher than PG value(%d)\n", thermal_value, p_hal_data->eeprom_thermal_meter));
@@ -616,11 +581,7 @@ odm_txpowertracking_callback_thermal_meter(
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter Xtal Tracking**********\n"));
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
if (thermal_value > p_hal_data->eeprom_thermal_meter) {
-#else
- if (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther) {
-#endif
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
("Temperature(%d) higher than PG value(%d)\n", thermal_value, p_hal_data->eeprom_thermal_meter));
(*c.odm_txxtaltrack_set_xtal)(p_dm_odm);
@@ -632,9 +593,6 @@ odm_txpowertracking_callback_thermal_meter(
}
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********End Xtal Tracking**********\n"));
}
-
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
-
if (!IS_HARDWARE_TYPE_8723B(adapter)) {
/*Delta temperature is equal to or larger than 20 centigrade (When threshold is 8).*/
if (delta_IQK >= c.threshold_iqk) {
@@ -678,8 +636,6 @@ odm_txpowertracking_callback_thermal_meter(
}
}
-#endif
-
ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("<===odm_txpowertracking_callback_thermal_meter\n"));
p_rf_calibrate_info->tx_powercount = 0;
@@ -698,7 +654,6 @@ odm_reset_iqk_result(
{
return;
}
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
u8 odm_get_right_chnl_place_for_iqk(u8 chnl)
{
u8 channel_all[ODM_TARGET_CHNL_NUM_2G_5G] = {
@@ -716,24 +671,13 @@ u8 odm_get_right_chnl_place_for_iqk(u8 chnl)
return 0;
}
-#endif
-static void
-odm_iq_calibrate(
- struct PHY_DM_STRUCT *p_dm_odm
-)
+static void odm_iq_calibrate(struct PHY_DM_STRUCT *p_dm_odm)
{
struct _ADAPTER *adapter = p_dm_odm->adapter;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if (*p_dm_odm->p_is_fcs_mode_enable)
- return;
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_CE))
if (IS_HARDWARE_TYPE_8812AU(adapter))
return;
-#endif
if (p_dm_odm->is_linked) {
if ((*p_dm_odm->p_channel != p_dm_odm->pre_channel) && (!*p_dm_odm->p_is_scan_in_process)) {
@@ -775,25 +719,14 @@ void phydm_rf_init(void *p_dm_void)
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
odm_txpowertracking_init(p_dm_odm);
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
odm_clear_txpowertracking_state(p_dm_odm);
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-#if (RTL8814A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type & ODM_RTL8814A)
- phy_iq_calibrate_8814a_init(p_dm_odm);
-#endif
-#endif
-
}
void phydm_rf_watchdog(void *p_dm_void)
{
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
+
odm_txpowertracking_check(p_dm_odm);
if (p_dm_odm->support_ic_type & ODM_IC_11AC_SERIES)
odm_iq_calibrate(p_dm_odm);
-#endif
}
diff --git a/hal/phydm/halphyrf_ce.h b/hal/phydm/halphyrf_ce.h
index 71d104a..ac2b690 100644
--- a/hal/phydm/halphyrf_ce.h
+++ b/hal/phydm/halphyrf_ce.h
@@ -90,18 +90,11 @@ odm_clear_txpowertracking_state(
void
odm_txpowertracking_callback_thermal_meter(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- void *p_dm_void
-#else
struct _ADAPTER *adapter
-#endif
);
-
-
#define ODM_TARGET_CHNL_NUM_2G_5G 59
-
void
odm_reset_iqk_result(
void *p_dm_void
diff --git a/hal/phydm/halphyrf_win.c b/hal/phydm/halphyrf_win.c
deleted file mode 100644
index 202848e..0000000
--- a/hal/phydm/halphyrf_win.c
+++ /dev/null
@@ -1,784 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-
-#include "mp_precomp.h"
-#include "phydm_precomp.h"
-
-#define CALCULATE_SWINGTALBE_OFFSET(_offset, _direction, _size, _delta_thermal) \
- do {\
- for (_offset = 0; _offset < _size; _offset++) { \
- \
- if (_delta_thermal < thermal_threshold[_direction][_offset]) { \
- \
- if (_offset != 0)\
- _offset--;\
- break;\
- } \
- } \
- if (_offset >= _size)\
- _offset = _size-1;\
- } while (0)
-
-void configure_txpower_track(
- struct PHY_DM_STRUCT *p_dm_odm,
- struct _TXPWRTRACK_CFG *p_config
-)
-{
-#if RTL8192E_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8192E)
- configure_txpower_track_8192e(p_config);
-#endif
-#if RTL8821A_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8821)
- configure_txpower_track_8821a(p_config);
-#endif
-#if RTL8812A_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8812)
- configure_txpower_track_8812a(p_config);
-#endif
-#if RTL8188E_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8188E)
- configure_txpower_track_8188e(p_config);
-#endif
-
-#if RTL8188F_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8188F)
- configure_txpower_track_8188f(p_config);
-#endif
-
-#if RTL8723B_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8723B)
- configure_txpower_track_8723b(p_config);
-#endif
-
-#if RTL8814A_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8814A)
- configure_txpower_track_8814a(p_config);
-#endif
-
-#if RTL8703B_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8703B)
- configure_txpower_track_8703b(p_config);
-#endif
-
-#if RTL8822B_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8822B)
- configure_txpower_track_8822b(p_config);
-#endif
-
-#if RTL8723D_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8723D)
- configure_txpower_track_8723d(p_config);
-#endif
-
-#if RTL8821C_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8821C)
- configure_txpower_track_8821c(p_config);
-#endif
-
-}
-
-/* **********************************************************************
- * <20121113, Kordan> This function should be called when tx_agc changed.
- * Otherwise the previous compensation is gone, because we record the
- * delta of temperature between two TxPowerTracking watch dogs.
- *
- * NOTE: If Tx BB swing or Tx scaling is varified during run-time, still
- * need to call this function.
- * ********************************************************************** */
-void
-odm_clear_txpowertracking_state(
- struct PHY_DM_STRUCT *p_dm_odm
-)
-{
- PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(p_dm_odm->adapter);
- u8 p = 0;
- struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm_odm->rf_calibrate_info);
-
- p_rf_calibrate_info->bb_swing_idx_cck_base = p_rf_calibrate_info->default_cck_index;
- p_rf_calibrate_info->bb_swing_idx_cck = p_rf_calibrate_info->default_cck_index;
- p_rf_calibrate_info->CCK_index = 0;
-
- for (p = ODM_RF_PATH_A; p < MAX_RF_PATH; ++p) {
- p_rf_calibrate_info->bb_swing_idx_ofdm_base[p] = p_rf_calibrate_info->default_ofdm_index;
- p_rf_calibrate_info->bb_swing_idx_ofdm[p] = p_rf_calibrate_info->default_ofdm_index;
- p_rf_calibrate_info->OFDM_index[p] = p_rf_calibrate_info->default_ofdm_index;
-
- p_rf_calibrate_info->power_index_offset[p] = 0;
- p_rf_calibrate_info->delta_power_index[p] = 0;
- p_rf_calibrate_info->delta_power_index_last[p] = 0;
-
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = 0; /* Initial Mix mode power tracking*/
- p_rf_calibrate_info->remnant_ofdm_swing_idx[p] = 0;
- p_rf_calibrate_info->kfree_offset[p] = 0;
- }
-
- p_rf_calibrate_info->modify_tx_agc_flag_path_a = false; /*Initial at Modify Tx Scaling mode*/
- p_rf_calibrate_info->modify_tx_agc_flag_path_b = false; /*Initial at Modify Tx Scaling mode*/
- p_rf_calibrate_info->modify_tx_agc_flag_path_c = false; /*Initial at Modify Tx Scaling mode*/
- p_rf_calibrate_info->modify_tx_agc_flag_path_d = false; /*Initial at Modify Tx Scaling mode*/
- p_rf_calibrate_info->remnant_cck_swing_idx = 0;
- p_rf_calibrate_info->thermal_value = p_hal_data->eeprom_thermal_meter;
-
- p_rf_calibrate_info->modify_tx_agc_value_cck = 0; /* modify by Mingzhi.Guo */
- p_rf_calibrate_info->modify_tx_agc_value_ofdm = 0; /* modify by Mingzhi.Guo */
-
-}
-
-void
-odm_txpowertracking_callback_thermal_meter(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- struct PHY_DM_STRUCT *p_dm_odm
-#else
- struct _ADAPTER *adapter
-#endif
-)
-{
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->odmpriv;
-#endif
-#endif
-
- struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm_odm->rf_calibrate_info);
-
- u8 thermal_value = 0, delta, delta_LCK, delta_IQK, p = 0, i = 0;
- s8 diff_DPK[4] = {0};
- u8 thermal_value_avg_count = 0;
- u32 thermal_value_avg = 0, regc80, regcd0, regcd4, regab4;
-
- u8 OFDM_min_index = 0; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */
- u8 indexforchannel = 0; /* get_right_chnl_place_for_iqk(p_hal_data->current_channel) */
- u8 power_tracking_type = p_hal_data->RfPowerTrackingType;
- u8 xtal_offset_eanble = 0;
-
- struct _TXPWRTRACK_CFG c;
-
- /* 4 1. The following TWO tables decide the final index of OFDM/CCK swing table. */
- u8 *delta_swing_table_idx_tup_a = NULL;
- u8 *delta_swing_table_idx_tdown_a = NULL;
- u8 *delta_swing_table_idx_tup_b = NULL;
- u8 *delta_swing_table_idx_tdown_b = NULL;
- /*for 8814 add by Yu Chen*/
- u8 *delta_swing_table_idx_tup_c = NULL;
- u8 *delta_swing_table_idx_tdown_c = NULL;
- u8 *delta_swing_table_idx_tup_d = NULL;
- u8 *delta_swing_table_idx_tdown_d = NULL;
- /*for Xtal Offset by James.Tung*/
- s8 *delta_swing_table_xtal_up = NULL;
- s8 *delta_swing_table_xtal_down = NULL;
-
- /* 4 2. Initilization ( 7 steps in total ) */
-
- configure_txpower_track(p_dm_odm, &c);
-
- (*c.get_delta_swing_table)(p_dm_odm, (u8 **)&delta_swing_table_idx_tup_a, (u8 **)&delta_swing_table_idx_tdown_a,
- (u8 **)&delta_swing_table_idx_tup_b, (u8 **)&delta_swing_table_idx_tdown_b);
-
- if (p_dm_odm->support_ic_type & ODM_RTL8814A) /*for 8814 path C & D*/
- (*c.get_delta_swing_table8814only)(p_dm_odm, (u8 **)&delta_swing_table_idx_tup_c, (u8 **)&delta_swing_table_idx_tdown_c,
- (u8 **)&delta_swing_table_idx_tup_d, (u8 **)&delta_swing_table_idx_tdown_d);
-
- if (p_dm_odm->support_ic_type & (ODM_RTL8703B | ODM_RTL8723D)) /*for Xtal Offset*/
- (*c.get_delta_swing_xtal_table)(p_dm_odm, (s8 **)&delta_swing_table_xtal_up, (s8 **)&delta_swing_table_xtal_down);
-
-
- p_rf_calibrate_info->txpowertracking_callback_cnt++; /*cosa add for debug*/
- p_rf_calibrate_info->is_txpowertracking_init = true;
-
- /*p_rf_calibrate_info->txpowertrack_control = p_hal_data->txpowertrack_control;
- We should keep updating the control variable according to HalData.
- rf_calibrate_info.rega24 will be initialized when ODM HW configuring, but MP configures with para files. */
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-#if (MP_DRIVER == 1)
- p_rf_calibrate_info->rega24 = 0x090e1317;
-#endif
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
- if (p_dm_odm->mp_mode == true)
- p_rf_calibrate_info->rega24 = 0x090e1317;
-#endif
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("===>odm_txpowertracking_callback_thermal_meter\n p_rf_calibrate_info->bb_swing_idx_cck_base: %d, p_rf_calibrate_info->bb_swing_idx_ofdm_base[A]: %d, p_rf_calibrate_info->default_ofdm_index: %d\n",
- p_rf_calibrate_info->bb_swing_idx_cck_base, p_rf_calibrate_info->bb_swing_idx_ofdm_base[ODM_RF_PATH_A], p_rf_calibrate_info->default_ofdm_index));
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("p_rf_calibrate_info->txpowertrack_control=%d, p_hal_data->eeprom_thermal_meter %d\n", p_rf_calibrate_info->txpowertrack_control, p_hal_data->eeprom_thermal_meter));
- thermal_value = (u8)odm_get_rf_reg(p_dm_odm, ODM_RF_PATH_A, c.thermal_reg_addr, 0xfc00); /* 0x42: RF Reg[15:10] 88E */
-
- /*add log by zhao he, check c80/c94/c14/ca0 value*/
- if (p_dm_odm->support_ic_type == ODM_RTL8723D) {
- regc80 = odm_get_bb_reg(p_dm_odm, 0xc80, MASKDWORD);
- regcd0 = odm_get_bb_reg(p_dm_odm, 0xcd0, MASKDWORD);
- regcd4 = odm_get_bb_reg(p_dm_odm, 0xcd4, MASKDWORD);
- regab4 = odm_get_bb_reg(p_dm_odm, 0xab4, 0x000007FF);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xc80 = 0x%x 0xcd0 = 0x%x 0xcd4 = 0x%x 0xab4 = 0x%x\n", regc80, regcd0, regcd4, regab4));
- }
-
- if (!p_rf_calibrate_info->txpowertrack_control)
- return;
-
-
- /*4 3. Initialize ThermalValues of rf_calibrate_info*/
-
- if (p_rf_calibrate_info->is_reloadtxpowerindex)
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("reload ofdm index for band switch\n"));
-
- /*4 4. Calculate average thermal meter*/
-
- p_rf_calibrate_info->thermal_value_avg[p_rf_calibrate_info->thermal_value_avg_index] = thermal_value;
- p_rf_calibrate_info->thermal_value_avg_index++;
- if (p_rf_calibrate_info->thermal_value_avg_index == c.average_thermal_num) /*Average times = c.average_thermal_num*/
- p_rf_calibrate_info->thermal_value_avg_index = 0;
-
- for (i = 0; i < c.average_thermal_num; i++) {
- if (p_rf_calibrate_info->thermal_value_avg[i]) {
- thermal_value_avg += p_rf_calibrate_info->thermal_value_avg[i];
- thermal_value_avg_count++;
- }
- }
-
- if (thermal_value_avg_count) { /* Calculate Average thermal_value after average enough times */
- thermal_value = (u8)(thermal_value_avg / thermal_value_avg_count);
- p_rf_calibrate_info->thermal_value_delta = thermal_value - p_hal_data->eeprom_thermal_meter;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("AVG Thermal Meter = 0x%X, EFUSE Thermal base = 0x%X\n", thermal_value, p_hal_data->eeprom_thermal_meter));
- }
-
- /* 4 5. Calculate delta, delta_LCK, delta_IQK. */
-
- /* "delta" here is used to determine whether thermal value changes or not. */
- delta = (thermal_value > p_rf_calibrate_info->thermal_value) ? (thermal_value - p_rf_calibrate_info->thermal_value) : (p_rf_calibrate_info->thermal_value - thermal_value);
- delta_LCK = (thermal_value > p_rf_calibrate_info->thermal_value_lck) ? (thermal_value - p_rf_calibrate_info->thermal_value_lck) : (p_rf_calibrate_info->thermal_value_lck - thermal_value);
- delta_IQK = (thermal_value > p_rf_calibrate_info->thermal_value_iqk) ? (thermal_value - p_rf_calibrate_info->thermal_value_iqk) : (p_rf_calibrate_info->thermal_value_iqk - thermal_value);
-
- if (p_rf_calibrate_info->thermal_value_iqk == 0xff) { /*no PG, use thermal value for IQK*/
- p_rf_calibrate_info->thermal_value_iqk = thermal_value;
- delta_IQK = (thermal_value > p_rf_calibrate_info->thermal_value_iqk) ? (thermal_value - p_rf_calibrate_info->thermal_value_iqk) : (p_rf_calibrate_info->thermal_value_iqk - thermal_value);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("no PG, use thermal_value for IQK\n"));
- }
-
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- diff_DPK[p] = (s8)thermal_value - (s8)p_rf_calibrate_info->dpk_thermal[p];
-
- /*4 6. If necessary, do LCK.*/
-
- if (!(p_dm_odm->support_ic_type & ODM_RTL8821)) { /*no PG, do LCK at initial status*/
- if (p_rf_calibrate_info->thermal_value_lck == 0xff) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("no PG, do LCK\n"));
- p_rf_calibrate_info->thermal_value_lck = thermal_value;
-
- /*Use RTLCK, so close power tracking driver LCK*/
- if (!(p_dm_odm->support_ic_type & ODM_RTL8814A)) {
- if (c.phy_lc_calibrate)
- (*c.phy_lc_calibrate)(p_dm_odm);
- }
-
- delta_LCK = (thermal_value > p_rf_calibrate_info->thermal_value_lck) ? (thermal_value - p_rf_calibrate_info->thermal_value_lck) : (p_rf_calibrate_info->thermal_value_lck - thermal_value);
- }
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("(delta, delta_LCK, delta_IQK) = (%d, %d, %d)\n", delta, delta_LCK, delta_IQK));
-
- /* Delta temperature is equal to or larger than 20 centigrade.*/
- if (delta_LCK >= c.threshold_iqk) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("delta_LCK(%d) >= threshold_iqk(%d)\n", delta_LCK, c.threshold_iqk));
- p_rf_calibrate_info->thermal_value_lck = thermal_value;
-
- /*Use RTLCK, so close power tracking driver LCK*/
- if (!(p_dm_odm->support_ic_type & ODM_RTL8814A)) {
- if (c.phy_lc_calibrate)
- (*c.phy_lc_calibrate)(p_dm_odm);
- }
- }
- }
-
- /*3 7. If necessary, move the index of swing table to adjust Tx power.*/
-
- if (delta > 0 && p_rf_calibrate_info->txpowertrack_control) {
- /* "delta" here is used to record the absolute value of differrence. */
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
- delta = thermal_value > p_hal_data->eeprom_thermal_meter ? (thermal_value - p_hal_data->eeprom_thermal_meter) : (p_hal_data->eeprom_thermal_meter - thermal_value);
-#else
- delta = (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther) ? (thermal_value - p_dm_odm->priv->pmib->dot11RFEntry.ther) : (p_dm_odm->priv->pmib->dot11RFEntry.ther - thermal_value);
-#endif
- if (delta >= TXPWR_TRACK_TABLE_SIZE)
- delta = TXPWR_TRACK_TABLE_SIZE - 1;
-
- /*4 7.1 The Final Power index = BaseIndex + power_index_offset*/
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
- if (thermal_value > p_hal_data->eeprom_thermal_meter) {
-#else
- if (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther) {
-#endif
-
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
- p_rf_calibrate_info->delta_power_index_last[p] = p_rf_calibrate_info->delta_power_index[p]; /*recording poer index offset*/
- switch (p) {
- case ODM_RF_PATH_B:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tup_b[%d] = %d\n", delta, delta_swing_table_idx_tup_b[delta]));
-
- p_rf_calibrate_info->delta_power_index[p] = delta_swing_table_idx_tup_b[delta];
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_b[delta]; /*Record delta swing for mix mode power tracking*/
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is higher and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_B] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
- break;
-
- case ODM_RF_PATH_C:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tup_c[%d] = %d\n", delta, delta_swing_table_idx_tup_c[delta]));
-
- p_rf_calibrate_info->delta_power_index[p] = delta_swing_table_idx_tup_c[delta];
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_c[delta]; /*Record delta swing for mix mode power tracking*/
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is higher and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_C] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
- break;
-
- case ODM_RF_PATH_D:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tup_d[%d] = %d\n", delta, delta_swing_table_idx_tup_d[delta]));
-
- p_rf_calibrate_info->delta_power_index[p] = delta_swing_table_idx_tup_d[delta];
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_d[delta]; /*Record delta swing for mix mode power tracking*/
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is higher and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_D] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
- break;
-
- default:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tup_a[%d] = %d\n", delta, delta_swing_table_idx_tup_a[delta]));
-
- p_rf_calibrate_info->delta_power_index[p] = delta_swing_table_idx_tup_a[delta];
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = delta_swing_table_idx_tup_a[delta]; /*Record delta swing for mix mode power tracking*/
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is higher and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_A] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
- break;
- }
- }
-
- if (p_dm_odm->support_ic_type & (ODM_RTL8703B | ODM_RTL8723D)) {
- /*Save xtal_offset from Xtal table*/
- p_rf_calibrate_info->xtal_offset_last = p_rf_calibrate_info->xtal_offset; /*recording last Xtal offset*/
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("[Xtal] delta_swing_table_xtal_up[%d] = %d\n", delta, delta_swing_table_xtal_up[delta]));
- p_rf_calibrate_info->xtal_offset = delta_swing_table_xtal_up[delta];
-
- if (p_rf_calibrate_info->xtal_offset_last == p_rf_calibrate_info->xtal_offset)
- xtal_offset_eanble = 0;
- else
- xtal_offset_eanble = 1;
- }
-
- } else {
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
- p_rf_calibrate_info->delta_power_index_last[p] = p_rf_calibrate_info->delta_power_index[p]; /*recording poer index offset*/
-
- switch (p) {
- case ODM_RF_PATH_B:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tdown_b[%d] = %d\n", delta, delta_swing_table_idx_tdown_b[delta]));
- p_rf_calibrate_info->delta_power_index[p] = -1 * delta_swing_table_idx_tdown_b[delta];
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_b[delta]; /*Record delta swing for mix mode power tracking*/
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is lower and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_B] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
- break;
-
- case ODM_RF_PATH_C:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tdown_c[%d] = %d\n", delta, delta_swing_table_idx_tdown_c[delta]));
- p_rf_calibrate_info->delta_power_index[p] = -1 * delta_swing_table_idx_tdown_c[delta];
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_c[delta]; /*Record delta swing for mix mode power tracking*/
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is lower and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_C] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
- break;
-
- case ODM_RF_PATH_D:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tdown_d[%d] = %d\n", delta, delta_swing_table_idx_tdown_d[delta]));
- p_rf_calibrate_info->delta_power_index[p] = -1 * delta_swing_table_idx_tdown_d[delta];
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_d[delta]; /*Record delta swing for mix mode power tracking*/
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is lower and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_D] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
- break;
-
- default:
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("delta_swing_table_idx_tdown_a[%d] = %d\n", delta, delta_swing_table_idx_tdown_a[delta]));
- p_rf_calibrate_info->delta_power_index[p] = -1 * delta_swing_table_idx_tdown_a[delta];
- p_rf_calibrate_info->absolute_ofdm_swing_idx[p] = -1 * delta_swing_table_idx_tdown_a[delta]; /*Record delta swing for mix mode power tracking*/
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("******Temp is lower and p_rf_calibrate_info->absolute_ofdm_swing_idx[ODM_RF_PATH_A] = %d\n", p_rf_calibrate_info->absolute_ofdm_swing_idx[p]));
- break;
- }
- }
-
- if (p_dm_odm->support_ic_type & (ODM_RTL8703B | ODM_RTL8723D)) {
- /*Save xtal_offset from Xtal table*/
- p_rf_calibrate_info->xtal_offset_last = p_rf_calibrate_info->xtal_offset; /*recording last Xtal offset*/
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("[Xtal] delta_swing_table_xtal_down[%d] = %d\n", delta, delta_swing_table_xtal_down[delta]));
- p_rf_calibrate_info->xtal_offset = delta_swing_table_xtal_down[delta];
-
- if (p_rf_calibrate_info->xtal_offset_last == p_rf_calibrate_info->xtal_offset)
- xtal_offset_eanble = 0;
- else
- xtal_offset_eanble = 1;
- }
-
- }
-
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("\n\n=========================== [path-%d] Calculating power_index_offset===========================\n", p));
-
- if (p_rf_calibrate_info->delta_power_index[p] == p_rf_calibrate_info->delta_power_index_last[p]) /*If Thermal value changes but lookup table value still the same*/
- p_rf_calibrate_info->power_index_offset[p] = 0;
- else
- p_rf_calibrate_info->power_index_offset[p] = p_rf_calibrate_info->delta_power_index[p] - p_rf_calibrate_info->delta_power_index_last[p]; /*Power index diff between 2 times Power Tracking*/
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("[path-%d] power_index_offset(%d) = delta_power_index(%d) - delta_power_index_last(%d)\n", p, p_rf_calibrate_info->power_index_offset[p], p_rf_calibrate_info->delta_power_index[p], p_rf_calibrate_info->delta_power_index_last[p]));
-
- p_rf_calibrate_info->OFDM_index[p] = p_rf_calibrate_info->bb_swing_idx_ofdm_base[p] + p_rf_calibrate_info->power_index_offset[p];
- p_rf_calibrate_info->CCK_index = p_rf_calibrate_info->bb_swing_idx_cck_base + p_rf_calibrate_info->power_index_offset[p];
-
- p_rf_calibrate_info->bb_swing_idx_cck = p_rf_calibrate_info->CCK_index;
- p_rf_calibrate_info->bb_swing_idx_ofdm[p] = p_rf_calibrate_info->OFDM_index[p];
-
- /*************Print BB Swing base and index Offset*************/
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("The 'CCK' final index(%d) = BaseIndex(%d) + power_index_offset(%d)\n", p_rf_calibrate_info->bb_swing_idx_cck, p_rf_calibrate_info->bb_swing_idx_cck_base, p_rf_calibrate_info->power_index_offset[p]));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("The 'OFDM' final index(%d) = BaseIndex[%d](%d) + power_index_offset(%d)\n", p_rf_calibrate_info->bb_swing_idx_ofdm[p], p, p_rf_calibrate_info->bb_swing_idx_ofdm_base[p], p_rf_calibrate_info->power_index_offset[p]));
-
- /*4 7.1 Handle boundary conditions of index.*/
-
- if (p_rf_calibrate_info->OFDM_index[p] > c.swing_table_size_ofdm - 1)
- p_rf_calibrate_info->OFDM_index[p] = c.swing_table_size_ofdm - 1;
- else if (p_rf_calibrate_info->OFDM_index[p] <= OFDM_min_index)
- p_rf_calibrate_info->OFDM_index[p] = OFDM_min_index;
- }
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("\n\n========================================================================================================\n"));
-
- if (p_rf_calibrate_info->CCK_index > c.swing_table_size_cck - 1)
- p_rf_calibrate_info->CCK_index = c.swing_table_size_cck - 1;
- else if (p_rf_calibrate_info->CCK_index <= 0)
- p_rf_calibrate_info->CCK_index = 0;
- } else {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("The thermal meter is unchanged or TxPowerTracking OFF(%d): thermal_value: %d, p_rf_calibrate_info->thermal_value: %d\n",
- p_rf_calibrate_info->txpowertrack_control, thermal_value, p_rf_calibrate_info->thermal_value));
-
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- p_rf_calibrate_info->power_index_offset[p] = 0;
- }
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("TxPowerTracking: [CCK] Swing Current index: %d, Swing base index: %d\n",
- p_rf_calibrate_info->CCK_index, p_rf_calibrate_info->bb_swing_idx_cck_base)); /*Print Swing base & current*/
-
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("TxPowerTracking: [OFDM] Swing Current index: %d, Swing base index[%d]: %d\n",
- p_rf_calibrate_info->OFDM_index[p], p, p_rf_calibrate_info->bb_swing_idx_ofdm_base[p]));
- }
-
- if ((p_dm_odm->support_ic_type & ODM_RTL8814A)) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("power_tracking_type=%d\n", power_tracking_type));
-
- if (power_tracking_type == 0) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX_MODE**********\n"));
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_MODE, p, 0);
- } else if (power_tracking_type == 1) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX(2G) TSSI(5G) MODE**********\n"));
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_2G_TSSI_5G_MODE, p, 0);
- } else if (power_tracking_type == 2) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX(5G) TSSI(2G)MODE**********\n"));
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_5G_TSSI_2G_MODE, p, 0);
- } else if (power_tracking_type == 3) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking TSSI MODE**********\n"));
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, TSSI_MODE, p, 0);
- }
- p_rf_calibrate_info->thermal_value = thermal_value; /*Record last Power Tracking Thermal value*/
-
- } else if ((p_rf_calibrate_info->power_index_offset[ODM_RF_PATH_A] != 0 ||
- p_rf_calibrate_info->power_index_offset[ODM_RF_PATH_B] != 0 ||
- p_rf_calibrate_info->power_index_offset[ODM_RF_PATH_C] != 0 ||
- p_rf_calibrate_info->power_index_offset[ODM_RF_PATH_D] != 0) &&
- p_rf_calibrate_info->txpowertrack_control && (p_hal_data->eeprom_thermal_meter != 0xff)) {
- /* 4 7.2 Configure the Swing Table to adjust Tx Power. */
-
- p_rf_calibrate_info->is_tx_power_changed = true; /*Always true after Tx Power is adjusted by power tracking.*/
- /* */
- /* 2012/04/23 MH According to Luke's suggestion, we can not write BB digital */
- /* to increase TX power. Otherwise, EVM will be bad. */
- /* */
- /* 2012/04/25 MH Add for tx power tracking to set tx power in tx agc for 88E. */
- if (thermal_value > p_rf_calibrate_info->thermal_value) {
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("Temperature Increasing(%d): delta_pi: %d, delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n",
- p, p_rf_calibrate_info->power_index_offset[p], delta, thermal_value, p_hal_data->eeprom_thermal_meter, p_rf_calibrate_info->thermal_value));
- }
- } else if (thermal_value < p_rf_calibrate_info->thermal_value) { /*Low temperature*/
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("Temperature Decreasing(%d): delta_pi: %d, delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n",
- p, p_rf_calibrate_info->power_index_offset[p], delta, thermal_value, p_hal_data->eeprom_thermal_meter, p_rf_calibrate_info->thermal_value));
- }
- }
-
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- if (thermal_value > p_hal_data->eeprom_thermal_meter)
-#else
- if (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther)
-#endif
- {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("Temperature(%d) higher than PG value(%d)\n", thermal_value, p_hal_data->eeprom_thermal_meter));
-
- if (p_dm_odm->support_ic_type == ODM_RTL8188E || p_dm_odm->support_ic_type == ODM_RTL8192E || p_dm_odm->support_ic_type == ODM_RTL8821 ||
- p_dm_odm->support_ic_type == ODM_RTL8812 || p_dm_odm->support_ic_type == ODM_RTL8723B || p_dm_odm->support_ic_type == ODM_RTL8814A ||
- p_dm_odm->support_ic_type == ODM_RTL8703B || p_dm_odm->support_ic_type == ODM_RTL8188F || p_dm_odm->support_ic_type == ODM_RTL8822B ||
- p_dm_odm->support_ic_type == ODM_RTL8723D || p_dm_odm->support_ic_type == ODM_RTL8821C) {
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX_MODE**********\n"));
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_MODE, p, 0);
- } else {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking BBSWING_MODE**********\n"));
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, BBSWING, p, indexforchannel);
- }
- } else {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("Temperature(%d) lower than PG value(%d)\n", thermal_value, p_hal_data->eeprom_thermal_meter));
-
- if (p_dm_odm->support_ic_type == ODM_RTL8188E || p_dm_odm->support_ic_type == ODM_RTL8192E || p_dm_odm->support_ic_type == ODM_RTL8821 ||
- p_dm_odm->support_ic_type == ODM_RTL8812 || p_dm_odm->support_ic_type == ODM_RTL8723B || p_dm_odm->support_ic_type == ODM_RTL8814A ||
- p_dm_odm->support_ic_type == ODM_RTL8703B || p_dm_odm->support_ic_type == ODM_RTL8188F || p_dm_odm->support_ic_type == ODM_RTL8822B ||
- p_dm_odm->support_ic_type == ODM_RTL8723D || p_dm_odm->support_ic_type == ODM_RTL8821C) {
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX_MODE**********\n"));
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, MIX_MODE, p, indexforchannel);
- } else {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking BBSWING_MODE**********\n"));
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- (*c.odm_tx_pwr_track_set_pwr)(p_dm_odm, BBSWING, p, indexforchannel);
- }
-
- }
-
- p_rf_calibrate_info->bb_swing_idx_cck_base = p_rf_calibrate_info->bb_swing_idx_cck; /*Record last time Power Tracking result as base.*/
- for (p = ODM_RF_PATH_A; p < c.rf_path_count; p++)
- p_rf_calibrate_info->bb_swing_idx_ofdm_base[p] = p_rf_calibrate_info->bb_swing_idx_ofdm[p];
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("p_rf_calibrate_info->thermal_value = %d thermal_value= %d\n", p_rf_calibrate_info->thermal_value, thermal_value));
-
- p_rf_calibrate_info->thermal_value = thermal_value; /*Record last Power Tracking Thermal value*/
-
- }
-
-
- if (p_dm_odm->support_ic_type == ODM_RTL8703B || p_dm_odm->support_ic_type == ODM_RTL8723D) {
-
- if (xtal_offset_eanble != 0 && p_rf_calibrate_info->txpowertrack_control && (p_hal_data->eeprom_thermal_meter != 0xff)) {
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter Xtal Tracking**********\n"));
-
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
- if (thermal_value > p_hal_data->eeprom_thermal_meter) {
-#else
- if (thermal_value > p_dm_odm->priv->pmib->dot11RFEntry.ther) {
-#endif
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("Temperature(%d) higher than PG value(%d)\n", thermal_value, p_hal_data->eeprom_thermal_meter));
- (*c.odm_txxtaltrack_set_xtal)(p_dm_odm);
- } else {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
- ("Temperature(%d) lower than PG value(%d)\n", thermal_value, p_hal_data->eeprom_thermal_meter));
- (*c.odm_txxtaltrack_set_xtal)(p_dm_odm);
- }
- }
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********End Xtal Tracking**********\n"));
- }
-
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
-
- if (!IS_HARDWARE_TYPE_8723B(adapter)) {
- /*Delta temperature is equal to or larger than 20 centigrade (When threshold is 8).*/
- if (delta_IQK >= c.threshold_iqk) {
- p_rf_calibrate_info->thermal_value_iqk = thermal_value;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("delta_IQK(%d) >= threshold_iqk(%d)\n", delta_IQK, c.threshold_iqk));
- if (!p_rf_calibrate_info->is_iqk_in_progress)
- (*c.do_iqk)(p_dm_odm, delta_IQK, thermal_value, 8);
- }
- }
- if (p_rf_calibrate_info->dpk_thermal[ODM_RF_PATH_A] != 0) {
- if (diff_DPK[ODM_RF_PATH_A] >= c.threshold_dpk) {
- odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
- odm_set_bb_reg(p_dm_odm, 0xcc4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), (diff_DPK[ODM_RF_PATH_A] / c.threshold_dpk));
- odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
- } else if ((diff_DPK[ODM_RF_PATH_A] <= -1 * c.threshold_dpk)) {
- s32 value = 0x20 + (diff_DPK[ODM_RF_PATH_A] / c.threshold_dpk);
-
- odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
- odm_set_bb_reg(p_dm_odm, 0xcc4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), value);
- odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
- } else {
- odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
- odm_set_bb_reg(p_dm_odm, 0xcc4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), 0);
- odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
- }
- }
- if (p_rf_calibrate_info->dpk_thermal[ODM_RF_PATH_B] != 0) {
- if (diff_DPK[ODM_RF_PATH_B] >= c.threshold_dpk) {
- odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
- odm_set_bb_reg(p_dm_odm, 0xec4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), (diff_DPK[ODM_RF_PATH_B] / c.threshold_dpk));
- odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
- } else if ((diff_DPK[ODM_RF_PATH_B] <= -1 * c.threshold_dpk)) {
- s32 value = 0x20 + (diff_DPK[ODM_RF_PATH_B] / c.threshold_dpk);
-
- odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
- odm_set_bb_reg(p_dm_odm, 0xec4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), value);
- odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
- } else {
- odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x1);
- odm_set_bb_reg(p_dm_odm, 0xec4, BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10), 0);
- odm_set_bb_reg(p_dm_odm, 0x82c, BIT(31), 0x0);
- }
- }
-
-#endif
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("<===odm_txpowertracking_callback_thermal_meter\n"));
-
- p_rf_calibrate_info->tx_powercount = 0;
-}
-
-
-
-/* 3============================================================
- * 3 IQ Calibration
- * 3============================================================ */
-
-void
-odm_reset_iqk_result(
- struct PHY_DM_STRUCT *p_dm_odm
-)
-{
- return;
-}
-#if !(DM_ODM_SUPPORT_TYPE & ODM_AP)
-u8 odm_get_right_chnl_place_for_iqk(u8 chnl)
-{
- u8 channel_all[ODM_TARGET_CHNL_NUM_2G_5G] = {
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 149, 151, 153, 155, 157, 159, 161, 163, 165
- };
- u8 place = chnl;
-
-
- if (chnl > 14) {
- for (place = 14; place < sizeof(channel_all); place++) {
- if (channel_all[place] == chnl)
- return place - 13;
- }
- }
- return 0;
-
-}
-#endif
-
-void
-odm_iq_calibrate(
- struct PHY_DM_STRUCT *p_dm_odm
-)
-{
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- HAL_DATA_TYPE *pHalData = GET_HAL_DATA(adapter);
-
- RT_TRACE(COMP_SCAN, ODM_DBG_LOUD, ("=>%s\n" , __func__));
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if (*p_dm_odm->p_is_fcs_mode_enable)
- return;
-#endif
-
- if (p_dm_odm->is_linked) {
- RT_TRACE(COMP_SCAN, ODM_DBG_LOUD, ("interval=%d ch=%d prech=%d scan=%s\n", p_dm_odm->linked_interval,
- *p_dm_odm->p_channel, p_dm_odm->pre_channel, *p_dm_odm->p_is_scan_in_process == TRUE ? "TRUE":"FALSE"));
-
- if (*p_dm_odm->p_channel != p_dm_odm->pre_channel) {
- p_dm_odm->pre_channel = *p_dm_odm->p_channel;
- p_dm_odm->linked_interval = 0;
- }
-
- if ((p_dm_odm->linked_interval < 3) && (!*p_dm_odm->p_is_scan_in_process))
- p_dm_odm->linked_interval++;
-
- if (p_dm_odm->linked_interval == 2)
- PHY_IQCalibrate(adapter, false);
- } else
- p_dm_odm->linked_interval = 0;
-
- RT_TRACE(COMP_SCAN, ODM_DBG_LOUD, ("<=%s interval=%d ch=%d prech=%d scan=%s\n", __func__, p_dm_odm->linked_interval,
- *p_dm_odm->p_channel, p_dm_odm->pre_channel, *p_dm_odm->p_is_scan_in_process == TRUE?"TRUE":"FALSE"));
-}
-
-void phydm_rf_init(struct PHY_DM_STRUCT *p_dm_odm)
-{
-
- odm_txpowertracking_init(p_dm_odm);
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
- odm_clear_txpowertracking_state(p_dm_odm);
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-#if (RTL8814A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type & ODM_RTL8814A)
- phy_iq_calibrate_8814a_init(p_dm_odm);
-#endif
-#endif
-
-}
-
-void phydm_rf_watchdog(struct PHY_DM_STRUCT *p_dm_odm)
-{
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
- odm_txpowertracking_check(p_dm_odm);
- if (p_dm_odm->support_ic_type & ODM_IC_11AC_SERIES)
- odm_iq_calibrate(p_dm_odm);
-#endif
-}
diff --git a/hal/phydm/halphyrf_win.h b/hal/phydm/halphyrf_win.h
deleted file mode 100644
index e82b42a..0000000
--- a/hal/phydm/halphyrf_win.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-
-#ifndef __HAL_PHY_RF_H__
-#define __HAL_PHY_RF_H__
-
-#include "phydm_kfree.h"
-#if (RTL8814A_SUPPORT == 1)
- #include "rtl8814a/phydm_iqk_8814a.h"
-#endif
-
-#if (RTL8822B_SUPPORT == 1)
- #include "rtl8822b/phydm_iqk_8822b.h"
- #include "../mac/Halmac_type.h"
-#endif
-#include "phydm_powertracking_win.h"
-
-#if (RTL8821C_SUPPORT == 1)
- #include "rtl8821c/phydm_iqk_8821c.h"
-#endif
-
-enum spur_cal_method {
- PLL_RESET,
- AFE_PHASE_SEL
-};
-
-enum pwrtrack_method {
- BBSWING,
- TXAGC,
- MIX_MODE,
- TSSI_MODE,
- MIX_2G_TSSI_5G_MODE,
- MIX_5G_TSSI_2G_MODE
-};
-
-typedef void(*func_set_pwr)(void *, enum pwrtrack_method, u8, u8);
-typedef void(*func_iqk)(void *, u8, u8, u8);
-typedef void(*func_lck)(void *);
-typedef void(*func_swing)(void *, u8 **, u8 **, u8 **, u8 **);
-typedef void(*func_swing8814only)(void *, u8 **, u8 **, u8 **, u8 **);
-typedef void (*func_swing_xtal)(void *, s8 **, s8 **);
-typedef void (*func_set_xtal)(void *);
-typedef void(*func_all_swing)(void *, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **, u8 **);
-
-struct _TXPWRTRACK_CFG {
- u8 swing_table_size_cck;
- u8 swing_table_size_ofdm;
- u8 threshold_iqk;
- u8 threshold_dpk;
- u8 average_thermal_num;
- u8 rf_path_count;
- u32 thermal_reg_addr;
- func_set_pwr odm_tx_pwr_track_set_pwr;
- func_iqk do_iqk;
- func_lck phy_lc_calibrate;
- func_swing get_delta_swing_table;
- func_swing8814only get_delta_swing_table8814only;
- func_swing_xtal get_delta_swing_xtal_table;
- func_set_xtal odm_txxtaltrack_set_xtal;
- func_all_swing get_delta_all_swing_table;
-};
-
-void
-configure_txpower_track(
- struct PHY_DM_STRUCT *p_dm_odm,
- struct _TXPWRTRACK_CFG *p_config
-);
-
-
-void
-odm_clear_txpowertracking_state(
- struct PHY_DM_STRUCT *p_dm_odm
-);
-
-void
-odm_txpowertracking_callback_thermal_meter(
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- struct PHY_DM_STRUCT *p_dm_odm
-#else
- struct _ADAPTER *adapter
-#endif
-);
-
-
-
-#define ODM_TARGET_CHNL_NUM_2G_5G 59
-
-
-void
-odm_reset_iqk_result(
- struct PHY_DM_STRUCT *p_dm_odm
-);
-u8
-odm_get_right_chnl_place_for_iqk(
- u8 chnl
-);
-
-void odm_iq_calibrate(struct PHY_DM_STRUCT *p_dm_odm);
-void phydm_rf_init(struct PHY_DM_STRUCT *p_dm_odm);
-void phydm_rf_watchdog(struct PHY_DM_STRUCT *p_dm_odm);
-
-#endif /* #ifndef __HAL_PHY_RF_H__ */
diff --git a/hal/phydm/phydm_acs.h b/hal/phydm/phydm_acs.h
index fccbe84..37ddb39 100644
--- a/hal/phydm/phydm_acs.h
+++ b/hal/phydm/phydm_acs.h
@@ -38,27 +38,6 @@ struct _ACS_ {
u8 clean_channel_5g;
u16 channel_info_2g[2][ODM_MAX_CHANNEL_2G]; /* Channel_Info[1]: channel score, Channel_Info[2]:Channel_Scan_Times */
u16 channel_info_5g[2][ODM_MAX_CHANNEL_5G];
-
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- u8 acs_step;
- /* NHM count 0-11 */
- u8 nhm_cnt[14][11];
-
- /* AC-Series, for storing previous setting */
- u32 reg0x990;
- u32 reg0x994;
- u32 reg0x998;
- u32 reg0x99c;
- u8 reg0x9a0; /* u8 */
-
- /* N-Series, for storing previous setting */
- u32 reg0x890;
- u32 reg0x894;
- u32 reg0x898;
- u32 reg0x89c;
- u8 reg0xe28; /* u8 */
-#endif
-
};
@@ -84,22 +63,4 @@ odm_get_auto_channel_select_result(
u8 band
);
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
-
-void
-phydm_auto_channel_select_setting_ap(
- void *p_dm_void,
- u32 setting, /* 0: STORE_DEFAULT_NHM_SETTING; 1: RESTORE_DEFAULT_NHM_SETTING, 2: ACS_NHM_SETTING */
- u32 acs_step
-);
-
-void
-phydm_get_nhm_statistics_ap(
- void *p_dm_void,
- u32 idx, /* @ 2G, Real channel number = idx+1 */
- u32 acs_step
-);
-
-#endif /* #if ( DM_ODM_SUPPORT_TYPE & ODM_AP ) */
-
#endif /* #ifndef __PHYDMACS_H__ */
diff --git a/hal/phydm/phydm_adaptivity.c b/hal/phydm/phydm_adaptivity.c
index fd675f5..2b54ff7 100644
--- a/hal/phydm/phydm_adaptivity.c
+++ b/hal/phydm/phydm_adaptivity.c
@@ -24,13 +24,6 @@
#include "mp_precomp.h"
#include "phydm_precomp.h"
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- #if WPP_SOFTWARE_TRACE
- #include "PhyDM_Adaptivity.tmh"
- #endif
-#endif
-
-
void
phydm_check_adaptivity(
void *p_dm_void
@@ -40,13 +33,6 @@ phydm_check_adaptivity(
struct _ADAPTIVITY_STATISTICS *adaptivity = (struct _ADAPTIVITY_STATISTICS *)phydm_get_structure(p_dm_odm, PHYDM_ADAPTIVITY);
if (p_dm_odm->support_ability & ODM_BB_ADAPTIVITY) {
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if (p_dm_odm->ap_total_num > adaptivity->ap_num_th) {
- p_dm_odm->adaptivity_enable = false;
- p_dm_odm->adaptivity_flag = false;
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("AP total num > %d!!, disable adaptivity\n", adaptivity->ap_num_th));
- } else
-#endif
{
if (adaptivity->dynamic_link_adaptivity || adaptivity->acs_for_adaptivity) {
if (p_dm_odm->is_linked && adaptivity->is_check == false) {
@@ -67,72 +53,8 @@ phydm_check_adaptivity(
p_dm_odm->adaptivity_enable = false;
p_dm_odm->adaptivity_flag = false;
}
-
-
-
}
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-bool
-phydm_check_channel_plan(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *p_adapter = p_dm_odm->adapter;
- PMGNT_INFO p_mgnt_info = &(p_adapter->MgntInfo);
-
- if (p_mgnt_info->RegEnableAdaptivity == 2) {
- if (p_dm_odm->carrier_sense_enable == false) { /*check domain Code for adaptivity or CarrierSense*/
- if ((*p_dm_odm->p_band_type == ODM_BAND_5G) &&
- !(p_dm_odm->odm_regulation_5g == REGULATION_ETSI || p_dm_odm->odm_regulation_5g == REGULATION_WW)) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("adaptivity skip 5G domain code : %d\n", p_dm_odm->odm_regulation_5g));
- p_dm_odm->adaptivity_enable = false;
- p_dm_odm->adaptivity_flag = false;
- return true;
- } else if ((*p_dm_odm->p_band_type == ODM_BAND_2_4G) &&
- !(p_dm_odm->odm_regulation_2_4g == REGULATION_ETSI || p_dm_odm->odm_regulation_2_4g == REGULATION_WW)) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("adaptivity skip 2.4G domain code : %d\n", p_dm_odm->odm_regulation_2_4g));
- p_dm_odm->adaptivity_enable = false;
- p_dm_odm->adaptivity_flag = false;
- return true;
-
- } else if ((*p_dm_odm->p_band_type != ODM_BAND_2_4G) && (*p_dm_odm->p_band_type != ODM_BAND_5G)) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("adaptivity neither 2G nor 5G band, return\n"));
- p_dm_odm->adaptivity_enable = false;
- p_dm_odm->adaptivity_flag = false;
- return true;
- }
- } else {
- if ((*p_dm_odm->p_band_type == ODM_BAND_5G) &&
- !(p_dm_odm->odm_regulation_5g == REGULATION_MKK || p_dm_odm->odm_regulation_5g == REGULATION_WW)) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("CarrierSense skip 5G domain code : %d\n", p_dm_odm->odm_regulation_5g));
- p_dm_odm->adaptivity_enable = false;
- p_dm_odm->adaptivity_flag = false;
- return true;
- }
-
- else if ((*p_dm_odm->p_band_type == ODM_BAND_2_4G) &&
- !(p_dm_odm->odm_regulation_2_4g == REGULATION_MKK || p_dm_odm->odm_regulation_2_4g == REGULATION_WW)) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("CarrierSense skip 2.4G domain code : %d\n", p_dm_odm->odm_regulation_2_4g));
- p_dm_odm->adaptivity_enable = false;
- p_dm_odm->adaptivity_flag = false;
- return true;
-
- } else if ((*p_dm_odm->p_band_type != ODM_BAND_2_4G) && (*p_dm_odm->p_band_type != ODM_BAND_5G)) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("CarrierSense neither 2G nor 5G band, return\n"));
- p_dm_odm->adaptivity_enable = false;
- p_dm_odm->adaptivity_flag = false;
- return true;
- }
- }
- }
-
- return false;
-
-}
-#endif
-
void
phydm_nhm_counter_statistics_init(
void *p_dm_void
@@ -426,9 +348,6 @@ phydm_check_environment(
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
struct _ADAPTIVITY_STATISTICS *adaptivity = (struct _ADAPTIVITY_STATISTICS *)phydm_get_structure(p_dm_odm, PHYDM_ADAPTIVITY);
bool is_clean_environment = false;
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
-#endif
if (adaptivity->is_first_link == true) {
if (p_dm_odm->support_ic_type & (ODM_IC_11AC_GAIN_IDX_EDCCA | ODM_IC_11N_GAIN_IDX_EDCCA))
@@ -456,9 +375,6 @@ phydm_check_environment(
p_dm_odm->adaptivity_flag = false;
else
p_dm_odm->adaptivity_flag = true;
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- priv->pshare->rf_ft_var.is_clean_environment = true;
-#endif
} else {
if (!adaptivity->acs_for_adaptivity) {
p_dm_odm->th_l2h_ini = p_dm_odm->th_l2h_ini_mode2; /*mode2*/
@@ -467,9 +383,6 @@ phydm_check_environment(
p_dm_odm->adaptivity_flag = false;
p_dm_odm->adaptivity_enable = false;
}
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- priv->pshare->rf_ft_var.is_clean_environment = false;
-#endif
}
adaptivity->nhm_wait = 0;
adaptivity->is_first_link = true;
@@ -677,9 +590,6 @@ phydm_adaptivity_init(
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
struct _ADAPTIVITY_STATISTICS *adaptivity = (struct _ADAPTIVITY_STATISTICS *)phydm_get_structure(p_dm_odm, PHYDM_ADAPTIVITY);
s8 igi_target = 0x32;
- /*struct _dynamic_initial_gain_threshold_* p_dm_dig_table = &p_dm_odm->dm_dig_table;*/
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_CE | ODM_WIN))
if (p_dm_odm->carrier_sense_enable == false) {
if (p_dm_odm->th_l2h_ini == 0)
@@ -689,40 +599,11 @@ phydm_adaptivity_init(
if (p_dm_odm->th_edcca_hl_diff == 0)
p_dm_odm->th_edcca_hl_diff = 7;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_CE))
if (p_dm_odm->wifi_test == true || p_dm_odm->mp_mode == true)
-#else
- if ((p_dm_odm->wifi_test & RT_WIFI_LOGO) == true)
-#endif
p_dm_odm->edcca_enable = false; /*even no adaptivity, we still enable EDCCA, AP side use mib control*/
else
p_dm_odm->edcca_enable = true;
-#elif (DM_ODM_SUPPORT_TYPE & ODM_AP)
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
-
- if (p_dm_odm->carrier_sense_enable) {
- p_dm_odm->th_l2h_ini = 0xa;
- p_dm_odm->th_edcca_hl_diff = 7;
- } else {
- p_dm_odm->th_l2h_ini = p_dm_odm->TH_L2H_default; /*set by mib*/
- p_dm_odm->th_edcca_hl_diff = p_dm_odm->th_edcca_hl_diff_default;
- }
-
- if (priv->pshare->rf_ft_var.adaptivity_enable == 3)
- adaptivity->acs_for_adaptivity = true;
- else
- adaptivity->acs_for_adaptivity = false;
-
- if (priv->pshare->rf_ft_var.adaptivity_enable == 2)
- adaptivity->dynamic_link_adaptivity = true;
- else
- adaptivity->dynamic_link_adaptivity = false;
-
- priv->pshare->rf_ft_var.is_clean_environment = false;
-
-#endif
-
p_dm_odm->adaptivity_igi_upper = 0;
p_dm_odm->adaptivity_enable = false; /*use this flag to decide enable or disable*/
@@ -759,10 +640,6 @@ phydm_adaptivity_init(
odm_set_bb_reg(p_dm_odm, ODM_REG_PAGE_B1_97F, BIT(30), 0x1); /*set to page B1*/
odm_set_bb_reg(p_dm_odm, ODM_REG_EDCCA_DCNF_97F, BIT(27) | BIT26, 0x1); /*0:rx_dfir, 1: dcnf_out, 2 :rx_iq, 3: rx_nbi_nf_out*/
odm_set_bb_reg(p_dm_odm, ODM_REG_PAGE_B1_97F, BIT(30), 0x0);
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- if (priv->pshare->rf_ft_var.adaptivity_enable == 1)
- odm_set_bb_reg(p_dm_odm, 0xce8, BIT(13), 0x1); /*0: mean, 1:max pwdB*/
-#endif
} else
odm_set_bb_reg(p_dm_odm, ODM_REG_EDCCA_DCNF_11N, BIT(21) | BIT20, 0x1); /*0:rx_dfir, 1: dcnf_out, 2 :rx_iq, 3: rx_nbi_nf_out*/
}
@@ -801,16 +678,6 @@ phydm_adaptivity(
s8 th_l2h_dmc, th_h2l_dmc;
s8 diff = 0, igi_target;
struct _ADAPTIVITY_STATISTICS *adaptivity = (struct _ADAPTIVITY_STATISTICS *)phydm_get_structure(p_dm_odm, PHYDM_ADAPTIVITY);
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *p_adapter = p_dm_odm->adapter;
- bool is_fw_current_in_ps_mode = false;
-
- p_adapter->HalFunc.GetHwRegHandler(p_adapter, HW_VAR_FW_PSMODE_STATUS, (u8 *)(&is_fw_current_in_ps_mode));
-
- /*Disable EDCCA mode while under LPS mode, added by Roger, 2012.09.14.*/
- if (is_fw_current_in_ps_mode)
- return;
-#endif
if ((p_dm_odm->edcca_enable == false) || (adaptivity->is_stop_edcca == true)) {
ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("Disable EDCCA!!!\n"));
@@ -822,18 +689,6 @@ phydm_adaptivity(
p_dm_odm->th_l2h_ini = p_dm_odm->th_l2h_ini_mode2;
p_dm_odm->th_edcca_hl_diff = p_dm_odm->th_edcca_hl_diff_mode2;
}
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- else {
- if (phydm_check_channel_plan(p_dm_odm) || (p_dm_odm->ap_total_num > adaptivity->ap_num_th)) {
- p_dm_odm->th_l2h_ini = p_dm_odm->th_l2h_ini_mode2;
- p_dm_odm->th_edcca_hl_diff = p_dm_odm->th_edcca_hl_diff_mode2;
- } else {
- p_dm_odm->th_l2h_ini = adaptivity->th_l2h_ini_backup;
- p_dm_odm->th_edcca_hl_diff = adaptivity->th_edcca_hl_diff_backup;
- }
- }
-#endif
-
ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("odm_Adaptivity() =====>\n"));
ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("igi_base=0x%x, th_l2h_ini = %d, th_edcca_hl_diff = %d\n",
adaptivity->igi_base, p_dm_odm->th_l2h_ini, p_dm_odm->th_edcca_hl_diff));
@@ -901,73 +756,6 @@ phydm_adaptivity(
return;
}
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-
-void
-phydm_adaptivity_bsod(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *p_adapter = p_dm_odm->adapter;
- PMGNT_INFO p_mgnt_info = &(p_adapter->MgntInfo);
- u8 count = 0;
- u32 u4_value;
-
- /*
- 1. turn off RF (TRX Mux in standby mode)
- 2. H2C mac id drop
- 3. ignore EDCCA
- 4. wait for clear FIFO
- 5. don't ignore EDCCA
- 6. turn on RF (TRX Mux in TRx mdoe)
- 7. H2C mac id resume
- */
-
- RT_TRACE(COMP_MLME, DBG_WARNING, ("MAC id drop packet!!!!!\n"));
-
- p_adapter->dropPktByMacIdCnt++;
- p_mgnt_info->bDropPktInProgress = true;
-
- p_adapter->HalFunc.GetHwRegHandler(p_adapter, HW_VAR_MAX_Q_PAGE_NUM, (u8 *)(&u4_value));
- RT_TRACE(COMP_INIT, DBG_LOUD, ("Queue Reserved Page number = 0x%08x\n", u4_value));
- p_adapter->HalFunc.GetHwRegHandler(p_adapter, HW_VAR_AVBL_Q_PAGE_NUM, (u8 *)(&u4_value));
- RT_TRACE(COMP_INIT, DBG_LOUD, ("Available Queue Page number = 0x%08x\n", u4_value));
-
- /*Standby mode*/
- phydm_set_trx_mux(p_dm_odm, phydm_standby_mode, phydm_standby_mode);
- odm_write_dig(p_dm_odm, 0x20);
-
- /*H2C mac id drop*/
- MacIdIndicateDisconnect(p_adapter);
-
- /*Ignore EDCCA*/
- phydm_mac_edcca_state(p_dm_odm, phydm_ignore_edcca);
-
- delay_ms(50);
- count = 5;
-
- /*Resume EDCCA*/
- phydm_mac_edcca_state(p_dm_odm, phydm_dont_ignore_edcca);
-
- /*Turn on TRx mode*/
- phydm_set_trx_mux(p_dm_odm, phydm_tx_mode, phydm_rx_mode);
- odm_write_dig(p_dm_odm, 0x20);
-
- /*Resume H2C macid*/
- MacIdRecoverMediaStatus(p_adapter);
-
- p_adapter->HalFunc.GetHwRegHandler(p_adapter, HW_VAR_AVBL_Q_PAGE_NUM, (u8 *)(&u4_value));
- RT_TRACE(COMP_INIT, DBG_LOUD, ("Available Queue Page number = 0x%08x\n", u4_value));
-
- p_mgnt_info->bDropPktInProgress = false;
- RT_TRACE(COMP_MLME, DBG_WARNING, ("End of MAC id drop packet, spent %dms\n", count * 10));
-
-}
-
-#endif
-
/*This API is for solving USB can't Tx problem due to USB3.0 interference in 2.4G*/
void
phydm_pause_edcca(
@@ -983,7 +771,6 @@ phydm_pause_edcca(
if (is_pasue_edcca) {
adaptivity->is_stop_edcca = true;
-
if (p_dm_odm->support_ic_type & (ODM_IC_11AC_GAIN_IDX_EDCCA | ODM_IC_11N_GAIN_IDX_EDCCA)) {
if (adaptivity->adajust_igi_level > IGI)
diff = adaptivity->adajust_igi_level - IGI;
@@ -1010,45 +797,23 @@ phydm_pause_edcca(
ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("pauseEDCCA : L2Hbak = 0x%x, H2Lbak = 0x%x, IGI = 0x%x\n", adaptivity->backup_l2h, adaptivity->backup_h2l, IGI));
/*Disable EDCCA*/
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if (odm_is_work_item_scheduled(&(adaptivity->phydm_pause_edcca_work_item)) == false)
- odm_schedule_work_item(&(adaptivity->phydm_pause_edcca_work_item));
-#else
phydm_pause_edcca_work_item_callback(p_dm_odm);
-#endif
-
} else {
adaptivity->is_stop_edcca = false;
ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_ADAPTIVITY, ODM_DBG_LOUD, ("resumeEDCCA : L2Hbak = 0x%x, H2Lbak = 0x%x, IGI = 0x%x\n", adaptivity->backup_l2h, adaptivity->backup_h2l, IGI));
/*Resume EDCCA*/
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if (odm_is_work_item_scheduled(&(adaptivity->phydm_resume_edcca_work_item)) == false)
- odm_schedule_work_item(&(adaptivity->phydm_resume_edcca_work_item));
-#else
phydm_resume_edcca_work_item_callback(p_dm_odm);
-#endif
-
}
-
}
void
phydm_pause_edcca_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
void *p_dm_void
-#endif
)
{
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-#else
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#endif
if (p_dm_odm->support_ic_type & ODM_IC_11N_SERIES)
odm_set_bb_reg(p_dm_odm, REG_OFDM_0_ECCA_THRESHOLD, MASKBYTE2 | MASKBYTE0, (u32)(0x7f | 0x7f << 16));
@@ -1061,19 +826,10 @@ phydm_pause_edcca_work_item_callback(
void
phydm_resume_edcca_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
void *p_dm_void
-#endif
)
{
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-#else
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#endif
struct _ADAPTIVITY_STATISTICS *adaptivity = (struct _ADAPTIVITY_STATISTICS *)phydm_get_structure(p_dm_odm, PHYDM_ADAPTIVITY);
if (p_dm_odm->support_ic_type & ODM_IC_11N_SERIES)
diff --git a/hal/phydm/phydm_adaptivity.h b/hal/phydm/phydm_adaptivity.h
index 27a50ea..a0bc3a4 100644
--- a/hal/phydm/phydm_adaptivity.h
+++ b/hal/phydm/phydm_adaptivity.h
@@ -27,17 +27,6 @@
#define pwdb_upper_bound 7
#define dfir_loss 5
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
-enum phydm_regulation_type {
- REGULATION_FCC = 0,
- REGULATION_MKK = 1,
- REGULATION_ETSI = 2,
- REGULATION_WW = 3,
-
- MAX_REGULATION_NUM = 4
-};
-#endif
-
enum phydm_adapinfo_e {
PHYDM_ADAPINFO_CARRIER_SENSE_ENABLE = 0,
PHYDM_ADAPINFO_DCBACKOFF,
@@ -45,11 +34,8 @@ enum phydm_adapinfo_e {
PHYDM_ADAPINFO_TH_L2H_INI,
PHYDM_ADAPINFO_TH_EDCCA_HL_DIFF,
PHYDM_ADAPINFO_AP_NUM_TH
-
};
-
-
enum phydm_set_lna {
phydm_disable_lna = 0,
phydm_enable_lna = 1,
@@ -85,10 +71,6 @@ struct _ADAPTIVITY_STATISTICS {
s8 backup_l2h;
s8 backup_h2l;
bool is_stop_edcca;
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- RT_WORK_ITEM phydm_pause_edcca_work_item;
- RT_WORK_ITEM phydm_resume_edcca_work_item;
-#endif
};
void
@@ -180,40 +162,14 @@ phydm_set_edcca_threshold_api(
u8 IGI
);
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-void
-phydm_disable_edcca(
- void *p_dm_void
-);
-
-void
-phydm_dynamic_edcca(
- void *p_dm_void
-);
-
-void
-phydm_adaptivity_bsod(
- void *p_dm_void
-);
-
-#endif
-
void
phydm_pause_edcca_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
void *p_dm_void
-#endif
);
void
phydm_resume_edcca_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
void *p_dm_void
-#endif
);
#endif
diff --git a/hal/phydm/phydm_adc_sampling.c b/hal/phydm/phydm_adc_sampling.c
index f10d7ef..89739a2 100644
--- a/hal/phydm/phydm_adc_sampling.c
+++ b/hal/phydm/phydm_adc_sampling.c
@@ -1,26 +1,9 @@
#include "mp_precomp.h"
#include "phydm_precomp.h"
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- #if ((RTL8197F_SUPPORT == 1) || (RTL8822B_SUPPORT == 1))
- #include "rtl8197f/Hal8197FPhyReg.h"
- #include "WlanHAL/HalMac88XX/halmac_reg2.h"
- #else
- #include "WlanHAL/HalHeader/HalComReg.h"
- #endif
-#endif
#if (PHYDM_LA_MODE_SUPPORT == 1)
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-
-#if WPP_SOFTWARE_TRACE
- #include "phydm_adc_sampling.tmh"
-#endif
-
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
bool
phydm_la_buffer_allocate(
void *p_dm_void
@@ -36,12 +19,8 @@ phydm_la_buffer_allocate(
if (adc_smp_buf->length == 0) {
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- if (PlatformAllocateMemoryWithZero(adapter, (void **)&(adc_smp_buf->octet), adc_smp_buf->buffer_size) != RT_STATUS_SUCCESS) {
-#else
odm_allocate_memory(p_dm_odm, (void **)&adc_smp_buf->octet, adc_smp_buf->buffer_size);
if (!adc_smp_buf->octet) {
-#endif
ret = false;
} else
adc_smp_buf->length = adc_smp_buf->buffer_size;
@@ -50,7 +29,6 @@ phydm_la_buffer_allocate(
return ret;
}
-#endif
void
phydm_la_get_tx_pkt_buf(
@@ -92,14 +70,6 @@ phydm_la_get_tx_pkt_buf(
dbg_print("is_round_up = ((%d)), finish_addr=((0x%x * 8Byte)), Start_Addr = ((0x%x * 8Byte)), smp_number = ((%d))\n", is_round_up, finish_addr, addr_8byte, smp_number);
}
- /*
- dbg_print("is_round_up = %d, finish_addr=0x%x, value32=0x%x\n", is_round_up, finish_addr, value32);
- dbg_print("end_addr = %x, adc_smp_buf->start_pos = 0x%x, adc_smp_buf->buffer_size = 0x%x\n", end_addr, adc_smp_buf->start_pos, adc_smp_buf->buffer_size);
- */
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- watchdog_stop(p_dm_odm->priv);
-#endif
-
if (p_dm_odm->support_ic_type & ODM_RTL8197F) {
for (addr = 0x0, i = 0; addr < end_addr; addr += 8, i += 2) { /*64K byte*/
if ((addr & 0xfff) == 0)
@@ -121,19 +91,12 @@ phydm_la_get_tx_pkt_buf(
data_l = odm_get_bb_reg(p_dm_odm, 0x8000 + (addr & 0xfff), MASKDWORD);
data_h = odm_get_bb_reg(p_dm_odm, 0x8000 + (addr & 0xfff) + 4, MASKDWORD);
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
adc_smp_buf->octet[i] = data_h;
adc_smp_buf->octet[i + 1] = data_l;
-#endif
#if DBG
dbg_print("%08x%08x\n", data_h, data_l);
-#else
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- RT_TRACE_EX(COMP_LA_MODE, DBG_LOUD, ("%08x%08x\n", adc_smp_buf->octet[i], adc_smp_buf->octet[i + 1]));
#endif
-#endif
-
i = i + 2;
if ((addr + 8) >= end_addr)
@@ -146,14 +109,7 @@ phydm_la_get_tx_pkt_buf(
break;
}
dbg_print("smp_cnt = ((%d))\n", smp_cnt);
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- RT_TRACE_EX(COMP_LA_MODE, DBG_LOUD, ("smp_cnt = ((%d))\n", smp_cnt));
-#endif
}
-
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- watchdog_resume(p_dm_odm->priv);
-#endif
}
void
@@ -198,10 +154,6 @@ phydm_la_mode_set_mac_iq_dump(
reg_value = odm_get_bb_reg(p_dm_odm, 0x7c0, 0xff);
dbg_print("4. [Set MAC IQ dump] 0x7c0[7:0] = ((0x%x))\n", reg_value);
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- RT_TRACE_EX(COMP_LA_MODE, DBG_LOUD, ("4. [Set MAC IQ dump] 0x7c0[7:0] = ((0x%x))\n", reg_value));
-#endif
-
}
void
@@ -213,10 +165,6 @@ phydm_la_mode_set_dma_type(
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
dbg_print("2. [LA mode DMA setting] Dma_type = ((%d))\n", la_dma_type);
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- RT_TRACE_EX(COMP_LA_MODE, DBG_LOUD, ("2. [LA mode DMA setting] Dma_type = ((%d))\n", la_dma_type));
-#endif
-
if (p_dm_odm->support_ic_type & ODM_N_ANTDIV_SUPPORT)
odm_set_bb_reg(p_dm_odm, 0x9a0, 0xf00, la_dma_type); /*0x9A0[11:8]*/
else
@@ -248,9 +196,6 @@ phydm_adc_smp_start(
phydm_la_mode_set_mac_iq_dump(p_dm_odm);
/* return; */
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- watchdog_stop(p_dm_odm->priv);
-#endif
target_polling_bit = (adc_smp->is_bb_trigger) ? BIT(1) : BIT(2);
do { /*Polling time always use 100ms, when it exceed 2s, break while loop*/
@@ -273,23 +218,6 @@ phydm_adc_smp_start(
}
} while (while_cnt < 20);
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- watchdog_resume(p_dm_odm->priv);
-#if (RTL8197F_SUPPORT)
- if (p_dm_odm->support_ic_type & ODM_RTL8197F) {
- /*Stop DMA*/
- backup_DMA = odm_get_mac_reg(p_dm_odm, 0x300, MASKLWORD);
- odm_set_mac_reg(p_dm_odm, 0x300, 0x7fff, backup_DMA | 0x7fff);
-
- /*move LA mode content from IMEM to TxPktBuffer
- Src : OCPBASE_IMEM 0x00000000
- Dest : OCPBASE_TXBUF 0x18780000
- Len : 64K*/
- GET_HAL_INTERFACE(p_dm_odm->priv)->init_ddma_handler(p_dm_odm->priv, OCPBASE_IMEM, OCPBASE_TXBUF, 0x10000);
- }
-#endif
-#endif
-
if (adc_smp->adc_smp_state == ADCSMP_STATE_SET) {
if (polling_ok)
@@ -298,21 +226,10 @@ phydm_adc_smp_start(
dbg_print("[Polling timeout]\n");
}
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- if (p_dm_odm->support_ic_type & ODM_RTL8197F)
- odm_set_mac_reg(p_dm_odm, 0x300, 0x7fff, backup_DMA); /*Resume DMA*/
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
if (adc_smp->adc_smp_state == ADCSMP_STATE_SET)
adc_smp->adc_smp_state = ADCSMP_STATE_QUERY;
-#endif
dbg_print("[LA mode] LA_pattern_count = ((%d))\n", adc_smp->la_count);
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- RT_TRACE_EX(COMP_LA_MODE, DBG_LOUD, ("[LA mode] la_count = ((%d))\n", adc_smp->la_count));
-#endif
-
adc_smp_stop(p_dm_odm);
@@ -327,22 +244,6 @@ phydm_adc_smp_start(
}
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-void
-adc_smp_work_item_callback(
- void *p_context
-)
-{
- struct _ADAPTER *adapter = (struct _ADAPTER *)p_context;
- PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
- struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
-
- dbg_print("[WorkItem Call back] LA_State=((%d))\n", adc_smp->adc_smp_state);
- phydm_adc_smp_start(p_dm_odm);
-}
-#endif
-
void
adc_smp_set(
void *p_dm_void,
@@ -362,75 +263,23 @@ adc_smp_set(
adc_smp->la_dma_type = dma_data_sig_sel;
adc_smp->la_trigger_time = trigger_time;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
if (adc_smp->adc_smp_state != ADCSMP_STATE_IDLE)
is_set_success = false;
else if (adc_smp->adc_smp_buf.length == 0)
is_set_success = phydm_la_buffer_allocate(p_dm_odm);
-#endif
if (is_set_success) {
adc_smp->adc_smp_state = ADCSMP_STATE_SET;
dbg_print("[LA Set Success] LA_State=((%d))\n", adc_smp->adc_smp_state);
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-
- dbg_print("ADCSmp_work_item_index = ((%d))\n", adc_smp->la_work_item_index);
- if (adc_smp->la_work_item_index != 0) {
- odm_schedule_work_item(&(adc_smp->adc_smp_work_item_1));
- adc_smp->la_work_item_index = 0;
- } else {
- odm_schedule_work_item(&(adc_smp->adc_smp_work_item));
- adc_smp->la_work_item_index = 1;
- }
-#else
phydm_adc_smp_start(p_dm_odm);
-#endif
} else
dbg_print("[LA Set Fail] LA_State=((%d))\n", adc_smp->adc_smp_state);
}
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-enum rt_status
-adc_smp_query(
- void *p_dm_void,
- ULONG information_buffer_length,
- void *information_buffer,
- PULONG bytes_written
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _RT_ADCSMP *adc_smp = &(p_dm_odm->adcsmp);
- enum rt_status ret_status = RT_STATUS_SUCCESS;
- struct _RT_ADCSMP_STRING *adc_smp_buf = &(adc_smp->adc_smp_buf);
-
- dbg_print("[%s] LA_State=((%d))", __func__, adc_smp->adc_smp_state);
-
- if (information_buffer_length != adc_smp_buf->buffer_size) {
- *bytes_written = 0;
- ret_status = RT_STATUS_RESOURCE;
- } else if (adc_smp_buf->length != adc_smp_buf->buffer_size) {
- *bytes_written = 0;
- ret_status = RT_STATUS_RESOURCE;
- } else if (adc_smp->adc_smp_state != ADCSMP_STATE_QUERY) {
- *bytes_written = 0;
- ret_status = RT_STATUS_PENDING;
- } else {
- odm_move_memory(p_dm_odm, information_buffer, adc_smp_buf->octet, adc_smp_buf->buffer_size);
- *bytes_written = adc_smp_buf->buffer_size;
-
- adc_smp->adc_smp_state = ADCSMP_STATE_IDLE;
- }
-
- dbg_print("Return status %d\n", ret_status);
-
- return ret_status;
-}
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
-
void
adc_smp_query(
void *p_dm_void,
@@ -498,8 +347,6 @@ adc_smp_query_single_data(
return 0;
}
-#endif
-
void
adc_smp_stop(
void *p_dm_void
@@ -539,7 +386,6 @@ adc_smp_init(
}
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
void
adc_smp_de_init(
void *p_dm_void
@@ -557,9 +403,6 @@ adc_smp_de_init(
}
}
-#endif
-
-
void
phydm_la_mode_bb_setting(
void *p_dm_void
@@ -577,11 +420,6 @@ phydm_la_mode_bb_setting(
dbg_print("1. [LA mode bb_setting] trig_mode = ((%d)), dbg_port = ((0x%x)), Trig_Edge = ((%d)), smp_rate = ((%d)), Trig_Sel = ((0x%x))\n",
trig_mode, dbg_port, is_trigger_edge, sampling_rate, trig_sig_sel);
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- RT_TRACE_EX(COMP_LA_MODE, DBG_LOUD, ("1. [LA mode bb_setting]trig_mode = ((%d)), dbg_port = ((0x%x)), Trig_Edge = ((%d)), smp_rate = ((%d)), Trig_Sel = ((0x%x))\n",
- trig_mode, dbg_port, is_trigger_edge, sampling_rate, trig_sig_sel));
-#endif
-
if (trig_mode == PHYDM_MAC_TRIG)
trig_sig_sel = 0; /*ignore this setting*/
@@ -671,16 +509,12 @@ phydm_la_mode_set_trigger_time(
trigger_time_unit_num = (u8)(trigger_time_mu_sec >> time_unit);
dbg_print("3. [Set Trigger Time] Trig_Time = ((%d)) * unit = ((2^%d us))\n", trigger_time_unit_num, time_unit);
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- RT_TRACE_EX(COMP_LA_MODE, DBG_LOUD, ("3. [Set Trigger Time] Trig_Time = ((%d)) * unit = ((2^%d us))\n", trigger_time_unit_num, time_unit));
-#endif
odm_set_mac_reg(p_dm_odm, 0x7cc, BIT(20) | BIT(19) | BIT(18), time_unit);
odm_set_mac_reg(p_dm_odm, 0x7c0, 0x7f00, (trigger_time_unit_num & 0x7f));
}
-
void
phydm_lamode_trigger_setting(
void *p_dm_void,
@@ -744,10 +578,6 @@ phydm_lamode_trigger_setting(
dbg_print("echo lamode %d %d %d %d %d %d %x %d %d %d\n", var1[0], var1[1], var1[2], var1[3], var1[4], var1[5], var1[6], var1[7], var1[8], var1[9]);
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- RT_TRACE_EX(COMP_LA_MODE, DBG_LOUD, ("echo lamode %d %d %d %d %d %d %x %d %d %d\n", var1[0], var1[1], var1[2], var1[3], var1[4], var1[5], var1[6], var1[7], var1[8], var1[9]));
-#endif
-
PHYDM_SNPRINTF((output + used, out_len - used, "a.En= ((1)), b.mode = ((%d)), c.Trig_Sel = ((0x%x)), d.Dma_type = ((%d))\n", trig_mode, trig_sig_sel, dma_data_sig_sel));
PHYDM_SNPRINTF((output + used, out_len - used, "e.Trig_Time = ((%dus)), f.mac_ref_mask = ((0x%x)), g.dbg_port = ((0x%x))\n", trigger_time_mu_sec, adc_smp->la_mac_ref_mask, adc_smp->la_dbg_port));
PHYDM_SNPRINTF((output + used, out_len - used, "h.Trig_edge = ((%d)), i.smp rate = ((%d MHz)), j.Cap_num = ((%d))\n", adc_smp->la_trigger_edge, (80 >> adc_smp->la_smp_rate), adc_smp->la_count));
diff --git a/hal/phydm/phydm_adc_sampling.h b/hal/phydm/phydm_adc_sampling.h
index 2acd0f5..1aec843 100644
--- a/hal/phydm/phydm_adc_sampling.h
+++ b/hal/phydm/phydm_adc_sampling.h
@@ -51,20 +51,8 @@ struct _RT_ADCSMP {
u32 la_count;
u8 is_bb_trigger;
u8 la_work_item_index;
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- RT_WORK_ITEM adc_smp_work_item;
- RT_WORK_ITEM adc_smp_work_item_1;
-#endif
};
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-void
-adc_smp_work_item_callback(
- void *p_context
-);
-#endif
-
void
adc_smp_set(
void *p_dm_void,
@@ -75,15 +63,6 @@ adc_smp_set(
u16 polling_time
);
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-enum rt_status
-adc_smp_query(
- void *p_dm_void,
- ULONG information_buffer_length,
- void *information_buffer,
- PULONG bytes_written
-);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
void
adc_smp_query(
void *p_dm_void,
@@ -105,7 +84,6 @@ adc_smp_query_single_data(
u32 index
);
-#endif
void
adc_smp_stop(
void *p_dm_void
@@ -116,12 +94,10 @@ adc_smp_init(
void *p_dm_void
);
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
void
adc_smp_de_init(
void *p_dm_void
);
-#endif
void
phydm_la_mode_bb_setting(
diff --git a/hal/phydm/phydm_antdect.c b/hal/phydm/phydm_antdect.c
index e23b320..0db6d07 100644
--- a/hal/phydm/phydm_antdect.c
+++ b/hal/phydm/phydm_antdect.c
@@ -25,7 +25,6 @@
#include "mp_precomp.h"
#include "phydm_precomp.h"
-/* #if( DM_ODM_SUPPORT_TYPE & (ODM_WIN |ODM_CE)) */
#if (defined(CONFIG_ANT_DETECTION))
/* IS_ANT_DETECT_SUPPORT_SINGLE_TONE(adapter)
diff --git a/hal/phydm/phydm_antdect.h b/hal/phydm/phydm_antdect.h
index 59d279b..54d47f3 100644
--- a/hal/phydm/phydm_antdect.h
+++ b/hal/phydm/phydm_antdect.h
@@ -24,7 +24,6 @@
#define ANTDECT_VERSION "2.1" /*2015.07.29 by YuChen*/
#if (defined(CONFIG_ANT_DETECTION))
-/* #if( DM_ODM_SUPPORT_TYPE & (ODM_WIN |ODM_CE)) */
/* ANT Test */
#define ANTTESTALL 0x00 /*ant A or B will be Testing*/
#define ANTTESTA 0x01 /*ant A will be Testing*/
diff --git a/hal/phydm/phydm_antdiv.c b/hal/phydm/phydm_antdiv.c
index 48315f6..22aa365 100644
--- a/hal/phydm/phydm_antdiv.c
+++ b/hal/phydm/phydm_antdiv.c
@@ -367,123 +367,6 @@ odm_update_tx_ant(
}
#ifdef BEAMFORMING_SUPPORT
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
-
-void
-odm_bdc_init(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _BF_DIV_COEX_ *p_dm_bdc_table = &p_dm_odm->dm_bdc_table;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("\n[ BDC Initialization......]\n"));
- p_dm_bdc_table->BDC_state = BDC_DIV_TRAIN_STATE;
- p_dm_bdc_table->bdc_mode = BDC_MODE_NULL;
- p_dm_bdc_table->bdc_try_flag = 0;
- p_dm_bdc_table->bd_ccoex_type_wbfer = 0;
- p_dm_odm->bdc_holdstate = 0xff;
-
- if (p_dm_odm->support_ic_type == ODM_RTL8192E) {
- odm_set_bb_reg(p_dm_odm, 0xd7c, 0x0FFFFFFF, 0x1081008);
- odm_set_bb_reg(p_dm_odm, 0xd80, 0x0FFFFFFF, 0);
- } else if (p_dm_odm->support_ic_type == ODM_RTL8812) {
- odm_set_bb_reg(p_dm_odm, 0x9b0, 0x0FFFFFFF, 0x1081008); /* 0x9b0[30:0] = 01081008 */
- odm_set_bb_reg(p_dm_odm, 0x9b4, 0x0FFFFFFF, 0); /* 0x9b4[31:0] = 00000000 */
- }
-
-}
-
-
-void
-odm_CSI_on_off(
- void *p_dm_void,
- u8 CSI_en
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- if (CSI_en == CSI_ON) {
- if (p_dm_odm->support_ic_type == ODM_RTL8192E) {
- odm_set_mac_reg(p_dm_odm, 0xd84, BIT(11), 1); /* 0xd84[11]=1 */
- } else if (p_dm_odm->support_ic_type == ODM_RTL8812) {
- odm_set_mac_reg(p_dm_odm, 0x9b0, BIT(31), 1); /* 0x9b0[31]=1 */
- }
-
- } else if (CSI_en == CSI_OFF) {
- if (p_dm_odm->support_ic_type == ODM_RTL8192E) {
- odm_set_mac_reg(p_dm_odm, 0xd84, BIT(11), 0); /* 0xd84[11]=0 */
- } else if (p_dm_odm->support_ic_type == ODM_RTL8812) {
- odm_set_mac_reg(p_dm_odm, 0x9b0, BIT(31), 0); /* 0x9b0[31]=0 */
- }
- }
-}
-
-void
-odm_bd_ccoex_type_with_bfer_client(
- void *p_dm_void,
- u8 swch
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _BF_DIV_COEX_ *p_dm_bdc_table = &p_dm_odm->dm_bdc_table;
- u8 bd_ccoex_type_wbfer;
-
- if (swch == DIVON_CSIOFF) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[BDCcoexType: 1] {DIV,CSI} ={1,0}\n"));
- bd_ccoex_type_wbfer = 1;
-
- if (bd_ccoex_type_wbfer != p_dm_bdc_table->bd_ccoex_type_wbfer) {
- odm_ant_div_on_off(p_dm_odm, ANTDIV_ON);
- odm_CSI_on_off(p_dm_odm, CSI_OFF);
- p_dm_bdc_table->bd_ccoex_type_wbfer = 1;
- }
- } else if (swch == DIVOFF_CSION) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[BDCcoexType: 2] {DIV,CSI} ={0,1}\n"));
- bd_ccoex_type_wbfer = 2;
-
- if (bd_ccoex_type_wbfer != p_dm_bdc_table->bd_ccoex_type_wbfer) {
- odm_ant_div_on_off(p_dm_odm, ANTDIV_OFF);
- odm_CSI_on_off(p_dm_odm, CSI_ON);
- p_dm_bdc_table->bd_ccoex_type_wbfer = 2;
- }
- }
-}
-
-void odm_bf_ant_div_mode_arbitration(void *p_dm_void)
-{
-}
-
-void
-odm_div_train_state_setting(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _BF_DIV_COEX_ *p_dm_bdc_table = &p_dm_odm->dm_bdc_table;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("\n*****[S T A R T ]***** [2-0. DIV_TRAIN_STATE]\n"));
- p_dm_bdc_table->bdc_try_counter = 2;
- p_dm_bdc_table->bdc_try_flag = 1;
- p_dm_bdc_table->BDC_state = bdc_bfer_train_state;
- odm_bd_ccoex_type_with_bfer_client(p_dm_odm, DIVON_CSIOFF);
-}
-
-void
-odm_bd_ccoex_bfee_rx_div_arbitration(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _BF_DIV_COEX_ *p_dm_bdc_table = &p_dm_odm->dm_bdc_table;
- bool stop_bf_flag;
- u8 bdc_active_mode;
-
-
-#endif /* #ifdef BEAMFORMING_SUPPORT */
-
-
-#if (RTL8188E_SUPPORT == 1)
-
void
odm_rx_hw_ant_div_init_88e(
@@ -642,828 +525,6 @@ void odm_smart_hw_ant_div_init_88e(void *p_dm_void)
}
#endif
-#endif /* #if (RTL8188E_SUPPORT == 1) */
-
-
-#if (RTL8192E_SUPPORT == 1)
-void
-odm_rx_hw_ant_div_init_92e(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _FAST_ANTENNA_TRAINNING_ *p_dm_fat_table = &p_dm_odm->dm_fat_table;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8192E AntDiv_Init => ant_div_type=[CGCS_RX_HW_ANTDIV]\n"));
-
- /* Pin Settings */
- odm_set_bb_reg(p_dm_odm, 0x870, BIT(8), 0);/* reg870[8]=1'b0, */ /* "antsel" is controled by HWs */
- odm_set_bb_reg(p_dm_odm, 0xc50, BIT(8), 1); /* regc50[8]=1'b1 */ /* " CS/CG switching" is controled by HWs */
-
- /* Mapping table */
- odm_set_bb_reg(p_dm_odm, 0x914, 0xFFFF, 0x0100); /* antenna mapping table */
-
- /* OFDM Settings */
- odm_set_bb_reg(p_dm_odm, 0xca4, 0x7FF, 0xA0); /* thershold */
- odm_set_bb_reg(p_dm_odm, 0xca4, 0x7FF000, 0x0); /* bias */
-
- /* CCK Settings */
- odm_set_bb_reg(p_dm_odm, 0xa04, 0xF000000, 0); /* Select which path to receive for CCK_1 & CCK_2 */
- odm_set_bb_reg(p_dm_odm, 0xb34, BIT(30), 0); /* (92E) ANTSEL_CCK_opt = r_en_antsel_cck? ANTSEL_CCK: 1'b0 */
- odm_set_bb_reg(p_dm_odm, 0xa74, BIT(7), 1); /* Fix CCK PHY status report issue */
- odm_set_bb_reg(p_dm_odm, 0xa0c, BIT(4), 1); /* CCK complete HW AntDiv within 64 samples */
-
-#ifdef ODM_EVM_ENHANCE_ANTDIV
- /* EVM enhance AntDiv method init---------------------------------------------------------------------- */
- p_dm_fat_table->EVM_method_enable = 0;
- p_dm_fat_table->fat_state = NORMAL_STATE_MIAN;
- p_dm_odm->antdiv_intvl = 0x64;
- odm_set_bb_reg(p_dm_odm, 0x910, 0x3f, 0xf);
- p_dm_odm->antdiv_evm_en = 1;
- /* p_dm_odm->antdiv_period=1; */
- p_dm_odm->evm_antdiv_period = 3;
-
-#endif
-
-}
-
-void
-odm_trx_hw_ant_div_init_92e(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _FAST_ANTENNA_TRAINNING_ *p_dm_fat_table = &p_dm_odm->dm_fat_table;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8192E AntDiv_Init => ant_div_type=[ Only for DIR605, CG_TRX_HW_ANTDIV]\n"));
-
- /* 3 --RFE pin setting--------- */
- /* [MAC] */
- odm_set_mac_reg(p_dm_odm, 0x38, BIT(11), 1); /* DBG PAD Driving control (GPIO 8) */
- odm_set_mac_reg(p_dm_odm, 0x4c, BIT(23), 0); /* path-A, RFE_CTRL_3 */
- odm_set_mac_reg(p_dm_odm, 0x4c, BIT(29), 1); /* path-A, RFE_CTRL_8 */
- /* [BB] */
- odm_set_bb_reg(p_dm_odm, 0x944, BIT(3), 1); /* RFE_buffer */
- odm_set_bb_reg(p_dm_odm, 0x944, BIT(8), 1);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(7) | BIT6, 0x0); /* r_rfe_path_sel_ (RFE_CTRL_3) */
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(17) | BIT16, 0x0); /* r_rfe_path_sel_ (RFE_CTRL_8) */
- odm_set_bb_reg(p_dm_odm, 0x944, BIT(31), 0); /* RFE_buffer */
- odm_set_bb_reg(p_dm_odm, 0x92C, BIT(3), 0); /* rfe_inv (RFE_CTRL_3) */
- odm_set_bb_reg(p_dm_odm, 0x92C, BIT(8), 1); /* rfe_inv (RFE_CTRL_8) */
- odm_set_bb_reg(p_dm_odm, 0x930, 0xF000, 0x8); /* path-A, RFE_CTRL_3 */
- odm_set_bb_reg(p_dm_odm, 0x934, 0xF, 0x8); /* path-A, RFE_CTRL_8 */
- /* 3 ------------------------- */
-
- /* Pin Settings */
- odm_set_bb_reg(p_dm_odm, 0xC50, BIT(8), 0); /* path-A */ /* disable CS/CG switch */
-
- odm_set_bb_reg(p_dm_odm, 0x870, BIT(9) | BIT8, 0); /* path-A */ /* antsel antselb by HW */
- odm_set_bb_reg(p_dm_odm, 0xB38, BIT(10), 0); /* path-A */ /* antsel2 by HW */
-
- /* Mapping table */
- odm_set_bb_reg(p_dm_odm, 0x914, 0xFFFF, 0x0100); /* antenna mapping table */
-
- /* OFDM Settings */
- odm_set_bb_reg(p_dm_odm, 0xca4, 0x7FF, 0xA0); /* thershold */
- odm_set_bb_reg(p_dm_odm, 0xca4, 0x7FF000, 0x0); /* bias */
-
- /* CCK Settings */
- odm_set_bb_reg(p_dm_odm, 0xa04, 0xF000000, 0); /* Select which path to receive for CCK_1 & CCK_2 */
- odm_set_bb_reg(p_dm_odm, 0xb34, BIT(30), 0); /* (92E) ANTSEL_CCK_opt = r_en_antsel_cck? ANTSEL_CCK: 1'b0 */
- odm_set_bb_reg(p_dm_odm, 0xa74, BIT(7), 1); /* Fix CCK PHY status report issue */
- odm_set_bb_reg(p_dm_odm, 0xa0c, BIT(4), 1); /* CCK complete HW AntDiv within 64 samples */
-
-#ifdef ODM_EVM_ENHANCE_ANTDIV
- /* EVM enhance AntDiv method init---------------------------------------------------------------------- */
- p_dm_fat_table->EVM_method_enable = 0;
- p_dm_fat_table->fat_state = NORMAL_STATE_MIAN;
- p_dm_odm->antdiv_intvl = 0x64;
- odm_set_bb_reg(p_dm_odm, 0x910, 0x3f, 0xf);
- p_dm_odm->antdiv_evm_en = 1;
- /* p_dm_odm->antdiv_period=1; */
- p_dm_odm->evm_antdiv_period = 3;
-#endif
-}
-
-#if (defined(CONFIG_5G_CG_SMART_ANT_DIVERSITY)) || (defined(CONFIG_2G_CG_SMART_ANT_DIVERSITY))
-void
-odm_smart_hw_ant_div_init_92e(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8192E AntDiv_Init => ant_div_type=[CG_TRX_SMART_ANTDIV]\n"));
-}
-#endif
-
-#endif /* #if (RTL8192E_SUPPORT == 1) */
-
-#if (RTL8723D_SUPPORT == 1)
-void
-odm_trx_hw_ant_div_init_8723d(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[8723D] AntDiv_Init => ant_div_type=[S0S1_HW_TRX_AntDiv]\n"));
-
- /*BT Coexistence*/
- /*keep antsel_map when GNT_BT = 1*/
- odm_set_bb_reg(p_dm_odm, 0x864, BIT(12), 1);
- /* Disable hw antsw & fast_train.antsw when GNT_BT=1 */
- odm_set_bb_reg(p_dm_odm, 0x874, BIT(23), 0);
- /* Disable hw antsw & fast_train.antsw when BT TX/RX */
- odm_set_bb_reg(p_dm_odm, 0xE64, 0xFFFF0000, 0x000c);
-
-
- odm_set_bb_reg(p_dm_odm, 0x870, BIT(9) | BIT(8), 0);
- /*PTA setting: WL_BB_SEL_BTG_TRXG_anta, (1: HW CTRL 0: SW CTRL)*/
- /*odm_set_bb_reg(p_dm_odm, 0x948, BIT6, 0);*/
- /*odm_set_bb_reg(p_dm_odm, 0x948, BIT8, 0);*/
- /*GNT_WL tx*/
- odm_set_bb_reg(p_dm_odm, 0x950, BIT(29), 0);
-
-
- /*Mapping Table*/
- odm_set_bb_reg(p_dm_odm, 0x914, MASKBYTE0, 0);
- odm_set_bb_reg(p_dm_odm, 0x914, MASKBYTE1, 3);
- /* odm_set_bb_reg(p_dm_odm, 0x864, BIT5|BIT4|BIT3, 0); */
- /* odm_set_bb_reg(p_dm_odm, 0x864, BIT8|BIT7|BIT6, 1); */
-
- /* Set WLBB_SEL_RF_ON 1 if RXFIR_PWDB > 0xCcc[3:0] */
- odm_set_bb_reg(p_dm_odm, 0xCcc, BIT(12), 0);
- /* Low-to-High threshold for WLBB_SEL_RF_ON when OFDM enable */
- odm_set_bb_reg(p_dm_odm, 0xCcc, 0x0F, 0x01);
- /* High-to-Low threshold for WLBB_SEL_RF_ON when OFDM enable */
- odm_set_bb_reg(p_dm_odm, 0xCcc, 0xF0, 0x0);
- /* b Low-to-High threshold for WLBB_SEL_RF_ON when OFDM disable ( only CCK ) */
- odm_set_bb_reg(p_dm_odm, 0xAbc, 0xFF, 0x06);
- /* High-to-Low threshold for WLBB_SEL_RF_ON when OFDM disable ( only CCK ) */
- odm_set_bb_reg(p_dm_odm, 0xAbc, 0xFF00, 0x00);
-
-
- /*OFDM HW AntDiv Parameters*/
- odm_set_bb_reg(p_dm_odm, 0xCA4, 0x7FF, 0xa0);
- odm_set_bb_reg(p_dm_odm, 0xCA4, 0x7FF000, 0x00);
- odm_set_bb_reg(p_dm_odm, 0xC5C, BIT(20) | BIT(19) | BIT(18), 0x04);
-
- /*CCK HW AntDiv Parameters*/
- odm_set_bb_reg(p_dm_odm, 0xA74, BIT(7), 1);
- odm_set_bb_reg(p_dm_odm, 0xA0C, BIT(4), 1);
- odm_set_bb_reg(p_dm_odm, 0xAA8, BIT(8), 0);
-
- odm_set_bb_reg(p_dm_odm, 0xA0C, 0x0F, 0xf);
- odm_set_bb_reg(p_dm_odm, 0xA14, 0x1F, 0x8);
- odm_set_bb_reg(p_dm_odm, 0xA10, BIT(13), 0x1);
- odm_set_bb_reg(p_dm_odm, 0xA74, BIT(8), 0x0);
- odm_set_bb_reg(p_dm_odm, 0xB34, BIT(30), 0x1);
-
- /*disable antenna training */
- odm_set_bb_reg(p_dm_odm, 0xE08, BIT(16), 0);
- odm_set_bb_reg(p_dm_odm, 0xc50, BIT(8), 0);
-
-}
-
-void phydm_set_tx_ant_pwr_8723d(void *p_dm_void, u8 ant)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _FAST_ANTENNA_TRAINNING_ *p_dm_fat_table = &p_dm_odm->dm_fat_table;
- struct _ADAPTER *p_adapter = p_dm_odm->adapter;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter);
-
- p_dm_fat_table->rx_idle_ant = ant;
-
- rtw_hal_set_tx_power_level(p_adapter, *p_dm_odm->p_channel);
-}
-#endif
-
-#if (RTL8723B_SUPPORT == 1)
-void
-odm_trx_hw_ant_div_init_8723b(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8723B AntDiv_Init => ant_div_type=[CG_TRX_HW_ANTDIV(DPDT)]\n"));
-
- /* Mapping Table */
- odm_set_bb_reg(p_dm_odm, 0x914, MASKBYTE0, 0);
- odm_set_bb_reg(p_dm_odm, 0x914, MASKBYTE1, 1);
-
- /* OFDM HW AntDiv Parameters */
- odm_set_bb_reg(p_dm_odm, 0xCA4, 0x7FF, 0xa0); /* thershold */
- odm_set_bb_reg(p_dm_odm, 0xCA4, 0x7FF000, 0x00); /* bias */
-
- /* CCK HW AntDiv Parameters */
- odm_set_bb_reg(p_dm_odm, 0xA74, BIT(7), 1); /* patch for clk from 88M to 80M */
- odm_set_bb_reg(p_dm_odm, 0xA0C, BIT(4), 1); /* do 64 samples */
-
- /* BT Coexistence */
- odm_set_bb_reg(p_dm_odm, 0x864, BIT(12), 0); /* keep antsel_map when GNT_BT = 1 */
- odm_set_bb_reg(p_dm_odm, 0x874, BIT(23), 0); /* Disable hw antsw & fast_train.antsw when GNT_BT=1 */
-
- /* Output Pin Settings */
- odm_set_bb_reg(p_dm_odm, 0x870, BIT(8), 0);
-
- odm_set_bb_reg(p_dm_odm, 0x948, BIT(6), 0); /* WL_BB_SEL_BTG_TRXG_anta, (1: HW CTRL 0: SW CTRL) */
- odm_set_bb_reg(p_dm_odm, 0x948, BIT(7), 0);
-
- odm_set_mac_reg(p_dm_odm, 0x40, BIT(3), 1);
- odm_set_mac_reg(p_dm_odm, 0x38, BIT(11), 1);
- odm_set_mac_reg(p_dm_odm, 0x4C, BIT(24) | BIT23, 2); /* select DPDT_P and DPDT_N as output pin */
-
- odm_set_bb_reg(p_dm_odm, 0x944, BIT(0) | BIT1, 3); /* in/out */
- odm_set_bb_reg(p_dm_odm, 0x944, BIT(31), 0);
-
- odm_set_bb_reg(p_dm_odm, 0x92C, BIT(1), 0); /* DPDT_P non-inverse */
- odm_set_bb_reg(p_dm_odm, 0x92C, BIT(0), 1); /* DPDT_N inverse */
-
- odm_set_bb_reg(p_dm_odm, 0x930, 0xF0, 8); /* DPDT_P = ANTSEL[0] */
- odm_set_bb_reg(p_dm_odm, 0x930, 0xF, 8); /* DPDT_N = ANTSEL[0] */
-
- /* 2 [--For HW Bug setting] */
- if (p_dm_odm->ant_type == ODM_AUTO_ANT)
- odm_set_bb_reg(p_dm_odm, 0xA00, BIT(15), 0); /* CCK AntDiv function block enable */
-
-}
-
-void
-odm_s0s1_sw_ant_div_init_8723b(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _sw_antenna_switch_ *p_dm_swat_table = &p_dm_odm->dm_swat_table;
- struct _FAST_ANTENNA_TRAINNING_ *p_dm_fat_table = &p_dm_odm->dm_fat_table;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8723B AntDiv_Init => ant_div_type=[ S0S1_SW_AntDiv]\n"));
-
- /* Mapping Table */
- odm_set_bb_reg(p_dm_odm, 0x914, MASKBYTE0, 0);
- odm_set_bb_reg(p_dm_odm, 0x914, MASKBYTE1, 1);
-
- /* Output Pin Settings */
- /* odm_set_bb_reg(p_dm_odm, 0x948, BIT6, 0x1); */
- odm_set_bb_reg(p_dm_odm, 0x870, BIT(9) | BIT(8), 0);
-
- p_dm_fat_table->is_become_linked = false;
- p_dm_swat_table->try_flag = SWAW_STEP_INIT;
- p_dm_swat_table->double_chk_flag = 0;
-
- /* 2 [--For HW Bug setting] */
- odm_set_bb_reg(p_dm_odm, 0x80C, BIT(21), 0); /* TX ant by Reg */
-
-}
-
-void
-odm_update_rx_idle_ant_8723b(
- void *p_dm_void,
- u8 ant,
- u32 default_ant,
- u32 optional_ant
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _FAST_ANTENNA_TRAINNING_ *p_dm_fat_table = &p_dm_odm->dm_fat_table;
- struct _ADAPTER *p_adapter = p_dm_odm->adapter;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter);
- u8 count = 0;
- u8 u1_temp;
- u8 h2c_parameter;
-
- if ((!p_dm_odm->is_linked) && (p_dm_odm->ant_type == ODM_AUTO_ANT)) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Update Rx-Idle-ant ] 8723B: Fail to set RX antenna due to no link\n"));
- return;
- }
-
- odm_set_bb_reg(p_dm_odm, 0x948, BIT(6), 0x1);
- odm_set_bb_reg(p_dm_odm, 0x948, BIT(9), default_ant);
- odm_set_bb_reg(p_dm_odm, 0x864, BIT(5) | BIT4 | BIT3, default_ant); /*Default RX*/
- odm_set_bb_reg(p_dm_odm, 0x864, BIT(8) | BIT7 | BIT6, optional_ant); /*Optional RX*/
- odm_set_bb_reg(p_dm_odm, 0x860, BIT(14) | BIT13 | BIT12, default_ant); /*Default TX*/
- p_dm_fat_table->rx_idle_ant = ant;
-
- /* Set TX AGC by S0/S1 */
- /* Need to consider Linux driver */
- rtw_hal_set_tx_power_level(p_adapter, *p_dm_odm->p_channel);
-
- /* Set IQC by S0/S1 */
- odm_set_iqc_by_rfpath(p_dm_odm, default_ant);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Update Rx-Idle-ant ] 8723B: Success to set RX antenna\n"));
-}
-
-bool
-phydm_is_bt_enable_8723b(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u32 bt_state;
- /*u32 reg75;*/
-
- /*reg75 = odm_get_bb_reg(p_dm_odm, 0x74, BIT8);*/
- /*odm_set_bb_reg(p_dm_odm, 0x74, BIT8, 0x0);*/
- odm_set_bb_reg(p_dm_odm, 0xa0, BIT(24) | BIT(25) | BIT(26), 0x5);
- bt_state = odm_get_bb_reg(p_dm_odm, 0xa0, (BIT(3) | BIT(2) | BIT(1) | BIT(0)));
- /*odm_set_bb_reg(p_dm_odm, 0x74, BIT8, reg75);*/
-
- if ((bt_state == 4) || (bt_state == 7) || (bt_state == 9) || (bt_state == 13))
- return true;
- else
- return false;
-}
-#endif /* #if (RTL8723B_SUPPORT == 1) */
-
-#if (RTL8821A_SUPPORT == 1)
-#ifdef CONFIG_HL_SMART_ANTENNA_TYPE1
-void
-phydm_hl_smart_ant_type1_init_8821a(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _SMART_ANTENNA_TRAINNING_ *pdm_sat_table = &(p_dm_odm->dm_sat_table);
- struct _FAST_ANTENNA_TRAINNING_ *p_dm_fat_table = &p_dm_odm->dm_fat_table;
- u32 value32;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8821A SmartAnt_Init => ant_div_type=[Hong-Lin Smart ant Type1]\n"));
-
- /* ---------------------------------------- */
- /* GPIO 2-3 for Beam control */
- /* reg0x66[2]=0 */
- /* reg0x44[27:26] = 0 */
- /* reg0x44[23:16] enable_output for P_GPIO[7:0] */
- /* reg0x44[15:8] output_value for P_GPIO[7:0] */
- /* reg0x40[1:0] = 0 GPIO function */
- /* ------------------------------------------ */
-
- /*GPIO setting*/
- odm_set_mac_reg(p_dm_odm, 0x64, BIT(18), 0);
- odm_set_mac_reg(p_dm_odm, 0x44, BIT(27) | BIT(26), 0);
- odm_set_mac_reg(p_dm_odm, 0x44, BIT(19) | BIT18, 0x3); /*enable_output for P_GPIO[3:2]*/
- /*odm_set_mac_reg(p_dm_odm, 0x44, BIT(11)|BIT10, 0);*/ /*output value*/
- odm_set_mac_reg(p_dm_odm, 0x40, BIT(1) | BIT0, 0); /*GPIO function*/
-
- /*Hong_lin smart antenna HW setting*/
- pdm_sat_table->data_codeword_bit_num = 24;/*max=32*/
- pdm_sat_table->beam_patten_num_each_ant = 4;
-
-#if DEV_BUS_TYPE == RT_SDIO_INTERFACE
- pdm_sat_table->latch_time = 100; /*mu sec*/
-#elif DEV_BUS_TYPE == RT_USB_INTERFACE
- pdm_sat_table->latch_time = 100; /*mu sec*/
-#endif
- pdm_sat_table->pkt_skip_statistic_en = 0;
-
- pdm_sat_table->ant_num = 1;/*max=8*/
- pdm_sat_table->ant_num_total = NUM_ANTENNA_8821A;
- pdm_sat_table->first_train_ant = MAIN_ANT;
-
- pdm_sat_table->rfu_codeword_table[0] = 0x0;
- pdm_sat_table->rfu_codeword_table[1] = 0x4;
- pdm_sat_table->rfu_codeword_table[2] = 0x8;
- pdm_sat_table->rfu_codeword_table[3] = 0xc;
-
- pdm_sat_table->rfu_codeword_table_5g[0] = 0x1;
- pdm_sat_table->rfu_codeword_table_5g[1] = 0x2;
- pdm_sat_table->rfu_codeword_table_5g[2] = 0x4;
- pdm_sat_table->rfu_codeword_table_5g[3] = 0x8;
-
- pdm_sat_table->fix_beam_pattern_en = 0;
- pdm_sat_table->decision_holding_period = 0;
-
- /*beam training setting*/
- pdm_sat_table->pkt_counter = 0;
- pdm_sat_table->per_beam_training_pkt_num = 10;
-
- /*set default beam*/
- pdm_sat_table->fast_training_beam_num = 0;
- pdm_sat_table->pre_fast_training_beam_num = pdm_sat_table->fast_training_beam_num;
- phydm_set_all_ant_same_beam_num(p_dm_odm);
-
- p_dm_fat_table->fat_state = FAT_BEFORE_LINK_STATE;
-
- odm_set_bb_reg(p_dm_odm, 0xCA4, MASKDWORD, 0x01000100);
- odm_set_bb_reg(p_dm_odm, 0xCA8, MASKDWORD, 0x01000100);
-
- /*[BB] FAT setting*/
- odm_set_bb_reg(p_dm_odm, 0xc08, BIT(18) | BIT(17) | BIT(16), pdm_sat_table->ant_num);
- odm_set_bb_reg(p_dm_odm, 0xc08, BIT(31), 0); /*increase ant num every FAT period 0:+1, 1+2*/
- odm_set_bb_reg(p_dm_odm, 0x8c4, BIT(2) | BIT1, 1); /*change cca antenna timming threshold if no CCA occurred: 0:200ms / 1:100ms / 2:no use / 3: 300*/
- odm_set_bb_reg(p_dm_odm, 0x8c4, BIT(0), 1); /*FAT_watchdog_en*/
-
- value32 = odm_get_mac_reg(p_dm_odm, 0x7B4, MASKDWORD);
- odm_set_mac_reg(p_dm_odm, 0x7b4, MASKDWORD, value32 | (BIT(16) | BIT17)); /*Reg7B4[16]=1 enable antenna training */
- /*Reg7B4[17]=1 enable match MAC addr*/
- odm_set_mac_reg(p_dm_odm, 0x7b4, 0xFFFF, 0);/*Match MAC ADDR*/
- odm_set_mac_reg(p_dm_odm, 0x7b0, MASKDWORD, 0);
-
-}
-#endif
-
-void
-odm_trx_hw_ant_div_init_8821a(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8821A AntDiv_Init => ant_div_type=[ CG_TRX_HW_ANTDIV (DPDT)]\n"));
-
- /* Output Pin Settings */
- odm_set_mac_reg(p_dm_odm, 0x4C, BIT(25), 0);
-
- odm_set_mac_reg(p_dm_odm, 0x64, BIT(29), 1); /* PAPE by WLAN control */
- odm_set_mac_reg(p_dm_odm, 0x64, BIT(28), 1); /* LNAON by WLAN control */
-
- odm_set_bb_reg(p_dm_odm, 0xCB0, MASKDWORD, 0x77775745);
- odm_set_bb_reg(p_dm_odm, 0xCB8, BIT(16), 0);
-
- odm_set_mac_reg(p_dm_odm, 0x4C, BIT(23), 0); /* select DPDT_P and DPDT_N as output pin */
- odm_set_mac_reg(p_dm_odm, 0x4C, BIT(24), 1); /* by WLAN control */
- odm_set_bb_reg(p_dm_odm, 0xCB4, 0xF, 8); /* DPDT_P = ANTSEL[0] */
- odm_set_bb_reg(p_dm_odm, 0xCB4, 0xF0, 8); /* DPDT_N = ANTSEL[0] */
- odm_set_bb_reg(p_dm_odm, 0xCB4, BIT(29), 0); /* DPDT_P non-inverse */
- odm_set_bb_reg(p_dm_odm, 0xCB4, BIT(28), 1); /* DPDT_N inverse */
-
- /* Mapping Table */
- odm_set_bb_reg(p_dm_odm, 0xCA4, MASKBYTE0, 0);
- odm_set_bb_reg(p_dm_odm, 0xCA4, MASKBYTE1, 1);
-
- /* OFDM HW AntDiv Parameters */
- odm_set_bb_reg(p_dm_odm, 0x8D4, 0x7FF, 0xA0); /* thershold */
- odm_set_bb_reg(p_dm_odm, 0x8D4, 0x7FF000, 0x10); /* bias */
-
- /* CCK HW AntDiv Parameters */
- odm_set_bb_reg(p_dm_odm, 0xA74, BIT(7), 1); /* patch for clk from 88M to 80M */
- odm_set_bb_reg(p_dm_odm, 0xA0C, BIT(4), 1); /* do 64 samples */
-
- odm_set_bb_reg(p_dm_odm, 0x800, BIT(25), 0); /* ANTSEL_CCK sent to the smart_antenna circuit */
- odm_set_bb_reg(p_dm_odm, 0xA00, BIT(15), 0); /* CCK AntDiv function block enable */
-
- /* BT Coexistence */
- odm_set_bb_reg(p_dm_odm, 0xCAC, BIT(9), 1); /* keep antsel_map when GNT_BT = 1 */
- odm_set_bb_reg(p_dm_odm, 0x804, BIT(4), 1); /* Disable hw antsw & fast_train.antsw when GNT_BT=1 */
-
- odm_set_bb_reg(p_dm_odm, 0x8CC, BIT(20) | BIT19 | BIT18, 3); /* settling time of antdiv by RF LNA = 100ns */
-
- /* response TX ant by RX ant */
- odm_set_mac_reg(p_dm_odm, 0x668, BIT(3), 1);
-
-}
-
-void
-odm_s0s1_sw_ant_div_init_8821a(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _sw_antenna_switch_ *p_dm_swat_table = &p_dm_odm->dm_swat_table;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8821A AntDiv_Init => ant_div_type=[ S0S1_SW_AntDiv]\n"));
-
- /* Output Pin Settings */
- odm_set_mac_reg(p_dm_odm, 0x4C, BIT(25), 0);
-
- odm_set_mac_reg(p_dm_odm, 0x64, BIT(29), 1); /* PAPE by WLAN control */
- odm_set_mac_reg(p_dm_odm, 0x64, BIT(28), 1); /* LNAON by WLAN control */
-
- odm_set_bb_reg(p_dm_odm, 0xCB0, MASKDWORD, 0x77775745);
- odm_set_bb_reg(p_dm_odm, 0xCB8, BIT(16), 0);
-
- odm_set_mac_reg(p_dm_odm, 0x4C, BIT(23), 0); /* select DPDT_P and DPDT_N as output pin */
- odm_set_mac_reg(p_dm_odm, 0x4C, BIT(24), 1); /* by WLAN control */
- odm_set_bb_reg(p_dm_odm, 0xCB4, 0xF, 8); /* DPDT_P = ANTSEL[0] */
- odm_set_bb_reg(p_dm_odm, 0xCB4, 0xF0, 8); /* DPDT_N = ANTSEL[0] */
- odm_set_bb_reg(p_dm_odm, 0xCB4, BIT(29), 0); /* DPDT_P non-inverse */
- odm_set_bb_reg(p_dm_odm, 0xCB4, BIT(28), 1); /* DPDT_N inverse */
-
- /* Mapping Table */
- odm_set_bb_reg(p_dm_odm, 0xCA4, MASKBYTE0, 0);
- odm_set_bb_reg(p_dm_odm, 0xCA4, MASKBYTE1, 1);
-
- /* OFDM HW AntDiv Parameters */
- odm_set_bb_reg(p_dm_odm, 0x8D4, 0x7FF, 0xA0); /* thershold */
- odm_set_bb_reg(p_dm_odm, 0x8D4, 0x7FF000, 0x10); /* bias */
-
- /* CCK HW AntDiv Parameters */
- odm_set_bb_reg(p_dm_odm, 0xA74, BIT(7), 1); /* patch for clk from 88M to 80M */
- odm_set_bb_reg(p_dm_odm, 0xA0C, BIT(4), 1); /* do 64 samples */
-
- odm_set_bb_reg(p_dm_odm, 0x800, BIT(25), 0); /* ANTSEL_CCK sent to the smart_antenna circuit */
- odm_set_bb_reg(p_dm_odm, 0xA00, BIT(15), 0); /* CCK AntDiv function block enable */
-
- /* BT Coexistence */
- odm_set_bb_reg(p_dm_odm, 0xCAC, BIT(9), 1); /* keep antsel_map when GNT_BT = 1 */
- odm_set_bb_reg(p_dm_odm, 0x804, BIT(4), 1); /* Disable hw antsw & fast_train.antsw when GNT_BT=1 */
-
- odm_set_bb_reg(p_dm_odm, 0x8CC, BIT(20) | BIT19 | BIT18, 3); /* settling time of antdiv by RF LNA = 100ns */
-
- /* response TX ant by RX ant */
- odm_set_mac_reg(p_dm_odm, 0x668, BIT(3), 1);
-
-
- odm_set_bb_reg(p_dm_odm, 0x900, BIT(18), 0);
-
- p_dm_swat_table->try_flag = SWAW_STEP_INIT;
- p_dm_swat_table->double_chk_flag = 0;
- p_dm_swat_table->cur_antenna = MAIN_ANT;
- p_dm_swat_table->pre_antenna = MAIN_ANT;
- p_dm_swat_table->swas_no_link_state = 0;
-
-}
-#endif /* #if (RTL8821A_SUPPORT == 1) */
-
-#if (RTL8822B_SUPPORT == 1)
-#ifdef CONFIG_HL_SMART_ANTENNA_TYPE1
-void
-phydm_hl_smart_ant_type1_init_8822b(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _SMART_ANTENNA_TRAINNING_ *pdm_sat_table = &(p_dm_odm->dm_sat_table);
- struct _FAST_ANTENNA_TRAINNING_ *p_dm_fat_table = &p_dm_odm->dm_fat_table;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8821A SmartAnt_Init => ant_div_type=[Hong-Lin Smart ant Type1]\n"));
-
- /*OFDM HW AntDiv Parameters*/
- odm_set_bb_reg(p_dm_odm, 0x8D4, 0x7FF, 0xA0); /*thershold*/
- odm_set_bb_reg(p_dm_odm, 0x8D4, 0x7FF000, 0x10); /*bias*/
- odm_set_bb_reg(p_dm_odm, 0x8CC, BIT(20) | BIT19 | BIT18, 3); /*settling time of antdiv by RF LNA = 100ns*/
-
- /*CCK HW AntDiv Parameters*/
- odm_set_bb_reg(p_dm_odm, 0xA74, BIT(7), 1); /*patch for clk from 88M to 80M*/
- odm_set_bb_reg(p_dm_odm, 0xA0C, BIT(4), 1); /*do 64 samples*/
- odm_set_bb_reg(p_dm_odm, 0x800, BIT(25), 0); /*ANTSEL_CCK sent to the smart_antenna circuit*/
- odm_set_bb_reg(p_dm_odm, 0xA00, BIT(15), 0); /*CCK AntDiv function block enable*/
-
- /*BT Coexistence*/
- odm_set_bb_reg(p_dm_odm, 0xCAC, BIT(9), 1); /*keep antsel_map when GNT_BT = 1*/
- odm_set_bb_reg(p_dm_odm, 0x804, BIT(4), 1); /*Disable hw antsw & fast_train.antsw when GNT_BT=1*/
-
- /*CGCS setting*/
- odm_set_bb_reg(p_dm_odm, 0xC1C, (BIT(7) | BIT6), 0); /*force to CG*/
-
- /* ---------------------------------------- */
- /* GPIO 0-1 for Beam control */
- /* reg0x66[2:0]=0 */
- /* reg0x44[25:24] = 0 */
- /* reg0x44[23:16] enable_output for P_GPIO[7:0] */
- /* reg0x44[15:8] output_value for P_GPIO[7:0] */
- /* reg0x40[1:0] = 0 GPIO function */
- /* ------------------------------------------ */
-
- /*GPIO setting*/
- odm_set_mac_reg(p_dm_odm, 0x64, (BIT(18) | BIT(17) | BIT(16)), 0);
- odm_set_mac_reg(p_dm_odm, 0x44, BIT(25) | BIT24, 0); /*config P_GPIO[3:2] to data port*/
- odm_set_mac_reg(p_dm_odm, 0x44, BIT(17) | BIT16, 0x3); /*enable_output for P_GPIO[3:2]*/
- /*odm_set_mac_reg(p_dm_odm, 0x44, BIT(9)|BIT8, 0);*/ /*P_GPIO[3:2] output value*/
- odm_set_mac_reg(p_dm_odm, 0x40, BIT(1) | BIT0, 0); /*GPIO function*/
-
- /*Hong_lin smart antenna HW setting*/
- pdm_sat_table->data_codeword_bit_num = 24;/*max=32*/
- pdm_sat_table->beam_patten_num_each_ant = 4;
-
-#if DEV_BUS_TYPE == RT_SDIO_INTERFACE
- pdm_sat_table->latch_time = 100; /*mu sec*/
-#elif DEV_BUS_TYPE == RT_USB_INTERFACE
- pdm_sat_table->latch_time = 100; /*mu sec*/
-#endif
- pdm_sat_table->pkt_skip_statistic_en = 0;
-
- pdm_sat_table->ant_num = 0;/*set=1~7,1~7ant, set=0: 8ant*/
- pdm_sat_table->ant_num_total = MAX_PATH_NUM_8822B;
- pdm_sat_table->first_train_ant = MAIN_ANT;
-
- pdm_sat_table->rfu_codeword_table[0] = 0x0;
- pdm_sat_table->rfu_codeword_table[1] = 0x4;
- pdm_sat_table->rfu_codeword_table[2] = 0x8;
- pdm_sat_table->rfu_codeword_table[3] = 0xc;
-
- pdm_sat_table->rfu_codeword_table_5g[0] = 0x1;
- pdm_sat_table->rfu_codeword_table_5g[1] = 0x2;
- pdm_sat_table->rfu_codeword_table_5g[2] = 0x4;
- pdm_sat_table->rfu_codeword_table_5g[3] = 0x8;
-
- pdm_sat_table->fix_beam_pattern_en = 0;
- pdm_sat_table->decision_holding_period = 0;
-
- /*beam training setting*/
- pdm_sat_table->pkt_counter = 0;
- pdm_sat_table->per_beam_training_pkt_num = 10;
-
- /*set default beam*/
- pdm_sat_table->fast_training_beam_num = 0;
- pdm_sat_table->pre_fast_training_beam_num = pdm_sat_table->fast_training_beam_num;
- phydm_set_all_ant_same_beam_num(p_dm_odm);
-
- p_dm_fat_table->fat_state = FAT_BEFORE_LINK_STATE;
-
- /*Mapping table*/
- odm_set_bb_reg(p_dm_odm, 0xCA4, MASKDWORD, 0x03020100);
- odm_set_bb_reg(p_dm_odm, 0xCA8, MASKDWORD, 0x07060504);
-
- /*Smart Antenna training setting*/
- odm_set_bb_reg(p_dm_odm, 0xc08, BIT(18) | BIT(17) | BIT(16), pdm_sat_table->ant_num);
- odm_set_bb_reg(p_dm_odm, 0xc08, BIT(31), 0); /*increase ant num every FAT period 0:+1, 1+2*/
- odm_set_bb_reg(p_dm_odm, 0x8c4, BIT(2) | BIT1, 1); /*change cca antenna timming threshold if no CCA occurred: 0:200ms / 1:100ms / 2:no use / 3: 300*/
- odm_set_bb_reg(p_dm_odm, 0x8c4, BIT(0), 1); /*FAT_watchdog_en*/
-
- odm_set_mac_reg(p_dm_odm, 0x7b4, (BIT(17) | BIT16), 0x3); /*Reg7B4[16]=1 enable antenna training */
- /*Reg7B4[17]=1 enable match MAC addr*/
- odm_set_mac_reg(p_dm_odm, 0x7b4, 0xFFFF, 0); /*Match MAC ADDR part1*/
- odm_set_mac_reg(p_dm_odm, 0x7b0, MASKDWORD, 0); /*Match MAC ADDR part2*/
-
-}
-#endif
-#endif
-
-
-#if (RTL8821C_SUPPORT == 1)
-void
-odm_trx_hw_ant_div_init_8821c(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8821C AntDiv_Init => ant_div_type=[ CG_TRX_HW_ANTDIV (DPDT)]\n"));
- /* Output Pin Settings */
- odm_set_mac_reg(p_dm_odm, 0x4C, BIT(25), 0);
-
- odm_set_mac_reg(p_dm_odm, 0x64, BIT(29), 1); /* PAPE by WLAN control */
- odm_set_mac_reg(p_dm_odm, 0x64, BIT(28), 1); /* LNAON by WLAN control */
-
- odm_set_bb_reg(p_dm_odm, 0xCB0, MASKDWORD, 0x77775745);
- odm_set_bb_reg(p_dm_odm, 0xCB8, BIT(16), 0);
-
- odm_set_mac_reg(p_dm_odm, 0x4C, BIT(23), 0); /* select DPDT_P and DPDT_N as output pin */
- odm_set_mac_reg(p_dm_odm, 0x4C, BIT(24), 1); /* by WLAN control */
- odm_set_bb_reg(p_dm_odm, 0xCB4, 0xF, 8); /* DPDT_P = ANTSEL[0] */
- odm_set_bb_reg(p_dm_odm, 0xCB4, 0xF0, 8); /* DPDT_N = ANTSEL[0] */
- odm_set_bb_reg(p_dm_odm, 0xCB4, BIT(29), 0); /* DPDT_P non-inverse */
- odm_set_bb_reg(p_dm_odm, 0xCB4, BIT(28), 1); /* DPDT_N inverse */
-
- /* Mapping Table */
- odm_set_bb_reg(p_dm_odm, 0xCA4, MASKBYTE0, 0);
- odm_set_bb_reg(p_dm_odm, 0xCA4, MASKBYTE1, 1);
-
- /* OFDM HW AntDiv Parameters */
- odm_set_bb_reg(p_dm_odm, 0x8D4, 0x7FF, 0xA0); /* thershold */
- odm_set_bb_reg(p_dm_odm, 0x8D4, 0x7FF000, 0x10); /* bias */
-
- /* CCK HW AntDiv Parameters */
- odm_set_bb_reg(p_dm_odm, 0xA74, BIT(7), 1); /* patch for clk from 88M to 80M */
- odm_set_bb_reg(p_dm_odm, 0xA0C, BIT(4), 1); /* do 64 samples */
-
- odm_set_bb_reg(p_dm_odm, 0x800, BIT(25), 0); /* ANTSEL_CCK sent to the smart_antenna circuit */
- odm_set_bb_reg(p_dm_odm, 0xA00, BIT(15), 0); /* CCK AntDiv function block enable */
-
- /* BT Coexistence */
- odm_set_bb_reg(p_dm_odm, 0xCAC, BIT(9), 1); /* keep antsel_map when GNT_BT = 1 */
- odm_set_bb_reg(p_dm_odm, 0x804, BIT(4), 1); /* Disable hw antsw & fast_train.antsw when GNT_BT=1 */
-
- /* Timming issue */
- odm_set_bb_reg(p_dm_odm, 0x818, BIT(23) | BIT22 | BIT21 | BIT20, 0); /*keep antidx after tx for ACK ( unit x 3.2 mu sec)*/
- odm_set_bb_reg(p_dm_odm, 0x8CC, BIT(20) | BIT19 | BIT18, 3); /* settling time of antdiv by RF LNA = 100ns */
-
- /* response TX ant by RX ant */
- odm_set_mac_reg(p_dm_odm, 0x668, BIT(3), 1);
-
-}
-#endif /* #if (RTL8821C_SUPPORT == 1) */
-
-
-#if (RTL8881A_SUPPORT == 1)
-void
-odm_trx_hw_ant_div_init_8881a(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8881A AntDiv_Init => ant_div_type=[ CG_TRX_HW_ANTDIV (SPDT)]\n"));
-
- /* Output Pin Settings */
- /* [SPDT related] */
- odm_set_mac_reg(p_dm_odm, 0x4C, BIT(25), 0);
- odm_set_mac_reg(p_dm_odm, 0x4C, BIT(26), 0);
- odm_set_bb_reg(p_dm_odm, 0xCB4, BIT(31), 0); /* delay buffer */
- odm_set_bb_reg(p_dm_odm, 0xCB4, BIT(22), 0);
- odm_set_bb_reg(p_dm_odm, 0xCB4, BIT(24), 1);
- odm_set_bb_reg(p_dm_odm, 0xCB0, 0xF00, 8); /* DPDT_P = ANTSEL[0] */
- odm_set_bb_reg(p_dm_odm, 0xCB0, 0xF0000, 8); /* DPDT_N = ANTSEL[0] */
-
- /* Mapping Table */
- odm_set_bb_reg(p_dm_odm, 0xCA4, MASKBYTE0, 0);
- odm_set_bb_reg(p_dm_odm, 0xCA4, MASKBYTE1, 1);
-
- /* OFDM HW AntDiv Parameters */
- odm_set_bb_reg(p_dm_odm, 0x8D4, 0x7FF, 0xA0); /* thershold */
- odm_set_bb_reg(p_dm_odm, 0x8D4, 0x7FF000, 0x0); /* bias */
- odm_set_bb_reg(p_dm_odm, 0x8CC, BIT(20) | BIT19 | BIT18, 3); /* settling time of antdiv by RF LNA = 100ns */
-
- /* CCK HW AntDiv Parameters */
- odm_set_bb_reg(p_dm_odm, 0xA74, BIT(7), 1); /* patch for clk from 88M to 80M */
- odm_set_bb_reg(p_dm_odm, 0xA0C, BIT(4), 1); /* do 64 samples */
-
- /* 2 [--For HW Bug setting] */
-
- odm_set_bb_reg(p_dm_odm, 0x900, BIT(18), 0); /* TX ant by Reg */ /* A-cut bug */
-}
-
-#endif /* #if (RTL8881A_SUPPORT == 1) */
-
-
-#if (RTL8812A_SUPPORT == 1)
-void
-odm_trx_hw_ant_div_init_8812a(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8812A AntDiv_Init => ant_div_type=[ CG_TRX_HW_ANTDIV (SPDT)]\n"));
-
- /* 3 */ /* 3 --RFE pin setting--------- */
- /* [BB] */
- odm_set_bb_reg(p_dm_odm, 0x900, BIT(10) | BIT9 | BIT8, 0x0); /* disable SW switch */
- odm_set_bb_reg(p_dm_odm, 0x900, BIT(17) | BIT(16), 0x0);
- odm_set_bb_reg(p_dm_odm, 0x974, BIT(7) | BIT6, 0x3); /* in/out */
- odm_set_bb_reg(p_dm_odm, 0xCB4, BIT(31), 0); /* delay buffer */
- odm_set_bb_reg(p_dm_odm, 0xCB4, BIT(26), 0);
- odm_set_bb_reg(p_dm_odm, 0xCB4, BIT(27), 1);
- odm_set_bb_reg(p_dm_odm, 0xCB0, 0xF000000, 8); /* DPDT_P = ANTSEL[0] */
- odm_set_bb_reg(p_dm_odm, 0xCB0, 0xF0000000, 8); /* DPDT_N = ANTSEL[0] */
- /* 3 ------------------------- */
-
- /* Mapping Table */
- odm_set_bb_reg(p_dm_odm, 0xCA4, MASKBYTE0, 0);
- odm_set_bb_reg(p_dm_odm, 0xCA4, MASKBYTE1, 1);
-
- /* OFDM HW AntDiv Parameters */
- odm_set_bb_reg(p_dm_odm, 0x8D4, 0x7FF, 0xA0); /* thershold */
- odm_set_bb_reg(p_dm_odm, 0x8D4, 0x7FF000, 0x0); /* bias */
- odm_set_bb_reg(p_dm_odm, 0x8CC, BIT(20) | BIT19 | BIT18, 3); /* settling time of antdiv by RF LNA = 100ns */
-
- /* CCK HW AntDiv Parameters */
- odm_set_bb_reg(p_dm_odm, 0xA74, BIT(7), 1); /* patch for clk from 88M to 80M */
- odm_set_bb_reg(p_dm_odm, 0xA0C, BIT(4), 1); /* do 64 samples */
-
- /* 2 [--For HW Bug setting] */
-
- odm_set_bb_reg(p_dm_odm, 0x900, BIT(18), 0); /* TX ant by Reg */ /* A-cut bug */
-
-}
-
-#endif /* #if (RTL8812A_SUPPORT == 1) */
-
-#if (RTL8188F_SUPPORT == 1)
-void
-odm_s0s1_sw_ant_div_init_8188f(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _sw_antenna_switch_ *p_dm_swat_table = &p_dm_odm->dm_swat_table;
- struct _FAST_ANTENNA_TRAINNING_ *p_dm_fat_table = &p_dm_odm->dm_fat_table;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***8188F AntDiv_Init => ant_div_type=[ S0S1_SW_AntDiv]\n"));
-
-
- /*GPIO setting*/
- /*odm_set_mac_reg(p_dm_odm, 0x64, BIT18, 0); */
- /*odm_set_mac_reg(p_dm_odm, 0x44, BIT28|BIT27, 0);*/
- odm_set_mac_reg(p_dm_odm, 0x44, BIT(20) | BIT19, 0x3); /*enable_output for P_GPIO[4:3]*/
- /*odm_set_mac_reg(p_dm_odm, 0x44, BIT(12)|BIT11, 0);*/ /*output value*/
- /*odm_set_mac_reg(p_dm_odm, 0x40, BIT(1)|BIT0, 0);*/ /*GPIO function*/
-
- p_dm_fat_table->is_become_linked = false;
- p_dm_swat_table->try_flag = SWAW_STEP_INIT;
- p_dm_swat_table->double_chk_flag = 0;
-}
-
-void
-phydm_update_rx_idle_antenna_8188F(
- void *p_dm_void,
- u32 default_ant
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 codeword;
-
- if (default_ant == ANT1_2G)
- codeword = 1; /*2'b01*/
- else
- codeword = 2;/*2'b10*/
-
- odm_set_mac_reg(p_dm_odm, 0x44, (BIT(12) | BIT11), codeword); /*GPIO[4:3] output value*/
-}
-
-#endif
-
-
-
#ifdef ODM_EVM_ENHANCE_ANTDIV
void
@@ -1742,24 +803,6 @@ odm_hw_ant_div(
struct _dynamic_initial_gain_threshold_ *p_dm_dig_table = &p_dm_odm->dm_dig_table;
struct sta_info *p_entry;
-#if (BEAMFORMING_SUPPORT == 1)
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- struct _BF_DIV_COEX_ *p_dm_bdc_table = &p_dm_odm->dm_bdc_table;
- u32 TH1 = 500000;
- u32 TH2 = 10000000;
- u32 ma_rx_temp, degrade_TP_temp, improve_TP_temp;
- u8 monitor_rssi_threshold = 30;
-
- p_dm_bdc_table->BF_pass = true;
- p_dm_bdc_table->DIV_pass = true;
- p_dm_bdc_table->is_all_div_sta_idle = true;
- p_dm_bdc_table->is_all_bf_sta_idle = true;
- p_dm_bdc_table->num_bf_tar = 0 ;
- p_dm_bdc_table->num_div_tar = 0;
- p_dm_bdc_table->num_client = 0;
-#endif
-#endif
-
if (!p_dm_odm->is_linked) { /* is_linked==False */
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[No Link!!!]\n"));
@@ -1776,19 +819,6 @@ odm_hw_ant_div(
if (p_dm_fat_table->is_become_linked == false) {
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[Linked !!!]\n"));
odm_ant_div_on_off(p_dm_odm, ANTDIV_ON);
- /*odm_tx_by_tx_desc_or_reg(p_dm_odm, TX_BY_DESC);*/
-
- /* if(p_dm_odm->support_ic_type == ODM_RTL8821 ) */
- /* odm_set_bb_reg(p_dm_odm, 0x800, BIT(25), 0); */ /* CCK AntDiv function disable */
-
- /* #if(DM_ODM_SUPPORT_TYPE == ODM_AP) */
- /* else if(p_dm_odm->support_ic_type == ODM_RTL8881A) */
- /* odm_set_bb_reg(p_dm_odm, 0x800, BIT(25), 0); */ /* CCK AntDiv function disable */
- /* #endif */
-
- /* else if(p_dm_odm->support_ic_type == ODM_RTL8723B ||p_dm_odm->support_ic_type == ODM_RTL8812) */
- /* odm_set_bb_reg(p_dm_odm, 0xA00, BIT(15), 0); */ /* CCK AntDiv function disable */
-
p_dm_fat_table->is_become_linked = p_dm_odm->is_linked;
if (p_dm_odm->support_ic_type == ODM_RTL8723B && p_dm_odm->ant_div_type == CG_TRX_HW_ANTDIV) {
@@ -1797,11 +827,6 @@ odm_hw_ant_div(
}
/* 2 BDC Init */
-#if (BEAMFORMING_SUPPORT == 1)
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- odm_bdc_init(p_dm_odm);
-#endif
-#endif
#ifdef ODM_EVM_ENHANCE_ANTDIV
odm_evm_fast_ant_reset(p_dm_odm);
@@ -1826,12 +851,6 @@ odm_hw_ant_div(
#endif
/* 2 BDC mode Arbitration */
-#if (BEAMFORMING_SUPPORT == 1)
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- if (p_dm_odm->antdiv_evm_en == 0 || p_dm_fat_table->EVM_method_enable == 0)
- odm_bf_ant_div_mode_arbitration(p_dm_odm);
-#endif
-#endif
for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) {
p_entry = p_dm_odm->p_odm_sta_info[i];
@@ -1880,123 +899,22 @@ odm_hw_ant_div(
/* 2 Select TX Antenna */
if (p_dm_odm->ant_div_type != CGCS_RX_HW_ANTDIV) {
-#if (BEAMFORMING_SUPPORT == 1)
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- if (p_dm_bdc_table->w_bfee_client[i] == 0)
-#endif
-#endif
- {
odm_update_tx_ant(p_dm_odm, target_ant, i);
- }
}
/* ------------------------------------------------------------ */
-#if (BEAMFORMING_SUPPORT == 1)
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
-
- p_dm_bdc_table->num_client++;
-
- if (p_dm_bdc_table->bdc_mode == BDC_MODE_2 || p_dm_bdc_table->bdc_mode == BDC_MODE_3) {
- /* 2 Byte counter */
-
- ma_rx_temp = (p_entry->rx_byte_cnt_low_maw) << 3 ; /* RX TP ( bit /sec) */
-
- if (p_dm_bdc_table->BDC_state == bdc_bfer_train_state)
- p_dm_bdc_table->MA_rx_TP_DIV[i] = ma_rx_temp ;
- else
- p_dm_bdc_table->MA_rx_TP[i] = ma_rx_temp ;
-
- if ((ma_rx_temp < TH2) && (ma_rx_temp > TH1) && (local_max_rssi <= monitor_rssi_threshold)) {
- if (p_dm_bdc_table->w_bfer_client[i] == 1) { /* Bfer_Target */
- p_dm_bdc_table->num_bf_tar++;
-
- if (p_dm_bdc_table->BDC_state == BDC_DECISION_STATE && p_dm_bdc_table->bdc_try_flag == 0) {
- improve_TP_temp = (p_dm_bdc_table->MA_rx_TP_DIV[i] * 9) >> 3 ; /* * 1.125 */
- p_dm_bdc_table->BF_pass = (p_dm_bdc_table->MA_rx_TP[i] > improve_TP_temp) ? true : false;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** Client[ %d ] : { MA_rx_TP,improve_TP_temp, MA_rx_TP_DIV, BF_pass}={ %d, %d, %d , %d }\n", i, p_dm_bdc_table->MA_rx_TP[i], improve_TP_temp, p_dm_bdc_table->MA_rx_TP_DIV[i], p_dm_bdc_table->BF_pass));
- }
- } else { /* DIV_Target */
- p_dm_bdc_table->num_div_tar++;
-
- if (p_dm_bdc_table->BDC_state == BDC_DECISION_STATE && p_dm_bdc_table->bdc_try_flag == 0) {
- degrade_TP_temp = (p_dm_bdc_table->MA_rx_TP_DIV[i] * 5) >> 3; /* * 0.625 */
- p_dm_bdc_table->DIV_pass = (p_dm_bdc_table->MA_rx_TP[i] > degrade_TP_temp) ? true : false;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** Client[ %d ] : { MA_rx_TP, degrade_TP_temp, MA_rx_TP_DIV, DIV_pass}=\n{ %d, %d, %d , %d }\n", i, p_dm_bdc_table->MA_rx_TP[i], degrade_TP_temp, p_dm_bdc_table->MA_rx_TP_DIV[i], p_dm_bdc_table->DIV_pass));
- }
- }
- }
-
- if (ma_rx_temp > TH1) {
- if (p_dm_bdc_table->w_bfer_client[i] == 1) /* Bfer_Target */
- p_dm_bdc_table->is_all_bf_sta_idle = false;
- else/* DIV_Target */
- p_dm_bdc_table->is_all_div_sta_idle = false;
- }
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** Client[ %d ] : { BFmeeCap, BFmerCap} = { %d , %d }\n", i, p_dm_bdc_table->w_bfee_client[i], p_dm_bdc_table->w_bfer_client[i]));
-
- if (p_dm_bdc_table->BDC_state == bdc_bfer_train_state)
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** Client[ %d ] : MA_rx_TP_DIV = (( %d ))\n", i, p_dm_bdc_table->MA_rx_TP_DIV[i]));
-
- else
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** Client[ %d ] : MA_rx_TP = (( %d ))\n", i, p_dm_bdc_table->MA_rx_TP[i]));
-
- }
-#endif
-#endif
-
- }
-
-#if (BEAMFORMING_SUPPORT == 1)
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- if (p_dm_bdc_table->bdc_try_flag == 0)
-#endif
-#endif
- {
- phydm_antdiv_reset_statistic(p_dm_odm, i);
}
+ phydm_antdiv_reset_statistic(p_dm_odm, i);
}
/* 2 Set RX Idle Antenna & TX Antenna(Because of HW Bug ) */
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** rx_idle_ant = (( %s ))\n\n", (rx_idle_ant == MAIN_ANT) ? "MAIN_ANT" : "AUX_ANT"));
-
-#if (BEAMFORMING_SUPPORT == 1)
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- if (p_dm_bdc_table->bdc_mode == BDC_MODE_1 || p_dm_bdc_table->bdc_mode == BDC_MODE_3) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("*** bdc_rx_idle_update_counter = (( %d ))\n", p_dm_bdc_table->bdc_rx_idle_update_counter));
-
- if (p_dm_bdc_table->bdc_rx_idle_update_counter == 1) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***Update RxIdle Antenna!!!\n"));
- p_dm_bdc_table->bdc_rx_idle_update_counter = 30;
- odm_update_rx_idle_ant(p_dm_odm, rx_idle_ant);
- } else {
- p_dm_bdc_table->bdc_rx_idle_update_counter--;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***NOT update RxIdle Antenna because of BF ( need to fix TX-ant)\n"));
- }
- } else
-#endif
-#endif
- odm_update_rx_idle_ant(p_dm_odm, rx_idle_ant);
-#else
odm_update_rx_idle_ant(p_dm_odm, rx_idle_ant);
-#endif/* #if(DM_ODM_SUPPORT_TYPE == ODM_AP) */
-
-
-
/* 2 BDC Main Algorithm */
-#if (BEAMFORMING_SUPPORT == 1)
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- if (p_dm_odm->antdiv_evm_en == 0 || p_dm_fat_table->EVM_method_enable == 0)
- odm_bd_ccoex_bfee_rx_div_arbitration(p_dm_odm);
-#endif
-#endif
-
if (ant_div_max_rssi == 0)
p_dm_dig_table->ant_div_rssi_max = p_dm_odm->rssi_min;
else
@@ -2567,72 +1485,23 @@ odm_set_next_mac_addr_target(
if (IS_STA_VALID(p_entry)) {
/*Match MAC ADDR*/
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP | ODM_CE))
value32 = (p_entry->hwaddr[5] << 8) | p_entry->hwaddr[4];
-#else
- value32 = (p_entry->MacAddr[5] << 8) | p_entry->MacAddr[4];
-#endif
odm_set_mac_reg(p_dm_odm, 0x7b4, 0xFFFF, value32);/*0x7b4~0x7b5*/
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP | ODM_CE))
value32 = (p_entry->hwaddr[3] << 24) | (p_entry->hwaddr[2] << 16) | (p_entry->hwaddr[1] << 8) | p_entry->hwaddr[0];
-#else
- value32 = (p_entry->MacAddr[3] << 24) | (p_entry->MacAddr[2] << 16) | (p_entry->MacAddr[1] << 8) | p_entry->MacAddr[0];
-#endif
odm_set_mac_reg(p_dm_odm, 0x7b0, MASKDWORD, value32);/*0x7b0~0x7b3*/
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("p_dm_fat_table->train_idx=%d\n", p_dm_fat_table->train_idx));
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP | ODM_CE))
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Training MAC addr = %x:%x:%x:%x:%x:%x\n",
p_entry->hwaddr[5], p_entry->hwaddr[4], p_entry->hwaddr[3], p_entry->hwaddr[2], p_entry->hwaddr[1], p_entry->hwaddr[0]));
-#else
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Training MAC addr = %x:%x:%x:%x:%x:%x\n",
p_entry->MacAddr[5], p_entry->MacAddr[4], p_entry->MacAddr[3], p_entry->MacAddr[2], p_entry->MacAddr[1], p_entry->MacAddr[0]));
-#endif
-
break;
}
}
}
-
-#if 0
- /* */
- /* 2012.03.26 LukeLee: This should be removed later, the MAC address is changed according to MACID in turn */
- /* */
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- {
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PMGNT_INFO p_mgnt_info = &adapter->MgntInfo;
-
- for (i = 0; i < 6; i++) {
- bssid[i] = p_mgnt_info->bssid[i];
- /* dbg_print("bssid[%d]=%x\n", i, bssid[i]); */
- }
- }
-#endif
-
- /* odm_set_next_mac_addr_target(p_dm_odm); */
-
- /* 1 Select MAC Address Filter */
- for (i = 0; i < 6; i++) {
- if (bssid[i] != p_dm_fat_table->bssid[i]) {
- is_match_bssid = false;
- break;
- }
- }
- if (is_match_bssid == false) {
- /* Match MAC ADDR */
- value32 = (bssid[5] << 8) | bssid[4];
- odm_set_mac_reg(p_dm_odm, 0x7b4, 0xFFFF, value32);
- value32 = (bssid[3] << 24) | (bssid[2] << 16) | (bssid[1] << 8) | bssid[0];
- odm_set_mac_reg(p_dm_odm, 0x7b0, MASKDWORD, value32);
- }
-
- return is_match_bssid;
-#endif
-
}
#if (defined(CONFIG_5G_CG_SMART_ANT_DIVERSITY)) || (defined(CONFIG_2G_CG_SMART_ANT_DIVERSITY))
@@ -2719,36 +1588,6 @@ odm_fast_ant_training(
ODM_RT_TRACE("*** ant-index : [ %d ], counter = (( %d )), Avg RSSI = (( %d ))\n", i, p_dm_fat_table->ant_rssi_cnt[i], p_dm_fat_table->ant_ave_rssi[i]);
}
-
-#if 0
-#if (RTL8192E_SUPPORT == 1)
- /* 3 [path-B]--------------------------- */
- for (i = 0; i < (p_dm_odm->fat_comb_b); i++) {
- if (p_dm_fat_table->antRSSIcnt_pathB[i] == 0)
- p_dm_fat_table->antAveRSSI_pathB[i] = 0;
- else { /* (ant_rssi_cnt[i] != 0) */
- p_dm_fat_table->antAveRSSI_pathB[i] = p_dm_fat_table->antSumRSSI_pathB[i] / p_dm_fat_table->antRSSIcnt_pathB[i];
- is_pkt_filter_macth_path_b = true;
- }
- if (p_dm_fat_table->antAveRSSI_pathB[i] > max_rssi_path_b) {
- max_rssi_path_b = p_dm_fat_table->antAveRSSI_pathB[i];
- pckcnt_path_b = p_dm_fat_table->antRSSIcnt_pathB[i];
- target_ant_path_b = (u8) i;
- }
- if (p_dm_fat_table->antAveRSSI_pathB[i] == max_rssi_path_b) {
- if (p_dm_fat_table->antRSSIcnt_pathB > pckcnt_path_b) {
- max_rssi_path_b = p_dm_fat_table->antAveRSSI_pathB[i];
- target_ant_path_b = (u8) i;
- }
- }
- if (p_dm_odm->fat_print_rssi == 1) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("***{path-B}: Sum RSSI[%d] = (( %d )), cnt RSSI [%d] = (( %d )), Avg RSSI[%d] = (( %d ))\n",
- i, p_dm_fat_table->antSumRSSI_pathB[i], i, p_dm_fat_table->antRSSIcnt_pathB[i], i, p_dm_fat_table->antAveRSSI_pathB[i]));
- }
- }
-#endif
-#endif
-
/* 1 DECISION STATE */
/* 2 Select TRX Antenna */
@@ -3499,46 +2338,6 @@ odm_fast_ant_training_hl_smart_antenna_type1(
}
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-
-void
-phydm_beam_switch_workitem_callback(
- void *p_context
-)
-{
- struct _ADAPTER *p_adapter = (struct _ADAPTER *)p_context;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
- struct _SMART_ANTENNA_TRAINNING_ *pdm_sat_table = &(p_dm_odm->dm_sat_table);
-
-#if DEV_BUS_TYPE != RT_PCI_INTERFACE
- pdm_sat_table->pkt_skip_statistic_en = 1;
-#endif
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ SmartAnt ] Beam Switch Workitem Callback, pkt_skip_statistic_en = (( %d ))\n", pdm_sat_table->pkt_skip_statistic_en));
-
- phydm_update_beam_pattern(p_dm_odm, pdm_sat_table->update_beam_codeword, pdm_sat_table->data_codeword_bit_num);
-
-#if DEV_BUS_TYPE != RT_PCI_INTERFACE
- /*odm_stall_execution(pdm_sat_table->latch_time);*/
- pdm_sat_table->pkt_skip_statistic_en = 0;
-#endif
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("pkt_skip_statistic_en = (( %d )), latch_time = (( %d ))\n", pdm_sat_table->pkt_skip_statistic_en, pdm_sat_table->latch_time));
-}
-
-void
-phydm_beam_decision_workitem_callback(
- void *p_context
-)
-{
- struct _ADAPTER *p_adapter = (struct _ADAPTER *)p_context;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ SmartAnt ] Beam decision Workitem Callback\n"));
- odm_fast_ant_training_hl_smart_antenna_type1(p_dm_odm);
-}
-#endif
-
#endif /*#ifdef CONFIG_HL_SMART_ANTENNA_TYPE1*/
void
@@ -3817,68 +2616,6 @@ odm_ant_div(
}
/* ---------- */
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-
- if (p_dm_fat_table->enable_ctrl_frame_antdiv) {
-
- if ((p_dm_odm->data_frame_num <= 10) && (p_dm_odm->is_linked))
- p_dm_fat_table->use_ctrl_frame_antdiv = 1;
- else
- p_dm_fat_table->use_ctrl_frame_antdiv = 0;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("use_ctrl_frame_antdiv = (( %d )), data_frame_num = (( %d ))\n", p_dm_fat_table->use_ctrl_frame_antdiv, p_dm_odm->data_frame_num));
- p_dm_odm->data_frame_num = 0;
- }
-
- if (p_adapter->MgntInfo.AntennaTest)
- return;
-
- {
-#if (BEAMFORMING_SUPPORT == 1)
- enum beamforming_cap beamform_cap = (p_dm_odm->beamforming_info.beamform_cap);
-
- if (beamform_cap & BEAMFORMEE_CAP) { /* BFmee On && Div On->Div Off */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ AntDiv : OFF ] BFmee ==1\n"));
- if (p_dm_fat_table->fix_ant_bfee == 0) {
- odm_ant_div_on_off(p_dm_odm, ANTDIV_OFF);
- p_dm_fat_table->fix_ant_bfee = 1;
- }
- return;
- } else { /* BFmee Off && Div Off->Div On */
- if ((p_dm_fat_table->fix_ant_bfee == 1) && p_dm_odm->is_linked) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ AntDiv : ON ] BFmee ==0\n"));
- if ((p_dm_odm->ant_div_type != S0S1_SW_ANTDIV))
- odm_ant_div_on_off(p_dm_odm, ANTDIV_ON);
-
- p_dm_fat_table->fix_ant_bfee = 0;
- }
- }
-#endif
- }
-#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
- /* ----------just for fool proof */
-
- if (p_dm_odm->antdiv_rssi)
- p_dm_odm->debug_components |= ODM_COMP_ANT_DIV;
- else
- p_dm_odm->debug_components &= ~ODM_COMP_ANT_DIV;
-
- if (p_dm_fat_table->ant_div_2g_5g == ODM_ANTDIV_2G) {
- /* ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[ 2G AntDiv Running ]\n")); */
- if (!(p_dm_odm->support_ic_type & ODM_ANTDIV_2G_SUPPORT_IC))
- return;
- } else if (p_dm_fat_table->ant_div_2g_5g == ODM_ANTDIV_5G) {
- /* ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[ 5G AntDiv Running ]\n")); */
- if (!(p_dm_odm->support_ic_type & ODM_ANTDIV_5G_SUPPORT_IC))
- return;
- }
- /* else if(p_dm_fat_table->ant_div_2g_5g == (ODM_ANTDIV_2G|ODM_ANTDIV_5G)) */
- /* { */
- /* ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("[ 2G & 5G AntDiv Running ]\n")); */
- /* } */
-#endif
-
- /* ---------- */
if (p_dm_odm->antdiv_select == 1)
p_dm_odm->ant_type = ODM_FIX_MAIN_ANT;
@@ -3887,8 +2624,6 @@ odm_ant_div(
else /* if (p_dm_odm->antdiv_select==0) */
p_dm_odm->ant_type = ODM_AUTO_ANT;
- /* ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV,ODM_DBG_LOUD,("ant_type= (( %d )) , pre_ant_type= (( %d ))\n",p_dm_odm->ant_type,p_dm_odm->pre_ant_type)); */
-
if (p_dm_odm->ant_type != ODM_AUTO_ANT) {
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Fix Antenna at (( %s ))\n", (p_dm_odm->ant_type == ODM_FIX_MAIN_ANT) ? "MAIN" : "AUX"));
@@ -4156,13 +2891,8 @@ odm_process_rssi_for_ant_div(
u8 train_pkt_number;
#endif
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
- u32 rx_power_ant0, rx_power_ant1;
- u32 rx_evm_ant0, rx_evm_ant1;
-#else
u8 rx_power_ant0, rx_power_ant1;
u8 rx_evm_ant0, rx_evm_ant1;
-#endif
cck_max_rate = ODM_RATE11M;
is_cck_rate = (p_pktinfo->data_rate <= cck_max_rate) ? true : false;
@@ -4358,7 +3088,6 @@ odm_process_rssi_for_ant_div(
/* ODM_RT_TRACE(p_dm_odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD,("antsel_tr_mux=3'b%d%d%d\n",p_dm_fat_table->antsel_rx_keep_2, p_dm_fat_table->antsel_rx_keep_1, p_dm_fat_table->antsel_rx_keep_0)); */
}
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
void
odm_set_tx_ant_by_tx_info(
void *p_dm_void,
@@ -4405,89 +3134,6 @@ odm_set_tx_ant_by_tx_info(
#endif
}
}
-#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
-
-void
-odm_set_tx_ant_by_tx_info(
- struct rtl8192cd_priv *priv,
- struct tx_desc *pdesc,
- unsigned short aid
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = &(priv->pshare->_dmodm);
- struct _FAST_ANTENNA_TRAINNING_ *p_dm_fat_table = &priv->pshare->_dmodm.dm_fat_table;
- u32 support_ic_type = priv->pshare->_dmodm.support_ic_type;
-
- if (!(p_dm_odm->support_ability & ODM_BB_ANT_DIV))
- return;
-
- if (p_dm_odm->ant_div_type == CGCS_RX_HW_ANTDIV)
- return;
-
- if (support_ic_type == ODM_RTL8881A) {
- /*panic_printk("[%s] [%d] ******ODM_SetTxAntByTxInfo_8881E******\n",__func__,__LINE__); */
- pdesc->dword6 &= set_desc(~(BIT(18) | BIT(17) | BIT(16)));
- pdesc->dword6 |= set_desc(p_dm_fat_table->antsel_a[aid] << 16);
- } else if (support_ic_type == ODM_RTL8192E) {
- /*panic_printk("[%s] [%d] ******ODM_SetTxAntByTxInfo_8192E******\n",__func__,__LINE__); */
- pdesc->dword6 &= set_desc(~(BIT(18) | BIT(17) | BIT(16)));
- pdesc->dword6 |= set_desc(p_dm_fat_table->antsel_a[aid] << 16);
- } else if (support_ic_type == ODM_RTL8188E) {
- /*panic_printk("[%s] [%d] ******ODM_SetTxAntByTxInfo_8188E******\n",__func__,__LINE__);*/
- pdesc->dword2 &= set_desc(~BIT(24));
- pdesc->dword2 &= set_desc(~BIT(25));
- pdesc->dword7 &= set_desc(~BIT(29));
-
- pdesc->dword2 |= set_desc(p_dm_fat_table->antsel_a[aid] << 24);
- pdesc->dword2 |= set_desc(p_dm_fat_table->antsel_b[aid] << 25);
- pdesc->dword7 |= set_desc(p_dm_fat_table->antsel_c[aid] << 29);
-
-
- } else if (support_ic_type == ODM_RTL8812) {
- /*[path-A]*/
- /*panic_printk("[%s] [%d] ******ODM_SetTxAntByTxInfo_8881E******\n",__func__,__LINE__);*/
-
- pdesc->dword6 &= set_desc(~BIT(16));
- pdesc->dword6 &= set_desc(~BIT(17));
- pdesc->dword6 &= set_desc(~BIT(18));
-
- pdesc->dword6 |= set_desc(p_dm_fat_table->antsel_a[aid] << 16);
- pdesc->dword6 |= set_desc(p_dm_fat_table->antsel_b[aid] << 17);
- pdesc->dword6 |= set_desc(p_dm_fat_table->antsel_c[aid] << 18);
-
- }
-}
-
-
-#if 1 /*def CONFIG_WLAN_HAL*/
-void
-odm_set_tx_ant_by_tx_info_hal(
- struct rtl8192cd_priv *priv,
- void *pdesc_data,
- u16 aid
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = &(priv->pshare->_dmodm);
- struct _FAST_ANTENNA_TRAINNING_ *p_dm_fat_table = &priv->pshare->_dmodm.dm_fat_table;
- u32 support_ic_type = priv->pshare->_dmodm.support_ic_type;
- PTX_DESC_DATA_88XX pdescdata = (PTX_DESC_DATA_88XX)pdesc_data;
-
- if (!(p_dm_odm->support_ability & ODM_BB_ANT_DIV))
- return;
-
- if (p_dm_odm->ant_div_type == CGCS_RX_HW_ANTDIV)
- return;
-
- if (support_ic_type == ODM_RTL8881A || support_ic_type == ODM_RTL8192E || support_ic_type == ODM_RTL8814A) {
- /*panic_printk("[%s] [%d] ******odm_set_tx_ant_by_tx_info_hal******\n",__func__,__LINE__);*/
- pdescdata->ant_sel = 1;
- pdescdata->ant_sel_a = p_dm_fat_table->antsel_a[aid];
- }
-}
-#endif /*#ifdef CONFIG_WLAN_HAL*/
-
-#endif
-
void
odm_ant_div_config(
@@ -4496,132 +3142,12 @@ odm_ant_div_config(
{
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
struct _FAST_ANTENNA_TRAINNING_ *p_dm_fat_table = &p_dm_odm->dm_fat_table;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("WIN Config Antenna Diversity\n"));
- /*
- if(p_dm_odm->support_ic_type==ODM_RTL8723B)
- {
- if((!p_dm_odm->dm_swat_table.ANTA_ON || !p_dm_odm->dm_swat_table.ANTB_ON))
- p_dm_odm->support_ability &= ~(ODM_BB_ANT_DIV);
- }
- */
- if (p_dm_odm->support_ic_type == ODM_RTL8723D) {
-
- p_dm_odm->ant_div_type = S0S1_TRX_HW_ANTDIV;
- /**/
- }
-#elif (DM_ODM_SUPPORT_TYPE & (ODM_CE))
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("CE Config Antenna Diversity\n"));
if (p_dm_odm->support_ic_type == ODM_RTL8723B)
p_dm_odm->ant_div_type = S0S1_SW_ANTDIV;
-
-
-#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("AP Config Antenna Diversity\n"));
-
- /* 2 [ NOT_SUPPORT_ANTDIV ] */
-#if (defined(CONFIG_NOT_SUPPORT_ANTDIV))
- p_dm_odm->support_ability &= ~(ODM_BB_ANT_DIV);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Disable AntDiv function] : Not Support 2.4G & 5G Antenna Diversity\n"));
-
- /* 2 [ 2G&5G_SUPPORT_ANTDIV ] */
-#elif (defined(CONFIG_2G5G_SUPPORT_ANTDIV))
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Enable AntDiv function] : 2.4G & 5G Support Antenna Diversity Simultaneously\n"));
- p_dm_fat_table->ant_div_2g_5g = (ODM_ANTDIV_2G | ODM_ANTDIV_5G);
-
- if (p_dm_odm->support_ic_type & ODM_ANTDIV_SUPPORT)
- p_dm_odm->support_ability |= ODM_BB_ANT_DIV;
- if (*p_dm_odm->p_band_type == ODM_BAND_5G) {
-#if (defined(CONFIG_5G_CGCS_RX_DIVERSITY))
- p_dm_odm->ant_div_type = CGCS_RX_HW_ANTDIV;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv type = CGCS_RX_HW_ANTDIV\n"));
- panic_printk("[ 5G] : AntDiv type = CGCS_RX_HW_ANTDIV\n");
-#elif (defined(CONFIG_5G_CG_TRX_DIVERSITY) || defined(CONFIG_2G5G_CG_TRX_DIVERSITY_8881A))
- p_dm_odm->ant_div_type = CG_TRX_HW_ANTDIV;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv type = CG_TRX_HW_ANTDIV\n"));
- panic_printk("[ 5G] : AntDiv type = CG_TRX_HW_ANTDIV\n");
-#elif (defined(CONFIG_5G_CG_SMART_ANT_DIVERSITY))
- p_dm_odm->ant_div_type = CG_TRX_SMART_ANTDIV;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv type = CG_SMART_ANTDIV\n"));
-#elif (defined(CONFIG_5G_S0S1_SW_ANT_DIVERSITY))
- p_dm_odm->ant_div_type = S0S1_SW_ANTDIV;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv type = S0S1_SW_ANTDIV\n"));
-#endif
- } else if (*p_dm_odm->p_band_type == ODM_BAND_2_4G) {
-#if (defined(CONFIG_2G_CGCS_RX_DIVERSITY))
- p_dm_odm->ant_div_type = CGCS_RX_HW_ANTDIV;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv type = CGCS_RX_HW_ANTDIV\n"));
-#elif (defined(CONFIG_2G_CG_TRX_DIVERSITY) || defined(CONFIG_2G5G_CG_TRX_DIVERSITY_8881A))
- p_dm_odm->ant_div_type = CG_TRX_HW_ANTDIV;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv type = CG_TRX_HW_ANTDIV\n"));
-#elif (defined(CONFIG_2G_CG_SMART_ANT_DIVERSITY))
- p_dm_odm->ant_div_type = CG_TRX_SMART_ANTDIV;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv type = CG_SMART_ANTDIV\n"));
-#elif (defined(CONFIG_2G_S0S1_SW_ANT_DIVERSITY))
- p_dm_odm->ant_div_type = S0S1_SW_ANTDIV;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv type = S0S1_SW_ANTDIV\n"));
-#endif
- }
-
- /* 2 [ 5G_SUPPORT_ANTDIV ] */
-#elif (defined(CONFIG_5G_SUPPORT_ANTDIV))
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Enable AntDiv function] : Only 5G Support Antenna Diversity\n"));
- panic_printk("[ Enable AntDiv function] : Only 5G Support Antenna Diversity\n");
- p_dm_fat_table->ant_div_2g_5g = (ODM_ANTDIV_5G);
- if (*p_dm_odm->p_band_type == ODM_BAND_5G) {
- if (p_dm_odm->support_ic_type & ODM_ANTDIV_5G_SUPPORT_IC)
- p_dm_odm->support_ability |= ODM_BB_ANT_DIV;
-#if (defined(CONFIG_5G_CGCS_RX_DIVERSITY))
- p_dm_odm->ant_div_type = CGCS_RX_HW_ANTDIV;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv type = CGCS_RX_HW_ANTDIV\n"));
- panic_printk("[ 5G] : AntDiv type = CGCS_RX_HW_ANTDIV\n");
-#elif (defined(CONFIG_5G_CG_TRX_DIVERSITY))
- p_dm_odm->ant_div_type = CG_TRX_HW_ANTDIV;
- panic_printk("[ 5G] : AntDiv type = CG_TRX_HW_ANTDIV\n");
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv type = CG_TRX_HW_ANTDIV\n"));
-#elif (defined(CONFIG_5G_CG_SMART_ANT_DIVERSITY))
- p_dm_odm->ant_div_type = CG_TRX_SMART_ANTDIV;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv type = CG_SMART_ANTDIV\n"));
-#elif (defined(CONFIG_5G_S0S1_SW_ANT_DIVERSITY))
- p_dm_odm->ant_div_type = S0S1_SW_ANTDIV;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 5G] : AntDiv type = S0S1_SW_ANTDIV\n"));
-#endif
- } else if (*p_dm_odm->p_band_type == ODM_BAND_2_4G) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Not Support 2G ant_div_type\n"));
- p_dm_odm->support_ability &= ~(ODM_BB_ANT_DIV);
- }
-
- /* 2 [ 2G_SUPPORT_ANTDIV ] */
-#elif (defined(CONFIG_2G_SUPPORT_ANTDIV))
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ Enable AntDiv function] : Only 2.4G Support Antenna Diversity\n"));
- p_dm_fat_table->ant_div_2g_5g = (ODM_ANTDIV_2G);
- if (*p_dm_odm->p_band_type == ODM_BAND_2_4G) {
- if (p_dm_odm->support_ic_type & ODM_ANTDIV_2G_SUPPORT_IC)
- p_dm_odm->support_ability |= ODM_BB_ANT_DIV;
-#if (defined(CONFIG_2G_CGCS_RX_DIVERSITY))
- p_dm_odm->ant_div_type = CGCS_RX_HW_ANTDIV;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv type = CGCS_RX_HW_ANTDIV\n"));
-#elif (defined(CONFIG_2G_CG_TRX_DIVERSITY))
- p_dm_odm->ant_div_type = CG_TRX_HW_ANTDIV;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv type = CG_TRX_HW_ANTDIV\n"));
-#elif (defined(CONFIG_2G_CG_SMART_ANT_DIVERSITY))
- p_dm_odm->ant_div_type = CG_TRX_SMART_ANTDIV;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv type = CG_SMART_ANTDIV\n"));
-#elif (defined(CONFIG_2G_S0S1_SW_ANT_DIVERSITY))
- p_dm_odm->ant_div_type = S0S1_SW_ANTDIV;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[ 2.4G] : AntDiv type = S0S1_SW_ANTDIV\n"));
-#endif
- } else if (*p_dm_odm->p_band_type == ODM_BAND_5G) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("Not Support 5G ant_div_type\n"));
- p_dm_odm->support_ability &= ~(ODM_BB_ANT_DIV);
- }
-#endif
-#endif
-
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[AntDiv Config Info] AntDiv_SupportAbility = (( %x ))\n", ((p_dm_odm->support_ability & ODM_BB_ANT_DIV) ? 1 : 0)));
ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("[AntDiv Config Info] be_fix_tx_ant = ((%d))\n", p_dm_odm->dm_fat_table.b_fix_tx_ant));
diff --git a/hal/phydm/phydm_antdiv.h b/hal/phydm/phydm_antdiv.h
index 272b4fd..4794da6 100644
--- a/hal/phydm/phydm_antdiv.h
+++ b/hal/phydm/phydm_antdiv.h
@@ -151,12 +151,6 @@ struct _sw_antenna_switch_ {
u32 pkt_cnt_sw_ant_div_by_ctrl_frame;
bool is_sw_ant_div_by_ctrl_frame;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-#if USE_WORKITEM
- RT_WORK_ITEM phydm_sw_antenna_switch_workitem;
-#endif
-#endif
-
/* AntDect (Before link Antenna Switch check) need to be moved*/
u16 single_ant_counter;
u16 dual_ant_counter;
@@ -170,42 +164,8 @@ struct _sw_antenna_switch_ {
bool rssi_ant_dect_result;
u8 ant_5g;
u8 ant_2g;
-
-
};
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-#if (defined(CONFIG_PHYDM_ANTENNA_DIVERSITY))
-struct _BF_DIV_COEX_ {
- bool w_bfer_client[ODM_ASSOCIATE_ENTRY_NUM];
- bool w_bfee_client[ODM_ASSOCIATE_ENTRY_NUM];
- u32 MA_rx_TP[ODM_ASSOCIATE_ENTRY_NUM];
- u32 MA_rx_TP_DIV[ODM_ASSOCIATE_ENTRY_NUM];
-
- u8 bd_ccoex_type_wbfer;
- u8 num_txbfee_client;
- u8 num_txbfer_client;
- u8 bdc_try_counter;
- u8 bdc_hold_counter;
- u8 bdc_mode;
- u8 bdc_active_mode;
- u8 BDC_state;
- u8 bdc_rx_idle_update_counter;
- u8 num_client;
- u8 pre_num_client;
- u8 num_bf_tar;
- u8 num_div_tar;
-
- bool is_all_div_sta_idle;
- bool is_all_bf_sta_idle;
- bool bdc_try_flag;
- bool BF_pass;
- bool DIV_pass;
-};
-#endif
-#endif
-
#ifdef CONFIG_HL_SMART_ANTENNA_TYPE1
struct _SMART_ANTENNA_TRAINNING_ {
u32 latch_time;
@@ -237,12 +197,6 @@ struct _SMART_ANTENNA_TRAINNING_ {
u32 beacon_counter;
u32 pre_beacon_counter;
u8 update_beam_idx;
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- RT_WORK_ITEM hl_smart_antenna_workitem;
- RT_WORK_ITEM hl_smart_antenna_decision_workitem;
-#endif
-
};
#endif
@@ -296,7 +250,6 @@ struct _FAST_ANTENNA_TRAINNING_ {
u32 main_crc32_fail_cnt;
u32 aux_crc32_fail_cnt;
#endif
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
u32 cck_ctrl_frame_cnt_main;
u32 cck_ctrl_frame_cnt_aux;
u32 ofdm_ctrl_frame_cnt_main;
@@ -305,7 +258,6 @@ struct _FAST_ANTENNA_TRAINNING_ {
u32 aux_ant_ctrl_frame_sum;
u32 main_ant_ctrl_frame_cnt;
u32 aux_ant_ctrl_frame_cnt;
-#endif
u8 b_fix_tx_ant;
bool fix_ant_bfee;
bool enable_ctrl_frame_antdiv;
@@ -417,20 +369,6 @@ phydm_set_tx_ant_pwr_8723d(
#ifdef CONFIG_S0S1_SW_ANTENNA_DIVERSITY
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-void
-odm_sw_antdiv_callback(
- struct timer_list *p_timer
-);
-
-void
-odm_sw_antdiv_workitem_callback(
- void *p_context
-);
-
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
-
void
odm_sw_antdiv_workitem_callback(
void *p_context
@@ -441,8 +379,6 @@ odm_sw_antdiv_callback(
void *function_context
);
-#endif
-
void
odm_s0s1_sw_ant_div_by_ctrl_frame(
void *p_dm_void,
@@ -497,19 +433,6 @@ odm_fast_ant_training_work_item_callback(
#ifdef CONFIG_HL_SMART_ANTENNA_TYPE1
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-void
-phydm_beam_switch_workitem_callback(
- void *p_context
-);
-
-void
-phydm_beam_decision_workitem_callback(
- void *p_context
-);
-
-#endif
-
void
phydm_update_beam_pattern(
void *p_dm_void,
@@ -562,7 +485,6 @@ odm_process_rssi_for_ant_div(
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
void
odm_set_tx_ant_by_tx_info(
void *p_dm_void,
@@ -570,28 +492,6 @@ odm_set_tx_ant_by_tx_info(
u8 mac_id
);
-#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
-
-struct tx_desc; /*declared tx_desc here or compile error happened when enabled 8822B*/
-
-void
-odm_set_tx_ant_by_tx_info(
- struct rtl8192cd_priv *priv,
- struct tx_desc *pdesc,
- unsigned short aid
-);
-
-#if 1/*def def CONFIG_WLAN_HAL*/
-void
-odm_set_tx_ant_by_tx_info_hal(
- struct rtl8192cd_priv *priv,
- void *pdesc_data,
- u16 aid
-);
-#endif /*#ifdef CONFIG_WLAN_HAL*/
-#endif
-
-
void
odm_ant_div_config(
void *p_dm_void
diff --git a/hal/phydm/phydm_beamforming.c b/hal/phydm/phydm_beamforming.c
deleted file mode 100644
index 80aae83..0000000
--- a/hal/phydm/phydm_beamforming.c
+++ /dev/null
@@ -1,1880 +0,0 @@
-#include "mp_precomp.h"
-#include "phydm_precomp.h"
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- #if WPP_SOFTWARE_TRACE
- #include "phydm_beamforming.tmh"
- #endif
-#endif
-
-#if (BEAMFORMING_SUPPORT == 1)
-
-struct _RT_BEAMFORM_STAINFO *
-phydm_sta_info_init(
- struct PHY_DM_STRUCT *p_dm_odm,
- u16 sta_idx
-)
-{
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
- struct _RT_BEAMFORM_STAINFO *p_entry = &(p_beam_info->beamform_sta_info);
- struct sta_info *p_sta = p_dm_odm->p_odm_sta_info[sta_idx];
- struct _ADAPTER *adapter = p_dm_odm->adapter;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- PMGNT_INFO p_MgntInfo = &adapter->MgntInfo;
- PRT_HIGH_THROUGHPUT p_ht_info = GET_HT_INFO(p_MgntInfo);
- PRT_VERY_HIGH_THROUGHPUT p_vht_info = GET_VHT_INFO(p_MgntInfo);
- u1Byte iotpeer = 0;
-
- iotpeer = p_MgntInfo->IOTPeer;
- odm_move_memory(p_dm_odm, p_entry->my_mac_addr, adapter->CurrentAddress, 6);
-
- p_entry->ht_beamform_cap = p_ht_info->HtBeamformCap;
- p_entry->vht_beamform_cap = p_vht_info->VhtBeamformCap;
-
- /*IBSS, AP mode*/
- if (sta_idx != 0) {
- p_entry->aid = p_sta->AID;
- p_entry->ra = p_sta->MacAddr;
- p_entry->mac_id = p_sta->AssociatedMacId;
- p_entry->wireless_mode = p_sta->WirelessMode;
- p_entry->bw = p_sta->BandWidth;
- p_entry->cur_beamform = p_sta->HTInfo.HtCurBeamform;
- } else {/*client mode*/
- p_entry->aid = p_MgntInfo->mAId;
- p_entry->ra = p_MgntInfo->Bssid;
- p_entry->mac_id = p_MgntInfo->mMacId;
- p_entry->wireless_mode = p_MgntInfo->dot11CurrentWirelessMode;
- p_entry->bw = p_MgntInfo->dot11CurrentChannelBandWidth;
- p_entry->cur_beamform = p_ht_info->HtCurBeamform;
- }
-
- if ((p_entry->wireless_mode & WIRELESS_MODE_AC_5G) || (p_entry->wireless_mode & WIRELESS_MODE_AC_24G)) {
- if (sta_idx != 0)
- p_entry->cur_beamform_vht = p_sta->VHTInfo.VhtCurBeamform;
- else
- p_entry->cur_beamform_vht = p_vht_info->VhtCurBeamform;
-
- }
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("p_sta->wireless_mode = 0x%x, staidx = %d\n", p_sta->WirelessMode, sta_idx));
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
-
- if (!IS_STA_VALID(p_sta)) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s => sta_info(mac_id:%d) failed\n", __func__, sta_idx));
- rtw_warn_on(1);
- return p_entry;
- }
-
- odm_move_memory(p_dm_odm, p_entry->my_mac_addr, adapter_mac_addr(p_sta->padapter), 6);
- p_entry->ht_beamform_cap = p_sta->htpriv.beamform_cap;
-
- p_entry->aid = p_sta->aid;
- p_entry->ra = p_sta->hwaddr;
- p_entry->mac_id = p_sta->mac_id;
- p_entry->wireless_mode = p_sta->wireless_mode;
- p_entry->bw = p_sta->bw_mode;
-
- p_entry->cur_beamform = p_sta->htpriv.beamform_cap;
-#if ODM_IC_11AC_SERIES_SUPPORT
- if ((p_entry->wireless_mode & WIRELESS_MODE_AC_5G) || (p_entry->wireless_mode & WIRELESS_MODE_AC_24G)) {
- p_entry->cur_beamform_vht = p_sta->vhtpriv.beamform_cap;
- p_entry->vht_beamform_cap = p_sta->vhtpriv.beamform_cap;
- }
-#endif
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("p_sta->wireless_mode = 0x%x, staidx = %d\n", p_sta->wireless_mode, sta_idx));
-#endif
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("p_entry->cur_beamform = 0x%x, p_entry->cur_beamform_vht = 0x%x\n", p_entry->cur_beamform, p_entry->cur_beamform_vht));
- return p_entry;
-
-}
-void phydm_sta_info_update(
- struct PHY_DM_STRUCT *p_dm_odm,
- u16 sta_idx,
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry
-)
-{
- struct sta_info *p_sta = p_dm_odm->p_odm_sta_info[sta_idx];
-
- if (!IS_STA_VALID(p_sta))
- return;
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
- p_sta->txbf_paid = p_beamform_entry->p_aid;
- p_sta->txbf_gid = p_beamform_entry->g_id;
-#endif
-}
-
-struct _RT_BEAMFORMEE_ENTRY *
-phydm_beamforming_get_bfee_entry_by_addr(
- void *p_dm_void,
- u8 *RA,
- u8 *idx
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 i = 0;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
-
- for (i = 0; i < BEAMFORMEE_ENTRY_NUM; i++) {
- if (p_beam_info->beamformee_entry[i].is_used && (eq_mac_addr(RA, p_beam_info->beamformee_entry[i].mac_addr))) {
- *idx = i;
- return &(p_beam_info->beamformee_entry[i]);
- }
- }
-
- return NULL;
-}
-
-struct _RT_BEAMFORMER_ENTRY *
-phydm_beamforming_get_bfer_entry_by_addr(
- void *p_dm_void,
- u8 *TA,
- u8 *idx
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 i = 0;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
-
- for (i = 0; i < BEAMFORMER_ENTRY_NUM; i++) {
- if (p_beam_info->beamformer_entry[i].is_used && (eq_mac_addr(TA, p_beam_info->beamformer_entry[i].mac_addr))) {
- *idx = i;
- return &(p_beam_info->beamformer_entry[i]);
- }
- }
-
- return NULL;
-}
-
-
-struct _RT_BEAMFORMEE_ENTRY *
-phydm_beamforming_get_entry_by_mac_id(
- void *p_dm_void,
- u8 mac_id,
- u8 *idx
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 i = 0;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
-
- for (i = 0; i < BEAMFORMEE_ENTRY_NUM; i++) {
- if (p_beam_info->beamformee_entry[i].is_used && (mac_id == p_beam_info->beamformee_entry[i].mac_id)) {
- *idx = i;
- return &(p_beam_info->beamformee_entry[i]);
- }
- }
-
- return NULL;
-}
-
-
-enum beamforming_cap
-phydm_beamforming_get_entry_beam_cap_by_mac_id(
- void *p_dm_void,
- u8 mac_id
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 i = 0;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
- enum beamforming_cap beamform_entry_cap = BEAMFORMING_CAP_NONE;
-
- for (i = 0; i < BEAMFORMEE_ENTRY_NUM; i++) {
- if (p_beam_info->beamformee_entry[i].is_used && (mac_id == p_beam_info->beamformee_entry[i].mac_id)) {
- beamform_entry_cap = p_beam_info->beamformee_entry[i].beamform_entry_cap;
- i = BEAMFORMEE_ENTRY_NUM;
- }
- }
-
- return beamform_entry_cap;
-}
-
-
-struct _RT_BEAMFORMEE_ENTRY *
-phydm_beamforming_get_free_bfee_entry(
- void *p_dm_void,
- u8 *idx
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 i = 0;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
-
- for (i = 0; i < BEAMFORMEE_ENTRY_NUM; i++) {
- if (p_beam_info->beamformee_entry[i].is_used == false) {
- *idx = i;
- return &(p_beam_info->beamformee_entry[i]);
- }
- }
- return NULL;
-}
-
-struct _RT_BEAMFORMER_ENTRY *
-phydm_beamforming_get_free_bfer_entry(
- void *p_dm_void,
- u8 *idx
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 i = 0;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s ===>\n", __func__));
-
- for (i = 0; i < BEAMFORMER_ENTRY_NUM; i++) {
- if (p_beam_info->beamformer_entry[i].is_used == false) {
- *idx = i;
- return &(p_beam_info->beamformer_entry[i]);
- }
- }
- return NULL;
-}
-
-/*
- * Description: Get the first entry index of MU Beamformee.
- *
- * Return value: index of the first MU sta.
- *
- * 2015.05.25. Created by tynli.
- *
- */
-u8
-phydm_beamforming_get_first_mu_bfee_entry_idx(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 idx = 0xFF;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
- bool is_found = false;
-
- for (idx = 0; idx < BEAMFORMEE_ENTRY_NUM; idx++) {
- if (p_beam_info->beamformee_entry[idx].is_used && p_beam_info->beamformee_entry[idx].is_mu_sta) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] idx=%d!\n", __func__, idx));
- is_found = true;
- break;
- }
- }
-
- if (!is_found)
- idx = 0xFF;
-
- return idx;
-}
-
-
-/*Add SU BFee and MU BFee*/
-struct _RT_BEAMFORMEE_ENTRY *
-beamforming_add_bfee_entry(
- void *p_dm_void,
- struct _RT_BEAMFORM_STAINFO *p_sta,
- enum beamforming_cap beamform_cap,
- u8 num_of_sounding_dim,
- u8 comp_steering_num_of_bfer,
- u8 *idx
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _RT_BEAMFORMEE_ENTRY *p_entry = phydm_beamforming_get_free_bfee_entry(p_dm_odm, idx);
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Start!\n", __func__));
-
- if (p_entry != NULL) {
- p_entry->is_used = true;
- p_entry->aid = p_sta->aid;
- p_entry->mac_id = p_sta->mac_id;
- p_entry->sound_bw = p_sta->bw;
- odm_move_memory(p_dm_odm, p_entry->my_mac_addr, p_sta->my_mac_addr, 6);
-
- if (phydm_acting_determine(p_dm_odm, phydm_acting_as_ap)) {
- /*BSSID[44:47] xor BSSID[40:43]*/
- u16 bssid = ((p_sta->my_mac_addr[5] & 0xf0) >> 4) ^ (p_sta->my_mac_addr[5] & 0xf);
- /*(dec(A) + dec(B)*32) mod 512*/
- p_entry->p_aid = (p_sta->aid + bssid * 32) & 0x1ff;
- p_entry->g_id = 63;
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: BFee P_AID addressed to STA=%d\n", __func__, p_entry->p_aid));
- } else if (phydm_acting_determine(p_dm_odm, phydm_acting_as_ibss)) {
- /*ad hoc mode*/
- p_entry->p_aid = 0;
- p_entry->g_id = 63;
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: BFee P_AID as IBSS=%d\n", __func__, p_entry->p_aid));
- } else {
- /*client mode*/
- p_entry->p_aid = p_sta->ra[5];
- /*BSSID[39:47]*/
- p_entry->p_aid = (p_entry->p_aid << 1) | (p_sta->ra[4] >> 7);
- p_entry->g_id = 0;
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: BFee P_AID addressed to AP=0x%X\n", __func__, p_entry->p_aid));
- }
- cp_mac_addr(p_entry->mac_addr, p_sta->ra);
- p_entry->is_txbf = false;
- p_entry->is_sound = false;
- p_entry->sound_period = 400;
- p_entry->beamform_entry_cap = beamform_cap;
- p_entry->beamform_entry_state = BEAMFORMING_ENTRY_STATE_UNINITIALIZE;
-
- /* p_entry->log_seq = 0xff; Move to beamforming_add_bfer_entry*/
- /* p_entry->log_retry_cnt = 0; Move to beamforming_add_bfer_entry*/
- /* p_entry->LogSuccessCnt = 0; Move to beamforming_add_bfer_entry*/
-
- p_entry->log_status_fail_cnt = 0;
-
- p_entry->num_of_sounding_dim = num_of_sounding_dim;
- p_entry->comp_steering_num_of_bfer = comp_steering_num_of_bfer;
-
- if (beamform_cap & BEAMFORMER_CAP_VHT_MU) {
- p_dm_odm->beamforming_info.beamformee_mu_cnt += 1;
- p_entry->is_mu_sta = true;
- p_dm_odm->beamforming_info.first_mu_bfee_index = phydm_beamforming_get_first_mu_bfee_entry_idx(p_dm_odm);
- } else if (beamform_cap & (BEAMFORMER_CAP_VHT_SU | BEAMFORMER_CAP_HT_EXPLICIT)) {
- p_dm_odm->beamforming_info.beamformee_su_cnt += 1;
- p_entry->is_mu_sta = false;
- }
-
- return p_entry;
- } else
- return NULL;
-}
-
-/*Add SU BFee and MU BFer*/
-struct _RT_BEAMFORMER_ENTRY *
-beamforming_add_bfer_entry(
- void *p_dm_void,
- struct _RT_BEAMFORM_STAINFO *p_sta,
- enum beamforming_cap beamform_cap,
- u8 num_of_sounding_dim,
- u8 *idx
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _RT_BEAMFORMER_ENTRY *p_entry = phydm_beamforming_get_free_bfer_entry(p_dm_odm, idx);
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Start!\n", __func__));
-
- if (p_entry != NULL) {
- p_entry->is_used = true;
- odm_move_memory(p_dm_odm, p_entry->my_mac_addr, p_sta->my_mac_addr, 6);
- if (phydm_acting_determine(p_dm_odm, phydm_acting_as_ap)) {
- /*BSSID[44:47] xor BSSID[40:43]*/
- u16 bssid = ((p_sta->my_mac_addr[5] & 0xf0) >> 4) ^ (p_sta->my_mac_addr[5] & 0xf);
-
- p_entry->p_aid = (p_sta->aid + bssid * 32) & 0x1ff;
- p_entry->g_id = 63;
- /*(dec(A) + dec(B)*32) mod 512*/
- } else if (phydm_acting_determine(p_dm_odm, phydm_acting_as_ibss)) {
- p_entry->p_aid = 0;
- p_entry->g_id = 63;
- } else {
- p_entry->p_aid = p_sta->ra[5];
- /*BSSID[39:47]*/
- p_entry->p_aid = (p_entry->p_aid << 1) | (p_sta->ra[4] >> 7);
- p_entry->g_id = 0;
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: P_AID addressed to AP=0x%X\n", __func__, p_entry->p_aid));
- }
-
- cp_mac_addr(p_entry->mac_addr, p_sta->ra);
- p_entry->beamform_entry_cap = beamform_cap;
-
- p_entry->pre_log_seq = 0; /*Modified by Jeffery @2015-04-13*/
- p_entry->log_seq = 0; /*Modified by Jeffery @2014-10-29*/
- p_entry->log_retry_cnt = 0; /*Modified by Jeffery @2014-10-29*/
- p_entry->log_success = 0; /*log_success is NOT needed to be accumulated, so LogSuccessCnt->log_success, 2015-04-13, Jeffery*/
- p_entry->clock_reset_times = 0; /*Modified by Jeffery @2015-04-13*/
-
- p_entry->num_of_sounding_dim = num_of_sounding_dim;
-
- if (beamform_cap & BEAMFORMEE_CAP_VHT_MU) {
- p_dm_odm->beamforming_info.beamformer_mu_cnt += 1;
- p_entry->is_mu_ap = true;
- p_entry->aid = p_sta->aid;
- } else if (beamform_cap & (BEAMFORMEE_CAP_VHT_SU | BEAMFORMEE_CAP_HT_EXPLICIT)) {
- p_dm_odm->beamforming_info.beamformer_su_cnt += 1;
- p_entry->is_mu_ap = false;
- }
-
- return p_entry;
- } else
- return NULL;
-}
-
-#if 0
-bool
-beamforming_remove_entry(
- struct _ADAPTER *adapter,
- u8 *RA,
- u8 *idx
-)
-{
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-
- struct _RT_BEAMFORMER_ENTRY *p_bfer_entry = phydm_beamforming_get_bfer_entry_by_addr(p_dm_odm, RA, idx);
- struct _RT_BEAMFORMEE_ENTRY *p_entry = phydm_beamforming_get_bfee_entry_by_addr(p_dm_odm, RA, idx);
- bool ret = false;
-
- RT_DISP(FBEAM, FBEAM_FUN, ("[Beamforming]@%s Start!\n", __func__));
- RT_DISP(FBEAM, FBEAM_FUN, ("[Beamforming]@%s, p_bfer_entry=0x%x\n", __func__, p_bfer_entry));
- RT_DISP(FBEAM, FBEAM_FUN, ("[Beamforming]@%s, p_entry=0x%x\n", __func__, p_entry));
-
- if (p_entry != NULL) {
- p_entry->is_used = false;
- p_entry->beamform_entry_cap = BEAMFORMING_CAP_NONE;
- /*p_entry->beamform_entry_state = BEAMFORMING_ENTRY_STATE_UNINITIALIZE;*/
- p_entry->is_beamforming_in_progress = false;
- ret = true;
- }
- if (p_bfer_entry != NULL) {
- p_bfer_entry->is_used = false;
- p_bfer_entry->beamform_entry_cap = BEAMFORMING_CAP_NONE;
- ret = true;
- }
- return ret;
-
-}
-#endif
-
-/* Used for beamforming_start_v1 */
-void
-phydm_beamforming_ndpa_rate(
- void *p_dm_void,
- CHANNEL_WIDTH BW,
- u8 rate
-)
-{
- u16 ndpa_rate = rate;
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Start!\n", __func__));
-
- if (ndpa_rate == 0) {
- if (p_dm_odm->rssi_min > 30) /* link RSSI > 30% */
- ndpa_rate = ODM_RATE24M;
- else
- ndpa_rate = ODM_RATE6M;
- }
-
- if (ndpa_rate < ODM_RATEMCS0)
- BW = (CHANNEL_WIDTH)ODM_BW20M;
-
- ndpa_rate = (ndpa_rate << 8) | BW;
- hal_com_txbf_set(p_dm_odm, TXBF_SET_SOUNDING_RATE, (u8 *)&ndpa_rate);
-
-}
-
-
-/* Used for beamforming_start_sw and beamforming_start_fw */
-void
-phydm_beamforming_dym_ndpa_rate(
- void *p_dm_void
-)
-{
- u16 ndpa_rate = ODM_RATE6M, BW;
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Start!\n", __func__));
-
- if (p_dm_odm->rssi_min > 30) /*link RSSI > 30%*/
- ndpa_rate = ODM_RATE24M;
- else
- ndpa_rate = ODM_RATE6M;
-
- BW = ODM_BW20M;
- ndpa_rate = ndpa_rate << 8 | BW;
- hal_com_txbf_set(p_dm_odm, TXBF_SET_SOUNDING_RATE, (u8 *)&ndpa_rate);
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s End, NDPA rate = 0x%X\n", __func__, ndpa_rate));
-}
-
-/*
-* SW Sounding : SW Timer unit 1ms
-* HW Timer unit (1/32000) s 32k is clock.
-* FW Sounding : FW Timer unit 10ms
-*/
-void
-beamforming_dym_period(
- void *p_dm_void,
- u8 status
-)
-{
- u8 idx;
- bool is_change_period = false;
- u16 sound_period_sw, sound_period_fw;
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _RT_SOUNDING_INFO *p_sound_info = &(p_beam_info->sounding_info);
-
- struct _RT_BEAMFORMEE_ENTRY *p_entry = &(p_beam_info->beamformee_entry[p_beam_info->beamformee_cur_idx]);
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start!\n", __func__));
-
- /* 3 TODO per-client throughput caculation. */
-
- if ((*(p_dm_odm->p_current_tx_tp) + *(p_dm_odm->p_current_rx_tp) > 2) && ((p_entry->log_status_fail_cnt <= 20) || status)) {
- sound_period_sw = 40; /* 40ms */
- sound_period_fw = 40; /* From H2C cmd, unit = 10ms */
- } else {
- sound_period_sw = 4000;/* 4s */
- sound_period_fw = 400;
- }
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s]sound_period_sw=%d, sound_period_fw=%d\n", __func__, sound_period_sw, sound_period_fw));
-
- for (idx = 0; idx < BEAMFORMEE_ENTRY_NUM; idx++) {
- p_beamform_entry = p_beam_info->beamformee_entry + idx;
-
- if (p_beamform_entry->default_csi_cnt > 20) {
- /*Modified by David*/
- sound_period_sw = 4000;
- sound_period_fw = 400;
- }
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] period = %d\n", __func__, sound_period_sw));
- if (p_beamform_entry->beamform_entry_cap & (BEAMFORMER_CAP_HT_EXPLICIT | BEAMFORMER_CAP_VHT_SU)) {
- if (p_sound_info->sound_mode == SOUNDING_FW_VHT_TIMER || p_sound_info->sound_mode == SOUNDING_FW_HT_TIMER) {
- if (p_beamform_entry->sound_period != sound_period_fw) {
- p_beamform_entry->sound_period = sound_period_fw;
- is_change_period = true; /*Only FW sounding need to send H2C packet to change sound period. */
- }
- } else if (p_beamform_entry->sound_period != sound_period_sw)
- p_beamform_entry->sound_period = sound_period_sw;
- }
- }
-
- if (is_change_period)
- hal_com_txbf_set(p_dm_odm, TXBF_SET_SOUNDING_FW_NDPA, (u8 *)&idx);
-}
-
-
-
-
-bool
-beamforming_send_ht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- CHANNEL_WIDTH BW,
- u8 q_idx
-)
-{
- bool ret = true;
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
- if (q_idx == BEACON_QUEUE)
- ret = send_fw_ht_ndpa_packet(p_dm_odm, RA, BW);
- else
- ret = send_sw_ht_ndpa_packet(p_dm_odm, RA, BW);
-
- return ret;
-}
-
-
-
-bool
-beamforming_send_vht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- u16 AID,
- CHANNEL_WIDTH BW,
- u8 q_idx
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- bool ret = true;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
-
- hal_com_txbf_set(p_dm_odm, TXBF_SET_GET_TX_RATE, NULL);
-
- if ((p_dm_odm->tx_bf_data_rate >= ODM_RATEVHTSS3MCS7) && (p_dm_odm->tx_bf_data_rate <= ODM_RATEVHTSS3MCS9) && (p_beam_info->snding3ss == false))
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("@%s: 3SS VHT 789 don't sounding\n", __func__));
-
- else {
- if (q_idx == BEACON_QUEUE) /* Send to reserved page => FW NDPA */
- ret = send_fw_vht_ndpa_packet(p_dm_odm, RA, AID, BW);
- else {
-#ifdef SUPPORT_MU_BF
-#if (SUPPORT_MU_BF == 1)
- p_beam_info->is_mu_sounding = true;
- ret = send_sw_vht_mu_ndpa_packet(p_dm_odm, BW);
-#else
- p_beam_info->is_mu_sounding = false;
- ret = send_sw_vht_ndpa_packet(p_dm_odm, RA, AID, BW);
-#endif
-#else
- p_beam_info->is_mu_sounding = false;
- ret = send_sw_vht_ndpa_packet(p_dm_odm, RA, AID, BW);
-#endif
- }
- }
- return ret;
-}
-
-
-enum beamforming_notify_state
-phydm_beamfomring_is_sounding(
- void *p_dm_void,
- struct _RT_BEAMFORMING_INFO *p_beam_info,
- u8 *idx
-)
-{
- enum beamforming_notify_state is_sounding = BEAMFORMING_NOTIFY_NONE;
- struct _RT_BEAMFORMING_OID_INFO beam_oid_info = p_beam_info->beamforming_oid_info;
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Start!\n", __func__));
-
- /*if(( Beamforming_GetBeamCap(p_beam_info) & BEAMFORMER_CAP) == 0)*/
- /*is_sounding = BEAMFORMING_NOTIFY_RESET;*/
- if (beam_oid_info.sound_oid_mode == sounding_stop_all_timer)
- is_sounding = BEAMFORMING_NOTIFY_RESET;
- else {
- u8 i;
-
- for (i = 0 ; i < BEAMFORMEE_ENTRY_NUM ; i++) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("@%s: BFee Entry %d is_used=%d, is_sound=%d\n", __func__, i, p_beam_info->beamformee_entry[i].is_used, p_beam_info->beamformee_entry[i].is_sound));
- if (p_beam_info->beamformee_entry[i].is_used && (!p_beam_info->beamformee_entry[i].is_sound)) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: Add BFee entry %d\n", __func__, i));
- *idx = i;
- if (p_beam_info->beamformee_entry[i].is_mu_sta)
- is_sounding = BEAMFORMEE_NOTIFY_ADD_MU;
- else
- is_sounding = BEAMFORMEE_NOTIFY_ADD_SU;
- }
-
- if ((!p_beam_info->beamformee_entry[i].is_used) && p_beam_info->beamformee_entry[i].is_sound) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: Delete BFee entry %d\n", __func__, i));
- *idx = i;
- if (p_beam_info->beamformee_entry[i].is_mu_sta)
- is_sounding = BEAMFORMEE_NOTIFY_DELETE_MU;
- else
- is_sounding = BEAMFORMEE_NOTIFY_DELETE_SU;
- }
- }
- }
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s End, is_sounding = %d\n", __func__, is_sounding));
- return is_sounding;
-}
-
-
-/* This function is unused */
-u8
-phydm_beamforming_sounding_idx(
- void *p_dm_void,
- struct _RT_BEAMFORMING_INFO *p_beam_info
-)
-{
- u8 idx = 0;
- struct _RT_BEAMFORMING_OID_INFO beam_oid_info = p_beam_info->beamforming_oid_info;
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Start!\n", __func__));
-
- if (beam_oid_info.sound_oid_mode == SOUNDING_SW_HT_TIMER || beam_oid_info.sound_oid_mode == SOUNDING_SW_VHT_TIMER ||
- beam_oid_info.sound_oid_mode == SOUNDING_HW_HT_TIMER || beam_oid_info.sound_oid_mode == SOUNDING_HW_VHT_TIMER)
- idx = beam_oid_info.sound_oid_idx;
- else {
- u8 i;
- for (i = 0; i < BEAMFORMEE_ENTRY_NUM; i++) {
- if (p_beam_info->beamformee_entry[i].is_used && (false == p_beam_info->beamformee_entry[i].is_sound)) {
- idx = i;
- break;
- }
- }
- }
-
- return idx;
-}
-
-
-enum sounding_mode
-phydm_beamforming_sounding_mode(
- void *p_dm_void,
- struct _RT_BEAMFORMING_INFO *p_beam_info,
- u8 idx
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 support_interface = p_dm_odm->support_interface;
-
- struct _RT_BEAMFORMEE_ENTRY beam_entry = p_beam_info->beamformee_entry[idx];
- struct _RT_BEAMFORMING_OID_INFO beam_oid_info = p_beam_info->beamforming_oid_info;
- enum sounding_mode mode = beam_oid_info.sound_oid_mode;
-
- if (beam_oid_info.sound_oid_mode == SOUNDING_SW_VHT_TIMER || beam_oid_info.sound_oid_mode == SOUNDING_HW_VHT_TIMER) {
- if (beam_entry.beamform_entry_cap & BEAMFORMER_CAP_VHT_SU)
- mode = beam_oid_info.sound_oid_mode;
- else
- mode = sounding_stop_all_timer;
- } else if (beam_oid_info.sound_oid_mode == SOUNDING_SW_HT_TIMER || beam_oid_info.sound_oid_mode == SOUNDING_HW_HT_TIMER) {
- if (beam_entry.beamform_entry_cap & BEAMFORMER_CAP_HT_EXPLICIT)
- mode = beam_oid_info.sound_oid_mode;
- else
- mode = sounding_stop_all_timer;
- } else if (beam_entry.beamform_entry_cap & BEAMFORMER_CAP_VHT_SU) {
- if ((support_interface == ODM_ITRF_USB) && !(p_dm_odm->support_ic_type & (ODM_RTL8814A | ODM_RTL8822B)))
- mode = SOUNDING_FW_VHT_TIMER;
- else
- mode = SOUNDING_SW_VHT_TIMER;
- } else if (beam_entry.beamform_entry_cap & BEAMFORMER_CAP_HT_EXPLICIT) {
- if ((support_interface == ODM_ITRF_USB) && !(p_dm_odm->support_ic_type & (ODM_RTL8814A | ODM_RTL8822B)))
- mode = SOUNDING_FW_HT_TIMER;
- else
- mode = SOUNDING_SW_HT_TIMER;
- } else
- mode = sounding_stop_all_timer;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] support_interface=%d, mode=%d\n", __func__, support_interface, mode));
-
- return mode;
-}
-
-
-u16
-phydm_beamforming_sounding_time(
- void *p_dm_void,
- struct _RT_BEAMFORMING_INFO *p_beam_info,
- enum sounding_mode mode,
- u8 idx
-)
-{
- u16 sounding_time = 0xffff;
- struct _RT_BEAMFORMEE_ENTRY beam_entry = p_beam_info->beamformee_entry[idx];
- struct _RT_BEAMFORMING_OID_INFO beam_oid_info = p_beam_info->beamforming_oid_info;
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Start!\n", __func__));
-
- if (mode == SOUNDING_HW_HT_TIMER || mode == SOUNDING_HW_VHT_TIMER)
- sounding_time = beam_oid_info.sound_oid_period * 32;
- else if (mode == SOUNDING_SW_HT_TIMER || mode == SOUNDING_SW_VHT_TIMER)
- /*Modified by David*/
- sounding_time = beam_entry.sound_period; /*beam_oid_info.sound_oid_period;*/
- else
- sounding_time = beam_entry.sound_period;
-
- return sounding_time;
-}
-
-
-CHANNEL_WIDTH
-phydm_beamforming_sounding_bw(
- void *p_dm_void,
- struct _RT_BEAMFORMING_INFO *p_beam_info,
- enum sounding_mode mode,
- u8 idx
-)
-{
- CHANNEL_WIDTH sounding_bw = CHANNEL_WIDTH_20;
- struct _RT_BEAMFORMEE_ENTRY beam_entry = p_beam_info->beamformee_entry[idx];
- struct _RT_BEAMFORMING_OID_INFO beam_oid_info = p_beam_info->beamforming_oid_info;
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
- if (mode == SOUNDING_HW_HT_TIMER || mode == SOUNDING_HW_VHT_TIMER)
- sounding_bw = beam_oid_info.sound_oid_bw;
- else if (mode == SOUNDING_SW_HT_TIMER || mode == SOUNDING_SW_VHT_TIMER)
- /*Modified by David*/
- sounding_bw = beam_entry.sound_bw; /*beam_oid_info.sound_oid_bw;*/
- else
- sounding_bw = beam_entry.sound_bw;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s, sounding_bw=0x%X\n", __func__, sounding_bw));
-
- return sounding_bw;
-}
-
-
-bool
-phydm_beamforming_select_beam_entry(
- void *p_dm_void,
- struct _RT_BEAMFORMING_INFO *p_beam_info
-)
-{
- struct _RT_SOUNDING_INFO *p_sound_info = &(p_beam_info->sounding_info);
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
- /*p_entry.is_sound is different between first and latter NDPA, and should not be used as BFee entry selection*/
- /*BTW, latter modification should sync to the selection mechanism of AP/ADSL instead of the fixed sound_idx.*/
- p_sound_info->sound_idx = phydm_beamforming_sounding_idx(p_dm_odm, p_beam_info);
- /*p_sound_info->sound_idx = 0;*/
-
- if (p_sound_info->sound_idx < BEAMFORMEE_ENTRY_NUM)
- p_sound_info->sound_mode = phydm_beamforming_sounding_mode(p_dm_odm, p_beam_info, p_sound_info->sound_idx);
- else
- p_sound_info->sound_mode = sounding_stop_all_timer;
-
- if (sounding_stop_all_timer == p_sound_info->sound_mode) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Return because of sounding_stop_all_timer\n", __func__));
- return false;
- } else {
- p_sound_info->sound_bw = phydm_beamforming_sounding_bw(p_dm_odm, p_beam_info, p_sound_info->sound_mode, p_sound_info->sound_idx);
- p_sound_info->sound_period = phydm_beamforming_sounding_time(p_dm_odm, p_beam_info, p_sound_info->sound_mode, p_sound_info->sound_idx);
- return true;
- }
-}
-
-/*SU BFee Entry Only*/
-bool
-phydm_beamforming_start_period(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- bool ret = true;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
- struct _RT_SOUNDING_INFO *p_sound_info = &(p_beam_info->sounding_info);
-
- phydm_beamforming_dym_ndpa_rate(p_dm_odm);
-
- phydm_beamforming_select_beam_entry(p_dm_odm, p_beam_info); /* Modified */
-
- if (p_sound_info->sound_mode == SOUNDING_SW_VHT_TIMER || p_sound_info->sound_mode == SOUNDING_SW_HT_TIMER)
- odm_set_timer(p_dm_odm, &p_beam_info->beamforming_timer, p_sound_info->sound_period);
- else if (p_sound_info->sound_mode == SOUNDING_HW_VHT_TIMER || p_sound_info->sound_mode == SOUNDING_HW_HT_TIMER ||
- p_sound_info->sound_mode == SOUNDING_AUTO_VHT_TIMER || p_sound_info->sound_mode == SOUNDING_AUTO_HT_TIMER) {
- HAL_HW_TIMER_TYPE timer_type = HAL_TIMER_TXBF;
- u32 val = (p_sound_info->sound_period | (timer_type << 16));
-
- /* HW timer stop: All IC has the same setting */
- phydm_set_hw_reg_handler_interface(p_dm_odm, HW_VAR_HW_REG_TIMER_STOP, (u8 *)(&timer_type));
- /* odm_write_1byte(p_dm_odm, 0x15F, 0); */
- /* HW timer init: All IC has the same setting, but 92E & 8812A only write 2 bytes */
- phydm_set_hw_reg_handler_interface(p_dm_odm, HW_VAR_HW_REG_TIMER_INIT, (u8 *)(&val));
- /* odm_write_1byte(p_dm_odm, 0x164, 1); */
- /* odm_write_4byte(p_dm_odm, 0x15C, val); */
- /* HW timer start: All IC has the same setting */
- phydm_set_hw_reg_handler_interface(p_dm_odm, HW_VAR_HW_REG_TIMER_START, (u8 *)(&timer_type));
- /* odm_write_1byte(p_dm_odm, 0x15F, 0x5); */
- } else if (p_sound_info->sound_mode == SOUNDING_FW_VHT_TIMER || p_sound_info->sound_mode == SOUNDING_FW_HT_TIMER)
- ret = beamforming_start_fw(p_dm_odm, p_sound_info->sound_idx);
- else
- ret = false;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] sound_idx=%d, sound_mode=%d, sound_bw=%d, sound_period=%d\n", __func__,
- p_sound_info->sound_idx, p_sound_info->sound_mode, p_sound_info->sound_bw, p_sound_info->sound_period));
-
- return ret;
-}
-
-/* Used after beamforming_leave, and will clear the setting of the "already deleted" entry
- *SU BFee Entry Only*/
-void
-phydm_beamforming_end_period_sw(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
- struct _RT_SOUNDING_INFO *p_sound_info = &(p_beam_info->sounding_info);
-
- HAL_HW_TIMER_TYPE timer_type = HAL_TIMER_TXBF;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Start!\n", __func__));
-
- if (p_sound_info->sound_mode == SOUNDING_SW_VHT_TIMER || p_sound_info->sound_mode == SOUNDING_SW_HT_TIMER)
- odm_cancel_timer(p_dm_odm, &p_beam_info->beamforming_timer);
- else if (p_sound_info->sound_mode == SOUNDING_HW_VHT_TIMER || p_sound_info->sound_mode == SOUNDING_HW_HT_TIMER ||
- p_sound_info->sound_mode == SOUNDING_AUTO_VHT_TIMER || p_sound_info->sound_mode == SOUNDING_AUTO_HT_TIMER)
- /*HW timer stop: All IC has the same setting*/
- phydm_set_hw_reg_handler_interface(p_dm_odm, HW_VAR_HW_REG_TIMER_STOP, (u8 *)(&timer_type));
- /*odm_write_1byte(p_dm_odm, 0x15F, 0);*/
-}
-
-void
-phydm_beamforming_end_period_fw(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 idx = 0;
-
- hal_com_txbf_set(p_dm_odm, TXBF_SET_SOUNDING_FW_NDPA, (u8 *)&idx);
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s]\n", __func__));
-}
-
-
-/*SU BFee Entry Only*/
-void
-phydm_beamforming_clear_entry_sw(
- void *p_dm_void,
- bool is_delete,
- u8 delete_idx
-)
-{
- u8 idx = 0;
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry = NULL;
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
-
- if (is_delete) {
- if (delete_idx < BEAMFORMEE_ENTRY_NUM) {
- p_beamform_entry = p_beam_info->beamformee_entry + delete_idx;
- if (!((!p_beamform_entry->is_used) && p_beamform_entry->is_sound)) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] SW delete_idx is wrong!!!!!\n", __func__));
- return;
- }
- }
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] SW delete BFee entry %d\n", __func__, delete_idx));
- if (p_beamform_entry->beamform_entry_state == BEAMFORMING_ENTRY_STATE_PROGRESSING) {
- p_beamform_entry->is_beamforming_in_progress = false;
- p_beamform_entry->beamform_entry_state = BEAMFORMING_ENTRY_STATE_UNINITIALIZE;
- } else if (p_beamform_entry->beamform_entry_state == BEAMFORMING_ENTRY_STATE_PROGRESSED) {
- p_beamform_entry->beamform_entry_state = BEAMFORMING_ENTRY_STATE_UNINITIALIZE;
- hal_com_txbf_set(p_dm_odm, TXBF_SET_SOUNDING_STATUS, (u8 *)&delete_idx);
- }
- p_beamform_entry->is_sound = false;
- } else {
- for (idx = 0; idx < BEAMFORMEE_ENTRY_NUM; idx++) {
- p_beamform_entry = p_beam_info->beamformee_entry + idx;
-
- /*Used after is_sounding=RESET, and will clear the setting of "ever sounded" entry, which is not necessarily be deleted.*/
- /*This function is mainly used in case "beam_oid_info.sound_oid_mode == sounding_stop_all_timer".*/
- /*However, setting oid doesn't delete entries (is_used is still true), new entries may fail to be added in.*/
-
- if (p_beamform_entry->is_sound) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] SW reset BFee entry %d\n", __func__, idx));
- /*
- * If End procedure is
- * 1. Between (Send NDPA, C2H packet return), reset state to initialized.
- * After C2H packet return , status bit will be set to zero.
- *
- * 2. After C2H packet, then reset state to initialized and clear status bit.
- */
-
- if (p_beamform_entry->beamform_entry_state == BEAMFORMING_ENTRY_STATE_PROGRESSING)
- phydm_beamforming_end_sw(p_dm_odm, 0);
- else if (p_beamform_entry->beamform_entry_state == BEAMFORMING_ENTRY_STATE_PROGRESSED) {
- p_beamform_entry->beamform_entry_state = BEAMFORMING_ENTRY_STATE_INITIALIZED;
- hal_com_txbf_set(p_dm_odm, TXBF_SET_SOUNDING_STATUS, (u8 *)&idx);
- }
-
- p_beamform_entry->is_sound = false;
- }
- }
- }
-}
-
-void
-phydm_beamforming_clear_entry_fw(
- void *p_dm_void,
- bool is_delete,
- u8 delete_idx
-)
-{
- u8 idx = 0;
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry = NULL;
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
-
- if (is_delete) {
- if (delete_idx < BEAMFORMEE_ENTRY_NUM) {
- p_beamform_entry = p_beam_info->beamformee_entry + delete_idx;
-
- if (!((!p_beamform_entry->is_used) && p_beamform_entry->is_sound)) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] FW delete_idx is wrong!!!!!\n", __func__));
- return;
- }
- }
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: FW delete BFee entry %d\n", __func__, delete_idx));
- p_beamform_entry->beamform_entry_state = BEAMFORMING_ENTRY_STATE_UNINITIALIZE;
- p_beamform_entry->is_sound = false;
- } else {
- for (idx = 0; idx < BEAMFORMEE_ENTRY_NUM; idx++) {
- p_beamform_entry = p_beam_info->beamformee_entry + idx;
-
- /*Used after is_sounding=RESET, and will clear the setting of "ever sounded" entry, which is not necessarily be deleted.*/
- /*This function is mainly used in case "beam_oid_info.sound_oid_mode == sounding_stop_all_timer".*/
- /*However, setting oid doesn't delete entries (is_used is still true), new entries may fail to be added in.*/
-
- if (p_beamform_entry->is_sound) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s]FW reset BFee entry %d\n", __func__, idx));
- /*
- * If End procedure is
- * 1. Between (Send NDPA, C2H packet return), reset state to initialized.
- * After C2H packet return , status bit will be set to zero.
- *
- * 2. After C2H packet, then reset state to initialized and clear status bit.
- */
-
- p_beamform_entry->beamform_entry_state = BEAMFORMING_ENTRY_STATE_INITIALIZED;
- p_beamform_entry->is_sound = false;
- }
- }
- }
-}
-
-/*
-* Called :
-* 1. Add and delete entry : beamforming_enter/beamforming_leave
-* 2. FW trigger : Beamforming_SetTxBFen
-* 3. Set OID_RT_BEAMFORMING_PERIOD : beamforming_control_v2
-*/
-void
-phydm_beamforming_notify(
- void *p_dm_void
-)
-{
- u8 idx = BEAMFORMEE_ENTRY_NUM;
- enum beamforming_notify_state is_sounding = BEAMFORMING_NOTIFY_NONE;
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
- struct _RT_SOUNDING_INFO *p_sound_info = &(p_beam_info->sounding_info);
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Start!\n", __func__));
-
- is_sounding = phydm_beamfomring_is_sounding(p_dm_odm, p_beam_info, &idx);
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s, Before notify, is_sounding=%d, idx=%d\n", __func__, is_sounding, idx));
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: p_beam_info->beamformee_su_cnt = %d\n", __func__, p_beam_info->beamformee_su_cnt));
-
-
- switch (is_sounding) {
- case BEAMFORMEE_NOTIFY_ADD_SU:
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: BEAMFORMEE_NOTIFY_ADD_SU\n", __func__));
- phydm_beamforming_start_period(p_dm_odm);
- break;
-
- case BEAMFORMEE_NOTIFY_DELETE_SU:
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: BEAMFORMEE_NOTIFY_DELETE_SU\n", __func__));
- if (p_sound_info->sound_mode == SOUNDING_FW_HT_TIMER || p_sound_info->sound_mode == SOUNDING_FW_VHT_TIMER) {
- phydm_beamforming_clear_entry_fw(p_dm_odm, true, idx);
- if (p_beam_info->beamformee_su_cnt == 0) { /* For 2->1 entry, we should not cancel SW timer */
- phydm_beamforming_end_period_fw(p_dm_odm);
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: No BFee left\n", __func__));
- }
- } else {
- phydm_beamforming_clear_entry_sw(p_dm_odm, true, idx);
- if (p_beam_info->beamformee_su_cnt == 0) { /* For 2->1 entry, we should not cancel SW timer */
- phydm_beamforming_end_period_sw(p_dm_odm);
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: No BFee left\n", __func__));
- }
- }
- break;
-
- case BEAMFORMEE_NOTIFY_ADD_MU:
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: BEAMFORMEE_NOTIFY_ADD_MU\n", __func__));
- if (p_beam_info->beamformee_mu_cnt == 2) {
- /*if (p_sound_info->sound_mode == SOUNDING_SW_VHT_TIMER || p_sound_info->sound_mode == SOUNDING_SW_HT_TIMER)
- odm_set_timer(p_dm_odm, &p_beam_info->beamforming_timer, p_sound_info->sound_period);*/
- odm_set_timer(p_dm_odm, &p_beam_info->beamforming_timer, 1000); /*Do MU sounding every 1sec*/
- } else
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: Less or larger than 2 MU STAs, not to set timer\n", __func__));
- break;
-
- case BEAMFORMEE_NOTIFY_DELETE_MU:
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: BEAMFORMEE_NOTIFY_DELETE_MU\n", __func__));
- if (p_beam_info->beamformee_mu_cnt == 1) {
- /*if (p_sound_info->sound_mode == SOUNDING_SW_VHT_TIMER || p_sound_info->sound_mode == SOUNDING_SW_HT_TIMER)*/{
- odm_cancel_timer(p_dm_odm, &p_beam_info->beamforming_timer);
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: Less than 2 MU STAs, stop sounding\n", __func__));
- }
- }
- break;
-
- case BEAMFORMING_NOTIFY_RESET:
- if (p_sound_info->sound_mode == SOUNDING_FW_HT_TIMER || p_sound_info->sound_mode == SOUNDING_FW_VHT_TIMER) {
- phydm_beamforming_clear_entry_fw(p_dm_odm, false, idx);
- phydm_beamforming_end_period_fw(p_dm_odm);
- } else {
- phydm_beamforming_clear_entry_sw(p_dm_odm, false, idx);
- phydm_beamforming_end_period_sw(p_dm_odm);
- }
-
- break;
-
- default:
- break;
- }
-
-}
-
-
-
-bool
-beamforming_init_entry(
- void *p_dm_void,
- u16 sta_idx,
- u8 *bfer_bfee_idx
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry = NULL;
- struct _RT_BEAMFORMER_ENTRY *p_beamformer_entry = NULL;
- struct _RT_BEAMFORM_STAINFO *p_sta = NULL;
- enum beamforming_cap beamform_cap = BEAMFORMING_CAP_NONE;
- u8 bfer_idx = 0xF, bfee_idx = 0xF;
- u8 num_of_sounding_dim = 0, comp_steering_num_of_bfer = 0;
-
- p_sta = phydm_sta_info_init(p_dm_odm, sta_idx);
-
- /*The current setting does not support Beaforming*/
- if (BEAMFORMING_CAP_NONE == p_sta->ht_beamform_cap && BEAMFORMING_CAP_NONE == p_sta->vht_beamform_cap) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("The configuration disabled Beamforming! Skip...\n"));
- return false;
- }
-
- if (p_sta->wireless_mode < WIRELESS_MODE_N_24G)
- return false;
- else {
- if (p_sta->wireless_mode & WIRELESS_MODE_N_5G || p_sta->wireless_mode & WIRELESS_MODE_N_24G) {/*HT*/
- if (TEST_FLAG(p_sta->cur_beamform, BEAMFORMING_HT_BEAMFORMER_ENABLE)) {/*We are Beamformee because the STA is Beamformer*/
- beamform_cap = (enum beamforming_cap)(beamform_cap | BEAMFORMEE_CAP_HT_EXPLICIT);
- num_of_sounding_dim = (p_sta->cur_beamform & BEAMFORMING_HT_BEAMFORMEE_CHNL_EST_CAP) >> 6;
- }
- /*We are Beamformer because the STA is Beamformee*/
- if (TEST_FLAG(p_sta->cur_beamform, BEAMFORMING_HT_BEAMFORMEE_ENABLE) ||
- TEST_FLAG(p_sta->ht_beamform_cap, BEAMFORMING_HT_BEAMFORMER_TEST)) {
- beamform_cap = (enum beamforming_cap)(beamform_cap | BEAMFORMER_CAP_HT_EXPLICIT);
- comp_steering_num_of_bfer = (p_sta->cur_beamform & BEAMFORMING_HT_BEAMFORMER_STEER_NUM) >> 4;
- }
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] HT cur_beamform=0x%X, beamform_cap=0x%X\n", __func__, p_sta->cur_beamform, beamform_cap));
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] HT num_of_sounding_dim=%d, comp_steering_num_of_bfer=%d\n", __func__, num_of_sounding_dim, comp_steering_num_of_bfer));
- }
-#if (ODM_IC_11AC_SERIES_SUPPORT == 1)
- if (p_sta->wireless_mode & WIRELESS_MODE_AC_5G || p_sta->wireless_mode & WIRELESS_MODE_AC_24G) { /*VHT*/
-
- /* We are Beamformee because the STA is SU Beamformer*/
- if (TEST_FLAG(p_sta->cur_beamform_vht, BEAMFORMING_VHT_BEAMFORMER_ENABLE)) {
- beamform_cap = (enum beamforming_cap)(beamform_cap | BEAMFORMEE_CAP_VHT_SU);
- num_of_sounding_dim = (p_sta->cur_beamform_vht & BEAMFORMING_VHT_BEAMFORMEE_SOUND_DIM) >> 12;
- }
- /* We are Beamformer because the STA is SU Beamformee*/
- if (TEST_FLAG(p_sta->cur_beamform_vht, BEAMFORMING_VHT_BEAMFORMEE_ENABLE) ||
- TEST_FLAG(p_sta->vht_beamform_cap, BEAMFORMING_VHT_BEAMFORMER_TEST)) {
- beamform_cap = (enum beamforming_cap)(beamform_cap | BEAMFORMER_CAP_VHT_SU);
- comp_steering_num_of_bfer = (p_sta->cur_beamform_vht & BEAMFORMING_VHT_BEAMFORMER_STS_CAP) >> 8;
- }
- /* We are Beamformee because the STA is MU Beamformer*/
- if (TEST_FLAG(p_sta->cur_beamform_vht, BEAMFORMING_VHT_MU_MIMO_AP_ENABLE)) {
- beamform_cap = (enum beamforming_cap)(beamform_cap | BEAMFORMEE_CAP_VHT_MU);
- num_of_sounding_dim = (p_sta->cur_beamform_vht & BEAMFORMING_VHT_BEAMFORMEE_SOUND_DIM) >> 12;
- }
- /* We are Beamformer because the STA is MU Beamformee*/
- if (phydm_acting_determine(p_dm_odm, phydm_acting_as_ap)) { /* Only AP mode supports to act an MU beamformer */
- if (TEST_FLAG(p_sta->cur_beamform_vht, BEAMFORMING_VHT_MU_MIMO_STA_ENABLE) ||
- TEST_FLAG(p_sta->vht_beamform_cap, BEAMFORMING_VHT_BEAMFORMER_TEST)) {
- beamform_cap = (enum beamforming_cap)(beamform_cap | BEAMFORMER_CAP_VHT_MU);
- comp_steering_num_of_bfer = (p_sta->cur_beamform_vht & BEAMFORMING_VHT_BEAMFORMER_STS_CAP) >> 8;
- }
- }
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s]VHT cur_beamform_vht=0x%X, beamform_cap=0x%X\n", __func__, p_sta->cur_beamform_vht, beamform_cap));
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s]VHT num_of_sounding_dim=0x%X, comp_steering_num_of_bfer=0x%X\n", __func__, num_of_sounding_dim, comp_steering_num_of_bfer));
-
- }
-#endif
- }
-
-
- if (beamform_cap == BEAMFORMING_CAP_NONE)
- return false;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Self BF Entry Cap = 0x%02X\n", __func__, beamform_cap));
-
- /*We are BFee, so the entry is BFer*/
- if (beamform_cap & (BEAMFORMEE_CAP_VHT_MU | BEAMFORMEE_CAP_VHT_SU | BEAMFORMEE_CAP_HT_EXPLICIT)) {
- p_beamformer_entry = phydm_beamforming_get_bfer_entry_by_addr(p_dm_odm, p_sta->ra, &bfer_idx);
-
- if (p_beamformer_entry == NULL) {
- p_beamformer_entry = beamforming_add_bfer_entry(p_dm_odm, p_sta, beamform_cap, num_of_sounding_dim, &bfer_idx);
- if (p_beamformer_entry == NULL)
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s]Not enough BFer entry!!!!!\n", __func__));
- }
- }
-
- /*We are BFer, so the entry is BFee*/
- if (beamform_cap & (BEAMFORMER_CAP_VHT_MU | BEAMFORMER_CAP_VHT_SU | BEAMFORMER_CAP_HT_EXPLICIT)) {
- p_beamform_entry = phydm_beamforming_get_bfee_entry_by_addr(p_dm_odm, p_sta->ra, &bfee_idx);
-
- /*¦pªGBFeeIdx = 0xF «h¥Nªí¥Ø«eentry·í¤¤¨S¦³¬Û¦PªºMACID¦b¤º*/
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Get BFee entry 0x%X by address\n", __func__, bfee_idx));
- if (p_beamform_entry == NULL) {
- p_beamform_entry = beamforming_add_bfee_entry(p_dm_odm, p_sta, beamform_cap, num_of_sounding_dim, comp_steering_num_of_bfer, &bfee_idx);
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s]: p_sta->AID=%d, p_sta->mac_id=%d\n", __func__, p_sta->aid, p_sta->mac_id));
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s]: Add BFee entry %d\n", __func__, bfee_idx));
-
- if (p_beamform_entry == NULL)
- return false;
- else
- p_beamform_entry->beamform_entry_state = BEAMFORMING_ENTRY_STATE_INITIALIZEING;
- } else {
- /*Entry has been created. If entry is initialing or progressing then errors occur.*/
- if (p_beamform_entry->beamform_entry_state != BEAMFORMING_ENTRY_STATE_INITIALIZED &&
- p_beamform_entry->beamform_entry_state != BEAMFORMING_ENTRY_STATE_PROGRESSED)
- return false;
- else
- p_beamform_entry->beamform_entry_state = BEAMFORMING_ENTRY_STATE_INITIALIZEING;
- }
- p_beamform_entry->beamform_entry_state = BEAMFORMING_ENTRY_STATE_INITIALIZED;
- phydm_sta_info_update(p_dm_odm, sta_idx, p_beamform_entry);
- }
-
- *bfer_bfee_idx = (bfer_idx << 4) | bfee_idx;
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] End: bfer_idx=0x%X, bfee_idx=0x%X, bfer_bfee_idx=0x%X\n", __func__, bfer_idx, bfee_idx, *bfer_bfee_idx));
-
- return true;
-}
-
-
-void
-beamforming_deinit_entry(
- void *p_dm_void,
- u8 *RA
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 idx = 0;
-
- struct _RT_BEAMFORMER_ENTRY *p_bfer_entry = phydm_beamforming_get_bfer_entry_by_addr(p_dm_odm, RA, &idx);
- struct _RT_BEAMFORMEE_ENTRY *p_bfee_entry = phydm_beamforming_get_bfee_entry_by_addr(p_dm_odm, RA, &idx);
- bool ret = false;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Start!\n", __func__));
-
- if (p_bfee_entry != NULL) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s, p_bfee_entry\n", __func__));
- p_bfee_entry->is_used = false;
- p_bfee_entry->beamform_entry_cap = BEAMFORMING_CAP_NONE;
- p_bfee_entry->is_beamforming_in_progress = false;
- if (p_bfee_entry->is_mu_sta) {
- p_dm_odm->beamforming_info.beamformee_mu_cnt -= 1;
- p_dm_odm->beamforming_info.first_mu_bfee_index = phydm_beamforming_get_first_mu_bfee_entry_idx(p_dm_odm);
- } else
- p_dm_odm->beamforming_info.beamformee_su_cnt -= 1;
- ret = true;
- }
-
- if (p_bfer_entry != NULL) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s, p_bfer_entry\n", __func__));
- p_bfer_entry->is_used = false;
- p_bfer_entry->beamform_entry_cap = BEAMFORMING_CAP_NONE;
- if (p_bfer_entry->is_mu_ap)
- p_dm_odm->beamforming_info.beamformer_mu_cnt -= 1;
- else
- p_dm_odm->beamforming_info.beamformer_su_cnt -= 1;
- ret = true;
- }
-
- if (ret == true)
- hal_com_txbf_set(p_dm_odm, TXBF_SET_SOUNDING_LEAVE, (u8 *)&idx);
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s End, idx = 0x%X\n", __func__, idx));
-}
-
-
-bool
-beamforming_start_v1(
- void *p_dm_void,
- u8 *RA,
- bool mode,
- CHANNEL_WIDTH BW,
- u8 rate
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 idx = 0;
- struct _RT_BEAMFORMEE_ENTRY *p_entry;
- bool ret = true;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
-
- p_entry = phydm_beamforming_get_bfee_entry_by_addr(p_dm_odm, RA, &idx);
-
- if (p_entry->is_used == false) {
- p_entry->is_beamforming_in_progress = false;
- return false;
- } else {
- if (p_entry->is_beamforming_in_progress)
- return false;
-
- p_entry->is_beamforming_in_progress = true;
-
- if (mode == 1) {
- if (!(p_entry->beamform_entry_cap & BEAMFORMER_CAP_HT_EXPLICIT)) {
- p_entry->is_beamforming_in_progress = false;
- return false;
- }
- } else if (mode == 0) {
- if (!(p_entry->beamform_entry_cap & BEAMFORMER_CAP_VHT_SU)) {
- p_entry->is_beamforming_in_progress = false;
- return false;
- }
- }
-
- if (p_entry->beamform_entry_state != BEAMFORMING_ENTRY_STATE_INITIALIZED && p_entry->beamform_entry_state != BEAMFORMING_ENTRY_STATE_PROGRESSED) {
- p_entry->is_beamforming_in_progress = false;
- return false;
- } else {
- p_entry->beamform_entry_state = BEAMFORMING_ENTRY_STATE_PROGRESSING;
- p_entry->is_sound = true;
- }
- }
-
- p_entry->sound_bw = BW;
- p_beam_info->beamformee_cur_idx = idx;
- phydm_beamforming_ndpa_rate(p_dm_odm, BW, rate);
- hal_com_txbf_set(p_dm_odm, TXBF_SET_SOUNDING_STATUS, (u8 *)&idx);
-
- if (mode == 1)
- ret = beamforming_send_ht_ndpa_packet(p_dm_odm, RA, BW, NORMAL_QUEUE);
- else
- ret = beamforming_send_vht_ndpa_packet(p_dm_odm, RA, p_entry->aid, BW, NORMAL_QUEUE);
-
- if (ret == false) {
- beamforming_leave(p_dm_odm, RA);
- p_entry->is_beamforming_in_progress = false;
- return false;
- }
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s idx %d\n", __func__, idx));
- return true;
-}
-
-
-bool
-beamforming_start_sw(
- void *p_dm_void,
- u8 idx,
- u8 mode,
- CHANNEL_WIDTH BW
-)
-{
- u8 *ra = NULL;
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _RT_BEAMFORMEE_ENTRY *p_entry;
- bool ret = true;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
-
- if (p_beam_info->is_mu_sounding) {
- p_beam_info->is_mu_sounding_in_progress = true;
- p_entry = &(p_beam_info->beamformee_entry[idx]);
- ra = p_entry->mac_addr;
-
- } else {
- p_entry = &(p_beam_info->beamformee_entry[idx]);
-
- if (p_entry->is_used == false) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("Skip Beamforming, no entry for idx =%d\n", idx));
- p_entry->is_beamforming_in_progress = false;
- return false;
- } else {
- if (p_entry->is_beamforming_in_progress) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("is_beamforming_in_progress, skip...\n"));
- return false;
- }
-
- p_entry->is_beamforming_in_progress = true;
- ra = p_entry->mac_addr;
-
- if (mode == SOUNDING_SW_HT_TIMER || mode == SOUNDING_HW_HT_TIMER || mode == SOUNDING_AUTO_HT_TIMER) {
- if (!(p_entry->beamform_entry_cap & BEAMFORMER_CAP_HT_EXPLICIT)) {
- p_entry->is_beamforming_in_progress = false;
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Return by not support BEAMFORMER_CAP_HT_EXPLICIT <==\n", __func__));
- return false;
- }
- } else if (mode == SOUNDING_SW_VHT_TIMER || mode == SOUNDING_HW_VHT_TIMER || mode == SOUNDING_AUTO_VHT_TIMER) {
- if (!(p_entry->beamform_entry_cap & BEAMFORMER_CAP_VHT_SU)) {
- p_entry->is_beamforming_in_progress = false;
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Return by not support BEAMFORMER_CAP_VHT_SU <==\n", __func__));
- return false;
- }
- }
- if (p_entry->beamform_entry_state != BEAMFORMING_ENTRY_STATE_INITIALIZED && p_entry->beamform_entry_state != BEAMFORMING_ENTRY_STATE_PROGRESSED) {
- p_entry->is_beamforming_in_progress = false;
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Return by incorrect beamform_entry_state(%d) <==\n", __func__, p_entry->beamform_entry_state));
- return false;
- } else {
- p_entry->beamform_entry_state = BEAMFORMING_ENTRY_STATE_PROGRESSING;
- p_entry->is_sound = true;
- }
- }
-
- p_beam_info->beamformee_cur_idx = idx;
- }
-
- /*2014.12.22 Luke: Need to be checked*/
- /*GET_TXBF_INFO(adapter)->fTxbfSet(adapter, TXBF_SET_SOUNDING_STATUS, (u8*)&idx);*/
-
- if (mode == SOUNDING_SW_HT_TIMER || mode == SOUNDING_HW_HT_TIMER || mode == SOUNDING_AUTO_HT_TIMER)
- ret = beamforming_send_ht_ndpa_packet(p_dm_odm, ra, BW, NORMAL_QUEUE);
- else
- ret = beamforming_send_vht_ndpa_packet(p_dm_odm, ra, p_entry->aid, BW, NORMAL_QUEUE);
-
- if (ret == false) {
- beamforming_leave(p_dm_odm, ra);
- p_entry->is_beamforming_in_progress = false;
- return false;
- }
-
-
- /*--------------------------
- * Send BF Report Poll for MU BF
- --------------------------*/
-#ifdef SUPPORT_MU_BF
-#if (SUPPORT_MU_BF == 1)
- {
- u8 idx, poll_sta_cnt = 0;
- bool is_get_first_bfee = false;
-
- if (p_beam_info->beamformee_mu_cnt > 1) { /* More than 1 MU STA*/
-
- for (idx = 0; idx < BEAMFORMEE_ENTRY_NUM; idx++) {
- p_entry = &(p_beam_info->beamformee_entry[idx]);
- if (p_entry->is_mu_sta) {
- if (is_get_first_bfee) {
- poll_sta_cnt++;
- if (poll_sta_cnt == (p_beam_info->beamformee_mu_cnt - 1))/* The last STA*/
- send_sw_vht_bf_report_poll(p_dm_odm, p_entry->mac_addr, true);
- else
- send_sw_vht_bf_report_poll(p_dm_odm, p_entry->mac_addr, false);
- } else
- is_get_first_bfee = true;
- }
- }
- }
- }
-#endif
-#endif
- return true;
-}
-
-
-bool
-beamforming_start_fw(
- void *p_dm_void,
- u8 idx
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _RT_BEAMFORMEE_ENTRY *p_entry;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
-
- p_entry = &(p_beam_info->beamformee_entry[idx]);
- if (p_entry->is_used == false) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("Skip Beamforming, no entry for idx =%d\n", idx));
- return false;
- }
-
- p_entry->beamform_entry_state = BEAMFORMING_ENTRY_STATE_PROGRESSING;
- p_entry->is_sound = true;
- hal_com_txbf_set(p_dm_odm, TXBF_SET_SOUNDING_FW_NDPA, (u8 *)&idx);
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] End, idx=0x%X\n", __func__, idx));
- return true;
-}
-
-void
-beamforming_check_sounding_success(
- void *p_dm_void,
- bool status
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _RT_BEAMFORMEE_ENTRY *p_entry = &(p_beam_info->beamformee_entry[p_beam_info->beamformee_cur_idx]);
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[David]@%s Start!\n", __func__));
-
- if (status == 1) {
- if (p_entry->log_status_fail_cnt == 21)
- beamforming_dym_period(p_dm_odm, status);
- p_entry->log_status_fail_cnt = 0;
- } else if (p_entry->log_status_fail_cnt <= 20) {
- p_entry->log_status_fail_cnt++;
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s log_status_fail_cnt %d\n", __func__, p_entry->log_status_fail_cnt));
- }
- if (p_entry->log_status_fail_cnt > 20) {
- p_entry->log_status_fail_cnt = 21;
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s log_status_fail_cnt > 20, Stop SOUNDING\n", __func__));
- beamforming_dym_period(p_dm_odm, status);
- }
-}
-
-void
-phydm_beamforming_end_sw(
- void *p_dm_void,
- bool status
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
- struct _RT_BEAMFORMEE_ENTRY *p_entry = &(p_beam_info->beamformee_entry[p_beam_info->beamformee_cur_idx]);
-
- if (p_beam_info->is_mu_sounding) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: MU sounding done\n", __func__));
- p_beam_info->is_mu_sounding_in_progress = false;
- hal_com_txbf_set(p_dm_odm, TXBF_SET_SOUNDING_STATUS, (u8 *)&(p_beam_info->beamformee_cur_idx));
- } else {
- if (p_entry->beamform_entry_state != BEAMFORMING_ENTRY_STATE_PROGRESSING) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] BeamformStatus %d\n", __func__, p_entry->beamform_entry_state));
- return;
- }
-
- if ((p_dm_odm->tx_bf_data_rate >= ODM_RATEVHTSS3MCS7) && (p_dm_odm->tx_bf_data_rate <= ODM_RATEVHTSS3MCS9) && (p_beam_info->snding3ss == false)) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] VHT3SS 7,8,9, do not apply V matrix.\n", __func__));
- p_entry->beamform_entry_state = BEAMFORMING_ENTRY_STATE_INITIALIZED;
- hal_com_txbf_set(p_dm_odm, TXBF_SET_SOUNDING_STATUS, (u8 *)&(p_beam_info->beamformee_cur_idx));
- } else if (status == 1) {
- p_entry->log_status_fail_cnt = 0;
- p_entry->beamform_entry_state = BEAMFORMING_ENTRY_STATE_PROGRESSED;
- hal_com_txbf_set(p_dm_odm, TXBF_SET_SOUNDING_STATUS, (u8 *)&(p_beam_info->beamformee_cur_idx));
- } else {
- p_entry->log_status_fail_cnt++;
- p_entry->beamform_entry_state = BEAMFORMING_ENTRY_STATE_INITIALIZED;
- hal_com_txbf_set(p_dm_odm, TXBF_SET_TX_PATH_RESET, (u8 *)&(p_beam_info->beamformee_cur_idx));
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] log_status_fail_cnt %d\n", __func__, p_entry->log_status_fail_cnt));
- }
-
- if (p_entry->log_status_fail_cnt > 50) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s log_status_fail_cnt > 50, Stop SOUNDING\n", __func__));
- p_entry->is_sound = false;
- beamforming_deinit_entry(p_dm_odm, p_entry->mac_addr);
-
- /*Modified by David - Every action of deleting entry should follow by Notify*/
- phydm_beamforming_notify(p_dm_odm);
- }
-
- p_entry->is_beamforming_in_progress = false;
- }
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s: status=%d\n", __func__, status));
-}
-
-
-void
-beamforming_timer_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- void *p_dm_void
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- void *p_context
-#endif
-)
-{
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- struct _ADAPTER *adapter = (struct _ADAPTER *)p_context;
- PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->odmpriv;
-#endif
- bool ret = false;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _RT_BEAMFORMEE_ENTRY *p_entry = &(p_beam_info->beamformee_entry[p_beam_info->beamformee_cur_idx]);
- struct _RT_SOUNDING_INFO *p_sound_info = &(p_beam_info->sounding_info);
- bool is_beamforming_in_progress;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Start!\n", __func__));
-
- if (p_beam_info->is_mu_sounding)
- is_beamforming_in_progress = p_beam_info->is_mu_sounding_in_progress;
- else
- is_beamforming_in_progress = p_entry->is_beamforming_in_progress;
-
- if (is_beamforming_in_progress) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("is_beamforming_in_progress, reset it\n"));
- phydm_beamforming_end_sw(p_dm_odm, 0);
- }
-
- ret = phydm_beamforming_select_beam_entry(p_dm_odm, p_beam_info);
-#if (SUPPORT_MU_BF == 1)
- if (ret && p_beam_info->beamformee_mu_cnt > 1)
- ret = 1;
- else
- ret = 0;
-#endif
- if (ret)
- ret = beamforming_start_sw(p_dm_odm, p_sound_info->sound_idx, p_sound_info->sound_mode, p_sound_info->sound_bw);
- else
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s, Error value return from BeamformingStart_V2\n", __func__));
-
- if ((p_beam_info->beamformee_su_cnt != 0) || (p_beam_info->beamformee_mu_cnt > 1)) {
- if (p_sound_info->sound_mode == SOUNDING_SW_VHT_TIMER || p_sound_info->sound_mode == SOUNDING_SW_HT_TIMER)
- odm_set_timer(p_dm_odm, &p_beam_info->beamforming_timer, p_sound_info->sound_period);
- else {
- u32 val = (p_sound_info->sound_period << 16) | HAL_TIMER_TXBF;
- phydm_set_hw_reg_handler_interface(p_dm_odm, HW_VAR_HW_REG_TIMER_RESTART, (u8 *)(&val));
- }
- }
-}
-
-
-void
-beamforming_sw_timer_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct timer_list *p_timer
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- void *function_context
-#endif
-)
-{
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter = (struct _ADAPTER *)p_timer->Adapter;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start!\n", __func__));
- beamforming_timer_callback(p_dm_odm);
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)function_context;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
-
- if (adapter->net_closed == true)
- return;
- rtw_run_in_thread_cmd(adapter, beamforming_timer_callback, adapter);
-#endif
-
-}
-
-
-void
-phydm_beamforming_init(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
- struct _RT_BEAMFORMING_OID_INFO *p_beam_oid_info = &(p_beam_info->beamforming_oid_info);
-
- p_beam_oid_info->sound_oid_mode = SOUNDING_STOP_OID_TIMER;
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s mode (%d)\n", __func__, p_beam_oid_info->sound_oid_mode));
-
- p_beam_info->beamformee_su_cnt = 0;
- p_beam_info->beamformer_su_cnt = 0;
- p_beam_info->beamformee_mu_cnt = 0;
- p_beam_info->beamformer_mu_cnt = 0;
- p_beam_info->beamformee_mu_reg_maping = 0;
- p_beam_info->mu_ap_index = 0;
- p_beam_info->is_mu_sounding = false;
- p_beam_info->first_mu_bfee_index = 0xFF;
- p_beam_info->apply_v_matrix = true;
- p_beam_info->snding3ss = false;
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- p_beam_info->source_adapter = p_dm_odm->adapter;
-#endif
- hal_com_txbf_beamform_init(p_dm_odm);
-}
-
-
-bool
-phydm_acting_determine(
- void *p_dm_void,
- enum phydm_acting_type type
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- bool ret = false;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->beamforming_info.source_adapter;
-#else
- struct _ADAPTER *adapter = p_dm_odm->adapter;
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- if (type == phydm_acting_as_ap)
- ret = ACTING_AS_AP(adapter);
- else if (type == phydm_acting_as_ibss)
- ret = ACTING_AS_IBSS(adapter);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
- struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
-
- if (type == phydm_acting_as_ap)
- ret = check_fwstate(pmlmepriv, WIFI_AP_STATE);
- else if (type == phydm_acting_as_ibss)
- ret = check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
-#endif
-
- return ret;
-
-}
-
-void
-beamforming_enter(
- void *p_dm_void,
- u16 sta_idx
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 bfer_bfee_idx = 0xff;
-
- if (beamforming_init_entry(p_dm_odm, sta_idx, &bfer_bfee_idx))
- hal_com_txbf_set(p_dm_odm, TXBF_SET_SOUNDING_ENTER, (u8 *)&bfer_bfee_idx);
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] End!\n", __func__));
-}
-
-
-void
-beamforming_leave(
- void *p_dm_void,
- u8 *RA
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
- if (RA != NULL) {
- beamforming_deinit_entry(p_dm_odm, RA);
- phydm_beamforming_notify(p_dm_odm);
- }
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] End!!\n", __func__));
-}
-
-#if 0
-/* Nobody calls this function */
-void
-phydm_beamforming_set_txbf_en(
- void *p_dm_void,
- u8 mac_id,
- bool is_txbf
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 idx = 0;
- struct _RT_BEAMFORMEE_ENTRY *p_entry;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Start!\n", __func__));
-
- p_entry = phydm_beamforming_get_entry_by_mac_id(p_dm_odm, mac_id, &idx);
-
- if (p_entry == NULL)
- return;
- else
- p_entry->is_txbf = is_txbf;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s mac_id %d TxBF %d\n", __func__, p_entry->mac_id, p_entry->is_txbf));
-
- phydm_beamforming_notify(p_dm_odm);
-}
-#endif
-
-enum beamforming_cap
-phydm_beamforming_get_beam_cap(
- void *p_dm_void,
- struct _RT_BEAMFORMING_INFO *p_beam_info
-)
-{
- u8 i;
- bool is_self_beamformer = false;
- bool is_self_beamformee = false;
- struct _RT_BEAMFORMEE_ENTRY beamformee_entry;
- struct _RT_BEAMFORMER_ENTRY beamformer_entry;
- enum beamforming_cap beamform_cap = BEAMFORMING_CAP_NONE;
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start!\n", __func__));
-
- for (i = 0; i < BEAMFORMEE_ENTRY_NUM; i++) {
- beamformee_entry = p_beam_info->beamformee_entry[i];
-
- if (beamformee_entry.is_used) {
- is_self_beamformer = true;
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] BFee entry %d is_used=true\n", __func__, i));
- break;
- }
- }
-
- for (i = 0; i < BEAMFORMER_ENTRY_NUM; i++) {
- beamformer_entry = p_beam_info->beamformer_entry[i];
-
- if (beamformer_entry.is_used) {
- is_self_beamformee = true;
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s]: BFer entry %d is_used=true\n", __func__, i));
- break;
- }
- }
-
- if (is_self_beamformer)
- beamform_cap = (enum beamforming_cap)(beamform_cap | BEAMFORMER_CAP);
- if (is_self_beamformee)
- beamform_cap = (enum beamforming_cap)(beamform_cap | BEAMFORMEE_CAP);
-
- return beamform_cap;
-}
-
-
-bool
-beamforming_control_v1(
- void *p_dm_void,
- u8 *RA,
- u8 AID,
- u8 mode,
- CHANNEL_WIDTH BW,
- u8 rate
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- bool ret = true;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Start!\n", __func__));
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("AID (%d), mode (%d), BW (%d)\n", AID, mode, BW));
-
- switch (mode) {
- case 0:
- ret = beamforming_start_v1(p_dm_odm, RA, 0, BW, rate);
- break;
- case 1:
- ret = beamforming_start_v1(p_dm_odm, RA, 1, BW, rate);
- break;
- case 2:
- phydm_beamforming_ndpa_rate(p_dm_odm, BW, rate);
- ret = beamforming_send_vht_ndpa_packet(p_dm_odm, RA, AID, BW, NORMAL_QUEUE);
- break;
- case 3:
- phydm_beamforming_ndpa_rate(p_dm_odm, BW, rate);
- ret = beamforming_send_ht_ndpa_packet(p_dm_odm, RA, BW, NORMAL_QUEUE);
- break;
- }
- return ret;
-}
-
-/*Only OID uses this function*/
-bool
-phydm_beamforming_control_v2(
- void *p_dm_void,
- u8 idx,
- u8 mode,
- CHANNEL_WIDTH BW,
- u16 period
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
- struct _RT_BEAMFORMING_OID_INFO *p_beam_oid_info = &(p_beam_info->beamforming_oid_info);
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s Start!\n", __func__));
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("idx (%d), mode (%d), BW (%d), period (%d)\n", idx, mode, BW, period));
-
- p_beam_oid_info->sound_oid_idx = idx;
- p_beam_oid_info->sound_oid_mode = (enum sounding_mode) mode;
- p_beam_oid_info->sound_oid_bw = BW;
- p_beam_oid_info->sound_oid_period = period;
-
- phydm_beamforming_notify(p_dm_odm);
-
- return true;
-}
-
-
-void
-phydm_beamforming_watchdog(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_TRACE, ("%s Start!\n", __func__));
-
- if (p_beam_info->beamformee_su_cnt == 0)
- return;
-
- beamforming_dym_period(p_dm_odm, 0);
- phydm_beamforming_dym_ndpa_rate(p_dm_odm);
-
-}
-
-
-#endif
diff --git a/hal/phydm/phydm_cfotracking.c b/hal/phydm/phydm_cfotracking.c
index 76ddc19..deb2cb2 100644
--- a/hal/phydm/phydm_cfotracking.c
+++ b/hal/phydm/phydm_cfotracking.c
@@ -26,7 +26,6 @@ odm_set_crystal_cap(
u8 crystal_cap
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
struct _CFO_TRACKING_ *p_cfo_track = (struct _CFO_TRACKING_ *)phydm_get_structure(p_dm_odm, PHYDM_CFOTRACK);
@@ -62,7 +61,6 @@ odm_set_crystal_cap(
}
ODM_RT_TRACE(p_dm_odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("odm_set_crystal_cap(): crystal_cap = 0x%x\n", crystal_cap));
-#endif
}
static u8
@@ -73,17 +71,10 @@ odm_get_default_crytaltal_cap(
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
u8 crystal_cap = 0x20;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
struct _ADAPTER *adapter = p_dm_odm->adapter;
HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
crystal_cap = p_hal_data->crystal_cap;
-#else
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
-
- if (priv->pmib->dot11RFEntry.xcap > 0)
- crystal_cap = priv->pmib->dot11RFEntry.xcap;
-#endif
crystal_cap = crystal_cap & 0x3f;
@@ -138,10 +129,7 @@ odm_cfo_tracking_reset(
ODM_RT_TRACE(p_dm_odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD,
("odm_cfo_tracking_reset(): approch default value (0x%x)\n", p_cfo_track->crystal_cap));
}
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
odm_set_atc_status(p_dm_odm, true);
-#endif
}
void
@@ -260,25 +248,12 @@ odm_cfo_tracking(
p_cfo_track->is_adjust = false;
}
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
/* 4 1.5 BT case: Disable CFO tracking */
if (p_dm_odm->is_bt_enabled) {
p_cfo_track->is_adjust = false;
odm_set_crystal_cap(p_dm_odm, p_cfo_track->def_x_cap);
ODM_RT_TRACE(p_dm_odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("odm_cfo_tracking(): Disable CFO tracking for BT!!\n"));
}
-#if 0
- /* 4 1.6 Big jump */
- if (p_cfo_track->is_adjust) {
- if (CFO_ave > CFO_TH_XTAL_LOW)
- adjust_xtal = adjust_xtal + ((CFO_ave - CFO_TH_XTAL_LOW) >> 2);
- else if (CFO_ave < (-CFO_TH_XTAL_LOW))
- adjust_xtal = adjust_xtal + ((CFO_TH_XTAL_LOW - CFO_ave) >> 2);
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("odm_cfo_tracking(): Crystal cap offset = %d\n", adjust_xtal));
- }
-#endif
-#endif
/* 4 1.7 Adjust Crystal Cap. */
if (p_cfo_track->is_adjust) {
@@ -297,7 +272,6 @@ odm_cfo_tracking(
ODM_RT_TRACE(p_dm_odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("odm_cfo_tracking(): Crystal cap = 0x%x, Default Crystal cap = 0x%x\n",
p_cfo_track->crystal_cap, p_cfo_track->def_x_cap));
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
if (p_dm_odm->support_ic_type & ODM_IC_11AC_SERIES)
return;
@@ -309,7 +283,6 @@ odm_cfo_tracking(
odm_set_atc_status(p_dm_odm, true);
ODM_RT_TRACE(p_dm_odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("odm_cfo_tracking(): Enable ATC!!\n"));
}
-#endif
}
}
@@ -329,18 +302,10 @@ odm_parsing_cfo(
if (!(p_dm_odm->support_ability & ODM_BB_CFO_TRACKING))
return;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
- if (p_pktinfo->is_packet_match_bssid)
-#else
- if (p_pktinfo->station_id != 0)
-#endif
- {
+ if (p_pktinfo->is_packet_match_bssid) {
if (num_ss > p_dm_odm->num_rf_path) /*For fool proof*/
num_ss = p_dm_odm->num_rf_path;
- /*ODM_RT_TRACE(p_dm_odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("num_ss = ((%d)), p_dm_odm->num_rf_path = ((%d))\n", num_ss, p_dm_odm->num_rf_path));*/
-
-
/* 3 Update CFO report for path-A & path-B */
/* Only paht-A and path-B have CFO tail and short CFO */
for (i = 0; i < num_ss; i++) {
diff --git a/hal/phydm/phydm_debug.c b/hal/phydm/phydm_debug.c
index b3da79b..4f6689d 100644
--- a/hal/phydm/phydm_debug.c
+++ b/hal/phydm/phydm_debug.c
@@ -876,70 +876,12 @@ phydm_bb_debug_info(
}
#endif /*#if CONFIG_PHYDM_DEBUG_FUNCTION*/
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-
-#if CONFIG_PHYDM_DEBUG_FUNCTION
-void phydm_sbd_check(
- struct PHY_DM_STRUCT *p_dm_odm
-)
-{
- static u32 pkt_cnt = 0;
- static bool sbd_state = 0;
- u32 sym_count, count, value32;
-
- if (sbd_state == 0) {
- pkt_cnt++;
- if (pkt_cnt % 5 == 0) { /*read SBD conter once every 5 packets*/
- odm_set_timer(p_dm_odm, &p_dm_odm->sbdcnt_timer, 0); /*ms*/
- sbd_state = 1;
- }
- } else { /*read counter*/
- value32 = odm_get_bb_reg(p_dm_odm, 0xF98, MASKDWORD);
- sym_count = (value32 & 0x7C000000) >> 26;
- count = (value32 & 0x3F00000) >> 20;
- dbg_print("#SBD# sym_count %d count %d\n", sym_count, count);
- sbd_state = 0;
- }
-}
-#endif /*#if CONFIG_PHYDM_DEBUG_FUNCTION*/
-
-void phydm_sbd_callback(
- struct timer_list *p_timer
-)
-{
-#if CONFIG_PHYDM_DEBUG_FUNCTION
- struct _ADAPTER *adapter = (struct _ADAPTER *)p_timer->Adapter;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-
-#if USE_WORKITEM
- odm_schedule_work_item(&p_dm_odm->sbdcnt_workitem);
-#else
- phydm_sbd_check(p_dm_odm);
-#endif
-#endif /*#if CONFIG_PHYDM_DEBUG_FUNCTION*/
-}
-
-void phydm_sbd_workitem_callback(
- void *p_context
-)
-{
-#if CONFIG_PHYDM_DEBUG_FUNCTION
- struct _ADAPTER *p_adapter = (struct _ADAPTER *)p_context;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-
- phydm_sbd_check(p_dm_odm);
-#endif /*#if CONFIG_PHYDM_DEBUG_FUNCTION*/
-}
-#endif
void
phydm_basic_dbg_message
(
void *p_dm_void
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
struct _FALSE_ALARM_STATISTICS *false_alm_cnt = (struct _FALSE_ALARM_STATISTICS *)phydm_get_structure(p_dm_odm, PHYDM_FALSEALMCNT);
struct _CFO_TRACKING_ *p_cfo_track = (struct _CFO_TRACKING_ *)phydm_get_structure(p_dm_odm, PHYDM_CFOTRACK);
@@ -1026,25 +968,8 @@ phydm_basic_dbg_message
ODM_RT_TRACE(p_dm_odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("is_linked = %d, Num_client = %d, rssi_min = %d, current_igi = 0x%x, bNoisy=%d\n\n",
p_dm_odm->is_linked, p_dm_odm->number_linked_client, p_dm_odm->rssi_min, p_dm_dig_table->cur_ig_value, p_dm_odm->noisy_decision));
-
- /*
- temp_reg = odm_get_bb_reg(p_dm_odm, 0xDD0, MASKBYTE0);
- ODM_RT_TRACE(p_dm_odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("0xDD0 = 0x%x\n",temp_reg));
-
- temp_reg = odm_get_bb_reg(p_dm_odm, 0xDDc, MASKBYTE1);
- ODM_RT_TRACE(p_dm_odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("0xDDD = 0x%x\n",temp_reg));
-
- temp_reg = odm_get_bb_reg(p_dm_odm, 0xc50, MASKBYTE0);
- ODM_RT_TRACE(p_dm_odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("0xC50 = 0x%x\n",temp_reg));
-
- temp_reg = odm_get_rf_reg(p_dm_odm, ODM_RF_PATH_A, 0x0, 0x3fe0);
- ODM_RT_TRACE(p_dm_odm,ODM_COMP_COMMON, ODM_DBG_LOUD, ("RF 0x0[13:5] = 0x%x\n\n",temp_reg));
- */
-
-#endif
}
-
void phydm_basic_profile(
void *p_dm_void,
u32 *_used,
@@ -1199,23 +1124,11 @@ void phydm_basic_profile(
PHYDM_SNPRINTF((output + used, out_len - used, " %-35s: %s\n", "PHY Parameter Commit by", commit_by));
PHYDM_SNPRINTF((output + used, out_len - used, " %-35s: %d\n", "PHY Parameter Release version", release_ver));
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- {
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PHYDM_SNPRINTF((output + used, out_len - used, " %-35s: %d (Subversion: %d)\n", "FW version", adapter->MgntInfo.FirmwareVersion, adapter->MgntInfo.FirmwareSubVersion));
- }
-#elif (DM_ODM_SUPPORT_TYPE & ODM_AP)
- {
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
- PHYDM_SNPRINTF((output + used, out_len - used, " %-35s: %d (Subversion: %d)\n", "FW version", priv->pshare->fw_version, priv->pshare->fw_sub_version));
- }
-#else
{
struct _ADAPTER *adapter = p_dm_odm->adapter;
HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
PHYDM_SNPRINTF((output + used, out_len - used, " %-35s: %d (Subversion: %d)\n", "FW version", p_hal_data->firmware_version, p_hal_data->firmware_sub_version));
}
-#endif
/* 1 PHY DM version List */
PHYDM_SNPRINTF((output + used, out_len - used, "%-35s\n", "% PHYDM version %"));
PHYDM_SNPRINTF((output + used, out_len - used, " %-35s: %s\n", "Code base", PHYDM_CODE_BASE));
@@ -1228,9 +1141,6 @@ void phydm_basic_profile(
PHYDM_SNPRINTF((output + used, out_len - used, " %-35s: %s\n", "Power Tracking", POWRTRACKING_VERSION));
PHYDM_SNPRINTF((output + used, out_len - used, " %-35s: %s\n", "Dynamic TxPower", DYNAMIC_TXPWR_VERSION));
PHYDM_SNPRINTF((output + used, out_len - used, " %-35s: %s\n", "RA Info", RAINFO_VERSION));
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PHYDM_SNPRINTF((output + used, out_len - used, " %-35s: %s\n", "Antenna Detection", ANTDECT_VERSION));
-#endif
PHYDM_SNPRINTF((output + used, out_len - used, " %-35s: %s\n", "Auto channel Selection", ACS_VERSION));
#if PHYDM_SUPPORT_EDCA
PHYDM_SNPRINTF((output + used, out_len - used, " %-35s: %s\n", "EDCA Turbo", EDCATURBO_VERSION));
@@ -1239,15 +1149,6 @@ void phydm_basic_profile(
PHYDM_SNPRINTF((output + used, out_len - used, " %-35s: %s\n", "LA mode", DYNAMIC_LA_MODE));
PHYDM_SNPRINTF((output + used, out_len - used, " %-35s: %s\n", "Dynamic RX path", DYNAMIC_RX_PATH_VERSION));
-#if (RTL8822B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type & ODM_RTL8822B)
- PHYDM_SNPRINTF((output + used, out_len - used, " %-35s: %s\n", "PHY config 8822B", PHY_CONFIG_VERSION_8822B));
-
-#endif
-#if (RTL8197F_SUPPORT == 1)
- if (p_dm_odm->support_ic_type & ODM_RTL8197F)
- PHYDM_SNPRINTF((output + used, out_len - used, " %-35s: %s\n", "PHY config 8197F", PHY_CONFIG_VERSION_8197F));
-#endif
*_used = used;
*_out_len = out_len;
#endif /*#if CONFIG_PHYDM_DEBUG_FUNCTION*/
@@ -1308,45 +1209,6 @@ phydm_api_set_txagc(
{
bool ret = false;
-#if ((RTL8822B_SUPPORT == 1) || (RTL8821C_SUPPORT == 1))
- if (p_dm_odm->support_ic_type & (ODM_RTL8822B | ODM_RTL8821C)) {
- if (is_single_rate) {
-#if (RTL8822B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8822B)
- ret = phydm_write_txagc_1byte_8822b(p_dm_odm, power_index, path, hw_rate);
-#endif
-#if (RTL8821C_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8821C)
- ret = phydm_write_txagc_1byte_8821c(p_dm_odm, power_index, path, hw_rate);
-#endif
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- set_current_tx_agc(p_dm_odm->priv, path, hw_rate, (u8)power_index);
-#endif
-
- } else {
- u8 i;
-#if (RTL8822B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8822B)
- ret = config_phydm_write_txagc_8822b(p_dm_odm, power_index, path, hw_rate);
-#endif
-#if (RTL8821C_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8821C)
- ret = config_phydm_write_txagc_8821c(p_dm_odm, power_index, path, hw_rate);
-#endif
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- for (i = 0; i < 4; i++)
- set_current_tx_agc(p_dm_odm->priv, path, (hw_rate + i), (u8)power_index);
-#endif
- }
- }
-#endif
-
-
-#if (RTL8197F_SUPPORT == 1)
- if (p_dm_odm->support_ic_type & ODM_RTL8197F)
- ret = config_phydm_write_txagc_8197f(p_dm_odm, power_index, path, hw_rate);
-#endif
-
return ret;
}
@@ -1359,21 +1221,6 @@ phydm_api_get_txagc(
{
u8 ret = 0;
-#if (RTL8822B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type & ODM_RTL8822B)
- ret = config_phydm_read_txagc_8822b(p_dm_odm, path, hw_rate);
-#endif
-
-#if (RTL8197F_SUPPORT == 1)
- if (p_dm_odm->support_ic_type & ODM_RTL8197F)
- ret = config_phydm_read_txagc_8197f(p_dm_odm, path, hw_rate);
-#endif
-
-#if (RTL8821C_SUPPORT == 1)
- if (p_dm_odm->support_ic_type & ODM_RTL8821C)
- ret = config_phydm_read_txagc_8821c(p_dm_odm, path, hw_rate);
-#endif
-
return ret;
}
@@ -1388,21 +1235,6 @@ phydm_api_switch_bw_channel(
{
bool ret = false;
-#if (RTL8822B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type & ODM_RTL8822B)
- ret = config_phydm_switch_channel_bw_8822b(p_dm_odm, central_ch, primary_ch_idx, bandwidth);
-#endif
-
-#if (RTL8197F_SUPPORT == 1)
- if (p_dm_odm->support_ic_type & ODM_RTL8197F)
- ret = config_phydm_switch_channel_bw_8197f(p_dm_odm, central_ch, primary_ch_idx, bandwidth);
-#endif
-
-#if (RTL8821C_SUPPORT == 1)
- if (p_dm_odm->support_ic_type & ODM_RTL8821C)
- ret = config_phydm_switch_channel_bw_8821c(p_dm_odm, central_ch, primary_ch_idx, bandwidth);
-#endif
-
return ret;
}
@@ -1970,12 +1802,7 @@ phydm_cmd_parser(
case PHYDM_DEMO: { /*echo demo 10 0x3a z abcde >cmd*/
u32 directory = 0;
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_CE | ODM_AP))
char char_temp;
-#else
- u32 char_temp = ' ';
-#endif
PHYDM_SSCANF(input[1], DCMD_DECIMAL, &directory);
PHYDM_SNPRINTF((output + used, out_len - used, "Decimal value = %d\n", directory));
@@ -2397,7 +2224,6 @@ phydm_cmd_parser(
break;
case PHYDM_DFS:
-#if (DM_ODM_SUPPORT_TYPE & ODM_CE)
{
u32 var[6] = {0};
@@ -2411,19 +2237,9 @@ phydm_cmd_parser(
if (input_idx >= 1)
phydm_dfs_debug(p_dm_odm, var, &used, output, &out_len);
}
-#endif
break;
-
case PHYDM_IQK:
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- phy_iq_calibrate(p_dm_odm->priv);
- PHYDM_SNPRINTF((output + used, out_len - used, "IQK !!\n"));
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- phy_iq_calibrate(p_dm_odm->adapter, false);
- PHYDM_SNPRINTF((output + used, out_len - used, "IQK !!\n"));
-#endif
break;
-
case PHYDM_NHM:
{
u8 target_rssi;
@@ -2588,7 +2404,6 @@ phydm_cmd_parser(
case PHYDM_TXBF:
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
#if (BEAMFORMING_SUPPORT == 1)
struct _RT_BEAMFORMING_INFO *p_beamforming_info = &p_dm_odm->beamforming_info;
@@ -2605,7 +2420,6 @@ phydm_cmd_parser(
PHYDM_SNPRINTF((output + used, out_len - used, "\r\n unknown cmd!!\n"));
#else
PHYDM_SNPRINTF((output + used, out_len - used, "\r\n no TxBF !!\n"));
-#endif
#endif
}
break;
@@ -2713,7 +2527,6 @@ char *strsep(char **s, const char *ct)
}
#endif
-#if (DM_ODM_SUPPORT_TYPE & (ODM_CE | ODM_AP))
s32
phydm_cmd(
struct PHY_DM_STRUCT *p_dm_odm,
@@ -2744,8 +2557,6 @@ phydm_cmd(
return 0;
}
-#endif
-
void
phydm_fw_trace_handler(
@@ -3025,22 +2836,11 @@ phydm_fw_trace_handler_8051(
extend_c2h_dbg_len = buffer[1];
extend_c2h_dbg_content = buffer + 2; /*DbgSeq+DbgContent for show HEX*/
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- RT_DISP(FC2H, C2H_Summary, ("[Extend C2H packet], Extend_c2hSubId=0x%x, extend_c2h_dbg_len=%d\n",
- extend_c2h_sub_id, extend_c2h_dbg_len));
-
- RT_DISP_DATA(FC2H, C2H_Summary, "[Extend C2H packet], Content Hex:", extend_c2h_dbg_content, cmd_len - 2);
-#endif
-
go_backfor_aggre_dbg_pkt:
i = 0;
extend_c2h_dbg_seq = buffer[2];
extend_c2h_dbg_content = buffer + 3;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- RT_DISP(FC2H, C2H_Summary, ("[RTKFW, SEQ= %d] :", extend_c2h_dbg_seq));
-#endif
-
for (; ; i++) {
fw_debug_trace[i] = extend_c2h_dbg_content[i];
if (extend_c2h_dbg_content[i + 1] == '\0') {
diff --git a/hal/phydm/phydm_dig.c b/hal/phydm/phydm_dig.c
index 4057065..1ac3f60 100644
--- a/hal/phydm/phydm_dig.c
+++ b/hal/phydm/phydm_dig.c
@@ -86,33 +86,17 @@ odm_fa_threshold_check(
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
if (p_dm_odm->is_linked && (is_performance || is_dfs_band)) {
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- /*For AP*/
- if ((rx_tp >> 2) > tx_tp && rx_tp < 10000 && rx_tp > 500) { /*10Mbps & 0.5Mbps*/
- dm_FA_thres[0] = 0x080;
- dm_FA_thres[1] = 0x100;
- dm_FA_thres[2] = 0x200;
- } else {
- dm_FA_thres[0] = 0x100;
- dm_FA_thres[1] = 0x200;
- dm_FA_thres[2] = 0x300;
- }
-#else
/*For NIC*/
dm_FA_thres[0] = DM_DIG_FA_TH0;
dm_FA_thres[1] = DM_DIG_FA_TH1;
dm_FA_thres[2] = DM_DIG_FA_TH2;
-#endif
} else {
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP | ODM_CE))
if (is_dfs_band) {
/* For DFS band and no link */
dm_FA_thres[0] = 250;
dm_FA_thres[1] = 1000;
dm_FA_thres[2] = 2000;
- } else
-#endif
- {
+ } else {
dm_FA_thres[0] = 2000;
dm_FA_thres[1] = 4000;
dm_FA_thres[2] = 5000;
@@ -231,110 +215,6 @@ odm_inband_noise_calculate(
void *p_dm_void
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _dynamic_initial_gain_threshold_ *p_dm_dig_table = &p_dm_odm->dm_dig_table;
- u8 igi_backup, time_cnt = 0, valid_cnt = 0;
- bool is_timeout = true;
- s8 s_noise_a, s_noise_b;
- s32 noise_rpt_a = 0, noise_rpt_b = 0;
- u32 tmp = 0;
- static u8 fail_cnt = 0;
-
- if (!(p_dm_odm->support_ic_type & (ODM_RTL8192E)))
- return;
-
- if (p_dm_odm->rf_type == ODM_1T1R || *(p_dm_odm->p_one_path_cca) != ODM_CCA_2R)
- return;
-
- if (!p_dm_dig_table->is_noise_est)
- return;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_InbandNoiseEstimate()========>\n"));
-
- /* 1 Set initial gain. */
- igi_backup = p_dm_dig_table->cur_ig_value;
- p_dm_dig_table->igi_offset_a = 0;
- p_dm_dig_table->igi_offset_b = 0;
- odm_write_dig(p_dm_odm, 0x24);
-
- /* 1 Update idle time power report */
- if (p_dm_odm->support_ic_type & ODM_IC_11N_SERIES)
- odm_set_bb_reg(p_dm_odm, ODM_REG_TX_ANT_CTRL_11N, BIT(25), 0x0);
-
- delay_ms(2);
-
- /* 1 Get noise power level */
- while (1) {
- /* 2 Read Noise Floor Report */
- if (p_dm_odm->support_ic_type & ODM_IC_11N_SERIES)
- tmp = odm_get_bb_reg(p_dm_odm, 0x8f8, MASKLWORD);
-
- s_noise_a = (s8)(tmp & 0xff);
- s_noise_b = (s8)((tmp & 0xff00) >> 8);
-
- /* ODM_RT_TRACE(p_dm_odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("s_noise_a = %d, s_noise_b = %d\n",s_noise_a, s_noise_b)); */
-
- if ((s_noise_a < 20 && s_noise_a >= -70) && (s_noise_b < 20 && s_noise_b >= -70)) {
- valid_cnt++;
- noise_rpt_a += s_noise_a;
- noise_rpt_b += s_noise_b;
- /* ODM_RT_TRACE(p_dm_odm,ODM_COMP_DIG, ODM_DBG_LOUD, ("s_noise_a = %d, s_noise_b = %d\n",s_noise_a, s_noise_b)); */
- }
-
- time_cnt++;
- is_timeout = (time_cnt >= 150) ? true : false;
-
- if (valid_cnt == 20 || is_timeout)
- break;
-
- delay_ms(2);
-
- }
-
- /* 1 Keep idle time power report */
- if (p_dm_odm->support_ic_type & ODM_IC_11N_SERIES)
- odm_set_bb_reg(p_dm_odm, ODM_REG_TX_ANT_CTRL_11N, BIT(25), 0x1);
-
- /* 1 Recover IGI */
- odm_write_dig(p_dm_odm, igi_backup);
-
- /* 1 Calculate Noise Floor */
- if (valid_cnt != 0) {
- noise_rpt_a /= (valid_cnt << 1);
- noise_rpt_b /= (valid_cnt << 1);
- }
-
- if (is_timeout) {
- noise_rpt_a = 0;
- noise_rpt_b = 0;
-
- fail_cnt++;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("Noise estimate fail time = %d\n", fail_cnt));
-
- if (fail_cnt == 3) {
- fail_cnt = 0;
- p_dm_dig_table->is_noise_est = false;
- }
- } else {
- noise_rpt_a = -110 + 0x24 + noise_rpt_a - 6;
- noise_rpt_b = -110 + 0x24 + noise_rpt_b - 6;
- p_dm_dig_table->is_noise_est = false;
- fail_cnt = 0;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("noise_rpt_a = %d, noise_rpt_b = %d\n", noise_rpt_a, noise_rpt_b));
- }
-
- /* 1 Calculate IGI Offset */
- if (noise_rpt_a > noise_rpt_b) {
- p_dm_dig_table->igi_offset_a = noise_rpt_a - noise_rpt_b;
- p_dm_dig_table->igi_offset_b = 0;
- } else {
- p_dm_dig_table->igi_offset_a = 0;
- p_dm_dig_table->igi_offset_b = noise_rpt_b - noise_rpt_a;
- }
-
-#endif
- return;
}
static void
@@ -342,31 +222,6 @@ odm_dig_for_bt_hs_mode(
void *p_dm_void
)
{
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _dynamic_initial_gain_threshold_ *p_dm_dig_table = &p_dm_odm->dm_dig_table;
- u8 dig_for_bt_hs = 0;
- u8 dig_up_bound = 0x5a;
-
- if (p_dm_odm->is_bt_connect_process)
- dig_for_bt_hs = 0x22;
- else {
- /* */
- /* Decide DIG value by BT HS RSSI. */
- /* */
- dig_for_bt_hs = p_dm_odm->bt_hs_rssi + 4;
-
- /* DIG Bound */
- if (dig_for_bt_hs > dig_up_bound)
- dig_for_bt_hs = dig_up_bound;
- if (dig_for_bt_hs < 0x1c)
- dig_for_bt_hs = 0x1c;
-
- /* update Current IGI */
- p_dm_dig_table->bt30_cur_igi = dig_for_bt_hs;
- }
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_dig_for_bt_hs_mode() : set DigValue=0x%x\n", dig_for_bt_hs));
-#endif
}
static void
@@ -620,12 +475,6 @@ odm_dig_abort(
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
struct _dynamic_initial_gain_threshold_ *p_dm_dig_table = &p_dm_odm->dm_dig_table;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *p_adapter = p_dm_odm->adapter;
-#endif
-
/* support_ability */
if (!(p_dm_odm->support_ability & ODM_BB_FA_CNT)) {
ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Return: support_ability ODM_BB_FA_CNT is disabled\n"));
@@ -656,18 +505,6 @@ odm_dig_abort(
return true;
}
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-#if OS_WIN_FROM_WIN7(OS_VERSION)
- if (IsAPModeExist(p_adapter) && p_adapter->bInHctTest) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Return: Is AP mode or In HCT Test\n"));
- return true;
- }
-#endif
-
- if (p_dm_odm->is_bt_hs_operation)
- odm_dig_for_bt_hs_mode(p_dm_odm);
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
#ifdef CONFIG_SPECIAL_SETTING_FOR_FUNAI_TV
if ((p_dm_odm->is_linked) && (p_dm_odm->adapter->registrypriv.force_igi != 0)) {
printk("p_dm_odm->rssi_min=%d\n", p_dm_odm->rssi_min);
@@ -675,13 +512,6 @@ odm_dig_abort(
return true;
}
#endif
-#else
- if (!(priv->up_time > 5)) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Return: Not In DIG operation period\n"));
- return true;
- }
-#endif
-
return false;
}
@@ -692,9 +522,6 @@ odm_dig_init(
{
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
struct _dynamic_initial_gain_threshold_ *p_dm_dig_table = &p_dm_odm->dm_dig_table;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- struct _FALSE_ALARM_STATISTICS *false_alm_cnt = (struct _FALSE_ALARM_STATISTICS *)phydm_get_structure(p_dm_odm, PHYDM_FALSEALMCNT);
-#endif
u32 ret_value;
u8 i;
@@ -722,24 +549,6 @@ odm_dig_init(
/* To Initialize p_dm_odm->is_dm_initial_gain_enable == false to avoid DIG error */
p_dm_odm->is_dm_initial_gain_enable = true;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- p_dm_dig_table->dig_dynamic_min_0 = 0x25;
- p_dm_dig_table->dig_dynamic_min_1 = 0x25;
-
- /* For AP\ ADSL modified DIG */
- p_dm_dig_table->is_tp_target = false;
- p_dm_dig_table->is_noise_est = true;
- p_dm_dig_table->igi_offset_a = 0;
- p_dm_dig_table->igi_offset_b = 0;
- p_dm_dig_table->tp_train_th_min = 0;
-
- /* For RTL8881A */
- false_alm_cnt->cnt_ofdm_fail_pre = 0;
-
- /* Dyanmic EDCCA */
- if (p_dm_odm->support_ic_type & ODM_IC_11AC_SERIES)
- odm_set_bb_reg(p_dm_odm, 0xC50, 0xFFFF0000, 0xfafd);
-#else
p_dm_dig_table->dig_dynamic_min_0 = DM_DIG_MIN_NIC;
p_dm_dig_table->dig_dynamic_min_1 = DM_DIG_MIN_NIC;
@@ -750,7 +559,6 @@ odm_dig_init(
p_dm_dig_table->pause_dig_level = 0;
odm_memory_set(p_dm_odm, p_dm_dig_table->pause_cckpd_value, 0, (DM_DIG_MAX_PAUSE_TYPE + 1));
p_dm_dig_table->pause_cckpd_level = 0;
-#endif
if (p_dm_odm->board_type & (ODM_BOARD_EXT_PA | ODM_BOARD_EXT_LNA)) {
p_dm_dig_table->rx_gain_range_max = DM_DIG_MAX_NIC;
@@ -790,13 +598,6 @@ odm_DIG(
)
{
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *p_adapter = p_dm_odm->adapter;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_dm_odm->adapter);
-#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
- struct sta_info *p_entry;
-#endif
/* Common parameters */
struct _dynamic_initial_gain_threshold_ *p_dm_dig_table = &p_dm_odm->dm_dig_table;
@@ -811,11 +612,6 @@ odm_DIG(
bool dig_go_up_check = true;
bool is_dfs_band = false;
bool is_performance = true, is_first_tp_target = false, is_first_coverage = false;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- u32 tp_train_th_min = dm_dig_tp_target_th0;
- static u8 time_cnt = 0;
- u8 i;
-#endif
if (odm_dig_abort(p_dm_odm) == true)
return;
@@ -830,142 +626,9 @@ odm_DIG(
first_dis_connect = (!p_dm_odm->is_linked) && (p_dm_dig_table->is_media_connect_0 == true);
}
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- /* 1 Noise Floor Estimate */
- /* p_dm_dig_table->is_noise_est = (first_connect)?true:p_dm_dig_table->is_noise_est; */
- /* odm_inband_noise_calculate (p_dm_odm); */
-
- /* 1 mode decision */
- if (p_dm_odm->is_linked) {
- /* 2 Calculate total TP */
- for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) {
- p_entry = p_dm_odm->p_odm_sta_info[i];
- if (IS_STA_VALID(p_entry)) {
- rx_tp += (u32)(p_entry->rx_byte_cnt_low_maw >> 7);
- tx_tp += (u32)(p_entry->tx_byte_cnt_low_maw >> 7); /* Kbps */
- }
- }
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): TX TP = %dkbps, RX TP = %dkbps\n", tx_tp, rx_tp));
- }
-
- switch (p_dm_odm->priv->pshare->rf_ft_var.dig_cov_enable) {
- case 0:
- {
- is_performance = true;
- break;
- }
- case 1:
- {
- is_performance = false;
- break;
- }
- case 2:
- {
- if (p_dm_odm->is_linked) {
- if (p_dm_dig_table->tp_train_th_min > dm_dig_tp_target_th0)
- tp_train_th_min = p_dm_dig_table->tp_train_th_min;
-
- if (p_dm_dig_table->tp_train_th_min > dm_dig_tp_target_th1)
- tp_train_th_min = dm_dig_tp_target_th1;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): TP training mode lower bound = %dkbps\n", tp_train_th_min));
-
- /* 2 Decide DIG mode by total TP */
- if ((tx_tp + rx_tp) > dm_dig_tp_target_th1) { /* change to performance mode */
- is_first_tp_target = (!p_dm_dig_table->is_tp_target) ? true : false;
- p_dm_dig_table->is_tp_target = true;
- is_performance = true;
- } else if ((tx_tp + rx_tp) < tp_train_th_min) { /* change to coverage mode */
- is_first_coverage = (p_dm_dig_table->is_tp_target) ? true : false;
-
- if (time_cnt < dm_dig_tp_training_period) {
- p_dm_dig_table->is_tp_target = false;
- is_performance = false;
- time_cnt++;
- } else {
- p_dm_dig_table->is_tp_target = true;
- is_performance = true;
- is_first_tp_target = true;
- time_cnt = 0;
- }
- } else { /* remain previous mode */
- is_performance = p_dm_dig_table->is_tp_target;
-
- if (!is_performance) {
- if (time_cnt < dm_dig_tp_training_period)
- time_cnt++;
- else {
- p_dm_dig_table->is_tp_target = true;
- is_performance = true;
- is_first_tp_target = true;
- time_cnt = 0;
- }
- }
- }
-
- if (!is_performance)
- p_dm_dig_table->tp_train_th_min = rx_tp + tx_tp;
-
- } else {
- is_performance = false;
- p_dm_dig_table->tp_train_th_min = 0;
- }
- break;
- }
- default:
- is_performance = true;
- }
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("====== DIG mode = %d ======\n", p_dm_odm->priv->pshare->rf_ft_var.dig_cov_enable));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("====== is_performance = %d ======\n", is_performance));
-#endif
/* 1 Boundary Decision */
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- /* 2 For AP\ADSL */
- if (!is_performance) {
- dm_dig_max = DM_DIG_MAX_AP_COVERAGR;
- dm_dig_min = DM_DIG_MIN_AP_COVERAGE;
- dig_max_of_min = DM_DIG_MAX_OF_MIN_COVERAGE;
- } else {
- if (p_dm_odm->rf_type == ODM_1T1R)
- dm_dig_max = DM_DIG_MAX_AP - 6;
- else
- dm_dig_max = DM_DIG_MAX_AP;
-
- if ((*p_dm_odm->p_band_type == ODM_BAND_2_4G) && (p_dm_odm->support_ic_type & ODM_RTL8814A)) /* for 2G 8814 */
- dm_dig_min = 0x1c;
- else if (p_dm_odm->support_ic_type & ODM_RTL8197F)
- dm_dig_min = 0x1e;
- else
- dm_dig_min = DM_DIG_MIN_AP;
- dig_max_of_min = DM_DIG_MAX_OF_MIN;
- }
-
- /* 4 TX2path */
- if (priv->pmib->dot11RFEntry.tx2path && !is_dfs_band && (*(p_dm_odm->p_wireless_mode) == ODM_WM_B))
- dm_dig_max = 0x2A;
-
-#if RTL8192E_SUPPORT
-#ifdef HIGH_POWER_EXT_LNA
- if ((p_dm_odm->support_ic_type & (ODM_RTL8192E)) && (p_dm_odm->ext_lna))
- dm_dig_max = 0x42;
-#endif
-#endif
- if (p_dm_odm->igi_lower_bound) {
- if (dm_dig_min < p_dm_odm->igi_lower_bound)
- dm_dig_min = p_dm_odm->igi_lower_bound;
- if (dig_max_of_min < p_dm_odm->igi_lower_bound)
- dig_max_of_min = p_dm_odm->igi_lower_bound;
- }
- if (p_dm_odm->igi_upper_bound) {
- if (dm_dig_max > p_dm_odm->igi_upper_bound)
- dm_dig_max = p_dm_odm->igi_upper_bound;
- if (dig_max_of_min > p_dm_odm->igi_upper_bound)
- dig_max_of_min = p_dm_odm->igi_upper_bound;
- }
-#else
/* 2 For WIN\CE */
if (p_dm_odm->support_ic_type >= ODM_RTL8188E)
dm_dig_max = 0x5A;
@@ -978,16 +641,11 @@ odm_DIG(
dm_dig_min = 0x1C;
dig_max_of_min = DM_DIG_MAX_AP;
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP | ODM_CE))
/* Modify lower bound for DFS band */
if ((((*p_dm_odm->p_channel >= 52) && (*p_dm_odm->p_channel <= 64)) ||
((*p_dm_odm->p_channel >= 100) && (*p_dm_odm->p_channel <= 140)))
-#if (DM_ODM_SUPPORT_TYPE & (ODM_CE))
&& phydm_dfs_master_enabled(p_dm_odm) == true
-#endif
) {
is_dfs_band = true;
if (*p_dm_odm->p_band_width == ODM_BW20M)
@@ -996,31 +654,24 @@ odm_DIG(
dm_dig_min = DM_DIG_MIN_AP_DFS;
ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): ====== In DFS band ======\n"));
}
-#endif
}
ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Absolutly upper bound = 0x%x, lower bound = 0x%x\n", dm_dig_max, dm_dig_min));
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
if (p_dm_odm->pu1_forced_igi_lb && (0 < *p_dm_odm->pu1_forced_igi_lb)) {
ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Force IGI lb to: 0x%02x !!!!!!\n", *p_dm_odm->pu1_forced_igi_lb));
dm_dig_min = *p_dm_odm->pu1_forced_igi_lb;
dm_dig_max = (dm_dig_min <= dm_dig_max) ? (dm_dig_max) : (dm_dig_min + 1);
}
-#endif
/* 1 Adjust boundary by RSSI */
if (p_dm_odm->is_linked && is_performance) {
/* 2 Modify DIG upper bound */
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- offset = 15;
-#else
/* 4 Modify DIG upper bound for 92E, 8723A\B, 8821 & 8812 BT */
if ((p_dm_odm->support_ic_type & (ODM_RTL8192E | ODM_RTL8723B | ODM_RTL8812 | ODM_RTL8821)) && (p_dm_odm->is_bt_limited_dig == 1)) {
offset = 10;
ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Coex. case: Force upper bound to RSSI + %d !!!!!!\n", offset));
} else
offset = 15;
-#endif
if ((p_dm_odm->rssi_min + offset) > dm_dig_max)
p_dm_dig_table->rx_gain_range_max = dm_dig_max;
@@ -1029,7 +680,6 @@ odm_DIG(
else
p_dm_dig_table->rx_gain_range_max = p_dm_odm->rssi_min + offset;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
/* 2 Modify DIG lower bound */
/* if(p_dm_odm->is_one_entry_only) */
{
@@ -1040,42 +690,16 @@ odm_DIG(
else
dig_dynamic_min = p_dm_odm->rssi_min;
-#if (DM_ODM_SUPPORT_TYPE & ODM_CE)
if (is_dfs_band) {
dig_dynamic_min = dm_dig_min;
ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DFS band: Force lower bound to 0x%x after link !!!!!!\n", dm_dig_min));
}
-#endif
}
-#else
- {
- /* 4 For AP */
-#ifdef __ECOS
- HAL_REORDER_BARRIER();
-#else
- rmb();
-#endif
- if (is_dfs_band) {
- dig_dynamic_min = dm_dig_min;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DFS band: Force lower bound to 0x%x after link !!!!!!\n", dm_dig_min));
- } else {
- if (p_dm_odm->rssi_min < dm_dig_min)
- dig_dynamic_min = dm_dig_min;
- else if (p_dm_odm->rssi_min > dig_max_of_min)
- dig_dynamic_min = dig_max_of_min;
- else
- dig_dynamic_min = p_dm_odm->rssi_min;
- }
- }
-#endif
} else {
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP | ODM_CE))
if (is_performance && is_dfs_band) {
p_dm_dig_table->rx_gain_range_max = 0x28;
ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DFS band: Force upper bound to 0x%x before link !!!!!!\n", p_dm_dig_table->rx_gain_range_max));
- } else
-#endif
- {
+ } else {
if (is_performance)
p_dm_dig_table->rx_gain_range_max = DM_DIG_MAX_OF_MIN;
else
@@ -1104,11 +728,9 @@ odm_DIG(
/* 1 Modify DIG lower bound, deal with abnormal case */
/* 2 Abnormal false alarm case */
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP | ODM_CE))
if (is_dfs_band)
p_dm_dig_table->rx_gain_range_min = dig_dynamic_min;
else
-#endif
{
if (!p_dm_odm->is_linked) {
p_dm_dig_table->rx_gain_range_min = dig_dynamic_min;
@@ -1120,7 +742,6 @@ odm_DIG(
}
/* 2 Abnormal # beacon case */
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
if (p_dm_odm->is_linked && !first_connect) {
ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("Beacon Num (%d)\n", p_dm_odm->phy_dbg_info.num_qry_beacon_pkt));
if ((p_dm_odm->phy_dbg_info.num_qry_beacon_pkt < 5) && (p_dm_odm->bsta_state)) {
@@ -1129,7 +750,6 @@ odm_DIG(
p_dm_odm->phy_dbg_info.num_qry_beacon_pkt, p_dm_dig_table->rx_gain_range_min));
}
}
-#endif
/* 2 Abnormal lower bound case */
if (p_dm_dig_table->rx_gain_range_min > p_dm_dig_table->rx_gain_range_max) {
@@ -1150,16 +770,13 @@ odm_DIG(
if (is_first_tp_target || (first_connect && is_performance)) {
p_dm_dig_table->large_fa_hit = 0;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP | ODM_CE))
if (is_dfs_band) {
if (p_dm_odm->rssi_min > 0x28)
current_igi = 0x28;
else
current_igi = p_dm_odm->rssi_min;
ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): DFS band: One-shot to 0x28 upmost!!!!!!\n"));
- } else
-#endif
- {
+ } else {
if (p_dm_odm->rssi_min < dig_max_of_min) {
if (current_igi < p_dm_odm->rssi_min)
current_igi = p_dm_odm->rssi_min;
@@ -1167,25 +784,11 @@ odm_DIG(
if (current_igi < dig_max_of_min)
current_igi = dig_max_of_min;
}
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
-#if (RTL8812A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8812)
- odm_config_bb_with_header_file(p_dm_odm, CONFIG_BB_AGC_TAB_DIFF);
-#endif
-#endif
}
ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): First connect case: IGI does on-shot to 0x%x\n", current_igi));
} else {
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-
- if (priv->pshare->rf_ft_var.dig_upcheck_enable)
- dig_go_up_check = phydm_dig_go_up_check(p_dm_odm);
-#endif
-
if ((p_false_alm_cnt->cnt_all > dm_FA_thres[2]) && dig_go_up_check)
current_igi = current_igi + 4;
else if ((p_false_alm_cnt->cnt_all > dm_FA_thres[1]) && dig_go_up_check)
@@ -1194,13 +797,11 @@ odm_DIG(
current_igi = current_igi - 2;
/* 4 Abnormal # beacon case */
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
if ((p_dm_odm->phy_dbg_info.num_qry_beacon_pkt < 5) && (p_false_alm_cnt->cnt_all < DM_DIG_FA_TH1) && (p_dm_odm->bsta_state)) {
current_igi = p_dm_dig_table->rx_gain_range_min;
ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Abnormal #beacon (%d) case: IGI does one-shot to 0x%x\n",
p_dm_odm->phy_dbg_info.num_qry_beacon_pkt, current_igi));
}
-#endif
}
} else {
/* 2 Before link */
@@ -1210,12 +811,6 @@ odm_DIG(
current_igi = dm_dig_min;
ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): First disconnect case: IGI does on-shot to lower bound\n"));
} else {
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- if (priv->pshare->rf_ft_var.dig_upcheck_enable)
- dig_go_up_check = phydm_dig_go_up_check(p_dm_odm);
-#endif
-
if ((p_false_alm_cnt->cnt_all > dm_FA_thres[2]) && dig_go_up_check)
current_igi = current_igi + 4;
else if ((p_false_alm_cnt->cnt_all > dm_FA_thres[1]) && dig_go_up_check)
@@ -1236,7 +831,7 @@ odm_DIG(
/* 1 Update status */
{
-#if ((DM_ODM_SUPPORT_TYPE & ODM_WIN) || ((DM_ODM_SUPPORT_TYPE & ODM_CE) && (ODM_CONFIG_BT_COEXIST == 1)))
+#if (((ODM_CONFIG_BT_COEXIST == 1)))
if (p_dm_odm->is_bt_hs_operation) {
if (p_dm_odm->is_linked) {
if (p_dm_dig_table->bt30_cur_igi > (current_igi))
@@ -1269,7 +864,6 @@ odm_dig_by_rssi_lps(
void *p_dm_void
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
struct _FALSE_ALARM_STATISTICS *p_false_alm_cnt = (struct _FALSE_ALARM_STATISTICS *)phydm_get_structure(p_dm_odm, PHYDM_FALSEALMCNT);
@@ -1312,7 +906,6 @@ odm_dig_by_rssi_lps(
ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_dig_by_rssi_lps(): current_igi = 0x%x\n", current_igi));
odm_write_dig(p_dm_odm, current_igi);/* odm_write_dig(p_dm_odm, p_dm_dig_table->cur_ig_value); */
-#endif
}
/* 3============================================================
@@ -1331,15 +924,6 @@ odm_false_alarm_counter_statistics(
#endif
u32 ret_value;
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- /* Mark there, and check this in odm_DMWatchDog */
-#if 0 /* (DM_ODM_SUPPORT_TYPE == ODM_AP) */
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
- if ((priv->auto_channel != 0) && (priv->auto_channel != 2))
- return;
-#endif
-#endif
-
if (!(p_dm_odm->support_ability & ODM_BB_FA_CNT))
return;
@@ -1706,19 +1290,6 @@ odm_cck_packet_detection_thresh(
struct _FALSE_ALARM_STATISTICS *false_alm_cnt = (struct _FALSE_ALARM_STATISTICS *)phydm_get_structure(p_dm_odm, PHYDM_FALSEALMCNT);
u8 cur_cck_cca_thres = p_dm_dig_table->cur_cck_cca_thres, RSSI_thd = 35;
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- /* modify by Guo.Mingzhi 2011-12-29 */
- if (p_dm_odm->is_dual_mac_smart_concurrent == true)
- /* if (p_dm_odm->is_dual_mac_smart_concurrent == false) */
- return;
- if (p_dm_odm->is_bt_hs_operation) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_cck_packet_detection_thresh() write 0xcd for BT HS mode!!\n"));
- odm_write_cck_cca_thres(p_dm_odm, 0xcd);
- return;
- }
-#endif
-
if ((!(p_dm_odm->support_ability & ODM_BB_CCK_PD)) || (!(p_dm_odm->support_ability & ODM_BB_FA_CNT))) {
ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_cck_packet_detection_thresh() return==========\n"));
#ifdef MCR_WIRELESS_EXTEND
@@ -1727,10 +1298,8 @@ odm_cck_packet_detection_thresh(
return;
}
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
if (p_dm_odm->ext_lna)
return;
-#endif
ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_cck_packet_detection_thresh() ==========>\n"));
@@ -1741,40 +1310,17 @@ odm_cck_packet_detection_thresh(
ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_cck_packet_detection_thresh(): CCK FA moving average = %d\n", p_dm_dig_table->cck_fa_ma));
if (p_dm_odm->is_linked) {
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
-#if 0 /*for [PCIE-1596]*/
- if (p_dm_odm->rssi_min > (RSSI_thd + 14))
- cur_cck_cca_thres = 0xed;
- else if (p_dm_odm->rssi_min > (RSSI_thd + 6))
- cur_cck_cca_thres = 0xdd;
- else
-#endif
- if (p_dm_odm->rssi_min > RSSI_thd)
- cur_cck_cca_thres = 0xcd;
- else if (p_dm_odm->rssi_min > 20) {
- if (p_dm_dig_table->cck_fa_ma > ((DM_DIG_FA_TH1 >> 1) + (DM_DIG_FA_TH1 >> 3)))
- cur_cck_cca_thres = 0xcd;
- else if (p_dm_dig_table->cck_fa_ma < (DM_DIG_FA_TH0 >> 1))
- cur_cck_cca_thres = 0x83;
- } else if (p_dm_odm->rssi_min > 7)
- cur_cck_cca_thres = 0x83;
- else
- cur_cck_cca_thres = 0x40;
-#else
- if (p_dm_dig_table->cur_ig_value > (0x24 + 14))
- cur_cck_cca_thres = 0xed;
- else if (p_dm_dig_table->cur_ig_value > (0x24 + 6))
- cur_cck_cca_thres = 0xdd;
- else if (p_dm_dig_table->cur_ig_value > 0x24)
+ if (p_dm_odm->rssi_min > RSSI_thd)
cur_cck_cca_thres = 0xcd;
- else {
- if (p_dm_dig_table->cck_fa_ma > 0x400)
+ else if (p_dm_odm->rssi_min > 20) {
+ if (p_dm_dig_table->cck_fa_ma > ((DM_DIG_FA_TH1 >> 1) + (DM_DIG_FA_TH1 >> 3)))
+ cur_cck_cca_thres = 0xcd;
+ else if (p_dm_dig_table->cck_fa_ma < (DM_DIG_FA_TH0 >> 1))
cur_cck_cca_thres = 0x83;
- else if (p_dm_dig_table->cck_fa_ma < 0x200)
- cur_cck_cca_thres = 0x40;
- }
-
-#endif
+ } else if (p_dm_odm->rssi_min > 7)
+ cur_cck_cca_thres = 0x83;
+ else
+ cur_cck_cca_thres = 0x40;
} else {
if (p_dm_dig_table->cck_fa_ma > 0x400)
cur_cck_cca_thres = 0x83;
@@ -1823,320 +1369,5 @@ phydm_dig_go_up_check(
u32 over_DIG_cover_cnt;
bool ret = true;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
-
- max_DIG_cover_bond = DM_DIG_MAX_AP - priv->pshare->rf_ft_var.dig_upcheck_initial_value;
- current_igi_max_up_resolution = cur_ig_value + 6;
- rx_gain_range_max = p_dm_dig_table->rx_gain_range_max;
-
- phydm_get_nhm_result(p_dm_odm);
-
- total_NHM_cnt = ccx_info->NHM_result[0] + ccx_info->NHM_result[1];
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("phydm_dig_go_up_check(): *****Get NHM results*****\n"));
-
- if (total_NHM_cnt != 0) {
-
- /* cur_ig_value < max_DIG_cover_bond - 6 */
- if (p_dm_dig_table->dig_go_up_check_level == DIG_GOUPCHECK_LEVEL_0) {
- DIG_cover_cnt = ccx_info->NHM_result[1];
- ret = ((priv->pshare->rf_ft_var.dig_level0_ratio_reciprocal * DIG_cover_cnt) >= total_NHM_cnt) ? true : false;
- }
-
- /* (max_DIG_cover_bond - 6) <= cur_ig_value < DM_DIG_MAX_AP */
- else if (p_dm_dig_table->dig_go_up_check_level == DIG_GOUPCHECK_LEVEL_1) {
- over_DIG_cover_cnt = ccx_info->NHM_result[1];
- ret = (priv->pshare->rf_ft_var.dig_level1_ratio_reciprocal * over_DIG_cover_cnt < total_NHM_cnt) ? true : false;
-
- if (!ret) {
- /* update p_dm_dig_table->rx_gain_range_max */
- p_dm_dig_table->rx_gain_range_max = (rx_gain_range_max >= max_DIG_cover_bond - 6) ? (max_DIG_cover_bond - 6) : rx_gain_range_max;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("phydm_dig_go_up_check(): Noise power is beyond DIG can filter, lock rx_gain_range_max to 0x%x\n",
- p_dm_dig_table->rx_gain_range_max));
- }
- }
-
- /* cur_ig_value > DM_DIG_MAX_AP, foolproof */
- else if (p_dm_dig_table->dig_go_up_check_level == DIG_GOUPCHECK_LEVEL_2)
- ret = true;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("phydm_dig_go_up_check(): DIG_GoUpCheck_level = %d\n, current_igi_max_up_resolution = 0x%x\n, max_DIG_cover_bond = 0x%x\n, rx_gain_range_max = 0x%x, ret = %d\n",
- p_dm_dig_table->dig_go_up_check_level,
- current_igi_max_up_resolution,
- max_DIG_cover_bond,
- p_dm_dig_table->rx_gain_range_max,
- ret));
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("phydm_dig_go_up_check(): NHM_result = %d, %d, %d, %d\n",
- ccx_info->NHM_result[0], ccx_info->NHM_result[1], ccx_info->NHM_result[2], ccx_info->NHM_result[3]));
-
- } else
- ret = true;
-
- for (i = 0 ; i <= 10 ; i++)
- ccx_info->NHM_th[i] = 0xFF;
-
- if (cur_ig_value < max_DIG_cover_bond - 6) {
- ccx_info->NHM_th[0] = 2 * (cur_ig_value - priv->pshare->rf_ft_var.dig_upcheck_initial_value);
- p_dm_dig_table->dig_go_up_check_level = DIG_GOUPCHECK_LEVEL_0;
- } else if (cur_ig_value <= DM_DIG_MAX_AP) {
- ccx_info->NHM_th[0] = 2 * max_DIG_cover_bond;
- p_dm_dig_table->dig_go_up_check_level = DIG_GOUPCHECK_LEVEL_1;
- }
- /* cur_ig_value > DM_DIG_MAX_AP, foolproof */
- else {
- p_dm_dig_table->dig_go_up_check_level = DIG_GOUPCHECK_LEVEL_2;
- ret = true;
- }
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("phydm_dig_go_up_check(): *****Set NHM settings*****\n"));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("phydm_dig_go_up_check(): DIG_GoUpCheck_level = %d\n",
- p_dm_dig_table->dig_go_up_check_level));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("phydm_dig_go_up_check(): NHM_th = 0x%x, 0x%x, 0x%x\n",
- ccx_info->NHM_th[0], ccx_info->NHM_th[1], ccx_info->NHM_th[2]));
-
- ccx_info->nhm_inexclude_cca = NHM_EXCLUDE_CCA;
- ccx_info->nhm_inexclude_txon = NHM_EXCLUDE_TXON;
- ccx_info->NHM_period = 0xC350;
-
- phydm_nhm_setting(p_dm_odm, SET_NHM_SETTING);
- phydm_nhm_trigger(p_dm_odm);
-#endif
-
return ret;
}
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-
-/* <20130108, Kordan> E.g., With LNA used, we make the Rx power smaller to have a better EVM. (Asked by Willis) */
-void
-odm_rfe_control(
- struct PHY_DM_STRUCT *p_dm_odm,
- u64 rssi_val
-)
-{
- struct _ADAPTER *adapter = (struct _ADAPTER *)p_dm_odm->adapter;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- static u8 trsw_high_pwr = 0;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("===> odm_rfe_control, RSSI = %d, trsw_high_pwr = 0x%X, p_dm_odm->rfe_type = %d\n",
- rssi_val, trsw_high_pwr, p_dm_odm->rfe_type));
-
- if (p_dm_odm->rfe_type == 3) {
-
- p_dm_odm->RSSI_TRSW = rssi_val;
-
- if (p_dm_odm->RSSI_TRSW >= p_dm_odm->RSSI_TRSW_H) {
- trsw_high_pwr = 1; /* Switch to */
- odm_set_bb_reg(p_dm_odm, REG_ANTSEL_SW_JAGUAR, BIT(1) | BIT0, 0x1); /* Set ANTSW=1/ANTSWB=0 for SW control */
- odm_set_bb_reg(p_dm_odm, REG_ANTSEL_SW_JAGUAR, BIT(9) | BIT8, 0x3); /* Set ANTSW=1/ANTSWB=0 for SW control */
-
- } else if (p_dm_odm->RSSI_TRSW <= p_dm_odm->RSSI_TRSW_L) {
- trsw_high_pwr = 0; /* Switched back */
- odm_set_bb_reg(p_dm_odm, REG_ANTSEL_SW_JAGUAR, BIT(1) | BIT0, 0x1); /* Set ANTSW=1/ANTSWB=0 for SW control */
- odm_set_bb_reg(p_dm_odm, REG_ANTSEL_SW_JAGUAR, BIT(9) | BIT8, 0x0); /* Set ANTSW=1/ANTSWB=0 for SW control */
-
- }
- }
-
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("(p_dm_odm->RSSI_TRSW_H, p_dm_odm->RSSI_TRSW_L) = (%d, %d)\n", p_dm_odm->RSSI_TRSW_H, p_dm_odm->RSSI_TRSW_L));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("(rssi_val, rssi_val, p_dm_odm->RSSI_TRSW_iso) = (%d, %d, %d)\n",
- rssi_val, p_dm_odm->RSSI_TRSW_iso, p_dm_odm->RSSI_TRSW));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("<=== odm_rfe_control, RSSI = %d, trsw_high_pwr = 0x%X\n", rssi_val, trsw_high_pwr));
-}
-
-void
-odm_mpt_dig_work_item_callback(
- void *p_context
-)
-{
- struct _ADAPTER *adapter = (struct _ADAPTER *)p_context;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-
- ODM_MPT_DIG(p_dm_odm);
-}
-
-void
-odm_mpt_dig_callback(
- struct timer_list *p_timer
-)
-{
- struct _ADAPTER *adapter = (struct _ADAPTER *)p_timer->Adapter;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-
-
-#if DEV_BUS_TYPE == RT_PCI_INTERFACE
-#if USE_WORKITEM
- odm_schedule_work_item(&p_dm_odm->mpt_dig_workitem);
-#else
- ODM_MPT_DIG(p_dm_odm);
-#endif
-#else
- odm_schedule_work_item(&p_dm_odm->mpt_dig_workitem);
-#endif
-
-}
-
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-void
-odm_mpt_dig_callback(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if USE_WORKITEM
- odm_schedule_work_item(&p_dm_odm->mpt_dig_workitem);
-#else
- ODM_MPT_DIG(p_dm_odm);
-#endif
-}
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE != ODM_CE)
-void
-odm_mpt_write_dig(
- void *p_dm_void,
- u8 cur_ig_value
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _dynamic_initial_gain_threshold_ *p_dm_dig_table = &p_dm_odm->dm_dig_table;
-
- odm_write_1byte(p_dm_odm, ODM_REG(IGI_A, p_dm_odm), cur_ig_value);
-
-#if (ODM_PHY_STATUS_NEW_TYPE_SUPPORT == 1)
- /* Set IGI value of CCK for new CCK AGC */
- if (p_dm_odm->cck_new_agc) {
- if (p_dm_odm->support_ic_type & ODM_IC_PHY_STATUE_NEW_TYPE)
- odm_set_bb_reg(p_dm_odm, 0xa0c, 0x00003f00, (cur_ig_value >> 1));
- }
-
-#endif
-
- if (p_dm_odm->rf_type > ODM_1T1R)
- odm_write_1byte(p_dm_odm, ODM_REG(IGI_B, p_dm_odm), cur_ig_value);
-
- if ((p_dm_odm->support_ic_type & ODM_IC_11AC_SERIES) && (p_dm_odm->rf_type > ODM_2T2R)) {
- odm_write_1byte(p_dm_odm, ODM_REG(IGI_C, p_dm_odm), cur_ig_value);
- odm_write_1byte(p_dm_odm, ODM_REG(IGI_D, p_dm_odm), cur_ig_value);
- }
-
- p_dm_dig_table->cur_ig_value = cur_ig_value;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("cur_ig_value = 0x%x\n", cur_ig_value));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("p_dm_odm->rf_type = 0x%x\n", p_dm_odm->rf_type));
-}
-
-void
-ODM_MPT_DIG(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _dynamic_initial_gain_threshold_ *p_dm_dig_table = &p_dm_odm->dm_dig_table;
- struct _FALSE_ALARM_STATISTICS *p_false_alm_cnt = (struct _FALSE_ALARM_STATISTICS *)phydm_get_structure(p_dm_odm, PHYDM_FALSEALMCNT);
- u8 current_igi = p_dm_dig_table->cur_ig_value;
- u8 dig_upper = 0x40, dig_lower = 0x20;
- u32 rx_ok_cal;
- u32 rx_pwdb_ave_final;
- u8 IGI_A = 0x20, IGI_B = 0x20;
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-
-#if ODM_FIX_2G_DIG
- IGI_A = 0x22;
- IGI_B = 0x24;
-#endif
-
-#else
- if (!(p_dm_odm->priv->pshare->rf_ft_var.mp_specific && p_dm_odm->priv->pshare->mp_dig_on))
- return;
-
- if (*p_dm_odm->p_band_type == ODM_BAND_5G)
- dig_lower = 0x22;
-#endif
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("===> ODM_MPT_DIG, p_band_type = %d\n", *p_dm_odm->p_band_type));
-
-#if (ODM_FIX_2G_DIG || (DM_ODM_SUPPORT_TYPE & ODM_AP))
- if (*p_dm_odm->p_band_type == ODM_BAND_5G || (p_dm_odm->support_ic_type & (ODM_RTL8814A | ODM_RTL8822B))) /* for 5G or 8814 */
-#else
- if (1) /* for both 2G/5G */
-#endif
- {
- odm_false_alarm_counter_statistics(p_dm_odm);
-
- rx_ok_cal = p_dm_odm->phy_dbg_info.num_qry_phy_status_cck + p_dm_odm->phy_dbg_info.num_qry_phy_status_ofdm;
- rx_pwdb_ave_final = (rx_ok_cal != 0) ? p_dm_odm->rx_pwdb_ave / rx_ok_cal : 0;
-
- p_dm_odm->phy_dbg_info.num_qry_phy_status_cck = 0;
- p_dm_odm->phy_dbg_info.num_qry_phy_status_ofdm = 0;
- p_dm_odm->rx_pwdb_ave = 0;
- p_dm_odm->MPDIG_2G = false;
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- p_dm_odm->times_2g = 0;
-#endif
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("RX OK = %d\n", rx_ok_cal));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("RSSI = %d\n", rx_pwdb_ave_final));
-
- if (rx_ok_cal >= 70 && rx_pwdb_ave_final <= 40) {
- if (current_igi > 0x24)
- odm_mpt_write_dig(p_dm_odm, 0x24);
- } else {
- if (p_false_alm_cnt->cnt_all > 1000)
- current_igi = current_igi + 8;
- else if (p_false_alm_cnt->cnt_all > 200)
- current_igi = current_igi + 4;
- else if (p_false_alm_cnt->cnt_all > 50)
- current_igi = current_igi + 2;
- else if (p_false_alm_cnt->cnt_all < 2)
- current_igi = current_igi - 2;
-
- if (current_igi < dig_lower)
- current_igi = dig_lower;
-
- if (current_igi > dig_upper)
- current_igi = dig_upper;
-
- odm_mpt_write_dig(p_dm_odm, current_igi);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("DIG = 0x%x, cnt_all = %d, cnt_ofdm_fail = %d, cnt_cck_fail = %d\n",
- current_igi, p_false_alm_cnt->cnt_all, p_false_alm_cnt->cnt_ofdm_fail, p_false_alm_cnt->cnt_cck_fail));
- }
- } else {
- if (p_dm_odm->MPDIG_2G == false) {
- if ((p_dm_odm->support_platform & ODM_WIN) && !(p_dm_odm->support_ic_type & (ODM_RTL8814A | ODM_RTL8822B))) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("===> Fix IGI\n"));
- odm_write_1byte(p_dm_odm, ODM_REG(IGI_A, p_dm_odm), IGI_A);
- odm_write_1byte(p_dm_odm, ODM_REG(IGI_B, p_dm_odm), IGI_B);
- p_dm_dig_table->cur_ig_value = IGI_B;
- } else
- odm_mpt_write_dig(p_dm_odm, IGI_A);
- }
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- p_dm_odm->times_2g++;
-
- if (p_dm_odm->times_2g == 3)
-#endif
- {
- p_dm_odm->MPDIG_2G = true;
- }
- }
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if (p_dm_odm->support_ic_type == ODM_RTL8812)
- odm_rfe_control(p_dm_odm, rx_pwdb_ave_final);
-#endif
-
- odm_set_timer(p_dm_odm, &p_dm_odm->mpt_dig_timer, 700);
-}
-#endif
diff --git a/hal/phydm/phydm_dynamicbbpowersaving.c b/hal/phydm/phydm_dynamicbbpowersaving.c
index 50db607..9d988dc 100644
--- a/hal/phydm/phydm_dynamicbbpowersaving.c
+++ b/hal/phydm/phydm_dynamicbbpowersaving.c
@@ -49,18 +49,14 @@ odm_rf_saving(
)
{
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE != ODM_AP)
struct _dynamic_power_saving *p_dm_ps_table = &p_dm_odm->dm_ps_table;
u8 rssi_up_bound = 30 ;
u8 rssi_low_bound = 25;
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
if (p_dm_odm->patch_id == 40) { /* RT_CID_819x_FUNAI_TV */
rssi_up_bound = 50 ;
rssi_low_bound = 45;
}
-#endif
if (p_dm_ps_table->initialize == 0) {
-
p_dm_ps_table->reg874 = (odm_get_bb_reg(p_dm_odm, 0x874, MASKDWORD) & 0x1CC000) >> 14;
p_dm_ps_table->regc70 = (odm_get_bb_reg(p_dm_odm, 0xc70, MASKDWORD) & BIT(3)) >> 3;
p_dm_ps_table->reg85c = (odm_get_bb_reg(p_dm_odm, 0x85c, MASKDWORD) & 0xFF000000) >> 24;
@@ -105,7 +101,6 @@ odm_rf_saving(
}
p_dm_ps_table->pre_rf_state = p_dm_ps_table->cur_rf_state;
}
-#endif
}
#endif
diff --git a/hal/phydm/phydm_dynamictxpower.c b/hal/phydm/phydm_dynamictxpower.c
index 8494559..2c04857 100644
--- a/hal/phydm/phydm_dynamictxpower.c
+++ b/hal/phydm/phydm_dynamictxpower.c
@@ -30,44 +30,10 @@ odm_dynamic_tx_power_init(
)
{
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PMGNT_INFO p_mgnt_info = &adapter->MgntInfo;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
-
- /*if (!IS_HARDWARE_TYPE_8814A(adapter)) {*/
- /* ODM_RT_TRACE(p_dm_odm,ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, */
- /* ("odm_dynamic_tx_power_init DynamicTxPowerEnable=%d\n", p_mgnt_info->is_dynamic_tx_power_enable));*/
- /* return;*/
- /*} else*/
- {
- p_mgnt_info->bDynamicTxPowerEnable = true;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD,
- ("odm_dynamic_tx_power_init DynamicTxPowerEnable=%d\n", p_mgnt_info->bDynamicTxPowerEnable));
- }
-
-#if DEV_BUS_TYPE == RT_USB_INTERFACE
- if (RT_GetInterfaceSelection(adapter) == INTF_SEL1_USB_High_Power) {
- odm_dynamic_tx_power_save_power_index(p_dm_odm);
- p_mgnt_info->bDynamicTxPowerEnable = true;
- } else
-#else
- /* so 92c pci do not need dynamic tx power? vivi check it later */
- p_mgnt_info->bDynamicTxPowerEnable = false;
-#endif
-
-
- p_hal_data->LastDTPLvl = tx_high_pwr_level_normal;
- p_hal_data->DynamicTxHighPowerLvl = tx_high_pwr_level_normal;
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
p_dm_odm->last_dtp_lvl = tx_high_pwr_level_normal;
p_dm_odm->dynamic_tx_high_power_lvl = tx_high_pwr_level_normal;
p_dm_odm->tx_agc_ofdm_18_6 = odm_get_bb_reg(p_dm_odm, 0xC24, MASKDWORD); /*TXAGC {18M 12M 9M 6M}*/
-
-#endif
-
}
void
@@ -76,19 +42,9 @@ odm_dynamic_tx_power_save_power_index(
)
{
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_CE | ODM_WIN))
u8 index;
u32 power_index_reg[6] = {0xc90, 0xc91, 0xc92, 0xc98, 0xc99, 0xc9a};
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- for (index = 0; index < 6; index++)
- p_hal_data->PowerIndex_backup[index] = PlatformEFIORead1Byte(adapter, power_index_reg[index]);
-
-
-#endif
-#endif
}
void
@@ -97,18 +53,10 @@ odm_dynamic_tx_power_restore_power_index(
)
{
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_CE | ODM_WIN))
u8 index;
struct _ADAPTER *adapter = p_dm_odm->adapter;
HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
u32 power_index_reg[6] = {0xc90, 0xc91, 0xc92, 0xc98, 0xc99, 0xc9a};
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- for (index = 0; index < 6; index++)
- PlatformEFIOWrite1Byte(adapter, power_index_reg[index], p_hal_data->PowerIndex_backup[index]);
-
-
-#endif
-#endif
}
void
@@ -131,68 +79,8 @@ odm_dynamic_tx_power_nic_ce(
void *p_dm_void
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_CE))
-#if (RTL8821A_SUPPORT == 1)
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 val;
- u8 rssi_tmp = p_dm_odm->rssi_min;
-
- if (!(p_dm_odm->support_ability & ODM_BB_DYNAMIC_TXPWR))
- return;
-
- if (rssi_tmp >= TX_POWER_NEAR_FIELD_THRESH_LVL2) {
- p_dm_odm->dynamic_tx_high_power_lvl = tx_high_pwr_level_level2;
- /**/
- } else if (rssi_tmp >= TX_POWER_NEAR_FIELD_THRESH_LVL1) {
- p_dm_odm->dynamic_tx_high_power_lvl = tx_high_pwr_level_level1;
- /**/
- } else if (rssi_tmp < (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) {
- p_dm_odm->dynamic_tx_high_power_lvl = tx_high_pwr_level_normal;
- /**/
- }
-
- if (p_dm_odm->last_dtp_lvl != p_dm_odm->dynamic_tx_high_power_lvl) {
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, ODM_DBG_LOUD, ("update_DTP_lv: ((%d)) -> ((%d))\n", p_dm_odm->last_dtp_lvl, p_dm_odm->dynamic_tx_high_power_lvl));
-
- p_dm_odm->last_dtp_lvl = p_dm_odm->dynamic_tx_high_power_lvl;
-
- if (p_dm_odm->support_ic_type & (ODM_RTL8821)) {
-
- if (p_dm_odm->dynamic_tx_high_power_lvl == tx_high_pwr_level_level2) {
-
- odm_set_mac_reg(p_dm_odm, 0x6D8, BIT(20) | BIT19 | BIT18, 1); /* Resp TXAGC offset = -3dB*/
-
- val = p_dm_odm->tx_agc_ofdm_18_6 & 0xff;
- if (val >= 0x20)
- val -= 0x16;
-
- odm_set_bb_reg(p_dm_odm, 0xC24, 0xff, val);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, ODM_DBG_LOUD, ("Set TX power: level 2\n"));
- } else if (p_dm_odm->dynamic_tx_high_power_lvl == tx_high_pwr_level_level1) {
-
- odm_set_mac_reg(p_dm_odm, 0x6D8, BIT(20) | BIT19 | BIT18, 1); /* Resp TXAGC offset = -3dB*/
-
- val = p_dm_odm->tx_agc_ofdm_18_6 & 0xff;
- if (val >= 0x20)
- val -= 0x10;
-
- odm_set_bb_reg(p_dm_odm, 0xC24, 0xff, val);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, ODM_DBG_LOUD, ("Set TX power: level 1\n"));
- } else if (p_dm_odm->dynamic_tx_high_power_lvl == tx_high_pwr_level_normal) {
-
- odm_set_mac_reg(p_dm_odm, 0x6D8, BIT(20) | BIT19 | BIT18, 0); /* Resp TXAGC offset = 0dB*/
- odm_set_bb_reg(p_dm_odm, 0xC24, MASKDWORD, p_dm_odm->tx_agc_ofdm_18_6);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, ODM_DBG_LOUD, ("Set TX power: normal\n"));
- }
- }
- }
-
-#endif
-#endif
}
-
void
odm_dynamic_tx_power(
void *p_dm_void
@@ -239,23 +127,6 @@ odm_dynamic_tx_power_nic(
if (!(p_dm_odm->support_ability & ODM_BB_DYNAMIC_TXPWR))
return;
-
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-
- if (p_dm_odm->support_ic_type == ODM_RTL8814A)
- odm_dynamic_tx_power_8814a(p_dm_odm);
- else if (p_dm_odm->support_ic_type & ODM_RTL8821) {
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PMGNT_INFO p_mgnt_info = GetDefaultMgntInfo(adapter);
-
- if (p_mgnt_info->RegRspPwr == 1) {
- if (p_dm_odm->rssi_min > 60)
- odm_set_mac_reg(p_dm_odm, ODM_REG_RESP_TX_11AC, BIT(20) | BIT19 | BIT18, 1); /*Resp TXAGC offset = -3dB*/
- else if (p_dm_odm->rssi_min < 55)
- odm_set_mac_reg(p_dm_odm, ODM_REG_RESP_TX_11AC, BIT(20) | BIT19 | BIT18, 0); /*Resp TXAGC offset = 0dB*/
- }
- }
-#endif
}
void
@@ -265,70 +136,6 @@ odm_dynamic_tx_power_ap(
)
{
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
-
- /* #if ((RTL8192C_SUPPORT==1) || (RTL8192D_SUPPORT==1) || (RTL8188E_SUPPORT==1) || (RTL8812E_SUPPORT==1)) */
-
-
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
- s32 i;
- s16 pwr_thd = 63;
-
- if (!priv->pshare->rf_ft_var.tx_pwr_ctrl)
- return;
-
-#if ((RTL8812A_SUPPORT == 1) || (RTL8881A_SUPPORT == 1) || (RTL8814A_SUPPORT == 1))
- if (p_dm_odm->support_ic_type & (ODM_RTL8812 | ODM_RTL8881A | ODM_RTL8814A))
- pwr_thd = TX_POWER_NEAR_FIELD_THRESH_LVL1;
-#endif
-
- /*
- * Check if station is near by to use lower tx power
- */
-
- if ((priv->up_time % 3) == 0) {
- int disable_pwr_ctrl = ((p_dm_odm->false_alm_cnt.cnt_all > 1000) || ((p_dm_odm->false_alm_cnt.cnt_all > 300) && ((RTL_R8(0xc50) & 0x7f) >= 0x32))) ? 1 : 0;
-
- for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) {
- struct sta_info *pstat = p_dm_odm->p_odm_sta_info[i];
- if (IS_STA_VALID(pstat)) {
- if (disable_pwr_ctrl)
- pstat->hp_level = 0;
- else if ((pstat->hp_level == 0) && (pstat->rssi > pwr_thd))
- pstat->hp_level = 1;
- else if ((pstat->hp_level == 1) && (pstat->rssi < (pwr_thd - 8)))
- pstat->hp_level = 0;
- }
- }
-
-#if defined(CONFIG_WLAN_HAL_8192EE)
- if (GET_CHIP_VER(priv) == VERSION_8192E) {
- if (!disable_pwr_ctrl && (p_dm_odm->rssi_min != 0xff)) {
- if (p_dm_odm->rssi_min > pwr_thd)
- RRSR_power_control_11n(priv, 1);
- else if (p_dm_odm->rssi_min < (pwr_thd - 8))
- RRSR_power_control_11n(priv, 0);
- } else
- RRSR_power_control_11n(priv, 0);
- }
-#endif
-
-#ifdef CONFIG_WLAN_HAL_8814AE
- if (GET_CHIP_VER(priv) == VERSION_8814A) {
- if (!disable_pwr_ctrl && (p_dm_odm->rssi_min != 0xff)) {
- if (p_dm_odm->rssi_min > pwr_thd)
- RRSR_power_control_14(priv, 1);
- else if (p_dm_odm->rssi_min < (pwr_thd - 8))
- RRSR_power_control_14(priv, 0);
- } else
- RRSR_power_control_14(priv, 0);
- }
-#endif
-
- }
- /* #endif */
-
-#endif
}
void
@@ -338,198 +145,4 @@ odm_dynamic_tx_power_8821(
u8 mac_id
)
{
-#if (RTL8821A_SUPPORT == 1)
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct sta_info *p_entry;
- u8 reg0xc56_byte;
- u8 txpwr_offset = 0;
-
- p_entry = p_dm_odm->p_odm_sta_info[mac_id];
-
- reg0xc56_byte = odm_read_1byte(p_dm_odm, 0xc56);
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("reg0xc56_byte=%d\n", reg0xc56_byte));
-
- if (p_entry[mac_id].rssi_stat.undecorated_smoothed_pwdb > 85) {
-
- /* Avoid TXAGC error after TX power offset is applied.
- For example: Reg0xc56=0x6, if txpwr_offset=3( reduce 11dB )
- Total power = 6-11= -5( overflow!! ), PA may be burned !
- so txpwr_offset should be adjusted by Reg0xc56*/
-
- if (reg0xc56_byte < 7)
- txpwr_offset = 1;
- else if (reg0xc56_byte < 11)
- txpwr_offset = 2;
- else
- txpwr_offset = 3;
-
- SET_TX_DESC_TX_POWER_OFFSET_8812(p_desc, txpwr_offset);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("odm_dynamic_tx_power_8821: RSSI=%d, txpwr_offset=%d\n", p_entry[mac_id].rssi_stat.undecorated_smoothed_pwdb, txpwr_offset));
-
- } else {
- SET_TX_DESC_TX_POWER_OFFSET_8812(p_desc, txpwr_offset);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("odm_dynamic_tx_power_8821: RSSI=%d, txpwr_offset=%d\n", p_entry[mac_id].rssi_stat.undecorated_smoothed_pwdb, txpwr_offset));
-
- }
-#endif /*#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)*/
-#endif /*#if (RTL8821A_SUPPORT==1)*/
}
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-void
-odm_dynamic_tx_power_8814a(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PMGNT_INFO p_mgnt_info = &adapter->MgntInfo;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- s32 undecorated_smoothed_pwdb;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD,
- ("TxLevel=%d p_mgnt_info->iot_action=%x p_mgnt_info->is_dynamic_tx_power_enable=%d\n",
- p_hal_data->DynamicTxHighPowerLvl, p_mgnt_info->IOTAction, p_mgnt_info->bDynamicTxPowerEnable));
-
- /*STA not connected and AP not connected*/
- if ((!p_mgnt_info->bMediaConnect) && (p_hal_data->EntryMinUndecoratedSmoothedPWDB == 0)) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("Not connected to any reset power lvl\n"));
- p_hal_data->DynamicTxHighPowerLvl = tx_high_pwr_level_normal;
- return;
- }
-
-
- if ((p_mgnt_info->bDynamicTxPowerEnable != true) || p_mgnt_info->IOTAction & HT_IOT_ACT_DISABLE_HIGH_POWER)
- p_hal_data->DynamicTxHighPowerLvl = tx_high_pwr_level_normal;
- else {
- if (p_mgnt_info->bMediaConnect) { /*Default port*/
- if (ACTING_AS_AP(adapter) || ACTING_AS_IBSS(adapter)) {
- undecorated_smoothed_pwdb = p_hal_data->EntryMinUndecoratedSmoothedPWDB;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("AP Client PWDB = 0x%x\n", undecorated_smoothed_pwdb));
- } else {
- undecorated_smoothed_pwdb = p_hal_data->UndecoratedSmoothedPWDB;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("STA Default Port PWDB = 0x%x\n", undecorated_smoothed_pwdb));
- }
- } else {/*associated entry pwdb*/
- undecorated_smoothed_pwdb = p_hal_data->EntryMinUndecoratedSmoothedPWDB;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("AP Ext Port PWDB = 0x%x\n", undecorated_smoothed_pwdb));
- }
-
- /*Should we separate as 2.4G/5G band?*/
-
- if (undecorated_smoothed_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL2) {
- p_hal_data->DynamicTxHighPowerLvl = tx_high_pwr_level_level2;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("tx_high_pwr_level_level1 (TxPwr=0x0)\n"));
- } else if ((undecorated_smoothed_pwdb < (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) &&
- (undecorated_smoothed_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL1)) {
- p_hal_data->DynamicTxHighPowerLvl = tx_high_pwr_level_level1;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("tx_high_pwr_level_level1 (TxPwr=0x10)\n"));
- } else if (undecorated_smoothed_pwdb < (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) {
- p_hal_data->DynamicTxHighPowerLvl = tx_high_pwr_level_normal;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("tx_high_pwr_level_normal\n"));
- }
- }
-
-
- if (p_hal_data->DynamicTxHighPowerLvl != p_hal_data->LastDTPLvl) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD, ("odm_dynamic_tx_power_8814a() channel = %d\n", p_hal_data->CurrentChannel));
- odm_set_tx_power_level8814(adapter, p_hal_data->CurrentChannel, p_hal_data->DynamicTxHighPowerLvl);
- }
-
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_TXPWR, DBG_LOUD,
- ("odm_dynamic_tx_power_8814a() channel = %d TXpower lvl=%d/%d\n",
- p_hal_data->CurrentChannel, p_hal_data->LastDTPLvl, p_hal_data->DynamicTxHighPowerLvl));
-
- p_hal_data->LastDTPLvl = p_hal_data->DynamicTxHighPowerLvl;
-
-}
-
-
-
-/**/
-/*For normal driver we always use the FW method to configure TX power index to reduce I/O transaction.*/
-/**/
-/**/
-void
-odm_set_tx_power_level8814(
- struct _ADAPTER *adapter,
- u8 channel,
- u8 pwr_lvl
-)
-{
-#if (DEV_BUS_TYPE == RT_USB_INTERFACE)
- u32 i, j, k = 0;
- u32 value[264] = {0};
- u32 path = 0, power_index, txagc_table_wd = 0x00801000;
-
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
-
- u8 jaguar2_rates[][4] = { {MGN_1M, MGN_2M, MGN_5_5M, MGN_11M},
- {MGN_6M, MGN_9M, MGN_12M, MGN_18M},
- {MGN_24M, MGN_36M, MGN_48M, MGN_54M},
- {MGN_MCS0, MGN_MCS1, MGN_MCS2, MGN_MCS3},
- {MGN_MCS4, MGN_MCS5, MGN_MCS6, MGN_MCS7},
- {MGN_MCS8, MGN_MCS9, MGN_MCS10, MGN_MCS11},
- {MGN_MCS12, MGN_MCS13, MGN_MCS14, MGN_MCS15},
- {MGN_MCS16, MGN_MCS17, MGN_MCS18, MGN_MCS19},
- {MGN_MCS20, MGN_MCS21, MGN_MCS22, MGN_MCS23},
- {MGN_VHT1SS_MCS0, MGN_VHT1SS_MCS1, MGN_VHT1SS_MCS2, MGN_VHT1SS_MCS3},
- {MGN_VHT1SS_MCS4, MGN_VHT1SS_MCS5, MGN_VHT1SS_MCS6, MGN_VHT1SS_MCS7},
- {MGN_VHT2SS_MCS8, MGN_VHT2SS_MCS9, MGN_VHT2SS_MCS0, MGN_VHT2SS_MCS1},
- {MGN_VHT2SS_MCS2, MGN_VHT2SS_MCS3, MGN_VHT2SS_MCS4, MGN_VHT2SS_MCS5},
- {MGN_VHT2SS_MCS6, MGN_VHT2SS_MCS7, MGN_VHT2SS_MCS8, MGN_VHT2SS_MCS9},
- {MGN_VHT3SS_MCS0, MGN_VHT3SS_MCS1, MGN_VHT3SS_MCS2, MGN_VHT3SS_MCS3},
- {MGN_VHT3SS_MCS4, MGN_VHT3SS_MCS5, MGN_VHT3SS_MCS6, MGN_VHT3SS_MCS7},
- {MGN_VHT3SS_MCS8, MGN_VHT3SS_MCS9, 0, 0}
- };
-
- for (path = ODM_RF_PATH_A; path <= ODM_RF_PATH_D; ++path) {
-
- u8 usb_host = UsbModeQueryHubUsbType(adapter);
- u8 usb_rfset = UsbModeQueryRfSet(adapter);
- u8 usb_rf_type = RT_GetRFType(adapter);
-
- for (i = 0; i <= 16; i++) {
- for (j = 0; j <= 3; j++) {
- if (jaguar2_rates[i][j] == 0)
- continue;
-
- txagc_table_wd = 0x00801000;
- power_index = (u32) PHY_GetTxPowerIndex(adapter, (u8)path, jaguar2_rates[i][j], p_hal_data->CurrentChannelBW, channel);
-
- /*for Query bus type to recude tx power.*/
- if (usb_host != USB_MODE_U3 && usb_rfset == 1 && IS_HARDWARE_TYPE_8814AU(adapter) && usb_rf_type == RF_3T3R) {
- if (channel <= 14) {
- if (power_index >= 16)
- power_index -= 16;
- else
- power_index = 0;
- } else
- power_index = 0;
- }
-
- if (pwr_lvl == tx_high_pwr_level_level1) {
- if (power_index >= 0x10)
- power_index -= 0x10;
- else
- power_index = 0;
- } else if (pwr_lvl == tx_high_pwr_level_level2)
- power_index = 0;
-
- txagc_table_wd |= (path << 8) | MRateToHwRate(jaguar2_rates[i][j]) | (power_index << 24);
-
- PHY_SetTxPowerIndexShadow(adapter, (u8)power_index, (u8)path, jaguar2_rates[i][j]);
-
- value[k++] = txagc_table_wd;
- }
- }
- }
-
- if (adapter->MgntInfo.bScanInProgress == false && adapter->MgntInfo.RegFWOffload == 2)
- HalDownloadTxPowerLevel8814(adapter, value);
-#endif
-}
-#endif
diff --git a/hal/phydm/phydm_edcaturbocheck.c b/hal/phydm/phydm_edcaturbocheck.c
index ef458bf..a8b5d25 100644
--- a/hal/phydm/phydm_edcaturbocheck.c
+++ b/hal/phydm/phydm_edcaturbocheck.c
@@ -32,35 +32,15 @@ odm_edca_turbo_init(
{
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter = NULL;
- HAL_DATA_TYPE *p_hal_data = NULL;
-
- if (p_dm_odm->adapter == NULL) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("EdcaTurboInit fail!!!\n"));
- return;
- }
-
- adapter = p_dm_odm->adapter;
- p_hal_data = GET_HAL_DATA(adapter);
-
- p_dm_odm->dm_edca_table.is_current_turbo_edca = false;
- p_dm_odm->dm_edca_table.is_cur_rdl_state = false;
- p_hal_data->is_any_non_be_pkts = false;
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
struct _ADAPTER *adapter = p_dm_odm->adapter;
p_dm_odm->dm_edca_table.is_current_turbo_edca = false;
p_dm_odm->dm_edca_table.is_cur_rdl_state = false;
adapter->recvpriv.is_any_non_be_pkts = false;
-#endif
ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Orginial VO PARAM: 0x%x\n", odm_read_4byte(p_dm_odm, ODM_EDCA_VO_PARAM)));
ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Orginial VI PARAM: 0x%x\n", odm_read_4byte(p_dm_odm, ODM_EDCA_VI_PARAM)));
ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Orginial BE PARAM: 0x%x\n", odm_read_4byte(p_dm_odm, ODM_EDCA_BE_PARAM)));
ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Orginial BK PARAM: 0x%x\n", odm_read_4byte(p_dm_odm, ODM_EDCA_BK_PARAM)));
-
-
} /* ODM_InitEdcaTurbo */
void
@@ -86,25 +66,15 @@ odm_edca_turbo_check(
switch (p_dm_odm->support_platform) {
case ODM_WIN:
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- odm_edca_turbo_check_mp(p_dm_odm);
-#endif
break;
-
case ODM_CE:
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
odm_edca_turbo_check_ce(p_dm_odm);
-#endif
break;
}
ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("<========================odm_edca_turbo_check\n"));
} /* odm_CheckEdcaTurbo */
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
-
-
void
odm_edca_turbo_check_ce(
void *p_dm_void
@@ -233,466 +203,6 @@ odm_edca_turbo_check_ce(
p_dm_odm->dm_edca_table.is_current_turbo_edca = _FALSE;
}
}
-
}
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-void
-odm_edca_turbo_check_mp(
- void *p_dm_void
-)
-{
-
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
-
- struct _ADAPTER *p_default_adapter = get_default_adapter(adapter);
- struct _ADAPTER *p_ext_adapter = get_first_ext_adapter(adapter); /* NULL; */
- PMGNT_INFO p_mgnt_info = &adapter->MgntInfo;
- PSTA_QOS p_sta_qos = adapter->MgntInfo.p_sta_qos;
- /* [Win7 count Tx/Rx statistic for Extension Port] odm_CheckEdcaTurbo's adapter is always Default. 2009.08.20, by Bohn */
- u64 ext_cur_tx_ok_cnt = 0;
- u64 ext_cur_rx_ok_cnt = 0;
- /* For future Win7 Enable Default Port to modify AMPDU size dynamically, 2009.08.20, Bohn. */
- u8 two_port_status = (u8)TWO_PORT_STATUS__WITHOUT_ANY_ASSOCIATE;
-
- /* Keep past Tx/Rx packet count for RT-to-RT EDCA turbo. */
- u64 cur_tx_ok_cnt = 0;
- u64 cur_rx_ok_cnt = 0;
- u32 EDCA_BE_UL = 0x5ea42b;/* Parameter suggested by Scott */ /* edca_setting_UL[p_mgnt_info->iot_peer]; */
- u32 EDCA_BE_DL = 0x5ea42b;/* Parameter suggested by Scott */ /* edca_setting_DL[p_mgnt_info->iot_peer]; */
- u32 EDCA_BE = 0x5ea42b;
- u8 iot_peer = 0;
- bool *p_is_cur_rdl_state = NULL;
- bool is_last_is_cur_rdl_state = false;
- bool is_bias_on_rx = false;
- bool is_edca_turbo_on = false;
- u8 tx_rate = 0xFF;
- u64 value64;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("odm_edca_turbo_check_mp========================>"));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Orginial BE PARAM: 0x%x\n", odm_read_4byte(p_dm_odm, ODM_EDCA_BE_PARAM)));
-
- /* *******************************
- * list paramter for different platform
- * ******************************* */
- is_last_is_cur_rdl_state = p_dm_odm->dm_edca_table.is_cur_rdl_state;
- p_is_cur_rdl_state = &(p_dm_odm->dm_edca_table.is_cur_rdl_state);
-
- /* 2012/09/14 MH Add */
- if (p_mgnt_info->num_non_be_pkt > p_mgnt_info->reg_edca_thresh && !(adapter->MgntInfo.wifi_confg & RT_WIFI_LOGO))
- p_hal_data->is_any_non_be_pkts = true;
-
- p_mgnt_info->num_non_be_pkt = 0;
-
- /* Caculate TX/RX TP: */
- cur_tx_ok_cnt = p_dm_odm->cur_tx_ok_cnt;
- cur_rx_ok_cnt = p_dm_odm->cur_rx_ok_cnt;
-
-
- if (p_ext_adapter == NULL)
- p_ext_adapter = p_default_adapter;
-
- ext_cur_tx_ok_cnt = p_ext_adapter->tx_stats.num_tx_bytes_unicast - p_mgnt_info->ext_last_tx_ok_cnt;
- ext_cur_rx_ok_cnt = p_ext_adapter->rx_stats.num_rx_bytes_unicast - p_mgnt_info->ext_last_rx_ok_cnt;
- get_two_port_shared_resource(adapter, TWO_PORT_SHARED_OBJECT__STATUS, NULL, &two_port_status);
- /* For future Win7 Enable Default Port to modify AMPDU size dynamically, 2009.08.20, Bohn. */
- if (two_port_status == TWO_PORT_STATUS__EXTENSION_ONLY) {
- cur_tx_ok_cnt = ext_cur_tx_ok_cnt ;
- cur_rx_ok_cnt = ext_cur_rx_ok_cnt ;
- }
- /* */
- iot_peer = p_mgnt_info->iot_peer;
- is_bias_on_rx = (p_mgnt_info->iot_action & HT_IOT_ACT_EDCA_BIAS_ON_RX) ? true : false;
- is_edca_turbo_on = ((!p_hal_data->is_any_non_be_pkts)) ? true : false;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("is_any_non_be_pkts : 0x%lx\n", p_hal_data->is_any_non_be_pkts));
-
-
- /* *******************************
- * check if edca turbo is disabled
- * ******************************* */
- if (odm_is_edca_turbo_disable(p_dm_odm)) {
- p_hal_data->is_any_non_be_pkts = false;
- p_mgnt_info->last_tx_ok_cnt = adapter->tx_stats.num_tx_bytes_unicast;
- p_mgnt_info->last_rx_ok_cnt = adapter->rx_stats.num_rx_bytes_unicast;
- p_mgnt_info->ext_last_tx_ok_cnt = p_ext_adapter->tx_stats.num_tx_bytes_unicast;
- p_mgnt_info->ext_last_rx_ok_cnt = p_ext_adapter->rx_stats.num_rx_bytes_unicast;
-
- }
-
- /* *******************************
- * remove iot case out
- * ******************************* */
- odm_edca_para_sel_by_iot(p_dm_odm, &EDCA_BE_UL, &EDCA_BE_DL);
-
-
- /* *******************************
- * Check if the status needs to be changed.
- * ******************************* */
- if (is_edca_turbo_on) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("is_edca_turbo_on : 0x%x is_bias_on_rx : 0x%x\n", is_edca_turbo_on, is_bias_on_rx));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("cur_tx_ok_cnt : 0x%lx\n", cur_tx_ok_cnt));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("cur_rx_ok_cnt : 0x%lx\n", cur_rx_ok_cnt));
- if (is_bias_on_rx)
- odm_edca_choose_traffic_idx(p_dm_odm, cur_tx_ok_cnt, cur_rx_ok_cnt, true, p_is_cur_rdl_state);
- else
- odm_edca_choose_traffic_idx(p_dm_odm, cur_tx_ok_cnt, cur_rx_ok_cnt, false, p_is_cur_rdl_state);
-
- /* modify by Guo.Mingzhi 2011-12-29 */
- if (adapter->AP_EDCA_PARAM[0] != EDCA_BE)
- EDCA_BE = adapter->AP_EDCA_PARAM[0];
- else
- EDCA_BE = ((*p_is_cur_rdl_state) == true) ? EDCA_BE_DL : EDCA_BE_UL;
-
- /*For TPLINK 8188EU test*/
- if ((IS_HARDWARE_TYPE_8188EU(adapter)) && (p_hal_data->UndecoratedSmoothedPWDB < 28)) { /* Set to origimal EDCA 0x5EA42B now need to update.*/
-
- } else { /*Use TPLINK preferred EDCA parameters.*/
- EDCA_BE = p_mgnt_info->EDCABEPara;
- }
-
- if (IS_HARDWARE_TYPE_8821U(adapter)) {
- if (p_mgnt_info->reg_tx_duty_enable) {
- /* 2013.01.23 LukeLee: debug for 8811AU thermal issue (reduce Tx duty cycle) */
- if (!p_mgnt_info->forced_data_rate) { /* auto rate */
- if (p_dm_odm->tx_rate != 0xFF)
- tx_rate = adapter->HalFunc.GetHwRateFromMRateHandler(p_dm_odm->tx_rate);
- } else /* force rate */
- tx_rate = (u8) p_mgnt_info->forced_data_rate;
-
- value64 = (cur_rx_ok_cnt << 2);
- if (cur_tx_ok_cnt < value64) /* Downlink */
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, EDCA_BE);
- else { /* Uplink */
- /*dbg_print("p_rf_calibrate_info->thermal_value = 0x%X\n", p_rf_calibrate_info->thermal_value);*/
- /*if(p_rf_calibrate_info->thermal_value < p_hal_data->eeprom_thermal_meter)*/
- if ((p_dm_odm->rf_calibrate_info.thermal_value < 0x2c) || (*p_dm_odm->p_band_type == BAND_ON_2_4G))
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, EDCA_BE);
- else {
- switch (tx_rate) {
- case MGN_VHT1SS_MCS6:
- case MGN_VHT1SS_MCS5:
- case MGN_MCS6:
- case MGN_MCS5:
- case MGN_48M:
- case MGN_54M:
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, 0x1ea42b);
- break;
- case MGN_VHT1SS_MCS4:
- case MGN_MCS4:
- case MGN_36M:
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, 0xa42b);
- break;
- case MGN_VHT1SS_MCS3:
- case MGN_MCS3:
- case MGN_24M:
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, 0xa47f);
- break;
- case MGN_VHT1SS_MCS2:
- case MGN_MCS2:
- case MGN_18M:
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, 0xa57f);
- break;
- case MGN_VHT1SS_MCS1:
- case MGN_MCS1:
- case MGN_9M:
- case MGN_12M:
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, 0xa77f);
- break;
- case MGN_VHT1SS_MCS0:
- case MGN_MCS0:
- case MGN_6M:
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, 0xa87f);
- break;
- default:
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, EDCA_BE);
- break;
- }
- }
- }
- } else
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, EDCA_BE);
-
- } else if (IS_HARDWARE_TYPE_8812AU(adapter)) {
- if (p_mgnt_info->reg_tx_duty_enable) {
- /* 2013.07.26 Wilson: debug for 8812AU thermal issue (reduce Tx duty cycle) */
- /* it;s the same issue as 8811AU */
- if (!p_mgnt_info->forced_data_rate) { /* auto rate */
- if (p_dm_odm->tx_rate != 0xFF)
- tx_rate = adapter->HalFunc.GetHwRateFromMRateHandler(p_dm_odm->tx_rate);
- } else /* force rate */
- tx_rate = (u8) p_mgnt_info->forced_data_rate;
-
- value64 = (cur_rx_ok_cnt << 2);
- if (cur_tx_ok_cnt < value64) /* Downlink */
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, EDCA_BE);
- else { /* Uplink */
- /*dbg_print("p_rf_calibrate_info->thermal_value = 0x%X\n", p_rf_calibrate_info->thermal_value);*/
- /*if(p_rf_calibrate_info->thermal_value < p_hal_data->eeprom_thermal_meter)*/
- if ((p_dm_odm->rf_calibrate_info.thermal_value < 0x2c) || (*p_dm_odm->p_band_type == BAND_ON_2_4G))
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, EDCA_BE);
- else {
- switch (tx_rate) {
- case MGN_VHT2SS_MCS9:
- case MGN_VHT1SS_MCS9:
- case MGN_VHT1SS_MCS8:
- case MGN_MCS15:
- case MGN_MCS7:
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, 0x1ea44f);
- case MGN_VHT2SS_MCS8:
- case MGN_VHT1SS_MCS7:
- case MGN_MCS14:
- case MGN_MCS6:
- case MGN_54M:
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, 0xa44f);
- case MGN_VHT2SS_MCS7:
- case MGN_VHT2SS_MCS6:
- case MGN_VHT1SS_MCS6:
- case MGN_VHT1SS_MCS5:
- case MGN_MCS13:
- case MGN_MCS5:
- case MGN_48M:
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, 0xa630);
- break;
- case MGN_VHT2SS_MCS5:
- case MGN_VHT2SS_MCS4:
- case MGN_VHT1SS_MCS4:
- case MGN_VHT1SS_MCS3:
- case MGN_MCS12:
- case MGN_MCS4:
- case MGN_MCS3:
- case MGN_36M:
- case MGN_24M:
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, 0xa730);
- break;
- case MGN_VHT2SS_MCS3:
- case MGN_VHT2SS_MCS2:
- case MGN_VHT2SS_MCS1:
- case MGN_VHT1SS_MCS2:
- case MGN_VHT1SS_MCS1:
- case MGN_MCS11:
- case MGN_MCS10:
- case MGN_MCS9:
- case MGN_MCS2:
- case MGN_MCS1:
- case MGN_18M:
- case MGN_12M:
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, 0xa830);
- break;
- case MGN_VHT2SS_MCS0:
- case MGN_VHT1SS_MCS0:
- case MGN_MCS0:
- case MGN_MCS8:
- case MGN_9M:
- case MGN_6M:
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, 0xa87f);
- break;
- default:
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, EDCA_BE);
- break;
- }
- }
- }
- } else
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, EDCA_BE);
- } else
- odm_write_4byte(p_dm_odm, ODM_EDCA_BE_PARAM, EDCA_BE);
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("EDCA Turbo on: EDCA_BE:0x%lx\n", EDCA_BE));
-
- p_dm_odm->dm_edca_table.is_current_turbo_edca = true;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("EDCA_BE_DL : 0x%lx EDCA_BE_UL : 0x%lx EDCA_BE : 0x%lx\n", EDCA_BE_DL, EDCA_BE_UL, EDCA_BE));
-
- } else {
- /* Turn Off EDCA turbo here. */
- /* Restore original EDCA according to the declaration of AP. */
- if (p_dm_odm->dm_edca_table.is_current_turbo_edca) {
- phydm_set_hw_reg_handler_interface(p_dm_odm, HW_VAR_AC_PARAM, GET_WMM_PARAM_ELE_SINGLE_AC_PARAM(p_sta_qos->wmm_param_ele, AC0_BE));
-
- p_dm_odm->dm_edca_table.is_current_turbo_edca = false;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Restore EDCA BE: 0x%lx\n", p_dm_odm->WMMEDCA_BE));
-
- }
- }
-
-}
-
-
-/* check if edca turbo is disabled */
-bool
-odm_is_edca_turbo_disable(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PMGNT_INFO p_mgnt_info = &adapter->MgntInfo;
- u32 iot_peer = p_mgnt_info->iot_peer;
-
- if (p_dm_odm->is_bt_disable_edca_turbo) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("EdcaTurboDisable for BT!!\n"));
- return true;
- }
-
- if ((!(p_dm_odm->support_ability & ODM_MAC_EDCA_TURBO)) ||
- (p_dm_odm->wifi_test & RT_WIFI_LOGO) ||
- (iot_peer >= HT_IOT_PEER_MAX)) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("EdcaTurboDisable\n"));
- return true;
- }
-
-
- /* 1. We do not turn on EDCA turbo mode for some AP that has IOT issue */
- /* 2. User may disable EDCA Turbo mode with OID settings. */
- if (p_mgnt_info->iot_action & HT_IOT_ACT_DISABLE_EDCA_TURBO) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("iot_action:EdcaTurboDisable\n"));
- return true;
- }
-
- return false;
-
-
-}
-
-/* add iot case here: for MP/CE */
-void
-odm_edca_para_sel_by_iot(
- void *p_dm_void,
- u32 *EDCA_BE_UL,
- u32 *EDCA_BE_DL
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- u32 iot_peer = 0;
- u32 ic_type = p_dm_odm->support_ic_type;
- u8 wireless_mode = 0xFF; /* invalid value */
- u32 iot_peer_sub_type = 0;
-
- PMGNT_INFO p_mgnt_info = &adapter->MgntInfo;
- u8 two_port_status = (u8)TWO_PORT_STATUS__WITHOUT_ANY_ASSOCIATE;
-
- if (p_dm_odm->p_wireless_mode != NULL)
- wireless_mode = *(p_dm_odm->p_wireless_mode);
-
- /* ========================================================= */
- /* list paramter for different platform */
-
- iot_peer = p_mgnt_info->iot_peer;
- iot_peer_sub_type = p_mgnt_info->iot_peer_subtype;
- get_two_port_shared_resource(adapter, TWO_PORT_SHARED_OBJECT__STATUS, NULL, &two_port_status);
-
- /* ****************************
- * / IOT case for MP
- * **************************** */
- if (p_dm_odm->support_interface == ODM_ITRF_PCIE) {
- (*EDCA_BE_UL) = 0x6ea42b;
- (*EDCA_BE_DL) = 0x6ea42b;
- }
-
- if (two_port_status == TWO_PORT_STATUS__EXTENSION_ONLY) {
- (*EDCA_BE_UL) = 0x5ea42b;/* Parameter suggested by Scott */ /* edca_setting_UL[ExtAdapter->mgnt_info.iot_peer]; */
- (*EDCA_BE_DL) = 0x5ea42b;/* Parameter suggested by Scott */ /* edca_setting_DL[ExtAdapter->mgnt_info.iot_peer]; */
- }
-
-#if (INTEL_PROXIMITY_SUPPORT == 1)
- if (p_mgnt_info->intel_class_mode_info.is_enable_ca == true)
- (*EDCA_BE_UL) = (*EDCA_BE_DL) = 0xa44f;
- else
-#endif
- {
- if ((p_mgnt_info->iot_action & (HT_IOT_ACT_FORCED_ENABLE_BE_TXOP | HT_IOT_ACT_AMSDU_ENABLE))) {
- /* To check whether we shall force turn on TXOP configuration. */
- if (!((*EDCA_BE_UL) & 0xffff0000))
- (*EDCA_BE_UL) |= 0x005e0000; /* Force TxOP limit to 0x005e for UL. */
- if (!((*EDCA_BE_DL) & 0xffff0000))
- (*EDCA_BE_DL) |= 0x005e0000; /* Force TxOP limit to 0x005e for DL. */
- }
-
- /* 92D txop can't be set to 0x3e for cisco1250 */
- if ((iot_peer == HT_IOT_PEER_CISCO) && (wireless_mode == ODM_WM_N24G)) {
- (*EDCA_BE_DL) = edca_setting_DL[iot_peer];
- (*EDCA_BE_UL) = edca_setting_UL[iot_peer];
- }
- /* merge from 92s_92c_merge temp brunch v2445 20120215 */
- else if ((iot_peer == HT_IOT_PEER_CISCO) && ((wireless_mode == ODM_WM_G) || (wireless_mode == (ODM_WM_B | ODM_WM_G)) || (wireless_mode == ODM_WM_A) || (wireless_mode == ODM_WM_B)))
- (*EDCA_BE_DL) = edca_setting_dl_g_mode[iot_peer];
- else if ((iot_peer == HT_IOT_PEER_AIRGO) && ((wireless_mode == ODM_WM_G) || (wireless_mode == ODM_WM_A)))
- (*EDCA_BE_DL) = 0xa630;
-
- else if (iot_peer == HT_IOT_PEER_MARVELL) {
- (*EDCA_BE_DL) = edca_setting_DL[iot_peer];
- (*EDCA_BE_UL) = edca_setting_UL[iot_peer];
- } else if (iot_peer == HT_IOT_PEER_ATHEROS && iot_peer_sub_type != HT_IOT_PEER_TPLINK_AC1750) {
- /* Set DL EDCA for Atheros peer to 0x3ea42b. Suggested by SD3 Wilson for ASUS TP issue. */
- if (wireless_mode == ODM_WM_G)
- (*EDCA_BE_DL) = edca_setting_dl_g_mode[iot_peer];
- else
- (*EDCA_BE_DL) = edca_setting_DL[iot_peer];
-
- if (ic_type == ODM_RTL8821)
- (*EDCA_BE_DL) = 0x5ea630;
-
- }
- }
-
- if ((ic_type == ODM_RTL8812) || (ic_type == ODM_RTL8192E)) { /* add 8812AU/8812AE */
- (*EDCA_BE_UL) = 0x5ea42b;
- (*EDCA_BE_DL) = 0x5ea42b;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("8812A: EDCA_BE_UL=0x%lx EDCA_BE_DL =0x%lx\n", (*EDCA_BE_UL), (*EDCA_BE_DL)));
- }
-
- if ((ic_type == ODM_RTL8814A) && (iot_peer == HT_IOT_PEER_REALTEK)) { /*8814AU and 8814AR*/
- (*EDCA_BE_UL) = 0x5ea42b;
- (*EDCA_BE_DL) = 0xa42b;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("8814A: EDCA_BE_UL=0x%lx EDCA_BE_DL =0x%lx\n", (*EDCA_BE_UL), (*EDCA_BE_DL)));
- }
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Special: EDCA_BE_UL=0x%lx EDCA_BE_DL =0x%lx, iot_peer = %d\n", (*EDCA_BE_UL), (*EDCA_BE_DL), iot_peer));
-
-}
-
-
-void
-odm_edca_choose_traffic_idx(
- void *p_dm_void,
- u64 cur_tx_bytes,
- u64 cur_rx_bytes,
- bool is_bias_on_rx,
- bool *p_is_cur_rdl_state
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
- if (is_bias_on_rx) {
-
- if (cur_tx_bytes > (cur_rx_bytes * 4)) {
- *p_is_cur_rdl_state = false;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Uplink Traffic\n "));
-
- } else {
- *p_is_cur_rdl_state = true;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Balance Traffic\n"));
-
- }
- } else {
- if (cur_rx_bytes > (cur_tx_bytes * 4)) {
- *p_is_cur_rdl_state = true;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Downlink Traffic\n"));
-
- } else {
- *p_is_cur_rdl_state = false;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_EDCA_TURBO, ODM_DBG_LOUD, ("Balance Traffic\n"));
- }
- }
-
- return ;
-}
-
-#endif
#endif /*PHYDM_SUPPORT_EDCA*/
diff --git a/hal/phydm/phydm_edcaturbocheck.h b/hal/phydm/phydm_edcaturbocheck.h
index 0ebe328..8f4d978 100644
--- a/hal/phydm/phydm_edcaturbocheck.h
+++ b/hal/phydm/phydm_edcaturbocheck.h
@@ -29,13 +29,10 @@ struct _EDCA_TURBO_ {
bool is_current_turbo_edca;
bool is_cur_rdl_state;
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
u32 prv_traffic_idx; /* edca turbo */
-#endif
};
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
static u32 edca_setting_UL[HT_IOT_PEER_MAX] =
/* UNKNOWN REALTEK_90 REALTEK_92SE BROADCOM RALINK ATHEROS CISCO MERU MARVELL 92U_AP SELF_AP(DownLink/Tx) */
{ 0x5e4322, 0xa44f, 0x5e4322, 0x5ea32b, 0x5ea422, 0x5ea322, 0x3ea430, 0x5ea42b, 0x5ea44f, 0x5e4322, 0x5e4322};
@@ -49,10 +46,6 @@ static u32 edca_setting_dl_g_mode[HT_IOT_PEER_MAX] =
/* UNKNOWN REALTEK_90 REALTEK_92SE BROADCOM RALINK ATHEROS CISCO MERU, MARVELL 92U_AP SELF_AP */
{ 0x4322, 0xa44f, 0x5e4322, 0xa42b, 0x5e4322, 0x4322, 0xa42b, 0x5ea42b, 0xa44f, 0x5e4322, 0x5ea42b};
-#endif
-
-
-
void
odm_edca_turbo_check(
void *p_dm_void
@@ -62,40 +55,10 @@ odm_edca_turbo_init(
void *p_dm_void
);
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-void
-odm_edca_turbo_check_mp(
- void *p_dm_void
-);
-
-/* check if edca turbo is disabled */
-bool
-odm_is_edca_turbo_disable(
- void *p_dm_void
-);
-/* choose edca paramter for special IOT case */
-void
-odm_edca_para_sel_by_iot(
- void *p_dm_void,
- u32 *EDCA_BE_UL,
- u32 *EDCA_BE_DL
-);
-/* check if it is UL or DL */
-void
-odm_edca_choose_traffic_idx(
- void *p_dm_void,
- u64 cur_tx_bytes,
- u64 cur_rx_bytes,
- bool is_bias_on_rx,
- bool *p_is_cur_rdl_state
-);
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
void
odm_edca_turbo_check_ce(
void *p_dm_void
);
-#endif
#endif /*PHYDM_SUPPORT_EDCA*/
diff --git a/hal/phydm/phydm_features.h b/hal/phydm/phydm_features.h
index f0b2636..514f454 100644
--- a/hal/phydm/phydm_features.h
+++ b/hal/phydm/phydm_features.h
@@ -28,162 +28,31 @@
#define PHYDM_LA_MODE_SUPPORT 0
#endif
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
+/*phydm debyg report & tools*/
+#define CONFIG_PHYDM_DEBUG_FUNCTION 1
- /*phydm debyg report & tools*/
- #define CONFIG_PHYDM_DEBUG_FUNCTION 1
+#define CONFIG_DYNAMIC_RX_PATH 0
- /*Antenna Diversity*/
+#define PHYDM_SUPPORT_EDCA 1
+#define SUPPORTABLITY_PHYDMLIZE 1
+#define RA_MASK_PHYDMLIZE_CE 1
+
+/*Antenna Diversity*/
+#ifdef CONFIG_ANTENNA_DIVERSITY
#define CONFIG_PHYDM_ANTENNA_DIVERSITY
- #ifdef CONFIG_PHYDM_ANTENNA_DIVERSITY
-
- #if (RTL8723B_SUPPORT == 1) || (RTL8821A_SUPPORT == 1) || (RTL8188F_SUPPORT == 1)
- #define CONFIG_S0S1_SW_ANTENNA_DIVERSITY
- #endif
-
- #if (RTL8821A_SUPPORT == 1) || (RTL8822B_SUPPORT == 1)
- /*#define CONFIG_HL_SMART_ANTENNA_TYPE1*/
- #define CONFIG_FAT_PATCH
- #endif
- #endif
-
- #if (RTL8822B_SUPPORT == 1)
- #define CONFIG_DYNAMIC_RX_PATH 0
- #else
- #define CONFIG_DYNAMIC_RX_PATH 0
- #endif
-
- #if (RTL8188E_SUPPORT == 1 || RTL8192E_SUPPORT == 1)
- #define CONFIG_RECEIVER_BLOCKING
- #endif
- #define PHYDM_SUPPORT_EDCA 0
- #define SUPPORTABLITY_PHYDMLIZE 1
- #define RA_MASK_PHYDMLIZE_WIN 1
- /*#define CONFIG_PATH_DIVERSITY*/
- /*#define CONFIG_RA_DYNAMIC_RTY_LIMIT*/
- #define CONFIG_ANT_DETECTION
- /*#define CONFIG_RA_DBG_CMD*/
- #define CONFIG_RA_FW_DBG_CODE 1
- /*#define CONFIG_PHYDM_RX_SNIFFER_PARSING*/
- #define CONFIG_BB_POWER_SAVING
- #define CONFIG_BB_TXBF_API
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
-
- /*phydm debyg report & tools*/
- #if defined(CONFIG_DISABLE_PHYDM_DEBUG_FUNCTION)
- #define CONFIG_PHYDM_DEBUG_FUNCTION 0
- #else
- #define CONFIG_PHYDM_DEBUG_FUNCTION 1
- #endif
-
- #if (RTL8822B_SUPPORT == 1)
- #define CONFIG_DYNAMIC_RX_PATH 0
- #else
- #define CONFIG_DYNAMIC_RX_PATH 0
- #endif
-
- #define PHYDM_SUPPORT_EDCA 1
- #define SUPPORTABLITY_PHYDMLIZE 0
- #define RA_MASK_PHYDMLIZE_AP 1
-
- /* #define CONFIG_RA_DBG_CMD*/
- #define CONFIG_RA_FW_DBG_CODE 0
-
- /*#define CONFIG_PATH_DIVERSITY*/
- /*#define CONFIG_RA_DYNAMIC_RTY_LIMIT*/
- #define CONFIG_RA_DYNAMIC_RATE_ID
- /*#define CONFIG_BB_POWER_SAVING*/
- #define CONFIG_BB_TXBF_API
-
- /* [ Configure Antenna Diversity ] */
- #if defined(CONFIG_RTL_8881A_ANT_SWITCH) || defined(CONFIG_SLOT_0_ANT_SWITCH) || defined(CONFIG_SLOT_1_ANT_SWITCH)
- #define CONFIG_PHYDM_ANTENNA_DIVERSITY
- #define ODM_EVM_ENHANCE_ANTDIV
-
- /*----------*/
-
- #if (!defined(CONFIG_NO_2G_DIVERSITY) && !defined(CONFIG_2G5G_CG_TRX_DIVERSITY_8881A) && !defined(CONFIG_2G_CGCS_RX_DIVERSITY) && !defined(CONFIG_2G_CG_TRX_DIVERSITY) && !defined(CONFIG_2G_CG_SMART_ANT_DIVERSITY))
- #define CONFIG_NO_2G_DIVERSITY
- #endif
-
- #ifdef CONFIG_NO_5G_DIVERSITY_8881A
- #define CONFIG_NO_5G_DIVERSITY
- #elif defined(CONFIG_5G_CGCS_RX_DIVERSITY_8881A)
- #define CONFIG_5G_CGCS_RX_DIVERSITY
- #elif defined(CONFIG_5G_CG_TRX_DIVERSITY_8881A)
- #define CONFIG_5G_CG_TRX_DIVERSITY
- #elif defined(CONFIG_2G5G_CG_TRX_DIVERSITY_8881A)
- #define CONFIG_2G5G_CG_TRX_DIVERSITY
- #endif
- #if (!defined(CONFIG_NO_5G_DIVERSITY) && !defined(CONFIG_5G_CGCS_RX_DIVERSITY) && !defined(CONFIG_5G_CG_TRX_DIVERSITY) && !defined(CONFIG_2G5G_CG_TRX_DIVERSITY) && !defined(CONFIG_5G_CG_SMART_ANT_DIVERSITY))
- #define CONFIG_NO_5G_DIVERSITY
- #endif
- /*----------*/
- #if (defined(CONFIG_NO_2G_DIVERSITY) && defined(CONFIG_NO_5G_DIVERSITY))
- #define CONFIG_NOT_SUPPORT_ANTDIV
- #elif (!defined(CONFIG_NO_2G_DIVERSITY) && defined(CONFIG_NO_5G_DIVERSITY))
- #define CONFIG_2G_SUPPORT_ANTDIV
- #elif (defined(CONFIG_NO_2G_DIVERSITY) && !defined(CONFIG_NO_5G_DIVERSITY))
- #define CONFIG_5G_SUPPORT_ANTDIV
- #elif ((!defined(CONFIG_NO_2G_DIVERSITY) && !defined(CONFIG_NO_5G_DIVERSITY)) || defined(CONFIG_2G5G_CG_TRX_DIVERSITY))
- #define CONFIG_2G5G_SUPPORT_ANTDIV
- #endif
- /*----------*/
- #endif
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
-
- /*phydm debyg report & tools*/
- #define CONFIG_PHYDM_DEBUG_FUNCTION 1
-
- #if (RTL8822B_SUPPORT == 1)
- #define CONFIG_DYNAMIC_RX_PATH 0
- #else
- #define CONFIG_DYNAMIC_RX_PATH 0
- #endif
-
- #define PHYDM_SUPPORT_EDCA 1
- #define SUPPORTABLITY_PHYDMLIZE 1
- #define RA_MASK_PHYDMLIZE_CE 1
-
- /*Antenna Diversity*/
- #ifdef CONFIG_ANTENNA_DIVERSITY
- #define CONFIG_PHYDM_ANTENNA_DIVERSITY
-
- #ifdef CONFIG_PHYDM_ANTENNA_DIVERSITY
-
- #if (RTL8723B_SUPPORT == 1) || (RTL8821A_SUPPORT == 1) || (RTL8188F_SUPPORT == 1)
- #define CONFIG_S0S1_SW_ANTENNA_DIVERSITY
- #endif
-
- #if (RTL8821A_SUPPORT == 1)
- /*#define CONFIG_HL_SMART_ANTENNA_TYPE1*/
- #endif
- #endif
- #endif
-
- #ifdef CONFIG_DFS_MASTER
- #define CONFIG_PHYDM_DFS_MASTER
- #endif
-
- #if (RTL8188E_SUPPORT == 1 || RTL8192E_SUPPORT == 1)
- #define CONFIG_RECEIVER_BLOCKING
- #endif
- /*#define CONFIG_RA_DBG_CMD*/
- #define CONFIG_RA_FW_DBG_CODE 0
- /*#define CONFIG_ANT_DETECTION*/
- /*#define CONFIG_PATH_DIVERSITY*/
- /*#define CONFIG_RA_DYNAMIC_RTY_LIMIT*/
- #define CONFIG_BB_POWER_SAVING
- #define CONFIG_BB_TXBF_API
-
- #ifdef CONFIG_BT_COEXIST
- #define BT_SUPPORT 1
- #endif
-
-
#endif
+#ifdef CONFIG_DFS_MASTER
+ #define CONFIG_PHYDM_DFS_MASTER
+#endif
+
+#define CONFIG_RECEIVER_BLOCKING
+#define CONFIG_RA_FW_DBG_CODE 0
+#define CONFIG_BB_POWER_SAVING
+#define CONFIG_BB_TXBF_API
+
+#ifdef CONFIG_BT_COEXIST
+ #define BT_SUPPORT 1
+#endif
#endif
diff --git a/hal/phydm/phydm_hwconfig.c b/hal/phydm/phydm_hwconfig.c
index eb4da02..1e8489c 100644
--- a/hal/phydm/phydm_hwconfig.c
+++ b/hal/phydm/phydm_hwconfig.c
@@ -86,34 +86,6 @@ odm_signal_scale_mapping_92c_series_patch_rt_cid_819x_lenovo(
)
{
s32 ret_sig = 0;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- /* if(p_dm_odm->support_interface == ODM_ITRF_PCIE) */
- {
- /* step 1. Scale mapping. */
- /* 20100611 Joseph: Re-tunning RSSI presentation for Lenovo. */
- /* 20100426 Joseph: Modify Signal strength mapping. */
- /* This modification makes the RSSI indication similar to Intel solution. */
- /* 20100414 Joseph: Tunning RSSI for Lenovo according to RTL8191SE. */
- if (curr_sig >= 54 && curr_sig <= 100)
- ret_sig = 100;
- else if (curr_sig >= 42 && curr_sig <= 53)
- ret_sig = 95;
- else if (curr_sig >= 36 && curr_sig <= 41)
- ret_sig = 74 + ((curr_sig - 36) * 20) / 6;
- else if (curr_sig >= 33 && curr_sig <= 35)
- ret_sig = 65 + ((curr_sig - 33) * 8) / 2;
- else if (curr_sig >= 18 && curr_sig <= 32)
- ret_sig = 62 + ((curr_sig - 18) * 2) / 15;
- else if (curr_sig >= 15 && curr_sig <= 17)
- ret_sig = 33 + ((curr_sig - 15) * 28) / 2;
- else if (curr_sig >= 10 && curr_sig <= 14)
- ret_sig = 39;
- else if (curr_sig >= 8 && curr_sig <= 9)
- ret_sig = 33;
- else if (curr_sig <= 8)
- ret_sig = 19;
- }
-#endif /* ENDIF (DM_ODM_SUPPORT_TYPE == ODM_WIN) */
return ret_sig;
}
@@ -124,34 +96,6 @@ odm_signal_scale_mapping_92c_series_patch_rt_cid_819x_netcore(
)
{
s32 ret_sig = 0;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- /* if(p_dm_odm->support_interface == ODM_ITRF_USB) */
- {
- /* Netcore request this modification because 2009.04.13 SU driver use it. */
- if (curr_sig >= 31 && curr_sig <= 100)
- ret_sig = 100;
- else if (curr_sig >= 21 && curr_sig <= 30)
- ret_sig = 90 + ((curr_sig - 20) / 1);
- else if (curr_sig >= 11 && curr_sig <= 20)
- ret_sig = 80 + ((curr_sig - 10) / 1);
- else if (curr_sig >= 7 && curr_sig <= 10)
- ret_sig = 69 + (curr_sig - 7);
- else if (curr_sig == 6)
- ret_sig = 54;
- else if (curr_sig == 5)
- ret_sig = 45;
- else if (curr_sig == 4)
- ret_sig = 36;
- else if (curr_sig == 3)
- ret_sig = 27;
- else if (curr_sig == 2)
- ret_sig = 18;
- else if (curr_sig == 1)
- ret_sig = 9;
- else
- ret_sig = curr_sig;
- }
-#endif /* ENDIF (DM_ODM_SUPPORT_TYPE == ODM_WIN) */
return ret_sig;
}
@@ -162,33 +106,7 @@ odm_signal_scale_mapping_92c_series(
)
{
s32 ret_sig = 0;
-#if (DEV_BUS_TYPE == RT_PCI_INTERFACE)
- if (p_dm_odm->support_interface == ODM_ITRF_PCIE) {
- /* step 1. Scale mapping. */
- if (curr_sig >= 61 && curr_sig <= 100)
- ret_sig = 90 + ((curr_sig - 60) / 4);
- else if (curr_sig >= 41 && curr_sig <= 60)
- ret_sig = 78 + ((curr_sig - 40) / 2);
- else if (curr_sig >= 31 && curr_sig <= 40)
- ret_sig = 66 + (curr_sig - 30);
- else if (curr_sig >= 21 && curr_sig <= 30)
- ret_sig = 54 + (curr_sig - 20);
- else if (curr_sig >= 5 && curr_sig <= 20)
- ret_sig = 42 + (((curr_sig - 5) * 2) / 3);
- else if (curr_sig == 4)
- ret_sig = 36;
- else if (curr_sig == 3)
- ret_sig = 27;
- else if (curr_sig == 2)
- ret_sig = 18;
- else if (curr_sig == 1)
- ret_sig = 9;
- else
- ret_sig = curr_sig;
- }
-#endif
-#if ((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
if ((p_dm_odm->support_interface == ODM_ITRF_USB) || (p_dm_odm->support_interface == ODM_ITRF_SDIO)) {
if (curr_sig >= 51 && curr_sig <= 100)
ret_sig = 100;
@@ -208,7 +126,6 @@ odm_signal_scale_mapping_92c_series(
ret_sig = curr_sig;
}
-#endif
return ret_sig;
}
s32
@@ -217,17 +134,6 @@ odm_signal_scale_mapping(
s32 curr_sig
)
{
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if ((p_dm_odm->support_platform == ODM_WIN) &&
- (p_dm_odm->support_interface != ODM_ITRF_PCIE) && /* USB & SDIO */
- (p_dm_odm->patch_id == 10)) /* p_mgnt_info->customer_id == RT_CID_819x_Netcore */
- return odm_signal_scale_mapping_92c_series_patch_rt_cid_819x_netcore(p_dm_odm, curr_sig);
- else if ((p_dm_odm->support_platform == ODM_WIN) &&
- (p_dm_odm->support_interface == ODM_ITRF_PCIE) &&
- (p_dm_odm->patch_id == 19)) /* p_mgnt_info->customer_id == RT_CID_819X_LENOVO) */
- return odm_signal_scale_mapping_92c_series_patch_rt_cid_819x_lenovo(p_dm_odm, curr_sig);
- else
-#endif
{
#ifdef CONFIG_SIGNAL_SCALE_MAPPING
return odm_signal_scale_mapping_92c_series(p_dm_odm, curr_sig);
@@ -247,84 +153,6 @@ static u8 odm_sq_process_patch_rt_cid_819x_lenovo(
)
{
u8 SQ = 0;
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-
- if (is_cck_rate) {
-
- if (IS_HARDWARE_TYPE_8192E(p_dm_odm->adapter)) {
-
- /* */
- /* Expected signal strength and bars indication at Lenovo lab. 2013.04.11 */
- /* 802.11n, 802.11b, 802.11g only at channel 6 */
- /* */
- /* Attenuation (dB) OS Signal Bars RSSI by Xirrus (dBm) */
- /* 50 5 -49 */
- /* 55 5 -49 */
- /* 60 5 -50 */
- /* 65 5 -51 */
- /* 70 5 -52 */
- /* 75 5 -54 */
- /* 80 5 -55 */
- /* 85 4 -60 */
- /* 90 3 -63 */
- /* 95 3 -65 */
- /* 100 2 -67 */
- /* 102 2 -67 */
- /* 104 1 -70 */
- /* */
-
- if (PWDB_ALL >= 50)
- SQ = 100;
- else if (PWDB_ALL >= 35 && PWDB_ALL < 50)
- SQ = 80;
- else if (PWDB_ALL >= 31 && PWDB_ALL < 35)
- SQ = 60;
- else if (PWDB_ALL >= 22 && PWDB_ALL < 31)
- SQ = 40;
- else if (PWDB_ALL >= 18 && PWDB_ALL < 22)
- SQ = 20;
- else
- SQ = 10;
- } else {
- if (PWDB_ALL >= 50)
- SQ = 100;
- else if (PWDB_ALL >= 35 && PWDB_ALL < 50)
- SQ = 80;
- else if (PWDB_ALL >= 22 && PWDB_ALL < 35)
- SQ = 60;
- else if (PWDB_ALL >= 18 && PWDB_ALL < 22)
- SQ = 40;
- else
- SQ = 10;
- }
-
- } else {
- /* OFDM rate */
-
- if (IS_HARDWARE_TYPE_8192E(p_dm_odm->adapter)) {
- if (RSSI >= 45)
- SQ = 100;
- else if (RSSI >= 22 && RSSI < 45)
- SQ = 80;
- else if (RSSI >= 18 && RSSI < 22)
- SQ = 40;
- else
- SQ = 20;
- } else {
- if (RSSI >= 45)
- SQ = 100;
- else if (RSSI >= 22 && RSSI < 45)
- SQ = 80;
- else if (RSSI >= 18 && RSSI < 22)
- SQ = 40;
- else
- SQ = 20;
- }
- }
-
- RT_TRACE(COMP_DBG, DBG_TRACE, ("is_cck_rate(%#d), PWDB_ALL(%#d), RSSI(%#d), SQ(%#d)\n", is_cck_rate, PWDB_ALL, RSSI, SQ));
-
-#endif
return SQ;
}
@@ -338,71 +166,6 @@ static u8 odm_sq_process_patch_rt_cid_819x_acer(
{
u8 SQ = 0;
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-
- if (is_cck_rate) {
-
- RT_TRACE(COMP_DBG, DBG_WARNING, ("odm_SQ_process_patch_RT_Acer\n"));
-
-#if OS_WIN_FROM_WIN8(OS_VERSION)
-
- if (PWDB_ALL >= 50)
- SQ = 100;
- else if (PWDB_ALL >= 35 && PWDB_ALL < 50)
- SQ = 80;
- else if (PWDB_ALL >= 30 && PWDB_ALL < 35)
- SQ = 60;
- else if (PWDB_ALL >= 25 && PWDB_ALL < 30)
- SQ = 40;
- else if (PWDB_ALL >= 20 && PWDB_ALL < 25)
- SQ = 20;
- else
- SQ = 10;
-#else
- if (PWDB_ALL >= 50)
- SQ = 100;
- else if (PWDB_ALL >= 35 && PWDB_ALL < 50)
- SQ = 80;
- else if (PWDB_ALL >= 30 && PWDB_ALL < 35)
- SQ = 60;
- else if (PWDB_ALL >= 25 && PWDB_ALL < 30)
- SQ = 40;
- else if (PWDB_ALL >= 20 && PWDB_ALL < 25)
- SQ = 20;
- else
- SQ = 10;
-
- if (PWDB_ALL == 0) /* Abnormal case, do not indicate the value above 20 on Win7 */
- SQ = 20;
-#endif
-
- } else {
- /* OFDM rate */
-
- if (IS_HARDWARE_TYPE_8192E(p_dm_odm->adapter)) {
- if (RSSI >= 45)
- SQ = 100;
- else if (RSSI >= 22 && RSSI < 45)
- SQ = 80;
- else if (RSSI >= 18 && RSSI < 22)
- SQ = 40;
- else
- SQ = 20;
- } else {
- if (RSSI >= 35)
- SQ = 100;
- else if (RSSI >= 30 && RSSI < 35)
- SQ = 80;
- else if (RSSI >= 25 && RSSI < 30)
- SQ = 40;
- else
- SQ = 20;
- }
- }
-
- RT_TRACE(COMP_DBG, DBG_LOUD, ("is_cck_rate(%#d), PWDB_ALL(%#d), RSSI(%#d), SQ(%#d)\n", is_cck_rate, PWDB_ALL, RSSI, SQ));
-
-#endif
return SQ;
}
@@ -724,10 +487,8 @@ odm_rx_phy_status92c_series_parsing(
}
p_phy_info->rx_pwdb_all = PWDB_ALL;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
p_phy_info->bt_rx_rssi_percentage = PWDB_ALL;
p_phy_info->recv_signal_power = rx_pwr_all;
-#endif
/* */
/* (3) Get Signal Quality (EVM) */
/* */
@@ -735,15 +496,6 @@ odm_rx_phy_status92c_series_parsing(
{
u8 SQ, SQ_rpt;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if ((p_dm_odm->support_platform == ODM_WIN) &&
- (p_dm_odm->patch_id == RT_CID_819X_LENOVO))
- SQ = odm_sq_process_patch_rt_cid_819x_lenovo(p_dm_odm, is_cck_rate, PWDB_ALL, 0, 0);
- else if ((p_dm_odm->support_platform == ODM_WIN) &&
- (p_dm_odm->patch_id == RT_CID_819X_ACER))
- SQ = odm_sq_process_patch_rt_cid_819x_acer(p_dm_odm, is_cck_rate, PWDB_ALL, 0, 0);
- else
-#endif
if (p_phy_info->rx_pwdb_all > 40 && !p_dm_odm->is_in_hct_test)
SQ = 100;
else {
@@ -791,9 +543,7 @@ odm_rx_phy_status92c_series_parsing(
/**/
}
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
p_phy_info->rx_pwr[i] = rx_pwr[i];
-#endif
/* Translate DBM to percentage. */
RSSI = odm_query_rx_pwr_percentage(rx_pwr[i]);
@@ -802,25 +552,9 @@ odm_rx_phy_status92c_series_parsing(
p_phy_info->rx_mimo_signal_strength[i] = (u8) RSSI;
-#if (DM_ODM_SUPPORT_TYPE & (/*ODM_WIN|*/ODM_CE|ODM_AP))
/* Get Rx snr value in DB */
p_phy_info->rx_snr[i] = p_dm_odm->phy_dbg_info.rx_snr_db[i] = (s32)(p_phy_sta_rpt->path_rxsnr[i] / 2);
-#endif
- /* Record Signal Strength for next packet */
- /* if(p_pktinfo->is_packet_match_bssid) */
- {
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if ((p_dm_odm->support_platform == ODM_WIN) &&
- (p_dm_odm->patch_id == RT_CID_819X_LENOVO)) {
- if (i == ODM_RF_PATH_A)
- p_phy_info->signal_quality = odm_sq_process_patch_rt_cid_819x_lenovo(p_dm_odm, is_cck_rate, PWDB_ALL, i, RSSI);
-
- } else if ((p_dm_odm->support_platform == ODM_WIN) &&
- (p_dm_odm->patch_id == RT_CID_819X_ACER))
- p_phy_info->signal_quality = odm_sq_process_patch_rt_cid_819x_acer(p_dm_odm, is_cck_rate, PWDB_ALL, 0, RSSI);
-#endif
- }
}
/* */
@@ -832,11 +566,9 @@ odm_rx_phy_status92c_series_parsing(
p_phy_info->rx_pwdb_all = PWDB_ALL;
/* ODM_RT_TRACE(p_dm_odm,ODM_COMP_RSSI_MONITOR, ODM_DBG_LOUD, ("ODM OFDM RSSI=%d\n",p_phy_info->rx_pwdb_all)); */
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
p_phy_info->bt_rx_rssi_percentage = PWDB_ALL_BT;
p_phy_info->rx_power = rx_pwr_all;
p_phy_info->recv_signal_power = rx_pwr_all;
-#endif
if ((p_dm_odm->support_platform == ODM_WIN) && (p_dm_odm->patch_id == 19)) {
/* do nothing */
@@ -872,30 +604,14 @@ odm_rx_phy_status92c_series_parsing(
odm_parsing_cfo(p_dm_odm, p_pktinfo, p_phy_sta_rpt->path_cfotail, num_ss);
}
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
/* UI BSS List signal strength(in percentage), make it good looking, from 0~100. */
/* It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp(). */
if (is_cck_rate) {
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- /* 2012/01/12 MH Use customeris signal strength from HalComRxdDesc.c/ */
- p_phy_info->signal_strength = SignalScaleProc(p_dm_odm->adapter, PWDB_ALL, true, true);
-#else
p_phy_info->signal_strength = (u8)(odm_signal_scale_mapping(p_dm_odm, PWDB_ALL));/*PWDB_ALL;*/
-#endif /*#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)*/
} else {
- if (rf_rx_num != 0) {
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- /* 2012/01/12 MH Use customeris signal strength from HalComRxdDesc.c/ */
- p_phy_info->signal_strength = SignalScaleProc(p_dm_odm->adapter, (total_rssi /= rf_rx_num), true, false);
-#else
+ if (rf_rx_num != 0)
p_phy_info->signal_strength = (u8)(odm_signal_scale_mapping(p_dm_odm, total_rssi /= rf_rx_num));
-#endif
- }
}
-#endif /*#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))*/
-
- /* dbg_print("is_cck_rate = %d, p_phy_info->rx_pwdb_all = %d, p_phy_sta_rpt->cck_agc_rpt_ofdm_cfosho_a = 0x%x\n", */
- /* is_cck_rate, p_phy_info->rx_pwdb_all, p_phy_sta_rpt->cck_agc_rpt_ofdm_cfosho_a); */
/* For 92C/92D HW (Hybrid) Antenna Diversity */
#if (defined(CONFIG_PHYDM_ANTENNA_DIVERSITY))
@@ -1110,10 +826,8 @@ odm_rx_phy_status_jaguar_series_parsing(
/* dbg_print("CCK: LNA_idx = %d, VGA_idx = %d, p_phy_info->rx_pwdb_all = %d\n", */
/* LNA_idx, VGA_idx, p_phy_info->rx_pwdb_all); */
/* } */
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
p_phy_info->bt_rx_rssi_percentage = PWDB_ALL;
p_phy_info->recv_signal_power = rx_pwr_all;
-#endif
/*(3) Get Signal Quality (EVM)*/
/*if (p_pktinfo->is_packet_match_bssid)*/
{
@@ -1170,9 +884,7 @@ odm_rx_phy_status_jaguar_series_parsing(
/* else */
/*rx_pwr[i] = ((p_phy_sta_rpt->gain_trsw[i]& 0x3F)*2) - 110; OLD FORMULA*/
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
p_phy_info->rx_pwr[i] = rx_pwr[i];
-#endif
/* Translate DBM to percentage. */
RSSI = odm_query_rx_pwr_percentage(rx_pwr[i]);
@@ -1195,24 +907,11 @@ odm_rx_phy_status_jaguar_series_parsing(
else if (p_dm_odm->support_ic_type & (ODM_RTL8814A | ODM_RTL8822B))
p_phy_info->rx_snr[i] = p_dm_odm->phy_dbg_info.rx_snr_db[i] = p_phy_sta_rpt->csi_current[i - 2] / 2;
-#if (DM_ODM_SUPPORT_TYPE != ODM_AP)
/*(2) CFO_short & CFO_tail*/
if (i < ODM_RF_PATH_C) {
p_phy_info->cfo_short[i] = odm_cfo((p_phy_sta_rpt->cfosho[i]));
p_phy_info->cfo_tail[i] = odm_cfo((p_phy_sta_rpt->cfotail[i]));
}
-#endif
- /* Record Signal Strength for next packet */
- if (p_pktinfo->is_packet_match_bssid) {
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if ((p_dm_odm->support_platform == ODM_WIN) &&
- (p_dm_odm->patch_id == RT_CID_819X_LENOVO)) {
- if (i == ODM_RF_PATH_A)
- p_phy_info->signal_quality = odm_sq_process_patch_rt_cid_819x_lenovo(p_dm_odm, is_cck_rate, PWDB_ALL, i, RSSI);
-
- }
-#endif
- }
}
/*(3)PWDB, Average PWDB calculated by hardware (for rate adaptive)*/
@@ -1227,11 +926,9 @@ odm_rx_phy_status_jaguar_series_parsing(
p_phy_info->rx_pwdb_all = PWDB_ALL;
/*ODM_RT_TRACE(p_dm_odm,ODM_COMP_RSSI_MONITOR, ODM_DBG_LOUD, ("ODM OFDM RSSI=%d\n",p_phy_info->rx_pwdb_all));*/
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
p_phy_info->bt_rx_rssi_percentage = PWDB_ALL_BT;
p_phy_info->rx_power = rx_pwr_all;
p_phy_info->recv_signal_power = rx_pwr_all;
-#endif
if ((p_dm_odm->support_platform == ODM_WIN) && (p_dm_odm->patch_id == 19)) {
/*do nothing*/
@@ -1296,9 +993,7 @@ odm_rx_phy_status_jaguar_series_parsing(
p_phy_info->signal_quality = EVM;
}
p_phy_info->rx_mimo_signal_quality[i] = EVM;
-#if (DM_ODM_SUPPORT_TYPE != ODM_AP)
p_phy_info->rx_mimo_evm_dbm[i] = evm_dbm;
-#endif
}
}
}
@@ -1310,16 +1005,10 @@ odm_rx_phy_status_jaguar_series_parsing(
}
/* dbg_print("is_cck_rate= %d, p_phy_info->signal_strength=%d % PWDB_AL=%d rf_rx_num=%d\n", is_cck_rate, p_phy_info->signal_strength, PWDB_ALL, rf_rx_num); */
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
/*UI BSS List signal strength(in percentage), make it good looking, from 0~100.*/
/*It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp().*/
if (is_cck_rate) {
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- /*2012/01/12 MH Use customeris signal strength from HalComRxdDesc.c/*/
- p_phy_info->signal_strength = SignalScaleProc(p_dm_odm->adapter, PWDB_ALL, false, true);
-#else
p_phy_info->signal_strength = (u8)(odm_signal_scale_mapping(p_dm_odm, PWDB_ALL));/*PWDB_ALL;*/
-#endif
} else {
if (rf_rx_num != 0) {
/* 2015/01 Sean, use the best two RSSI only, suggested by Ynlin and ChenYu.*/
@@ -1327,15 +1016,9 @@ odm_rx_phy_status_jaguar_series_parsing(
avg_rssi = best_rssi;
else
avg_rssi = (best_rssi + second_rssi) / 2;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- /* 2012/01/12 MH Use customeris signal strength from HalComRxdDesc.c/*/
- p_phy_info->signal_strength = SignalScaleProc(p_dm_odm->adapter, avg_rssi, false, false);
-#else
p_phy_info->signal_strength = (u8)(odm_signal_scale_mapping(p_dm_odm, avg_rssi));
-#endif
}
}
-#endif
p_dm_odm->rx_pwdb_ave = p_dm_odm->rx_pwdb_ave + p_phy_info->rx_pwdb_all;
p_dm_odm->dm_fat_table.antsel_rx_keep_0 = p_phy_sta_rpt->antidx_anta;
@@ -1377,10 +1060,6 @@ phydm_reset_rssi_for_dm(
)
{
struct sta_info *p_entry;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
-#endif
p_entry = p_dm_odm->p_odm_sta_info[station_id];
@@ -1399,17 +1078,6 @@ phydm_reset_rssi_for_dm(
p_entry->rssi_stat.is_send_rssi = RA_RSSI_STATE_INIT;
p_entry->rssi_stat.packet_map = 0;
p_entry->rssi_stat.valid_bit = 0;
-
- /*in WIN Driver: sta_ID==0->p_entry==NULL -> default port HAL_Data*/
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
- p_entry->bUsed = 0;
- if (station_id == 0) {
-
- p_hal_data->UndecoratedSmoothedPWDB = -1;
- /**/
- }
-#endif
-
}
void
@@ -1434,11 +1102,6 @@ odm_process_rssi_for_dm(
u32 weighting = 0;
u8 send_rssi_2_fw = 0;
struct sta_info *p_entry;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
- struct _FAST_ANTENNA_TRAINNING_ *p_dm_fat_table = &p_dm_odm->dm_fat_table;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
-#endif
if (p_pktinfo->station_id >= ODM_ASSOCIATE_ENTRY_NUM)
return;
@@ -1463,26 +1126,8 @@ odm_process_rssi_for_dm(
/**/
}
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
- if ((p_dm_odm->support_ability & ODM_BB_ANT_DIV) &&
- (p_dm_fat_table->enable_ctrl_frame_antdiv)
- ) {
- if (p_pktinfo->is_packet_match_bssid)
- p_dm_odm->data_frame_num++;
-
- if ((p_dm_fat_table->use_ctrl_frame_antdiv)) {
- if (!p_pktinfo->is_to_self)/*data frame + CTRL frame*/
- return;
- } else {
- if ((!p_pktinfo->is_packet_match_bssid))/*data frame only*/
- return;
- }
- } else
-#endif
- {
- if ((!p_pktinfo->is_packet_match_bssid))/*data frame only*/
- return;
- }
+ if ((!p_pktinfo->is_packet_match_bssid))/*data frame only*/
+ return;
if (p_pktinfo->is_packet_beacon)
p_dm_odm->phy_dbg_info.num_qry_beacon_pkt++;
@@ -1694,24 +1339,8 @@ odm_process_rssi_for_dm(
ODM_RT_TRACE(p_dm_odm, ODM_COMP_RSSI_MONITOR, ODM_DBG_LOUD, ("[Send to FW] PWDB = (( %d )), ofdm_pkt = (( %d )), cck_pkt = (( %d ))\n",
undecorated_smoothed_pwdb, p_entry->rssi_stat.ofdm_pkt, p_entry->rssi_stat.cck_pkt));
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
phydm_ra_rssi_rpt_wk(p_dm_odm);
-#endif
}
-
- /*in WIN Driver: sta_ID==0->p_entry==NULL -> default port HAL_Data*/
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
-
- if (p_pktinfo->station_id == 0) {
- /**/
- p_hal_data->UndecoratedSmoothedPWDB = undecorated_smoothed_pwdb;
- }
-#endif
-
- /* dbg_print("ofdm_pkt=%d, weighting=%d\n", ofdm_pkt, weighting); */
- /* dbg_print("undecorated_smoothed_ofdm=%d, undecorated_smoothed_pwdb=%d, undecorated_smoothed_cck=%d\n", */
- /* undecorated_smoothed_ofdm, undecorated_smoothed_pwdb, undecorated_smoothed_cck); */
-
}
}
@@ -1750,127 +1379,6 @@ odm_phy_status_query_jaguar_series(
odm_rx_phy_status_jaguar_series_parsing(p_dm_odm, p_phy_info, p_phy_status, p_pktinfo);
odm_process_rssi_for_dm(p_dm_odm, p_phy_info, p_pktinfo);
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- /*phydm_sbd_check(p_dm_odm);*/
-#endif
-}
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-void
-phydm_normal_driver_rx_sniffer(
- struct PHY_DM_STRUCT *p_dm_odm,
- u8 *p_desc,
- PRT_RFD_STATUS p_rt_rfd_status,
- u8 *p_drv_info,
- u8 phy_status
-)
-{
-#if (defined(CONFIG_PHYDM_RX_SNIFFER_PARSING))
- u32 *p_msg;
- u16 seq_num;
- struct _FAST_ANTENNA_TRAINNING_ *p_dm_fat_table = &p_dm_odm->dm_fat_table;
-
- if (p_rt_rfd_status->packet_report_type != NORMAL_RX)
- return;
-
- if (!p_dm_odm->is_linked) {
- if (p_rt_rfd_status->is_hw_error)
- return;
- }
-
- if (!(p_dm_fat_table->fat_state == FAT_TRAINING_STATE))
- return;
-
- if (phy_status == true) {
-
- if ((p_dm_odm->rx_pkt_type == type_block_ack) || (p_dm_odm->rx_pkt_type == type_rts) || (p_dm_odm->rx_pkt_type == type_cts))
- seq_num = 0;
- else
- seq_num = p_rt_rfd_status->seq_num;
-
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, ("%04d , %01s, rate=0x%02x, L=%04d , %s , %s",
- seq_num,
- /*p_rt_rfd_status->mac_id,*/
- ((p_rt_rfd_status->is_crc) ? "C" : (p_rt_rfd_status->is_ampdu) ? "A" : "_"),
- p_rt_rfd_status->data_rate,
- p_rt_rfd_status->length,
- ((p_rt_rfd_status->band_width == 0) ? "20M" : ((p_rt_rfd_status->band_width == 1) ? "40M" : "80M")),
- ((p_rt_rfd_status->is_ldpc) ? "LDP" : "BCC")
- ));
-
- if (p_dm_odm->rx_pkt_type == type_asoc_req) {
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , [%s]", "AS_REQ"));
- /**/
- } else if (p_dm_odm->rx_pkt_type == type_asoc_rsp) {
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , [%s]", "AS_RSP"));
- /**/
- } else if (p_dm_odm->rx_pkt_type == type_probe_req) {
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , [%s]", "PR_REQ"));
- /**/
- } else if (p_dm_odm->rx_pkt_type == type_probe_rsp) {
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , [%s]", "PR_RSP"));
- /**/
- } else if (p_dm_odm->rx_pkt_type == type_deauth) {
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , [%s]", "DEAUTH"));
- /**/
- } else if (p_dm_odm->rx_pkt_type == type_beacon) {
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , [%s]", "BEACON"));
- /**/
- } else if (p_dm_odm->rx_pkt_type == type_block_ack_req) {
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , [%s]", "BA_REQ"));
- /**/
- } else if (p_dm_odm->rx_pkt_type == type_rts) {
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , [%s]", "__RTS_"));
- /**/
- } else if (p_dm_odm->rx_pkt_type == type_cts) {
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , [%s]", "__CTS_"));
- /**/
- } else if (p_dm_odm->rx_pkt_type == type_ack) {
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , [%s]", "__ACK_"));
- /**/
- } else if (p_dm_odm->rx_pkt_type == type_block_ack) {
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , [%s]", "__BA__"));
- /**/
- } else if (p_dm_odm->rx_pkt_type == type_data) {
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , [%s]", "_DATA_"));
- /**/
- } else if (p_dm_odm->rx_pkt_type == type_data_ack) {
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , [%s]", "Data_Ack"));
- /**/
- } else if (p_dm_odm->rx_pkt_type == type_qos_data) {
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , [%s]", "QoS_Data"));
- /**/
- } else {
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , [0x%x]", p_dm_odm->rx_pkt_type));
- /**/
- }
-
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , [RSSI=%d,%d,%d,%d ]",
- p_dm_odm->RSSI_A,
- p_dm_odm->RSSI_B,
- p_dm_odm->RSSI_C,
- p_dm_odm->RSSI_D
- ));
-
- p_msg = (u32 *)p_drv_info;
-
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, (" , P-STS[28:0]=%08x-%08x-%08x-%08x-%08x-%08x-%08x\n",
- p_msg[6], p_msg[5], p_msg[4], p_msg[3], p_msg[2], p_msg[1], p_msg[1]));
- } else {
-
- ODM_RT_TRACE_F(p_dm_odm, ODM_COMP_SNIFFER, ODM_DBG_LOUD, ("%04d , %01s, rate=0x%02x, L=%04d , %s , %s\n",
- p_rt_rfd_status->seq_num,
- /*p_rt_rfd_status->mac_id,*/
- ((p_rt_rfd_status->is_crc) ? "C" : (p_rt_rfd_status->is_ampdu) ? "A" : "_"),
- p_rt_rfd_status->data_rate,
- p_rt_rfd_status->length,
- ((p_rt_rfd_status->band_width == 0) ? "20M" : ((p_rt_rfd_status->band_width == 1) ? "40M" : "80M")),
- ((p_rt_rfd_status->is_ldpc) ? "LDP" : "BCC")
- ));
- }
-
-#endif
}
#endif
@@ -1927,11 +1435,6 @@ odm_config_rf_with_header_file(
enum odm_rf_radio_path_e e_rf_path
)
{
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PMGNT_INFO p_mgnt_info = &(adapter->MgntInfo);
-#endif
-
ODM_RT_TRACE(p_dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD,
("===>odm_config_rf_with_header_file (%s)\n", (p_dm_odm->is_mp_chip) ? "MPChip" : "TestChip"));
ODM_RT_TRACE(p_dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD,
@@ -1939,85 +1442,8 @@ odm_config_rf_with_header_file(
p_dm_odm->support_platform, p_dm_odm->support_interface, p_dm_odm->board_type));
/* 1 AP doesn't use PHYDM power tracking table in these ICs */
-#if (DM_ODM_SUPPORT_TYPE != ODM_AP)
-#if (RTL8812A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8812) {
- if (config_type == CONFIG_RF_RADIO) {
- if (e_rf_path == ODM_RF_PATH_A)
- READ_AND_CONFIG_MP(8812a, _radioa);
- else if (e_rf_path == ODM_RF_PATH_B)
- READ_AND_CONFIG_MP(8812a, _radiob);
- } else if (config_type == CONFIG_RF_TXPWR_LMT) {
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN) && (DEV_BUS_TYPE == RT_PCI_INTERFACE)
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- if ((p_hal_data->EEPROMSVID == 0x17AA && p_hal_data->EEPROMSMID == 0xA811) ||
- (p_hal_data->EEPROMSVID == 0x10EC && p_hal_data->EEPROMSMID == 0xA812) ||
- (p_hal_data->EEPROMSVID == 0x10EC && p_hal_data->EEPROMSMID == 0x8812))
- READ_AND_CONFIG_MP(8812a, _txpwr_lmt_hm812a03);
- else
-#endif
- READ_AND_CONFIG_MP(8812a, _txpwr_lmt);
- }
- }
-#endif
-#if (RTL8821A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8821) {
- if (config_type == CONFIG_RF_RADIO) {
- if (e_rf_path == ODM_RF_PATH_A)
- READ_AND_CONFIG_MP(8821a, _radioa);
- } else if (config_type == CONFIG_RF_TXPWR_LMT) {
- if (p_dm_odm->support_interface == ODM_ITRF_USB) {
- if (p_dm_odm->ext_pa_5g || p_dm_odm->ext_lna_5g)
- READ_AND_CONFIG_MP(8821a, _txpwr_lmt_8811a_u_fem);
- else
- READ_AND_CONFIG_MP(8821a, _txpwr_lmt_8811a_u_ipa);
- } else {
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- if (p_mgnt_info->CustomerID == RT_CID_8821AE_ASUS_MB)
- READ_AND_CONFIG_MP(8821a, _txpwr_lmt_8821a_sar_8mm);
- else if (p_mgnt_info->CustomerID == RT_CID_ASUS_NB)
- READ_AND_CONFIG_MP(8821a, _txpwr_lmt_8821a_sar_5mm);
- else
-#endif
- READ_AND_CONFIG_MP(8821a, _txpwr_lmt_8821a);
- }
- }
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("<===8821_ODM_ConfigRFWithHeaderFile\n"));
- }
-#endif
-#if (RTL8192E_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8192E) {
- if (config_type == CONFIG_RF_RADIO) {
- if (e_rf_path == ODM_RF_PATH_A)
- READ_AND_CONFIG_MP(8192e, _radioa);
- else if (e_rf_path == ODM_RF_PATH_B)
- READ_AND_CONFIG_MP(8192e, _radiob);
- } else if (config_type == CONFIG_RF_TXPWR_LMT) {
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN) && (DEV_BUS_TYPE == RT_PCI_INTERFACE) /*Refine by Vincent Lan for 5mm SAR pwr limit*/
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
-
- if ((p_hal_data->EEPROMSVID == 0x11AD && p_hal_data->EEPROMSMID == 0x8192) ||
- (p_hal_data->EEPROMSVID == 0x11AD && p_hal_data->EEPROMSMID == 0x8193))
- READ_AND_CONFIG_MP(8192e, _txpwr_lmt_8192e_sar_5mm);
- else
-#endif
- READ_AND_CONFIG_MP(8192e, _txpwr_lmt);
- }
- }
-#endif
-#if (RTL8723D_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8723D) {
- if (config_type == CONFIG_RF_RADIO) {
- if (e_rf_path == ODM_RF_PATH_A)
- READ_AND_CONFIG_MP(8723d, _radioa);
- } else if (config_type == CONFIG_RF_TXPWR_LMT)
- READ_AND_CONFIG_MP(8723d, _txpwr_lmt);
- }
-#endif
-#endif/* (DM_ODM_SUPPORT_TYPE != ODM_AP) */
/* 1 All platforms support */
-#if (RTL8188E_SUPPORT == 1)
if (p_dm_odm->support_ic_type == ODM_RTL8188E) {
if (config_type == CONFIG_RF_RADIO) {
if (e_rf_path == ODM_RF_PATH_A)
@@ -2025,98 +1451,6 @@ odm_config_rf_with_header_file(
} else if (config_type == CONFIG_RF_TXPWR_LMT)
READ_AND_CONFIG_MP(8188e, _txpwr_lmt);
}
-#endif
-#if (RTL8723B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8723B) {
- if (config_type == CONFIG_RF_RADIO)
- READ_AND_CONFIG_MP(8723b, _radioa);
- else if (config_type == CONFIG_RF_TXPWR_LMT)
- READ_AND_CONFIG_MP(8723b, _txpwr_lmt);
- }
-#endif
-#if (RTL8814A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8814A) {
- if (config_type == CONFIG_RF_RADIO) {
- if (e_rf_path == ODM_RF_PATH_A)
- READ_AND_CONFIG_MP(8814a, _radioa);
- else if (e_rf_path == ODM_RF_PATH_B)
- READ_AND_CONFIG_MP(8814a, _radiob);
- else if (e_rf_path == ODM_RF_PATH_C)
- READ_AND_CONFIG_MP(8814a, _radioc);
- else if (e_rf_path == ODM_RF_PATH_D)
- READ_AND_CONFIG_MP(8814a, _radiod);
- } else if (config_type == CONFIG_RF_TXPWR_LMT) {
- if (p_dm_odm->rfe_type == 0)
- READ_AND_CONFIG_MP(8814a,_txpwr_lmt);
- else if (p_dm_odm->rfe_type == 1)
- READ_AND_CONFIG_MP(8814a,_txpwr_lmt_type1);
- else if (p_dm_odm->rfe_type == 2)
- READ_AND_CONFIG_MP(8814a,_txpwr_lmt_type2);
- else if (p_dm_odm->rfe_type == 3)
- READ_AND_CONFIG_MP(8814a,_txpwr_lmt_type3);
- else if (p_dm_odm->rfe_type == 5)
- READ_AND_CONFIG_MP(8814a,_txpwr_lmt_type5);
- else if (p_dm_odm->rfe_type == 7)
- READ_AND_CONFIG_MP(8814a,_txpwr_lmt_type7);
- else
- READ_AND_CONFIG_MP(8814a,_txpwr_lmt);
- }
- }
-#endif
-#if (RTL8703B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8703B) {
- if (config_type == CONFIG_RF_RADIO) {
- if (e_rf_path == ODM_RF_PATH_A)
- READ_AND_CONFIG_MP(8703b, _radioa);
- }
- }
-#endif
-#if (RTL8188F_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8188F) {
- if (config_type == CONFIG_RF_RADIO) {
- if (e_rf_path == ODM_RF_PATH_A)
- READ_AND_CONFIG_MP(8188f, _radioa);
- } else if (config_type == CONFIG_RF_TXPWR_LMT)
- READ_AND_CONFIG_MP(8188f, _txpwr_lmt);
- }
-#endif
-#if (RTL8822B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8822B) {
- if (config_type == CONFIG_RF_RADIO) {
- if (e_rf_path == ODM_RF_PATH_A)
- READ_AND_CONFIG_MP(8822b, _radioa);
- else if (e_rf_path == ODM_RF_PATH_B)
- READ_AND_CONFIG_MP(8822b, _radiob);
- } else if (config_type == CONFIG_RF_TXPWR_LMT) {
- if (p_dm_odm->rfe_type == 5)
- READ_AND_CONFIG_MP(8822b, _txpwr_lmt_type5);
- else
- READ_AND_CONFIG_MP(8822b, _txpwr_lmt);
- }
- }
-#endif
-
-#if (RTL8197F_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8197F) {
- if (config_type == CONFIG_RF_RADIO) {
- if (e_rf_path == ODM_RF_PATH_A)
- READ_AND_CONFIG_MP(8197f, _radioa);
- else if (e_rf_path == ODM_RF_PATH_B)
- READ_AND_CONFIG_MP(8197f, _radiob);
- }
- }
-#endif
-
-#if (RTL8821C_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8821C) {
- if (config_type == CONFIG_RF_RADIO) {
- if (e_rf_path == ODM_RF_PATH_A)
- READ_AND_CONFIG(8821c, _radioa);
- } else if (config_type == CONFIG_RF_TXPWR_LMT)
- READ_AND_CONFIG(8821c, _txpwr_lmt);
- }
-#endif
-
return HAL_STATUS_SUCCESS;
}
@@ -2132,53 +1466,6 @@ odm_config_rf_with_tx_pwr_track_header_file(
p_dm_odm->support_platform, p_dm_odm->support_interface, p_dm_odm->board_type));
/* 1 AP doesn't use PHYDM power tracking table in these ICs */
-#if (DM_ODM_SUPPORT_TYPE != ODM_AP)
-#if RTL8821A_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8821) {
- if (p_dm_odm->support_interface == ODM_ITRF_PCIE)
- READ_AND_CONFIG_MP(8821a, _txpowertrack_pcie);
- else if (p_dm_odm->support_interface == ODM_ITRF_USB)
- READ_AND_CONFIG_MP(8821a, _txpowertrack_usb);
- else if (p_dm_odm->support_interface == ODM_ITRF_SDIO)
- READ_AND_CONFIG_MP(8821a, _txpowertrack_sdio);
- }
-#endif
-#if RTL8812A_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8812) {
- if (p_dm_odm->support_interface == ODM_ITRF_PCIE)
- READ_AND_CONFIG_MP(8812a, _txpowertrack_pcie);
- else if (p_dm_odm->support_interface == ODM_ITRF_USB) {
- if (p_dm_odm->rfe_type == 3 && p_dm_odm->is_mp_chip)
- READ_AND_CONFIG_MP(8812a, _txpowertrack_rfe3);
- else
- READ_AND_CONFIG_MP(8812a, _txpowertrack_usb);
- }
-
- }
-#endif
-#if RTL8192E_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8192E) {
- if (p_dm_odm->support_interface == ODM_ITRF_PCIE)
- READ_AND_CONFIG_MP(8192e, _txpowertrack_pcie);
- else if (p_dm_odm->support_interface == ODM_ITRF_USB)
- READ_AND_CONFIG_MP(8192e, _txpowertrack_usb);
- else if (p_dm_odm->support_interface == ODM_ITRF_SDIO)
- READ_AND_CONFIG_MP(8192e, _txpowertrack_sdio);
- }
-#endif
-#if RTL8723D_SUPPORT
- if (p_dm_odm->support_ic_type == ODM_RTL8723D) {
- if (p_dm_odm->support_interface == ODM_ITRF_PCIE)
- READ_AND_CONFIG_MP(8723d, _txpowertrack_pcie);
- else if (p_dm_odm->support_interface == ODM_ITRF_USB)
- READ_AND_CONFIG_MP(8723d, _txpowertrack_usb);
- else if (p_dm_odm->support_interface == ODM_ITRF_SDIO)
- READ_AND_CONFIG_MP(8723d, _txpowertrack_sdio);
-
- READ_AND_CONFIG_MP(8723d, _txxtaltrack);
- }
-#endif
-#if RTL8188E_SUPPORT
if (p_dm_odm->support_ic_type == ODM_RTL8188E) {
if (odm_get_mac_reg(p_dm_odm, 0xF0, 0xF000) >= 8) { /*if 0xF0[15:12] >= 8, SMIC*/
if (p_dm_odm->support_interface == ODM_ITRF_PCIE)
@@ -2197,8 +1484,6 @@ odm_config_rf_with_tx_pwr_track_header_file(
}
}
-#endif
-#endif/* (DM_ODM_SUPPORT_TYPE != ODM_AP) */
/* 1 All platforms support */
#if RTL8723B_SUPPORT
@@ -2295,71 +1580,7 @@ odm_config_bb_with_header_file(
enum odm_bb_config_type config_type
)
{
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PMGNT_INFO p_mgnt_info = &(adapter->MgntInfo);
-#endif
-
- /* 1 AP doesn't use PHYDM initialization in these ICs */
-#if (RTL8812A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8812) {
- if (config_type == CONFIG_BB_PHY_REG)
- READ_AND_CONFIG_MP(8812a, _phy_reg);
- else if (config_type == CONFIG_BB_AGC_TAB)
- READ_AND_CONFIG_MP(8812a, _agc_tab);
- else if (config_type == CONFIG_BB_PHY_REG_PG) {
- if (p_dm_odm->rfe_type == 3 && p_dm_odm->is_mp_chip)
- READ_AND_CONFIG_MP(8812a, _phy_reg_pg_asus);
- else
- READ_AND_CONFIG_MP(8812a, _phy_reg_pg);
- } else if (config_type == CONFIG_BB_PHY_REG_MP)
- READ_AND_CONFIG_MP(8812a, _phy_reg_mp);
- else if (config_type == CONFIG_BB_AGC_TAB_DIFF) {
- if ((36 <= *p_dm_odm->p_channel) && (*p_dm_odm->p_channel <= 64))
- AGC_DIFF_CONFIG_MP(8812a, lb);
- else if (100 <= *p_dm_odm->p_channel)
- AGC_DIFF_CONFIG_MP(8812a, hb);
- }
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() phy:Rtl8812AGCTABArray\n"));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() agc:Rtl8812PHY_REGArray\n"));
- }
-#if (RTL8821A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8821) {
- if (config_type == CONFIG_BB_PHY_REG)
- READ_AND_CONFIG_MP(8821a, _phy_reg);
- else if (config_type == CONFIG_BB_AGC_TAB)
- READ_AND_CONFIG_MP(8821a, _agc_tab);
- else if (config_type == CONFIG_BB_PHY_REG_PG) {
- READ_AND_CONFIG_MP(8821a, _phy_reg_pg);
- }
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() phy:Rtl8821AGCTABArray\n"));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD, (" ===> phy_ConfigBBWithHeaderFile() agc:Rtl8821PHY_REGArray\n"));
- }
-#endif
-#if (RTL8192E_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8192E) {
- if (config_type == CONFIG_BB_PHY_REG)
- READ_AND_CONFIG_MP(8192e, _phy_reg);
- else if (config_type == CONFIG_BB_AGC_TAB)
- READ_AND_CONFIG_MP(8192e, _agc_tab);
- else if (config_type == CONFIG_BB_PHY_REG_PG)
- READ_AND_CONFIG_MP(8192e, _phy_reg_pg);
- }
-#endif
-#if (RTL8723D_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8723D) {
- if (config_type == CONFIG_BB_PHY_REG)
- READ_AND_CONFIG_MP(8723d, _phy_reg);
- else if (config_type == CONFIG_BB_AGC_TAB)
- READ_AND_CONFIG_MP(8723d, _agc_tab);
- else if (config_type == CONFIG_BB_PHY_REG_PG)
- READ_AND_CONFIG_MP(8723d, _phy_reg_pg);
- }
-#endif
-#endif/* (DM_ODM_SUPPORT_TYPE != ODM_AP) */
-
/* 1 All platforms support */
-#if (RTL8188E_SUPPORT == 1)
if (p_dm_odm->support_ic_type == ODM_RTL8188E) {
if (config_type == CONFIG_BB_PHY_REG)
READ_AND_CONFIG_MP(8188e, _phy_reg);
@@ -2368,122 +1589,6 @@ odm_config_bb_with_header_file(
else if (config_type == CONFIG_BB_PHY_REG_PG)
READ_AND_CONFIG_MP(8188e, _phy_reg_pg);
}
-#endif
-#if (RTL8723B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8723B) {
- if (config_type == CONFIG_BB_PHY_REG)
- READ_AND_CONFIG_MP(8723b, _phy_reg);
- else if (config_type == CONFIG_BB_AGC_TAB)
- READ_AND_CONFIG_MP(8723b, _agc_tab);
- else if (config_type == CONFIG_BB_PHY_REG_PG)
- READ_AND_CONFIG_MP(8723b, _phy_reg_pg);
- }
-#endif
-#if (RTL8814A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8814A) {
- if (config_type == CONFIG_BB_PHY_REG)
- READ_AND_CONFIG_MP(8814a, _phy_reg);
- else if (config_type == CONFIG_BB_AGC_TAB)
- READ_AND_CONFIG_MP(8814a, _agc_tab);
- else if (config_type == CONFIG_BB_PHY_REG_PG) {
- if (p_dm_odm->rfe_type == 0)
- READ_AND_CONFIG_MP(8814a,_phy_reg_pg);
- else if (p_dm_odm->rfe_type == 2)
- READ_AND_CONFIG_MP(8814a,_phy_reg_pg_type2);
- else if (p_dm_odm->rfe_type == 3)
- READ_AND_CONFIG_MP(8814a,_phy_reg_pg_type3);
- else if (p_dm_odm->rfe_type == 4)
- READ_AND_CONFIG_MP(8814a,_phy_reg_pg_type4);
- else if (p_dm_odm->rfe_type == 5)
- READ_AND_CONFIG_MP(8814a,_phy_reg_pg_type5);
- else if (p_dm_odm->rfe_type == 7)
- READ_AND_CONFIG_MP(8814a,_phy_reg_pg_type7);
- else
- READ_AND_CONFIG_MP(8814a,_phy_reg_pg);
- }
- else if (config_type == CONFIG_BB_PHY_REG_MP)
- READ_AND_CONFIG_MP(8814a, _phy_reg_mp);
- }
-#endif
-#if (RTL8703B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8703B) {
- if (config_type == CONFIG_BB_PHY_REG)
- READ_AND_CONFIG_MP(8703b, _phy_reg);
- else if (config_type == CONFIG_BB_AGC_TAB)
- READ_AND_CONFIG_MP(8703b, _agc_tab);
- else if (config_type == CONFIG_BB_PHY_REG_PG)
- READ_AND_CONFIG_MP(8703b, _phy_reg_pg);
- }
-#endif
-#if (RTL8188F_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8188F) {
- if (config_type == CONFIG_BB_PHY_REG)
- READ_AND_CONFIG_MP(8188f, _phy_reg);
- else if (config_type == CONFIG_BB_AGC_TAB)
- READ_AND_CONFIG_MP(8188f, _agc_tab);
- else if (config_type == CONFIG_BB_PHY_REG_PG)
- READ_AND_CONFIG_MP(8188f, _phy_reg_pg);
- }
-#endif
-#if (RTL8822B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8822B) {
- if (config_type == CONFIG_BB_PHY_REG)
- READ_AND_CONFIG_MP(8822b, _phy_reg);
- else if (config_type == CONFIG_BB_AGC_TAB)
- READ_AND_CONFIG_MP(8822b, _agc_tab);
- else if (config_type == CONFIG_BB_PHY_REG_PG)
- READ_AND_CONFIG_MP(8822b, _phy_reg_pg);
- /*else if (config_type == CONFIG_BB_PHY_REG_MP)*/
- /*READ_AND_CONFIG_MP(8822b, _phy_reg_mp);*/
- }
-#endif
-
-#if (RTL8197F_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8197F) {
- if (config_type == CONFIG_BB_PHY_REG) {
- READ_AND_CONFIG_MP(8197f, _phy_reg);
- if (p_dm_odm->cut_version == ODM_CUT_A)
- phydm_phypara_a_cut(p_dm_odm);
- } else if (config_type == CONFIG_BB_AGC_TAB)
- READ_AND_CONFIG_MP(8197f, _agc_tab);
- /* else if(config_type == CONFIG_BB_PHY_REG_PG)
- READ_AND_CONFIG_MP(8197f, _phy_reg_pg);
- else if(config_type == CONFIG_BB_PHY_REG_MP)
- READ_AND_CONFIG_MP(8197f, _phy_reg_mp); */
- }
-#endif
-
-#if (RTL8821C_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8821C) {
- if (config_type == CONFIG_BB_PHY_REG)
- READ_AND_CONFIG(8821c, _phy_reg);
- else if (config_type == CONFIG_BB_AGC_TAB) {
- READ_AND_CONFIG(8821c, _agc_tab);
- /* According to RFEtype, choosing correct AGC table*/
- if (p_dm_odm->rfe_type == 2 || p_dm_odm->rfe_type == 4 || p_dm_odm->rfe_type == 7)
- AGC_DIFF_CONFIG_MP(8821c, btg);
- } else if (config_type == CONFIG_BB_PHY_REG_PG)
- READ_AND_CONFIG(8821c, _phy_reg_pg);
- else if (config_type == CONFIG_BB_AGC_TAB_DIFF) {
- if (p_dm_odm->current_rf_set_8821c == SWITCH_TO_BTG)
- AGC_DIFF_CONFIG_MP(8821c, btg);
- else if (p_dm_odm->current_rf_set_8821c == SWITCH_TO_WLG)
- AGC_DIFF_CONFIG_MP(8821c, wlg);
- }
- }
-#endif
-
-#if (RTL8195A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8195A) {
- if (config_type == CONFIG_BB_PHY_REG)
- READ_AND_CONFIG(8195a, _phy_reg);
- else if (config_type == CONFIG_BB_AGC_TAB)
- READ_AND_CONFIG(8195a, _agc_tab);
- else if (config_type == CONFIG_BB_PHY_REG_PG)
- READ_AND_CONFIG(8195a, _phy_reg_pg);
- }
-#endif
-
return HAL_STATUS_SUCCESS;
}
@@ -2492,80 +1597,15 @@ odm_config_mac_with_header_file(
struct PHY_DM_STRUCT *p_dm_odm
)
{
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
-#endif
-
ODM_RT_TRACE(p_dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD,
("===>odm_config_mac_with_header_file (%s)\n", (p_dm_odm->is_mp_chip) ? "MPChip" : "TestChip"));
ODM_RT_TRACE(p_dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD,
("p_dm_odm->support_platform: 0x%X, p_dm_odm->support_interface: 0x%X, p_dm_odm->board_type: 0x%X\n",
p_dm_odm->support_platform, p_dm_odm->support_interface, p_dm_odm->board_type));
- /* 1 AP doesn't use PHYDM initialization in these ICs */
-#if (DM_ODM_SUPPORT_TYPE != ODM_AP)
-#if (RTL8812A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8812)
- READ_AND_CONFIG_MP(8812a, _mac_reg);
-#endif
-#if (RTL8821A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8821) {
- READ_AND_CONFIG_MP(8821a, _mac_reg);
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("<===8821_ODM_ConfigMACwithHeaderFile\n"));
- }
-#endif
-#if (RTL8192E_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8192E)
- READ_AND_CONFIG_MP(8192e, _mac_reg);
-#endif
-#if (RTL8723D_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8723D)
- READ_AND_CONFIG_MP(8723d, _mac_reg);
-#endif
-#endif/* (DM_ODM_SUPPORT_TYPE != ODM_AP) */
-
/* 1 All platforms support */
-#if (RTL8188E_SUPPORT == 1)
if (p_dm_odm->support_ic_type == ODM_RTL8188E)
READ_AND_CONFIG_MP(8188e, _mac_reg);
-#endif
-#if (RTL8723B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8723B)
- READ_AND_CONFIG_MP(8723b, _mac_reg);
-#endif
-#if (RTL8814A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8814A)
- READ_AND_CONFIG_MP(8814a, _mac_reg);
-#endif
-#if (RTL8703B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8703B)
- READ_AND_CONFIG_MP(8703b, _mac_reg);
-#endif
-#if (RTL8188F_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8188F)
- READ_AND_CONFIG_MP(8188f, _mac_reg);
-#endif
-#if (RTL8822B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8822B)
- READ_AND_CONFIG_MP(8822b, _mac_reg);
-#endif
-
-#if (RTL8197F_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8197F)
- READ_AND_CONFIG_MP(8197f, _mac_reg);
-#endif
-
-#if (RTL8821C_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8821C)
- READ_AND_CONFIG(8821c, _mac_reg);
-#endif
-
-#if (RTL8195A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8195A)
- READ_AND_CONFIG_MP(8195a, _mac_reg);
-#endif
-
return HAL_STATUS_SUCCESS;
}
@@ -2577,195 +1617,6 @@ odm_config_fw_with_header_file(
u32 *p_size
)
{
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-
-#if (RTL8188E_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8188E) {
-#ifdef CONFIG_SFW_SUPPORTED
- if (config_type == CONFIG_FW_NIC)
- READ_FIRMWARE_MP(8188e_t, _fw_nic);
- else if (config_type == CONFIG_FW_WOWLAN)
- READ_FIRMWARE_MP(8188e_t, _fw_wowlan);
- else if (config_type == CONFIG_FW_NIC_2)
- READ_FIRMWARE_MP(8188e_s, _fw_nic);
- else if (config_type == CONFIG_FW_WOWLAN_2)
- READ_FIRMWARE_MP(8188e_s, _fw_wowlan);
-#ifdef CONFIG_AP_WOWLAN
- if (config_type == CONFIG_FW_AP)
- READ_FIRMWARE_MP(8188e_t, _fw_ap);
- else if (config_type == CONFIG_FW_AP_2)
- READ_FIRMWARE_MP(8188e_s, _fw_ap);
-#endif /* CONFIG_AP_WOWLAN */
-#else
- if (config_type == CONFIG_FW_NIC)
- READ_FIRMWARE_MP(8188e_t, _fw_nic);
- else if (config_type == CONFIG_FW_WOWLAN)
- READ_FIRMWARE_MP(8188e_t, _fw_wowlan);
-#ifdef CONFIG_AP_WOWLAN
- else if (config_type == CONFIG_FW_AP)
- READ_FIRMWARE_MP(8188e_t, _fw_ap);
-#endif /* CONFIG_AP_WOWLAN */
-#endif
- }
-#endif
-#if (RTL8723B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8723B) {
- if (config_type == CONFIG_FW_NIC)
- READ_FIRMWARE_MP(8723b, _fw_nic);
- else if (config_type == CONFIG_FW_WOWLAN)
- READ_FIRMWARE_MP(8723b, _fw_wowlan);
-#ifdef CONFIG_AP_WOWLAN
- else if (config_type == config_fw_ap_wowlan)
- READ_FIRMWARE(8723b, _fw_ap);
-#endif
-
- }
-#endif /* #if (RTL8723B_SUPPORT == 1) */
-#if (RTL8812A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8812) {
- if (config_type == CONFIG_FW_NIC)
- READ_FIRMWARE_MP(8812a, _fw_nic);
- else if (config_type == CONFIG_FW_WOWLAN)
- READ_FIRMWARE_MP(8812a, _fw_wowlan);
- else if (config_type == CONFIG_FW_BT)
- READ_FIRMWARE_MP(8812a, _fw_nic_bt);
-#ifdef CONFIG_AP_WOWLAN
- else if (config_type == config_fw_ap_wowlan)
- READ_FIRMWARE(8812a, _fw_ap);
-#endif
- }
-#endif
-#if (RTL8821A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8821) {
- if (config_type == CONFIG_FW_NIC)
- READ_FIRMWARE_MP(8821a, _fw_nic);
- else if (config_type == CONFIG_FW_WOWLAN)
- READ_FIRMWARE_MP(8821a, _fw_wowlan);
-#ifdef CONFIG_AP_WOWLAN
- else if (config_type == config_fw_ap_wowlan)
- READ_FIRMWARE_MP(8821a, _fw_ap);
-#endif /*CONFIG_AP_WOWLAN*/
- else if (config_type == CONFIG_FW_BT)
- READ_FIRMWARE_MP(8821a, _fw_nic_bt);
- }
-#endif
-#if (RTL8192E_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8192E) {
- if (config_type == CONFIG_FW_NIC)
- READ_FIRMWARE_MP(8192e, _fw_nic);
- else if (config_type == CONFIG_FW_WOWLAN)
- READ_FIRMWARE_MP(8192e, _fw_wowlan);
-#ifdef CONFIG_AP_WOWLAN
- else if (config_type == config_fw_ap_wowlan)
- READ_FIRMWARE_MP(8192e, _fw_ap);
-#endif
- }
-#endif
-#if (RTL8723D_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8723D) {
- if (config_type == CONFIG_FW_NIC)
- READ_FIRMWARE_MP(8723d, _fw_nic);
- else if (config_type == CONFIG_FW_WOWLAN) {
- READ_FIRMWARE_MP(8723d, _fw_wowlan);
-#ifdef CONFIG_AP_WOWLAN
- else if (config_type == config_fw_ap_wowlan)
- READ_FIRMWARE_MP(8723d, _fw_ap);
-#endif
- }
- }
-#endif
- /*#if (RTL8814A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8814A)
- {
- if (config_type == CONFIG_FW_NIC)
- READ_FIRMWARE_MP(8814a, _fw_nic);
- else if (config_type == config_fw_wowlan)
- READ_FIRMWARE_MP(8814a, _fw_wowlan);
- #ifdef CONFIG_AP_WOWLAN
- else if (config_type == config_fw_ap_wowlan)
- READ_FIRMWARE_MP(8814a, _fw_ap);
- #endif
- }
- #endif */
-
-#if (RTL8814A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8814A) {
- if (config_type == CONFIG_FW_NIC)
- READ_FIRMWARE_MP(8814a, _fw_nic);
-#ifdef CONFIG_AP_WOWLAN
- else if (config_type == config_fw_ap_wowlan)
- READ_FIRMWARE_MP(8814a, _fw_ap);
-#endif
- }
-#endif
-
-#if (RTL8703B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8703B) {
- if (config_type == CONFIG_FW_NIC)
- READ_FIRMWARE_MP(8703b, _fw_nic);
- else if (config_type == CONFIG_FW_WOWLAN)
- READ_FIRMWARE_MP(8703b, _fw_wowlan);
-#ifdef CONFIG_AP_WOWLAN
- else if (config_type == config_fw_ap_wowlan)
- READ_FIRMWARE(8703b, _fw_ap);
-#endif
- }
-#endif
-
-#if (RTL8188F_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8188F) {
- if (config_type == CONFIG_FW_NIC)
- READ_FIRMWARE_MP(8188f, _fw_nic);
- else if (config_type == CONFIG_FW_WOWLAN)
- READ_FIRMWARE_MP(8188f, _fw_wowlan);
-#ifdef CONFIG_AP_WOWLAN
- else if (config_type == CONFIG_FW_AP)
- READ_FIRMWARE_MP(8188f, _fw_ap);
-#endif
- }
-#endif
-
-#if (RTL8822B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8822B) {
-
- if (config_type == CONFIG_FW_NIC)
- READ_FIRMWARE_MP(8822b, _fw_nic);
- else if (config_type == CONFIG_FW_WOWLAN)
- READ_FIRMWARE_MP(8822b, _fw_wowlan);
-#ifdef CONFIG_AP_WOWLAN
- else if (config_type == config_fw_ap_wowlan)
- READ_FIRMWARE(8822b, _fw_ap);
-#endif
- }
-#endif
-
-#if (RTL8197F_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8197F) {
- if (config_type == CONFIG_FW_NIC)
- READ_FIRMWARE_MP(8197f, _fw_nic);
-#ifdef CONFIG_AP_WOWLAN
- else if (config_type == config_fw_ap_wowlan)
- READ_FIRMWARE(8197f, _fw_ap);
-#endif
- }
-#endif
-
-#if ((DM_ODM_SUPPORT_TYPE == ODM_WIN))
-#if (RTL8821C_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8821C) {
- if (config_type == CONFIG_FW_NIC)
- READ_FIRMWARE_MP(8821c, _fw_nic);
- else if (config_type == CONFIG_FW_WOWLAN)
- READ_FIRMWARE_MP(8821c, _fw_wowlan);
-#ifdef CONFIG_AP_WOWLAN
- else if (config_type == config_fw_ap_wowlan)
- READ_FIRMWARE_MP(8821c, _fw_ap);
-#endif /*CONFIG_AP_WOWLAN*/
- }
-#endif
-#endif
-
-#endif/* (DM_ODM_SUPPORT_TYPE != ODM_AP) */
return HAL_STATUS_SUCCESS;
}
@@ -2776,62 +1627,9 @@ odm_get_hw_img_version(
{
u32 version = 0;
- /* 1 AP doesn't use PHYDM initialization in these ICs */
-#if (DM_ODM_SUPPORT_TYPE != ODM_AP)
-#if (RTL8821A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8821)
- version = GET_VERSION_MP(8821a, _mac_reg);
-#endif
-#if (RTL8192E_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8192E)
- version = GET_VERSION_MP(8192e, _mac_reg);
-#endif
-#if (RTL8812A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8812)
- version = GET_VERSION_MP(8812a, _mac_reg);
-#endif
-#if (RTL8723D_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8723D)
- version = GET_VERSION_MP(8723d, _mac_reg);
-#endif
-#endif /* (DM_ODM_SUPPORT_TYPE != ODM_AP) */
-
/*1 All platforms support*/
-#if (RTL8188E_SUPPORT == 1)
if (p_dm_odm->support_ic_type == ODM_RTL8188E)
version = GET_VERSION_MP(8188e, _mac_reg);
-#endif
-#if (RTL8723B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8723B)
- version = GET_VERSION_MP(8723b, _mac_reg);
-#endif
-#if (RTL8814A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8814A)
- version = GET_VERSION_MP(8814a, _mac_reg);
-#endif
-#if (RTL8703B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8703B)
- version = GET_VERSION_MP(8703b, _mac_reg);
-#endif
-#if (RTL8188F_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8188F)
- version = GET_VERSION_MP(8188f, _mac_reg);
-#endif
-#if (RTL8822B_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8822B)
- version = GET_VERSION_MP(8822b, _mac_reg);
-#endif
-
-#if (RTL8197F_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8197F)
- version = GET_VERSION_MP(8197f, _mac_reg);
-#endif
-
-#if (RTL8821C_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8821C)
- version = GET_VERSION(8821c, _mac_reg);
-#endif
-
return version;
}
@@ -2907,7 +1705,6 @@ phydm_reset_phy_info(
odm_memory_set(p_phydm, p_phy_info->rx_mimo_signal_strength, 0, 4);
odm_memory_set(p_phydm, p_phy_info->rx_snr, 0, 4);
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
p_phy_info->rx_power = -110;
p_phy_info->recv_signal_power = -110;
p_phy_info->bt_rx_rssi_percentage = 0;
@@ -2921,7 +1718,6 @@ phydm_reset_phy_info(
odm_memory_set(p_phydm, p_phy_info->rx_mimo_evm_dbm, 0, 4);
odm_memory_set(p_phydm, p_phy_info->cfo_short, 0, 8);
odm_memory_set(p_phydm, p_phy_info->cfo_tail, 0, 8);
-#endif
}
void
@@ -2950,7 +1746,6 @@ phydm_set_per_path_phy_info(
evm_percentage = (evm_dbm << 1) + (evm_dbm);
}
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
p_phy_info->rx_pwr[rx_path] = rx_pwr;
p_phy_info->rx_mimo_evm_dbm[rx_path] = evm_dbm;
@@ -2958,7 +1753,6 @@ phydm_set_per_path_phy_info(
p_phy_info->cfo_tail[rx_path] = cfo_tail;
p_phy_info->cfo_tail[rx_path] = ((p_phy_info->cfo_tail[rx_path] << 5) + (p_phy_info->cfo_tail[rx_path] << 2) +
(p_phy_info->cfo_tail[rx_path] << 1) + (p_phy_info->cfo_tail[rx_path])) >> 9;
-#endif
p_phy_info->rx_mimo_signal_strength[rx_path] = odm_query_rx_pwr_percentage(rx_pwr);
p_phy_info->rx_mimo_signal_quality[rx_path] = evm_percentage;
@@ -2977,14 +1771,12 @@ phydm_set_common_phy_info(
struct _odm_phy_status_info_ *p_phy_info
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
p_phy_info->rx_power = rx_power; /* RSSI in dB */
p_phy_info->recv_signal_power = rx_power; /* RSSI in dB */
p_phy_info->channel = channel; /* channel number */
p_phy_info->is_beamformed = is_beamformed; /* apply BF */
p_phy_info->is_mu_packet = is_mu_packet; /* MU packet */
p_phy_info->rxsc = rxsc;
-#endif
p_phy_info->rx_pwdb_all = odm_query_rx_pwr_percentage(rx_power); /* RSSI in percentage */
p_phy_info->signal_quality = signal_quality; /* signal quality */
p_phy_info->band_width = bandwidth; /* bandwidth */
@@ -3357,20 +2149,10 @@ phydm_process_rssi_for_dm_new_type(
undecorated_smoothed_pwdb = (accumulate_pwdb + (1 << (scaling_factor - 1))) >> scaling_factor;
}
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
if (p_entry->rssi_stat.undecorated_smoothed_pwdb == -1)
phydm_ra_rssi_rpt_wk(p_dm_odm);
-#endif
p_entry->rssi_stat.undecorated_smoothed_pwdb = undecorated_smoothed_pwdb;
p_dm_odm->accumulate_pwdb[p_pktinfo->station_id] = accumulate_pwdb;
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
- if (p_pktinfo->station_id == 0) {
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(p_dm_odm->adapter);
-
- p_hal_data->UndecoratedSmoothedPWDB = undecorated_smoothed_pwdb;
- }
-#endif
}
}
@@ -3384,8 +2166,6 @@ phydm_rx_phy_status_new_type(
{
u8 phy_status_type = (*p_phy_status & 0xf);
- /*dbg_print("phydm_rx_phy_status_new_type================> (page: %d)\n", phy_status_type);*/
-
/* Memory reset */
phydm_reset_phy_info(p_phydm, p_phy_info);
@@ -3405,11 +2185,7 @@ phydm_rx_phy_status_new_type(
}
/* Update signal strength to UI, and p_phy_info->rx_pwdb_all is the maximum RSSI of all path */
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- p_phy_info->signal_strength = SignalScaleProc(p_phydm->adapter, p_phy_info->rx_pwdb_all, false, false);
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
p_phy_info->signal_strength = (u8)(odm_signal_scale_mapping(p_phydm, p_phy_info->rx_pwdb_all));
-#endif
/* Calculate average RSSI and smoothed RSSI */
phydm_process_rssi_for_dm_new_type(p_phydm, p_phy_info, p_pktinfo);
diff --git a/hal/phydm/phydm_hwconfig.h b/hal/phydm/phydm_hwconfig.h
index 572e21d..3c7d594 100644
--- a/hal/phydm/phydm_hwconfig.h
+++ b/hal/phydm/phydm_hwconfig.h
@@ -195,17 +195,6 @@ odm_init_rssi_for_dm(
struct PHY_DM_STRUCT *p_dm_odm
);
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-void
-phydm_normal_driver_rx_sniffer(
- struct PHY_DM_STRUCT *p_dm_odm,
- u8 *p_desc,
- PRT_RFD_STATUS p_rt_rfd_status,
- u8 *p_drv_info,
- u8 phy_status
-);
-#endif
-
void
odm_phy_status_query(
struct PHY_DM_STRUCT *p_dm_odm,
diff --git a/hal/phydm/phydm_interface.c b/hal/phydm/phydm_interface.c
index 9f5b831..4150100 100644
--- a/hal/phydm/phydm_interface.c
+++ b/hal/phydm/phydm_interface.c
@@ -35,60 +35,33 @@ odm_read_1byte(
u32 reg_addr
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
- return RTL_R8(reg_addr);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
struct _ADAPTER *adapter = p_dm_odm->adapter;
+
return rtw_read8(adapter, reg_addr);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- return PlatformEFIORead1Byte(adapter, reg_addr);
-#endif
-
}
-
u16
odm_read_2byte(
struct PHY_DM_STRUCT *p_dm_odm,
u32 reg_addr
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
- return RTL_R16(reg_addr);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
struct _ADAPTER *adapter = p_dm_odm->adapter;
+
return rtw_read16(adapter, reg_addr);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- return PlatformEFIORead2Byte(adapter, reg_addr);
-#endif
-
}
-
u32
odm_read_4byte(
struct PHY_DM_STRUCT *p_dm_odm,
u32 reg_addr
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
- return RTL_R32(reg_addr);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
struct _ADAPTER *adapter = p_dm_odm->adapter;
+
return rtw_read32(adapter, reg_addr);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- return PlatformEFIORead4Byte(adapter, reg_addr);
-#endif
-
}
-
void
odm_write_1byte(
struct PHY_DM_STRUCT *p_dm_odm,
@@ -96,17 +69,9 @@ odm_write_1byte(
u8 data
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
- RTL_W8(reg_addr, data);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
struct _ADAPTER *adapter = p_dm_odm->adapter;
- rtw_write8(adapter, reg_addr, data);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PlatformEFIOWrite1Byte(adapter, reg_addr, data);
-#endif
+ rtw_write8(adapter, reg_addr, data);
}
@@ -117,20 +82,11 @@ odm_write_2byte(
u16 data
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
- RTL_W16(reg_addr, data);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
struct _ADAPTER *adapter = p_dm_odm->adapter;
+
rtw_write16(adapter, reg_addr, data);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PlatformEFIOWrite2Byte(adapter, reg_addr, data);
-#endif
-
}
-
void
odm_write_4byte(
struct PHY_DM_STRUCT *p_dm_odm,
@@ -138,20 +94,11 @@ odm_write_4byte(
u32 data
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
- RTL_W32(reg_addr, data);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
struct _ADAPTER *adapter = p_dm_odm->adapter;
+
rtw_write32(adapter, reg_addr, data);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PlatformEFIOWrite4Byte(adapter, reg_addr, data);
-#endif
-
}
-
void
odm_set_mac_reg(
struct PHY_DM_STRUCT *p_dm_odm,
@@ -160,17 +107,9 @@ odm_set_mac_reg(
u32 data
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- phy_set_bb_reg(p_dm_odm->priv, reg_addr, bit_mask, data);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PHY_SetBBReg(adapter, reg_addr, bit_mask, data);
-#else
phy_set_bb_reg(p_dm_odm->adapter, reg_addr, bit_mask, data);
-#endif
}
-
u32
odm_get_mac_reg(
struct PHY_DM_STRUCT *p_dm_odm,
@@ -178,16 +117,9 @@ odm_get_mac_reg(
u32 bit_mask
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- return phy_query_bb_reg(p_dm_odm->priv, reg_addr, bit_mask);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- return PHY_QueryMacReg(p_dm_odm->adapter, reg_addr, bit_mask);
-#else
return phy_query_mac_reg(p_dm_odm->adapter, reg_addr, bit_mask);
-#endif
}
-
void
odm_set_bb_reg(
struct PHY_DM_STRUCT *p_dm_odm,
@@ -196,17 +128,9 @@ odm_set_bb_reg(
u32 data
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- phy_set_bb_reg(p_dm_odm->priv, reg_addr, bit_mask, data);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PHY_SetBBReg(adapter, reg_addr, bit_mask, data);
-#else
phy_set_bb_reg(p_dm_odm->adapter, reg_addr, bit_mask, data);
-#endif
}
-
u32
odm_get_bb_reg(
struct PHY_DM_STRUCT *p_dm_odm,
@@ -214,17 +138,9 @@ odm_get_bb_reg(
u32 bit_mask
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- return phy_query_bb_reg(p_dm_odm->priv, reg_addr, bit_mask);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- return PHY_QueryBBReg(adapter, reg_addr, bit_mask);
-#else
return phy_query_bb_reg(p_dm_odm->adapter, reg_addr, bit_mask);
-#endif
}
-
void
odm_set_rf_reg(
struct PHY_DM_STRUCT *p_dm_odm,
@@ -234,16 +150,7 @@ odm_set_rf_reg(
u32 data
)
{
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- phy_set_rf_reg(p_dm_odm->priv, e_rf_path, reg_addr, bit_mask, data);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PHY_SetRFReg(adapter, e_rf_path, reg_addr, bit_mask, data);
- ODM_delay_us(2);
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
phy_set_rf_reg(p_dm_odm->adapter, e_rf_path, reg_addr, bit_mask, data);
-#endif
}
u32
@@ -254,19 +161,9 @@ odm_get_rf_reg(
u32 bit_mask
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- return phy_query_rf_reg(p_dm_odm->priv, e_rf_path, reg_addr, bit_mask, 1);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- return PHY_QueryRFReg(adapter, e_rf_path, reg_addr, bit_mask);
-#else
return phy_query_rf_reg(p_dm_odm->adapter, e_rf_path, reg_addr, bit_mask);
-#endif
}
-
-
-
/*
* ODM Memory relative API.
* */
@@ -277,14 +174,7 @@ odm_allocate_memory(
u32 length
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- *p_ptr = kmalloc(length, GFP_ATOMIC);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
*p_ptr = rtw_zvmalloc(length);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PlatformAllocateMemory(adapter, p_ptr, length);
-#endif
}
/* length could be ignored, used to detect memory leakage. */
@@ -295,14 +185,7 @@ odm_free_memory(
u32 length
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- kfree(p_ptr);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
rtw_vmfree(p_ptr, length);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- /* struct _ADAPTER* adapter = p_dm_odm->adapter; */
- PlatformFreeMemory(p_ptr, length);
-#endif
}
void
@@ -313,13 +196,7 @@ odm_move_memory(
u32 length
)
{
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- memcpy(p_dest, p_src, length);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
_rtw_memcpy(p_dest, p_src, length);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PlatformMoveMemory(p_dest, p_src, length);
-#endif
}
void odm_memory_set(
@@ -329,14 +206,9 @@ void odm_memory_set(
u32 length
)
{
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- memset(pbuf, value, length);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
_rtw_memset(pbuf, value, length);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PlatformFillMemory(pbuf, length, value);
-#endif
}
+
s32 odm_compare_memory(
struct PHY_DM_STRUCT *p_dm_odm,
void *p_buf1,
@@ -344,17 +216,9 @@ s32 odm_compare_memory(
u32 length
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- return memcmp(p_buf1, p_buf2, length);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
return _rtw_memcmp(p_buf1, p_buf2, length);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- return PlatformCompareMemory(p_buf1, p_buf2, length);
-#endif
}
-
-
/*
* ODM MISC relative API.
* */
@@ -364,133 +228,21 @@ odm_acquire_spin_lock(
enum rt_spinlock_type type
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
struct _ADAPTER *adapter = p_dm_odm->adapter;
+
rtw_odm_acquirespinlock(adapter, type);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PlatformAcquireSpinLock(adapter, type);
-#endif
}
+
void
odm_release_spin_lock(
struct PHY_DM_STRUCT *p_dm_odm,
enum rt_spinlock_type type
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
struct _ADAPTER *adapter = p_dm_odm->adapter;
rtw_odm_releasespinlock(adapter, type);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PlatformReleaseSpinLock(adapter, type);
-#endif
}
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-/*
- * Work item relative API. FOr MP driver only~!
- * */
-void
-odm_initialize_work_item(
- struct PHY_DM_STRUCT *p_dm_odm,
- PRT_WORK_ITEM p_rt_work_item,
- RT_WORKITEM_CALL_BACK rt_work_item_callback,
- void *p_context,
- const char *sz_id
-)
-{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PlatformInitializeWorkItem(adapter, p_rt_work_item, rt_work_item_callback, p_context, sz_id);
-#endif
-}
-
-
-void
-odm_start_work_item(
- PRT_WORK_ITEM p_rt_work_item
-)
-{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PlatformStartWorkItem(p_rt_work_item);
-#endif
-}
-
-
-void
-odm_stop_work_item(
- PRT_WORK_ITEM p_rt_work_item
-)
-{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PlatformStopWorkItem(p_rt_work_item);
-#endif
-}
-
-
-void
-odm_free_work_item(
- PRT_WORK_ITEM p_rt_work_item
-)
-{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PlatformFreeWorkItem(p_rt_work_item);
-#endif
-}
-
-
-void
-odm_schedule_work_item(
- PRT_WORK_ITEM p_rt_work_item
-)
-{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PlatformScheduleWorkItem(p_rt_work_item);
-#endif
-}
-
-
-bool
-odm_is_work_item_scheduled(
- PRT_WORK_ITEM p_rt_work_item
-)
-{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- return PlatformIsWorkItemScheduled(p_rt_work_item);
-#endif
-}
-#endif
-
-
/*
* ODM Timer relative API.
* */
@@ -499,59 +251,31 @@ odm_stall_execution(
u32 us_delay
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
rtw_udelay_os(us_delay);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PlatformStallExecution(us_delay);
-#endif
}
void
ODM_delay_ms(u32 ms)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- delay_ms(ms);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
rtw_mdelay_os(ms);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- delay_ms(ms);
-#endif
}
void
ODM_delay_us(u32 us)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- delay_us(us);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
rtw_udelay_os(us);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- PlatformStallExecution(us);
-#endif
}
void
ODM_sleep_ms(u32 ms)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
rtw_msleep_os(ms);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-#endif
}
void
ODM_sleep_us(u32 us)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
rtw_usleep_os(us);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-#endif
}
void
@@ -561,15 +285,7 @@ odm_set_timer(
u32 ms_delay
)
{
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- mod_timer(p_timer, jiffies + RTL_MILISECONDS_TO_JIFFIES(ms_delay));
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
_set_timer(p_timer, ms_delay); /* ms */
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PlatformSetTimer(adapter, p_timer, ms_delay);
-#endif
-
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
@@ -593,43 +309,17 @@ odm_cancel_timer(
struct timer_list *p_timer
)
{
-#if (DM_ODM_SUPPORT_TYPE & ODM_AP)
- del_timer(p_timer);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
_cancel_timer_ex(p_timer);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PlatformCancelTimer(adapter, p_timer);
-#endif
}
-
void
odm_release_timer(
struct PHY_DM_STRUCT *p_dm_odm,
struct timer_list *p_timer
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
-
- struct _ADAPTER *adapter = p_dm_odm->adapter;
-
- /* <20120301, Kordan> If the initilization fails, InitializeAdapterXxx will return regardless of InitHalDm.
- * Hence, uninitialized timers cause BSOD when the driver releases resources since the init fail. */
- if (p_timer == 0) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_INIT, ODM_DBG_SERIOUS, ("=====>odm_release_timer(), The timer is NULL! Please check it!\n"));
- return;
- }
-
- PlatformReleaseTimer(adapter, p_timer);
-#endif
}
-
static u8
phydm_trans_h2c_id(
struct PHY_DM_STRUCT *p_dm_odm,
@@ -641,168 +331,33 @@ phydm_trans_h2c_id(
switch (phydm_h2c_id) {
/* 1 [0] */
case ODM_H2C_RSSI_REPORT:
-
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- if (p_dm_odm->support_ic_type == ODM_RTL8188E)
- platform_h2c_id = H2C_88E_RSSI_REPORT;
- else if (p_dm_odm->support_ic_type == ODM_RTL8814A)
- platform_h2c_id = H2C_8814A_RSSI_REPORT;
- else
- platform_h2c_id = H2C_RSSI_REPORT;
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
platform_h2c_id = H2C_RSSI_SETTING;
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_AP)
-#if ((RTL8881A_SUPPORT == 1) || (RTL8192E_SUPPORT == 1) || (RTL8814A_SUPPORT == 1) || (RTL8822B_SUPPORT == 1) || (RTL8197F_SUPPORT == 1))
- if (p_dm_odm->support_ic_type == ODM_RTL8881A || p_dm_odm->support_ic_type == ODM_RTL8192E || p_dm_odm->support_ic_type & PHYDM_IC_3081_SERIES)
- platform_h2c_id = H2C_88XX_RSSI_REPORT;
- else
-#endif
-#if (RTL8812A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8812)
- platform_h2c_id = H2C_8812_RSSI_REPORT;
- else
-#endif
- {}
-#endif
-
break;
-
/* 1 [3] */
case ODM_H2C_WIFI_CALIBRATION:
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- platform_h2c_id = H2C_WIFI_CALIBRATION;
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
-#if (RTL8723B_SUPPORT == 1)
- platform_h2c_id = H2C_8723B_BT_WLAN_CALIBRATION;
-#endif
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_AP)
-#endif
break;
-
-
/* 1 [4] */
case ODM_H2C_IQ_CALIBRATION:
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- platform_h2c_id = H2C_IQ_CALIBRATION;
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
-#if ((RTL8812A_SUPPORT == 1) || (RTL8821A_SUPPORT == 1))
- platform_h2c_id = H2C_8812_IQ_CALIBRATION;
-#endif
-#elif (DM_ODM_SUPPORT_TYPE & ODM_AP)
-#endif
-
break;
/* 1 [5] */
case ODM_H2C_RA_PARA_ADJUST:
-
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- if (p_dm_odm->support_ic_type & (ODM_RTL8814A | ODM_RTL8822B))
- platform_h2c_id = H2C_8814A_RA_PARA_ADJUST;
- else
- platform_h2c_id = H2C_RA_PARA_ADJUST;
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
-#if ((RTL8812A_SUPPORT == 1) || (RTL8821A_SUPPORT == 1))
- platform_h2c_id = H2C_8812_RA_PARA_ADJUST;
-#elif ((RTL8814A_SUPPORT == 1) || (RTL8822B_SUPPORT == 1))
- platform_h2c_id = H2C_RA_PARA_ADJUST;
-#elif (RTL8192E_SUPPORT == 1)
- platform_h2c_id = H2C_8192E_RA_PARA_ADJUST;
-#elif (RTL8723B_SUPPORT == 1)
- platform_h2c_id = H2C_8723B_RA_PARA_ADJUST;
-#endif
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_AP)
-#if ((RTL8881A_SUPPORT == 1) || (RTL8192E_SUPPORT == 1) || (RTL8814A_SUPPORT == 1) || (RTL8822B_SUPPORT == 1) || (RTL8197F_SUPPORT == 1))
- if (p_dm_odm->support_ic_type == ODM_RTL8881A || p_dm_odm->support_ic_type == ODM_RTL8192E || p_dm_odm->support_ic_type & PHYDM_IC_3081_SERIES)
- platform_h2c_id = H2C_88XX_RA_PARA_ADJUST;
- else
-#endif
-#if (RTL8812A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8812)
- platform_h2c_id = H2C_8812_RA_PARA_ADJUST;
- else
-#endif
- {}
-#endif
-
break;
-
-
/* 1 [6] */
case PHYDM_H2C_DYNAMIC_TX_PATH:
-
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- if (p_dm_odm->support_ic_type == ODM_RTL8814A)
- platform_h2c_id = H2C_8814A_DYNAMIC_TX_PATH;
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
-#if (RTL8814A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8814A)
- platform_h2c_id = H2C_DYNAMIC_TX_PATH;
-#endif
-#elif (DM_ODM_SUPPORT_TYPE & ODM_AP)
-#if (RTL8814A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8814A)
- platform_h2c_id = H2C_88XX_DYNAMIC_TX_PATH;
-#endif
-
-#endif
-
break;
-
/* [7]*/
case PHYDM_H2C_FW_TRACE_EN:
-
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- if (p_dm_odm->support_ic_type & (ODM_RTL8814A | ODM_RTL8822B))
- platform_h2c_id = H2C_8814A_FW_TRACE_EN;
- else
- platform_h2c_id = H2C_FW_TRACE_EN;
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
-
platform_h2c_id = 0x49;
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_AP)
-#if ((RTL8881A_SUPPORT == 1) || (RTL8192E_SUPPORT == 1) || (RTL8814A_SUPPORT == 1) || (RTL8822B_SUPPORT == 1) || (RTL8197F_SUPPORT == 1))
- if (p_dm_odm->support_ic_type == ODM_RTL8881A || p_dm_odm->support_ic_type == ODM_RTL8192E || p_dm_odm->support_ic_type & PHYDM_IC_3081_SERIES)
- platform_h2c_id = H2C_88XX_FW_TRACE_EN;
- else
-#endif
-#if (RTL8812A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8812)
- platform_h2c_id = H2C_8812_FW_TRACE_EN;
- else
-#endif
- {}
-
-#endif
-
break;
-
case PHYDM_H2C_TXBF:
-#if ((RTL8192E_SUPPORT == 1) || (RTL8812A_SUPPORT == 1))
- platform_h2c_id = 0x41; /*H2C_TxBF*/
-#endif
break;
-
case PHYDM_H2C_MU:
-#if (RTL8822B_SUPPORT == 1)
- platform_h2c_id = 0x4a; /*H2C_MU*/
-#endif
break;
-
default:
platform_h2c_id = phydm_h2c_id;
break;
}
-
return platform_h2c_id;
-
}
/*ODM FW relative API.*/
@@ -822,35 +377,7 @@ odm_fill_h2c_cmd(
ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_RA_DBG, ODM_DBG_LOUD, ("[H2C] platform_h2c_id = ((0x%x))\n", platform_h2c_id));
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- if (p_dm_odm->support_ic_type == ODM_RTL8188E) {
- if (!p_dm_odm->ra_support88e)
- FillH2CCmd88E(adapter, platform_h2c_id, cmd_len, p_cmd_buffer);
- } else if (p_dm_odm->support_ic_type == ODM_RTL8814A)
- FillH2CCmd8814A(adapter, platform_h2c_id, cmd_len, p_cmd_buffer);
- else if (p_dm_odm->support_ic_type == ODM_RTL8822B)
-#if (RTL8822B_SUPPORT == 1)
- FillH2CCmd8822B(adapter, platform_h2c_id, cmd_len, p_cmd_buffer);
-#endif
- else
- FillH2CCmd(adapter, platform_h2c_id, cmd_len, p_cmd_buffer);
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
rtw_hal_fill_h2c_cmd(adapter, platform_h2c_id, cmd_len, p_cmd_buffer);
-
-#elif (DM_ODM_SUPPORT_TYPE & ODM_AP)
-#if ((RTL8881A_SUPPORT == 1) || (RTL8192E_SUPPORT == 1) || (RTL8814A_SUPPORT == 1) || (RTL8822B_SUPPORT == 1) || (RTL8197F_SUPPORT == 1))
- if (p_dm_odm->support_ic_type == ODM_RTL8881A || p_dm_odm->support_ic_type == ODM_RTL8192E || p_dm_odm->support_ic_type & PHYDM_IC_3081_SERIES)
- GET_HAL_INTERFACE(p_dm_odm->priv)->fill_h2c_cmd_handler(p_dm_odm->priv, platform_h2c_id, cmd_len, p_cmd_buffer);
- else
-#endif
-#if (RTL8812A_SUPPORT == 1)
- if (p_dm_odm->support_ic_type == ODM_RTL8812)
- fill_h2c_cmd8812(p_dm_odm->priv, platform_h2c_id, cmd_len, p_cmd_buffer);
- else
-#endif
- {}
-#endif
}
u8
@@ -862,9 +389,6 @@ phydm_c2H_content_parsing(
)
{
struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
-#endif
u8 extend_c2h_sub_id = 0;
u8 find_c2h_cmd = true;
@@ -872,36 +396,18 @@ phydm_c2H_content_parsing(
case PHYDM_C2H_DBG:
phydm_fw_trace_handler(p_dm_odm, tmp_buf, c2h_cmd_len);
break;
-
case PHYDM_C2H_RA_RPT:
phydm_c2h_ra_report_handler(p_dm_odm, tmp_buf, c2h_cmd_len);
break;
-
case PHYDM_C2H_RA_PARA_RPT:
odm_c2h_ra_para_report_handler(p_dm_odm, tmp_buf, c2h_cmd_len);
break;
-
case PHYDM_C2H_DYNAMIC_TX_PATH_RPT:
if (p_dm_odm->support_ic_type & (ODM_RTL8814A))
phydm_c2h_dtp_handler(p_dm_odm, tmp_buf, c2h_cmd_len);
break;
-
case PHYDM_C2H_IQK_FINISH:
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-
- if (p_dm_odm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821)) {
-
- RT_TRACE(COMP_MP, DBG_LOUD, ("== FW IQK Finish ==\n"));
- odm_acquire_spin_lock(p_dm_odm, RT_IQK_SPINLOCK);
- p_dm_odm->rf_calibrate_info.is_iqk_in_progress = false;
- odm_release_spin_lock(p_dm_odm, RT_IQK_SPINLOCK);
- p_dm_odm->rf_calibrate_info.iqk_progressing_time = 0;
- p_dm_odm->rf_calibrate_info.iqk_progressing_time = odm_get_progressing_time(p_dm_odm, p_dm_odm->rf_calibrate_info.iqk_start_time);
- }
-
-#endif
break;
-
case PHYDM_C2H_DBG_CODE:
phydm_fw_trace_handler_code(p_dm_odm, tmp_buf, c2h_cmd_len);
break;
@@ -912,14 +418,11 @@ phydm_c2H_content_parsing(
phydm_fw_trace_handler_8051(p_dm_odm, tmp_buf, c2h_cmd_len);
break;
-
default:
find_c2h_cmd = false;
break;
}
-
return find_c2h_cmd;
-
}
u64
@@ -927,13 +430,7 @@ odm_get_current_time(
struct PHY_DM_STRUCT *p_dm_odm
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- return 0;
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
return (u64)rtw_get_current_time();
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- return PlatformGetCurrentTime();
-#endif
}
u64
@@ -942,17 +439,9 @@ odm_get_progressing_time(
u64 start_time
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- return 0;
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
return rtw_get_passing_time_ms((u32)start_time);
-#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- return ((PlatformGetCurrentTime() - start_time) >> 10);
-#endif
}
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
-
void
phydm_set_hw_reg_handler_interface (
struct PHY_DM_STRUCT *p_dm_odm,
@@ -960,17 +449,9 @@ phydm_set_hw_reg_handler_interface (
u8 *val
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
struct _ADAPTER *adapter = p_dm_odm->adapter;
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- adapter->HalFunc.SetHwRegHandler(adapter, RegName, val);
-#else
adapter->hal_func.set_hw_reg_handler(adapter, RegName, val);
-#endif
-
-#endif
-
}
void
@@ -980,16 +461,7 @@ phydm_get_hal_def_var_handler_interface (
void *p_value
)
{
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN|ODM_CE))
struct _ADAPTER *adapter = p_dm_odm->adapter;
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- adapter->HalFunc.GetHalDefVarHandler(adapter, e_variable, p_value);
-#else
adapter->hal_func.get_hal_def_var_handler(adapter, e_variable, p_value);
-#endif
-
-#endif
}
-
-#endif
diff --git a/hal/phydm/phydm_noisemonitor.c b/hal/phydm/phydm_noisemonitor.c
index 145d193..f0d8d57 100644
--- a/hal/phydm/phydm_noisemonitor.c
+++ b/hal/phydm/phydm_noisemonitor.c
@@ -39,8 +39,6 @@
#define VALID_MAX 10
#define VALID_CNT 5
-#if (DM_ODM_SUPPORT_TYPE & (ODM_CE | ODM_WIN))
-
static s16 odm_inband_noise_monitor_n_series(struct PHY_DM_STRUCT *p_dm_odm, u8 is_pause_dig, u8 igi_value, u32 max_time)
{
u32 tmp4b;
@@ -276,8 +274,6 @@ odm_inband_noise_monitor_ac_series(struct PHY_DM_STRUCT *p_dm_odm, u8 is_pause_d
return p_dm_odm->noise_level.noise_all;
}
-
-
s16
odm_inband_noise_monitor(void *p_dm_void, u8 is_pause_dig, u8 igi_value, u32 max_time)
{
@@ -288,5 +284,3 @@ odm_inband_noise_monitor(void *p_dm_void, u8 is_pause_dig, u8 igi_value, u32 max
else
return odm_inband_noise_monitor_n_series(p_dm_odm, is_pause_dig, igi_value, max_time);
}
-
-#endif
diff --git a/hal/phydm/phydm_pathdiv.c b/hal/phydm/phydm_pathdiv.c
index aec5bbd..7c9b067 100644
--- a/hal/phydm/phydm_pathdiv.c
+++ b/hal/phydm/phydm_pathdiv.c
@@ -25,500 +25,7 @@
#include "phydm_precomp.h"
#if (defined(CONFIG_PATH_DIVERSITY))
-#if RTL8814A_SUPPORT
-
-void
-phydm_dtp_fix_tx_path(
- void *p_dm_void,
- u8 path
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ODM_PATH_DIVERSITY_ *p_dm_path_div = &p_dm_odm->dm_path_div;
- u8 i, num_enable_path = 0;
-
- if (path == p_dm_path_div->pre_tx_path)
- return;
- else
- p_dm_path_div->pre_tx_path = path;
-
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(18) | BIT(19), 3);
-
- for (i = 0; i < 4; i++) {
- if (path & BIT(i))
- num_enable_path++;
- }
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" number of trun-on path : (( %d ))\n", num_enable_path));
-
- if (num_enable_path == 1) {
- odm_set_bb_reg(p_dm_odm, 0x93c, 0xf00000, path);
-
- if (path == PHYDM_A) { /* 1-1 */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" Trun on path (( A ))\n"));
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(25) | BIT(24), 0);
- } else if (path == PHYDM_B) { /* 1-2 */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" Trun on path (( B ))\n"));
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(27) | BIT(26), 0);
- } else if (path == PHYDM_C) { /* 1-3 */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" Trun on path (( C ))\n"));
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(29) | BIT(28), 0);
-
- } else if (path == PHYDM_D) { /* 1-4 */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" Trun on path (( D ))\n"));
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(31) | BIT(30), 0);
- }
-
- } else if (num_enable_path == 2) {
- odm_set_bb_reg(p_dm_odm, 0x93c, 0xf00000, path);
- odm_set_bb_reg(p_dm_odm, 0x940, 0xf0, path);
-
- if (path == PHYDM_AB) { /* 2-1 */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" Trun on path (( A B ))\n"));
- /* set for 1ss */
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(25) | BIT(24), 0);
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(27) | BIT(26), 1);
- /* set for 2ss */
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(9) | BIT(8), 0);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(11) | BIT(10), 1);
- } else if (path == PHYDM_AC) { /* 2-2 */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" Trun on path (( A C ))\n"));
- /* set for 1ss */
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(25) | BIT(24), 0);
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(29) | BIT(28), 1);
- /* set for 2ss */
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(9) | BIT(8), 0);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(13) | BIT(12), 1);
- } else if (path == PHYDM_AD) { /* 2-3 */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" Trun on path (( A D ))\n"));
- /* set for 1ss */
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(25) | BIT(24), 0);
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(31) | BIT(30), 1);
- /* set for 2ss */
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(9) | BIT(8), 0);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(15) | BIT(14), 1);
- } else if (path == PHYDM_BC) { /* 2-4 */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" Trun on path (( B C ))\n"));
- /* set for 1ss */
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(27) | BIT(26), 0);
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(29) | BIT(28), 1);
- /* set for 2ss */
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(11) | BIT(10), 0);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(13) | BIT(12), 1);
- } else if (path == PHYDM_BD) { /* 2-5 */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" Trun on path (( B D ))\n"));
- /* set for 1ss */
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(27) | BIT(26), 0);
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(31) | BIT(30), 1);
- /* set for 2ss */
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(11) | BIT(10), 0);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(15) | BIT(14), 1);
- } else if (path == PHYDM_CD) { /* 2-6 */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" Trun on path (( C D ))\n"));
- /* set for 1ss */
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(29) | BIT(28), 0);
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(31) | BIT(30), 1);
- /* set for 2ss */
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(13) | BIT(12), 0);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(15) | BIT(14), 1);
- }
-
- } else if (num_enable_path == 3) {
- odm_set_bb_reg(p_dm_odm, 0x93c, 0xf00000, path);
- odm_set_bb_reg(p_dm_odm, 0x940, 0xf0, path);
- odm_set_bb_reg(p_dm_odm, 0x940, 0xf0000, path);
-
- if (path == PHYDM_ABC) { /* 3-1 */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" Trun on path (( A B C))\n"));
- /* set for 1ss */
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(25) | BIT(24), 0);
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(27) | BIT(26), 1);
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(29) | BIT(28), 2);
- /* set for 2ss */
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(9) | BIT(8), 0);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(11) | BIT(10), 1);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(13) | BIT(12), 2);
- /* set for 3ss */
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(21) | BIT(20), 0);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(23) | BIT(22), 1);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(25) | BIT(24), 2);
- } else if (path == PHYDM_ABD) { /* 3-2 */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" Trun on path (( A B D ))\n"));
- /* set for 1ss */
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(25) | BIT(24), 0);
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(27) | BIT(26), 1);
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(31) | BIT(30), 2);
- /* set for 2ss */
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(9) | BIT(8), 0);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(11) | BIT(10), 1);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(15) | BIT(14), 2);
- /* set for 3ss */
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(21) | BIT(20), 0);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(23) | BIT(22), 1);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(27) | BIT(26), 2);
-
- } else if (path == PHYDM_ACD) { /* 3-3 */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" Trun on path (( A C D ))\n"));
- /* set for 1ss */
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(25) | BIT(24), 0);
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(29) | BIT(28), 1);
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(31) | BIT(30), 2);
- /* set for 2ss */
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(9) | BIT(8), 0);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(13) | BIT(12), 1);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(15) | BIT(14), 2);
- /* set for 3ss */
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(21) | BIT(20), 0);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(25) | BIT(24), 1);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(27) | BIT(26), 2);
- } else if (path == PHYDM_BCD) { /* 3-4 */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" Trun on path (( B C D))\n"));
- /* set for 1ss */
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(27) | BIT(26), 0);
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(29) | BIT(28), 1);
- odm_set_bb_reg(p_dm_odm, 0x93c, BIT(31) | BIT(30), 2);
- /* set for 2ss */
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(11) | BIT(10), 0);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(13) | BIT(12), 1);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(15) | BIT(14), 2);
- /* set for 3ss */
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(23) | BIT(22), 0);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(25) | BIT(24), 1);
- odm_set_bb_reg(p_dm_odm, 0x940, BIT(27) | BIT(26), 2);
- }
- } else if (num_enable_path == 4)
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" Trun on path ((A B C D))\n"));
-
-}
-
-void
-phydm_find_default_path(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ODM_PATH_DIVERSITY_ *p_dm_path_div = &p_dm_odm->dm_path_div;
- u32 rssi_avg_a = 0, rssi_avg_b = 0, rssi_avg_c = 0, rssi_avg_d = 0, rssi_avg_bcd = 0;
- u32 rssi_total_a = 0, rssi_total_b = 0, rssi_total_c = 0, rssi_total_d = 0;
-
- /* 2 Default path Selection By RSSI */
-
- rssi_avg_a = (p_dm_path_div->path_a_cnt_all > 0) ? (p_dm_path_div->path_a_sum_all / p_dm_path_div->path_a_cnt_all) : 0 ;
- rssi_avg_b = (p_dm_path_div->path_b_cnt_all > 0) ? (p_dm_path_div->path_b_sum_all / p_dm_path_div->path_b_cnt_all) : 0 ;
- rssi_avg_c = (p_dm_path_div->path_c_cnt_all > 0) ? (p_dm_path_div->path_c_sum_all / p_dm_path_div->path_c_cnt_all) : 0 ;
- rssi_avg_d = (p_dm_path_div->path_d_cnt_all > 0) ? (p_dm_path_div->path_d_sum_all / p_dm_path_div->path_d_cnt_all) : 0 ;
-
-
- p_dm_path_div->path_a_sum_all = 0;
- p_dm_path_div->path_a_cnt_all = 0;
- p_dm_path_div->path_b_sum_all = 0;
- p_dm_path_div->path_b_cnt_all = 0;
- p_dm_path_div->path_c_sum_all = 0;
- p_dm_path_div->path_c_cnt_all = 0;
- p_dm_path_div->path_d_sum_all = 0;
- p_dm_path_div->path_d_cnt_all = 0;
-
- if (p_dm_path_div->use_path_a_as_default_ant == 1) {
- rssi_avg_bcd = (rssi_avg_b + rssi_avg_c + rssi_avg_d) / 3;
-
- if ((rssi_avg_a + ANT_DECT_RSSI_TH) > rssi_avg_bcd) {
- p_dm_path_div->is_path_a_exist = true;
- p_dm_path_div->default_path = PATH_A;
- } else
- p_dm_path_div->is_path_a_exist = false;
- } else {
- if ((rssi_avg_a >= rssi_avg_b) && (rssi_avg_a >= rssi_avg_c) && (rssi_avg_a >= rssi_avg_d))
- p_dm_path_div->default_path = PATH_A;
- else if ((rssi_avg_b >= rssi_avg_c) && (rssi_avg_b >= rssi_avg_d))
- p_dm_path_div->default_path = PATH_B;
- else if (rssi_avg_c >= rssi_avg_d)
- p_dm_path_div->default_path = PATH_C;
- else
- p_dm_path_div->default_path = PATH_D;
- }
-
-
-}
-
-
-void
-phydm_candidate_dtp_update(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ODM_PATH_DIVERSITY_ *p_dm_path_div = &p_dm_odm->dm_path_div;
-
- p_dm_path_div->num_candidate = 3;
-
- if (p_dm_path_div->use_path_a_as_default_ant == 1) {
- if (p_dm_path_div->num_tx_path == 3) {
- if (p_dm_path_div->is_path_a_exist) {
- p_dm_path_div->ant_candidate_1 = PHYDM_ABC;
- p_dm_path_div->ant_candidate_2 = PHYDM_ABD;
- p_dm_path_div->ant_candidate_3 = PHYDM_ACD;
- } else { /* use path BCD */
- p_dm_path_div->num_candidate = 1;
- phydm_dtp_fix_tx_path(p_dm_odm, PHYDM_BCD);
- return;
- }
- } else if (p_dm_path_div->num_tx_path == 2) {
- if (p_dm_path_div->is_path_a_exist) {
- p_dm_path_div->ant_candidate_1 = PHYDM_AB;
- p_dm_path_div->ant_candidate_2 = PHYDM_AC;
- p_dm_path_div->ant_candidate_3 = PHYDM_AD;
- } else {
- p_dm_path_div->ant_candidate_1 = PHYDM_BC;
- p_dm_path_div->ant_candidate_2 = PHYDM_BD;
- p_dm_path_div->ant_candidate_3 = PHYDM_CD;
- }
- }
- } else {
- /* 2 3 TX mode */
- if (p_dm_path_div->num_tx_path == 3) { /* choose 3 ant form 4 */
- if (p_dm_path_div->default_path == PATH_A) { /* choose 2 ant form 3 */
- p_dm_path_div->ant_candidate_1 = PHYDM_ABC;
- p_dm_path_div->ant_candidate_2 = PHYDM_ABD;
- p_dm_path_div->ant_candidate_3 = PHYDM_ACD;
- } else if (p_dm_path_div->default_path == PATH_B) {
- p_dm_path_div->ant_candidate_1 = PHYDM_ABC;
- p_dm_path_div->ant_candidate_2 = PHYDM_ABD;
- p_dm_path_div->ant_candidate_3 = PHYDM_BCD;
- } else if (p_dm_path_div->default_path == PATH_C) {
- p_dm_path_div->ant_candidate_1 = PHYDM_ABC;
- p_dm_path_div->ant_candidate_2 = PHYDM_ACD;
- p_dm_path_div->ant_candidate_3 = PHYDM_BCD;
- } else if (p_dm_path_div->default_path == PATH_D) {
- p_dm_path_div->ant_candidate_1 = PHYDM_ABD;
- p_dm_path_div->ant_candidate_2 = PHYDM_ACD;
- p_dm_path_div->ant_candidate_3 = PHYDM_BCD;
- }
- }
-
- /* 2 2 TX mode */
- else if (p_dm_path_div->num_tx_path == 2) { /* choose 2 ant form 4 */
- if (p_dm_path_div->default_path == PATH_A) { /* choose 2 ant form 3 */
- p_dm_path_div->ant_candidate_1 = PHYDM_AB;
- p_dm_path_div->ant_candidate_2 = PHYDM_AC;
- p_dm_path_div->ant_candidate_3 = PHYDM_AD;
- } else if (p_dm_path_div->default_path == PATH_B) {
- p_dm_path_div->ant_candidate_1 = PHYDM_AB;
- p_dm_path_div->ant_candidate_2 = PHYDM_BC;
- p_dm_path_div->ant_candidate_3 = PHYDM_BD;
- } else if (p_dm_path_div->default_path == PATH_C) {
- p_dm_path_div->ant_candidate_1 = PHYDM_AC;
- p_dm_path_div->ant_candidate_2 = PHYDM_BC;
- p_dm_path_div->ant_candidate_3 = PHYDM_CD;
- } else if (p_dm_path_div->default_path == PATH_D) {
- p_dm_path_div->ant_candidate_1 = PHYDM_AD;
- p_dm_path_div->ant_candidate_2 = PHYDM_BD;
- p_dm_path_div->ant_candidate_3 = PHYDM_CD;
- }
- }
- }
-}
-
-
-void
-phydm_dynamic_tx_path(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ODM_PATH_DIVERSITY_ *p_dm_path_div = &p_dm_odm->dm_path_div;
-
- struct sta_info *p_entry;
- u32 i;
- u8 num_client = 0;
- u8 h2c_parameter[6] = {0};
-
-
- if (!p_dm_odm->is_linked) { /* is_linked==False */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("DTP_8814 [No Link!!!]\n"));
-
- if (p_dm_path_div->is_become_linked == true) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" [Be disconnected]----->\n"));
- p_dm_path_div->is_become_linked = p_dm_odm->is_linked;
- }
- return;
- } else {
- if (p_dm_path_div->is_become_linked == false) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, (" [Be Linked !!!]----->\n"));
- p_dm_path_div->is_become_linked = p_dm_odm->is_linked;
- }
- }
-
- /* 2 [period CTRL] */
- if (p_dm_path_div->dtp_period >= 2)
- p_dm_path_div->dtp_period = 0;
- else {
- /* ODM_RT_TRACE(p_dm_odm,ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("Phydm_Dynamic_Tx_Path_8814A() Stay = (( %d ))\n",p_dm_path_div->dtp_period)); */
- p_dm_path_div->dtp_period++;
- return;
- }
-
-
- /* 2 [Fix path] */
- if (p_dm_odm->path_select != PHYDM_AUTO_PATH)
- return;
-
- /* 2 [Check Bfer] */
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-#if (BEAMFORMING_SUPPORT == 1)
- {
- enum beamforming_cap beamform_cap = (p_dm_odm->beamforming_info.beamform_cap);
-
- if (beamform_cap & BEAMFORMER_CAP) { /* BFmer On && Div On->Div Off */
- if (p_dm_path_div->fix_path_bfer == 0) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("[ PathDiv : OFF ] BFmer ==1\n"));
- p_dm_path_div->fix_path_bfer = 1 ;
- }
- return;
- } else { /* BFmer Off && Div Off->Div On */
- if (p_dm_path_div->fix_path_bfer == 1) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("[ PathDiv : ON ] BFmer ==0\n"));
- p_dm_path_div->fix_path_bfer = 0;
- }
- }
- }
-#endif
-#endif
-
- if (p_dm_path_div->use_path_a_as_default_ant == 1) {
- phydm_find_default_path(p_dm_odm);
- phydm_candidate_dtp_update(p_dm_odm);
- } else {
- if (p_dm_path_div->phydm_dtp_state == PHYDM_DTP_INIT) {
- phydm_find_default_path(p_dm_odm);
- phydm_candidate_dtp_update(p_dm_odm);
- p_dm_path_div->phydm_dtp_state = PHYDM_DTP_RUNNING_1;
- }
-
- else if (p_dm_path_div->phydm_dtp_state == PHYDM_DTP_RUNNING_1) {
- p_dm_path_div->dtp_check_patha_counter++;
-
- if (p_dm_path_div->dtp_check_patha_counter >= NUM_RESET_DTP_PERIOD) {
- p_dm_path_div->dtp_check_patha_counter = 0;
- p_dm_path_div->phydm_dtp_state = PHYDM_DTP_INIT;
- }
- /* 2 Search space update */
- else {
- /* 1. find the worst candidate */
-
-
- /* 2. repalce the worst candidate */
- }
- }
- }
-
- /* 2 Dynamic path Selection H2C */
-
- if (p_dm_path_div->num_candidate == 1)
- return;
- else {
- h2c_parameter[0] = p_dm_path_div->num_candidate;
- h2c_parameter[1] = p_dm_path_div->num_tx_path;
- h2c_parameter[2] = p_dm_path_div->ant_candidate_1;
- h2c_parameter[3] = p_dm_path_div->ant_candidate_2;
- h2c_parameter[4] = p_dm_path_div->ant_candidate_3;
-
- odm_fill_h2c_cmd(p_dm_odm, PHYDM_H2C_DYNAMIC_TX_PATH, 6, h2c_parameter);
- }
-
-}
-
-
-
-void
-phydm_dynamic_tx_path_init(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ODM_PATH_DIVERSITY_ *p_dm_path_div = &(p_dm_odm->dm_path_div);
- struct _ADAPTER *p_adapter = p_dm_odm->adapter;
-#if ((DM_ODM_SUPPORT_TYPE == ODM_WIN) && USB_SWITCH_SUPPORT)
- USB_MODE_MECH *p_usb_mode_mech = &p_adapter->usb_mode_mechanism;
-#endif
- u8 search_space_2[NUM_CHOOSE2_FROM4] = {PHYDM_AB, PHYDM_AC, PHYDM_AD, PHYDM_BC, PHYDM_BD, PHYDM_CD };
- u8 search_space_3[NUM_CHOOSE3_FROM4] = {PHYDM_BCD, PHYDM_ACD, PHYDM_ABD, PHYDM_ABC};
-
-#if ((DM_ODM_SUPPORT_TYPE == ODM_WIN) && USB_SWITCH_SUPPORT)
- p_dm_path_div->is_u3_mode = (p_usb_mode_mech->cur_usb_mode == USB_MODE_U3) ? 1 : 0 ;
-#else
- p_dm_path_div->is_u3_mode = 1;
-#endif
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("Dynamic TX path Init 8814\n"));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("is_u3_mode = (( %d ))\n", p_dm_path_div->is_u3_mode));
-
- memcpy(&(p_dm_path_div->search_space_2[0]), &(search_space_2[0]), NUM_CHOOSE2_FROM4);
- memcpy(&(p_dm_path_div->search_space_3[0]), &(search_space_3[0]), NUM_CHOOSE3_FROM4);
-
- p_dm_path_div->use_path_a_as_default_ant = 1;
- p_dm_path_div->phydm_dtp_state = PHYDM_DTP_INIT;
- p_dm_odm->path_select = PHYDM_AUTO_PATH;
- p_dm_path_div->phydm_path_div_type = PHYDM_4R_PATH_DIV;
-
-
- if (p_dm_path_div->is_u3_mode) {
- p_dm_path_div->num_tx_path = 3;
- phydm_dtp_fix_tx_path(p_dm_odm, PHYDM_BCD);/* 3TX Set Init TX path*/
-
- } else {
- p_dm_path_div->num_tx_path = 2;
- phydm_dtp_fix_tx_path(p_dm_odm, PHYDM_BC);/* 2TX // Set Init TX path*/
- }
-
-}
-
-
-void
-phydm_process_rssi_for_path_div(
- void *p_dm_void,
- void *p_phy_info_void,
- void *p_pkt_info_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _odm_phy_status_info_ *p_phy_info = (struct _odm_phy_status_info_ *)p_phy_info_void;
- struct _odm_per_pkt_info_ *p_pktinfo = (struct _odm_per_pkt_info_ *)p_pkt_info_void;
- struct _ODM_PATH_DIVERSITY_ *p_dm_path_div = &(p_dm_odm->dm_path_div);
-
- if (p_pktinfo->is_packet_to_self || p_pktinfo->is_packet_match_bssid) {
- if (p_pktinfo->data_rate > ODM_RATE11M) {
- if (p_dm_path_div->phydm_path_div_type == PHYDM_4R_PATH_DIV) {
-#if RTL8814A_SUPPORT
- if (p_dm_odm->support_ic_type & ODM_RTL8814A) {
- p_dm_path_div->path_a_sum_all += p_phy_info->rx_mimo_signal_strength[0];
- p_dm_path_div->path_a_cnt_all++;
-
- p_dm_path_div->path_b_sum_all += p_phy_info->rx_mimo_signal_strength[1];
- p_dm_path_div->path_b_cnt_all++;
-
- p_dm_path_div->path_c_sum_all += p_phy_info->rx_mimo_signal_strength[2];
- p_dm_path_div->path_c_cnt_all++;
-
- p_dm_path_div->path_d_sum_all += p_phy_info->rx_mimo_signal_strength[3];
- p_dm_path_div->path_d_cnt_all++;
- }
-#endif
- } else {
- p_dm_path_div->path_a_sum[p_pktinfo->station_id] += p_phy_info->rx_mimo_signal_strength[0];
- p_dm_path_div->path_a_cnt[p_pktinfo->station_id]++;
-
- p_dm_path_div->path_b_sum[p_pktinfo->station_id] += p_phy_info->rx_mimo_signal_strength[1];
- p_dm_path_div->path_b_cnt[p_pktinfo->station_id]++;
- }
- }
- }
-
-
-}
-
-#endif /* #if RTL8814A_SUPPORT */
-
-void
-odm_pathdiv_debug(
- void *p_dm_void,
+void odm_pathdiv_debug(void *p_dm_void,
u32 *const dm_value,
u32 *_used,
char *output,
@@ -566,20 +73,6 @@ phydm_c2h_dtp_handler(
u8 nsc_3 = cmd_buf[4];
ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("Target_candidate = (( %d ))\n", target));
- /*
- if( (nsc_1 >= nsc_2) && (nsc_1 >= nsc_3))
- {
- phydm_dtp_fix_tx_path(p_dm_odm, p_dm_path_div->ant_candidate_1);
- }
- else if( nsc_2 >= nsc_3)
- {
- phydm_dtp_fix_tx_path(p_dm_odm, p_dm_path_div->ant_candidate_2);
- }
- else
- {
- phydm_dtp_fix_tx_path(p_dm_odm, p_dm_path_div->ant_candidate_3);
- }
- */
#endif
}
@@ -594,20 +87,6 @@ odm_path_diversity(
ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("Return: Not Support PathDiv\n"));
return;
}
-
-#if RTL8812A_SUPPORT
-
- if (p_dm_odm->support_ic_type & ODM_RTL8812)
- odm_path_diversity_8812a(p_dm_odm);
- else
-#endif
-
-#if RTL8814A_SUPPORT
- if (p_dm_odm->support_ic_type & ODM_RTL8814A)
- phydm_dynamic_tx_path(p_dm_odm);
- else
-#endif
- {}
#endif
}
@@ -628,69 +107,5 @@ odm_path_diversity_init(
ODM_RT_TRACE(p_dm_odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, ("Return: Not Support PathDiv\n"));
return;
}
-
-#if RTL8812A_SUPPORT
- if (p_dm_odm->support_ic_type & ODM_RTL8812)
- odm_path_diversity_init_8812a(p_dm_odm);
- else
-#endif
-
-#if RTL8814A_SUPPORT
- if (p_dm_odm->support_ic_type & ODM_RTL8814A)
- phydm_dynamic_tx_path_init(p_dm_odm);
- else
-#endif
- {}
#endif
}
-
-
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-/*
- * 2011/12/02 MH Copy from MP oursrc for temporarily test.
- * */
-
-void
-odm_path_div_chk_ant_switch_callback(
- struct timer_list *p_timer
-)
-{
-}
-
-void
-odm_path_div_chk_ant_switch_workitem_callback(
- void *p_context
-)
-{
-}
-
-void
-odm_cck_tx_path_diversity_callback(
- struct timer_list *p_timer
-)
-{
-}
-
-void
-odm_cck_tx_path_diversity_work_item_callback(
- void *p_context
-)
-{
-}
-u8
-odm_sw_ant_div_select_scan_chnl(
- struct _ADAPTER *adapter
-)
-{
- return 0;
-}
-void
-odm_sw_ant_div_construct_scan_chnl(
- struct _ADAPTER *adapter,
- u8 scan_chnl
-)
-{
-}
-
-#endif /* #if (DM_ODM_SUPPORT_TYPE == ODM_WIN) */
diff --git a/hal/phydm/phydm_pathdiv.h b/hal/phydm/phydm_pathdiv.h
index 33e8f9e..776e815 100644
--- a/hal/phydm/phydm_pathdiv.h
+++ b/hal/phydm/phydm_pathdiv.h
@@ -149,171 +149,4 @@ odm_pathdiv_debug(
u32 *_out_len
);
-
-
-/* 1 [OLD IC]-------------------------------------------------------------------------------- */
-
-
-
-
-
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
-
-/* #define PATHDIV_ENABLE 1 */
-#define dm_path_div_rssi_check odm_path_div_chk_per_pkt_rssi
-#define path_div_check_before_link8192c odm_path_diversity_before_link92c
-
-
-
-
-struct _path_div_parameter_define_ {
- u32 org_5g_rege30;
- u32 org_5g_regc14;
- u32 org_5g_regca0;
- u32 swt_5g_rege30;
- u32 swt_5g_regc14;
- u32 swt_5g_regca0;
- /* for 2G IQK information */
- u32 org_2g_regc80;
- u32 org_2g_regc4c;
- u32 org_2g_regc94;
- u32 org_2g_regc14;
- u32 org_2g_regca0;
-
- u32 swt_2g_regc80;
- u32 swt_2g_regc4c;
- u32 swt_2g_regc94;
- u32 swt_2g_regc14;
- u32 swt_2g_regca0;
-};
-
-void
-odm_path_diversity_init_92c(
- struct _ADAPTER *adapter
-);
-
-void
-odm_2t_path_diversity_init_92c(
- struct _ADAPTER *adapter
-);
-
-void
-odm_1t_path_diversity_init_92c(
- struct _ADAPTER *adapter
-);
-
-bool
-odm_is_connected_92c(
- struct _ADAPTER *adapter
-);
-
-bool
-odm_path_diversity_before_link92c(
- /* struct _ADAPTER* adapter */
- struct PHY_DM_STRUCT *p_dm_odm
-);
-
-void
-odm_path_diversity_after_link_92c(
- struct _ADAPTER *adapter
-);
-
-void
-odm_set_resp_path_92c(
- struct _ADAPTER *adapter,
- u8 default_resp_path
-);
-
-void
-odm_ofdm_tx_path_diversity_92c(
- struct _ADAPTER *adapter
-);
-
-void
-odm_cck_tx_path_diversity_92c(
- struct _ADAPTER *adapter
-);
-
-void
-odm_reset_path_diversity_92c(
- struct _ADAPTER *adapter
-);
-
-void
-odm_cck_tx_path_diversity_callback(
- struct timer_list *p_timer
-);
-
-void
-odm_cck_tx_path_diversity_work_item_callback(
- void *p_context
-);
-
-void
-odm_path_div_chk_ant_switch_callback(
- struct timer_list *p_timer
-);
-
-void
-odm_path_div_chk_ant_switch_workitem_callback(
- void *p_context
-);
-
-
-void
-odm_path_div_chk_ant_switch(
- struct PHY_DM_STRUCT *p_dm_odm
-);
-
-void
-odm_cck_path_diversity_chk_per_pkt_rssi(
- struct _ADAPTER *adapter,
- bool is_def_port,
- bool is_match_bssid,
- struct _WLAN_STA *p_entry,
- PRT_RFD p_rfd,
- u8 *p_desc
-);
-
-void
-odm_path_div_chk_per_pkt_rssi(
- struct _ADAPTER *adapter,
- bool is_def_port,
- bool is_match_bssid,
- struct _WLAN_STA *p_entry,
- PRT_RFD p_rfd
-);
-
-void
-odm_path_div_rest_after_link(
- struct PHY_DM_STRUCT *p_dm_odm
-);
-
-void
-odm_fill_tx_path_in_txdesc(
- struct _ADAPTER *adapter,
- PRT_TCB p_tcb,
- u8 *p_desc
-);
-
-void
-odm_path_div_init_92d(
- struct PHY_DM_STRUCT *p_dm_odm
-);
-
-u8
-odm_sw_ant_div_select_scan_chnl(
- struct _ADAPTER *adapter
-);
-
-void
-odm_sw_ant_div_construct_scan_chnl(
- struct _ADAPTER *adapter,
- u8 scan_chnl
-);
-
-#endif /* #if(DM_ODM_SUPPORT_TYPE & (ODM_WIN)) */
-
-
#endif /* #ifndef __ODMPATHDIV_H__ */
diff --git a/hal/phydm/phydm_powertracking_ap.c b/hal/phydm/phydm_powertracking_ap.c
deleted file mode 100644
index 9da2136..0000000
--- a/hal/phydm/phydm_powertracking_ap.c
+++ /dev/null
@@ -1,1150 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-
-/* ************************************************************
- * include files
- * ************************************************************ */
-#include "mp_precomp.h"
-#include "phydm_precomp.h"
-
-#if !defined(_OUTSRC_COEXIST)
-/* ************************************************************
- * Global var
- * ************************************************************ */
-
-
-u32 ofdm_swing_table_new[OFDM_TABLE_SIZE_92D] = {
- 0x0b40002d, /* 0, -15.0dB */
- 0x0c000030, /* 1, -14.5dB */
- 0x0cc00033, /* 2, -14.0dB */
- 0x0d800036, /* 3, -13.5dB */
- 0x0e400039, /* 4, -13.0dB */
- 0x0f00003c, /* 5, -12.5dB */
- 0x10000040, /* 6, -12.0dB */
- 0x11000044, /* 7, -11.5dB */
- 0x12000048, /* 8, -11.0dB */
- 0x1300004c, /* 9, -10.5dB */
- 0x14400051, /* 10, -10.0dB */
- 0x15800056, /* 11, -9.5dB */
- 0x16c0005b, /* 12, -9.0dB */
- 0x18000060, /* 13, -8.5dB */
- 0x19800066, /* 14, -8.0dB */
- 0x1b00006c, /* 15, -7.5dB */
- 0x1c800072, /* 16, -7.0dB */
- 0x1e400079, /* 17, -6.5dB */
- 0x20000080, /* 18, -6.0dB */
- 0x22000088, /* 19, -5.5dB */
- 0x24000090, /* 20, -5.0dB */
- 0x26000098, /* 21, -4.5dB */
- 0x288000a2, /* 22, -4.0dB */
- 0x2ac000ab, /* 23, -3.5dB */
- 0x2d4000b5, /* 24, -3.0dB */
- 0x300000c0, /* 25, -2.5dB */
- 0x32c000cb, /* 26, -2.0dB */
- 0x35c000d7, /* 27, -1.5dB */
- 0x390000e4, /* 28, -1.0dB */
- 0x3c8000f2, /* 29, -0.5dB */
- 0x40000100, /* 30, +0dB */
- 0x43c0010f, /* 31, +0.5dB */
- 0x47c0011f, /* 32, +1.0dB */
- 0x4c000130, /* 33, +1.5dB */
- 0x50800142, /* 34, +2.0dB */
- 0x55400155, /* 35, +2.5dB */
- 0x5a400169, /* 36, +3.0dB */
- 0x5fc0017f, /* 37, +3.5dB */
- 0x65400195, /* 38, +4.0dB */
- 0x6b8001ae, /* 39, +4.5dB */
- 0x71c001c7, /* 40, +5.0dB */
- 0x788001e2, /* 41, +5.5dB */
- 0x7f8001fe /* 42, +6.0dB */
-};
-
-u8 cck_swing_table_ch1_ch13_new[CCK_TABLE_SIZE][8] = {
- {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01}, /* 0, -16.0dB */
- {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, /* 1, -15.5dB */
- {0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, /* 2, -15.0dB */
- {0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, /* 3, -14.5dB */
- {0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, /* 4, -14.0dB */
- {0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, /* 5, -13.5dB */
- {0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, /* 6, -13.0dB */
- {0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, /* 7, -12.5dB */
- {0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, /* 8, -12.0dB */
- {0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, /* 9, -11.5dB */
- {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, /* 10, -11.0dB */
- {0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, /* 11, -10.5dB */
- {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, /* 12, -10.0dB */
- {0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, /* 13, -9.5dB */
- {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, /* 14, -9.0dB */
- {0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, /* 15, -8.5dB */
- {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, /* 16, -8.0dB */
- {0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, /* 17, -7.5dB */
- {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, /* 18, -7.0dB */
- {0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, /* 19, -6.5dB */
- {0x1c, 0x1a, 0x18, 0x12, 0x0e, 0x08, 0x04, 0x02}, /* 20, -6.0dB */
- {0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, /* 21, -5.5dB */
- {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, /* 22, -5.0dB */
- {0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, /* 23, -4.5dB */
- {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, /* 24, -4.0dB */
- {0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, /* 25, -3.5dB */
- {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, /* 26, -3.0dB */
- {0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, /* 27, -2.5dB */
- {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, /* 28, -2.0dB */
- {0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, /* 29, -1.5dB */
- {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, /* 30, -1.0dB */
- {0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, /* 31, -0.5dB */
- {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04} /* 32, +0dB */
-};
-
-
-u8 cck_swing_table_ch14_new[CCK_TABLE_SIZE][8] = {
- {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00}, /* 0, -16.0dB */
- {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 1, -15.5dB */
- {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 2, -15.0dB */
- {0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 3, -14.5dB */
- {0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 4, -14.0dB */
- {0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 5, -13.5dB */
- {0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 6, -13.0dB */
- {0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 7, -12.5dB */
- {0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, /* 8, -12.0dB */
- {0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, /* 9, -11.5dB */
- {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, /* 10, -11.0dB */
- {0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, /* 11, -10.5dB */
- {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, /* 12, -10.0dB */
- {0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, /* 13, -9.5dB */
- {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, /* 14, -9.0dB */
- {0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, /* 15, -8.5dB */
- {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, /* 16, -8.0dB */
- {0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, /* 17, -7.5dB */
- {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, /* 18, -7.0dB */
- {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, /* 19, -6.5dB */
- {0x1c, 0x1a, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, /* 20, -6.0dB */
- {0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, /* 21, -5.5dB */
- {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, /* 22, -5.0dB */
- {0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, /* 23, -4.5dB */
- {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, /* 24, -4.0dB */
- {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, /* 25, -3.5dB */
- {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, /* 26, -3.0dB */
- {0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, /* 27, -2.5dB */
- {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, /* 28, -2.0dB */
- {0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, /* 29, -1.5dB */
- {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, /* 30, -1.0dB */
- {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, /* 31, -0.5dB */
- {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00} /* 32, +0dB */
-};
-
-u32 ofdm_swing_table[OFDM_TABLE_SIZE_92D] = {
- 0x0b40002d, /* 0, -15.0dB */
- 0x0c000030, /* 1, -14.5dB */
- 0x0cc00033, /* 2, -14.0dB */
- 0x0d800036, /* 3, -13.5dB */
- 0x0e400039, /* 4, -13.0dB */
- 0x0f00003c, /* 5, -12.5dB */
- 0x10000040, /* 6, -12.0dB */
- 0x11000044, /* 7, -11.5dB */
- 0x12000048, /* 8, -11.0dB */
- 0x1300004c, /* 9, -10.5dB */
- 0x14400051, /* 10, -10.0dB */
- 0x15800056, /* 11, -9.5dB */
- 0x16c0005b, /* 12, -9.0dB */
- 0x18000060, /* 13, -8.5dB */
- 0x19800066, /* 14, -8.0dB */
- 0x1b00006c, /* 15, -7.5dB */
- 0x1c800072, /* 16, -7.0dB */
- 0x1e400079, /* 17, -6.5dB */
- 0x20000080, /* 18, -6.0dB */
- 0x22000088, /* 19, -5.5dB */
- 0x24000090, /* 20, -5.0dB */
- 0x26000098, /* 21, -4.5dB */
- 0x288000a2, /* 22, -4.0dB */
- 0x2ac000ab, /* 23, -3.5dB */
- 0x2d4000b5, /* 24, -3.0dB */
- 0x300000c0, /* 25, -2.5dB */
- 0x32c000cb, /* 26, -2.0dB */
- 0x35c000d7, /* 27, -1.5dB */
- 0x390000e4, /* 28, -1.0dB */
- 0x3c8000f2, /* 29, -0.5dB */
- 0x40000100, /* 30, +0dB */
- 0x43c0010f, /* 31, +0.5dB */
- 0x47c0011f, /* 32, +1.0dB */
- 0x4c000130, /* 33, +1.5dB */
- 0x50800142, /* 34, +2.0dB */
- 0x55400155, /* 35, +2.5dB */
- 0x5a400169, /* 36, +3.0dB */
- 0x5fc0017f, /* 37, +3.5dB */
- 0x65400195, /* 38, +4.0dB */
- 0x6b8001ae, /* 39, +4.5dB */
- 0x71c001c7, /* 40, +5.0dB */
- 0x788001e2, /* 41, +5.5dB */
- 0x7f8001fe /* 42, +6.0dB */
-};
-
-
-u8 cck_swing_table_ch1_ch13[CCK_TABLE_SIZE][8] = {
- {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01}, /* 0, -16.0dB */
- {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, /* 1, -15.5dB */
- {0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, /* 2, -15.0dB */
- {0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, /* 3, -14.5dB */
- {0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, /* 4, -14.0dB */
- {0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, /* 5, -13.5dB */
- {0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, /* 6, -13.0dB */
- {0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, /* 7, -12.5dB */
- {0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, /* 8, -12.0dB */
- {0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, /* 9, -11.5dB */
- {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, /* 10, -11.0dB */
- {0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, /* 11, -10.5dB */
- {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, /* 12, -10.0dB */
- {0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, /* 13, -9.5dB */
- {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, /* 14, -9.0dB */
- {0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, /* 15, -8.5dB */
- {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, /* 16, -8.0dB */
- {0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, /* 17, -7.5dB */
- {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, /* 18, -7.0dB */
- {0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, /* 19, -6.5dB */
- {0x1c, 0x1a, 0x18, 0x12, 0x0e, 0x08, 0x04, 0x02}, /* 20, -6.0dB */
- {0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, /* 21, -5.5dB */
- {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, /* 22, -5.0dB */
- {0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, /* 23, -4.5dB */
- {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, /* 24, -4.0dB */
- {0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, /* 25, -3.5dB */
- {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, /* 26, -3.0dB */
- {0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, /* 27, -2.5dB */
- {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, /* 28, -2.0dB */
- {0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, /* 29, -1.5dB */
- {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, /* 30, -1.0dB */
- {0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, /* 31, -0.5dB */
- {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04} /* 32, +0dB */
-};
-
-
-u8 cck_swing_table_ch14[CCK_TABLE_SIZE][8] = {
- {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00}, /* 0, -16.0dB */
- {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 1, -15.5dB */
- {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 2, -15.0dB */
- {0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 3, -14.5dB */
- {0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 4, -14.0dB */
- {0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 5, -13.5dB */
- {0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 6, -13.0dB */
- {0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 7, -12.5dB */
- {0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, /* 8, -12.0dB */
- {0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, /* 9, -11.5dB */
- {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, /* 10, -11.0dB */
- {0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, /* 11, -10.5dB */
- {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, /* 12, -10.0dB */
- {0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, /* 13, -9.5dB */
- {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, /* 14, -9.0dB */
- {0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, /* 15, -8.5dB */
- {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, /* 16, -8.0dB */
- {0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, /* 17, -7.5dB */
- {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, /* 18, -7.0dB */
- {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, /* 19, -6.5dB */
- {0x1c, 0x1a, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, /* 20, -6.0dB */
- {0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, /* 21, -5.5dB */
- {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, /* 22, -5.0dB */
- {0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, /* 23, -4.5dB */
- {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, /* 24, -4.0dB */
- {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, /* 25, -3.5dB */
- {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, /* 26, -3.0dB */
- {0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, /* 27, -2.5dB */
- {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, /* 28, -2.0dB */
- {0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, /* 29, -1.5dB */
- {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, /* 30, -1.0dB */
- {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, /* 31, -0.5dB */
- {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00} /* 32, +0dB */
-};
-
-u8 cck_swing_table_ch1_ch14_88f[CCK_TABLE_SIZE_88F][16] = {
- {0x16, 0x15, 0x13, 0x10, 0xD, 0x9, 0x6, 0x3, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 0 -16dB */
- {0x18, 0x17, 0x15, 0x12, 0xE, 0xA, 0x7, 0x4, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 1 -15.5dB */
- {0x1B, 0x1A, 0x18, 0x14, 0x10, 0xB, 0x7, 0x4, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 2 -15dB */
- {0x1F, 0x1E, 0x1B, 0x17, 0x12, 0xD, 0x8, 0x5, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 3 -14.5dB */
- {0x22, 0x21, 0x1E, 0x19, 0x14, 0xE, 0x9, 0x5, 0x3, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 4 -14dB */
- {0x26, 0x25, 0x22, 0x1C, 0x16, 0x10, 0xA, 0x6, 0x3, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 5 -13.5dB */
- {0x2B, 0x2A, 0x26, 0x20, 0x19, 0x12, 0xC, 0x7, 0x3, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 6 -13dB */
- {0x30, 0x2F, 0x2A, 0x24, 0x1C, 0x14, 0xD, 0x8, 0x4, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 7 -12.5dB */
- {0x36, 0x34, 0x2F, 0x28, 0x1F, 0x17, 0xF, 0x9, 0x4, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 8 -12dB */
- {0x3D, 0x3B, 0x35, 0x2D, 0x23, 0x19, 0x11, 0xA, 0x5, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 9 -11.5dB */
- {0x44, 0x42, 0x3C, 0x33, 0x28, 0x1C, 0x13, 0xB, 0x5, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 10 -11dB */
- {0x4D, 0x4A, 0x43, 0x39, 0x2C, 0x20, 0x15, 0xC, 0x6, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 11 -10.5dB */
- {0x56, 0x53, 0x4B, 0x40, 0x32, 0x24, 0x17, 0xE, 0x6, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 12 -10dB */
- {0x60, 0x5D, 0x54, 0x47, 0x38, 0x28, 0x1A, 0xF, 0x7, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 13 -9.5dB */
- {0x6C, 0x69, 0x5F, 0x50, 0x3F, 0x2D, 0x1E, 0x11, 0x8, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 14 -9dB */
- {0x79, 0x76, 0x6A, 0x5A, 0x46, 0x33, 0x21, 0x13, 0x9, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 15 -8.5dB */
- {0x88, 0x84, 0x77, 0x65, 0x4F, 0x39, 0x25, 0x15, 0xA, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 16 -8dB */
- {0x99, 0x94, 0x86, 0x71, 0x58, 0x40, 0x2A, 0x18, 0xB, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 17 -7.5dB */
- {0xAC, 0xA6, 0x96, 0x7F, 0x63, 0x47, 0x2F, 0x1B, 0xD, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 18 -7dB */
- {0xC1, 0xBA, 0xA8, 0x8F, 0x6F, 0x50, 0x35, 0x1E, 0xE, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 19 -6.5dB */
- {0xD8, 0xD1, 0xBD, 0xA0, 0x7D, 0x5A, 0x3B, 0x22, 0x10, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} /* 20 -6dB */
-};
-
-
-u8 cck_swing_table_ch1_ch13_88f[CCK_TABLE_SIZE_88F][16] = {
- {0x16, 0x15, 0x13, 0x10, 0xD, 0x9, 0x6, 0x3, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 0 -16dB */
- {0x18, 0x17, 0x15, 0x12, 0xE, 0xA, 0x7, 0x4, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 1 -15.5dB */
- {0x1B, 0x1A, 0x18, 0x14, 0x10, 0xB, 0x7, 0x4, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 2 -15dB */
- {0x1F, 0x1E, 0x1B, 0x17, 0x12, 0xD, 0x8, 0x5, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 3 -14.5dB */
- {0x22, 0x21, 0x1E, 0x19, 0x14, 0xE, 0x9, 0x5, 0x3, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 4 -14dB */
- {0x26, 0x25, 0x22, 0x1C, 0x16, 0x10, 0xA, 0x6, 0x3, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 5 -13.5dB */
- {0x2B, 0x2A, 0x26, 0x20, 0x19, 0x12, 0xC, 0x7, 0x3, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 6 -13dB */
- {0x30, 0x2F, 0x2A, 0x24, 0x1C, 0x14, 0xD, 0x8, 0x4, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 7 -12.5dB */
- {0x36, 0x34, 0x2F, 0x28, 0x1F, 0x17, 0xF, 0x9, 0x4, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 8 -12dB */
- {0x3D, 0x3B, 0x35, 0x2D, 0x23, 0x19, 0x11, 0xA, 0x5, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 9 -11.5dB */
- {0x44, 0x42, 0x3C, 0x33, 0x28, 0x1C, 0x13, 0xB, 0x5, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 10 -11dB */
- {0x4D, 0x4A, 0x43, 0x39, 0x2C, 0x20, 0x15, 0xC, 0x6, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 11 -10.5dB */
- {0x56, 0x53, 0x4B, 0x40, 0x32, 0x24, 0x17, 0xE, 0x6, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 12 -10dB */
- {0x60, 0x5D, 0x54, 0x47, 0x38, 0x28, 0x1A, 0xF, 0x7, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 13 -9.5dB */
- {0x6C, 0x69, 0x5F, 0x50, 0x3F, 0x2D, 0x1E, 0x11, 0x8, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 14 -9dB */
- {0x79, 0x76, 0x6A, 0x5A, 0x46, 0x33, 0x21, 0x13, 0x9, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 15 -8.5dB */
- {0x88, 0x84, 0x77, 0x65, 0x4F, 0x39, 0x25, 0x15, 0xA, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 16 -8dB */
- {0x99, 0x94, 0x86, 0x71, 0x58, 0x40, 0x2A, 0x18, 0xB, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 17 -7.5dB */
- {0xAC, 0xA6, 0x96, 0x7F, 0x63, 0x47, 0x2F, 0x1B, 0xD, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 18 -7dB */
- {0xC1, 0xBA, 0xA8, 0x8F, 0x6F, 0x50, 0x35, 0x1E, 0xE, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, /* 19 -6.5dB */
- {0xD8, 0xD1, 0xBD, 0xA0, 0x7D, 0x5A, 0x3B, 0x22, 0x10, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} /* 20 -6dB */
-};
-
-
-u8 cck_swing_table_ch14_88f[CCK_TABLE_SIZE_88F][16] = {
- {0x44, 0x42, 0x3C, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-16dB*/
- {0x48, 0x46, 0x3F, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-15.5dB*/
- {0x4D, 0x4A, 0x43, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-15dB*/
- {0x51, 0x4F, 0x47, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-14.5dB*/
- {0x56, 0x53, 0x4B, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-14dB*/
- {0x5B, 0x58, 0x50, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-13.5dB*/
- {0x60, 0x5D, 0x54, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-13dB*/
- {0x66, 0x63, 0x59, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-12.5dB*/
- {0x6C, 0x69, 0x5F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-12dB*/
- {0x73, 0x6F, 0x64, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-11.5dB*/
- {0x79, 0x76, 0x6A, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-11dB*/
- {0x81, 0x7C, 0x71, 0x4A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-10.5dB*/
- {0x88, 0x84, 0x77, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-10dB*/
- {0x90, 0x8C, 0x7E, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-9.5dB*/
- {0x99, 0x94, 0x86, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-9dB*/
- {0xA2, 0x9D, 0x8E, 0x5E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-8.5dB*/
- {0xAC, 0xA6, 0x96, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-8dB*/
- {0xB6, 0xB0, 0x9F, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-7.5dB*/
- {0xC1, 0xBA, 0xA8, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-7dB*/
- {0xCC, 0xC5, 0xB2, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-6.5dB*/
- {0xD8, 0xD1, 0xBD, 0x7D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} /*-6dB*/
-};
-
-
-
-#if 0
-u32 ofdm_swing_table_92e[OFDM_TABLE_SIZE_92E] = {
- /* Index0 6 dB */ 0x7fc001ff,
- /* Index1 5.7dB */ 0x7b4001ed,
- /* Index2 5.4dB */ 0x774001dd,
- /* Index3 5.1dB */ 0x734001cd,
- /* Index4 4.8dB */ 0x6f4001bd,
- /* Index5 4.5dB */ 0x6b8001ae,
- /* Index6 4.2dB */ 0x67c0019f,
- /* Index7 3.9dB */ 0x64400191,
- /* Index8 3.6dB */ 0x60c00183,
- /* Index9 3.3dB */ 0x5d800176,
- /* Index10 3 dB */ 0x5a80016a,
- /* Index11 2.7dB */ 0x5740015d,
- /* Index12 2.4dB */ 0x54400151,
- /* Index13 2.1dB */ 0x51800146,
- /* Index14 1.8dB */ 0x4ec0013b,
- /* Index15 1.5dB */ 0x4c000130,
- /* Index16 1.2dB */ 0x49800126,
- /* Index17 0.9dB */ 0x4700011c,
- /* Index18 0.6dB */ 0x44800112,
- /* Index19 0.3dB */ 0x42000108,
- /* Index20 0 dB */ 0x40000100, /* 20 This is OFDM base index */
- /* Index21 -0.3dB */ 0x3dc000f7,
- /* Index22 -0.6dB */ 0x3bc000ef,
- /* Index23 -0.9dB */ 0x39c000e7,
- /* Index24 -1.2dB */ 0x37c000df,
- /* Index25 -1.5dB */ 0x35c000d7,
- /* Index26 -1.8dB */ 0x340000d0,
- /* Index27 -2.1dB */ 0x324000c9,
- /* Index28 -2.4dB */ 0x308000c2,
- /* Index29 -2.7dB */ 0x2f0000bc,
- /* Index30 -3 dB */ 0x2d4000b5,
- /* Index31 -3.3dB */ 0x2bc000af,
- /* Index32 -3.6dB */ 0x2a4000a9,
- /* Index33 -3.9dB */ 0x28c000a3,
- /* Index34 -4.2dB */ 0x2780009e,
- /* Index35 -4.5dB */ 0x26000098,
- /* Index36 -4.8dB */ 0x24c00093,
- /* Index37 -5.1dB */ 0x2380008e,
- /* Index38 -5.4dB */ 0x22400089,
- /* Index39 -5.7dB */ 0x21400085,
- /* Index40 -6 dB */ 0x20000080,
- /* Index41 -6.3dB */ 0x1f00007c,
- /* Index42 -6.6dB */ 0x1e000078,
- /* Index43 -6.9dB */ 0x1d000074,
- /* Index44 -7.2dB */ 0x1c000070,
- /* Index45 -7.5dB */ 0x1b00006c,
- /* Index46 -7.8dB */ 0x1a000068,
- /* Index47 -8.1dB */ 0x19400065,
- /* Index48 -8.4dB */ 0x18400061,
- /* Index49 -8.7dB */ 0x1780005e,
- /* Index50 -9 dB */ 0x16c0005b,
- /* Index51 -9.3dB */ 0x16000058,
- /* Index52 -9.6dB */ 0x15400055,
- /* Index53 -9.9dB */ 0x14800052
-};
-u8 cck_swing_table_ch1_ch13_92e[CCK_TABLE_SIZE_92E][8] = {
- /* Index0 0 dB */ {0x36, 0x34, 0x2E, 0x26, 0x1C, 0x12, 0x08, 0x04},
- /* Index1 -0.3dB */ {0x34, 0x32, 0x2C, 0x25, 0x1B, 0x11, 0x08, 0x04},
- /* Index2 -0.6dB */ {0x32, 0x30, 0x2B, 0x23, 0x1A, 0x11, 0x07, 0x04},
- /* Index3 -0.9dB */ {0x31, 0x2F, 0x29, 0x22, 0x19, 0x10, 0x07, 0x04},
- /* Index4 -1.2dB */ {0x2F, 0x2D, 0x28, 0x21, 0x18, 0x10, 0x07, 0x03},
- /* Index5 -1.5dB */ {0x2D, 0x2C, 0x27, 0x20, 0x18, 0x0F, 0x07, 0x03},
- /* Index6 -1.8dB */ {0x2C, 0x2A, 0x25, 0x1F, 0x17, 0x0F, 0x06, 0x03},
- /* Index7 -2.1dB */ {0x2A, 0x29, 0x24, 0x1E, 0x16, 0x0E, 0x06, 0x03},
- /* Index8 -2.4dB */ {0x29, 0x27, 0x23, 0x1D, 0x15, 0x0E, 0x06, 0x03},
- /* Index9 -2.7dB */ {0x27, 0x26, 0x22, 0x1C, 0x14, 0x0D, 0x06, 0x03},
- /* Index10 -3 dB */ {0x26, 0x25, 0x20, 0x1B, 0x14, 0x0D, 0x06, 0x03},
- /* Index11 -3.3dB */ {0x25, 0x23, 0x1F, 0x1A, 0x13, 0x0C, 0x05, 0x03},
- /* Index12 -3.6dB */ {0x24, 0x22, 0x1E, 0x19, 0x12, 0x0C, 0x05, 0x03},
- /* Index13 -3.9dB */ {0x22, 0x21, 0x1D, 0x18, 0x12, 0x0B, 0x05, 0x03},
- /* Index14 -4.2dB */ {0x21, 0x20, 0x1C, 0x17, 0x11, 0x0B, 0x05, 0x02},
- /* Index15 -4.5dB */ {0x20, 0x1F, 0x1B, 0x17, 0x11, 0x0B, 0x05, 0x02},
- /* Index16 -4.8dB */ {0x1F, 0x1E, 0x1A, 0x16, 0x10, 0x0A, 0x05, 0x02},
- /* Index17 -5.1dB */ {0x1E, 0x1D, 0x1A, 0x15, 0x10, 0x0A, 0x04, 0x02},
- /* Index18 -5.4dB */ {0x1D, 0x1C, 0x19, 0x14, 0x0F, 0x0A, 0x04, 0x02},
- /* Index19 -5.7dB */ {0x1C, 0x1B, 0x18, 0x14, 0x0E, 0x09, 0x04, 0x02},
- /* Index20 -6.0dB */ {0x1B, 0x1A, 0x17, 0x13, 0x0E, 0x09, 0x04, 0x02}, /* 20 This is CCK base index */
- /* Index21 -6.3dB */ {0x1A, 0x19, 0x16, 0x12, 0x0E, 0x09, 0x04, 0x02},
- /* Index22 -6.6dB */ {0x19, 0x18, 0x15, 0x12, 0x0D, 0x08, 0x04, 0x02},
- /* Index23 -6.9dB */ {0x18, 0x17, 0x15, 0x11, 0x0D, 0x08, 0x04, 0x02},
- /* Index24 -7.2dB */ {0x18, 0x17, 0x14, 0x11, 0x0C, 0x08, 0x03, 0x02},
- /* Index25 -7.5dB */ {0x17, 0x16, 0x13, 0x10, 0x0C, 0x08, 0x03, 0x02},
- /* Index26 -7.8dB */ {0x16, 0x15, 0x13, 0x0F, 0x0B, 0x07, 0x03, 0x02},
- /* Index27 -8.1dB */ {0x15, 0x14, 0x12, 0x0F, 0x0B, 0x07, 0x03, 0x02},
- /* Index28 -8.4dB */ {0x14, 0x14, 0x11, 0x0E, 0x0B, 0x07, 0x03, 0x02},
- /* Index29 -8.7dB */ {0x14, 0x13, 0x11, 0x0E, 0x0A, 0x07, 0x03, 0x01},
- /* Index30 -9.0dB */ {0x13, 0x12, 0x10, 0x0D, 0x0A, 0x06, 0x03, 0x01}, /* 30 This is hp CCK base index */
- /* Index31 -9.3dB */ {0x12, 0x12, 0x0F, 0x0D, 0x0A, 0x06, 0x03, 0x01},
- /* Index32 -9.6dB */ {0x12, 0x11, 0x0F, 0x0D, 0x09, 0x06, 0x03, 0x01},
- /* Index33 -9.9dB */ {0x11, 0x11, 0x0F, 0x0C, 0x09, 0x06, 0x03, 0x01},
- /* Index34 -10.2dB */ {0x11, 0x11, 0x0E, 0x0C, 0x09, 0x06, 0x02, 0x01},
- /* Index35 -10.5dB */ {0x10, 0x0F, 0x0E, 0x0B, 0x08, 0x05, 0x02, 0x01},
- /* Index36 -10.8dB */ {0x10, 0x0F, 0x0D, 0x0B, 0x08, 0x05, 0x02, 0x01},
- /* Index37 -11.1dB */ {0x0F, 0x0E, 0x0D, 0x0A, 0x08, 0x05, 0x02, 0x01},
- /* Index38 -11.4dB */ {0x0E, 0x0E, 0x0C, 0x0A, 0x07, 0x05, 0x02, 0x01},
- /* Index39 -11.7dB */ {0x0E, 0x0D, 0x0C, 0x0A, 0x07, 0x05, 0x02, 0x01},
- /* Index40 -12 dB */ {0x0E, 0x0D, 0x0C, 0x0A, 0x07, 0x05, 0x02, 0x01},
- /* Index41 -12.3dB */ {0x0D, 0x0D, 0x0B, 0x09, 0x07, 0x04, 0x02, 0x01},
- /* Index42 -12.6dB */ {0x0D, 0x0C, 0x0B, 0x09, 0x07, 0x04, 0x02, 0x01},
- /* Index43 -12.9dB */ {0x0C, 0x0C, 0x0A, 0x09, 0x06, 0x04, 0x02, 0x01},
- /* Index44 -13.2dB */ {0x0C, 0x0B, 0x0A, 0x08, 0x06, 0x04, 0x02, 0x01},
- /* Index45 -13.5dB */ {0x0B, 0x0B, 0x0A, 0x08, 0x06, 0x04, 0x02, 0x01},
- /* Index46 -13.8dB */ {0x0B, 0x0B, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01},
- /* Index47 -14.1dB */ {0x0B, 0x0A, 0x09, 0x07, 0x06, 0x04, 0x02, 0x01},
- /* Index48 -14.4dB */ {0x0A, 0x0A, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01},
- /* Index49 -14.7dB */ {0x0A, 0x0A, 0x08, 0x07, 0x05, 0x03, 0x01, 0x01},
- /* Index50 -15 dB */ {0x0A, 0x09, 0x08, 0x07, 0x05, 0x03, 0x01, 0x01},
- /* Index51 -15.3dB */ {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01},
- /* Index52 -15.6dB */ {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01},
- /* Index53 -15.9dB */ {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01}
-};
-u8 cck_swing_table_ch14_92e[CCK_TABLE_SIZE_92E][8] = {
- /* Index0 0 dB */ {0x36, 0x34, 0x2E, 0x26, 0x00, 0x00, 0x00, 0x00},
- /* Index1 -0.3dB */ {0x34, 0x32, 0x2C, 0x25, 0x00, 0x00, 0x00, 0x00},
- /* Index2 -0.6dB */ {0x32, 0x30, 0x2B, 0x23, 0x00, 0x00, 0x00, 0x00},
- /* Index3 -0.9dB */ {0x31, 0x2F, 0x29, 0x22, 0x00, 0x00, 0x00, 0x00},
- /* Index4 -1.2dB */ {0x2F, 0x2D, 0x28, 0x21, 0x00, 0x00, 0x00, 0x00},
- /* Index5 -1.5dB */ {0x2D, 0x2C, 0x27, 0x20, 0x00, 0x00, 0x00, 0x00},
- /* Index6 -1.8dB */ {0x2C, 0x2A, 0x25, 0x1F, 0x00, 0x00, 0x00, 0x00},
- /* Index7 -2.1dB */ {0x2A, 0x29, 0x24, 0x1E, 0x00, 0x00, 0x00, 0x00},
- /* Index8 -2.4dB */ {0x29, 0x27, 0x23, 0x1D, 0x00, 0x00, 0x00, 0x00},
- /* Index9 -2.7dB */ {0x27, 0x26, 0x22, 0x1C, 0x00, 0x00, 0x00, 0x00},
- /* Index10 -3 dB */ {0x26, 0x25, 0x20, 0x1B, 0x00, 0x00, 0x00, 0x00},
- /* Index11 -3.3dB */ {0x25, 0x23, 0x1F, 0x1A, 0x00, 0x00, 0x00, 0x00},
- /* Index12 -3.6dB */ {0x24, 0x22, 0x1E, 0x19, 0x00, 0x00, 0x00, 0x00},
- /* Index13 -3.9dB */ {0x22, 0x21, 0x1D, 0x18, 0x00, 0x00, 0x00, 0x00},
- /* Index14 -4.2dB */ {0x21, 0x20, 0x1C, 0x17, 0x00, 0x00, 0x00, 0x00},
- /* Index15 -4.5dB */ {0x20, 0x1F, 0x1B, 0x17, 0x00, 0x00, 0x00, 0x00},
- /* Index16 -4.8dB */ {0x1F, 0x1E, 0x1A, 0x16, 0x00, 0x00, 0x00, 0x00},
- /* Index17 -5.1dB */ {0x1E, 0x1D, 0x1A, 0x15, 0x00, 0x00, 0x00, 0x00},
- /* Index18 -5.4dB */ {0x1D, 0x1C, 0x19, 0x14, 0x00, 0x00, 0x00, 0x00},
- /* Index19 -5.7dB */ {0x1C, 0x1B, 0x18, 0x14, 0x00, 0x00, 0x00, 0x00},
- /* Index20 -6 dB */ {0x1B, 0x1A, 0x17, 0x13, 0x00, 0x00, 0x00, 0x00},
- /* Index21 -6.3dB */ {0x1A, 0x19, 0x16, 0x12, 0x00, 0x00, 0x00, 0x00},
- /* Index22 -6.6dB */ {0x19, 0x18, 0x15, 0x12, 0x00, 0x00, 0x00, 0x00},
- /* Index23 -6.9dB */ {0x18, 0x17, 0x15, 0x11, 0x00, 0x00, 0x00, 0x00},
- /* Index24 -7.2dB */ {0x18, 0x17, 0x14, 0x11, 0x00, 0x00, 0x00, 0x00},
- /* Index25 -7.5dB */ {0x17, 0x16, 0x13, 0x10, 0x00, 0x00, 0x00, 0x00},
- /* Index26 -7.8dB */ {0x16, 0x15, 0x13, 0x0F, 0x00, 0x00, 0x00, 0x00},
- /* Index27 -8.1dB */ {0x15, 0x14, 0x12, 0x0F, 0x00, 0x00, 0x00, 0x00},
- /* Index28 -8.4dB */ {0x14, 0x14, 0x11, 0x0E, 0x00, 0x00, 0x00, 0x00},
- /* Index29 -8.7dB */ {0x14, 0x13, 0x11, 0x0E, 0x00, 0x00, 0x00, 0x00},
- /* Index30 -9 dB */ {0x13, 0x12, 0x10, 0x0D, 0x00, 0x00, 0x00, 0x00},
- /* Index31 -9.3dB */ {0x12, 0x12, 0x0F, 0x0D, 0x00, 0x00, 0x00, 0x00},
- /* Index32 -9.6dB */ {0x12, 0x11, 0x0F, 0x0D, 0x00, 0x00, 0x00, 0x00},
- /* Index33 -9.9dB */ {0x11, 0x11, 0x0F, 0x0C, 0x00, 0x00, 0x00, 0x00},
- /* Index34 -10.2dB */ {0x11, 0x11, 0x0E, 0x0C, 0x00, 0x00, 0x00, 0x00},
- /* Index35 -10.5dB */ {0x10, 0x0F, 0x0E, 0x0B, 0x00, 0x00, 0x00, 0x00},
- /* Index36 -10.8dB */ {0x10, 0x0F, 0x0D, 0x0B, 0x00, 0x00, 0x00, 0x00},
- /* Index37 -11.1dB */ {0x0F, 0x0E, 0x0D, 0x0A, 0x00, 0x00, 0x00, 0x00},
- /* Index38 -11.4dB */ {0x0E, 0x0E, 0x0C, 0x0A, 0x00, 0x00, 0x00, 0x00},
- /* Index39 -11.7dB */ {0x0E, 0x0D, 0x0C, 0x0A, 0x00, 0x00, 0x00, 0x00},
- /* Index40 -12 dB */ {0x0E, 0x0D, 0x0C, 0x0A, 0x00, 0x00, 0x00, 0x00},
- /* Index41 -12.3dB */ {0x0D, 0x0D, 0x0B, 0x09, 0x00, 0x00, 0x00, 0x00},
- /* Index42 -12.6dB */ {0x0D, 0x0C, 0x0B, 0x09, 0x00, 0x00, 0x00, 0x00},
- /* Index43 -12.9dB */ {0x0C, 0x0C, 0x0A, 0x09, 0x00, 0x00, 0x00, 0x00},
- /* Index44 -13.2dB */ {0x0C, 0x0B, 0x0A, 0x08, 0x00, 0x00, 0x00, 0x00},
- /* Index45 -13.5dB */ {0x0B, 0x0B, 0x0A, 0x08, 0x00, 0x00, 0x00, 0x00},
- /* Index46 -13.8dB */ {0x0B, 0x0B, 0x09, 0x08, 0x00, 0x00, 0x00, 0x00},
- /* Index47 -14.1dB */ {0x0B, 0x0A, 0x09, 0x07, 0x00, 0x00, 0x00, 0x00},
- /* Index48 -14.4dB */ {0x0A, 0x0A, 0x09, 0x07, 0x00, 0x00, 0x00, 0x00},
- /* Index49 -14.7dB */ {0x0A, 0x0A, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00},
- /* Index50 -15 dB */ {0x0A, 0x09, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00},
- /* Index51 -15.3dB */ {0x09, 0x09, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00},
- /* Index52 -15.6dB */ {0x09, 0x09, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00},
- /* Index53 -15.9dB */ {0x09, 0x08, 0x07, 0x06, 0x00, 0x00, 0x00, 0x00}
-};
-#endif
-
-#ifdef AP_BUILD_WORKAROUND
-
-unsigned int tx_pwr_trk_ofdm_swing_tbl[tx_pwr_trk_ofdm_swing_tbl_len] = {
- /* +6.0dB */ 0x7f8001fe,
- /* +5.5dB */ 0x788001e2,
- /* +5.0dB */ 0x71c001c7,
- /* +4.5dB */ 0x6b8001ae,
- /* +4.0dB */ 0x65400195,
- /* +3.5dB */ 0x5fc0017f,
- /* +3.0dB */ 0x5a400169,
- /* +2.5dB */ 0x55400155,
- /* +2.0dB */ 0x50800142,
- /* +1.5dB */ 0x4c000130,
- /* +1.0dB */ 0x47c0011f,
- /* +0.5dB */ 0x43c0010f,
- /* 0.0dB */ 0x40000100,
- /* -0.5dB */ 0x3c8000f2,
- /* -1.0dB */ 0x390000e4,
- /* -1.5dB */ 0x35c000d7,
- /* -2.0dB */ 0x32c000cb,
- /* -2.5dB */ 0x300000c0,
- /* -3.0dB */ 0x2d4000b5,
- /* -3.5dB */ 0x2ac000ab,
- /* -4.0dB */ 0x288000a2,
- /* -4.5dB */ 0x26000098,
- /* -5.0dB */ 0x24000090,
- /* -5.5dB */ 0x22000088,
- /* -6.0dB */ 0x20000080,
- /* -6.5dB */ 0x1a00006c,
- /* -7.0dB */ 0x1c800072,
- /* -7.5dB */ 0x18000060,
- /* -8.0dB */ 0x19800066,
- /* -8.5dB */ 0x15800056,
- /* -9.0dB */ 0x26c0005b,
- /* -9.5dB */ 0x14400051,
- /* -10.0dB */ 0x24400051,
- /* -10.5dB */ 0x1300004c,
- /* -11.0dB */ 0x12000048,
- /* -11.5dB */ 0x11000044,
- /* -12.0dB */ 0x10000040
-};
-#endif
-
-#endif
-
-
-u8 delta_swing_table_idx_2ga_p_default[DELTA_SWINGIDX_SIZE] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3
- , 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9
- };
-u8 delta_swing_table_idx_2ga_n_default[DELTA_SWINGIDX_SIZE] = {0, 0, 0, 2, 2, 3, 3, 4, 4, 4
- , 4, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11
- };
-
-
-#ifdef CONFIG_WLAN_HAL_8192EE
-u32 ofdm_swing_table_92e[OFDM_TABLE_SIZE_92E] = {
- /* Index0 6 dB */ 0x7fc001ff,
- /* Index1 5.7dB */ 0x7b4001ed,
- /* Index2 5.4dB */ 0x774001dd,
- /* Index3 5.1dB */ 0x734001cd,
- /* Index4 4.8dB */ 0x6f4001bd,
- /* Index5 4.5dB */ 0x6b8001ae,
- /* Index6 4.2dB */ 0x67c0019f,
- /* Index7 3.9dB */ 0x64400191,
- /* Index8 3.6dB */ 0x60c00183,
- /* Index9 3.3dB */ 0x5d800176,
- /* Index10 3 dB */ 0x5a80016a,
- /* Index11 2.7dB */ 0x5740015d,
- /* Index12 2.4dB */ 0x54400151,
- /* Index13 2.1dB */ 0x51800146,
- /* Index14 1.8dB */ 0x4ec0013b,
- /* Index15 1.5dB */ 0x4c000130,
- /* Index16 1.2dB */ 0x49800126,
- /* Index17 0.9dB */ 0x4700011c,
- /* Index18 0.6dB */ 0x44800112,
- /* Index19 0.3dB */ 0x42000108,
- /* Index20 0 dB */ 0x40000100, /* 20 This is OFDM base index */
- /* Index21 -0.3dB */ 0x3dc000f7,
- /* Index22 -0.6dB */ 0x3bc000ef,
- /* Index23 -0.9dB */ 0x39c000e7,
- /* Index24 -1.2dB */ 0x37c000df,
- /* Index25 -1.5dB */ 0x35c000d7,
- /* Index26 -1.8dB */ 0x340000d0,
- /* Index27 -2.1dB */ 0x324000c9,
- /* Index28 -2.4dB */ 0x308000c2,
- /* Index29 -2.7dB */ 0x2f0000bc,
- /* Index30 -3 dB */ 0x2d4000b5,
- /* Index31 -3.3dB */ 0x2bc000af,
- /* Index32 -3.6dB */ 0x2a4000a9,
- /* Index33 -3.9dB */ 0x28c000a3,
- /* Index34 -4.2dB */ 0x2780009e,
- /* Index35 -4.5dB */ 0x26000098,
- /* Index36 -4.8dB */ 0x24c00093,
- /* Index37 -5.1dB */ 0x2380008e,
- /* Index38 -5.4dB */ 0x22400089,
- /* Index39 -5.7dB */ 0x21400085,
- /* Index40 -6 dB */ 0x20000080,
- /* Index41 -6.3dB */ 0x1f00007c,
- /* Index42 -6.6dB */ 0x1e000078,
- /* Index43 -6.9dB */ 0x1d000074,
- /* Index44 -7.2dB */ 0x1c000070,
- /* Index45 -7.5dB */ 0x1b00006c,
- /* Index46 -7.8dB */ 0x1a000068,
- /* Index47 -8.1dB */ 0x19400065,
- /* Index48 -8.4dB */ 0x18400061,
- /* Index49 -8.7dB */ 0x1780005e,
- /* Index50 -9 dB */ 0x16c0005b,
- /* Index51 -9.3dB */ 0x16000058,
- /* Index52 -9.6dB */ 0x15400055,
- /* Index53 -9.9dB */ 0x14800052
-};
-u8 cck_swing_table_ch1_ch13_92e[CCK_TABLE_SIZE_92E][8] = {
- /* Index0 0 dB */ {0x36, 0x34, 0x2E, 0x26, 0x1C, 0x12, 0x08, 0x04},
- /* Index1 -0.3dB */ {0x34, 0x32, 0x2C, 0x25, 0x1B, 0x11, 0x08, 0x04},
- /* Index2 -0.6dB */ {0x32, 0x30, 0x2B, 0x23, 0x1A, 0x11, 0x07, 0x04},
- /* Index3 -0.9dB */ {0x31, 0x2F, 0x29, 0x22, 0x19, 0x10, 0x07, 0x04},
- /* Index4 -1.2dB */ {0x2F, 0x2D, 0x28, 0x21, 0x18, 0x10, 0x07, 0x03},
- /* Index5 -1.5dB */ {0x2D, 0x2C, 0x27, 0x20, 0x18, 0x0F, 0x07, 0x03},
- /* Index6 -1.8dB */ {0x2C, 0x2A, 0x25, 0x1F, 0x17, 0x0F, 0x06, 0x03},
- /* Index7 -2.1dB */ {0x2A, 0x29, 0x24, 0x1E, 0x16, 0x0E, 0x06, 0x03},
- /* Index8 -2.4dB */ {0x29, 0x27, 0x23, 0x1D, 0x15, 0x0E, 0x06, 0x03},
- /* Index9 -2.7dB */ {0x27, 0x26, 0x22, 0x1C, 0x14, 0x0D, 0x06, 0x03},
- /* Index10 -3 dB */ {0x26, 0x25, 0x20, 0x1B, 0x14, 0x0D, 0x06, 0x03},
- /* Index11 -3.3dB */ {0x25, 0x23, 0x1F, 0x1A, 0x13, 0x0C, 0x05, 0x03},
- /* Index12 -3.6dB */ {0x24, 0x22, 0x1E, 0x19, 0x12, 0x0C, 0x05, 0x03},
- /* Index13 -3.9dB */ {0x22, 0x21, 0x1D, 0x18, 0x12, 0x0B, 0x05, 0x03},
- /* Index14 -4.2dB */ {0x21, 0x20, 0x1C, 0x17, 0x11, 0x0B, 0x05, 0x02},
- /* Index15 -4.5dB */ {0x20, 0x1F, 0x1B, 0x17, 0x11, 0x0B, 0x05, 0x02},
- /* Index16 -4.8dB */ {0x1F, 0x1E, 0x1A, 0x16, 0x10, 0x0A, 0x05, 0x02},
- /* Index17 -5.1dB */ {0x1E, 0x1D, 0x1A, 0x15, 0x10, 0x0A, 0x04, 0x02},
- /* Index18 -5.4dB */ {0x1D, 0x1C, 0x19, 0x14, 0x0F, 0x0A, 0x04, 0x02},
- /* Index19 -5.7dB */ {0x1C, 0x1B, 0x18, 0x14, 0x0E, 0x09, 0x04, 0x02},
- /* Index20 -6.0dB */ {0x1B, 0x1A, 0x17, 0x13, 0x0E, 0x09, 0x04, 0x02}, /* 20 This is CCK base index */
- /* Index21 -6.3dB */ {0x1A, 0x19, 0x16, 0x12, 0x0E, 0x09, 0x04, 0x02},
- /* Index22 -6.6dB */ {0x19, 0x18, 0x15, 0x12, 0x0D, 0x08, 0x04, 0x02},
- /* Index23 -6.9dB */ {0x18, 0x17, 0x15, 0x11, 0x0D, 0x08, 0x04, 0x02},
- /* Index24 -7.2dB */ {0x18, 0x17, 0x14, 0x11, 0x0C, 0x08, 0x03, 0x02},
- /* Index25 -7.5dB */ {0x17, 0x16, 0x13, 0x10, 0x0C, 0x08, 0x03, 0x02},
- /* Index26 -7.8dB */ {0x16, 0x15, 0x13, 0x0F, 0x0B, 0x07, 0x03, 0x02},
- /* Index27 -8.1dB */ {0x15, 0x14, 0x12, 0x0F, 0x0B, 0x07, 0x03, 0x02},
- /* Index28 -8.4dB */ {0x14, 0x14, 0x11, 0x0E, 0x0B, 0x07, 0x03, 0x02},
- /* Index29 -8.7dB */ {0x14, 0x13, 0x11, 0x0E, 0x0A, 0x07, 0x03, 0x01},
- /* Index30 -9.0dB */ {0x13, 0x12, 0x10, 0x0D, 0x0A, 0x06, 0x03, 0x01}, /* 30 This is hp CCK base index */
- /* Index31 -9.3dB */ {0x12, 0x12, 0x0F, 0x0D, 0x0A, 0x06, 0x03, 0x01},
- /* Index32 -9.6dB */ {0x12, 0x11, 0x0F, 0x0D, 0x09, 0x06, 0x03, 0x01},
- /* Index33 -9.9dB */ {0x11, 0x11, 0x0F, 0x0C, 0x09, 0x06, 0x03, 0x01},
- /* Index34 -10.2dB */ {0x11, 0x11, 0x0E, 0x0C, 0x09, 0x06, 0x02, 0x01},
- /* Index35 -10.5dB */ {0x10, 0x0F, 0x0E, 0x0B, 0x08, 0x05, 0x02, 0x01},
- /* Index36 -10.8dB */ {0x10, 0x0F, 0x0D, 0x0B, 0x08, 0x05, 0x02, 0x01},
- /* Index37 -11.1dB */ {0x0F, 0x0E, 0x0D, 0x0A, 0x08, 0x05, 0x02, 0x01},
- /* Index38 -11.4dB */ {0x0E, 0x0E, 0x0C, 0x0A, 0x07, 0x05, 0x02, 0x01},
- /* Index39 -11.7dB */ {0x0E, 0x0D, 0x0C, 0x0A, 0x07, 0x05, 0x02, 0x01},
- /* Index40 -12 dB */ {0x0E, 0x0D, 0x0C, 0x0A, 0x07, 0x05, 0x02, 0x01},
- /* Index41 -12.3dB */ {0x0D, 0x0D, 0x0B, 0x09, 0x07, 0x04, 0x02, 0x01},
- /* Index42 -12.6dB */ {0x0D, 0x0C, 0x0B, 0x09, 0x07, 0x04, 0x02, 0x01},
- /* Index43 -12.9dB */ {0x0C, 0x0C, 0x0A, 0x09, 0x06, 0x04, 0x02, 0x01},
- /* Index44 -13.2dB */ {0x0C, 0x0B, 0x0A, 0x08, 0x06, 0x04, 0x02, 0x01},
- /* Index45 -13.5dB */ {0x0B, 0x0B, 0x0A, 0x08, 0x06, 0x04, 0x02, 0x01},
- /* Index46 -13.8dB */ {0x0B, 0x0B, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01},
- /* Index47 -14.1dB */ {0x0B, 0x0A, 0x09, 0x07, 0x06, 0x04, 0x02, 0x01},
- /* Index48 -14.4dB */ {0x0A, 0x0A, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01},
- /* Index49 -14.7dB */ {0x0A, 0x0A, 0x08, 0x07, 0x05, 0x03, 0x01, 0x01},
- /* Index50 -15 dB */ {0x0A, 0x09, 0x08, 0x07, 0x05, 0x03, 0x01, 0x01},
- /* Index51 -15.3dB */ {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01},
- /* Index52 -15.6dB */ {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01},
- /* Index53 -15.9dB */ {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01}
-};
-u8 cck_swing_table_ch14_92e[CCK_TABLE_SIZE_92E][8] = {
- /* Index0 0 dB */ {0x36, 0x34, 0x2E, 0x26, 0x00, 0x00, 0x00, 0x00},
- /* Index1 -0.3dB */ {0x34, 0x32, 0x2C, 0x25, 0x00, 0x00, 0x00, 0x00},
- /* Index2 -0.6dB */ {0x32, 0x30, 0x2B, 0x23, 0x00, 0x00, 0x00, 0x00},
- /* Index3 -0.9dB */ {0x31, 0x2F, 0x29, 0x22, 0x00, 0x00, 0x00, 0x00},
- /* Index4 -1.2dB */ {0x2F, 0x2D, 0x28, 0x21, 0x00, 0x00, 0x00, 0x00},
- /* Index5 -1.5dB */ {0x2D, 0x2C, 0x27, 0x20, 0x00, 0x00, 0x00, 0x00},
- /* Index6 -1.8dB */ {0x2C, 0x2A, 0x25, 0x1F, 0x00, 0x00, 0x00, 0x00},
- /* Index7 -2.1dB */ {0x2A, 0x29, 0x24, 0x1E, 0x00, 0x00, 0x00, 0x00},
- /* Index8 -2.4dB */ {0x29, 0x27, 0x23, 0x1D, 0x00, 0x00, 0x00, 0x00},
- /* Index9 -2.7dB */ {0x27, 0x26, 0x22, 0x1C, 0x00, 0x00, 0x00, 0x00},
- /* Index10 -3 dB */ {0x26, 0x25, 0x20, 0x1B, 0x00, 0x00, 0x00, 0x00},
- /* Index11 -3.3dB */ {0x25, 0x23, 0x1F, 0x1A, 0x00, 0x00, 0x00, 0x00},
- /* Index12 -3.6dB */ {0x24, 0x22, 0x1E, 0x19, 0x00, 0x00, 0x00, 0x00},
- /* Index13 -3.9dB */ {0x22, 0x21, 0x1D, 0x18, 0x00, 0x00, 0x00, 0x00},
- /* Index14 -4.2dB */ {0x21, 0x20, 0x1C, 0x17, 0x00, 0x00, 0x00, 0x00},
- /* Index15 -4.5dB */ {0x20, 0x1F, 0x1B, 0x17, 0x00, 0x00, 0x00, 0x00},
- /* Index16 -4.8dB */ {0x1F, 0x1E, 0x1A, 0x16, 0x00, 0x00, 0x00, 0x00},
- /* Index17 -5.1dB */ {0x1E, 0x1D, 0x1A, 0x15, 0x00, 0x00, 0x00, 0x00},
- /* Index18 -5.4dB */ {0x1D, 0x1C, 0x19, 0x14, 0x00, 0x00, 0x00, 0x00},
- /* Index19 -5.7dB */ {0x1C, 0x1B, 0x18, 0x14, 0x00, 0x00, 0x00, 0x00},
- /* Index20 -6 dB */ {0x1B, 0x1A, 0x17, 0x13, 0x00, 0x00, 0x00, 0x00},
- /* Index21 -6.3dB */ {0x1A, 0x19, 0x16, 0x12, 0x00, 0x00, 0x00, 0x00},
- /* Index22 -6.6dB */ {0x19, 0x18, 0x15, 0x12, 0x00, 0x00, 0x00, 0x00},
- /* Index23 -6.9dB */ {0x18, 0x17, 0x15, 0x11, 0x00, 0x00, 0x00, 0x00},
- /* Index24 -7.2dB */ {0x18, 0x17, 0x14, 0x11, 0x00, 0x00, 0x00, 0x00},
- /* Index25 -7.5dB */ {0x17, 0x16, 0x13, 0x10, 0x00, 0x00, 0x00, 0x00},
- /* Index26 -7.8dB */ {0x16, 0x15, 0x13, 0x0F, 0x00, 0x00, 0x00, 0x00},
- /* Index27 -8.1dB */ {0x15, 0x14, 0x12, 0x0F, 0x00, 0x00, 0x00, 0x00},
- /* Index28 -8.4dB */ {0x14, 0x14, 0x11, 0x0E, 0x00, 0x00, 0x00, 0x00},
- /* Index29 -8.7dB */ {0x14, 0x13, 0x11, 0x0E, 0x00, 0x00, 0x00, 0x00},
- /* Index30 -9 dB */ {0x13, 0x12, 0x10, 0x0D, 0x00, 0x00, 0x00, 0x00},
- /* Index31 -9.3dB */ {0x12, 0x12, 0x0F, 0x0D, 0x00, 0x00, 0x00, 0x00},
- /* Index32 -9.6dB */ {0x12, 0x11, 0x0F, 0x0D, 0x00, 0x00, 0x00, 0x00},
- /* Index33 -9.9dB */ {0x11, 0x11, 0x0F, 0x0C, 0x00, 0x00, 0x00, 0x00},
- /* Index34 -10.2dB */ {0x11, 0x11, 0x0E, 0x0C, 0x00, 0x00, 0x00, 0x00},
- /* Index35 -10.5dB */ {0x10, 0x0F, 0x0E, 0x0B, 0x00, 0x00, 0x00, 0x00},
- /* Index36 -10.8dB */ {0x10, 0x0F, 0x0D, 0x0B, 0x00, 0x00, 0x00, 0x00},
- /* Index37 -11.1dB */ {0x0F, 0x0E, 0x0D, 0x0A, 0x00, 0x00, 0x00, 0x00},
- /* Index38 -11.4dB */ {0x0E, 0x0E, 0x0C, 0x0A, 0x00, 0x00, 0x00, 0x00},
- /* Index39 -11.7dB */ {0x0E, 0x0D, 0x0C, 0x0A, 0x00, 0x00, 0x00, 0x00},
- /* Index40 -12 dB */ {0x0E, 0x0D, 0x0C, 0x0A, 0x00, 0x00, 0x00, 0x00},
- /* Index41 -12.3dB */ {0x0D, 0x0D, 0x0B, 0x09, 0x00, 0x00, 0x00, 0x00},
- /* Index42 -12.6dB */ {0x0D, 0x0C, 0x0B, 0x09, 0x00, 0x00, 0x00, 0x00},
- /* Index43 -12.9dB */ {0x0C, 0x0C, 0x0A, 0x09, 0x00, 0x00, 0x00, 0x00},
- /* Index44 -13.2dB */ {0x0C, 0x0B, 0x0A, 0x08, 0x00, 0x00, 0x00, 0x00},
- /* Index45 -13.5dB */ {0x0B, 0x0B, 0x0A, 0x08, 0x00, 0x00, 0x00, 0x00},
- /* Index46 -13.8dB */ {0x0B, 0x0B, 0x09, 0x08, 0x00, 0x00, 0x00, 0x00},
- /* Index47 -14.1dB */ {0x0B, 0x0A, 0x09, 0x07, 0x00, 0x00, 0x00, 0x00},
- /* Index48 -14.4dB */ {0x0A, 0x0A, 0x09, 0x07, 0x00, 0x00, 0x00, 0x00},
- /* Index49 -14.7dB */ {0x0A, 0x0A, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00},
- /* Index50 -15 dB */ {0x0A, 0x09, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00},
- /* Index51 -15.3dB */ {0x09, 0x09, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00},
- /* Index52 -15.6dB */ {0x09, 0x09, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00},
- /* Index53 -15.9dB */ {0x09, 0x08, 0x07, 0x06, 0x00, 0x00, 0x00, 0x00}
-};
-#endif
-
-#if (RTL8814A_SUPPORT == 1 || RTL8822B_SUPPORT == 1)
-u32 tx_scaling_table_jaguar[TXSCALE_TABLE_SIZE] = {
- 0x081, /* 0, -12.0dB */
- 0x088, /* 1, -11.5dB */
- 0x090, /* 2, -11.0dB */
- 0x099, /* 3, -10.5dB */
- 0x0A2, /* 4, -10.0dB */
- 0x0AC, /* 5, -9.5dB */
- 0x0B6, /* 6, -9.0dB */
- 0x0C0, /* 7, -8.5dB */
- 0x0CC, /* 8, -8.0dB */
- 0x0D8, /* 9, -7.5dB */
- 0x0E5, /* 10, -7.0dB */
- 0x0F2, /* 11, -6.5dB */
- 0x101, /* 12, -6.0dB */
- 0x110, /* 13, -5.5dB */
- 0x120, /* 14, -5.0dB */
- 0x131, /* 15, -4.5dB */
- 0x143, /* 16, -4.0dB */
- 0x156, /* 17, -3.5dB */
- 0x16A, /* 18, -3.0dB */
- 0x180, /* 19, -2.5dB */
- 0x197, /* 20, -2.0dB */
- 0x1AF, /* 21, -1.5dB */
- 0x1C8, /* 22, -1.0dB */
- 0x1E3, /* 23, -0.5dB */
- 0x200, /* 24, +0 dB */
- 0x21E, /* 25, +0.5dB */
- 0x23E, /* 26, +1.0dB */
- 0x261, /* 27, +1.5dB */
- 0x285, /* 28, +2.0dB */
- 0x2AB, /* 29, +2.5dB */
- 0x2D3, /* 30, +3.0dB */
- 0x2FE, /* 31, +3.5dB */
- 0x32B, /* 32, +4.0dB */
- 0x35C, /* 33, +4.5dB */
- 0x38E, /* 34, +5.0dB */
- 0x3C4, /* 35, +5.5dB */
- 0x3FE /* 36, +6.0dB */
-};
-#elif(ODM_IC_11AC_SERIES_SUPPORT)
-u32 ofdm_swing_table_8812[OFDM_TABLE_SIZE_8812] = {
- 0x3FE, /* 0, (6dB) */
- 0x3C4, /* 1, (5.5dB) */
- 0x38E, /* 2, (5dB) */
- 0x35C, /* 3, (4.5dB) */
- 0x32B, /* 4, (4dB) */
- 0x2FE, /* 5, (3.5dB) */
- 0x2D3, /* 6, (3dB) */
- 0x2AB, /* 7, (2.5dB) */
- 0x285, /* 8, (2dB) */
- 0x261, /* 9, (1.5dB */
- 0x23E, /* 10, (1dB) */
- 0x21E, /* 11, (0.5dB) */
- 0x200, /* 12, (0dB) 8814 int PA 2G default */
- 0x1E3, /* 13, (-0.5dB) */
- 0x1C8, /* 14, (-1dB) */
- 0x1AF, /* 15, (-1.5dB) */
- 0x197, /* 16, (-2dB) */
- 0x180, /* 17, (-2.5dB) */
- 0x16A, /* 18, (-3dB) 8812 / 8814 int PA 5G / 8814 ext PA 2G5G default */
- 0x156, /* 19, (-3.5dB) */
- 0x143, /* 20, (-4dB) 8812 HP default */
- 0x131, /* 21, (-4.5dB) */
- 0x120, /* 22, (-5dB) */
- 0x110, /* 23, (-5.5dB) */
- 0x101, /* 24, (-6dB) */
- 0x0F2, /* 25, (-6.5dB) */
- 0x0E5, /* 26, (-7dB) */
- 0x0D8, /* 27, (-7.5dB) */
- 0x0CC, /* 28, (-8dB) */
- 0x0C0, /* 29, (-8.5dB) */
- 0x0B6, /* 30, (-9dB) */
- 0x0AC, /* 31, (-9.5dB) */
- 0x0A2, /* 32, (-10dB) */
- 0x099, /* 33, (-10.5dB) */
- 0x090, /* 34, (-11dB) */
- 0x088, /* 35, (-11.5dB) */
- 0x081, /* 36, (-12dB) */
- 0x079, /* 37, (-12.5dB) */
- 0x072, /* 38, (-13dB) */
- 0x06c, /* 39, (-13.5dB) */
- 0x066, /* 40, (-14dB) */
- 0x060, /* 41, (-14.5dB) */
- 0x05B /* 42, (-15dB) */
-};
-#endif
-
-u32 cck_swing_table_ch1_ch14_8723d[CCK_TABLE_SIZE_8723D] = {
- 0x0CD,
- 0x0D9,
- 0x0E6,
- 0x0F3,
- 0x102,
- 0x111,
- 0x121,
- 0x132,
- 0x144,
- 0x158,
- 0x16C,
- 0x182,
- 0x198,
- 0x1B1,
- 0x1CA,
- 0x1E5,
- 0x202,
- 0x221,
- 0x241,
- 0x263,
- 0x287,
- 0x2AE,
- 0x2D6,
- 0x301,
- 0x32F,
- 0x35F,
- 0x392,
- 0x3C9,
- 0x402,
- 0x43F,
- 0x47F,
- 0x4C3,
- 0x50C,
- 0x558,
- 0x5A9,
- 0x5FF,
- 0x65A,
- 0x6BA,
- 0x720,
- 0x78C,
- 0x7FF,
-};
-
-
-/* #endif */
-/* 3============================================================
- * 3 Tx Power Tracking
- * 3============================================================ */
-
-void
-odm_txpowertracking_init(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- if (!(p_dm_odm->support_ic_type & (ODM_RTL8814A | ODM_RTL8822B | ODM_IC_11N_SERIES)))
- return;
-#endif
-
- odm_txpowertracking_thermal_meter_init(p_dm_odm);
-}
-
-
-u8
-get_swing_index(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 i = 0, bb_swing_mask = 0;
- u32 bb_swing = 0;
- u32 swing_table_size = 0;
- u32 *p_swing_table = 0;
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
-
-#if (RTL8197F_SUPPORT == 1)
- if (GET_CHIP_VER(priv) == VERSION_8197F) {
- bb_swing = phy_query_bb_reg(priv, REG_OFDM_0_XA_TX_IQ_IMBALANCE, MASKOFDM_D);
- p_swing_table = ofdm_swing_table_new;
- swing_table_size = OFDM_TABLE_SIZE_92D;
- bb_swing_mask = 22;
- }
-#endif
-
-#if (RTL8822B_SUPPORT == 1)
- if (GET_CHIP_VER(priv) == VERSION_8822B) {
- bb_swing = phy_query_bb_reg(priv, REG_A_TX_SCALE_JAGUAR, 0xFFE00000);
- p_swing_table = tx_scaling_table_jaguar;
- swing_table_size = TXSCALE_TABLE_SIZE;
- bb_swing_mask = 0;
- }
-#endif
-
- for (i = 0; i < swing_table_size - 1; i++) {
- u32 table_value = p_swing_table[i] >> bb_swing_mask;
-
- if (bb_swing == table_value)
- break;
- }
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("bb_swing=0x%x bbswing_index=%d\n", bb_swing, i));
-
-
- return i;
-}
-
-
-void
-odm_txpowertracking_thermal_meter_init(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm_odm->rf_calibrate_info);
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
- u8 p;
- u8 default_swing_index;
-#if (RTL8197F_SUPPORT == 1 || RTL8822B_SUPPORT == 1)
- if ((GET_CHIP_VER(priv) == VERSION_8197F) || (GET_CHIP_VER(priv) == VERSION_8822B))
- default_swing_index = get_swing_index(p_dm_odm);
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PMGNT_INFO p_mgnt_info = &adapter->MgntInfo;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
-
- p_mgnt_info->is_txpowertracking = true;
- p_hal_data->tx_powercount = 0;
- p_hal_data->is_txpowertracking_init = false;
-
- if (p_dm_odm->mp_mode == false)
- p_hal_data->txpowertrack_control = true;
- ODM_RT_TRACE(p_dm_odm, COMP_POWER_TRACKING, DBG_LOUD, ("p_mgnt_info->is_txpowertracking = %d\n", p_mgnt_info->is_txpowertracking));
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- {
- p_dm_odm->rf_calibrate_info.is_txpowertracking = _TRUE;
- p_dm_odm->rf_calibrate_info.tx_powercount = 0;
- p_dm_odm->rf_calibrate_info.is_txpowertracking_init = _FALSE;
-
- if (p_dm_odm->mp_mode == false)
- p_dm_odm->rf_calibrate_info.txpowertrack_control = _TRUE;
-
- MSG_8192C("p_dm_odm txpowertrack_control = %d\n", p_dm_odm->rf_calibrate_info.txpowertrack_control);
- }
-
- p_dm_odm->rf_calibrate_info.txpowertrack_control = true;
- p_dm_odm->rf_calibrate_info.delta_power_index = 0;
- p_dm_odm->rf_calibrate_info.delta_power_index_last = 0;
- p_dm_odm->rf_calibrate_info.power_index_offset = 0;
- p_dm_odm->rf_calibrate_info.thermal_value = 0;
- p_rf_calibrate_info->default_ofdm_index = 28;
-
- p_rf_calibrate_info->default_cck_index = 20; /* -6 dB */
- p_rf_calibrate_info->bb_swing_idx_ofdm_base = p_rf_calibrate_info->default_ofdm_index;
- p_rf_calibrate_info->bb_swing_idx_cck_base = p_rf_calibrate_info->default_cck_index;
- p_dm_odm->rf_calibrate_info.CCK_index = p_rf_calibrate_info->default_cck_index;
-
- for (p = 0; p < MAX_RF_PATH; p++) {
- p_dm_odm->rf_calibrate_info.OFDM_index[p] = p_rf_calibrate_info->default_ofdm_index;
- p_rf_calibrate_info->bb_swing_idx_ofdm[p] = p_rf_calibrate_info->default_ofdm_index;
- p_rf_calibrate_info->kfree_offset[p] = 0; /* for 8814 kfree*/
- }
- p_rf_calibrate_info->bb_swing_idx_cck = p_rf_calibrate_info->default_cck_index;
-
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("p_rf_calibrate_info->default_ofdm_index=%d p_rf_calibrate_info->default_cck_index=%d\n", p_rf_calibrate_info->default_ofdm_index, p_rf_calibrate_info->default_cck_index));
-}
-
-void
-odm_txpowertracking_check(
- void *p_dm_void
-)
-{
- /* */
- /* For AP/ADSL use struct rtl8192cd_priv* */
- /* For CE/NIC use struct _ADAPTER* */
- /* */
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
-
-
- if (!(p_dm_odm->support_ability & ODM_RF_TX_PWR_TRACK))
- return;
-
- /* */
- /* 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate */
- /* at the same time. In the stage2/3, we need to prive universal interface and merge all */
- /* HW dynamic mechanism. */
- /* */
- switch (p_dm_odm->support_platform) {
- case ODM_WIN:
- odm_txpowertracking_check_mp(p_dm_odm);
- break;
-
- case ODM_CE:
- odm_txpowertracking_check_ce(p_dm_odm);
- break;
-
- case ODM_AP:
- odm_txpowertracking_check_ap(p_dm_odm);
- break;
-
- case ODM_ADSL:
- /*odm_DIGAP(p_dm_odm);*/
- break;
- }
-
-}
-
-void
-odm_txpowertracking_check_ce(
- void *p_dm_void
-)
-{
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
-
-#if (RTL8188E_SUPPORT == 1)
-
- /* if(!p_mgnt_info->is_txpowertracking || (!pdmpriv->txpowertrack_control && pdmpriv->is_ap_kdone)) */
- if (!(p_dm_odm->support_ability & ODM_RF_TX_PWR_TRACK))
- return;
-
- if (!p_dm_odm->rf_calibrate_info.tm_trigger) { /* at least delay 1 sec */
- /* p_hal_data->TxPowerCheckCnt++; */ /* cosa add for debug */
- odm_set_rf_reg(p_dm_odm, RF_PATH_A, RF_T_METER, RFREGOFFSETMASK, 0x60);
- /* DBG_8192C("Trigger 92C Thermal Meter!!\n"); */
-
- p_dm_odm->rf_calibrate_info.tm_trigger = 1;
- return;
-
- } else {
- /* DBG_8192C("Schedule TxPowerTracking direct call!!\n"); */
- odm_txpowertracking_callback_thermal_meter_8188e(adapter);
- p_dm_odm->rf_calibrate_info.tm_trigger = 0;
- }
-#endif
-
-#endif
-}
-
-void
-odm_txpowertracking_check_mp(
- void *p_dm_void
-)
-{
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
-
- if (odm_check_power_status(adapter) == false)
- return;
-
- if (!adapter->is_slave_of_dmsp || adapter->dual_mac_smart_concurrent == false)
- odm_txpowertracking_thermal_meter_check(adapter);
-#endif
-
-}
-
-
-void
-odm_txpowertracking_check_ap(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- struct rtl8192cd_priv *priv = p_dm_odm->priv;
-
-#if ((RTL8188E_SUPPORT == 1) || (RTL8192E_SUPPORT == 1) || (RTL8812A_SUPPORT == 1) || (RTL8881A_SUPPORT == 1) || (RTL8814A_SUPPORT == 1) || (RTL8197F_SUPPORT == 1))
- if (p_dm_odm->support_ic_type & (ODM_RTL8188E | ODM_RTL8192E | ODM_RTL8812 | ODM_RTL8881A | ODM_RTL8814A | ODM_RTL8197F | ODM_RTL8822B))
- odm_txpowertracking_callback_thermal_meter(p_dm_odm);
- else
-#endif
- {
- }
-#endif
-
-}
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-
-void
-odm_txpowertracking_thermal_meter_check(
- struct _ADAPTER *adapter
-)
-{
-#ifndef AP_BUILD_WORKAROUND
-#if (HAL_CODE_BASE == RTL8192_C)
- PMGNT_INFO p_mgnt_info = &adapter->MgntInfo;
- /* HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter); */
- static u8 tm_trigger = 0;
- /* u8 TxPowerCheckCnt = 5; */ /* 10 sec */
-
- if (!p_mgnt_info->is_txpowertracking /*|| (!p_hal_data->txpowertrack_control && p_hal_data->is_ap_kdone)*/)
- return;
-
- if (!tm_trigger) { /* at least delay 1 sec */
- if (IS_HARDWARE_TYPE_8188E(adapter) || IS_HARDWARE_TYPE_8812(adapter))
- phy_set_rf_reg(adapter, RF_PATH_A, RF_T_METER_88E, BIT(17) | BIT(16), 0x03);
- else
- phy_set_rf_reg(adapter, RF_PATH_A, RF_T_METER, RFREGOFFSETMASK, 0x60);
- RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("Trigger 92C Thermal Meter!!\n"));
-
- tm_trigger = 1;
- return;
- } else {
- RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("Schedule TxPowerTracking direct call!!\n"));
- odm_txpowertracking_direct_call(adapter); /* Using direct call is instead, added by Roger, 2009.06.18. */
- tm_trigger = 0;
- }
-#endif
-#endif
-}
-
-#endif
diff --git a/hal/phydm/phydm_powertracking_ce.h b/hal/phydm/phydm_powertracking_ce.h
index 72a30d4..c8ed798 100644
--- a/hal/phydm/phydm_powertracking_ce.h
+++ b/hal/phydm/phydm_powertracking_ce.h
@@ -169,11 +169,7 @@ struct odm_rf_calibration_structure {
u8 bb_swing_idx_ofdm[MAX_RF_PATH];
u8 bb_swing_idx_ofdm_current;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
u8 bb_swing_idx_ofdm_base[MAX_RF_PATH];
-#else
- u8 bb_swing_idx_ofdm_base;
-#endif
bool default_bb_swing_index_flag;
bool bb_swing_flag_ofdm;
u8 bb_swing_idx_cck;
@@ -302,33 +298,4 @@ odm_txpowertracking_check_ce(
void *p_dm_void
);
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
-
-void
-odm_txpowertracking_callback_thermal_meter92c(
- struct _ADAPTER *adapter
-);
-
-void
-odm_txpowertracking_callback_rx_gain_thermal_meter92d(
- struct _ADAPTER *adapter
-);
-
-void
-odm_txpowertracking_callback_thermal_meter92d(
- struct _ADAPTER *adapter
-);
-
-void
-odm_txpowertracking_direct_call92c(
- struct _ADAPTER *adapter
-);
-
-void
-odm_txpowertracking_thermal_meter_check(
- struct _ADAPTER *adapter
-);
-
-#endif
-
#endif
diff --git a/hal/phydm/phydm_powertracking_win.c b/hal/phydm/phydm_powertracking_win.c
deleted file mode 100644
index a9c544e..0000000
--- a/hal/phydm/phydm_powertracking_win.c
+++ /dev/null
@@ -1,749 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- *
- ******************************************************************************/
-
-/* ************************************************************
- * include files
- * ************************************************************ */
-#include "mp_precomp.h"
-#include "phydm_precomp.h"
-
-/* ************************************************************
- * Global var
- * ************************************************************ */
-
-u32 ofdm_swing_table[OFDM_TABLE_SIZE] = {
- 0x7f8001fe, /* 0, +6.0dB */
- 0x788001e2, /* 1, +5.5dB */
- 0x71c001c7, /* 2, +5.0dB */
- 0x6b8001ae, /* 3, +4.5dB */
- 0x65400195, /* 4, +4.0dB */
- 0x5fc0017f, /* 5, +3.5dB */
- 0x5a400169, /* 6, +3.0dB */
- 0x55400155, /* 7, +2.5dB */
- 0x50800142, /* 8, +2.0dB */
- 0x4c000130, /* 9, +1.5dB */
- 0x47c0011f, /* 10, +1.0dB */
- 0x43c0010f, /* 11, +0.5dB */
- 0x40000100, /* 12, +0dB */
- 0x3c8000f2, /* 13, -0.5dB */
- 0x390000e4, /* 14, -1.0dB */
- 0x35c000d7, /* 15, -1.5dB */
- 0x32c000cb, /* 16, -2.0dB */
- 0x300000c0, /* 17, -2.5dB */
- 0x2d4000b5, /* 18, -3.0dB */
- 0x2ac000ab, /* 19, -3.5dB */
- 0x288000a2, /* 20, -4.0dB */
- 0x26000098, /* 21, -4.5dB */
- 0x24000090, /* 22, -5.0dB */
- 0x22000088, /* 23, -5.5dB */
- 0x20000080, /* 24, -6.0dB */
- 0x1e400079, /* 25, -6.5dB */
- 0x1c800072, /* 26, -7.0dB */
- 0x1b00006c, /* 27. -7.5dB */
- 0x19800066, /* 28, -8.0dB */
- 0x18000060, /* 29, -8.5dB */
- 0x16c0005b, /* 30, -9.0dB */
- 0x15800056, /* 31, -9.5dB */
- 0x14400051, /* 32, -10.0dB */
- 0x1300004c, /* 33, -10.5dB */
- 0x12000048, /* 34, -11.0dB */
- 0x11000044, /* 35, -11.5dB */
- 0x10000040, /* 36, -12.0dB */
-};
-
-u8 cck_swing_table_ch1_ch13[CCK_TABLE_SIZE][8] = {
- {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04}, /* 0, +0dB */
- {0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, /* 1, -0.5dB */
- {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, /* 2, -1.0dB */
- {0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, /* 3, -1.5dB */
- {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, /* 4, -2.0dB */
- {0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, /* 5, -2.5dB */
- {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, /* 6, -3.0dB */
- {0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, /* 7, -3.5dB */
- {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, /* 8, -4.0dB */
- {0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, /* 9, -4.5dB */
- {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, /* 10, -5.0dB */
- {0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, /* 11, -5.5dB */
- {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, /* 12, -6.0dB <== default */
- {0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, /* 13, -6.5dB */
- {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, /* 14, -7.0dB */
- {0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, /* 15, -7.5dB */
- {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, /* 16, -8.0dB */
- {0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, /* 17, -8.5dB */
- {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, /* 18, -9.0dB */
- {0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, /* 19, -9.5dB */
- {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, /* 20, -10.0dB */
- {0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, /* 21, -10.5dB */
- {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, /* 22, -11.0dB */
- {0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, /* 23, -11.5dB */
- {0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, /* 24, -12.0dB */
- {0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, /* 25, -12.5dB */
- {0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, /* 26, -13.0dB */
- {0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, /* 27, -13.5dB */
- {0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, /* 28, -14.0dB */
- {0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, /* 29, -14.5dB */
- {0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, /* 30, -15.0dB */
- {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, /* 31, -15.5dB */
- {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01} /* 32, -16.0dB */
-};
-
-
-u8 cck_swing_table_ch14[CCK_TABLE_SIZE][8] = {
- {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, /* 0, +0dB */
- {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, /* 1, -0.5dB */
- {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, /* 2, -1.0dB */
- {0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, /* 3, -1.5dB */
- {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, /* 4, -2.0dB */
- {0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, /* 5, -2.5dB */
- {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, /* 6, -3.0dB */
- {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, /* 7, -3.5dB */
- {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, /* 8, -4.0dB */
- {0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, /* 9, -4.5dB */
- {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, /* 10, -5.0dB */
- {0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, /* 11, -5.5dB */
- {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, /* 12, -6.0dB <== default */
- {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, /* 13, -6.5dB */
- {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, /* 14, -7.0dB */
- {0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, /* 15, -7.5dB */
- {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, /* 16, -8.0dB */
- {0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, /* 17, -8.5dB */
- {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, /* 18, -9.0dB */
- {0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, /* 19, -9.5dB */
- {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, /* 20, -10.0dB */
- {0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, /* 21, -10.5dB */
- {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, /* 22, -11.0dB */
- {0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, /* 23, -11.5dB */
- {0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, /* 24, -12.0dB */
- {0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 25, -12.5dB */
- {0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 26, -13.0dB */
- {0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 27, -13.5dB */
- {0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 28, -14.0dB */
- {0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 29, -14.5dB */
- {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 30, -15.0dB */
- {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 31, -15.5dB */
- {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00} /* 32, -16.0dB */
-};
-
-
-u32 ofdm_swing_table_new[OFDM_TABLE_SIZE] = {
- 0x0b40002d, /* 0, -15.0dB */
- 0x0c000030, /* 1, -14.5dB */
- 0x0cc00033, /* 2, -14.0dB */
- 0x0d800036, /* 3, -13.5dB */
- 0x0e400039, /* 4, -13.0dB */
- 0x0f00003c, /* 5, -12.5dB */
- 0x10000040, /* 6, -12.0dB */
- 0x11000044, /* 7, -11.5dB */
- 0x12000048, /* 8, -11.0dB */
- 0x1300004c, /* 9, -10.5dB */
- 0x14400051, /* 10, -10.0dB */
- 0x15800056, /* 11, -9.5dB */
- 0x16c0005b, /* 12, -9.0dB */
- 0x18000060, /* 13, -8.5dB */
- 0x19800066, /* 14, -8.0dB */
- 0x1b00006c, /* 15, -7.5dB */
- 0x1c800072, /* 16, -7.0dB */
- 0x1e400079, /* 17, -6.5dB */
- 0x20000080, /* 18, -6.0dB */
- 0x22000088, /* 19, -5.5dB */
- 0x24000090, /* 20, -5.0dB */
- 0x26000098, /* 21, -4.5dB */
- 0x288000a2, /* 22, -4.0dB */
- 0x2ac000ab, /* 23, -3.5dB */
- 0x2d4000b5, /* 24, -3.0dB */
- 0x300000c0, /* 25, -2.5dB */
- 0x32c000cb, /* 26, -2.0dB */
- 0x35c000d7, /* 27, -1.5dB */
- 0x390000e4, /* 28, -1.0dB */
- 0x3c8000f2, /* 29, -0.5dB */
- 0x40000100, /* 30, +0dB */
- 0x43c0010f, /* 31, +0.5dB */
- 0x47c0011f, /* 32, +1.0dB */
- 0x4c000130, /* 33, +1.5dB */
- 0x50800142, /* 34, +2.0dB */
- 0x55400155, /* 35, +2.5dB */
- 0x5a400169, /* 36, +3.0dB */
- 0x5fc0017f, /* 37, +3.5dB */
- 0x65400195, /* 38, +4.0dB */
- 0x6b8001ae, /* 39, +4.5dB */
- 0x71c001c7, /* 40, +5.0dB */
- 0x788001e2, /* 41, +5.5dB */
- 0x7f8001fe /* 42, +6.0dB */
-};
-
-
-u8 cck_swing_table_ch1_ch14_88f[CCK_TABLE_SIZE_88F][16] = {
- {0x44, 0x42, 0x3C, 0x33, 0x28, 0x1C, 0x13, 0x0B, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-16dB*/
- {0x48, 0x46, 0x3F, 0x36, 0x2A, 0x1E, 0x14, 0x0B, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-15.5dB*/
- {0x4D, 0x4A, 0x43, 0x39, 0x2C, 0x20, 0x15, 0x0C, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-15dB*/
- {0x51, 0x4F, 0x47, 0x3C, 0x2F, 0x22, 0x16, 0x0D, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-14.5dB*/
- {0x56, 0x53, 0x4B, 0x40, 0x32, 0x24, 0x17, 0x0E, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-14dB*/
- {0x5B, 0x58, 0x50, 0x43, 0x35, 0x26, 0x19, 0x0E, 0x07, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-13.5dB*/
- {0x60, 0x5D, 0x54, 0x47, 0x38, 0x28, 0x1A, 0x0F, 0x07, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-13dB*/
- {0x66, 0x63, 0x59, 0x4C, 0x3B, 0x2B, 0x1C, 0x10, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-12.5dB*/
- {0x6C, 0x69, 0x5F, 0x50, 0x3F, 0x2D, 0x1E, 0x11, 0x08, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-12dB*/
- {0x73, 0x6F, 0x64, 0x55, 0x42, 0x30, 0x1F, 0x12, 0x08, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-11.5dB*/
- {0x79, 0x76, 0x6A, 0x5A, 0x46, 0x33, 0x21, 0x13, 0x09, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-11dB*/
- {0x81, 0x7C, 0x71, 0x5F, 0x4A, 0x36, 0x23, 0x14, 0x0A, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-10.5dB*/
- {0x88, 0x84, 0x77, 0x65, 0x4F, 0x39, 0x25, 0x15, 0x0A, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-10dB*/
- {0x90, 0x8C, 0x7E, 0x6B, 0x54, 0x3C, 0x27, 0x17, 0x0B, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-9.5dB*/
- {0x99, 0x94, 0x86, 0x71, 0x58, 0x40, 0x2A, 0x18, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-9dB*/
- {0xA2, 0x9D, 0x8E, 0x78, 0x5E, 0x43, 0x2C, 0x19, 0x0C, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-8.5dB*/
- {0xAC, 0xA6, 0x96, 0x7F, 0x63, 0x47, 0x2F, 0x1B, 0x0D, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-8dB*/
- {0xB6, 0xB0, 0x9F, 0x87, 0x69, 0x4C, 0x32, 0x1D, 0x0D, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-7.5dB*/
- {0xC1, 0xBA, 0xA8, 0x8F, 0x6F, 0x50, 0x35, 0x1E, 0x0E, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-7dB*/
- {0xCC, 0xC5, 0xB2, 0x97, 0x76, 0x55, 0x38, 0x20, 0x0F, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-6.5dB*/
- {0xD8, 0xD1, 0xBD, 0xA0, 0x7D, 0x5A, 0x3B, 0x22, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} /*-6dB*/
-};
-
-
-u8 cck_swing_table_ch1_ch13_88f[CCK_TABLE_SIZE_88F][16] = {
- {0x44, 0x42, 0x3C, 0x33, 0x28, 0x1C, 0x13, 0x0B, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-16dB*/
- {0x48, 0x46, 0x3F, 0x36, 0x2A, 0x1E, 0x14, 0x0B, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-15.5dB*/
- {0x4D, 0x4A, 0x43, 0x39, 0x2C, 0x20, 0x15, 0x0C, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-15dB*/
- {0x51, 0x4F, 0x47, 0x3C, 0x2F, 0x22, 0x16, 0x0D, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-14.5dB*/
- {0x56, 0x53, 0x4B, 0x40, 0x32, 0x24, 0x17, 0x0E, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-14dB*/
- {0x5B, 0x58, 0x50, 0x43, 0x35, 0x26, 0x19, 0x0E, 0x07, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-13.5dB*/
- {0x60, 0x5D, 0x54, 0x47, 0x38, 0x28, 0x1A, 0x0F, 0x07, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-13dB*/
- {0x66, 0x63, 0x59, 0x4C, 0x3B, 0x2B, 0x1C, 0x10, 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-12.5dB*/
- {0x6C, 0x69, 0x5F, 0x50, 0x3F, 0x2D, 0x1E, 0x11, 0x08, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-12dB*/
- {0x73, 0x6F, 0x64, 0x55, 0x42, 0x30, 0x1F, 0x12, 0x08, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-11.5dB*/
- {0x79, 0x76, 0x6A, 0x5A, 0x46, 0x33, 0x21, 0x13, 0x09, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-11dB*/
- {0x81, 0x7C, 0x71, 0x5F, 0x4A, 0x36, 0x23, 0x14, 0x0A, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-10.5dB*/
- {0x88, 0x84, 0x77, 0x65, 0x4F, 0x39, 0x25, 0x15, 0x0A, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-10dB*/
- {0x90, 0x8C, 0x7E, 0x6B, 0x54, 0x3C, 0x27, 0x17, 0x0B, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-9.5dB*/
- {0x99, 0x94, 0x86, 0x71, 0x58, 0x40, 0x2A, 0x18, 0x0B, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-9dB*/
- {0xA2, 0x9D, 0x8E, 0x78, 0x5E, 0x43, 0x2C, 0x19, 0x0C, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-8.5dB*/
- {0xAC, 0xA6, 0x96, 0x7F, 0x63, 0x47, 0x2F, 0x1B, 0x0D, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-8dB*/
- {0xB6, 0xB0, 0x9F, 0x87, 0x69, 0x4C, 0x32, 0x1D, 0x0D, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-7.5dB*/
- {0xC1, 0xBA, 0xA8, 0x8F, 0x6F, 0x50, 0x35, 0x1E, 0x0E, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-7dB*/
- {0xCC, 0xC5, 0xB2, 0x97, 0x76, 0x55, 0x38, 0x20, 0x0F, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-6.5dB*/
- {0xD8, 0xD1, 0xBD, 0xA0, 0x7D, 0x5A, 0x3B, 0x22, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} /*-6dB*/
-};
-
-
-u8 cck_swing_table_ch14_88f[CCK_TABLE_SIZE_88F][16] = {
- {0x44, 0x42, 0x3C, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-16dB*/
- {0x48, 0x46, 0x3F, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-15.5dB*/
- {0x4D, 0x4A, 0x43, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-15dB*/
- {0x51, 0x4F, 0x47, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-14.5dB*/
- {0x56, 0x53, 0x4B, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-14dB*/
- {0x5B, 0x58, 0x50, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-13.5dB*/
- {0x60, 0x5D, 0x54, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-13dB*/
- {0x66, 0x63, 0x59, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-12.5dB*/
- {0x6C, 0x69, 0x5F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-12dB*/
- {0x73, 0x6F, 0x64, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-11.5dB*/
- {0x79, 0x76, 0x6A, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-11dB*/
- {0x81, 0x7C, 0x71, 0x4A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-10.5dB*/
- {0x88, 0x84, 0x77, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-10dB*/
- {0x90, 0x8C, 0x7E, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-9.5dB*/
- {0x99, 0x94, 0x86, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-9dB*/
- {0xA2, 0x9D, 0x8E, 0x5E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-8.5dB*/
- {0xAC, 0xA6, 0x96, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-8dB*/
- {0xB6, 0xB0, 0x9F, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-7.5dB*/
- {0xC1, 0xBA, 0xA8, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-7dB*/
- {0xCC, 0xC5, 0xB2, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*-6.5dB*/
- {0xD8, 0xD1, 0xBD, 0x7D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} /*-6dB*/
-};
-
-
-
-
-u8 cck_swing_table_ch1_ch13_new[CCK_TABLE_SIZE][8] = {
- {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01}, /* 0, -16.0dB */
- {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, /* 1, -15.5dB */
- {0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, /* 2, -15.0dB */
- {0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, /* 3, -14.5dB */
- {0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, /* 4, -14.0dB */
- {0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, /* 5, -13.5dB */
- {0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, /* 6, -13.0dB */
- {0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, /* 7, -12.5dB */
- {0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, /* 8, -12.0dB */
- {0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, /* 9, -11.5dB */
- {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, /* 10, -11.0dB */
- {0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, /* 11, -10.5dB */
- {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, /* 12, -10.0dB */
- {0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, /* 13, -9.5dB */
- {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, /* 14, -9.0dB */
- {0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, /* 15, -8.5dB */
- {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, /* 16, -8.0dB */
- {0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, /* 17, -7.5dB */
- {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, /* 18, -7.0dB */
- {0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, /* 19, -6.5dB */
- {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, /* 20, -6.0dB */
- {0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, /* 21, -5.5dB */
- {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, /* 22, -5.0dB */
- {0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, /* 23, -4.5dB */
- {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, /* 24, -4.0dB */
- {0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, /* 25, -3.5dB */
- {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, /* 26, -3.0dB */
- {0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, /* 27, -2.5dB */
- {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, /* 28, -2.0dB */
- {0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, /* 29, -1.5dB */
- {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, /* 30, -1.0dB */
- {0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, /* 31, -0.5dB */
- {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04} /* 32, +0dB */
-};
-
-
-u8 cck_swing_table_ch14_new[CCK_TABLE_SIZE][8] = {
- {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00}, /* 0, -16.0dB */
- {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 1, -15.5dB */
- {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 2, -15.0dB */
- {0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 3, -14.5dB */
- {0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 4, -14.0dB */
- {0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 5, -13.5dB */
- {0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 6, -13.0dB */
- {0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, /* 7, -12.5dB */
- {0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, /* 8, -12.0dB */
- {0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, /* 9, -11.5dB */
- {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, /* 10, -11.0dB */
- {0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, /* 11, -10.5dB */
- {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, /* 12, -10.0dB */
- {0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, /* 13, -9.5dB */
- {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, /* 14, -9.0dB */
- {0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, /* 15, -8.5dB */
- {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, /* 16, -8.0dB */
- {0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, /* 17, -7.5dB */
- {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, /* 18, -7.0dB */
- {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, /* 19, -6.5dB */
- {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, /* 20, -6.0dB */
- {0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, /* 21, -5.5dB */
- {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, /* 22, -5.0dB */
- {0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, /* 23, -4.5dB */
- {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, /* 24, -4.0dB */
- {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, /* 25, -3.5dB */
- {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, /* 26, -3.0dB */
- {0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, /* 27, -2.5dB */
- {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, /* 28, -2.0dB */
- {0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, /* 29, -1.5dB */
- {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, /* 30, -1.0dB */
- {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, /* 31, -0.5dB */
- {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00} /* 32, +0dB */
-};
-u32 cck_swing_table_ch1_ch14_8723d[CCK_TABLE_SIZE_8723D] = {
- 0x0CD,
- 0x0D9,
- 0x0E6,
- 0x0F3,
- 0x102,
- 0x111,
- 0x121,
- 0x132,
- 0x144,
- 0x158,
- 0x16C,
- 0x182,
- 0x198,
- 0x1B1,
- 0x1CA,
- 0x1E5,
- 0x202,
- 0x221,
- 0x241,
- 0x263,
- 0x287,
- 0x2AE,
- 0x2D6,
- 0x301,
- 0x32F,
- 0x35F,
- 0x392,
- 0x3C9,
- 0x402,
- 0x43F,
- 0x47F,
- 0x4C3,
- 0x50C,
- 0x558,
- 0x5A9,
- 0x5FF,
- 0x65A,
- 0x6BA,
- 0x720,
- 0x78C,
- 0x7FF,
-};
-
-
-u32 tx_scaling_table_jaguar[TXSCALE_TABLE_SIZE] = {
- 0x081, /* 0, -12.0dB */
- 0x088, /* 1, -11.5dB */
- 0x090, /* 2, -11.0dB */
- 0x099, /* 3, -10.5dB */
- 0x0A2, /* 4, -10.0dB */
- 0x0AC, /* 5, -9.5dB */
- 0x0B6, /* 6, -9.0dB */
- 0x0C0, /* 7, -8.5dB */
- 0x0CC, /* 8, -8.0dB */
- 0x0D8, /* 9, -7.5dB */
- 0x0E5, /* 10, -7.0dB */
- 0x0F2, /* 11, -6.5dB */
- 0x101, /* 12, -6.0dB */
- 0x110, /* 13, -5.5dB */
- 0x120, /* 14, -5.0dB */
- 0x131, /* 15, -4.5dB */
- 0x143, /* 16, -4.0dB */
- 0x156, /* 17, -3.5dB */
- 0x16A, /* 18, -3.0dB */
- 0x180, /* 19, -2.5dB */
- 0x197, /* 20, -2.0dB */
- 0x1AF, /* 21, -1.5dB */
- 0x1C8, /* 22, -1.0dB */
- 0x1E3, /* 23, -0.5dB */
- 0x200, /* 24, +0 dB */
- 0x21E, /* 25, +0.5dB */
- 0x23E, /* 26, +1.0dB */
- 0x261, /* 27, +1.5dB */
- 0x285, /* 28, +2.0dB */
- 0x2AB, /* 29, +2.5dB */
- 0x2D3, /* 30, +3.0dB */
- 0x2FE, /* 31, +3.5dB */
- 0x32B, /* 32, +4.0dB */
- 0x35C, /* 33, +4.5dB */
- 0x38E, /* 34, +5.0dB */
- 0x3C4, /* 35, +5.5dB */
- 0x3FE /* 36, +6.0dB */
-};
-
-
-#ifdef AP_BUILD_WORKAROUND
-
-unsigned int tx_pwr_trk_ofdm_swing_tbl[tx_pwr_trk_ofdm_swing_tbl_len] = {
- /* +6.0dB */ 0x7f8001fe,
- /* +5.5dB */ 0x788001e2,
- /* +5.0dB */ 0x71c001c7,
- /* +4.5dB */ 0x6b8001ae,
- /* +4.0dB */ 0x65400195,
- /* +3.5dB */ 0x5fc0017f,
- /* +3.0dB */ 0x5a400169,
- /* +2.5dB */ 0x55400155,
- /* +2.0dB */ 0x50800142,
- /* +1.5dB */ 0x4c000130,
- /* +1.0dB */ 0x47c0011f,
- /* +0.5dB */ 0x43c0010f,
- /* 0.0dB */ 0x40000100,
- /* -0.5dB */ 0x3c8000f2,
- /* -1.0dB */ 0x390000e4,
- /* -1.5dB */ 0x35c000d7,
- /* -2.0dB */ 0x32c000cb,
- /* -2.5dB */ 0x300000c0,
- /* -3.0dB */ 0x2d4000b5,
- /* -3.5dB */ 0x2ac000ab,
- /* -4.0dB */ 0x288000a2,
- /* -4.5dB */ 0x26000098,
- /* -5.0dB */ 0x24000090,
- /* -5.5dB */ 0x22000088,
- /* -6.0dB */ 0x20000080,
- /* -6.5dB */ 0x1a00006c,
- /* -7.0dB */ 0x1c800072,
- /* -7.5dB */ 0x18000060,
- /* -8.0dB */ 0x19800066,
- /* -8.5dB */ 0x15800056,
- /* -9.0dB */ 0x26c0005b,
- /* -9.5dB */ 0x14400051,
- /* -10.0dB */ 0x24400051,
- /* -10.5dB */ 0x1300004c,
- /* -11.0dB */ 0x12000048,
- /* -11.5dB */ 0x11000044,
- /* -12.0dB */ 0x10000040
-};
-
-#endif
-
-void
-odm_txpowertracking_init(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- if (!(p_dm_odm->support_ic_type & (ODM_RTL8814A | ODM_IC_11N_SERIES | ODM_RTL8822B)))
- return;
-#endif
-
- odm_txpowertracking_thermal_meter_init(p_dm_odm);
-}
-
-u8
-get_swing_index(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- u8 i = 0;
- u32 bb_swing;
- u32 swing_table_size;
- u32 *p_swing_table;
-
- if (p_dm_odm->support_ic_type == ODM_RTL8188E || p_dm_odm->support_ic_type == ODM_RTL8723B ||
- p_dm_odm->support_ic_type == ODM_RTL8192E || p_dm_odm->support_ic_type == ODM_RTL8188F || p_dm_odm->support_ic_type == ODM_RTL8703B) {
- bb_swing = odm_get_bb_reg(p_dm_odm, REG_OFDM_0_XA_TX_IQ_IMBALANCE, 0xFFC00000);
-
- p_swing_table = ofdm_swing_table_new;
- swing_table_size = OFDM_TABLE_SIZE;
- } else {
- bb_swing = PHY_GetTxBBSwing_8812A(adapter, p_hal_data->CurrentBandType, ODM_RF_PATH_A);
- p_swing_table = tx_scaling_table_jaguar;
- swing_table_size = TXSCALE_TABLE_SIZE;
- }
-
- for (i = 0; i < swing_table_size; ++i) {
- u32 table_value = p_swing_table[i];
-
- if (table_value >= 0x100000)
- table_value >>= 22;
- if (bb_swing == table_value)
- break;
- }
- return i;
-}
-
-void
-odm_txpowertracking_thermal_meter_init(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 default_swing_index = get_swing_index(p_dm_odm);
- struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm_odm->rf_calibrate_info);
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- u8 p = 0;
-
- if (p_dm_odm->mp_mode == false)
- p_rf_calibrate_info->txpowertrack_control = true;
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- {
- p_rf_calibrate_info->is_txpowertracking = _TRUE;
- p_rf_calibrate_info->tx_powercount = 0;
- p_rf_calibrate_info->is_txpowertracking_init = _FALSE;
-
- if (p_dm_odm->mp_mode == false)
- p_rf_calibrate_info->txpowertrack_control = _TRUE;
-
- MSG_8192C("p_dm_odm txpowertrack_control = %d\n", p_rf_calibrate_info->txpowertrack_control);
- }
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-#if (MP_DRIVER == 1)
- p_rf_calibrate_info->txpowertrack_control = false;
-#else
- p_rf_calibrate_info->txpowertrack_control = true;
-#endif
-#else
- p_rf_calibrate_info->txpowertrack_control = true;
-#endif
-
- p_rf_calibrate_info->thermal_value = p_hal_data->eeprom_thermal_meter;
- p_rf_calibrate_info->thermal_value_iqk = p_hal_data->eeprom_thermal_meter;
- p_rf_calibrate_info->thermal_value_lck = p_hal_data->eeprom_thermal_meter;
-
- if (p_rf_calibrate_info->default_bb_swing_index_flag != true) {
- /*The index of "0 dB" in SwingTable.*/
- if (p_dm_odm->support_ic_type == ODM_RTL8188E || p_dm_odm->support_ic_type == ODM_RTL8723B ||
- p_dm_odm->support_ic_type == ODM_RTL8192E || p_dm_odm->support_ic_type == ODM_RTL8703B) {
- p_rf_calibrate_info->default_ofdm_index = (default_swing_index >= OFDM_TABLE_SIZE) ? 30 : default_swing_index;
- p_rf_calibrate_info->default_cck_index = 20;
- } else if (p_dm_odm->support_ic_type == ODM_RTL8188F) { /*add by Mingzhi.Guo 2015-03-23*/
- p_rf_calibrate_info->default_ofdm_index = 28; /*OFDM: -1dB*/
- p_rf_calibrate_info->default_cck_index = 20; /*CCK:-6dB*/
- } else if (p_dm_odm->support_ic_type == ODM_RTL8723D) { /*add by zhaohe 2015-10-27*/
- p_rf_calibrate_info->default_ofdm_index = 28; /*OFDM: -1dB*/
- p_rf_calibrate_info->default_cck_index = 28; /*CCK: -6dB*/
- } else {
- p_rf_calibrate_info->default_ofdm_index = (default_swing_index >= TXSCALE_TABLE_SIZE) ? 24 : default_swing_index;
- p_rf_calibrate_info->default_cck_index = 24;
- }
- p_rf_calibrate_info->default_bb_swing_index_flag = true;
- }
-
- p_rf_calibrate_info->bb_swing_idx_cck_base = p_rf_calibrate_info->default_cck_index;
- p_rf_calibrate_info->CCK_index = p_rf_calibrate_info->default_cck_index;
-
- for (p = ODM_RF_PATH_A; p < MAX_RF_PATH; ++p) {
- p_rf_calibrate_info->bb_swing_idx_ofdm_base[p] = p_rf_calibrate_info->default_ofdm_index;
- p_rf_calibrate_info->OFDM_index[p] = p_rf_calibrate_info->default_ofdm_index;
- p_rf_calibrate_info->delta_power_index[p] = 0;
- p_rf_calibrate_info->delta_power_index_last[p] = 0;
- p_rf_calibrate_info->power_index_offset[p] = 0;
- p_rf_calibrate_info->kfree_offset[p] = 0;
- }
- p_rf_calibrate_info->modify_tx_agc_value_ofdm = 0;
- p_rf_calibrate_info->modify_tx_agc_value_cck = 0;
-
-}
-
-
-void
-odm_txpowertracking_check(
- void *p_dm_void
-)
-{
-
-#if 0
- /* 2011/09/29 MH In HW integration first stage, we provide 4 different handle to operate */
- /* at the same time. In the stage2/3, we need to prive universal interface and merge all */
- /* HW dynamic mechanism. */
-#endif
-
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- switch (p_dm_odm->support_platform) {
- case ODM_WIN:
- odm_txpowertracking_check_mp(p_dm_odm);
- break;
-
- case ODM_CE:
- odm_txpowertracking_check_ce(p_dm_odm);
- break;
-
- case ODM_AP:
- odm_txpowertracking_check_ap(p_dm_odm);
- break;
-
- default:
- break;
- }
-
-}
-
-void
-odm_txpowertracking_check_ce(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
-#if ((RTL8188F_SUPPORT == 1))
- rtl8192c_odm_check_txpowertracking(adapter);
-#endif
-
-#if (RTL8188E_SUPPORT == 1)
-
- if (!(p_dm_odm->support_ability & ODM_RF_TX_PWR_TRACK))
- return;
-
- if (!p_rf_calibrate_info->tm_trigger) {
- odm_set_rf_reg(p_dm_odm, ODM_RF_PATH_A, RF_T_METER, RFREGOFFSETMASK, 0x60);
- /*DBG_8192C("Trigger 92C Thermal Meter!!\n");*/
-
- p_rf_calibrate_info->tm_trigger = 1;
- return;
-
- } else {
- /*DBG_8192C("Schedule TxPowerTracking direct call!!\n");*/
- odm_txpowertracking_callback_thermal_meter_8188e(adapter);
- p_rf_calibrate_info->tm_trigger = 0;
- }
-#endif
-#endif
-}
-
-void
-odm_txpowertracking_check_mp(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter = p_dm_odm->adapter;
-
- if (*p_dm_odm->p_is_fcs_mode_enable)
- return;
-
- if (odm_check_power_status(adapter) == false) {
- RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("===>odm_check_power_status() return false\n"));
- return;
- }
-
- if (IS_HARDWARE_TYPE_8821B(adapter)) /* TODO: Don't Do PowerTracking*/
- return;
-
- odm_txpowertracking_thermal_meter_check(adapter);
-
-
-#endif
-
-}
-
-
-void
-odm_txpowertracking_check_ap(
- void *p_dm_void
-)
-{
- return;
-
-}
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-
-void
-odm_txpowertracking_direct_call(
- struct _ADAPTER *adapter
-)
-{
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-
- odm_txpowertracking_callback_thermal_meter(adapter);
-}
-
-void
-odm_txpowertracking_thermal_meter_check(
- struct _ADAPTER *adapter
-)
-{
-#ifndef AP_BUILD_WORKAROUND
- static u8 tm_trigger = 0;
-
- if (!(GET_HAL_DATA(adapter)->DM_OutSrc.support_ability & ODM_RF_TX_PWR_TRACK)) {
- RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD,
- ("===>odm_txpowertracking_thermal_meter_check(),p_mgnt_info->is_txpowertracking is false, return!!\n"));
- return;
- }
-
- if (!tm_trigger) {
- if (IS_HARDWARE_TYPE_8188E(adapter) || IS_HARDWARE_TYPE_JAGUAR(adapter) || IS_HARDWARE_TYPE_8192E(adapter) ||
- IS_HARDWARE_TYPE_8723B(adapter) || IS_HARDWARE_TYPE_8814A(adapter) || IS_HARDWARE_TYPE_8188F(adapter) || IS_HARDWARE_TYPE_8703B(adapter)
- || IS_HARDWARE_TYPE_8822B(adapter) || IS_HARDWARE_TYPE_8723D(adapter) || IS_HARDWARE_TYPE_8821C(adapter))
- PHY_SetRFReg(adapter, ODM_RF_PATH_A, RF_T_METER_88E, BIT(17) | BIT(16), 0x03);
- else
- PHY_SetRFReg(adapter, ODM_RF_PATH_A, RF_T_METER, RFREGOFFSETMASK, 0x60);
-
- RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("Trigger Thermal Meter!!\n"));
-
- tm_trigger = 1;
- return;
- } else {
- RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("Schedule TxPowerTracking direct call!!\n"));
- odm_txpowertracking_direct_call(adapter);
- tm_trigger = 0;
- }
-#endif
-}
-
-#endif
diff --git a/hal/phydm/phydm_pre_define.h b/hal/phydm/phydm_pre_define.h
index 11146e9..869b153 100644
--- a/hal/phydm/phydm_pre_define.h
+++ b/hal/phydm/phydm_pre_define.h
@@ -66,15 +66,8 @@
#define PHYDM_ABCD (BIT(0) | BIT(1) | BIT(2) | BIT(3))
/* number of entry */
-#if (DM_ODM_SUPPORT_TYPE & (ODM_CE))
- #define ASSOCIATE_ENTRY_NUM MACID_NUM_SW_LIMIT /* Max size of asoc_entry[].*/
- #define ODM_ASSOCIATE_ENTRY_NUM ASSOCIATE_ENTRY_NUM
- #elif(DM_ODM_SUPPORT_TYPE & (ODM_AP))
- #define ASSOCIATE_ENTRY_NUM NUM_STAT
- #define ODM_ASSOCIATE_ENTRY_NUM (ASSOCIATE_ENTRY_NUM+1)
-#else
- #define ODM_ASSOCIATE_ENTRY_NUM ((ASSOCIATE_ENTRY_NUM*3)+1)
-#endif
+#define ASSOCIATE_ENTRY_NUM MACID_NUM_SW_LIMIT /* Max size of asoc_entry[].*/
+#define ODM_ASSOCIATE_ENTRY_NUM ASSOCIATE_ENTRY_NUM
/* -----MGN rate--------------------------------- */
@@ -278,27 +271,7 @@ enum ODM_MGN_RATE {
#define ODM_RATEVHTSS4MCS8 0x52
#define ODM_RATEVHTSS4MCS9 0x53
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- #define ODM_NUM_RATE_IDX (ODM_RATEVHTSS4MCS9+1)
-#else
- #if (RTL8192E_SUPPORT == 1) || (RTL8197F_SUPPORT == 1)
- #define ODM_NUM_RATE_IDX (ODM_RATEMCS15+1)
- #elif (RTL8723B_SUPPORT == 1) || (RTL8188E_SUPPORT == 1) || (RTL8188F_SUPPORT == 1)
- #define ODM_NUM_RATE_IDX (ODM_RATEMCS7+1)
- #elif (RTL8821A_SUPPORT == 1) || (RTL8881A_SUPPORT == 1)
- #define ODM_NUM_RATE_IDX (ODM_RATEVHTSS1MCS9+1)
- #elif (RTL8812A_SUPPORT == 1)
- #define ODM_NUM_RATE_IDX (ODM_RATEVHTSS2MCS9+1)
- #elif (RTL8814A_SUPPORT == 1)
- #define ODM_NUM_RATE_IDX (ODM_RATEVHTSS3MCS9+1)
- #else
- #define ODM_NUM_RATE_IDX (ODM_RATEVHTSS4MCS9+1)
- #endif
-#endif
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- #define CONFIG_SFW_SUPPORTED
-#endif
+#define ODM_NUM_RATE_IDX (ODM_RATEVHTSS4MCS9+1)
/* 1 ============================================================
* 1 enumeration
@@ -354,34 +327,8 @@ enum odm_ic_type_e {
#define PHYDM_IC_SUPPORT_LA_MODE (ODM_RTL8814A | ODM_RTL8822B | ODM_RTL8197F | ODM_RTL8821C)
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
-
-#ifdef RTK_AC_SUPPORT
- #define ODM_IC_11AC_SERIES_SUPPORT 1
-#else
- #define ODM_IC_11AC_SERIES_SUPPORT 0
-#endif
-
-#define ODM_IC_11N_SERIES_SUPPORT 1
-#define ODM_CONFIG_BT_COEXIST 0
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-
-#define ODM_IC_11AC_SERIES_SUPPORT 1
-#define ODM_IC_11N_SERIES_SUPPORT 1
-#define ODM_CONFIG_BT_COEXIST 1
-
-#else
-
-#if ((RTL8188E_SUPPORT == 1) || \
-(RTL8723B_SUPPORT == 1) || (RTL8192E_SUPPORT == 1) || (RTL8195A_SUPPORT == 1) || (RTL8703B_SUPPORT == 1) || \
-(RTL8188F_SUPPORT == 1) || (RTL8723D_SUPPORT == 1) || (RTL8197F_SUPPORT == 1))
-#define ODM_IC_11N_SERIES_SUPPORT 1
+#define ODM_IC_11N_SERIES_SUPPORT 1
#define ODM_IC_11AC_SERIES_SUPPORT 0
-#else
-#define ODM_IC_11N_SERIES_SUPPORT 0
-#define ODM_IC_11AC_SERIES_SUPPORT 1
-#endif
#ifdef CONFIG_BT_COEXIST
#define ODM_CONFIG_BT_COEXIST 1
@@ -389,9 +336,6 @@ enum odm_ic_type_e {
#define ODM_CONFIG_BT_COEXIST 0
#endif
-#endif
-
-
#if ((RTL8197F_SUPPORT == 1) || (RTL8723D_SUPPORT == 1) || (RTL8822B_SUPPORT == 1) || (RTL8821C_SUPPORT == 1))
#define ODM_PHY_STATUS_NEW_TYPE_SUPPORT 1
#else
@@ -479,7 +423,6 @@ enum odm_operation_mode_e {
};
/* ODM_CMNINFO_WM_MODE */
-#if (DM_ODM_SUPPORT_TYPE & (ODM_CE))
enum odm_wireless_mode_e {
ODM_WM_UNKNOW = 0x0,
ODM_WM_B = BIT(0),
@@ -490,37 +433,15 @@ enum odm_wireless_mode_e {
ODM_WM_AUTO = BIT(5),
ODM_WM_AC = BIT(6),
};
-#else
-enum odm_wireless_mode_e {
- ODM_WM_UNKNOWN = 0x00,/*0x0*/
- ODM_WM_A = BIT(0), /* 0x1*/
- ODM_WM_B = BIT(1), /* 0x2*/
- ODM_WM_G = BIT(2),/* 0x4*/
- ODM_WM_AUTO = BIT(3),/* 0x8*/
- ODM_WM_N24G = BIT(4),/* 0x10*/
- ODM_WM_N5G = BIT(5),/* 0x20*/
- ODM_WM_AC_5G = BIT(6),/* 0x40*/
- ODM_WM_AC_24G = BIT(7),/* 0x80*/
- ODM_WM_AC_ONLY = BIT(8),/* 0x100*/
- ODM_WM_MAX = BIT(11)/* 0x800*/
-
-};
-#endif
/* ODM_CMNINFO_BAND */
enum odm_band_type_e {
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- ODM_BAND_2_4G = BIT(0),
- ODM_BAND_5G = BIT(1),
-#else
ODM_BAND_2_4G = 0,
ODM_BAND_5G,
ODM_BAND_ON_BOTH,
ODM_BANDMAX
-#endif
};
-
/* ODM_CMNINFO_SEC_CHNL_OFFSET */
enum phydm_sec_chnl_offset_e {
diff --git a/hal/phydm/phydm_rainfo.h b/hal/phydm/phydm_rainfo.h
index 2ca1b07..157bb50 100644
--- a/hal/phydm/phydm_rainfo.h
+++ b/hal/phydm/phydm_rainfo.h
@@ -63,15 +63,7 @@
#define RA_MASK_VHT1SS 0x3ff000
#define RA_MASK_VHT2SS 0xffc00000
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- #define RA_FIRST_MACID 1
-#elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- #define RA_FIRST_MACID 0
- #define WIN_DEFAULT_PORT_MACID 0
- #define WIN_BT_PORT_MACID 2
-#else /*if (DM_ODM_SUPPORT_TYPE == ODM_CE)*/
#define RA_FIRST_MACID 0
-#endif
#define ap_init_rate_adaptive_state odm_rate_adaptive_state_ap_init
@@ -205,25 +197,12 @@ struct _odm_ra_info_ {
u8 ra_stage; /* StageRA, decide how many times RA will be done between PT */
u8 pt_smooth_factor;
#endif
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP) && ((DEV_BUS_TYPE == RT_USB_INTERFACE) || (DEV_BUS_TYPE == RT_SDIO_INTERFACE))
- u8 rate_down_counter;
- u8 rate_up_counter;
- u8 rate_direction;
- u8 bounding_type;
- u8 bounding_counter;
- u8 bounding_learning_time;
- u8 rate_down_start_time;
-#endif
};
#endif
struct _rate_adaptive_table_ {
u8 firstconnect;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- bool PT_collision_pre;
-#endif
-
#if (defined(CONFIG_RA_DBG_CMD))
bool is_ra_dbg_init;
@@ -272,20 +251,10 @@ struct _ODM_RATE_ADAPTIVE {
u8 low_rssi_thresh; /* if RSSI <= low_rssi_thresh => ratr_state is DM_RATR_STA_LOW */
u8 ratr_state; /* Current RSSI level, DM_RATR_STA_HIGH/DM_RATR_STA_MIDDLE/DM_RATR_STA_LOW */
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
u8 ldpc_thres; /* if RSSI > ldpc_thres => switch from LPDC to BCC */
bool is_lower_rts_rate;
-#endif
-#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
- u8 rts_thres;
-#elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
bool is_use_ldpc;
-#else
- u8 ultra_low_rssi_thresh;
- u32 last_ratr; /* RATR Register Content */
-#endif
-
};
void
@@ -480,8 +449,6 @@ odm_ra_post_action_on_assoc(
void *p_dm_odm
);
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
-
u8
odm_find_rts_rate(
void *p_dm_void,
@@ -501,49 +468,12 @@ phydm_update_pwr_track(
u8 rate
);
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-
-s32
-phydm_find_minimum_rssi(
- struct PHY_DM_STRUCT *p_dm_odm,
- struct _ADAPTER *p_adapter,
- OUT bool *p_is_link_temp
-);
-
-void
-odm_update_init_rate_work_item_callback(
- void *p_context
-);
-
-void
-odm_rssi_dump_to_register(
- void *p_dm_void
-);
-
-void
-odm_refresh_ldpc_rts_mp(
- struct _ADAPTER *p_adapter,
- struct PHY_DM_STRUCT *p_dm_odm,
- u8 m_mac_id,
- u8 iot_peer,
- s32 undecorated_smoothed_pwdb
-);
-
-#if 0
-void
-odm_dynamic_arfb_select(
- void *p_dm_void,
- u8 rate,
- bool collision_state
-);
-#endif
void
odm_rate_adaptive_state_ap_init(
void *PADAPTER_VOID,
struct sta_info *p_entry
);
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
static void
find_minimum_rssi(
@@ -568,18 +498,5 @@ odm_get_rate_bitmap(
);
void phydm_ra_rssi_rpt_wk(void *p_context);
-#endif/*#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)*/
-
-#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP))
-/*
-void
-phydm_gen_ramask_h2c_AP(
- void *p_dm_void,
- struct rtl8192cd_priv *priv,
- struct sta_info *p_entry,
- u8 rssi_level
-);
-*/
-#endif/*#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN| ODM_CE))*/
#endif /*#ifndef __ODMRAINFO_H__*/
diff --git a/hal/phydm/phydm_reg.h b/hal/phydm/phydm_reg.h
index 16328fe..2374cbd 100644
--- a/hal/phydm/phydm_reg.h
+++ b/hal/phydm/phydm_reg.h
@@ -126,89 +126,7 @@
/*
* Bitmap Definition
* */
-#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
- /* TX AGC */
- #define REG_TX_AGC_A_CCK_11_CCK_1_JAGUAR 0xc20
- #define REG_TX_AGC_A_OFDM18_OFDM6_JAGUAR 0xc24
- #define REG_TX_AGC_A_OFDM54_OFDM24_JAGUAR 0xc28
- #define REG_TX_AGC_A_MCS3_MCS0_JAGUAR 0xc2c
- #define REG_TX_AGC_A_MCS7_MCS4_JAGUAR 0xc30
- #define REG_TX_AGC_A_MCS11_MCS8_JAGUAR 0xc34
- #define REG_TX_AGC_A_MCS15_MCS12_JAGUAR 0xc38
- #define REG_TX_AGC_A_NSS1_INDEX3_NSS1_INDEX0_JAGUAR 0xc3c
- #define REG_TX_AGC_A_NSS1_INDEX7_NSS1_INDEX4_JAGUAR 0xc40
- #define REG_TX_AGC_A_NSS2_INDEX1_NSS1_INDEX8_JAGUAR 0xc44
- #define REG_TX_AGC_A_NSS2_INDEX5_NSS2_INDEX2_JAGUAR 0xc48
- #define REG_TX_AGC_A_NSS2_INDEX9_NSS2_INDEX6_JAGUAR 0xc4c
- #if defined(CONFIG_WLAN_HAL_8814AE)
- #define REG_TX_AGC_A_MCS19_MCS16_JAGUAR 0xcd8
- #define REG_TX_AGC_A_MCS23_MCS20_JAGUAR 0xcdc
- #define REG_TX_AGC_A_NSS3_INDEX3_NSS3_INDEX0_JAGUAR 0xce0
- #define REG_TX_AGC_A_NSS3_INDEX7_NSS3_INDEX4_JAGUAR 0xce4
- #define REG_TX_AGC_A_NSS3_INDEX9_NSS3_INDEX8_JAGUAR 0xce8
- #endif
- #define REG_TX_AGC_B_CCK_11_CCK_1_JAGUAR 0xe20
- #define REG_TX_AGC_B_OFDM18_OFDM6_JAGUAR 0xe24
- #define REG_TX_AGC_B_OFDM54_OFDM24_JAGUAR 0xe28
- #define REG_TX_AGC_B_MCS3_MCS0_JAGUAR 0xe2c
- #define REG_TX_AGC_B_MCS7_MCS4_JAGUAR 0xe30
- #define REG_TX_AGC_B_MCS11_MCS8_JAGUAR 0xe34
- #define REG_TX_AGC_B_MCS15_MCS12_JAGUAR 0xe38
- #define REG_TX_AGC_B_NSS1_INDEX3_NSS1_INDEX0_JAGUAR 0xe3c
- #define REG_TX_AGC_B_NSS1_INDEX7_NSS1_INDEX4_JAGUAR 0xe40
- #define REG_TX_AGC_B_NSS2_INDEX1_NSS1_INDEX8_JAGUAR 0xe44
- #define REG_TX_AGC_B_NSS2_INDEX5_NSS2_INDEX2_JAGUAR 0xe48
- #define REG_TX_AGC_B_NSS2_INDEX9_NSS2_INDEX6_JAGUAR 0xe4c
- #if defined(CONFIG_WLAN_HAL_8814AE)
- #define REG_TX_AGC_B_MCS19_MCS16_JAGUAR 0xed8
- #define REG_TX_AGC_B_MCS23_MCS20_JAGUAR 0xedc
- #define REG_TX_AGC_B_NSS3_INDEX3_NSS3_INDEX0_JAGUAR 0xee0
- #define REG_TX_AGC_B_NSS3_INDEX7_NSS3_INDEX4_JAGUAR 0xee4
- #define REG_TX_AGC_B_NSS3_INDEX9_NSS3_INDEX8_JAGUAR 0xee8
- #define REG_TX_AGC_C_CCK_11_CCK_1_JAGUAR 0x1820
- #define REG_TX_AGC_C_OFDM18_OFDM6_JAGUAR 0x1824
- #define REG_TX_AGC_C_OFDM54_OFDM24_JAGUAR 0x1828
- #define REG_TX_AGC_C_MCS3_MCS0_JAGUAR 0x182c
- #define REG_TX_AGC_C_MCS7_MCS4_JAGUAR 0x1830
- #define REG_TX_AGC_C_MCS11_MCS8_JAGUAR 0x1834
- #define REG_TX_AGC_C_MCS15_MCS12_JAGUAR 0x1838
- #define REG_TX_AGC_C_NSS1_INDEX3_NSS1_INDEX0_JAGUAR 0x183c
- #define REG_TX_AGC_C_NSS1_INDEX7_NSS1_INDEX4_JAGUAR 0x1840
- #define REG_TX_AGC_C_NSS2_INDEX1_NSS1_INDEX8_JAGUAR 0x1844
- #define REG_TX_AGC_C_NSS2_INDEX5_NSS2_INDEX2_JAGUAR 0x1848
- #define REG_TX_AGC_C_NSS2_INDEX9_NSS2_INDEX6_JAGUAR 0x184c
- #define REG_TX_AGC_C_MCS19_MCS16_JAGUAR 0x18d8
- #define REG_TX_AGC_C_MCS23_MCS20_JAGUAR 0x18dc
- #define REG_TX_AGC_C_NSS3_INDEX3_NSS3_INDEX0_JAGUAR 0x18e0
- #define REG_TX_AGC_C_NSS3_INDEX7_NSS3_INDEX4_JAGUAR 0x18e4
- #define REG_TX_AGC_C_NSS3_INDEX9_NSS3_INDEX8_JAGUAR 0x18e8
- #define REG_TX_AGC_D_CCK_11_CCK_1_JAGUAR 0x1a20
- #define REG_TX_AGC_D_OFDM18_OFDM6_JAGUAR 0x1a24
- #define REG_TX_AGC_D_OFDM54_OFDM24_JAGUAR 0x1a28
- #define REG_TX_AGC_D_MCS3_MCS0_JAGUAR 0x1a2c
- #define REG_TX_AGC_D_MCS7_MCS4_JAGUAR 0x1a30
- #define REG_TX_AGC_D_MCS11_MCS8_JAGUAR 0x1a34
- #define REG_TX_AGC_D_MCS15_MCS12_JAGUAR 0x1a38
- #define REG_TX_AGC_D_NSS1_INDEX3_NSS1_INDEX0_JAGUAR 0x1a3c
- #define REG_TX_AGC_D_NSS1_INDEX7_NSS1_INDEX4_JAGUAR 0x1a40
- #define REG_TX_AGC_D_NSS2_INDEX1_NSS1_INDEX8_JAGUAR 0x1a44
- #define REG_TX_AGC_D_NSS2_INDEX5_NSS2_INDEX2_JAGUAR 0x1a48
- #define REG_TX_AGC_D_NSS2_INDEX9_NSS2_INDEX6_JAGUAR 0x1a4c
- #define REG_TX_AGC_D_MCS19_MCS16_JAGUAR 0x1ad8
- #define REG_TX_AGC_D_MCS23_MCS20_JAGUAR 0x1adc
- #define REG_TX_AGC_D_NSS3_INDEX3_NSS3_INDEX0_JAGUAR 0x1ae0
- #define REG_TX_AGC_D_NSS3_INDEX7_NSS3_INDEX4_JAGUAR 0x1ae4
- #define REG_TX_AGC_D_NSS3_INDEX9_NSS3_INDEX8_JAGUAR 0x1ae8
- #endif
-
- #define is_tx_agc_byte0_jaguar 0xff
- #define is_tx_agc_byte1_jaguar 0xff00
- #define is_tx_agc_byte2_jaguar 0xff0000
- #define is_tx_agc_byte3_jaguar 0xff000000
-#endif
-
-#define BIT_FA_RESET BIT(0)
-
+#define BIT_FA_RESET BIT(0)
#endif
diff --git a/hal/phydm/phydm_rtl8188e.c b/hal/phydm/phydm_rtl8188e.c
index 1e097d7..86a77f2 100644
--- a/hal/phydm/phydm_rtl8188e.c
+++ b/hal/phydm/phydm_rtl8188e.c
@@ -18,55 +18,41 @@
*
******************************************************************************/
-/* ************************************************************
- * include files
- * ************************************************************ */
-
#include "mp_precomp.h"
#include "phydm_precomp.h"
-#if (RTL8188E_SUPPORT == 1)
-
-void
-odm_dig_lower_bound_88e(
- struct PHY_DM_STRUCT *p_dm_odm
-)
+void odm_dig_lower_bound_88e(struct PHY_DM_STRUCT *p_dm_odm)
{
- struct _dynamic_initial_gain_threshold_ *p_dm_dig_table = &p_dm_odm->dm_dig_table;
+ struct _dynamic_initial_gain_threshold_ *p_dm_dig_table =
+ &p_dm_odm->dm_dig_table;
if (p_dm_odm->ant_div_type == CG_TRX_HW_ANTDIV) {
- p_dm_dig_table->rx_gain_range_min = (u8) p_dm_dig_table->ant_div_rssi_max;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_dig_lower_bound_88e(): p_dm_dig_table->ant_div_rssi_max=%d\n", p_dm_dig_table->ant_div_rssi_max));
+ p_dm_dig_table->rx_gain_range_min =
+ (u8)p_dm_dig_table->ant_div_rssi_max;
+ ODM_RT_TRACE(p_dm_odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD,
+ ("odm_dig_lower_bound_88e(): p_dm_dig_table->ant_div_rssi_max=%d\n",
+ p_dm_dig_table->ant_div_rssi_max));
}
- /* If only one Entry connected */
}
/*=============================================================
* AntDiv Before Link
===============================================================*/
-void
-odm_sw_ant_div_reset_before_link(
- struct PHY_DM_STRUCT *p_dm_odm
-)
+void odm_sw_ant_div_reset_before_link(struct PHY_DM_STRUCT *p_dm_odm)
{
-
- struct _sw_antenna_switch_ *p_dm_swat_table = &p_dm_odm->dm_swat_table;
+ struct _sw_antenna_switch_ *p_dm_swat_table = &p_dm_odm->dm_swat_table;
p_dm_swat_table->swas_no_link_state = 0;
-
}
-
/* 3============================================================
* 3 Dynamic Primary CCA
* 3============================================================ */
-void
-odm_primary_cca_init(
- struct PHY_DM_STRUCT *p_dm_odm)
+void odm_primary_cca_init(struct PHY_DM_STRUCT *p_dm_odm)
{
- struct _dynamic_primary_cca *primary_cca = &(p_dm_odm->dm_pri_cca);
+ struct _dynamic_primary_cca *primary_cca = &(p_dm_odm->dm_pri_cca);
primary_cca->dup_rts_flag = 0;
primary_cca->intf_flag = 0;
primary_cca->intf_type = 0;
@@ -74,315 +60,13 @@ odm_primary_cca_init(
primary_cca->pri_cca_flag = 0;
}
-bool
-odm_dynamic_primary_cca_dup_rts(
- struct PHY_DM_STRUCT *p_dm_odm
-)
+bool odm_dynamic_primary_cca_dup_rts(struct PHY_DM_STRUCT *p_dm_odm)
{
- struct _dynamic_primary_cca *primary_cca = &(p_dm_odm->dm_pri_cca);
+ struct _dynamic_primary_cca *primary_cca = &(p_dm_odm->dm_pri_cca);
return primary_cca->dup_rts_flag;
}
-void
-odm_dynamic_primary_cca(
- struct PHY_DM_STRUCT *p_dm_odm
-)
+void odm_dynamic_primary_cca(struct PHY_DM_STRUCT *p_dm_odm)
{
-
-#if (DM_ODM_SUPPORT_TYPE != ODM_CE)
-
- struct _ADAPTER *adapter = p_dm_odm->adapter; /* for NIC */
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
- struct sta_info *p_entry;
-#endif
-
- struct _FALSE_ALARM_STATISTICS *false_alm_cnt = (struct _FALSE_ALARM_STATISTICS *)phydm_get_structure(p_dm_odm, PHYDM_FALSEALMCNT);
- struct _dynamic_primary_cca *primary_cca = &(p_dm_odm->dm_pri_cca);
-
- bool is_40mhz;
- bool client_40mhz = false, client_tmp = false; /* connected client BW */
- bool is_connected = false; /* connected or not */
- static u8 client_40mhz_pre = 0;
- static u64 last_tx_ok_cnt = 0;
- static u64 last_rx_ok_cnt = 0;
- static u32 counter = 0;
- static u8 delay = 1;
- u64 cur_tx_ok_cnt;
- u64 cur_rx_ok_cnt;
- u8 sec_ch_offset;
- u8 i;
-
- if (!(p_dm_odm->support_ability & ODM_BB_PRIMARY_CCA))
- return;
-
- if (p_dm_odm->support_ic_type != ODM_RTL8188E)
- return;
-
- is_40mhz = *(p_dm_odm->p_band_width);
- sec_ch_offset = *(p_dm_odm->p_sec_ch_offset);
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Second CH Offset = %d\n", sec_ch_offset));
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if (is_40mhz == 1)
- sec_ch_offset = sec_ch_offset % 2 + 1; /* NIC's definition is reverse to AP 1:secondary below, 2: secondary above */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Second CH Offset = %d\n", sec_ch_offset));
- /* 3 Check Current WLAN Traffic */
- cur_tx_ok_cnt = adapter->TxStats.NumTxBytesUnicast - last_tx_ok_cnt;
- cur_rx_ok_cnt = adapter->RxStats.NumRxBytesUnicast - last_rx_ok_cnt;
- last_tx_ok_cnt = adapter->TxStats.NumTxBytesUnicast;
- last_rx_ok_cnt = adapter->RxStats.NumRxBytesUnicast;
-#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
- /* 3 Check Current WLAN Traffic */
- cur_tx_ok_cnt = *(p_dm_odm->p_num_tx_bytes_unicast) - last_tx_ok_cnt;
- cur_rx_ok_cnt = *(p_dm_odm->p_num_rx_bytes_unicast) - last_rx_ok_cnt;
- last_tx_ok_cnt = *(p_dm_odm->p_num_tx_bytes_unicast);
- last_rx_ok_cnt = *(p_dm_odm->p_num_rx_bytes_unicast);
-#endif
-
- /* ==================Debug Message==================== */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("TP = %llu\n", cur_tx_ok_cnt + cur_rx_ok_cnt));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("is_40mhz = %d\n", is_40mhz));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("BW_LSC = %d\n", false_alm_cnt->cnt_bw_lsc));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("BW_USC = %d\n", false_alm_cnt->cnt_bw_usc));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("CCA OFDM = %d\n", false_alm_cnt->cnt_ofdm_cca));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("CCA CCK = %d\n", false_alm_cnt->cnt_cck_cca));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("OFDM FA = %d\n", false_alm_cnt->cnt_ofdm_fail));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("CCK FA = %d\n", false_alm_cnt->cnt_cck_fail));
- /* ================================================ */
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- if (ACTING_AS_AP(adapter)) /* primary cca process only do at AP mode */
-#endif
- {
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("ACTING as AP mode=%d\n", ACTING_AS_AP(adapter)));
- /* 3 To get entry's connection and BW infomation status. */
- for (i = 0; i < ASSOCIATE_ENTRY_NUM; i++) {
- if (IsAPModeExist(adapter) && GetFirstExtAdapter(adapter) != NULL)
- p_entry = AsocEntry_EnumStation(GetFirstExtAdapter(adapter), i);
- else
- p_entry = AsocEntry_EnumStation(GetDefaultAdapter(adapter), i);
- if (p_entry != NULL) {
- client_tmp = p_entry->BandWidth; /* client BW */
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Client_BW=%d\n", client_tmp));
- if (client_tmp > client_40mhz)
- client_40mhz = client_tmp; /* 40M/20M coexist => 40M priority is High */
-
- if (p_entry->bAssociated) {
- is_connected = true; /* client is connected or not */
- break;
- }
- } else
- break;
- }
-#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
- /* 3 To get entry's connection and BW infomation status. */
-
- struct sta_info *pstat;
-
- for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) {
- pstat = p_dm_odm->p_odm_sta_info[i];
- if (IS_STA_VALID(pstat)) {
- client_tmp = pstat->tx_bw;
- if (client_tmp > client_40mhz)
- client_40mhz = client_tmp; /* 40M/20M coexist => 40M priority is High */
-
- is_connected = true;
- }
- }
-#endif
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("is_connected=%d\n", is_connected));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Is Client 40MHz=%d\n", client_40mhz));
- /* 1 Monitor whether the interference exists or not */
- if (primary_cca->monitor_flag == 1) {
- if (sec_ch_offset == 1) { /* secondary channel is below the primary channel */
- if ((false_alm_cnt->cnt_ofdm_cca > 500) && (false_alm_cnt->cnt_bw_lsc > false_alm_cnt->cnt_bw_usc + 500)) {
- if (false_alm_cnt->cnt_ofdm_fail > false_alm_cnt->cnt_ofdm_cca >> 1) {
- primary_cca->intf_type = 1;
- primary_cca->pri_cca_flag = 1;
- odm_set_bb_reg(p_dm_odm, 0xc6c, BIT(8) | BIT7, 2); /* USC MF */
- if (primary_cca->dup_rts_flag == 1)
- primary_cca->dup_rts_flag = 0;
- } else {
- primary_cca->intf_type = 2;
- if (primary_cca->dup_rts_flag == 0)
- primary_cca->dup_rts_flag = 1;
- }
-
- } else { /* interferecne disappear */
- primary_cca->dup_rts_flag = 0;
- primary_cca->intf_flag = 0;
- primary_cca->intf_type = 0;
- }
- } else if (sec_ch_offset == 2) { /* secondary channel is above the primary channel */
- if ((false_alm_cnt->cnt_ofdm_cca > 500) && (false_alm_cnt->cnt_bw_usc > false_alm_cnt->cnt_bw_lsc + 500)) {
- if (false_alm_cnt->cnt_ofdm_fail > false_alm_cnt->cnt_ofdm_cca >> 1) {
- primary_cca->intf_type = 1;
- primary_cca->pri_cca_flag = 1;
- odm_set_bb_reg(p_dm_odm, 0xc6c, BIT(8) | BIT7, 1); /* LSC MF */
- if (primary_cca->dup_rts_flag == 1)
- primary_cca->dup_rts_flag = 0;
- } else {
- primary_cca->intf_type = 2;
- if (primary_cca->dup_rts_flag == 0)
- primary_cca->dup_rts_flag = 1;
- }
-
- } else { /* interferecne disappear */
- primary_cca->dup_rts_flag = 0;
- primary_cca->intf_flag = 0;
- primary_cca->intf_type = 0;
- }
-
-
- }
- primary_cca->monitor_flag = 0;
- }
-
- /* 1 Dynamic Primary CCA Main Function */
- if (primary_cca->monitor_flag == 0) {
- if (is_40mhz) { /* if RFBW==40M mode which require to process primary cca */
- /* 2 STA is NOT Connected */
- if (!is_connected) {
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("STA NOT Connected!!!!\n"));
-
- if (primary_cca->pri_cca_flag == 1) { /* reset primary cca when STA is disconnected */
- primary_cca->pri_cca_flag = 0;
- odm_set_bb_reg(p_dm_odm, 0xc6c, BIT(8) | BIT(7), 0);
- }
- if (primary_cca->dup_rts_flag == 1) /* reset Duplicate RTS when STA is disconnected */
- primary_cca->dup_rts_flag = 0;
-
- if (sec_ch_offset == 1) { /* secondary channel is below the primary channel */
- if ((false_alm_cnt->cnt_ofdm_cca > 800) && (false_alm_cnt->cnt_bw_lsc * 5 > false_alm_cnt->cnt_bw_usc * 9)) {
- primary_cca->intf_flag = 1; /* secondary channel interference is detected!!! */
- if (false_alm_cnt->cnt_ofdm_fail > false_alm_cnt->cnt_ofdm_cca >> 1)
- primary_cca->intf_type = 1; /* interference is shift */
- else
- primary_cca->intf_type = 2; /* interference is in-band */
- } else {
- primary_cca->intf_flag = 0;
- primary_cca->intf_type = 0;
- }
- } else if (sec_ch_offset == 2) { /* secondary channel is above the primary channel */
- if ((false_alm_cnt->cnt_ofdm_cca > 800) && (false_alm_cnt->cnt_bw_usc * 5 > false_alm_cnt->cnt_bw_lsc * 9)) {
- primary_cca->intf_flag = 1; /* secondary channel interference is detected!!! */
- if (false_alm_cnt->cnt_ofdm_fail > false_alm_cnt->cnt_ofdm_cca >> 1)
- primary_cca->intf_type = 1; /* interference is shift */
- else
- primary_cca->intf_type = 2; /* interference is in-band */
- } else {
- primary_cca->intf_flag = 0;
- primary_cca->intf_type = 0;
- }
- }
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("primary_cca=%d\n", primary_cca->pri_cca_flag));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Intf_Type=%d\n", primary_cca->intf_type));
- }
- /* 2 STA is Connected */
- else {
- if (client_40mhz == 0) /* 3 */ { /* client BW = 20MHz */
- if (primary_cca->pri_cca_flag == 0) {
- primary_cca->pri_cca_flag = 1;
- if (sec_ch_offset == 1)
- odm_set_bb_reg(p_dm_odm, 0xc6c, BIT(8) | BIT(7), 2);
- else if (sec_ch_offset == 2)
- odm_set_bb_reg(p_dm_odm, 0xc6c, BIT(8) | BIT(7), 1);
- }
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("STA Connected 20M!!! primary_cca=%d\n", primary_cca->pri_cca_flag));
- } else /* 3 */ { /* client BW = 40MHz */
- if (primary_cca->intf_flag == 1) { /* interference is detected!! */
- if (primary_cca->intf_type == 1) {
- if (primary_cca->pri_cca_flag != 1) {
- primary_cca->pri_cca_flag = 1;
- if (sec_ch_offset == 1)
- odm_set_bb_reg(p_dm_odm, 0xc6c, BIT(8) | BIT(7), 2);
- else if (sec_ch_offset == 2)
- odm_set_bb_reg(p_dm_odm, 0xc6c, BIT(8) | BIT(7), 1);
- }
- } else if (primary_cca->intf_type == 2) {
- if (primary_cca->dup_rts_flag != 1)
- primary_cca->dup_rts_flag = 1;
- }
- } else { /* if intf_flag==0 */
- if ((cur_tx_ok_cnt + cur_rx_ok_cnt) < 10000) { /* idle mode or TP traffic is very low */
- if (sec_ch_offset == 1) {
- if ((false_alm_cnt->cnt_ofdm_cca > 800) && (false_alm_cnt->cnt_bw_lsc * 5 > false_alm_cnt->cnt_bw_usc * 9)) {
- primary_cca->intf_flag = 1;
- if (false_alm_cnt->cnt_ofdm_fail > false_alm_cnt->cnt_ofdm_cca >> 1)
- primary_cca->intf_type = 1; /* interference is shift */
- else
- primary_cca->intf_type = 2; /* interference is in-band */
- }
- } else if (sec_ch_offset == 2) {
- if ((false_alm_cnt->cnt_ofdm_cca > 800) && (false_alm_cnt->cnt_bw_usc * 5 > false_alm_cnt->cnt_bw_lsc * 9)) {
- primary_cca->intf_flag = 1;
- if (false_alm_cnt->cnt_ofdm_fail > false_alm_cnt->cnt_ofdm_cca >> 1)
- primary_cca->intf_type = 1; /* interference is shift */
- else
- primary_cca->intf_type = 2; /* interference is in-band */
- }
-
- }
- } else { /* TP Traffic is High */
- if (sec_ch_offset == 1) {
- if (false_alm_cnt->cnt_bw_lsc > (false_alm_cnt->cnt_bw_usc + 500)) {
- if (delay == 0) { /* add delay to avoid interference occurring abruptly, jump one time */
- primary_cca->intf_flag = 1;
- if (false_alm_cnt->cnt_ofdm_fail > false_alm_cnt->cnt_ofdm_cca >> 1)
- primary_cca->intf_type = 1; /* interference is shift */
- else
- primary_cca->intf_type = 2; /* interference is in-band */
- delay = 1;
- } else
- delay = 0;
- }
- } else if (sec_ch_offset == 2) {
- if (false_alm_cnt->cnt_bw_usc > (false_alm_cnt->cnt_bw_lsc + 500)) {
- if (delay == 0) { /* add delay to avoid interference occurring abruptly */
- primary_cca->intf_flag = 1;
- if (false_alm_cnt->cnt_ofdm_fail > false_alm_cnt->cnt_ofdm_cca >> 1)
- primary_cca->intf_type = 1; /* interference is shift */
- else
- primary_cca->intf_type = 2; /* interference is in-band */
- delay = 1;
- } else
- delay = 0;
- }
- }
- }
- }
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Primary CCA=%d\n", primary_cca->pri_cca_flag));
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("Duplicate RTS=%d\n", primary_cca->dup_rts_flag));
- }
-
- } /* end of connected */
- }
- }
- /* 1 Dynamic Primary CCA Monitor counter */
- if ((primary_cca->pri_cca_flag == 1) || (primary_cca->dup_rts_flag == 1)) {
- if (client_40mhz == 0) { /* client=20M no need to monitor primary cca flag */
- client_40mhz_pre = client_40mhz;
- return;
- }
- counter++;
- ODM_RT_TRACE(p_dm_odm, ODM_COMP_DYNAMIC_PRICCA, ODM_DBG_LOUD, ("counter=%d\n", counter));
- if ((counter == 30) || ((client_40mhz - client_40mhz_pre) == 1)) { /* Every 60 sec to monitor one time */
- primary_cca->monitor_flag = 1; /* monitor flag is triggered!!!!! */
- if (primary_cca->pri_cca_flag == 1) {
- primary_cca->pri_cca_flag = 0;
- odm_set_bb_reg(p_dm_odm, 0xc6c, BIT(8) | BIT(7), 0);
- }
- counter = 0;
- }
- }
- }
-
- client_40mhz_pre = client_40mhz;
-#endif
}
-
-#endif /* #if (RTL8188E_SUPPORT == 1) */
diff --git a/hal/phydm/phydm_rtl8188e.h b/hal/phydm/phydm_rtl8188e.h
index 5466455..8e36deb 100644
--- a/hal/phydm/phydm_rtl8188e.h
+++ b/hal/phydm/phydm_rtl8188e.h
@@ -34,11 +34,6 @@ odm_dig_lower_bound_88e(
struct PHY_DM_STRUCT *p_dm_odm
);
-
-
-
-#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
-
#define sw_ant_div_reset_before_link odm_sw_ant_div_reset_before_link
void odm_sw_ant_div_reset_before_link(struct PHY_DM_STRUCT *p_dm_odm);
@@ -49,12 +44,6 @@ odm_set_tx_ant_by_tx_info_88e(
u8 *p_desc,
u8 mac_id
);
-#else/* (DM_ODM_SUPPORT_TYPE == ODM_AP) */
-void
-odm_set_tx_ant_by_tx_info_88e(
- struct PHY_DM_STRUCT *p_dm_odm
-);
-#endif
void
odm_primary_cca_init(
diff --git a/hal/phydm/phydm_types.h b/hal/phydm/phydm_types.h
index 0707e5a..a8a2a22 100644
--- a/hal/phydm/phydm_types.h
+++ b/hal/phydm/phydm_types.h
@@ -32,17 +32,11 @@
#define ODM_ENDIAN_BIG 0
#define ODM_ENDIAN_LITTLE 1
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- #define GET_PDM_ODM(__padapter) ((struct PHY_DM_STRUCT*)(&((GET_HAL_DATA(__padapter))->DM_OutSrc)))
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
#define GET_PDM_ODM(__padapter) ((struct PHY_DM_STRUCT*)(&((GET_HAL_DATA(__padapter))->odmpriv)))
-#endif
-#if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
#define RT_PCI_INTERFACE 1
#define RT_USB_INTERFACE 2
#define RT_SDIO_INTERFACE 3
-#endif
enum hal_status {
HAL_STATUS_SUCCESS,
@@ -55,10 +49,6 @@ enum hal_status {
RT_STATUS_OS_API_FAILED,*/
};
-#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
- #define MP_DRIVER 0
-#endif
-#if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
#define VISTA_USB_RX_REVISE 0
@@ -112,73 +102,6 @@ enum rt_spinlock_type {
RT_LAST_SPINLOCK,
};
-#endif
-
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- #define sta_info _RT_WLAN_STA
- #define __func__ __func__
- #define PHYDM_TESTCHIP_SUPPORT TESTCHIP_SUPPORT
- #define MASKH3BYTES 0xffffff00
- #define SUCCESS 0
- #define FAIL (-1)
-
- #define u8 u1Byte
- #define s8 s1Byte
-
- #define u16 u2Byte
- #define s16 s2Byte
-
- #define u32 u4Byte
- #define s32 s4Byte
-
- #define u64 u8Byte
- #define s64 s8Byte
-
- #define bool BOOLEAN
-
- #define timer_list _RT_TIMER
-
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
-
- /* To let ADSL/AP project compile ok; it should be removed after all conflict are solved. Added by Annie, 2011-10-07. */
- #define ADSL_AP_BUILD_WORKAROUND
- #define AP_BUILD_WORKAROUND
-
- #ifdef AP_BUILD_WORKAROUND
- #include "../typedef.h"
- #else
- typedef void void, *void *;
- typedef unsigned char bool, *bool *;
- typedef unsigned char u8, *u8 *;
- typedef unsigned short u16, *u16 *;
- typedef unsigned int u32, *u32 *;
- typedef unsigned long long u64, *u64 *;
- #if 1
- /* In ARM platform, system would use the type -- "char" as "unsigned char"
- * And we only use s8/s8* as INT8 now, so changes the type of s8.*/
- typedef signed char s8, *s8 *;
- #else
- typedef char s8, *s8 *;
- #endif
- typedef short s16, *s16 *;
- typedef long s32, *s32 *;
- typedef long long s64, *s64 *;
- #endif
-
- #define _TRUE 1
- #define _FALSE 0
-
- #if (defined(TESTCHIP_SUPPORT))
- #define PHYDM_TESTCHIP_SUPPORT 1
- #else
- #define PHYDM_TESTCHIP_SUPPORT 0
- #endif
-
- #define sta_info stat_info
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
#include
#define DEV_BUS_TYPE RT_USB_INTERFACE
@@ -207,7 +130,6 @@ enum rt_spinlock_type {
#else
#define PHYDM_TESTCHIP_SUPPORT 0
#endif
-#endif
#define READ_NEXT_PAIR(v1, v2, i) do { if (i+2 >= array_len) break; i += 2; v1 = array[i]; v2 = array[i+1]; } while (0)
#define COND_ELSE 2
diff --git a/hal/phydm/txbf/halcomtxbf.c b/hal/phydm/txbf/halcomtxbf.c
deleted file mode 100644
index 2349fa9..0000000
--- a/hal/phydm/txbf/halcomtxbf.c
+++ /dev/null
@@ -1,538 +0,0 @@
-/* ************************************************************
- * Description:
- *
- * This file is for TXBF mechanism
- *
- * ************************************************************ */
-#include "mp_precomp.h"
-#include "../phydm_precomp.h"
-
-#if (BEAMFORMING_SUPPORT == 1)
-/*Beamforming halcomtxbf API create by YuChen 2015/05*/
-
-void
-hal_com_txbf_beamform_init(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- bool is_iqgen_setting_ok = false;
-
- if (p_dm_odm->support_ic_type & ODM_RTL8814A) {
- is_iqgen_setting_ok = phydm_beamforming_set_iqgen_8814A(p_dm_odm);
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] is_iqgen_setting_ok = %d\n", __func__, is_iqgen_setting_ok));
- }
-}
-
-/*Only used for MU BFer Entry when get GID management frame (self is as MU STA)*/
-void
-hal_com_txbf_config_gtab(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-
- if (p_dm_odm->support_ic_type & ODM_RTL8822B)
- hal_txbf_8822b_config_gtab(p_dm_odm);
-}
-
-void
-phydm_beamform_set_sounding_enter(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _HAL_TXBF_INFO *p_txbf_info = &p_dm_odm->beamforming_info.txbf_info;
-
- if (odm_is_work_item_scheduled(&(p_txbf_info->txbf_enter_work_item)) == false)
- odm_schedule_work_item(&(p_txbf_info->txbf_enter_work_item));
-#else
- hal_com_txbf_enter_work_item_callback(p_dm_odm);
-#endif
-}
-
-void
-phydm_beamform_set_sounding_leave(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _HAL_TXBF_INFO *p_txbf_info = &p_dm_odm->beamforming_info.txbf_info;
-
- if (odm_is_work_item_scheduled(&(p_txbf_info->txbf_leave_work_item)) == false)
- odm_schedule_work_item(&(p_txbf_info->txbf_leave_work_item));
-#else
- hal_com_txbf_leave_work_item_callback(p_dm_odm);
-#endif
-}
-
-void
-phydm_beamform_set_sounding_rate(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _HAL_TXBF_INFO *p_txbf_info = &p_dm_odm->beamforming_info.txbf_info;
-
- if (odm_is_work_item_scheduled(&(p_txbf_info->txbf_rate_work_item)) == false)
- odm_schedule_work_item(&(p_txbf_info->txbf_rate_work_item));
-#else
- hal_com_txbf_rate_work_item_callback(p_dm_odm);
-#endif
-}
-
-void
-phydm_beamform_set_sounding_status(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _HAL_TXBF_INFO *p_txbf_info = &p_dm_odm->beamforming_info.txbf_info;
-
- if (odm_is_work_item_scheduled(&(p_txbf_info->txbf_status_work_item)) == false)
- odm_schedule_work_item(&(p_txbf_info->txbf_status_work_item));
-#else
- hal_com_txbf_status_work_item_callback(p_dm_odm);
-#endif
-}
-
-void
-phydm_beamform_set_sounding_fw_ndpa(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _HAL_TXBF_INFO *p_txbf_info = &p_dm_odm->beamforming_info.txbf_info;
-
- if (*p_dm_odm->p_is_fw_dw_rsvd_page_in_progress)
- odm_set_timer(p_dm_odm, &(p_txbf_info->txbf_fw_ndpa_timer), 5);
- else
- odm_schedule_work_item(&(p_txbf_info->txbf_fw_ndpa_work_item));
-#else
- hal_com_txbf_fw_ndpa_work_item_callback(p_dm_odm);
-#endif
-}
-
-void
-phydm_beamform_set_sounding_clk(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _HAL_TXBF_INFO *p_txbf_info = &p_dm_odm->beamforming_info.txbf_info;
-
- if (odm_is_work_item_scheduled(&(p_txbf_info->txbf_clk_work_item)) == false)
- odm_schedule_work_item(&(p_txbf_info->txbf_clk_work_item));
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- struct _ADAPTER *padapter = p_dm_odm->adapter;
-
- rtw_run_in_thread_cmd(padapter, hal_com_txbf_clk_work_item_callback, padapter);
-#else
- hal_com_txbf_clk_work_item_callback(p_dm_odm);
-#endif
-}
-
-void
-phydm_beamform_set_reset_tx_path(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _HAL_TXBF_INFO *p_txbf_info = &p_dm_odm->beamforming_info.txbf_info;
-
- if (odm_is_work_item_scheduled(&(p_txbf_info->txbf_reset_tx_path_work_item)) == false)
- odm_schedule_work_item(&(p_txbf_info->txbf_reset_tx_path_work_item));
-#else
- hal_com_txbf_reset_tx_path_work_item_callback(p_dm_odm);
-#endif
-}
-
-void
-phydm_beamform_set_get_tx_rate(
- void *p_dm_void
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _HAL_TXBF_INFO *p_txbf_info = &p_dm_odm->beamforming_info.txbf_info;
-
- if (odm_is_work_item_scheduled(&(p_txbf_info->txbf_get_tx_rate_work_item)) == false)
- odm_schedule_work_item(&(p_txbf_info->txbf_get_tx_rate_work_item));
-#else
- hal_com_txbf_get_tx_rate_work_item_callback(p_dm_odm);
-#endif
-}
-
-void
-hal_com_txbf_enter_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
- void *p_dm_void
-#endif
-)
-{
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-#else
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#endif
- struct _HAL_TXBF_INFO *p_txbf_info = &p_dm_odm->beamforming_info.txbf_info;
- u8 idx = p_txbf_info->txbf_idx;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start!\n", __func__));
-
- if (p_dm_odm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821))
- hal_txbf_jaguar_enter(p_dm_odm, idx);
- else if (p_dm_odm->support_ic_type & ODM_RTL8192E)
- hal_txbf_8192e_enter(p_dm_odm, idx);
- else if (p_dm_odm->support_ic_type & ODM_RTL8814A)
- hal_txbf_8814a_enter(p_dm_odm, idx);
- else if (p_dm_odm->support_ic_type & ODM_RTL8822B)
- hal_txbf_8822b_enter(p_dm_odm, idx);
-}
-
-void
-hal_com_txbf_leave_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
- void *p_dm_void
-#endif
-)
-{
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-#else
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#endif
- struct _HAL_TXBF_INFO *p_txbf_info = &p_dm_odm->beamforming_info.txbf_info;
-
- u8 idx = p_txbf_info->txbf_idx;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start!\n", __func__));
-
- if (p_dm_odm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821))
- hal_txbf_jaguar_leave(p_dm_odm, idx);
- else if (p_dm_odm->support_ic_type & ODM_RTL8192E)
- hal_txbf_8192e_leave(p_dm_odm, idx);
- else if (p_dm_odm->support_ic_type & ODM_RTL8814A)
- hal_txbf_8814a_leave(p_dm_odm, idx);
- else if (p_dm_odm->support_ic_type & ODM_RTL8822B)
- hal_txbf_8822b_leave(p_dm_odm, idx);
-}
-
-
-void
-hal_com_txbf_fw_ndpa_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
- void *p_dm_void
-#endif
-)
-{
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-#else
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#endif
- struct _HAL_TXBF_INFO *p_txbf_info = &p_dm_odm->beamforming_info.txbf_info;
- u8 idx = p_txbf_info->ndpa_idx;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start!\n", __func__));
-
- if (p_dm_odm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821))
- hal_txbf_jaguar_fw_txbf(p_dm_odm, idx);
- else if (p_dm_odm->support_ic_type & ODM_RTL8192E)
- hal_txbf_8192e_fw_tx_bf(p_dm_odm, idx);
- else if (p_dm_odm->support_ic_type & ODM_RTL8814A)
- hal_txbf_8814a_fw_txbf(p_dm_odm, idx);
- else if (p_dm_odm->support_ic_type & ODM_RTL8822B)
- hal_txbf_8822b_fw_txbf(p_dm_odm, idx);
-}
-
-void
-hal_com_txbf_clk_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
- void *p_dm_void
-#endif
-)
-{
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-#else
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#endif
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start!\n", __func__));
-
- if (p_dm_odm->support_ic_type & ODM_RTL8812)
- hal_txbf_jaguar_clk_8812a(p_dm_odm);
-}
-
-
-
-void
-hal_com_txbf_rate_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
- void *p_dm_void
-#endif
-)
-{
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-#else
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#endif
- struct _HAL_TXBF_INFO *p_txbf_info = &p_dm_odm->beamforming_info.txbf_info;
- u8 BW = p_txbf_info->BW;
- u8 rate = p_txbf_info->rate;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start!\n", __func__));
-
- if (p_dm_odm->support_ic_type & ODM_RTL8812)
- hal_txbf_8812a_set_ndpa_rate(p_dm_odm, BW, rate);
- else if (p_dm_odm->support_ic_type & ODM_RTL8192E)
- hal_txbf_8192e_set_ndpa_rate(p_dm_odm, BW, rate);
- else if (p_dm_odm->support_ic_type & ODM_RTL8814A)
- hal_txbf_8814a_set_ndpa_rate(p_dm_odm, BW, rate);
-
-}
-
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-void
-hal_com_txbf_fw_ndpa_timer_callback(
- struct timer_list *p_timer
-)
-{
-
- struct _ADAPTER *adapter = (struct _ADAPTER *)p_timer->Adapter;
- PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-
- struct _HAL_TXBF_INFO *p_txbf_info = &p_dm_odm->beamforming_info.txbf_info;
-
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start!\n", __func__));
-
- if (*p_dm_odm->p_is_fw_dw_rsvd_page_in_progress)
- odm_set_timer(p_dm_odm, &(p_txbf_info->txbf_fw_ndpa_timer), 5);
- else
- odm_schedule_work_item(&(p_txbf_info->txbf_fw_ndpa_work_item));
-}
-#endif
-
-
-void
-hal_com_txbf_status_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
- void *p_dm_void
-#endif
-)
-{
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-#else
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#endif
- struct _HAL_TXBF_INFO *p_txbf_info = &p_dm_odm->beamforming_info.txbf_info;
-
- u8 idx = p_txbf_info->txbf_idx;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start!\n", __func__));
-
- if (p_dm_odm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821))
- hal_txbf_jaguar_status(p_dm_odm, idx);
- else if (p_dm_odm->support_ic_type & ODM_RTL8192E)
- hal_txbf_8192e_status(p_dm_odm, idx);
- else if (p_dm_odm->support_ic_type & ODM_RTL8814A)
- hal_txbf_8814a_status(p_dm_odm, idx);
- else if (p_dm_odm->support_ic_type & ODM_RTL8822B)
- hal_txbf_8822b_status(p_dm_odm, idx);
-}
-
-void
-hal_com_txbf_reset_tx_path_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
- void *p_dm_void
-#endif
-)
-{
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-#else
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#endif
- struct _HAL_TXBF_INFO *p_txbf_info = &p_dm_odm->beamforming_info.txbf_info;
-
- u8 idx = p_txbf_info->txbf_idx;
-
- if (p_dm_odm->support_ic_type & ODM_RTL8814A)
- hal_txbf_8814a_reset_tx_path(p_dm_odm, idx);
-
-}
-
-void
-hal_com_txbf_get_tx_rate_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
- void *p_dm_void
-#endif
-)
-{
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
-#else
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
-#endif
-
- if (p_dm_odm->support_ic_type & ODM_RTL8814A)
- hal_txbf_8814a_get_tx_rate(p_dm_odm);
-}
-
-
-bool
-hal_com_txbf_set(
- void *p_dm_void,
- u8 set_type,
- void *p_in_buf
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u8 *p_u1_tmp = (u8 *)p_in_buf;
- struct _HAL_TXBF_INFO *p_txbf_info = &p_dm_odm->beamforming_info.txbf_info;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] set_type = 0x%X\n", __func__, set_type));
-
- switch (set_type) {
- case TXBF_SET_SOUNDING_ENTER:
- p_txbf_info->txbf_idx = *p_u1_tmp;
- phydm_beamform_set_sounding_enter(p_dm_odm);
- break;
-
- case TXBF_SET_SOUNDING_LEAVE:
- p_txbf_info->txbf_idx = *p_u1_tmp;
- phydm_beamform_set_sounding_leave(p_dm_odm);
- break;
-
- case TXBF_SET_SOUNDING_RATE:
- p_txbf_info->BW = p_u1_tmp[0];
- p_txbf_info->rate = p_u1_tmp[1];
- phydm_beamform_set_sounding_rate(p_dm_odm);
- break;
-
- case TXBF_SET_SOUNDING_STATUS:
- p_txbf_info->txbf_idx = *p_u1_tmp;
- phydm_beamform_set_sounding_status(p_dm_odm);
- break;
-
- case TXBF_SET_SOUNDING_FW_NDPA:
- p_txbf_info->ndpa_idx = *p_u1_tmp;
- phydm_beamform_set_sounding_fw_ndpa(p_dm_odm);
- break;
-
- case TXBF_SET_SOUNDING_CLK:
- phydm_beamform_set_sounding_clk(p_dm_odm);
- break;
-
- case TXBF_SET_TX_PATH_RESET:
- p_txbf_info->txbf_idx = *p_u1_tmp;
- phydm_beamform_set_reset_tx_path(p_dm_odm);
- break;
-
- case TXBF_SET_GET_TX_RATE:
- phydm_beamform_set_get_tx_rate(p_dm_odm);
- break;
-
- }
-
- return true;
-}
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-bool
-hal_com_txbf_get(
- struct _ADAPTER *adapter,
- u8 get_type,
- void *p_out_buf
-)
-{
- PHAL_DATA_TYPE p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
- bool *p_boolean = (bool *)p_out_buf;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start!\n", __func__));
-
- if (get_type == TXBF_GET_EXPLICIT_BEAMFORMEE) {
- if (IS_HARDWARE_TYPE_OLDER_THAN_8812A(adapter))
- *p_boolean = false;
- else if (/*IS_HARDWARE_TYPE_8822B(adapter) ||*/
- IS_HARDWARE_TYPE_8821B(adapter) ||
- IS_HARDWARE_TYPE_8192E(adapter) ||
- IS_HARDWARE_TYPE_JAGUAR(adapter) || IS_HARDWARE_TYPE_JAGUAR_AND_JAGUAR2(adapter))
- *p_boolean = true;
- else
- *p_boolean = false;
- } else if (get_type == TXBF_GET_EXPLICIT_BEAMFORMER) {
- if (IS_HARDWARE_TYPE_OLDER_THAN_8812A(adapter))
- *p_boolean = false;
- else if (/*IS_HARDWARE_TYPE_8822B(adapter) ||*/
- IS_HARDWARE_TYPE_8821B(adapter) ||
- IS_HARDWARE_TYPE_8192E(adapter) ||
- IS_HARDWARE_TYPE_JAGUAR(adapter) || IS_HARDWARE_TYPE_JAGUAR_AND_JAGUAR2(adapter)) {
- if (p_hal_data->RF_Type == RF_2T2R || p_hal_data->RF_Type == RF_3T3R)
- *p_boolean = true;
- else
- *p_boolean = false;
- } else
- *p_boolean = false;
- } else if (get_type == TXBF_GET_MU_MIMO_STA) {
-#if ((RTL8822B_SUPPORT == 1) || (RTL8821C_SUPPORT == 1))
- if (IS_HARDWARE_TYPE_8822B(adapter) || IS_HARDWARE_TYPE_8821C(adapter))
- *p_boolean = true;
- else
-#endif
- *p_boolean = false;
-
-
- } else if (get_type == TXBF_GET_MU_MIMO_AP) {
-#if (RTL8822B_SUPPORT == 1)
- if (IS_HARDWARE_TYPE_8822B(adapter))
- *p_boolean = true;
- else
-#endif
- *p_boolean = false;
- }
-
- return true;
-}
-#endif
-
-
-#endif
diff --git a/hal/phydm/txbf/halcomtxbf.h b/hal/phydm/txbf/halcomtxbf.h
index 37beb45..a303e54 100644
--- a/hal/phydm/txbf/halcomtxbf.h
+++ b/hal/phydm/txbf/halcomtxbf.h
@@ -44,19 +44,7 @@ struct _HAL_TXBF_INFO {
u8 ndpa_idx;
u8 BW;
u8 rate;
-
struct timer_list txbf_fw_ndpa_timer;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- RT_WORK_ITEM txbf_enter_work_item;
- RT_WORK_ITEM txbf_leave_work_item;
- RT_WORK_ITEM txbf_fw_ndpa_work_item;
- RT_WORK_ITEM txbf_clk_work_item;
- RT_WORK_ITEM txbf_status_work_item;
- RT_WORK_ITEM txbf_rate_work_item;
- RT_WORK_ITEM txbf_reset_tx_path_work_item;
- RT_WORK_ITEM txbf_get_tx_rate_work_item;
-#endif
-
};
#if (BEAMFORMING_SUPPORT == 1)
@@ -73,65 +61,37 @@ hal_com_txbf_config_gtab(
void
hal_com_txbf_enter_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
void *p_dm_void
-#endif
);
void
hal_com_txbf_leave_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
void *p_dm_void
-#endif
);
void
hal_com_txbf_fw_ndpa_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
void *p_dm_void
-#endif
);
void
hal_com_txbf_clk_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
void *p_dm_void
-#endif
);
void
hal_com_txbf_reset_tx_path_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
void *p_dm_void
-#endif
);
void
hal_com_txbf_get_tx_rate_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
void *p_dm_void
-#endif
);
void
hal_com_txbf_rate_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
void *p_dm_void
-#endif
);
void
@@ -141,11 +101,7 @@ hal_com_txbf_fw_ndpa_timer_callback(
void
hal_com_txbf_status_work_item_callback(
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- struct _ADAPTER *adapter
-#else
void *p_dm_void
-#endif
);
bool
diff --git a/hal/phydm/txbf/haltxbfinterface.c b/hal/phydm/txbf/haltxbfinterface.c
deleted file mode 100644
index d09d498..0000000
--- a/hal/phydm/txbf/haltxbfinterface.c
+++ /dev/null
@@ -1,1502 +0,0 @@
-/* ************************************************************
- * Description:
- *
- * This file is for TXBF interface mechanism
- *
- * ************************************************************ */
-#include "mp_precomp.h"
-#include "../phydm_precomp.h"
-
-#if (BEAMFORMING_SUPPORT == 1)
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-void
-beamforming_gid_paid(
- struct _ADAPTER *adapter,
- PRT_TCB p_tcb
-)
-{
- u8 idx = 0;
- u8 RA[6] = {0};
- u8 *p_header = GET_FRAME_OF_FIRST_FRAG(adapter, p_tcb);
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
-
- if (adapter->HardwareType < HARDWARE_TYPE_RTL8192EE)
- return;
- else if (IS_WIRELESS_MODE_N(adapter) == false)
- return;
-
-#if (SUPPORT_MU_BF == 1)
- if (p_tcb->tx_bf_pkt_type == RT_BF_PKT_TYPE_BROADCAST_NDPA) { /* MU NDPA */
-#else
- if (0) {
-#endif
- /* Fill G_ID and P_AID */
- p_tcb->G_ID = 63;
- if (p_beam_info->first_mu_bfee_index < BEAMFORMEE_ENTRY_NUM) {
- p_tcb->P_AID = p_beam_info->beamformee_entry[p_beam_info->first_mu_bfee_index].p_aid;
- RT_DISP(FBEAM, FBEAM_FUN, ("[David]@%s End, G_ID=0x%X, P_AID=0x%X\n", __func__, p_tcb->G_ID, p_tcb->P_AID));
- }
- } else {
- GET_80211_HDR_ADDRESS1(p_header, &RA);
-
- /* VHT SU PPDU carrying one or more group addressed MPDUs or */
- /* Transmitting a VHT NDP intended for multiple recipients */
- if (MacAddr_isBcst(RA) || MacAddr_isMulticast(RA) || p_tcb->macId == MAC_ID_STATIC_FOR_BROADCAST_MULTICAST) {
- p_tcb->G_ID = 63;
- p_tcb->P_AID = 0;
- } else if (ACTING_AS_AP(adapter)) {
- u16 AID = (u16)(MacIdGetOwnerAssociatedClientAID(adapter, p_tcb->macId) & 0x1ff); /*AID[0:8]*/
-
- /*RT_DISP(FBEAM, FBEAM_FUN, ("@%s p_tcb->mac_id=0x%X, AID=0x%X\n", __func__, p_tcb->mac_id, AID));*/
- p_tcb->G_ID = 63;
-
- if (AID == 0) /*A PPDU sent by an AP to a non associated STA*/
- p_tcb->P_AID = 0;
- else { /*Sent by an AP and addressed to a STA associated with that AP*/
- u16 BSSID = 0;
- GET_80211_HDR_ADDRESS2(p_header, &RA);
- BSSID = ((RA[5] & 0xf0) >> 4) ^ (RA[5] & 0xf); /*BSSID[44:47] xor BSSID[40:43]*/
- p_tcb->P_AID = (AID + BSSID * 32) & 0x1ff; /*(dec(A) + dec(B)*32) mod 512*/
- }
- } else if (ACTING_AS_IBSS(adapter)) {
- p_tcb->G_ID = 63;
- /*P_AID for infrasturcture mode; MACID for ad-hoc mode. */
- p_tcb->P_AID = p_tcb->macId;
- } else if (MgntLinkStatusQuery(adapter)) { /*Addressed to AP*/
- p_tcb->G_ID = 0;
- GET_80211_HDR_ADDRESS1(p_header, &RA);
- p_tcb->P_AID = RA[5]; /*RA[39:47]*/
- p_tcb->P_AID = (p_tcb->P_AID << 1) | (RA[4] >> 7);
- } else {
- p_tcb->G_ID = 63;
- p_tcb->P_AID = 0;
- }
- /*RT_DISP(FBEAM, FBEAM_FUN, ("[David]@%s End, G_ID=0x%X, P_AID=0x%X\n", __func__, p_tcb->G_ID, p_tcb->P_AID));*/
- }
-}
-
-
-enum rt_status
-beamforming_get_report_frame(
- struct _ADAPTER *adapter,
- PRT_RFD p_rfd,
- POCTET_STRING p_pdu_os
-)
-{
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry = NULL;
- u8 *p_mimo_ctrl_field, p_csi_report, p_csi_matrix;
- u8 idx, nc, nr, CH_W;
- u16 csi_matrix_len = 0;
-
- ACT_PKT_TYPE pkt_type = ACT_PKT_TYPE_UNKNOWN;
-
- /* Memory comparison to see if CSI report is the same with previous one */
- p_beamform_entry = phydm_beamforming_get_bfee_entry_by_addr(p_dm_odm, Frame_Addr2(*p_pdu_os), &idx);
-
- if (p_beamform_entry == NULL) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("beamforming_get_report_frame: Cannot find entry by addr\n"));
- return RT_STATUS_FAILURE;
- }
-
- pkt_type = PacketGetActionFrameType(p_pdu_os);
-
- /* -@ Modified by David */
- if (pkt_type == ACT_PKT_VHT_COMPRESSED_BEAMFORMING) {
- p_mimo_ctrl_field = p_pdu_os->Octet + 26;
- nc = ((*p_mimo_ctrl_field) & 0x7) + 1;
- nr = (((*p_mimo_ctrl_field) & 0x38) >> 3) + 1;
- CH_W = (((*p_mimo_ctrl_field) & 0xC0) >> 6);
- /*p_csi_matrix = p_mimo_ctrl_field + 3 + nc;*/ /* 24+(1+1+3)+2 MAC header+(Category+ActionCode+MIMOControlField) +SNR(nc=2) */
- csi_matrix_len = p_pdu_os->Length - 26 - 3 - nc;
- } else if (pkt_type == ACT_PKT_HT_COMPRESSED_BEAMFORMING) {
- p_mimo_ctrl_field = p_pdu_os->Octet + 26;
- nc = ((*p_mimo_ctrl_field) & 0x3) + 1;
- nr = (((*p_mimo_ctrl_field) & 0xC) >> 2) + 1;
- CH_W = (((*p_mimo_ctrl_field) & 0x10) >> 4);
- /*p_csi_matrix = p_mimo_ctrl_field + 6 + nr;*/ /* 24+(1+1+6)+2 MAC header+(Category+ActionCode+MIMOControlField) +SNR(nc=2) */
- csi_matrix_len = p_pdu_os->Length - 26 - 6 - nr;
- } else
- return RT_STATUS_SUCCESS;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] idx=%d, pkt type=%d, nc=%d, nr=%d, CH_W=%d\n", __func__, idx, pkt_type, nc, nr, CH_W));
-
- return RT_STATUS_SUCCESS;
-}
-
-
-void
-construct_ht_ndpa_packet(
- struct _ADAPTER *adapter,
- u8 *RA,
- u8 *buffer,
- u32 *p_length,
- CHANNEL_WIDTH BW
-)
-{
- u16 duration = 0;
- PMGNT_INFO p_mgnt_info = &(adapter->MgntInfo);
- OCTET_STRING p_ndpa_frame, action_content;
- u8 action_hdr[4] = {ACT_CAT_VENDOR, 0x00, 0xe0, 0x4c};
-
- PlatformZeroMemory(buffer, 32);
-
- SET_80211_HDR_FRAME_CONTROL(buffer, 0);
-
- SET_80211_HDR_ORDER(buffer, 1);
- SET_80211_HDR_TYPE_AND_SUBTYPE(buffer, Type_Action_No_Ack);
-
- SET_80211_HDR_ADDRESS1(buffer, RA);
- SET_80211_HDR_ADDRESS2(buffer, adapter->CurrentAddress);
- SET_80211_HDR_ADDRESS3(buffer, p_mgnt_info->Bssid);
-
- duration = 2 * a_SifsTime + 40;
-
- if (BW == CHANNEL_WIDTH_40)
- duration += 87;
- else
- duration += 180;
-
- SET_80211_HDR_DURATION(buffer, duration);
-
- /* HT control field */
- SET_HT_CTRL_CSI_STEERING(buffer + sMacHdrLng, 3);
- SET_HT_CTRL_NDP_ANNOUNCEMENT(buffer + sMacHdrLng, 1);
-
- FillOctetString(p_ndpa_frame, buffer, sMacHdrLng + sHTCLng);
-
- FillOctetString(action_content, action_hdr, 4);
- PacketAppendData(&p_ndpa_frame, action_content);
-
- *p_length = 32;
-}
-
-
-
-
-bool
-send_fw_ht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- CHANNEL_WIDTH BW
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PRT_TCB p_tcb;
- PRT_TX_LOCAL_BUFFER p_buf;
- bool ret = true;
- u32 buf_len;
- u8 *buf_addr;
- u8 desc_len = 0, idx = 0, ndp_tx_rate;
- struct _ADAPTER *p_def_adapter = GetDefaultAdapter(adapter);
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry = phydm_beamforming_get_bfee_entry_by_addr(p_dm_odm, RA, &idx);
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start!\n", __func__));
-
- if (p_beamform_entry == NULL)
- return false;
-
- ndp_tx_rate = beamforming_get_htndp_tx_rate(p_dm_odm, p_beamform_entry->comp_steering_num_of_bfer);
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] ndp_tx_rate =%d\n", __func__, ndp_tx_rate));
- PlatformAcquireSpinLock(adapter, RT_TX_SPINLOCK);
-
- if (MgntGetFWBuffer(p_def_adapter, &p_tcb, &p_buf)) {
-#if (DEV_BUS_TYPE != RT_PCI_INTERFACE)
- desc_len = adapter->HWDescHeadLength - p_hal_data->USBALLDummyLength;
-#endif
- buf_addr = p_buf->Buffer.VirtualAddress + desc_len;
-
- construct_ht_ndpa_packet(
- adapter,
- RA,
- buf_addr,
- &buf_len,
- BW
- );
-
- p_tcb->PacketLength = buf_len + desc_len;
-
- p_tcb->bTxEnableSwCalcDur = true;
-
- p_tcb->BWOfPacket = BW;
-
- if (ACTING_AS_IBSS(adapter) || ACTING_AS_AP(adapter))
- p_tcb->G_ID = 63;
-
- p_tcb->P_AID = p_beamform_entry->p_aid;
- p_tcb->DataRate = ndp_tx_rate; /*rate of NDP decide by nr*/
-
- adapter->HalFunc.CmdSendPacketHandler(adapter, p_tcb, p_buf, p_tcb->PacketLength, DESC_PACKET_TYPE_NORMAL, false);
- } else
- ret = false;
-
- PlatformReleaseSpinLock(adapter, RT_TX_SPINLOCK);
-
- if (ret)
- RT_DISP_DATA(FBEAM, FBEAM_DATA, "", p_buf->Buffer.VirtualAddress, p_tcb->PacketLength);
-
- return ret;
-}
-
-
-bool
-send_sw_ht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- CHANNEL_WIDTH BW
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PRT_TCB p_tcb;
- PRT_TX_LOCAL_BUFFER p_buf;
- bool ret = true;
- u8 idx = 0, ndp_tx_rate = 0;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry = phydm_beamforming_get_bfee_entry_by_addr(p_dm_odm, RA, &idx);
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start!\n", __func__));
-
- ndp_tx_rate = beamforming_get_htndp_tx_rate(p_dm_odm, p_beamform_entry->comp_steering_num_of_bfer);
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] ndp_tx_rate =%d\n", __func__, ndp_tx_rate));
-
- PlatformAcquireSpinLock(adapter, RT_TX_SPINLOCK);
-
- if (MgntGetBuffer(adapter, &p_tcb, &p_buf)) {
- construct_ht_ndpa_packet(
- adapter,
- RA,
- p_buf->Buffer.VirtualAddress,
- &p_tcb->PacketLength,
- BW
- );
-
- p_tcb->bTxEnableSwCalcDur = true;
-
- p_tcb->BWOfPacket = BW;
-
- MgntSendPacket(adapter, p_tcb, p_buf, p_tcb->PacketLength, NORMAL_QUEUE, ndp_tx_rate);
- } else
- ret = false;
-
- PlatformReleaseSpinLock(adapter, RT_TX_SPINLOCK);
-
- if (ret)
- RT_DISP_DATA(FBEAM, FBEAM_DATA, "", p_buf->Buffer.VirtualAddress, p_tcb->PacketLength);
-
- return ret;
-}
-
-
-
-void
-construct_vht_ndpa_packet(
- struct PHY_DM_STRUCT *p_dm_odm,
- u8 *RA,
- u16 AID,
- u8 *buffer,
- u32 *p_length,
- CHANNEL_WIDTH BW
-)
-{
- u16 duration = 0;
- u8 sequence = 0;
- u8 *p_ndpa_frame = buffer;
- struct _RT_NDPA_STA_INFO sta_info;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- u8 idx = 0;
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry = phydm_beamforming_get_bfee_entry_by_addr(p_dm_odm, RA, &idx);
- /* Frame control. */
- SET_80211_HDR_FRAME_CONTROL(p_ndpa_frame, 0);
- SET_80211_HDR_TYPE_AND_SUBTYPE(p_ndpa_frame, Type_NDPA);
-
- SET_80211_HDR_ADDRESS1(p_ndpa_frame, RA);
- SET_80211_HDR_ADDRESS2(p_ndpa_frame, p_beamform_entry->my_mac_addr);
-
- duration = 2 * a_SifsTime + 44;
-
- if (BW == CHANNEL_WIDTH_80)
- duration += 40;
- else if (BW == CHANNEL_WIDTH_40)
- duration += 87;
- else
- duration += 180;
-
- SET_80211_HDR_DURATION(p_ndpa_frame, duration);
-
- sequence = *(p_dm_odm->p_sounding_seq) << 2;
- odm_move_memory(p_dm_odm, p_ndpa_frame + 16, &sequence, 1);
-
- if (phydm_acting_determine(p_dm_odm, phydm_acting_as_ibss) || phydm_acting_determine(p_dm_odm, phydm_acting_as_ap) == false)
- AID = 0;
-
- sta_info.aid = AID;
- sta_info.feedback_type = 0;
- sta_info.nc_index = 0;
-
- odm_move_memory(p_dm_odm, p_ndpa_frame + 17, (u8 *)&sta_info, 2);
-
- *p_length = 19;
-}
-
-
-bool
-send_fw_vht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- u16 AID,
- CHANNEL_WIDTH BW
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PRT_TCB p_tcb;
- PRT_TX_LOCAL_BUFFER p_buf;
- bool ret = true;
- u32 buf_len;
- u8 *buf_addr;
- u8 desc_len = 0, idx = 0, ndp_tx_rate = 0;
- struct _ADAPTER *p_def_adapter = GetDefaultAdapter(adapter);
- struct _RT_BEAMFORMING_INFO *p_beam_info = &p_dm_odm->beamforming_info;
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry = phydm_beamforming_get_bfee_entry_by_addr(p_dm_odm, RA, &idx);
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start!\n", __func__));
-
- if (p_beamform_entry == NULL)
- return false;
-
- ndp_tx_rate = beamforming_get_vht_ndp_tx_rate(p_dm_odm, p_beamform_entry->comp_steering_num_of_bfer);
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] ndp_tx_rate =%d\n", __func__, ndp_tx_rate));
-
- PlatformAcquireSpinLock(adapter, RT_TX_SPINLOCK);
-
- if (MgntGetFWBuffer(p_def_adapter, &p_tcb, &p_buf)) {
-#if (DEV_BUS_TYPE != RT_PCI_INTERFACE)
- desc_len = adapter->HWDescHeadLength - p_hal_data->USBALLDummyLength;
-#endif
- buf_addr = p_buf->Buffer.VirtualAddress + desc_len;
-
- construct_vht_ndpa_packet(
- p_dm_odm,
- RA,
- AID,
- buf_addr,
- &buf_len,
- BW
- );
-
- p_tcb->PacketLength = buf_len + desc_len;
-
- p_tcb->bTxEnableSwCalcDur = true;
-
- p_tcb->BWOfPacket = BW;
-
- if (phydm_acting_determine(p_dm_odm, phydm_acting_as_ibss) || phydm_acting_determine(p_dm_odm, phydm_acting_as_ap))
- p_tcb->G_ID = 63;
-
- p_tcb->P_AID = p_beamform_entry->p_aid;
- p_tcb->DataRate = ndp_tx_rate; /*decide by nr*/
-
- adapter->HalFunc.CmdSendPacketHandler(adapter, p_tcb, p_buf, p_tcb->PacketLength, DESC_PACKET_TYPE_NORMAL, false);
- } else
- ret = false;
-
- PlatformReleaseSpinLock(adapter, RT_TX_SPINLOCK);
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] End, ret=%d\n", __func__, ret));
-
- if (ret)
- RT_DISP_DATA(FBEAM, FBEAM_DATA, "", p_buf->Buffer.VirtualAddress, p_tcb->PacketLength);
-
- return ret;
-}
-
-
-
-bool
-send_sw_vht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- u16 AID,
- CHANNEL_WIDTH BW
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- PRT_TCB p_tcb;
- PRT_TX_LOCAL_BUFFER p_buf;
- bool ret = true;
- u8 idx = 0, ndp_tx_rate = 0;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry = phydm_beamforming_get_bfee_entry_by_addr(p_dm_odm, RA, &idx);
-
- ndp_tx_rate = beamforming_get_vht_ndp_tx_rate(p_dm_odm, p_beamform_entry->comp_steering_num_of_bfer);
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] ndp_tx_rate =%d\n", __func__, ndp_tx_rate));
-
- PlatformAcquireSpinLock(adapter, RT_TX_SPINLOCK);
-
- if (MgntGetBuffer(adapter, &p_tcb, &p_buf)) {
- construct_vht_ndpa_packet(
- p_dm_odm,
- RA,
- AID,
- p_buf->Buffer.VirtualAddress,
- &p_tcb->PacketLength,
- BW
- );
-
- p_tcb->bTxEnableSwCalcDur = true;
- p_tcb->BWOfPacket = BW;
-
- /*rate of NDP decide by nr*/
- MgntSendPacket(adapter, p_tcb, p_buf, p_tcb->PacketLength, NORMAL_QUEUE, ndp_tx_rate);
- } else
- ret = false;
-
- PlatformReleaseSpinLock(adapter, RT_TX_SPINLOCK);
-
- if (ret)
- RT_DISP_DATA(FBEAM, FBEAM_DATA, "", p_buf->Buffer.VirtualAddress, p_tcb->PacketLength);
-
- return ret;
-}
-
-#ifdef SUPPORT_MU_BF
-#if (SUPPORT_MU_BF == 1)
-/*
- * Description: On VHT GID management frame by an MU beamformee.
- *
- * 2015.05.20. Created by tynli.
- */
-enum rt_status
-beamforming_get_vht_gid_mgnt_frame(
- struct _ADAPTER *adapter,
- PRT_RFD p_rfd,
- POCTET_STRING p_pdu_os
-)
-{
- HAL_DATA_TYPE *p_hal_data = GET_HAL_DATA(adapter);
- struct PHY_DM_STRUCT *p_dm_odm = &p_hal_data->DM_OutSrc;
- enum rt_status rt_status = RT_STATUS_SUCCESS;
- u8 *p_buffer = NULL;
- u8 *p_raddr = NULL;
- u8 mem_status[8] = {0}, user_pos[16] = {0};
- u8 idx;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _RT_BEAMFORMER_ENTRY *p_beamform_entry = &p_beam_info->beamformer_entry[p_beam_info->mu_ap_index];
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] On VHT GID mgnt frame!\n", __func__));
-
- /* Check length*/
- if (p_pdu_os->length < (FRAME_OFFSET_VHT_GID_MGNT_USER_POSITION_ARRAY + 16)) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("beamforming_get_vht_gid_mgnt_frame(): Invalid length (%d)\n", p_pdu_os->length));
- return RT_STATUS_INVALID_LENGTH;
- }
-
- /* Check RA*/
- p_raddr = (u8 *)(p_pdu_os->Octet) + 4;
- if (!eq_mac_addr(p_raddr, adapter->CurrentAddress)) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("beamforming_get_vht_gid_mgnt_frame(): Drop because of RA error.\n"));
- return RT_STATUS_PKT_DROP;
- }
-
- RT_DISP_DATA(FBEAM, FBEAM_DATA, "On VHT GID Mgnt Frame ==>:\n", p_pdu_os->Octet, p_pdu_os->length);
-
- /*Parsing Membership status array*/
- p_buffer = p_pdu_os->Octet + FRAME_OFFSET_VHT_GID_MGNT_MEMBERSHIP_STATUS_ARRAY;
- for (idx = 0; idx < 8; idx++) {
- mem_status[idx] = GET_VHT_GID_MGNT_INFO_MEMBERSHIP_STATUS(p_buffer + idx);
- p_beamform_entry->gid_valid[idx] = GET_VHT_GID_MGNT_INFO_MEMBERSHIP_STATUS(p_buffer + idx);
- }
-
- RT_DISP_DATA(FBEAM, FBEAM_DATA, "mem_status: ", mem_status, 8);
-
- /* Parsing User Position array*/
- p_buffer = p_pdu_os->Octet + FRAME_OFFSET_VHT_GID_MGNT_USER_POSITION_ARRAY;
- for (idx = 0; idx < 16; idx++) {
- user_pos[idx] = GET_VHT_GID_MGNT_INFO_USER_POSITION(p_buffer + idx);
- p_beamform_entry->user_position[idx] = GET_VHT_GID_MGNT_INFO_USER_POSITION(p_buffer + idx);
- }
-
- RT_DISP_DATA(FBEAM, FBEAM_DATA, "user_pos: ", user_pos, 16);
-
- /* Group ID detail printed*/
- {
- u8 i, j;
- u8 tmp_val;
- u16 tmp_val2;
-
- for (i = 0; i < 8; i++) {
- tmp_val = mem_status[i];
- tmp_val2 = ((user_pos[i * 2 + 1] << 8) & 0xFF00) + (user_pos[i * 2] & 0xFF);
- for (j = 0; j < 8; j++) {
- if ((tmp_val >> j) & BIT(0)) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("Use Group ID (%d), User Position (%d)\n",
- (i * 8 + j), (tmp_val2 >> 2 * j) & 0x3));
- }
- }
- }
- }
-
- /* Indicate GID frame to IHV service. */
- {
- u8 indibuffer[24] = {0};
- u8 indioffset = 0;
-
- PlatformMoveMemory(indibuffer + indioffset, p_beamform_entry->gid_valid, 8);
- indioffset += 8;
- PlatformMoveMemory(indibuffer + indioffset, p_beamform_entry->user_position, 16);
- indioffset += 16;
-
- PlatformIndicateCustomStatus(
- adapter,
- RT_CUSTOM_EVENT_VHT_RECV_GID_MGNT_FRAME,
- RT_CUSTOM_INDI_TARGET_IHV,
- indibuffer,
- indioffset);
- }
-
- /* Config HW GID table */
- hal_com_txbf_config_gtab(p_dm_odm);
-
- return rt_status;
-}
-
-/*
- * Description: Construct VHT Group ID (GID) management frame.
- *
- * 2015.05.20. Created by tynli.
- */
-void
-construct_vht_gid_mgnt_frame(
- struct PHY_DM_STRUCT *p_dm_odm,
- u8 *RA,
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry,
- u8 *buffer,
- u32 *p_length
-
-)
-{
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _ADAPTER *adapter = p_beam_info->source_adapter;
- OCTET_STRING os_ftm_frame, tmp;
-
- FillOctetString(os_ftm_frame, buffer, 0);
- *p_length = 0;
-
- ConstructMaFrameHdr(
- adapter,
- RA,
- ACT_CAT_VHT,
- ACT_VHT_GROUPID_MANAGEMENT,
- &os_ftm_frame);
-
- /* Membership status array*/
- FillOctetString(tmp, p_beamform_entry->gid_valid, 8);
- PacketAppendData(&os_ftm_frame, tmp);
-
- /* User Position array*/
- FillOctetString(tmp, p_beamform_entry->user_position, 16);
- PacketAppendData(&os_ftm_frame, tmp);
-
- *p_length = os_ftm_frame.length;
-
- RT_DISP_DATA(FBEAM, FBEAM_DATA, "construct_vht_gid_mgnt_frame():\n", buffer, *p_length);
-}
-
-bool
-send_sw_vht_gid_mgnt_frame(
- void *p_dm_void,
- u8 *RA,
- u8 idx
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- PRT_TCB p_tcb;
- PRT_TX_LOCAL_BUFFER p_buf;
- bool ret = true;
- u8 data_rate = 0;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry = &p_beam_info->beamformee_entry[idx];
- struct _ADAPTER *adapter = p_beam_info->source_adapter;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start!\n", __func__));
-
- PlatformAcquireSpinLock(adapter, RT_TX_SPINLOCK);
-
- if (MgntGetBuffer(adapter, &p_tcb, &p_buf)) {
- construct_vht_gid_mgnt_frame(
- p_dm_odm,
- RA,
- p_beamform_entry,
- p_buf->Buffer.VirtualAddress,
- &p_tcb->PacketLength
- );
-
- p_tcb->bw_of_packet = CHANNEL_WIDTH_20;
- data_rate = MGN_6M;
- MgntSendPacket(adapter, p_tcb, p_buf, p_tcb->PacketLength, NORMAL_QUEUE, data_rate);
- } else
- ret = false;
-
- PlatformReleaseSpinLock(adapter, RT_TX_SPINLOCK);
-
- if (ret)
- RT_DISP_DATA(FBEAM, FBEAM_DATA, "", p_buf->Buffer.VirtualAddress, p_tcb->PacketLength);
-
- return ret;
-}
-
-
-/*
- * Description: Construct VHT beamforming report poll.
- *
- * 2015.05.20. Created by tynli.
- */
-void
-construct_vht_bf_report_poll(
- struct PHY_DM_STRUCT *p_dm_odm,
- u8 *RA,
- u8 *buffer,
- u32 *p_length
-)
-{
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _ADAPTER *adapter = p_beam_info->source_adapter;
- u8 *p_bf_rpt_poll = buffer;
-
- /* Frame control*/
- SET_80211_HDR_FRAME_CONTROL(p_bf_rpt_poll, 0);
- SET_80211_HDR_TYPE_AND_SUBTYPE(p_bf_rpt_poll, Type_Beamforming_Report_Poll);
-
- /* duration*/
- SET_80211_HDR_DURATION(p_bf_rpt_poll, 100);
-
- /* RA*/
- SET_VHT_BF_REPORT_POLL_RA(p_bf_rpt_poll, RA);
-
- /* TA*/
- SET_VHT_BF_REPORT_POLL_TA(p_bf_rpt_poll, adapter->CurrentAddress);
-
- /* Feedback Segment Retransmission Bitmap*/
- SET_VHT_BF_REPORT_POLL_FEEDBACK_SEG_RETRAN_BITMAP(p_bf_rpt_poll, 0xFF);
-
- *p_length = 17;
-
- RT_DISP_DATA(FBEAM, FBEAM_DATA, "construct_vht_bf_report_poll():\n", buffer, *p_length);
-
-}
-
-bool
-send_sw_vht_bf_report_poll(
- void *p_dm_void,
- u8 *RA,
- bool is_final_poll
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- PRT_TCB p_tcb;
- PRT_TX_LOCAL_BUFFER p_buf;
- bool ret = true;
- u8 idx = 0, data_rate = 0;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry = phydm_beamforming_get_bfee_entry_by_addr(p_dm_odm, RA, &idx);
- struct _ADAPTER *adapter = p_beam_info->source_adapter;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start!\n", __func__));
-
- PlatformAcquireSpinLock(adapter, RT_TX_SPINLOCK);
-
- if (MgntGetBuffer(adapter, &p_tcb, &p_buf)) {
- construct_vht_bf_report_poll(
- p_dm_odm,
- RA,
- p_buf->Buffer.VirtualAddress,
- &p_tcb->PacketLength
- );
-
- p_tcb->bTxEnableSwCalcDur = true; /* need?*/
- p_tcb->BWOfPacket = CHANNEL_WIDTH_20;
-
- if (is_final_poll)
- p_tcb->TxBFPktType = RT_BF_PKT_TYPE_FINAL_BF_REPORT_POLL;
- else
- p_tcb->TxBFPktType = RT_BF_PKT_TYPE_BF_REPORT_POLL;
-
- data_rate = MGN_6M; /* Legacy OFDM rate*/
- MgntSendPacket(adapter, p_tcb, p_buf, p_tcb->PacketLength, NORMAL_QUEUE, data_rate);
- } else
- ret = false;
-
- PlatformReleaseSpinLock(adapter, RT_TX_SPINLOCK);
-
- if (ret)
- RT_DISP_DATA(FBEAM, FBEAM_DATA, "send_sw_vht_bf_report_poll():\n", p_buf->Buffer.VirtualAddress, p_tcb->PacketLength);
-
- return ret;
-
-}
-
-
-/*
- * Description: Construct VHT MU NDPA packet.
- * We should combine this function with construct_vht_ndpa_packet() in the future.
- *
- * 2015.05.21. Created by tynli.
- */
-void
-construct_vht_mu_ndpa_packet(
- struct PHY_DM_STRUCT *p_dm_odm,
- CHANNEL_WIDTH BW,
- u8 *buffer,
- u32 *p_length
-)
-{
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _ADAPTER *adapter = p_beam_info->source_adapter;
- u16 duration = 0;
- u8 sequence = 0;
- u8 *p_ndpa_frame = buffer;
- struct _RT_NDPA_STA_INFO sta_info;
- u8 idx;
- u8 dest_addr[6] = {0};
- struct _RT_BEAMFORMEE_ENTRY *p_entry = NULL;
-
- /* Fill the first MU BFee entry (STA1) MAC addr to destination address then
- HW will change A1 to broadcast addr. 2015.05.28. Suggested by SD1 Chunchu. */
- for (idx = 0; idx < BEAMFORMEE_ENTRY_NUM; idx++) {
- p_entry = &(p_beam_info->beamformee_entry[idx]);
- if (p_entry->is_mu_sta) {
- cp_mac_addr(dest_addr, p_entry->mac_addr);
- break;
- }
- }
- if (p_entry == NULL)
- return;
-
- /* Frame control.*/
- SET_80211_HDR_FRAME_CONTROL(p_ndpa_frame, 0);
- SET_80211_HDR_TYPE_AND_SUBTYPE(p_ndpa_frame, Type_NDPA);
-
- SET_80211_HDR_ADDRESS1(p_ndpa_frame, dest_addr);
- SET_80211_HDR_ADDRESS2(p_ndpa_frame, p_entry->my_mac_addr);
-
- /*--------------------------------------------*/
- /* Need to modify "duration" to MU consideration. */
- duration = 2 * a_SifsTime + 44;
-
- if (BW == CHANNEL_WIDTH_80)
- duration += 40;
- else if (BW == CHANNEL_WIDTH_40)
- duration += 87;
- else
- duration += 180;
- /*--------------------------------------------*/
-
- SET_80211_HDR_DURATION(p_ndpa_frame, duration);
-
- sequence = *(p_dm_odm->p_sounding_seq) << 2;
- odm_move_memory(p_dm_odm, p_ndpa_frame + 16, &sequence, 1);
-
- *p_length = 17;
-
- /* Construct STA info. for multiple STAs*/
- for (idx = 0; idx < BEAMFORMEE_ENTRY_NUM; idx++) {
- p_entry = &(p_beam_info->beamformee_entry[idx]);
- if (p_entry->is_mu_sta) {
- sta_info.aid = p_entry->AID;
- sta_info.feedback_type = 1; /* 1'b1: MU*/
- sta_info.nc_index = 0;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Get beamformee_entry idx(%d), AID =%d\n", __func__, idx, p_entry->AID));
-
- odm_move_memory(p_dm_odm, p_ndpa_frame + (*p_length), (u8 *)&sta_info, 2);
- *p_length += 2;
- }
- }
-
-}
-
-bool
-send_sw_vht_mu_ndpa_packet(
- void *p_dm_void,
- CHANNEL_WIDTH BW
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- PRT_TCB p_tcb;
- PRT_TX_LOCAL_BUFFER p_buf;
- bool ret = true;
- u8 ndp_tx_rate = 0;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _ADAPTER *adapter = p_beam_info->source_adapter;
-
- ndp_tx_rate = MGN_VHT2SS_MCS0;
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] ndp_tx_rate =%d\n", __func__, ndp_tx_rate));
-
- PlatformAcquireSpinLock(adapter, RT_TX_SPINLOCK);
-
- if (MgntGetBuffer(adapter, &p_tcb, &p_buf)) {
- construct_vht_mu_ndpa_packet(
- p_dm_odm,
- BW,
- p_buf->Buffer.VirtualAddress,
- &p_tcb->PacketLength
- );
-
- p_tcb->bTxEnableSwCalcDur = true;
- p_tcb->BWOfPacket = BW;
- p_tcb->TxBFPktType = RT_BF_PKT_TYPE_BROADCAST_NDPA;
-
- /*rate of NDP decide by nr*/
- MgntSendPacket(adapter, p_tcb, p_buf, p_tcb->PacketLength, NORMAL_QUEUE, ndp_tx_rate);
- } else
- ret = false;
-
- PlatformReleaseSpinLock(adapter, RT_TX_SPINLOCK);
-
- if (ret)
- RT_DISP_DATA(FBEAM, FBEAM_DATA, "", p_buf->Buffer.VirtualAddress, p_tcb->PacketLength);
-
- return ret;
-}
-
-
-void
-dbg_construct_vht_mundpa_packet(
- struct PHY_DM_STRUCT *p_dm_odm,
- CHANNEL_WIDTH BW,
- u8 *buffer,
- u32 *p_length
-)
-{
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _ADAPTER *adapter = p_beam_info->source_adapter;
- u16 duration = 0;
- u8 sequence = 0;
- u8 *p_ndpa_frame = buffer;
- struct _RT_NDPA_STA_INFO sta_info;
- u8 idx;
- u8 dest_addr[6] = {0};
- struct _RT_BEAMFORMEE_ENTRY *p_entry = NULL;
-
- bool is_STA1 = false;
-
-
- /* Fill the first MU BFee entry (STA1) MAC addr to destination address then
- HW will change A1 to broadcast addr. 2015.05.28. Suggested by SD1 Chunchu. */
- for (idx = 0; idx < BEAMFORMEE_ENTRY_NUM; idx++) {
- p_entry = &(p_beam_info->beamformee_entry[idx]);
- if (p_entry->is_mu_sta) {
- if (is_STA1 == false) {
- is_STA1 = true;
- continue;
- } else {
- cp_mac_addr(dest_addr, p_entry->mac_addr);
- break;
- }
- }
- }
-
- /* Frame control.*/
- SET_80211_HDR_FRAME_CONTROL(p_ndpa_frame, 0);
- SET_80211_HDR_TYPE_AND_SUBTYPE(p_ndpa_frame, Type_NDPA);
-
- SET_80211_HDR_ADDRESS1(p_ndpa_frame, dest_addr);
- SET_80211_HDR_ADDRESS2(p_ndpa_frame, p_dm_odm->CurrentAddress);
-
- /*--------------------------------------------*/
- /* Need to modify "duration" to MU consideration. */
- duration = 2 * a_SifsTime + 44;
-
- if (BW == CHANNEL_WIDTH_80)
- duration += 40;
- else if (BW == CHANNEL_WIDTH_40)
- duration += 87;
- else
- duration += 180;
- /*--------------------------------------------*/
-
- SET_80211_HDR_DURATION(p_ndpa_frame, duration);
-
- sequence = *(p_dm_odm->p_sounding_seq) << 2;
- odm_move_memory(p_dm_odm, p_ndpa_frame + 16, &sequence, 1);
-
- *p_length = 17;
-
- /*STA2's STA Info*/
- sta_info.aid = p_entry->aid;
- sta_info.feedback_type = 1; /* 1'b1: MU */
- sta_info.nc_index = 0;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Get beamformee_entry idx(%d), AID =%d\n", __func__, idx, p_entry->aid));
-
- odm_move_memory(p_dm_odm, p_ndpa_frame + (*p_length), (u8 *)&sta_info, 2);
- *p_length += 2;
-
-}
-
-bool
-dbg_send_sw_vht_mundpa_packet(
- void *p_dm_void,
- CHANNEL_WIDTH BW
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- PRT_TCB p_tcb;
- PRT_TX_LOCAL_BUFFER p_buf;
- bool ret = true;
- u8 ndp_tx_rate = 0;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _ADAPTER *adapter = p_beam_info->source_adapter;
-
- ndp_tx_rate = MGN_VHT2SS_MCS0;
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] ndp_tx_rate =%d\n", __func__, ndp_tx_rate));
-
- PlatformAcquireSpinLock(adapter, RT_TX_SPINLOCK);
-
- if (MgntGetBuffer(adapter, &p_tcb, &p_buf)) {
- dbg_construct_vht_mundpa_packet(
- p_dm_odm,
- BW,
- p_buf->Buffer.VirtualAddress,
- &p_tcb->PacketLength
- );
-
- p_tcb->bTxEnableSwCalcDur = true;
- p_tcb->BWOfPacket = BW;
- p_tcb->TxBFPktType = RT_BF_PKT_TYPE_UNICAST_NDPA;
-
- /*rate of NDP decide by nr*/
- MgntSendPacket(adapter, p_tcb, p_buf, p_tcb->PacketLength, NORMAL_QUEUE, ndp_tx_rate);
- } else
- ret = false;
-
- PlatformReleaseSpinLock(adapter, RT_TX_SPINLOCK);
-
- if (ret)
- RT_DISP_DATA(FBEAM, FBEAM_DATA, "", p_buf->Buffer.VirtualAddress, p_tcb->PacketLength);
-
- return ret;
-}
-
-
-#endif /*#if (SUPPORT_MU_BF == 1)*/
-#endif /*#ifdef SUPPORT_MU_BF*/
-
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
-
-u32
-beamforming_get_report_frame(
- void *p_dm_void,
- union recv_frame *precv_frame
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- u32 ret = _SUCCESS;
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry = NULL;
- u8 *pframe = precv_frame->u.hdr.rx_data;
- u32 frame_len = precv_frame->u.hdr.len;
- u8 *TA;
- u8 idx, offset;
-
-
- /*Memory comparison to see if CSI report is the same with previous one*/
- TA = get_addr2_ptr(pframe);
- p_beamform_entry = phydm_beamforming_get_bfee_entry_by_addr(p_dm_odm, TA, &idx);
- if (p_beamform_entry->beamform_entry_cap & BEAMFORMER_CAP_VHT_SU)
- offset = 31; /*24+(1+1+3)+2 MAC header+(Category+ActionCode+MIMOControlField)+SNR(nc=2)*/
- else if (p_beamform_entry->beamform_entry_cap & BEAMFORMER_CAP_HT_EXPLICIT)
- offset = 34; /*24+(1+1+6)+2 MAC header+(Category+ActionCode+MIMOControlField)+SNR(nc=2)*/
- else
- return ret;
-
-
- return ret;
-}
-
-
-bool
-send_fw_ht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- CHANNEL_WIDTH BW
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct rtw_ieee80211_hdr *pwlanhdr;
- struct xmit_priv *pxmitpriv = &(adapter->xmitpriv);
- struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- u8 action_hdr[4] = {ACT_CAT_VENDOR, 0x00, 0xe0, 0x4c};
- u8 *pframe;
- u16 *fctrl;
- u16 duration = 0;
- u8 a_sifs_time = 0, ndp_tx_rate = 0, idx = 0;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry = phydm_beamforming_get_bfee_entry_by_addr(p_dm_odm, RA, &idx);
-
- pmgntframe = alloc_mgtxmitframe(pxmitpriv);
-
- if (pmgntframe == NULL) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s, alloc mgnt frame fail\n", __func__));
- return _FALSE;
- }
-
- /* update attribute */
- pattrib = &pmgntframe->attrib;
- update_mgntframe_attrib(adapter, pattrib);
-
- pattrib->qsel = QSLT_BEACON;
- ndp_tx_rate = beamforming_get_htndp_tx_rate(p_dm_odm, p_beamform_entry->comp_steering_num_of_bfer);
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] ndp_tx_rate =%d\n", __func__, ndp_tx_rate));
- pattrib->rate = ndp_tx_rate;
- pattrib->bwmode = BW;
- pattrib->order = 1;
- pattrib->subtype = WIFI_ACTION_NOACK;
-
- _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
-
- pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-
- pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
-
- fctrl = &pwlanhdr->frame_ctl;
- *(fctrl) = 0;
-
- set_order_bit(pframe);
- set_frame_sub_type(pframe, WIFI_ACTION_NOACK);
-
- _rtw_memcpy(pwlanhdr->addr1, RA, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr2, p_beamform_entry->my_mac_addr, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
-
- if (pmlmeext->cur_wireless_mode == WIRELESS_11B)
- a_sifs_time = 10;
- else
- a_sifs_time = 16;
-
- duration = 2 * a_sifs_time + 40;
-
- if (BW == CHANNEL_WIDTH_40)
- duration += 87;
- else
- duration += 180;
-
- set_duration(pframe, duration);
-
- /* HT control field */
- SET_HT_CTRL_CSI_STEERING(pframe + 24, 3);
- SET_HT_CTRL_NDP_ANNOUNCEMENT(pframe + 24, 1);
-
- _rtw_memcpy(pframe + 28, action_hdr, 4);
-
- pattrib->pktlen = 32;
-
- pattrib->last_txcmdsz = pattrib->pktlen;
-
- dump_mgntframe(adapter, pmgntframe);
-
- return _TRUE;
-}
-
-
-bool
-send_sw_ht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- CHANNEL_WIDTH BW
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct rtw_ieee80211_hdr *pwlanhdr;
- struct xmit_priv *pxmitpriv = &(adapter->xmitpriv);
- struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- u8 action_hdr[4] = {ACT_CAT_VENDOR, 0x00, 0xe0, 0x4c};
- u8 *pframe;
- u16 *fctrl;
- u16 duration = 0;
- u8 a_sifs_time = 0, ndp_tx_rate = 0, idx = 0;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry = phydm_beamforming_get_bfee_entry_by_addr(p_dm_odm, RA, &idx);
-
- ndp_tx_rate = beamforming_get_htndp_tx_rate(p_dm_odm, p_beamform_entry->comp_steering_num_of_bfer);
-
- pmgntframe = alloc_mgtxmitframe(pxmitpriv);
-
- if (pmgntframe == NULL) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s, alloc mgnt frame fail\n", __func__));
- return _FALSE;
- }
-
- /*update attribute*/
- pattrib = &pmgntframe->attrib;
- update_mgntframe_attrib(adapter, pattrib);
- pattrib->qsel = QSLT_MGNT;
- pattrib->rate = ndp_tx_rate;
- pattrib->bwmode = BW;
- pattrib->order = 1;
- pattrib->subtype = WIFI_ACTION_NOACK;
-
- _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
-
- pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-
- pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
-
- fctrl = &pwlanhdr->frame_ctl;
- *(fctrl) = 0;
-
- set_order_bit(pframe);
- set_frame_sub_type(pframe, WIFI_ACTION_NOACK);
-
- _rtw_memcpy(pwlanhdr->addr1, RA, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr2, p_beamform_entry->my_mac_addr, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
-
- if (pmlmeext->cur_wireless_mode == WIRELESS_11B)
- a_sifs_time = 10;
- else
- a_sifs_time = 16;
-
- duration = 2 * a_sifs_time + 40;
-
- if (BW == CHANNEL_WIDTH_40)
- duration += 87;
- else
- duration += 180;
-
- set_duration(pframe, duration);
-
- /*HT control field*/
- SET_HT_CTRL_CSI_STEERING(pframe + 24, 3);
- SET_HT_CTRL_NDP_ANNOUNCEMENT(pframe + 24, 1);
-
- _rtw_memcpy(pframe + 28, action_hdr, 4);
-
- pattrib->pktlen = 32;
-
- pattrib->last_txcmdsz = pattrib->pktlen;
-
- dump_mgntframe(adapter, pmgntframe);
-
- return _TRUE;
-}
-
-
-bool
-send_fw_vht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- u16 AID,
- CHANNEL_WIDTH BW
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct rtw_ieee80211_hdr *pwlanhdr;
- struct xmit_priv *pxmitpriv = &(adapter->xmitpriv);
- struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
- u8 *pframe;
- u16 *fctrl;
- u16 duration = 0;
- u8 sequence = 0, a_sifs_time = 0, ndp_tx_rate = 0, idx = 0;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry = phydm_beamforming_get_bfee_entry_by_addr(p_dm_odm, RA, &idx);
- struct _RT_NDPA_STA_INFO sta_info;
-
- pmgntframe = alloc_mgtxmitframe(pxmitpriv);
-
- if (pmgntframe == NULL) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s, alloc mgnt frame fail\n", __func__));
- return _FALSE;
- }
-
- /* update attribute */
- pattrib = &pmgntframe->attrib;
- _rtw_memcpy(pattrib->ra, RA, ETH_ALEN);
- update_mgntframe_attrib(adapter, pattrib);
-
- pattrib->qsel = QSLT_BEACON;
- ndp_tx_rate = beamforming_get_vht_ndp_tx_rate(p_dm_odm, p_beamform_entry->comp_steering_num_of_bfer);
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] ndp_tx_rate =%d\n", __func__, ndp_tx_rate));
- pattrib->rate = ndp_tx_rate;
- pattrib->bwmode = BW;
- pattrib->subtype = WIFI_NDPA;
-
- _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
-
- pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-
- pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
-
- fctrl = &pwlanhdr->frame_ctl;
- *(fctrl) = 0;
-
- set_frame_sub_type(pframe, WIFI_NDPA);
-
- _rtw_memcpy(pwlanhdr->addr1, RA, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr2, p_beamform_entry->my_mac_addr, ETH_ALEN);
-
- if (is_supported_5g(pmlmeext->cur_wireless_mode) || is_supported_ht(pmlmeext->cur_wireless_mode))
- a_sifs_time = 16;
- else
- a_sifs_time = 10;
-
- duration = 2 * a_sifs_time + 44;
-
- if (BW == CHANNEL_WIDTH_80)
- duration += 40;
- else if (BW == CHANNEL_WIDTH_40)
- duration += 87;
- else
- duration += 180;
-
- set_duration(pframe, duration);
-
- sequence = p_beam_info->sounding_sequence << 2;
- if (p_beam_info->sounding_sequence >= 0x3f)
- p_beam_info->sounding_sequence = 0;
- else
- p_beam_info->sounding_sequence++;
-
- _rtw_memcpy(pframe + 16, &sequence, 1);
-
- if (((pmlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE))
- AID = 0;
-
- sta_info.aid = AID;
- sta_info.feedback_type = 0;
- sta_info.nc_index = 0;
-
- _rtw_memcpy(pframe + 17, (u8 *)&sta_info, 2);
-
- pattrib->pktlen = 19;
-
- pattrib->last_txcmdsz = pattrib->pktlen;
-
- dump_mgntframe(adapter, pmgntframe);
-
- return _TRUE;
-}
-
-
-
-bool
-send_sw_vht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- u16 AID,
- CHANNEL_WIDTH BW
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- struct xmit_frame *pmgntframe;
- struct pkt_attrib *pattrib;
- struct rtw_ieee80211_hdr *pwlanhdr;
- struct xmit_priv *pxmitpriv = &(adapter->xmitpriv);
- struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv;
- struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
- struct mlme_priv *pmlmepriv = &(adapter->mlmepriv);
- struct _RT_NDPA_STA_INFO ndpa_sta_info;
- u8 ndp_tx_rate = 0, sequence = 0, a_sifs_time = 0, idx = 0;
- u8 *pframe;
- u16 *fctrl;
- u16 duration = 0;
- struct _RT_BEAMFORMING_INFO *p_beam_info = &(p_dm_odm->beamforming_info);
- struct _RT_BEAMFORMEE_ENTRY *p_beamform_entry = phydm_beamforming_get_bfee_entry_by_addr(p_dm_odm, RA, &idx);
-
- ndp_tx_rate = beamforming_get_vht_ndp_tx_rate(p_dm_odm, p_beamform_entry->comp_steering_num_of_bfer);
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] ndp_tx_rate =%d\n", __func__, ndp_tx_rate));
-
- pmgntframe = alloc_mgtxmitframe(pxmitpriv);
-
- if (pmgntframe == NULL) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("%s, alloc mgnt frame fail\n", __func__));
- return _FALSE;
- }
-
- /*update attribute*/
- pattrib = &pmgntframe->attrib;
- _rtw_memcpy(pattrib->ra, RA, ETH_ALEN);
- update_mgntframe_attrib(adapter, pattrib);
- pattrib->qsel = QSLT_MGNT;
- pattrib->rate = ndp_tx_rate;
- pattrib->bwmode = BW;
- pattrib->subtype = WIFI_NDPA;
-
- _rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
-
- pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
-
- pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
-
- fctrl = &pwlanhdr->frame_ctl;
- *(fctrl) = 0;
-
- set_frame_sub_type(pframe, WIFI_NDPA);
-
- _rtw_memcpy(pwlanhdr->addr1, RA, ETH_ALEN);
- _rtw_memcpy(pwlanhdr->addr2, p_beamform_entry->my_mac_addr, ETH_ALEN);
-
- if (is_supported_5g(pmlmeext->cur_wireless_mode) || is_supported_ht(pmlmeext->cur_wireless_mode))
- a_sifs_time = 16;
- else
- a_sifs_time = 10;
-
- duration = 2 * a_sifs_time + 44;
-
- if (BW == CHANNEL_WIDTH_80)
- duration += 40;
- else if (BW == CHANNEL_WIDTH_40)
- duration += 87;
- else
- duration += 180;
-
- set_duration(pframe, duration);
-
- sequence = p_beam_info->sounding_sequence << 2;
- if (p_beam_info->sounding_sequence >= 0x3f)
- p_beam_info->sounding_sequence = 0;
- else
- p_beam_info->sounding_sequence++;
-
- _rtw_memcpy(pframe + 16, &sequence, 1);
- if (((pmlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE) || ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE))
- AID = 0;
-
- ndpa_sta_info.aid = AID;
- ndpa_sta_info.feedback_type = 0;
- ndpa_sta_info.nc_index = 0;
-
- _rtw_memcpy(pframe + 17, (u8 *)&ndpa_sta_info, 2);
-
- pattrib->pktlen = 19;
-
- pattrib->last_txcmdsz = pattrib->pktlen;
-
- dump_mgntframe(adapter, pmgntframe);
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] [%d]\n", __func__, __LINE__));
-
- return _TRUE;
-}
-
-
-#endif
-
-
-void
-beamforming_get_ndpa_frame(
- void *p_dm_void,
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- OCTET_STRING pdu_os
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- union recv_frame *precv_frame
-#endif
-)
-{
- struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void;
- struct _ADAPTER *adapter = p_dm_odm->adapter;
- u8 *TA ;
- u8 idx, sequence;
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- u8 *p_ndpa_frame = pdu_os.Octet;
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- u8 *p_ndpa_frame = precv_frame->u.hdr.rx_data;
-#endif
- struct _RT_BEAMFORMER_ENTRY *p_beamformer_entry = NULL; /*Modified By Jeffery @2014-10-29*/
-
-
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- RT_DISP_DATA(FBEAM, FBEAM_DATA, "beamforming_get_ndpa_frame\n", pdu_os.Octet, pdu_os.Length);
- if (IsCtrlNDPA(p_ndpa_frame) == false)
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- if (get_frame_sub_type(p_ndpa_frame) != WIFI_NDPA)
-#endif
- return;
- else if (!(p_dm_odm->support_ic_type & (ODM_RTL8812 | ODM_RTL8821))) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] not 8812 or 8821A, return\n", __func__));
- return;
- }
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- TA = Frame_Addr2(pdu_os);
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- TA = get_addr2_ptr(p_ndpa_frame);
-#endif
- /*Remove signaling TA. */
- TA[0] = TA[0] & 0xFE;
-
- p_beamformer_entry = phydm_beamforming_get_bfer_entry_by_addr(p_dm_odm, TA, &idx); /* Modified By Jeffery @2014-10-29 */
-
- /*Break options for Clock Reset*/
- if (p_beamformer_entry == NULL)
- return;
- else if (!(p_beamformer_entry->beamform_entry_cap & BEAMFORMEE_CAP_VHT_SU))
- return;
- /*log_success: As long as 8812A receive NDPA and feedback CSI succeed once, clock reset is NO LONGER needed !2015-04-10, Jeffery*/
- /*clock_reset_times: While BFer entry always doesn't receive our CSI, clock will reset again and again.So clock_reset_times is limited to 5 times.2015-04-13, Jeffery*/
- else if ((p_beamformer_entry->log_success == 1) || (p_beamformer_entry->clock_reset_times == 5)) {
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] log_seq=%d, pre_log_seq=%d, log_retry_cnt=%d, log_success=%d, clock_reset_times=%d, clock reset is no longer needed.\n",
- __func__, p_beamformer_entry->log_seq, p_beamformer_entry->pre_log_seq, p_beamformer_entry->log_retry_cnt, p_beamformer_entry->log_success, p_beamformer_entry->clock_reset_times));
-
- return;
- }
-
- sequence = (p_ndpa_frame[16]) >> 2;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Start, sequence=%d, log_seq=%d, pre_log_seq=%d, log_retry_cnt=%d, clock_reset_times=%d, log_success=%d\n",
- __func__, sequence, p_beamformer_entry->log_seq, p_beamformer_entry->pre_log_seq, p_beamformer_entry->log_retry_cnt, p_beamformer_entry->clock_reset_times, p_beamformer_entry->log_success));
-
- if ((p_beamformer_entry->log_seq != 0) && (p_beamformer_entry->pre_log_seq != 0)) {
- /*Success condition*/
- if ((p_beamformer_entry->log_seq != sequence) && (p_beamformer_entry->pre_log_seq != p_beamformer_entry->log_seq)) {
- /* break option for clcok reset, 2015-03-30, Jeffery */
- p_beamformer_entry->log_retry_cnt = 0;
- /*As long as 8812A receive NDPA and feedback CSI succeed once, clock reset is no longer needed.*/
- /*That is, log_success is NOT needed to be reset to zero, 2015-04-13, Jeffery*/
- p_beamformer_entry->log_success = 1;
-
- } else {/*Fail condition*/
-
- if (p_beamformer_entry->log_retry_cnt == 5) {
- p_beamformer_entry->clock_reset_times++;
- p_beamformer_entry->log_retry_cnt = 0;
-
- ODM_RT_TRACE(p_dm_odm, PHYDM_COMP_TXBF, ODM_DBG_LOUD, ("[%s] Clock Reset!!! clock_reset_times=%d\n",
- __func__, p_beamformer_entry->clock_reset_times));
- hal_com_txbf_set(p_dm_odm, TXBF_SET_SOUNDING_CLK, NULL);
-
- } else
- p_beamformer_entry->log_retry_cnt++;
- }
- }
-
- /*Update log_seq & pre_log_seq*/
- p_beamformer_entry->pre_log_seq = p_beamformer_entry->log_seq;
- p_beamformer_entry->log_seq = sequence;
-
-}
-
-
-
-#endif
diff --git a/hal/phydm/txbf/haltxbfinterface.h b/hal/phydm/txbf/haltxbfinterface.h
index 915812c..4bf9502 100644
--- a/hal/phydm/txbf/haltxbfinterface.h
+++ b/hal/phydm/txbf/haltxbfinterface.h
@@ -1,158 +1,8 @@
#ifndef __HAL_TXBF_INTERFACE_H__
#define __HAL_TXBF_INTERFACE_H__
-#if (BEAMFORMING_SUPPORT == 1)
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
-
-#define a_SifsTime ((IS_WIRELESS_MODE_5G(adapter)|| IS_WIRELESS_MODE_N_24G(adapter))? 16 : 10)
-
-void
-beamforming_gid_paid(
- struct _ADAPTER *adapter,
- PRT_TCB p_tcb
-);
-
-enum rt_status
-beamforming_get_report_frame(
- struct _ADAPTER *adapter,
- PRT_RFD p_rfd,
- POCTET_STRING p_pdu_os
-);
-
-void
-beamforming_get_ndpa_frame(
- void *p_dm_void,
- OCTET_STRING pdu_os
-);
-
-bool
-send_fw_ht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- CHANNEL_WIDTH BW
-);
-
-bool
-send_fw_vht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- u16 AID,
- CHANNEL_WIDTH BW
-);
-
-bool
-send_sw_vht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- u16 AID,
- CHANNEL_WIDTH BW
-);
-
-bool
-send_sw_ht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- CHANNEL_WIDTH BW
-);
-
-#if (SUPPORT_MU_BF == 1)
-enum rt_status
-beamforming_get_vht_gid_mgnt_frame(
- struct _ADAPTER *adapter,
- PRT_RFD p_rfd,
- POCTET_STRING p_pdu_os
-);
-
-bool
-send_sw_vht_gid_mgnt_frame(
- void *p_dm_void,
- u8 *RA,
- u8 idx
-);
-
-bool
-send_sw_vht_bf_report_poll(
- void *p_dm_void,
- u8 *RA,
- bool is_final_poll
-);
-
-bool
-send_sw_vht_mu_ndpa_packet(
- void *p_dm_void,
- CHANNEL_WIDTH BW
-);
-#else
-#define beamforming_get_vht_gid_mgnt_frame(adapter, p_rfd, p_pdu_os) RT_STATUS_FAILURE
-#define send_sw_vht_gid_mgnt_frame(p_dm_void, RA)
-#define send_sw_vht_bf_report_poll(p_dm_void, RA, is_final_poll)
-#define send_sw_vht_mu_ndpa_packet(p_dm_void, BW)
-#endif
-
-
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
-
-u32
-beamforming_get_report_frame(
- void *p_dm_void,
- union recv_frame *precv_frame
-);
-
-bool
-send_fw_ht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- CHANNEL_WIDTH BW
-);
-
-bool
-send_sw_ht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- CHANNEL_WIDTH BW
-);
-
-bool
-send_fw_vht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- u16 AID,
- CHANNEL_WIDTH BW
-);
-
-bool
-send_sw_vht_ndpa_packet(
- void *p_dm_void,
- u8 *RA,
- u16 AID,
- CHANNEL_WIDTH BW
-);
-#endif
-
-void
-beamforming_get_ndpa_frame(
- void *p_dm_void,
-#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- OCTET_STRING pdu_os
-#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
- union recv_frame *precv_frame
-#endif
-);
-
-bool
-dbg_send_sw_vht_mundpa_packet(
- void *p_dm_void,
- CHANNEL_WIDTH BW
-);
-
-#else
#define beamforming_get_ndpa_frame(p_dm_odm, _pdu_os)
-#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
- #define beamforming_get_report_frame(adapter, precv_frame) RT_STATUS_FAILURE
-#elif (DM_ODM_SUPPORT_TYPE == ODM_WIN)
- #define beamforming_get_report_frame(adapter, p_rfd, p_pdu_os) RT_STATUS_FAILURE
- #define beamforming_get_vht_gid_mgnt_frame(adapter, p_rfd, p_pdu_os) RT_STATUS_FAILURE
-#endif
+#define beamforming_get_report_frame(adapter, precv_frame) RT_STATUS_FAILURE
#define send_fw_ht_ndpa_packet(p_dm_void, RA, BW)
#define send_sw_ht_ndpa_packet(p_dm_void, RA, BW)
#define send_fw_vht_ndpa_packet(p_dm_void, RA, AID, BW)
@@ -160,6 +10,5 @@ dbg_send_sw_vht_mundpa_packet(
#define send_sw_vht_gid_mgnt_frame(p_dm_void, RA, idx)
#define send_sw_vht_bf_report_poll(p_dm_void, RA, is_final_poll)
#define send_sw_vht_mu_ndpa_packet(p_dm_void, BW)
-#endif
#endif
|