Commit 0322af58 authored by Andrei Emeltchenko's avatar Andrei Emeltchenko Committed by Anas Nashif
Browse files

usb: Add Bluetooth device decriptors



Add USB Bluetooth device descriptors to usb_descriptor table.

Signed-off-by: default avatarAndrei Emeltchenko <andrei.emeltchenko@intel.com>
parent 4d703b1e
Loading
Loading
Loading
Loading
+60 −0
Original line number Diff line number Diff line
@@ -122,6 +122,14 @@ struct dev_common_descriptor {
		struct usb_ep_descriptor if0_in_ep;
		struct usb_ep_descriptor if0_out_ep;
	} __packed cdc_eem_cfg;
#endif
#ifdef CONFIG_USB_DEVICE_BLUETOOTH
	struct usb_bluetooth_config {
		struct usb_if_descriptor if0;
		struct usb_ep_descriptor if0_int_ep;
		struct usb_ep_descriptor if0_out_ep;
		struct usb_ep_descriptor if0_in_ep;
	} __packed bluetooth_cfg;
#endif
	struct usb_string_desription {
		struct usb_string_descriptor lang_descr;
@@ -664,6 +672,58 @@ static struct dev_common_descriptor common_desc = {
		},
	},
#endif /* CONFIG_USB_DEVICE_NETWORK_EEM */
#ifdef CONFIG_USB_DEVICE_BLUETOOTH
	.bluetooth_cfg = {
		/* Interface descriptor 0 */
		.if0 = {
			.bLength = sizeof(struct usb_if_descriptor),
			.bDescriptorType = USB_INTERFACE_DESC,
			.bInterfaceNumber = FIRST_IFACE_BLUETOOTH,
			.bAlternateSetting = 0,
			.bNumEndpoints = 3,
			.bInterfaceClass = WIRELESS_DEVICE_CLASS,
			.bInterfaceSubClass = RF_SUBCLASS,
			.bInterfaceProtocol = BLUETOOTH_PROTOCOL,
			.iInterface = 0,
		},

		/* Interrupt Endpoint */
		.if0_int_ep = {
			.bLength = sizeof(struct usb_ep_descriptor),
			.bDescriptorType = USB_ENDPOINT_DESC,
			.bEndpointAddress = CONFIG_BLUETOOTH_INT_EP_ADDR,
			.bmAttributes = USB_DC_EP_INTERRUPT,
			.wMaxPacketSize =
				sys_cpu_to_le16(
				CONFIG_BLUETOOTH_INT_EP_MPS),
			.bInterval = 0x01,
		},

		/* Data Endpoint OUT */
		.if0_out_ep = {
			.bLength = sizeof(struct usb_ep_descriptor),
			.bDescriptorType = USB_ENDPOINT_DESC,
			.bEndpointAddress = CONFIG_BLUETOOTH_OUT_EP_ADDR,
			.bmAttributes = USB_DC_EP_BULK,
			.wMaxPacketSize =
				sys_cpu_to_le16(
				CONFIG_BLUETOOTH_BULK_EP_MPS),
			.bInterval = 0x01,
		},

		/* Data Endpoint IN */
		.if0_in_ep = {
			.bLength = sizeof(struct usb_ep_descriptor),
			.bDescriptorType = USB_ENDPOINT_DESC,
			.bEndpointAddress = CONFIG_BLUETOOTH_IN_EP_ADDR,
			.bmAttributes = USB_DC_EP_BULK,
			.wMaxPacketSize =
				sys_cpu_to_le16(
				CONFIG_BLUETOOTH_BULK_EP_MPS),
			.bInterval = 0x01,
		},
	},
#endif /* CONFIG_USB_DEVICE_BLUETOOTH */
	.string_descr = {
		.lang_descr = {
			.bLength = sizeof(struct usb_string_descriptor),
+14 −3
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@
#define NUMOF_ENDPOINTS_HID		0
#endif /* CONFIG_USB_DEVICE_HID */


#ifdef CONFIG_USB_DEVICE_NETWORK_EEM
#define NUMOF_IFACES_CDC_EEM		1
#define NUMOF_ENDPOINTS_CDC_EEM		2
@@ -63,12 +62,22 @@
#define NUMOF_ENDPOINTS_CDC_EEM		0
#endif

#ifdef CONFIG_USB_DEVICE_BLUETOOTH
#define NUMOF_IFACES_BLUETOOTH		1
#define NUMOF_ENDPOINTS_BLUETOOTH	3
#else
#define NUMOF_IFACES_BLUETOOTH		0
#define NUMOF_ENDPOINTS_BLUETOOTH	0
#endif

#define NUMOF_IFACES	(NUMOF_IFACES_CDC_ACM + NUMOF_IFACES_MASS + \
			 NUMOF_IFACES_RNDIS + NUMOF_IFACES_CDC_ECM + \
			 NUMOF_IFACES_HID + NUMOF_IFACES_CDC_EEM)
			 NUMOF_IFACES_HID + NUMOF_IFACES_CDC_EEM + \
			 NUMOF_IFACES_BLUETOOTH)
#define NUMOF_ENDPOINTS	(NUMOF_ENDPOINTS_CDC_ACM + NUMOF_ENDPOINTS_MASS + \
			 NUMOF_ENDPOINTS_RNDIS + NUMOF_ENDPOINTS_CDC_ECM + \
			 NUMOF_ENDPOINTS_HID + NUMOF_ENDPOINTS_CDC_EEM)
			 NUMOF_ENDPOINTS_HID + NUMOF_ENDPOINTS_CDC_EEM + \
			 NUMOF_ENDPOINTS_BLUETOOTH)

#define FIRST_IFACE_CDC_ACM		0
#define FIRST_IFACE_MASS_STORAGE	NUMOF_IFACES_CDC_ACM
@@ -81,6 +90,8 @@
					 NUMOF_IFACES_CDC_ECM)
#define FIRST_IFACE_CDC_EEM		(FIRST_IFACE_HID + \
					 NUMOF_IFACES_HID)
#define FIRST_IFACE_BLUETOOTH		(FIRST_IFACE_CDC_EEM + \
					 NUMOF_IFACES_CDC_EEM)

#define MFR_DESC_LENGTH		(sizeof(CONFIG_USB_DEVICE_MANUFACTURER) * 2)
#define MFR_UC_IDX_MAX		(MFR_DESC_LENGTH - 3)