linux/sound/firewire/fireface
Takashi Sakamoto 73f5537fb2 ALSA: fireface: support tx MIDI functionality of Fireface UCX
Fireface UCX transfers asynchronous transactions for MIDI messages.
One transaction includes quadlet data therefore it can transfer 3
message bytes as maximum. Base address of the destination is
configured by two settings; a register for higher 8 byte of the
address, and a bitflag to option register indicates lower 8byte.

The register for higher address is 0x'ffff'0000'0034. Unfortunately,
firmware v24 includes a bug to ignore registered value for the
destination address and transfers to 0x0001xxxxxxxx always. This
driver doesn't work well if the bug exists, therefore users should
install the latest firmware (v27).

The bitflag is a part of value to be written to option register
(0x'ffff'0000'0014).

lower addr:  bitflag (little endian)
 '0000'0000: 0x00002000
 '0000'0080: 0x00004000
 '0000'0100: 0x00008000
 '0000'0180: 0x00010000

This register includes more options but they are not relevant to
packet streaming or MIDI functionality. This driver don't touch it.

Furthermore, the transaction is sent to address offset incremented
by 4 byte to the offset in previous time. When it reaches base address
plus 0x7c, next offset is the base address.

Content of the transaction includes a prefix byte. Upper 4 bits of
the byte indicates port number, and the rest 4 bits indicate the way
to decode rest of bytes for MIDI message.

Except for system exclusive messages, the rest bits are the same as
status bits of the message without channel bits. For system exclusive
messages, the rest bits are encoded according to included message bytes.
For example:

message: f0 7e 7f 09 01 f7
offset: content (little endian, port 0)
 '0000: 0x04f07e7f
 '0004: 0x070901f7

message: f0 00 00 66 14 20 00 00 00 f7
offset: content (little endian, port 1)
 '0014: 0x14f00000
 '0018: 0x14661420
 '001c: 0x14000000
 '0020: 0x15f70000

message: f0 00 00 66 14 20 00 00 f7
offset: content (little endian, port 0)
 '0078: 0x04f00000
 '007c: 0x04661420
 '0000: 0x070000f7

This commit supports decoding scheme for the above and allows
applications to receive MIDI messages via ALSA rawmidi interface.
The lower 8 bytes of destination address is fixed to 0x'0000'0000,
thus this driver expects userspace applications to configure option
register with bitflag 0x00002000 in advance.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-22 17:20:51 +01:00
..
amdtp-ff.c locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE() 2017-10-25 11:01:08 +02:00
ff-hwdep.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
ff-midi.c locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE() 2017-10-25 11:01:08 +02:00
ff-pcm.c ALSA: fireface: add protocol-dependent operation to get clock status 2019-01-21 15:12:20 +01:00
ff-proc.c ALSA: fireface: code refactoring to parse of clock configuration 2019-01-21 15:12:23 +01:00
ff-protocol-former.c ALSA: fireface: change prototype of handler for async transaction with MIDI messages 2019-01-22 17:20:49 +01:00
ff-protocol-latter.c ALSA: fireface: support tx MIDI functionality of Fireface UCX 2019-01-22 17:20:51 +01:00
ff-stream.c ALSA: fireface: add protocol-dependent operation to get clock status 2019-01-21 15:12:20 +01:00
ff-transaction.c ALSA: fireface: add model-dependent parameter for address range to receive async transaction 2019-01-22 17:20:50 +01:00
ff.c ALSA: fireface: support tx MIDI functionality of Fireface UCX 2019-01-22 17:20:51 +01:00
ff.h ALSA: fireface: add model-dependent parameter for address range to receive async transaction 2019-01-22 17:20:50 +01:00
Makefile ALSA: fireface: add support for Fireface UCX 2019-01-21 15:12:25 +01:00