Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
nu11secur1ty
GitHub Repository: nu11secur1ty/Kali-Linux
Path: blob/master/ALFA-W1F1/RTL8814AU/hal/rtl8814a/rtl8814a_sreset.c
1307 views
1
/******************************************************************************
2
*
3
* Copyright(c) 2007 - 2017 Realtek Corporation.
4
*
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.
8
*
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
12
* more details.
13
*
14
*****************************************************************************/
15
#define _RTL8814A_SRESET_C_
16
17
/* #include <drv_types.h> */
18
#include <rtl8814a_hal.h>
19
20
#ifdef DBG_CONFIG_ERROR_DETECT
21
void rtl8814_sreset_xmit_status_check(_adapter *padapter)
22
{
23
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
24
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
25
26
systime current_time;
27
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
28
unsigned int diff_time;
29
u32 txdma_status;
30
31
txdma_status = rtw_read32(padapter, REG_TXDMA_STATUS);
32
if (txdma_status != 0x00) {
33
RTW_INFO("%s REG_TXDMA_STATUS:0x%08x\n", __FUNCTION__, txdma_status);
34
rtw_hal_sreset_reset(padapter);
35
}
36
#ifdef CONFIG_USB_HCI
37
/* total xmit irp = 4 */
38
/* RTW_INFO("==>%s free_xmitbuf_cnt(%d),txirp_cnt(%d)\n",__FUNCTION__,pxmitpriv->free_xmitbuf_cnt,pxmitpriv->txirp_cnt); */
39
/* if(pxmitpriv->txirp_cnt == NR_XMITBUFF+1) */
40
current_time = rtw_get_current_time();
41
42
if (0 == pxmitpriv->free_xmitbuf_cnt || 0 == pxmitpriv->free_xmit_extbuf_cnt) {
43
44
diff_time = rtw_get_passing_time_ms(psrtpriv->last_tx_time);
45
46
if (diff_time > 2000) {
47
if (psrtpriv->last_tx_complete_time == 0)
48
psrtpriv->last_tx_complete_time = current_time;
49
else {
50
diff_time = rtw_get_passing_time_ms(psrtpriv->last_tx_complete_time);
51
if (diff_time > 4000) {
52
u32 ability = 0;
53
54
/* padapter->Wifi_Error_Status = WIFI_TX_HANG; */
55
ability = rtw_phydm_ability_get(padapter);
56
57
RTW_INFO("%s tx hang %s\n", __FUNCTION__,
58
(ability & ODM_BB_ADAPTIVITY) ? "ODM_BB_ADAPTIVITY" : "");
59
60
if (!(ability & ODM_BB_ADAPTIVITY))
61
rtw_hal_sreset_reset(padapter);
62
}
63
}
64
}
65
}
66
#endif /* CONFIG_USB_HCI */
67
68
if (psrtpriv->dbg_trigger_point == SRESET_TGP_XMIT_STATUS) {
69
psrtpriv->dbg_trigger_point = SRESET_TGP_NULL;
70
rtw_hal_sreset_reset(padapter);
71
return;
72
}
73
}
74
75
void rtl8814_sreset_linked_status_check(_adapter *padapter)
76
{
77
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
78
struct sreset_priv *psrtpriv = &pHalData->srestpriv;
79
80
u32 rx_dma_status = 0;
81
rx_dma_status = rtw_read32(padapter, REG_RXDMA_STATUS);
82
if (rx_dma_status != 0x00)
83
RTW_INFO("%s REG_RXDMA_STATUS:0x%08x\n", __FUNCTION__, rx_dma_status);
84
#if 0
85
u32 regc50, regc58, reg824, reg800;
86
regc50 = rtw_read32(padapter, 0xc50);
87
regc58 = rtw_read32(padapter, 0xc58);
88
reg824 = rtw_read32(padapter, 0x824);
89
reg800 = rtw_read32(padapter, 0x800);
90
if (((regc50 & 0xFFFFFF00) != 0x69543400) ||
91
((regc58 & 0xFFFFFF00) != 0x69543400) ||
92
(((reg824 & 0xFFFFFF00) != 0x00390000) && (((reg824 & 0xFFFFFF00) != 0x80390000))) ||
93
(((reg800 & 0xFFFFFF00) != 0x03040000) && ((reg800 & 0xFFFFFF00) != 0x83040000))) {
94
RTW_INFO("%s regc50:0x%08x, regc58:0x%08x, reg824:0x%08x, reg800:0x%08x,\n", __FUNCTION__,
95
regc50, regc58, reg824, reg800);
96
rtw_hal_sreset_reset(padapter);
97
}
98
#endif
99
100
if (psrtpriv->dbg_trigger_point == SRESET_TGP_LINK_STATUS) {
101
psrtpriv->dbg_trigger_point = SRESET_TGP_NULL;
102
rtw_hal_sreset_reset(padapter);
103
return;
104
}
105
}
106
#endif
107
108