cmd.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. /*
  2. * This file is part of wl12xx
  3. *
  4. * Copyright (c) 1998-2007 Texas Instruments Incorporated
  5. * Copyright (C) 2008 Nokia Corporation
  6. *
  7. * Contact: Kalle Valo <kalle.valo@nokia.com>
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * version 2 as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  21. * 02110-1301 USA
  22. *
  23. */
  24. #ifndef __WL12XX_CMD_H__
  25. #define __WL12XX_CMD_H__
  26. #include "wl12xx.h"
  27. int wl12xx_cmd_send(struct wl12xx *wl, u16 type, void *buf, size_t buf_len);
  28. int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer);
  29. int wl12xx_cmd_interrogate(struct wl12xx *wl, u16 ie_id, u16 ie_len,
  30. void *answer);
  31. int wl12xx_cmd_configure(struct wl12xx *wl, void *ie, int ie_len);
  32. int wl12xx_cmd_vbm(struct wl12xx *wl, u8 identity,
  33. void *bitmap, u16 bitmap_len, u8 bitmap_control);
  34. int wl12xx_cmd_data_path(struct wl12xx *wl, u8 channel, u8 enable);
  35. int wl12xx_cmd_join(struct wl12xx *wl, u8 bss_type, u8 dtim_interval,
  36. u16 beacon_interval, u8 wait);
  37. int wl12xx_cmd_ps_mode(struct wl12xx *wl, u8 ps_mode);
  38. int wl12xx_cmd_read_memory(struct wl12xx *wl, u32 addr, u32 len, void *answer);
  39. int wl12xx_cmd_template_set(struct wl12xx *wl, u16 cmd_id,
  40. void *buf, size_t buf_len);
  41. /* unit ms */
  42. #define WL12XX_COMMAND_TIMEOUT 2000
  43. #define WL12XX_MAX_TEMPLATE_SIZE 300
  44. struct wl12xx_cmd_packet_template {
  45. __le16 size;
  46. u8 template[WL12XX_MAX_TEMPLATE_SIZE];
  47. } __attribute__ ((packed));
  48. enum wl12xx_commands {
  49. CMD_RESET = 0,
  50. CMD_INTERROGATE = 1, /*use this to read information elements*/
  51. CMD_CONFIGURE = 2, /*use this to write information elements*/
  52. CMD_ENABLE_RX = 3,
  53. CMD_ENABLE_TX = 4,
  54. CMD_DISABLE_RX = 5,
  55. CMD_DISABLE_TX = 6,
  56. CMD_SCAN = 8,
  57. CMD_STOP_SCAN = 9,
  58. CMD_VBM = 10,
  59. CMD_START_JOIN = 11,
  60. CMD_SET_KEYS = 12,
  61. CMD_READ_MEMORY = 13,
  62. CMD_WRITE_MEMORY = 14,
  63. CMD_BEACON = 19,
  64. CMD_PROBE_RESP = 20,
  65. CMD_NULL_DATA = 21,
  66. CMD_PROBE_REQ = 22,
  67. CMD_TEST = 23,
  68. CMD_RADIO_CALIBRATE = 25, /* OBSOLETE */
  69. CMD_ENABLE_RX_PATH = 27, /* OBSOLETE */
  70. CMD_NOISE_HIST = 28,
  71. CMD_RX_RESET = 29,
  72. CMD_PS_POLL = 30,
  73. CMD_QOS_NULL_DATA = 31,
  74. CMD_LNA_CONTROL = 32,
  75. CMD_SET_BCN_MODE = 33,
  76. CMD_MEASUREMENT = 34,
  77. CMD_STOP_MEASUREMENT = 35,
  78. CMD_DISCONNECT = 36,
  79. CMD_SET_PS_MODE = 37,
  80. CMD_CHANNEL_SWITCH = 38,
  81. CMD_STOP_CHANNEL_SWICTH = 39,
  82. CMD_AP_DISCOVERY = 40,
  83. CMD_STOP_AP_DISCOVERY = 41,
  84. CMD_SPS_SCAN = 42,
  85. CMD_STOP_SPS_SCAN = 43,
  86. CMD_HEALTH_CHECK = 45,
  87. CMD_DEBUG = 46,
  88. CMD_TRIGGER_SCAN_TO = 47,
  89. NUM_COMMANDS,
  90. MAX_COMMAND_ID = 0xFFFF,
  91. };
  92. #define MAX_CMD_PARAMS 572
  93. struct wl12xx_command {
  94. u16 id;
  95. u16 status;
  96. u8 parameters[MAX_CMD_PARAMS];
  97. };
  98. enum {
  99. CMD_MAILBOX_IDLE = 0,
  100. CMD_STATUS_SUCCESS = 1,
  101. CMD_STATUS_UNKNOWN_CMD = 2,
  102. CMD_STATUS_UNKNOWN_IE = 3,
  103. CMD_STATUS_REJECT_MEAS_SG_ACTIVE = 11,
  104. CMD_STATUS_RX_BUSY = 13,
  105. CMD_STATUS_INVALID_PARAM = 14,
  106. CMD_STATUS_TEMPLATE_TOO_LARGE = 15,
  107. CMD_STATUS_OUT_OF_MEMORY = 16,
  108. CMD_STATUS_STA_TABLE_FULL = 17,
  109. CMD_STATUS_RADIO_ERROR = 18,
  110. CMD_STATUS_WRONG_NESTING = 19,
  111. CMD_STATUS_TIMEOUT = 21, /* Driver internal use.*/
  112. CMD_STATUS_FW_RESET = 22, /* Driver internal use.*/
  113. MAX_COMMAND_STATUS = 0xff
  114. };
  115. /*
  116. * CMD_READ_MEMORY
  117. *
  118. * The host issues this command to read the WiLink device memory/registers.
  119. *
  120. * Note: The Base Band address has special handling (16 bits registers and
  121. * addresses). For more information, see the hardware specification.
  122. */
  123. /*
  124. * CMD_WRITE_MEMORY
  125. *
  126. * The host issues this command to write the WiLink device memory/registers.
  127. *
  128. * The Base Band address has special handling (16 bits registers and
  129. * addresses). For more information, see the hardware specification.
  130. */
  131. #define MAX_READ_SIZE 256
  132. struct cmd_read_write_memory {
  133. /* The address of the memory to read from or write to.*/
  134. u32 addr;
  135. /* The amount of data in bytes to read from or write to the WiLink
  136. * device.*/
  137. u32 size;
  138. /* The actual value read from or written to the Wilink. The source
  139. of this field is the Host in WRITE command or the Wilink in READ
  140. command. */
  141. u8 value[MAX_READ_SIZE];
  142. };
  143. #define CMDMBOX_HEADER_LEN 4
  144. #define CMDMBOX_INFO_ELEM_HEADER_LEN 4
  145. struct basic_scan_parameters {
  146. u32 rx_config_options;
  147. u32 rx_filter_options;
  148. /*
  149. * Scan options:
  150. * bit 0: When this bit is set, passive scan.
  151. * bit 1: Band, when this bit is set we scan
  152. * in the 5Ghz band.
  153. * bit 2: voice mode, 0 for normal scan.
  154. * bit 3: scan priority, 1 for high priority.
  155. */
  156. u16 scan_options;
  157. /* Number of channels to scan */
  158. u8 num_channels;
  159. /* Number opf probe requests to send, per channel */
  160. u8 num_probe_requests;
  161. /* Rate and modulation for probe requests */
  162. u16 tx_rate;
  163. u8 tid_trigger;
  164. u8 ssid_len;
  165. u32 ssid[8];
  166. } __attribute__ ((packed));
  167. struct basic_scan_channel_parameters {
  168. u32 min_duration; /* in TU */
  169. u32 max_duration; /* in TU */
  170. u32 bssid_lsb;
  171. u16 bssid_msb;
  172. /*
  173. * bits 0-3: Early termination count.
  174. * bits 4-5: Early termination condition.
  175. */
  176. u8 early_termination;
  177. u8 tx_power_att;
  178. u8 channel;
  179. u8 pad[3];
  180. } __attribute__ ((packed));
  181. /* SCAN parameters */
  182. #define SCAN_MAX_NUM_OF_CHANNELS 16
  183. struct cmd_scan {
  184. struct basic_scan_parameters params;
  185. struct basic_scan_channel_parameters channels[SCAN_MAX_NUM_OF_CHANNELS];
  186. } __attribute__ ((packed));
  187. enum {
  188. BSS_TYPE_IBSS = 0,
  189. BSS_TYPE_STA_BSS = 2,
  190. BSS_TYPE_AP_BSS = 3,
  191. MAX_BSS_TYPE = 0xFF
  192. };
  193. #define JOIN_CMD_CTRL_TX_FLUSH 0x80 /* Firmware flushes all Tx */
  194. #define JOIN_CMD_CTRL_EARLY_WAKEUP_ENABLE 0x01 /* Early wakeup time */
  195. struct cmd_join {
  196. u32 bssid_lsb;
  197. u16 bssid_msb;
  198. u16 beacon_interval; /* in TBTTs */
  199. u32 rx_config_options;
  200. u32 rx_filter_options;
  201. /*
  202. * The target uses this field to determine the rate at
  203. * which to transmit control frame responses (such as
  204. * ACK or CTS frames).
  205. */
  206. u16 basic_rate_set;
  207. u8 dtim_interval;
  208. u8 tx_ctrl_frame_rate; /* OBSOLETE */
  209. u8 tx_ctrl_frame_mod; /* OBSOLETE */
  210. /*
  211. * bits 0-2: This bitwise field specifies the type
  212. * of BSS to start or join (BSS_TYPE_*).
  213. * bit 4: Band - The radio band in which to join
  214. * or start.
  215. * 0 - 2.4GHz band
  216. * 1 - 5GHz band
  217. * bits 3, 5-7: Reserved
  218. */
  219. u8 bss_type;
  220. u8 channel;
  221. u8 ssid_len;
  222. u8 ssid[IW_ESSID_MAX_SIZE];
  223. u8 ctrl; /* JOIN_CMD_CTRL_* */
  224. u8 tx_mgt_frame_rate; /* OBSOLETE */
  225. u8 tx_mgt_frame_mod; /* OBSOLETE */
  226. u8 reserved;
  227. } __attribute__ ((packed));
  228. #endif /* __WL12XX_CMD_H__ */