11#if DETWS_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;
22DetwsPlace detws_psram_place(
size_t size,
bool dma_required,
size_t free_dram,
size_t free_psram,
23 size_t psram_threshold,
size_t dram_reserve)
26 return DetwsPlace::PLACE_FAIL;
28 bool d_fits = dram_fits(size, free_dram, dram_reserve);
29 bool p_fits = size <= free_psram;
32 return d_fits ? DetwsPlace::PLACE_DRAM : DetwsPlace::PLACE_FAIL;
34 if (size >= psram_threshold)
37 return DetwsPlace::PLACE_PSRAM;
39 return DetwsPlace::PLACE_DRAM;
40 return DetwsPlace::PLACE_FAIL;
45 return DetwsPlace::PLACE_DRAM;
47 return DetwsPlace::PLACE_PSRAM;
48 return DetwsPlace::PLACE_FAIL;
51void detws_pingpong_init(PingPong *pp)
57uint8_t detws_pingpong_fill_index(
const PingPong *pp)
59 return pp ? pp->fill_idx : 0;
62uint8_t detws_pingpong_drain_index(
const PingPong *pp)
64 return pp ? (uint8_t)(pp->fill_idx ^ 1u) : 1;
67uint8_t detws_pingpong_swap(PingPong *pp)
Buffer placement policy (DRAM vs PSRAM) + SPI DMA ping-pong index manager (DETWS_ENABLE_PSRAM_POOL).