blob: c93968092fc1ca03ce52ff7d23c0fbe518bf44e1 [file] [log] [blame]
Luciano Coelhof5fc0f82009-08-06 16:25:28 +03001/*
2 * This file is part of wl1271
3 *
4 * Copyright (C) 1998-2009 Texas Instruments. All rights reserved.
5 * Copyright (C) 2008-2009 Nokia Corporation
6 *
7 * Contact: Luciano Coelho <luciano.coelho@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
25#ifndef __WL1271_H__
26#define __WL1271_H__
27
28#include <linux/mutex.h>
29#include <linux/completion.h>
30#include <linux/spinlock.h>
31#include <linux/list.h>
32#include <linux/bitops.h>
33#include <net/mac80211.h>
34
Juuso Oikarinen2b60100b2009-10-13 12:47:39 +030035#include "wl1271_conf.h"
36
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030037#define DRIVER_NAME "wl1271"
38#define DRIVER_PREFIX DRIVER_NAME ": "
39
40enum {
41 DEBUG_NONE = 0,
42 DEBUG_IRQ = BIT(0),
43 DEBUG_SPI = BIT(1),
44 DEBUG_BOOT = BIT(2),
45 DEBUG_MAILBOX = BIT(3),
Kalle Valoc8c90872010-02-18 13:25:53 +020046 DEBUG_TESTMODE = BIT(4),
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030047 DEBUG_EVENT = BIT(5),
48 DEBUG_TX = BIT(6),
49 DEBUG_RX = BIT(7),
50 DEBUG_SCAN = BIT(8),
51 DEBUG_CRYPT = BIT(9),
52 DEBUG_PSM = BIT(10),
53 DEBUG_MAC80211 = BIT(11),
54 DEBUG_CMD = BIT(12),
55 DEBUG_ACX = BIT(13),
Teemu Paasikivia3b8ea72010-03-18 12:26:41 +020056 DEBUG_SDIO = BIT(14),
Juuso Oikarinen14b228a2010-03-18 12:26:43 +020057 DEBUG_FILTERS = BIT(15),
Luciano Coelhof5fc0f82009-08-06 16:25:28 +030058 DEBUG_ALL = ~0,
59};
60
61#define DEBUG_LEVEL (DEBUG_NONE)
62
63#define DEBUG_DUMP_LIMIT 1024
64
65#define wl1271_error(fmt, arg...) \
66 printk(KERN_ERR DRIVER_PREFIX "ERROR " fmt "\n", ##arg)
67
68#define wl1271_warning(fmt, arg...) \
69 printk(KERN_WARNING DRIVER_PREFIX "WARNING " fmt "\n", ##arg)
70
71#define wl1271_notice(fmt, arg...) \
72 printk(KERN_INFO DRIVER_PREFIX fmt "\n", ##arg)
73
74#define wl1271_info(fmt, arg...) \
75 printk(KERN_DEBUG DRIVER_PREFIX fmt "\n", ##arg)
76
77#define wl1271_debug(level, fmt, arg...) \
78 do { \
79 if (level & DEBUG_LEVEL) \
80 printk(KERN_DEBUG DRIVER_PREFIX fmt "\n", ##arg); \
81 } while (0)
82
83#define wl1271_dump(level, prefix, buf, len) \
84 do { \
85 if (level & DEBUG_LEVEL) \
86 print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \
87 DUMP_PREFIX_OFFSET, 16, 1, \
88 buf, \
89 min_t(size_t, len, DEBUG_DUMP_LIMIT), \
90 0); \
91 } while (0)
92
93#define wl1271_dump_ascii(level, prefix, buf, len) \
94 do { \
95 if (level & DEBUG_LEVEL) \
96 print_hex_dump(KERN_DEBUG, DRIVER_PREFIX prefix, \
97 DUMP_PREFIX_OFFSET, 16, 1, \
98 buf, \
99 min_t(size_t, len, DEBUG_DUMP_LIMIT), \
100 true); \
101 } while (0)
102
103#define WL1271_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN | \
Juuso Oikarinenc87dec92009-10-08 21:56:31 +0300104 CFG_BSSID_FILTER_EN | \
105 CFG_MC_FILTER_EN)
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300106
107#define WL1271_DEFAULT_RX_FILTER (CFG_RX_RCTS_ACK | CFG_RX_PRSP_EN | \
108 CFG_RX_MGMT_EN | CFG_RX_DATA_EN | \
109 CFG_RX_CTL_EN | CFG_RX_BCN_EN | \
110 CFG_RX_AUTH_EN | CFG_RX_ASSOC_EN)
111
112#define WL1271_FW_NAME "wl1271-fw.bin"
113#define WL1271_NVS_NAME "wl1271-nvs.bin"
Juuso Oikarinen152ee6e2010-02-18 13:25:42 +0200114
Juuso Oikarinen04e36fc2010-02-22 08:38:40 +0200115#define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff))
116#define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff))
117
Juuso Oikarinen152ee6e2010-02-18 13:25:42 +0200118/* NVS data structure */
119#define WL1271_NVS_SECTION_SIZE 468
120
121#define WL1271_NVS_GENERAL_PARAMS_SIZE 57
122#define WL1271_NVS_GENERAL_PARAMS_SIZE_PADDED \
123 (WL1271_NVS_GENERAL_PARAMS_SIZE + 1)
124#define WL1271_NVS_STAT_RADIO_PARAMS_SIZE 17
125#define WL1271_NVS_STAT_RADIO_PARAMS_SIZE_PADDED \
126 (WL1271_NVS_STAT_RADIO_PARAMS_SIZE + 1)
127#define WL1271_NVS_DYN_RADIO_PARAMS_SIZE 65
128#define WL1271_NVS_DYN_RADIO_PARAMS_SIZE_PADDED \
129 (WL1271_NVS_DYN_RADIO_PARAMS_SIZE + 1)
130#define WL1271_NVS_FEM_COUNT 2
131#define WL1271_NVS_INI_SPARE_SIZE 124
132
133struct wl1271_nvs_file {
134 /* NVS section */
135 u8 nvs[WL1271_NVS_SECTION_SIZE];
136
137 /* INI section */
138 u8 general_params[WL1271_NVS_GENERAL_PARAMS_SIZE_PADDED];
139 u8 stat_radio_params[WL1271_NVS_STAT_RADIO_PARAMS_SIZE_PADDED];
140 u8 dyn_radio_params[WL1271_NVS_FEM_COUNT]
141 [WL1271_NVS_DYN_RADIO_PARAMS_SIZE_PADDED];
142 u8 ini_spare[WL1271_NVS_INI_SPARE_SIZE];
143} __attribute__ ((packed));
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300144
Juuso Oikarinen545f1da2009-10-08 21:56:23 +0300145/*
Teemu Paasikivi1ebec3d2009-10-13 12:47:48 +0300146 * Enable/disable 802.11a support for WL1273
147 */
148#undef WL1271_80211A_ENABLED
149
Juuso Oikarinen259da432010-03-26 12:53:18 +0200150#define WL1271_BUSY_WORD_CNT 1
Juuso Oikarinen545f1da2009-10-08 21:56:23 +0300151#define WL1271_BUSY_WORD_LEN (WL1271_BUSY_WORD_CNT * sizeof(u32))
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300152
153#define WL1271_ELP_HW_STATE_ASLEEP 0
154#define WL1271_ELP_HW_STATE_IRQ 1
155
Juuso Oikarinend94cd292009-10-08 21:56:25 +0300156#define WL1271_DEFAULT_BEACON_INT 100
157#define WL1271_DEFAULT_DTIM_PERIOD 1
158
Juuso Oikarinenc87dec92009-10-08 21:56:31 +0300159#define ACX_TX_DESCRIPTORS 32
Juuso Oikarinenbe7078c2009-10-08 21:56:26 +0300160
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300161enum wl1271_state {
162 WL1271_STATE_OFF,
163 WL1271_STATE_ON,
164 WL1271_STATE_PLT,
165};
166
167enum wl1271_partition_type {
168 PART_DOWN,
169 PART_WORK,
170 PART_DRPW,
171
172 PART_TABLE_LEN
173};
174
175struct wl1271_partition {
176 u32 size;
177 u32 start;
178};
179
180struct wl1271_partition_set {
181 struct wl1271_partition mem;
182 struct wl1271_partition reg;
Juuso Oikarinen451de972009-10-12 15:08:46 +0300183 struct wl1271_partition mem2;
184 struct wl1271_partition mem3;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300185};
186
187struct wl1271;
188
189/* FIXME: I'm not sure about this structure name */
190struct wl1271_chip {
191 u32 id;
192 char fw_ver[21];
193};
194
195struct wl1271_stats {
196 struct acx_statistics *fw_stats;
197 unsigned long fw_stats_update;
198
199 unsigned int retry_count;
200 unsigned int excessive_retries;
201};
202
203struct wl1271_debugfs {
204 struct dentry *rootdir;
205 struct dentry *fw_statistics;
206
207 struct dentry *tx_internal_desc_overflow;
208
209 struct dentry *rx_out_of_mem;
210 struct dentry *rx_hdr_overflow;
211 struct dentry *rx_hw_stuck;
212 struct dentry *rx_dropped;
213 struct dentry *rx_fcs_err;
214 struct dentry *rx_xfr_hint_trig;
215 struct dentry *rx_path_reset;
216 struct dentry *rx_reset_counter;
217
218 struct dentry *dma_rx_requested;
219 struct dentry *dma_rx_errors;
220 struct dentry *dma_tx_requested;
221 struct dentry *dma_tx_errors;
222
223 struct dentry *isr_cmd_cmplt;
224 struct dentry *isr_fiqs;
225 struct dentry *isr_rx_headers;
226 struct dentry *isr_rx_mem_overflow;
227 struct dentry *isr_rx_rdys;
228 struct dentry *isr_irqs;
229 struct dentry *isr_tx_procs;
230 struct dentry *isr_decrypt_done;
231 struct dentry *isr_dma0_done;
232 struct dentry *isr_dma1_done;
233 struct dentry *isr_tx_exch_complete;
234 struct dentry *isr_commands;
235 struct dentry *isr_rx_procs;
236 struct dentry *isr_hw_pm_mode_changes;
237 struct dentry *isr_host_acknowledges;
238 struct dentry *isr_pci_pm;
239 struct dentry *isr_wakeups;
240 struct dentry *isr_low_rssi;
241
242 struct dentry *wep_addr_key_count;
243 struct dentry *wep_default_key_count;
244 /* skipping wep.reserved */
245 struct dentry *wep_key_not_found;
246 struct dentry *wep_decrypt_fail;
247 struct dentry *wep_packets;
248 struct dentry *wep_interrupt;
249
250 struct dentry *pwr_ps_enter;
251 struct dentry *pwr_elp_enter;
252 struct dentry *pwr_missing_bcns;
253 struct dentry *pwr_wake_on_host;
254 struct dentry *pwr_wake_on_timer_exp;
255 struct dentry *pwr_tx_with_ps;
256 struct dentry *pwr_tx_without_ps;
257 struct dentry *pwr_rcvd_beacons;
258 struct dentry *pwr_power_save_off;
259 struct dentry *pwr_enable_ps;
260 struct dentry *pwr_disable_ps;
261 struct dentry *pwr_fix_tsf_ps;
262 /* skipping cont_miss_bcns_spread for now */
263 struct dentry *pwr_rcvd_awake_beacons;
264
265 struct dentry *mic_rx_pkts;
266 struct dentry *mic_calc_failure;
267
268 struct dentry *aes_encrypt_fail;
269 struct dentry *aes_decrypt_fail;
270 struct dentry *aes_encrypt_packets;
271 struct dentry *aes_decrypt_packets;
272 struct dentry *aes_encrypt_interrupt;
273 struct dentry *aes_decrypt_interrupt;
274
275 struct dentry *event_heart_beat;
276 struct dentry *event_calibration;
277 struct dentry *event_rx_mismatch;
278 struct dentry *event_rx_mem_empty;
279 struct dentry *event_rx_pool;
280 struct dentry *event_oom_late;
281 struct dentry *event_phy_transmit_error;
282 struct dentry *event_tx_stuck;
283
284 struct dentry *ps_pspoll_timeouts;
285 struct dentry *ps_upsd_timeouts;
286 struct dentry *ps_upsd_max_sptime;
287 struct dentry *ps_upsd_max_apturn;
288 struct dentry *ps_pspoll_max_apturn;
289 struct dentry *ps_pspoll_utilization;
290 struct dentry *ps_upsd_utilization;
291
292 struct dentry *rxpipe_rx_prep_beacon_drop;
293 struct dentry *rxpipe_descr_host_int_trig_rx_data;
294 struct dentry *rxpipe_beacon_buffer_thres_host_int_trig_rx_data;
295 struct dentry *rxpipe_missed_beacon_host_int_trig_rx_data;
296 struct dentry *rxpipe_tx_xfr_host_int_trig_rx_data;
297
298 struct dentry *tx_queue_len;
299
300 struct dentry *retry_count;
301 struct dentry *excessive_retries;
Luciano Coelho98b2a682009-12-11 15:40:52 +0200302 struct dentry *gpio_power;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300303};
304
305#define NUM_TX_QUEUES 4
306#define NUM_RX_PKT_DESC 8
307
308/* FW status registers */
309struct wl1271_fw_status {
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300310 __le32 intr;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300311 u8 fw_rx_counter;
312 u8 drv_rx_counter;
313 u8 reserved;
314 u8 tx_results_counter;
Luciano Coelhod0f63b22009-10-15 10:33:29 +0300315 __le32 rx_pkt_descs[NUM_RX_PKT_DESC];
316 __le32 tx_released_blks[NUM_TX_QUEUES];
317 __le32 fw_localtime;
318 __le32 padding[2];
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300319} __attribute__ ((packed));
320
321struct wl1271_rx_mem_pool_addr {
322 u32 addr;
323 u32 addr_extra;
324};
325
Teemu Paasikiviabb0b3b2009-10-13 12:47:50 +0300326struct wl1271_scan {
327 u8 state;
328 u8 ssid[IW_ESSID_MAX_SIZE+1];
329 size_t ssid_len;
330 u8 active;
331 u8 high_prio;
332 u8 probe_requests;
333};
334
Teemu Paasikivi8197b712010-02-22 08:38:23 +0200335struct wl1271_if_operations {
336 void (*read)(struct wl1271 *wl, int addr, void *buf, size_t len,
337 bool fixed);
338 void (*write)(struct wl1271 *wl, int addr, void *buf, size_t len,
339 bool fixed);
340 void (*reset)(struct wl1271 *wl);
341 void (*init)(struct wl1271 *wl);
Teemu Paasikivibecd5512010-03-18 12:26:27 +0200342 void (*power)(struct wl1271 *wl, bool enable);
Teemu Paasikivi8197b712010-02-22 08:38:23 +0200343 struct device* (*dev)(struct wl1271 *wl);
344 void (*enable_irq)(struct wl1271 *wl);
345 void (*disable_irq)(struct wl1271 *wl);
346};
347
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300348struct wl1271 {
Teemu Paasikivi3b56dd62010-03-18 12:26:46 +0200349 struct platform_device *plat_dev;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300350 struct ieee80211_hw *hw;
351 bool mac80211_registered;
352
Teemu Paasikivi8197b712010-02-22 08:38:23 +0200353 void *if_priv;
354
355 struct wl1271_if_operations *if_ops;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300356
357 void (*set_power)(bool enable);
358 int irq;
359
360 spinlock_t wl_lock;
361
362 enum wl1271_state state;
363 struct mutex mutex;
364
Juuso Oikarinen830fb672009-12-11 15:41:06 +0200365#define WL1271_FLAG_STA_RATES_CHANGED (0)
366#define WL1271_FLAG_STA_ASSOCIATED (1)
Juuso Oikarinen71449f82009-12-11 15:41:07 +0200367#define WL1271_FLAG_JOINED (2)
368#define WL1271_FLAG_GPIO_POWER (3)
369#define WL1271_FLAG_TX_QUEUE_STOPPED (4)
370#define WL1271_FLAG_SCANNING (5)
371#define WL1271_FLAG_IN_ELP (6)
372#define WL1271_FLAG_PSM (7)
373#define WL1271_FLAG_PSM_REQUESTED (8)
Juuso Oikarinen1e73eb62010-02-22 08:38:37 +0200374#define WL1271_FLAG_IRQ_PENDING (9)
375#define WL1271_FLAG_IRQ_RUNNING (10)
Juuso Oikarinen830fb672009-12-11 15:41:06 +0200376 unsigned long flags;
377
Juuso Oikarinen451de972009-10-12 15:08:46 +0300378 struct wl1271_partition_set part;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300379
380 struct wl1271_chip chip;
381
382 int cmd_box_addr;
383 int event_box_addr;
384
385 u8 *fw;
386 size_t fw_len;
Juuso Oikarinen152ee6e2010-02-18 13:25:42 +0200387 struct wl1271_nvs_file *nvs;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300388
389 u8 bssid[ETH_ALEN];
390 u8 mac_addr[ETH_ALEN];
391 u8 bss_type;
392 u8 ssid[IW_ESSID_MAX_SIZE + 1];
393 u8 ssid_len;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300394 int channel;
395
396 struct wl1271_acx_mem_map *target_mem_map;
397
398 /* Accounting for allocated / available TX blocks on HW */
399 u32 tx_blocks_freed[NUM_TX_QUEUES];
400 u32 tx_blocks_available;
Juuso Oikarinenffb591c2010-02-22 08:38:31 +0200401 u32 tx_results_count;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300402
403 /* Transmitted TX packets counter for chipset interface */
Juuso Oikarinenffb591c2010-02-22 08:38:31 +0200404 u32 tx_packets_count;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300405
406 /* Time-offset between host and chipset clocks */
Juuso Oikarinenac5e1e32010-02-22 08:38:38 +0200407 s64 time_offset;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300408
409 /* Session counter for the chipset */
410 int session_counter;
411
412 /* Frames scheduled for transmission, not handled yet */
413 struct sk_buff_head tx_queue;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300414
415 struct work_struct tx_work;
Juuso Oikarinenc87dec92009-10-08 21:56:31 +0300416
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300417 /* Pending TX frames */
Juuso Oikarinenbe7078c2009-10-08 21:56:26 +0300418 struct sk_buff *tx_frames[ACX_TX_DESCRIPTORS];
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300419
Juuso Oikarinenac4e4ce2009-10-08 21:56:19 +0300420 /* Security sequence number counters */
421 u8 tx_security_last_seq;
Juuso Oikarinen04e36fc2010-02-22 08:38:40 +0200422 s64 tx_security_seq;
Juuso Oikarinenac4e4ce2009-10-08 21:56:19 +0300423
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300424 /* FW Rx counter */
425 u32 rx_counter;
426
427 /* Rx memory pool address */
428 struct wl1271_rx_mem_pool_addr rx_mem_pool_addr;
429
430 /* The target interrupt mask */
431 struct work_struct irq_work;
432
433 /* The mbox event mask */
434 u32 event_mask;
435
436 /* Mailbox pointers */
437 u32 mbox_ptr[2];
438
439 /* Are we currently scanning */
Teemu Paasikiviabb0b3b2009-10-13 12:47:50 +0300440 struct wl1271_scan scan;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300441
442 /* Our association ID */
443 u16 aid;
444
Juuso Oikarinend94cd292009-10-08 21:56:25 +0300445 /* currently configured rate set */
Juuso Oikarinen830fb672009-12-11 15:41:06 +0200446 u32 sta_rate_set;
Juuso Oikarinend94cd292009-10-08 21:56:25 +0300447 u32 basic_rate_set;
Juuso Oikarinen830fb672009-12-11 15:41:06 +0200448 u32 rate_set;
Juuso Oikarinend94cd292009-10-08 21:56:25 +0300449
Juuso Oikarinen8a5a37a2009-10-08 21:56:24 +0300450 /* The current band */
451 enum ieee80211_band band;
452
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300453 /* Default key (for WEP) */
454 u32 default_key;
455
Juuso Oikarinen14b228a2010-03-18 12:26:43 +0200456 unsigned int filters;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300457 unsigned int rx_config;
458 unsigned int rx_filter;
459
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300460 struct completion *elp_compl;
Juuso Oikarinen37b70a82009-10-08 21:56:21 +0300461 struct delayed_work elp_work;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300462
Juuso Oikarinen19ad0712009-11-02 20:22:11 +0200463 /* retry counter for PSM entries */
464 u8 psm_entry_retry;
465
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300466 /* in dBm */
467 int power_level;
468
469 struct wl1271_stats stats;
470 struct wl1271_debugfs debugfs;
471
472 u32 buffer_32;
473 u32 buffer_cmd;
Juuso Oikarinen545f1da2009-10-08 21:56:23 +0300474 u32 buffer_busyword[WL1271_BUSY_WORD_CNT];
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300475
476 struct wl1271_fw_status *fw_status;
477 struct wl1271_tx_hw_res_if *tx_res_if;
Juuso Oikarinenb771eee2009-10-08 21:56:34 +0300478
479 struct ieee80211_vif *vif;
Luciano Coelhod6e19d12009-10-12 15:08:43 +0300480
Juuso Oikarinen2b60100b2009-10-13 12:47:39 +0300481 /* Current chipset configuration */
482 struct conf_drv_settings conf;
Juuso Oikarinen01c09162009-10-13 12:47:55 +0300483
Juuso Oikarinen7fc3a862010-03-18 12:26:32 +0200484 bool sg_enabled;
485
Juuso Oikarinen01c09162009-10-13 12:47:55 +0300486 struct list_head list;
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300487};
488
489int wl1271_plt_start(struct wl1271 *wl);
490int wl1271_plt_stop(struct wl1271 *wl);
491
492#define JOIN_TIMEOUT 5000 /* 5000 milliseconds to join */
493
494#define SESSION_COUNTER_MAX 7 /* maximum value for the session counter */
495
496#define WL1271_DEFAULT_POWER_LEVEL 0
497
Juuso Oikarinen06f7bc72010-02-22 08:38:33 +0200498#define WL1271_TX_QUEUE_LOW_WATERMARK 10
499#define WL1271_TX_QUEUE_HIGH_WATERMARK 25
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300500
Juuso Oikarinen01ac17e2009-12-11 15:41:02 +0200501/* WL1271 needs a 200ms sleep after power on, and a 20ms sleep before power
502 on in case is has been shut down shortly before */
503#define WL1271_PRE_POWER_ON_SLEEP 20 /* in miliseconds */
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300504#define WL1271_POWER_ON_SLEEP 200 /* in miliseconds */
505
Teemu Paasikivi1ebec3d2009-10-13 12:47:48 +0300506static inline bool wl1271_11a_enabled(void)
507{
Juuso Oikarinen152ee6e2010-02-18 13:25:42 +0200508 /* FIXME: this could be determined based on the NVS-INI file */
Teemu Paasikivi1ebec3d2009-10-13 12:47:48 +0300509#ifdef WL1271_80211A_ENABLED
510 return true;
511#else
512 return false;
513#endif
514}
515
Luciano Coelhof5fc0f82009-08-06 16:25:28 +0300516#endif