Commit | Line | Data |
---|---|---|
f5fc0f86 LC |
1 | /* |
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_RX_H__ | |
26 | #define __WL1271_RX_H__ | |
27 | ||
28 | #include <linux/bitops.h> | |
29 | ||
30 | #define WL1271_RX_MAX_RSSI -30 | |
31 | #define WL1271_RX_MIN_RSSI -95 | |
32 | ||
33 | #define WL1271_RX_ALIGN_TO 4 | |
34 | #define WL1271_RX_ALIGN(len) (((len) + WL1271_RX_ALIGN_TO - 1) & \ | |
35 | ~(WL1271_RX_ALIGN_TO - 1)) | |
36 | ||
37 | #define SHORT_PREAMBLE_BIT BIT(0) | |
38 | #define OFDM_RATE_BIT BIT(6) | |
39 | #define PBCC_RATE_BIT BIT(7) | |
40 | ||
41 | #define PLCP_HEADER_LENGTH 8 | |
42 | #define RX_DESC_PACKETID_SHIFT 11 | |
43 | #define RX_MAX_PACKET_ID 3 | |
44 | ||
45 | #define NUM_RX_PKT_DESC_MOD_MASK 7 | |
46 | #define WL1271_RX_RATE_UNSUPPORTED 0xFF | |
47 | ||
48 | #define RX_DESC_VALID_FCS 0x0001 | |
49 | #define RX_DESC_MATCH_RXADDR1 0x0002 | |
50 | #define RX_DESC_MCAST 0x0004 | |
51 | #define RX_DESC_STAINTIM 0x0008 | |
52 | #define RX_DESC_VIRTUAL_BM 0x0010 | |
53 | #define RX_DESC_BCAST 0x0020 | |
54 | #define RX_DESC_MATCH_SSID 0x0040 | |
55 | #define RX_DESC_MATCH_BSSID 0x0080 | |
56 | #define RX_DESC_ENCRYPTION_MASK 0x0300 | |
57 | #define RX_DESC_MEASURMENT 0x0400 | |
58 | #define RX_DESC_SEQNUM_MASK 0x1800 | |
59 | #define RX_DESC_MIC_FAIL 0x2000 | |
60 | #define RX_DESC_DECRYPT_FAIL 0x4000 | |
61 | ||
62 | /* | |
63 | * RX Descriptor flags: | |
64 | * | |
65 | * Bits 0-1 - band | |
66 | * Bit 2 - STBC | |
67 | * Bit 3 - A-MPDU | |
68 | * Bit 4 - HT | |
69 | * Bits 5-7 - encryption | |
70 | */ | |
71 | #define WL1271_RX_DESC_BAND_MASK 0x03 | |
72 | #define WL1271_RX_DESC_ENCRYPT_MASK 0xE0 | |
73 | ||
74 | #define WL1271_RX_DESC_BAND_BG 0x00 | |
75 | #define WL1271_RX_DESC_BAND_J 0x01 | |
76 | #define WL1271_RX_DESC_BAND_A 0x02 | |
77 | ||
78 | #define WL1271_RX_DESC_STBC BIT(2) | |
79 | #define WL1271_RX_DESC_A_MPDU BIT(3) | |
80 | #define WL1271_RX_DESC_HT BIT(4) | |
81 | ||
82 | #define WL1271_RX_DESC_ENCRYPT_WEP 0x20 | |
83 | #define WL1271_RX_DESC_ENCRYPT_TKIP 0x40 | |
84 | #define WL1271_RX_DESC_ENCRYPT_AES 0x60 | |
85 | #define WL1271_RX_DESC_ENCRYPT_GEM 0x80 | |
86 | ||
87 | /* | |
88 | * RX Descriptor status | |
89 | * | |
90 | * Bits 0-2 - status | |
91 | * Bits 3-7 - reserved | |
92 | */ | |
93 | #define WL1271_RX_DESC_STATUS_MASK 0x07 | |
94 | ||
95 | #define WL1271_RX_DESC_SUCCESS 0x00 | |
96 | #define WL1271_RX_DESC_DECRYPT_FAIL 0x01 | |
97 | #define WL1271_RX_DESC_MIC_FAIL 0x02 | |
98 | #define WL1271_RX_DESC_DRIVER_RX_Q_FAIL 0x03 | |
99 | ||
100 | #define RX_MEM_BLOCK_MASK 0xFF | |
101 | #define RX_BUF_SIZE_MASK 0xFFF00 | |
102 | #define RX_BUF_SIZE_SHIFT_DIV 6 | |
103 | ||
104 | struct wl1271_rx_descriptor { | |
105 | u16 length; | |
106 | u8 status; | |
107 | u8 flags; | |
108 | u8 rate; | |
109 | u8 channel; | |
110 | s8 rssi; | |
111 | u8 snr; | |
112 | u32 timestamp; | |
113 | u8 packet_class; | |
114 | u8 process_id; | |
115 | u8 pad_len; | |
116 | u8 reserved; | |
117 | } __attribute__ ((packed)); | |
118 | ||
119 | void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_status *status); | |
120 | ||
121 | #endif |