summaryrefslogtreecommitdiff
path: root/axfer/xfer-libasound-irq-rw.c
Commit message (Collapse)AuthorAgeFilesLines
* axfer: handle -ETIMEDOUT before non-block I/O operationTakashi Sakamoto2019-10-301-1/+10
| | | | | | | | | | | | | | When running for IRQ-based scheduling model, transmission backend is expected to queue PCM event in different context from the main thread. When queueing no events during time equivalent to one period of PCM buffer, the backend has problems. This commit outputs report it for non-blocking operation for IRQ-based scheduling model. The timeout is equivalent to all frames in buffer, instead of period for safe. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* axfer: code refactoring for a helper function to wait for avail buffer spaceTakashi Sakamoto2019-10-301-26/+28
| | | | | | | | | This commit applies code refactoring for waiting PCM event queued per period of PCM buffer in copying operation for IRQ-based scheduling model. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* axfer: add a common interface of waiter for I/O event notificationTakashi Sakamoto2018-11-131-2/+24
| | | | | | | | | | | | | | | There're several types of system calls for multiplexed I/O. They're used to receive notifications of I/O events. Typically, userspace applications call them against file descriptor to yield CPU. When I/O is enabled on any of the descriptors, a task of the application is rescheduled, then the application execute I/O calls. This commit adds a common interface for this type of system calls, named as 'waiter'. This is expected to be used with non-blocking file operation and operations on mapped page frame. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* axfer: add an option to suppress event waitingTakashi Sakamoto2018-11-131-8/+12
| | | | | | | | | | | | In aplay, '--test-nowait' is used to suppress calls of snd_pcm_wait() when I/O operations return -EAGAIN or process truncated number of data frames. This seems to be for debugging purpose. In this program, this option is equivalent to suppress event waiting. This commit adds support for this option. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* axfer: add support for non-blocking operationTakashi Sakamoto2018-11-131-4/+98
| | | | | | | | | | | | | | | | In alsa-lib PCM API, snd_pcm_read[i|n]() and snd_pcm_write[i|n] can be used with non-blocking mode. This is available when SND_PCM_NONBLOCK is used as 'mode' argument for a call of snd_pcm_open(). This commit adds support this type of operation. To reduce CPU usage, this commit uses 'snd_pcm_wait()' to wait for event notification. Below lines are examples to execute: $ axfer transfer -N -P -d 2 -D hw:0,3 /dev/urandom -f dat -vvv $ axfer transfer -N -C -d 2 -D hw:1,0 /dev/null -r 48000 -vvv Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* axfer: add support for blocking data transmission operation of alsa-lib PCM APITakashi Sakamoto2018-11-131-0/+307
In alsa-lib PCM API, snd_pcm_read[i|n]() and snd_pcm_write[i|n]() are used to transfer data frames from/to hardware. When a handler is not opened with specific flags, these functions perform blocking operation; i.e. the function call doesn't return till all of request number of data frames are actually handled, or call is interrupted by Unix signals, or PCM substeam corrupts due to hardware reasons. This commit adds support for this type of data transmission. For cases that requested data frames are not processed by container interface, this commit adds internal cache mechanism to handle rest of data frames in next timing. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>