2022-06-08 23:46:35 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/* Copyright(c) 2007 - 2011 Realtek Corporation. */
|
|
|
|
|
|
|
|
#include "../include/osdep_service.h"
|
|
|
|
#include "../include/drv_types.h"
|
|
|
|
|
|
|
|
#include "../include/hal_intf.h"
|
|
|
|
#include "../include/hal_com.h"
|
|
|
|
#include "../include/rtl8188e_hal.h"
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
#define _HAL_INIT_C_
|
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
void dump_chip_info(struct HAL_VERSION chip_vers)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-05-27 22:32:24 +00:00
|
|
|
uint cnt = 0;
|
|
|
|
char buf[128];
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
cnt += sprintf((buf + cnt), "Chip Version Info: CHIP_8188E_");
|
|
|
|
cnt += sprintf((buf + cnt), "%s_", IS_NORMAL_CHIP(chip_vers) ?
|
2013-08-04 20:12:30 +00:00
|
|
|
"Normal_Chip" : "Test_Chip");
|
2022-06-08 23:46:35 +00:00
|
|
|
cnt += sprintf((buf + cnt), "%s_", IS_CHIP_VENDOR_TSMC(chip_vers) ?
|
2013-08-04 20:12:30 +00:00
|
|
|
"TSMC" : "UMC");
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
switch (chip_vers.CUTVersion) {
|
|
|
|
case A_CUT_VERSION:
|
|
|
|
cnt += sprintf((buf + cnt), "A_CUT_");
|
|
|
|
break;
|
|
|
|
case B_CUT_VERSION:
|
|
|
|
cnt += sprintf((buf + cnt), "B_CUT_");
|
|
|
|
break;
|
|
|
|
case C_CUT_VERSION:
|
|
|
|
cnt += sprintf((buf + cnt), "C_CUT_");
|
|
|
|
break;
|
|
|
|
case D_CUT_VERSION:
|
|
|
|
cnt += sprintf((buf + cnt), "D_CUT_");
|
|
|
|
break;
|
|
|
|
case E_CUT_VERSION:
|
|
|
|
cnt += sprintf((buf + cnt), "E_CUT_");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
cnt += sprintf((buf + cnt), "UNKNOWN_CUT(%d)_", chip_vers.CUTVersion);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
cnt += sprintf((buf + cnt), "1T1R_");
|
|
|
|
|
|
|
|
cnt += sprintf((buf + cnt), "RomVer(%d)\n", chip_vers.ROMVer);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-05-26 17:17:22 +00:00
|
|
|
pr_info("%s", buf);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
#define CHAN_PLAN_HW 0x80
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
u8 /* return the final channel plan decision */
|
|
|
|
hal_com_get_channel_plan(struct adapter *padapter, u8 hw_channel_plan,
|
|
|
|
u8 sw_channel_plan, u8 def_channel_plan,
|
|
|
|
bool load_fail)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-08-04 20:12:30 +00:00
|
|
|
u8 sw_cfg;
|
|
|
|
u8 chnlplan;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
sw_cfg = true;
|
|
|
|
if (!load_fail) {
|
2013-05-08 21:45:39 +00:00
|
|
|
if (!rtw_is_channel_plan_valid(sw_channel_plan))
|
2013-08-04 20:12:30 +00:00
|
|
|
sw_cfg = false;
|
|
|
|
if (hw_channel_plan & CHAN_PLAN_HW)
|
|
|
|
sw_cfg = false;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
if (sw_cfg)
|
|
|
|
chnlplan = sw_channel_plan;
|
2013-05-08 21:45:39 +00:00
|
|
|
else
|
2013-08-04 20:12:30 +00:00
|
|
|
chnlplan = hw_channel_plan & (~CHAN_PLAN_HW);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
if (!rtw_is_channel_plan_valid(chnlplan))
|
|
|
|
chnlplan = def_channel_plan;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
return chnlplan;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
u8 MRateToHwRate(u8 rate)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-08-04 20:12:30 +00:00
|
|
|
u8 ret = DESC_RATE1M;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
switch (rate) {
|
|
|
|
/* CCK and OFDM non-HT rates */
|
|
|
|
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;
|
|
|
|
default:
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
void HalSetBrateCfg(struct adapter *adapt, u8 *brates, u16 *rate_cfg)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-08-04 20:12:30 +00:00
|
|
|
u8 i, is_brate, brate;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) {
|
|
|
|
is_brate = brates[i] & IEEE80211_BASIC_RATE_MASK;
|
|
|
|
brate = brates[i] & 0x7f;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
if (is_brate) {
|
2013-05-27 03:51:56 +00:00
|
|
|
switch (brate) {
|
|
|
|
case IEEE80211_CCK_RATE_1MB:
|
2013-08-04 20:12:30 +00:00
|
|
|
*rate_cfg |= RATE_1M;
|
2013-05-27 03:51:56 +00:00
|
|
|
break;
|
|
|
|
case IEEE80211_CCK_RATE_2MB:
|
2013-08-04 20:12:30 +00:00
|
|
|
*rate_cfg |= RATE_2M;
|
2013-05-27 03:51:56 +00:00
|
|
|
break;
|
|
|
|
case IEEE80211_CCK_RATE_5MB:
|
2013-08-04 20:12:30 +00:00
|
|
|
*rate_cfg |= RATE_5_5M;
|
2013-05-27 03:51:56 +00:00
|
|
|
break;
|
|
|
|
case IEEE80211_CCK_RATE_11MB:
|
2013-08-04 20:12:30 +00:00
|
|
|
*rate_cfg |= RATE_11M;
|
2013-05-27 03:51:56 +00:00
|
|
|
break;
|
|
|
|
case IEEE80211_OFDM_RATE_6MB:
|
2013-08-04 20:12:30 +00:00
|
|
|
*rate_cfg |= RATE_6M;
|
2013-05-27 03:51:56 +00:00
|
|
|
break;
|
|
|
|
case IEEE80211_OFDM_RATE_9MB:
|
2013-08-04 20:12:30 +00:00
|
|
|
*rate_cfg |= RATE_9M;
|
2013-05-27 03:51:56 +00:00
|
|
|
break;
|
|
|
|
case IEEE80211_OFDM_RATE_12MB:
|
2013-08-04 20:12:30 +00:00
|
|
|
*rate_cfg |= RATE_12M;
|
2013-05-27 03:51:56 +00:00
|
|
|
break;
|
|
|
|
case IEEE80211_OFDM_RATE_18MB:
|
2013-08-04 20:12:30 +00:00
|
|
|
*rate_cfg |= RATE_18M;
|
2013-05-27 03:51:56 +00:00
|
|
|
break;
|
|
|
|
case IEEE80211_OFDM_RATE_24MB:
|
2013-08-04 20:12:30 +00:00
|
|
|
*rate_cfg |= RATE_24M;
|
2013-05-27 03:51:56 +00:00
|
|
|
break;
|
|
|
|
case IEEE80211_OFDM_RATE_36MB:
|
2013-08-04 20:12:30 +00:00
|
|
|
*rate_cfg |= RATE_36M;
|
2013-05-27 03:51:56 +00:00
|
|
|
break;
|
|
|
|
case IEEE80211_OFDM_RATE_48MB:
|
2013-08-04 20:12:30 +00:00
|
|
|
*rate_cfg |= RATE_48M;
|
2013-05-27 03:51:56 +00:00
|
|
|
break;
|
|
|
|
case IEEE80211_OFDM_RATE_54MB:
|
2013-08-04 20:12:30 +00:00
|
|
|
*rate_cfg |= RATE_54M;
|
2013-05-27 03:51:56 +00:00
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
static void one_out_pipe(struct adapter *adapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-08-04 20:12:30 +00:00
|
|
|
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-07-10 18:25:07 +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 */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-10 18:25:07 +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
|
|
|
}
|
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
static void two_out_pipe(struct adapter *adapter, bool wifi_cfg)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-08-04 20:12:30 +00:00
|
|
|
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(adapter);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
if (wifi_cfg) { /* WMM */
|
|
|
|
/* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
|
|
|
|
/* 0, 1, 0, 1, 0, 0, 0, 0, 0}; */
|
2013-07-10 18:25:07 +00:00
|
|
|
/* 0:H, 1:L */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-10 18:25:07 +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 */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-10 18:25:07 +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-19 04:28:07 +00:00
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
} else {/* typical setting */
|
|
|
|
/* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
|
|
|
|
/* 1, 1, 0, 0, 0, 0, 0, 0, 0}; */
|
2013-07-10 18:25:07 +00:00
|
|
|
/* 0:H, 1:L */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-10 18:25:07 +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 */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-10 18:25:07 +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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
static void three_out_pipe(struct adapter *adapter, bool wifi_cfg)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-08-04 20:12:30 +00:00
|
|
|
struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(adapter);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
if (wifi_cfg) {/* for WMM */
|
|
|
|
/* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
|
|
|
|
/* 1, 2, 1, 0, 0, 0, 0, 0, 0}; */
|
2013-07-10 18:25:07 +00:00
|
|
|
/* 0:H, 1:N, 2:L */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-10 18:25:07 +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 */
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-07-10 18:25:07 +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-19 04:28:07 +00:00
|
|
|
|
2013-07-10 18:25:07 +00:00
|
|
|
} else {/* typical setting */
|
2013-08-04 20:12:30 +00:00
|
|
|
/* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */
|
|
|
|
/* 2, 2, 1, 0, 0, 0, 0, 0, 0}; */
|
2013-07-10 18:25:07 +00:00
|
|
|
/* 0:H, 1:N, 2:L */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-10 18:25:07 +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 */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-10 18:25:07 +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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
bool Hal_MappingOutPipe(struct adapter *adapter, u8 numoutpipe)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2013-08-04 20:12:30 +00:00
|
|
|
struct registry_priv *pregistrypriv = &adapter->registrypriv;
|
|
|
|
bool wifi_cfg = (pregistrypriv->wifi_spec) ? true : false;
|
2013-05-26 03:02:10 +00:00
|
|
|
bool result = true;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
switch (numoutpipe) {
|
|
|
|
case 2:
|
|
|
|
two_out_pipe(adapter, wifi_cfg);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
three_out_pipe(adapter, wifi_cfg);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
one_out_pipe(adapter);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
result = false;
|
|
|
|
break;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2013-05-19 04:28:07 +00:00
|
|
|
/*
|
2013-05-08 21:45:39 +00:00
|
|
|
* C2H event format:
|
2013-05-19 04:28:07 +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
|
|
|
*/
|
|
|
|
|
2013-07-27 01:08:39 +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;
|
|
|
|
|
2022-06-08 23:46:35 +00:00
|
|
|
if (!buf)
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
|
|
|
|
trigger = rtw_read8(adapter, REG_C2HEVT_CLEAR);
|
|
|
|
|
2013-08-04 20:12:30 +00:00
|
|
|
if (trigger == C2H_EVT_HOST_CLOSE)
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit; /* Not ready */
|
2013-08-04 20:12:30 +00:00
|
|
|
else if (trigger != C2H_EVT_FW_CLOSE)
|
2013-05-08 21:45:39 +00:00
|
|
|
goto clear_evt; /* Not a valid value */
|
|
|
|
|
|
|
|
c2h_evt = (struct c2h_evt_hdr *)buf;
|
|
|
|
|
2014-12-13 04:43:35 +00:00
|
|
|
memset(c2h_evt, 0, 16);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
*buf = rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL);
|
2022-06-08 23:46:35 +00:00
|
|
|
*(buf + 1) = rtw_read8(adapter, REG_C2HEVT_MSG_NORMAL + 1);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
/* Read the content */
|
|
|
|
for (i = 0; i < c2h_evt->plen; i++)
|
2013-08-04 20:12:30 +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
|
|
|
|
|
|
|
ret = _SUCCESS;
|
|
|
|
|
|
|
|
clear_evt:
|
2013-05-19 04:28:07 +00:00
|
|
|
/*
|
2013-05-08 21:45:39 +00:00
|
|
|
* Clear event to notify FW we have read the command.
|
2013-08-04 20:12:30 +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
|
|
|
*/
|
2022-06-08 23:46:35 +00:00
|
|
|
rtw_write8(adapter, REG_C2HEVT_CLEAR, C2H_EVT_HOST_CLOSE);
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
|
|
|
return ret;
|
|
|
|
}
|