mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
esp_hw_support: move soc_memory_types.h helper functions into esp_hw_support
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -68,6 +68,7 @@
|
||||
#endif
|
||||
|
||||
const static char *TAG = "esp-sha";
|
||||
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
|
||||
@@ -225,7 +226,7 @@ int esp_sha_dma(esp_sha_type sha_type, const void *input, uint32_t ilen,
|
||||
}
|
||||
|
||||
/* DMA cannot access memory in flash, hash block by block instead of using DMA */
|
||||
if (!esp_ptr_dma_ext_capable(input) && !esp_ptr_dma_capable(input) && (ilen != 0)) {
|
||||
if (!s_check_dma_capable(input) && (ilen != 0)) {
|
||||
esp_sha_block_mode(sha_type, input, ilen, buf, buf_len, is_first_block);
|
||||
return 0;
|
||||
}
|
||||
@@ -240,7 +241,7 @@ int esp_sha_dma(esp_sha_type sha_type, const void *input, uint32_t ilen,
|
||||
#endif
|
||||
|
||||
/* Copy to internal buf if buf is in non DMA capable memory */
|
||||
if (!esp_ptr_dma_ext_capable(buf) && !esp_ptr_dma_capable(buf) && (buf_len != 0)) {
|
||||
if (!s_check_dma_capable(buf) && (buf_len != 0)) {
|
||||
dma_cap_buf = heap_caps_malloc(sizeof(unsigned char) * buf_len, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
|
||||
if (dma_cap_buf == NULL) {
|
||||
ESP_LOGE(TAG, "Failed to allocate buf memory");
|
||||
@@ -326,3 +327,14 @@ static esp_err_t esp_sha_dma_process(esp_sha_type sha_type, const void *input, u
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user