-#define is_rts_frame(__fc) \
- ( !!((((__fc) & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) && \
- (((__fc) & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_RTS)) )
-#define is_cts_frame(__fc) \
- ( !!((((__fc) & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) && \
- (((__fc) & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_CTS)) )
-#define is_probe_resp(__fc) \
- ( !!((((__fc) & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_MGMT) && \
- (((__fc) & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PROBE_RESP)) )
-
-/*
- * Interval defines
- */
-#define LINK_TUNE_INTERVAL ( 1 * HZ )
-#define RFKILL_POLL_INTERVAL ( HZ / 4 )
-
-/*
- * TX result flags.
- */
-enum TX_STATUS {
- TX_SUCCESS = 0,
- TX_SUCCESS_RETRY = 1,
- TX_FAIL_RETRY = 2,
- TX_FAIL_INVALID = 3,
- TX_FAIL_OTHER = 4,
-};
-
-/*
- * Antenna values
- */
-enum antenna {
- ANTENNA_DIVERSITY = 0,
- ANTENNA_A = 1,
- ANTENNA_B = 2,
-};
-
-/*
- * Led mode values.
- */
-enum led_mode {
- LED_MODE_DEFAULT = 0,
- LED_MODE_TXRX_ACTIVITY = 1,
- LED_MODE_SIGNAL_STRENGTH = 2,
- LED_MODE_ASUS = 3,
- LED_MODE_ALPHA = 4,
-};
-
-/*
- * Device states
- */
-enum dev_state {
- STATE_DEEP_SLEEP = 0,
- STATE_SLEEP = 1,
- STATE_STANDBY = 2,
- STATE_AWAKE = 3,
-
-/*
- * Additional device states, these values are
- * not strict since they are not directly passed
- * into the device.
- */
- STATE_RADIO_ON,
- STATE_RADIO_OFF,
- STATE_RADIO_RX_ON,
- STATE_RADIO_RX_OFF,
-};
-
-/*
- * IFS backoff values
- */
-enum ifs {
- IFS_BACKOFF = 0,
- IFS_SIFS = 1,
- IFS_NEW_BACKOFF = 2,
- IFS_NONE = 3,
-};
-
-/*
- * Cipher types for hardware encryption
- */
-enum cipher {
- CIPHER_NONE = 0,
- CIPHER_WEP64 = 1,
- CIPHER_WEP128 = 2,
- CIPHER_TKIP = 3,
- CIPHER_AES = 4,
-/*
- * The following fields were added by rt61pci and rt73usb.
- */
- CIPHER_CKIP64 = 5,
- CIPHER_CKIP128 = 6,
- CIPHER_TKIP_NO_MIC = 7,
-};
-
-/*
- * Register handlers.
- * We store the position of a register field inside a field structure,
- * This will simplify the process of setting and reading a certain field
- * inside the register while making sure the process remains byte order safe.
- */
-struct rt2x00_field8 {
- u8 bit_offset;
- u8 bit_mask;
-};
-
-struct rt2x00_field16 {
- u16 bit_offset;
- u16 bit_mask;
-};
-
-struct rt2x00_field32 {
- u32 bit_offset;
- u32 bit_mask;
-};
-
-/*
- * Power of two check from Linus Torvalds,
- * this will check if the mask that has been
- * given contains and contiguous set of bits.
- */
-#define is_power_of_two(x) ( !((x) & ((x)-1)) )
-#define low_bit_mask(x) ( ((x)-1) & ~(x) )
-#define is_valid_mask(x) is_power_of_two(1 + (x) + low_bit_mask(x))
-
-#define FIELD8(__mask) \
-({ \
- BUILD_BUG_ON(!(__mask) || \
- !is_valid_mask(__mask) || \
- (__mask) != (u8)(__mask)); \
- (struct rt2x00_field8) { \
- __ffs(__mask), (__mask) \
- }; \
-})
-
-#define FIELD16(__mask) \
-({ \
- BUILD_BUG_ON(!(__mask) || \
- !is_valid_mask(__mask) || \
- (__mask) != (u16)(__mask));\
- (struct rt2x00_field16) { \
- __ffs(__mask), (__mask) \
- }; \
-})
-
-#define FIELD32(__mask) \
-({ \
- BUILD_BUG_ON(!(__mask) || \
- !is_valid_mask(__mask) || \
- (__mask) != (u32)(__mask));\
- (struct rt2x00_field32) { \
- __ffs(__mask), (__mask) \
- }; \
-})
-
-static inline void rt2x00_set_field32(u32 *reg,
- const struct rt2x00_field32 field, const u32 value)
-{
- *reg &= ~(field.bit_mask);
- *reg |= (value << field.bit_offset) & field.bit_mask;
-}
-
-static inline u32 rt2x00_get_field32(const u32 reg,
- const struct rt2x00_field32 field)
-{
- return (reg & field.bit_mask) >> field.bit_offset;
-}
-
-static inline void rt2x00_set_field16(u16 *reg,
- const struct rt2x00_field16 field, const u16 value)