diff options
Diffstat (limited to 'sys/dev/usb/usbdi.h')
| -rw-r--r-- | sys/dev/usb/usbdi.h | 195 |
1 files changed, 64 insertions, 131 deletions
diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h index 19450dca540a..15780bec6698 100644 --- a/sys/dev/usb/usbdi.h +++ b/sys/dev/usb/usbdi.h @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.h,v 1.16 1999/01/08 11:58:26 augustss Exp $ */ +/* $NetBSD: usbdi.h,v 1.28 1999/09/11 08:19:27 augustss Exp $ */ /* $FreeBSD$ */ /* @@ -45,45 +45,17 @@ typedef struct usbd_pipe *usbd_pipe_handle; typedef struct usbd_request *usbd_request_handle; typedef void *usbd_private_handle; -typedef enum { - USBD_ENDPOINT_ACTIVE, - USBD_ENDPOINT_STALLED, -} usbd_endpoint_state; - -typedef enum { - USBD_PIPE_ACTIVE, - USBD_PIPE_STALLED, - USBD_PIPE_IDLE, -} usbd_pipe_state; - -typedef enum { - USBD_INTERFACE_ACTIVE, - USBD_INTERFACE_STALLED, - USBD_INTERFACE_IDLE, -} usbd_interface_state; - -typedef enum { - USBD_DEVICE_ATTACHED, - USBD_DEVICE_POWERED, - USBD_DEVICE_DEFAULT, - USBD_DEVICE_ADDRESSED, - USBD_DEVICE_CONFIGURED, - USBD_DEVICE_SUSPENDED, -} usbd_device_state; - -typedef enum { - USBD_NORMAL_COMPLETION = 0, +typedef enum { /* keep in sync with usbd_status_msgs */ + USBD_NORMAL_COMPLETION = 0, /* must be 0 */ USBD_IN_PROGRESS, /* errors */ USBD_PENDING_REQUESTS, USBD_NOT_STARTED, USBD_INVAL, - USBD_IS_IDLE, USBD_NOMEM, USBD_CANCELLED, USBD_BAD_ADDRESS, USBD_IN_USE, - USBD_INTERFACE_NOT_ACTIVE, USBD_NO_ADDR, USBD_SET_ADDR_FAILED, USBD_NO_POWER, @@ -95,8 +67,7 @@ typedef enum { USBD_STALLED, USBD_INTERRUPTED, - USBD_XXX, -#define USBD_ERROR_MAX 21 /* used for usbd_error_strs */ + USBD_ERROR_MAX, /* must be last */ } usbd_status; typedef int usbd_lock_token; @@ -107,19 +78,15 @@ typedef void (*usbd_callback) __P((usbd_request_handle, usbd_private_handle, /* Open flags */ #define USBD_EXCLUSIVE_USE 0x01 -/* XXX broken, should not use the same value */ /* Request flags */ -#define USBD_XFER_OUT 0x01 -#define USBD_XFER_IN 0x02 -#define USBD_SHORT_XFER_OK 0x04 +/* in usb.h #define USBD_SHORT_XFER_OK 0x04*/ /* allow short reads */ +#define USBD_SYNCHRONOUS 0x08 /* wait for completion */ #define USBD_NO_TIMEOUT 0 #define USBD_DEFAULT_TIMEOUT 5000 /* ms = 5 s */ #if defined(__FreeBSD__) #define USB_CDEV_MAJOR 108 - -extern struct cdevsw usb_cdevsw; #endif usbd_status usbd_open_pipe @@ -127,109 +94,54 @@ usbd_status usbd_open_pipe 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((void)); +usbd_request_handle usbd_alloc_request __P((usbd_device_handle)); usbd_status usbd_free_request __P((usbd_request_handle reqh)); -usbd_status usbd_setup_request +void usbd_setup_request __P((usbd_request_handle reqh, usbd_pipe_handle pipe, usbd_private_handle priv, void *buffer, u_int32_t length, u_int16_t flags, u_int32_t timeout, usbd_callback)); -usbd_status usbd_setup_device_request - __P((usbd_request_handle reqh, usb_device_request_t *req)); -usbd_status usbd_setup_default_request +void usbd_setup_default_request __P((usbd_request_handle reqh, 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)); -usbd_status usbd_set_request_timeout - __P((usbd_request_handle reqh, u_int32_t timeout)); -usbd_status usbd_get_request_status +void usbd_setup_isoc_request + __P((usbd_request_handle reqh, usbd_pipe_handle pipe, + usbd_private_handle priv, u_int16_t *frlengths, + u_int32_t nframes, usbd_callback)); +void usbd_get_request_status __P((usbd_request_handle reqh, usbd_private_handle *priv, void **buffer, u_int32_t *count, usbd_status *status)); -usbd_status usbd_request_device_data - __P((usbd_request_handle reqh, usb_device_request_t *req)); -usb_descriptor_t *usbd_get_descriptor - __P((usbd_interface_handle *iface, u_int8_t desc_type)); usb_endpoint_descriptor_t *usbd_interface2endpoint_descriptor __P((usbd_interface_handle iface, u_int8_t address)); -usbd_status usbd_set_configuration - __P((usbd_device_handle dev, u_int8_t conf)); -usbd_status usbd_retry_request - __P((usbd_request_handle reqh, u_int32_t retry_count)); usbd_status usbd_abort_pipe __P((usbd_pipe_handle pipe)); -usbd_status usbd_abort_interface __P((usbd_interface_handle iface)); -usbd_status usbd_reset_pipe __P((usbd_pipe_handle pipe)); -usbd_status usbd_reset_interface __P((usbd_interface_handle iface)); usbd_status usbd_clear_endpoint_stall __P((usbd_pipe_handle pipe)); usbd_status usbd_clear_endpoint_stall_async __P((usbd_pipe_handle pipe)); -usbd_status usbd_set_pipe_state - __P((usbd_pipe_handle pipe, usbd_pipe_state state)); -usbd_status usbd_get_pipe_state - __P((usbd_pipe_handle pipe, usbd_pipe_state *state, - u_int32_t *endpoint_state, u_int32_t *request_count)); -usbd_status usbd_set_interface_state - __P((usbd_interface_handle iface, usbd_interface_state state)); -usbd_status usbd_get_interface_state - __P((usbd_interface_handle iface, usbd_interface_state *state)); -usbd_status usbd_get_device_state - __P((usbd_device_handle dev, usbd_device_state *state)); -usbd_status usbd_set_device_state - __P((usbd_device_handle dev, usbd_device_state state)); -usbd_status usbd_device_address - __P((usbd_device_handle dev, u_int8_t *address)); -usbd_status usbd_endpoint_address - __P((usbd_pipe_handle dev, u_int8_t *address)); usbd_status usbd_endpoint_count __P((usbd_interface_handle dev, u_int8_t *count)); usbd_status usbd_interface_count __P((usbd_device_handle dev, u_int8_t *count)); -#if 0 -u_int8_t usbd_bus_count __P((void)); -usbd_status usbd_get_bus_handle __P((u_int8_t index, usbd_bus_handle *bus)); -usbd_status usbd_get_root_hub - __P((usbd_bus_handle bus, usbd_device_handle *dev)); -usbd_status usbd_port_count __P((usbd_device_handle hub, u_int8_t *nports)); -usbd_status usbd_hub2device_handle - __P((usbd_device_handle hub, u_int8_t port, usbd_device_handle *dev)); -#endif -usbd_status usbd_request2pipe_handle - __P((usbd_request_handle reqh, usbd_pipe_handle *pipe)); -usbd_status usbd_pipe2interface_handle - __P((usbd_pipe_handle pipe, usbd_interface_handle *iface)); usbd_status usbd_interface2device_handle __P((usbd_interface_handle iface, usbd_device_handle *dev)); -usbd_status usbd_device2bus_handle - __P((usbd_device_handle dev, usbd_bus_handle *bus)); usbd_status usbd_device2interface_handle - __P((usbd_device_handle dev, u_int8_t ifaceno, - usbd_interface_handle *iface)); -usbd_status usbd_set_interface_private_handle - __P((usbd_interface_handle iface, usbd_private_handle priv)); -usbd_status usbd_get_interface_private_handle - __P((usbd_interface_handle iface, usbd_private_handle *priv)); -usbd_status usbd_reference_pipe __P((usbd_pipe_handle pipe)); -usbd_status usbd_dereference_pipe __P((usbd_pipe_handle pipe)); -usbd_lock_token usbd_lock __P((void)); -void usbd_unlock __P((usbd_lock_token tok)); + __P((usbd_device_handle dev, u_int8_t ifaceno, usbd_interface_handle *iface)); -/* Non-standard */ +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)); usbd_status usbd_sync_transfer __P((usbd_request_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)); -usbd_status usbd_open_pipe_iso - __P((usbd_interface_handle iface, u_int8_t address, - u_int8_t flags, usbd_pipe_handle *pipe, - usbd_private_handle priv, u_int32_t bufsize, u_int32_t nbuf, - usbd_callback)); usbd_status usbd_do_request - __P((usbd_device_handle dev, usb_device_request_t *req, void *data)); + __P((usbd_device_handle pipe, usb_device_request_t *req, void *data)); usbd_status usbd_do_request_async - __P((usbd_device_handle dev, usb_device_request_t *req, void *data)); + __P((usbd_device_handle pipe, usb_device_request_t *req, void *data)); usbd_status usbd_do_request_flags - __P((usbd_device_handle dev, usb_device_request_t *req, + __P((usbd_device_handle pipe, usb_device_request_t *req, void *data, u_int16_t flags, int *)); usb_interface_descriptor_t *usbd_get_interface_descriptor __P((usbd_interface_handle iface)); @@ -251,9 +163,6 @@ usb_endpoint_descriptor_t *usbd_find_edesc __P((usb_config_descriptor_t *cd, int ifaceidx, int altidx, int endptidx)); -char * usbd_errstr(usbd_status err); - - void usbd_dopoll __P((usbd_interface_handle)); void usbd_set_polling __P((usbd_interface_handle iface, int on)); @@ -264,6 +173,9 @@ struct usb_attach_arg { int port; int configno; int ifaceno; + int vendor; + int product; + int release; usbd_device_handle device; /* current device */ usbd_interface_handle iface; /* current interface */ int usegeneric; @@ -271,7 +183,7 @@ struct usb_attach_arg { int nifaces; /* number of interfaces */ }; -#if defined(__NetBSD__) +#if defined(__NetBSD__) || defined(__OpenBSD__) /* Match codes. */ /* First five codes is for a whole device. */ #define UMATCH_VENDOR_PRODUCT_REV 14 @@ -295,33 +207,54 @@ struct usb_attach_arg { #elif defined(__FreeBSD__) /* FreeBSD needs values less than zero */ -#define UMATCH_VENDOR_PRODUCT_REV (-10) -#define UMATCH_VENDOR_PRODUCT (-20) -#define UMATCH_VENDOR_DEVCLASS_DEVPROTO (-30) -#define UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO (-40) -#define UMATCH_DEVCLASS_DEVSUBCLASS (-50) -#define UMATCH_VENDOR_PRODUCT_REV_CONF_IFACE (-60) -#define UMATCH_VENDOR_PRODUCT_CONF_IFACE (-70) -#define UMATCH_VENDOR_IFACESUBCLASS_IFACEPROTO (-80) -#define UMATCH_VENDOR_IFACESUBCLASS (-90) -#define UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO (-100) -#define UMATCH_IFACECLASS_IFACESUBCLASS (-110) -#define UMATCH_IFACECLASS (-120) -#define UMATCH_IFACECLASS_GENERIC (-130) -#define UMATCH_GENERIC (-140) -#define UMATCH_NONE (ENXIO) -#endif +/* for the moment disabled +#define UMATCH_VENDOR_PRODUCT_REV -14 +#define UMATCH_VENDOR_PRODUCT -13 +#define UMATCH_VENDOR_DEVCLASS_DEVPROTO -12 +#define UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO -11 +#define UMATCH_DEVCLASS_DEVSUBCLASS -10 +#define UMATCH_VENDOR_PRODUCT_REV_CONF_IFACE -9 +#define UMATCH_VENDOR_PRODUCT_CONF_IFACE -8 +#define UMATCH_VENDOR_IFACESUBCLASS_IFACEPROTO -7 +#define UMATCH_VENDOR_IFACESUBCLASS -6 +#define UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO -5 +#define UMATCH_IFACECLASS_IFACESUBCLASS -4 +#define UMATCH_IFACECLASS -3 +#define UMATCH_IFACECLASS_GENERIC -2 +#define UMATCH_GENERIC -1 +#define UMATCH_NONE ENXIO +* For the moment we use Yes/No answers with appropriate +* sorting in the config file +*/ +#define UMATCH_VENDOR_PRODUCT_REV 0 +#define UMATCH_VENDOR_PRODUCT 0 +#define UMATCH_VENDOR_DEVCLASS_DEVPROTO 0 +#define UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO 0 +#define UMATCH_DEVCLASS_DEVSUBCLASS 0 +#define UMATCH_VENDOR_PRODUCT_REV_CONF_IFACE 0 +#define UMATCH_VENDOR_PRODUCT_CONF_IFACE 0 +#define UMATCH_VENDOR_IFACESUBCLASS_IFACEPROTO 0 +#define UMATCH_VENDOR_IFACESUBCLASS 0 +#define UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO 0 +#define UMATCH_IFACECLASS_IFACESUBCLASS 0 +#define UMATCH_IFACECLASS 0 +#define UMATCH_IFACECLASS_GENERIC 0 +#define UMATCH_GENERIC 0 +#define UMATCH_NONE ENXIO + + +#endif void usbd_devinfo __P((usbd_device_handle, int, char *)); struct usbd_quirks *usbd_get_quirks __P((usbd_device_handle)); -void usbd_set_disco __P((usbd_pipe_handle, void (*)(void *), void *)); usb_endpoint_descriptor_t *usbd_get_endpoint_descriptor __P((usbd_interface_handle iface, u_int8_t address)); +const char *usbd_errstr __P((usbd_status)); + #if defined(__FreeBSD__) int usbd_driver_load __P((module_t mod, int what, void *arg)); -bus_print_child_t usbd_print_child; #endif /* XXX */ |
