Exemplo n.º 1
0
static void au1000_dma_start(struct audio_stream *stream)
{
	if (!stream->buffer)
		return;

	init_dma(stream->dma);
	if (get_dma_active_buffer(stream->dma) == 0) {
		clear_dma_done0(stream->dma);
		set_dma_addr0(stream->dma, stream->buffer->start);
		set_dma_count0(stream->dma, stream->period_size >> 1);
		set_dma_addr1(stream->dma, stream->buffer->next->start);
		set_dma_count1(stream->dma, stream->period_size >> 1);
	} else {
Exemplo n.º 2
0
static void
au1000_dma_start(audio_stream_t *stream)
{
	snd_pcm_substream_t *substream = stream->substream;
	snd_pcm_runtime_t *runtime = substream->runtime;

	unsigned long flags, dma_start;
	int i;
	au1000_period_t * pointer;

	if (stream->buffer == NULL) {
		dma_start = virt_to_phys(runtime->dma_area);

		stream->period_size = frames_to_bytes(runtime,
			runtime->period_size);
		stream->buffer = kmalloc(sizeof(au1000_period_t), GFP_KERNEL);
		pointer = stream->buffer;
		for (i = 0 ; i < runtime->periods ; i++) {
			pointer->start = (u32)(dma_start +
				(i * stream->period_size));
			pointer->relative_end = (u32)
				(((i+1) * stream->period_size) - 0x1);
			if ( i < runtime->periods - 1) {
				pointer->next = kmalloc(sizeof(au1000_period_t)
					, GFP_KERNEL);
				pointer = pointer->next;
			}
		}
		pointer->next = stream->buffer;

		spin_lock_irqsave(&stream->dma_lock, flags);
		init_dma(stream->dma);
		if (get_dma_active_buffer(stream->dma) == 0) {
			clear_dma_done0(stream->dma);
			set_dma_addr0(stream->dma, stream->buffer->start);
			set_dma_count0(stream->dma, stream->period_size >> 1);
			set_dma_addr1(stream->dma, stream->buffer->next->start);
			set_dma_count1(stream->dma, stream->period_size >> 1);
		} else {