Deleted Added
full compact
if_urtw.c (298818) if_urtw.c (299176)
1/*-
2 * Copyright (c) 2008 Weongyo Jeong <weongyo@FreeBSD.org>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2008 Weongyo Jeong <weongyo@FreeBSD.org>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include <sys/cdefs.h>
18__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_urtw.c 298818 2016-04-29 22:14:11Z avos $");
18__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_urtw.c 299176 2016-05-06 15:09:21Z pfg $");
19#include <sys/param.h>
20#include <sys/sockio.h>
21#include <sys/sysctl.h>
22#include <sys/lock.h>
23#include <sys/mutex.h>
24#include <sys/mbuf.h>
25#include <sys/kernel.h>
26#include <sys/socket.h>

--- 1878 unchanged lines hidden (view full) ---

1905 urtw_write16_m(sc, URTW_BRSR, data);
1906fail:
1907 return (error);
1908}
1909
1910static uint16_t
1911urtw_rate2rtl(uint32_t rate)
1912{
19#include <sys/param.h>
20#include <sys/sockio.h>
21#include <sys/sysctl.h>
22#include <sys/lock.h>
23#include <sys/mutex.h>
24#include <sys/mbuf.h>
25#include <sys/kernel.h>
26#include <sys/socket.h>

--- 1878 unchanged lines hidden (view full) ---

1905 urtw_write16_m(sc, URTW_BRSR, data);
1906fail:
1907 return (error);
1908}
1909
1910static uint16_t
1911urtw_rate2rtl(uint32_t rate)
1912{
1913 int i;
1913 unsigned int i;
1914
1915 for (i = 0; i < nitems(urtw_ratetable); i++) {
1916 if (rate == urtw_ratetable[i].reg)
1917 return urtw_ratetable[i].val;
1918 }
1919
1920 return (3);
1921}
1922
1923static uint16_t
1924urtw_rtl2rate(uint32_t rate)
1925{
1914
1915 for (i = 0; i < nitems(urtw_ratetable); i++) {
1916 if (rate == urtw_ratetable[i].reg)
1917 return urtw_ratetable[i].val;
1918 }
1919
1920 return (3);
1921}
1922
1923static uint16_t
1924urtw_rtl2rate(uint32_t rate)
1925{
1926 int i;
1926 unsigned int i;
1927
1928 for (i = 0; i < nitems(urtw_ratetable); i++) {
1929 if (rate == urtw_ratetable[i].val)
1930 return urtw_ratetable[i].reg;
1931 }
1932
1933 return (0);
1934}

--- 510 unchanged lines hidden (view full) ---

2445fail:
2446 return (error);
2447}
2448
2449
2450static usb_error_t
2451urtw_8225_rf_init(struct urtw_softc *sc)
2452{
1927
1928 for (i = 0; i < nitems(urtw_ratetable); i++) {
1929 if (rate == urtw_ratetable[i].val)
1930 return urtw_ratetable[i].reg;
1931 }
1932
1933 return (0);
1934}

--- 510 unchanged lines hidden (view full) ---

2445fail:
2446 return (error);
2447}
2448
2449
2450static usb_error_t
2451urtw_8225_rf_init(struct urtw_softc *sc)
2452{
2453 int i;
2453 unsigned int i;
2454 uint16_t data;
2455 usb_error_t error;
2456
2457 error = urtw_8180_set_anaparam(sc, URTW_8225_ANAPARAM_ON);
2458 if (error)
2459 goto fail;
2460
2461 error = urtw_8225_usb_init(sc);

--- 364 unchanged lines hidden (view full) ---

2826
2827fail:
2828 return (error);
2829}
2830
2831static usb_error_t
2832urtw_8225v2_rf_init(struct urtw_softc *sc)
2833{
2454 uint16_t data;
2455 usb_error_t error;
2456
2457 error = urtw_8180_set_anaparam(sc, URTW_8225_ANAPARAM_ON);
2458 if (error)
2459 goto fail;
2460
2461 error = urtw_8225_usb_init(sc);

--- 364 unchanged lines hidden (view full) ---

2826
2827fail:
2828 return (error);
2829}
2830
2831static usb_error_t
2832urtw_8225v2_rf_init(struct urtw_softc *sc)
2833{
2834 int i;
2834 unsigned int i;
2835 uint16_t data;
2836 uint32_t data32;
2837 usb_error_t error;
2838
2839 error = urtw_8180_set_anaparam(sc, URTW_8225_ANAPARAM_ON);
2840 if (error)
2841 goto fail;
2842

--- 316 unchanged lines hidden (view full) ---

3159fail:
3160 return (error);
3161}
3162
3163static usb_error_t
3164urtw_8225v2b_rf_init(struct urtw_softc *sc)
3165{
3166 struct ieee80211com *ic = &sc->sc_ic;
2835 uint16_t data;
2836 uint32_t data32;
2837 usb_error_t error;
2838
2839 error = urtw_8180_set_anaparam(sc, URTW_8225_ANAPARAM_ON);
2840 if (error)
2841 goto fail;
2842

--- 316 unchanged lines hidden (view full) ---

3159fail:
3160 return (error);
3161}
3162
3163static usb_error_t
3164urtw_8225v2b_rf_init(struct urtw_softc *sc)
3165{
3166 struct ieee80211com *ic = &sc->sc_ic;
3167 int i;
3167 unsigned int i;
3168 uint8_t data8;
3169 usb_error_t error;
3170
3171 error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG);
3172 if (error)
3173 goto fail;
3174
3175 /*

--- 1211 unchanged lines hidden ---
3168 uint8_t data8;
3169 usb_error_t error;
3170
3171 error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG);
3172 if (error)
3173 goto fail;
3174
3175 /*

--- 1211 unchanged lines hidden ---