zd_ieee80211.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef _ZD_IEEE80211_H
  2. #define _ZD_IEEE80211_H
  3. #include <net/ieee80211.h>
  4. /* Additional definitions from the standards.
  5. */
  6. #define ZD_REGDOMAIN_FCC 0x10
  7. #define ZD_REGDOMAIN_IC 0x20
  8. #define ZD_REGDOMAIN_ETSI 0x30
  9. #define ZD_REGDOMAIN_SPAIN 0x31
  10. #define ZD_REGDOMAIN_FRANCE 0x32
  11. #define ZD_REGDOMAIN_JAPAN_ADD 0x40
  12. #define ZD_REGDOMAIN_JAPAN 0x41
  13. enum {
  14. MIN_CHANNEL24 = 1,
  15. MAX_CHANNEL24 = 14,
  16. };
  17. struct channel_range {
  18. u8 start;
  19. u8 end; /* exclusive (channel must be less than end) */
  20. };
  21. struct iw_freq;
  22. int zd_geo_init(struct ieee80211_device *ieee, u8 regdomain);
  23. const struct channel_range *zd_channel_range(u8 regdomain);
  24. int zd_regdomain_supports_channel(u8 regdomain, u8 channel);
  25. int zd_regdomain_supported(u8 regdomain);
  26. /* for 2.4 GHz band */
  27. int zd_channel_to_freq(struct iw_freq *freq, u8 channel);
  28. int zd_find_channel(u8 *channel, const struct iw_freq *freq);
  29. #define ZD_PLCP_SERVICE_LENGTH_EXTENSION 0x80
  30. struct ofdm_plcp_header {
  31. u8 prefix[3];
  32. __le16 service;
  33. } __attribute__((packed));
  34. static inline u8 zd_ofdm_plcp_header_rate(const struct ofdm_plcp_header *header)
  35. {
  36. return header->prefix[0] & 0xf;
  37. }
  38. /* The following defines give the encoding of the 4-bit rate field in the
  39. * OFDM (802.11a/802.11g) PLCP header. Notify that these values are used to
  40. * define the zd-rate values for OFDM.
  41. *
  42. * See the struct zd_ctrlset definition in zd_mac.h.
  43. */
  44. #define ZD_OFDM_PLCP_RATE_6M 0xb
  45. #define ZD_OFDM_PLCP_RATE_9M 0xf
  46. #define ZD_OFDM_PLCP_RATE_12M 0xa
  47. #define ZD_OFDM_PLCP_RATE_18M 0xe
  48. #define ZD_OFDM_PLCP_RATE_24M 0x9
  49. #define ZD_OFDM_PLCP_RATE_36M 0xd
  50. #define ZD_OFDM_PLCP_RATE_48M 0x8
  51. #define ZD_OFDM_PLCP_RATE_54M 0xc
  52. struct cck_plcp_header {
  53. u8 signal;
  54. u8 service;
  55. __le16 length;
  56. __le16 crc16;
  57. } __attribute__((packed));
  58. static inline u8 zd_cck_plcp_header_signal(const struct cck_plcp_header *header)
  59. {
  60. return header->signal;
  61. }
  62. /* These defines give the encodings of the signal field in the 802.11b PLCP
  63. * header. The signal field gives the bit rate of the following packet. Even
  64. * if technically wrong we use CCK here also for the 1 MBit/s and 2 MBit/s
  65. * rate to stay consistent with Zydas and our use of the term.
  66. *
  67. * Notify that these values are *not* used in the zd-rates.
  68. */
  69. #define ZD_CCK_PLCP_SIGNAL_1M 0x0a
  70. #define ZD_CCK_PLCP_SIGNAL_2M 0x14
  71. #define ZD_CCK_PLCP_SIGNAL_5M5 0x37
  72. #define ZD_CCK_PLCP_SIGNAL_11M 0x6e
  73. enum ieee80211_std {
  74. IEEE80211B = 0x01,
  75. IEEE80211A = 0x02,
  76. IEEE80211G = 0x04,
  77. };
  78. #endif /* _ZD_IEEE80211_H */