1 /******************************************************************************
3 * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 ******************************************************************************/
20 #define _RTL8723A_SRESET_C_
22 #include <rtl8723a_sreset.h>
23 #include <rtl8723a_hal.h>
26 #ifdef DBG_CONFIG_ERROR_DETECT
27 void rtl8723a_sreset_xmit_status_check(_adapter *padapter)
29 HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
30 struct sreset_priv *psrtpriv = &pHalData->srestpriv;
32 unsigned long current_time;
33 struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
34 unsigned int diff_time;
38 if( (txdma_status=rtw_read32(padapter, REG_TXDMA_STATUS)) !=0x00){
39 DBG_8723A("%s REG_TXDMA_STATUS:0x%08x\n", __FUNCTION__, txdma_status);
40 rtw_hal_sreset_reset(padapter);
45 //DBG_8723A("==>%s free_xmitbuf_cnt(%d),txirp_cnt(%d)\n",__FUNCTION__,pxmitpriv->free_xmitbuf_cnt,pxmitpriv->txirp_cnt);
46 //if(pxmitpriv->txirp_cnt == NR_XMITBUFF+1)
47 current_time = rtw_get_current_time();
49 if(0 == pxmitpriv->free_xmitbuf_cnt || 0 == pxmitpriv->free_xmit_extbuf_cnt) {
51 diff_time = rtw_get_passing_time_ms(psrtpriv->last_tx_time);
53 if (diff_time > 2000) {
54 if (psrtpriv->last_tx_complete_time == 0) {
55 psrtpriv->last_tx_complete_time = current_time;
58 diff_time = rtw_get_passing_time_ms(psrtpriv->last_tx_complete_time);
59 if (diff_time > 4000) {
60 //padapter->Wifi_Error_Status = WIFI_TX_HANG;
61 DBG_8723A("%s tx hang\n", __FUNCTION__);
62 rtw_hal_sreset_reset(padapter);
67 #endif // #ifdef CONFIG_USB_HCI
69 if (psrtpriv->dbg_trigger_point == SRESET_TGP_XMIT_STATUS) {
70 psrtpriv->dbg_trigger_point = SRESET_TGP_NULL;
71 rtw_hal_sreset_reset(padapter);
76 void rtl8723a_sreset_linked_status_check(_adapter *padapter)
78 HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
79 struct sreset_priv *psrtpriv = &pHalData->srestpriv;
81 u32 regc50,regc58,reg824,reg800;
82 regc50 = rtw_read32(padapter,0xc50);
83 regc58 = rtw_read32(padapter,0xc58);
84 reg824 = rtw_read32(padapter,0x824);
85 reg800 = rtw_read32(padapter,0x800);
86 if( ((regc50&0xFFFFFF00)!= 0x69543400)||
87 ((regc58&0xFFFFFF00)!= 0x69543400)||
88 (((reg824&0xFFFFFF00)!= 0x00390000)&&(((reg824&0xFFFFFF00)!= 0x80390000)))||
89 ( ((reg800&0xFFFFFF00)!= 0x03040000)&&((reg800&0xFFFFFF00)!= 0x83040000)))
91 DBG_8723A("%s regc50:0x%08x, regc58:0x%08x, reg824:0x%08x, reg800:0x%08x,\n", __FUNCTION__,
92 regc50, regc58, reg824, reg800);
93 rtw_hal_sreset_reset(padapter);
97 if (psrtpriv->dbg_trigger_point == SRESET_TGP_LINK_STATUS) {
98 psrtpriv->dbg_trigger_point = SRESET_TGP_NULL;
99 rtw_hal_sreset_reset(padapter);