summaryrefslogtreecommitdiff
path: root/include/alsa/hwdep.h
blob: 46ed1f7801e19e5d65e851d4a46c621b6342026d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/**
 * \file include/hwdep.h
 * \brief Application interface library for the ALSA driver
 * \author Jaroslav Kysela <perex@perex.cz>
 * \author Abramo Bagnara <abramo@alsa-project.org>
 * \author Takashi Iwai <tiwai@suse.de>
 * \date 1998-2001
 *
 * Application interface library for the ALSA driver
 */
/*
 *   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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#ifndef __ALSA_HWDEP_H
#define __ALSA_HWDEP_H

#ifdef __cplusplus
extern "C" {
#endif

/**
 *  \defgroup HwDep Hardware Dependant Interface
 *  The Hardware Dependant Interface.
 *  \{
 */

/** dlsym version for interface entry callback */
#define SND_HWDEP_DLSYM_VERSION         _dlsym_hwdep_001

/** HwDep information container */
typedef struct _snd_hwdep_info snd_hwdep_info_t;

/** HwDep DSP status container */
typedef struct _snd_hwdep_dsp_status snd_hwdep_dsp_status_t;

/** HwDep DSP image container */
typedef struct _snd_hwdep_dsp_image snd_hwdep_dsp_image_t;

/** HwDep interface */
typedef enum _snd_hwdep_iface {
        SND_HWDEP_IFACE_OPL2 = 0,       /**< OPL2 raw driver */
        SND_HWDEP_IFACE_OPL3,           /**< OPL3 raw driver */
        SND_HWDEP_IFACE_OPL4,           /**< OPL4 raw driver */
        SND_HWDEP_IFACE_SB16CSP,        /**< SB16CSP driver */
        SND_HWDEP_IFACE_EMU10K1,        /**< EMU10K1 driver */
        SND_HWDEP_IFACE_YSS225,         /**< YSS225 driver */
        SND_HWDEP_IFACE_ICS2115,        /**< ICS2115 driver */
        SND_HWDEP_IFACE_SSCAPE,         /**< Ensoniq SoundScape ISA card (MC68EC000) */
        SND_HWDEP_IFACE_VX,             /**< Digigram VX cards */
        SND_HWDEP_IFACE_MIXART,         /**< Digigram miXart cards */
        SND_HWDEP_IFACE_USX2Y,          /**< Tascam US122, US224 & US428 usb */
        SND_HWDEP_IFACE_EMUX_WAVETABLE, /**< EmuX wavetable */
        SND_HWDEP_IFACE_BLUETOOTH,      /**< Bluetooth audio */
        SND_HWDEP_IFACE_USX2Y_PCM,      /**< Tascam US122, US224 & US428 raw USB PCM */
        SND_HWDEP_IFACE_PCXHR,          /**< Digigram PCXHR */
        SND_HWDEP_IFACE_SB_RC,          /**< SB Extigy/Audigy2NX remote control */
        SND_HWDEP_IFACE_HDA,            /**< HD-audio */
        SND_HWDEP_IFACE_USB_STREAM,     /**< direct access to usb stream */
        SND_HWDEP_IFACE_FW_DICE,        /**< TC DICE FireWire device */
        SND_HWDEP_IFACE_FW_FIREWORKS,   /**< Echo Audio Fireworks based device */
        SND_HWDEP_IFACE_FW_BEBOB,       /**< BridgeCo BeBoB based device */
        SND_HWDEP_IFACE_FW_OXFW,        /**< Oxford OXFW970/971 based device */
        SND_HWDEP_IFACE_FW_DIGI00X,     /* Digidesign Digi 002/003 family */
        SND_HWDEP_IFACE_FW_TASCAM,      /* TASCAM FireWire series */
        SND_HWDEP_IFACE_LINE6,          /* Line6 USB processors */
        SND_HWDEP_IFACE_FW_MOTU,        /* MOTU FireWire series */
        SND_HWDEP_IFACE_FW_FIREFACE,    /* RME Fireface series */

        SND_HWDEP_IFACE_LAST = SND_HWDEP_IFACE_FW_FIREFACE,     /**< last known hwdep interface */
} snd_hwdep_iface_t;

/** open for reading */
#define SND_HWDEP_OPEN_READ             (O_RDONLY)
/** open for writing */
#define SND_HWDEP_OPEN_WRITE            (O_WRONLY)
/** open for reading and writing */
#define SND_HWDEP_OPEN_DUPLEX           (O_RDWR)
/** open mode flag: open in nonblock mode */
#define SND_HWDEP_OPEN_NONBLOCK         (O_NONBLOCK)

/** HwDep handle type */
typedef enum _snd_hwdep_type {
        /** Kernel level HwDep */
        SND_HWDEP_TYPE_HW,
        /** Shared memory client HwDep (not yet implemented) */
        SND_HWDEP_TYPE_SHM,
        /** INET client HwDep (not yet implemented) */
        SND_HWDEP_TYPE_INET
} snd_hwdep_type_t;

/** HwDep handle */
typedef struct _snd_hwdep snd_hwdep_t;

int snd_hwdep_open(snd_hwdep_t **hwdep, const char *name, int mode);
int snd_hwdep_close(snd_hwdep_t *hwdep);
int snd_hwdep_poll_descriptors(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int space);
int snd_hwdep_poll_descriptors_count(snd_hwdep_t *hwdep);
int snd_hwdep_poll_descriptors_revents(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
int snd_hwdep_nonblock(snd_hwdep_t *hwdep, int nonblock);
int snd_hwdep_info(snd_hwdep_t *hwdep, snd_hwdep_info_t * info);
int snd_hwdep_dsp_status(snd_hwdep_t *hwdep, snd_hwdep_dsp_status_t *status);
int snd_hwdep_dsp_load(snd_hwdep_t *hwdep, snd_hwdep_dsp_image_t *block);
int snd_hwdep_ioctl(snd_hwdep_t *hwdep, unsigned int request, void * arg);
ssize_t snd_hwdep_write(snd_hwdep_t *hwdep, const void *buffer, size_t size);
ssize_t snd_hwdep_read(snd_hwdep_t *hwdep, void *buffer, size_t size);

size_t snd_hwdep_info_sizeof(void);
/** allocate #snd_hwdep_info_t container on stack */
#define snd_hwdep_info_alloca(ptr) __snd_alloca(ptr, snd_hwdep_info)
int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr);
void snd_hwdep_info_free(snd_hwdep_info_t *obj);
void snd_hwdep_info_copy(snd_hwdep_info_t *dst, const snd_hwdep_info_t *src);

unsigned int snd_hwdep_info_get_device(const snd_hwdep_info_t *obj);
int snd_hwdep_info_get_card(const snd_hwdep_info_t *obj);
const char *snd_hwdep_info_get_id(const snd_hwdep_info_t *obj);
const char *snd_hwdep_info_get_name(const snd_hwdep_info_t *obj);
snd_hwdep_iface_t snd_hwdep_info_get_iface(const snd_hwdep_info_t *obj);
void snd_hwdep_info_set_device(snd_hwdep_info_t *obj, unsigned int val);

size_t snd_hwdep_dsp_status_sizeof(void);
/** allocate #snd_hwdep_dsp_status_t container on stack */
#define snd_hwdep_dsp_status_alloca(ptr) __snd_alloca(ptr, snd_hwdep_dsp_status)
int snd_hwdep_dsp_status_malloc(snd_hwdep_dsp_status_t **ptr);
void snd_hwdep_dsp_status_free(snd_hwdep_dsp_status_t *obj);
void snd_hwdep_dsp_status_copy(snd_hwdep_dsp_status_t *dst, const snd_hwdep_dsp_status_t *src);

unsigned int snd_hwdep_dsp_status_get_version(const snd_hwdep_dsp_status_t *obj);
const char *snd_hwdep_dsp_status_get_id(const snd_hwdep_dsp_status_t *obj);
unsigned int snd_hwdep_dsp_status_get_num_dsps(const snd_hwdep_dsp_status_t *obj);
unsigned int snd_hwdep_dsp_status_get_dsp_loaded(const snd_hwdep_dsp_status_t *obj);
unsigned int snd_hwdep_dsp_status_get_chip_ready(const snd_hwdep_dsp_status_t *obj);

size_t snd_hwdep_dsp_image_sizeof(void);
/** allocate #snd_hwdep_dsp_image_t container on stack */
#define snd_hwdep_dsp_image_alloca(ptr) __snd_alloca(ptr, snd_hwdep_dsp_image)
int snd_hwdep_dsp_image_malloc(snd_hwdep_dsp_image_t **ptr);
void snd_hwdep_dsp_image_free(snd_hwdep_dsp_image_t *obj);
void snd_hwdep_dsp_image_copy(snd_hwdep_dsp_image_t *dst, const snd_hwdep_dsp_image_t *src);

unsigned int snd_hwdep_dsp_image_get_index(const snd_hwdep_dsp_image_t *obj);
const char *snd_hwdep_dsp_image_get_name(const snd_hwdep_dsp_image_t *obj);
const void *snd_hwdep_dsp_image_get_image(const snd_hwdep_dsp_image_t *obj);
size_t snd_hwdep_dsp_image_get_length(const snd_hwdep_dsp_image_t *obj);

void snd_hwdep_dsp_image_set_index(snd_hwdep_dsp_image_t *obj, unsigned int _index);
void snd_hwdep_dsp_image_set_name(snd_hwdep_dsp_image_t *obj, const char *name);
void snd_hwdep_dsp_image_set_image(snd_hwdep_dsp_image_t *obj, void *buffer);
void snd_hwdep_dsp_image_set_length(snd_hwdep_dsp_image_t *obj, size_t length);

/** \} */

#ifdef __cplusplus
}
#endif

#endif /* __ALSA_HWDEP_H */