mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 21:24:32 +02:00
components/bt: add config option to choose Bluetooth intterupt level.
This commit is contained in:
@@ -415,3 +415,10 @@ config BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD
|
|||||||
of ADV packets lost in the controller reaches this threshold. It is better to set a larger value.
|
of ADV packets lost in the controller reaches this threshold. It is better to set a larger value.
|
||||||
If you set `BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD` to a small value or printf every adv lost event, it
|
If you set `BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD` to a small value or printf every adv lost event, it
|
||||||
may cause adv packets lost more.
|
may cause adv packets lost more.
|
||||||
|
|
||||||
|
config BTDM_CTRL_HLI
|
||||||
|
bool "High level interrut"
|
||||||
|
depends on BT_ENABLED
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Using Level 4 interrupt for Bluetooth.
|
@@ -257,9 +257,11 @@ extern uint32_t _btdm_data_end;
|
|||||||
/* Local Function Declare
|
/* Local Function Declare
|
||||||
*********************************************************************
|
*********************************************************************
|
||||||
*/
|
*/
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
static xt_handler set_isr_hlevel_wrapper(int n, xt_handler f, void *arg);
|
static xt_handler set_isr_hlevel_wrapper(int n, xt_handler f, void *arg);
|
||||||
static void IRAM_ATTR interrupt_hlevel_disable(void);
|
static void IRAM_ATTR interrupt_hlevel_disable(void);
|
||||||
static void IRAM_ATTR interrupt_hlevel_restore(void);
|
static void IRAM_ATTR interrupt_hlevel_restore(void);
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
static void IRAM_ATTR task_yield(void);
|
static void IRAM_ATTR task_yield(void);
|
||||||
static void IRAM_ATTR task_yield_from_isr(void);
|
static void IRAM_ATTR task_yield_from_isr(void);
|
||||||
static void *semphr_create_wrapper(uint32_t max, uint32_t init);
|
static void *semphr_create_wrapper(uint32_t max, uint32_t init);
|
||||||
@@ -272,12 +274,21 @@ static void *mutex_create_wrapper(void);
|
|||||||
static void mutex_delete_wrapper(void *mutex);
|
static void mutex_delete_wrapper(void *mutex);
|
||||||
static int32_t mutex_lock_wrapper(void *mutex);
|
static int32_t mutex_lock_wrapper(void *mutex);
|
||||||
static int32_t mutex_unlock_wrapper(void *mutex);
|
static int32_t mutex_unlock_wrapper(void *mutex);
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
static void *queue_create_hlevel_wrapper(uint32_t queue_len, uint32_t item_size);
|
static void *queue_create_hlevel_wrapper(uint32_t queue_len, uint32_t item_size);
|
||||||
static void queue_delete_hlevel_wrapper(void *queue);
|
static void queue_delete_hlevel_wrapper(void *queue);
|
||||||
static int32_t IRAM_ATTR queue_send_hlevel_wrapper(void *queue, void *item, uint32_t block_time_ms);
|
static int32_t IRAM_ATTR queue_send_hlevel_wrapper(void *queue, void *item, uint32_t block_time_ms);
|
||||||
static int32_t IRAM_ATTR queue_send_from_isr_hlevel_wrapper(void *queue, void *item, void *hptw);
|
static int32_t IRAM_ATTR queue_send_from_isr_hlevel_wrapper(void *queue, void *item, void *hptw);
|
||||||
static int32_t IRAM_ATTR queue_recv_hlevel_wrapper(void *queue, void *item, uint32_t block_time_ms);
|
static int32_t IRAM_ATTR queue_recv_hlevel_wrapper(void *queue, void *item, uint32_t block_time_ms);
|
||||||
static int32_t IRAM_ATTR queue_recv_from_isr_hlevel_wrapper(void *queue, void *item, void *hptw);
|
static int32_t IRAM_ATTR queue_recv_from_isr_hlevel_wrapper(void *queue, void *item, void *hptw);
|
||||||
|
#else
|
||||||
|
static void *queue_create_wrapper(uint32_t queue_len, uint32_t item_size);
|
||||||
|
static void queue_delete_wrapper(void *queue);
|
||||||
|
static int32_t IRAM_ATTR queue_send_wrapper(void *queue, void *item, uint32_t block_time_ms);
|
||||||
|
static int32_t IRAM_ATTR queue_send_from_isr_wrapper(void *queue, void *item, void *hptw);
|
||||||
|
static int32_t IRAM_ATTR queue_recv_wrapper(void *queue, void *item, uint32_t block_time_ms);
|
||||||
|
static int32_t IRAM_ATTR queue_recv_from_isr_wrapper(void *queue, void *item, void *hptw);
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
static int32_t task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle, uint32_t core_id);
|
static int32_t task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle, uint32_t core_id);
|
||||||
static void task_delete_wrapper(void *task_handle);
|
static void task_delete_wrapper(void *task_handle);
|
||||||
static bool IRAM_ATTR is_in_isr_wrapper(void);
|
static bool IRAM_ATTR is_in_isr_wrapper(void);
|
||||||
@@ -308,7 +319,9 @@ static uint8_t coex_schm_curr_period_get_wrapper(void);
|
|||||||
static void * coex_schm_curr_phase_get_wrapper(void);
|
static void * coex_schm_curr_phase_get_wrapper(void);
|
||||||
static int coex_wifi_channel_get_wrapper(uint8_t *primary, uint8_t *secondary);
|
static int coex_wifi_channel_get_wrapper(uint8_t *primary, uint8_t *secondary);
|
||||||
static int coex_register_wifi_channel_change_callback_wrapper(void *cb);
|
static int coex_register_wifi_channel_change_callback_wrapper(void *cb);
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
static void *customer_queue_create_hlevel_wrapper(uint32_t queue_len, uint32_t item_size);
|
static void *customer_queue_create_hlevel_wrapper(uint32_t queue_len, uint32_t item_size);
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
static void IRAM_ATTR interrupt_l3_disable(void);
|
static void IRAM_ATTR interrupt_l3_disable(void);
|
||||||
static void IRAM_ATTR interrupt_l3_restore(void);
|
static void IRAM_ATTR interrupt_l3_restore(void);
|
||||||
|
|
||||||
@@ -318,10 +331,17 @@ static void IRAM_ATTR interrupt_l3_restore(void);
|
|||||||
/* OSI funcs */
|
/* OSI funcs */
|
||||||
static const struct osi_funcs_t osi_funcs_ro = {
|
static const struct osi_funcs_t osi_funcs_ro = {
|
||||||
._version = OSI_VERSION,
|
._version = OSI_VERSION,
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
._set_isr = set_isr_hlevel_wrapper,
|
._set_isr = set_isr_hlevel_wrapper,
|
||||||
._ints_on = xt_ints_on,
|
._ints_on = xt_ints_on,
|
||||||
._interrupt_disable = interrupt_hlevel_disable,
|
._interrupt_disable = interrupt_hlevel_disable,
|
||||||
._interrupt_restore = interrupt_hlevel_restore,
|
._interrupt_restore = interrupt_hlevel_restore,
|
||||||
|
#else
|
||||||
|
._set_isr = xt_set_interrupt_handler,
|
||||||
|
._ints_on = xt_ints_on,
|
||||||
|
._interrupt_disable = interrupt_l3_disable,
|
||||||
|
._interrupt_restore = interrupt_l3_restore,
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
._task_yield = task_yield,
|
._task_yield = task_yield,
|
||||||
._task_yield_from_isr = task_yield_from_isr,
|
._task_yield_from_isr = task_yield_from_isr,
|
||||||
._semphr_create = semphr_create_wrapper,
|
._semphr_create = semphr_create_wrapper,
|
||||||
@@ -334,12 +354,21 @@ static const struct osi_funcs_t osi_funcs_ro = {
|
|||||||
._mutex_delete = mutex_delete_wrapper,
|
._mutex_delete = mutex_delete_wrapper,
|
||||||
._mutex_lock = mutex_lock_wrapper,
|
._mutex_lock = mutex_lock_wrapper,
|
||||||
._mutex_unlock = mutex_unlock_wrapper,
|
._mutex_unlock = mutex_unlock_wrapper,
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
._queue_create = queue_create_hlevel_wrapper,
|
._queue_create = queue_create_hlevel_wrapper,
|
||||||
._queue_delete = queue_delete_hlevel_wrapper,
|
._queue_delete = queue_delete_hlevel_wrapper,
|
||||||
._queue_send = queue_send_hlevel_wrapper,
|
._queue_send = queue_send_hlevel_wrapper,
|
||||||
._queue_send_from_isr = queue_send_from_isr_hlevel_wrapper,
|
._queue_send_from_isr = queue_send_from_isr_hlevel_wrapper,
|
||||||
._queue_recv = queue_recv_hlevel_wrapper,
|
._queue_recv = queue_recv_hlevel_wrapper,
|
||||||
._queue_recv_from_isr = queue_recv_from_isr_hlevel_wrapper,
|
._queue_recv_from_isr = queue_recv_from_isr_hlevel_wrapper,
|
||||||
|
#else
|
||||||
|
._queue_create = queue_create_wrapper,
|
||||||
|
._queue_delete = queue_delete_wrapper,
|
||||||
|
._queue_send = queue_send_wrapper,
|
||||||
|
._queue_send_from_isr = queue_send_from_isr_wrapper,
|
||||||
|
._queue_recv = queue_recv_wrapper,
|
||||||
|
._queue_recv_from_isr = queue_recv_from_isr_wrapper,
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
._task_create = task_create_wrapper,
|
._task_create = task_create_wrapper,
|
||||||
._task_delete = task_delete_wrapper,
|
._task_delete = task_delete_wrapper,
|
||||||
._is_in_isr = is_in_isr_wrapper,
|
._is_in_isr = is_in_isr_wrapper,
|
||||||
@@ -376,7 +405,11 @@ static const struct osi_funcs_t osi_funcs_ro = {
|
|||||||
._set_isr_l3 = xt_set_interrupt_handler,
|
._set_isr_l3 = xt_set_interrupt_handler,
|
||||||
._interrupt_l3_disable = interrupt_l3_disable,
|
._interrupt_l3_disable = interrupt_l3_disable,
|
||||||
._interrupt_l3_restore = interrupt_l3_restore,
|
._interrupt_l3_restore = interrupt_l3_restore,
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
._customer_queue_create = customer_queue_create_hlevel_wrapper,
|
._customer_queue_create = customer_queue_create_hlevel_wrapper,
|
||||||
|
#else
|
||||||
|
._customer_queue_create = NULL,
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
._magic = OSI_MAGIC_VALUE,
|
._magic = OSI_MAGIC_VALUE,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -442,6 +475,7 @@ static inline void btdm_check_and_init_bb(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
struct interrupt_hlevel_cb{
|
struct interrupt_hlevel_cb{
|
||||||
uint32_t status;
|
uint32_t status;
|
||||||
uint8_t nested;
|
uint8_t nested;
|
||||||
@@ -479,6 +513,7 @@ static void IRAM_ATTR interrupt_hlevel_restore(void)
|
|||||||
hli_intr_restore(hli_cb.status);
|
hli_intr_restore(hli_cb.status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
|
|
||||||
static void IRAM_ATTR interrupt_l3_disable(void)
|
static void IRAM_ATTR interrupt_l3_disable(void)
|
||||||
{
|
{
|
||||||
@@ -511,48 +546,76 @@ static void IRAM_ATTR task_yield_from_isr(void)
|
|||||||
|
|
||||||
static void *semphr_create_wrapper(uint32_t max, uint32_t init)
|
static void *semphr_create_wrapper(uint32_t max, uint32_t init)
|
||||||
{
|
{
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
SemaphoreHandle_t downstream_semaphore = xSemaphoreCreateCounting(max, init);
|
SemaphoreHandle_t downstream_semaphore = xSemaphoreCreateCounting(max, init);
|
||||||
assert(downstream_semaphore);
|
assert(downstream_semaphore);
|
||||||
hli_queue_handle_t s_semaphore = hli_semaphore_create(max, downstream_semaphore);
|
hli_queue_handle_t s_semaphore = hli_semaphore_create(max, downstream_semaphore);
|
||||||
assert(downstream_semaphore);
|
assert(downstream_semaphore);
|
||||||
return s_semaphore;
|
return s_semaphore;
|
||||||
|
#else
|
||||||
|
return (void *)xSemaphoreCreateCounting(max, init);
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void semphr_delete_wrapper(void *semphr)
|
static void semphr_delete_wrapper(void *semphr)
|
||||||
{
|
{
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
if (((hli_queue_handle_t)semphr)->downstream != NULL) {
|
if (((hli_queue_handle_t)semphr)->downstream != NULL) {
|
||||||
vSemaphoreDelete(((hli_queue_handle_t)semphr)->downstream);
|
vSemaphoreDelete(((hli_queue_handle_t)semphr)->downstream);
|
||||||
}
|
}
|
||||||
|
|
||||||
hli_queue_delete(semphr);
|
hli_queue_delete(semphr);
|
||||||
|
#else
|
||||||
|
vSemaphoreDelete(semphr);
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t IRAM_ATTR semphr_take_from_isr_wrapper(void *semphr, void *hptw)
|
static int32_t IRAM_ATTR semphr_take_from_isr_wrapper(void *semphr, void *hptw)
|
||||||
{
|
{
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
return (int32_t)xSemaphoreTakeFromISR(((hli_queue_handle_t)semphr)->downstream, hptw);
|
return (int32_t)xSemaphoreTakeFromISR(((hli_queue_handle_t)semphr)->downstream, hptw);
|
||||||
|
#else
|
||||||
|
return (int32_t)xSemaphoreTakeFromISR(semphr, hptw);
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t IRAM_ATTR semphr_give_from_isr_wrapper(void *semphr, void *hptw)
|
static int32_t IRAM_ATTR semphr_give_from_isr_wrapper(void *semphr, void *hptw)
|
||||||
{
|
{
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
UNUSED(hptw);
|
UNUSED(hptw);
|
||||||
assert(xPortGetCoreID() == CONFIG_BTDM_CTRL_PINNED_TO_CORE);
|
assert(xPortGetCoreID() == CONFIG_BTDM_CTRL_PINNED_TO_CORE);
|
||||||
return hli_semaphore_give(semphr);
|
return hli_semaphore_give(semphr);
|
||||||
|
#else
|
||||||
|
return (int32_t)xSemaphoreGiveFromISR(semphr, hptw);
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t semphr_take_wrapper(void *semphr, uint32_t block_time_ms)
|
static int32_t semphr_take_wrapper(void *semphr, uint32_t block_time_ms)
|
||||||
{
|
{
|
||||||
bool ret;
|
bool ret;
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
if (block_time_ms == OSI_FUNCS_TIME_BLOCKING) {
|
if (block_time_ms == OSI_FUNCS_TIME_BLOCKING) {
|
||||||
ret = xSemaphoreTake(((hli_queue_handle_t)semphr)->downstream, portMAX_DELAY);
|
ret = xSemaphoreTake(((hli_queue_handle_t)semphr)->downstream, portMAX_DELAY);
|
||||||
} else {
|
} else {
|
||||||
ret = xSemaphoreTake(((hli_queue_handle_t)semphr)->downstream, block_time_ms / portTICK_PERIOD_MS);
|
ret = xSemaphoreTake(((hli_queue_handle_t)semphr)->downstream, block_time_ms / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (block_time_ms == OSI_FUNCS_TIME_BLOCKING) {
|
||||||
|
ret = xSemaphoreTake(semphr, portMAX_DELAY);
|
||||||
|
} else {
|
||||||
|
ret = xSemaphoreTake(semphr, block_time_ms / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
return (int32_t)ret;
|
return (int32_t)ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t semphr_give_wrapper(void *semphr)
|
static int32_t semphr_give_wrapper(void *semphr)
|
||||||
{
|
{
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
return (int32_t)xSemaphoreGive(((hli_queue_handle_t)semphr)->downstream);
|
return (int32_t)xSemaphoreGive(((hli_queue_handle_t)semphr)->downstream);
|
||||||
|
#else
|
||||||
|
return (int32_t)xSemaphoreGive(semphr);
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *mutex_create_wrapper(void)
|
static void *mutex_create_wrapper(void)
|
||||||
@@ -575,6 +638,7 @@ static int32_t mutex_unlock_wrapper(void *mutex)
|
|||||||
return (int32_t)xSemaphoreGive(mutex);
|
return (int32_t)xSemaphoreGive(mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
static void *queue_create_hlevel_wrapper(uint32_t queue_len, uint32_t item_size)
|
static void *queue_create_hlevel_wrapper(uint32_t queue_len, uint32_t item_size)
|
||||||
{
|
{
|
||||||
QueueHandle_t downstream_queue = xQueueCreate(queue_len, item_size);
|
QueueHandle_t downstream_queue = xQueueCreate(queue_len, item_size);
|
||||||
@@ -632,12 +696,12 @@ static int32_t queue_recv_hlevel_wrapper(void *queue, void *item, uint32_t block
|
|||||||
{
|
{
|
||||||
bool ret;
|
bool ret;
|
||||||
if (block_time_ms == OSI_FUNCS_TIME_BLOCKING) {
|
if (block_time_ms == OSI_FUNCS_TIME_BLOCKING) {
|
||||||
ret = (int32_t)xQueueReceive(((hli_queue_handle_t)queue)->downstream, item, portMAX_DELAY);
|
ret = xQueueReceive(((hli_queue_handle_t)queue)->downstream, item, portMAX_DELAY);
|
||||||
} else {
|
} else {
|
||||||
ret =(int32_t)xQueueReceive(((hli_queue_handle_t)queue)->downstream, item, block_time_ms / portTICK_PERIOD_MS);
|
ret =xQueueReceive(((hli_queue_handle_t)queue)->downstream, item, block_time_ms / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return (int32_t)ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t IRAM_ATTR queue_recv_from_isr_hlevel_wrapper(void *queue, void *item, void *hptw)
|
static int32_t IRAM_ATTR queue_recv_from_isr_hlevel_wrapper(void *queue, void *item, void *hptw)
|
||||||
@@ -645,6 +709,51 @@ static int32_t IRAM_ATTR queue_recv_from_isr_hlevel_wrapper(void *queue, void *i
|
|||||||
return (int32_t)xQueueReceiveFromISR(((hli_queue_handle_t)queue)->downstream, item, hptw);
|
return (int32_t)xQueueReceiveFromISR(((hli_queue_handle_t)queue)->downstream, item, hptw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
static void *queue_create_wrapper(uint32_t queue_len, uint32_t item_size)
|
||||||
|
{
|
||||||
|
return (void *)xQueueCreate(queue_len, item_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void queue_delete_wrapper(void *queue)
|
||||||
|
{
|
||||||
|
vQueueDelete(queue);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t queue_send_wrapper(void *queue, void *item, uint32_t block_time_ms)
|
||||||
|
{
|
||||||
|
if (block_time_ms == OSI_FUNCS_TIME_BLOCKING) {
|
||||||
|
return (int32_t)xQueueSend(queue, item, portMAX_DELAY);
|
||||||
|
} else {
|
||||||
|
return (int32_t)xQueueSend(queue, item, block_time_ms / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t IRAM_ATTR queue_send_from_isr_wrapper(void *queue, void *item, void *hptw)
|
||||||
|
{
|
||||||
|
return (int32_t)xQueueSendFromISR(queue, item, hptw);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t queue_recv_wrapper(void *queue, void *item, uint32_t block_time_ms)
|
||||||
|
{
|
||||||
|
bool ret;
|
||||||
|
if (block_time_ms == OSI_FUNCS_TIME_BLOCKING) {
|
||||||
|
ret = xQueueReceive(queue, item, portMAX_DELAY);
|
||||||
|
} else {
|
||||||
|
ret = xQueueReceive(queue, item, block_time_ms / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int32_t)ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t IRAM_ATTR queue_recv_from_isr_wrapper(void *queue, void *item, void *hptw)
|
||||||
|
{
|
||||||
|
return (int32_t)xQueueReceiveFromISR(queue, item, hptw);
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
|
|
||||||
|
|
||||||
static int32_t task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle, uint32_t core_id)
|
static int32_t task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle, uint32_t core_id)
|
||||||
{
|
{
|
||||||
return (uint32_t)xTaskCreatePinnedToCore(task_func, name, stack_depth, param, prio, task_handle, (core_id < portNUM_PROCESSORS ? core_id : tskNO_AFFINITY));
|
return (uint32_t)xTaskCreatePinnedToCore(task_func, name, stack_depth, param, prio, task_handle, (core_id < portNUM_PROCESSORS ? core_id : tskNO_AFFINITY));
|
||||||
@@ -1189,6 +1298,7 @@ esp_err_t esp_bt_mem_release(esp_bt_mode_t mode)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
static void hli_queue_setup_cb(void* arg)
|
static void hli_queue_setup_cb(void* arg)
|
||||||
{
|
{
|
||||||
hli_queue_setup();
|
hli_queue_setup();
|
||||||
@@ -1206,13 +1316,16 @@ static void hli_queue_setup_pinned_to_core(int core_id)
|
|||||||
}
|
}
|
||||||
#endif /* !CONFIG_FREERTOS_UNICORE */
|
#endif /* !CONFIG_FREERTOS_UNICORE */
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
|
|
||||||
esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||||
{
|
{
|
||||||
esp_err_t err;
|
esp_err_t err;
|
||||||
uint32_t btdm_cfg_mask = 0;
|
uint32_t btdm_cfg_mask = 0;
|
||||||
|
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
hli_queue_setup_pinned_to_core(CONFIG_BTDM_CTRL_PINNED_TO_CORE);
|
hli_queue_setup_pinned_to_core(CONFIG_BTDM_CTRL_PINNED_TO_CORE);
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
|
|
||||||
//if all the bt available memory was already released, cannot initialize bluetooth controller
|
//if all the bt available memory was already released, cannot initialize bluetooth controller
|
||||||
if (btdm_dram_available_region[0].mode == ESP_BT_MODE_IDLE) {
|
if (btdm_dram_available_region[0].mode == ESP_BT_MODE_IDLE) {
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/queue.h"
|
#include "freertos/queue.h"
|
||||||
|
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
#define HLI_MAX_HANDLERS 4
|
#define HLI_MAX_HANDLERS 4
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -292,3 +292,5 @@ bool IRAM_ATTR hli_semaphore_give(hli_queue_handle_t queue)
|
|||||||
uint8_t data = 0;
|
uint8_t data = 0;
|
||||||
return hli_queue_put(queue, &data);
|
return hli_queue_put(queue, &data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
|
@@ -14,6 +14,8 @@ extern "C" {
|
|||||||
#include "freertos/queue.h"
|
#include "freertos/queue.h"
|
||||||
#include "freertos/semphr.h"
|
#include "freertos/semphr.h"
|
||||||
|
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
|
|
||||||
/*** Queues ***/
|
/*** Queues ***/
|
||||||
|
|
||||||
struct hli_queue_t
|
struct hli_queue_t
|
||||||
@@ -155,6 +157,8 @@ bool hli_queue_put(hli_queue_handle_t queue, const void* data);
|
|||||||
*/
|
*/
|
||||||
bool hli_semaphore_give(hli_queue_handle_t queue);
|
bool hli_semaphore_give(hli_queue_handle_t queue);
|
||||||
|
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -8,6 +8,8 @@
|
|||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "soc/soc.h"
|
#include "soc/soc.h"
|
||||||
|
|
||||||
|
#if CONFIG_BTDM_CTRL_HLI
|
||||||
|
|
||||||
/* Interrupt stack size, for C code.
|
/* Interrupt stack size, for C code.
|
||||||
* TODO: reduce and make configurable.
|
* TODO: reduce and make configurable.
|
||||||
*/
|
*/
|
||||||
@@ -250,6 +252,8 @@ _highint4_stack_switch:
|
|||||||
/* Return from the interrupt, restoring PS from EPS_4 */
|
/* Return from the interrupt, restoring PS from EPS_4 */
|
||||||
rfi 4
|
rfi 4
|
||||||
|
|
||||||
|
#endif /* CONFIG_BTDM_CTRL_HLI */
|
||||||
|
|
||||||
/* The linker has no reason to link in this file; all symbols it exports are already defined
|
/* The linker has no reason to link in this file; all symbols it exports are already defined
|
||||||
(weakly!) in the default int handler. Define a symbol here so we can use it to have the
|
(weakly!) in the default int handler. Define a symbol here so we can use it to have the
|
||||||
linker inspect this anyway. */
|
linker inspect this anyway. */
|
||||||
|
Submodule components/bt/controller/lib_esp32 updated: c9748123de...cfbb0571fb
@@ -149,6 +149,12 @@ the adv packet will be discarded until the memory is restored. */
|
|||||||
#define BTDM_CTRL_AUTO_LATENCY_EFF false
|
#define BTDM_CTRL_AUTO_LATENCY_EFF false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_BTDM_CTRL_HLI
|
||||||
|
#define BTDM_CTRL_HLI CONFIG_BTDM_CTRL_HLI
|
||||||
|
#else
|
||||||
|
#define BTDM_CTRL_HLI false
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF
|
#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
|
#define BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF CONFIG_BTDM_CTRL_LEGACY_AUTH_VENDOR_EVT_EFF
|
||||||
#else
|
#else
|
||||||
@@ -183,6 +189,7 @@ the adv packet will be discarded until the memory is restored. */
|
|||||||
.ble_sca = CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF, \
|
.ble_sca = CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF, \
|
||||||
.pcm_role = CONFIG_BTDM_CTRL_PCM_ROLE_EFF, \
|
.pcm_role = CONFIG_BTDM_CTRL_PCM_ROLE_EFF, \
|
||||||
.pcm_polar = CONFIG_BTDM_CTRL_PCM_POLAR_EFF, \
|
.pcm_polar = CONFIG_BTDM_CTRL_PCM_POLAR_EFF, \
|
||||||
|
.hli = BTDM_CTRL_HLI, \
|
||||||
.magic = ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL, \
|
.magic = ESP_BT_CONTROLLER_CONFIG_MAGIC_VAL, \
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -224,6 +231,7 @@ typedef struct {
|
|||||||
uint8_t ble_sca; /*!< BLE low power crystal accuracy index */
|
uint8_t ble_sca; /*!< BLE low power crystal accuracy index */
|
||||||
uint8_t pcm_role; /*!< PCM role (master & slave)*/
|
uint8_t pcm_role; /*!< PCM role (master & slave)*/
|
||||||
uint8_t pcm_polar; /*!< PCM polar trig (falling clk edge & rising clk edge) */
|
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 */
|
uint32_t magic; /*!< Magic number */
|
||||||
} esp_bt_controller_config_t;
|
} esp_bt_controller_config_t;
|
||||||
|
|
||||||
|
@@ -475,6 +475,7 @@ menu "ESP System Settings"
|
|||||||
|
|
||||||
config ESP_SYSTEM_CHECK_INT_LEVEL_4
|
config ESP_SYSTEM_CHECK_INT_LEVEL_4
|
||||||
bool "Level 4 interrupt"
|
bool "Level 4 interrupt"
|
||||||
|
depends on !BTDM_CTRL_HLI
|
||||||
help
|
help
|
||||||
Using level 4 interrupt for Interrupt Watchdog and other system checks.
|
Using level 4 interrupt for Interrupt Watchdog and other system checks.
|
||||||
endchoice
|
endchoice
|
||||||
|
@@ -118,7 +118,7 @@ void esp_int_wdt_init(void)
|
|||||||
wdt_hal_write_protect_enable(&iwdt_context);
|
wdt_hal_write_protect_enable(&iwdt_context);
|
||||||
|
|
||||||
|
|
||||||
#if (CONFIG_ESP32_ECO3_CACHE_LOCK_FIX && CONFIG_BT_ENABLED)
|
#if (CONFIG_ESP32_ECO3_CACHE_LOCK_FIX && CONFIG_BTDM_CTRL_HLI)
|
||||||
|
|
||||||
#define APB_DCRSET (0x200c)
|
#define APB_DCRSET (0x200c)
|
||||||
#define APB_ITCTRL (0x3f00)
|
#define APB_ITCTRL (0x3f00)
|
||||||
|
@@ -32,7 +32,7 @@ The default behaviour is to just exit the interrupt or call the panic handler on
|
|||||||
.align 4
|
.align 4
|
||||||
|
|
||||||
_xt_debugexception:
|
_xt_debugexception:
|
||||||
#if (CONFIG_ESP32_ECO3_CACHE_LOCK_FIX && CONFIG_BT_ENABLED)
|
#if (CONFIG_ESP32_ECO3_CACHE_LOCK_FIX && CONFIG_BTDM_CTRL_HLI)
|
||||||
#define XT_DEBUGCAUSE_DI (5)
|
#define XT_DEBUGCAUSE_DI (5)
|
||||||
getcoreid a0
|
getcoreid a0
|
||||||
#if (CONFIG_BTDM_CTRL_PINNED_TO_CORE == PRO_CPU_NUM)
|
#if (CONFIG_BTDM_CTRL_PINNED_TO_CORE == PRO_CPU_NUM)
|
||||||
@@ -45,7 +45,7 @@ _xt_debugexception:
|
|||||||
extui a0, a0, XT_DEBUGCAUSE_DI, 1
|
extui a0, a0, XT_DEBUGCAUSE_DI, 1
|
||||||
bnez a0, _xt_debug_di_exc
|
bnez a0, _xt_debug_di_exc
|
||||||
1:
|
1:
|
||||||
#endif //(CONFIG_ESP32_ECO3_CACHE_LOCK_FIX && CONFIG_BT_ENABLED)
|
#endif //(CONFIG_ESP32_ECO3_CACHE_LOCK_FIX && CONFIG_BTDM_CTRL_HLI)
|
||||||
|
|
||||||
movi a0,PANIC_RSN_DEBUGEXCEPTION
|
movi a0,PANIC_RSN_DEBUGEXCEPTION
|
||||||
wsr a0,EXCCAUSE
|
wsr a0,EXCCAUSE
|
||||||
@@ -59,7 +59,7 @@ _xt_debugexception:
|
|||||||
call0 _xt_panic /* does not return */
|
call0 _xt_panic /* does not return */
|
||||||
rfi XCHAL_DEBUGLEVEL
|
rfi XCHAL_DEBUGLEVEL
|
||||||
|
|
||||||
#if (CONFIG_ESP32_ECO3_CACHE_LOCK_FIX && CONFIG_BT_ENABLED)
|
#if (CONFIG_ESP32_ECO3_CACHE_LOCK_FIX && CONFIG_BTDM_CTRL_HLI)
|
||||||
.align 4
|
.align 4
|
||||||
_xt_debug_di_exc:
|
_xt_debug_di_exc:
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ _xt_debug_di_exc:
|
|||||||
|
|
||||||
rsr a0, EXCSAVE+XCHAL_DEBUGLEVEL
|
rsr a0, EXCSAVE+XCHAL_DEBUGLEVEL
|
||||||
rfi XCHAL_DEBUGLEVEL
|
rfi XCHAL_DEBUGLEVEL
|
||||||
#endif //(CONFIG_ESP32_ECO3_CACHE_LOCK_FIX && CONFIG_BT_ENABLED)
|
#endif //(CONFIG_ESP32_ECO3_CACHE_LOCK_FIX && CONFIG_BTDM_CTRL_HLI)
|
||||||
#endif /* Debug exception */
|
#endif /* Debug exception */
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user