Преглед изворни кода

[bt] fix compilation errors that do not use bluetooth and register vhci devices in advance

Evlers пре 11 месеци
родитељ
комит
c43399c855
2 измењених фајлова са 12 додато и 3 уклоњено
  1. 4 2
      SConscript
  2. 8 1
      porting/bt/vhci_dev.c

+ 4 - 2
SConscript

@@ -69,10 +69,12 @@ if GetDepend(['ESP_HOSTED_BT_USING_VHCI_DEVICE_DRIVER']):
     src += Glob('porting/bt/vhci_dev.c')
     src += Glob('porting/bt/vhci/*.c')
     path += [cwd + '/porting/bt/vhci']
-
-if GetDepend(['ESP_HOSTED_BT_USING_NIMBLE_STACK']):
+elif GetDepend(['ESP_HOSTED_BT_USING_NIMBLE_STACK']):
     # add nimble hci driver source and header files
     src += Glob('porting/bt/vhci_drv.c')
+else:
+    # empty implementation
+    src += Glob('porting/bt/vhci_drv.c')
 path += [cwd + '/esp-hosted/host/drivers/bt']
 
 # add host wlan source files

+ 8 - 1
porting/bt/vhci_dev.c

@@ -21,6 +21,11 @@ static const char TAG[] = "vhci.dev";
 
 static struct rt_ringbuffer *vhci_rx_buffer = RT_NULL;
 
+void hci_drv_init(void)
+{
+    /* do nothing for VHCI: underlying transport should be ready */
+}
+
 void hci_drv_show_configuration(void)
 {
 	ESP_LOGI(TAG, "Host BT Support: Enabled");
@@ -114,8 +119,10 @@ static rt_vhci_dev_t vhci_dev =
     .ops = &vhci_ops
 };
 
-void hci_drv_init(void)
+static int rt_vhci_dev_init(void)
 {
     /* register virtual hci device */
     rt_device_vhci_register(&vhci_dev, ESP_HOSTED_VHCI_DEVICE_NAME, RT_DEVICE_FLAG_RDWR, NULL);
+    return RT_EOK;
 }
+INIT_DEVICE_EXPORT(rt_vhci_dev_init);