summaryrefslogtreecommitdiff
path: root/sound/firewire/motu/motu.h
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2017-03-22 15:30:23 +0300
committerTakashi Iwai <tiwai@suse.de>2017-03-28 13:33:56 +0300
commit9e796e7d59e71f8a556cfbdc2ffa3aff0555dd0e (patch)
tree2248865f8f2695690589c5792cda0092f0afc1e8 /sound/firewire/motu/motu.h
parentdd49b2d1f04af9b1f44e9fe82c85f374f662c61b (diff)
downloadlinux-9e796e7d59e71f8a556cfbdc2ffa3aff0555dd0e.tar.xz
ALSA: firewire-motu: add MIDI functionality
In MOTU FireWire series, MIDI messages are multiplexed to isochronous packets as well as PCM frames, while the way is different from the one in IEC 61883-6. MIDI messages are put into a certain position in message chunks. One data block can includes one byte of the MIDI messages. When data block includes a MIDI byte, the block has a flag in a certain position of the message chunk. These positions are unique depending on protocols. Once a data block includes a MIDI byte, some following data blocks includes no MIDI bytes. Next MIDI byte appears on a data block corresponding to next cycle of physical MIDI bus. This seems to avoid buffer overflow caused by bandwidth differences between IEEE 1394 bus and physical MIDI bus. This commit adds MIDI functionality to transfer/receive MIDI messages. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/motu/motu.h')
-rw-r--r--sound/firewire/motu/motu.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/sound/firewire/motu/motu.h b/sound/firewire/motu/motu.h
index afc6de654daa..338b35193001 100644
--- a/sound/firewire/motu/motu.h
+++ b/sound/firewire/motu/motu.h
@@ -21,12 +21,15 @@
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/info.h>
+#include <sound/rawmidi.h>
#include "../lib.h"
#include "../amdtp-stream.h"
#include "../iso-resources.h"
struct snd_motu_packet_format {
+ unsigned char midi_flag_offset;
+ unsigned char midi_byte_offset;
unsigned char pcm_byte_offset;
unsigned char msg_chunks;
@@ -38,6 +41,7 @@ struct snd_motu {
struct snd_card *card;
struct fw_unit *unit;
struct mutex mutex;
+ spinlock_t lock;
bool registered;
struct delayed_work dwork;
@@ -113,9 +117,12 @@ int amdtp_motu_init(struct amdtp_stream *s, struct fw_unit *unit,
enum amdtp_stream_direction dir,
const struct snd_motu_protocol *const protocol);
int amdtp_motu_set_parameters(struct amdtp_stream *s, unsigned int rate,
+ unsigned int midi_ports,
struct snd_motu_packet_format *formats);
int amdtp_motu_add_pcm_hw_constraints(struct amdtp_stream *s,
struct snd_pcm_runtime *runtime);
+void amdtp_motu_midi_trigger(struct amdtp_stream *s, unsigned int port,
+ struct snd_rawmidi_substream *midi);
int snd_motu_transaction_read(struct snd_motu *motu, u32 offset, __be32 *reg,
size_t size);
@@ -133,4 +140,6 @@ void snd_motu_stream_stop_duplex(struct snd_motu *motu);
void snd_motu_proc_init(struct snd_motu *motu);
int snd_motu_create_pcm_devices(struct snd_motu *motu);
+
+int snd_motu_create_midi_devices(struct snd_motu *motu);
#endif