From: Tian Hao Date: Thu, 24 Nov 2016 11:57:47 +0000 (+0800) Subject: component/bt : wifi/bt software coexist option X-Git-Tag: v1.0~2^2~28 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=55e0690f69b8f6134ebe508887974278a35d7aec;p=esp-idf component/bt : wifi/bt software coexist option 1. option of sw coexist 2. cpu set freq function modify 3. update lib 4. ld add static data address --- diff --git a/components/bt/lib b/components/bt/lib index 5349ca3634..a0f2d0a961 160000 --- a/components/bt/lib +++ b/components/bt/lib @@ -1 +1 @@ -Subproject commit 5349ca363427758b9ef902f33e9ac0dae2c349e1 +Subproject commit a0f2d0a961eef1a4926218b26b77011a89e8188f diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index 694f81a9e6..8300b444c5 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -38,6 +38,14 @@ config ESP32_ENABLE_STACK_BT # bool "None" #endchoice +config SW_COEXIST_ENABLE + bool "Software do control of wifi/bt coexisit" + depends on ESP32_ENABLE_STACK_BT && ESP32_ENABLE_STACK_WIFI + default "n" + help + Software do something control of wifi/bt coexist. For some heavy traffic senario, + do sotware coexist, may be better. + config MEMMAP_BT bool depends on ESP32_ENABLE_STACK_BT diff --git a/components/esp32/cpu_freq.c b/components/esp32/cpu_freq.c index 327ea63867..c9d3104594 100644 --- a/components/esp32/cpu_freq.c +++ b/components/esp32/cpu_freq.c @@ -33,8 +33,8 @@ typedef enum{ extern void phy_get_romfunc_addr(); // TODO: these functions need to be moved from librtc to ESP-IDF -extern void rtc_init_lite(); -extern void rtc_set_cpu_freq(xtal_freq_t xtal_freq, cpu_freq_t cpu_freq); +extern void rtc_init_lite(xtal_freq_t xtal_freq); +extern void rtc_set_cpu_freq(cpu_freq_t cpu_freq); /* * This function is not exposed as an API at this point, @@ -52,7 +52,7 @@ void esp_set_cpu_freq(void) // wait uart tx finish, otherwise some uart output will be lost uart_tx_wait_idle(0); - rtc_init_lite(); + rtc_init_lite(XTAL_AUTO); cpu_freq_t freq = CPU_80M; switch(freq_mhz) { case 240: @@ -73,7 +73,7 @@ void esp_set_cpu_freq(void) // wait uart tx finish, otherwise some uart output will be lost uart_tx_wait_idle(0); - rtc_set_cpu_freq(XTAL_AUTO, freq); + rtc_set_cpu_freq(freq); ets_update_cpu_frequency(freq_mhz); } diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index 1eb0a5355e..5ecb8546c0 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -51,6 +51,7 @@ #include "esp_int_wdt.h" #include "esp_task_wdt.h" #include "esp_phy_init.h" +#include "esp_coexist.h" #include "trax.h" void start_cpu0(void) __attribute__((weak, alias("start_cpu0_default"))); @@ -194,6 +195,12 @@ void start_cpu0_default(void) do_phy_init(); #endif +#if CONFIG_SW_COEXIST_ENABLE + if (coexist_init() == ESP_OK) { + coexist_set_enable(true); + } +#endif + xTaskCreatePinnedToCore(&main_task, "main", ESP_TASK_MAIN_STACK, NULL, ESP_TASK_MAIN_PRIO, NULL, 0); diff --git a/components/esp32/include/esp_coexist.h b/components/esp32/include/esp_coexist.h new file mode 100644 index 0000000000..09d38aced6 --- /dev/null +++ b/components/esp32/include/esp_coexist.h @@ -0,0 +1,46 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Init software coexist + * + * @return Init ok or failed. + */ +esp_err_t coexist_init(void); + +/** + * @brief Get software coexist enable or not + * + * @return software coexist enable status. + */ +bool coexist_get_enable(void); + +/** + * @brief Set software coexist enable or not + * + * @param enable software coexist or disable it + * + * @return Void. + */ +void coexist_set_enable(bool enable); + +#ifdef __cplusplus +} +#endif diff --git a/components/esp32/ld/esp32.rom.ld b/components/esp32/ld/esp32.rom.ld index 5266a679be..af9522976b 100644 --- a/components/esp32/ld/esp32.rom.ld +++ b/components/esp32/ld/esp32.rom.ld @@ -1841,3 +1841,22 @@ PROVIDE ( _xtos_syscall_handler = 0x40000790 ); PROVIDE ( _xtos_unhandled_exception = 0x4000c024 ); PROVIDE ( _xtos_unhandled_interrupt = 0x4000c01c ); PROVIDE ( _xtos_vpri_enabled = 0x3ffe0654 ); +/* Following are static data, but can be used, not generated by script <<<<< btdm data */ +PROVIDE ( ld_acl_env = 0x3ffb8258 ); +PROVIDE ( ld_active_ch_map = 0x3ffb8334 ); +PROVIDE ( ld_bcst_acl_env = 0x3ffb8274 ); +PROVIDE ( ld_csb_rx_env = 0x3ffb8278 ); +PROVIDE ( ld_csb_tx_env = 0x3ffb827c ); +PROVIDE ( ld_env = 0x3ffb9510 ); +PROVIDE ( ld_fm_env = 0x3ffb8284 ); +PROVIDE ( ld_inq_env = 0x3ffb82e4 ); +PROVIDE ( ld_iscan_env = 0x3ffb82e8 ); +PROVIDE ( ld_page_env = 0x3ffb82f0 ); +PROVIDE ( ld_pca_env = 0x3ffb82f4 ); +PROVIDE ( ld_pscan_env = 0x3ffb8308 ); +PROVIDE ( ld_sched_env = 0x3ffb830c ); +PROVIDE ( ld_sched_params = 0x3ffb96c0 ); +PROVIDE ( ld_sco_env = 0x3ffb824c ); +PROVIDE ( ld_sscan_env = 0x3ffb832c ); +PROVIDE ( ld_strain_env = 0x3ffb8330 ); +/* Above are static data, but can be used, not generated by script >>>>> btdm data */ diff --git a/components/esp32/lib b/components/esp32/lib index e2e5781dc2..93fcc0324c 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit e2e5781dc27e638c5e63f85bc23590dd21af1619 +Subproject commit 93fcc0324cd9b4de8ae381a876d371dfd4eff8e3 diff --git a/examples/07_blufi/components/blufi/blufi_task.c b/examples/07_blufi/components/blufi/blufi_task.c index e4d4875c0d..8c46780b49 100644 --- a/examples/07_blufi/components/blufi/blufi_task.c +++ b/examples/07_blufi/components/blufi/blufi_task.c @@ -79,7 +79,7 @@ static esp_err_t blufi_task_post(uint32_t sig, void *par, void *cb, void *arg) esp_err_t blufi_transfer_context(blufi_task_cb_t cb, void *arg) { - LOG_DEBUG("%s cb %08x, arg %u\n", __func__, cb, arg); + LOG_DEBUG("%s cb %08x, arg %u\n", __func__, (uint32_t)cb, (uint32_t)arg); return blufi_task_post(BLUFI_SIG_SWITCH_CONTEXT, 0, cb, arg); } diff --git a/examples/10_gatt_client/main/component.mk b/examples/10_gatt_client/main/component.mk index 24356f23ed..afcb917c60 100644 --- a/examples/10_gatt_client/main/component.mk +++ b/examples/10_gatt_client/main/component.mk @@ -7,4 +7,4 @@ # please read the ESP-IDF documents if you need to do this. # -include $(IDF_PATH)/make/component_common.mk +#include $(IDF_PATH)/make/component_common.mk