1 /*
2  * Copyright (c) 2016 Nordic Semiconductor ASA
3  * Copyright (c) 2016 Vinayak Kariappa Chettimada
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #if defined(CONFIG_BT_HCI_ACL_FLOW_CONTROL)
9 extern int32_t    hci_hbuf_total;
10 extern uint32_t    hci_hbuf_sent;
11 extern uint32_t    hci_hbuf_acked;
12 extern atomic_t hci_state_mask;
13 
14 #define HCI_STATE_BIT_RESET 0
15 #endif
16 
17 #define HCI_CLASS_NONE            0 /* Invalid class */
18 #define HCI_CLASS_EVT_REQUIRED    1 /* Mesh and connection-{established,
19 				     * disconnected}
20 				     */
21 #define HCI_CLASS_EVT_DISCARDABLE 2 /* Best-effort reporting. Discardable
22 				     * over HCI in case of overflow
23 				     */
24 #define HCI_CLASS_EVT_CONNECTION  3 /* Connection management; e.g.
25 				     * terminate, update, encryption
26 				     */
27 #define HCI_CLASS_EVT_LLCP        4 /* LL Control Procedures */
28 #define HCI_CLASS_ACL_DATA        5 /* Asynchronous Connection Less (general
29 				     * data)
30 				     */
31 #define HCI_CLASS_ISO_DATA        6 /* Isochronous data */
32 
33 
34 void hci_init(struct k_poll_signal *signal_host_buf);
35 struct net_buf *hci_cmd_handle(struct net_buf *cmd, void **node_rx);
36 void hci_evt_encode(struct node_rx_pdu *node_rx, struct net_buf *buf);
37 uint8_t hci_get_class(struct node_rx_pdu *node_rx);
38 void hci_disconn_complete_encode(struct pdu_data *pdu_data, uint16_t handle,
39 				 struct net_buf *buf);
40 void hci_disconn_complete_process(uint16_t handle);
41 #if defined(CONFIG_BT_CONN)
42 int hci_acl_handle(struct net_buf *acl, struct net_buf **evt);
43 void hci_acl_encode(struct node_rx_pdu *node_rx, struct net_buf *buf);
44 void hci_num_cmplt_encode(struct net_buf *buf, uint16_t handle, uint8_t num);
45 #endif
46 #if defined(CONFIG_BT_CTLR_ISO)
47 void hci_iso_encode(struct net_buf *buf, uint16_t handle, uint8_t flags);
48 #endif
49 int hci_vendor_cmd_handle(uint16_t ocf, struct net_buf *cmd,
50 			  struct net_buf **evt);
51 uint8_t hci_vendor_read_static_addr(struct bt_hci_vs_static_addr addrs[],
52 				 uint8_t size);
53 void hci_vendor_read_key_hierarchy_roots(uint8_t ir[16], uint8_t er[16]);
54 int hci_vendor_cmd_handle_common(uint16_t ocf, struct net_buf *cmd,
55 			     struct net_buf **evt);
56 uint8_t hci_vendor_read_std_codecs(
57 	const struct bt_hci_std_codec_info_v2 **codecs);
58 uint8_t hci_vendor_read_vs_codecs(
59 	const struct bt_hci_vs_codec_info_v2 **codecs);
60 uint8_t hci_vendor_read_codec_capabilities(uint8_t coding_format,
61 					   uint16_t company_id,
62 					   uint16_t vs_codec_id,
63 					   uint8_t transport,
64 					   uint8_t direction,
65 					   uint8_t *num_capabilities,
66 					   size_t *capabilities_bytes,
67 					   const uint8_t **capabilities);
68 uint8_t hci_vendor_read_ctlr_delay(uint8_t coding_format,
69 				   uint16_t company_id,
70 				   uint16_t vs_codec_id,
71 				   uint8_t transport,
72 				   uint8_t direction,
73 				   uint8_t codec_config_len,
74 				   const uint8_t *codec_config,
75 				   uint32_t *min_delay,
76 				   uint32_t *max_delay);
77