1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright(c) 2009-2012  Realtek Corporation.*/
3 
4 #ifndef __RTL92C__FW__H__
5 #define __RTL92C__FW__H__
6 
7 #define FW_8192C_SIZE					0x3000
8 #define FW_8192C_START_ADDRESS			0x1000
9 #define FW_8192C_END_ADDRESS			0x3FFF
10 #define FW_8192C_PAGE_SIZE				4096
11 #define FW_8192C_POLLING_DELAY			5
12 
13 #define IS_FW_HEADER_EXIST(_pfwhdr)	\
14 	((_pfwhdr->signature&0xFFFF) == 0x2300 ||\
15 	(_pfwhdr->signature&0xFFFF) == 0x2301 ||\
16 	(_pfwhdr->signature&0xFFFF) == 0x2302)
17 
18 #define pagenum_128(_len)	(u32)(((_len)>>7) + ((_len)&0x7F ? 1 : 0))
19 
20 #define SET_H2CCMD_PWRMODE_PARM_MODE(__ph2ccmd, __val)			\
21 	SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val)
22 #define SET_H2CCMD_PWRMODE_PARM_SMART_PS(__ph2ccmd, __val)		\
23 	SET_BITS_TO_LE_1BYTE((__ph2ccmd)+1, 0, 8, __val)
24 #define SET_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(__ph2ccmd, __val)	\
25 	SET_BITS_TO_LE_1BYTE((__ph2ccmd)+2, 0, 8, __val)
26 #define SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(__ph2ccmd, __val)		\
27 	SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val)
28 #define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__ph2ccmd, __val)		\
29 	SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val)
30 #define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__ph2ccmd, __val)		\
31 	SET_BITS_TO_LE_1BYTE((__ph2ccmd)+1, 0, 8, __val)
32 #define SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__ph2ccmd, __val)		\
33 	SET_BITS_TO_LE_1BYTE((__ph2ccmd)+2, 0, 8, __val)
34 
35 void rtl8723e_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id,
36 			   u32 cmd_len, u8 *p_cmdbuffer);
37 void rtl8723e_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode);
38 void rtl8723e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished);
39 void rtl8723e_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus);
40 void rtl8723e_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state);
41 #endif
42