52#include <sys/stdint.h>
53#include <sys/stddef.h>
58#include <sys/kernel.h>
60#include <sys/module.h>
63#include <sys/condvar.h>
64#include <sys/sysctl.h>
66#include <sys/unistd.h>
67#include <sys/callout.h>
68#include <sys/malloc.h>
76#define USB_DEBUG_VAR uvisor_debug
83static int uvisor_debug = 0;
85static SYSCTL_NODE(_hw_usb, OID_AUTO, uvisor, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
88 &uvisor_debug, 0,
"Debug level");
91#define UVISOR_CONFIG_INDEX 0
92#define UVISOR_IFACE_INDEX 0
99#define UVISORIBUFSIZE 0
100#define UVISOROBUFSIZE 32
101#define UVISOROFRAMES 32
109#define UVISOR_REQUEST_BYTES_AVAILABLE 0x01
115#define UVISOR_CLOSE_NOTIFICATION 0x02
121#define UVISOR_GET_CONNECTION_INFORMATION 0x03
126#define UVISOR_MAX_CONN 8
135#define UVISOR_CONNECTION_INFO_SIZE 18
138#define UVISOR_ENDPOINT_1 0x01
139#define UVISOR_ENDPOINT_2 0x02
142#define UVISOR_FUNCTION_GENERIC 0x00
143#define UVISOR_FUNCTION_DEBUGGER 0x01
144#define UVISOR_FUNCTION_HOTSYNC 0x02
145#define UVISOR_FUNCTION_CONSOLE 0x03
146#define UVISOR_FUNCTION_REMOTE_FILE_SYS 0x04
151#define UVISOR_GET_PALM_INFORMATION 0x04
152#define UVISOR_GET_PALM_INFORMATION_LEN 0x44
181#define UVISOR_FLAG_PALM4 0x0001
182#define UVISOR_FLAG_VISOR 0x0002
183#define UVISOR_FLAG_PALM35 0x0004
184#define UVISOR_FLAG_SEND_NOTIFY 0x0008
217 .flags = {.pipe_bof = 1,.force_short_xfer = 1,},
226 .flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
257#define UVISOR_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) }
321 sizeof(uvisor_config_copy));
325 mtx_init(&sc->
sc_mtx,
"uvisor", NULL, MTX_DEF);
339 DPRINTF(
"init failed, error=%s\n",
347 DPRINTF(
"could not allocate all pipes\n");
354 DPRINTF(
"ucom_attach failed\n");
376 device_claim_softc(
dev);
390 device_free_softc(sc);
411 DPRINTF(
"getting connection info\n");
434 DPRINTF(
"Number of ports: %d\n", np);
436 for (i = 0; i < np; ++i) {
448 desc =
"Remote File System";
505 DPRINTF(
"getting config info\n");
517 DPRINTF(
"get the interface number\n");
531 DPRINTF(
"getting available bytes\n");
570 &
req, buffer, 0, 1000);
572 DPRINTFN(0,
"close notification 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+")
const struct nvlist * config
void(* ucom_cfg_open)(struct ucom_softc *)
enum usb_hc_mode usb_mode
struct usbd_lookup_info info
struct usb_device * device
struct uvisor_connection_info::@66 connections[UVISOR_MAX_CONN]
uByte endpoint_numbers_different
struct uvisor_palm_connection_info::@67 connections[UVISOR_MAX_CONN]
struct ucom_super_softc sc_super_ucom
struct usb_device * sc_udev
struct usb_xfer * sc_xfer[UVISOR_N_TRANSFER]
struct ucom_softc sc_ucom
#define UT_READ_VENDOR_ENDPOINT
struct usb_endpoint_descriptor desc
const char * usbd_errstr(usb_error_t err)
int usbd_lookup_id_by_uaa(const struct usb_device_id *id, usb_size_t sizeof_id, struct usb_attach_arg *uaa)
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_xfer_set_frames(struct usb_xfer *xfer, usb_frcount_t n)
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_xfer_set_frame_offset(struct usb_xfer *xfer, usb_frlength_t offset, usb_frcount_t frindex)
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_SHORT_XFER_OK
#define USB_ST_TRANSFERRED
void() usb_callback_t(struct usb_xfer *, usb_error_t)
#define STRUCT_USB_HOST_ID
#define USB_GET_DRIVER_INFO(did)
#define USB_GET_STATE(xfer)
#define usbd_do_request(u, m, r, d)
static void uvisor_cfg_open(struct ucom_softc *)
static const struct usb_config uvisor_config[UVISOR_N_TRANSFER]
#define UVISOR_FUNCTION_HOTSYNC
static const struct ucom_callback uvisor_callback
static void uvisor_stop_read(struct ucom_softc *)
static device_attach_t uvisor_attach
#define UVISOR_FLAG_VISOR
#define UVISOR_FUNCTION_DEBUGGER
static void uvisor_free_softc(struct uvisor_softc *)
static void uvisor_start_write(struct ucom_softc *)
DRIVER_MODULE(uvisor, uhub, uvisor_driver, uvisor_devclass, NULL, 0)
static void uvisor_stop_write(struct ucom_softc *)
#define UVISOR_REQUEST_BYTES_AVAILABLE
static device_detach_t uvisor_detach
MODULE_VERSION(uvisor, 1)
static device_probe_t uvisor_probe
UCOM_UNLOAD_DRAIN(uvisor)
#define UVISOR_GET_CONNECTION_INFORMATION
#define UVISOR_FLAG_PALM35
#define UVISOR_GET_PALM_INFORMATION
#define UVISOR_FUNCTION_GENERIC
#define UVISOR_FUNCTION_REMOTE_FILE_SYS
#define UVISOR_CLOSE_NOTIFICATION
static void uvisor_cfg_close(struct ucom_softc *)
static void uvisor_free(struct ucom_softc *)
#define UVISOR_CONNECTION_INFO_SIZE
#define UVISOR_FLAG_PALM4
static void uvisor_start_read(struct ucom_softc *)
#define UVISOR_IFACE_INDEX
static devclass_t uvisor_devclass
USB_PNP_HOST_INFO(uvisor_devs)
#define UVISOR_CONFIG_INDEX
MODULE_DEPEND(uvisor, ucom, 1, 1, 1)
static driver_t uvisor_driver
static usb_callback_t uvisor_read_callback
static const STRUCT_USB_HOST_ID uvisor_devs[]
#define UVISOR_DEV(v, p, i)
#define UVISOR_GET_PALM_INFORMATION_LEN
static usb_callback_t uvisor_write_callback
static device_method_t uvisor_methods[]
struct uvisor_connection_info __packed
static usb_error_t uvisor_init(struct uvisor_softc *, struct usb_device *, struct usb_config *)