All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: charles.eidsness@rogers.com
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Problems Writing a Driver for an AMD Au1000 MIPS Processor
Date: Tue, 08 Jun 2004 18:03:44 +0200	[thread overview]
Message-ID: <s5hbrju2g0v.wl@alsa2.suse.de> (raw)
In-Reply-To: <40C4A94D.3070100@rogers.com>

At Mon, 07 Jun 2004 13:43:41 -0400,
Charles Eidsness wrote:
> 
> I've been trying to write an ALSA driver for the AC97 port on an
> embedded AMD au1000 MIPS processor but am having some difficulties. The
> processor's DMA controller has two buffers which automatically toggle
> back and forth once the buffer is full. My problem is that when I
> playback a wave file (just using cat xxx > /dev/dsp) it sounds choppy if
> I run the spin_unlock_irqrestore on every interrupt, it's only playing
> back half the data. But if I run the spin_unlock_irqrestore function on
> every-other interrupt and have only two periods it sounds fine. I'm
> guessing I'm handling the streaming interface with the ALSA API incorrectly.

just taking a quick look, at least i found that the pointer callback
returns the wrong value. 

static snd_pcm_uframes_t
snd_au1000_pointer(snd_pcm_substream_t * substream)
{
     audio_stream_t *stream = substream->private_data;
     snd_pcm_runtime_t *runtime = substream->runtime;
     unsigned long location, flags;
     spin_lock_irqsave(&stream->dma_lock, flags);
     location = get_dma_residue(stream->dma);
     spin_unlock_irqrestore(&stream->dma_lock, flags);
     location = stream->dma_size - location;
     return bytes_to_frames(runtime,location);
}

this returns the point in the current period.  the pointer callback
must return the current position in the whole DMA buffer.

thus, you'll need to track the current DMA position (remembering
e.g. stream->cur_period), and increment it in interrupt. 
Then adds this offset in the above pointer callback.


Takashi


-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite!  GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org

  reply	other threads:[~2004-06-08 16:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-07 17:43 Problems Writing a Driver for an AMD Au1000 MIPS Processor Charles Eidsness
2004-06-08 16:03 ` Takashi Iwai [this message]
2004-06-08 18:09   ` Charles Eidsness
  -- strict thread matches above, loose matches on Subject: below --
2004-06-07 14:27 Charles Eidsness

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hbrju2g0v.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=charles.eidsness@rogers.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.