xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852be/phl/custom/phl_custom_fb.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /******************************************************************************
2  *
3  * Copyright(c) 2019 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 _PHL_CUSTOM_FB_H_
16 #define _PHL_CUSTOM_FB_H_
17 
18 #ifdef CONFIG_PHL_CUSTOM_FEATURE_FB
19 #define TX_PKT_CYCLE (10)
20 
21 #define	FC_QOS_BIT			BIT7
22 #define GET_80211_HDR_TO_DS(_hdr)	LE_BITS_TO_2BYTE(_hdr, 8, 1)
23 #define GET_80211_HDR_FROM_DS(_hdr)	LE_BITS_TO_2BYTE(_hdr, 9, 1)
24 #define GET_80211_HDR_WEP(_hdr)		LE_BITS_TO_2BYTE(_hdr, 14, 1)
25 #define GET_80211_HDR_ORDER(_hdr)	LE_BITS_TO_2BYTE(_hdr, 15, 1)
26 #define IS_DATA_FRAME(pdu)		( ((EF1Byte(pdu[0]) & 0x0C)==0x08) ? TRUE : FALSE )
27 #define	IS_QOS_DATA_FRAME(pdu)		(IS_DATA_FRAME(pdu) && (EF1Byte(pdu[0]) & FC_QOS_BIT) )
28 
29 enum _fackbook_test_mode {
30 	FB_TEST_MODE_FAKE_TX_CYCLE = BIT0,
31 	FB_TEST_MODE_USE_STA_MAC = BIT1,
32 };
33 
34 struct _facebook_init_param {
35 	u32 enable;
36 	u32 test_mode;
37 	struct rtw_wifi_role_t *wifi_role;
38 };
39 
40 struct _facebook_bcn_param {
41 	u32 enable;
42 	u8 cus_wmode;
43 };
44 struct _custom_facebook_ctx {
45 	struct _facebook_init_param init;
46 	struct _facebook_bcn_param bcn_param;
47 };
48 
49 enum phl_mdl_ret_code
50 phl_custom_hdl_fb_evt(void* dispr,
51                       void* custom_ctx,
52                       struct _custom_facebook_ctx* fb_ctx,
53                       struct phl_msg* msg);
54 enum phl_mdl_ret_code
55 phl_custom_hdl_fb_fail_evt(void* dispr,
56                            void* custom_ctx,
57                            struct _custom_facebook_ctx* fb_ctx,
58                            struct phl_msg* msg);
59 
60 enum phl_mdl_ret_code
61 phl_custom_fb_update_opt_ie(void* dispr,
62                             void* custom_ctx,
63                             struct _custom_facebook_ctx* fb_ctx,
64                             struct phl_module_op_info* info);
65 
66 enum phl_mdl_ret_code
67 phl_custom_fb_set_role_cap(void* dispr,
68                            void* custom_ctx,
69                            struct _custom_facebook_ctx* fb_ctx,
70                            struct phl_module_op_info* info);
71 
72 enum rtw_phl_status
73 phl_custom_fb_init_role_cap(struct phl_info_t *phl_info,
74                             u8 hw_band,
75                             struct role_cap_t *role_cap);
76 #else
77 #define phl_custom_fb_update_opt_ie(_dispr, _ctx, _fb_ctx, _info) (MDL_RET_SUCCESS)
78 #define phl_custom_fb_set_role_cap(_dispr, _ctx, _fb_ctx, _info) (RTW_PHL_STATUS_SUCCESS)
79 #define phl_custom_fb_init_role_cap(_phl_info, _hw_band, _role_cap) (RTW_PHL_STATUS_SUCCESS)
80 #endif
81 
82 #endif  /*_PHL_CUSTOMIZE_FEATURE_H_*/
83 
84