[bwn] break out the 'g' phy code into a separate source file.
* Break out the 'g' phy code; * Break out the debugging bits into a separate source file, since some debugging prints are done in the phy code; * Make some more chip methods in if_bwn.c public. This brings the size of if_bwn.c down to 6,805 lines which is now approaching managable.
This commit is contained in:
parent
eaddb80745
commit
d546e47aa0
@ -1132,6 +1132,8 @@ dev/bwi/if_bwi_pci.c optional bwi pci
|
||||
# XXX Work around clang warning, until maintainer approves fix.
|
||||
dev/bwn/if_bwn.c optional bwn siba_bwn \
|
||||
compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
|
||||
dev/bwn/if_bwn_phy_g.c optional bwn siba_bwn \
|
||||
compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
|
||||
dev/bwn/if_bwn_phy_lp.c optional bwn siba_bwn \
|
||||
compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
|
||||
dev/cardbus/cardbus.c optional cardbus
|
||||
|
3661
sys/dev/bwn/if_bwn.c
3661
sys/dev/bwn/if_bwn.c
File diff suppressed because it is too large
Load Diff
66
sys/dev/bwn/if_bwn_debug.h
Normal file
66
sys/dev/bwn/if_bwn_debug.h
Normal file
@ -0,0 +1,66 @@
|
||||
/*-
|
||||
* Copyright (c) 2009-2010 Weongyo Jeong <weongyo@freebsd.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer,
|
||||
* without modification.
|
||||
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
||||
* similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
|
||||
* redistribution must be conditioned upon including a substantially
|
||||
* similar Disclaimer requirement for further binary redistribution.
|
||||
*
|
||||
* NO WARRANTY
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef __IF_BWN_DEBUG_H__
|
||||
#define __IF_BWN_DEBUG_H__
|
||||
|
||||
enum {
|
||||
BWN_DEBUG_XMIT = 0x00000001, /* basic xmit operation */
|
||||
BWN_DEBUG_RECV = 0x00000002, /* basic recv operation */
|
||||
BWN_DEBUG_STATE = 0x00000004, /* 802.11 state transitions */
|
||||
BWN_DEBUG_TXPOW = 0x00000008, /* tx power processing */
|
||||
BWN_DEBUG_RESET = 0x00000010, /* reset processing */
|
||||
BWN_DEBUG_OPS = 0x00000020, /* bwn_ops processing */
|
||||
BWN_DEBUG_BEACON = 0x00000040, /* beacon handling */
|
||||
BWN_DEBUG_WATCHDOG = 0x00000080, /* watchdog timeout */
|
||||
BWN_DEBUG_INTR = 0x00000100, /* ISR */
|
||||
BWN_DEBUG_CALIBRATE = 0x00000200, /* periodic calibration */
|
||||
BWN_DEBUG_NODE = 0x00000400, /* node management */
|
||||
BWN_DEBUG_LED = 0x00000800, /* led management */
|
||||
BWN_DEBUG_CMD = 0x00001000, /* cmd submission */
|
||||
BWN_DEBUG_LO = 0x00002000, /* LO */
|
||||
BWN_DEBUG_FW = 0x00004000, /* firmware */
|
||||
BWN_DEBUG_WME = 0x00008000, /* WME */
|
||||
BWN_DEBUG_RF = 0x00010000, /* RF */
|
||||
BWN_DEBUG_FATAL = 0x80000000, /* fatal errors */
|
||||
BWN_DEBUG_ANY = 0xffffffff
|
||||
};
|
||||
|
||||
#ifdef BWN_DEBUG
|
||||
#define DPRINTF(sc, m, fmt, ...) do { \
|
||||
if (sc->sc_debug & (m)) \
|
||||
printf(fmt, __VA_ARGS__); \
|
||||
} while (0)
|
||||
#else /* BWN_DEBUG */
|
||||
#define DPRINTF(sc, m, fmt, ...) do { (void) sc; } while (0)
|
||||
#endif /* BWN_DEBUG */
|
||||
|
||||
#endif /* __IF_BWN_DEBUG_H__ */
|
@ -43,7 +43,21 @@ struct bwn_mac;
|
||||
extern uint64_t bwn_hf_read(struct bwn_mac *);
|
||||
extern void bwn_hf_write(struct bwn_mac *, uint64_t);
|
||||
|
||||
extern void bwn_ram_write(struct bwn_mac *, uint16_t, uint32_t);
|
||||
|
||||
extern void bwn_mac_suspend(struct bwn_mac *);
|
||||
extern void bwn_mac_enable(struct bwn_mac *);
|
||||
|
||||
extern int bwn_switch_channel(struct bwn_mac *, int);
|
||||
|
||||
extern uint16_t bwn_shm_read_2(struct bwn_mac *, uint16_t, uint16_t);
|
||||
extern void bwn_shm_write_2(struct bwn_mac *, uint16_t, uint16_t,
|
||||
uint16_t);
|
||||
extern uint32_t bwn_shm_read_4(struct bwn_mac *, uint16_t, uint16_t);
|
||||
extern void bwn_shm_write_4(struct bwn_mac *, uint16_t, uint16_t,
|
||||
uint32_t);
|
||||
|
||||
extern void bwn_reset_core(struct bwn_mac *, uint32_t);
|
||||
extern void bwn_psctl(struct bwn_mac *, uint32_t);
|
||||
|
||||
#endif
|
||||
|
3667
sys/dev/bwn/if_bwn_phy_g.c
Normal file
3667
sys/dev/bwn/if_bwn_phy_g.c
Normal file
File diff suppressed because it is too large
Load Diff
57
sys/dev/bwn/if_bwn_phy_g.h
Normal file
57
sys/dev/bwn/if_bwn_phy_g.h
Normal file
@ -0,0 +1,57 @@
|
||||
/*-
|
||||
* Copyright (c) 2009-2010 Weongyo Jeong <weongyo@freebsd.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer,
|
||||
* without modification.
|
||||
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
||||
* similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
|
||||
* redistribution must be conditioned upon including a substantially
|
||||
* similar Disclaimer requirement for further binary redistribution.
|
||||
*
|
||||
* NO WARRANTY
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef __IF_BWN_PHY_G_H__
|
||||
#define __IF_BWN_PHY_G_H__
|
||||
|
||||
extern int bwn_phy_g_attach(struct bwn_mac *mac);
|
||||
extern void bwn_phy_g_detach(struct bwn_mac *mac);
|
||||
extern int bwn_phy_g_prepare_hw(struct bwn_mac *mac);
|
||||
extern void bwn_phy_g_init_pre(struct bwn_mac *mac);
|
||||
extern int bwn_phy_g_init(struct bwn_mac *mac);
|
||||
extern void bwn_phy_g_exit(struct bwn_mac *mac);
|
||||
extern uint16_t bwn_phy_g_read(struct bwn_mac *mac, uint16_t reg);
|
||||
extern void bwn_phy_g_write(struct bwn_mac *mac, uint16_t reg, uint16_t value);
|
||||
extern uint16_t bwn_phy_g_rf_read(struct bwn_mac *mac, uint16_t reg);
|
||||
extern void bwn_phy_g_rf_write(struct bwn_mac *mac, uint16_t reg, uint16_t value);
|
||||
extern int bwn_phy_g_hwpctl(struct bwn_mac *mac);
|
||||
extern void bwn_phy_g_rf_onoff(struct bwn_mac *mac, int on);
|
||||
extern void bwn_phy_switch_analog(struct bwn_mac *mac, int on);
|
||||
extern int bwn_phy_g_switch_channel(struct bwn_mac *mac, uint32_t newchan);
|
||||
extern uint32_t bwn_phy_g_get_default_chan(struct bwn_mac *mac);
|
||||
extern void bwn_phy_g_set_antenna(struct bwn_mac *mac, int antenna);
|
||||
extern int bwn_phy_g_im(struct bwn_mac *mac, int mode);
|
||||
extern int bwn_phy_g_recalc_txpwr(struct bwn_mac *mac, int ignore_tssi);
|
||||
extern void bwn_phy_g_set_txpwr(struct bwn_mac *mac);
|
||||
extern void bwn_phy_g_task_15s(struct bwn_mac *mac);
|
||||
extern void bwn_phy_g_task_60s(struct bwn_mac *mac);
|
||||
|
||||
#endif /* __IF_BWN_PHY_G_H__ */
|
@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/bwn/if_bwnreg.h>
|
||||
#include <dev/bwn/if_bwnvar.h>
|
||||
|
||||
#include <dev/bwn/if_bwn_debug.h>
|
||||
#include <dev/bwn/if_bwn_misc.h>
|
||||
#include <dev/bwn/if_bwn_phy_lp.h>
|
||||
|
||||
@ -368,16 +369,6 @@ static const uint16_t bwn_tabl_iqlocal_tbl[] = {
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const uint16_t bwn_tab_noise_g1[] = BWN_TAB_NOISE_G1;
|
||||
static const uint16_t bwn_tab_noise_g2[] = BWN_TAB_NOISE_G2;
|
||||
static const uint16_t bwn_tab_noisescale_g1[] = BWN_TAB_NOISESCALE_G1;
|
||||
static const uint16_t bwn_tab_noisescale_g2[] = BWN_TAB_NOISESCALE_G2;
|
||||
static const uint16_t bwn_tab_noisescale_g3[] = BWN_TAB_NOISESCALE_G3;
|
||||
const uint8_t bwn_bitrev_table[256] = BWN_BITREV_TABLE;
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
bwn_phy_lp_init_pre(struct bwn_mac *mac)
|
||||
{
|
||||
|
@ -4,10 +4,12 @@
|
||||
|
||||
KMOD= if_bwn
|
||||
SRCS= if_bwn.c if_bwnreg.h if_bwnvar.h
|
||||
SRCS+= if_bwn_phy_lp.c
|
||||
SRCS+= if_bwn_phy_g.c if_bwn_phy_lp.c
|
||||
SRCS+= device_if.h bus_if.h pci_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
||||
# XXX Work around clang warning, until maintainer approves fix.
|
||||
CWARNFLAGS.if_bwn.c= ${NO_WSOMETIMES_UNINITIALIZED}
|
||||
CWARNFLAGS.if_bwn_phy_g.c= ${NO_WSOMETIMES_UNINITIALIZED}
|
||||
CWARNFLAGS.if_bwn_phy_lp.c= ${NO_WSOMETIMES_UNINITIALIZED}
|
||||
|
Loading…
x
Reference in New Issue
Block a user