Merge branch 'bugfix/unicore_config_prevent_ipc_code' into 'master'

ipc: prevent code getting pulled in for unicore configuration

See merge request espressif/esp-idf!5795
This commit is contained in:
Angus Gratton
2019-08-30 16:26:47 +08:00
7 changed files with 47 additions and 18 deletions

View File

@@ -47,7 +47,6 @@
#include "nvs_flash.h"
#include "esp_event.h"
#include "esp_spi_flash.h"
#include "esp_ipc.h"
#include "esp_private/crosscore_int.h"
#include "esp_log.h"
#include "esp_vfs_dev.h"

View File

@@ -28,9 +28,11 @@
#include "esp_log.h"
#include "esp_intr_alloc.h"
#include "esp_attr.h"
#include "esp_ipc.h"
#include <limits.h>
#include <assert.h>
#if !CONFIG_FREERTOS_UNICORE
#include "esp_ipc.h"
#endif
static const char* TAG = "intr_alloc";
@@ -705,20 +707,26 @@ esp_err_t IRAM_ATTR esp_intr_set_in_iram(intr_handle_t handle, bool is_in_iram)
return ESP_OK;
}
#if !CONFIG_FREERTOS_UNICORE
static void esp_intr_free_cb(void *arg)
{
(void)esp_intr_free((intr_handle_t)arg);
}
#endif /* !CONFIG_FREERTOS_UNICORE */
esp_err_t esp_intr_free(intr_handle_t handle)
{
bool free_shared_vector=false;
if (!handle) return ESP_ERR_INVALID_ARG;
#if !CONFIG_FREERTOS_UNICORE
//Assign this routine to the core where this interrupt is allocated on.
if (handle->vector_desc->cpu!=xPortGetCoreID()) {
esp_err_t ret = esp_ipc_call_blocking(handle->vector_desc->cpu, &esp_intr_free_cb, (void *)handle);
return ret == ESP_OK ? ESP_OK : ESP_FAIL;
}
#endif /* !CONFIG_FREERTOS_UNICORE */
portENTER_CRITICAL(&spinlock);
esp_intr_disable(handle);
if (handle->vector_desc->flags&VECDESC_FL_SHARED) {

View File

@@ -3,7 +3,9 @@
#include "freertos/task.h"
#include "unity.h"
#include "esp_ipc.h"
#include "sdkconfig.h"
#if !CONFIG_FREERTOS_UNICORE
static void test_func_ipc_cb(void *arg)
{
vTaskDelay(50);
@@ -14,10 +16,7 @@ static void test_func_ipc_cb(void *arg)
TEST_CASE("Test blocking IPC function call", "[ipc]")
{
int val = 0x5a5a;
#ifdef CONFIG_FREERTOS_UNICORE
esp_ipc_call_blocking(xPortGetCoreID(), test_func_ipc_cb, &val);
#else
esp_ipc_call_blocking(!xPortGetCoreID(), test_func_ipc_cb, &val);
#endif
TEST_ASSERT_EQUAL_HEX(val, 0xa5a5);
}
#endif /* !CONFIG_FREERTOS_UNICORE */