26 #define _RTL871X_MP_C_
33 static void _init_mp_priv_(
struct mp_priv *pmp_priv)
48 static int init_mp_priv(
struct mp_priv *pmp_priv)
53 _init_mp_priv_(pmp_priv);
60 goto _exit_init_mp_priv;
67 _init_listhead(&(pmp_xmitframe->
list));
68 list_insert_tail(&(pmp_xmitframe->
list),
81 static int free_mp_priv(
struct mp_priv *pmp_priv)
93 init_mp_priv(pmppriv);
100 free_mp_priv(pmppriv);
113 cmd32 = (iocmd_class << 24) | (iocmd_value << 8) | iocmd_idx ;
121 static u8 fw_iocmd_write(
struct _adapter *pAdapter,
131 cmd32 = (iocmd_class << 24) | (iocmd_value << 8) | iocmd_idx ;
138 u8 shift = offset & 0x0003;
139 u16 bb_addr = offset & 0x0FFC;
144 iocmd.
value = bb_addr;
146 bb_val = fw_iocmd_read(pAdapter, iocmd);
149 bb_val >>= (shift * 8);
151 bb_val2 = fw_iocmd_read(pAdapter, iocmd);
152 bb_val2 <<= ((4 - shift) * 8);
161 u8 shift = offset & 0x0003;
162 u16 bb_addr = offset & 0x0FFC;
166 iocmd.
value = bb_addr;
173 oldValue &= (0xFFFFFFFF >> ((4 - shift) * 8));
174 value = oldValue | (newValue << (shift * 8));
175 if (fw_iocmd_write(pAdapter, iocmd, value) ==
false)
179 oldValue &= (0xFFFFFFFF << (shift * 8));
180 value = oldValue | (newValue >> ((4 - shift) * 8));
182 return fw_iocmd_write(pAdapter, iocmd, value);
188 u16 rf_addr = (path << 8) | offset;
193 iocmd.
value = rf_addr ;
195 rf_data = fw_iocmd_read(pAdapter, iocmd);
201 u16 rf_addr = (path << 8) | offset;
205 iocmd.
value = rf_addr;
207 return fw_iocmd_write(pAdapter, iocmd, value);
214 for (i = 0; i <= 31; i++)
215 if (((bitmask>>i) & 0x1) == 1)
222 u32 org_value, bit_shift, new_value;
225 bit_shift = bitshift(bitmask);
226 new_value = (org_value &
bitmask) >> bit_shift;
230 static u8 set_bb_reg(
struct _adapter *pAdapter,
235 u32 org_value, bit_shift, new_value;
239 bit_shift = bitshift(bitmask);
240 new_value = ((org_value & (~bitmask)) | (value << bit_shift));
249 u32 org_value, bit_shift, new_value;
252 bit_shift = bitshift(bitmask);
253 new_value = (org_value &
bitmask) >> bit_shift;
260 u32 org_value, bit_shift, new_value;
264 bit_shift = bitshift(bitmask);
265 new_value = ((org_value & (~bitmask)) | (value << bit_shift));
298 static void SetCCKTxPower(
struct _adapter *pAdapter,
u8 TxPower)
306 static void SetOFDMTxPower(
struct _adapter *pAdapter,
u8 TxPower)
310 TxAGC |= ((TxPower<<24)|(TxPower<<16)|(TxPower<<8)|TxPower);
321 u8 TxPower = pAdapter->
mppriv.curr_txpoweridx;
322 SetCCKTxPower(pAdapter, TxPower);
323 SetOFDMTxPower(pAdapter, TxPower);
328 u32 TxAGCOffset_B, TxAGCOffset_C, TxAGCOffset_D, tmpAGC;
330 TxAGCOffset_B = (ulTxAGCOffset&0x000000ff);
331 TxAGCOffset_C = ((ulTxAGCOffset&0x0000ff00)>>8);
332 TxAGCOffset_D = ((ulTxAGCOffset&0x00ff0000)>>16);
333 tmpAGC = (TxAGCOffset_D<<8 | TxAGCOffset_C<<4 | TxAGCOffset_B);
344 value = (pAdapter->
mppriv.curr_rateidx < 4) ? 0x4440 : 0xF200;
352 u8 Bandwidth = pAdapter->
mppriv.curr_bandwidth;
356 regBwOpMode |=
BIT(2);
358 regBwOpMode &= ~(
BIT(2));
425 u32 ofdm_tx_en_val = 0, ofdm_tx_ant_sel_val = 0;
426 u8 ofdm_rx_ant_sel_val = 0;
427 u8 cck_ant_select_val = 0;
428 u32 cck_ant_sel_val = 0;
433 switch (pAdapter->
mppriv.antenna_tx) {
438 ofdm_tx_en_val = 0x3;
439 ofdm_tx_ant_sel_val = 0x11111111;
445 ofdm_tx_en_val = 0x3;
446 ofdm_tx_ant_sel_val = 0x22222222;
452 ofdm_tx_en_val = 0x3;
453 ofdm_tx_ant_sel_val = 0x3321333;
460 set_bb_reg(pAdapter,
rFPGA1_TxInfo, 0xffffffff, ofdm_tx_ant_sel_val);
462 set_bb_reg(pAdapter,
rFPGA0_TxInfo, 0x0000000f, ofdm_tx_en_val);
463 switch (pAdapter->
mppriv.antenna_rx) {
465 ofdm_rx_ant_sel_val = 0x1;
470 ofdm_rx_ant_sel_val = 0x2;
475 ofdm_rx_ant_sel_val = 0x3;
484 ofdm_rx_ant_sel_val);
487 ofdm_rx_ant_sel_val);
489 cck_ant_sel_val = cck_ant_select_val;
497 pAdapter->
mppriv.curr_crystalcap);
500 static void TriggerRFThermalMeter(
struct _adapter *pAdapter)
506 static u32 ReadRFThermalMeter(
struct _adapter *pAdapter)
508 u32 ThermalValue = 0;
517 TriggerRFThermalMeter(pAdapter);
519 *value = ReadRFThermalMeter(pAdapter);
552 u8 rfPath = pAdapter->
mppriv.curr_rfpath;
553 switch (pAdapter->
mppriv.antenna_tx) {
623 static void SetCCKContinuousTx(
struct _adapter *pAdapter,
u8 bStart)
638 cckrate = pAdapter->
mppriv.curr_rateidx;
655 static void SetOFDMContinuousTx(
struct _adapter *pAdapter,
u8 bStart)
693 SetCCKContinuousTx(pAdapter, bStart);
696 SetOFDMContinuousTx(pAdapter, bStart);
706 u32 i, phyrx_set = 0;
710 phyrx_set |= (i << 28);
711 phyrx_set |= 0x08000000;
716 static u32 GetPhyRxPktCounts(
struct _adapter *pAdapter,
u32 selbit)
722 SelectBit = selbit << 28;
723 phyrx_set |= (SelectBit & 0xF0000000);
732 u32 OFDM_cnt = 0, CCK_cnt = 0, HT_cnt = 0;
737 return OFDM_cnt + CCK_cnt + HT_cnt;
742 u32 OFDM_cnt = 0, CCK_cnt = 0, HT_cnt = 0;
747 return OFDM_cnt + CCK_cnt + HT_cnt;