diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/ar5211.c | 18 | ||||
-rw-r--r-- | sys/dev/ic/ar5212.c | 30 | ||||
-rw-r--r-- | sys/dev/ic/ar5xxx.h | 7 |
3 files changed, 36 insertions, 19 deletions
diff --git a/sys/dev/ic/ar5211.c b/sys/dev/ic/ar5211.c index b7d377807a2..bbbb593270f 100644 --- a/sys/dev/ic/ar5211.c +++ b/sys/dev/ic/ar5211.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar5211.c,v 1.27 2006/09/19 13:37:11 reyk Exp $ */ +/* $OpenBSD: ar5211.c,v 1.28 2006/09/19 16:42:29 reyk Exp $ */ /* * Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org> @@ -423,23 +423,29 @@ ar5k_ar5211_reset(struct ath_hal *hal, HAL_OPMODE op_mode, HAL_CHANNEL *channel, */ hal->ah_op_mode = op_mode; - if (channel->c_channel_flags & IEEE80211_CHAN_A) { + switch (channel->c_channel_flags & CHANNEL_MODES) { + case CHANNEL_A: mode = AR5K_INI_VAL_11A; freq = AR5K_INI_RFGAIN_5GHZ; ee_mode = AR5K_EEPROM_MODE_11A; - } else if (channel->c_channel_flags & IEEE80211_CHAN_T) { + break; + case CHANNEL_T: mode = AR5K_INI_VAL_11A_TURBO; freq = AR5K_INI_RFGAIN_5GHZ; ee_mode = AR5K_EEPROM_MODE_11A; - } else if (channel->c_channel_flags & IEEE80211_CHAN_B) { + break; + case CHANNEL_B: mode = AR5K_INI_VAL_11B; freq = AR5K_INI_RFGAIN_2GHZ; ee_mode = AR5K_EEPROM_MODE_11B; - } else if (channel->c_channel_flags & IEEE80211_CHAN_G) { + break; + case CHANNEL_G: + case CHANNEL_PUREG: mode = AR5K_INI_VAL_11G; freq = AR5K_INI_RFGAIN_2GHZ; ee_mode = AR5K_EEPROM_MODE_11G; - } else { + break; + default: AR5K_PRINTF("invalid channel: %d\n", channel->c_channel); return (AH_FALSE); } diff --git a/sys/dev/ic/ar5212.c b/sys/dev/ic/ar5212.c index 8ccb60e252a..965aab792d0 100644 --- a/sys/dev/ic/ar5212.c +++ b/sys/dev/ic/ar5212.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar5212.c,v 1.31 2006/09/19 13:25:54 reyk Exp $ */ +/* $OpenBSD: ar5212.c,v 1.32 2006/09/19 16:42:29 reyk Exp $ */ /* * Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org> @@ -452,31 +452,39 @@ ar5k_ar5212_reset(struct ath_hal *hal, HAL_OPMODE op_mode, HAL_CHANNEL *channel, return (AH_FALSE); } - if (channel->c_channel_flags & IEEE80211_CHAN_A) { + switch (channel->c_channel_flags & CHANNEL_MODES) { + case CHANNEL_A: mode = AR5K_INI_VAL_11A; freq = AR5K_INI_RFGAIN_5GHZ; ee_mode = AR5K_EEPROM_MODE_11A; - } else if (channel->c_channel_flags & IEEE80211_CHAN_T) { - mode = AR5K_INI_VAL_11A_TURBO; - freq = AR5K_INI_RFGAIN_5GHZ; - ee_mode = AR5K_EEPROM_MODE_11A; - } else if (channel->c_channel_flags & IEEE80211_CHAN_B) { + break; + case CHANNEL_B: mode = AR5K_INI_VAL_11B; freq = AR5K_INI_RFGAIN_2GHZ; ee_mode = AR5K_EEPROM_MODE_11B; - } else if (channel->c_channel_flags & IEEE80211_CHAN_G) { + break; + case CHANNEL_G: + case CHANNEL_PUREG: mode = AR5K_INI_VAL_11G; freq = AR5K_INI_RFGAIN_2GHZ; ee_mode = AR5K_EEPROM_MODE_11G; - } else if (channel->c_channel_flags & CHANNEL_TG) { + break; + case CHANNEL_T: + mode = AR5K_INI_VAL_11A_TURBO; + freq = AR5K_INI_RFGAIN_5GHZ; + ee_mode = AR5K_EEPROM_MODE_11A; + break; + case CHANNEL_TG: mode = AR5K_INI_VAL_11G_TURBO; freq = AR5K_INI_RFGAIN_2GHZ; ee_mode = AR5K_EEPROM_MODE_11G; - } else if (channel->c_channel_flags & CHANNEL_XR) { + break; + case CHANNEL_XR: mode = AR5K_INI_VAL_XR; freq = AR5K_INI_RFGAIN_5GHZ; ee_mode = AR5K_EEPROM_MODE_11A; - } else { + break; + default: AR5K_PRINTF("invalid channel: %d\n", channel->c_channel); return (AH_FALSE); } diff --git a/sys/dev/ic/ar5xxx.h b/sys/dev/ic/ar5xxx.h index 5d89ac29423..813c7610bcf 100644 --- a/sys/dev/ic/ar5xxx.h +++ b/sys/dev/ic/ar5xxx.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ar5xxx.h,v 1.32 2006/06/23 21:53:01 reyk Exp $ */ +/* $OpenBSD: ar5xxx.h,v 1.33 2006/09/19 16:42:29 reyk Exp $ */ /* * Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org> @@ -461,10 +461,13 @@ typedef struct { #define CHANNEL_T (CHANNEL_A | IEEE80211_CHAN_TURBO) #define CHANNEL_TG (CHANNEL_PUREG | IEEE80211_CHAN_TURBO) #define CHANNEL_XR (CHANNEL_A | IEEE80211_CHAN_XR) +#define CHANNEL_MODES \ + (CHANNEL_A | CHANNEL_B | CHANNEL_G | CHANNEL_PUREG | \ + CHANNEL_T | CHANNEL_TG | CHANNEL_XR) typedef enum { HAL_CHIP_5GHZ = IEEE80211_CHAN_5GHZ, - HAL_CHIP_2GHZ = IEEE80211_CHAN_2GHZ, + HAL_CHIP_2GHZ = IEEE80211_CHAN_2GHZ } HAL_CHIP; /* |