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 #ifndef __RTL8723D_RECV_H__ 16 #define __RTL8723D_RECV_H__ 17 18 #define RECV_BLK_SZ 512 19 #define RECV_BLK_CNT 16 20 #define RECV_BLK_TH RECV_BLK_CNT 21 22 #if defined(CONFIG_USB_HCI) 23 24 #ifndef MAX_RECVBUF_SZ 25 #ifdef PLATFORM_OS_CE 26 #define MAX_RECVBUF_SZ (8192+1024) /* 8K+1k */ 27 #else 28 #ifndef CONFIG_MINIMAL_MEMORY_USAGE 29 /* #define MAX_RECVBUF_SZ (32768) */ /* 32k */ 30 /* #define MAX_RECVBUF_SZ (16384) */ /* 16K */ 31 /* #define MAX_RECVBUF_SZ (10240) */ /* 10K */ 32 #ifdef CONFIG_PLATFORM_MSTAR 33 #define MAX_RECVBUF_SZ (8192) /* 8K */ 34 #else 35 #define MAX_RECVBUF_SZ (15360) /* 15k < 16k */ 36 #endif 37 /* #define MAX_RECVBUF_SZ (8192+1024) */ /* 8K+1k */ 38 #else 39 #define MAX_RECVBUF_SZ (4000) /* about 4K */ 40 #endif 41 #endif 42 #endif /* !MAX_RECVBUF_SZ */ 43 44 #elif defined(CONFIG_PCI_HCI) 45 /* #ifndef CONFIG_MINIMAL_MEMORY_USAGE */ 46 /* #define MAX_RECVBUF_SZ (9100) */ 47 /* #else */ 48 #define MAX_RECVBUF_SZ (4000) /* about 4K 49 * #endif */ 50 51 52 #elif defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) 53 54 #define MAX_RECVBUF_SZ (RX_DMA_BOUNDARY_8723D + 1) 55 56 #endif 57 58 /* Rx smooth factor */ 59 #define Rx_Smooth_Factor (20) 60 61 #ifdef CONFIG_SDIO_HCI 62 #ifndef CONFIG_SDIO_RX_COPY 63 #undef MAX_RECVBUF_SZ 64 #define MAX_RECVBUF_SZ (RX_DMA_SIZE_8723D - RX_DMA_RESERVED_SIZE_8723D) 65 #endif /* !CONFIG_SDIO_RX_COPY */ 66 #endif /* CONFIG_SDIO_HCI */ 67 68 /*-----------------------------------------------------------------*/ 69 /* RTL8723D RX BUFFER DESC */ 70 /*-----------------------------------------------------------------*/ 71 /*DWORD 0*/ 72 #define SET_RX_BUFFER_DESC_DATA_LENGTH_8723D(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 0, 14, __Value) 73 #define SET_RX_BUFFER_DESC_LS_8723D(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 15, 1, __Value) 74 #define SET_RX_BUFFER_DESC_FS_8723D(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 16, 1, __Value) 75 #define SET_RX_BUFFER_DESC_TOTAL_LENGTH_8723D(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 16, 15, __Value) 76 77 #define GET_RX_BUFFER_DESC_OWN_8723D(__pRxStatusDesc) LE_BITS_TO_4BYTE(__pRxStatusDesc, 31, 1) 78 #define GET_RX_BUFFER_DESC_LS_8723D(__pRxStatusDesc) LE_BITS_TO_4BYTE(__pRxStatusDesc, 15, 1) 79 #define GET_RX_BUFFER_DESC_FS_8723D(__pRxStatusDesc) LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 1) 80 #ifdef USING_RX_TAG 81 #define GET_RX_BUFFER_DESC_RX_TAG_8723D(__pRxStatusDesc) LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 13) 82 #else 83 #define GET_RX_BUFFER_DESC_TOTAL_LENGTH_8723D(__pRxStatusDesc) LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 15) 84 #endif 85 86 /*DWORD 1*/ 87 #define SET_RX_BUFFER_PHYSICAL_LOW_8723D(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE(__pRxStatusDesc+4, 0, 32, __Value) 88 89 /*DWORD 2*/ 90 #ifdef CONFIG_64BIT_DMA 91 #define SET_RX_BUFFER_PHYSICAL_HIGH_8723D(__pRxStatusDesc, __Value) SET_BITS_TO_LE_4BYTE(__pRxStatusDesc+8, 0, 32, __Value) 92 #else 93 #define SET_RX_BUFFER_PHYSICAL_HIGH_8723D(__pRxStatusDesc, __Value) 94 #endif 95 96 97 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI) 98 s32 rtl8723ds_init_recv_priv(PADAPTER padapter); 99 void rtl8723ds_free_recv_priv(PADAPTER padapter); 100 s32 rtl8723ds_recv_hdl(_adapter *padapter); 101 #endif 102 103 #ifdef CONFIG_USB_HCI 104 int rtl8723du_init_recv_priv(_adapter *padapter); 105 void rtl8723du_free_recv_priv(_adapter *padapter); 106 void rtl8723du_init_recvbuf(_adapter *padapter, struct recv_buf *precvbuf); 107 #endif 108 109 #ifdef CONFIG_PCI_HCI 110 s32 rtl8723de_init_recv_priv(PADAPTER padapter); 111 void rtl8723de_free_recv_priv(PADAPTER padapter); 112 #endif 113 114 void rtl8723d_query_rx_desc_status(union recv_frame *precvframe, u8 *pdesc); 115 116 #endif /* __RTL8723D_RECV_H__ */ 117