11#if PC_ENABLE_PSRAM_POOL
16bool dram_fits(
size_t size,
size_t free_dram,
size_t reserve)
18 return (uint64_t)size + reserve <= (uint64_t)free_dram;
22pc_place pc_psram_place(
size_t size,
bool dma_required,
size_t free_dram,
size_t free_psram,
size_t psram_threshold,
27 return pc_place::PLACE_FAIL;
30 bool d_fits = dram_fits(size, free_dram, dram_reserve);
31 bool p_fits = size <= free_psram;
35 return d_fits ? pc_place::PLACE_DRAM : pc_place::PLACE_FAIL;
38 if (size >= psram_threshold)
42 return pc_place::PLACE_PSRAM;
46 return pc_place::PLACE_DRAM;
48 return pc_place::PLACE_FAIL;
54 return pc_place::PLACE_DRAM;
58 return pc_place::PLACE_PSRAM;
60 return pc_place::PLACE_FAIL;
63void pc_pingpong_init(PingPong *pp)
71uint8_t pc_pingpong_fill_index(
const PingPong *pp)
73 return pp ? pp->fill_idx : 0;
76uint8_t pc_pingpong_drain_index(
const PingPong *pp)
78 return pp ? (uint8_t)(pp->fill_idx ^ 1u) : 1;
81uint8_t pc_pingpong_swap(PingPong *pp)
Buffer placement policy (DRAM vs PSRAM) + SPI DMA ping-pong index manager (PC_ENABLE_PSRAM_POOL).