1 /* 2 * Copyright (c) 2024, sakumisu 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 #ifndef USBH_BLUETOOTH_H 7 #define USBH_BLUETOOTH_H 8 9 #define USB_BLUETOOTH_HCI_NONE 0x00 10 #define USB_BLUETOOTH_HCI_CMD 0x01 11 #define USB_BLUETOOTH_HCI_ACL 0x02 12 #define USB_BLUETOOTH_HCI_SCO 0x03 13 #define USB_BLUETOOTH_HCI_EVT 0x04 14 #define USB_BLUETOOTH_HCI_ISO 0x05 15 16 struct usbh_bluetooth { 17 struct usbh_hubport *hport; 18 uint8_t intf; 19 struct usb_endpoint_descriptor *bulkin; /* Bulk IN endpoint */ 20 struct usb_endpoint_descriptor *bulkout; /* Bulk OUT endpoint */ 21 struct usbh_urb bulkin_urb; /* Bulk IN urb */ 22 struct usbh_urb bulkout_urb; /* Bulk OUT urb */ 23 #ifndef CONFIG_USBHOST_BLUETOOTH_HCI_H4 24 struct usb_endpoint_descriptor *intin; /* INTR endpoint */ 25 struct usb_endpoint_descriptor *isoin; /* Bulk IN endpoint */ 26 struct usb_endpoint_descriptor *isoout; /* Bulk OUT endpoint */ 27 struct usbh_urb intin_urb; /* INTR IN urb */ 28 struct usbh_urb *isoin_urb; /* Bulk IN urb */ 29 struct usbh_urb *isoout_urb; /* Bulk OUT urb */ 30 uint8_t num_of_intf_altsettings; 31 #endif 32 33 void *user_data; 34 }; 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 int usbh_bluetooth_hci_write(uint8_t hci_type, uint8_t *buffer, uint32_t buflen); 41 void usbh_bluetooth_hci_read_callback(uint8_t *data, uint32_t len); 42 #ifdef CONFIG_USBHOST_BLUETOOTH_HCI_H4 43 void usbh_bluetooth_hci_rx_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV); 44 #else 45 void usbh_bluetooth_hci_evt_rx_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV); 46 void usbh_bluetooth_hci_acl_rx_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV); 47 #endif 48 49 void usbh_bluetooth_run(struct usbh_bluetooth *bluetooth_class); 50 void usbh_bluetooth_stop(struct usbh_bluetooth *bluetooth_class); 51 52 #ifdef __cplusplus 53 } 54 #endif 55 56 #endif /* USBH_BLUETOOTH_H */ 57