1f9f848faSopenharmony_ci/*-
2f9f848faSopenharmony_ci * SPDX-License-Identifier: BSD-2-Clause
3f9f848faSopenharmony_ci *
4f9f848faSopenharmony_ci * Copyright (c) 2013 Hans Petter Selasky. All rights reserved.
5f9f848faSopenharmony_ci *
6f9f848faSopenharmony_ci * Redistribution and use in source and binary forms, with or without
7f9f848faSopenharmony_ci * modification, are permitted provided that the following conditions
8f9f848faSopenharmony_ci * are met:
9f9f848faSopenharmony_ci * 1. Redistributions of source code must retain the above copyright
10f9f848faSopenharmony_ci *    notice, this list of conditions and the following disclaimer.
11f9f848faSopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright
12f9f848faSopenharmony_ci *    notice, this list of conditions and the following disclaimer in the
13f9f848faSopenharmony_ci *    documentation and/or other materials provided with the distribution.
14f9f848faSopenharmony_ci *
15f9f848faSopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16f9f848faSopenharmony_ci * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17f9f848faSopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18f9f848faSopenharmony_ci * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19f9f848faSopenharmony_ci * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20f9f848faSopenharmony_ci * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21f9f848faSopenharmony_ci * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22f9f848faSopenharmony_ci * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23f9f848faSopenharmony_ci * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24f9f848faSopenharmony_ci * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25f9f848faSopenharmony_ci * SUCH DAMAGE.
26f9f848faSopenharmony_ci */
27f9f848faSopenharmony_ci
28f9f848faSopenharmony_ci/*
29f9f848faSopenharmony_ci * Including this file is mandatory for all USB related c-files in the loader.
30f9f848faSopenharmony_ci */
31f9f848faSopenharmony_ci
32f9f848faSopenharmony_ci#ifndef _USB_FREEBSD_LOADER_H_
33f9f848faSopenharmony_ci#define	_USB_FREEBSD_LOADER_H_
34f9f848faSopenharmony_ci
35f9f848faSopenharmony_ci/* Default USB configuration */
36f9f848faSopenharmony_ci#define	USB_HAVE_UGEN 1
37f9f848faSopenharmony_ci#define	USB_HAVE_DEVCTL 0
38f9f848faSopenharmony_ci#define	USB_HAVE_BUSDMA 1
39f9f848faSopenharmony_ci#define	USB_HAVE_COMPAT_LINUX 1
40f9f848faSopenharmony_ci#define	USB_HAVE_USER_IO 0
41f9f848faSopenharmony_ci#define	USB_HAVE_MBUF 1
42f9f848faSopenharmony_ci#define	USB_HAVE_TT_SUPPORT 1
43f9f848faSopenharmony_ci#define	USB_HAVE_POWERD 1
44f9f848faSopenharmony_ci#define	USB_HAVE_PF 0
45f9f848faSopenharmony_ci#define	USB_HAVE_ROOT_MOUNT_HOLD 0
46f9f848faSopenharmony_ci#define	USB_HAVE_ID_SECTION 0
47f9f848faSopenharmony_ci#define	USB_HAVE_PER_BUS_PROCESS 1
48f9f848faSopenharmony_ci#define	USB_HAVE_FIXED_ENDPOINT 0
49f9f848faSopenharmony_ci#define	USB_HAVE_FIXED_IFACE 0
50f9f848faSopenharmony_ci#define	USB_HAVE_FIXED_CONFIG 0
51f9f848faSopenharmony_ci#define	USB_HAVE_FIXED_PORT 0
52f9f848faSopenharmony_ci
53f9f848faSopenharmony_ci#define	USB_HAVE_DEVICE_TOPOLOGY 1
54f9f848faSopenharmony_ci#define	USB_SUPPORT_SD_HOT_PLUG 1
55f9f848faSopenharmony_ci
56f9f848faSopenharmony_ci#define	USB_CALLOUT_ZERO_TICKS 1
57f9f848faSopenharmony_ci
58f9f848faSopenharmony_ci#define	USB_TD_GET_PROC(td) (0)
59f9f848faSopenharmony_ci#define	USB_PROC_GET_GID(td) (0)
60f9f848faSopenharmony_ci
61f9f848faSopenharmony_ci#if (!defined(USB_HOST_ALIGN)) || (USB_HOST_ALIGN <= 0)
62f9f848faSopenharmony_ci/* Use default value. */
63f9f848faSopenharmony_ci#undef USB_HOST_ALIGN
64f9f848faSopenharmony_ci#define	USB_HOST_ALIGN	8		/* bytes, must be power of two */
65f9f848faSopenharmony_ci#endif
66f9f848faSopenharmony_ci/* Sanity check for USB_HOST_ALIGN: Verify power of two. */
67f9f848faSopenharmony_ci#if ((-USB_HOST_ALIGN) & USB_HOST_ALIGN) != USB_HOST_ALIGN
68f9f848faSopenharmony_ci#error "USB_HOST_ALIGN is not power of two."
69f9f848faSopenharmony_ci#endif
70f9f848faSopenharmony_ci#define	USB_FS_ISOC_UFRAME_MAX 4	/* exclusive unit */
71f9f848faSopenharmony_ci#define	USB_BUS_MAX 256			/* units */
72f9f848faSopenharmony_ci#define	USB_MAX_DEVICES 8		/* units */
73f9f848faSopenharmony_ci#define	USB_CONFIG_MAX 65535		/* bytes */
74f9f848faSopenharmony_ci#define	USB_IFACE_MAX 32		/* units */
75f9f848faSopenharmony_ci#define	USB_FIFO_MAX 128		/* units */
76f9f848faSopenharmony_ci#define	USB_MAX_EP_UNITS 32		/* units */
77f9f848faSopenharmony_ci#define	USB_MAX_EP_STREAMS 8		/* units */
78f9f848faSopenharmony_ci#define	USB_MAX_PORTS 255		/* units */
79f9f848faSopenharmony_ci
80f9f848faSopenharmony_ci#define	USB_MAX_FS_ISOC_FRAMES_PER_XFER (120)	/* units */
81f9f848faSopenharmony_ci#define	USB_MAX_HS_ISOC_FRAMES_PER_XFER (8*120)	/* units */
82f9f848faSopenharmony_ci
83f9f848faSopenharmony_ci#define	USB_HUB_MAX_DEPTH	5
84f9f848faSopenharmony_ci#define	USB_EP0_BUFSIZE		1024	/* bytes */
85f9f848faSopenharmony_ci#define	USB_CS_RESET_LIMIT	20	/* failures = 20 * 50 ms = 1sec */
86f9f848faSopenharmony_ci
87f9f848faSopenharmony_ci#define	USB_MAX_AUTO_QUIRK	8	/* maximum number of dynamic quirks */
88f9f848faSopenharmony_ci
89f9f848faSopenharmony_ci#define	USB_IN_POLLING_MODE_FUNC() 0
90f9f848faSopenharmony_ci#define	USB_IN_POLLING_MODE_VALUE() 0
91f9f848faSopenharmony_ci
92f9f848faSopenharmony_citypedef uint32_t usb_timeout_t;		/* milliseconds */
93f9f848faSopenharmony_citypedef uint32_t usb_frlength_t;	/* bytes */
94f9f848faSopenharmony_citypedef uint32_t usb_frcount_t;		/* units */
95f9f848faSopenharmony_citypedef uint32_t usb_size_t;		/* bytes */
96f9f848faSopenharmony_citypedef uint32_t usb_ticks_t;		/* system defined */
97f9f848faSopenharmony_citypedef uint16_t usb_power_mask_t;	/* see "USB_HW_POWER_XXX" */
98f9f848faSopenharmony_citypedef uint16_t usb_stream_t;		/* stream ID */
99f9f848faSopenharmony_ci
100f9f848faSopenharmony_ci#endif					/* _USB_FREEBSD_LOADER_H_ */
101