diff options
Diffstat (limited to 'sys/dev/usb/usbdi.h')
-rw-r--r-- | sys/dev/usb/usbdi.h | 75 |
1 files changed, 46 insertions, 29 deletions
diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h index 7efe8acf65d..29f969c58cc 100644 --- a/sys/dev/usb/usbdi.h +++ b/sys/dev/usb/usbdi.h @@ -1,5 +1,5 @@ -/* $OpenBSD: usbdi.h,v 1.6 1999/11/07 21:30:20 fgsch Exp $ */ -/* $NetBSD: usbdi.h,v 1.31 1999/10/13 08:10:58 augustss Exp $ */ +/* $OpenBSD: usbdi.h,v 1.7 2000/03/26 08:39:46 aaron Exp $ */ +/* $NetBSD: usbdi.h,v 1.31 2000/03/02 12:37:51 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ typedef struct usbd_bus *usbd_bus_handle; typedef struct usbd_device *usbd_device_handle; typedef struct usbd_interface *usbd_interface_handle; typedef struct usbd_pipe *usbd_pipe_handle; -typedef struct usbd_request *usbd_request_handle; +typedef struct usbd_xfer *usbd_xfer_handle; typedef void *usbd_private_handle; typedef enum { /* keep in sync with usbd_status_msgs */ @@ -70,18 +70,23 @@ typedef enum { /* keep in sync with usbd_status_msgs */ USBD_ERROR_MAX, /* must be last */ } usbd_status; -typedef int usbd_lock_token; - -typedef void (*usbd_callback) __P((usbd_request_handle, usbd_private_handle, +typedef void (*usbd_callback) __P((usbd_xfer_handle, usbd_private_handle, usbd_status)); /* Open flags */ #define USBD_EXCLUSIVE_USE 0x01 +/* Use default (specified by ep. desc.) interval on interrupt pipe */ +#define USBD_DEFAULT_INTERVAL (-1) + /* Request flags */ #define USBD_NO_COPY 0x01 /* do not copy data to DMA buffer */ #define USBD_SYNCHRONOUS 0x02 /* wait for completion */ /* in usb.h #define USBD_SHORT_XFER_OK 0x04*/ /* allow short reads */ +#define USBD_FORCE_SHORT_XFER 0x08 /* force last short packet on write */ + +/* XXX Temporary hack XXX */ +#define USBD_NO_TSLEEP 0x80 /* XXX use busy wait */ #define USBD_NO_TIMEOUT 0 #define USBD_DEFAULT_TIMEOUT 5000 /* ms = 5 s */ @@ -94,25 +99,25 @@ usbd_status usbd_open_pipe __P((usbd_interface_handle iface, u_int8_t address, u_int8_t flags, usbd_pipe_handle *pipe)); usbd_status usbd_close_pipe __P((usbd_pipe_handle pipe)); -usbd_status usbd_transfer __P((usbd_request_handle req)); -usbd_request_handle usbd_alloc_request __P((usbd_device_handle)); -usbd_status usbd_free_request __P((usbd_request_handle reqh)); -void usbd_setup_request - __P((usbd_request_handle reqh, usbd_pipe_handle pipe, +usbd_status usbd_transfer __P((usbd_xfer_handle req)); +usbd_xfer_handle usbd_alloc_xfer __P((usbd_device_handle)); +usbd_status usbd_free_xfer __P((usbd_xfer_handle xfer)); +void usbd_setup_xfer + __P((usbd_xfer_handle xfer, usbd_pipe_handle pipe, usbd_private_handle priv, void *buffer, u_int32_t length, u_int16_t flags, u_int32_t timeout, usbd_callback)); -void usbd_setup_default_request - __P((usbd_request_handle reqh, usbd_device_handle dev, +void usbd_setup_default_xfer + __P((usbd_xfer_handle xfer, usbd_device_handle dev, usbd_private_handle priv, u_int32_t timeout, usb_device_request_t *req, void *buffer, u_int32_t length, u_int16_t flags, usbd_callback)); -void usbd_setup_isoc_request - __P((usbd_request_handle reqh, usbd_pipe_handle pipe, +void usbd_setup_isoc_xfer + __P((usbd_xfer_handle xfer, usbd_pipe_handle pipe, usbd_private_handle priv, u_int16_t *frlengths, u_int32_t nframes, u_int16_t flags, usbd_callback)); -void usbd_get_request_status - __P((usbd_request_handle reqh, usbd_private_handle *priv, +void usbd_get_xfer_status + __P((usbd_xfer_handle xfer, usbd_private_handle *priv, void **buffer, u_int32_t *count, usbd_status *status)); usb_endpoint_descriptor_t *usbd_interface2endpoint_descriptor __P((usbd_interface_handle iface, u_int8_t address)); @@ -129,15 +134,15 @@ usbd_status usbd_device2interface_handle __P((usbd_device_handle dev, u_int8_t ifaceno, usbd_interface_handle *iface)); usbd_device_handle usbd_pipe2device_handle __P((usbd_pipe_handle)); -void *usbd_alloc_buffer __P((usbd_request_handle req, u_int32_t size)); -void usbd_free_buffer __P((usbd_request_handle req)); -void *usbd_get_buffer __P((usbd_request_handle reqh)); -usbd_status usbd_sync_transfer __P((usbd_request_handle req)); +void *usbd_alloc_buffer __P((usbd_xfer_handle req, u_int32_t size)); +void usbd_free_buffer __P((usbd_xfer_handle req)); +void *usbd_get_buffer __P((usbd_xfer_handle xfer)); +usbd_status usbd_sync_transfer __P((usbd_xfer_handle req)); usbd_status usbd_open_pipe_intr __P((usbd_interface_handle iface, u_int8_t address, u_int8_t flags, usbd_pipe_handle *pipe, usbd_private_handle priv, void *buffer, - u_int32_t length, usbd_callback)); + u_int32_t length, usbd_callback, int)); usbd_status usbd_do_request __P((usbd_device_handle pipe, usb_device_request_t *req, void *data)); usbd_status usbd_do_request_async @@ -166,11 +171,21 @@ usb_endpoint_descriptor_t *usbd_find_edesc int endptidx)); void usbd_dopoll __P((usbd_interface_handle)); -void usbd_set_polling __P((usbd_interface_handle iface, int on)); +void usbd_set_polling __P((usbd_device_handle iface, int on)); const char *usbd_errstr __P((usbd_status err)); -void usbd_add_event __P((int, usbd_device_handle)); +void usbd_add_dev_event __P((int, usbd_device_handle)); +void usbd_add_drv_event __P((int, usbd_device_handle, device_ptr_t)); + +void usbd_devinfo __P((usbd_device_handle, int, char *)); +struct usbd_quirks *usbd_get_quirks __P((usbd_device_handle)); +usb_endpoint_descriptor_t *usbd_get_endpoint_descriptor + __P((usbd_interface_handle iface, u_int8_t address)); + +usbd_status usbd_reload_device_desc __P((usbd_device_handle)); + +int usbd_ratecheck __P((struct timeval *last)); /* NetBSD attachment information */ @@ -231,17 +246,19 @@ struct usb_attach_arg { #endif -void usbd_devinfo __P((usbd_device_handle, int, char *)); -struct usbd_quirks *usbd_get_quirks __P((usbd_device_handle)); -usb_endpoint_descriptor_t *usbd_get_endpoint_descriptor - __P((usbd_interface_handle iface, u_int8_t address)); - #if defined(__FreeBSD__) int usbd_driver_load __P((module_t mod, int what, void *arg)); #endif +/* + * XXX + * splusb MUST be the lowest level interrupt so that within USB callbacks + * the level can be raised the appropriate level. + * XXX Should probably use a softsplusb. + */ /* XXX */ #define splusb splbio +#define splhardusb splbio #define IPL_USB IPL_BIO /* XXX */ |