usb_if.m revision 188942
1184610Salfred#- 2184610Salfred# Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 3184610Salfred# 4184610Salfred# Redistribution and use in source and binary forms, with or without 5184610Salfred# modification, are permitted provided that the following conditions 6184610Salfred# are met: 7184610Salfred# 1. Redistributions of source code must retain the above copyright 8184610Salfred# notice, this list of conditions and the following disclaimer, 9184610Salfred# without modification, immediately at the beginning of the file. 10184610Salfred# 2. Redistributions in binary form must reproduce the above copyright 11184610Salfred# notice, this list of conditions and the following disclaimer in the 12184610Salfred# documentation and/or other materials provided with the distribution. 13184610Salfred# 3. The name of the author may not be used to endorse or promote products 14184610Salfred# derived from this software without specific prior written permission. 15184610Salfred# 16184610Salfred# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17184610Salfred# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18184610Salfred# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19184610Salfred# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20184610Salfred# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21184610Salfred# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22184610Salfred# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23184610Salfred# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24184610Salfred# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25184610Salfred# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26184610Salfred# 27184610Salfred# $FreeBSD: head/sys/dev/usb/usb_if.m 188942 2009-02-23 18:31:00Z thompsa $ 28184610Salfred# 29184610Salfred 30184610Salfred# USB interface description 31184610Salfred# 32184610Salfred 33184610Salfred#include <sys/bus.h> 34184610Salfred 35188942SthompsaINTERFACE usb; 36184610Salfred 37184610Salfred# The device received a control request 38184610Salfred# 39184610Salfred# Return values: 40184610Salfred# 0: Success 41184610Salfred# ENOTTY: Transaction stalled 42184610Salfred# Else: Use builtin request handler 43184610Salfred# 44184610SalfredMETHOD int handle_request { 45184610Salfred device_t dev; 46184610Salfred const void *req; /* pointer to the device request */ 47184610Salfred void **pptr; /* data pointer */ 48184610Salfred uint16_t *plen; /* maximum transfer length */ 49184610Salfred uint16_t offset; /* data offset */ 50184610Salfred uint8_t is_complete; /* set if transfer is complete */ 51184610Salfred}; 52184610Salfred 53