48#include <sys/stdint.h>
49#include <sys/stddef.h>
54#include <sys/kernel.h>
56#include <sys/module.h>
59#include <sys/condvar.h>
60#include <sys/sysctl.h>
62#include <sys/unistd.h>
63#include <sys/callout.h>
64#include <sys/malloc.h>
76#define USB_DEBUG_VAR urio_debug
82static int urio_debug = 0;
84static SYSCTL_NODE(_hw_usb, OID_AUTO, urio, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
87 &urio_debug, 0,
"urio debug level");
96#define URIO_BSIZE (1<<12)
97#define URIO_IFQ_MAXLEN 2
107#define URIO_FLAG_READ_STALL 0x01
108#define URIO_FLAG_WRITE_STALL 0x02
140 .basename[0] =
"urio",
149 .flags = {.pipe_bof = 1,.force_short_xfer = 1,.proxy_buffer = 1,},
158 .flags = {.pipe_bof = 1,.short_xfer_ok = 1,.proxy_buffer = 1,},
202 {
USB_VPI(USB_VENDOR_DIAMOND2, USB_PRODUCT_DIAMOND2_RIO600USB, 0)},
203 {
USB_VPI(USB_VENDOR_DIAMOND2, USB_PRODUCT_DIAMOND2_RIO800USB, 0)},
237 mtx_init(&sc->
sc_mtx,
"urio lock", NULL, MTX_DEF | MTX_RECURSE);
240 "%s", device_get_nameunit(
dev));
254 UID_ROOT, GID_OPERATOR, 0644);
306 sc->
sc_flags &= ~URIO_FLAG_WRITE_STALL;
355 sc->
sc_flags &= ~URIO_FLAG_READ_STALL;
399 if (fflags & FREAD) {
411 if (fflags & FWRITE) {
427 if (fflags & (FREAD | FWRITE)) {
442 if (!(fflags & FWRITE)) {
446 memset(&ur, 0,
sizeof(ur));
453 if (!(fflags & FWRITE)) {
457 memset(&ur, 0,
sizeof(ur));
468 DPRINTFN(2,
"Sending command\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+")
#define USB_PRODUCT_DIAMOND_RIO500USB
#define USB_VENDOR_DIAMOND
struct usb_fifo_sc sc_fifo
struct usb_xfer * sc_xfer[URIO_T_MAX]
struct usb_device * sc_udev
enum usb_hc_mode usb_mode
struct usbd_lookup_info info
struct usb_device * device
struct usb_device_request ucr_request
usb_fifo_close_t * f_close
#define URIO_FLAG_WRITE_STALL
#define URIO_FLAG_READ_STALL
static usb_fifo_cmd_t urio_start_write
DRIVER_MODULE(urio, uhub, urio_driver, urio_devclass, NULL, 0)
static usb_fifo_open_t urio_open
static devclass_t urio_devclass
static device_probe_t urio_probe
static usb_fifo_cmd_t urio_stop_read
static usb_fifo_ioctl_t urio_ioctl
static usb_callback_t urio_write_clear_stall_callback
static driver_t urio_driver
static usb_callback_t urio_read_callback
static device_detach_t urio_detach
static const STRUCT_USB_HOST_ID urio_devs[]
static const struct usb_config urio_config[URIO_T_MAX]
static usb_fifo_cmd_t urio_stop_write
static device_attach_t urio_attach
USB_PNP_HOST_INFO(urio_devs)
static struct usb_fifo_methods urio_fifo_methods
MODULE_DEPEND(urio, usb, 1, 1, 1)
static usb_fifo_cmd_t urio_start_read
static usb_fifo_close_t urio_close
static device_method_t urio_methods[]
static usb_callback_t urio_read_clear_stall_callback
static usb_callback_t urio_write_callback
#define UT_WRITE_VENDOR_DEVICE
#define UT_READ_VENDOR_DEVICE
const char * usbd_errstr(usb_error_t err)
int ugen_do_request(struct usb_fifo *f, struct usb_ctl_request *ur)
int usbd_lookup_id_by_uaa(const struct usb_device_id *id, usb_size_t sizeof_id, struct usb_attach_arg *uaa)
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)
uint8_t usbd_clear_stall_callback(struct usb_xfer *xfer1, struct usb_xfer *xfer2)
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_xfer_softc(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)
int usb_fifo_alloc_buffer(struct usb_fifo *f, uint32_t bufsize, uint16_t nbuf)
int() usb_fifo_ioctl_t(struct usb_fifo *fifo, u_long cmd, void *addr, int fflags)
void * usb_fifo_softc(struct usb_fifo *fifo)
void() usb_fifo_close_t(struct usb_fifo *fifo, int fflags)
void usb_fifo_detach(struct usb_fifo_sc *f_sc)
void usb_fifo_put_data(struct usb_fifo *fifo, struct usb_page_cache *pc, usb_frlength_t offset, usb_frlength_t len, uint8_t what)
int usb_fifo_attach(struct usb_device *udev, void *priv_sc, struct mtx *priv_mtx, struct usb_fifo_methods *pm, struct usb_fifo_sc *f_sc, uint16_t unit, int16_t subunit, uint8_t iface_index, uid_t uid, gid_t gid, int mode)
void() usb_fifo_cmd_t(struct usb_fifo *fifo)
void usb_fifo_free_buffer(struct usb_fifo *f)
uint8_t usb_fifo_get_data(struct usb_fifo *fifo, struct usb_page_cache *pc, usb_frlength_t offset, usb_frlength_t len, usb_frlength_t *actlen, uint8_t what)
#define USB_ST_TRANSFERRED
void() usb_callback_t(struct usb_xfer *, usb_error_t)
int() usb_fifo_open_t(struct usb_fifo *fifo, int fflags)
#define USB_VPI(vend, prod, info)
#define STRUCT_USB_HOST_ID
#define USB_GET_STATE(xfer)
uint32_t usb_fifo_put_bytes_max(struct usb_fifo *fifo)