xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8723ds/include/rtl8192f_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 __RTL8192F_RECV_H__
16 #define __RTL8192F_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 		#ifndef CONFIG_MINIMAL_MEMORY_USAGE
26 			/* #define MAX_RECVBUF_SZ (32768) */ /* 32k */
27 			/* #define MAX_RECVBUF_SZ (16384) */ /* 16K */
28 			/* #define MAX_RECVBUF_SZ (10240) */ /* 10K */
29 			#ifdef CONFIG_PLATFORM_MSTAR
30 				#define MAX_RECVBUF_SZ (8192) /* 8K */
31 			#else
32 				#define MAX_RECVBUF_SZ (32768) /* 32k */
33 			#endif
34 			/* #define MAX_RECVBUF_SZ (8192+1024) */ /* 8K+1k */
35 		#else
36 			#define MAX_RECVBUF_SZ (4000) /* about 4K */
37 		#endif
38 	#endif /* !MAX_RECVBUF_SZ */
39 
40 #elif defined(CONFIG_PCI_HCI)
41 	#define MAX_RECVBUF_SZ (4000) /* about 4K */
42 
43 #elif defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
44 
45 	#define MAX_RECVBUF_SZ (RX_DMA_BOUNDARY_8192F + 1)
46 
47 #endif
48 
49 /* Rx smooth factor */
50 #define	Rx_Smooth_Factor (20)
51 
52 #ifdef CONFIG_SDIO_HCI
53 	#ifndef CONFIG_SDIO_RX_COPY
54 		#undef MAX_RECVBUF_SZ
55 		#define MAX_RECVBUF_SZ	(RX_DMA_SIZE_8192F - RX_DMA_RESERVED_SIZE_8192F)
56 	#endif /* !CONFIG_SDIO_RX_COPY */
57 #endif /* CONFIG_SDIO_HCI */
58 
59 /*-----------------------------------------------------------------*/
60 /*	RTL8192F RX BUFFER DESC                                      */
61 /*-----------------------------------------------------------------*/
62 /*DWORD 0*/
63 #define SET_RX_BUFFER_DESC_DATA_LENGTH_8192F(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 0, 14, __Value)
64 #define SET_RX_BUFFER_DESC_LS_8192F(__pRxStatusDesc, __Value)	SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 15, 1, __Value)
65 #define SET_RX_BUFFER_DESC_FS_8192F(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 16, 1, __Value)
66 #define SET_RX_BUFFER_DESC_TOTAL_LENGTH_8192F(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 16, 15, __Value)
67 
68 #define GET_RX_BUFFER_DESC_OWN_8192F(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 31, 1)
69 #define GET_RX_BUFFER_DESC_LS_8192F(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 15, 1)
70 #define GET_RX_BUFFER_DESC_FS_8192F(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 1)
71 #ifdef USING_RX_TAG
72 	#define GET_RX_BUFFER_DESC_RX_TAG_8192F(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 13)
73 #else
74 	#define GET_RX_BUFFER_DESC_TOTAL_LENGTH_8192F(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 15)
75 #endif
76 
77 /*DWORD 1*/
78 #define SET_RX_BUFFER_PHYSICAL_LOW_8192F(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc+4, 0, 32, __Value)
79 
80 /*DWORD 2*/
81 #ifdef CONFIG_64BIT_DMA
82 	#define SET_RX_BUFFER_PHYSICAL_HIGH_8192F(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc+8, 0, 32, __Value)
83 #else
84 	#define SET_RX_BUFFER_PHYSICAL_HIGH_8192F(__pRxStatusDesc, __Value)
85 #endif
86 
87 
88 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
89 	s32 rtl8192fs_init_recv_priv(PADAPTER padapter);
90 	void rtl8192fs_free_recv_priv(PADAPTER padapter);
91 	s32 rtl8192fs_recv_hdl(_adapter *padapter);
92 #endif
93 
94 #ifdef CONFIG_USB_HCI
95 	int rtl8192fu_init_recv_priv(_adapter *padapter);
96 	void rtl8192fu_free_recv_priv(_adapter *padapter);
97 	void rtl8192fu_init_recvbuf(_adapter *padapter, struct recv_buf *precvbuf);
98 #endif
99 
100 #ifdef CONFIG_PCI_HCI
101 	s32 rtl8192fe_init_recv_priv(_adapter *padapter);
102 	void rtl8192fe_free_recv_priv(_adapter *padapter);
103 #endif
104 
105 void rtl8192f_query_rx_desc_status(union recv_frame *precvframe, u8 *pdesc);
106 
107 #endif /* __RTL8192F_RECV_H__ */
108