mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
feat(system_init): introduce pre-scheduler and pre-app main handler registrations
- Added macros for registering handlers to run before the scheduler and app main. - Updated various components to utilize the new registration system for initialization. - Refactored app startup logic to streamline initialization sequence.
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "esp_private/esp_psram_mspi.h"
|
||||
#include "esp_private/mspi_mem_barrier.h"
|
||||
#include "esp_private/startup_internal.h"
|
||||
#include "esp_private/esp_sys_event_app_init.h"
|
||||
#if SOC_SPIRAM_XIP_SUPPORTED
|
||||
#include "esp_private/mmu_psram_flash.h"
|
||||
#endif
|
||||
@@ -675,6 +676,23 @@ esp_err_t esp_psram_extram_reserve_dma_pool(size_t size)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL
|
||||
ESP_PRE_APP_MAIN_HANDLER_REGISTER(reserve_dma_pool, 110)
|
||||
{
|
||||
(void)user_arg;
|
||||
(void)ctx;
|
||||
if (!esp_psram_is_initialized()) {
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t err = esp_psram_extram_reserve_dma_pool(CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Could not reserve internal/DMA pool (error 0x%x)", err);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool IRAM_ATTR __attribute__((pure)) esp_psram_is_initialized(void)
|
||||
{
|
||||
return s_psram_ctx.is_initialised;
|
||||
|
||||
Reference in New Issue
Block a user