1/* 2 * Copyright 2018, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT license. 4 * 5 * Authors: 6 * Augustin Cavalier <waddlesplash> 7 */ 8#ifndef _FBSD_COMPAT_USB_HAIKU_H_ 9#define _FBSD_COMPAT_USB_HAIKU_H_ 10 11#include <sys/cdefs.h> 12 13/* Default USB configuration */ 14#define USB_HAVE_UGEN 1 15#define USB_HAVE_DEVCTL 1 16#define USB_HAVE_BUSDMA 1 17#define USB_HAVE_COMPAT_LINUX 0 18#define USB_HAVE_USER_IO 1 19#define USB_HAVE_MBUF 1 20#define USB_HAVE_TT_SUPPORT 1 21#define USB_HAVE_POWERD 1 22#define USB_HAVE_MSCTEST 1 23#define USB_HAVE_MSCTEST_DETACH 1 24#define USB_HAVE_PF 1 25#define USB_HAVE_ROOT_MOUNT_HOLD 1 26#define USB_HAVE_ID_SECTION 0 27#define USB_HAVE_PER_BUS_PROCESS 1 28#define USB_HAVE_FIXED_ENDPOINT 0 29#define USB_HAVE_FIXED_IFACE 0 30#define USB_HAVE_FIXED_CONFIG 0 31#define USB_HAVE_FIXED_PORT 0 32#define USB_HAVE_DISABLE_ENUM 1 33 34/* define zero ticks callout value */ 35#define USB_CALLOUT_ZERO_TICKS 1 36 37#define USB_TD_GET_PROC(td) (td)->td_proc 38#define USB_PROC_GET_GID(td) (td)->p_pgid 39 40#if (!defined(USB_HOST_ALIGN)) || (USB_HOST_ALIGN <= 0) 41/* Use default value. */ 42#undef USB_HOST_ALIGN 43#if defined(__arm__) || defined(__mips__) || defined(__powerpc__) 44#define USB_HOST_ALIGN 32 /* Arm and MIPS need at least this much, if not more */ 45#else 46#define USB_HOST_ALIGN 8 /* bytes, must be power of two */ 47#endif 48#endif 49/* Sanity check for USB_HOST_ALIGN: Verify power of two. */ 50#if ((-USB_HOST_ALIGN) & USB_HOST_ALIGN) != USB_HOST_ALIGN 51#error "USB_HOST_ALIGN is not power of two." 52#endif 53#define USB_FS_ISOC_UFRAME_MAX 4 /* exclusive unit */ 54#define USB_BUS_MAX 256 /* units */ 55#define USB_MAX_DEVICES 128 /* units */ 56#define USB_CONFIG_MAX 65535 /* bytes */ 57#define USB_IFACE_MAX 32 /* units */ 58#define USB_FIFO_MAX 128 /* units */ 59#define USB_MAX_EP_STREAMS 8 /* units */ 60#define USB_MAX_EP_UNITS 32 /* units */ 61#define USB_MAX_PORTS 255 /* units */ 62 63#define USB_MAX_FS_ISOC_FRAMES_PER_XFER (120) /* units */ 64#define USB_MAX_HS_ISOC_FRAMES_PER_XFER (8*120) /* units */ 65 66#define USB_HUB_MAX_DEPTH 5 67#define USB_EP0_BUFSIZE 1024 /* bytes */ 68#define USB_CS_RESET_LIMIT 20 /* failures = 20 * 50 ms = 1sec */ 69 70#define USB_MAX_AUTO_QUIRK 8 /* maximum number of dynamic quirks */ 71 72typedef uint32_t usb_timeout_t; /* milliseconds */ 73typedef uint32_t usb_frlength_t; /* bytes */ 74typedef uint32_t usb_frcount_t; /* units */ 75typedef uint32_t usb_size_t; /* bytes */ 76typedef uint32_t usb_ticks_t; /* system defined */ 77typedef uint16_t usb_power_mask_t; /* see "USB_HW_POWER_XXX" */ 78typedef uint16_t usb_stream_t; /* stream ID */ 79 80#endif // _FBSD_COMPAT_USB_HAIKU_H_ 81