esp_hw_support: move soc_memory_types.h helper functions into esp_hw_support

This commit is contained in:
Armando
2022-03-31 15:07:51 +08:00
parent d612c71be5
commit c4bcf1117c
24 changed files with 461 additions and 253 deletions
+14 -2
View File
@@ -93,6 +93,7 @@ static esp_pm_lock_handle_t s_pm_sleep_lock;
#endif //SOC_PSRAM_DMA_CAPABLE
static const char *TAG = "esp-aes";
static bool s_check_dma_capable(const void *p);
/* These are static due to:
* * Must be in DMA capable memory, so stack is not a safe place to put them
@@ -349,11 +350,11 @@ static int esp_aes_process_dma(esp_aes_context *ctx, const unsigned char *input,
}
#endif
/* DMA cannot access memory in the iCache range, copy input to internal ram */
if (!esp_ptr_dma_ext_capable(input) && !esp_ptr_dma_capable(input)) {
if (!s_check_dma_capable(input)) {
input_needs_realloc = true;
}
if (!esp_ptr_dma_ext_capable(output) && !esp_ptr_dma_capable(output)) {
if (!s_check_dma_capable(output)) {
output_needs_realloc = true;
}
@@ -1040,3 +1041,14 @@ int esp_aes_crypt_ctr(esp_aes_context *ctx,
return r;
}
static bool s_check_dma_capable(const void *p)
{
bool is_capable = false;
#if CONFIG_SPIRAM
is_capable |= esp_ptr_dma_ext_capable(p);
#endif
is_capable |= esp_ptr_dma_capable(p);
return is_capable;
}