1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 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 __RTL8192E_CMD_H__
21 #define __RTL8192E_CMD_H__
23 typedef enum _RTL8192E_H2C_CMD {
24 H2C_8192E_RSVDPAGE = 0x00,
25 H2C_8192E_MSRRPT = 0x01,
26 H2C_8192E_SCAN = 0x02,
27 H2C_8192E_KEEP_ALIVE_CTRL = 0x03,
28 H2C_8192E_DISCONNECT_DECISION = 0x04,
29 H2C_8192E_INIT_OFFLOAD = 0x06,
30 H2C_8192E_AP_OFFLOAD = 0x08,
31 H2C_8192E_BCN_RSVDPAGE = 0x09,
32 H2C_8192E_PROBERSP_RSVDPAGE = 0x0a,
34 H2C_8192E_AP_WOW_GPIO_CTRL = 0x13,
36 H2C_8192E_SETPWRMODE = 0x20,
37 H2C_8192E_PS_TUNING_PARA = 0x21,
38 H2C_8192E_PS_TUNING_PARA2 = 0x22,
39 H2C_8192E_PS_LPS_PARA = 0x23,
40 H2C_8192E_P2P_PS_OFFLOAD = 0x24,
41 H2C_8192E_SAP_PS = 0x26,
42 H2C_8192E_RA_MASK = 0x40,
43 H2C_8192E_RSSI_REPORT = 0x42,
44 H2C_8192E_RA_PARA_ADJUST = 0x46,
46 H2C_8192E_WO_WLAN = 0x80,
47 H2C_8192E_REMOTE_WAKE_CTRL = 0x81,
48 H2C_8192E_AOAC_GLOBAL_INFO = 0x82,
49 H2C_8192E_AOAC_RSVDPAGE = 0x83,
51 /* Not defined in new 88E H2C CMD Format */
52 H2C_8192E_SELECTIVE_SUSPEND_ROF_CMD,
53 H2C_8192E_P2P_PS_MODE,
59 u8 eid; /* element id */
68 typedef struct _SETPWRMODE_PARM {
69 u8 Mode;/* 0:Active,1:LPS,2:WMMPS */
70 /* u8 RLBM:4; */ /* 0:Min,1:Max,2: User define */
71 u8 SmartPS_RLBM;/* LPS=0:PS_Poll,1:PS_Poll,2:NullData,WMM=0:PS_Poll,1:NullData */
72 u8 AwakeInterval; /* unit: beacon interval */
74 u8 PwrState;/* AllON(0x0c),RFON(0x04),RFOFF(0x00) */
75 } SETPWRMODE_PARM, *PSETPWRMODE_PARM;
77 struct H2C_SS_RFOFF_PARAM {
78 u8 ROFOn; /* 1: on, 0:off */
79 u16 gpio_period; /* unit: 1024 us */
80 } __attribute__((packed));
83 typedef struct JOINBSSRPT_PARM_92E {
84 u8 OpMode; /* RT_MEDIA_STATUS */
87 #endif /* CONFIG_WOWLAN */
88 } JOINBSSRPT_PARM_92E, *PJOINBSSRPT_PARM_92E;
90 /* move to hal_com_h2c.h
91 typedef struct _RSVDPAGE_LOC_92E {
97 } RSVDPAGE_LOC_92E, *PRSVDPAGE_LOC_92E;
101 /* _SETPWRMODE_PARM */
102 #define SET_8192E_H2CCMD_PWRMODE_PARM_MODE(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 8, __Value)
103 #define SET_8192E_H2CCMD_PWRMODE_PARM_RLBM(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 0, 4, __Value)
104 #define SET_8192E_H2CCMD_PWRMODE_PARM_SMART_PS(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 4, 4, __Value)
105 #define SET_8192E_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd)+2, 0, 8, __Value)
106 #define SET_8192E_H2CCMD_PWRMODE_PARM_ALL_QUEUE_UAPSD(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd)+3, 0, 8, __Value)
107 #define SET_8192E_H2CCMD_PWRMODE_PARM_BCN_EARLY_C2H_RPT(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd)+3, 2, 1, __Value)
108 #define SET_8192E_H2CCMD_PWRMODE_PARM_PWR_STATE(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd)+4, 0, 8, __Value)
109 #define SET_8192E_H2CCMD_PWRMODE_PARM_BYTE5(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE((__pH2CCmd)+5, 0, 8, __Value)
110 #define GET_8192E_H2CCMD_PWRMODE_PARM_MODE(__pH2CCmd) LE_BITS_TO_1BYTE(__pH2CCmd, 0, 8)
112 /* _P2P_PS_OFFLOAD */
113 #define SET_8192E_H2CCMD_P2P_PS_OFFLOAD_ENABLE(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 1, __Value)
114 #define SET_8192E_H2CCMD_P2P_PS_OFFLOAD_ROLE(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 1, 1, __Value)
115 #define SET_8192E_H2CCMD_P2P_PS_OFFLOAD_CTWINDOW_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 2, 1, __Value)
116 #define SET_8192E_H2CCMD_P2P_PS_OFFLOAD_NOA0_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 3, 1, __Value)
117 #define SET_8192E_H2CCMD_P2P_PS_OFFLOAD_NOA1_EN(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 4, 1, __Value)
118 #define SET_8192E_H2CCMD_P2P_PS_OFFLOAD_ALLSTASLEEP(__pH2CCmd, __Value) SET_BITS_TO_LE_1BYTE(__pH2CCmd, 5, 1, __Value)
121 /* host message to firmware cmd */
122 void rtl8192e_set_FwPwrMode_cmd(PADAPTER padapter, u8 Mode);
123 void rtl8192e_set_FwJoinBssReport_cmd(PADAPTER padapter, u8 mstatus);
124 u8 rtl8192e_set_rssi_cmd(PADAPTER padapter, u8 *param);
125 void rtl8192e_set_raid_cmd(PADAPTER padapter, u32 bitmap, u8 *arg, u8 bw);
126 s32 FillH2CCmd_8192E(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer);
127 u8 GetTxBufferRsvdPageNum8192E(_adapter *padapter, bool wowlan);
128 /* u8 rtl8192c_set_FwSelectSuspend_cmd(PADAPTER padapter, u8 bfwpoll, u16 period); */
129 s32 c2h_handler_8192e(_adapter *adapter, u8 id, u8 seq, u8 plen, u8 *payload);
130 #ifdef CONFIG_BT_COEXIST
131 void rtl8192e_download_BTCoex_AP_mode_rsvd_page(PADAPTER padapter);
132 #endif /* CONFIG_BT_COEXIST */
134 void rtl8192e_set_p2p_ps_offload_cmd(PADAPTER padapter, u8 p2p_ps_state);
135 #endif /* CONFIG_P2P */
137 void CheckFwRsvdPageContent(PADAPTER padapter);
140 #ifdef CONFIG_TDLS_CH_SW
141 void rtl8192e_set_BcnEarly_C2H_Rpt_cmd(PADAPTER padapter, u8 enable);
145 #ifdef CONFIG_TSF_RESET_OFFLOAD
146 int reset_tsf(PADAPTER Adapter, u8 reset_port);
147 #endif /* CONFIG_TSF_RESET_OFFLOAD */
149 /* / TX Feedback Content */
150 #define USEC_UNIT_FOR_8192E_C2H_TX_RPT_QUEUE_TIME 256
152 #define GET_8192E_C2H_TX_RPT_QUEUE_SELECT(_Header) LE_BITS_TO_1BYTE((_Header + 0), 0, 5)
153 #define GET_8192E_C2H_TX_RPT_PKT_BROCAST(_Header) LE_BITS_TO_1BYTE((_Header + 0), 5, 1)
154 #define GET_8192E_C2H_TX_RPT_LIFE_TIME_OVER(_Header) LE_BITS_TO_1BYTE((_Header + 0), 6, 1)
155 #define GET_8192E_C2H_TX_RPT_RETRY_OVER(_Header) LE_BITS_TO_1BYTE((_Header + 0), 7, 1)
156 #define GET_8192E_C2H_TX_RPT_MAC_ID(_Header) LE_BITS_TO_1BYTE((_Header + 1), 0, 8)
157 #define GET_8192E_C2H_TX_RPT_DATA_RETRY_CNT(_Header) LE_BITS_TO_1BYTE((_Header + 2), 0, 6)
158 #define GET_8192E_C2H_TX_RPT_QUEUE_TIME(_Header) LE_BITS_TO_2BYTE((_Header + 3), 0, 16) /* In unit of 256 microseconds. */
159 #define GET_8192E_C2H_TX_RPT_FINAL_DATA_RATE(_Header) LE_BITS_TO_1BYTE((_Header + 5), 0, 8)
161 #endif /* __RTL8192E_CMD_H__ */