1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * This file is part of wl1251
5 * Copyright (c) 1998-2007 Texas Instruments Incorporated
6 * Copyright (C) 2008 Nokia Corporation
9 #ifndef __WL1251_RX_H__
10 #define __WL1251_RX_H__
12 #include <linux/bitops.h>
19 * The Rx path uses a double buffer and an rx_contro structure, each located
20 * at a fixed address in the device memory. The host keeps track of which
21 * buffer is available and alternates between them on a per packet basis.
22 * The size of each of the two buffers is large enough to hold the longest
24 * The RX path goes like that:
25 * 1) The target generates an interrupt each time a new packet is received.
26 * There are 2 RX interrupts, one for each buffer.
27 * 2) The host reads the received packet from one of the double buffers.
28 * 3) The host triggers a target interrupt.
29 * 4) The target prepares the next RX packet.
32 #define WL1251_RX_MAX_RSSI -30
33 #define WL1251_RX_MIN_RSSI -95
35 #define WL1251_RX_ALIGN_TO 4
36 #define WL1251_RX_ALIGN(len) (((len) + WL1251_RX_ALIGN_TO - 1) & \
37 ~(WL1251_RX_ALIGN_TO - 1))
39 #define SHORT_PREAMBLE_BIT BIT(0)
40 #define OFDM_RATE_BIT BIT(6)
41 #define PBCC_RATE_BIT BIT(7)
43 #define PLCP_HEADER_LENGTH 8
44 #define RX_DESC_PACKETID_SHIFT 11
45 #define RX_MAX_PACKET_ID 3
47 #define RX_DESC_VALID_FCS 0x0001
48 #define RX_DESC_MATCH_RXADDR1 0x0002
49 #define RX_DESC_MCAST 0x0004
50 #define RX_DESC_STAINTIM 0x0008
51 #define RX_DESC_VIRTUAL_BM 0x0010
52 #define RX_DESC_BCAST 0x0020
53 #define RX_DESC_MATCH_SSID 0x0040
54 #define RX_DESC_MATCH_BSSID 0x0080
55 #define RX_DESC_ENCRYPTION_MASK 0x0300
56 #define RX_DESC_MEASURMENT 0x0400
57 #define RX_DESC_SEQNUM_MASK 0x1800
58 #define RX_DESC_MIC_FAIL 0x2000
59 #define RX_DESC_DECRYPT_FAIL 0x4000
61 struct wl1251_rx_descriptor
{
62 u32 timestamp
; /* In microseconds */
63 u16 length
; /* Paylod length, including headers */
92 u8 mod_pre
; /* Modulation and preamble */
106 void wl1251_rx(struct wl1251
*wl
);