• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
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 __RTL8723A_CMD_H__
16 #define __RTL8723A_CMD_H__
17 
18 
19 #define H2C_BT_FW_PATCH_LEN		3
20 #define H2C_BT_PWR_FORCE_LEN		3
21 
22 enum cmd_msg_element_id
23 {
24 	NONE_CMDMSG_EID,
25 	AP_OFFLOAD_EID = 0,
26 	SET_PWRMODE_EID = 1,
27 	JOINBSS_RPT_EID = 2,
28 	RSVD_PAGE_EID = 3,
29 	RSSI_4_EID = 4,
30 	RSSI_SETTING_EID = 5,
31 	MACID_CONFIG_EID = 6,
32 	MACID_PS_MODE_EID = 7,
33 	P2P_PS_OFFLOAD_EID = 8,
34 	SELECTIVE_SUSPEND_ROF_CMD = 9,
35 	BT_QUEUE_PKT_EID = 17,
36 	BT_ANT_TDMA_EID = 20,
37 	BT_2ANT_HID_EID = 21,
38 	P2P_PS_CTW_CMD_EID = 32,
39 	FORCE_BT_TX_PWR_EID = 33,
40 	SET_TDMA_WLAN_ACT_TIME_EID = 34,
41 	SET_BT_TX_RETRY_INDEX_EID = 35,
42 	HID_PROFILE_ENABLE_EID = 36,
43 	BT_IGNORE_WLAN_ACT_EID = 37,
44 	BT_PTA_MANAGER_UPDATE_ENABLE_EID = 38,
45 	DAC_SWING_VALUE_EID = 41,
46 	TRADITIONAL_TDMA_EN_EID = 51,
47 	H2C_BT_FW_PATCH = 54,
48 	B_TYPE_TDMA_EID = 58,
49 	SCAN_EN_EID = 59,
50 	LOWPWR_LPS_EID = 71,
51 	H2C_RESET_TSF = 75,
52 	MAX_CMDMSG_EID
53 };
54 
55 struct cmd_msg_parm {
56 	u8 eid; /* element id */
57 	u8 sz; /*  sz */
58 	u8 buf[6];
59 };
60 
61 struct setpwrmode_parm {
62 	u8 Mode;
63 	u8 SmartPS;
64 	u8 AwakeInterval;	/*  unit: beacon interval */
65 	u8 bAllQueueUAPSD;
66 
67 #define SETPM_LOWRXBCN			BIT(0)
68 #define SETPM_AUTOANTSWITCH		BIT(1)
69 #define SETPM_PSALLOWBTHIGHPRI	BIT(2)
70 	u8 BcnAntMode;
71 } __packed;
72 
73 struct H2C_SS_RFOFF_PARAM{
74 	u8 ROFOn; /*  1: on, 0:off */
75 	u16 gpio_period; /*  unit: 1024 us */
76 }__attribute__ ((packed));
77 
78 
79 struct joinbssrpt_parm {
80 	u8 OpMode;	/*  enum rt_media_status */
81 };
82 
83 struct rsvdpage_loc {
84 	u8 LocProbeRsp;
85 	u8 LocPsPoll;
86 	u8 LocNullData;
87 	u8 LocQosNull;
88 	u8 LocBTQosNull;
89 };
90 
91 struct P2P_PS_Offload_t {
92 	u8 Offload_En:1;
93 	u8 role:1; /*  1: Owner, 0: Client */
94 	u8 CTWindow_En:1;
95 	u8 NoA0_En:1;
96 	u8 NoA1_En:1;
97 	u8 AllStaSleep:1; /*  Only valid in Owner */
98 	u8 discovery:1;
99 	u8 rsvd:1;
100 };
101 
102 struct P2P_PS_CTWPeriod_t {
103 	u8 CTWPeriod;	/* TU */
104 };
105 
106 #define B_TDMA_EN			BIT(0)
107 #define B_TDMA_FIXANTINBT		BIT(1)
108 #define B_TDMA_TXPSPOLL			BIT(2)
109 #define B_TDMA_VAL870			BIT(3)
110 #define B_TDMA_AUTOWAKEUP		BIT(4)
111 #define B_TDMA_NOPS			BIT(5)
112 #define B_TDMA_WLANHIGHPRI		BIT(6)
113 
114 struct b_type_tdma_parm {
115 	u8 option;
116 
117 	u8 TBTTOnPeriod;
118 	u8 MedPeriod;
119 	u8 rsvd30;
120 } __packed;
121 
122 struct scan_en_parm {
123 	u8 En;
124 } __packed;
125 
126 /*  BT_PWR */
127 #define SET_H2CCMD_BT_PWR_IDX(__pH2CCmd, __Value)							SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd, 0, 8, __Value)
128 
129 /*  BT_FW_PATCH */
130 #define SET_H2CCMD_BT_FW_PATCH_ENABLE(__pH2CCmd, __Value)					SET_BITS_TO_LE_4BYTE(__pH2CCmd, 0, 8, __Value) /*	SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 8, __Value) */
131 #define SET_H2CCMD_BT_FW_PATCH_SIZE(__pH2CCmd, __Value)						SET_BITS_TO_LE_4BYTE(__pH2CCmd, 8, 16, __Value) /*	SET_BITS_TO_LE_2BYTE((__pH2CCmd)+1, 0, 16, __Value) */
132 
133 struct lowpwr_lps_parm{
134 	u8 bcn_count:4;
135 	u8 tb_bcn_threshold:3;
136 	u8 enable:1;
137 	u8 bcn_interval;
138 	u8 drop_threshold;
139 	u8 max_early_period;
140 	u8 max_bcn_timeout_period;
141 } __packed;
142 
143 
144 /*  host message to firmware cmd */
145 void rtl8723a_set_FwPwrMode_cmd(struct rtw_adapter *padapter, u8 Mode);
146 void rtl8723a_set_FwJoinBssReport_cmd(struct rtw_adapter *padapter, u8 mstatus);
147 #ifdef CONFIG_8723AU_BT_COEXIST
148 void rtl8723a_set_BTCoex_AP_mode_FwRsvdPkt_cmd(struct rtw_adapter *padapter);
149 #else
150 #define rtl8723a_set_BTCoex_AP_mode_FwRsvdPkt_cmd(padapter) do {} while(0)
151 #endif
152 int rtl8723a_set_rssi_cmd(struct rtw_adapter *padapter, u8 *param);
153 int rtl8723a_set_raid_cmd(struct rtw_adapter *padapter, u32 mask, u8 arg);
154 void rtl8723a_add_rateatid(struct rtw_adapter *padapter, u32 bitmap, u8 arg, u8 rssi_level);
155 
156 int FillH2CCmd(struct rtw_adapter *padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer);
157 
158 #endif
159