Path: blob/master/ALFA-W1F1/RTL8814AU/hal/rtl8814a/rtl8814a_sreset.c
1307 views
/******************************************************************************1*2* Copyright(c) 2007 - 2017 Realtek Corporation.3*4* This program is free software; you can redistribute it and/or modify it5* under the terms of version 2 of the GNU General Public License as6* published by the Free Software Foundation.7*8* This program is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for11* more details.12*13*****************************************************************************/14#define _RTL8814A_SRESET_C_1516/* #include <drv_types.h> */17#include <rtl8814a_hal.h>1819#ifdef DBG_CONFIG_ERROR_DETECT20void rtl8814_sreset_xmit_status_check(_adapter *padapter)21{22HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);23struct sreset_priv *psrtpriv = &pHalData->srestpriv;2425systime current_time;26struct xmit_priv *pxmitpriv = &padapter->xmitpriv;27unsigned int diff_time;28u32 txdma_status;2930txdma_status = rtw_read32(padapter, REG_TXDMA_STATUS);31if (txdma_status != 0x00) {32RTW_INFO("%s REG_TXDMA_STATUS:0x%08x\n", __FUNCTION__, txdma_status);33rtw_hal_sreset_reset(padapter);34}35#ifdef CONFIG_USB_HCI36/* total xmit irp = 4 */37/* RTW_INFO("==>%s free_xmitbuf_cnt(%d),txirp_cnt(%d)\n",__FUNCTION__,pxmitpriv->free_xmitbuf_cnt,pxmitpriv->txirp_cnt); */38/* if(pxmitpriv->txirp_cnt == NR_XMITBUFF+1) */39current_time = rtw_get_current_time();4041if (0 == pxmitpriv->free_xmitbuf_cnt || 0 == pxmitpriv->free_xmit_extbuf_cnt) {4243diff_time = rtw_get_passing_time_ms(psrtpriv->last_tx_time);4445if (diff_time > 2000) {46if (psrtpriv->last_tx_complete_time == 0)47psrtpriv->last_tx_complete_time = current_time;48else {49diff_time = rtw_get_passing_time_ms(psrtpriv->last_tx_complete_time);50if (diff_time > 4000) {51u32 ability = 0;5253/* padapter->Wifi_Error_Status = WIFI_TX_HANG; */54ability = rtw_phydm_ability_get(padapter);5556RTW_INFO("%s tx hang %s\n", __FUNCTION__,57(ability & ODM_BB_ADAPTIVITY) ? "ODM_BB_ADAPTIVITY" : "");5859if (!(ability & ODM_BB_ADAPTIVITY))60rtw_hal_sreset_reset(padapter);61}62}63}64}65#endif /* CONFIG_USB_HCI */6667if (psrtpriv->dbg_trigger_point == SRESET_TGP_XMIT_STATUS) {68psrtpriv->dbg_trigger_point = SRESET_TGP_NULL;69rtw_hal_sreset_reset(padapter);70return;71}72}7374void rtl8814_sreset_linked_status_check(_adapter *padapter)75{76HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);77struct sreset_priv *psrtpriv = &pHalData->srestpriv;7879u32 rx_dma_status = 0;80rx_dma_status = rtw_read32(padapter, REG_RXDMA_STATUS);81if (rx_dma_status != 0x00)82RTW_INFO("%s REG_RXDMA_STATUS:0x%08x\n", __FUNCTION__, rx_dma_status);83#if 084u32 regc50, regc58, reg824, reg800;85regc50 = rtw_read32(padapter, 0xc50);86regc58 = rtw_read32(padapter, 0xc58);87reg824 = rtw_read32(padapter, 0x824);88reg800 = rtw_read32(padapter, 0x800);89if (((regc50 & 0xFFFFFF00) != 0x69543400) ||90((regc58 & 0xFFFFFF00) != 0x69543400) ||91(((reg824 & 0xFFFFFF00) != 0x00390000) && (((reg824 & 0xFFFFFF00) != 0x80390000))) ||92(((reg800 & 0xFFFFFF00) != 0x03040000) && ((reg800 & 0xFFFFFF00) != 0x83040000))) {93RTW_INFO("%s regc50:0x%08x, regc58:0x%08x, reg824:0x%08x, reg800:0x%08x,\n", __FUNCTION__,94regc50, regc58, reg824, reg800);95rtw_hal_sreset_reset(padapter);96}97#endif9899if (psrtpriv->dbg_trigger_point == SRESET_TGP_LINK_STATUS) {100psrtpriv->dbg_trigger_point = SRESET_TGP_NULL;101rtw_hal_sreset_reset(padapter);102return;103}104}105#endif106107108