Timer interface

Timer interface is designed to use internal timers in sound hardware, but it can be driven with any timer.

General overview

The timer implementation uses ring buffer to store information about timing events. In this buffer is recorded count of ticks and current tick resolution in nanoseconds.


Timer devices can be opened in two ways. When SND_TIMER_OPEN_NONBLOCK flag is used, then the open functions return immediately with -EBUSY error code when resources are occupied with another application. When SND_TIMER_OPEN_NONBLOCK is not used (by default) the open functions block the application requesting device until resources are not free.


Events are read via snd_timer_read() function.


The full featured examples with cross-links:

example code

This example shows opening a timer device and reading of timer events.