zd_ieee80211.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* ZD1211 USB-WLAN driver for Linux
  2. *
  3. * Copyright (C) 2005-2007 Ulrich Kunitz <kune@deine-taler.de>
  4. * Copyright (C) 2006-2007 Daniel Drake <dsd@gentoo.org>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #ifndef _ZD_IEEE80211_H
  21. #define _ZD_IEEE80211_H
  22. #include <net/mac80211.h>
  23. /* Additional definitions from the standards.
  24. */
  25. #define ZD_REGDOMAIN_FCC 0x10
  26. #define ZD_REGDOMAIN_IC 0x20
  27. #define ZD_REGDOMAIN_ETSI 0x30
  28. #define ZD_REGDOMAIN_SPAIN 0x31
  29. #define ZD_REGDOMAIN_FRANCE 0x32
  30. #define ZD_REGDOMAIN_JAPAN_ADD 0x40
  31. #define ZD_REGDOMAIN_JAPAN 0x41
  32. enum {
  33. MIN_CHANNEL24 = 1,
  34. MAX_CHANNEL24 = 14,
  35. };
  36. void zd_geo_init(struct ieee80211_hw *hw, u8 regdomain);
  37. #define ZD_PLCP_SERVICE_LENGTH_EXTENSION 0x80
  38. struct ofdm_plcp_header {
  39. u8 prefix[3];
  40. __le16 service;
  41. } __attribute__((packed));
  42. static inline u8 zd_ofdm_plcp_header_rate(const struct ofdm_plcp_header *header)
  43. {
  44. return header->prefix[0] & 0xf;
  45. }
  46. /* The following defines give the encoding of the 4-bit rate field in the
  47. * OFDM (802.11a/802.11g) PLCP header. Notify that these values are used to
  48. * define the zd-rate values for OFDM.
  49. *
  50. * See the struct zd_ctrlset definition in zd_mac.h.
  51. */
  52. #define ZD_OFDM_PLCP_RATE_6M 0xb
  53. #define ZD_OFDM_PLCP_RATE_9M 0xf
  54. #define ZD_OFDM_PLCP_RATE_12M 0xa
  55. #define ZD_OFDM_PLCP_RATE_18M 0xe
  56. #define ZD_OFDM_PLCP_RATE_24M 0x9
  57. #define ZD_OFDM_PLCP_RATE_36M 0xd
  58. #define ZD_OFDM_PLCP_RATE_48M 0x8
  59. #define ZD_OFDM_PLCP_RATE_54M 0xc
  60. struct cck_plcp_header {
  61. u8 signal;
  62. u8 service;
  63. __le16 length;
  64. __le16 crc16;
  65. } __attribute__((packed));
  66. static inline u8 zd_cck_plcp_header_signal(const struct cck_plcp_header *header)
  67. {
  68. return header->signal;
  69. }
  70. /* These defines give the encodings of the signal field in the 802.11b PLCP
  71. * header. The signal field gives the bit rate of the following packet. Even
  72. * if technically wrong we use CCK here also for the 1 MBit/s and 2 MBit/s
  73. * rate to stay consistent with Zydas and our use of the term.
  74. *
  75. * Notify that these values are *not* used in the zd-rates.
  76. */
  77. #define ZD_CCK_PLCP_SIGNAL_1M 0x0a
  78. #define ZD_CCK_PLCP_SIGNAL_2M 0x14
  79. #define ZD_CCK_PLCP_SIGNAL_5M5 0x37
  80. #define ZD_CCK_PLCP_SIGNAL_11M 0x6e
  81. #endif /* _ZD_IEEE80211_H */