74#include <sys/stdint.h>
75#include <sys/stddef.h>
80#include <sys/kernel.h>
82#include <sys/module.h>
85#include <sys/condvar.h>
86#include <sys/sysctl.h>
88#include <sys/unistd.h>
89#include <sys/callout.h>
90#include <sys/malloc.h>
98#define USB_DEBUG_VAR ubser_debug
104#define UBSER_UNIT_MAX 32
107#define VENDOR_GET_NUMSER 0x01
108#define VENDOR_SET_BREAK 0x02
109#define VENDOR_CLEAR_BREAK 0x03
112static int ubser_debug = 0;
114static SYSCTL_NODE(_hw_usb, OID_AUTO, ubser, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
117 &ubser_debug, 0,
"ubser debug level");
169 .flags = {.pipe_bof = 1,.force_short_xfer = 1,},
178 .flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
242 mtx_init(&sc->
sc_mtx,
"ubser", NULL, MTX_DEF);
261 device_printf(
dev,
"failed to get number "
262 "of serial ports: %s\n",
269 device_printf(
dev,
"found %i serials\n", sc->
sc_numser);
279 DPRINTFN(0,
"invalid tx_size\n");
318 device_claim_softc(
dev);
332 device_free_softc(sc);
354 switch (t->c_ospeed) {
362 if (t->c_cflag & CSTOPB)
366 if (t->c_cflag & PARENB)
370 switch (t->c_cflag & CSIZE) {
379 (CRTS_IFLOW | CDTR_IFLOW | CDSR_OFLOW | CCAR_OFLOW)) != 0)
458 DPRINTF(
"invalid actlen=0!\n");
465 DPRINTF(
"invalid serial number!\n");
504 &
req, NULL, 0, 1000);
506 DPRINTFN(0,
"send break failed, error=%s\n",
static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "USB DWC OTG")
SYSCTL_INT(_hw_usb_dwc_otg, OID_AUTO, phy_type, CTLFLAG_RDTUN, &dwc_otg_phy_type, 0, "DWC OTG PHY TYPE - 0/1/2/3 - ULPI/HSIC/INTERNAL/UTMI+")
struct usb_device * sc_udev
struct ucom_super_softc sc_super_ucom
struct ucom_softc sc_ucom[UBSER_UNIT_MAX]
struct usb_xfer * sc_xfer[UBSER_N_TRANSFER]
void(* ucom_cfg_set_break)(struct ucom_softc *, uint8_t)
enum usb_hc_mode usb_mode
struct usbd_lookup_info info
struct usb_device * device
uint8_t bInterfaceSubClass
DRIVER_MODULE(ubser, uhub, ubser_driver, ubser_devclass, NULL, 0)
#define VENDOR_GET_NUMSER
static void ubser_stop_read(struct ucom_softc *)
static device_probe_t ubser_probe
static void ubser_cfg_set_break(struct ucom_softc *, uint8_t)
static const struct ucom_callback ubser_callback
static device_method_t ubser_methods[]
static void ubser_free_softc(struct ubser_softc *)
static __inline void ubser_inc_tx_unit(struct ubser_softc *sc)
static void ubser_free(struct ucom_softc *)
static void ubser_start_write(struct ucom_softc *)
static int ubser_pre_param(struct ucom_softc *, struct termios *)
static void ubser_stop_write(struct ucom_softc *)
static const struct usb_config ubser_config[UBSER_N_TRANSFER]
static void ubser_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *)
MODULE_DEPEND(ubser, ucom, 1, 1, 1)
static void ubser_start_read(struct ucom_softc *)
static device_attach_t ubser_attach
static device_detach_t ubser_detach
static usb_callback_t ubser_write_callback
static void ubser_poll(struct ucom_softc *ucom)
static devclass_t ubser_devclass
static driver_t ubser_driver
static usb_callback_t ubser_read_callback
#define UT_READ_VENDOR_INTERFACE
void usbd_copy_in(struct usb_page_cache *cache, usb_frlength_t offset, const void *ptr, usb_frlength_t len)
void usbd_copy_out(struct usb_page_cache *cache, usb_frlength_t offset, void *ptr, usb_frlength_t len)
const char * usb_get_manufacturer(struct usb_device *udev)
const char * usbd_errstr(usb_error_t err)
usb_error_t usbd_do_request_flags(struct usb_device *udev, struct mtx *mtx, struct usb_device_request *req, void *data, uint16_t flags, uint16_t *actlen, usb_timeout_t timeout)
uint8_t ucom_get_data(struct ucom_softc *sc, struct usb_page_cache *pc, uint32_t offset, uint32_t len, uint32_t *actlen)
int ucom_attach(struct ucom_super_softc *ssc, struct ucom_softc *sc, int subunits, void *parent, const struct ucom_callback *callback, struct mtx *mtx)
int ucom_unref(struct ucom_super_softc *ssc)
void ucom_ref(struct ucom_super_softc *ssc)
void ucom_set_pnpinfo_usb(struct ucom_super_softc *ssc, device_t dev)
void ucom_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc)
void ucom_put_data(struct ucom_softc *sc, struct usb_page_cache *pc, uint32_t offset, uint32_t len)
#define ucom_cfg_do_request(udev, com, req, ptr, flags, timo)
void usbd_transfer_submit(struct usb_xfer *xfer)
void usbd_transfer_unsetup(struct usb_xfer **pxfer, uint16_t n_setup)
void usbd_xfer_set_frame_len(struct usb_xfer *xfer, usb_frcount_t frindex, usb_frlength_t len)
struct usb_page_cache * usbd_xfer_get_frame(struct usb_xfer *xfer, usb_frcount_t frindex)
usb_error_t usbd_transfer_setup(struct usb_device *udev, const uint8_t *ifaces, struct usb_xfer **ppxfer, const struct usb_config *setup_start, uint16_t n_setup, void *priv_sc, struct mtx *xfer_mtx)
void usbd_transfer_start(struct usb_xfer *xfer)
void usbd_transfer_poll(struct usb_xfer **ppxfer, uint16_t max)
void * usbd_xfer_softc(struct usb_xfer *xfer)
void usbd_xfer_set_stall(struct usb_xfer *xfer)
void usbd_transfer_stop(struct usb_xfer *xfer)
void usbd_xfer_status(struct usb_xfer *xfer, int *actlen, int *sumlen, int *aframes, int *nframes)
usb_frlength_t usbd_xfer_max_len(struct usb_xfer *xfer)
void device_set_usb_desc(device_t dev)
#define USB_DEFAULT_TIMEOUT
#define USB_ST_TRANSFERRED
void() usb_callback_t(struct usb_xfer *, usb_error_t)
#define USB_GET_STATE(xfer)