diff options
| author | cooljqln <cooljqln@noreply.codeberg.org> | 2025-04-19 03:46:38 +0000 |
|---|---|---|
| committer | cooljqln <cooljqln@noreply.codeberg.org> | 2025-04-19 03:46:38 +0000 |
| commit | 79c9f0b6ccfec97f23563010f134d842c4240582 (patch) | |
| tree | 93b4bd208cb5a8e754022dc2299d8be336ca090d | |
| parent | 6dd277216d07ffdc3784aae17b07fdc7f6f36cc0 (diff) | |
| parent | 544f5db6e0abab76fa03f6f35613b752dd6f4100 (diff) | |
| download | tangara-fw-79c9f0b6ccfec97f23563010f134d842c4240582.tar.gz | |
Merge pull request 'move some allocations from internal RAM to external RAM' (#330) from Be.ing/tangara-fw:internal_ram into main
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/330
| -rw-r--r-- | src/tangara/audio/audio_decoder.cpp | 2 | ||||
| -rw-r--r-- | src/tangara/audio/processor.cpp | 4 | ||||
| -rw-r--r-- | src/tasks/tasks.cpp | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/tangara/audio/audio_decoder.cpp b/src/tangara/audio/audio_decoder.cpp index fca7e6da..2306e994 100644 --- a/src/tangara/audio/audio_decoder.cpp +++ b/src/tangara/audio/audio_decoder.cpp @@ -70,7 +70,7 @@ Decoder::Decoder(std::shared_ptr<SampleProcessor> processor) ESP_LOGI(kTag, "allocating codec buffer, %u KiB", kCodecBufferLength / 1024); codec_buffer_ = { reinterpret_cast<sample::Sample*>(heap_caps_calloc( - kCodecBufferLength, sizeof(sample::Sample), MALLOC_CAP_DMA)), + kCodecBufferLength, sizeof(sample::Sample), MALLOC_CAP_SPIRAM)), kCodecBufferLength}; } diff --git a/src/tangara/audio/processor.cpp b/src/tangara/audio/processor.cpp index 2fa7f78e..3126f050 100644 --- a/src/tangara/audio/processor.cpp +++ b/src/tangara/audio/processor.cpp @@ -52,7 +52,7 @@ SampleProcessor::SampleProcessor(drivers::PcmBuffer& sink) : commands_(xQueueCreate(2, sizeof(Args))), source_(xStreamBufferCreateWithCaps(kSourceBufferLength + 1, sizeof(sample::Sample), - MALLOC_CAP_DMA)), + MALLOC_CAP_SPIRAM)), sink_(sink), unprocessed_samples_(0) { tasks::StartPersistent<tasks::Type::kAudioConverter>([&]() { Main(); }); @@ -354,7 +354,7 @@ Buffer::Buffer() : storage_(reinterpret_cast<sample::Sample*>( heap_caps_calloc(kSampleBufferLength, sizeof(sample::Sample), - MALLOC_CAP_DMA))), + MALLOC_CAP_SPIRAM))), buffer_(storage_, kSampleBufferLength), samples_in_buffer_() {} diff --git a/src/tasks/tasks.cpp b/src/tasks/tasks.cpp index f0b567f2..c85b492b 100644 --- a/src/tasks/tasks.cpp +++ b/src/tasks/tasks.cpp @@ -40,8 +40,8 @@ auto AllocateStack() -> std::span<StackType_t>; template <> auto AllocateStack<Type::kAudioDecoder>() -> std::span<StackType_t> { constexpr std::size_t size = 20 * 1024; - static StackType_t sStack[size]; - return {sStack, size}; + return {static_cast<StackType_t*>(heap_caps_malloc(size, MALLOC_CAP_SPIRAM)), + size}; } // LVGL requires only a relatively small stack. Lua's stack is allocated // separately. @@ -55,8 +55,8 @@ template <> // PCM conversion and resampling uses a very small amount of stack. auto AllocateStack<Type::kAudioConverter>() -> std::span<StackType_t> { constexpr std::size_t size = 4 * 1024; - static StackType_t sStack[size]; - return {sStack, size}; + return {static_cast<StackType_t*>(heap_caps_malloc(size, MALLOC_CAP_SPIRAM)), + size}; } // Background workers receive huge stacks in PSRAM. This is mostly to faciliate // use of LevelDB from any bg worker; Leveldb is designed for non-embedded use |
