1 /******************************************************************************
3 * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
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.
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
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 ******************************************************************************/
20 #ifndef __RTL8723A_CMD_H__
21 #define __RTL8723A_CMD_H__
24 #define H2C_8723A_BT_FW_PATCH_LEN 3
25 #define H2C_BT_PWR_FORCE_LEN 3
27 enum cmd_msg_element_id
37 MACID_PS_MODE_EID = 7,
38 P2P_PS_OFFLOAD_EID = 8,
39 SELECTIVE_SUSPEND_ROF_CMD = 9,
40 BT_QUEUE_PKT_EID = 17,
43 P2P_PS_CTW_CMD_EID = 32,
44 FORCE_BT_TX_PWR_EID = 33,
45 SET_TDMA_WLAN_ACT_TIME_EID = 34,
46 SET_BT_TX_RETRY_INDEX_EID = 35,
47 HID_PROFILE_ENABLE_EID = 36,
48 BT_IGNORE_WLAN_ACT_EID = 37,
49 BT_PTA_MANAGER_UPDATE_ENABLE_EID = 38,
50 DAC_SWING_VALUE_EID = 41,
51 TRADITIONAL_TDMA_EN_EID = 51,
52 H2C_8723A_BT_FW_PATCH = 54,
56 H2C_8723A_RESET_TSF = 75,
66 typedef struct _SETPWRMODE_PARM
70 u8 AwakeInterval; // unit: beacon interval
76 u8 PSAllowBTHighPriority:1;
79 #define SETPM_LOWRXBCN BIT(0)
80 #define SETPM_AUTOANTSWITCH BIT(1)
81 #define SETPM_PSALLOWBTHIGHPRI BIT(2)
84 }__attribute__((__packed__)) SETPWRMODE_PARM, *PSETPWRMODE_PARM;
86 struct H2C_SS_RFOFF_PARAM{
87 u8 ROFOn; // 1: on, 0:off
88 u16 gpio_period; // unit: 1024 us
89 }__attribute__ ((packed));
92 typedef struct JOINBSSRPT_PARM_8723A{
93 u8 OpMode; // RT_MEDIA_STATUS
94 }JOINBSSRPT_PARM_8723A, *PJOINBSSRPT_PARM_8723A;
96 typedef struct _RSVDPAGE_LOC_8723A {
102 } RSVDPAGE_LOC_8723A, *PRSVDPAGE_LOC_8723A;
106 typedef struct _B_TYPE_TDMA_PARM
110 u8 FixAntennaInBTSide:1;
112 u8 val870:1; // value of 870, when disable
115 u8 WlanHighPriority:1;
118 #define B_TDMA_EN BIT(0)
119 #define B_TDMA_FIXANTINBT BIT(1)
120 #define B_TDMA_TXPSPOLL BIT(2)
121 #define B_TDMA_VAL870 BIT(3)
122 #define B_TDMA_AUTOWAKEUP BIT(4)
123 #define B_TDMA_NOPS BIT(5)
124 #define B_TDMA_WLANHIGHPRI BIT(6)
131 }__attribute__((__packed__)) B_TYPE_TDMA_PARM, *PB_TYPE_TDMA_PARM;
133 typedef struct _SCAN_EN_PARM {
140 }__attribute__((__packed__)) SCAN_EN_PARM, *PSCAN_EN_PARM;
143 #define SET_H2CCMD_BT_PWR_IDX(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT(__pH2CCmd, 0, 8, __Value)
147 #define SET_H2CCMD_BT_FW_PATCH_ENABLE(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 8, __Value)
148 #define SET_H2CCMD_BT_FW_PATCH_SIZE(__pH2CCmd, __Value) SET_BITS_TO_LE_2BYTE((__pH2CCmd)+1, 0, 16, __Value)
150 #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)
151 #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)
158 * byte1[6:0]= bcn count : how many bcn not recevied should return to old mechanism
159 * byte1[7] = enable : enable mechanism
160 * byte2=bcn period : bcn recv time of this AP, unit 32 us
161 * byte3= drop threshold : how many pkts be droped, rx dma should be release
162 * byte4 = max early period
163 * byte5 = max bcn timeout period
165 #define SET_H2CCMD_LOWPWR_LPS_BCN_COUNT(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 4, __Value)
166 #define SET_H2CCMD_LOWPWR_LPS_TB_BCN_THRESH(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 4, 3, __Value)
167 #define SET_H2CCMD_LOWPWR_LPS_ENABLE(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 7, 1, __Value)
168 #define SET_H2CCMD_LOWPWR_LPS_BCN_PERIOD(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+1, 0, 8, __Value)
169 #define SET_H2CCMD_LOWPWR_LPS_BCN_DROP_THRESH(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+2, 0, 8, __Value)
170 #define SET_H2CCMD_LOWPWR_LPS_MAX_EARLY_PERIOD(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+3, 0, 8, __Value)
171 #define SET_H2CCMD_LOWPWR_LPS_MAX_BCN_TO_PERIOD(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE_8BIT((__pH2CCmd)+4, 0, 8, __Value)
173 typedef struct _LOWPWR_LPS_PARM
176 u8 tb_bcn_threshold:3;
181 u8 max_bcn_timeout_period;
182 }__attribute__((__packed__)) LOWPWR_LPS_PARM, *PLOWPWR_LPS_PARM;
186 // host message to firmware cmd
187 void rtl8723a_set_FwPwrMode_cmd(PADAPTER padapter, u8 Mode);
188 void rtl8723a_set_FwJoinBssReport_cmd(PADAPTER padapter, u8 mstatus);
189 #ifdef CONFIG_BT_COEXIST
190 void rtl8723a_set_BTCoex_AP_mode_FwRsvdPkt_cmd(PADAPTER padapter);
192 u8 rtl8192c_set_rssi_cmd(PADAPTER padapter, u8 *param);
193 //u8 rtl8723a_set_rssi_cmd(PADAPTER padapter, u8 *param);
194 void rtl8192c_set_raid_cmd(PADAPTER padapter, u32 mask, u8* arg);
195 //u8 rtl8723a_set_raid_cmd(PADAPTER padapter, u32 mask, u8 arg);
196 void rtl8192c_Add_RateATid(PADAPTER padapter, u32 bitmap, u8* arg, u8 rssi_level);
197 //void rtl8723a_Add_RateATid(PADAPTER padapter, u32 bitmap, u8 arg);
198 u8 rtl8192c_set_FwSelectSuspend_cmd(PADAPTER padapter, u8 bfwpoll, u16 period);
199 //u8 rtl8723a_set_FwSelectSuspend_cmd(PADAPTER padapter, u8 bfwpoll, u16 period);
202 void rtl8192c_set_p2p_ps_offload_cmd(PADAPTER padapter, u8 p2p_ps_state);
203 //void rtl8723a_set_p2p_ps_offload_cmd(PADAPTER padapter, u8 p2p_ps_state);
206 void CheckFwRsvdPageContent(PADAPTER padapter);
210 #ifdef CONFIG_TSF_RESET_OFFLOAD
211 u8 rtl8723c_reset_tsf(_adapter *padapter, u8 reset_port);
212 #endif // CONFIG_TSF_RESET_OFFLOAD
214 s32 FillH2CCmd(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer);