usbh_bluetooth.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. #define USB_BLUETOOTH_HCI_NONE 0x00
  9. #define USB_BLUETOOTH_HCI_CMD 0x01
  10. #define USB_BLUETOOTH_HCI_ACL 0x02
  11. #define USB_BLUETOOTH_HCI_SCO 0x03
  12. #define USB_BLUETOOTH_HCI_EVT 0x04
  13. #define USB_BLUETOOTH_HCI_ISO 0x05
  14. struct usbh_bluetooth {
  15. struct usbh_hubport *hport;
  16. uint8_t intf;
  17. struct usb_endpoint_descriptor *bulkin; /* Bulk IN endpoint */
  18. struct usb_endpoint_descriptor *bulkout; /* Bulk OUT endpoint */
  19. struct usbh_urb bulkin_urb; /* Bulk IN urb */
  20. struct usbh_urb bulkout_urb; /* Bulk OUT urb */
  21. #ifndef CONFIG_USBHOST_BLUETOOTH_HCI_H4
  22. struct usb_endpoint_descriptor *intin; /* INTR endpoint */
  23. struct usb_endpoint_descriptor *isoin; /* Bulk IN endpoint */
  24. struct usb_endpoint_descriptor *isoout; /* Bulk OUT endpoint */
  25. struct usbh_urb intin_urb; /* INTR IN urb */
  26. struct usbh_urb *isoin_urb; /* Bulk IN urb */
  27. struct usbh_urb *isoout_urb; /* Bulk OUT urb */
  28. uint8_t num_of_intf_altsettings;
  29. #endif
  30. void *user_data;
  31. };
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. int usbh_bluetooth_hci_write(uint8_t hci_type, uint8_t *buffer, uint32_t buflen);
  36. void usbh_bluetooth_hci_read_callback(uint8_t *data, uint32_t len);
  37. #ifdef CONFIG_USBHOST_BLUETOOTH_HCI_H4
  38. void usbh_bluetooth_hci_rx_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV);
  39. #else
  40. void usbh_bluetooth_hci_evt_rx_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV);
  41. void usbh_bluetooth_hci_acl_rx_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV);
  42. #endif
  43. void usbh_bluetooth_run(struct usbh_bluetooth *bluetooth_class);
  44. void usbh_bluetooth_stop(struct usbh_bluetooth *bluetooth_class);
  45. #ifdef __cplusplus
  46. }
  47. #endif
  48. #endif /* USBH_BLUETOOTH_H */