diff --git a/components/esp_psram/esp_psram.c b/components/esp_psram/esp_psram.c index ce23e4f9337..7c956b7b8bd 100644 --- a/components/esp_psram/esp_psram.c +++ b/components/esp_psram/esp_psram.c @@ -390,6 +390,15 @@ size_t esp_psram_get_size(void) return (size_t)available_size; } +uint8_t* esp_psram_get_address(void) +{ + if (!s_psram_ctx.is_initialised) { + return NULL; + } + + return s_psram_ctx.mapped_regions[PSRAM_MEM_8BIT_ALIGNED].vaddr_start; +} + uint8_t esp_psram_io_get_cs_io(void) { return esp_psram_impl_get_cs_io(); diff --git a/components/esp_psram/include/esp_psram.h b/components/esp_psram/include/esp_psram.h index 75487573f0c..b7b2a534a1a 100644 --- a/components/esp_psram/include/esp_psram.h +++ b/components/esp_psram/include/esp_psram.h @@ -42,6 +42,13 @@ bool esp_psram_is_initialized(void); */ size_t esp_psram_get_size(void); +/** + * @brief Get the memory mapped address of the attached PSRAM chip + * + * @return Pointer to the start of PSRAM memory, or NULL if PSRAM isn't successfully initialized + */ +uint8_t* esp_psram_get_address(void); + #ifdef __cplusplus } #endif