mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
feat(xip_psram): support xip psram feature on esp32p4
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2010-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2010-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "soc/soc.h"
|
||||
#include "soc/ext_mem_defs.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_attr.h"
|
||||
@@ -179,6 +180,31 @@ inline static bool esp_ptr_in_tcm(const void *p) {
|
||||
#endif //#if SOC_MEM_TCM_SUPPORTED
|
||||
|
||||
/** End of the common section that has to be in sync with esp_memory_utils.h **/
|
||||
|
||||
/**
|
||||
* @brief Check if the pointer is in PSRAM vaddr space
|
||||
*
|
||||
* @note This function is only used when in bootloader, where the PSRAM isn't initialised.
|
||||
* This function simply check if the pointer is the in the PSRAM vaddr space.
|
||||
* The PSRAM vaddr space is not always the same as the actual PSRAM vaddr range used in APP
|
||||
*
|
||||
* @param p pointer
|
||||
*
|
||||
* @return true: is in PSRAM; false: not in PSRAM
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
inline static bool esp_ptr_in_extram(const void *p) {
|
||||
bool valid = false;
|
||||
#if SOC_IRAM_PSRAM_ADDRESS_LOW
|
||||
valid |= ((intptr_t)p >= SOC_IRAM_PSRAM_ADDRESS_LOW && (intptr_t)p < SOC_IRAM_PSRAM_ADDRESS_HIGH);
|
||||
#endif
|
||||
|
||||
#if SOC_DRAM_PSRAM_ADDRESS_LOW
|
||||
valid |= ((intptr_t)p >= SOC_DRAM_PSRAM_ADDRESS_LOW && (intptr_t)p < SOC_DRAM_PSRAM_ADDRESS_HIGH);
|
||||
#endif
|
||||
return valid;
|
||||
}
|
||||
|
||||
/** Don't add new functions below **/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include "esp_err.h"
|
||||
#include "esp_image_format.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Image process driver
|
||||
*/
|
||||
typedef struct image_process_driver_s image_process_driver_t;
|
||||
|
||||
/**
|
||||
* @brief Image process driver
|
||||
*/
|
||||
struct image_process_driver_s {
|
||||
|
||||
/**
|
||||
* @brief Process segments
|
||||
*
|
||||
* @param[in] data image meta data
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK
|
||||
* - ESP_ERR_INVALID_ARG: invalid argument
|
||||
* - ESP_ERR_INVALID_STATE: invalid state
|
||||
*/
|
||||
esp_err_t (*process_segments)(esp_image_metadata_t *data);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Image process flow
|
||||
* @note This API first reads the image header, then process the segments from the image header.
|
||||
* This API can be further inserted with more steps about the image processing by registering
|
||||
* more function pointer in `image_process_driver_t`.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK
|
||||
* - ESP_FAIL: image process flow fails
|
||||
*/
|
||||
esp_err_t image_process(void);
|
||||
|
||||
/**
|
||||
* @brief get flash segments info, only available after image_process() has been called
|
||||
*
|
||||
* @param[out] out_drom_paddr_start drom paddr start
|
||||
* @param[out] out_irom_paddr_start irom paddr start
|
||||
*/
|
||||
void image_process_get_flash_segments_info(uint32_t *out_drom_paddr_start, uint32_t *out_irom_paddr_start);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user