/* $FreeBSD: release/9.0.0/tools/tools/bus_autoconf/bus_autoconf_format_example.txt 223534 2011-06-25 13:44:05Z hselasky $ */

#if BYTE_ORDER == BIG_ENDIAN
#define	U16_XOR "8"
#define	U32_XOR "12"
#define	U64_XOR "56"
#define	U8_BITFIELD_XOR "7"
#define	U16_BITFIELD_XOR "15"
#define	U32_BITFIELD_XOR "31"
#define	U64_BITFIELD_XOR "63"
#else
#define	U16_XOR "0"
#define	U32_XOR "0"
#define	U64_XOR "0"
#define	U8_BITFIELD_XOR "0"
#define	U16_BITFIELD_XOR "0"
#define	U32_BITFIELD_XOR "0"
#define	U64_BITFIELD_XOR "0"
#endif

#if USB_HAVE_COMPAT_LINUX
#define	MFL_SIZE "1"
#else
#define	MFL_SIZE "0"
#endif

static const char __section("bus_autoconf_format") __used usb_id_format[] = {

		/*
		 * Declare three different sections that use the same format.
		 * All sizes are in bits. Fields cannot be greater than
		 * 8 bits in size. Bitfields having a size greater than 1
		 * must fit within the byte in which the bitfield is defined.
		 */

		"usb_host_id{256,:}"
		"usb_device_id{256,:}"
		"usb_dual_id{256,:}"

		/*
		 * Describe all fields in the usb_device_id structure
		 * which is found in sys/dev/usb/usbdi.h.
		 */

#if BITS_PER_LONG == 32 || BITS_PER_LONG == 64
		"unused{0,8}"
		"unused{0,8}"
		"unused{0,8}"
		"unused{0,8}"
#if BITS_PER_LONG == 64
		"unused{0,8}"
		"unused{0,8}"
		"unused{0,8}"
		"unused{0,8}"
#endif
#else
#error "Please update code."
#endif

		"idVendor[0]{" U16_XOR ",8}"
		"idVendor[1]{" U16_XOR ",8}"
		"idProduct[0]{" U16_XOR ",8}"
		"idProduct[1]{" U16_XOR ",8}"
		"bcdDevice_lo[0]{" U16_XOR ",8}"
		"bcdDevice_lo[1]{" U16_XOR ",8}"
		"bcdDevice_hi[0]{" U16_XOR ",8}"
		"bcdDevice_hi[1]{" U16_XOR ",8}"

		"bDeviceClass{0,8}"
		"bDeviceSubClass{0,8}"
		"bDeviceProtocol{0,8}"
		"bInterfaceClass{0,8}"
		"bInterfaceSubClass{0,8}"
		"bInterfaceProtocol{0,8}"

/* NOTE: On big endian machines bitfields are bitreversed. */

		"mf_vendor{" U8_BITFIELD_XOR ",1}"
		"mf_product{" U8_BITFIELD_XOR ",1}"
		"mf_dev_lo{" U8_BITFIELD_XOR ",1}"
		"mf_dev_hi{" U8_BITFIELD_XOR ",1}"

		"mf_dev_class{" U8_BITFIELD_XOR ",1}"
		"mf_dev_subclass{" U8_BITFIELD_XOR ",1}"
		"mf_dev_protocol{" U8_BITFIELD_XOR ",1}"
		"mf_int_class{" U8_BITFIELD_XOR ",1}"

		"mf_int_subclass{" U8_BITFIELD_XOR ",1}"
		"mf_int_protocol{" U8_BITFIELD_XOR ",1}"
		"unused{" U8_BITFIELD_XOR ",6}"

		"mfl_vendor{" U16_XOR "," MFL_SIZE "}"
		"mfl_product{" U16_XOR "," MFL_SIZE "}"
		"mfl_dev_lo{" U16_XOR "," MFL_SIZE "}"
		"mfl_dev_hi{" U16_XOR "," MFL_SIZE "}"

		"mfl_dev_class{" U16_XOR "," MFL_SIZE "}"
		"mfl_dev_subclass{" U16_XOR "," MFL_SIZE "}"
		"mfl_dev_protocol{" U16_XOR "," MFL_SIZE "}"
		"mfl_int_class{" U16_XOR "," MFL_SIZE "}"

		"mfl_int_subclass{" U16_XOR "," MFL_SIZE "}"
		"mfl_int_protocol{" U16_XOR "," MFL_SIZE "}"
		"unused{" U16_XOR "," MFL_SIZE "}"
		"unused{" U16_XOR "," MFL_SIZE "}"

		"unused{" U16_XOR "," MFL_SIZE "}"
		"unused{" U16_XOR "," MFL_SIZE "}"
		"unused{" U16_XOR "," MFL_SIZE "}"
		"unused{" U16_XOR "," MFL_SIZE "}"
};
