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/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 <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/serial/usb_serial.h>
Go to the source code of this file.
Data Structures | |
struct | ubsa_softc |
Macros | |
#define | USB_DEBUG_VAR ubsa_debug |
#define | UBSA_BSIZE 1024 /* bytes */ |
#define | UBSA_CONFIG_INDEX 0 |
#define | UBSA_IFACE_INDEX 0 |
#define | UBSA_REG_BAUDRATE 0x00 |
#define | UBSA_REG_STOP_BITS 0x01 |
#define | UBSA_REG_DATA_BITS 0x02 |
#define | UBSA_REG_PARITY 0x03 |
#define | UBSA_REG_DTR 0x0A |
#define | UBSA_REG_RTS 0x0B |
#define | UBSA_REG_BREAK 0x0C |
#define | UBSA_REG_FLOW_CTRL 0x10 |
#define | UBSA_PARITY_NONE 0x00 |
#define | UBSA_PARITY_EVEN 0x01 |
#define | UBSA_PARITY_ODD 0x02 |
#define | UBSA_PARITY_MARK 0x03 |
#define | UBSA_PARITY_SPACE 0x04 |
#define | UBSA_FLOW_NONE 0x0000 |
#define | UBSA_FLOW_OCTS 0x0001 |
#define | UBSA_FLOW_ODSR 0x0002 |
#define | UBSA_FLOW_IDSR 0x0004 |
#define | UBSA_FLOW_IDTR 0x0008 |
#define | UBSA_FLOW_IRTS 0x0010 |
#define | UBSA_FLOW_ORTS 0x0020 |
#define | UBSA_FLOW_UNKNOWN 0x0040 |
#define | UBSA_FLOW_OXON 0x0080 |
#define | UBSA_FLOW_IXON 0x0100 |
#define | UBSA_LSR_TSRE 0x40 /* Transmitter empty: byte sent */ |
#define | UBSA_LSR_TXRDY 0x20 /* Transmitter buffer empty */ |
#define | UBSA_LSR_BI 0x10 /* Break detected */ |
#define | UBSA_LSR_FE 0x08 /* Framing error: bad stop bit */ |
#define | UBSA_LSR_PE 0x04 /* Parity error */ |
#define | UBSA_LSR_OE 0x02 /* Overrun, lost incoming byte */ |
#define | UBSA_LSR_RXRDY 0x01 /* Byte ready in Receive Buffer */ |
#define | UBSA_LSR_RCV_MASK 0x1f /* Mask for incoming data or error */ |
#define | UBSA_MSR_DCD 0x80 /* Current Data Carrier Detect */ |
#define | UBSA_MSR_RI 0x40 /* Current Ring Indicator */ |
#define | UBSA_MSR_DSR 0x20 /* Current Data Set Ready */ |
#define | UBSA_MSR_CTS 0x10 /* Current Clear to Send */ |
#define | UBSA_MSR_DDCD 0x08 /* DCD has changed state */ |
#define | UBSA_MSR_TERI 0x04 /* RI has toggled low to high */ |
#define | UBSA_MSR_DDSR 0x02 /* DSR has changed state */ |
#define | UBSA_MSR_DCTS 0x01 /* CTS has changed state */ |
Enumerations | |
enum | { UBSA_BULK_DT_WR , UBSA_BULK_DT_RD , UBSA_INTR_DT_RD , UBSA_N_TRANSFER } |
Functions | |
__FBSDID ("$FreeBSD$") | |
static void | ubsa_free_softc (struct ubsa_softc *) |
static void | ubsa_cfg_request (struct ubsa_softc *, uint8_t, uint16_t) |
static void | ubsa_free (struct ucom_softc *) |
static void | ubsa_cfg_set_dtr (struct ucom_softc *, uint8_t) |
static void | ubsa_cfg_set_rts (struct ucom_softc *, uint8_t) |
static void | ubsa_cfg_set_break (struct ucom_softc *, uint8_t) |
static int | ubsa_pre_param (struct ucom_softc *, struct termios *) |
static void | ubsa_cfg_param (struct ucom_softc *, struct termios *) |
static void | ubsa_start_read (struct ucom_softc *) |
static void | ubsa_stop_read (struct ucom_softc *) |
static void | ubsa_start_write (struct ucom_softc *) |
static void | ubsa_stop_write (struct ucom_softc *) |
static void | ubsa_cfg_get_status (struct ucom_softc *, uint8_t *, uint8_t *) |
static void | ubsa_poll (struct ucom_softc *ucom) |
DRIVER_MODULE (ubsa, uhub, ubsa_driver, ubsa_devclass, NULL, 0) | |
MODULE_DEPEND (ubsa, ucom, 1, 1, 1) | |
MODULE_DEPEND (ubsa, usb, 1, 1, 1) | |
MODULE_VERSION (ubsa, 1) | |
USB_PNP_HOST_INFO (ubsa_devs) | |
static int | ubsa_probe (device_t dev) |
static int | ubsa_attach (device_t dev) |
static int | ubsa_detach (device_t dev) |
UCOM_UNLOAD_DRAIN (ubsa) | |
static void | ubsa_write_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | ubsa_read_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | ubsa_intr_callback (struct usb_xfer *xfer, usb_error_t error) |
Variables | |
static device_probe_t | ubsa_probe |
static device_attach_t | ubsa_attach |
static device_detach_t | ubsa_detach |
static usb_callback_t | ubsa_write_callback |
static usb_callback_t | ubsa_read_callback |
static usb_callback_t | ubsa_intr_callback |
static const struct usb_config | ubsa_config [UBSA_N_TRANSFER] |
static const struct ucom_callback | ubsa_callback |
static const STRUCT_USB_HOST_ID | ubsa_devs [] |
static device_method_t | ubsa_methods [] |
static devclass_t | ubsa_devclass |
static driver_t | ubsa_driver |
#define UBSA_LSR_RXRDY 0x01 /* Byte ready in Receive Buffer */ |
#define UBSA_LSR_TSRE 0x40 /* Transmitter empty: byte sent */ |
anonymous enum |
__FBSDID | ( | "$FreeBSD$" | ) |
DRIVER_MODULE | ( | ubsa | , |
uhub | , | ||
ubsa_driver | , | ||
ubsa_devclass | , | ||
NULL | , | ||
0 | |||
) |
MODULE_DEPEND | ( | ubsa | , |
ucom | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | ubsa | , |
usb | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_VERSION | ( | ubsa | , |
1 | |||
) |
|
static |
Definition at line 298 of file ubsa.c.
References usbd_lookup_info::bIfaceNum, dev, usb_attach_arg::device, device_set_usb_desc(), DPRINTF, error, usb_attach_arg::info, ubsa_softc::sc_iface_index, ubsa_softc::sc_iface_no, ubsa_softc::sc_mtx, ubsa_softc::sc_super_ucom, ubsa_softc::sc_ucom, ubsa_softc::sc_udev, ubsa_softc::sc_xfer, UBSA_BULK_DT_RD, UBSA_BULK_DT_WR, ubsa_callback, ubsa_config, ubsa_detach, UBSA_IFACE_INDEX, UBSA_N_TRANSFER, ucom_attach(), ucom_ref(), ucom_set_pnpinfo_usb(), usbd_transfer_setup(), and usbd_xfer_set_stall().
|
static |
Definition at line 565 of file ubsa.c.
References DPRINTF, ubsa_softc::sc_lsr, ubsa_softc::sc_msr, and ucom_softc::sc_parent.
|
static |
Definition at line 454 of file ubsa.c.
References DPRINTF, ucom_softc::sc_parent, ubsa_softc::sc_ucom, ubsa_cfg_request(), ubsa_cfg_set_dtr(), ubsa_cfg_set_rts(), UBSA_FLOW_IRTS, UBSA_FLOW_IXON, UBSA_FLOW_OCTS, UBSA_FLOW_OXON, UBSA_PARITY_EVEN, UBSA_PARITY_NONE, UBSA_PARITY_ODD, UBSA_REG_BAUDRATE, UBSA_REG_DATA_BITS, UBSA_REG_FLOW_CTRL, UBSA_REG_PARITY, UBSA_REG_STOP_BITS, and value.
|
static |
Definition at line 377 of file ubsa.c.
References index, req, ubsa_softc::sc_iface_no, ubsa_softc::sc_ucom, ubsa_softc::sc_udev, ucom_cfg_do_request, usbd_errstr(), USETW, UT_WRITE_VENDOR_DEVICE, and value.
Referenced by ubsa_cfg_param(), ubsa_cfg_set_break(), ubsa_cfg_set_dtr(), and ubsa_cfg_set_rts().
|
static |
Definition at line 418 of file ubsa.c.
References DPRINTF, ucom_softc::sc_parent, ubsa_cfg_request(), and UBSA_REG_BREAK.
|
static |
Definition at line 398 of file ubsa.c.
References DPRINTF, ucom_softc::sc_parent, ubsa_cfg_request(), and UBSA_REG_DTR.
Referenced by ubsa_cfg_param().
|
static |
Definition at line 408 of file ubsa.c.
References DPRINTF, ucom_softc::sc_parent, ubsa_cfg_request(), and UBSA_REG_RTS.
Referenced by ubsa_cfg_param().
|
static |
Definition at line 343 of file ubsa.c.
References dev, DPRINTF, ubsa_softc::sc_super_ucom, ubsa_softc::sc_ucom, ubsa_softc::sc_xfer, ubsa_free_softc(), UBSA_N_TRANSFER, ucom_detach(), and usbd_transfer_unsetup().
|
static |
Definition at line 371 of file ubsa.c.
References ucom_softc::sc_parent, and ubsa_free_softc().
|
static |
Definition at line 362 of file ubsa.c.
References ubsa_softc::sc_mtx, ubsa_softc::sc_super_ucom, and ucom_unref().
Referenced by ubsa_detach(), and ubsa_free().
|
static |
Definition at line 635 of file ubsa.c.
References DPRINTF, error, ubsa_softc::sc_lsr, ubsa_softc::sc_msr, ubsa_softc::sc_ucom, UBSA_MSR_CTS, UBSA_MSR_DCD, UBSA_MSR_DSR, UBSA_MSR_RI, ucom_status_change(), USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_copy_out(), 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 691 of file ubsa.c.
References ucom_softc::sc_parent, ubsa_softc::sc_xfer, UBSA_N_TRANSFER, and usbd_transfer_poll().
|
static |
Definition at line 428 of file ubsa.c.
References DPRINTF, and ucom_softc::sc_parent.
|
static |
Definition at line 281 of file ubsa.c.
References usbd_lookup_info::bConfigIndex, usbd_lookup_info::bIfaceIndex, dev, usb_attach_arg::info, UBSA_CONFIG_INDEX, ubsa_devs, UBSA_IFACE_INDEX, usb_attach_arg::usb_mode, USB_MODE_HOST, and usbd_lookup_id_by_uaa().
|
static |
Definition at line 605 of file ubsa.c.
References error, ubsa_softc::sc_ucom, ucom_put_data(), USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, 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 525 of file ubsa.c.
References ucom_softc::sc_parent, ubsa_softc::sc_xfer, UBSA_BULK_DT_RD, UBSA_INTR_DT_RD, and usbd_transfer_start().
|
static |
Definition at line 549 of file ubsa.c.
References ucom_softc::sc_parent, ubsa_softc::sc_xfer, UBSA_BULK_DT_WR, and usbd_transfer_start().
|
static |
Definition at line 537 of file ubsa.c.
References ucom_softc::sc_parent, ubsa_softc::sc_xfer, UBSA_BULK_DT_RD, UBSA_INTR_DT_RD, and usbd_transfer_stop().
|
static |
Definition at line 557 of file ubsa.c.
References ucom_softc::sc_parent, ubsa_softc::sc_xfer, UBSA_BULK_DT_WR, and usbd_transfer_stop().
|
static |
Definition at line 576 of file ubsa.c.
References error, ubsa_softc::sc_ucom, UBSA_BSIZE, ucom_get_data(), USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_transfer_submit(), usbd_xfer_get_frame(), usbd_xfer_set_frame_len(), usbd_xfer_set_stall(), and usbd_xfer_softc().
UCOM_UNLOAD_DRAIN | ( | ubsa | ) |
USB_PNP_HOST_INFO | ( | ubsa_devs | ) |
|
static |
Definition at line 225 of file ubsa.c.
Referenced by ubsa_attach().
|
static |
Definition at line 196 of file ubsa.c.
Referenced by ubsa_attach().
|
static |
Definition at line 174 of file ubsa.c.
Referenced by ubsa_attach().
|
static |
Definition at line 240 of file ubsa.c.
Referenced by ubsa_probe().
|
static |
|
static |
|
static |
|
static |
|
static |