xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8189fs/include/rtl8192f_recv.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2017 Realtek Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  *****************************************************************************/
16 #ifndef __RTL8192F_RECV_H__
17 #define __RTL8192F_RECV_H__
18 
19 #define RECV_BLK_SZ 512
20 #define RECV_BLK_CNT 16
21 #define RECV_BLK_TH RECV_BLK_CNT
22 
23 #if defined(CONFIG_USB_HCI)
24 
25 	#ifndef MAX_RECVBUF_SZ
26 		#ifndef CONFIG_MINIMAL_MEMORY_USAGE
27 			/* #define MAX_RECVBUF_SZ (32768) */ /* 32k */
28 			/* #define MAX_RECVBUF_SZ (16384) */ /* 16K */
29 			/* #define MAX_RECVBUF_SZ (10240) */ /* 10K */
30 			#ifdef CONFIG_PLATFORM_MSTAR
31 				#define MAX_RECVBUF_SZ (8192) /* 8K */
32 			#else
33 				#define MAX_RECVBUF_SZ (32768) /* 32k */
34 			#endif
35 			/* #define MAX_RECVBUF_SZ (8192+1024) */ /* 8K+1k */
36 		#else
37 			#define MAX_RECVBUF_SZ (4000) /* about 4K */
38 		#endif
39 	#endif /* !MAX_RECVBUF_SZ */
40 
41 #elif defined(CONFIG_PCI_HCI)
42 	#define MAX_RECVBUF_SZ (4000) /* about 4K */
43 
44 #elif defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
45 
46 	#define MAX_RECVBUF_SZ (RX_DMA_BOUNDARY_8192F + 1)
47 
48 #endif
49 
50 /* Rx smooth factor */
51 #define	Rx_Smooth_Factor (20)
52 
53 #ifdef CONFIG_SDIO_HCI
54 	#ifndef CONFIG_SDIO_RX_COPY
55 		#undef MAX_RECVBUF_SZ
56 		#define MAX_RECVBUF_SZ	(RX_DMA_SIZE_8192F - RX_DMA_RESERVED_SIZE_8192F)
57 	#endif /* !CONFIG_SDIO_RX_COPY */
58 #endif /* CONFIG_SDIO_HCI */
59 
60 /*-----------------------------------------------------------------*/
61 /*	RTL8192F RX BUFFER DESC                                      */
62 /*-----------------------------------------------------------------*/
63 /*DWORD 0*/
64 #define SET_RX_BUFFER_DESC_DATA_LENGTH_8192F(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 0, 14, __Value)
65 #define SET_RX_BUFFER_DESC_LS_8192F(__pRxStatusDesc, __Value)	SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 15, 1, __Value)
66 #define SET_RX_BUFFER_DESC_FS_8192F(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 16, 1, __Value)
67 #define SET_RX_BUFFER_DESC_TOTAL_LENGTH_8192F(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc, 16, 15, __Value)
68 
69 #define GET_RX_BUFFER_DESC_OWN_8192F(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 31, 1)
70 #define GET_RX_BUFFER_DESC_LS_8192F(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 15, 1)
71 #define GET_RX_BUFFER_DESC_FS_8192F(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 1)
72 #ifdef USING_RX_TAG
73 	#define GET_RX_BUFFER_DESC_RX_TAG_8192F(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 13)
74 #else
75 	#define GET_RX_BUFFER_DESC_TOTAL_LENGTH_8192F(__pRxStatusDesc)		LE_BITS_TO_4BYTE(__pRxStatusDesc, 16, 15)
76 #endif
77 
78 /*DWORD 1*/
79 #define SET_RX_BUFFER_PHYSICAL_LOW_8192F(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc+4, 0, 32, __Value)
80 
81 /*DWORD 2*/
82 #ifdef CONFIG_64BIT_DMA
83 	#define SET_RX_BUFFER_PHYSICAL_HIGH_8192F(__pRxStatusDesc, __Value)		SET_BITS_TO_LE_4BYTE(__pRxStatusDesc+8, 0, 32, __Value)
84 #else
85 	#define SET_RX_BUFFER_PHYSICAL_HIGH_8192F(__pRxStatusDesc, __Value)
86 #endif
87 
88 
89 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
90 	s32 rtl8192fs_init_recv_priv(PADAPTER padapter);
91 	void rtl8192fs_free_recv_priv(PADAPTER padapter);
92 	s32 rtl8192fs_recv_hdl(_adapter *padapter);
93 #endif
94 
95 #ifdef CONFIG_USB_HCI
96 	int rtl8192fu_init_recv_priv(_adapter *padapter);
97 	void rtl8192fu_free_recv_priv(_adapter *padapter);
98 	void rtl8192fu_init_recvbuf(_adapter *padapter, struct recv_buf *precvbuf);
99 #endif
100 
101 #ifdef CONFIG_PCI_HCI
102 	s32 rtl8192fe_init_recv_priv(_adapter *padapter);
103 	void rtl8192fe_free_recv_priv(_adapter *padapter);
104 #endif
105 
106 void rtl8192f_query_rx_desc_status(union recv_frame *precvframe, u8 *pdesc);
107 
108 #endif /* __RTL8192F_RECV_H__ */
109