Files
luban-lite-t3e-pro/packages/third-party/cherryusb/class/wireless/usbh_bluetooth.h
刘可亮 9f7ba67007 v1.0.3
2024-01-27 08:47:24 +08:00

56 lines
2.0 KiB
C

/*
* Copyright (c) 2024, sakumisu
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef USBH_BLUETOOTH_H
#define USBH_BLUETOOTH_H
#define USB_BLUETOOTH_HCI_CMD 0
#define USB_BLUETOOTH_HCI_EVT 1
#define USB_BLUETOOTH_HCI_ACL_OUT 2
#define USB_BLUETOOTH_HCI_ACL_IN 3
#define USB_BLUETOOTH_HCI_ISO_OUT 4
#define USB_BLUETOOTH_HCI_ISO_IN 5
struct usbh_bluetooth {
struct usbh_hubport *hport;
struct usb_endpoint_descriptor *bulkin; /* Bulk IN endpoint */
struct usb_endpoint_descriptor *bulkout; /* Bulk OUT endpoint */
struct usb_endpoint_descriptor *intin; /* INTR endpoint */
struct usb_endpoint_descriptor *isoin; /* Bulk IN endpoint */
struct usb_endpoint_descriptor *isoout; /* Bulk OUT endpoint */
struct usbh_urb bulkin_urb; /* Bulk IN urb */
struct usbh_urb bulkout_urb; /* Bulk OUT urb */
struct usbh_urb intin_urb; /* INTR IN urb */
struct usbh_urb *isoin_urb; /* Bulk IN urb */
struct usbh_urb *isoout_urb; /* Bulk OUT urb */
uint8_t intf;
uint8_t num_of_intf_altsettings;
};
#ifdef __cplusplus
extern "C" {
#endif
void usbh_bluetooth_run(struct usbh_bluetooth *bluetooth_class);
void usbh_bluetooth_stop(struct usbh_bluetooth *bluetooth_class);
/* OpCode(OCF+OGF:2bytes) + ParamLength + Paramas */
int usbh_bluetooth_hci_cmd(uint8_t *buffer, uint32_t buflen);
/* Handle (12bits) + Packet_Boundary_Flag(2bits) + BC_flag(2bits) + data_len(2bytes) + data */
int usbh_bluetooth_hci_acl_out(uint8_t *buffer, uint32_t buflen);
void usbh_bluetooth_hci_event_rx_thread(void *argument);
void usbh_bluetooth_hci_acl_rx_thread(void *argument);
/* USB_BLUETOOTH_HCI_EVT : EventCode(1byte) + ParamLength + Parama0 + Parama1 + Parama2;
USB_BLUETOOTH_HCI_ACL : Handle (12bits) + Packet_Boundary_Flag(2bits) + BC_flag(2bits) + data_len(2bytes) + data
*/
void usbh_bluetooth_hci_rx_callback(uint8_t hci_type, uint8_t *data, uint32_t len);
#ifdef __cplusplus
}
#endif
#endif /* USBH_BLUETOOTH_H */