diff --git a/drivers/bluetooth/controller/Makefile b/drivers/bluetooth/controller/Makefile index ee2570e7ee5..c422b3073d0 100644 --- a/drivers/bluetooth/controller/Makefile +++ b/drivers/bluetooth/controller/Makefile @@ -14,5 +14,5 @@ obj-$(CONFIG_BLUETOOTH_CONTROLLER) += hal/radio.o obj-$(CONFIG_BLUETOOTH_CONTROLLER) += ll/ticker.o obj-$(CONFIG_BLUETOOTH_CONTROLLER) += ll/ctrl.o obj-$(CONFIG_BLUETOOTH_CONTROLLER) += ll/ll.o +obj-$(CONFIG_BLUETOOTH_CONTROLLER) += hci/hci_driver.o obj-$(CONFIG_BLUETOOTH_CONTROLLER) += hci/hci.o -obj-$(CONFIG_BLUETOOTH_CONTROLLER) += main.o diff --git a/drivers/bluetooth/controller/hci/hci.c b/drivers/bluetooth/controller/hci/hci.c index 5c489c25d3a..1b34b3ab6db 100644 --- a/drivers/bluetooth/controller/hci/hci.c +++ b/drivers/bluetooth/controller/hci/hci.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "defines.h" #include "ticker.h" @@ -33,9 +34,7 @@ #include "pdu.h" #include "ctrl.h" #include "ll.h" - -#include -#include "hci.h" +#include "hci_internal.h" #include "debug.h" @@ -959,7 +958,7 @@ static void hci_data_handle(void) hci_context.rx_len = 0; } -void hci_handle(uint8_t x, uint8_t *len, uint8_t **out) +void hcic_handle(uint8_t x, uint8_t *len, uint8_t **out) { struct bt_hci_cmd_hdr *cmd; @@ -1378,7 +1377,7 @@ static void encode_data(uint8_t *buf, uint8_t *len, uint8_t **out) } -void hci_encode(uint8_t *buf, uint8_t *len, uint8_t **out) +void hcic_encode(uint8_t *buf, uint8_t *len, uint8_t **out) { struct radio_pdu_node_rx *radio_pdu_node_rx; struct pdu_data *pdu_data; @@ -1408,8 +1407,8 @@ void hci_encode(uint8_t *buf, uint8_t *len, uint8_t **out) } } -void hci_encode_num_cmplt(uint16_t handle, uint8_t num, uint8_t *len, - uint8_t **out) +void hcic_encode_num_cmplt(uint16_t handle, uint8_t num, uint8_t *len, + uint8_t **out) { struct bt_hci_evt_num_completed_packets *ep; struct bt_hci_handle_count *hc; diff --git a/drivers/bluetooth/controller/main.c b/drivers/bluetooth/controller/hci/hci_driver.c similarity index 94% rename from drivers/bluetooth/controller/main.c rename to drivers/bluetooth/controller/hci/hci_driver.c index ce02f8a6c1c..8d461f241e6 100644 --- a/drivers/bluetooth/controller/main.c +++ b/drivers/bluetooth/controller/hci/hci_driver.c @@ -42,7 +42,7 @@ #include "hal/radio.h" #include "ll/ticker.h" #include "ll/ctrl_internal.h" -#include "hci/hci.h" +#include "hci_internal.h" #include "hal/debug.h" @@ -224,7 +224,7 @@ static void native_recv_fiber(int unused0, int unused1) uint8_t *buf; int retval; - hci_encode_num_cmplt(handle, num_cmplt, &len, &buf); + hcic_encode_num_cmplt(handle, num_cmplt, &len, &buf); BT_ASSERT(len); retval = native_recv(len, buf); @@ -238,7 +238,7 @@ static void native_recv_fiber(int unused0, int unused1) uint8_t *buf; int retval; - hci_encode((uint8_t *)radio_pdu_node_rx, &len, &buf); + hcic_encode((uint8_t *)radio_pdu_node_rx, &len, &buf); /* Not all radio_rx_get are translated to HCI!, * hence just dequeue. @@ -267,7 +267,6 @@ static void native_recv_fiber(int unused0, int unused1) static int native_send(struct net_buf *buf) { - extern void hci_handle(uint8_t x, uint8_t *len, uint8_t **out); uint8_t type; uint8_t remaining; uint8_t *in; @@ -279,10 +278,10 @@ static int native_send(struct net_buf *buf) type = bt_buf_get_type(buf); switch (type) { case BT_BUF_ACL_OUT: - hci_handle(HCI_ACL, &remaining, &in); + hcic_handle(HCI_ACL, &remaining, &in); break; case BT_BUF_CMD: - hci_handle(HCI_CMD, &remaining, &in); + hcic_handle(HCI_CMD, &remaining, &in); break; default: BT_ERR("Unknown HCI type %u", type); @@ -296,7 +295,7 @@ static int native_send(struct net_buf *buf) if (buf->len) { while (buf->len - 1) { - hci_handle(net_buf_pull_u8(buf), &remaining, &in); + hcic_handle(net_buf_pull_u8(buf), &remaining, &in); } if (remaining) { @@ -304,9 +303,9 @@ static int native_send(struct net_buf *buf) return -EINVAL; } - hci_handle(net_buf_pull_u8(buf), &remaining, &in); + hcic_handle(net_buf_pull_u8(buf), &remaining, &in); - BT_DBG("hci_handle returned %u bytes", remaining); + BT_DBG("hcic_handle returned %u bytes", remaining); if (remaining) { int retval; diff --git a/drivers/bluetooth/controller/hci/hci.h b/drivers/bluetooth/controller/hci/hci_internal.h similarity index 68% rename from drivers/bluetooth/controller/hci/hci.h rename to drivers/bluetooth/controller/hci/hci_internal.h index e290085dab1..31d15e884e2 100644 --- a/drivers/bluetooth/controller/hci/hci.h +++ b/drivers/bluetooth/controller/hci/hci_internal.h @@ -15,12 +15,12 @@ * limitations under the License. */ -#ifndef _HCI_H_ -#define _HCI_H_ +#ifndef _HCI_CONTROLLER_H_ +#define _HCI_CONTROLLER_H_ -void hci_handle(uint8_t x, uint8_t *len, uint8_t **out); -void hci_encode(uint8_t *buf, uint8_t *len, uint8_t **out); -void hci_encode_num_cmplt(uint16_t instance, uint8_t num, uint8_t *len, - uint8_t **out); +void hcic_handle(uint8_t x, uint8_t *len, uint8_t **out); +void hcic_encode(uint8_t *buf, uint8_t *len, uint8_t **out); +void hcic_encode_num_cmplt(uint16_t instance, uint8_t num, uint8_t *len, + uint8_t **out); -#endif /* _HCI_H_ */ +#endif /* _HCI_CONTROLLER_H_ */