xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8821cs/include/rtl8710b_recv.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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 __RTL8710B_RECV_H__
16 #define __RTL8710B_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 	#ifndef MAX_RECVBUF_SZ
24 		#ifdef CONFIG_MINIMAL_MEMORY_USAGE
25 			#define MAX_RECVBUF_SZ (4000) /* about 4K */
26 		#else
27 			#ifdef CONFIG_PLATFORM_MSTAR
28 				#define MAX_RECVBUF_SZ (8192) /* 8K */
29 				#elif defined(CONFIG_PLATFORM_HISILICON)
30 				#define MAX_RECVBUF_SZ (16384) /* 16k */
31 			#else
32 				#define MAX_RECVBUF_SZ (15360) /* 15k < 16k */
33 				/* #define MAX_RECVBUF_SZ (32768) */ /* 32k */
34 				/* #define MAX_RECVBUF_SZ (20480) */ /* 20K */
35 				/* #define MAX_RECVBUF_SZ (10240)  */ /* 10K */
36 				/* #define MAX_RECVBUF_SZ (16384) */ /* 16k - 92E RX BUF :16K */
37 			#endif
38 		#endif
39 	#endif /* !MAX_RECVBUF_SZ */
40 #endif
41 
42 /* Rx smooth factor */
43 #define	Rx_Smooth_Factor (20)
44 
45 /*-----------------------------------------------------------------*/
46 /*	RTL8710B RX BUFFER DESC                                      */
47 /*-----------------------------------------------------------------*/
48 /*DWORD 0*/
49 #define SET_RX_BUFFER_DESC_DATA_LENGTH_8710B(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 0, 14, __Value)
50 #define SET_RX_BUFFER_DESC_LS_8710B(__pRxStatusDesc, __Value)	SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 15, 1, __Value)
51 #define SET_RX_BUFFER_DESC_FS_8710B(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 16, 1, __Value)
52 #define SET_RX_BUFFER_DESC_TOTAL_LENGTH_8710B(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 16, 15, __Value)
53 
54 #define GET_RX_BUFFER_DESC_OWN_8710B(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 31, 1)
55 #define GET_RX_BUFFER_DESC_LS_8710B(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 15, 1)
56 #define GET_RX_BUFFER_DESC_FS_8710B(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 1)
57 #ifdef USING_RX_TAG
58 	#define GET_RX_BUFFER_DESC_RX_TAG_8710B(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 13)
59 #else
60 	#define GET_RX_BUFFER_DESC_TOTAL_LENGTH_8710B(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 15)
61 #endif
62 
63 /*DWORD 1*/
64 #define SET_RX_BUFFER_PHYSICAL_LOW_8710B(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc+4, 0, 32, __Value)
65 
66 /*DWORD 2*/
67 #ifdef CONFIG_64BIT_DMA
68 	#define SET_RX_BUFFER_PHYSICAL_HIGH_8710B(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc+8, 0, 32, __Value)
69 #else
70 	#define SET_RX_BUFFER_PHYSICAL_HIGH_8710B(__pRxStatusDesc, __Value)
71 #endif
72 
73 #ifdef CONFIG_USB_HCI
74 	int rtl8710bu_init_recv_priv(_adapter *padapter);
75 	void rtl8710bu_free_recv_priv(_adapter *padapter);
76 	void rtl8710bu_init_recvbuf(_adapter *padapter, struct recv_buf *precvbuf);
77 #endif
78 
79 void rtl8710b_query_rx_desc_status(union recv_frame *precvframe, u8 *pdesc);
80 
81 #endif /* __RTL8710B_RECV_H__ */
82