aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ca0106/ca_midi.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/ca0106/ca_midi.c')
-rw-r--r--sound/pci/ca0106/ca_midi.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/sound/pci/ca0106/ca_midi.c b/sound/pci/ca0106/ca_midi.c
index 2e08b27b8349..2e6eab1f1189 100644
--- a/sound/pci/ca0106/ca_midi.c
+++ b/sound/pci/ca0106/ca_midi.c
@@ -40,18 +40,20 @@
40#define ca_midi_input_avail(midi) (!(ca_midi_read_stat(midi) & midi->input_avail)) 40#define ca_midi_input_avail(midi) (!(ca_midi_read_stat(midi) & midi->input_avail))
41#define ca_midi_output_ready(midi) (!(ca_midi_read_stat(midi) & midi->output_ready)) 41#define ca_midi_output_ready(midi) (!(ca_midi_read_stat(midi) & midi->output_ready))
42 42
43static void ca_midi_clear_rx(ca_midi_t *midi) 43static void ca_midi_clear_rx(struct snd_ca_midi *midi)
44{ 44{
45 int timeout = 100000; 45 int timeout = 100000;
46 for (; timeout > 0 && ca_midi_input_avail(midi); timeout--) 46 for (; timeout > 0 && ca_midi_input_avail(midi); timeout--)
47 ca_midi_read_data(midi); 47 ca_midi_read_data(midi);
48#ifdef CONFIG_SND_DEBUG 48#ifdef CONFIG_SND_DEBUG
49 if (timeout <= 0) 49 if (timeout <= 0)
50 snd_printk(KERN_ERR "ca_midi_clear_rx: timeout (status = 0x%x)\n", ca_midi_read_stat(midi)); 50 snd_printk(KERN_ERR "ca_midi_clear_rx: timeout (status = 0x%x)\n",
51 ca_midi_read_stat(midi));
51#endif 52#endif
52} 53}
53 54
54static void ca_midi_interrupt(ca_midi_t *midi, unsigned int status) { 55static void ca_midi_interrupt(struct snd_ca_midi *midi, unsigned int status)
56{
55 unsigned char byte; 57 unsigned char byte;
56 58
57 if (midi->rmidi == NULL) { 59 if (midi->rmidi == NULL) {
@@ -86,7 +88,7 @@ static void ca_midi_interrupt(ca_midi_t *midi, unsigned int status) {
86 88
87} 89}
88 90
89static void ca_midi_cmd(ca_midi_t *midi, unsigned char cmd, int ack) 91static void ca_midi_cmd(struct snd_ca_midi *midi, unsigned char cmd, int ack)
90{ 92{
91 unsigned long flags; 93 unsigned long flags;
92 int timeout, ok; 94 int timeout, ok;
@@ -119,9 +121,9 @@ static void ca_midi_cmd(ca_midi_t *midi, unsigned char cmd, int ack)
119 ca_midi_read_data(midi)); 121 ca_midi_read_data(midi));
120} 122}
121 123
122static int ca_midi_input_open(snd_rawmidi_substream_t * substream) 124static int ca_midi_input_open(struct snd_rawmidi_substream *substream)
123{ 125{
124 ca_midi_t *midi = (ca_midi_t *)substream->rmidi->private_data; 126 struct snd_ca_midi *midi = substream->rmidi->private_data;
125 unsigned long flags; 127 unsigned long flags;
126 128
127 snd_assert(midi->dev_id, return -ENXIO); 129 snd_assert(midi->dev_id, return -ENXIO);
@@ -138,9 +140,9 @@ static int ca_midi_input_open(snd_rawmidi_substream_t * substream)
138 return 0; 140 return 0;
139} 141}
140 142
141static int ca_midi_output_open(snd_rawmidi_substream_t * substream) 143static int ca_midi_output_open(struct snd_rawmidi_substream *substream)
142{ 144{
143 ca_midi_t *midi = (ca_midi_t *)substream->rmidi->private_data; 145 struct snd_ca_midi *midi = substream->rmidi->private_data;
144 unsigned long flags; 146 unsigned long flags;
145 147
146 snd_assert(midi->dev_id, return -ENXIO); 148 snd_assert(midi->dev_id, return -ENXIO);
@@ -157,9 +159,9 @@ static int ca_midi_output_open(snd_rawmidi_substream_t * substream)
157 return 0; 159 return 0;
158} 160}
159 161
160static int ca_midi_input_close(snd_rawmidi_substream_t * substream) 162static int ca_midi_input_close(struct snd_rawmidi_substream *substream)
161{ 163{
162 ca_midi_t *midi = (ca_midi_t *)substream->rmidi->private_data; 164 struct snd_ca_midi *midi = substream->rmidi->private_data;
163 unsigned long flags; 165 unsigned long flags;
164 166
165 snd_assert(midi->dev_id, return -ENXIO); 167 snd_assert(midi->dev_id, return -ENXIO);
@@ -176,9 +178,9 @@ static int ca_midi_input_close(snd_rawmidi_substream_t * substream)
176 return 0; 178 return 0;
177} 179}
178 180
179static int ca_midi_output_close(snd_rawmidi_substream_t * substream) 181static int ca_midi_output_close(struct snd_rawmidi_substream *substream)
180{ 182{
181 ca_midi_t *midi = (ca_midi_t *)substream->rmidi->private_data; 183 struct snd_ca_midi *midi = substream->rmidi->private_data;
182 unsigned long flags; 184 unsigned long flags;
183 snd_assert(midi->dev_id, return -ENXIO); 185 snd_assert(midi->dev_id, return -ENXIO);
184 186
@@ -197,9 +199,9 @@ static int ca_midi_output_close(snd_rawmidi_substream_t * substream)
197 return 0; 199 return 0;
198} 200}
199 201
200static void ca_midi_input_trigger(snd_rawmidi_substream_t * substream, int up) 202static void ca_midi_input_trigger(struct snd_rawmidi_substream *substream, int up)
201{ 203{
202 ca_midi_t *midi = (ca_midi_t *)substream->rmidi->private_data; 204 struct snd_ca_midi *midi = substream->rmidi->private_data;
203 snd_assert(midi->dev_id, return); 205 snd_assert(midi->dev_id, return);
204 206
205 if (up) { 207 if (up) {
@@ -209,9 +211,9 @@ static void ca_midi_input_trigger(snd_rawmidi_substream_t * substream, int up)
209 } 211 }
210} 212}
211 213
212static void ca_midi_output_trigger(snd_rawmidi_substream_t * substream, int up) 214static void ca_midi_output_trigger(struct snd_rawmidi_substream *substream, int up)
213{ 215{
214 ca_midi_t *midi = (ca_midi_t *)substream->rmidi->private_data; 216 struct snd_ca_midi *midi = substream->rmidi->private_data;
215 unsigned long flags; 217 unsigned long flags;
216 218
217 snd_assert(midi->dev_id, return); 219 snd_assert(midi->dev_id, return);
@@ -246,21 +248,22 @@ static void ca_midi_output_trigger(snd_rawmidi_substream_t * substream, int up)
246 } 248 }
247} 249}
248 250
249static snd_rawmidi_ops_t ca_midi_output = 251static struct snd_rawmidi_ops ca_midi_output =
250{ 252{
251 .open = ca_midi_output_open, 253 .open = ca_midi_output_open,
252 .close = ca_midi_output_close, 254 .close = ca_midi_output_close,
253 .trigger = ca_midi_output_trigger, 255 .trigger = ca_midi_output_trigger,
254}; 256};
255 257
256static snd_rawmidi_ops_t ca_midi_input = 258static struct snd_rawmidi_ops ca_midi_input =
257{ 259{
258 .open = ca_midi_input_open, 260 .open = ca_midi_input_open,
259 .close = ca_midi_input_close, 261 .close = ca_midi_input_close,
260 .trigger = ca_midi_input_trigger, 262 .trigger = ca_midi_input_trigger,
261}; 263};
262 264
263static void ca_midi_free(ca_midi_t *midi) { 265static void ca_midi_free(struct snd_ca_midi *midi)
266{
264 midi->interrupt = NULL; 267 midi->interrupt = NULL;
265 midi->interrupt_enable = NULL; 268 midi->interrupt_enable = NULL;
266 midi->interrupt_disable = NULL; 269 midi->interrupt_disable = NULL;
@@ -271,14 +274,14 @@ static void ca_midi_free(ca_midi_t *midi) {
271 midi->rmidi = NULL; 274 midi->rmidi = NULL;
272} 275}
273 276
274static void ca_rmidi_free(snd_rawmidi_t *rmidi) 277static void ca_rmidi_free(struct snd_rawmidi *rmidi)
275{ 278{
276 ca_midi_free((ca_midi_t *)rmidi->private_data); 279 ca_midi_free(rmidi->private_data);
277} 280}
278 281
279int __devinit ca_midi_init(void *dev_id, ca_midi_t *midi, int device, char *name) 282int __devinit ca_midi_init(void *dev_id, struct snd_ca_midi *midi, int device, char *name)
280{ 283{
281 snd_rawmidi_t *rmidi; 284 struct snd_rawmidi *rmidi;
282 int err; 285 int err;
283 286
284 if ((err = snd_rawmidi_new(midi->get_dev_id_card(midi->dev_id), name, device, 1, 1, &rmidi)) < 0) 287 if ((err = snd_rawmidi_new(midi->get_dev_id_card(midi->dev_id), name, device, 1, 1, &rmidi)) < 0)