zd_ieee80211.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef _ZD_IEEE80211_H
  2. #define _ZD_IEEE80211_H
  3. #include <net/ieee80211.h>
  4. #include "zd_types.h"
  5. /* Additional definitions from the standards.
  6. */
  7. #define ZD_REGDOMAIN_FCC 0x10
  8. #define ZD_REGDOMAIN_IC 0x20
  9. #define ZD_REGDOMAIN_ETSI 0x30
  10. #define ZD_REGDOMAIN_SPAIN 0x31
  11. #define ZD_REGDOMAIN_FRANCE 0x32
  12. #define ZD_REGDOMAIN_JAPAN_ADD 0x40
  13. #define ZD_REGDOMAIN_JAPAN 0x41
  14. enum {
  15. MIN_CHANNEL24 = 1,
  16. MAX_CHANNEL24 = 14,
  17. };
  18. struct channel_range {
  19. u8 start;
  20. u8 end; /* exclusive (channel must be less than end) */
  21. };
  22. struct iw_freq;
  23. int zd_geo_init(struct ieee80211_device *ieee, u8 regdomain);
  24. const struct channel_range *zd_channel_range(u8 regdomain);
  25. int zd_regdomain_supports_channel(u8 regdomain, u8 channel);
  26. int zd_regdomain_supported(u8 regdomain);
  27. /* for 2.4 GHz band */
  28. int zd_channel_to_freq(struct iw_freq *freq, u8 channel);
  29. int zd_find_channel(u8 *channel, const struct iw_freq *freq);
  30. #define ZD_PLCP_SERVICE_LENGTH_EXTENSION 0x80
  31. struct ofdm_plcp_header {
  32. u8 prefix[3];
  33. __le16 service;
  34. } __attribute__((packed));
  35. static inline u8 zd_ofdm_plcp_header_rate(
  36. const struct ofdm_plcp_header *header)
  37. {
  38. return header->prefix[0] & 0xf;
  39. }
  40. #define ZD_OFDM_RATE_6M 0xb
  41. #define ZD_OFDM_RATE_9M 0xf
  42. #define ZD_OFDM_RATE_12M 0xa
  43. #define ZD_OFDM_RATE_18M 0xe
  44. #define ZD_OFDM_RATE_24M 0x9
  45. #define ZD_OFDM_RATE_36M 0xd
  46. #define ZD_OFDM_RATE_48M 0x8
  47. #define ZD_OFDM_RATE_54M 0xc
  48. struct cck_plcp_header {
  49. u8 signal;
  50. u8 service;
  51. __le16 length;
  52. __le16 crc16;
  53. };
  54. static inline u8 zd_cck_plcp_header_rate(const struct cck_plcp_header *header)
  55. {
  56. return header->signal;
  57. }
  58. #define ZD_CCK_SIGNAL_1M 0x0a
  59. #define ZD_CCK_SIGNAL_2M 0x14
  60. #define ZD_CCK_SIGNAL_5M5 0x37
  61. #define ZD_CCK_SIGNAL_11M 0x6e
  62. enum ieee80211_std {
  63. IEEE80211B = 0x01,
  64. IEEE80211A = 0x02,
  65. IEEE80211G = 0x04,
  66. };
  67. #endif /* _ZD_IEEE80211_H */