Skip to content

Commit

Permalink
Merge pull request espressif#13 from tannewt/psram_address_getter
Browse files Browse the repository at this point in the history
Add getter for PSRAM address
  • Loading branch information
tannewt authored Sep 14, 2023
2 parents f6feece + f2ee41e commit 4ae5861
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions components/esp_psram/esp_psram.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
7 changes: 7 additions & 0 deletions components/esp_psram/include/esp_psram.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4ae5861

Please sign in to comment.