usb_freebsd.h revision 250204
1194677Sthompsa/* $FreeBSD: head/sys/dev/usb/usb_freebsd.h 250204 2013-05-03 09:23:06Z hselasky $ */ 2194677Sthompsa/*- 3194677Sthompsa * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 4194677Sthompsa * 5194677Sthompsa * Redistribution and use in source and binary forms, with or without 6194677Sthompsa * modification, are permitted provided that the following conditions 7194677Sthompsa * are met: 8194677Sthompsa * 1. Redistributions of source code must retain the above copyright 9194677Sthompsa * notice, this list of conditions and the following disclaimer. 10194677Sthompsa * 2. Redistributions in binary form must reproduce the above copyright 11194677Sthompsa * notice, this list of conditions and the following disclaimer in the 12194677Sthompsa * documentation and/or other materials provided with the distribution. 13194677Sthompsa * 14194677Sthompsa * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15194677Sthompsa * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16194677Sthompsa * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17194677Sthompsa * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18194677Sthompsa * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19194677Sthompsa * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20194677Sthompsa * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21194677Sthompsa * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22194677Sthompsa * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23194677Sthompsa * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24194677Sthompsa * SUCH DAMAGE. 25194677Sthompsa */ 26194677Sthompsa 27194677Sthompsa/* 28194677Sthompsa * Including this file is mandatory for all USB related c-files in the kernel. 29194677Sthompsa */ 30194677Sthompsa 31194677Sthompsa#ifndef _USB_FREEBSD_H_ 32194677Sthompsa#define _USB_FREEBSD_H_ 33194677Sthompsa 34194677Sthompsa/* Default USB configuration */ 35194677Sthompsa#define USB_HAVE_UGEN 1 36214221Shselasky#define USB_HAVE_DEVCTL 1 37194677Sthompsa#define USB_HAVE_BUSDMA 1 38194677Sthompsa#define USB_HAVE_COMPAT_LINUX 1 39194677Sthompsa#define USB_HAVE_USER_IO 1 40194677Sthompsa#define USB_HAVE_MBUF 1 41194677Sthompsa#define USB_HAVE_TT_SUPPORT 1 42194677Sthompsa#define USB_HAVE_POWERD 1 43194677Sthompsa#define USB_HAVE_MSCTEST 1 44217558Shselasky#define USB_HAVE_PF 1 45246122Shselasky#define USB_HAVE_ROOT_MOUNT_HOLD 1 46246194Shselasky#define USB_HAVE_ID_SECTION 1 47246363Shselasky#define USB_HAVE_PER_BUS_PROCESS 1 48250204Shselasky#define USB_HAVE_FIXED_ENDPOINT 0 49250204Shselasky#define USB_HAVE_FIXED_IFACE 0 50194677Sthompsa 51194677Sthompsa#define USB_TD_GET_PROC(td) (td)->td_proc 52194677Sthompsa#define USB_PROC_GET_GID(td) (td)->p_pgid 53194677Sthompsa 54217793Shselasky#if (!defined(USB_HOST_ALIGN)) || (USB_HOST_ALIGN <= 0) 55217793Shselasky/* Use default value. */ 56217718Shselasky#undef USB_HOST_ALIGN 57194677Sthompsa#define USB_HOST_ALIGN 8 /* bytes, must be power of two */ 58217718Shselasky#endif 59217793Shselasky/* Sanity check for USB_HOST_ALIGN: Verify power of two. */ 60217793Shselasky#if ((-USB_HOST_ALIGN) & USB_HOST_ALIGN) != USB_HOST_ALIGN 61217793Shselasky#error "USB_HOST_ALIGN is not power of two." 62217793Shselasky#endif 63194677Sthompsa#define USB_FS_ISOC_UFRAME_MAX 4 /* exclusive unit */ 64194677Sthompsa#define USB_BUS_MAX 256 /* units */ 65194677Sthompsa#define USB_MAX_DEVICES 128 /* units */ 66250204Shselasky#define USB_CONFIG_MAX 65535 /* bytes */ 67194677Sthompsa#define USB_IFACE_MAX 32 /* units */ 68194677Sthompsa#define USB_FIFO_MAX 128 /* units */ 69239214Shselasky#define USB_MAX_EP_STREAMS 8 /* units */ 70250204Shselasky#define USB_MAX_EP_UNITS 32 /* units */ 71194677Sthompsa 72194677Sthompsa#define USB_MAX_FS_ISOC_FRAMES_PER_XFER (120) /* units */ 73194677Sthompsa#define USB_MAX_HS_ISOC_FRAMES_PER_XFER (8*120) /* units */ 74194677Sthompsa 75194677Sthompsa#define USB_HUB_MAX_DEPTH 5 76194677Sthompsa#define USB_EP0_BUFSIZE 1024 /* bytes */ 77222786Shselasky#define USB_CS_RESET_LIMIT 20 /* failures = 20 * 50 ms = 1sec */ 78194677Sthompsa 79225350Shselasky#define USB_MAX_AUTO_QUIRK 4 /* maximum number of dynamic quirks */ 80225350Shselasky 81194677Sthompsatypedef uint32_t usb_timeout_t; /* milliseconds */ 82194677Sthompsatypedef uint32_t usb_frlength_t; /* bytes */ 83194677Sthompsatypedef uint32_t usb_frcount_t; /* units */ 84194677Sthompsatypedef uint32_t usb_size_t; /* bytes */ 85194677Sthompsatypedef uint32_t usb_ticks_t; /* system defined */ 86194677Sthompsatypedef uint16_t usb_power_mask_t; /* see "USB_HW_POWER_XXX" */ 87239214Shselaskytypedef uint16_t usb_stream_t; /* stream ID */ 88194677Sthompsa 89194677Sthompsa#endif /* _USB_FREEBSD_H_ */ 90