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 | uchcom_softc |
struct | uchcom_divider |
struct | uchcom_divider_record |
Enumerations | |
enum | { UCHCOM_BULK_DT_WR , UCHCOM_BULK_DT_RD , UCHCOM_INTR_DT_RD , UCHCOM_N_TRANSFER } |
Functions | |
__FBSDID ("$FreeBSD$") | |
static void | uchcom_free (struct ucom_softc *) |
static int | uchcom_pre_param (struct ucom_softc *, struct termios *) |
static void | uchcom_cfg_get_status (struct ucom_softc *, uint8_t *, uint8_t *) |
static void | uchcom_cfg_open (struct ucom_softc *ucom) |
static void | uchcom_cfg_param (struct ucom_softc *, struct termios *) |
static void | uchcom_cfg_set_break (struct ucom_softc *, uint8_t) |
static void | uchcom_cfg_set_dtr (struct ucom_softc *, uint8_t) |
static void | uchcom_cfg_set_rts (struct ucom_softc *, uint8_t) |
static void | uchcom_start_read (struct ucom_softc *) |
static void | uchcom_start_write (struct ucom_softc *) |
static void | uchcom_stop_read (struct ucom_softc *) |
static void | uchcom_stop_write (struct ucom_softc *) |
static void | uchcom_update_version (struct uchcom_softc *) |
static void | uchcom_convert_status (struct uchcom_softc *, uint8_t) |
static void | uchcom_update_status (struct uchcom_softc *) |
static void | uchcom_set_dtr_rts (struct uchcom_softc *) |
static int | uchcom_calc_divider_settings (struct uchcom_divider *, uint32_t) |
static void | uchcom_set_baudrate (struct uchcom_softc *, uint32_t) |
static void | uchcom_poll (struct ucom_softc *ucom) |
static void | uchcom_free_softc (struct uchcom_softc *) |
static int | uchcom_probe (device_t dev) |
static int | uchcom_attach (device_t dev) |
static int | uchcom_detach (device_t dev) |
UCOM_UNLOAD_DRAIN (uchcom) | |
static void | uchcom_ctrl_write (struct uchcom_softc *sc, uint8_t reqno, uint16_t value, uint16_t index) |
static void | uchcom_ctrl_read (struct uchcom_softc *sc, uint8_t reqno, uint16_t value, uint16_t index, void *buf, uint16_t buflen) |
static void | uchcom_write_reg (struct uchcom_softc *sc, uint8_t reg1, uint8_t val1, uint8_t reg2, uint8_t val2) |
static void | uchcom_read_reg (struct uchcom_softc *sc, uint8_t reg1, uint8_t *rval1, uint8_t reg2, uint8_t *rval2) |
static void | uchcom_get_version (struct uchcom_softc *sc, uint8_t *rver) |
static void | uchcom_get_status (struct uchcom_softc *sc, uint8_t *rval) |
static void | uchcom_set_dtr_rts_10 (struct uchcom_softc *sc, uint8_t val) |
static void | uchcom_set_dtr_rts_20 (struct uchcom_softc *sc, uint8_t val) |
static void | uchcom_intr_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | uchcom_write_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | uchcom_read_callback (struct usb_xfer *xfer, usb_error_t error) |
DRIVER_MODULE (uchcom, uhub, uchcom_driver, uchcom_devclass, NULL, 0) | |
MODULE_DEPEND (uchcom, ucom, 1, 1, 1) | |
MODULE_DEPEND (uchcom, usb, 1, 1, 1) | |
MODULE_VERSION (uchcom, 1) | |
USB_PNP_HOST_INFO (uchcom_devs) | |
Variables | |
static const struct uchcom_divider_record | dividers [] |
static const STRUCT_USB_HOST_ID | uchcom_devs [] |
static device_probe_t | uchcom_probe |
static device_attach_t | uchcom_attach |
static device_detach_t | uchcom_detach |
static usb_callback_t | uchcom_intr_callback |
static usb_callback_t | uchcom_write_callback |
static usb_callback_t | uchcom_read_callback |
static const struct usb_config | uchcom_config_data [UCHCOM_N_TRANSFER] |
static struct ucom_callback | uchcom_callback |
static device_method_t | uchcom_methods [] |
static driver_t | uchcom_driver |
static devclass_t | uchcom_devclass |
anonymous enum |
__FBSDID | ( | "$FreeBSD$" | ) |
DRIVER_MODULE | ( | uchcom | , |
uhub | , | ||
uchcom_driver | , | ||
uchcom_devclass | , | ||
NULL | , | ||
0 | |||
) |
MODULE_DEPEND | ( | uchcom | , |
ucom | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | uchcom | , |
usb | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_VERSION | ( | uchcom | , |
1 | |||
) |
|
static |
Definition at line 312 of file uchcom.c.
References dev, usb_attach_arg::device, device_set_usb_desc(), DPRINTF, error, usbd_lookup_info::idProduct, usb_attach_arg::info, uchcom_softc::sc_mtx, uchcom_softc::sc_super_ucom, uchcom_softc::sc_ucom, uchcom_softc::sc_udev, uchcom_softc::sc_xfer, UCHCOM_BULK_DT_RD, UCHCOM_BULK_DT_WR, uchcom_callback, uchcom_config_data, uchcom_detach, UCHCOM_IFACE_INDEX, UCHCOM_N_TRANSFER, ucom_attach(), ucom_ref(), ucom_set_pnpinfo_usb(), usbd_errstr(), usbd_transfer_setup(), and usbd_xfer_set_stall().
|
static |
Definition at line 574 of file uchcom.c.
References dividers, uchcom_divider::dv_div, uchcom_divider::dv_mod, uchcom_divider::dv_prescaler, uchcom_divider_record::dvr_base_clock, uchcom_divider_record::dvr_divider, uchcom_divider_record::dvr_high, uchcom_divider_record::dvr_low, NUM_DIVIDERS, UCHCOM_BASE_UNKNOWN, UCHCOM_BPS_MOD_BASE, and UCHCOM_BPS_MOD_BASE_OFS.
Referenced by uchcom_pre_param(), and uchcom_set_baudrate().
|
static |
Definition at line 638 of file uchcom.c.
References DPRINTF, uchcom_softc::sc_lsr, uchcom_softc::sc_msr, and ucom_softc::sc_parent.
|
static |
Definition at line 672 of file uchcom.c.
References DPRINTF, ucom_softc::sc_parent, uchcom_update_status(), and uchcom_update_version().
|
static |
Definition at line 705 of file uchcom.c.
References ucom_softc::sc_parent, uchcom_softc::sc_version, uchcom_ctrl_write(), uchcom_get_version(), UCHCOM_LCR1_CS8, UCHCOM_LCR1_RX, UCHCOM_LCR1_TX, uchcom_read_reg(), UCHCOM_REG_LCR1, UCHCOM_REG_LCR2, UCHCOM_REQ_RESET, uchcom_set_baudrate(), uchcom_set_dtr_rts(), uchcom_update_status(), UCHCOM_VER_30, and uchcom_write_reg().
|
static |
Definition at line 554 of file uchcom.c.
References ucom_softc::sc_parent, UCHCOM_BRK_MASK, UCHCOM_LCR1_TX, uchcom_read_reg(), UCHCOM_REG_BREAK1, UCHCOM_REG_LCR1, and uchcom_write_reg().
|
static |
Definition at line 650 of file uchcom.c.
References DPRINTF, uchcom_softc::sc_dtr, ucom_softc::sc_parent, and uchcom_set_dtr_rts().
|
static |
Definition at line 661 of file uchcom.c.
References DPRINTF, ucom_softc::sc_parent, uchcom_softc::sc_rts, and uchcom_set_dtr_rts().
|
static |
Definition at line 519 of file uchcom.c.
References uchcom_softc::sc_dtr, uchcom_softc::sc_msr, uchcom_softc::sc_rts, UCHCOM_DTR_MASK, and UCHCOM_RTS_MASK.
Referenced by uchcom_intr_callback(), and uchcom_update_status().
|
static |
Definition at line 429 of file uchcom.c.
References DPRINTF, index, req, uchcom_softc::sc_ucom, uchcom_softc::sc_udev, ucom_cfg_do_request, USB_SHORT_XFER_OK, USETW, UT_READ_VENDOR_DEVICE, and value.
Referenced by uchcom_get_version(), and uchcom_read_reg().
|
static |
Definition at line 411 of file uchcom.c.
References DPRINTF, index, req, uchcom_softc::sc_ucom, uchcom_softc::sc_udev, ucom_cfg_do_request, USETW, UT_WRITE_VENDOR_DEVICE, and value.
Referenced by uchcom_cfg_param(), uchcom_set_dtr_rts_20(), and uchcom_write_reg().
|
static |
Definition at line 373 of file uchcom.c.
References dev, uchcom_softc::sc_super_ucom, uchcom_softc::sc_ucom, uchcom_softc::sc_xfer, uchcom_free_softc(), UCHCOM_N_TRANSFER, ucom_detach(), and usbd_transfer_unsetup().
|
static |
Definition at line 401 of file uchcom.c.
References ucom_softc::sc_parent, and uchcom_free_softc().
|
static |
Definition at line 392 of file uchcom.c.
References uchcom_softc::sc_mtx, uchcom_softc::sc_super_ucom, and ucom_unref().
Referenced by uchcom_detach(), and uchcom_free().
|
static |
Definition at line 490 of file uchcom.c.
References uchcom_read_reg(), UCHCOM_REG_STAT1, and UCHCOM_REG_STAT2.
Referenced by uchcom_update_status().
|
static |
Definition at line 479 of file uchcom.c.
References uchcom_ctrl_read(), UCHCOM_INPUT_BUF_SIZE, and UCHCOM_REQ_GET_VERSION.
Referenced by uchcom_cfg_param(), and uchcom_update_version().
|
static |
Definition at line 780 of file uchcom.c.
References DPRINTF, error, uchcom_softc::sc_ucom, uchcom_convert_status(), UCHCOM_INTR_LEAST, UCHCOM_INTR_STAT1, 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 886 of file uchcom.c.
References ucom_softc::sc_parent, uchcom_softc::sc_xfer, UCHCOM_N_TRANSFER, and usbd_transfer_poll().
|
static |
Definition at line 683 of file uchcom.c.
References uchcom_calc_divider_settings().
|
static |
Definition at line 293 of file uchcom.c.
References usbd_lookup_info::bConfigIndex, usbd_lookup_info::bIfaceIndex, dev, usb_attach_arg::info, UCHCOM_CONFIG_INDEX, uchcom_devs, UCHCOM_IFACE_INDEX, usb_attach_arg::usb_mode, USB_MODE_HOST, and usbd_lookup_id_by_uaa().
|
static |
Definition at line 853 of file uchcom.c.
References error, uchcom_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 459 of file uchcom.c.
References DPRINTF, uchcom_ctrl_read(), UCHCOM_INPUT_BUF_SIZE, and UCHCOM_REQ_READ_REG.
Referenced by uchcom_cfg_param(), uchcom_cfg_set_break(), and uchcom_get_status().
|
static |
Definition at line 615 of file uchcom.c.
References uchcom_divider::dv_div, uchcom_divider::dv_mod, uchcom_divider::dv_prescaler, uchcom_calc_divider_settings(), UCHCOM_REG_BPS_DIV, UCHCOM_REG_BPS_MOD, UCHCOM_REG_BPS_PAD, UCHCOM_REG_BPS_PRE, and uchcom_write_reg().
Referenced by uchcom_cfg_param().
|
static |
Definition at line 538 of file uchcom.c.
References uchcom_softc::sc_dtr, uchcom_softc::sc_rts, uchcom_softc::sc_version, UCHCOM_DTR_MASK, UCHCOM_RTS_MASK, uchcom_set_dtr_rts_10(), uchcom_set_dtr_rts_20(), UCHCOM_VER_20, and val.
Referenced by uchcom_cfg_param(), uchcom_cfg_set_dtr(), and uchcom_cfg_set_rts().
|
static |
Definition at line 496 of file uchcom.c.
References UCHCOM_REG_STAT1, uchcom_write_reg(), and val.
Referenced by uchcom_set_dtr_rts().
|
static |
Definition at line 502 of file uchcom.c.
References uchcom_ctrl_write(), UCHCOM_REQ_SET_DTRRTS, and val.
Referenced by uchcom_set_dtr_rts().
|
static |
Definition at line 737 of file uchcom.c.
References ucom_softc::sc_parent, uchcom_softc::sc_xfer, UCHCOM_BULK_DT_RD, UCHCOM_INTR_DT_RD, and usbd_transfer_start().
|
static |
Definition at line 761 of file uchcom.c.
References ucom_softc::sc_parent, uchcom_softc::sc_xfer, UCHCOM_BULK_DT_WR, and usbd_transfer_start().
|
static |
Definition at line 749 of file uchcom.c.
References ucom_softc::sc_parent, uchcom_softc::sc_xfer, UCHCOM_BULK_DT_RD, UCHCOM_INTR_DT_RD, and usbd_transfer_stop().
|
static |
Definition at line 769 of file uchcom.c.
References ucom_softc::sc_parent, uchcom_softc::sc_xfer, UCHCOM_BULK_DT_WR, and usbd_transfer_stop().
|
static |
Definition at line 529 of file uchcom.c.
References uchcom_convert_status(), and uchcom_get_status().
Referenced by uchcom_cfg_open(), and uchcom_cfg_param().
|
static |
Definition at line 512 of file uchcom.c.
References DPRINTF, uchcom_softc::sc_version, and uchcom_get_version().
Referenced by uchcom_cfg_open().
|
static |
Definition at line 822 of file uchcom.c.
References DPRINTF, error, uchcom_softc::sc_ucom, ucom_get_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(), and usbd_xfer_softc().
|
static |
Definition at line 447 of file uchcom.c.
References DPRINTF, uchcom_ctrl_write(), and UCHCOM_REQ_WRITE_REG.
Referenced by uchcom_cfg_param(), uchcom_cfg_set_break(), uchcom_set_baudrate(), and uchcom_set_dtr_rts_10().
UCOM_UNLOAD_DRAIN | ( | uchcom | ) |
USB_PNP_HOST_INFO | ( | uchcom_devs | ) |
|
static |
Definition at line 193 of file uchcom.c.
Referenced by uchcom_calc_divider_settings().
|
static |
Definition at line 272 of file uchcom.c.
Referenced by uchcom_attach().
|
static |
Definition at line 243 of file uchcom.c.
Referenced by uchcom_attach().
|
static |
Definition at line 236 of file uchcom.c.
Referenced by uchcom_attach().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |