28 #ifndef __ALSA_TIMER_H
29 #define __ALSA_TIMER_H
42 #define SND_TIMER_DLSYM_VERSION _dlsym_timer_001
44 #define SND_TIMER_QUERY_DLSYM_VERSION _dlsym_timer_query_001
61 typedef enum _snd_timer_class {
71 typedef enum _snd_timer_slave_class {
80 typedef enum _snd_timer_event {
81 SND_TIMER_EVENT_RESOLUTION = 0,
83 SND_TIMER_EVENT_START,
85 SND_TIMER_EVENT_CONTINUE,
86 SND_TIMER_EVENT_PAUSE,
87 SND_TIMER_EVENT_EARLY,
88 SND_TIMER_EVENT_SUSPEND,
89 SND_TIMER_EVENT_RESUME,
91 SND_TIMER_EVENT_MSTART = SND_TIMER_EVENT_START + 10,
92 SND_TIMER_EVENT_MSTOP = SND_TIMER_EVENT_STOP + 10,
93 SND_TIMER_EVENT_MCONTINUE = SND_TIMER_EVENT_CONTINUE + 10,
94 SND_TIMER_EVENT_MPAUSE = SND_TIMER_EVENT_PAUSE + 10,
95 SND_TIMER_EVENT_MSUSPEND = SND_TIMER_EVENT_SUSPEND + 10,
96 SND_TIMER_EVENT_MRESUME = SND_TIMER_EVENT_RESUME + 10
100 typedef struct _snd_timer_read {
106 typedef struct _snd_timer_tread {
113 #define SND_TIMER_GLOBAL_SYSTEM 0
115 #define SND_TIMER_GLOBAL_RTC 1
117 #define SND_TIMER_GLOBAL_HPET 2
119 #define SND_TIMER_GLOBAL_HRTIMER 3
122 #define SND_TIMER_OPEN_NONBLOCK (1<<0)
124 #define SND_TIMER_OPEN_TREAD (1<<1)
127 typedef enum _snd_timer_type {
169 #define snd_timer_id_alloca(ptr) __snd_alloca(ptr, snd_timer_id)
187 #define snd_timer_ginfo_alloca(ptr) __snd_alloca(ptr, snd_timer_ginfo)
205 #define snd_timer_info_alloca(ptr) __snd_alloca(ptr, snd_timer_info)
218 #define snd_timer_params_alloca(ptr) __snd_alloca(ptr, snd_timer_params)
238 #define snd_timer_status_alloca(ptr) __snd_alloca(ptr, snd_timer_status)
void snd_timer_id_copy(snd_timer_id_t *dst, const snd_timer_id_t *src)
copy one snd_timer_id_t structure to another
Definition: timer_query.c:480
struct _snd_timer_ginfo snd_timer_ginfo_t
Definition: timer.h:49
unsigned int val
Definition: timer.h:109
snd_htimestamp_t snd_timer_status_get_timestamp(snd_timer_status_t *status)
get timestamp
Definition: timer.c:837
int snd_timer_query_next_device(snd_timer_query_t *handle, snd_timer_id_t *tid)
obtain the next timer identification
Definition: timer_query.c:223
struct _snd_timer_gstatus snd_timer_gstatus_t
Definition: timer.h:53
struct _snd_timer_id snd_timer_id_t
Definition: timer.h:47
int snd_timer_id_get_sclass(snd_timer_id_t *id)
get timer sub-class
Definition: timer_query.c:524
snd_timer_t * snd_async_handler_get_timer(snd_async_handler_t *handler)
Return timer handle related to an async handler.
Definition: timer.c:326
int snd_timer_close(snd_timer_t *handle)
close timer handle
Definition: timer.c:243
snd_timer_event_t
Definition: timer.h:80
long snd_timer_params_get_ticks(snd_timer_params_t *params)
get timer ticks
Definition: timer.c:707
size_t snd_timer_params_sizeof(void)
get size of the snd_timer_params_t structure in bytes
Definition: timer.c:557
void(* snd_async_callback_t)(snd_async_handler_t *handler)
Async notification callback.
Definition: global.h:121
long snd_timer_status_get_lost(snd_timer_status_t *status)
get master tick lost count
Definition: timer.c:859
void snd_timer_status_copy(snd_timer_status_t *dst, const snd_timer_status_t *src)
copy one snd_timer_status_t structure to another
Definition: timer.c:824
ssize_t snd_timer_read(snd_timer_t *handle, void *buffer, size_t size)
read bytes using timer handle
Definition: timer.c:939
int snd_timer_status(snd_timer_t *handle, snd_timer_status_t *status)
get status from timer handle
Definition: timer.c:893
size_t snd_timer_info_sizeof(void)
get size of the snd_timer_info_t structure in bytes
Definition: timer.c:438
long snd_timer_info_get_resolution(snd_timer_info_t *info)
get timer resolution in us
Definition: timer.c:534
struct _snd_timer_query snd_timer_query_t
Definition: timer.h:137
int snd_timer_open(snd_timer_t **handle, const char *name, int mode)
Opens a new connection to the timer interface.
Definition: timer.c:207
int snd_timer_poll_descriptors(snd_timer_t *handle, struct pollfd *pfds, unsigned int space)
get poll descriptors
Definition: timer.c:353
const char * snd_timer_info_get_name(snd_timer_info_t *info)
get timer name
Definition: timer.c:522
int snd_timer_open_lconf(snd_timer_t **handle, const char *name, int mode, snd_config_t *lconf)
Opens a new connection to the timer interface using local configuration.
Definition: timer.c:228
int snd_timer_info_malloc(snd_timer_info_t **ptr)
allocate a new snd_timer_info_t structure
Definition: timer.c:451
int snd_timer_params_set_exclusive(snd_timer_params_t *params, int exclusive)
set timer exclusive use
Definition: timer.c:637
int snd_timer_query_status(snd_timer_query_t *handle, snd_timer_gstatus_t *status)
get the timer global status
Definition: timer_query.c:427
struct _snd_timer_params snd_timer_params_t
Definition: timer.h:57
void snd_timer_params_set_queue_size(snd_timer_params_t *params, long queue_size)
set timer queue size (32-1024)
Definition: timer.c:718
char * snd_timer_ginfo_get_id(snd_timer_ginfo_t *obj)
get timer identification
Definition: timer_query.c:327
snd_timer_event_t event
Definition: timer.h:107
struct _snd_timer snd_timer_t
Definition: timer.h:139
void snd_timer_ginfo_copy(snd_timer_ginfo_t *dst, const snd_timer_ginfo_t *src)
copy one snd_timer_info_t structure to another
Definition: timer_query.c:274
unsigned long snd_timer_ginfo_get_resolution_min(snd_timer_ginfo_t *obj)
get timer minimal resolution in ns
Definition: timer_query.c:357
int snd_timer_info_is_slave(snd_timer_info_t *info)
determine, if timer is slave
Definition: timer.c:489
unsigned int ticks
Definition: timer.h:102
struct _snd_timer_status snd_timer_status_t
Definition: timer.h:59
int snd_timer_params_set_auto_start(snd_timer_params_t *params, int auto_start)
set timer auto start
Definition: timer.c:608
int snd_timer_poll_descriptors_revents(snd_timer_t *timer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
get returned events from poll descriptors
Definition: timer.c:384
size_t snd_timer_status_sizeof(void)
get size of the snd_timer_status_t structure in bytes
Definition: timer.c:784
long snd_timer_status_get_resolution(snd_timer_status_t *status)
get resolution in us
Definition: timer.c:848
int snd_timer_params_malloc(snd_timer_params_t **ptr)
allocate a new snd_timer_params_t structure
Definition: timer.c:570
struct timespec snd_htimestamp_t
Definition: global.h:153
int snd_timer_stop(snd_timer_t *handle)
stop the timer
Definition: timer.c:916
int snd_timer_query_params(snd_timer_query_t *handle, snd_timer_gparams_t *params)
set the timer global parameters
Definition: timer_query.c:409
struct _snd_timer_gparams snd_timer_gparams_t
Definition: timer.h:51
int snd_timer_params_get_early_event(snd_timer_params_t *params)
determine if timer has early event flag
Definition: timer.c:685
long snd_timer_status_get_overrun(snd_timer_status_t *status)
get overrun count
Definition: timer.c:870
void snd_timer_info_free(snd_timer_info_t *obj)
frees the snd_timer_info_t structure
Definition: timer.c:467
int snd_timer_params_set_early_event(snd_timer_params_t *params, int early_event)
set timer early event
Definition: timer.c:670
unsigned int snd_timer_params_get_filter(snd_timer_params_t *params)
get timer event filter
Definition: timer.c:759
void snd_timer_id_free(snd_timer_id_t *obj)
frees the snd_timer_id_t structure
Definition: timer_query.c:469
void snd_timer_info_copy(snd_timer_info_t *dst, const snd_timer_info_t *src)
copy one snd_timer_info_t structure to another
Definition: timer.c:478
snd_timer_slave_class_t
Definition: timer.h:71
int snd_timer_ginfo_set_tid(snd_timer_ginfo_t *obj, snd_timer_id_t *tid)
set timer identification
Definition: timer_query.c:286
unsigned int resolution
Definition: timer.h:101
int snd_timer_ginfo_get_card(snd_timer_ginfo_t *obj)
get associated card with timer
Definition: timer_query.c:317
void snd_timer_params_free(snd_timer_params_t *obj)
frees the snd_timer_params_t structure
Definition: timer.c:586
int snd_timer_id_get_device(snd_timer_id_t *id)
get timer device
Definition: timer_query.c:568
int snd_timer_id_get_subdevice(snd_timer_id_t *id)
get timer subdevice
Definition: timer_query.c:590
int snd_timer_status_malloc(snd_timer_status_t **ptr)
allocate a new snd_timer_status_t structure
Definition: timer.c:797
int snd_timer_id_get_class(snd_timer_id_t *id)
get timer class
Definition: timer_query.c:502
int snd_timer_id_malloc(snd_timer_id_t **ptr)
allocate a new snd_timer_id_t structure
Definition: timer_query.c:453
size_t snd_timer_id_sizeof(void)
get size of the snd_timer_id_t structure in bytes
Definition: timer_query.c:440
int snd_timer_query_open_lconf(snd_timer_query_t **handle, const char *name, int mode, snd_config_t *lconf)
Opens a new connection to the timer query interface using local configuration.
Definition: timer_query.c:187
struct _snd_async_handler snd_async_handler_t
Internal structure for an async notification client handler.
Definition: global.h:114
void snd_timer_params_set_filter(snd_timer_params_t *params, unsigned int filter)
set timer event filter
Definition: timer.c:743
int snd_timer_poll_descriptors_count(snd_timer_t *handle)
get count of poll descriptors for timer handle
Definition: timer.c:340
void snd_timer_params_set_ticks(snd_timer_params_t *params, long ticks)
set timer ticks
Definition: timer.c:696
void snd_timer_id_set_class(snd_timer_id_t *id, int dev_class)
set timer class
Definition: timer_query.c:491
long snd_timer_status_get_queue(snd_timer_status_t *status)
get count of used queue elements
Definition: timer.c:881
char * snd_timer_ginfo_get_name(snd_timer_ginfo_t *obj)
get timer name
Definition: timer_query.c:337
int snd_timer_start(snd_timer_t *handle)
start the timer
Definition: timer.c:905
int snd_timer_query_close(snd_timer_query_t *handle)
close timer query handle
Definition: timer_query.c:202
int snd_timer_params_get_exclusive(snd_timer_params_t *params)
determine if timer has exclusive flag
Definition: timer.c:657
int snd_timer_params(snd_timer_t *handle, snd_timer_params_t *params)
set parameters for timer handle
Definition: timer.c:773
unsigned int snd_timer_ginfo_get_flags(snd_timer_ginfo_t *obj)
get timer flags
Definition: timer_query.c:307
struct _snd_config snd_config_t
Internal structure for a configuration node object.
Definition: conf.h:69
int snd_timer_info_get_card(snd_timer_info_t *info)
get timer card
Definition: timer.c:500
snd_timer_id_t * snd_timer_ginfo_get_tid(snd_timer_ginfo_t *obj)
get timer identification
Definition: timer_query.c:297
struct _snd_timer_info snd_timer_info_t
Definition: timer.h:55
int snd_timer_id_get_card(snd_timer_id_t *id)
get timer card
Definition: timer_query.c:546
void snd_timer_id_set_device(snd_timer_id_t *id, int device)
set timer device
Definition: timer_query.c:557
int snd_timer_continue(snd_timer_t *handle)
continue the timer
Definition: timer.c:927
void snd_timer_status_free(snd_timer_status_t *obj)
frees the snd_timer_status_t structure
Definition: timer.c:813
void snd_timer_id_set_sclass(snd_timer_id_t *id, int dev_sclass)
set timer sub-class
Definition: timer_query.c:513
int snd_timer_query_info(snd_timer_query_t *handle, snd_timer_ginfo_t *info)
obtain the timer global information
Definition: timer_query.c:391
void snd_timer_id_set_subdevice(snd_timer_id_t *id, int subdevice)
set timer subdevice
Definition: timer_query.c:579
long snd_timer_params_get_queue_size(snd_timer_params_t *params)
get queue size
Definition: timer.c:729
unsigned long snd_timer_ginfo_get_resolution(snd_timer_ginfo_t *obj)
get timer resolution in ns
Definition: timer_query.c:347
void snd_timer_ginfo_free(snd_timer_ginfo_t *obj)
frees the snd_timer_ginfo_t structure
Definition: timer_query.c:263
int snd_async_add_timer_handler(snd_async_handler_t **handler, snd_timer_t *timer, snd_async_callback_t callback, void *private_data)
Add an async handler for a timer.
Definition: timer.c:296
int snd_timer_params_get_auto_start(snd_timer_params_t *params)
determine if timer has auto start flag
Definition: timer.c:623
unsigned long snd_timer_ginfo_get_resolution_max(snd_timer_ginfo_t *obj)
get timer maximal resolution in ns
Definition: timer_query.c:367
void * ptr
Definition: seq_event.h:199
const char * snd_timer_info_get_id(snd_timer_info_t *info)
get timer id
Definition: timer.c:511
size_t snd_timer_ginfo_sizeof(void)
get size of the snd_timer_ginfo_t structure in bytes
Definition: timer_query.c:234
snd_htimestamp_t tstamp
Definition: timer.h:108
unsigned int snd_timer_ginfo_get_clients(snd_timer_ginfo_t *obj)
get current timer clients
Definition: timer_query.c:377
long snd_timer_info_get_ticks(snd_timer_info_t *info)
(DEPRECATED) get maximum timer ticks
Definition: timer.c:952
snd_timer_type_t
Definition: timer.h:127
int snd_timer_query_open(snd_timer_query_t **handle, const char *name, int mode)
Opens a new connection to the timer query interface.
Definition: timer_query.c:166
void snd_timer_id_set_card(snd_timer_id_t *id, int card)
set timer card
Definition: timer_query.c:535
int snd_timer_ginfo_malloc(snd_timer_ginfo_t **ptr)
allocate a new snd_timer_ginfo_t structure
Definition: timer_query.c:247
int snd_timer_info(snd_timer_t *handle, snd_timer_info_t *timer)
get information about timer handle
Definition: timer.c:546
snd_timer_class_t
Definition: timer.h:61
void snd_timer_params_copy(snd_timer_params_t *dst, const snd_timer_params_t *src)
copy one snd_timer_params_t structure to another
Definition: timer.c:597