rx.h 2.5 KB

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