[alsa-devel] Input/output error while playing a file using aplay

Pharaoh . pharaoh137 at gmail.com
Tue Jun 26 15:43:37 CEST 2007


As per the plat-omap/dma.c the function is like this:

/*
  * Returns current physical source address for the given DMA channel.
  * If the channel is running the caller must disable interrupts prior calling
  * this function and process the returned value before re-enabling interrupt to
  * prevent races with the interrupt handler. Note that in continuous mode there
  * is a chance for CSSA_L register overflow inbetween the two reads resulting
  * in incorrect return value.
  */
 dma_addr_t omap_get_dma_src_pos(int lch)
 {
         dma_addr_t offset;

         if (cpu_class_is_omap1())
                 offset = (dma_addr_t) (OMAP1_DMA_CSSA_L_REG(lch) |
                                        (OMAP1_DMA_CSSA_U_REG(lch) << 16));

         if (cpu_is_omap24xx())
                 offset = OMAP_DMA_CSAC_REG(lch);

         return offset;
}

I have one doubt here, I am referring Writing ALSA driver by Takashi
it says following about the dma_addr_t.

If you use a standard ALSA function, snd_pcm_lib_malloc_pages(), for
allocating the buffer, these fields are set by the ALSA middle layer,
and you should not change them by yourself.

I am using the standard helper function to allocate the DMA buffer in
my hw_params, so I am not setting the runtime->dma_addr field, pcm
layer must be setting it, right?

But in my pointer function I am accessing runtime->dma_addr where as
the guide says it is i.e the physical bus address is not accessible
from the main CPU. I am doing wrong accessing it?

After allocating the buffer in hw_params i am  trying to check the
physical and virtual addr of the DMA buffer, I get

Physical DMA addr is 00000000 and virtual addr is c3540000

does it mean that dma_addr is really not accessible from main CPU?

In pointer when I check the dma addr I get

runtime->dma_addr is 00000000 !!

How come??

-pharaoh.

On 6/26/07, Clemens Ladisch <cladisch at fastmail.net> wrote:
> Pharaoh . wrote:
> >                 src = omap_get_dma_src_pos(s->lch[s->dma_q_head]);
> >                 offset = src - runtime->dma_addr;
> >                 printk("src is %u and offset is %u\n",dest,offset);
> >
> > src is 3246792928 and offset is 3304194048
> > Returning pos = 20742144
> > ALSA sound/core/pcm_lib.c:167: BUG: stream = 0, pos = 0x13c8000, buffer
> size = 0x4000, period size = 0x800
>
> dma_addr = 0xFC9420E0 (is this correct?)
> src      = 0xC18620E0
> offset   = 0xC4F20000
>
> Apparently, the return value of omap_get_dma_src_pos() is wrong.
> Should this value be 16 bits?
>
>
> Regards,
> Clemens
>


More information about the Alsa-devel mailing list