2013-05-19 04:28:07 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright(c) 2007 - 2012 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
|
|
|
|
*
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2013-07-19 22:05:40 +00:00
|
|
|
#include <rtw_sreset.h>
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
void sreset_init_value(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-22 23:18:19 +00:00
|
|
|
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
|
2013-05-19 04:28:07 +00:00
|
|
|
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
|
|
|
|
|
|
|
_rtw_mutex_init(&psrtpriv->silentreset_mutex);
|
2013-05-26 03:02:10 +00:00
|
|
|
psrtpriv->silent_reset_inprogress = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
|
2013-08-01 18:10:46 +00:00
|
|
|
psrtpriv->last_tx_time = 0;
|
|
|
|
psrtpriv->last_tx_complete_time = 0;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2013-07-27 01:08:39 +00:00
|
|
|
void sreset_reset_value(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-22 23:18:19 +00:00
|
|
|
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
|
2013-05-19 04:28:07 +00:00
|
|
|
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
|
|
|
|
2013-05-26 03:02:10 +00:00
|
|
|
psrtpriv->silent_reset_inprogress = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
|
2013-08-01 18:10:46 +00:00
|
|
|
psrtpriv->last_tx_time = 0;
|
|
|
|
psrtpriv->last_tx_complete_time = 0;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
u8 sreset_get_wifi_status(struct adapter *padapter)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-22 23:18:19 +00:00
|
|
|
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
|
2013-05-19 04:28:07 +00:00
|
|
|
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
|
|
|
|
|
|
|
|
u8 status = WIFI_STATUS_SUCCESS;
|
|
|
|
u32 val32 = 0;
|
2013-07-24 03:39:20 +00:00
|
|
|
unsigned long irqL;
|
2013-08-01 18:10:46 +00:00
|
|
|
if (psrtpriv->silent_reset_inprogress)
|
2013-05-19 04:28:07 +00:00
|
|
|
return status;
|
2013-08-01 18:10:46 +00:00
|
|
|
val32 = rtw_read32(padapter, REG_TXDMA_STATUS);
|
|
|
|
if (val32 == 0xeaeaeaea) {
|
2013-05-19 04:28:07 +00:00
|
|
|
psrtpriv->Wifi_Error_Status = WIFI_IF_NOT_EXIST;
|
2013-08-01 18:10:46 +00:00
|
|
|
} else if (val32 != 0) {
|
|
|
|
DBG_88E("txdmastatu(%x)\n", val32);
|
2013-05-19 04:28:07 +00:00
|
|
|
psrtpriv->Wifi_Error_Status = WIFI_MAC_TXDMA_ERROR;
|
|
|
|
}
|
|
|
|
|
2013-08-01 18:10:46 +00:00
|
|
|
if (WIFI_STATUS_SUCCESS != psrtpriv->Wifi_Error_Status) {
|
|
|
|
DBG_88E("==>%s error_status(0x%x)\n", __func__, psrtpriv->Wifi_Error_Status);
|
|
|
|
status = (psrtpriv->Wifi_Error_Status & (~(USB_READ_PORT_FAIL|USB_WRITE_PORT_FAIL)));
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2013-08-01 18:10:46 +00:00
|
|
|
DBG_88E("==> %s wifi_status(0x%x)\n", __func__, status);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* status restore */
|
2013-05-19 04:28:07 +00:00
|
|
|
psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS;
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2013-07-27 01:08:39 +00:00
|
|
|
void sreset_set_wifi_error_status(struct adapter *padapter, u32 status)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-22 23:18:19 +00:00
|
|
|
struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
|
2013-05-19 04:28:07 +00:00
|
|
|
pHalData->srestpriv.Wifi_Error_Status = status;
|
|
|
|
}
|