wait..wait.....I need to use locking here...let me send you log after doing locking appropriately .....
On 6/26/07, Pharaoh . pharaoh137@gmail.com wrote:
It would really help if you'd show us the code of the version of the driver that you're currently talking about.
Hi Clemens...
I had sent you the source file having pcm callbacks yesterday, now I have modified the pointer function as follows, I am just giving the pointer function here to avoid duplication, but please let me know in case you want to have look at the entire file.
static snd_pcm_uframes_t snd_omap_alsa_pointer(snd_pcm_substream_t *substream) {
struct omap_eac *chip = snd_pcm_substream_chip(substream); snd_pcm_uframes_t pos = 0; FN_ENTER; pos = audio_get_dma_pos(&chip->s[substream->pstr->stream]); printk("Returning pos = %d\n", pos); return pos; FN_EXIT;
}
static snd_pcm_uframes_t audio_get_dma_pos(struct audio_stream *s) { snd_pcm_substream_t *substream = s->stream; snd_pcm_runtime_t *runtime = substream->runtime; unsigned long flags; dma_addr_t count; unsigned long offset; dma_addr_t src,dest;
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { dest = omap_get_dma_dst_pos(s->lch[s->dma_q_head]); offset = dest - runtime->dma_addr; printk("dest is %u and offset is %u\n",dest,offset); } else { 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); } return bytes_to_frames(substream->runtime, offset);
}
And the log is as follows.
For the first time.
snd_omap_alsa_pointer start src is 3246792928 and offset is 3304194048 Returning pos = 20742144 Inside snd_pcm_update_hw_ptr_pos, pos is 20742144 ALSA sound/core/pcm_lib.c:167: BUG: stream = 0, pos = 0x13c8000, buffer size = 0x4000, period size = 0x800 returning pos 20742144
I can see things are horribaly wrong here....
On 6/26/07, Clemens Ladisch cladisch@fastmail.net wrote:
Pharaoh . wrote:
After rewriting the pointer function
It would really help if you'd show us the code of the version of the driver that you're currently talking about.
I am not getting the input/output error but I am getting underruns. ... ALSA sound/core/pcm_lib.c:167: BUG: stream = 0, pos = 0x1150000, buffer
size = 0x4000, period size = 0x800
Here, "pos" is the value returned by your pointer callback. This value should have been a frame number somewhere in the buffer, i.e., in the range 0..0x3fff. Apparently, the pointer callback doesn't correctly calculate this value.
Please remove most printk()s, and add some in the pointer callback to show both the value that you get from the DMA controller, and the value that this function returns.
Regards, Clemens