21 Jul
2020
21 Jul
'20
10:54 p.m.
+static int q6asm_compr_copy(struct snd_soc_component *component,
struct snd_compr_stream *stream, char __user *buf,
{ struct snd_compr_runtime *runtime = stream->runtime; struct q6asm_dai_rtd *prtd = runtime->private_data; unsigned long flags;size_t count)
- u32 wflags = 0;
- int avail, bytes_in_flight = 0;
- void *dstn;
- size_t copy;
- u32 app_pointer;
- u32 bytes_received;
- bytes_received = prtd->bytes_received;
- /**
/*
* Make sure that next track data pointer is aligned at 32 bit boundary
* This is a Mandatory requirement from DSP data buffers alignment
*/
- if (prtd->next_track)
bytes_received = ALIGN(prtd->bytes_received, prtd->pcm_count);
- app_pointer = bytes_received/prtd->pcm_size;
- app_pointer = bytes_received - (app_pointer * prtd->pcm_size);
- dstn = prtd->dma_buffer.area + app_pointer;
- if (count < prtd->pcm_size - app_pointer) {
if (copy_from_user(dstn, buf, count))
return -EFAULT;
- } else {
copy = prtd->pcm_size - app_pointer;
if (copy_from_user(dstn, buf, copy))
return -EFAULT;
if (copy_from_user(prtd->dma_buffer.area, buf + copy,
count - copy))
return -EFAULT;
- }