From: <tr...@ff...> - 2012-03-15 03:34:19
|
Author: jwoithe Date: 2012-03-14 20:33:59 -0700 (Wed, 14 Mar 2012) New Revision: 2083 Modified: trunk/libffado/src/libstreaming/motu/MotuReceiveStreamProcessor.cpp trunk/libffado/src/libstreaming/motu/MotuReceiveStreamProcessor.h trunk/libffado/src/motu/motu_avdevice.cpp Log: motu: adjustments to 828mk1 packet layout. When parsing received packets make allowances for the lack of control events in the data stream. Compile-tested only. Modified: trunk/libffado/src/libstreaming/motu/MotuReceiveStreamProcessor.cpp =================================================================== --- trunk/libffado/src/libstreaming/motu/MotuReceiveStreamProcessor.cpp 2012-03-13 09:17:31 UTC (rev 2082) +++ trunk/libffado/src/libstreaming/motu/MotuReceiveStreamProcessor.cpp 2012-03-15 03:33:59 UTC (rev 2083) @@ -36,6 +36,8 @@ #include "libutil/ByteSwap.h" +#include "../../motu/motu_avdevice.h" + #include <cstring> #include <math.h> #include <assert.h> @@ -85,6 +87,11 @@ , mb_head ( 0 ) , mb_tail ( 0 ) { + // The model needs to be easily visible since the interpretation of the + // receive stream is dependent on the model in a slight but important + // way. + Motu::MotuDevice *dev = static_cast<Motu::MotuDevice *>(&parent); + m_motu_model = dev->m_motu_model; memset(&m_devctrls, 0, sizeof(m_devctrls)); } @@ -253,8 +260,12 @@ { bool no_problem=true; - /* Scan incoming block for device control events */ - decodeMotuCtrlEvents(data, nevents); + /* Scan incoming block for device control events. These do not seem to + * be present on the 828Mk1 (or at the very least are in a different + * location). + */ + if (m_motu_model != Motu::MOTU_MODEL_828MkI) + decodeMotuCtrlEvents(data, nevents); for ( PortVectorIterator it = m_Ports.begin(); it != m_Ports.end(); Modified: trunk/libffado/src/libstreaming/motu/MotuReceiveStreamProcessor.h =================================================================== --- trunk/libffado/src/libstreaming/motu/MotuReceiveStreamProcessor.h 2012-03-13 09:17:31 UTC (rev 2082) +++ trunk/libffado/src/libstreaming/motu/MotuReceiveStreamProcessor.h 2012-03-15 03:33:59 UTC (rev 2083) @@ -171,6 +171,7 @@ */ unsigned int m_event_size; + signed int m_motu_model; struct MotuDevControls m_devctrls; /* A small MIDI buffer to cover for the case where we need to span a Modified: trunk/libffado/src/motu/motu_avdevice.cpp =================================================================== --- trunk/libffado/src/motu/motu_avdevice.cpp 2012-03-13 09:17:31 UTC (rev 2082) +++ trunk/libffado/src/motu/motu_avdevice.cpp 2012-03-15 03:33:59 UTC (rev 2083) @@ -85,24 +85,24 @@ // Ports declarations const PortEntry Ports_828MKI[] = { - {"Analog1", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, - {"Analog2", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, - {"Analog3", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 16}, - {"Analog4", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 19}, - {"Analog5", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 22}, - {"Analog6", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 25}, - {"Analog7", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 28}, - {"Analog8", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 31}, - {"SPDIF1", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 34}, - {"SPDIF2", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 37}, - {"ADAT1", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 40}, - {"ADAT2", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 43}, - {"ADAT3", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 46}, - {"ADAT4", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 49}, - {"ADAT5", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 52}, - {"ADAT6", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 55}, - {"ADAT7", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 58}, - {"ADAT8", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 61}, + {"Analog1", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 4}, + {"Analog2", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 7}, + {"Analog3", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, + {"Analog4", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, + {"Analog5", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 16}, + {"Analog6", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 19}, + {"Analog7", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 22}, + {"Analog8", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 25}, + {"SPDIF1", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 28}, + {"SPDIF2", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 31}, + {"ADAT1", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 34}, + {"ADAT2", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 37}, + {"ADAT3", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 40}, + {"ADAT4", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 43}, + {"ADAT5", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 46}, + {"ADAT6", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 49}, + {"ADAT7", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 52}, + {"ADAT8", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 55}, }; const PortEntry Ports_896HD[] = @@ -2107,9 +2107,12 @@ unsigned int flags = 0; unsigned int port_flags; - // At the very least an event consists of the SPH (4 bytes) and the control/MIDI - // bytes (6 bytes). - size = 4+6; + // At the very least an event consists of the SPH (4 bytes). On all + // interfaces except the 828Mk1 there are also 6 bytes of control/MIDI + // data at the start. + size = 4; + if (m_motu_model != MOTU_MODEL_828MkI) + size += 6; getOpticalMode(direction, &optical_mode_a, &optical_mode_b); if ( sample_rate > 96000 ) @@ -2159,6 +2162,12 @@ size = m_tx_event_size; #endif + // The 828Mk1 includes an additional 6 bytes at the end of the packet. + // The purpose of these is unknown at this stage, but we need to allow + // for them in the event size calculation. + if (m_motu_model == MOTU_MODEL_828MkI) + size += 6; + // Finally round size up to the next quadlet boundary return ((size+3)/4)*4; } |