rx.h 3.2 KB

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