net: wireless: rockchip_wlan: add rtl8723cs support
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8723cs / include / rtl8188e_cmd.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 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  * 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
17  *
18  *
19  ******************************************************************************/
20 #ifndef __RTL8188E_CMD_H__
21 #define __RTL8188E_CMD_H__
22
23 #if 0
24 enum cmd_msg_element_id {
25         NONE_CMDMSG_EID,
26         AP_OFFLOAD_EID = 0,
27         SET_PWRMODE_EID = 1,
28         JOINBSS_RPT_EID = 2,
29         RSVD_PAGE_EID = 3,
30         RSSI_4_EID = 4,
31         RSSI_SETTING_EID = 5,
32         MACID_CONFIG_EID = 6,
33         MACID_PS_MODE_EID = 7,
34         P2P_PS_OFFLOAD_EID = 8,
35         SELECTIVE_SUSPEND_ROF_CMD = 9,
36         P2P_PS_CTW_CMD_EID = 32,
37         MAX_CMDMSG_EID
38 };
39 #else
40 typedef enum _RTL8188E_H2C_CMD_ID {
41         /* Class Common */
42         H2C_COM_RSVD_PAGE                       = 0x00,
43         H2C_COM_MEDIA_STATUS_RPT        = 0x01,
44         H2C_COM_SCAN                                    = 0x02,
45         H2C_COM_KEEP_ALIVE                      = 0x03,
46         H2C_COM_DISCNT_DECISION         = 0x04,
47 #ifndef CONFIG_WOWLAN
48         H2C_COM_WWLAN                           = 0x05,
49 #endif
50         H2C_COM_INIT_OFFLOAD                    = 0x06,
51         H2C_COM_REMOTE_WAKE_CTL = 0x07,
52         H2C_COM_AP_OFFLOAD                      = 0x08,
53         H2C_COM_BCN_RSVD_PAGE           = 0x09,
54         H2C_COM_PROB_RSP_RSVD_PAGE      = 0x0A,
55
56         /* Class PS */
57         H2C_PS_PWR_MODE                         = 0x20,
58         H2C_PS_TUNE_PARA                                = 0x21,
59         H2C_PS_TUNE_PARA_2                      = 0x22,
60         H2C_PS_LPS_PARA                         = 0x23,
61         H2C_PS_P2P_OFFLOAD                      = 0x24,
62
63         /* Class DM */
64         H2C_DM_MACID_CFG                                = 0x40,
65         H2C_DM_TXBF                                     = 0x41,
66         H2C_RSSI_REPORT                         = 0x42,
67         /* Class BT */
68         H2C_BT_COEX_MASK                                = 0x60,
69         H2C_BT_COEX_GPIO_MODE           = 0x61,
70         H2C_BT_DAC_SWING_VAL                    = 0x62,
71         H2C_BT_PSD_RST                          = 0x63,
72
73         /* Class Remote WakeUp */
74 #ifdef CONFIG_WOWLAN
75         H2C_COM_WWLAN                           = 0x80,
76         H2C_COM_REMOTE_WAKE_CTRL        = 0x81,
77         H2C_COM_AOAC_GLOBAL_INFO        = 0x82,
78         H2C_COM_AOAC_RSVD_PAGE          = 0x83,
79 #endif
80
81         /* Class */
82         /* H2C_RESET_TSF                                =0xc0, */
83 } RTL8188E_H2C_CMD_ID;
84
85 #endif
86
87
88 struct cmd_msg_parm {
89         u8 eid; /* element id */
90         u8 sz; /* sz */
91         u8 buf[6];
92 };
93
94 enum {
95         PWRS
96 };
97
98 typedef struct _SETPWRMODE_PARM {
99         u8 Mode;/* 0:Active,1:LPS,2:WMMPS */
100         /* u8 RLBM:4; */ /* 0:Min,1:Max,2: User define */
101         u8 SmartPS_RLBM;/* LPS=0:PS_Poll,1:PS_Poll,2:NullData,WMM=0:PS_Poll,1:NullData */
102         u8 AwakeInterval;       /* unit: beacon interval */
103         u8 bAllQueueUAPSD;
104         u8 PwrState;/* AllON(0x0c),RFON(0x04),RFOFF(0x00) */
105 } SETPWRMODE_PARM, *PSETPWRMODE_PARM;
106
107 struct H2C_SS_RFOFF_PARAM {
108         u8 ROFOn; /* 1: on, 0:off */
109         u16 gpio_period; /* unit: 1024 us */
110 } __attribute__((packed));
111
112
113 typedef struct JOINBSSRPT_PARM_88E {
114         u8 OpMode;      /* RT_MEDIA_STATUS */
115 #ifdef CONFIG_WOWLAN
116         u8 MacID;       /* MACID */
117 #endif /* CONFIG_WOWLAN */
118 } JOINBSSRPT_PARM_88E, *PJOINBSSRPT_PARM_88E;
119
120 #if 0
121 /* move to hal_com_h2c.h */
122 typedef struct _RSVDPAGE_LOC_88E {
123         u8 LocProbeRsp;
124         u8 LocPsPoll;
125         u8 LocNullData;
126         u8 LocQosNull;
127         u8 LocBTQosNull;
128 #ifdef CONFIG_WOWLAN
129         u8 LocRemoteCtrlInfo;
130         u8 LocArpRsp;
131         u8 LocNbrAdv;
132         u8 LocGTKRsp;
133         u8 LocGTKInfo;
134         u8 LocProbeReq;
135         u8 LocNetList;
136 #endif /* CONFIG_WOWLAN  */
137 } RSVDPAGE_LOC_88E, *PRSVDPAGE_LOC_88E;
138 #endif
139
140 /* host message to firmware cmd */
141 void rtl8188e_set_FwPwrMode_cmd(PADAPTER padapter, u8 Mode);
142 void rtl8188e_set_FwJoinBssReport_cmd(PADAPTER padapter, u8 mstatus);
143 u8 rtl8188e_set_rssi_cmd(PADAPTER padapter, u8 *param);
144 u8 rtl8188e_set_raid_cmd(_adapter *padapter, u32 bitmap, u8 *arg, u8 bw);
145 s32 FillH2CCmd_88E(PADAPTER padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer);
146 /* u8 rtl8192c_set_FwSelectSuspend_cmd(PADAPTER padapter, u8 bfwpoll, u16 period); */
147 u8 GetTxBufferRsvdPageNum8188E(_adapter *padapter, bool wowlan);
148
149
150 #ifdef CONFIG_P2P
151         void rtl8188e_set_p2p_ps_offload_cmd(PADAPTER padapter, u8 p2p_ps_state);
152 #endif /* CONFIG_P2P */
153
154 void CheckFwRsvdPageContent(PADAPTER padapter);
155
156 #ifdef CONFIG_TSF_RESET_OFFLOAD
157         /* u8 rtl8188e_reset_tsf(_adapter *padapter, u8 reset_port); */
158         int reset_tsf(PADAPTER Adapter, u8 reset_port);
159 #endif /* CONFIG_TSF_RESET_OFFLOAD */
160
161 /* #define H2C_8188E_RSVDPAGE_LOC_LEN      5 */
162 /* #define H2C_8188E_AOAC_RSVDPAGE_LOC_LEN 7 */
163
164 /* ---------------------------------------------------------------------------------------------------------
165  * ----------------------------------    H2C CMD CONTENT    --------------------------------------------------
166  * ---------------------------------------------------------------------------------------------------------
167  *   */
168 #if 0
169         /* move to hal_com_h2c.h
170         * _RSVDPAGE_LOC_CMD_0x00 */
171         #define SET_8188E_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__pH2CCmd, __Value)     SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 8, __Value)
172         #define SET_8188E_H2CCMD_RSVDPAGE_LOC_PSPOLL(__pH2CCmd, __Value)            SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 0, 8, __Value)
173         #define SET_8188E_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__pH2CCmd, __Value)     SET_BITS_TO_LE_1BYTE((__pH2CCmd)+2, 0, 8, __Value)
174         #define SET_8188E_H2CCMD_RSVDPAGE_LOC_QOS_NULL_DATA(__pH2CCmd, __Value)     SET_BITS_TO_LE_1BYTE((__pH2CCmd)+3, 0, 8, __Value)
175         /*  AOAC_RSVDPAGE_LOC_0x83 */
176         #define SET_8188E_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(__pH2CCmd, __Value)        SET_BITS_TO_LE_1BYTE((__pH2CCmd), 0, 8, __Value)
177         #define SET_8188E_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(__pH2CCmd, __Value)                  SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 0, 8, __Value)
178 #endif
179 #endif/* __RTL8188E_CMD_H__ */