FreeBSD kernel usb device Code
uipaq.c File Reference
#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 <dev/usb/usb_cdc.h>
#include "usbdevs.h"
#include <dev/usb/usb_debug.h>
#include <dev/usb/usb_process.h>
#include <dev/usb/serial/usb_serial.h>
Include dependency graph for uipaq.c:

Go to the source code of this file.

Data Structures

struct  uipaq_softc
 

Macros

#define USB_DEBUG_VAR   usb_debug
 
#define UIPAQ_CONFIG_INDEX   0 /* config number 1 */
 
#define UIPAQ_IFACE_INDEX   0
 
#define UIPAQ_BUF_SIZE   1024
 

Enumerations

enum  { UIPAQ_BULK_DT_WR , UIPAQ_BULK_DT_RD , UIPAQ_N_TRANSFER }
 

Functions

 __FBSDID ("$FreeBSD$")
 
static void uipaq_free_softc (struct uipaq_softc *)
 
static void uipaq_free (struct ucom_softc *)
 
static void uipaq_start_read (struct ucom_softc *)
 
static void uipaq_stop_read (struct ucom_softc *)
 
static void uipaq_start_write (struct ucom_softc *)
 
static void uipaq_stop_write (struct ucom_softc *)
 
static void uipaq_cfg_set_dtr (struct ucom_softc *, uint8_t)
 
static void uipaq_cfg_set_rts (struct ucom_softc *, uint8_t)
 
static void uipaq_cfg_set_break (struct ucom_softc *, uint8_t)
 
static void uipaq_poll (struct ucom_softc *ucom)
 
 DRIVER_MODULE (uipaq, uhub, uipaq_driver, uipaq_devclass, NULL, 0)
 
 MODULE_DEPEND (uipaq, ucom, 1, 1, 1)
 
 MODULE_DEPEND (uipaq, usb, 1, 1, 1)
 
 MODULE_VERSION (uipaq, 1)
 
 USB_PNP_HOST_INFO (uipaq_devs)
 
static int uipaq_probe (device_t dev)
 
static int uipaq_attach (device_t dev)
 
int uipaq_detach (device_t dev)
 
 UCOM_UNLOAD_DRAIN (uipaq)
 
static void uipaq_write_callback (struct usb_xfer *xfer, usb_error_t error)
 
static void uipaq_read_callback (struct usb_xfer *xfer, usb_error_t error)
 

Variables

static device_probe_t uipaq_probe
 
static device_attach_t uipaq_attach
 
static device_detach_t uipaq_detach
 
static usb_callback_t uipaq_write_callback
 
static usb_callback_t uipaq_read_callback
 
static const struct usb_config uipaq_config_data [UIPAQ_N_TRANSFER]
 
static const struct ucom_callback uipaq_callback
 
static const STRUCT_USB_HOST_ID uipaq_devs []
 
static device_method_t uipaq_methods []
 
static devclass_t uipaq_devclass
 
static driver_t uipaq_driver
 

Macro Definition Documentation

◆ UIPAQ_BUF_SIZE

#define UIPAQ_BUF_SIZE   1024

Definition at line 83 of file uipaq.c.

◆ UIPAQ_CONFIG_INDEX

#define UIPAQ_CONFIG_INDEX   0 /* config number 1 */

Definition at line 80 of file uipaq.c.

◆ UIPAQ_IFACE_INDEX

#define UIPAQ_IFACE_INDEX   0

Definition at line 81 of file uipaq.c.

◆ USB_DEBUG_VAR

#define USB_DEBUG_VAR   usb_debug

Definition at line 74 of file uipaq.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
UIPAQ_BULK_DT_WR 
UIPAQ_BULK_DT_RD 
UIPAQ_N_TRANSFER 

Definition at line 85 of file uipaq.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DRIVER_MODULE()

DRIVER_MODULE ( uipaq  ,
uhub  ,
uipaq_driver  ,
uipaq_devclass  ,
NULL  ,
 
)

◆ MODULE_DEPEND() [1/2]

MODULE_DEPEND ( uipaq  ,
ucom  ,
,
,
 
)

◆ MODULE_DEPEND() [2/2]

MODULE_DEPEND ( uipaq  ,
usb  ,
,
,
 
)

◆ MODULE_VERSION()

MODULE_VERSION ( uipaq  ,
 
)

◆ UCOM_UNLOAD_DRAIN()

UCOM_UNLOAD_DRAIN ( uipaq  )

◆ uipaq_attach()

◆ uipaq_cfg_set_break()

static void uipaq_cfg_set_break ( struct ucom_softc ucom,
uint8_t  onoff 
)
static

◆ uipaq_cfg_set_dtr()

static void uipaq_cfg_set_dtr ( struct ucom_softc ucom,
uint8_t  onoff 
)
static

◆ uipaq_cfg_set_rts()

static void uipaq_cfg_set_rts ( struct ucom_softc ucom,
uint8_t  onoff 
)
static

◆ uipaq_detach()

int uipaq_detach ( device_t  dev)

Definition at line 1179 of file uipaq.c.

References dev, uipaq_softc::sc_super_ucom, uipaq_softc::sc_ucom, uipaq_softc::sc_xfer, ucom_detach(), uipaq_free_softc(), UIPAQ_N_TRANSFER, and usbd_transfer_unsetup().

Here is the call graph for this function:

◆ uipaq_free()

static void uipaq_free ( struct ucom_softc ucom)
static

Definition at line 1205 of file uipaq.c.

References ucom_softc::sc_parent, and uipaq_free_softc().

Here is the call graph for this function:

◆ uipaq_free_softc()

static void uipaq_free_softc ( struct uipaq_softc sc)
static

Definition at line 1196 of file uipaq.c.

References uipaq_softc::sc_mtx, uipaq_softc::sc_super_ucom, and ucom_unref().

Referenced by uipaq_detach(), and uipaq_free().

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

◆ uipaq_poll()

static void uipaq_poll ( struct ucom_softc ucom)
static

Definition at line 1372 of file uipaq.c.

References ucom_softc::sc_parent, uipaq_softc::sc_xfer, UIPAQ_N_TRANSFER, and usbd_transfer_poll().

Here is the call graph for this function:

◆ uipaq_probe()

◆ uipaq_read_callback()

static void uipaq_read_callback ( struct usb_xfer xfer,
usb_error_t  error 
)
static

◆ uipaq_start_read()

static void uipaq_start_read ( struct ucom_softc ucom)
static

Definition at line 1211 of file uipaq.c.

References ucom_softc::sc_parent, uipaq_softc::sc_xfer, UIPAQ_BULK_DT_RD, and usbd_transfer_start().

Here is the call graph for this function:

◆ uipaq_start_write()

static void uipaq_start_write ( struct ucom_softc ucom)
static

Definition at line 1229 of file uipaq.c.

References ucom_softc::sc_parent, uipaq_softc::sc_xfer, UIPAQ_BULK_DT_WR, and usbd_transfer_start().

Here is the call graph for this function:

◆ uipaq_stop_read()

static void uipaq_stop_read ( struct ucom_softc ucom)
static

Definition at line 1220 of file uipaq.c.

References ucom_softc::sc_parent, uipaq_softc::sc_xfer, UIPAQ_BULK_DT_RD, and usbd_transfer_stop().

Here is the call graph for this function:

◆ uipaq_stop_write()

static void uipaq_stop_write ( struct ucom_softc ucom)
static

Definition at line 1237 of file uipaq.c.

References ucom_softc::sc_parent, uipaq_softc::sc_xfer, UIPAQ_BULK_DT_WR, and usbd_transfer_stop().

Here is the call graph for this function:

◆ uipaq_write_callback()

static void uipaq_write_callback ( struct usb_xfer xfer,
usb_error_t  error 
)
static

◆ USB_PNP_HOST_INFO()

USB_PNP_HOST_INFO ( uipaq_devs  )

Variable Documentation

◆ uipaq_attach

device_attach_t uipaq_attach
static

Definition at line 106 of file uipaq.c.

◆ uipaq_callback

const struct ucom_callback uipaq_callback
static
Initial value:
= {
.ucom_cfg_set_dtr = &uipaq_cfg_set_dtr,
.ucom_cfg_set_rts = &uipaq_cfg_set_rts,
.ucom_cfg_set_break = &uipaq_cfg_set_break,
.ucom_start_read = &uipaq_start_read,
.ucom_stop_read = &uipaq_stop_read,
.ucom_start_write = &uipaq_start_write,
.ucom_stop_write = &uipaq_stop_write,
.ucom_poll = &uipaq_poll,
.ucom_free = &uipaq_free,
}
static void uipaq_start_read(struct ucom_softc *)
Definition: uipaq.c:1211
static void uipaq_stop_write(struct ucom_softc *)
Definition: uipaq.c:1237
static void uipaq_free(struct ucom_softc *)
Definition: uipaq.c:1205
static void uipaq_poll(struct ucom_softc *ucom)
Definition: uipaq.c:1372
static void uipaq_cfg_set_break(struct ucom_softc *, uint8_t)
Definition: uipaq.c:1293
static void uipaq_stop_read(struct ucom_softc *)
Definition: uipaq.c:1220
static void uipaq_cfg_set_rts(struct ucom_softc *, uint8_t)
Definition: uipaq.c:1269
static void uipaq_start_write(struct ucom_softc *)
Definition: uipaq.c:1229
static void uipaq_cfg_set_dtr(struct ucom_softc *, uint8_t)
Definition: uipaq.c:1245

Definition at line 143 of file uipaq.c.

Referenced by uipaq_attach().

◆ uipaq_config_data

const struct usb_config uipaq_config_data[UIPAQ_N_TRANSFER]
static
Initial value:
= {
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_OUT,
.bufsize = UIPAQ_BUF_SIZE,
.flags = {.pipe_bof = 1,.force_short_xfer = 1,},
.callback = &uipaq_write_callback,
},
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
.bufsize = UIPAQ_BUF_SIZE,
.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
.callback = &uipaq_read_callback,
},
}
static usb_callback_t uipaq_write_callback
Definition: uipaq.c:110
#define UIPAQ_BUF_SIZE
Definition: uipaq.c:83
static usb_callback_t uipaq_read_callback
Definition: uipaq.c:111
@ UIPAQ_BULK_DT_RD
Definition: uipaq.c:87
@ UIPAQ_BULK_DT_WR
Definition: uipaq.c:86
#define UE_ADDR_ANY
Definition: usb.h:537
#define UE_BULK
Definition: usb.h:543
#define UE_DIR_IN
Definition: usb.h:531
#define UE_DIR_OUT
Definition: usb.h:532

Definition at line 123 of file uipaq.c.

Referenced by uipaq_attach().

◆ uipaq_detach

device_detach_t uipaq_detach
static

Definition at line 107 of file uipaq.c.

Referenced by uipaq_attach().

◆ uipaq_devclass

devclass_t uipaq_devclass
static

Definition at line 1080 of file uipaq.c.

◆ uipaq_devs

const STRUCT_USB_HOST_ID uipaq_devs[]
static

Definition at line 160 of file uipaq.c.

Referenced by uipaq_probe().

◆ uipaq_driver

driver_t uipaq_driver
static
Initial value:
= {
.name = "uipaq",
.methods = uipaq_methods,
.size = sizeof(struct uipaq_softc),
}
static device_method_t uipaq_methods[]
Definition: uipaq.c:1073

Definition at line 1082 of file uipaq.c.

◆ uipaq_methods

device_method_t uipaq_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, uipaq_probe),
DEVMETHOD(device_attach, uipaq_attach),
DEVMETHOD(device_detach, uipaq_detach),
DEVMETHOD_END
}
static device_attach_t uipaq_attach
Definition: uipaq.c:106
static device_detach_t uipaq_detach
Definition: uipaq.c:107
static device_probe_t uipaq_probe
Definition: uipaq.c:105

Definition at line 1073 of file uipaq.c.

◆ uipaq_probe

device_probe_t uipaq_probe
static

Definition at line 105 of file uipaq.c.

◆ uipaq_read_callback

usb_callback_t uipaq_read_callback
static

Definition at line 111 of file uipaq.c.

◆ uipaq_write_callback

usb_callback_t uipaq_write_callback
static

Definition at line 110 of file uipaq.c.