Lines Matching refs:hmidi
1307 static int snd_hdsp_midi_output_write (struct hdsp_midi *hmidi) in snd_hdsp_midi_output_write() argument
1317 spin_lock_irqsave (&hmidi->lock, flags); in snd_hdsp_midi_output_write()
1318 if (hmidi->output) { in snd_hdsp_midi_output_write()
1319 if (!snd_rawmidi_transmit_empty (hmidi->output)) { in snd_hdsp_midi_output_write()
1320 n_pending = snd_hdsp_midi_output_possible(hmidi->hdsp, hmidi->id); in snd_hdsp_midi_output_write()
1325 to_write = snd_rawmidi_transmit(hmidi->output, buf, n_pending); in snd_hdsp_midi_output_write()
1328 snd_hdsp_midi_write_byte (hmidi->hdsp, hmidi->id, buf[i]); in snd_hdsp_midi_output_write()
1333 spin_unlock_irqrestore (&hmidi->lock, flags); in snd_hdsp_midi_output_write()
1337 static int snd_hdsp_midi_input_read (struct hdsp_midi *hmidi) in snd_hdsp_midi_input_read() argument
1344 spin_lock_irqsave (&hmidi->lock, flags); in snd_hdsp_midi_input_read()
1345 n_pending = snd_hdsp_midi_input_available(hmidi->hdsp, hmidi->id); in snd_hdsp_midi_input_read()
1347 if (hmidi->input) { in snd_hdsp_midi_input_read()
1351 buf[i] = snd_hdsp_midi_read_byte (hmidi->hdsp, hmidi->id); in snd_hdsp_midi_input_read()
1353 snd_rawmidi_receive (hmidi->input, buf, n_pending); in snd_hdsp_midi_input_read()
1357 snd_hdsp_midi_read_byte (hmidi->hdsp, hmidi->id); in snd_hdsp_midi_input_read()
1360 hmidi->pending = 0; in snd_hdsp_midi_input_read()
1361 if (hmidi->id) in snd_hdsp_midi_input_read()
1362 hmidi->hdsp->control_register |= HDSP_Midi1InterruptEnable; in snd_hdsp_midi_input_read()
1364 hmidi->hdsp->control_register |= HDSP_Midi0InterruptEnable; in snd_hdsp_midi_input_read()
1365 hdsp_write(hmidi->hdsp, HDSP_controlRegister, hmidi->hdsp->control_register); in snd_hdsp_midi_input_read()
1366 spin_unlock_irqrestore (&hmidi->lock, flags); in snd_hdsp_midi_input_read()
1367 return snd_hdsp_midi_output_write (hmidi); in snd_hdsp_midi_input_read()
1373 struct hdsp_midi *hmidi; in snd_hdsp_midi_input_trigger() local
1377 hmidi = (struct hdsp_midi *) substream->rmidi->private_data; in snd_hdsp_midi_input_trigger()
1378 hdsp = hmidi->hdsp; in snd_hdsp_midi_input_trigger()
1379 ie = hmidi->id ? HDSP_Midi1InterruptEnable : HDSP_Midi0InterruptEnable; in snd_hdsp_midi_input_trigger()
1383 snd_hdsp_flush_midi_input (hdsp, hmidi->id); in snd_hdsp_midi_input_trigger()
1396 struct hdsp_midi *hmidi = from_timer(hmidi, t, timer); in snd_hdsp_midi_output_timer() local
1399 snd_hdsp_midi_output_write(hmidi); in snd_hdsp_midi_output_timer()
1400 spin_lock_irqsave (&hmidi->lock, flags); in snd_hdsp_midi_output_timer()
1408 if (hmidi->istimer) in snd_hdsp_midi_output_timer()
1409 mod_timer(&hmidi->timer, 1 + jiffies); in snd_hdsp_midi_output_timer()
1411 spin_unlock_irqrestore (&hmidi->lock, flags); in snd_hdsp_midi_output_timer()
1416 struct hdsp_midi *hmidi; in snd_hdsp_midi_output_trigger() local
1419 hmidi = (struct hdsp_midi *) substream->rmidi->private_data; in snd_hdsp_midi_output_trigger()
1420 spin_lock_irqsave (&hmidi->lock, flags); in snd_hdsp_midi_output_trigger()
1422 if (!hmidi->istimer) { in snd_hdsp_midi_output_trigger()
1423 timer_setup(&hmidi->timer, snd_hdsp_midi_output_timer, in snd_hdsp_midi_output_trigger()
1425 mod_timer(&hmidi->timer, 1 + jiffies); in snd_hdsp_midi_output_trigger()
1426 hmidi->istimer++; in snd_hdsp_midi_output_trigger()
1429 if (hmidi->istimer && --hmidi->istimer <= 0) in snd_hdsp_midi_output_trigger()
1430 del_timer (&hmidi->timer); in snd_hdsp_midi_output_trigger()
1432 spin_unlock_irqrestore (&hmidi->lock, flags); in snd_hdsp_midi_output_trigger()
1434 snd_hdsp_midi_output_write(hmidi); in snd_hdsp_midi_output_trigger()
1439 struct hdsp_midi *hmidi; in snd_hdsp_midi_input_open() local
1441 hmidi = (struct hdsp_midi *) substream->rmidi->private_data; in snd_hdsp_midi_input_open()
1442 spin_lock_irq (&hmidi->lock); in snd_hdsp_midi_input_open()
1443 snd_hdsp_flush_midi_input (hmidi->hdsp, hmidi->id); in snd_hdsp_midi_input_open()
1444 hmidi->input = substream; in snd_hdsp_midi_input_open()
1445 spin_unlock_irq (&hmidi->lock); in snd_hdsp_midi_input_open()
1452 struct hdsp_midi *hmidi; in snd_hdsp_midi_output_open() local
1454 hmidi = (struct hdsp_midi *) substream->rmidi->private_data; in snd_hdsp_midi_output_open()
1455 spin_lock_irq (&hmidi->lock); in snd_hdsp_midi_output_open()
1456 hmidi->output = substream; in snd_hdsp_midi_output_open()
1457 spin_unlock_irq (&hmidi->lock); in snd_hdsp_midi_output_open()
1464 struct hdsp_midi *hmidi; in snd_hdsp_midi_input_close() local
1468 hmidi = (struct hdsp_midi *) substream->rmidi->private_data; in snd_hdsp_midi_input_close()
1469 spin_lock_irq (&hmidi->lock); in snd_hdsp_midi_input_close()
1470 hmidi->input = NULL; in snd_hdsp_midi_input_close()
1471 spin_unlock_irq (&hmidi->lock); in snd_hdsp_midi_input_close()
1478 struct hdsp_midi *hmidi; in snd_hdsp_midi_output_close() local
1482 hmidi = (struct hdsp_midi *) substream->rmidi->private_data; in snd_hdsp_midi_output_close()
1483 spin_lock_irq (&hmidi->lock); in snd_hdsp_midi_output_close()
1484 hmidi->output = NULL; in snd_hdsp_midi_output_close()
1485 spin_unlock_irq (&hmidi->lock); in snd_hdsp_midi_output_close()