2 * This file is part of wl12xx
4 * Copyright (c) 1998-2007 Texas Instruments Incorporated
5 * Copyright (C) 2008 Nokia Corporation
7 * Contact: Kalle Valo <kalle.valo@nokia.com>
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.
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.
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
25 #ifndef __WL12XX_RX_H__
26 #define __WL12XX_RX_H__
28 #include <linux/bitops.h>
33 * The Rx path uses a double buffer and an rx_contro structure, each located
34 * at a fixed address in the device memory. The host keeps track of which
35 * buffer is available and alternates between them on a per packet basis.
36 * The size of each of the two buffers is large enough to hold the longest
38 * The RX path goes like that:
39 * 1) The target generates an interrupt each time a new packet is received.
40 * There are 2 RX interrupts, one for each buffer.
41 * 2) The host reads the received packet from one of the double buffers.
42 * 3) The host triggers a target interrupt.
43 * 4) The target prepares the next RX packet.
46 #define WL12XX_RX_MAX_RSSI -30
47 #define WL12XX_RX_MIN_RSSI -95
49 #define WL12XX_RX_ALIGN_TO 4
50 #define WL12XX_RX_ALIGN(len) (((len) + WL12XX_RX_ALIGN_TO - 1) & \
51 ~(WL12XX_RX_ALIGN_TO - 1))
53 #define SHORT_PREAMBLE_BIT BIT(0)
54 #define OFDM_RATE_BIT BIT(6)
55 #define PBCC_RATE_BIT BIT(7)
57 #define PLCP_HEADER_LENGTH 8
58 #define RX_DESC_PACKETID_SHIFT 11
59 #define RX_MAX_PACKET_ID 3
61 #define RX_DESC_VALID_FCS 0x0001
62 #define RX_DESC_MATCH_RXADDR1 0x0002
63 #define RX_DESC_MCAST 0x0004
64 #define RX_DESC_STAINTIM 0x0008
65 #define RX_DESC_VIRTUAL_BM 0x0010
66 #define RX_DESC_BCAST 0x0020
67 #define RX_DESC_MATCH_SSID 0x0040
68 #define RX_DESC_MATCH_BSSID 0x0080
69 #define RX_DESC_ENCRYPTION_MASK 0x0300
70 #define RX_DESC_MEASURMENT 0x0400
71 #define RX_DESC_SEQNUM_MASK 0x1800
72 #define RX_DESC_MIC_FAIL 0x2000
73 #define RX_DESC_DECRYPT_FAIL 0x4000
75 struct wl12xx_rx_descriptor
{
76 u32 timestamp
; /* In microseconds */
77 u16 length
; /* Paylod length, including headers */
106 u8 mod_pre
; /* Modulation and preamble */
118 } __attribute__ ((packed
));
120 void wl12xx_rx(struct wl12xx
*wl
);