diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2006-11-30 19:28:08 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2006-11-30 19:28:08 +0000 |
commit | 336c02122079518f962f733645d7701ae2cbe53b (patch) | |
tree | e0621106a4debb6abd4ac242cd8e2c62bd6e513d /sys/dev | |
parent | 1992792221c8da7cf7aa08b9ec984b1a533d6e65 (diff) |
cosmetic
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/if_zyd.c | 51 | ||||
-rw-r--r-- | sys/dev/usb/if_zydreg.h | 90 |
2 files changed, 84 insertions, 57 deletions
diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index eb068b6df37..87c71b27897 100644 --- a/sys/dev/usb/if_zyd.c +++ b/sys/dev/usb/if_zyd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_zyd.c,v 1.44 2006/11/30 17:45:40 damien Exp $ */ +/* $OpenBSD: if_zyd.c,v 1.45 2006/11/30 19:28:07 damien Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr> @@ -95,18 +95,13 @@ static const struct zyd_type { } zyd_devs[] = { ZYD_ZD1211_DEV(3COM2, 3CRUSB10075), ZYD_ZD1211_DEV(ABOCOM, WL54), - ZYD_ZD1211B_DEV(ACCTON, SMCWUSBG), - ZYD_ZD1211B_DEV(ASUS, A9T_WIFI), ZYD_ZD1211_DEV(ASUS, WL159G), ZYD_ZD1211_DEV(BELKIN, F5D7050C), - ZYD_ZD1211B_DEV(CISCOLINKSYS, WUSBF54G), ZYD_ZD1211_DEV(CYBERTAN, TG54USB), ZYD_ZD1211_DEV(DRAYTEK, VIGOR550), - ZYD_ZD1211B_DEV(FIBERLINE, WL430U), ZYD_ZD1211_DEV(PLANEX2, GWUS54GZL), ZYD_ZD1211_DEV(PLANEX3, GWUS54MINI), ZYD_ZD1211_DEV(SAGEM, XG760A), - ZYD_ZD1211B_DEV(SAGEM, XG76NA), ZYD_ZD1211_DEV(SITECOMEU, WL113), ZYD_ZD1211_DEV(SWEEX, ZD1211), ZYD_ZD1211_DEV(TEKRAM, QUICKWLAN), @@ -114,10 +109,16 @@ static const struct zyd_type { ZYD_ZD1211_DEV(TWINMOS, G240), ZYD_ZD1211_DEV(UMEDIA, TEW429UB_A), ZYD_ZD1211_DEV(UMEDIA, TEW429UB), - ZYD_ZD1211B_DEV(UMEDIA, TEW429UBC1), ZYD_ZD1211_DEV(WISTRONNEWEB, UR055G), ZYD_ZD1211_DEV(ZYDAS, ZD1211), ZYD_ZD1211_DEV(ZYXEL, ZYAIRG220), + + ZYD_ZD1211B_DEV(ACCTON, SMCWUSBG), + ZYD_ZD1211B_DEV(ASUS, A9T_WIFI), + ZYD_ZD1211B_DEV(CISCOLINKSYS, WUSBF54G), + ZYD_ZD1211B_DEV(FIBERLINE, WL430U), + ZYD_ZD1211B_DEV(SAGEM, XG76NA), + ZYD_ZD1211B_DEV(UMEDIA, TEW429UBC1), ZYD_ZD1211B_DEV(ZYXEL, M202), ZYD_ZD1211B_DEV(ZYDAS, ZD1211B), }; @@ -1272,8 +1273,9 @@ zyd_maxim_set_channel(struct zyd_rf *rf, uint8_t chan) struct zyd_softc *sc = rf->rf_sc; static const struct zyd_phy_pair phyini[] = ZYD_MAXIM_PHY; static const uint32_t rfini[] = ZYD_MAXIM_RF; - static const uint32_t rfprog_f[] = ZYD_MAXIM_CHANTABLE_F; - static const uint32_t rfprog_n[] = ZYD_MAXIM_CHANTABLE_N; + static const struct { + uint32_t r1, r2; + } rfprog[] = ZYD_MAXIM_CHANTABLE; uint16_t tmp; int i, error; @@ -1292,8 +1294,8 @@ zyd_maxim_set_channel(struct zyd_rf *rf, uint8_t chan) (void)zyd_write16(sc, ZYD_CR203, tmp & ~(1 << 4)); /* first two values taken from the chantables */ - (void)zyd_rfwrite(sc, rfprog_f[chan - 1]); - (void)zyd_rfwrite(sc, rfprog_n[chan - 1]); + (void)zyd_rfwrite(sc, rfprog[chan - 1].r1); + (void)zyd_rfwrite(sc, rfprog[chan - 1].r2); /* init maxim radio - skipping the two first values */ for (i = 2; i < N(rfini); i++) { @@ -1356,8 +1358,9 @@ zyd_maxim2_set_channel(struct zyd_rf *rf, uint8_t chan) struct zyd_softc *sc = rf->rf_sc; static const struct zyd_phy_pair phyini[] = ZYD_MAXIM2_PHY; static const uint32_t rfini[] = ZYD_MAXIM2_RF; - static const uint32_t rfprog_f[] = ZYD_MAXIM2_CHANTABLE_F; - static const uint32_t rfprog_n[] = ZYD_MAXIM2_CHANTABLE_N; + static const struct { + uint32_t r1, r2; + } rfprog[] = ZYD_MAXIM2_CHANTABLE; uint16_t tmp; int i, error; @@ -1376,8 +1379,8 @@ zyd_maxim2_set_channel(struct zyd_rf *rf, uint8_t chan) (void)zyd_write16(sc, ZYD_CR203, tmp & ~(1 << 4)); /* first two values taken from the chantables */ - (void)zyd_rfwrite(sc, rfprog_f[chan - 1]); - (void)zyd_rfwrite(sc, rfprog_n[chan - 1]); + (void)zyd_rfwrite(sc, rfprog[chan - 1].r1); + (void)zyd_rfwrite(sc, rfprog[chan - 1].r2); /* init maxim2 radio - skipping the two first values */ for (i = 2; i < N(rfini); i++) { @@ -1695,8 +1698,8 @@ zyd_set_chan(struct zyd_softc *sc, struct ieee80211_channel *c) /* XXX more ZD1211B specific bits? */ if (sc->mac_rev == ZYD_ZD1211B) { - zyd_write32(sc, ZYD_CR69, 0x28); - zyd_write32(sc, ZYD_CR69, 0x2a); + (void)zyd_write32(sc, ZYD_CR69, 0x28); + (void)zyd_write32(sc, ZYD_CR69, 0x2a); } zyd_unlock_phy(sc); @@ -2008,7 +2011,7 @@ zyd_tx_data(struct zyd_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) struct zyd_tx_data *data; struct ieee80211_frame *wh; int xferlen, totlen, rate; - u_int16_t hdrlen; + uint16_t pktlen; usbd_status error; wh = mtod(m0, struct ieee80211_frame *); @@ -2075,14 +2078,10 @@ zyd_tx_data(struct zyd_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) desc->phy |= ZYD_TX_PHY_SHPREAMBLE; /* actual transmit length (XXX why +10?) */ - hdrlen = sizeof (struct zyd_tx_desc) + 10; - - if (sc->mac_rev == ZYD_ZD1211B) { - /* XXX this means no cipher */ - desc->pktlen = htole16(hdrlen); - } else { - desc->pktlen = htole16(hdrlen + totlen); - } + pktlen = sizeof (struct zyd_tx_desc) + 10; + if (sc->mac_rev == ZYD_ZD1211) + pktlen += totlen; + desc->pktlen = htole16(pktlen); desc->plcp_length = (16 * totlen + rate - 1) / rate; desc->plcp_service = 0; diff --git a/sys/dev/usb/if_zydreg.h b/sys/dev/usb/if_zydreg.h index 6be82aa02f2..c531210a0f8 100644 --- a/sys/dev/usb/if_zydreg.h +++ b/sys/dev/usb/if_zydreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_zydreg.h,v 1.18 2006/11/30 17:45:40 damien Exp $ */ +/* $OpenBSD: if_zydreg.h,v 1.19 2006/11/30 19:28:07 damien Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr> @@ -588,6 +588,8 @@ { 0x181a60, 0x1c0000 } \ } + + #define ZYD_AL2230_PHY \ { \ { ZYD_CR15, 0x20 }, { ZYD_CR23, 0x40 }, { ZYD_CR24, 0x20 }, \ @@ -608,7 +610,7 @@ { ZYD_CR119, 0x10 }, { ZYD_CR120, 0x4f }, { ZYD_CR121, 0x77 }, \ { ZYD_CR122, 0xe0 }, { ZYD_CR137, 0x88 }, { ZYD_CR252, 0xff }, \ { ZYD_CR253, 0xff }, { ZYD_CR251, 0x2f }, { ZYD_CR251, 0x3f }, \ - { ZYD_CR138, 0x28 }, { ZYD_CR203, 0x06 }, \ + { ZYD_CR138, 0x28 }, { ZYD_CR203, 0x06 } \ } #define ZYD_AL2230_PHY_B \ @@ -722,24 +724,26 @@ 0x193d76, 0x9dd844, 0x500007, 0xd8c010, 0x3c9000, 0xf15d58 \ } -#define ZYD_AL7230B_CHANTABLE \ -{ \ - { 0x09ec00, 0x8cccc8 }, \ - { 0x09ec00, 0x8cccd8 }, \ - { 0x09ec00, 0x8cccc0 }, \ - { 0x09ec00, 0x8cccd0 }, \ - { 0x05ec00, 0x8cccc8 }, \ - { 0x05ec00, 0x8cccd8 }, \ - { 0x05ec00, 0x8cccc0 }, \ - { 0x05ec00, 0x8cccd0 }, \ - { 0x0dec00, 0x8cccc8 }, \ - { 0x0dec00, 0x8cccd8 }, \ - { 0x0dec00, 0x8cccc0 }, \ - { 0x0dec00, 0x8cccd0 }, \ - { 0x03ec00, 0x8cccc8 }, \ - { 0x03ec00, 0x866660 } \ +#define ZYD_AL7230B_CHANTABLE \ +{ \ + { 0x09ec00, 0x8cccc8 }, \ + { 0x09ec00, 0x8cccd8 }, \ + { 0x09ec00, 0x8cccc0 }, \ + { 0x09ec00, 0x8cccd0 }, \ + { 0x05ec00, 0x8cccc8 }, \ + { 0x05ec00, 0x8cccd8 }, \ + { 0x05ec00, 0x8cccc0 }, \ + { 0x05ec00, 0x8cccd0 }, \ + { 0x0dec00, 0x8cccc8 }, \ + { 0x0dec00, 0x8cccd8 }, \ + { 0x0dec00, 0x8cccc0 }, \ + { 0x0dec00, 0x8cccd0 }, \ + { 0x03ec00, 0x8cccc8 }, \ + { 0x03ec00, 0x866660 } \ } + + #define ZYD_AL2210_PHY \ { \ { ZYD_CR9, 0xe0 }, { ZYD_CR10, 0x91 }, { ZYD_CR12, 0x90 }, \ @@ -765,6 +769,8 @@ 0x019a80, 0x019b40 \ } + + #define ZYD_GCT_PHY \ { \ { ZYD_CR47, 0x1e }, { ZYD_CR15, 0xdc }, { ZYD_CR113, 0xc0 }, \ @@ -793,6 +799,8 @@ 0x1a3000, 0x1ab000 \ } + + #define ZYD_MAXIM_PHY \ { \ { ZYD_CR23, 0x40 }, { ZYD_CR15, 0x20 }, { ZYD_CR28, 0x3e }, \ @@ -827,17 +835,25 @@ 0x00026c \ } -#define ZYD_MAXIM_CHANTABLE_F \ -{ \ - 0x0ccd4, 0x22224, 0x37774, 0x0ccd4, 0x22224, 0x37774, 0x0ccd4, \ - 0x22224, 0x37774, 0x0ccd4, 0x22224, 0x37774, 0x0ccd4, 0x199a4 \ +#define ZYD_MAXIM_CHANTABLE \ +{ \ + { 0x0ccd4, 0x30a03 }, \ + { 0x22224, 0x00a13 }, \ + { 0x37774, 0x10a13 }, \ + { 0x0ccd4, 0x30a13 }, \ + { 0x22224, 0x00a23 }, \ + { 0x37774, 0x10a23 }, \ + { 0x0ccd4, 0x30a23 }, \ + { 0x22224, 0x00a33 }, \ + { 0x37774, 0x10a33 }, \ + { 0x0ccd4, 0x30a33 }, \ + { 0x22224, 0x00a43 }, \ + { 0x37774, 0x10a43 }, \ + { 0x0ccd4, 0x30a43 }, \ + { 0x199a4, 0x20a53 } \ } -#define ZYD_MAXIM_CHANTABLE_N \ -{ \ - 0x30a03, 0x00a13, 0x10a13, 0x30a13, 0x00a23, 0x10a23, 0x30a23, \ - 0x00a33, 0x10a33, 0x30a33, 0x00a43, 0x10a43, 0x30a43, 0x20a53 \ -} + #define ZYD_MAXIM2_PHY \ { \ @@ -878,10 +894,22 @@ 0x08884, 0x1ddd4, 0x33334, 0x08884, 0x1ddd4, 0x33334, 0x26664 \ } -#define ZYD_MAXIM2_CHANTABLE_N \ -{ \ - 0x10a03, 0x20a13, 0x30a13, 0x10a13, 0x20a23, 0x30a23, 0x10a23, \ - 0x20a33, 0x30a33, 0x10a33, 0x20a43, 0x30a43, 0x10a43, 0x20a53 \ +#define ZYD_MAXIM2_CHANTABLE \ +{ \ + { 0x33334, 0x10a03 }, \ + { 0x08884, 0x20a13 }, \ + { 0x1ddd4, 0x30a13 }, \ + { 0x33334, 0x10a13 }, \ + { 0x08884, 0x20a23 }, \ + { 0x1ddd4, 0x30a23 }, \ + { 0x33334, 0x10a23 }, \ + { 0x08884, 0x20a33 }, \ + { 0x1ddd4, 0x30a33 }, \ + { 0x33334, 0x10a33 }, \ + { 0x08884, 0x20a43 }, \ + { 0x1ddd4, 0x30a43 }, \ + { 0x33334, 0x10a43 }, \ + { 0x26664, 0x20a53 } \ } /* |