Explorar el Código

component/bt: modify the bluetooth read_efuse_mac interface

wangmengyang hace 9 años
padre
commit
6d061ec903
Se han modificado 4 ficheros con 12 adiciones y 6 borrados
  1. 1 1
      components/bt/Kconfig
  2. 8 2
      components/bt/bt.c
  3. 1 1
      components/bt/lib
  4. 2 2
      components/esp32/system_api.c

+ 1 - 1
components/bt/Kconfig

@@ -3,7 +3,7 @@ menuconfig BT_ENABLED
     help
     help
         Select this option to enable Bluetooth stack and show the submenu with Bluetooth configuration choices.
         Select this option to enable Bluetooth stack and show the submenu with Bluetooth configuration choices.
 
 
-config ESP_MAC_OFFSET_BT_
+config ESP_MAC_OFFSET_BT
     int "MAC address offset value of WiFi station"
     int "MAC address offset value of WiFi station"
     depends on BT_ENABLED
     depends on BT_ENABLED
     range 0 255
     range 0 255

+ 8 - 2
components/bt/bt.c

@@ -45,6 +45,7 @@ extern void btdm_controller_deinit(void);
 extern int btdm_controller_enable(esp_bt_mode_t mode);
 extern int btdm_controller_enable(esp_bt_mode_t mode);
 extern int btdm_controller_disable(esp_bt_mode_t mode);
 extern int btdm_controller_disable(esp_bt_mode_t mode);
 extern void btdm_rf_bb_init(void);
 extern void btdm_rf_bb_init(void);
+extern int esp_read_mac(uint8_t *mac, int type);
 
 
 /* VHCI function interface */
 /* VHCI function interface */
 typedef struct vhci_host_callback {
 typedef struct vhci_host_callback {
@@ -78,7 +79,7 @@ struct osi_funcs_t {
     void *(*_mutex_create)(void);
     void *(*_mutex_create)(void);
     int32_t (*_mutex_lock)(void *mutex);
     int32_t (*_mutex_lock)(void *mutex);
     int32_t (*_mutex_unlock)(void *mutex);
     int32_t (*_mutex_unlock)(void *mutex);
-    esp_err_t (* _read_efuse_mac)(uint8_t mac[6]);
+    int32_t (* _read_efuse_mac)(uint8_t mac[6]);
 };
 };
 
 
 /* Static variable declare */
 /* Static variable declare */
@@ -129,6 +130,11 @@ static int32_t IRAM_ATTR mutex_unlock_wrapper(void *mutex)
     return (int32_t)xSemaphoreGive(mutex);
     return (int32_t)xSemaphoreGive(mutex);
 }
 }
 
 
+static int32_t IRAM_ATTR read_mac_wrapper(uint8_t mac[6])
+{
+    return esp_read_mac(mac, ESP_MAC_BT);
+}
+
 static struct osi_funcs_t osi_funcs = {
 static struct osi_funcs_t osi_funcs = {
     ._set_isr = xt_set_interrupt_handler,
     ._set_isr = xt_set_interrupt_handler,
     ._ints_on = xt_ints_on,
     ._ints_on = xt_ints_on,
@@ -141,7 +147,7 @@ static struct osi_funcs_t osi_funcs = {
     ._mutex_create = mutex_create_wrapper,
     ._mutex_create = mutex_create_wrapper,
     ._mutex_lock = mutex_lock_wrapper,
     ._mutex_lock = mutex_lock_wrapper,
     ._mutex_unlock = mutex_unlock_wrapper,
     ._mutex_unlock = mutex_unlock_wrapper,
-    ._read_efuse_mac = esp_efuse_read_mac,
+    ._read_efuse_mac = read_mac_wrapper
 };
 };
 
 
 bool esp_vhci_host_check_send_available(void)
 bool esp_vhci_host_check_send_available(void)

+ 1 - 1
components/bt/lib

@@ -1 +1 @@
-Subproject commit 9f9f6a004e42519f54555c42a037b8ef25bf2238
+Subproject commit 9a4bb1d5287572664f170f9df4dbfd71babdfc68

+ 2 - 2
components/esp32/system_api.c

@@ -97,13 +97,13 @@ esp_err_t esp_read_mac(uint8_t* mac, int interface)
         break;
         break;
 #endif
 #endif
 #if CONFIG_BT_ENABLED
 #if CONFIG_BT_ENABLED
-    case ESP_MAC_WIFI_BT:
+    case ESP_MAC_BT:
         memcpy(mac, efuse_mac, 6);
         memcpy(mac, efuse_mac, 6);
         mac[5] += CONFIG_ESP_MAC_OFFSET_BT;
         mac[5] += CONFIG_ESP_MAC_OFFSET_BT;
         break;
         break;
 #endif
 #endif
 #if CONFIG_ETHERNET
 #if CONFIG_ETHERNET
-    case ESP_MAC_WIFI_ETH:
+    case ESP_MAC_ETH:
         memcpy(mac, efuse_mac, 6);
         memcpy(mac, efuse_mac, 6);
         mac[5] += CONFIG_ESP_MAC_OFFSET_ETH;
         mac[5] += CONFIG_ESP_MAC_OFFSET_ETH;
         break;
         break;