1#ifndef __SOUND_SB16_CSP_H
2#define __SOUND_SB16_CSP_H
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#define SNDRV_SB_CSP_MODE_NONE 0x00
28#define SNDRV_SB_CSP_MODE_DSP_READ 0x01
29#define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02
30#define SNDRV_SB_CSP_MODE_QSOUND 0x04
31
32
33#define SNDRV_SB_CSP_LOAD_FROMUSER 0x01
34#define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02
35
36
37#define SNDRV_SB_CSP_SAMPLE_8BIT 0x01
38#define SNDRV_SB_CSP_SAMPLE_16BIT 0x02
39
40
41#define SNDRV_SB_CSP_MONO 0x01
42#define SNDRV_SB_CSP_STEREO 0x02
43
44
45#define SNDRV_SB_CSP_RATE_8000 0x01
46#define SNDRV_SB_CSP_RATE_11025 0x02
47#define SNDRV_SB_CSP_RATE_22050 0x04
48#define SNDRV_SB_CSP_RATE_44100 0x08
49#define SNDRV_SB_CSP_RATE_ALL 0x0f
50
51
52#define SNDRV_SB_CSP_ST_IDLE 0x00
53#define SNDRV_SB_CSP_ST_LOADED 0x01
54#define SNDRV_SB_CSP_ST_RUNNING 0x02
55#define SNDRV_SB_CSP_ST_PAUSED 0x04
56#define SNDRV_SB_CSP_ST_AUTO 0x08
57#define SNDRV_SB_CSP_ST_QSOUND 0x10
58
59
60#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20
61
62
63#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000
64
65
66struct snd_sb_csp_mc_header {
67 char codec_name[16];
68 unsigned short func_req;
69};
70
71
72struct snd_sb_csp_microcode {
73 struct snd_sb_csp_mc_header info;
74 unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
75};
76
77
78struct snd_sb_csp_start {
79 int sample_width;
80 int channels;
81};
82
83
84struct snd_sb_csp_info {
85 char codec_name[16];
86 unsigned short func_nr;
87 unsigned int acc_format;
88 unsigned short acc_channels;
89 unsigned short acc_width;
90 unsigned short acc_rates;
91 unsigned short csp_mode;
92 unsigned short run_channels;
93 unsigned short run_width;
94 unsigned short version;
95 unsigned short state;
96};
97
98
99
100#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info)
101
102
103
104
105
106
107
108#define SNDRV_SB_CSP_IOCTL_LOAD_CODE \
109 _IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode))
110
111#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12)
112
113#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start)
114
115#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14)
116
117#define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15)
118
119#define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16)
120
121#ifdef __KERNEL__
122#include "sb.h"
123#include "hwdep.h"
124#include <linux/firmware.h>
125
126struct snd_sb_csp;
127
128
129enum {
130 CSP_PROGRAM_MULAW,
131 CSP_PROGRAM_ALAW,
132 CSP_PROGRAM_ADPCM_INIT,
133 CSP_PROGRAM_ADPCM_PLAYBACK,
134 CSP_PROGRAM_ADPCM_CAPTURE,
135
136 CSP_PROGRAM_COUNT
137};
138
139
140
141
142struct snd_sb_csp_ops {
143 int (*csp_use) (struct snd_sb_csp * p);
144 int (*csp_unuse) (struct snd_sb_csp * p);
145 int (*csp_autoload) (struct snd_sb_csp * p, int pcm_sfmt, int play_rec_mode);
146 int (*csp_start) (struct snd_sb_csp * p, int sample_width, int channels);
147 int (*csp_stop) (struct snd_sb_csp * p);
148 int (*csp_qsound_transfer) (struct snd_sb_csp * p);
149};
150
151
152
153
154struct snd_sb_csp {
155 struct snd_sb *chip;
156 int used;
157 char codec_name[16];
158 unsigned short func_nr;
159 unsigned int acc_format;
160 int acc_channels;
161 int acc_width;
162 int acc_rates;
163 int mode;
164 int run_channels;
165 int run_width;
166 int version;
167 int running;
168
169 struct snd_sb_csp_ops ops;
170
171 spinlock_t q_lock;
172 int q_enabled;
173 int qpos_left;
174 int qpos_right;
175 int qpos_changed;
176
177 struct snd_kcontrol *qsound_switch;
178 struct snd_kcontrol *qsound_space;
179
180 struct mutex access_mutex;
181
182 const struct firmware *csp_programs[CSP_PROGRAM_COUNT];
183};
184
185int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep);
186#endif
187
188#endif
189