bebob: Add comment for bus reset

I found a fact that M-Audio Firewire 1814 can certainly respond to
request command once generating bus reset.

Currently there is a exported kernel API to do this but there is no
header for the other subsystem.
firewire-lib: Add support for deferred transaction

Some devices based on BeBoB use this type of transaction.

'Deferred Transaction' is defined in 'AV/C Digital Interface Command Set
General Specification' and is used by targets to make a response deferred
during processing it.

If a target may not be able to complete a command within 100msec since
receiving the command, then the target shall return INTERIM response,
to which final response will follow later. CONTROL/NOTIFY commands are
allowed for deferred transaction.

There is an issue. In the specification, the interval between INTERIM
response and final response is 'Unspecified interval'. The specification
depends on each subunit specification for this interval.

But we promise to finish this function for caller. In this reason, I use
FCP_TIMEOUT_MS for this interval. Currently it's 125msec.
firewire-lib: improvement for return value of AV/C commands

With previous commit, firewire-lib can handle deferred transaction
correctly. This means caller don't need to judge response code and
firewire-lib replace the codes to Linux's error codes.
bebob: improvement for command processing

With previous commit, firewire-lib can returns error codes instead of
response codes. The caller can just check return value as Linux's error
code.

And, with post commit, firewire-lib can handle command without response.
M-Audio Firewire 1814 and ProjectMix I/O are known as a device which use
this type of transaction (so rude). bebob_maudio.c has some codes for
this transaction but the codes are obsoleted.

Additionally, with post commit, firewire-lib can handle deferred
transaction. M-Audio Firewire 410 is known as a device which uses this
type of transaction. bebob_command.c has some codes for this transaction
but the codes can be obsoleted. But this device has a quirk to send a
wrong value for fdf field in AV/C Plug Signal Format command in its
beginning of startup and just after break connections.
oxfw: optimization for command processing

With previous commit, firewire-lib can returns error codes instead of
response codes. The caller can just check return value as Linux's error
code.
firewire-lib: remove sort processing

I need more time to gather information to persist my reasoning but currently
I don't have...

[alsa-devel] [PATCH 09/39] firewire-lib: Add sort function for transmitted packet
http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/074157.html
firewire-lib: Add checking continuity of data block counter

In IEC 61883-1, the value of dbc refers to the first data block following
a CIP header in current bus packet and a first packet a sequence number with
value zero.
In IEC 61883-6, data block count is running count of transmitted data blocks.

According to these specifications, this commit add codes to check continuity
of data blocks. When detecting discontinuity, streaming is stopped.

I note that discontinuity means there are some packets lost in theory. But
there may be devices which don't report continuous value for dbc field.
firewire-lib/fireworks: Add a quirk for empty packet with TAG0

Fireworks has a quirk to tranmit empty packets with TAG0. This commit
is to avoid side effect for the other devices.
firewire-lib/fireworks: Add a quirk for the meaning of dbc

Fireworks has a quirk for the value of dbc field in transmitted packets.
For Fireworks, dbc means the end of events in current packet. This is out
of specification.

For example, AudioFire4:
CIP0	CIP1	Payload
01070092 90FFFFFF 02
0107009A 9001E17B 3A
010700A2 9001F6E5 3A
010700A2 90FFFFFF 02
010700AA 9001104F 3A
010700B2 900125B9 3A
010700BA 90013B23 3A
010700BA 90FFFFFF 02
010700C2 9001548E 3A
010700CA 900169F8 3A
010700CA 90FFFFFF 02
010700D2 90018362 3A
010700DA 900198CC 3A

According to IEC 61883-6, a packet following to empty packet has the same
value for its dbc. But for Fireworks, it's incremented and empty packet has
the same value for its dbc as previous packet.

This commit adds a flag for Fireworks and some codes to checking dbc continuity.
firewire-lib/fireworks: Add a quirk for wrong dbs in tx packets

One of Fireworks firmware, named  as 'AudioFire9', seems to transmit
packets with wrong value of dbs. It's always 0x11 but actual size of
data block is different.

This commit adds a flag for this quirk and some codes to calculate
correct size.
firewire-lib/fireworks: Add a quirk for fixed interval of reported dbc

Fireworks firmware version 5.5 reports fix interval for dbc in each packet.

For example, AudioFire4:
CIP0	CIP1	Payload
00070000 900484FF 72
00070008 9004A8FF 72
00070008 90FFFFFF 02
00070010 9004D0FF 72
00070018 9004C4FF 72
00070020 9004E8FF 72
00070020 90FFFFFF 02
00070028 900410FE 72

The interval of each dbc should be 16 except for empty packet but it's not.

This commit adds a flag for this quirk and codes to refer to a fixed value.
firewire-lib/fireworks: rename a quirk of rx packets for MIDI

Fireworks has a quirk to ignore MIDI messages in data blocks more than 8.
This commit rename an existed flag to keep naming rule.
bebob: Add a workaround for changing sampling rate in M-Audio Firewire 1814

This device has a quirk. Just after command AV/C Plug Signal command for
output, AV/C Plug Signal command for input causes timeout or badly confict
error.

This workaround adds wait for 100 msec just after the former command. As
long as I know, the device finish requested operation and successfully
handle the latter command.
bebob: break connections when encountering discontinuity of CIP

With previous commits, there are two ways to generate streaming errors.
One is packet queueing error and another is dicontinuity of CIP.
The latter needs to restart streams including breaking connections.
Without re-establishing connections, when applications receive XRUN
caused by discontinuity of CIP and restart streams by snd_pcm_prepare()
call, the stream is not stopped and discontinuity will continue.