rtl8812a_sreset.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2011 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. #define _RTL8812A_SRESET_C_
  21. //#include <drv_types.h>
  22. #include <rtl8812a_hal.h>
  23. #ifdef DBG_CONFIG_ERROR_DETECT
  24. void rtl8812_sreset_xmit_status_check(_adapter *padapter)
  25. {
  26. HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
  27. struct sreset_priv *psrtpriv = &pHalData->srestpriv;
  28. unsigned long current_time;
  29. struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
  30. unsigned int diff_time;
  31. u32 txdma_status;
  32. if( (txdma_status=rtw_read32(padapter, REG_TXDMA_STATUS)) !=0x00){
  33. DBG_871X("%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. //DBG_8192C("==>%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. if (0 == pxmitpriv->free_xmitbuf_cnt || 0 == pxmitpriv->free_xmit_extbuf_cnt) {
  42. diff_time = rtw_get_passing_time_ms(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;
  46. }
  47. else{
  48. diff_time = rtw_get_passing_time_ms(psrtpriv->last_tx_complete_time);
  49. if (diff_time > 4000) {
  50. //padapter->Wifi_Error_Status = WIFI_TX_HANG;
  51. DBG_871X("%s tx hang\n", __FUNCTION__);
  52. rtw_hal_sreset_reset(padapter);
  53. }
  54. }
  55. }
  56. }
  57. #endif //CONFIG_USB_HCI
  58. if (psrtpriv->dbg_trigger_point == SRESET_TGP_XMIT_STATUS) {
  59. psrtpriv->dbg_trigger_point = SRESET_TGP_NULL;
  60. rtw_hal_sreset_reset(padapter);
  61. return;
  62. }
  63. }
  64. void rtl8812_sreset_linked_status_check(_adapter *padapter)
  65. {
  66. HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
  67. struct sreset_priv *psrtpriv = &pHalData->srestpriv;
  68. u32 rx_dma_status = 0;
  69. rx_dma_status = rtw_read32(padapter,REG_RXDMA_STATUS);
  70. if(rx_dma_status!= 0x00){
  71. DBG_8192C("%s REG_RXDMA_STATUS:0x%08x\n",__FUNCTION__,rx_dma_status);
  72. }
  73. #if 0
  74. u32 regc50,regc58,reg824,reg800;
  75. regc50 = rtw_read32(padapter,0xc50);
  76. regc58 = rtw_read32(padapter,0xc58);
  77. reg824 = rtw_read32(padapter,0x824);
  78. reg800 = rtw_read32(padapter,0x800);
  79. if( ((regc50&0xFFFFFF00)!= 0x69543400)||
  80. ((regc58&0xFFFFFF00)!= 0x69543400)||
  81. (((reg824&0xFFFFFF00)!= 0x00390000)&&(((reg824&0xFFFFFF00)!= 0x80390000)))||
  82. ( ((reg800&0xFFFFFF00)!= 0x03040000)&&((reg800&0xFFFFFF00)!= 0x83040000)))
  83. {
  84. DBG_8192C("%s regc50:0x%08x, regc58:0x%08x, reg824:0x%08x, reg800:0x%08x,\n", __FUNCTION__,
  85. regc50, regc58, reg824, reg800);
  86. rtw_hal_sreset_reset(padapter);
  87. }
  88. #endif
  89. if (psrtpriv->dbg_trigger_point == SRESET_TGP_LINK_STATUS) {
  90. psrtpriv->dbg_trigger_point = SRESET_TGP_NULL;
  91. rtw_hal_sreset_reset(padapter);
  92. return;
  93. }
  94. }
  95. #endif