Пример #1
0
/* Start DMA -
 * Do the initial set of work to initialize all the channels as required.
 * We shall then initate a transfer
 */
static int omap_start_sound_dma(audio_stream_t * s, dma_addr_t dma_ptr,
				u_int dma_size)
{
	int ret = -EPERM;

	FN_IN;
	if (unlikely(dma_size > MAX_DMA_SIZE)) {
		ERR("DmaSoundDma: Start: overflowed %d-%d\n", dma_size,
		    MAX_DMA_SIZE);
		return -EOVERFLOW;
	}

	if (AUDIO_QUEUE_FULL(s)) {
		ret = -2;
		goto sound_out;
	}
	
	if (s->input_or_output == FMODE_WRITE)
		/*playback */
	{
		ret =
		    audio_set_dma_params_play(s->lch[s->dma_q_tail], dma_ptr,
					      dma_size);
	} else {
		ret =
		    audio_set_dma_params_capture(s->lch[s->dma_q_tail], dma_ptr,
						 dma_size);
	}
	if (ret != 0) {
		ret = -2;	/* indicate queue full */
		goto sound_out;
	}
	AUDIO_INCREMENT_TAIL(s);
	ret = audio_start_dma_chain(s);
	if (ret) {
		ERR("dma start failed");
	}
      sound_out:
	FN_OUT(ret);
	return ret;

}
Пример #2
0
/*
 * Start DMA -
 * Do the initial set of work to initialize all the channels as required.
 * We shall then initate a transfer
 */
int omap_start_alsa_sound_dma(struct audio_stream *s,
			dma_addr_t dma_ptr,
			u_int dma_size)
{
	int ret = -EPERM;

	FN_IN;

	if (unlikely(dma_size > MAX_DMA_SIZE)) {
		ERR("DmaSoundDma: Start: overflowed %d-%d\n", dma_size,
		    MAX_DMA_SIZE);
		return -EOVERFLOW;
	}

	if (s->stream_id == SNDRV_PCM_STREAM_PLAYBACK) {
		/* playback */
		ret =
		    audio_set_dma_params_play(s->lch[s->dma_q_tail],
					      dma_ptr, dma_size);
	} else {
		ret =
		    audio_set_dma_params_capture(s->lch[s->dma_q_tail],
						 dma_ptr, dma_size);
	}
	if (ret != 0) {
		ret = -3;	/* indicate queue full */
		goto sound_out;
	}
	AUDIO_INCREMENT_TAIL(s);
	ret = audio_start_dma_chain(s);
	if (ret)
		ERR("dma start failed");

sound_out:
	FN_OUT(ret);
	return ret;

}