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