zephyr/soc/espressif/esp32s3/esp32s3-mp.c

42 lines
1.1 KiB
C

/*
* Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/device.h>
#include <zephyr/kernel.h>
#include <zephyr/spinlock.h>
#include <zephyr/kernel_structs.h>
#include <soc.h>
#include <esp_cpu.h>
#include <zephyr/drivers/interrupt_controller/intc_esp32.h>
void smp_log(const char *msg)
{
while (*msg) {
esp_rom_uart_tx_one_char(*msg++);
}
esp_rom_uart_tx_one_char('\r');
esp_rom_uart_tx_one_char('\n');
}
void esp_appcpu_start(void *entry_point)
{
esp_cpu_unstall(1);
if (!REG_GET_BIT(SYSTEM_CORE_1_CONTROL_0_REG, SYSTEM_CONTROL_CORE_1_CLKGATE_EN)) {
REG_SET_BIT(SYSTEM_CORE_1_CONTROL_0_REG, SYSTEM_CONTROL_CORE_1_CLKGATE_EN);
REG_CLR_BIT(SYSTEM_CORE_1_CONTROL_0_REG, SYSTEM_CONTROL_CORE_1_RUNSTALL);
REG_SET_BIT(SYSTEM_CORE_1_CONTROL_0_REG, SYSTEM_CONTROL_CORE_1_RESETTING);
REG_CLR_BIT(SYSTEM_CORE_1_CONTROL_0_REG, SYSTEM_CONTROL_CORE_1_RESETTING);
}
esp_rom_ets_set_appcpu_boot_addr((void *)entry_point);
ets_delay_us(50000);
smp_log("ESP32S3: CPU1 start sequence complete");
}