FreeBSD kernel usb device Code
|
#include <sys/tty.h>
#include <sys/serial.h>
#include <sys/fcntl.h>
#include <sys/sysctl.h>
#include <sys/timepps.h>
Go to the source code of this file.
Data Structures | |
struct | ucom_callback |
struct | ucom_cfg_task |
struct | ucom_param_task |
struct | ucom_super_softc |
struct | ucom_softc |
Macros | |
#define | UCOM_MODVER 1 |
#define | UCOM_MINVER 1 |
#define | UCOM_PREFVER UCOM_MODVER |
#define | UCOM_MAXVER 1 |
#define | UCOM_JITTERBUF_SIZE 128 /* bytes */ |
#define | ULSR_RCV_FIFO 0x80 |
#define | ULSR_TSRE 0x40 /* Transmitter empty: byte sent */ |
#define | ULSR_TXRDY 0x20 /* Transmitter buffer empty */ |
#define | ULSR_BI 0x10 /* Break detected */ |
#define | ULSR_FE 0x08 /* Framing error: bad stop bit */ |
#define | ULSR_PE 0x04 /* Parity error */ |
#define | ULSR_OE 0x02 /* Overrun, lost incoming byte */ |
#define | ULSR_RXRDY 0x01 /* Byte ready in Receive Buffer */ |
#define | ULSR_RCV_MASK 0x1f /* Mask for incoming data or error */ |
#define | UCOM_FLAG_RTS_IFLOW 0x01 /* use RTS input flow control */ |
#define | UCOM_FLAG_GONE 0x02 /* the device is gone */ |
#define | UCOM_FLAG_ATTACHED 0x04 /* set if attached */ |
#define | UCOM_FLAG_GP_DATA 0x08 /* set if get and put data is possible */ |
#define | UCOM_FLAG_LL_READY 0x20 /* set if low layer is ready */ |
#define | UCOM_FLAG_HL_READY 0x40 /* set if high layer is ready */ |
#define | UCOM_FLAG_CONSOLE 0x80 /* set if device is a console */ |
#define | UCOM_FLAG_WAIT_REFS 0x0100 /* set if we must wait for refs */ |
#define | UCOM_FLAG_FREE_UNIT 0x0200 /* set if we must free the unit */ |
#define | UCOM_FLAG_INWAKEUP 0x0400 /* set if we are in the tsw_inwakeup callback */ |
#define | UCOM_FLAG_LSRTXIDLE 0x0800 /* set if sc_lsr bits ULSR_TSRE+TXRDY work */ |
#define | UCOM_FLAG_DEVICE_MODE 0x1000 /* set if we're an USB device, not a host */ |
#define | UCOM_LS_DTR 0x01 |
#define | UCOM_LS_RTS 0x02 |
#define | UCOM_LS_BREAK 0x04 |
#define | UCOM_LS_RING 0x08 |
#define | UCOM_MTX_ASSERT(sc, what) USB_MTX_ASSERT((sc)->sc_mtx, what) |
#define | UCOM_MTX_LOCK(sc) USB_MTX_LOCK((sc)->sc_mtx) |
#define | UCOM_MTX_UNLOCK(sc) USB_MTX_UNLOCK((sc)->sc_mtx) |
#define | UCOM_UNLOAD_DRAIN(x) SYSUNINIT(var, SI_SUB_KLD - 2, SI_ORDER_ANY, ucom_drain_all, 0) |
#define | ucom_cfg_do_request(udev, com, req, ptr, flags, timo) usbd_do_request_proc(udev,&(com)->sc_super->sc_tq,req,ptr,flags,NULL,timo) |
Functions | |
int | ucom_attach (struct ucom_super_softc *, struct ucom_softc *, int, void *, const struct ucom_callback *callback, struct mtx *) |
void | ucom_detach (struct ucom_super_softc *, struct ucom_softc *) |
void | ucom_set_pnpinfo_usb (struct ucom_super_softc *, device_t) |
void | ucom_set_usb_mode (struct ucom_super_softc *, enum usb_hc_mode) |
void | ucom_status_change (struct ucom_softc *) |
uint8_t | ucom_get_data (struct ucom_softc *, struct usb_page_cache *, uint32_t, uint32_t, uint32_t *) |
void | ucom_put_data (struct ucom_softc *, struct usb_page_cache *, uint32_t, uint32_t) |
uint8_t | ucom_cfg_is_gone (struct ucom_softc *) |
void | ucom_drain (struct ucom_super_softc *) |
void | ucom_drain_all (void *) |
void | ucom_ref (struct ucom_super_softc *) |
int | ucom_unref (struct ucom_super_softc *) |
static void | ucom_use_lsr_txbits (struct ucom_softc *sc) |
#define ucom_cfg_do_request | ( | udev, | |
com, | |||
req, | |||
ptr, | |||
flags, | |||
timo | |||
) | usbd_do_request_proc(udev,&(com)->sc_super->sc_tq,req,ptr,flags,NULL,timo) |
Definition at line 208 of file usb_serial.h.
#define UCOM_FLAG_ATTACHED 0x04 /* set if attached */ |
Definition at line 178 of file usb_serial.h.
#define UCOM_FLAG_CONSOLE 0x80 /* set if device is a console */ |
Definition at line 182 of file usb_serial.h.
#define UCOM_FLAG_DEVICE_MODE 0x1000 /* set if we're an USB device, not a host */ |
Definition at line 187 of file usb_serial.h.
#define UCOM_FLAG_FREE_UNIT 0x0200 /* set if we must free the unit */ |
Definition at line 184 of file usb_serial.h.
#define UCOM_FLAG_GONE 0x02 /* the device is gone */ |
Definition at line 177 of file usb_serial.h.
#define UCOM_FLAG_GP_DATA 0x08 /* set if get and put data is possible */ |
Definition at line 179 of file usb_serial.h.
#define UCOM_FLAG_HL_READY 0x40 /* set if high layer is ready */ |
Definition at line 181 of file usb_serial.h.
#define UCOM_FLAG_INWAKEUP 0x0400 /* set if we are in the tsw_inwakeup callback */ |
Definition at line 185 of file usb_serial.h.
#define UCOM_FLAG_LL_READY 0x20 /* set if low layer is ready */ |
Definition at line 180 of file usb_serial.h.
#define UCOM_FLAG_LSRTXIDLE 0x0800 /* set if sc_lsr bits ULSR_TSRE+TXRDY work */ |
Definition at line 186 of file usb_serial.h.
#define UCOM_FLAG_RTS_IFLOW 0x01 /* use RTS input flow control */ |
Definition at line 176 of file usb_serial.h.
#define UCOM_FLAG_WAIT_REFS 0x0100 /* set if we must wait for refs */ |
Definition at line 183 of file usb_serial.h.
#define UCOM_JITTERBUF_SIZE 128 /* bytes */ |
Definition at line 77 of file usb_serial.h.
#define UCOM_LS_BREAK 0x04 |
Definition at line 197 of file usb_serial.h.
#define UCOM_LS_DTR 0x01 |
Definition at line 195 of file usb_serial.h.
#define UCOM_LS_RING 0x08 |
Definition at line 198 of file usb_serial.h.
#define UCOM_LS_RTS 0x02 |
Definition at line 196 of file usb_serial.h.
#define UCOM_MAXVER 1 |
Definition at line 76 of file usb_serial.h.
#define UCOM_MINVER 1 |
Definition at line 74 of file usb_serial.h.
#define UCOM_MODVER 1 |
Definition at line 72 of file usb_serial.h.
#define UCOM_MTX_ASSERT | ( | sc, | |
what | |||
) | USB_MTX_ASSERT((sc)->sc_mtx, what) |
Definition at line 202 of file usb_serial.h.
#define UCOM_MTX_LOCK | ( | sc | ) | USB_MTX_LOCK((sc)->sc_mtx) |
Definition at line 203 of file usb_serial.h.
#define UCOM_MTX_UNLOCK | ( | sc | ) | USB_MTX_UNLOCK((sc)->sc_mtx) |
Definition at line 204 of file usb_serial.h.
#define UCOM_PREFVER UCOM_MODVER |
Definition at line 75 of file usb_serial.h.
#define UCOM_UNLOAD_DRAIN | ( | x | ) | SYSUNINIT(var, SI_SUB_KLD - 2, SI_ORDER_ANY, ucom_drain_all, 0) |
Definition at line 205 of file usb_serial.h.
#define ULSR_BI 0x10 /* Break detected */ |
Definition at line 114 of file usb_serial.h.
#define ULSR_FE 0x08 /* Framing error: bad stop bit */ |
Definition at line 115 of file usb_serial.h.
#define ULSR_OE 0x02 /* Overrun, lost incoming byte */ |
Definition at line 117 of file usb_serial.h.
#define ULSR_PE 0x04 /* Parity error */ |
Definition at line 116 of file usb_serial.h.
#define ULSR_RCV_FIFO 0x80 |
Definition at line 111 of file usb_serial.h.
Definition at line 119 of file usb_serial.h.
#define ULSR_RXRDY 0x01 /* Byte ready in Receive Buffer */ |
Definition at line 118 of file usb_serial.h.
#define ULSR_TSRE 0x40 /* Transmitter empty: byte sent */ |
Definition at line 112 of file usb_serial.h.
#define ULSR_TXRDY 0x20 /* Transmitter buffer empty */ |
Definition at line 113 of file usb_serial.h.
int ucom_attach | ( | struct ucom_super_softc * | ssc, |
struct ucom_softc * | sc, | ||
int | subunits, | ||
void * | parent, | ||
const struct ucom_callback * | callback, | ||
struct mtx * | mtx | ||
) |
Definition at line 267 of file usb_serial.c.
References DPRINTF, error, ucom_softc::sc_callback, ucom_super_softc::sc_flag, ucom_softc::sc_flag, ucom_softc::sc_mtx, ucom_softc::sc_parent, ucom_softc::sc_subunit, ucom_super_softc::sc_subunits, ucom_softc::sc_super, ucom_super_softc::sc_tq, ucom_softc::sc_tty, ucom_super_softc::sc_ttyname, ucom_super_softc::sc_unit, ucom_attach_tty(), ucom_detach(), UCOM_FLAG_ATTACHED, UCOM_FLAG_DEVICE_MODE, UCOM_FLAG_FREE_UNIT, UCOM_FLAG_WAIT_REFS, ucom_callback::ucom_free, ucom_ref(), UCOM_TTY_PREFIX, ucom_unit_alloc(), ucom_unit_free(), USB_PRI_MED, and usb_proc_create().
Referenced by u3g_attach(), uark_attach(), ubsa_attach(), ubser_attach(), uchcom_attach(), ucycom_attach(), ufoma_attach(), uftdi_attach(), ugensa_attach(), uhso_probe_iface(), uipaq_attach(), umcs7840_attach(), umct_attach(), umodem_attach(), umoscom_attach(), uplcom_attach(), usie_attach(), uslcom_attach(), uvisor_attach(), and uvscom_attach().
uint8_t ucom_cfg_is_gone | ( | struct ucom_softc * | sc | ) |
Definition at line 667 of file usb_serial.c.
References ucom_softc::sc_super, ucom_super_softc::sc_tq, and usb_proc_is_gone().
void ucom_detach | ( | struct ucom_super_softc * | ssc, |
struct ucom_softc * | sc | ||
) |
Definition at line 336 of file usb_serial.c.
References ucom_super_softc::sc_flag, ucom_softc::sc_flag, ucom_super_softc::sc_subunits, ucom_super_softc::sc_sysctl_ttyname, ucom_super_softc::sc_sysctl_ttyports, ucom_super_softc::sc_tq, ucom_detach_tty(), ucom_drain(), UCOM_FLAG_ATTACHED, UCOM_FLAG_WAIT_REFS, ucom_unref(), usb_proc_drain(), and usb_proc_free().
Referenced by u3g_detach(), uark_detach(), ubsa_detach(), ubser_detach(), uchcom_detach(), ucom_attach(), ucycom_detach(), ufoma_detach(), uftdi_detach(), ugensa_detach(), uhso_detach(), uipaq_detach(), umcs7840_detach(), umct_detach(), umodem_detach(), umoscom_detach(), uplcom_detach(), usie_detach(), uslcom_detach(), uvisor_detach(), and uvscom_detach().
void ucom_drain | ( | struct ucom_super_softc * | ssc | ) |
Definition at line 375 of file usb_serial.c.
References ucom_super_softc::sc_refs, ucom_mtx, and usb_pause_mtx().
Referenced by ucom_detach().
void ucom_drain_all | ( | void * | arg | ) |
Definition at line 386 of file usb_serial.c.
References ucom_close_refs, ucom_mtx, and usb_pause_mtx().
uint8_t ucom_get_data | ( | struct ucom_softc * | sc, |
struct usb_page_cache * | pc, | ||
uint32_t | offset, | ||
uint32_t | len, | ||
uint32_t * | actlen | ||
) |
Definition at line 1384 of file usb_serial.c.
References usb_page_search::buffer, DPRINTF, len, usb_page_search::length, offset, ucom_softc::sc_flag, ucom_softc::sc_tty, UCOM_CONS_BUFSIZE, ucom_cons_tx_buf, ucom_cons_tx_high, ucom_cons_tx_low, UCOM_FLAG_CONSOLE, UCOM_FLAG_GP_DATA, UCOM_MTX_ASSERT, usbd_copy_in(), and usbd_get_page().
Referenced by u3g_write_callback(), uark_bulk_write_callback(), ubsa_write_callback(), ubser_write_callback(), uchcom_write_callback(), ucycom_ctrl_write_callback(), ufoma_bulk_write_callback(), ufoma_ctrl_write_callback(), uftdi_write_callback(), ugensa_bulk_write_callback(), uhso_bs_write_callback(), uhso_mux_write_callback(), uipaq_write_callback(), umcs7840_write_callbackN(), umct_write_callback(), umodem_write_callback(), umoscom_write_callback(), uplcom_write_callback(), usie_uc_tx_callback(), uslcom_write_callback(), uvisor_write_callback(), and uvscom_write_callback().
void ucom_put_data | ( | struct ucom_softc * | sc, |
struct usb_page_cache * | pc, | ||
uint32_t | offset, | ||
uint32_t | len | ||
) |
Definition at line 1462 of file usb_serial.c.
References usb_page_search::buffer, DPRINTF, len, usb_page_search::length, offset, ucom_softc::sc_flag, ucom_softc::sc_jitterbuf, ucom_softc::sc_jitterbuf_in, ucom_softc::sc_jitterbuf_out, ucom_softc::sc_tty, UCOM_CONS_BUFSIZE, ucom_cons_rx_buf, ucom_cons_rx_high, ucom_cons_rx_low, UCOM_FLAG_CONSOLE, UCOM_FLAG_RTS_IFLOW, UCOM_JITTERBUF_SIZE, UCOM_MTX_ASSERT, ucom_rts(), usbd_copy_out(), and usbd_get_page().
Referenced by u3g_read_callback(), uark_bulk_read_callback(), ubsa_read_callback(), ubser_read_callback(), uchcom_read_callback(), ucycom_intr_read_callback(), ufoma_bulk_read_callback(), ufoma_ctrl_read_callback(), uftdi_read_callback(), ugensa_bulk_read_callback(), uhso_bs_read_callback(), uhso_mux_read_callback(), uipaq_read_callback(), umcs7840_read_callbackN(), umct_read_callback_sub(), umodem_read_callback(), umoscom_read_callback(), uplcom_read_callback(), usie_uc_rx_callback(), uslcom_read_callback(), uvisor_read_callback(), and uvscom_read_callback().
void ucom_ref | ( | struct ucom_super_softc * | ssc | ) |
Definition at line 1695 of file usb_serial.c.
References ucom_super_softc::sc_refs, and ucom_mtx.
Referenced by u3g_attach(), uark_attach(), ubsa_attach(), ubser_attach(), uchcom_attach(), ucom_attach(), ucycom_attach(), ufoma_attach(), uftdi_attach(), ugensa_attach(), uhso_attach(), uipaq_attach(), umcs7840_attach(), umct_attach(), umodem_attach(), umoscom_attach(), uplcom_attach(), usie_attach(), uslcom_attach(), uvisor_attach(), and uvscom_attach().
void ucom_set_pnpinfo_usb | ( | struct ucom_super_softc * | ssc, |
device_t | dev | ||
) |
Definition at line 549 of file usb_serial.c.
References usbd_lookup_info::bIfaceIndex, dev, usb_attach_arg::device, usb_attach_arg::info, ucom_super_softc::sc_subunits, ucom_super_softc::sc_sysctl_ttyname, ucom_super_softc::sc_sysctl_ttyports, ucom_super_softc::sc_ttyname, ucom_super_softc::sc_unit, UCOM_TTY_PREFIX, and usbd_set_pnpinfo().
Referenced by u3g_attach(), uark_attach(), ubsa_attach(), ubser_attach(), uchcom_attach(), ucycom_attach(), ufoma_attach(), uftdi_attach(), ugensa_attach(), uhso_probe_iface(), uipaq_attach(), umcs7840_attach(), umct_attach(), umodem_attach(), umoscom_attach(), uplcom_attach(), uslcom_attach(), uvisor_attach(), and uvscom_attach().
void ucom_set_usb_mode | ( | struct ucom_super_softc * | ssc, |
enum | usb_hc_mode | ||
) |
Definition at line 584 of file usb_serial.c.
References ucom_super_softc::sc_flag, UCOM_FLAG_DEVICE_MODE, usb_attach_arg::usb_mode, and USB_MODE_DEVICE.
Referenced by umodem_attach().
void ucom_status_change | ( | struct ucom_softc * | sc | ) |
Definition at line 1229 of file usb_serial.c.
References DPRINTF, ucom_cfg_task::hdr, ucom_softc::sc_flag, ucom_softc::sc_status_task, ucom_cfg_status_change, UCOM_FLAG_CONSOLE, UCOM_FLAG_HL_READY, UCOM_MTX_ASSERT, and ucom_queue_command().
Referenced by u3g_intr_callback(), ubsa_intr_callback(), uchcom_intr_callback(), ucom_open(), ufoma_intr_callback(), uftdi_read_callback(), uhso_bs_intr_callback(), umcs7840_intr_callback(), umct_intr_callback_sub(), umodem_intr_read_callback(), umoscom_intr_callback(), uplcom_intr_callback(), uslcom_control_callback(), and uvscom_intr_callback().
int ucom_unref | ( | struct ucom_super_softc * | ssc | ) |
Definition at line 1730 of file usb_serial.c.
References ucom_super_softc::sc_refs, ucom_free_unit(), and ucom_mtx.
Referenced by u3g_free_softc(), uark_free_softc(), ubsa_free_softc(), ubser_free_softc(), uchcom_free_softc(), ucom_detach(), ucom_free(), ucycom_free_softc(), ufoma_free_softc(), uftdi_free_softc(), ugensa_free_softc(), uhso_free_softc(), uipaq_free_softc(), umcs7840_free_softc(), umct_free_softc(), umodem_free_softc(), umoscom_free_softc(), uplcom_free_softc(), usie_free_softc(), uslcom_free_softc(), uvisor_free_softc(), and uvscom_free_softc().
|
inlinestatic |
Definition at line 229 of file usb_serial.h.
References ucom_softc::sc_flag, and UCOM_FLAG_LSRTXIDLE.
Referenced by uftdi_attach().