/home/users/builder/rpm/BUILD/alsa-lib-1.0.13/include/timer.h

Go to the documentation of this file.
00001 
00011 /*
00012  *   This library is free software; you can redistribute it and/or modify
00013  *   it under the terms of the GNU Lesser General Public License as
00014  *   published by the Free Software Foundation; either version 2.1 of
00015  *   the License, or (at your option) any later version.
00016  *
00017  *   This program is distributed in the hope that it will be useful,
00018  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *   GNU Lesser General Public License for more details.
00021  *
00022  *   You should have received a copy of the GNU Lesser General Public
00023  *   License along with this library; if not, write to the Free Software
00024  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00025  *
00026  */
00027 
00028 #ifndef __ALSA_TIMER_H
00029 #define __ALSA_TIMER_H
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034 
00042 #define SND_TIMER_DLSYM_VERSION         _dlsym_timer_001
00043 
00044 #define SND_TIMER_QUERY_DLSYM_VERSION   _dlsym_timer_query_001
00045 
00047 typedef struct _snd_timer_id snd_timer_id_t;
00049 typedef struct _snd_timer_ginfo snd_timer_ginfo_t;
00051 typedef struct _snd_timer_gparams snd_timer_gparams_t;
00053 typedef struct _snd_timer_gstatus snd_timer_gstatus_t;
00055 typedef struct _snd_timer_info snd_timer_info_t;
00057 typedef struct _snd_timer_params snd_timer_params_t;
00059 typedef struct _snd_timer_status snd_timer_status_t;
00061 typedef enum _snd_timer_class {
00062         SND_TIMER_CLASS_NONE = -1,      
00063         SND_TIMER_CLASS_SLAVE = 0,      
00064         SND_TIMER_CLASS_GLOBAL,         
00065         SND_TIMER_CLASS_CARD,           
00066         SND_TIMER_CLASS_PCM,            
00067         SND_TIMER_CLASS_LAST = SND_TIMER_CLASS_PCM      
00068 } snd_timer_class_t;
00069 
00071 typedef enum _snd_timer_slave_class {
00072         SND_TIMER_SCLASS_NONE = 0,              
00073         SND_TIMER_SCLASS_APPLICATION,           
00074         SND_TIMER_SCLASS_SEQUENCER,             
00075         SND_TIMER_SCLASS_OSS_SEQUENCER,         
00076         SND_TIMER_SCLASS_LAST = SND_TIMER_SCLASS_OSS_SEQUENCER  
00077 } snd_timer_slave_class_t;
00078 
00080 typedef enum _snd_timer_event {
00081         SND_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */
00082         SND_TIMER_EVENT_TICK,           /* val = ticks */
00083         SND_TIMER_EVENT_START,          /* val = resolution in ns */
00084         SND_TIMER_EVENT_STOP,           /* val = 0 */
00085         SND_TIMER_EVENT_CONTINUE,       /* val = resolution in ns */
00086         SND_TIMER_EVENT_PAUSE,          /* val = 0 */
00087         SND_TIMER_EVENT_EARLY,          /* val = 0 */
00088         SND_TIMER_EVENT_SUSPEND,        /* val = 0 */
00089         SND_TIMER_EVENT_RESUME,         /* val = resolution in ns */
00090         /* master timer events for slave timer instances */
00091         SND_TIMER_EVENT_MSTART = SND_TIMER_EVENT_START + 10,
00092         SND_TIMER_EVENT_MSTOP = SND_TIMER_EVENT_STOP + 10,
00093         SND_TIMER_EVENT_MCONTINUE = SND_TIMER_EVENT_CONTINUE + 10,
00094         SND_TIMER_EVENT_MPAUSE = SND_TIMER_EVENT_PAUSE + 10,
00095         SND_TIMER_EVENT_MSUSPEND = SND_TIMER_EVENT_SUSPEND + 10,
00096         SND_TIMER_EVENT_MRESUME = SND_TIMER_EVENT_RESUME + 10   
00097 } snd_timer_event_t;
00098 
00100 typedef struct _snd_timer_read {
00101         unsigned int resolution;        
00102         unsigned int ticks;             
00103 } snd_timer_read_t;
00104 
00106 typedef struct _snd_timer_tread {
00107         snd_timer_event_t event;        
00108         snd_htimestamp_t tstamp;        
00109         unsigned int val;               
00110 } snd_timer_tread_t;
00111 
00113 #define SND_TIMER_GLOBAL_SYSTEM 0
00114 
00115 #define SND_TIMER_GLOBAL_RTC    1
00116 
00117 #define SND_TIMER_GLOBAL_HPET   2
00118 
00120 #define SND_TIMER_OPEN_NONBLOCK         (1<<0)
00121 
00122 #define SND_TIMER_OPEN_TREAD            (1<<1)
00123 
00125 typedef enum _snd_timer_type {
00127         SND_TIMER_TYPE_HW = 0,
00129         SND_TIMER_TYPE_SHM,
00131         SND_TIMER_TYPE_INET
00132 } snd_timer_type_t;
00133 
00135 typedef struct _snd_timer_query snd_timer_query_t;
00137 typedef struct _snd_timer snd_timer_t;
00138 
00139 
00140 int snd_timer_query_open(snd_timer_query_t **handle, const char *name, int mode);
00141 int snd_timer_query_open_lconf(snd_timer_query_t **handle, const char *name, int mode, snd_config_t *lconf);
00142 int snd_timer_query_close(snd_timer_query_t *handle);
00143 int snd_timer_query_next_device(snd_timer_query_t *handle, snd_timer_id_t *tid);
00144 int snd_timer_query_info(snd_timer_query_t *handle, snd_timer_ginfo_t *info);
00145 int snd_timer_query_params(snd_timer_query_t *handle, snd_timer_gparams_t *params);
00146 int snd_timer_query_status(snd_timer_query_t *handle, snd_timer_gstatus_t *status);
00147 
00148 int snd_timer_open(snd_timer_t **handle, const char *name, int mode);
00149 int snd_timer_open_lconf(snd_timer_t **handle, const char *name, int mode, snd_config_t *lconf);
00150 int snd_timer_close(snd_timer_t *handle);
00151 int snd_async_add_timer_handler(snd_async_handler_t **handler, snd_timer_t *timer,
00152                                 snd_async_callback_t callback, void *private_data);
00153 snd_timer_t *snd_async_handler_get_timer(snd_async_handler_t *handler);
00154 int snd_timer_poll_descriptors_count(snd_timer_t *handle);
00155 int snd_timer_poll_descriptors(snd_timer_t *handle, struct pollfd *pfds, unsigned int space);
00156 int snd_timer_poll_descriptors_revents(snd_timer_t *timer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
00157 int snd_timer_info(snd_timer_t *handle, snd_timer_info_t *timer);
00158 int snd_timer_params(snd_timer_t *handle, snd_timer_params_t *params);
00159 int snd_timer_status(snd_timer_t *handle, snd_timer_status_t *status);
00160 int snd_timer_start(snd_timer_t *handle);
00161 int snd_timer_stop(snd_timer_t *handle);
00162 int snd_timer_continue(snd_timer_t *handle);
00163 ssize_t snd_timer_read(snd_timer_t *handle, void *buffer, size_t size);
00164 
00165 size_t snd_timer_id_sizeof(void);
00167 #define snd_timer_id_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_id_t *) alloca(snd_timer_id_sizeof()); memset(*ptr, 0, snd_timer_id_sizeof()); } while (0)
00168 int snd_timer_id_malloc(snd_timer_id_t **ptr);
00169 void snd_timer_id_free(snd_timer_id_t *obj);
00170 void snd_timer_id_copy(snd_timer_id_t *dst, const snd_timer_id_t *src);
00171 
00172 void snd_timer_id_set_class(snd_timer_id_t *id, int dev_class);
00173 int snd_timer_id_get_class(snd_timer_id_t *id);
00174 void snd_timer_id_set_sclass(snd_timer_id_t *id, int dev_sclass);
00175 int snd_timer_id_get_sclass(snd_timer_id_t *id);
00176 void snd_timer_id_set_card(snd_timer_id_t *id, int card);
00177 int snd_timer_id_get_card(snd_timer_id_t *id);
00178 void snd_timer_id_set_device(snd_timer_id_t *id, int device);
00179 int snd_timer_id_get_device(snd_timer_id_t *id);
00180 void snd_timer_id_set_subdevice(snd_timer_id_t *id, int subdevice);
00181 int snd_timer_id_get_subdevice(snd_timer_id_t *id);
00182 
00183 size_t snd_timer_ginfo_sizeof(void);
00185 #define snd_timer_ginfo_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_ginfo_t *) alloca(snd_timer_ginfo_sizeof()); memset(*ptr, 0, snd_timer_ginfo_sizeof()); } while (0)
00186 int snd_timer_ginfo_malloc(snd_timer_ginfo_t **ptr);
00187 void snd_timer_ginfo_free(snd_timer_ginfo_t *obj);
00188 void snd_timer_ginfo_copy(snd_timer_ginfo_t *dst, const snd_timer_ginfo_t *src);
00189 
00190 int snd_timer_ginfo_set_tid(snd_timer_ginfo_t *obj, snd_timer_id_t *tid);
00191 snd_timer_id_t *snd_timer_ginfo_get_tid(snd_timer_ginfo_t *obj);
00192 unsigned int snd_timer_ginfo_get_flags(snd_timer_ginfo_t *obj);
00193 int snd_timer_ginfo_get_card(snd_timer_ginfo_t *obj);
00194 char *snd_timer_ginfo_get_id(snd_timer_ginfo_t *obj);
00195 char *snd_timer_ginfo_get_name(snd_timer_ginfo_t *obj);
00196 unsigned long snd_timer_ginfo_get_resolution(snd_timer_ginfo_t *obj);
00197 unsigned long snd_timer_ginfo_get_resolution_min(snd_timer_ginfo_t *obj);
00198 unsigned long snd_timer_ginfo_get_resolution_max(snd_timer_ginfo_t *obj);
00199 unsigned int snd_timer_ginfo_get_clients(snd_timer_ginfo_t *obj);
00200 
00201 size_t snd_timer_info_sizeof(void);
00203 #define snd_timer_info_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_info_t *) alloca(snd_timer_info_sizeof()); memset(*ptr, 0, snd_timer_info_sizeof()); } while (0)
00204 int snd_timer_info_malloc(snd_timer_info_t **ptr);
00205 void snd_timer_info_free(snd_timer_info_t *obj);
00206 void snd_timer_info_copy(snd_timer_info_t *dst, const snd_timer_info_t *src);
00207 
00208 int snd_timer_info_is_slave(snd_timer_info_t * info);
00209 int snd_timer_info_get_card(snd_timer_info_t * info);
00210 const char *snd_timer_info_get_id(snd_timer_info_t * info);
00211 const char *snd_timer_info_get_name(snd_timer_info_t * info);
00212 long snd_timer_info_get_resolution(snd_timer_info_t * info);
00213 
00214 size_t snd_timer_params_sizeof(void);
00216 #define snd_timer_params_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_params_t *) alloca(snd_timer_params_sizeof()); memset(*ptr, 0, snd_timer_params_sizeof()); } while (0)
00217 int snd_timer_params_malloc(snd_timer_params_t **ptr);
00218 void snd_timer_params_free(snd_timer_params_t *obj);
00219 void snd_timer_params_copy(snd_timer_params_t *dst, const snd_timer_params_t *src);
00220 
00221 int snd_timer_params_set_auto_start(snd_timer_params_t * params, int auto_start);
00222 int snd_timer_params_get_auto_start(snd_timer_params_t * params);
00223 int snd_timer_params_set_exclusive(snd_timer_params_t * params, int exclusive);
00224 int snd_timer_params_get_exclusive(snd_timer_params_t * params);
00225 int snd_timer_params_set_early_event(snd_timer_params_t * params, int early_event);
00226 int snd_timer_params_get_early_event(snd_timer_params_t * params);
00227 void snd_timer_params_set_ticks(snd_timer_params_t * params, long ticks);
00228 long snd_timer_params_get_ticks(snd_timer_params_t * params);
00229 void snd_timer_params_set_queue_size(snd_timer_params_t * params, long queue_size);
00230 long snd_timer_params_get_queue_size(snd_timer_params_t * params);
00231 void snd_timer_params_set_filter(snd_timer_params_t * params, unsigned int filter);
00232 unsigned int snd_timer_params_get_filter(snd_timer_params_t * params);
00233 
00234 size_t snd_timer_status_sizeof(void);
00236 #define snd_timer_status_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_status_t *) alloca(snd_timer_status_sizeof()); memset(*ptr, 0, snd_timer_status_sizeof()); } while (0)
00237 int snd_timer_status_malloc(snd_timer_status_t **ptr);
00238 void snd_timer_status_free(snd_timer_status_t *obj);
00239 void snd_timer_status_copy(snd_timer_status_t *dst, const snd_timer_status_t *src);
00240 
00241 snd_htimestamp_t snd_timer_status_get_timestamp(snd_timer_status_t * status);
00242 long snd_timer_status_get_resolution(snd_timer_status_t * status);
00243 long snd_timer_status_get_lost(snd_timer_status_t * status);
00244 long snd_timer_status_get_overrun(snd_timer_status_t * status);
00245 long snd_timer_status_get_queue(snd_timer_status_t * status);
00246 
00247 /* deprecated functions, for compatibility */
00248 long snd_timer_info_get_ticks(snd_timer_info_t * info);
00249 
00252 #ifdef __cplusplus
00253 }
00254 #endif
00255 
00256 #endif 

Generated on Sun Apr 1 18:36:42 2007 for ALSA project - the C library reference by  doxygen 1.5.1