usb_freebsd.h revision 217793
123599Smarkm/* $FreeBSD: head/sys/dev/usb/usb_freebsd.h 217793 2011-01-24 17:38:37Z hselasky $ */ 223599Smarkm/*- 323599Smarkm * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 423599Smarkm * 523599Smarkm * Redistribution and use in source and binary forms, with or without 623599Smarkm * modification, are permitted provided that the following conditions 723599Smarkm * are met: 823599Smarkm * 1. Redistributions of source code must retain the above copyright 923599Smarkm * notice, this list of conditions and the following disclaimer. 1023599Smarkm * 2. Redistributions in binary form must reproduce the above copyright 1123599Smarkm * notice, this list of conditions and the following disclaimer in the 1223599Smarkm * documentation and/or other materials provided with the distribution. 1323599Smarkm * 1423599Smarkm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1523599Smarkm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1623599Smarkm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1723599Smarkm * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1823599Smarkm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1923599Smarkm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2023599Smarkm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2123599Smarkm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2223599Smarkm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2323599Smarkm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2423599Smarkm * SUCH DAMAGE. 2523599Smarkm */ 2623599Smarkm 2723599Smarkm/* 2823599Smarkm * Including this file is mandatory for all USB related c-files in the kernel. 2923599Smarkm */ 3023599Smarkm 3123599Smarkm#ifndef _USB_FREEBSD_H_ 3223599Smarkm#define _USB_FREEBSD_H_ 3323599Smarkm 3423599Smarkm/* Default USB configuration */ 3523599Smarkm#define USB_HAVE_UGEN 1 3623599Smarkm#define USB_HAVE_DEVCTL 1 3723599Smarkm#define USB_HAVE_BUSDMA 1 3823599Smarkm#define USB_HAVE_COMPAT_LINUX 1 3933850Sahasty#define USB_HAVE_USER_IO 1 4023599Smarkm#define USB_HAVE_MBUF 1 4124246Sfsmp#define USB_HAVE_TT_SUPPORT 1 4224246Sfsmp#define USB_HAVE_POWERD 1 4324246Sfsmp#define USB_HAVE_MSCTEST 1 4424246Sfsmp#define USB_HAVE_PF 1 4524246Sfsmp 4624246Sfsmp#define USB_TD_GET_PROC(td) (td)->td_proc 4724246Sfsmp#define USB_PROC_GET_GID(td) (td)->p_pgid 4824246Sfsmp 4924246Sfsmp#if (!defined(USB_HOST_ALIGN)) || (USB_HOST_ALIGN <= 0) 5023599Smarkm/* Use default value. */ 5124246Sfsmp#undef USB_HOST_ALIGN 5224246Sfsmp#define USB_HOST_ALIGN 8 /* bytes, must be power of two */ 5324528Sfsmp#endif 5424528Sfsmp/* Sanity check for USB_HOST_ALIGN: Verify power of two. */ 5524528Sfsmp#if ((-USB_HOST_ALIGN) & USB_HOST_ALIGN) != USB_HOST_ALIGN 5624528Sfsmp#error "USB_HOST_ALIGN is not power of two." 5724528Sfsmp#endif 5824528Sfsmp#define USB_FS_ISOC_UFRAME_MAX 4 /* exclusive unit */ 5924528Sfsmp#define USB_BUS_MAX 256 /* units */ 6024246Sfsmp#define USB_MAX_DEVICES 128 /* units */ 6124528Sfsmp#define USB_IFACE_MAX 32 /* units */ 6224528Sfsmp#define USB_FIFO_MAX 128 /* units */ 6324528Sfsmp 6424528Sfsmp#define USB_MAX_FS_ISOC_FRAMES_PER_XFER (120) /* units */ 6524528Sfsmp#define USB_MAX_HS_ISOC_FRAMES_PER_XFER (8*120) /* units */ 6624528Sfsmp 6724528Sfsmp#define USB_HUB_MAX_DEPTH 5 6824528Sfsmp#define USB_EP0_BUFSIZE 1024 /* bytes */ 6924528Sfsmp 7024528Sfsmptypedef uint32_t usb_timeout_t; /* milliseconds */ 7124246Sfsmptypedef uint32_t usb_frlength_t; /* bytes */ 7224246Sfsmptypedef uint32_t usb_frcount_t; /* units */ 7324246Sfsmptypedef uint32_t usb_size_t; /* bytes */ 7424246Sfsmptypedef uint32_t usb_ticks_t; /* system defined */ 7524246Sfsmptypedef uint16_t usb_power_mask_t; /* see "USB_HW_POWER_XXX" */ 7624246Sfsmp 7724246Sfsmp#endif /* _USB_FREEBSD_H_ */ 7824246Sfsmp