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$
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#
39195121Sthompsa# The value pointed to by "pstate" can be updated to
40195121Sthompsa# "USB_HR_COMPLETE_OK" to indicate that the control
41195121Sthompsa# read transfer is complete, in case of short USB
42195121Sthompsa# control transfers.
43195121Sthompsa#
44184610Salfred# Return values:
45184610Salfred# 0: Success
46184610Salfred# ENOTTY: Transaction stalled
47184610Salfred# Else: Use builtin request handler
48184610Salfred#
49184610SalfredMETHOD int handle_request {
50184610Salfred	device_t dev;
51184610Salfred	const void *req; /* pointer to the device request */
52184610Salfred	void **pptr; /* data pointer */
53184610Salfred	uint16_t *plen; /* maximum transfer length */
54184610Salfred	uint16_t offset; /* data offset */
55195121Sthompsa	uint8_t *pstate; /* set if transfer is complete, see USB_HR_XXX */
56184610Salfred};
57228483Shselasky
58228483Shselasky# Take controller from BIOS
59228483Shselasky#
60228483Shselasky# Return values:
61228483Shselasky# 0: Success
62228483Shselasky# Else: Failure
63228483Shselasky#
64228483ShselaskyMETHOD int take_controller {
65228483Shselasky	device_t dev;
66228483Shselasky};
67