ALSA: fireface: change prototype of handler for async transaction with MIDI messages
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Tue, 22 Jan 2019 13:17:00 +0000 (22:17 +0900)
committerTakashi Iwai <tiwai@suse.de>
Tue, 22 Jan 2019 16:20:49 +0000 (17:20 +0100)
In a series of Fireface, devices transfer asynchronous transaction with
MIDI messages. In the transaction, content is different depending on
models. ALSA fireface driver has protocol-dependent handler to pick up
MIDI messages from the content.

In latter models of the series, the transaction is transferred to range
of address sequentially. This seems to check continuity of transferred
messages.

This commit changes prototype of the handler to receive offset of
address for received transactions.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/fireface/ff-protocol-former.c
sound/firewire/fireface/ff-transaction.c
sound/firewire/fireface/ff.h

index 9c0ae50e88d1d88fd404c1a05765765f1d38a2c2..266e4892a81837a6d6c5947fb31b55794f2e947a 100644 (file)
@@ -375,7 +375,8 @@ static void ff800_finish_session(struct snd_ff *ff)
                           FF800_ISOC_COMM_STOP, &reg, sizeof(reg), 0);
 }
 
-static void ff800_handle_midi_msg(struct snd_ff *ff, __le32 *buf, size_t length)
+static void ff800_handle_midi_msg(struct snd_ff *ff, unsigned int offset,
+                                 __le32 *buf, size_t length)
 {
        int i;
 
@@ -502,7 +503,8 @@ static void ff400_finish_session(struct snd_ff *ff)
                           FF400_ISOC_COMM_STOP, &reg, sizeof(reg), 0);
 }
 
-static void ff400_handle_midi_msg(struct snd_ff *ff, __le32 *buf, size_t length)
+static void ff400_handle_midi_msg(struct snd_ff *ff, unsigned int offset,
+                                 __le32 *buf, size_t length)
 {
        int i;
 
index 065e045d3fb5ab2d4e1c821d6e6bde70d100e68f..d3fde813ce17dc6b9d881345176300e1f5affecc 100644 (file)
@@ -146,7 +146,9 @@ static void handle_midi_msg(struct fw_card *card, struct fw_request *request,
 
        fw_send_response(card, request, RCODE_COMPLETE);
 
-       ff->spec->protocol->handle_midi_msg(ff, buf, length);
+       offset -= ff->async_handler.offset;
+       ff->spec->protocol->handle_midi_msg(ff, (unsigned int)offset, buf,
+                                           length);
 }
 
 static int allocate_own_address(struct snd_ff *ff, int i)
index 8aea7920b57f3d38eebfa352b836c47e38bde7a7..ddcffb8d85c6c68a11929dfc96f1123758d46e25 100644 (file)
@@ -103,7 +103,8 @@ enum snd_ff_clock_src {
 };
 
 struct snd_ff_protocol {
-       void (*handle_midi_msg)(struct snd_ff *ff, __le32 *buf, size_t length);
+       void (*handle_midi_msg)(struct snd_ff *ff, unsigned int offset,
+                               __le32 *buf, size_t length);
        int (*get_clock)(struct snd_ff *ff, unsigned int *rate,
                         enum snd_ff_clock_src *src);
        int (*switch_fetching_mode)(struct snd_ff *ff, bool enable);