1/**
2 * \file include/hwdep.h
3 * \brief Application interface library for the ALSA driver
4 * \author Jaroslav Kysela <perex@perex.cz>
5 * \author Abramo Bagnara <abramo@alsa-project.org>
6 * \author Takashi Iwai <tiwai@suse.de>
7 * \date 1998-2001
8 *
9 * Application interface library for the ALSA driver
10 */
11/*
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.
16 *
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.
21 *
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
25 *
26 */
27
28#ifndef __ALSA_HWDEP_H
29#define __ALSA_HWDEP_H
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/**
36 * \defgroup HwDep Hardware Dependant Interface
37 * The Hardware Dependant Interface.
38 * \{
39 */
40
41/** dlsym version for interface entry callback */
42#define SND_HWDEP_DLSYM_VERSION _dlsym_hwdep_001
43
44/** HwDep information container */
45typedef struct _snd_hwdep_info snd_hwdep_info_t;
46
47/** HwDep DSP status container */
48typedef struct _snd_hwdep_dsp_status snd_hwdep_dsp_status_t;
49
50/** HwDep DSP image container */
51typedef struct _snd_hwdep_dsp_image snd_hwdep_dsp_image_t;
52
53/** HwDep interface */
54typedef enum _snd_hwdep_iface {
55 SND_HWDEP_IFACE_OPL2 = 0, /**< OPL2 raw driver */
56 SND_HWDEP_IFACE_OPL3, /**< OPL3 raw driver */
57 SND_HWDEP_IFACE_OPL4, /**< OPL4 raw driver */
58 SND_HWDEP_IFACE_SB16CSP, /**< SB16CSP driver */
59 SND_HWDEP_IFACE_EMU10K1, /**< EMU10K1 driver */
60 SND_HWDEP_IFACE_YSS225, /**< YSS225 driver */
61 SND_HWDEP_IFACE_ICS2115, /**< ICS2115 driver */
62 SND_HWDEP_IFACE_SSCAPE, /**< Ensoniq SoundScape ISA card (MC68EC000) */
63 SND_HWDEP_IFACE_VX, /**< Digigram VX cards */
64 SND_HWDEP_IFACE_MIXART, /**< Digigram miXart cards */
65 SND_HWDEP_IFACE_USX2Y, /**< Tascam US122, US224 & US428 usb */
66 SND_HWDEP_IFACE_EMUX_WAVETABLE, /**< EmuX wavetable */
67 SND_HWDEP_IFACE_BLUETOOTH, /**< Bluetooth audio */
68 SND_HWDEP_IFACE_USX2Y_PCM, /**< Tascam US122, US224 & US428 raw USB PCM */
69 SND_HWDEP_IFACE_PCXHR, /**< Digigram PCXHR */
70 SND_HWDEP_IFACE_SB_RC, /**< SB Extigy/Audigy2NX remote control */
71
72 SND_HWDEP_IFACE_LAST = SND_HWDEP_IFACE_SB_RC /**< last known hwdep interface */
73} snd_hwdep_iface_t;
74
75/** open for reading */
76#define SND_HWDEP_OPEN_READ (O_RDONLY)
77/** open for writing */
78#define SND_HWDEP_OPEN_WRITE (O_WRONLY)
79/** open for reading and writing */
80#define SND_HWDEP_OPEN_DUPLEX (O_RDWR)
81/** open mode flag: open in nonblock mode */
82#define SND_HWDEP_OPEN_NONBLOCK (O_NONBLOCK)
83
84/** HwDep handle type */
85typedef enum _snd_hwdep_type {
86 /** Kernel level HwDep */
87 SND_HWDEP_TYPE_HW,
88 /** Shared memory client HwDep (not yet implemented) */
89 SND_HWDEP_TYPE_SHM,
90 /** INET client HwDep (not yet implemented) */
91 SND_HWDEP_TYPE_INET
92} snd_hwdep_type_t;
93
94/** HwDep handle */
95typedef struct _snd_hwdep snd_hwdep_t;
96
97int snd_hwdep_open(snd_hwdep_t **hwdep, const char *name, int mode);
98int snd_hwdep_close(snd_hwdep_t *hwdep);
99int snd_hwdep_poll_descriptors(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int space);
100int snd_hwdep_poll_descriptors_revents(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
101int snd_hwdep_nonblock(snd_hwdep_t *hwdep, int nonblock);
102int snd_hwdep_info(snd_hwdep_t *hwdep, snd_hwdep_info_t * info);
103int snd_hwdep_dsp_status(snd_hwdep_t *hwdep, snd_hwdep_dsp_status_t *status);
104int snd_hwdep_dsp_load(snd_hwdep_t *hwdep, snd_hwdep_dsp_image_t *block);
105int snd_hwdep_ioctl(snd_hwdep_t *hwdep, unsigned int request, void * arg);
106ssize_t snd_hwdep_write(snd_hwdep_t *hwdep, const void *buffer, size_t size);
107ssize_t snd_hwdep_read(snd_hwdep_t *hwdep, void *buffer, size_t size);
108
109size_t snd_hwdep_info_sizeof(void);
110/** allocate #snd_hwdep_info_t container on stack */
111#define snd_hwdep_info_alloca(ptr) __snd_alloca(ptr, snd_hwdep_info)
112int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr);
113void snd_hwdep_info_free(snd_hwdep_info_t *obj);
114void snd_hwdep_info_copy(snd_hwdep_info_t *dst, const snd_hwdep_info_t *src);
115
116unsigned int snd_hwdep_info_get_device(const snd_hwdep_info_t *obj);
117int snd_hwdep_info_get_card(const snd_hwdep_info_t *obj);
118const char *snd_hwdep_info_get_id(const snd_hwdep_info_t *obj);
119const char *snd_hwdep_info_get_name(const snd_hwdep_info_t *obj);
120snd_hwdep_iface_t snd_hwdep_info_get_iface(const snd_hwdep_info_t *obj);
121void snd_hwdep_info_set_device(snd_hwdep_info_t *obj, unsigned int val);
122
123size_t snd_hwdep_dsp_status_sizeof(void);
124/** allocate #snd_hwdep_dsp_status_t container on stack */
125#define snd_hwdep_dsp_status_alloca(ptr) __snd_alloca(ptr, snd_hwdep_dsp_status)
126int snd_hwdep_dsp_status_malloc(snd_hwdep_dsp_status_t **ptr);
127void snd_hwdep_dsp_status_free(snd_hwdep_dsp_status_t *obj);
128void snd_hwdep_dsp_status_copy(snd_hwdep_dsp_status_t *dst, const snd_hwdep_dsp_status_t *src);
129
130unsigned int snd_hwdep_dsp_status_get_version(const snd_hwdep_dsp_status_t *obj);
131const char *snd_hwdep_dsp_status_get_id(const snd_hwdep_dsp_status_t *obj);
132unsigned int snd_hwdep_dsp_status_get_num_dsps(const snd_hwdep_dsp_status_t *obj);
133unsigned int snd_hwdep_dsp_status_get_dsp_loaded(const snd_hwdep_dsp_status_t *obj);
134unsigned int snd_hwdep_dsp_status_get_chip_ready(const snd_hwdep_dsp_status_t *obj);
135
136size_t snd_hwdep_dsp_image_sizeof(void);
137/** allocate #snd_hwdep_dsp_image_t container on stack */
138#define snd_hwdep_dsp_image_alloca(ptr) __snd_alloca(ptr, snd_hwdep_dsp_image)
139int snd_hwdep_dsp_image_malloc(snd_hwdep_dsp_image_t **ptr);
140void snd_hwdep_dsp_image_free(snd_hwdep_dsp_image_t *obj);
141void snd_hwdep_dsp_image_copy(snd_hwdep_dsp_image_t *dst, const snd_hwdep_dsp_image_t *src);
142
143unsigned int snd_hwdep_dsp_image_get_index(const snd_hwdep_dsp_image_t *obj);
144const char *snd_hwdep_dsp_image_get_name(const snd_hwdep_dsp_image_t *obj);
145const void *snd_hwdep_dsp_image_get_image(const snd_hwdep_dsp_image_t *obj);
146size_t snd_hwdep_dsp_image_get_length(const snd_hwdep_dsp_image_t *obj);
147
148void snd_hwdep_dsp_image_set_index(snd_hwdep_dsp_image_t *obj, unsigned int _index);
149void snd_hwdep_dsp_image_set_name(snd_hwdep_dsp_image_t *obj, const char *name);
150void snd_hwdep_dsp_image_set_image(snd_hwdep_dsp_image_t *obj, void *buffer);
151void snd_hwdep_dsp_image_set_length(snd_hwdep_dsp_image_t *obj, size_t length);
152
153/** \} */
154
155#ifdef __cplusplus
156}
157#endif
158
159#endif /* __ALSA_HWDEP_H */
160
161