/*-
 * Copyright (c) 1999, 2000 MAEKAWA Masahide <maekawa@math.sci.kobe-u.ac.jp>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *	$Maekawa: main.h,v 1.23 2000/04/03 20:41:49 maekawa Exp $
 */

#include <sys/types.h>

#define	BIT(x, k, n)	(((x) >> (k)) & ~(~0 << (n)))

int usb_get_descriptor	__P((int, u_int8_t, u_int8_t, u_int8_t, void *, int));
void bprintf		__P((u_int8_t *, size_t));
void iprintf		__P((char *, ...));

struct devinfo {
	u_int8_t	class;
	u_int8_t	subclass;
	u_int8_t	protocol;
	u_int16_t	vendor;
	u_int16_t	product;
};

void dump_full		__P((struct usb_full_desc *));
void dump_descriptor	__P((void *, const char *));
void dump_raw		__P((u_int8_t *, const char *));

/* Standard */
void dump_device	__P((usb_device_descriptor_t *));
void dump_config	__P((usb_descriptor_t *));
int dump_interface	__P((usb_descriptor_t *));
void dump_endpoint	__P((usb_descriptor_t *));
void dump_string	__P((usb_string_descriptor_t *, int));

/* Class Specific */
void dump_cs_device	__P((usb_descriptor_t *, int));
void dump_cs_interface	__P((usb_descriptor_t *));
void dump_cs_endpoint	__P((usb_descriptor_t *));

#if 0
#if defined(__FreeBSD__)
/* Class definitions */
#define	UICLASS_AUDIO		UCLASS_AUDIO
#define	UISUBCLASS_AUDIOCONTROL	USUBCLASS_AUDIOCONTROL
#define	UISUBCLASS_AUDIOSTREAM	USUBCLASS_AUDIOSTREAM
#define	UISUBCLASS_MIDISTREAM	USUBCLASS_MIDISTREAM
#define	UICLASS_HID		UCLASS_HID
#endif
#endif
