Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: DMA Operation???

Re: DMA Operation???

From: Linus Nielsen Feltzing <linus_at_haxx.se>
Date: Sat, 19 Oct 2002 09:12:15 +0200

On Fri, 18 Oct 2002 14:44:19 +0100, George Styles wrote:
> Can i ask one more thing please? is the DMA clever enough to not
> send data through faster than the MAS can use it? i assume the MAS
> can say 'enough for now' and the DMA pauses until the MAS says it
> is ready for more data (or does so via the UART by setting RTR to
> no!)?

There is a signal from the MAS called the DEMAND signal. It goes high
when the MAS wants data. We poll that signal at 1ms intervals. When
we see a high signal, we enable the Tx Empty interrupt on the serial
port, which in turn triggers one DMA transfer. The byte is sent via
the serial port (at approx 1mbit/s), and an interrupt is triggered
when the byte is sent, and the DMA transfers the next byte, and so
on. We get an interrupt when the DEMAND pin goes low again, where we
disable the Tx interrupt.

> How about this? when we want a beep, we
>
> 1. stop the current DMA (assumes that DMA is active all the time
> either transfering data to serial0 or waiting for serial0 to become
> ready),
>
> 2. Read the address it got up to

We can read that on the fly. We can do like this:

1. Read the current DMA address.
2. Search for the next frame boundary from there
3. Adjust the DMA buffer length accordingly
4. We get a DMA interrupt when it has transferred the remainder of
the frame
5. We reprogram the DMA to play the beep
6. We continue with the normal stream

To make this really good, we may want to skip as many frames as the
beep took, to keep the play time constant.

The operation above gets complicated for several reasons:

1) The next frame boundary may not be in the current DMA buffer
2) The buffer may wrap
3) The music may be paused
4) The DMA address is used to detect the track boundaries

/Linus

-- 
Linus Nielsen Feltzing, linus_at_haxx.se on 2002-10-19
Received on 2002-10-19

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy