2013-05-08 21:45:39 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
2014-12-19 06:59:46 +00:00
|
|
|
*
|
2013-05-08 21:45:39 +00:00
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2014-12-11 21:15:04 +00:00
|
|
|
#include <drv_conf.h>
|
2013-05-08 21:45:39 +00:00
|
|
|
#include <osdep_service.h>
|
|
|
|
#include <drv_types.h>
|
|
|
|
|
|
|
|
#include <hal_intf.h>
|
|
|
|
#include <hal_com.h>
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
#include <rtl8188e_hal.h>
|
|
|
|
|
|
|
|
#define _HAL_INIT_C_
|
|
|
|
|
2015-03-17 14:57:29 +00:00
|
|
|
void dump_chip_info(struct hal_version ChipVersion)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
int cnt = 0;
|
|
|
|
u8 buf[128];
|
|
|
|
|
2015-08-15 18:24:16 +00:00
|
|
|
if (IS_81XXC(ChipVersion)) {
|
2014-12-11 21:15:04 +00:00
|
|
|
cnt += sprintf((buf+cnt), "Chip Version Info: %s_", IS_92C_SERIAL(ChipVersion)?"CHIP_8192C":"CHIP_8188C");
|
|
|
|
}
|
2015-08-15 18:24:16 +00:00
|
|
|
else if (IS_92D(ChipVersion)) {
|
2013-05-08 21:45:39 +00:00
|
|
|
cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8192D_");
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2015-08-15 18:24:16 +00:00
|
|
|
else if (IS_8723_SERIES(ChipVersion)) {
|
2013-05-08 21:45:39 +00:00
|
|
|
cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8723A_");
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2015-08-15 18:24:16 +00:00
|
|
|
else if (IS_8188E(ChipVersion)) {
|
2013-05-08 21:45:39 +00:00
|
|
|
cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8188E_");
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
cnt += sprintf((buf+cnt), "%s_", IS_NORMAL_CHIP(ChipVersion)?"Normal_Chip":"Test_Chip");
|
|
|
|
cnt += sprintf((buf+cnt), "%s_", IS_CHIP_VENDOR_TSMC(ChipVersion)?"TSMC":"UMC");
|
2015-08-15 18:02:34 +00:00
|
|
|
if (IS_A_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "A_CUT_");
|
|
|
|
else if (IS_B_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "B_CUT_");
|
|
|
|
else if (IS_C_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "C_CUT_");
|
|
|
|
else if (IS_D_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "D_CUT_");
|
|
|
|
else if (IS_E_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "E_CUT_");
|
|
|
|
else if (IS_I_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "I_CUT_");
|
|
|
|
else if (IS_J_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "J_CUT_");
|
|
|
|
else if (IS_K_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "K_CUT_");
|
2014-12-11 21:15:04 +00:00
|
|
|
else cnt += sprintf((buf+cnt), "UNKNOWN_CUT(%d)_", ChipVersion.CUTVersion);
|
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if (IS_1T1R(ChipVersion)) cnt += sprintf((buf+cnt), "1T1R_");
|
|
|
|
else if (IS_1T2R(ChipVersion)) cnt += sprintf((buf+cnt), "1T2R_");
|
|
|
|
else if (IS_2T2R(ChipVersion)) cnt += sprintf((buf+cnt), "2T2R_");
|
2014-12-11 21:15:04 +00:00
|
|
|
else cnt += sprintf((buf+cnt), "UNKNOWN_RFTYPE(%d)_", ChipVersion.RFType);
|
|
|
|
|
|
|
|
cnt += sprintf((buf+cnt), "RomVer(%d)\n", ChipVersion.ROMVer);
|
|
|
|
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("%s", buf);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
#define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
u8 /* return the final channel plan decision */
|
2014-12-11 21:15:04 +00:00
|
|
|
hal_com_get_channel_plan(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *padapter,
|
|
|
|
u8 hw_channel_plan, /* channel plan from HW (efuse/eeprom) */
|
|
|
|
u8 sw_channel_plan, /* channel plan from SW (registry/module param) */
|
|
|
|
u8 def_channel_plan, /* channel plan used when the former two is invalid */
|
|
|
|
bool AutoLoadFail
|
2014-12-11 21:15:04 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 swConfig;
|
|
|
|
u8 chnlPlan;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
swConfig = true;
|
2014-12-11 21:15:04 +00:00
|
|
|
if (!AutoLoadFail)
|
|
|
|
{
|
2013-05-08 21:45:39 +00:00
|
|
|
if (!rtw_is_channel_plan_valid(sw_channel_plan))
|
2014-12-29 02:13:24 +00:00
|
|
|
swConfig = false;
|
2014-12-11 21:15:04 +00:00
|
|
|
if (hw_channel_plan & EEPROM_CHANNEL_PLAN_BY_HW_MASK)
|
2014-12-29 02:13:24 +00:00
|
|
|
swConfig = false;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:13:24 +00:00
|
|
|
if (swConfig == true)
|
2014-12-11 21:15:04 +00:00
|
|
|
chnlPlan = sw_channel_plan;
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2014-12-11 21:15:04 +00:00
|
|
|
chnlPlan = hw_channel_plan & (~EEPROM_CHANNEL_PLAN_BY_HW_MASK);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (!rtw_is_channel_plan_valid(chnlPlan))
|
|
|
|
chnlPlan = def_channel_plan;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
return chnlPlan;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 MRateToHwRate(u8 rate)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 ret = DESC_RATE1M;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:05:44 +00:00
|
|
|
switch (rate)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
2015-02-20 00:51:33 +00:00
|
|
|
/* CCK and OFDM non-HT rates */
|
2014-12-11 21:15:04 +00:00
|
|
|
case IEEE80211_CCK_RATE_1MB: ret = DESC_RATE1M; break;
|
|
|
|
case IEEE80211_CCK_RATE_2MB: ret = DESC_RATE2M; break;
|
|
|
|
case IEEE80211_CCK_RATE_5MB: ret = DESC_RATE5_5M; break;
|
|
|
|
case IEEE80211_CCK_RATE_11MB: ret = DESC_RATE11M; break;
|
|
|
|
case IEEE80211_OFDM_RATE_6MB: ret = DESC_RATE6M; break;
|
|
|
|
case IEEE80211_OFDM_RATE_9MB: ret = DESC_RATE9M; break;
|
|
|
|
case IEEE80211_OFDM_RATE_12MB: ret = DESC_RATE12M; break;
|
|
|
|
case IEEE80211_OFDM_RATE_18MB: ret = DESC_RATE18M; break;
|
|
|
|
case IEEE80211_OFDM_RATE_24MB: ret = DESC_RATE24M; break;
|
|
|
|
case IEEE80211_OFDM_RATE_36MB: ret = DESC_RATE36M; break;
|
|
|
|
case IEEE80211_OFDM_RATE_48MB: ret = DESC_RATE48M; break;
|
|
|
|
case IEEE80211_OFDM_RATE_54MB: ret = DESC_RATE54M; break;
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* HT rates since here */
|
|
|
|
/* case MGN_MCS0: ret = DESC_RATEMCS0; break; */
|
|
|
|
/* case MGN_MCS1: ret = DESC_RATEMCS1; break; */
|
|
|
|
/* case MGN_MCS2: ret = DESC_RATEMCS2; break; */
|
|
|
|
/* case MGN_MCS3: ret = DESC_RATEMCS3; break; */
|
|
|
|
/* case MGN_MCS4: ret = DESC_RATEMCS4; break; */
|
|
|
|
/* case MGN_MCS5: ret = DESC_RATEMCS5; break; */
|
|
|
|
/* case MGN_MCS6: ret = DESC_RATEMCS6; break; */
|
|
|
|
/* case MGN_MCS7: ret = DESC_RATEMCS7; break; */
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
default: break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
void HalSetBrateCfg(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter * Adapter,
|
|
|
|
u8 *mBratesOS,
|
|
|
|
u16 *pBrateCfg)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
u8 i, is_brate, brate;
|
|
|
|
|
2015-08-15 18:06:32 +00:00
|
|
|
for (i=0;i<NDIS_802_11_LENGTH_RATES_EX;i++)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
is_brate = mBratesOS[i] & IEEE80211_BASIC_RATE_MASK;
|
|
|
|
brate = mBratesOS[i] & 0x7f;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-08-15 18:02:34 +00:00
|
|
|
if ( is_brate )
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2015-08-15 18:05:44 +00:00
|
|
|
switch (brate)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
case IEEE80211_CCK_RATE_1MB: *pBrateCfg |= RATE_1M; break;
|
|
|
|
case IEEE80211_CCK_RATE_2MB: *pBrateCfg |= RATE_2M; break;
|
|
|
|
case IEEE80211_CCK_RATE_5MB: *pBrateCfg |= RATE_5_5M;break;
|
|
|
|
case IEEE80211_CCK_RATE_11MB: *pBrateCfg |= RATE_11M; break;
|
|
|
|
case IEEE80211_OFDM_RATE_6MB: *pBrateCfg |= RATE_6M; break;
|
|
|
|
case IEEE80211_OFDM_RATE_9MB: *pBrateCfg |= RATE_9M; break;
|
|
|
|
case IEEE80211_OFDM_RATE_12MB: *pBrateCfg |= RATE_12M; break;
|
|
|
|
case IEEE80211_OFDM_RATE_18MB: *pBrateCfg |= RATE_18M; break;
|
|
|
|
case IEEE80211_OFDM_RATE_24MB: *pBrateCfg |= RATE_24M; break;
|
|
|
|
case IEEE80211_OFDM_RATE_36MB: *pBrateCfg |= RATE_36M; break;
|
|
|
|
case IEEE80211_OFDM_RATE_48MB: *pBrateCfg |= RATE_48M; break;
|
|
|
|
case IEEE80211_OFDM_RATE_54MB: *pBrateCfg |= RATE_54M; break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-11 21:15:04 +00:00
|
|
|
_OneOutPipeMapping(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *pAdapter
|
2014-12-11 21:15:04 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(pAdapter);
|
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];/* VO */
|
|
|
|
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0];/* VI */
|
|
|
|
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[0];/* BE */
|
|
|
|
pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[0];/* BK */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0];/* BCN */
|
|
|
|
pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];/* MGT */
|
|
|
|
pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */
|
|
|
|
pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void
|
2014-12-11 21:15:04 +00:00
|
|
|
_TwoOutPipeMapping(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *pAdapter,
|
|
|
|
bool bWIFICfg
|
2014-12-11 21:15:04 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(pAdapter);
|
|
|
|
|
2015-08-15 18:24:16 +00:00
|
|
|
if (bWIFICfg) { /* WMM */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* BK, BE, VI, VO, BCN, CMD,MGT,HIGH,HCCA */
|
|
|
|
/* 0, 1, 0, 1, 0, 0, 0, 0, 0 }; */
|
|
|
|
/* 0:H, 1:L */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[1];/* VO */
|
|
|
|
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0];/* VI */
|
|
|
|
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[1];/* BE */
|
|
|
|
pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[0];/* BK */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0];/* BCN */
|
|
|
|
pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];/* MGT */
|
|
|
|
pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */
|
|
|
|
pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2015-08-15 18:27:00 +00:00
|
|
|
else {/* typical setting */
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* BK, BE, VI, VO, BCN, CMD,MGT,HIGH,HCCA */
|
|
|
|
/* 1, 1, 0, 0, 0, 0, 0, 0, 0 }; */
|
|
|
|
/* 0:H, 1:L */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];/* VO */
|
|
|
|
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[0];/* VI */
|
|
|
|
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[1];/* BE */
|
|
|
|
pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[1];/* BK */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0];/* BCN */
|
|
|
|
pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];/* MGT */
|
|
|
|
pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */
|
|
|
|
pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-29 02:06:17 +00:00
|
|
|
static void _ThreeOutPipeMapping(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *pAdapter,
|
|
|
|
bool bWIFICfg
|
2014-12-11 21:15:04 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(pAdapter);
|
|
|
|
|
2015-08-15 18:24:16 +00:00
|
|
|
if (bWIFICfg) {/* for WMM */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* BK, BE, VI, VO, BCN, CMD,MGT,HIGH,HCCA */
|
|
|
|
/* 1, 2, 1, 0, 0, 0, 0, 0, 0 }; */
|
|
|
|
/* 0:H, 1:N, 2:L */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];/* VO */
|
|
|
|
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[1];/* VI */
|
|
|
|
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[2];/* BE */
|
|
|
|
pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[1];/* BK */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0];/* BCN */
|
|
|
|
pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];/* MGT */
|
|
|
|
pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */
|
|
|
|
pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2015-08-15 18:27:00 +00:00
|
|
|
else {/* typical setting */
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
/* BK, BE, VI, VO, BCN, CMD,MGT,HIGH,HCCA */
|
|
|
|
/* 2, 2, 1, 0, 0, 0, 0, 0, 0 }; */
|
|
|
|
/* 0:H, 1:N, 2:L */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
pdvobjpriv->Queue2Pipe[0] = pdvobjpriv->RtOutPipe[0];/* VO */
|
|
|
|
pdvobjpriv->Queue2Pipe[1] = pdvobjpriv->RtOutPipe[1];/* VI */
|
|
|
|
pdvobjpriv->Queue2Pipe[2] = pdvobjpriv->RtOutPipe[2];/* BE */
|
|
|
|
pdvobjpriv->Queue2Pipe[3] = pdvobjpriv->RtOutPipe[2];/* BK */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-02-20 00:51:33 +00:00
|
|
|
pdvobjpriv->Queue2Pipe[4] = pdvobjpriv->RtOutPipe[0];/* BCN */
|
|
|
|
pdvobjpriv->Queue2Pipe[5] = pdvobjpriv->RtOutPipe[0];/* MGT */
|
|
|
|
pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */
|
|
|
|
pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
bool
|
2014-12-11 21:15:04 +00:00
|
|
|
Hal_MappingOutPipe(
|
2015-03-13 17:06:38 +00:00
|
|
|
struct adapter *pAdapter,
|
|
|
|
u8 NumOutPipe
|
2014-12-11 21:15:04 +00:00
|
|
|
)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
struct registry_priv *pregistrypriv = &pAdapter->registrypriv;
|
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
bool bWIFICfg = (pregistrypriv->wifi_spec) ?true:false;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2015-03-02 23:21:23 +00:00
|
|
|
bool result = true;
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2015-08-15 18:05:44 +00:00
|
|
|
switch (NumOutPipe)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
case 2:
|
|
|
|
_TwoOutPipeMapping(pAdapter, bWIFICfg);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
_ThreeOutPipeMapping(pAdapter, bWIFICfg);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
_OneOutPipeMapping(pAdapter);
|
|
|
|
break;
|
|
|
|
default:
|
2014-12-29 02:13:24 +00:00
|
|
|
result = false;
|
2014-12-11 21:15:04 +00:00
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return result;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void hal_init_macaddr(struct adapter *adapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2014-12-11 21:15:04 +00:00
|
|
|
rtw_hal_set_hwreg(adapter, HW_VAR_MAC_ADDR, adapter->eeprompriv.mac_addr);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2014-12-19 06:59:46 +00:00
|
|
|
/*
|
2013-05-08 21:45:39 +00:00
|
|
|
* C2H event format:
|
2014-12-19 06:59:46 +00:00
|
|
|
* Field TRIGGER CONTENT CMD_SEQ CMD_LEN CMD_ID
|
|
|
|
* BITS [127:120] [119:16] [15:8] [7:4] [3:0]
|
2013-05-08 21:45:39 +00:00
|
|
|
*/
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
void c2h_evt_clear(struct adapter *adapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
rtw_write8(adapter, REG_C2HEVT_CLEAR, C2H_EVT_HOST_CLOSE);
|
|
|
|
}
|
|
|
|
|
2014-12-17 23:13:53 +00:00
|
|
|
s32 c2h_evt_read(struct adapter *adapter, u8 *buf)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
s32 ret = _FAIL;
|
|
|
|
struct c2h_evt_hdr *c2h_evt;
|
|
|
|
int i;
|
|
|
|
u8 trigger;
|
|
|
|
|
|
|
|
if (buf == NULL)
|
|
|
|
goto exit;
|
|
|
|
|
|
|
|
trigger = rtw_read8(adapter, REG_C2HEVT_CLEAR);
|
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
if (trigger == C2H_EVT_HOST_CLOSE) {
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit; /* Not ready */
|
2014-12-11 21:15:04 +00:00
|
|
|
} else if (trigger != C2H_EVT_FW_CLOSE) {
|
2013-05-08 21:45:39 +00:00
|
|
|
goto clear_evt; /* Not a valid value */
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
c2h_evt = (struct c2h_evt_hdr *)buf;
|
|
|
|
|
2015-02-19 20:58:09 +00:00
|
|
|
memset(c2h_evt, 0, 16);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
*buf = rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL);
|
2014-12-19 06:59:46 +00:00
|
|
|
*(buf+1) = rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL + 1);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
RT_PRINT_DATA(_module_hal_init_c_, _drv_info_, "c2h_evt_read(): ",
|
2014-12-11 21:15:04 +00:00
|
|
|
&c2h_evt , sizeof(c2h_evt));
|
|
|
|
|
|
|
|
if (0) {
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E("%s id:%u, len:%u, seq:%u, trigger:0x%02x\n", __func__
|
2014-12-11 21:15:04 +00:00
|
|
|
, c2h_evt->id, c2h_evt->plen, c2h_evt->seq, trigger);
|
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
/* Read the content */
|
|
|
|
for (i = 0; i < c2h_evt->plen; i++)
|
2014-12-11 21:15:04 +00:00
|
|
|
c2h_evt->payload[i] = rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL + sizeof(*c2h_evt) + i);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
RT_PRINT_DATA(_module_hal_init_c_, _drv_info_, "c2h_evt_read(): Command Content:\n",
|
|
|
|
c2h_evt->payload, c2h_evt->plen);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
ret = _SUCCESS;
|
|
|
|
|
|
|
|
clear_evt:
|
2014-12-19 06:59:46 +00:00
|
|
|
/*
|
2013-05-08 21:45:39 +00:00
|
|
|
* Clear event to notify FW we have read the command.
|
2014-12-11 21:15:04 +00:00
|
|
|
* If this field isn't clear, the FW won't update the next command message.
|
2013-05-08 21:45:39 +00:00
|
|
|
*/
|
|
|
|
c2h_evt_clear(adapter);
|
|
|
|
exit:
|
|
|
|
return ret;
|
|
|
|
}
|
2014-12-11 21:15:04 +00:00
|
|
|
|
|
|
|
u8
|
2015-03-17 15:31:25 +00:00
|
|
|
SetHalDefVar(struct adapter *adapter, enum HAL_DEF_VARIABLE variable, void *value)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(adapter);
|
|
|
|
PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
|
|
|
|
u8 bResult = _SUCCESS;
|
|
|
|
|
2015-08-15 18:05:44 +00:00
|
|
|
switch (variable) {
|
2014-12-11 21:15:04 +00:00
|
|
|
case HW_DEF_FA_CNT_DUMP:
|
2015-08-15 18:02:34 +00:00
|
|
|
if (*((u8*)value))
|
2014-12-11 21:15:04 +00:00
|
|
|
pDM_Odm->DebugComponents |= (ODM_COMP_DIG |ODM_COMP_FA_CNT);
|
|
|
|
else
|
|
|
|
pDM_Odm->DebugComponents &= ~(ODM_COMP_DIG |ODM_COMP_FA_CNT);
|
|
|
|
break;
|
|
|
|
case HW_DEF_ODM_DBG_FLAG:
|
2014-12-30 23:52:40 +00:00
|
|
|
ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_DBG_COMP, *((u64*)value));
|
2014-12-11 21:15:04 +00:00
|
|
|
break;
|
|
|
|
case HW_DEF_ODM_DBG_LEVEL:
|
2014-12-30 22:55:10 +00:00
|
|
|
ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_DBG_LEVEL, *((u32*)value));
|
2014-12-11 21:15:04 +00:00
|
|
|
break;
|
|
|
|
default:
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E_LEVEL(_drv_always_, "%s: [WARNING] HAL_DEF_VARIABLE(%d) not defined!\n", __FUNCTION__, variable);
|
2014-12-11 21:15:04 +00:00
|
|
|
bResult = _FAIL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
u8
|
2015-03-17 15:31:25 +00:00
|
|
|
GetHalDefVar(struct adapter *adapter, enum HAL_DEF_VARIABLE variable, void *value)
|
2014-12-11 21:15:04 +00:00
|
|
|
{
|
|
|
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(adapter);
|
|
|
|
PDM_ODM_T pDM_Odm = &(pHalData->odmpriv);
|
|
|
|
u8 bResult = _SUCCESS;
|
|
|
|
|
2015-08-15 18:05:44 +00:00
|
|
|
switch (variable) {
|
2014-12-11 21:15:04 +00:00
|
|
|
case HW_DEF_ODM_DBG_FLAG:
|
2014-12-30 23:52:40 +00:00
|
|
|
*((u64*)value) = pDM_Odm->DebugComponents;
|
2014-12-11 21:15:04 +00:00
|
|
|
break;
|
|
|
|
case HW_DEF_ODM_DBG_LEVEL:
|
2014-12-30 22:55:10 +00:00
|
|
|
*((u32*)value) = pDM_Odm->DebugLevel;
|
2014-12-11 21:15:04 +00:00
|
|
|
break;
|
|
|
|
case HAL_DEF_DBG_DM_FUNC:
|
|
|
|
*((u32*)value) = pHalData->odmpriv.SupportAbility;
|
|
|
|
break;
|
|
|
|
default:
|
2015-08-15 21:38:30 +00:00
|
|
|
DBG_88E_LEVEL(_drv_always_, "%s: [WARNING] HAL_DEF_VARIABLE(%d) not defined!\n", __FUNCTION__, variable);
|
2014-12-11 21:15:04 +00:00
|
|
|
bResult = _FAIL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bResult;
|
|
|
|
}
|