1
2
3
4
5
6
7
8
9
10
11
12
13
14
size_t pcm_get_bytes_waiting(void)
{
    int bytes = remaining + (DMAC0C0LLI.control & 0xfff) * 2;
    const struct dma_lli* lli = DMAC0C0LLI.nextlli;
    int depth = 0;
    while (lli)
    {
        bytes += (lli->control & 0xfff) * 2;
        lli = lli->nextlli;
        depth++;
    }
    splashf(0, "%d %d", depth, bytes);
    return bytes;
}