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 ******************************************************************************/
15 #define _RTL8723A_SRESET_C_
17 #include <rtl8723a_sreset.h>
18 #include <rtl8723a_hal.h>
19 #include <usb_ops_linux.h>
21 void rtl8723a_sreset_xmit_status_check(struct rtw_adapter *padapter)
23 struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);
24 struct sreset_priv *psrtpriv = &pHalData->srestpriv;
26 unsigned long current_time;
27 struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
28 unsigned int diff_time;
31 txdma_status = rtl8723au_read32(padapter, REG_TXDMA_STATUS);
32 if (txdma_status != 0) {
33 DBG_8723A("%s REG_TXDMA_STATUS:0x%08x\n", __func__, txdma_status);
34 rtw_sreset_reset(padapter);
37 current_time = jiffies;
39 if (0 == pxmitpriv->free_xmitbuf_cnt || 0 == pxmitpriv->free_xmit_extbuf_cnt) {
41 diff_time = jiffies_to_msecs(jiffies - psrtpriv->last_tx_time);
43 if (diff_time > 2000) {
44 if (psrtpriv->last_tx_complete_time == 0) {
45 psrtpriv->last_tx_complete_time = current_time;
47 diff_time = jiffies_to_msecs(jiffies - psrtpriv->last_tx_complete_time);
48 if (diff_time > 4000) {
49 DBG_8723A("%s tx hang\n", __func__);
50 rtw_sreset_reset(padapter);