diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2019-01-22 22:17:04 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-01-22 17:20:54 +0100 |
commit | 82b6297b4434d1bc523f3470be4875ab185c6663 (patch) | |
tree | 27bdbce1a069da4f3e3a31bf104078c9703162a8 /sound/firewire/fireface/ff-protocol-former.c | |
parent | 481e09ac9a82644af697884cc522b76b4dd07e4d (diff) |
ALSA: fireface: add protocol-specific operation to fill transaction buffer with MIDI messages
Between former and latter models, content of asynchronous transaction
for MIDI messages from driver to device is different.
This commit is a preparation to support latter models. A protocol-specific
operation is added to encode MIDI messages to the transaction.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/fireface/ff-protocol-former.c')
-rw-r--r-- | sound/firewire/fireface/ff-protocol-former.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sound/firewire/fireface/ff-protocol-former.c b/sound/firewire/fireface/ff-protocol-former.c index 266e4892a818..e0acf40a02ee 100644 --- a/sound/firewire/fireface/ff-protocol-former.c +++ b/sound/firewire/fireface/ff-protocol-former.c @@ -263,6 +263,27 @@ static void former_dump_status(struct snd_ff *ff, dump_sync_status(ff, buffer); } +static int former_fill_midi_msg(struct snd_ff *ff, + struct snd_rawmidi_substream *substream, + unsigned int port) +{ + u8 *buf = (u8 *)ff->msg_buf[port]; + int len; + int i; + + len = snd_rawmidi_transmit_peek(substream, buf, + SND_FF_MAXIMIM_MIDI_QUADS); + if (len <= 0) + return len; + + // One quadlet includes one byte. + for (i = len - 1; i >= 0; --i) + ff->msg_buf[port][i] = cpu_to_le32(buf[i]); + ff->rx_bytes[port] = len; + + return len; +} + #define FF800_STF 0x0000fc88f000 #define FF800_RX_PACKET_FORMAT 0x0000fc88f004 #define FF800_ALLOC_TX_STREAM 0x0000fc88f008 @@ -392,6 +413,7 @@ static void ff800_handle_midi_msg(struct snd_ff *ff, unsigned int offset, const struct snd_ff_protocol snd_ff_protocol_ff800 = { .handle_midi_msg = ff800_handle_midi_msg, + .fill_midi_msg = former_fill_midi_msg, .get_clock = former_get_clock, .switch_fetching_mode = former_switch_fetching_mode, .begin_session = ff800_begin_session, @@ -543,6 +565,7 @@ static void ff400_handle_midi_msg(struct snd_ff *ff, unsigned int offset, const struct snd_ff_protocol snd_ff_protocol_ff400 = { .handle_midi_msg = ff400_handle_midi_msg, + .fill_midi_msg = former_fill_midi_msg, .get_clock = former_get_clock, .switch_fetching_mode = former_switch_fetching_mode, .begin_session = ff400_begin_session, |