mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-12-16 08:56:42 -05:00
Moved some prototypes from src/pcm/pcm_plugin.h to include/pcm_plugin.h.
Merged src/pcm/atomic.h to include/iatomic.h. Added initial description of hw and hooks plugins.
This commit is contained in:
parent
b36ad628f7
commit
8c1887d7af
18 changed files with 442 additions and 159 deletions
|
|
@ -3,12 +3,12 @@ alsaincludedir = ${includedir}/alsa
|
|||
|
||||
alsainclude_HEADERS = asoundlib.h asoundef.h \
|
||||
version.h global.h input.h output.h error.h \
|
||||
conf.h pcm.h rawmidi.h timer.h \
|
||||
conf.h pcm.h pcm_plugin.h rawmidi.h timer.h \
|
||||
hwdep.h control.h mixer.h \
|
||||
seq_event.h seq.h seqmid.h seq_midi_event.h \
|
||||
conv.h instr.h
|
||||
conv.h instr.h iatomic.h
|
||||
|
||||
noinst_HEADERS = sys.h search.h list.h aserver.h local.h config.h iatomic.h
|
||||
noinst_HEADERS = sys.h search.h list.h aserver.h local.h config.h
|
||||
|
||||
EXTRA_CLEAN = stamp-vh
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef __ALSA_IATOMIC__
|
||||
#define __ALSA_IATOMIC__
|
||||
#ifndef __ALSA_IATOMIC_H
|
||||
#define __ALSA_IATOMIC_H
|
||||
|
||||
#ifdef __i386__
|
||||
|
||||
|
|
@ -1059,4 +1059,72 @@ typedef struct { volatile int counter; } atomic_t;
|
|||
|
||||
#endif /* IATOMIC_DEFINED */
|
||||
|
||||
#endif /* __ALSA_IATOMIC__ */
|
||||
/*
|
||||
* Atomic read/write
|
||||
* Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
|
||||
*/
|
||||
|
||||
/* Max number of times we must spin on a spinlock calling sched_yield().
|
||||
After MAX_SPIN_COUNT iterations, we put the calling thread to sleep. */
|
||||
|
||||
#ifndef MAX_SPIN_COUNT
|
||||
#define MAX_SPIN_COUNT 50
|
||||
#endif
|
||||
|
||||
/* Duration of sleep (in nanoseconds) when we can't acquire a spinlock
|
||||
after MAX_SPIN_COUNT iterations of sched_yield().
|
||||
This MUST BE > 2ms.
|
||||
(Otherwise the kernel does busy-waiting for realtime threads,
|
||||
giving other threads no chance to run.) */
|
||||
|
||||
#ifndef SPIN_SLEEP_DURATION
|
||||
#define SPIN_SLEEP_DURATION 2000001
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
unsigned int begin, end;
|
||||
} snd_atomic_write_t;
|
||||
|
||||
typedef struct {
|
||||
volatile const snd_atomic_write_t *write;
|
||||
unsigned int end;
|
||||
} snd_atomic_read_t;
|
||||
|
||||
void snd_atomic_read_wait(snd_atomic_read_t *t);
|
||||
|
||||
static inline void snd_atomic_write_init(snd_atomic_write_t *w)
|
||||
{
|
||||
w->begin = 0;
|
||||
w->end = 0;
|
||||
}
|
||||
|
||||
static inline void snd_atomic_write_begin(snd_atomic_write_t *w)
|
||||
{
|
||||
w->begin++;
|
||||
wmb();
|
||||
}
|
||||
|
||||
static inline void snd_atomic_write_end(snd_atomic_write_t *w)
|
||||
{
|
||||
wmb();
|
||||
w->end++;
|
||||
}
|
||||
|
||||
static inline void snd_atomic_read_init(snd_atomic_read_t *r, snd_atomic_write_t *w)
|
||||
{
|
||||
r->write = w;
|
||||
}
|
||||
|
||||
static inline void snd_atomic_read_begin(snd_atomic_read_t *r)
|
||||
{
|
||||
r->end = r->write->end;
|
||||
rmb();
|
||||
}
|
||||
|
||||
static inline int snd_atomic_read_ok(snd_atomic_read_t *r)
|
||||
{
|
||||
rmb();
|
||||
return r->end == r->write->begin;
|
||||
}
|
||||
|
||||
#endif /* __ALSA_IATOMIC_H */
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ typedef struct sndrv_seq_event snd_seq_event_t;
|
|||
#include "error.h"
|
||||
#include "conf.h"
|
||||
#include "pcm.h"
|
||||
#include "pcm_plugin.h"
|
||||
#include "rawmidi.h"
|
||||
#include "timer.h"
|
||||
#include "hwdep.h"
|
||||
|
|
|
|||
112
include/pcm_plugin.h
Normal file
112
include/pcm_plugin.h
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
/**
|
||||
* \file <alsa/pcm_plugin.h>
|
||||
* \brief Common PCM plugin code
|
||||
* \author Abramo Bagnara <abramo@alsa-project.org>
|
||||
* \author Jaroslav Kysela <perex@suse.cz>
|
||||
* \date 2000-2001
|
||||
*
|
||||
* Application interface library for the ALSA driver.
|
||||
* See the \ref pcm_plugins page for more details.
|
||||
*
|
||||
* \warning Using of contents of this header file might be dangerous
|
||||
* in the sense of compatibility reasons. The contents might be
|
||||
* freely changed in future.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ALSA_PCM_PLUGIN_H
|
||||
|
||||
/**
|
||||
* \defgroup PCM_Plugins PCM Plugins
|
||||
* \ingroup PCM
|
||||
* See the \ref pcm_plugins page for more details.
|
||||
* \{
|
||||
*/
|
||||
|
||||
#define SND_PCM_PLUGIN_RATE_MIN 4000 /**< minimal rate for the rate plugin */
|
||||
#define SND_PCM_PLUGIN_RATE_MAX 192000 /**< maximal rate for the rate plugin */
|
||||
|
||||
#define SND_PCM_PLUGIN_ROUTE_FLOAT 1 /**< use floats for route plugin */
|
||||
#define SND_PCM_PLUGIN_ROUTE_RESOLUTION 16 /**< integer resolution for route plugin */
|
||||
|
||||
#if SND_PCM_PLUGIN_ROUTE_FLOAT
|
||||
/** route ttable entry type */
|
||||
typedef float snd_pcm_route_ttable_entry_t;
|
||||
#define SND_PCM_PLUGIN_ROUTE_HALF 0.5 /**< half value */
|
||||
#define SND_PCM_PLUGIN_ROUTE_FULL 1.0 /**< full value */
|
||||
#else
|
||||
/** route ttable entry type */
|
||||
typedef int snd_pcm_route_ttable_entry_t;
|
||||
#define SND_PCM_PLUGIN_ROUTE_HALF (SND_PCM_PLUGIN_ROUTE_RESOLUTION / 2) /**< half value */
|
||||
#define SND_PCM_PLUGIN_ROUTE_FULL SND_PCM_PLUGIN_ROUTE_RESOLUTION /**< full value */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Hardware plugin
|
||||
*/
|
||||
int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
||||
int card, int device, int subdevice,
|
||||
snd_pcm_stream_t stream, int mode,
|
||||
int mmap_emulation);
|
||||
int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_t *slave, int close_slave);
|
||||
int snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_format_t sformat, snd_pcm_t *slave,
|
||||
int close_slave);
|
||||
int snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_format_t sformat, snd_pcm_t *slave,
|
||||
int close_slave);
|
||||
int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_format_t sformat, snd_pcm_t *slave,
|
||||
int close_slave);
|
||||
int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_format_t sformat, snd_pcm_t *slave,
|
||||
int close_slave);
|
||||
int snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_format_t sformat, snd_pcm_t *slave,
|
||||
int close_slave);
|
||||
int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *ttable,
|
||||
unsigned int tt_csize, unsigned int tt_ssize,
|
||||
unsigned int *tt_cused, unsigned int *tt_sused,
|
||||
int schannels);
|
||||
int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_format_t sformat, int schannels,
|
||||
snd_pcm_route_ttable_entry_t *ttable,
|
||||
unsigned int tt_ssize,
|
||||
unsigned int tt_cused, unsigned int tt_sused,
|
||||
snd_pcm_t *slave, int close_slave);
|
||||
int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_format_t sformat, unsigned int srate,
|
||||
snd_pcm_t *slave, int close_slave);
|
||||
|
||||
/*
|
||||
* Hooks plugin
|
||||
*/
|
||||
int snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_t *slave, int close_slave);
|
||||
int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
/** \} */
|
||||
|
||||
#endif /* __ALSA_PCM_PLUGIN_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue