39 DE_MID((
"enable_midi_input(%d)\n", enable));
41 if (wait_handshake(chip))
52 clear_handshake(chip);
65 if (wait_handshake(chip))
75 clear_handshake(chip);
77 DE_MID((
"write_midi: %d\n", bytes));
90 static inline int mtc_process_data(
struct echoaudio *chip,
short midi_byte)
92 switch (chip->mtc_state) {
94 if (midi_byte == 0xF1)
116 static int midi_service_irq(
struct echoaudio *chip)
118 short int count, midi_byte,
i, received;
129 for (i = 1; i <=
count; i++) {
142 chip->midi_buffer[received++] = (
u8)midi_byte;
160 DE_MID((
"rawmidi_iopen\n"));
172 spin_lock_irq(&chip->
lock);
173 enable_midi_input(chip, up);
174 spin_unlock_irq(&chip->
lock);
185 chip->midi_in =
NULL;
186 DE_MID((
"rawmidi_iclose\n"));
199 DE_MID((
"rawmidi_oopen\n"));
205 static void snd_echo_midi_output_write(
unsigned long data)
212 DE_MID((
"snd_echo_midi_output_write\n"));
221 DE_MID((
"Try to send %d bytes...\n", bytes));
222 sent = write_midi(chip, buf, bytes);
228 }
else if (sent > 0) {
229 DE_MID((
"%d bytes sent\n", sent));
244 time = (sent << 3) / 25 + 1;
246 DE_MID((
"Timer armed(%d)\n", ((time *
HZ + 999) / 1000)));
248 spin_unlock_irqrestore(&chip->
lock, flags);
258 DE_MID((
"snd_echo_midi_output_trigger(%d)\n", up));
259 spin_lock_irq(&chip->
lock);
263 chip->
timer.function = snd_echo_midi_output_write;
270 spin_unlock_irq(&chip->
lock);
272 DE_MID((
"Timer removed\n"));
276 spin_unlock_irq(&chip->
lock);
279 snd_echo_midi_output_write((
unsigned long)chip);
288 chip->midi_out =
NULL;
289 DE_MID((
"rawmidi_oclose\n"));
296 .open = snd_echo_midi_input_open,
297 .close = snd_echo_midi_input_close,
298 .trigger = snd_echo_midi_input_trigger,
302 .open = snd_echo_midi_output_open,
303 .close = snd_echo_midi_output_close,
304 .trigger = snd_echo_midi_output_trigger,
320 chip->rmidi->private_data =
chip;
323 &snd_echo_midi_input);
325 &snd_echo_midi_output);