Path: blob/master/thirdparty/linuxbsd_headers/alsa/global.h
9898 views
/**1* \file include/global.h2* \brief Application interface library for the ALSA driver3* \author Jaroslav Kysela <[email protected]>4* \author Abramo Bagnara <[email protected]>5* \author Takashi Iwai <[email protected]>6* \date 1998-20017*8* Application interface library for the ALSA driver9*/10/*11* This library is free software; you can redistribute it and/or modify12* it under the terms of the GNU Lesser General Public License as13* published by the Free Software Foundation; either version 2.1 of14* the License, or (at your option) any later version.15*16* This program is distributed in the hope that it will be useful,17* but WITHOUT ANY WARRANTY; without even the implied warranty of18* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the19* GNU Lesser General Public License for more details.20*21* You should have received a copy of the GNU Lesser General Public22* License along with this library; if not, write to the Free Software23* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA24*25*/2627#ifndef __ALSA_GLOBAL_H_28#define __ALSA_GLOBAL_H_2930/* for timeval and timespec */31#include <time.h>3233#ifdef __cplusplus34extern "C" {35#endif3637/**38* \defgroup Global Global defines and functions39* Global defines and functions.40* \par41* The ALSA library implementation uses these macros and functions.42* Most applications probably do not need them.43* \{44*/4546const char *snd_asoundlib_version(void);4748#ifndef ATTRIBUTE_UNUSED49/** do not print warning (gcc) when function parameter is not used */50#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))51#endif5253#ifdef PIC /* dynamic build */5455/** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */56#define __SND_DLSYM_VERSION(name, version) _ ## name ## version57/**58* \hideinitializer59* \brief Appends the build version to the name of a versioned dynamic symbol.60*/61#define SND_DLSYM_BUILD_VERSION(name, version) char __SND_DLSYM_VERSION(name, version);6263#else /* static build */6465struct snd_dlsym_link {66struct snd_dlsym_link *next;67const char *dlsym_name;68const void *dlsym_ptr;69};7071extern struct snd_dlsym_link *snd_dlsym_start;7273/** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */74#define __SND_DLSYM_VERSION(prefix, name, version) _ ## prefix ## name ## version75/**76* \hideinitializer77* \brief Appends the build version to the name of a versioned dynamic symbol.78*/79#define SND_DLSYM_BUILD_VERSION(name, version) \80static struct snd_dlsym_link __SND_DLSYM_VERSION(snd_dlsym_, name, version); \81void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) __attribute__ ((constructor)); \82void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) { \83__SND_DLSYM_VERSION(snd_dlsym_, name, version).next = snd_dlsym_start; \84__SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_name = # name; \85__SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_ptr = (void *)&name; \86snd_dlsym_start = &__SND_DLSYM_VERSION(snd_dlsym_, name, version); \87}8889#endif9091#ifndef __STRING92/** \brief Return 'x' argument as string */93#define __STRING(x) #x94#endif9596/** \brief Returns the version of a dynamic symbol as a string. */97#define SND_DLSYM_VERSION(version) __STRING(version)9899void *snd_dlopen(const char *file, int mode);100void *snd_dlsym(void *handle, const char *name, const char *version);101int snd_dlclose(void *handle);102103104/** \brief alloca helper macro. */105#define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)106107/**108* \brief Internal structure for an async notification client handler.109*110* The ALSA library uses a pointer to this structure as a handle to an async111* notification object. Applications don't access its contents directly.112*/113typedef struct _snd_async_handler snd_async_handler_t;114115/**116* \brief Async notification callback.117*118* See the #snd_async_add_handler function for details.119*/120typedef void (*snd_async_callback_t)(snd_async_handler_t *handler);121122int snd_async_add_handler(snd_async_handler_t **handler, int fd,123snd_async_callback_t callback, void *private_data);124int snd_async_del_handler(snd_async_handler_t *handler);125int snd_async_handler_get_fd(snd_async_handler_t *handler);126int snd_async_handler_get_signo(snd_async_handler_t *handler);127void *snd_async_handler_get_callback_private(snd_async_handler_t *handler);128129struct snd_shm_area *snd_shm_area_create(int shmid, void *ptr);130struct snd_shm_area *snd_shm_area_share(struct snd_shm_area *area);131int snd_shm_area_destroy(struct snd_shm_area *area);132133int snd_user_file(const char *file, char **result);134135#ifdef __GLIBC__136#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE)137struct timeval {138time_t tv_sec; /* seconds */139long tv_usec; /* microseconds */140};141142struct timespec {143time_t tv_sec; /* seconds */144long tv_nsec; /* nanoseconds */145};146#endif147#endif148149/** Timestamp */150typedef struct timeval snd_timestamp_t;151/** Hi-res timestamp */152typedef struct timespec snd_htimestamp_t;153154/** \} */155156#ifdef __cplusplus157}158#endif159160#endif /* __ALSA_GLOBAL_H */161162163