From e10416659c4a5268d86a82313d9b71abf47bebdf Mon Sep 17 00:00:00 2001 From: baohongde Date: Thu, 23 Sep 2021 17:04:05 +0800 Subject: [PATCH] components/bt: Sync bt lib with the high level interrupt version --- components/bt/controller/bt.c | 18 ++++++++++++++++-- components/bt/controller/lib | 2 +- components/bt/include/esp_bt.h | 4 ++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/components/bt/controller/bt.c b/components/bt/controller/bt.c index 384d4d1079..21835f6480 100644 --- a/components/bt/controller/bt.c +++ b/components/bt/controller/bt.c @@ -90,7 +90,7 @@ do{\ } while(0) #define OSI_FUNCS_TIME_BLOCKING 0xffffffff -#define OSI_VERSION 0x00010002 +#define OSI_VERSION 0x00010003 #define OSI_MAGIC_VALUE 0xFADEBEAD /* SPIRAM Configuration */ @@ -182,6 +182,10 @@ struct osi_funcs_t { void *(* _coex_schm_curr_phase_get)(void); int (* _coex_wifi_channel_get)(uint8_t *primary, uint8_t *secondary); int (* _coex_register_wifi_channel_change_callback)(void *cb); + xt_handler (*_set_isr_l3)(int n, xt_handler f, void *arg); + void (*_interrupt_l3_disable)(void); + void (*_interrupt_l3_restore)(void); + void *(* _customer_queue_create)(uint32_t queue_len, uint32_t item_size); uint32_t _magic; }; @@ -268,6 +272,7 @@ static bool btdm_queue_generic_deregister(btdm_queue_item_t *queue); #endif /* CONFIG_SPIRAM_USE_MALLOC */ static void IRAM_ATTR interrupt_disable(void); static void IRAM_ATTR interrupt_restore(void); +static void IRAM_ATTR task_yield(void); static void IRAM_ATTR task_yield_from_isr(void); static void *semphr_create_wrapper(uint32_t max, uint32_t init); static void semphr_delete_wrapper(void *semphr); @@ -326,7 +331,7 @@ static const struct osi_funcs_t osi_funcs_ro = { ._ints_on = xt_ints_on, ._interrupt_disable = interrupt_disable, ._interrupt_restore = interrupt_restore, - ._task_yield = vPortYield, + ._task_yield = task_yield, ._task_yield_from_isr = task_yield_from_isr, ._semphr_create = semphr_create_wrapper, ._semphr_delete = semphr_delete_wrapper, @@ -377,6 +382,10 @@ static const struct osi_funcs_t osi_funcs_ro = { ._coex_schm_curr_phase_get = coex_schm_curr_phase_get_wrapper, ._coex_wifi_channel_get = coex_wifi_channel_get_wrapper, ._coex_register_wifi_channel_change_callback = coex_register_wifi_channel_change_callback_wrapper, + ._set_isr_l3 = xt_set_interrupt_handler, + ._interrupt_l3_disable = interrupt_disable, + ._interrupt_l3_restore = interrupt_restore, + ._customer_queue_create = NULL, ._magic = OSI_MAGIC_VALUE, }; @@ -511,6 +520,11 @@ static void IRAM_ATTR interrupt_restore(void) } } +static void IRAM_ATTR task_yield(void) +{ + vPortYield(); +} + static void IRAM_ATTR task_yield_from_isr(void) { portYIELD_FROM_ISR(); diff --git a/components/bt/controller/lib b/components/bt/controller/lib index fb49791b7c..cfbb0571fb 160000 --- a/components/bt/controller/lib +++ b/components/bt/controller/lib @@ -1 +1 @@ -Subproject commit fb49791b7c1a8a35f06e68124c90022667b4cff1 +Subproject commit cfbb0571fb424ca4a68a0c172cbff1fdc79fd91b diff --git a/components/bt/include/esp_bt.h b/components/bt/include/esp_bt.h index 9ade0cb802..550b22d8c4 100644 --- a/components/bt/include/esp_bt.h +++ b/components/bt/include/esp_bt.h @@ -117,6 +117,8 @@ the adv packet will be discarded until the memory is restored. */ #define BTDM_CTRL_AUTO_LATENCY_EFF false #endif +#define BTDM_CTRL_HLI false + #ifdef CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF #define BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF #else @@ -151,6 +153,7 @@ the adv packet will be discarded until the memory is restored. */ .ble_sca = CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF, \ .pcm_role = CONFIG_BTDM_CTRL_PCM_ROLE_EFF, \ .pcm_polar = CONFIG_BTDM_CTRL_PCM_POLAR_EFF, \ + .hli = BTDM_CTRL_HLI, \ .magic = ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL, \ }; @@ -192,6 +195,7 @@ typedef struct { uint8_t ble_sca; /*!< BLE low power crystal accuracy index */ uint8_t pcm_role; /*!< PCM role (master & slave)*/ uint8_t pcm_polar; /*!< PCM polar trig (falling clk edge & rising clk edge) */ + bool hli; /*!< Using high level interrupt or not */ uint32_t magic; /*!< Magic number */ } esp_bt_controller_config_t;