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 <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
#include "usbdevs.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_cuereg.h>
Go to the source code of this file.
Macros | |
#define | USB_DEBUG_VAR cue_debug |
#define | CUE_DEV(v, p) { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) } |
#define | CUE_SETBIT(sc, reg, x) cue_csr_write_1(sc, reg, cue_csr_read_1(sc, reg) | (x)) |
#define | CUE_CLRBIT(sc, reg, x) cue_csr_write_1(sc, reg, cue_csr_read_1(sc, reg) & ~(x)) |
#define | CUE_BITS 9 |
Functions | |
__FBSDID ("$FreeBSD$") | |
static uint8_t | cue_csr_read_1 (struct cue_softc *, uint16_t) |
static uint16_t | cue_csr_read_2 (struct cue_softc *, uint8_t) |
static int | cue_csr_write_1 (struct cue_softc *, uint16_t, uint16_t) |
static int | cue_mem (struct cue_softc *, uint8_t, uint16_t, void *, int) |
static int | cue_getmac (struct cue_softc *, void *) |
static uint32_t | cue_mchash (const uint8_t *) |
static void | cue_reset (struct cue_softc *) |
DRIVER_MODULE (cue, uhub, cue_driver, cue_devclass, NULL, 0) | |
MODULE_DEPEND (cue, uether, 1, 1, 1) | |
MODULE_DEPEND (cue, usb, 1, 1, 1) | |
MODULE_DEPEND (cue, ether, 1, 1, 1) | |
MODULE_VERSION (cue, 1) | |
USB_PNP_HOST_INFO (cue_devs) | |
static void | cue_setpromisc (struct usb_ether *ue) |
static u_int | cue_hash_maddr (void *arg, struct sockaddr_dl *sdl, u_int cnt) |
static void | cue_setmulti (struct usb_ether *ue) |
static void | cue_attach_post (struct usb_ether *ue) |
static int | cue_probe (device_t dev) |
static int | cue_attach (device_t dev) |
static int | cue_detach (device_t dev) |
static void | cue_bulk_read_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | cue_bulk_write_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | cue_tick (struct usb_ether *ue) |
static void | cue_start (struct usb_ether *ue) |
static void | cue_init (struct usb_ether *ue) |
static void | cue_stop (struct usb_ether *ue) |
Variables | |
static const STRUCT_USB_HOST_ID | cue_devs [] |
static device_probe_t | cue_probe |
static device_attach_t | cue_attach |
static device_detach_t | cue_detach |
static usb_callback_t | cue_bulk_read_callback |
static usb_callback_t | cue_bulk_write_callback |
static uether_fn_t | cue_attach_post |
static uether_fn_t | cue_init |
static uether_fn_t | cue_stop |
static uether_fn_t | cue_start |
static uether_fn_t | cue_tick |
static uether_fn_t | cue_setmulti |
static uether_fn_t | cue_setpromisc |
static const struct usb_config | cue_config [CUE_N_TRANSFER] |
static device_method_t | cue_methods [] |
static driver_t | cue_driver |
static devclass_t | cue_devclass |
static const struct usb_ether_methods | cue_ue_methods |
#define CUE_CLRBIT | ( | sc, | |
reg, | |||
x | |||
) | cue_csr_write_1(sc, reg, cue_csr_read_1(sc, reg) & ~(x)) |
#define CUE_DEV | ( | v, | |
p | |||
) | { USB_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p) } |
#define CUE_SETBIT | ( | sc, | |
reg, | |||
x | |||
) | cue_csr_write_1(sc, reg, cue_csr_read_1(sc, reg) | (x)) |
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 404 of file if_cue.c.
References cue_config, cue_detach, CUE_IFACE_IDX, CUE_N_TRANSFER, cue_ue_methods, dev, usb_attach_arg::device, device_set_usb_desc(), error, cue_softc::sc_mtx, cue_softc::sc_ue, cue_softc::sc_xfer, usb_ether::ue_dev, usb_ether::ue_methods, usb_ether::ue_mtx, usb_ether::ue_sc, usb_ether::ue_udev, uether_ifattach(), and usbd_transfer_setup().
|
static |
Definition at line 377 of file if_cue.c.
References cue_getmac(), usb_ether::ue_eaddr, and uether_getsc().
|
static |
Definition at line 455 of file if_cue.c.
References DPRINTF, error, len, cue_softc::sc_ue, 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 503 of file if_cue.c.
References error, cue_softc::sc_ue, uether_getifp(), USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_copy_in(), usbd_errstr(), 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 201 of file if_cue.c.
References CUE_CMD_READREG, reg, req, cue_softc::sc_ue, uether_do_request, USETW, UT_READ_VENDOR_DEVICE, and val.
|
static |
Definition at line 219 of file if_cue.c.
References CUE_CMD_READREG, reg, req, cue_softc::sc_ue, uether_do_request, USETW, UT_READ_VENDOR_DEVICE, and val.
Referenced by cue_tick().
|
static |
Definition at line 235 of file if_cue.c.
References CUE_CMD_WRITEREG, reg, req, cue_softc::sc_ue, uether_do_request, USETW, UT_WRITE_VENDOR_DEVICE, and val.
Referenced by cue_init(), and cue_stop().
|
static |
Definition at line 442 of file if_cue.c.
References CUE_N_TRANSFER, dev, cue_softc::sc_mtx, cue_softc::sc_ue, cue_softc::sc_xfer, uether_ifdetach(), and usbd_transfer_unsetup().
|
static |
Definition at line 266 of file if_cue.c.
References CUE_CMD_GET_MACADDR, req, cue_softc::sc_ue, uether_do_request, USETW, and UT_READ_VENDOR_DEVICE.
Referenced by cue_attach_post().
|
static |
Definition at line 311 of file if_cue.c.
References cue_mchash().
Referenced by cue_setmulti().
|
static |
Definition at line 592 of file if_cue.c.
References CUE_ADVANCED_OPMODES, CUE_AOP_EMBED_RXLEN, CUE_BULK_DT_WR, cue_csr_write_1(), CUE_ETHCTL, CUE_ETHCTL_MCAST_ON, CUE_ETHCTL_RX_ON, CUE_LEDCTL, CUE_LEDCTL_FOLLOW_LINK, CUE_LOCK_ASSERT, CUE_PAR0, cue_reset(), CUE_RX_BUFPKTS, CUE_RX_FRAMES, cue_setpromisc, cue_start, cue_stop, CUE_TX_BUFPKTS, CUE_TX_FRAMES, cue_softc::sc_xfer, uether_getifp(), uether_getsc(), and usbd_xfer_set_stall().
|
static |
Definition at line 282 of file if_cue.c.
References addr, and CUE_BITS.
Referenced by cue_hash_maddr(), and cue_setmulti().
|
static |
Definition at line 249 of file if_cue.c.
References addr, CUE_CMD_READSRAM, len, req, cue_softc::sc_ue, uether_do_request, USETW, UT_READ_VENDOR_DEVICE, and UT_WRITE_VENDOR_DEVICE.
Referenced by cue_setmulti().
|
static |
Definition at line 385 of file if_cue.c.
References usbd_lookup_info::bConfigIndex, usbd_lookup_info::bIfaceIndex, CUE_CONFIG_IDX, cue_devs, CUE_IFACE_IDX, dev, usb_attach_arg::info, usb_attach_arg::usb_mode, USB_MODE_HOST, and usbd_lookup_id_by_uaa().
|
static |
Definition at line 356 of file if_cue.c.
References CUE_CMD_RESET, req, cue_softc::sc_ue, uether_do_request, uether_pause(), USETW, and UT_WRITE_VENDOR_DEVICE.
Referenced by cue_init(), and cue_stop().
|
static |
Definition at line 323 of file if_cue.c.
References CUE_CMD_WRITESRAM, cue_hash_maddr(), CUE_LOCK_ASSERT, CUE_MCAST_TABLE_ADDR, cue_mchash(), cue_mem(), uether_getifp(), and uether_getsc().
|
static |
Definition at line 293 of file if_cue.c.
References CUE_CLRBIT, CUE_ETHCTL, CUE_ETHCTL_PROMISC, CUE_LOCK_ASSERT, CUE_SETBIT, cue_setmulti, uether_getifp(), and uether_getsc().
|
static |
Definition at line 580 of file if_cue.c.
References CUE_BULK_DT_RD, CUE_BULK_DT_WR, cue_softc::sc_xfer, uether_getsc(), and usbd_transfer_start().
|
static |
Definition at line 642 of file if_cue.c.
References CUE_BULK_DT_RD, CUE_BULK_DT_WR, cue_csr_write_1(), CUE_ETHCTL, CUE_LOCK_ASSERT, cue_reset(), cue_softc::sc_xfer, uether_getifp(), uether_getsc(), and usbd_transfer_stop().
|
static |
Definition at line 564 of file if_cue.c.
References cue_csr_read_2(), CUE_LOCK_ASSERT, CUE_RX_FRAMEERR, CUE_TX_EXCESSCOLL, CUE_TX_MULTICOLL, CUE_TX_SINGLECOLL, uether_getifp(), and uether_getsc().
DRIVER_MODULE | ( | cue | , |
uhub | , | ||
cue_driver | , | ||
cue_devclass | , | ||
NULL | , | ||
0 | |||
) |
MODULE_DEPEND | ( | cue | , |
ether | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | cue | , |
uether | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | cue | , |
usb | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_VERSION | ( | cue | , |
1 | |||
) |
USB_PNP_HOST_INFO | ( | cue_devs | ) |
|
static |
|
static |
|
static |
|
static |
Definition at line 139 of file if_cue.c.
Referenced by cue_attach().
|
static |
Definition at line 109 of file if_cue.c.
Referenced by cue_attach().
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 119 of file if_cue.c.
Referenced by cue_setpromisc().
|
static |
Definition at line 120 of file if_cue.c.
Referenced by cue_init().
|
static |
Definition at line 117 of file if_cue.c.
Referenced by cue_init().
|
static |
Definition at line 116 of file if_cue.c.
Referenced by cue_init().
|
static |
|
static |
Definition at line 184 of file if_cue.c.
Referenced by cue_attach().