summaryrefslogtreecommitdiff
path: root/class/wireless/usbh_bluetooth.h
blob: 87eb02acb36b6e392ef5680d9d0cbde0b9dc2675 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * Copyright (c) 2024, sakumisu
 *
 * SPDX-License-Identifier: Apache-2.0
 */
#ifndef USBH_BLUETOOTH_H
#define USBH_BLUETOOTH_H

#define USB_BLUETOOTH_HCI_NONE 0x00
#define USB_BLUETOOTH_HCI_CMD  0x01
#define USB_BLUETOOTH_HCI_ACL  0x02
#define USB_BLUETOOTH_HCI_SCO  0x03
#define USB_BLUETOOTH_HCI_EVT  0x04
#define USB_BLUETOOTH_HCI_ISO  0x05

struct usbh_bluetooth {
    struct usbh_hubport *hport;
    uint8_t intf;
    struct usb_endpoint_descriptor *bulkin;  /* Bulk IN endpoint */
    struct usb_endpoint_descriptor *bulkout; /* Bulk OUT endpoint */
    struct usbh_urb bulkin_urb;              /* Bulk IN urb */
    struct usbh_urb bulkout_urb;             /* Bulk OUT urb */
#ifndef CONFIG_USBHOST_BLUETOOTH_HCI_H4
    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 intin_urb;              /* INTR IN urb */
    struct usbh_urb *isoin_urb;             /* Bulk IN urb */
    struct usbh_urb *isoout_urb;            /* Bulk OUT urb */
    uint8_t num_of_intf_altsettings;
#endif

    void *user_data;
};

#ifdef __cplusplus
extern "C" {
#endif

int usbh_bluetooth_hci_write(uint8_t hci_type, uint8_t *buffer, uint32_t buflen);
void usbh_bluetooth_hci_read_callback(uint8_t *data, uint32_t len);
#ifdef CONFIG_USBHOST_BLUETOOTH_HCI_H4
void usbh_bluetooth_hci_rx_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV);
#else
void usbh_bluetooth_hci_evt_rx_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV);
void usbh_bluetooth_hci_acl_rx_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV);
#endif

void usbh_bluetooth_run(struct usbh_bluetooth *bluetooth_class);
void usbh_bluetooth_stop(struct usbh_bluetooth *bluetooth_class);

#ifdef __cplusplus
}
#endif

#endif /* USBH_BLUETOOTH_H */