FreeBSD kernel usb device Code
usb_serial.h File Reference
#include <sys/tty.h>
#include <sys/serial.h>
#include <sys/fcntl.h>
#include <sys/sysctl.h>
#include <sys/timepps.h>
Include dependency graph for usb_serial.h:
This graph shows which files directly or indirectly include this file:

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)
 

Macro Definition Documentation

◆ ucom_cfg_do_request

#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.

◆ UCOM_FLAG_ATTACHED

#define UCOM_FLAG_ATTACHED   0x04 /* set if attached */

Definition at line 178 of file usb_serial.h.

◆ UCOM_FLAG_CONSOLE

#define UCOM_FLAG_CONSOLE   0x80 /* set if device is a console */

Definition at line 182 of file usb_serial.h.

◆ UCOM_FLAG_DEVICE_MODE

#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.

◆ UCOM_FLAG_FREE_UNIT

#define UCOM_FLAG_FREE_UNIT   0x0200 /* set if we must free the unit */

Definition at line 184 of file usb_serial.h.

◆ UCOM_FLAG_GONE

#define UCOM_FLAG_GONE   0x02 /* the device is gone */

Definition at line 177 of file usb_serial.h.

◆ UCOM_FLAG_GP_DATA

#define UCOM_FLAG_GP_DATA   0x08 /* set if get and put data is possible */

Definition at line 179 of file usb_serial.h.

◆ UCOM_FLAG_HL_READY

#define UCOM_FLAG_HL_READY   0x40 /* set if high layer is ready */

Definition at line 181 of file usb_serial.h.

◆ UCOM_FLAG_INWAKEUP

#define UCOM_FLAG_INWAKEUP   0x0400 /* set if we are in the tsw_inwakeup callback */

Definition at line 185 of file usb_serial.h.

◆ UCOM_FLAG_LL_READY

#define UCOM_FLAG_LL_READY   0x20 /* set if low layer is ready */

Definition at line 180 of file usb_serial.h.

◆ UCOM_FLAG_LSRTXIDLE

#define UCOM_FLAG_LSRTXIDLE   0x0800 /* set if sc_lsr bits ULSR_TSRE+TXRDY work */

Definition at line 186 of file usb_serial.h.

◆ UCOM_FLAG_RTS_IFLOW

#define UCOM_FLAG_RTS_IFLOW   0x01 /* use RTS input flow control */

Definition at line 176 of file usb_serial.h.

◆ UCOM_FLAG_WAIT_REFS

#define UCOM_FLAG_WAIT_REFS   0x0100 /* set if we must wait for refs */

Definition at line 183 of file usb_serial.h.

◆ UCOM_JITTERBUF_SIZE

#define UCOM_JITTERBUF_SIZE   128 /* bytes */

Definition at line 77 of file usb_serial.h.

◆ UCOM_LS_BREAK

#define UCOM_LS_BREAK   0x04

Definition at line 197 of file usb_serial.h.

◆ UCOM_LS_DTR

#define UCOM_LS_DTR   0x01

Definition at line 195 of file usb_serial.h.

◆ UCOM_LS_RING

#define UCOM_LS_RING   0x08

Definition at line 198 of file usb_serial.h.

◆ UCOM_LS_RTS

#define UCOM_LS_RTS   0x02

Definition at line 196 of file usb_serial.h.

◆ UCOM_MAXVER

#define UCOM_MAXVER   1

Definition at line 76 of file usb_serial.h.

◆ UCOM_MINVER

#define UCOM_MINVER   1

Definition at line 74 of file usb_serial.h.

◆ UCOM_MODVER

#define UCOM_MODVER   1

Definition at line 72 of file usb_serial.h.

◆ UCOM_MTX_ASSERT

#define UCOM_MTX_ASSERT (   sc,
  what 
)    USB_MTX_ASSERT((sc)->sc_mtx, what)

Definition at line 202 of file usb_serial.h.

◆ UCOM_MTX_LOCK

#define UCOM_MTX_LOCK (   sc)    USB_MTX_LOCK((sc)->sc_mtx)

Definition at line 203 of file usb_serial.h.

◆ UCOM_MTX_UNLOCK

#define UCOM_MTX_UNLOCK (   sc)    USB_MTX_UNLOCK((sc)->sc_mtx)

Definition at line 204 of file usb_serial.h.

◆ UCOM_PREFVER

#define UCOM_PREFVER   UCOM_MODVER

Definition at line 75 of file usb_serial.h.

◆ UCOM_UNLOAD_DRAIN

#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.

◆ ULSR_BI

#define ULSR_BI   0x10 /* Break detected */

Definition at line 114 of file usb_serial.h.

◆ ULSR_FE

#define ULSR_FE   0x08 /* Framing error: bad stop bit */

Definition at line 115 of file usb_serial.h.

◆ ULSR_OE

#define ULSR_OE   0x02 /* Overrun, lost incoming byte */

Definition at line 117 of file usb_serial.h.

◆ ULSR_PE

#define ULSR_PE   0x04 /* Parity error */

Definition at line 116 of file usb_serial.h.

◆ ULSR_RCV_FIFO

#define ULSR_RCV_FIFO   0x80

Definition at line 111 of file usb_serial.h.

◆ ULSR_RCV_MASK

#define ULSR_RCV_MASK   0x1f /* Mask for incoming data or error */

Definition at line 119 of file usb_serial.h.

◆ ULSR_RXRDY

#define ULSR_RXRDY   0x01 /* Byte ready in Receive Buffer */

Definition at line 118 of file usb_serial.h.

◆ ULSR_TSRE

#define ULSR_TSRE   0x40 /* Transmitter empty: byte sent */

Definition at line 112 of file usb_serial.h.

◆ ULSR_TXRDY

#define ULSR_TXRDY   0x20 /* Transmitter buffer empty */

Definition at line 113 of file usb_serial.h.

Function Documentation

◆ ucom_attach()

◆ ucom_cfg_is_gone()

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().

Here is the call graph for this function:

◆ ucom_detach()

◆ ucom_drain()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ucom_drain_all()

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().

Here is the call graph for this function:

◆ ucom_get_data()

◆ ucom_put_data()

◆ ucom_ref()

◆ ucom_set_pnpinfo_usb()

◆ ucom_set_usb_mode()

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().

Here is the caller graph for this function:

◆ ucom_status_change()

◆ ucom_unref()

◆ ucom_use_lsr_txbits()

static void ucom_use_lsr_txbits ( struct ucom_softc sc)
inlinestatic

Definition at line 229 of file usb_serial.h.

References ucom_softc::sc_flag, and UCOM_FLAG_LSRTXIDLE.

Referenced by uftdi_attach().

Here is the caller graph for this function: