2 * \file <alsa/global.h>
3 * \brief Application interface library for the ALSA driver
4 * \author Jaroslav Kysela <perex@suse.cz>
5 * \author Abramo Bagnara <abramo@alsa-project.org>
6 * \author Takashi Iwai <tiwai@suse.de>
9 * Application interface library for the ALSA driver
12 * This library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as
14 * published by the Free Software Foundation; either version 2.1 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #ifndef __ALSA_GLOBAL_H_
29 #define __ALSA_GLOBAL_H_
36 * \defgroup Global Global defines and functions
37 * Global defines and functions.
39 * The ALSA library implementation uses these macros and functions.
40 * Most applications probably do not need them.
44 const char *snd_asoundlib_version(void);
46 #ifndef ATTRIBUTE_UNUSED
47 /** do not print warning (gcc) when function parameter is not used */
48 #define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
51 #ifdef PIC /* dynamic build */
53 /** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
54 #define __SND_DLSYM_VERSION(name, version) _ ## name ## version
57 * \brief Appends the build version to the name of a versioned dynamic symbol.
59 #define SND_DLSYM_BUILD_VERSION(name, version) char __SND_DLSYM_VERSION(name, version);
61 #else /* static build */
63 struct snd_dlsym_link {
64 struct snd_dlsym_link *next;
65 const char *dlsym_name;
66 const void *dlsym_ptr;
69 extern struct snd_dlsym_link *snd_dlsym_start;
71 /** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
72 #define __SND_DLSYM_VERSION(prefix, name, version) _ ## prefix ## name ## version
75 * \brief Appends the build version to the name of a versioned dynamic symbol.
77 #define SND_DLSYM_BUILD_VERSION(name, version) \
78 static struct snd_dlsym_link __SND_DLSYM_VERSION(snd_dlsym_, name, version); \
79 void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) __attribute__ ((constructor)); \
80 void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) { \
81 __SND_DLSYM_VERSION(snd_dlsym_, name, version).next = snd_dlsym_start; \
82 __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_name = # name; \
83 __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_ptr = (void *)&name; \
84 snd_dlsym_start = &__SND_DLSYM_VERSION(snd_dlsym_, name, version); \
90 /** \brief Return 'x' argument as string */
91 #define __STRING(x) #x
94 /** \brief Returns the version of a dynamic symbol as a string. */
95 #define SND_DLSYM_VERSION(version) __STRING(version)
97 void *snd_dlopen(const char *file, int mode);
98 void *snd_dlsym(void *handle, const char *name, const char *version);
99 int snd_dlclose(void *handle);
103 * \brief Internal structure for an async notification client handler.
105 * The ALSA library uses a pointer to this structure as a handle to an async
106 * notification object. Applications don't access its contents directly.
108 typedef struct _snd_async_handler snd_async_handler_t;
111 * \brief Async notification callback.
113 * See the #snd_async_add_handler function for details.
115 typedef void (*snd_async_callback_t)(snd_async_handler_t *handler);
117 int snd_async_add_handler(snd_async_handler_t **handler, int fd,
118 snd_async_callback_t callback, void *private_data);
119 int snd_async_del_handler(snd_async_handler_t *handler);
120 int snd_async_handler_get_fd(snd_async_handler_t *handler);
121 int snd_async_handler_get_signo(snd_async_handler_t *handler);
122 void *snd_async_handler_get_callback_private(snd_async_handler_t *handler);
124 struct snd_shm_area *snd_shm_area_create(int shmid, void *ptr);
125 struct snd_shm_area *snd_shm_area_share(struct snd_shm_area *area);
126 int snd_shm_area_destroy(struct snd_shm_area *area);
128 int snd_user_file(const char *file, char **result);
131 typedef struct timeval snd_timestamp_t;
132 /** Hi-res timestamp */
133 typedef struct timespec snd_htimestamp_t;
141 #endif /* __ALSA_GLOBAL_H */