scan.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. #ifndef __SCAN_H__
  24. #define __SCAN_H__
  25. #include "wl12xx.h"
  26. int wl1271_scan(struct wl1271 *wl, const u8 *ssid, size_t ssid_len,
  27. struct cfg80211_scan_request *req);
  28. int wl1271_scan_build_probe_req(struct wl1271 *wl,
  29. const u8 *ssid, size_t ssid_len,
  30. const u8 *ie, size_t ie_len, u8 band);
  31. void wl1271_scan_stm(struct wl1271 *wl);
  32. void wl1271_scan_complete_work(struct work_struct *work);
  33. #define WL1271_SCAN_MAX_CHANNELS 24
  34. #define WL1271_SCAN_DEFAULT_TAG 1
  35. #define WL1271_SCAN_CURRENT_TX_PWR 0
  36. #define WL1271_SCAN_OPT_ACTIVE 0
  37. #define WL1271_SCAN_OPT_PASSIVE 1
  38. #define WL1271_SCAN_OPT_PRIORITY_HIGH 4
  39. #define WL1271_SCAN_BAND_2_4_GHZ 0
  40. #define WL1271_SCAN_BAND_5_GHZ 1
  41. #define WL1271_SCAN_TIMEOUT 10000 /* msec */
  42. enum {
  43. WL1271_SCAN_STATE_IDLE,
  44. WL1271_SCAN_STATE_2GHZ_ACTIVE,
  45. WL1271_SCAN_STATE_2GHZ_PASSIVE,
  46. WL1271_SCAN_STATE_5GHZ_ACTIVE,
  47. WL1271_SCAN_STATE_5GHZ_PASSIVE,
  48. WL1271_SCAN_STATE_DONE
  49. };
  50. struct basic_scan_params {
  51. __le32 rx_config_options;
  52. __le32 rx_filter_options;
  53. /* Scan option flags (WL1271_SCAN_OPT_*) */
  54. __le16 scan_options;
  55. /* Number of scan channels in the list (maximum 30) */
  56. u8 n_ch;
  57. /* This field indicates the number of probe requests to send
  58. per channel for an active scan */
  59. u8 n_probe_reqs;
  60. /* Rate bit field for sending the probes */
  61. __le32 tx_rate;
  62. u8 tid_trigger;
  63. u8 ssid_len;
  64. /* in order to align */
  65. u8 padding1[2];
  66. u8 ssid[IW_ESSID_MAX_SIZE];
  67. /* Band to scan */
  68. u8 band;
  69. u8 use_ssid_list;
  70. u8 scan_tag;
  71. u8 padding2;
  72. } __packed;
  73. struct basic_scan_channel_params {
  74. /* Duration in TU to wait for frames on a channel for active scan */
  75. __le32 min_duration;
  76. __le32 max_duration;
  77. __le32 bssid_lsb;
  78. __le16 bssid_msb;
  79. u8 early_termination;
  80. u8 tx_power_att;
  81. u8 channel;
  82. /* FW internal use only! */
  83. u8 dfs_candidate;
  84. u8 activity_detected;
  85. u8 pad;
  86. } __packed;
  87. struct wl1271_cmd_scan {
  88. struct wl1271_cmd_header header;
  89. struct basic_scan_params params;
  90. struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS];
  91. } __packed;
  92. struct wl1271_cmd_trigger_scan_to {
  93. struct wl1271_cmd_header header;
  94. __le32 timeout;
  95. } __packed;
  96. #endif /* __WL1271_SCAN_H__ */