Luciano Coelho | 34dd2aa | 2010-07-08 17:50:06 +0300 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of wl1271 |
| 3 | * |
| 4 | * Copyright (C) 2009-2010 Nokia Corporation |
| 5 | * |
| 6 | * Contact: Luciano Coelho <luciano.coelho@nokia.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License |
| 10 | * version 2 as published by the Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 20 | * 02110-1301 USA |
| 21 | * |
| 22 | */ |
| 23 | |
| 24 | #ifndef __WL1271_SCAN_H__ |
| 25 | #define __WL1271_SCAN_H__ |
| 26 | |
| 27 | #include "wl1271.h" |
| 28 | |
| 29 | int wl1271_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len, |
Luciano Coelho | 08688d6 | 2010-07-08 17:50:07 +0300 | [diff] [blame] | 30 | struct cfg80211_scan_request *req); |
Luciano Coelho | 34dd2aa | 2010-07-08 17:50:06 +0300 | [diff] [blame] | 31 | int wl1271_scan_build_probe_req(struct wl1271 *wl, |
| 32 | const u8 *ssid, size_t ssid_len, |
| 33 | const u8 *ie, size_t ie_len, u8 band); |
Luciano Coelho | 08688d6 | 2010-07-08 17:50:07 +0300 | [diff] [blame] | 34 | void wl1271_scan_stm(struct wl1271 *wl); |
Juuso Oikarinen | c454f1d | 2010-08-24 06:28:03 +0300 | [diff] [blame^] | 35 | void wl1271_scan_complete_work(struct work_struct *work); |
Luciano Coelho | 34dd2aa | 2010-07-08 17:50:06 +0300 | [diff] [blame] | 36 | |
| 37 | #define WL1271_SCAN_MAX_CHANNELS 24 |
| 38 | #define WL1271_SCAN_DEFAULT_TAG 1 |
| 39 | #define WL1271_SCAN_CURRENT_TX_PWR 0 |
| 40 | #define WL1271_SCAN_OPT_ACTIVE 0 |
| 41 | #define WL1271_SCAN_OPT_PASSIVE 1 |
| 42 | #define WL1271_SCAN_OPT_PRIORITY_HIGH 4 |
| 43 | #define WL1271_SCAN_CHAN_MIN_DURATION 30000 /* TU */ |
| 44 | #define WL1271_SCAN_CHAN_MAX_DURATION 60000 /* TU */ |
| 45 | #define WL1271_SCAN_BAND_2_4_GHZ 0 |
| 46 | #define WL1271_SCAN_BAND_5_GHZ 1 |
Luciano Coelho | 08688d6 | 2010-07-08 17:50:07 +0300 | [diff] [blame] | 47 | #define WL1271_SCAN_PROBE_REQS 3 |
| 48 | |
| 49 | enum { |
| 50 | WL1271_SCAN_STATE_IDLE, |
| 51 | WL1271_SCAN_STATE_2GHZ_ACTIVE, |
| 52 | WL1271_SCAN_STATE_2GHZ_PASSIVE, |
| 53 | WL1271_SCAN_STATE_5GHZ_ACTIVE, |
| 54 | WL1271_SCAN_STATE_5GHZ_PASSIVE, |
| 55 | WL1271_SCAN_STATE_DONE |
| 56 | }; |
Luciano Coelho | 34dd2aa | 2010-07-08 17:50:06 +0300 | [diff] [blame] | 57 | |
| 58 | struct basic_scan_params { |
| 59 | __le32 rx_config_options; |
| 60 | __le32 rx_filter_options; |
| 61 | /* Scan option flags (WL1271_SCAN_OPT_*) */ |
| 62 | __le16 scan_options; |
| 63 | /* Number of scan channels in the list (maximum 30) */ |
Luciano Coelho | 08688d6 | 2010-07-08 17:50:07 +0300 | [diff] [blame] | 64 | u8 n_ch; |
Luciano Coelho | 34dd2aa | 2010-07-08 17:50:06 +0300 | [diff] [blame] | 65 | /* This field indicates the number of probe requests to send |
| 66 | per channel for an active scan */ |
Luciano Coelho | 08688d6 | 2010-07-08 17:50:07 +0300 | [diff] [blame] | 67 | u8 n_probe_reqs; |
Luciano Coelho | 34dd2aa | 2010-07-08 17:50:06 +0300 | [diff] [blame] | 68 | /* Rate bit field for sending the probes */ |
| 69 | __le32 tx_rate; |
| 70 | u8 tid_trigger; |
| 71 | u8 ssid_len; |
| 72 | /* in order to align */ |
| 73 | u8 padding1[2]; |
| 74 | u8 ssid[IW_ESSID_MAX_SIZE]; |
| 75 | /* Band to scan */ |
| 76 | u8 band; |
| 77 | u8 use_ssid_list; |
| 78 | u8 scan_tag; |
| 79 | u8 padding2; |
Luciano Coelho | 72e93e9 | 2010-07-09 14:10:58 +0300 | [diff] [blame] | 80 | } __packed; |
Luciano Coelho | 34dd2aa | 2010-07-08 17:50:06 +0300 | [diff] [blame] | 81 | |
| 82 | struct basic_scan_channel_params { |
| 83 | /* Duration in TU to wait for frames on a channel for active scan */ |
| 84 | __le32 min_duration; |
| 85 | __le32 max_duration; |
| 86 | __le32 bssid_lsb; |
| 87 | __le16 bssid_msb; |
| 88 | u8 early_termination; |
| 89 | u8 tx_power_att; |
| 90 | u8 channel; |
| 91 | /* FW internal use only! */ |
| 92 | u8 dfs_candidate; |
| 93 | u8 activity_detected; |
| 94 | u8 pad; |
Luciano Coelho | 72e93e9 | 2010-07-09 14:10:58 +0300 | [diff] [blame] | 95 | } __packed; |
Luciano Coelho | 34dd2aa | 2010-07-08 17:50:06 +0300 | [diff] [blame] | 96 | |
| 97 | struct wl1271_cmd_scan { |
| 98 | struct wl1271_cmd_header header; |
| 99 | |
| 100 | struct basic_scan_params params; |
| 101 | struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS]; |
Luciano Coelho | 72e93e9 | 2010-07-09 14:10:58 +0300 | [diff] [blame] | 102 | } __packed; |
Luciano Coelho | 34dd2aa | 2010-07-08 17:50:06 +0300 | [diff] [blame] | 103 | |
| 104 | struct wl1271_cmd_trigger_scan_to { |
| 105 | struct wl1271_cmd_header header; |
| 106 | |
| 107 | __le32 timeout; |
Luciano Coelho | 72e93e9 | 2010-07-09 14:10:58 +0300 | [diff] [blame] | 108 | } __packed; |
Luciano Coelho | 34dd2aa | 2010-07-08 17:50:06 +0300 | [diff] [blame] | 109 | |
| 110 | #endif /* __WL1271_SCAN_H__ */ |