Generic architecture support

Support dmix on generic architectures without atomic operations but
using a semaphore to avoid concurrent accesses.  This is less effective
than atomic operations but should work on every system.
This commit is contained in:
Takashi Iwai 2005-03-29 14:13:04 +00:00
parent 6a6a70ffe7
commit 9207804912
2 changed files with 15 additions and 5 deletions

View file

@ -228,8 +228,15 @@ static void snd_pcm_dmix_sync_area(snd_pcm_t *pcm, snd_pcm_uframes_t size)
transfer = appl_ptr + size > pcm->buffer_size ? pcm->buffer_size - appl_ptr : size;
if (slave_appl_ptr + transfer > dmix->shmptr->s.buffer_size)
transfer = dmix->shmptr->s.buffer_size - slave_appl_ptr;
if (transfer)
if (transfer) {
#ifdef NO_CONCURRENT_ACCESS
snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
#endif
mix_areas(dmix, src_areas, dst_areas, appl_ptr, slave_appl_ptr, transfer);
#ifdef NO_CONCURRENT_ACCESS
snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
#endif
}
if (transfer >= size)
return;
size -= transfer;