Merge branch 'bugfix/dport_access_unicore' into 'master'
dport_access: Fix spurious warning in unicore mode, refactor See merge request !931
This commit is contained in:
commit
45c926f8f0
|
@ -22,6 +22,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <sdkconfig.h>
|
||||||
#include "esp_attr.h"
|
#include "esp_attr.h"
|
||||||
#include "esp_err.h"
|
#include "esp_err.h"
|
||||||
#include "esp_intr.h"
|
#include "esp_intr.h"
|
||||||
|
@ -145,16 +146,20 @@ void IRAM_ATTR esp_dport_access_stall_other_cpu_end_wrap(void)
|
||||||
DPORT_STALL_OTHER_CPU_END();
|
DPORT_STALL_OTHER_CPU_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dport_access_init_core0(void *arg)
|
static void dport_access_init_core(void *arg)
|
||||||
{
|
{
|
||||||
int core_id = xPortGetCoreID();
|
int core_id = 0;
|
||||||
|
uint32_t intr_source = ETS_FROM_CPU_INTR2_SOURCE;
|
||||||
|
|
||||||
assert(core_id == 0);
|
#ifndef CONFIG_FREERTOS_UNICORE
|
||||||
|
core_id = xPortGetCoreID();
|
||||||
vPortCPUInitializeMutex(&g_dport_mux);
|
if (core_id == 1) {
|
||||||
|
intr_source = ETS_FROM_CPU_INTR3_SOURCE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ESP_INTR_DISABLE(ETS_DPORT_INUM);
|
ESP_INTR_DISABLE(ETS_DPORT_INUM);
|
||||||
intr_matrix_set(core_id, ETS_FROM_CPU_INTR2_SOURCE, ETS_DPORT_INUM);
|
intr_matrix_set(core_id, intr_source, ETS_DPORT_INUM);
|
||||||
ESP_INTR_ENABLE(ETS_DPORT_INUM);
|
ESP_INTR_ENABLE(ETS_DPORT_INUM);
|
||||||
|
|
||||||
dport_access_ref[core_id] = 0;
|
dport_access_ref[core_id] = 0;
|
||||||
|
@ -165,33 +170,10 @@ static void dport_access_init_core0(void *arg)
|
||||||
vTaskDelete(NULL);
|
vTaskDelete(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dport_access_init_core1(void *arg)
|
/* Defer initialisation until after scheduler is running */
|
||||||
{
|
|
||||||
int core_id = xPortGetCoreID();
|
|
||||||
|
|
||||||
assert(core_id == 1);
|
|
||||||
|
|
||||||
ESP_INTR_DISABLE(ETS_DPORT_INUM);
|
|
||||||
intr_matrix_set(core_id, ETS_FROM_CPU_INTR3_SOURCE, ETS_DPORT_INUM);
|
|
||||||
ESP_INTR_ENABLE(ETS_DPORT_INUM);
|
|
||||||
|
|
||||||
dport_access_ref[core_id] = 0;
|
|
||||||
dport_access_start[core_id] = 0;
|
|
||||||
dport_access_end[core_id] = 0;
|
|
||||||
dport_core_state[core_id] = DPORT_CORE_STATE_RUNNING;
|
|
||||||
|
|
||||||
vTaskDelete(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* This initialise should be really effective after vTaskStartScheduler */
|
|
||||||
void esp_dport_access_int_init(void)
|
void esp_dport_access_int_init(void)
|
||||||
{
|
{
|
||||||
if (xPortGetCoreID() == 0) {
|
xTaskCreatePinnedToCore(&dport_access_init_core, "dport", configMINIMAL_STACK_SIZE, NULL, 5, NULL, xPortGetCoreID());
|
||||||
xTaskCreatePinnedToCore(&dport_access_init_core0, "dport0", 2048, NULL, 5, NULL, 0);
|
|
||||||
} else {
|
|
||||||
xTaskCreatePinnedToCore(&dport_access_init_core1, "dport1", 2048, NULL, 5, NULL, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void esp_dport_access_int_deinit(void)
|
void esp_dport_access_int_deinit(void)
|
||||||
|
|
|
@ -80,7 +80,7 @@ void esp_ipc_init()
|
||||||
const char* task_names[2] = {"ipc0", "ipc1"};
|
const char* task_names[2] = {"ipc0", "ipc1"};
|
||||||
for (int i = 0; i < portNUM_PROCESSORS; ++i) {
|
for (int i = 0; i < portNUM_PROCESSORS; ++i) {
|
||||||
s_ipc_sem[i] = xSemaphoreCreateBinary();
|
s_ipc_sem[i] = xSemaphoreCreateBinary();
|
||||||
xTaskCreatePinnedToCore(ipc_task, task_names[i], XT_STACK_MIN_SIZE, (void*) i,
|
xTaskCreatePinnedToCore(ipc_task, task_names[i], configMINIMAL_STACK_SIZE, (void*) i,
|
||||||
configMAX_PRIORITIES - 1, &s_ipc_tasks[i], i);
|
configMAX_PRIORITIES - 1, &s_ipc_tasks[i], i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,15 +163,13 @@
|
||||||
#define configMAX_PRIORITIES ( 25 )
|
#define configMAX_PRIORITIES ( 25 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Minimal stack size. This may need to be increased for your application */
|
#ifndef CONFIG_ESP32_APPTRACE_ENABLE
|
||||||
/* NOTE: The FreeRTOS demos may not work reliably with stack size < 4KB. */
|
#define configMINIMAL_STACK_SIZE 512
|
||||||
/* The Xtensa-specific examples should be fine with XT_STACK_MIN_SIZE. */
|
#else
|
||||||
#if !(defined XT_STACK_MIN_SIZE)
|
/* apptrace module requires at least 2KB of stack per task */
|
||||||
#error XT_STACK_MIN_SIZE not defined, did you include xtensa_config.h ?
|
#define configMINIMAL_STACK_SIZE 2048
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define configMINIMAL_STACK_SIZE (XT_STACK_MIN_SIZE > 1024 ? XT_STACK_MIN_SIZE : 1024)
|
|
||||||
|
|
||||||
/* The Xtensa port uses a separate interrupt stack. Adjust the stack size */
|
/* The Xtensa port uses a separate interrupt stack. Adjust the stack size */
|
||||||
/* to suit the needs of your specific application. */
|
/* to suit the needs of your specific application. */
|
||||||
#ifndef configISR_STACK_SIZE
|
#ifndef configISR_STACK_SIZE
|
||||||
|
|
|
@ -40,5 +40,5 @@ void blink_task(void *pvParameter)
|
||||||
|
|
||||||
void app_main()
|
void app_main()
|
||||||
{
|
{
|
||||||
xTaskCreate(&blink_task, "blink_task", 2048, NULL, 5, NULL);
|
xTaskCreate(&blink_task, "blink_task", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue