Commit | Line | Data |
---|---|---|
1b509caf LF |
1 | /****************************************************************************** |
2 | * | |
3 | * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. | |
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 | * 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 | |
17 | * | |
18 | * | |
19 | ******************************************************************************/ | |
20 | ||
21 | #include <rtw_sreset.h> | |
e73fd15e | 22 | #include <usb_ops_linux.h> |
1b509caf LF |
23 | |
24 | void sreset_init_value(struct adapter *padapter) | |
25 | { | |
26 | struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); | |
27 | struct sreset_priv *psrtpriv = &pHalData->srestpriv; | |
28 | ||
1b509caf | 29 | psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; |
1b509caf | 30 | } |
1b509caf LF |
31 | |
32 | u8 sreset_get_wifi_status(struct adapter *padapter) | |
33 | { | |
34 | struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); | |
35 | struct sreset_priv *psrtpriv = &pHalData->srestpriv; | |
36 | ||
37 | u8 status = WIFI_STATUS_SUCCESS; | |
38 | u32 val32 = 0; | |
39 | ||
99ecfb06 | 40 | val32 = usb_read32(padapter, REG_TXDMA_STATUS); |
1b509caf LF |
41 | if (val32 == 0xeaeaeaea) { |
42 | psrtpriv->Wifi_Error_Status = WIFI_IF_NOT_EXIST; | |
43 | } else if (val32 != 0) { | |
44 | DBG_88E("txdmastatu(%x)\n", val32); | |
45 | psrtpriv->Wifi_Error_Status = WIFI_MAC_TXDMA_ERROR; | |
46 | } | |
47 | ||
48 | if (WIFI_STATUS_SUCCESS != psrtpriv->Wifi_Error_Status) { | |
49 | DBG_88E("==>%s error_status(0x%x)\n", __func__, psrtpriv->Wifi_Error_Status); | |
adb3d770 | 50 | status = psrtpriv->Wifi_Error_Status & (~(USB_READ_PORT_FAIL|USB_WRITE_PORT_FAIL)); |
1b509caf LF |
51 | } |
52 | DBG_88E("==> %s wifi_status(0x%x)\n", __func__, status); | |
53 | ||
54 | /* status restore */ | |
55 | psrtpriv->Wifi_Error_Status = WIFI_STATUS_SUCCESS; | |
56 | ||
57 | return status; | |
58 | } | |
59 | ||
60 | void sreset_set_wifi_error_status(struct adapter *padapter, u32 status) | |
61 | { | |
62 | struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter); | |
63 | pHalData->srestpriv.Wifi_Error_Status = status; | |
64 | } |