mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
feat(coex): support GPIO debug
This commit is contained in:
@ -19,7 +19,9 @@ if(CONFIG_ESP_COEX_ENABLED)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CONFIG_ESP_WIFI_ENABLED)
|
if(CONFIG_ESP_WIFI_ENABLED)
|
||||||
list(APPEND srcs "${idf_target}/esp_coex_adapter.c")
|
list(APPEND srcs "${idf_target}/esp_coex_adapter.c"
|
||||||
|
"src/coexist_debug_diagram.c"
|
||||||
|
"src/coexist_debug.c")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -40,4 +40,201 @@ menu "Wireless Coexistence"
|
|||||||
If enabled, coexist power management will be enabled.
|
If enabled, coexist power management will be enabled.
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
config ESP_COEX_GPIO_DEBUG
|
||||||
|
bool "GPIO debugging for coexistence"
|
||||||
|
default n
|
||||||
|
depends on !PM_SLP_DISABLE_GPIO && !PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
|
||||||
|
help
|
||||||
|
Support coexistence GPIO debugging
|
||||||
|
|
||||||
|
if (ESP_COEX_GPIO_DEBUG)
|
||||||
|
|
||||||
|
choice ESP_COEX_GPIO_DEBUG_DIAG
|
||||||
|
prompt "Debugging Diagram"
|
||||||
|
default ESP_COEX_GPIO_DEBUG_DIAG_GENERAL
|
||||||
|
help
|
||||||
|
Select type of debugging diagram
|
||||||
|
|
||||||
|
config ESP_COEX_GPIO_DEBUG_DIAG_GENERAL
|
||||||
|
bool "General"
|
||||||
|
config ESP_COEX_GPIO_DEBUG_DIAG_WIFI
|
||||||
|
bool "Wi-Fi"
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config ESP_COEX_GPIO_DEBUG_IO_COUNT
|
||||||
|
int "Max number of debugging GPIOs"
|
||||||
|
range 0 12
|
||||||
|
default 12
|
||||||
|
|
||||||
|
config ESP_COEX_GPIO_DEBUG_IO_IDX0
|
||||||
|
depends on (ESP_COEX_GPIO_DEBUG_IO_COUNT > 0)
|
||||||
|
int "Actual IO num for Debug IO ID0"
|
||||||
|
range 0 SOC_GPIO_OUT_RANGE_MAX
|
||||||
|
default 15 if IDF_TARGET_ESP32
|
||||||
|
default 4 if IDF_TARGET_ESP32S2
|
||||||
|
default 19 if IDF_TARGET_ESP32C3
|
||||||
|
default 4 if IDF_TARGET_ESP32S3
|
||||||
|
default 18 if IDF_TARGET_ESP32C2
|
||||||
|
default 4 if IDF_TARGET_ESP32C6
|
||||||
|
default 2 if IDF_TARGET_ESP32C5
|
||||||
|
default 4 if IDF_TARGET_ESP32C61
|
||||||
|
default 1
|
||||||
|
|
||||||
|
config ESP_COEX_GPIO_DEBUG_IO_IDX1
|
||||||
|
depends on (ESP_COEX_GPIO_DEBUG_IO_COUNT > 1)
|
||||||
|
int "Actual IO num for Debug IO ID1"
|
||||||
|
range 0 SOC_GPIO_OUT_RANGE_MAX
|
||||||
|
default 2 if IDF_TARGET_ESP32
|
||||||
|
default 5 if IDF_TARGET_ESP32S2
|
||||||
|
default 18 if IDF_TARGET_ESP32C3
|
||||||
|
default 5 if IDF_TARGET_ESP32S3
|
||||||
|
default 4 if IDF_TARGET_ESP32C2
|
||||||
|
default 5 if IDF_TARGET_ESP32C6
|
||||||
|
default 3 if IDF_TARGET_ESP32C5
|
||||||
|
default 5 if IDF_TARGET_ESP32C61
|
||||||
|
default 2
|
||||||
|
|
||||||
|
config ESP_COEX_GPIO_DEBUG_IO_IDX2
|
||||||
|
depends on (ESP_COEX_GPIO_DEBUG_IO_COUNT > 2)
|
||||||
|
int "Actual IO num for Debug IO ID2"
|
||||||
|
range 0 SOC_GPIO_OUT_RANGE_MAX
|
||||||
|
default 0 if IDF_TARGET_ESP32
|
||||||
|
default 6 if IDF_TARGET_ESP32S2
|
||||||
|
default 4 if IDF_TARGET_ESP32C3
|
||||||
|
default 6 if IDF_TARGET_ESP32S3
|
||||||
|
default 5 if IDF_TARGET_ESP32C2
|
||||||
|
default 6 if IDF_TARGET_ESP32C6
|
||||||
|
default 4 if IDF_TARGET_ESP32C5
|
||||||
|
default 6 if IDF_TARGET_ESP32C61
|
||||||
|
default 3
|
||||||
|
|
||||||
|
config ESP_COEX_GPIO_DEBUG_IO_IDX3
|
||||||
|
depends on (ESP_COEX_GPIO_DEBUG_IO_COUNT > 3)
|
||||||
|
int "Actual IO num for Debug IO ID3"
|
||||||
|
range 0 SOC_GPIO_OUT_RANGE_MAX
|
||||||
|
default 4 if IDF_TARGET_ESP32
|
||||||
|
default 7 if IDF_TARGET_ESP32S2
|
||||||
|
default 5 if IDF_TARGET_ESP32C3
|
||||||
|
default 7 if IDF_TARGET_ESP32S3
|
||||||
|
default 6 if IDF_TARGET_ESP32C2
|
||||||
|
default 7 if IDF_TARGET_ESP32C6
|
||||||
|
default 5 if IDF_TARGET_ESP32C5
|
||||||
|
default 7 if IDF_TARGET_ESP32C61
|
||||||
|
default 4
|
||||||
|
|
||||||
|
config ESP_COEX_GPIO_DEBUG_IO_IDX4
|
||||||
|
depends on (ESP_COEX_GPIO_DEBUG_IO_COUNT > 4)
|
||||||
|
int "Actual IO num for Debug IO ID4"
|
||||||
|
range 0 SOC_GPIO_OUT_RANGE_MAX
|
||||||
|
default 5 if IDF_TARGET_ESP32
|
||||||
|
default 8 if IDF_TARGET_ESP32S2
|
||||||
|
default 6 if IDF_TARGET_ESP32C3
|
||||||
|
default 15 if IDF_TARGET_ESP32S3
|
||||||
|
default 7 if IDF_TARGET_ESP32C2
|
||||||
|
default 8 if IDF_TARGET_ESP32C6
|
||||||
|
default 27 if IDF_TARGET_ESP32C5
|
||||||
|
default 0 if IDF_TARGET_ESP32C61
|
||||||
|
default 5
|
||||||
|
|
||||||
|
config ESP_COEX_GPIO_DEBUG_IO_IDX5
|
||||||
|
depends on (ESP_COEX_GPIO_DEBUG_IO_COUNT > 5)
|
||||||
|
int "Actual IO num for Debug IO ID5"
|
||||||
|
range 0 SOC_GPIO_OUT_RANGE_MAX
|
||||||
|
default 18 if IDF_TARGET_ESP32
|
||||||
|
default 9 if IDF_TARGET_ESP32S2
|
||||||
|
default 7 if IDF_TARGET_ESP32C3
|
||||||
|
default 16 if IDF_TARGET_ESP32S3
|
||||||
|
default 8 if IDF_TARGET_ESP32C2
|
||||||
|
default 10 if IDF_TARGET_ESP32C6
|
||||||
|
default 6 if IDF_TARGET_ESP32C5
|
||||||
|
default 1 if IDF_TARGET_ESP32C61
|
||||||
|
default 6
|
||||||
|
|
||||||
|
config ESP_COEX_GPIO_DEBUG_IO_IDX6
|
||||||
|
depends on (ESP_COEX_GPIO_DEBUG_IO_COUNT > 6)
|
||||||
|
int "Actual IO num for Debug IO ID6"
|
||||||
|
range 0 SOC_GPIO_OUT_RANGE_MAX
|
||||||
|
default 19 if IDF_TARGET_ESP32
|
||||||
|
default 10 if IDF_TARGET_ESP32S2
|
||||||
|
default 8 if IDF_TARGET_ESP32C3
|
||||||
|
default 17 if IDF_TARGET_ESP32S3
|
||||||
|
default 9 if IDF_TARGET_ESP32C2
|
||||||
|
default 11 if IDF_TARGET_ESP32C6
|
||||||
|
default 7 if IDF_TARGET_ESP32C5
|
||||||
|
default 8 if IDF_TARGET_ESP32C61
|
||||||
|
default 7
|
||||||
|
|
||||||
|
config ESP_COEX_GPIO_DEBUG_IO_IDX7
|
||||||
|
depends on (ESP_COEX_GPIO_DEBUG_IO_COUNT > 7)
|
||||||
|
int "Actual IO num for Debug IO ID7"
|
||||||
|
range 0 SOC_GPIO_OUT_RANGE_MAX
|
||||||
|
default 22 if IDF_TARGET_ESP32
|
||||||
|
default 11 if IDF_TARGET_ESP32S2
|
||||||
|
default 9 if IDF_TARGET_ESP32C3
|
||||||
|
default 18 if IDF_TARGET_ESP32S3
|
||||||
|
default 10 if IDF_TARGET_ESP32C2
|
||||||
|
default 2 if IDF_TARGET_ESP32C6
|
||||||
|
default 26 if IDF_TARGET_ESP32C5
|
||||||
|
default 2 if IDF_TARGET_ESP32C61
|
||||||
|
default 8
|
||||||
|
|
||||||
|
config ESP_COEX_GPIO_DEBUG_IO_IDX8
|
||||||
|
depends on (ESP_COEX_GPIO_DEBUG_IO_COUNT > 8)
|
||||||
|
int "Actual IO num for Debug IO ID8"
|
||||||
|
range 0 SOC_GPIO_OUT_RANGE_MAX
|
||||||
|
default 13 if IDF_TARGET_ESP32
|
||||||
|
default 12 if IDF_TARGET_ESP32S2
|
||||||
|
default 10 if IDF_TARGET_ESP32C3
|
||||||
|
default 10 if IDF_TARGET_ESP32S3
|
||||||
|
default 1 if IDF_TARGET_ESP32C2
|
||||||
|
default 15 if IDF_TARGET_ESP32C6
|
||||||
|
default 24 if IDF_TARGET_ESP32C5
|
||||||
|
default 3 if IDF_TARGET_ESP32C61
|
||||||
|
default 9
|
||||||
|
|
||||||
|
config ESP_COEX_GPIO_DEBUG_IO_IDX9
|
||||||
|
depends on (ESP_COEX_GPIO_DEBUG_IO_COUNT > 9)
|
||||||
|
int "Actual IO num for Debug IO ID9"
|
||||||
|
range 0 SOC_GPIO_OUT_RANGE_MAX
|
||||||
|
default 12 if IDF_TARGET_ESP32
|
||||||
|
default 13 if IDF_TARGET_ESP32S2
|
||||||
|
default 0 if IDF_TARGET_ESP32C3
|
||||||
|
default 11 if IDF_TARGET_ESP32S3
|
||||||
|
default 0 if IDF_TARGET_ESP32C2
|
||||||
|
default 23 if IDF_TARGET_ESP32C6
|
||||||
|
default 23 if IDF_TARGET_ESP32C5
|
||||||
|
default 9 if IDF_TARGET_ESP32C61
|
||||||
|
default 10
|
||||||
|
|
||||||
|
config ESP_COEX_GPIO_DEBUG_IO_IDX10
|
||||||
|
depends on (ESP_COEX_GPIO_DEBUG_IO_COUNT > 10)
|
||||||
|
int "Actual IO num for Debug IO ID10"
|
||||||
|
range 0 SOC_GPIO_OUT_RANGE_MAX
|
||||||
|
default 14 if IDF_TARGET_ESP32
|
||||||
|
default 14 if IDF_TARGET_ESP32S2
|
||||||
|
default 3 if IDF_TARGET_ESP32C3
|
||||||
|
default 12 if IDF_TARGET_ESP32S3
|
||||||
|
default 3 if IDF_TARGET_ESP32C2
|
||||||
|
default 22 if IDF_TARGET_ESP32C6
|
||||||
|
default 16 if IDF_TARGET_ESP32C5
|
||||||
|
default 13 if IDF_TARGET_ESP32C61
|
||||||
|
default 11
|
||||||
|
|
||||||
|
config ESP_COEX_GPIO_DEBUG_IO_IDX11
|
||||||
|
depends on (ESP_COEX_GPIO_DEBUG_IO_COUNT > 11)
|
||||||
|
int "Actual IO num for Debug IO ID11"
|
||||||
|
range 0 SOC_GPIO_OUT_RANGE_MAX
|
||||||
|
default 27 if IDF_TARGET_ESP32
|
||||||
|
default 15 if IDF_TARGET_ESP32S2
|
||||||
|
default 2 if IDF_TARGET_ESP32C3
|
||||||
|
default 13 if IDF_TARGET_ESP32S3
|
||||||
|
default 2 if IDF_TARGET_ESP32C2
|
||||||
|
default 21 if IDF_TARGET_ESP32C6
|
||||||
|
default 0 if IDF_TARGET_ESP32C5
|
||||||
|
default 12 if IDF_TARGET_ESP32C61
|
||||||
|
default 12
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
endmenu # Wireless Coexistence
|
endmenu # Wireless Coexistence
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -20,6 +20,7 @@
|
|||||||
#include "esp_timer.h"
|
#include "esp_timer.h"
|
||||||
#include "private/esp_coexist_adapter.h"
|
#include "private/esp_coexist_adapter.h"
|
||||||
#include "esp32/rom/ets_sys.h"
|
#include "esp32/rom/ets_sys.h"
|
||||||
|
#include "private/esp_coexist_debug.h"
|
||||||
|
|
||||||
#define TAG "esp_coex_adapter"
|
#define TAG "esp_coex_adapter"
|
||||||
|
|
||||||
@ -206,6 +207,15 @@ static int32_t esp_coex_internal_semphr_give_wrapper(void *semphr)
|
|||||||
return (int32_t)xSemaphoreGive(((modem_static_queue_t *)semphr)->handle);
|
return (int32_t)xSemaphoreGive(((modem_static_queue_t *)semphr)->handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int esp_coexist_debug_matrix_init_wrapper(int evt, int sig, bool rev)
|
||||||
|
{
|
||||||
|
#if CONFIG_ESP_COEX_GPIO_DEBUG
|
||||||
|
return esp_coexist_debug_matrix_init(evt, sig, rev);
|
||||||
|
#else
|
||||||
|
return ESP_ERR_NOT_SUPPORTED;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
coex_adapter_funcs_t g_coex_adapter_funcs = {
|
coex_adapter_funcs_t g_coex_adapter_funcs = {
|
||||||
._version = COEX_ADAPTER_VERSION,
|
._version = COEX_ADAPTER_VERSION,
|
||||||
._spin_lock_create = esp_coex_common_spin_lock_create_wrapper,
|
._spin_lock_create = esp_coex_common_spin_lock_create_wrapper,
|
||||||
@ -227,5 +237,6 @@ coex_adapter_funcs_t g_coex_adapter_funcs = {
|
|||||||
._timer_done = esp_coex_common_timer_done_wrapper,
|
._timer_done = esp_coex_common_timer_done_wrapper,
|
||||||
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
|
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
|
||||||
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
|
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
|
||||||
|
._debug_matrix_init = esp_coexist_debug_matrix_init_wrapper,
|
||||||
._magic = COEX_ADAPTER_MAGIC,
|
._magic = COEX_ADAPTER_MAGIC,
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -22,6 +22,7 @@
|
|||||||
#include "esp_private/esp_clk.h"
|
#include "esp_private/esp_clk.h"
|
||||||
#include "private/esp_coexist_adapter.h"
|
#include "private/esp_coexist_adapter.h"
|
||||||
#include "esp32c2/rom/ets_sys.h"
|
#include "esp32c2/rom/ets_sys.h"
|
||||||
|
#include "private/esp_coexist_debug.h"
|
||||||
|
|
||||||
#define TAG "esp_coex_adapter"
|
#define TAG "esp_coex_adapter"
|
||||||
|
|
||||||
@ -142,6 +143,15 @@ static int32_t IRAM_ATTR esp_coex_semphr_give_from_isr_wrapper(void *semphr, voi
|
|||||||
return (int32_t)xSemaphoreGiveFromISR(semphr, hptw);
|
return (int32_t)xSemaphoreGiveFromISR(semphr, hptw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int esp_coexist_debug_matrix_init_wrapper(int evt, int sig, bool rev)
|
||||||
|
{
|
||||||
|
#if CONFIG_ESP_COEX_GPIO_DEBUG
|
||||||
|
return esp_coexist_debug_matrix_init(evt, sig, rev);
|
||||||
|
#else
|
||||||
|
return ESP_ERR_NOT_SUPPORTED;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
coex_adapter_funcs_t g_coex_adapter_funcs = {
|
coex_adapter_funcs_t g_coex_adapter_funcs = {
|
||||||
._version = COEX_ADAPTER_VERSION,
|
._version = COEX_ADAPTER_VERSION,
|
||||||
._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper,
|
._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper,
|
||||||
@ -161,5 +171,6 @@ coex_adapter_funcs_t g_coex_adapter_funcs = {
|
|||||||
._timer_done = esp_coex_common_timer_done_wrapper,
|
._timer_done = esp_coex_common_timer_done_wrapper,
|
||||||
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
|
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
|
||||||
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
|
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
|
||||||
|
._debug_matrix_init = esp_coexist_debug_matrix_init_wrapper,
|
||||||
._magic = COEX_ADAPTER_MAGIC,
|
._magic = COEX_ADAPTER_MAGIC,
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -23,6 +23,7 @@
|
|||||||
#include "private/esp_coexist_adapter.h"
|
#include "private/esp_coexist_adapter.h"
|
||||||
#include "esp32c3/rom/ets_sys.h"
|
#include "esp32c3/rom/ets_sys.h"
|
||||||
#include "soc/system_reg.h"
|
#include "soc/system_reg.h"
|
||||||
|
#include "private/esp_coexist_debug.h"
|
||||||
|
|
||||||
#define TAG "esp_coex_adapter"
|
#define TAG "esp_coex_adapter"
|
||||||
|
|
||||||
@ -148,6 +149,15 @@ static int32_t IRAM_ATTR esp_coex_semphr_give_from_isr_wrapper(void *semphr, voi
|
|||||||
return (int32_t)xSemaphoreGiveFromISR(semphr, hptw);
|
return (int32_t)xSemaphoreGiveFromISR(semphr, hptw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int esp_coexist_debug_matrix_init_wrapper(int evt, int sig, bool rev)
|
||||||
|
{
|
||||||
|
#if CONFIG_ESP_COEX_GPIO_DEBUG
|
||||||
|
return esp_coexist_debug_matrix_init(evt, sig, rev);
|
||||||
|
#else
|
||||||
|
return ESP_ERR_NOT_SUPPORTED;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
coex_adapter_funcs_t g_coex_adapter_funcs = {
|
coex_adapter_funcs_t g_coex_adapter_funcs = {
|
||||||
._version = COEX_ADAPTER_VERSION,
|
._version = COEX_ADAPTER_VERSION,
|
||||||
._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper,
|
._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper,
|
||||||
@ -165,5 +175,6 @@ coex_adapter_funcs_t g_coex_adapter_funcs = {
|
|||||||
._timer_done = esp_coex_common_timer_done_wrapper,
|
._timer_done = esp_coex_common_timer_done_wrapper,
|
||||||
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
|
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
|
||||||
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
|
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
|
||||||
|
._debug_matrix_init = esp_coexist_debug_matrix_init_wrapper,
|
||||||
._magic = COEX_ADAPTER_MAGIC,
|
._magic = COEX_ADAPTER_MAGIC,
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -21,6 +21,7 @@
|
|||||||
#include "esp_private/esp_clk.h"
|
#include "esp_private/esp_clk.h"
|
||||||
#include "private/esp_coexist_adapter.h"
|
#include "private/esp_coexist_adapter.h"
|
||||||
#include "esp32c5/rom/ets_sys.h"
|
#include "esp32c5/rom/ets_sys.h"
|
||||||
|
#include "private/esp_coexist_debug.h"
|
||||||
|
|
||||||
#define TAG "esp_coex_adapter"
|
#define TAG "esp_coex_adapter"
|
||||||
|
|
||||||
@ -141,6 +142,15 @@ static int32_t IRAM_ATTR esp_coex_semphr_give_from_isr_wrapper(void *semphr, voi
|
|||||||
return (int32_t)xSemaphoreGiveFromISR(semphr, hptw);
|
return (int32_t)xSemaphoreGiveFromISR(semphr, hptw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int esp_coexist_debug_matrix_init_wrapper(int evt, int sig, bool rev)
|
||||||
|
{
|
||||||
|
#if CONFIG_ESP_COEX_GPIO_DEBUG
|
||||||
|
return esp_coexist_debug_matrix_init(evt, sig, rev);
|
||||||
|
#else
|
||||||
|
return ESP_ERR_NOT_SUPPORTED;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
coex_adapter_funcs_t g_coex_adapter_funcs = {
|
coex_adapter_funcs_t g_coex_adapter_funcs = {
|
||||||
._version = COEX_ADAPTER_VERSION,
|
._version = COEX_ADAPTER_VERSION,
|
||||||
._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper,
|
._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper,
|
||||||
@ -159,5 +169,6 @@ coex_adapter_funcs_t g_coex_adapter_funcs = {
|
|||||||
._timer_done = esp_coex_common_timer_done_wrapper,
|
._timer_done = esp_coex_common_timer_done_wrapper,
|
||||||
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
|
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
|
||||||
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
|
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
|
||||||
|
._debug_matrix_init = esp_coexist_debug_matrix_init_wrapper,
|
||||||
._magic = COEX_ADAPTER_MAGIC,
|
._magic = COEX_ADAPTER_MAGIC,
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -22,6 +22,7 @@
|
|||||||
#include "esp_private/esp_clk.h"
|
#include "esp_private/esp_clk.h"
|
||||||
#include "private/esp_coexist_adapter.h"
|
#include "private/esp_coexist_adapter.h"
|
||||||
#include "esp32c6/rom/ets_sys.h"
|
#include "esp32c6/rom/ets_sys.h"
|
||||||
|
#include "private/esp_coexist_debug.h"
|
||||||
|
|
||||||
#define TAG "esp_coex_adapter"
|
#define TAG "esp_coex_adapter"
|
||||||
|
|
||||||
@ -142,6 +143,15 @@ static int32_t IRAM_ATTR esp_coex_semphr_give_from_isr_wrapper(void *semphr, voi
|
|||||||
return (int32_t)xSemaphoreGiveFromISR(semphr, hptw);
|
return (int32_t)xSemaphoreGiveFromISR(semphr, hptw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int esp_coexist_debug_matrix_init_wrapper(int evt, int sig, bool rev)
|
||||||
|
{
|
||||||
|
#if CONFIG_ESP_COEX_GPIO_DEBUG
|
||||||
|
return esp_coexist_debug_matrix_init(evt, sig, rev);
|
||||||
|
#else
|
||||||
|
return ESP_ERR_NOT_SUPPORTED;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
coex_adapter_funcs_t g_coex_adapter_funcs = {
|
coex_adapter_funcs_t g_coex_adapter_funcs = {
|
||||||
._version = COEX_ADAPTER_VERSION,
|
._version = COEX_ADAPTER_VERSION,
|
||||||
._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper,
|
._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper,
|
||||||
@ -160,5 +170,6 @@ coex_adapter_funcs_t g_coex_adapter_funcs = {
|
|||||||
._timer_done = esp_coex_common_timer_done_wrapper,
|
._timer_done = esp_coex_common_timer_done_wrapper,
|
||||||
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
|
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
|
||||||
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
|
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
|
||||||
|
._debug_matrix_init = esp_coexist_debug_matrix_init_wrapper,
|
||||||
._magic = COEX_ADAPTER_MAGIC,
|
._magic = COEX_ADAPTER_MAGIC,
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -21,7 +21,8 @@
|
|||||||
#include "soc/rtc.h"
|
#include "soc/rtc.h"
|
||||||
#include "esp_private/esp_clk.h"
|
#include "esp_private/esp_clk.h"
|
||||||
#include "private/esp_coexist_adapter.h"
|
#include "private/esp_coexist_adapter.h"
|
||||||
#include "esp32c6/rom/ets_sys.h"
|
#include "esp32h2/rom/ets_sys.h"
|
||||||
|
#include "private/esp_coexist_debug.h"
|
||||||
|
|
||||||
#define TAG "esp_coex_adapter"
|
#define TAG "esp_coex_adapter"
|
||||||
|
|
||||||
@ -134,6 +135,15 @@ static int32_t IRAM_ATTR esp_coex_semphr_give_from_isr_wrapper(void *semphr, voi
|
|||||||
return (int32_t)xSemaphoreGiveFromISR(semphr, hptw);
|
return (int32_t)xSemaphoreGiveFromISR(semphr, hptw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int esp_coexist_debug_matrix_init_wrapper(int evt, int sig, bool rev)
|
||||||
|
{
|
||||||
|
#if CONFIG_ESP_COEX_GPIO_DEBUG
|
||||||
|
return esp_coexist_debug_matrix_init(evt, sig, rev);
|
||||||
|
#else
|
||||||
|
return ESP_ERR_NOT_SUPPORTED;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
coex_adapter_funcs_t g_coex_adapter_funcs = {
|
coex_adapter_funcs_t g_coex_adapter_funcs = {
|
||||||
._version = COEX_ADAPTER_VERSION,
|
._version = COEX_ADAPTER_VERSION,
|
||||||
._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper,
|
._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper,
|
||||||
@ -152,5 +162,6 @@ coex_adapter_funcs_t g_coex_adapter_funcs = {
|
|||||||
._timer_done = esp_coex_common_timer_done_wrapper,
|
._timer_done = esp_coex_common_timer_done_wrapper,
|
||||||
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
|
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
|
||||||
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
|
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
|
||||||
|
._debug_matrix_init = esp_coexist_debug_matrix_init_wrapper,
|
||||||
._magic = COEX_ADAPTER_MAGIC,
|
._magic = COEX_ADAPTER_MAGIC,
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -22,6 +22,7 @@
|
|||||||
#include "esp_private/esp_clk.h"
|
#include "esp_private/esp_clk.h"
|
||||||
#include "private/esp_coexist_adapter.h"
|
#include "private/esp_coexist_adapter.h"
|
||||||
#include "esp32s2/rom/ets_sys.h"
|
#include "esp32s2/rom/ets_sys.h"
|
||||||
|
#include "private/esp_coexist_debug.h"
|
||||||
|
|
||||||
#define TAG "esp_coex_adapter"
|
#define TAG "esp_coex_adapter"
|
||||||
|
|
||||||
@ -216,6 +217,15 @@ static int32_t esp_coex_internal_semphr_give_wrapper(void *semphr)
|
|||||||
return (int32_t)xSemaphoreGive(((modem_static_queue_t *)semphr)->handle);
|
return (int32_t)xSemaphoreGive(((modem_static_queue_t *)semphr)->handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int esp_coexist_debug_matrix_init_wrapper(int evt, int sig, bool rev)
|
||||||
|
{
|
||||||
|
#if CONFIG_ESP_COEX_GPIO_DEBUG
|
||||||
|
return esp_coexist_debug_matrix_init(evt, sig, rev);
|
||||||
|
#else
|
||||||
|
return ESP_ERR_NOT_SUPPORTED;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
coex_adapter_funcs_t g_coex_adapter_funcs = {
|
coex_adapter_funcs_t g_coex_adapter_funcs = {
|
||||||
._version = COEX_ADAPTER_VERSION,
|
._version = COEX_ADAPTER_VERSION,
|
||||||
._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper,
|
._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper,
|
||||||
@ -233,5 +243,6 @@ coex_adapter_funcs_t g_coex_adapter_funcs = {
|
|||||||
._timer_done = esp_coex_common_timer_done_wrapper,
|
._timer_done = esp_coex_common_timer_done_wrapper,
|
||||||
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
|
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
|
||||||
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
|
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
|
||||||
|
._debug_matrix_init = esp_coexist_debug_matrix_init_wrapper,
|
||||||
._magic = COEX_ADAPTER_MAGIC,
|
._magic = COEX_ADAPTER_MAGIC,
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -23,6 +23,7 @@
|
|||||||
#include "private/esp_coexist_adapter.h"
|
#include "private/esp_coexist_adapter.h"
|
||||||
#include "esp32s3/rom/ets_sys.h"
|
#include "esp32s3/rom/ets_sys.h"
|
||||||
#include "soc/system_reg.h"
|
#include "soc/system_reg.h"
|
||||||
|
#include "private/esp_coexist_debug.h"
|
||||||
|
|
||||||
#define TAG "esp_coex_adapter"
|
#define TAG "esp_coex_adapter"
|
||||||
|
|
||||||
@ -222,6 +223,15 @@ static int32_t esp_coex_internal_semphr_give_wrapper(void *semphr)
|
|||||||
return (int32_t)xSemaphoreGive(((modem_static_queue_t *)semphr)->handle);
|
return (int32_t)xSemaphoreGive(((modem_static_queue_t *)semphr)->handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int esp_coexist_debug_matrix_init_wrapper(int evt, int sig, bool rev)
|
||||||
|
{
|
||||||
|
#if CONFIG_ESP_COEX_GPIO_DEBUG
|
||||||
|
return esp_coexist_debug_matrix_init(evt, sig, rev);
|
||||||
|
#else
|
||||||
|
return ESP_ERR_NOT_SUPPORTED;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
coex_adapter_funcs_t g_coex_adapter_funcs = {
|
coex_adapter_funcs_t g_coex_adapter_funcs = {
|
||||||
._version = COEX_ADAPTER_VERSION,
|
._version = COEX_ADAPTER_VERSION,
|
||||||
._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper,
|
._task_yield_from_isr = esp_coex_common_task_yield_from_isr_wrapper,
|
||||||
@ -239,5 +249,6 @@ coex_adapter_funcs_t g_coex_adapter_funcs = {
|
|||||||
._timer_done = esp_coex_common_timer_done_wrapper,
|
._timer_done = esp_coex_common_timer_done_wrapper,
|
||||||
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
|
._timer_setfn = esp_coex_common_timer_setfn_wrapper,
|
||||||
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
|
._timer_arm_us = esp_coex_common_timer_arm_us_wrapper,
|
||||||
|
._debug_matrix_init = esp_coexist_debug_matrix_init_wrapper,
|
||||||
._magic = COEX_ADAPTER_MAGIC,
|
._magic = COEX_ADAPTER_MAGIC,
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -116,7 +116,7 @@ const char *esp_coex_version_get(void);
|
|||||||
* @deprecated Use esp_coex_status_bit_set() and esp_coex_status_bit_clear() instead.
|
* @deprecated Use esp_coex_status_bit_set() and esp_coex_status_bit_clear() instead.
|
||||||
* Set coexist preference of performance
|
* Set coexist preference of performance
|
||||||
* For example, if prefer to bluetooth, then it will make A2DP(play audio via classic bt)
|
* For example, if prefer to bluetooth, then it will make A2DP(play audio via classic bt)
|
||||||
* more smooth while wifi is runnning something.
|
* more smooth while wifi is running something.
|
||||||
* If prefer to wifi, it will do similar things as prefer to bluetooth.
|
* If prefer to wifi, it will do similar things as prefer to bluetooth.
|
||||||
* Default, it prefer to balance.
|
* Default, it prefer to balance.
|
||||||
*
|
*
|
||||||
@ -219,6 +219,15 @@ esp_err_t esp_external_coex_set_validate_high(bool is_high_valid);
|
|||||||
esp_err_t esp_coex_wifi_i154_enable(void);
|
esp_err_t esp_coex_wifi_i154_enable(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CONFIG_ESP_COEX_GPIO_DEBUG
|
||||||
|
/**
|
||||||
|
* @brief Enable coexist GPIO debug.
|
||||||
|
* To fully enable this feature, make sure functions in rom_funcs are out of ROM.
|
||||||
|
* @return : ESP_OK - success, other - failed
|
||||||
|
*/
|
||||||
|
esp_err_t esp_coexist_debug_init(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -46,6 +46,7 @@ typedef struct {
|
|||||||
void (* _timer_done)(void *ptimer);
|
void (* _timer_done)(void *ptimer);
|
||||||
void (* _timer_setfn)(void *ptimer, void *pfunction, void *parg);
|
void (* _timer_setfn)(void *ptimer, void *pfunction, void *parg);
|
||||||
void (* _timer_arm_us)(void *ptimer, uint32_t us, bool repeat);
|
void (* _timer_arm_us)(void *ptimer, uint32_t us, bool repeat);
|
||||||
|
int (* _debug_matrix_init)(int event, int signal, bool rev);
|
||||||
int32_t _magic;
|
int32_t _magic;
|
||||||
} coex_adapter_funcs_t;
|
} coex_adapter_funcs_t;
|
||||||
|
|
||||||
|
145
components/esp_coex/include/private/esp_coexist_debug.h
Normal file
145
components/esp_coex/include/private/esp_coexist_debug.h
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
|
#if CONFIG_ESP_COEX_GPIO_DEBUG
|
||||||
|
#include "esp_err.h"
|
||||||
|
#include "stdbool.h"
|
||||||
|
#include "soc/soc_caps.h"
|
||||||
|
|
||||||
|
#define COEX_GPIO_DEBUG_IO_INVALID SOC_GPIO_PIN_COUNT
|
||||||
|
|
||||||
|
/* Debug signal */
|
||||||
|
#define COEX_GPIO_DEBUG_SIG_RES_US 10
|
||||||
|
typedef enum {
|
||||||
|
COEX_GPIO_DEBUG_SIG_POSE,
|
||||||
|
COEX_GPIO_DEBUG_SIG_NEGA,
|
||||||
|
} coex_gpio_debug_sig_t;
|
||||||
|
#define COEX_GPIO_DEBUG_SIG_TO_DURATION(sig) ((sig - COEX_GPIO_DEBUG_SIG_NEGA) * COEX_GPIO_DEBUG_SIG_RES_US)
|
||||||
|
#define COEX_GPIO_DEBUG_SIG_CHECK_US 100
|
||||||
|
|
||||||
|
/* User diagram */
|
||||||
|
#ifdef CONFIG_ESP_COEX_GPIO_DEBUG_DIAG_GENERAL
|
||||||
|
#define COEX_GPIO_DEBUG_DIAG_GENERAL 1
|
||||||
|
#elif defined(CONFIG_ESP_COEX_GPIO_DEBUG_DIAG_WIFI)
|
||||||
|
#define COEX_GPIO_DEBUG_DIAG_WIFI 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* User configuration validity check */
|
||||||
|
#define COEX_GPIO_DEBUG_IO_COUNT_MAX 12
|
||||||
|
#define COEX_GPIO_DEBUG_IO_COUNT CONFIG_ESP_COEX_GPIO_DEBUG_IO_COUNT
|
||||||
|
|
||||||
|
#if !defined(CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX0)
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX0 COEX_GPIO_DEBUG_IO_INVALID
|
||||||
|
#else
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX0 CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX1)
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX1 COEX_GPIO_DEBUG_IO_INVALID
|
||||||
|
#else
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX1 CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX2)
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX2 COEX_GPIO_DEBUG_IO_INVALID
|
||||||
|
#else
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX2 CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX3)
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX3 COEX_GPIO_DEBUG_IO_INVALID
|
||||||
|
#else
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX3 CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX4)
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX4 COEX_GPIO_DEBUG_IO_INVALID
|
||||||
|
#else
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX4 CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX5)
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX5 COEX_GPIO_DEBUG_IO_INVALID
|
||||||
|
#else
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX5 CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX6)
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX6 COEX_GPIO_DEBUG_IO_INVALID
|
||||||
|
#else
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX6 CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX6
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX7)
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX7 COEX_GPIO_DEBUG_IO_INVALID
|
||||||
|
#else
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX7 CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX7
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX8)
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX8 COEX_GPIO_DEBUG_IO_INVALID
|
||||||
|
#else
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX8 CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX9)
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX9 COEX_GPIO_DEBUG_IO_INVALID
|
||||||
|
#else
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX9 CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX9
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX10)
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX10 COEX_GPIO_DEBUG_IO_INVALID
|
||||||
|
#else
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX10 CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX10
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX11)
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX11 COEX_GPIO_DEBUG_IO_INVALID
|
||||||
|
#else
|
||||||
|
#define COEX_GPIO_DEBUG_IO_IDX11 CONFIG_ESP_COEX_GPIO_DEBUG_IO_IDX11
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* wifi callback -> debug */
|
||||||
|
void wifi_set_gpio_debug_cb(void (* cb)(int, int));
|
||||||
|
int wifi_gpio_debug_max_event_get(void);
|
||||||
|
|
||||||
|
/* functions to check if in ROM */
|
||||||
|
void lmacProcessTxComplete(void);
|
||||||
|
void lmacTxFrame(void);
|
||||||
|
void pm_update_by_connectionless_status(void);
|
||||||
|
void pm_sleep(void);
|
||||||
|
void pm_dream(void);
|
||||||
|
void pm_beacon_monitor_timeout_process(void);
|
||||||
|
void pm_connectionless_wake_window_timeout_process(void);
|
||||||
|
void pm_coex_schm_process(void);
|
||||||
|
void pm_tbtt_process(void);
|
||||||
|
void pm_rx_beacon_process(void);
|
||||||
|
void ppTask(void);
|
||||||
|
void wDev_IndicateFrame(void);
|
||||||
|
void pm_check_state(void);
|
||||||
|
void pm_tx_null_data_done_process(void);
|
||||||
|
void pm_start(void);
|
||||||
|
void pm_stop(void);
|
||||||
|
|
||||||
|
/* coex callback -> debug */
|
||||||
|
void coex_set_gpio_debug_cb(void (*cb)(int, int));
|
||||||
|
int coex_gpio_debug_max_event_get(void);
|
||||||
|
esp_err_t coex_gpio_debug_matrix_init(void);
|
||||||
|
|
||||||
|
/* debug -> coex wrapper */
|
||||||
|
esp_err_t esp_coexist_debug_matrix_init(int evt, int sig, bool rev);
|
||||||
|
|
||||||
|
/* debug <-> diagram */
|
||||||
|
void wifi_bind_io_to_evt(uint8_t io_idx, uint8_t evt);
|
||||||
|
void coex_bind_io_to_evt(uint8_t io_idx, uint8_t evt);
|
||||||
|
void diagram_bind_io_to_evt(void);
|
||||||
|
|
||||||
|
#endif
|
277
components/esp_coex/src/coexist_debug.c
Normal file
277
components/esp_coex/src/coexist_debug.c
Normal file
@ -0,0 +1,277 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "private/esp_coexist_debug.h"
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "esp_err.h"
|
||||||
|
#include "string.h"
|
||||||
|
#include "esp_attr.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
|
#include "esp32/rom/gpio.h"
|
||||||
|
#include "esp32/rom/ets_sys.h"
|
||||||
|
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
|
||||||
|
#include "esp32s2/rom/gpio.h"
|
||||||
|
#include "esp32s2/rom/ets_sys.h"
|
||||||
|
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||||
|
#include "esp32c3/rom/gpio.h"
|
||||||
|
#include "esp32c3/rom/ets_sys.h"
|
||||||
|
#elif defined(CONFIG_IDF_TARGET_ESP32C2)
|
||||||
|
#include "esp32c2/rom/gpio.h"
|
||||||
|
#include "esp32c2/rom/ets_sys.h"
|
||||||
|
#elif defined(CONFIG_IDF_TARGET_ESP32C6)
|
||||||
|
#include "esp32c6/rom/gpio.h"
|
||||||
|
#include "esp32c6/rom/ets_sys.h"
|
||||||
|
#elif defined(CONFIG_IDF_TARGET_ESP32C5)
|
||||||
|
#include "esp32c5/rom/gpio.h"
|
||||||
|
#include "esp32c5/rom/ets_sys.h"
|
||||||
|
#elif defined(CONFIG_IDF_TARGET_ESP32C61)
|
||||||
|
#include "esp32c61/rom/gpio.h"
|
||||||
|
#include "esp32c61/rom/ets_sys.h"
|
||||||
|
#endif
|
||||||
|
#include "driver/gpio.h"
|
||||||
|
#include "soc/gpio_sig_map.h"
|
||||||
|
#include "esp_rom_gpio.h"
|
||||||
|
#include "soc/soc.h"
|
||||||
|
|
||||||
|
#if CONFIG_ESP_COEX_GPIO_DEBUG
|
||||||
|
static char* TAG = "coexist debug";
|
||||||
|
|
||||||
|
__attribute__((weak)) void wifi_set_gpio_debug_cb(void (* cb)(int, int))
|
||||||
|
{
|
||||||
|
ESP_LOGW(TAG, "Not support: %s", __FUNCTION__);
|
||||||
|
}
|
||||||
|
__attribute__((weak)) int wifi_gpio_debug_max_event_get(void)
|
||||||
|
{
|
||||||
|
ESP_LOGW(TAG, "Not support: %s", __FUNCTION__);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((weak)) void coex_set_gpio_debug_cb(void (*cb)(int, int))
|
||||||
|
{
|
||||||
|
ESP_LOGW(TAG, "Not support: %s", __FUNCTION__);
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((weak)) int coex_gpio_debug_max_event_get(void)
|
||||||
|
{
|
||||||
|
ESP_LOGW(TAG, "Not support: %s", __FUNCTION__);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((weak)) esp_err_t coex_gpio_debug_matrix_init(void)
|
||||||
|
{
|
||||||
|
ESP_LOGW(TAG, "Not support: %s", __FUNCTION__);
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if functions in ROM */
|
||||||
|
static const void* rom_funcs[] = {
|
||||||
|
#if CONFIG_ESP_WIFI_ENABLED
|
||||||
|
lmacProcessTxComplete,
|
||||||
|
lmacTxFrame,
|
||||||
|
pm_update_by_connectionless_status,
|
||||||
|
pm_sleep,
|
||||||
|
pm_dream,
|
||||||
|
pm_beacon_monitor_timeout_process,
|
||||||
|
pm_connectionless_wake_window_timeout_process,
|
||||||
|
pm_coex_schm_process,
|
||||||
|
pm_tbtt_process,
|
||||||
|
pm_rx_beacon_process,
|
||||||
|
ppTask,
|
||||||
|
wDev_IndicateFrame,
|
||||||
|
pm_check_state,
|
||||||
|
pm_tx_null_data_done_process,
|
||||||
|
pm_start,
|
||||||
|
pm_stop,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
static const char* rom_funcs_name[] = {
|
||||||
|
#if CONFIG_ESP_WIFI_ENABLED
|
||||||
|
"lmacProcessTxComplete",
|
||||||
|
"lmacTxframe",
|
||||||
|
"pm_update_by_connectionless_status",
|
||||||
|
"pm_sleep",
|
||||||
|
"pm_dream",
|
||||||
|
"pm_beacon_monitor_timeout_process",
|
||||||
|
"pm_connectionless_wake_window_timeout_process",
|
||||||
|
"pm_coex_schm_process",
|
||||||
|
"pm_tbtt_process",
|
||||||
|
"pm_rx_beacon_process",
|
||||||
|
"ppTask",
|
||||||
|
"wDev_IndicateFrame",
|
||||||
|
"pm_check_state",
|
||||||
|
"pm_tx_null_data_done_process",
|
||||||
|
"pm_start",
|
||||||
|
"pm_stop",
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
static bool check_funcs_in_rom(void)
|
||||||
|
{
|
||||||
|
bool in_rom = false;
|
||||||
|
for (uint8_t i = 0; i < sizeof(rom_funcs) / sizeof(void*); i++) {
|
||||||
|
if ((uint32_t)rom_funcs[i] >= SOC_IROM_MASK_LOW && (uint32_t)rom_funcs[i] <= SOC_IROM_MASK_HIGH) {
|
||||||
|
ESP_LOGE(TAG, "remove function from ROM: %s", rom_funcs_name[i]);
|
||||||
|
in_rom = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return in_rom;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Define used IO nums */
|
||||||
|
static const DRAM_ATTR gpio_num_t s_io_nums[COEX_GPIO_DEBUG_IO_COUNT_MAX] = {
|
||||||
|
COEX_GPIO_DEBUG_IO_IDX0,
|
||||||
|
COEX_GPIO_DEBUG_IO_IDX1,
|
||||||
|
COEX_GPIO_DEBUG_IO_IDX2,
|
||||||
|
COEX_GPIO_DEBUG_IO_IDX3,
|
||||||
|
COEX_GPIO_DEBUG_IO_IDX4,
|
||||||
|
COEX_GPIO_DEBUG_IO_IDX5,
|
||||||
|
COEX_GPIO_DEBUG_IO_IDX6,
|
||||||
|
COEX_GPIO_DEBUG_IO_IDX7,
|
||||||
|
COEX_GPIO_DEBUG_IO_IDX8,
|
||||||
|
COEX_GPIO_DEBUG_IO_IDX9,
|
||||||
|
COEX_GPIO_DEBUG_IO_IDX10,
|
||||||
|
COEX_GPIO_DEBUG_IO_IDX11,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Mapping from evt to IO */
|
||||||
|
static DRAM_ATTR gpio_num_t *s_evt_io_map, *s_wifi_evt_io_map, *s_coex_evt_io_map;
|
||||||
|
static DRAM_ATTR uint8_t s_wifi_evt_max, s_coex_evt_max;
|
||||||
|
|
||||||
|
inline static void bind_io_to_evt(gpio_num_t *ptrmap, uint8_t io, uint8_t evt)
|
||||||
|
{
|
||||||
|
ptrmap[evt] = io;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static void evt_set_signal(gpio_num_t io, coex_gpio_debug_sig_t sig)
|
||||||
|
{
|
||||||
|
if (sig == COEX_GPIO_DEBUG_SIG_POSE) {
|
||||||
|
gpio_set_level(io, true);
|
||||||
|
} else if (sig == COEX_GPIO_DEBUG_SIG_NEGA) {
|
||||||
|
gpio_set_level(io, false);
|
||||||
|
} else {
|
||||||
|
gpio_set_level(io, true);
|
||||||
|
esp_rom_delay_us(COEX_GPIO_DEBUG_SIG_TO_DURATION(sig));
|
||||||
|
gpio_set_level(io, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wifi_bind_io_to_evt(uint8_t io_idx, uint8_t evt)
|
||||||
|
{
|
||||||
|
if (!s_wifi_evt_io_map || evt >= s_wifi_evt_max || io_idx >= COEX_GPIO_DEBUG_IO_COUNT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ESP_LOGI(TAG, "Bind IO %u to Wi-Fi evt %u", s_io_nums[io_idx], evt);
|
||||||
|
bind_io_to_evt(s_wifi_evt_io_map, s_io_nums[io_idx], evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void coex_bind_io_to_evt(uint8_t io_idx, uint8_t evt)
|
||||||
|
{
|
||||||
|
if (!s_coex_evt_io_map || evt >= s_coex_evt_max || io_idx >= COEX_GPIO_DEBUG_IO_COUNT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ESP_LOGI(TAG, "Bind IO %u to coexist evt %u", s_io_nums[io_idx], evt);
|
||||||
|
bind_io_to_evt(s_coex_evt_io_map, s_io_nums[io_idx], evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
IRAM_ATTR void wifi_set_gpio_debug(int evt, coex_gpio_debug_sig_t sig)
|
||||||
|
{
|
||||||
|
if (evt >= s_wifi_evt_max || s_wifi_evt_io_map[evt] == COEX_GPIO_DEBUG_IO_INVALID) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
evt_set_signal(s_wifi_evt_io_map[evt], sig);
|
||||||
|
}
|
||||||
|
|
||||||
|
IRAM_ATTR void coex_set_gpio_debug(int evt, coex_gpio_debug_sig_t sig)
|
||||||
|
{
|
||||||
|
if (evt >= s_coex_evt_max || s_coex_evt_io_map[evt] == COEX_GPIO_DEBUG_IO_INVALID) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
evt_set_signal(s_coex_evt_io_map[evt], sig);
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t esp_coexist_debug_matrix_init(int evt, int sig, bool rev)
|
||||||
|
{
|
||||||
|
if (evt >= s_coex_evt_max || s_coex_evt_io_map[evt] == COEX_GPIO_DEBUG_IO_INVALID) {
|
||||||
|
return ESP_ERR_INVALID_ARG;
|
||||||
|
}
|
||||||
|
esp_rom_gpio_connect_out_signal(s_coex_evt_io_map[evt], sig, rev, false);
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t esp_coexist_debug_init(void)
|
||||||
|
{
|
||||||
|
if (check_funcs_in_rom()) {
|
||||||
|
return ESP_ERR_INVALID_STATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
s_wifi_evt_max = wifi_gpio_debug_max_event_get();
|
||||||
|
s_coex_evt_max = coex_gpio_debug_max_event_get();
|
||||||
|
uint8_t evt_max = s_wifi_evt_max + s_coex_evt_max;
|
||||||
|
if (evt_max == 0) {
|
||||||
|
return ESP_ERR_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate binding map */
|
||||||
|
s_evt_io_map = malloc(sizeof(gpio_num_t) * evt_max);
|
||||||
|
if (!s_evt_io_map) {
|
||||||
|
return ESP_ERR_NO_MEM;
|
||||||
|
}
|
||||||
|
/* Init to invalid IO num */
|
||||||
|
for (uint8_t i = 0; i < evt_max; i++) {
|
||||||
|
s_evt_io_map[i] = COEX_GPIO_DEBUG_IO_INVALID;
|
||||||
|
}
|
||||||
|
s_wifi_evt_io_map = s_evt_io_map;
|
||||||
|
s_coex_evt_io_map = s_evt_io_map + s_wifi_evt_max;
|
||||||
|
|
||||||
|
/* binding map configuration */
|
||||||
|
diagram_bind_io_to_evt();
|
||||||
|
|
||||||
|
/* Register callback for Wi-Fi evt */
|
||||||
|
wifi_set_gpio_debug_cb(wifi_set_gpio_debug);
|
||||||
|
|
||||||
|
/* Register callback for coexist evt */
|
||||||
|
coex_set_gpio_debug_cb(coex_set_gpio_debug);
|
||||||
|
|
||||||
|
/* IO init and validity check */
|
||||||
|
gpio_config_t io_conf = {
|
||||||
|
//disable interrupt
|
||||||
|
.intr_type = GPIO_INTR_DISABLE,
|
||||||
|
//set as output mode
|
||||||
|
.mode = GPIO_MODE_OUTPUT,
|
||||||
|
//bit mask of the pins that you want to set,e.g.GPIO18/19
|
||||||
|
.pin_bit_mask = 0,
|
||||||
|
//disable pull-down mode
|
||||||
|
.pull_down_en = GPIO_PULLDOWN_DISABLE,
|
||||||
|
//enable pull-up mode
|
||||||
|
.pull_up_en = GPIO_PULLUP_ENABLE,
|
||||||
|
};
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < COEX_GPIO_DEBUG_IO_COUNT; i++) {
|
||||||
|
gpio_num_t io = s_io_nums[i];
|
||||||
|
io_conf.pin_bit_mask = (1ULL << io);
|
||||||
|
gpio_config(&io_conf);
|
||||||
|
gpio_set_level(io, 0);
|
||||||
|
}
|
||||||
|
esp_rom_delay_us(COEX_GPIO_DEBUG_SIG_CHECK_US);
|
||||||
|
for (uint8_t i = 0; i < COEX_GPIO_DEBUG_IO_COUNT; i++) {
|
||||||
|
gpio_set_level(s_io_nums[i], true);
|
||||||
|
}
|
||||||
|
esp_rom_delay_us(COEX_GPIO_DEBUG_SIG_CHECK_US);
|
||||||
|
for (uint8_t i = 0; i < COEX_GPIO_DEBUG_IO_COUNT; i++) {
|
||||||
|
gpio_set_level(s_io_nums[i], false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Init coexist hardware signal */
|
||||||
|
ESP_ERROR_CHECK(coex_gpio_debug_matrix_init());
|
||||||
|
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
59
components/esp_coex/src/coexist_debug_diagram.c
Normal file
59
components/esp_coex/src/coexist_debug_diagram.c
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "private/esp_coexist_debug.h"
|
||||||
|
|
||||||
|
#if CONFIG_ESP_COEX_GPIO_DEBUG
|
||||||
|
#ifdef COEX_GPIO_DEBUG_DIAG_GENERAL
|
||||||
|
void diagram_bind_io_to_evt(void) {
|
||||||
|
/* Bind IO to coexist evt */
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
|
coex_bind_io_to_evt(0, 8);
|
||||||
|
coex_bind_io_to_evt(0, 11);
|
||||||
|
coex_bind_io_to_evt(1, 16);
|
||||||
|
#else
|
||||||
|
coex_bind_io_to_evt(0, 0);
|
||||||
|
coex_bind_io_to_evt(1, 1);
|
||||||
|
#endif
|
||||||
|
/* Bind IO to Wi-Fi evt */
|
||||||
|
wifi_bind_io_to_evt(2, 9);
|
||||||
|
wifi_bind_io_to_evt(3, 10);
|
||||||
|
wifi_bind_io_to_evt(4, 11);
|
||||||
|
|
||||||
|
wifi_bind_io_to_evt(5, 0);
|
||||||
|
wifi_bind_io_to_evt(6, 1);
|
||||||
|
}
|
||||||
|
#elif defined(COEX_GPIO_DEBUG_DIAG_WIFI)
|
||||||
|
void diagram_bind_io_to_evt(void) {
|
||||||
|
/* Bind IO to coexist evt */
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
|
coex_bind_io_to_evt(0, 8);
|
||||||
|
coex_bind_io_to_evt(0, 11);
|
||||||
|
coex_bind_io_to_evt(1, 16);
|
||||||
|
#else
|
||||||
|
coex_bind_io_to_evt(0, 0);
|
||||||
|
coex_bind_io_to_evt(1, 1);
|
||||||
|
#endif
|
||||||
|
/* Bind IO to Wi-Fi evt */
|
||||||
|
wifi_bind_io_to_evt(2, 9);
|
||||||
|
wifi_bind_io_to_evt(3, 10);
|
||||||
|
wifi_bind_io_to_evt(4, 11);
|
||||||
|
|
||||||
|
wifi_bind_io_to_evt(5, 0);
|
||||||
|
wifi_bind_io_to_evt(6, 1);
|
||||||
|
|
||||||
|
wifi_bind_io_to_evt(7, 3);
|
||||||
|
wifi_bind_io_to_evt(8, 4);
|
||||||
|
wifi_bind_io_to_evt(9, 5);
|
||||||
|
wifi_bind_io_to_evt(10, 6);
|
||||||
|
wifi_bind_io_to_evt(11, 7);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void diagram_bind_io_to_evt(void) {
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
Reference in New Issue
Block a user