• Home
  • Raw
  • Download

Lines Matching refs:midi

55 wf_mpu_status (snd_wavefront_midi_t *midi)  in wf_mpu_status()  argument
58 return inb (midi->mpu_status_port); in wf_mpu_status()
62 input_avail (snd_wavefront_midi_t *midi) in input_avail() argument
65 return !(wf_mpu_status(midi) & INPUT_AVAIL); in input_avail()
69 output_ready (snd_wavefront_midi_t *midi) in output_ready() argument
72 return !(wf_mpu_status(midi) & OUTPUT_READY); in output_ready()
76 read_data (snd_wavefront_midi_t *midi) in read_data() argument
79 return inb (midi->mpu_data_port); in read_data()
83 write_data (snd_wavefront_midi_t *midi, unsigned char byte) in write_data() argument
86 outb (byte, midi->mpu_data_port); in write_data()
109 return &acard->wavefront.midi; in get_wavefront_midi()
114 snd_wavefront_midi_t *midi = &card->wavefront.midi; in snd_wavefront_midi_output_write() local
132 if (midi->substream_output[midi->output_mpu] == NULL) { in snd_wavefront_midi_output_write()
141 if (output_ready (midi)) in snd_wavefront_midi_output_write()
145 spin_lock_irqsave (&midi->virtual, flags); in snd_wavefront_midi_output_write()
146 if ((midi->mode[midi->output_mpu] & MPU401_MODE_OUTPUT) == 0) { in snd_wavefront_midi_output_write()
147 spin_unlock_irqrestore (&midi->virtual, flags); in snd_wavefront_midi_output_write()
150 if (output_ready (midi)) { in snd_wavefront_midi_output_write()
151 if (snd_rawmidi_transmit(midi->substream_output[midi->output_mpu], &midi_byte, 1) == 1) { in snd_wavefront_midi_output_write()
152 if (!midi->isvirtual || in snd_wavefront_midi_output_write()
155 write_data(midi, midi_byte); in snd_wavefront_midi_output_write()
158 if (midi->istimer) { in snd_wavefront_midi_output_write()
159 if (--midi->istimer <= 0) in snd_wavefront_midi_output_write()
160 del_timer(&midi->timer); in snd_wavefront_midi_output_write()
162 midi->mode[midi->output_mpu] &= ~MPU401_MODE_OUTPUT_TRIGGER; in snd_wavefront_midi_output_write()
163 spin_unlock_irqrestore (&midi->virtual, flags); in snd_wavefront_midi_output_write()
167 spin_unlock_irqrestore (&midi->virtual, flags); in snd_wavefront_midi_output_write()
170 spin_unlock_irqrestore (&midi->virtual, flags); in snd_wavefront_midi_output_write()
175 if (midi->substream_output[!midi->output_mpu] == NULL) { in snd_wavefront_midi_output_write()
184 if (output_ready (midi)) in snd_wavefront_midi_output_write()
188 spin_lock_irqsave (&midi->virtual, flags); in snd_wavefront_midi_output_write()
189 if (!midi->isvirtual) in snd_wavefront_midi_output_write()
191 mpu = midi->output_mpu ^ mask; in snd_wavefront_midi_output_write()
193 if ((midi->mode[mpu] & MPU401_MODE_OUTPUT) == 0) { in snd_wavefront_midi_output_write()
194 spin_unlock_irqrestore (&midi->virtual, flags); in snd_wavefront_midi_output_write()
197 if (snd_rawmidi_transmit_empty(midi->substream_output[mpu])) in snd_wavefront_midi_output_write()
199 if (output_ready (midi)) { in snd_wavefront_midi_output_write()
200 if (mpu != midi->output_mpu) { in snd_wavefront_midi_output_write()
201 write_data(midi, mpu == internal_mpu ? in snd_wavefront_midi_output_write()
204 midi->output_mpu = mpu; in snd_wavefront_midi_output_write()
205 } else if (snd_rawmidi_transmit(midi->substream_output[mpu], &midi_byte, 1) == 1) { in snd_wavefront_midi_output_write()
206 if (!midi->isvirtual || in snd_wavefront_midi_output_write()
209 write_data(midi, midi_byte); in snd_wavefront_midi_output_write()
213 if (midi->istimer) { in snd_wavefront_midi_output_write()
214 if (--midi->istimer <= 0) in snd_wavefront_midi_output_write()
215 del_timer(&midi->timer); in snd_wavefront_midi_output_write()
217 midi->mode[mpu] &= ~MPU401_MODE_OUTPUT_TRIGGER; in snd_wavefront_midi_output_write()
218 spin_unlock_irqrestore (&midi->virtual, flags); in snd_wavefront_midi_output_write()
222 spin_unlock_irqrestore (&midi->virtual, flags); in snd_wavefront_midi_output_write()
225 spin_unlock_irqrestore (&midi->virtual, flags); in snd_wavefront_midi_output_write()
232 snd_wavefront_midi_t *midi; in snd_wavefront_midi_input_open() local
242 if ((midi = get_wavefront_midi (substream)) == NULL) in snd_wavefront_midi_input_open()
245 spin_lock_irqsave (&midi->open, flags); in snd_wavefront_midi_input_open()
246 midi->mode[mpu] |= MPU401_MODE_INPUT; in snd_wavefront_midi_input_open()
247 midi->substream_input[mpu] = substream; in snd_wavefront_midi_input_open()
248 spin_unlock_irqrestore (&midi->open, flags); in snd_wavefront_midi_input_open()
256 snd_wavefront_midi_t *midi; in snd_wavefront_midi_output_open() local
266 if ((midi = get_wavefront_midi (substream)) == NULL) in snd_wavefront_midi_output_open()
269 spin_lock_irqsave (&midi->open, flags); in snd_wavefront_midi_output_open()
270 midi->mode[mpu] |= MPU401_MODE_OUTPUT; in snd_wavefront_midi_output_open()
271 midi->substream_output[mpu] = substream; in snd_wavefront_midi_output_open()
272 spin_unlock_irqrestore (&midi->open, flags); in snd_wavefront_midi_output_open()
280 snd_wavefront_midi_t *midi; in snd_wavefront_midi_input_close() local
290 if ((midi = get_wavefront_midi (substream)) == NULL) in snd_wavefront_midi_input_close()
293 spin_lock_irqsave (&midi->open, flags); in snd_wavefront_midi_input_close()
294 midi->mode[mpu] &= ~MPU401_MODE_INPUT; in snd_wavefront_midi_input_close()
295 spin_unlock_irqrestore (&midi->open, flags); in snd_wavefront_midi_input_close()
303 snd_wavefront_midi_t *midi; in snd_wavefront_midi_output_close() local
313 if ((midi = get_wavefront_midi (substream)) == NULL) in snd_wavefront_midi_output_close()
316 spin_lock_irqsave (&midi->open, flags); in snd_wavefront_midi_output_close()
317 midi->mode[mpu] &= ~MPU401_MODE_OUTPUT; in snd_wavefront_midi_output_close()
318 spin_unlock_irqrestore (&midi->open, flags); in snd_wavefront_midi_output_close()
325 snd_wavefront_midi_t *midi; in snd_wavefront_midi_input_trigger() local
336 if ((midi = get_wavefront_midi (substream)) == NULL) { in snd_wavefront_midi_input_trigger()
340 spin_lock_irqsave (&midi->virtual, flags); in snd_wavefront_midi_input_trigger()
342 midi->mode[mpu] |= MPU401_MODE_INPUT_TRIGGER; in snd_wavefront_midi_input_trigger()
344 midi->mode[mpu] &= ~MPU401_MODE_INPUT_TRIGGER; in snd_wavefront_midi_input_trigger()
346 spin_unlock_irqrestore (&midi->virtual, flags); in snd_wavefront_midi_input_trigger()
351 snd_wavefront_midi_t *midi = from_timer(midi, t, timer); in snd_wavefront_midi_output_timer() local
352 snd_wavefront_card_t *card = midi->timer_card; in snd_wavefront_midi_output_timer()
355 spin_lock_irqsave (&midi->virtual, flags); in snd_wavefront_midi_output_timer()
356 mod_timer(&midi->timer, 1 + jiffies); in snd_wavefront_midi_output_timer()
357 spin_unlock_irqrestore (&midi->virtual, flags); in snd_wavefront_midi_output_timer()
364 snd_wavefront_midi_t *midi; in snd_wavefront_midi_output_trigger() local
375 if ((midi = get_wavefront_midi (substream)) == NULL) { in snd_wavefront_midi_output_trigger()
379 spin_lock_irqsave (&midi->virtual, flags); in snd_wavefront_midi_output_trigger()
381 if ((midi->mode[mpu] & MPU401_MODE_OUTPUT_TRIGGER) == 0) { in snd_wavefront_midi_output_trigger()
382 if (!midi->istimer) { in snd_wavefront_midi_output_trigger()
383 timer_setup(&midi->timer, in snd_wavefront_midi_output_trigger()
386 mod_timer(&midi->timer, 1 + jiffies); in snd_wavefront_midi_output_trigger()
388 midi->istimer++; in snd_wavefront_midi_output_trigger()
389 midi->mode[mpu] |= MPU401_MODE_OUTPUT_TRIGGER; in snd_wavefront_midi_output_trigger()
392 midi->mode[mpu] &= ~MPU401_MODE_OUTPUT_TRIGGER; in snd_wavefront_midi_output_trigger()
394 spin_unlock_irqrestore (&midi->virtual, flags); in snd_wavefront_midi_output_trigger()
405 snd_wavefront_midi_t *midi; in snd_wavefront_midi_interrupt() local
411 midi = &card->wavefront.midi; in snd_wavefront_midi_interrupt()
413 if (!input_avail (midi)) { /* not for us */ in snd_wavefront_midi_interrupt()
418 spin_lock_irqsave (&midi->virtual, flags); in snd_wavefront_midi_interrupt()
421 if (input_avail (midi)) { in snd_wavefront_midi_interrupt()
422 byte = read_data (midi); in snd_wavefront_midi_interrupt()
424 if (midi->isvirtual) { in snd_wavefront_midi_interrupt()
426 substream = midi->substream_input[external_mpu]; in snd_wavefront_midi_interrupt()
429 substream = midi->substream_output[internal_mpu]; in snd_wavefront_midi_interrupt()
433 substream = midi->substream_input[internal_mpu]; in snd_wavefront_midi_interrupt()
441 if (midi->mode[mpu] & MPU401_MODE_INPUT_TRIGGER) { in snd_wavefront_midi_interrupt()
448 spin_unlock_irqrestore (&midi->virtual, flags); in snd_wavefront_midi_interrupt()
459 spin_lock_irqsave (&card->wavefront.midi.virtual, flags); in snd_wavefront_midi_enable_virtual()
460 card->wavefront.midi.isvirtual = 1; in snd_wavefront_midi_enable_virtual()
461 card->wavefront.midi.output_mpu = internal_mpu; in snd_wavefront_midi_enable_virtual()
462 card->wavefront.midi.input_mpu = internal_mpu; in snd_wavefront_midi_enable_virtual()
463 spin_unlock_irqrestore (&card->wavefront.midi.virtual, flags); in snd_wavefront_midi_enable_virtual()
472 spin_lock_irqsave (&card->wavefront.midi.virtual, flags); in snd_wavefront_midi_disable_virtual()
475 card->wavefront.midi.isvirtual = 0; in snd_wavefront_midi_disable_virtual()
476 spin_unlock_irqrestore (&card->wavefront.midi.virtual, flags); in snd_wavefront_midi_disable_virtual()
486 snd_wavefront_midi_t *midi; in snd_wavefront_midi_start() local
489 midi = &dev->midi; in snd_wavefront_midi_start()
497 for (i = 0; i < 30000 && !output_ready (midi); i++); in snd_wavefront_midi_start()
499 if (!output_ready (midi)) { in snd_wavefront_midi_start()
510 outb (UART_MODE_ON, midi->mpu_command_port); in snd_wavefront_midi_start()
513 if (input_avail (midi)) { in snd_wavefront_midi_start()
514 if (read_data (midi) == MPU_ACK) { in snd_wavefront_midi_start()