1 //------------------------------------------------------------------------------
2 // <copyright file="wmi_api.h" company="Atheros">
3 // Copyright (c) 2004-2010 Atheros Corporation. All rights reserved.
6 // Permission to use, copy, modify, and/or distribute this software for any
7 // purpose with or without fee is hereby granted, provided that the above
8 // copyright notice and this permission notice appear in all copies.
10 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 //------------------------------------------------------------------------------
20 //==============================================================================
21 // This file contains the definitions for the Wireless Module Interface (WMI).
23 // Author(s): ="Atheros"
24 //==============================================================================
32 /* WMI converts a dix frame with an ethernet payload (up to 1500 bytes)
33 * to an 802.3 frame (adds SNAP header) and adds on a WMI data header */
34 #define WMI_MAX_TX_DATA_FRAME_LENGTH (1500 + sizeof(WMI_DATA_HDR) + sizeof(ATH_MAC_HDR) + sizeof(ATH_LLC_SNAP_HDR))
36 /* A normal WMI data frame */
37 #define WMI_MAX_NORMAL_RX_DATA_FRAME_LENGTH (1500 + sizeof(WMI_DATA_HDR) + sizeof(ATH_MAC_HDR) + sizeof(ATH_LLC_SNAP_HDR))
39 /* An AMSDU frame */ /* The MAX AMSDU length of AR6003 is 3839 */
40 #define WMI_MAX_AMSDU_RX_DATA_FRAME_LENGTH (3840 + sizeof(WMI_DATA_HDR) + sizeof(ATH_MAC_HDR) + sizeof(ATH_LLC_SNAP_HDR))
43 * IP QoS Field definitions according to 802.1p
45 #define BEST_EFFORT_PRI 0
46 #define BACKGROUND_PRI 1
47 #define EXCELLENT_EFFORT_PRI 3
48 #define CONTROLLED_LOAD_PRI 4
51 #define NETWORK_CONTROL_PRI 7
54 #define UNDEFINED_PRI (0xff)
56 #define WMI_IMPLICIT_PSTREAM_INACTIVITY_INT 5000 /* 5 seconds */
58 #define A_ROUND_UP(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
61 ATHEROS_COMPLIANCE = 0x1,
62 }TSPEC_PARAM_COMPLIANCE;
66 void *wmi_init(void *devt);
68 void wmi_qos_state_init(struct wmi_t *wmip);
69 void wmi_shutdown(struct wmi_t *wmip);
70 HTC_ENDPOINT_ID wmi_get_control_ep(struct wmi_t * wmip);
71 void wmi_set_control_ep(struct wmi_t * wmip, HTC_ENDPOINT_ID eid);
72 u16 wmi_get_mapped_qos_queue(struct wmi_t *, u8 );
73 int wmi_dix_2_dot3(struct wmi_t *wmip, void *osbuf);
74 int wmi_data_hdr_add(struct wmi_t *wmip, void *osbuf, u8 msgType, bool bMoreData, WMI_DATA_HDR_DATA_TYPE data_type,u8 metaVersion, void *pTxMetaS);
75 int wmi_dot3_2_dix(void *osbuf);
77 int wmi_dot11_hdr_remove (struct wmi_t *wmip, void *osbuf);
78 int wmi_dot11_hdr_add(struct wmi_t *wmip, void *osbuf, NETWORK_TYPE mode);
80 int wmi_data_hdr_remove(struct wmi_t *wmip, void *osbuf);
81 int wmi_syncpoint(struct wmi_t *wmip);
82 int wmi_syncpoint_reset(struct wmi_t *wmip);
83 u8 wmi_implicit_create_pstream(struct wmi_t *wmip, void *osbuf, u32 layer2Priority, bool wmmEnabled);
85 u8 wmi_determine_userPriority (u8 *pkt, u32 layer2Pri);
87 int wmi_control_rx(struct wmi_t *wmip, void *osbuf);
88 void wmi_iterate_nodes(struct wmi_t *wmip, wlan_node_iter_func *f, void *arg);
89 void wmi_free_allnodes(struct wmi_t *wmip);
90 bss_t *wmi_find_node(struct wmi_t *wmip, const u8 *macaddr);
91 void wmi_free_node(struct wmi_t *wmip, const u8 *macaddr);
96 SYNC_BEFORE_WMIFLAG, /* transmit all queued data before cmd */
97 SYNC_AFTER_WMIFLAG, /* any new data waits until cmd execs */
99 END_WMIFLAG /* end marker */
102 int wmi_cmd_send(struct wmi_t *wmip, void *osbuf, WMI_COMMAND_ID cmdId,
105 int wmi_connect_cmd(struct wmi_t *wmip,
106 NETWORK_TYPE netType,
107 DOT11_AUTH_MODE dot11AuthMode,
109 CRYPTO_TYPE pairwiseCrypto,
110 u8 pairwiseCryptoLen,
111 CRYPTO_TYPE groupCrypto,
119 int wmi_reconnect_cmd(struct wmi_t *wmip,
122 int wmi_disconnect_cmd(struct wmi_t *wmip);
123 int wmi_getrev_cmd(struct wmi_t *wmip);
124 int wmi_startscan_cmd(struct wmi_t *wmip, WMI_SCAN_TYPE scanType,
125 u32 forceFgScan, u32 isLegacy,
126 u32 homeDwellTime, u32 forceScanInterval,
127 s8 numChan, u16 *channelList);
128 int wmi_scanparams_cmd(struct wmi_t *wmip, u16 fg_start_sec,
129 u16 fg_end_sec, u16 bg_sec,
130 u16 minact_chdw_msec,
131 u16 maxact_chdw_msec, u16 pas_chdw_msec,
132 u8 shScanRatio, u8 scanCtrlFlags,
133 u32 max_dfsch_act_time,
134 u16 maxact_scan_per_ssid);
135 int wmi_bssfilter_cmd(struct wmi_t *wmip, u8 filter, u32 ieMask);
136 int wmi_probedSsid_cmd(struct wmi_t *wmip, u8 index, u8 flag,
137 u8 ssidLength, u8 *ssid);
138 int wmi_listeninterval_cmd(struct wmi_t *wmip, u16 listenInterval, u16 listenBeacons);
139 int wmi_bmisstime_cmd(struct wmi_t *wmip, u16 bmisstime, u16 bmissbeacons);
140 int wmi_associnfo_cmd(struct wmi_t *wmip, u8 ieType,
141 u8 ieLen, u8 *ieInfo);
142 int wmi_powermode_cmd(struct wmi_t *wmip, u8 powerMode);
143 int wmi_ibsspmcaps_cmd(struct wmi_t *wmip, u8 pmEnable, u8 ttl,
144 u16 atim_windows, u16 timeout_value);
145 int wmi_apps_cmd(struct wmi_t *wmip, u8 psType, u32 idle_time,
146 u32 ps_period, u8 sleep_period);
147 int wmi_pmparams_cmd(struct wmi_t *wmip, u16 idlePeriod,
148 u16 psPollNum, u16 dtimPolicy,
149 u16 wakup_tx_policy, u16 num_tx_to_wakeup,
150 u16 ps_fail_event_policy);
151 int wmi_disctimeout_cmd(struct wmi_t *wmip, u8 timeout);
152 int wmi_sync_cmd(struct wmi_t *wmip, u8 syncNumber);
153 int wmi_create_pstream_cmd(struct wmi_t *wmip, WMI_CREATE_PSTREAM_CMD *pstream);
154 int wmi_delete_pstream_cmd(struct wmi_t *wmip, u8 trafficClass, u8 streamID);
155 int wmi_set_framerate_cmd(struct wmi_t *wmip, u8 bEnable, u8 type, u8 subType, u16 rateMask);
156 int wmi_set_bitrate_cmd(struct wmi_t *wmip, s32 dataRate, s32 mgmtRate, s32 ctlRate);
157 int wmi_get_bitrate_cmd(struct wmi_t *wmip);
158 s8 wmi_validate_bitrate(struct wmi_t *wmip, s32 rate, s8 *rate_idx);
159 int wmi_get_regDomain_cmd(struct wmi_t *wmip);
160 int wmi_get_channelList_cmd(struct wmi_t *wmip);
161 int wmi_set_channelParams_cmd(struct wmi_t *wmip, u8 scanParam,
162 WMI_PHY_MODE mode, s8 numChan,
165 int wmi_set_snr_threshold_params(struct wmi_t *wmip,
166 WMI_SNR_THRESHOLD_PARAMS_CMD *snrCmd);
167 int wmi_set_rssi_threshold_params(struct wmi_t *wmip,
168 WMI_RSSI_THRESHOLD_PARAMS_CMD *rssiCmd);
169 int wmi_clr_rssi_snr(struct wmi_t *wmip);
170 int wmi_set_lq_threshold_params(struct wmi_t *wmip,
171 WMI_LQ_THRESHOLD_PARAMS_CMD *lqCmd);
172 int wmi_set_rts_cmd(struct wmi_t *wmip, u16 threshold);
173 int wmi_set_lpreamble_cmd(struct wmi_t *wmip, u8 status, u8 preamblePolicy);
175 int wmi_set_error_report_bitmask(struct wmi_t *wmip, u32 bitmask);
177 int wmi_get_challenge_resp_cmd(struct wmi_t *wmip, u32 cookie,
180 int wmi_config_debug_module_cmd(struct wmi_t *wmip, u16 mmask,
181 u16 tsr, bool rep, u16 size,
184 int wmi_get_stats_cmd(struct wmi_t *wmip);
186 int wmi_addKey_cmd(struct wmi_t *wmip, u8 keyIndex,
187 CRYPTO_TYPE keyType, u8 keyUsage,
188 u8 keyLength,u8 *keyRSC,
189 u8 *keyMaterial, u8 key_op_ctrl, u8 *mac,
190 WMI_SYNC_FLAG sync_flag);
191 int wmi_add_krk_cmd(struct wmi_t *wmip, u8 *krk);
192 int wmi_delete_krk_cmd(struct wmi_t *wmip);
193 int wmi_deleteKey_cmd(struct wmi_t *wmip, u8 keyIndex);
194 int wmi_set_akmp_params_cmd(struct wmi_t *wmip,
195 WMI_SET_AKMP_PARAMS_CMD *akmpParams);
196 int wmi_get_pmkid_list_cmd(struct wmi_t *wmip);
197 int wmi_set_pmkid_list_cmd(struct wmi_t *wmip,
198 WMI_SET_PMKID_LIST_CMD *pmkInfo);
199 int wmi_abort_scan_cmd(struct wmi_t *wmip);
200 int wmi_set_txPwr_cmd(struct wmi_t *wmip, u8 dbM);
201 int wmi_get_txPwr_cmd(struct wmi_t *wmip);
202 int wmi_addBadAp_cmd(struct wmi_t *wmip, u8 apIndex, u8 *bssid);
203 int wmi_deleteBadAp_cmd(struct wmi_t *wmip, u8 apIndex);
204 int wmi_set_tkip_countermeasures_cmd(struct wmi_t *wmip, bool en);
205 int wmi_setPmkid_cmd(struct wmi_t *wmip, u8 *bssid, u8 *pmkId,
207 int wmi_set_access_params_cmd(struct wmi_t *wmip, u8 ac, u16 txop,
208 u8 eCWmin, u8 eCWmax,
210 int wmi_set_retry_limits_cmd(struct wmi_t *wmip, u8 frameType,
211 u8 trafficClass, u8 maxRetries,
214 void wmi_get_current_bssid(struct wmi_t *wmip, u8 *bssid);
216 int wmi_get_roam_tbl_cmd(struct wmi_t *wmip);
217 int wmi_get_roam_data_cmd(struct wmi_t *wmip, u8 roamDataType);
218 int wmi_set_roam_ctrl_cmd(struct wmi_t *wmip, WMI_SET_ROAM_CTRL_CMD *p,
220 int wmi_set_powersave_timers_cmd(struct wmi_t *wmip,
221 WMI_POWERSAVE_TIMERS_POLICY_CMD *pCmd,
224 int wmi_set_opt_mode_cmd(struct wmi_t *wmip, u8 optMode);
225 int wmi_opt_tx_frame_cmd(struct wmi_t *wmip,
232 int wmi_set_adhoc_bconIntvl_cmd(struct wmi_t *wmip, u16 intvl);
233 int wmi_set_voice_pkt_size_cmd(struct wmi_t *wmip, u16 voicePktSize);
234 int wmi_set_max_sp_len_cmd(struct wmi_t *wmip, u8 maxSpLen);
235 u8 convert_userPriority_to_trafficClass(u8 userPriority);
236 u8 wmi_get_power_mode_cmd(struct wmi_t *wmip);
237 int wmi_verify_tspec_params(WMI_CREATE_PSTREAM_CMD *pCmd, int tspecCompliance);
239 #ifdef CONFIG_HOST_TCMD_SUPPORT
240 int wmi_test_cmd(struct wmi_t *wmip, u8 *buf, u32 len);
243 int wmi_set_bt_status_cmd(struct wmi_t *wmip, u8 streamType, u8 status);
244 int wmi_set_bt_params_cmd(struct wmi_t *wmip, WMI_SET_BT_PARAMS_CMD* cmd);
246 int wmi_set_btcoex_fe_ant_cmd(struct wmi_t *wmip, WMI_SET_BTCOEX_FE_ANT_CMD * cmd);
248 int wmi_set_btcoex_colocated_bt_dev_cmd(struct wmi_t *wmip,
249 WMI_SET_BTCOEX_COLOCATED_BT_DEV_CMD * cmd);
251 int wmi_set_btcoex_btinquiry_page_config_cmd(struct wmi_t *wmip,
252 WMI_SET_BTCOEX_BTINQUIRY_PAGE_CONFIG_CMD *cmd);
254 int wmi_set_btcoex_sco_config_cmd(struct wmi_t *wmip,
255 WMI_SET_BTCOEX_SCO_CONFIG_CMD * cmd);
257 int wmi_set_btcoex_a2dp_config_cmd(struct wmi_t *wmip,
258 WMI_SET_BTCOEX_A2DP_CONFIG_CMD* cmd);
261 int wmi_set_btcoex_aclcoex_config_cmd(struct wmi_t *wmip, WMI_SET_BTCOEX_ACLCOEX_CONFIG_CMD* cmd);
263 int wmi_set_btcoex_debug_cmd(struct wmi_t *wmip, WMI_SET_BTCOEX_DEBUG_CMD * cmd);
265 int wmi_set_btcoex_bt_operating_status_cmd(struct wmi_t * wmip,
266 WMI_SET_BTCOEX_BT_OPERATING_STATUS_CMD * cmd);
268 int wmi_get_btcoex_config_cmd(struct wmi_t * wmip, WMI_GET_BTCOEX_CONFIG_CMD * cmd);
270 int wmi_get_btcoex_stats_cmd(struct wmi_t * wmip);
272 int wmi_SGI_cmd(struct wmi_t *wmip, u32 sgiMask, u8 sgiPERThreshold);
275 * This function is used to configure the fix rates mask to the target.
277 int wmi_set_fixrates_cmd(struct wmi_t *wmip, u32 fixRatesMask);
278 int wmi_get_ratemask_cmd(struct wmi_t *wmip);
280 int wmi_set_authmode_cmd(struct wmi_t *wmip, u8 mode);
282 int wmi_set_reassocmode_cmd(struct wmi_t *wmip, u8 mode);
284 int wmi_set_qos_supp_cmd(struct wmi_t *wmip,u8 status);
285 int wmi_set_wmm_cmd(struct wmi_t *wmip, WMI_WMM_STATUS status);
286 int wmi_set_wmm_txop(struct wmi_t *wmip, WMI_TXOP_CFG txEnable);
287 int wmi_set_country(struct wmi_t *wmip, u8 *countryCode);
289 int wmi_get_keepalive_configured(struct wmi_t *wmip);
290 u8 wmi_get_keepalive_cmd(struct wmi_t *wmip);
291 int wmi_set_keepalive_cmd(struct wmi_t *wmip, u8 keepaliveInterval);
293 int wmi_set_appie_cmd(struct wmi_t *wmip, u8 mgmtFrmType,
294 u8 ieLen,u8 *ieInfo);
296 int wmi_set_halparam_cmd(struct wmi_t *wmip, u8 *cmd, u16 dataLen);
298 s32 wmi_get_rate(s8 rateindex);
300 int wmi_set_ip_cmd(struct wmi_t *wmip, WMI_SET_IP_CMD *cmd);
302 /*Wake on Wireless WMI commands*/
303 int wmi_set_host_sleep_mode_cmd(struct wmi_t *wmip, WMI_SET_HOST_SLEEP_MODE_CMD *cmd);
304 int wmi_set_wow_mode_cmd(struct wmi_t *wmip, WMI_SET_WOW_MODE_CMD *cmd);
305 int wmi_get_wow_list_cmd(struct wmi_t *wmip, WMI_GET_WOW_LIST_CMD *cmd);
306 int wmi_add_wow_pattern_cmd(struct wmi_t *wmip,
307 WMI_ADD_WOW_PATTERN_CMD *cmd, u8 *pattern, u8 *mask, u8 pattern_size);
308 int wmi_del_wow_pattern_cmd(struct wmi_t *wmip,
309 WMI_DEL_WOW_PATTERN_CMD *cmd);
310 int wmi_set_wsc_status_cmd(struct wmi_t *wmip, u32 status);
313 wmi_set_params_cmd(struct wmi_t *wmip, u32 opcode, u32 length, char *buffer);
316 wmi_set_mcast_filter_cmd(struct wmi_t *wmip, u8 dot1, u8 dot2, u8 dot3, u8 dot4);
319 wmi_del_mcast_filter_cmd(struct wmi_t *wmip, u8 dot1, u8 dot2, u8 dot3, u8 dot4);
322 wmi_mcast_filter_cmd(struct wmi_t *wmip, u8 enable);
325 wmi_find_Ssidnode (struct wmi_t *wmip, u8 *pSsid,
326 u32 ssidLength, bool bIsWPA2, bool bMatchSSID);
330 wmi_node_return (struct wmi_t *wmip, bss_t *bss);
333 wmi_set_nodeage(struct wmi_t *wmip, u32 nodeAge);
335 #if defined(CONFIG_TARGET_PROFILE_SUPPORT)
336 int wmi_prof_cfg_cmd(struct wmi_t *wmip, u32 period, u32 nbins);
337 int wmi_prof_addr_set_cmd(struct wmi_t *wmip, u32 addr);
338 int wmi_prof_start_cmd(struct wmi_t *wmip);
339 int wmi_prof_stop_cmd(struct wmi_t *wmip);
340 int wmi_prof_count_get_cmd(struct wmi_t *wmip);
341 #endif /* CONFIG_TARGET_PROFILE_SUPPORT */
342 #ifdef OS_ROAM_MANAGEMENT
343 void wmi_scan_indication (struct wmi_t *wmip);
347 wmi_set_target_event_report_cmd(struct wmi_t *wmip, WMI_SET_TARGET_EVENT_REPORT_CMD* cmd);
349 bss_t *wmi_rm_current_bss (struct wmi_t *wmip, u8 *id);
350 int wmi_add_current_bss (struct wmi_t *wmip, u8 *id, bss_t *bss);
357 wmi_ap_profile_commit(struct wmi_t *wmip, WMI_CONNECT_CMD *p);
360 wmi_ap_set_hidden_ssid(struct wmi_t *wmip, u8 hidden_ssid);
363 wmi_ap_set_num_sta(struct wmi_t *wmip, u8 num_sta);
366 wmi_ap_set_acl_policy(struct wmi_t *wmip, u8 policy);
369 wmi_ap_acl_mac_list(struct wmi_t *wmip, WMI_AP_ACL_MAC_CMD *a);
371 u8 acl_add_del_mac(WMI_AP_ACL *a, WMI_AP_ACL_MAC_CMD *acl);
374 wmi_ap_set_mlme(struct wmi_t *wmip, u8 cmd, u8 *mac, u16 reason);
377 wmi_set_pvb_cmd(struct wmi_t *wmip, u16 aid, bool flag);
380 wmi_ap_conn_inact_time(struct wmi_t *wmip, u32 period);
383 wmi_ap_bgscan_time(struct wmi_t *wmip, u32 period, u32 dwell);
386 wmi_ap_set_dtim(struct wmi_t *wmip, u8 dtim);
389 wmi_ap_set_rateset(struct wmi_t *wmip, u8 rateset);
392 wmi_set_ht_cap_cmd(struct wmi_t *wmip, WMI_SET_HT_CAP_CMD *cmd);
395 wmi_set_ht_op_cmd(struct wmi_t *wmip, u8 sta_chan_width);
398 wmi_send_hci_cmd(struct wmi_t *wmip, u8 *buf, u16 sz);
401 wmi_set_tx_select_rates_cmd(struct wmi_t *wmip, u32 *pMaskArray);
404 wmi_setup_aggr_cmd(struct wmi_t *wmip, u8 tid);
407 wmi_delete_aggr_cmd(struct wmi_t *wmip, u8 tid, bool uplink);
410 wmi_allow_aggr_cmd(struct wmi_t *wmip, u16 tx_tidmask, u16 rx_tidmask);
413 wmi_set_rx_frame_format_cmd(struct wmi_t *wmip, u8 rxMetaVersion, bool rxDot11Hdr, bool defragOnHost);
416 wmi_set_thin_mode_cmd(struct wmi_t *wmip, bool bThinMode);
419 wmi_set_wlan_conn_precedence_cmd(struct wmi_t *wmip, BT_WLAN_CONN_PRECEDENCE precedence);
422 wmi_set_pmk_cmd(struct wmi_t *wmip, u8 *pmk);
425 wmi_set_excess_tx_retry_thres_cmd(struct wmi_t *wmip, WMI_SET_EXCESS_TX_RETRY_THRES_CMD *cmd);
427 u16 wmi_ieee2freq (int chan);
429 u32 wmi_freq2ieee (u16 freq);
432 wmi_find_matching_Ssidnode (struct wmi_t *wmip, u8 *pSsid,
434 u32 dot11AuthMode, u32 authMode,
435 u32 pairwiseCryptoType, u32 grpwiseCryptoTyp);
441 #endif /* _WMI_API_H_ */