wl1251_rx.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * This file is part of wl1251
  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 __WL1251_RX_H__
  25. #define __WL1251_RX_H__
  26. #include <linux/bitops.h>
  27. #include "wl1251.h"
  28. /*
  29. * RX PATH
  30. *
  31. * The Rx path uses a double buffer and an rx_contro structure, each located
  32. * at a fixed address in the device memory. The host keeps track of which
  33. * buffer is available and alternates between them on a per packet basis.
  34. * The size of each of the two buffers is large enough to hold the longest
  35. * 802.3 packet.
  36. * The RX path goes like that:
  37. * 1) The target generates an interrupt each time a new packet is received.
  38. * There are 2 RX interrupts, one for each buffer.
  39. * 2) The host reads the received packet from one of the double buffers.
  40. * 3) The host triggers a target interrupt.
  41. * 4) The target prepares the next RX packet.
  42. */
  43. #define WL1251_RX_MAX_RSSI -30
  44. #define WL1251_RX_MIN_RSSI -95
  45. #define WL1251_RX_ALIGN_TO 4
  46. #define WL1251_RX_ALIGN(len) (((len) + WL1251_RX_ALIGN_TO - 1) & \
  47. ~(WL1251_RX_ALIGN_TO - 1))
  48. #define SHORT_PREAMBLE_BIT BIT(0)
  49. #define OFDM_RATE_BIT BIT(6)
  50. #define PBCC_RATE_BIT BIT(7)
  51. #define PLCP_HEADER_LENGTH 8
  52. #define RX_DESC_PACKETID_SHIFT 11
  53. #define RX_MAX_PACKET_ID 3
  54. #define RX_DESC_VALID_FCS 0x0001
  55. #define RX_DESC_MATCH_RXADDR1 0x0002
  56. #define RX_DESC_MCAST 0x0004
  57. #define RX_DESC_STAINTIM 0x0008
  58. #define RX_DESC_VIRTUAL_BM 0x0010
  59. #define RX_DESC_BCAST 0x0020
  60. #define RX_DESC_MATCH_SSID 0x0040
  61. #define RX_DESC_MATCH_BSSID 0x0080
  62. #define RX_DESC_ENCRYPTION_MASK 0x0300
  63. #define RX_DESC_MEASURMENT 0x0400
  64. #define RX_DESC_SEQNUM_MASK 0x1800
  65. #define RX_DESC_MIC_FAIL 0x2000
  66. #define RX_DESC_DECRYPT_FAIL 0x4000
  67. struct wl1251_rx_descriptor {
  68. u32 timestamp; /* In microseconds */
  69. u16 length; /* Paylod length, including headers */
  70. u16 flags;
  71. /*
  72. * 0 - 802.11
  73. * 1 - 802.3
  74. * 2 - IP
  75. * 3 - Raw Codec
  76. */
  77. u8 type;
  78. /*
  79. * Received Rate:
  80. * 0x0A - 1MBPS
  81. * 0x14 - 2MBPS
  82. * 0x37 - 5_5MBPS
  83. * 0x0B - 6MBPS
  84. * 0x0F - 9MBPS
  85. * 0x6E - 11MBPS
  86. * 0x0A - 12MBPS
  87. * 0x0E - 18MBPS
  88. * 0xDC - 22MBPS
  89. * 0x09 - 24MBPS
  90. * 0x0D - 36MBPS
  91. * 0x08 - 48MBPS
  92. * 0x0C - 54MBPS
  93. */
  94. u8 rate;
  95. u8 mod_pre; /* Modulation and preamble */
  96. u8 channel;
  97. /*
  98. * 0 - 2.4 Ghz
  99. * 1 - 5 Ghz
  100. */
  101. u8 band;
  102. s8 rssi; /* in dB */
  103. u8 rcpi; /* in dB */
  104. u8 snr; /* in dB */
  105. } __attribute__ ((packed));
  106. void wl1251_rx(struct wl1251 *wl);
  107. #endif