Blame include/global.h

Packit 4a16fb
/**
Packit 4a16fb
 * \file include/global.h
Packit 4a16fb
 * \brief Application interface library for the ALSA driver
Packit 4a16fb
 * \author Jaroslav Kysela <perex@perex.cz>
Packit 4a16fb
 * \author Abramo Bagnara <abramo@alsa-project.org>
Packit 4a16fb
 * \author Takashi Iwai <tiwai@suse.de>
Packit 4a16fb
 * \date 1998-2001
Packit 4a16fb
 *
Packit 4a16fb
 * Application interface library for the ALSA driver
Packit 4a16fb
 */
Packit 4a16fb
/*
Packit 4a16fb
 *   This library is free software; you can redistribute it and/or modify
Packit 4a16fb
 *   it under the terms of the GNU Lesser General Public License as
Packit 4a16fb
 *   published by the Free Software Foundation; either version 2.1 of
Packit 4a16fb
 *   the License, or (at your option) any later version.
Packit 4a16fb
 *
Packit 4a16fb
 *   This program is distributed in the hope that it will be useful,
Packit 4a16fb
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 4a16fb
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 4a16fb
 *   GNU Lesser General Public License for more details.
Packit 4a16fb
 *
Packit 4a16fb
 *   You should have received a copy of the GNU Lesser General Public
Packit 4a16fb
 *   License along with this library; if not, write to the Free Software
Packit 4a16fb
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
Packit 4a16fb
 *
Packit 4a16fb
 */
Packit 4a16fb
Packit 4a16fb
#ifndef __ALSA_GLOBAL_H_
Packit 4a16fb
#define __ALSA_GLOBAL_H_
Packit 4a16fb
Packit 4a16fb
/* for timeval and timespec */
Packit 4a16fb
#include <time.h>
Packit 4a16fb
Packit 4a16fb
#ifdef __cplusplus
Packit 4a16fb
extern "C" {
Packit 4a16fb
#endif
Packit 4a16fb
Packit 4a16fb
/**
Packit 4a16fb
 *  \defgroup Global Global defines and functions
Packit 4a16fb
 *  Global defines and functions.
Packit 4a16fb
 *  \par
Packit 4a16fb
 *  The ALSA library implementation uses these macros and functions.
Packit 4a16fb
 *  Most applications probably do not need them.
Packit 4a16fb
 *  \{
Packit 4a16fb
 */
Packit 4a16fb
Packit 4a16fb
const char *snd_asoundlib_version(void);
Packit 4a16fb
Packit 4a16fb
#ifndef ATTRIBUTE_UNUSED
Packit 4a16fb
/** do not print warning (gcc) when function parameter is not used */
Packit 4a16fb
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
Packit 4a16fb
#endif
Packit 4a16fb
Packit 4a16fb
#ifdef PIC /* dynamic build */
Packit 4a16fb
Packit 4a16fb
/** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
Packit 4a16fb
#define __SND_DLSYM_VERSION(name, version) _ ## name ## version
Packit 4a16fb
/**
Packit 4a16fb
 * \hideinitializer
Packit 4a16fb
 * \brief Appends the build version to the name of a versioned dynamic symbol.
Packit 4a16fb
 */
Packit 4a16fb
#define SND_DLSYM_BUILD_VERSION(name, version) char __SND_DLSYM_VERSION(name, version);
Packit 4a16fb
Packit 4a16fb
#else /* static build */
Packit 4a16fb
Packit 4a16fb
struct snd_dlsym_link {
Packit 4a16fb
	struct snd_dlsym_link *next;
Packit 4a16fb
	const char *dlsym_name;
Packit 4a16fb
	const void *dlsym_ptr;
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
extern struct snd_dlsym_link *snd_dlsym_start;
Packit 4a16fb
Packit 4a16fb
/** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
Packit 4a16fb
#define __SND_DLSYM_VERSION(prefix, name, version) _ ## prefix ## name ## version
Packit 4a16fb
/**
Packit 4a16fb
 * \hideinitializer
Packit 4a16fb
 * \brief Appends the build version to the name of a versioned dynamic symbol.
Packit 4a16fb
 */
Packit 4a16fb
#define SND_DLSYM_BUILD_VERSION(name, version) \
Packit 4a16fb
  static struct snd_dlsym_link __SND_DLSYM_VERSION(snd_dlsym_, name, version); \
Packit 4a16fb
  void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) __attribute__ ((constructor)); \
Packit 4a16fb
  void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) { \
Packit 4a16fb
    __SND_DLSYM_VERSION(snd_dlsym_, name, version).next = snd_dlsym_start; \
Packit 4a16fb
    __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_name = # name; \
Packit 4a16fb
    __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_ptr = (void *)&nam;; \
Packit 4a16fb
    snd_dlsym_start = &__SND_DLSYM_VERSION(snd_dlsym_, name, version); \
Packit 4a16fb
  }
Packit 4a16fb
Packit 4a16fb
#endif
Packit 4a16fb
Packit 4a16fb
#ifndef __STRING
Packit 4a16fb
/** \brief Return 'x' argument as string */
Packit 4a16fb
#define __STRING(x)     #x
Packit 4a16fb
#endif
Packit 4a16fb
Packit 4a16fb
/** \brief Returns the version of a dynamic symbol as a string. */
Packit 4a16fb
#define SND_DLSYM_VERSION(version) __STRING(version)
Packit 4a16fb
Packit Service f36a15
int snd_dlpath(char *path, size_t path_len, const char *name);
Packit 4a16fb
void *snd_dlopen(const char *file, int mode, char *errbuf, size_t errbuflen);
Packit 4a16fb
void *snd_dlsym(void *handle, const char *name, const char *version);
Packit 4a16fb
int snd_dlclose(void *handle);
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
/** \brief alloca helper macro. */
Packit 4a16fb
#define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
Packit 4a16fb
Packit 4a16fb
/**
Packit 4a16fb
 * \brief Internal structure for an async notification client handler.
Packit 4a16fb
 *
Packit 4a16fb
 * The ALSA library uses a pointer to this structure as a handle to an async
Packit 4a16fb
 * notification object. Applications don't access its contents directly.
Packit 4a16fb
 */
Packit 4a16fb
typedef struct _snd_async_handler snd_async_handler_t;
Packit 4a16fb
Packit 4a16fb
/**
Packit 4a16fb
 * \brief Async notification callback.
Packit 4a16fb
 *
Packit 4a16fb
 * See the #snd_async_add_handler function for details.
Packit 4a16fb
 */
Packit 4a16fb
typedef void (*snd_async_callback_t)(snd_async_handler_t *handler);
Packit 4a16fb
Packit 4a16fb
int snd_async_add_handler(snd_async_handler_t **handler, int fd, 
Packit 4a16fb
			  snd_async_callback_t callback, void *private_data);
Packit 4a16fb
int snd_async_del_handler(snd_async_handler_t *handler);
Packit 4a16fb
int snd_async_handler_get_fd(snd_async_handler_t *handler);
Packit 4a16fb
int snd_async_handler_get_signo(snd_async_handler_t *handler);
Packit 4a16fb
void *snd_async_handler_get_callback_private(snd_async_handler_t *handler);
Packit 4a16fb
Packit 4a16fb
struct snd_shm_area *snd_shm_area_create(int shmid, void *ptr);
Packit 4a16fb
struct snd_shm_area *snd_shm_area_share(struct snd_shm_area *area);
Packit 4a16fb
int snd_shm_area_destroy(struct snd_shm_area *area);
Packit 4a16fb
Packit 4a16fb
int snd_user_file(const char *file, char **result);
Packit 4a16fb
Packit 4a16fb
#ifdef __GLIBC__
Packit 4a16fb
#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE)
Packit 4a16fb
struct timeval {
Packit 4a16fb
	time_t		tv_sec;		/* seconds */
Packit 4a16fb
	long		tv_usec;	/* microseconds */
Packit 4a16fb
};
Packit 4a16fb
Packit 4a16fb
struct timespec {
Packit 4a16fb
	time_t		tv_sec;		/* seconds */
Packit 4a16fb
	long		tv_nsec;	/* nanoseconds */
Packit 4a16fb
};
Packit 4a16fb
#endif
Packit 4a16fb
#endif
Packit 4a16fb
Packit 4a16fb
/** Timestamp */
Packit 4a16fb
typedef struct timeval snd_timestamp_t;
Packit 4a16fb
/** Hi-res timestamp */
Packit 4a16fb
typedef struct timespec snd_htimestamp_t;
Packit 4a16fb
Packit 4a16fb
/** \} */
Packit 4a16fb
Packit 4a16fb
#ifdef __cplusplus
Packit 4a16fb
}
Packit 4a16fb
#endif
Packit 4a16fb
Packit 4a16fb
#endif /* __ALSA_GLOBAL_H */