midi.c (b22364c8eec89e6b0c081a237f3b6348df87796f) midi.c (da3cec35dd3c31d8706db4bf379372ce70d92118)
1/****************************************************************************
2
3 Copyright Echo Digital Audio Corporation (c) 1998 - 2004
4 All rights reserved
5 www.echoaudio.com
6
7 This file is part of Echo Digital Audio's generic driver library.
8

--- 45 unchanged lines hidden (view full) ---

54}
55
56
57
58/* Send a buffer full of MIDI data to the DSP
59Returns how many actually written or < 0 on error */
60static int write_midi(struct echoaudio *chip, u8 *data, int bytes)
61{
1/****************************************************************************
2
3 Copyright Echo Digital Audio Corporation (c) 1998 - 2004
4 All rights reserved
5 www.echoaudio.com
6
7 This file is part of Echo Digital Audio's generic driver library.
8

--- 45 unchanged lines hidden (view full) ---

54}
55
56
57
58/* Send a buffer full of MIDI data to the DSP
59Returns how many actually written or < 0 on error */
60static int write_midi(struct echoaudio *chip, u8 *data, int bytes)
61{
62 snd_assert(bytes > 0 && bytes < MIDI_OUT_BUFFER_SIZE, return -EINVAL);
62 if (snd_BUG_ON(bytes <= 0 || bytes >= MIDI_OUT_BUFFER_SIZE))
63 return -EINVAL;
63
64 if (wait_handshake(chip))
65 return -EIO;
66
67 /* HF4 indicates that it is safe to write MIDI output data */
68 if (! (get_dsp_register(chip, CHI32_STATUS_REG) & CHI32_STATUS_REG_HF4))
69 return 0;
70

--- 43 unchanged lines hidden (view full) ---

114from the DSP's buffer. It returns the number of bytes received. */
115static int midi_service_irq(struct echoaudio *chip)
116{
117 short int count, midi_byte, i, received;
118
119 /* The count is at index 0, followed by actual data */
120 count = le16_to_cpu(chip->comm_page->midi_input[0]);
121
64
65 if (wait_handshake(chip))
66 return -EIO;
67
68 /* HF4 indicates that it is safe to write MIDI output data */
69 if (! (get_dsp_register(chip, CHI32_STATUS_REG) & CHI32_STATUS_REG_HF4))
70 return 0;
71

--- 43 unchanged lines hidden (view full) ---

115from the DSP's buffer. It returns the number of bytes received. */
116static int midi_service_irq(struct echoaudio *chip)
117{
118 short int count, midi_byte, i, received;
119
120 /* The count is at index 0, followed by actual data */
121 count = le16_to_cpu(chip->comm_page->midi_input[0]);
122
122 snd_assert(count < MIDI_IN_BUFFER_SIZE, return 0);
123 if (snd_BUG_ON(count >= MIDI_IN_BUFFER_SIZE))
124 return 0;
123
124 /* Get the MIDI data from the comm page */
125 i = 1;
126 received = 0;
127 for (i = 1; i <= count; i++) {
128 /* Get the MIDI byte */
129 midi_byte = le16_to_cpu(chip->comm_page->midi_input[i]);
130

--- 199 unchanged lines hidden ---
125
126 /* Get the MIDI data from the comm page */
127 i = 1;
128 received = 0;
129 for (i = 1; i <= count; i++) {
130 /* Get the MIDI byte */
131 midi_byte = le16_to_cpu(chip->comm_page->midi_input[i]);
132

--- 199 unchanged lines hidden ---