1#ifndef _WMI_API_H_
2#define _WMI_API_H_
3/*
4 * Copyright (c) 2004-2006 Atheros Communications Inc.
5 * All rights reserved.
6 *
7 * This file contains the definitions for the Wireless Module Interface (WMI).
8 *
9 * $Id: //depot/sw/releases/olca2.0-GPL/host/include/wmi_api.h#2 $
10 *
11 *
12 *  This program is free software; you can redistribute it and/or modify
13 *  it under the terms of the GNU General Public License version 2 as
14 *  published by the Free Software Foundation;
15 *
16 *  Software distributed under the License is distributed on an "AS
17 *  IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
18 *  implied. See the License for the specific language governing
19 *  rights and limitations under the License.
20 *
21 *
22 *
23 */
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/*
30 * IP QoS Field definitions according to 802.1p
31 */
32#define BEST_EFFORT_PRI         0
33#define BACKGROUND_PRI          1
34#define EXCELLENT_EFFORT_PRI    3
35#define CONTROLLED_LOAD_PRI     4
36#define VIDEO_PRI               5
37#define VOICE_PRI               6
38#define NETWORK_CONTROL_PRI     7
39#define MAX_NUM_PRI             8
40
41#define UNDEFINED_PRI           (0xff)
42
43/* simple mapping of IP TOS field to a WMI priority stream
44 * this mapping was taken from the original linux driver implementation
45 * The operation maps the following
46 *
47 *  */
48#define IP_TOS_TO_WMI_PRI(tos)  \
49    ((WMI_PRI_STREAM_ID)(((tos) >> 1) & 0x03))
50
51#define WMI_IMPLICIT_PSTREAM_INACTIVITY_INT 5000 /* 5 seconds */
52
53
54struct wmi_t;
55
56void *wmi_init(void *devt);
57
58void wmi_qos_state_init(struct wmi_t *wmip);
59void wmi_shutdown(struct wmi_t *wmip);
60A_UINT16  wmi_get_mapped_qos_queue(struct wmi_t *, A_UINT8);
61A_STATUS wmi_dix_2_dot3(struct wmi_t *wmip, void *osbuf);
62A_STATUS wmi_data_hdr_add(struct wmi_t *wmip, void *osbuf, A_UINT8 msgType);
63A_STATUS wmi_dot3_2_dix(struct wmi_t *wmip, void *osbuf);
64A_STATUS wmi_data_hdr_remove(struct wmi_t *wmip, void *osbuf);
65A_STATUS wmi_syncpoint(struct wmi_t *wmip);
66A_STATUS wmi_syncpoint_reset(struct wmi_t *wmip);
67WMI_PRI_STREAM_ID wmi_get_stream_id(struct wmi_t *wmip, A_UINT8 trafficClass);
68A_UINT8 wmi_implicit_create_pstream(struct wmi_t *wmip, void *osbuf, A_UINT8 dir, A_UINT8 up);
69
70A_STATUS wmi_control_rx(struct wmi_t *wmip, void *osbuf);
71void wmi_iterate_nodes(struct wmi_t *wmip, wlan_node_iter_func *f, void *arg);
72void wmi_free_allnodes(struct wmi_t *wmip);
73bss_t *wmi_find_node(struct wmi_t *wmip, const A_UINT8 *macaddr);
74
75
76typedef enum {
77    NO_SYNC_WMIFLAG = 0,
78    SYNC_BEFORE_WMIFLAG,            /* transmit all queued data before cmd */
79    SYNC_AFTER_WMIFLAG,             /* any new data waits until cmd execs */
80    SYNC_BOTH_WMIFLAG,
81    END_WMIFLAG                     /* end marker */
82} WMI_SYNC_FLAG;
83
84A_STATUS wmi_cmd_send(struct wmi_t *wmip, void *osbuf, WMI_COMMAND_ID cmdId,
85                      WMI_SYNC_FLAG flag);
86A_STATUS wmi_connect_cmd(struct wmi_t *wmip,
87                         NETWORK_TYPE netType,
88                         DOT11_AUTH_MODE dot11AuthMode,
89                         AUTH_MODE authMode,
90                         CRYPTO_TYPE pairwiseCrypto,
91                         A_UINT8 pairwiseCryptoLen,
92                         CRYPTO_TYPE groupCrypto,
93                         A_UINT8 groupCryptoLen,
94                         int ssidLength,
95                         A_UCHAR *ssid,
96                         A_UINT8 *bssid,
97                         A_UINT16 channel,
98                         A_UINT32 ctrl_flags);
99A_STATUS wmi_reconnect_cmd(struct wmi_t *wmip,
100                           A_UINT8 *bssid,
101                           A_UINT16 channel);
102A_STATUS wmi_disconnect_cmd(struct wmi_t *wmip);
103A_STATUS wmi_getrev_cmd(struct wmi_t *wmip);
104A_STATUS wmi_startscan_cmd(struct wmi_t *wmip, WMI_SCAN_TYPE scanType,
105                           A_BOOL forceFgScan, A_BOOL isLegacy,
106                           A_UINT32 homeDwellTime, A_UINT32 forceScanInterval);
107A_STATUS wmi_scanparams_cmd(struct wmi_t *wmip, A_UINT16 fg_start_sec,
108                            A_UINT16 fg_end_sec, A_UINT16 bg_sec,
109                            A_UINT16 minact_chdw_msec,
110                            A_UINT16 maxact_chdw_msec, A_UINT16 pas_chdw_msec,
111                            A_UINT8 shScanRatio, A_UINT8 scanCtrlFlags,
112                            A_UINT32 max_dfsch_act_time);
113A_STATUS wmi_bssfilter_cmd(struct wmi_t *wmip, A_UINT8 filter, A_UINT32 ieMask);
114A_STATUS wmi_probedSsid_cmd(struct wmi_t *wmip, A_UINT8 index, A_UINT8 flag,
115                            A_UINT8 ssidLength, A_UCHAR *ssid);
116A_STATUS wmi_listeninterval_cmd(struct wmi_t *wmip, A_UINT16 listenInterval, A_UINT16 listenBeacons);
117A_STATUS wmi_bmisstime_cmd(struct wmi_t *wmip, A_UINT16 bmisstime, A_UINT16 bmissbeacons);
118A_STATUS wmi_associnfo_cmd(struct wmi_t *wmip, A_UINT8 ieType,
119                           A_UINT8 ieLen, A_UINT8 *ieInfo);
120A_STATUS wmi_powermode_cmd(struct wmi_t *wmip, A_UINT8 powerMode);
121A_STATUS wmi_ibsspmcaps_cmd(struct wmi_t *wmip, A_UINT8 pmEnable, A_UINT8 ttl,
122                            A_UINT16 atim_windows, A_UINT16 timeout_value);
123A_STATUS wmi_pmparams_cmd(struct wmi_t *wmip, A_UINT16 idlePeriod,
124                           A_UINT16 psPollNum, A_UINT16 dtimPolicy);
125A_STATUS wmi_disctimeout_cmd(struct wmi_t *wmip, A_UINT8 timeout);
126A_STATUS wmi_sync_cmd(struct wmi_t *wmip, A_UINT8 syncNumber);
127A_STATUS wmi_create_pstream_cmd(struct wmi_t *wmip, WMI_CREATE_PSTREAM_CMD *pstream);
128A_STATUS wmi_delete_pstream_cmd(struct wmi_t *wmip, A_UINT8 trafficClass, A_UINT8 streamID);
129A_STATUS wmi_set_bitrate_cmd(struct wmi_t *wmip, A_INT32 rate);
130A_STATUS wmi_get_bitrate_cmd(struct wmi_t *wmip);
131A_INT8   wmi_validate_bitrate(struct wmi_t *wmip, A_INT32 rate);
132A_STATUS wmi_get_regDomain_cmd(struct wmi_t *wmip);
133A_STATUS wmi_get_channelList_cmd(struct wmi_t *wmip);
134A_STATUS wmi_set_channelParams_cmd(struct wmi_t *wmip, A_UINT8 scanParam,
135                                   WMI_PHY_MODE mode, A_INT8 numChan,
136                                   A_UINT16 *channelList);
137
138A_STATUS wmi_set_snr_threshold_params(struct wmi_t *wmip,
139                                       WMI_SNR_THRESHOLD_PARAMS_CMD *snrCmd);
140A_STATUS wmi_set_rssi_threshold_params(struct wmi_t *wmip,
141                                        WMI_RSSI_THRESHOLD_PARAMS_CMD *rssiCmd);
142A_STATUS wmi_clr_rssi_snr(struct wmi_t *wmip);
143A_STATUS wmi_set_lq_threshold_params(struct wmi_t *wmip,
144                                      WMI_LQ_THRESHOLD_PARAMS_CMD *lqCmd);
145A_STATUS wmi_set_rts_cmd(struct wmi_t *wmip, A_UINT16 threshold);
146A_STATUS wmi_set_lpreamble_cmd(struct wmi_t *wmip, A_UINT8 status);
147
148A_STATUS wmi_set_error_report_bitmask(struct wmi_t *wmip, A_UINT32 bitmask);
149
150A_STATUS wmi_get_challenge_resp_cmd(struct wmi_t *wmip, A_UINT32 cookie,
151                                    A_UINT32 source);
152A_STATUS wmi_config_debug_module_cmd(struct wmi_t *wmip, A_UINT16 mmask,
153                                     A_UINT16 tsr, A_BOOL rep, A_UINT16 size,
154                                     A_UINT32 valid);
155A_STATUS wmi_get_stats_cmd(struct wmi_t *wmip);
156A_STATUS wmi_addKey_cmd(struct wmi_t *wmip, A_UINT8 keyIndex,
157                        CRYPTO_TYPE keyType, A_UINT8 keyUsage,
158                        A_UINT8 keyLength,A_UINT8 *keyRSC,
159                        A_UINT8 *keyMaterial, A_UINT8 key_op_ctrl,
160                        WMI_SYNC_FLAG sync_flag);
161A_STATUS wmi_add_krk_cmd(struct wmi_t *wmip, A_UINT8 *krk);
162A_STATUS wmi_delete_krk_cmd(struct wmi_t *wmip);
163A_STATUS wmi_deleteKey_cmd(struct wmi_t *wmip, A_UINT8 keyIndex);
164A_STATUS wmi_set_akmp_params_cmd(struct wmi_t *wmip,
165                                 WMI_SET_AKMP_PARAMS_CMD *akmpParams);
166A_STATUS wmi_get_pmkid_list_cmd(struct wmi_t *wmip);
167A_STATUS wmi_set_pmkid_list_cmd(struct wmi_t *wmip,
168                                WMI_SET_PMKID_LIST_CMD *pmkInfo);
169A_STATUS wmi_set_txPwr_cmd(struct wmi_t *wmip, A_UINT8 dbM);
170A_STATUS wmi_get_txPwr_cmd(struct wmi_t *wmip);
171A_STATUS wmi_switch_radio(struct wmi_t *wmip, A_UINT8 on);
172A_STATUS wmi_addBadAp_cmd(struct wmi_t *wmip, A_UINT8 apIndex, A_UINT8 *bssid);
173A_STATUS wmi_deleteBadAp_cmd(struct wmi_t *wmip, A_UINT8 apIndex);
174A_STATUS wmi_set_tkip_countermeasures_cmd(struct wmi_t *wmip, A_BOOL en);
175A_STATUS wmi_setPmkid_cmd(struct wmi_t *wmip, A_UINT8 *bssid, A_UINT8 *pmkId,
176                          A_BOOL set);
177A_STATUS wmi_set_access_params_cmd(struct wmi_t *wmip, A_UINT16 txop,
178                                   A_UINT8 eCWmin, A_UINT8 eCWmax,
179                                   A_UINT8 aifsn);
180A_STATUS wmi_set_retry_limits_cmd(struct wmi_t *wmip, A_UINT8 frameType,
181                                  A_UINT8 trafficClass, A_UINT8 maxRetries,
182                                  A_UINT8 enableNotify);
183
184void wmi_get_current_bssid(struct wmi_t *wmip, A_UINT8 *bssid);
185
186A_STATUS wmi_get_roam_tbl_cmd(struct wmi_t *wmip);
187A_STATUS wmi_get_roam_data_cmd(struct wmi_t *wmip, A_UINT8 roamDataType);
188A_STATUS wmi_set_roam_ctrl_cmd(struct wmi_t *wmip, WMI_SET_ROAM_CTRL_CMD *p,
189                               A_UINT8 size);
190A_STATUS wmi_set_powersave_timers_cmd(struct wmi_t *wmip,
191                            WMI_POWERSAVE_TIMERS_POLICY_CMD *pCmd,
192                            A_UINT8 size);
193
194A_STATUS wmi_set_opt_mode_cmd(struct wmi_t *wmip, A_UINT8 optMode);
195A_STATUS wmi_opt_tx_frame_cmd(struct wmi_t *wmip,
196                              A_UINT8 frmType,
197                              A_UINT8 *dstMacAddr,
198                              A_UINT8 *bssid,
199                              A_UINT16 optIEDataLen,
200                              A_UINT8 *optIEData);
201
202A_STATUS wmi_set_adhoc_bconIntvl_cmd(struct wmi_t *wmip, A_UINT16 intvl);
203A_STATUS wmi_set_voice_pkt_size_cmd(struct wmi_t *wmip, A_UINT16 voicePktSize);
204A_STATUS wmi_set_max_sp_len_cmd(struct wmi_t *wmip, A_UINT8 maxSpLen);
205A_UINT8  convert_userPriority_to_trafficClass(A_UINT8 userPriority);
206A_UINT8 wmi_get_power_mode_cmd(struct wmi_t *wmip);
207A_STATUS wmi_verify_tspec_params(WMI_CREATE_PSTREAM_CMD *pCmd, A_BOOL tspecCompliance);
208
209#ifdef CONFIG_HOST_TCMD_SUPPORT
210A_STATUS wmi_test_cmd(struct wmi_t *wmip, A_UINT8 *buf, A_UINT32  len);
211#endif
212
213A_STATUS wmi_set_bt_status_cmd(struct wmi_t *wmip, A_UINT8 streamType, A_UINT8 status);
214A_STATUS wmi_set_bt_params_cmd(struct wmi_t *wmip, WMI_SET_BT_PARAMS_CMD* cmd);
215
216
217/*
218 *  This function is used to configure the fix rates mask to the target.
219 */
220A_STATUS wmi_set_fixrates_cmd(struct wmi_t *wmip, A_INT16 fixRatesMask);
221A_STATUS wmi_get_ratemask_cmd(struct wmi_t *wmip);
222
223A_STATUS wmi_set_authmode_cmd(struct wmi_t *wmip, A_UINT8 mode);
224
225A_STATUS wmi_set_reassocmode_cmd(struct wmi_t *wmip, A_UINT8 mode);
226
227A_STATUS wmi_set_wmm_cmd(struct wmi_t *wmip, WMI_WMM_STATUS status);
228A_STATUS wmi_set_wmm_txop(struct wmi_t *wmip, WMI_TXOP_CFG txEnable);
229
230A_STATUS wmi_get_keepalive_configured(struct wmi_t *wmip);
231A_UINT8 wmi_get_keepalive_cmd(struct wmi_t *wmip);
232A_STATUS wmi_set_keepalive_cmd(struct wmi_t *wmip, A_UINT8 keepaliveInterval);
233
234A_STATUS wmi_set_appie_cmd(struct wmi_t *wmip, A_UINT8 mgmtFrmType,
235                           A_UINT8 ieLen,A_UINT8 *ieInfo);
236
237A_STATUS wmi_set_halparam_cmd(struct wmi_t *wmip, A_UINT8 *cmd, A_UINT16 dataLen);
238A_INT32 wmi_get_rate(A_INT8 rateindex);
239
240/*Wake on Wireless WMI commands*/
241A_STATUS wmi_set_host_sleep_mode_cmd(struct wmi_t *wmip, WMI_SET_HOST_SLEEP_MODE_CMD *cmd);
242A_STATUS wmi_set_wow_mode_cmd(struct wmi_t *wmip, WMI_SET_WOW_MODE_CMD *cmd);
243A_STATUS wmi_get_wow_list_cmd(struct wmi_t *wmip, WMI_GET_WOW_LIST_CMD *cmd);
244A_STATUS wmi_add_wow_pattern_cmd(struct wmi_t *wmip,
245                                 WMI_ADD_WOW_PATTERN_CMD *cmd, A_UINT8* pattern, A_UINT8* mask, A_UINT8 pattern_size);
246A_STATUS wmi_del_wow_pattern_cmd(struct wmi_t *wmip,
247                                 WMI_DEL_WOW_PATTERN_CMD *cmd);
248A_STATUS wmi_set_wsc_status_cmd(struct wmi_t *wmip, A_UINT32 status);
249
250bss_t *
251wmi_find_Ssidnode (struct wmi_t *wmip, A_UCHAR *pSsid,
252				   A_UINT32 ssidLength, A_BOOL bIsWPA2);
253
254void
255wmi_node_return (struct wmi_t *wmip, bss_t *bss);
256#ifdef __cplusplus
257}
258#endif
259
260#endif /* _WMI_API_H_ */
261