FreeBSD kernel usb device Code
|
#include <sys/cdefs.h>
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/socket.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
#include <sys/sysctl.h>
#include <sys/sx.h>
#include <sys/unistd.h>
#include <sys/callout.h>
#include <sys/malloc.h>
#include <sys/priv.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_media.h>
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
#include "usbdevs.h"
#include "miibus_if.h"
#include <dev/usb/usb_debug.h>
#include <dev/usb/usb_process.h>
#include <dev/usb/net/usb_ethernet.h>
#include <dev/usb/net/if_udavreg.h>
Go to the source code of this file.
Macros | |
#define | USB_DEBUG_VAR udav_debug |
#define | UDAV_SETBIT(sc, reg, x) udav_csr_write1(sc, reg, udav_csr_read1(sc, reg) | (x)) |
#define | UDAV_CLRBIT(sc, reg, x) udav_csr_write1(sc, reg, udav_csr_read1(sc, reg) & ~(x)) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static int | udav_csr_read (struct udav_softc *, uint16_t, void *, int) |
static int | udav_csr_write (struct udav_softc *, uint16_t, void *, int) |
static uint8_t | udav_csr_read1 (struct udav_softc *, uint16_t) |
static int | udav_csr_write1 (struct udav_softc *, uint16_t, uint8_t) |
static void | udav_reset (struct udav_softc *) |
static int | udav_ifmedia_upd (struct ifnet *) |
static void | udav_ifmedia_status (struct ifnet *, struct ifmediareq *) |
DRIVER_MODULE (udav, uhub, udav_driver, udav_devclass, NULL, 0) | |
DRIVER_MODULE (miibus, udav, miibus_driver, miibus_devclass, 0, 0) | |
MODULE_DEPEND (udav, uether, 1, 1, 1) | |
MODULE_DEPEND (udav, usb, 1, 1, 1) | |
MODULE_DEPEND (udav, ether, 1, 1, 1) | |
MODULE_DEPEND (udav, miibus, 1, 1, 1) | |
MODULE_VERSION (udav, 1) | |
USB_PNP_HOST_INFO (udav_devs) | |
static void | udav_attach_post (struct usb_ether *ue) |
static int | udav_probe (device_t dev) |
static int | udav_attach (device_t dev) |
static int | udav_detach (device_t dev) |
static void | udav_init (struct usb_ether *ue) |
static u_int | udav_hash_maddr (void *arg, struct sockaddr_dl *sdl, u_int cnt) |
static void | udav_setmulti (struct usb_ether *ue) |
static void | udav_setpromisc (struct usb_ether *ue) |
static void | udav_start (struct usb_ether *ue) |
static void | udav_bulk_write_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | udav_bulk_read_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | udav_intr_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | udav_stop (struct usb_ether *ue) |
static void | udav_tick (struct usb_ether *ue) |
static int | udav_miibus_readreg (device_t dev, int phy, int reg) |
static int | udav_miibus_writereg (device_t dev, int phy, int reg, int data) |
static void | udav_miibus_statchg (device_t dev) |
Variables | |
static device_probe_t | udav_probe |
static device_attach_t | udav_attach |
static device_detach_t | udav_detach |
static usb_callback_t | udav_bulk_write_callback |
static usb_callback_t | udav_bulk_read_callback |
static usb_callback_t | udav_intr_callback |
static uether_fn_t | udav_attach_post |
static uether_fn_t | udav_init |
static uether_fn_t | udav_stop |
static uether_fn_t | udav_start |
static uether_fn_t | udav_tick |
static uether_fn_t | udav_setmulti |
static uether_fn_t | udav_setpromisc |
static miibus_readreg_t | udav_miibus_readreg |
static miibus_writereg_t | udav_miibus_writereg |
static miibus_statchg_t | udav_miibus_statchg |
static const struct usb_config | udav_config [UDAV_N_TRANSFER] |
static device_method_t | udav_methods [] |
static driver_t | udav_driver |
static devclass_t | udav_devclass |
static const STRUCT_USB_HOST_ID | udav_devs [] |
static const struct usb_ether_methods | udav_ue_methods |
static const struct usb_ether_methods | udav_ue_methods_nophy |
#define UDAV_CLRBIT | ( | sc, | |
reg, | |||
x | |||
) | udav_csr_write1(sc, reg, udav_csr_read1(sc, reg) & ~(x)) |
#define UDAV_SETBIT | ( | sc, | |
reg, | |||
x | |||
) | udav_csr_write1(sc, reg, udav_csr_read1(sc, reg) | (x)) |
__FBSDID | ( | "$FreeBSD$" | ) |
DRIVER_MODULE | ( | miibus | , |
udav | , | ||
miibus_driver | , | ||
miibus_devclass | , | ||
0 | , | ||
0 | |||
) |
DRIVER_MODULE | ( | udav | , |
uhub | , | ||
udav_driver | , | ||
udav_devclass | , | ||
NULL | , | ||
0 | |||
) |
MODULE_DEPEND | ( | udav | , |
ether | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | udav | , |
miibus | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | udav | , |
uether | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | udav | , |
usb | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_VERSION | ( | udav | , |
1 | |||
) |
|
static |
Definition at line 263 of file if_udav.c.
References dev, usb_attach_arg::device, device_set_usb_desc(), error, udav_softc::sc_flags, udav_softc::sc_mtx, udav_softc::sc_ue, udav_softc::sc_xfer, udav_config, udav_detach, UDAV_FLAG_LINK, UDAV_FLAG_NO_PHY, UDAV_IFACE_INDEX, UDAV_N_TRANSFER, udav_ue_methods, udav_ue_methods_nophy, usb_ether::ue_dev, usb_ether::ue_methods, usb_ether::ue_mtx, usb_ether::ue_sc, usb_ether::ue_udev, uether_ifattach(), USB_GET_DRIVER_INFO, and usbd_transfer_setup().
|
static |
Definition at line 236 of file if_udav.c.
References udav_csr_read(), UDAV_PAR, udav_reset(), usb_ether::ue_eaddr, and uether_getsc().
|
static |
Definition at line 662 of file if_udav.c.
References DPRINTF, error, len, udav_rxpkt::pktlen, udav_rxpkt::rxstat, udav_softc::sc_ue, UDAV_RSR_ERR, UDAV_RSR_LCS, uether_getifp(), uether_rxbuf(), uether_rxflush(), USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_copy_out(), usbd_errstr(), usbd_transfer_submit(), usbd_xfer_get_frame(), usbd_xfer_max_len(), usbd_xfer_set_frame_len(), usbd_xfer_set_stall(), usbd_xfer_softc(), and usbd_xfer_status().
|
static |
Definition at line 581 of file if_udav.c.
References error, udav_softc::sc_flags, udav_softc::sc_ue, UDAV_FLAG_LINK, UDAV_MIN_FRAME_LEN, uether_getifp(), USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_copy_in(), usbd_errstr(), usbd_frame_zero(), usbd_m_copy_in(), usbd_transfer_submit(), usbd_xfer_get_frame(), usbd_xfer_set_frame_len(), usbd_xfer_set_stall(), and usbd_xfer_softc().
|
static |
Definition at line 378 of file if_udav.c.
References len, offset, req, udav_softc::sc_ue, UDAV_REQ_REG_READ, uether_do_request, USETW, and UT_READ_VENDOR_DEVICE.
Referenced by udav_attach_post(), udav_csr_read1(), and udav_miibus_readreg().
|
static |
Definition at line 411 of file if_udav.c.
References offset, udav_csr_read(), and val.
Referenced by udav_reset(), and udav_setpromisc().
|
static |
Definition at line 394 of file if_udav.c.
References len, offset, req, udav_softc::sc_ue, UDAV_REQ_REG_WRITE, uether_do_request, USETW, and UT_WRITE_VENDOR_DEVICE.
Referenced by udav_init(), udav_miibus_writereg(), and udav_setmulti().
|
static |
Definition at line 420 of file if_udav.c.
References offset, req, udav_softc::sc_ue, UDAV_REQ_REG_WRITE1, uether_do_request, USETW, and UT_WRITE_VENDOR_DEVICE.
Referenced by udav_miibus_readreg(), udav_miibus_writereg(), and udav_setpromisc().
|
static |
Definition at line 314 of file if_udav.c.
References dev, udav_softc::sc_mtx, udav_softc::sc_ue, udav_softc::sc_xfer, UDAV_N_TRANSFER, uether_ifdetach(), and usbd_transfer_unsetup().
|
static |
Definition at line 508 of file if_udav.c.
Referenced by udav_setmulti().
|
static |
Definition at line 778 of file if_udav.c.
References GET_MII, UDAV_LOCK, and UDAV_UNLOCK.
|
static |
Definition at line 761 of file if_udav.c.
References error, GET_MII, udav_softc::sc_flags, and UDAV_LOCK_ASSERT.
|
static |
Definition at line 437 of file if_udav.c.
References udav_softc::sc_ue, udav_softc::sc_xfer, UDAV_BULK_DT_WR, UDAV_CLRBIT, udav_csr_write(), UDAV_GPCR, UDAV_GPCR_GEP_CNTL0, UDAV_GPR, UDAV_GPR_GEPIO0, UDAV_LOCK_ASSERT, UDAV_NCR, UDAV_NCR_LBK0, UDAV_NCR_LBK1, UDAV_PAR, UDAV_RCR, UDAV_RCR_DIS_CRC, UDAV_RCR_DIS_LONG, UDAV_RCR_RXEN, UDAV_SETBIT, udav_setpromisc, udav_start, udav_stop, usb_ether::ue_sc, uether_getifp(), and usbd_xfer_set_stall().
|
static |
Definition at line 718 of file if_udav.c.
References error, USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_transfer_submit(), usbd_xfer_max_len(), usbd_xfer_set_frame_len(), and usbd_xfer_set_stall().
|
static |
Definition at line 808 of file if_udav.c.
References dev, reg, udav_softc::sc_mtx, UDAV_CLRBIT, udav_csr_read(), udav_csr_write1(), UDAV_EPAR, UDAV_EPAR_EROA_MASK, UDAV_EPAR_PHY_ADR0, UDAV_EPCR, UDAV_EPCR_EPOS, UDAV_EPCR_ERPRR, UDAV_EPDRL, UDAV_LOCK, UDAV_UNLOCK, and val.
|
static |
Definition at line 849 of file if_udav.c.
References data, dev, reg, udav_softc::sc_mtx, UDAV_CLRBIT, udav_csr_write(), udav_csr_write1(), UDAV_EPAR, UDAV_EPAR_EROA_MASK, UDAV_EPAR_PHY_ADR0, UDAV_EPCR, UDAV_EPCR_EPOS, UDAV_EPCR_ERPRW, UDAV_EPDRL, UDAV_LOCK, UDAV_UNLOCK, and val.
|
static |
Definition at line 248 of file if_udav.c.
References usbd_lookup_info::bConfigIndex, usbd_lookup_info::bIfaceIndex, dev, usb_attach_arg::info, UDAV_CONFIG_INDEX, udav_devs, UDAV_IFACE_INDEX, usb_attach_arg::usb_mode, USB_MODE_HOST, and usbd_lookup_id_by_uaa().
|
static |
Definition at line 477 of file if_udav.c.
References udav_softc::sc_flags, udav_softc::sc_ue, UDAV_CLRBIT, udav_csr_read1(), UDAV_NCR, UDAV_NCR_EXT_PHY, UDAV_NCR_RST, UDAV_SETBIT, UDAV_TX_TIMEOUT, and uether_pause().
Referenced by udav_attach_post(), and udav_stop().
|
static |
Definition at line 520 of file if_udav.c.
References udav_softc::sc_ue, UDAV_CLRBIT, udav_csr_write(), udav_hash_maddr(), UDAV_LOCK_ASSERT, UDAV_MAR, UDAV_RCR, UDAV_RCR_ALL, UDAV_RCR_PRMSC, UDAV_SETBIT, usb_ether::ue_sc, and uether_getifp().
|
static |
Definition at line 549 of file if_udav.c.
References udav_softc::sc_ue, udav_csr_read1(), udav_csr_write1(), UDAV_RCR, UDAV_RCR_ALL, UDAV_RCR_PRMSC, usb_ether::ue_sc, and uether_getifp().
|
static |
Definition at line 568 of file if_udav.c.
References udav_softc::sc_xfer, UDAV_BULK_DT_RD, UDAV_BULK_DT_WR, UDAV_INTR_DT_RD, usb_ether::ue_sc, and usbd_transfer_start().
|
static |
Definition at line 739 of file if_udav.c.
References udav_softc::sc_flags, udav_softc::sc_ue, udav_softc::sc_xfer, UDAV_BULK_DT_RD, UDAV_BULK_DT_WR, UDAV_FLAG_NO_PHY, UDAV_INTR_DT_RD, UDAV_LOCK_ASSERT, udav_reset(), usb_ether::ue_sc, uether_getifp(), and usbd_transfer_stop().
|
static |
Definition at line 791 of file if_udav.c.
References GET_MII, udav_softc::sc_flags, UDAV_FLAG_LINK, UDAV_LOCK_ASSERT, udav_start, and usb_ether::ue_sc.
USB_PNP_HOST_INFO | ( | udav_devs | ) |
|
static |
|
static |
|
static |
|
static |
Definition at line 122 of file if_udav.c.
Referenced by udav_attach().
|
static |
Definition at line 96 of file if_udav.c.
Referenced by udav_attach().
|
static |
Definition at line 175 of file if_udav.c.
Referenced by udav_probe().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 108 of file if_udav.c.
Referenced by udav_init().
|
static |
Definition at line 105 of file if_udav.c.
Referenced by udav_init(), and udav_tick().
|
static |
Definition at line 104 of file if_udav.c.
Referenced by udav_init().
|
static |
|
static |
Definition at line 199 of file if_udav.c.
Referenced by udav_attach().
|
static |
Definition at line 211 of file if_udav.c.
Referenced by udav_attach().