Changeset 1355

Show
Ignore:
Timestamp:
09/30/08 19:59:38 (12 years ago)
Author:
jwoithe
Message:

MOTU: centralise event/frame size calculations to getEventSize(). Needed because some interfaces (eg: the Ultralite) don't seem to use DBS CIP header field in a consistent way.
MOTU: Add a "pad" port flag to indicate padding in a packet. Needed to support the Ultralite cleanly.
MOTU: Tweaks to the Ultralite configuration information.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libffado-2.0/src/libstreaming/motu/MotuReceiveStreamProcessor.cpp

    r1344 r1355  
    142142        unsigned int fdf_size = get_bits(CondSwapFromBus32(quadlet[1]), 23, 8) == 0x22 ? 32:0; // Event unit size in bits 
    143143 
    144         // Don't even attempt to process a packet if it isn't what 
    145         // we expect from a MOTU.  Yes, an FDF value of 32 bears 
    146         // little relationship to the actual data (24 bit integer) 
    147         // sent by the MOTU - it's one of those areas where MOTU 
    148         // have taken a curious detour around the standards. 
    149         if (tag!=1 || fdf_size!=32) { 
     144        // Don't even attempt to process a packet if it isn't what we expect 
     145        // from a MOTU.  Yes, an FDF value of 32 bears little relationship 
     146        // to the actual data (24 bit integer) sent by the MOTU - it's one 
     147        // of those areas where MOTU have taken a curious detour around the 
     148        // standards.  Do this check early on because for invalid packets 
     149        // dbs may not be what we expect, potentially causing issues later 
     150        // on. 
     151        if (tag!=1 || fdf_size!=32 || dbs==0) { 
    150152            return eCRV_Invalid; 
    151153        } 
    152154 
    153         // put this after the check because event_length can become 0 on invalid packets 
    154         unsigned int event_length = (fdf_size * dbs) / 8;       // Event size in bytes 
    155         unsigned int n_events = (length-8) / event_length; 
     155        // m_event_size is the event size in bytes 
     156        unsigned int n_events = (length-8) / m_event_size; 
    156157 
    157158        // Acquire the timestamp of the last frame in the packet just 
    158159        // received.  Since every frame from the MOTU has its own timestamp 
    159160        // we can just pick it straight from the packet. 
    160         uint32_t last_sph = CondSwapFromBus32(*(quadlet_t *)(data+8+(n_events-1)*event_length)); 
     161        uint32_t last_sph = CondSwapFromBus32(*(quadlet_t *)(data+8+(n_events-1)*m_event_size)); 
    161162        m_last_timestamp = sphRecvToFullTicks(last_sph, m_Parent.get1394Service().getCycleTimer()); 
    162163 
     
    180181enum StreamProcessor::eChildReturnValue 
    181182MotuReceiveStreamProcessor::processPacketData(unsigned char *data, unsigned int length) { 
    182     quadlet_t* quadlet = (quadlet_t*) data; 
    183  
    184     unsigned int dbs = get_bits(CondSwapFromBus32(quadlet[0]), 23, 8);  // Size of one event in terms of fdf_size 
    185     unsigned int fdf_size = get_bits(CondSwapFromBus32(quadlet[1]), 23, 8) == 0x22 ? 32:0; // Event unit size in bits 
    186     // this is only called for packets that return eCRV_OK on processPacketHeader 
    187     // so event_length won't become 0 
    188     unsigned int event_length = (fdf_size * dbs) / 8;       // Event size in bytes 
    189     unsigned int n_events = (length-8) / event_length; 
     183    // m_event_size should never be zero 
     184    unsigned int n_events = (length-8) / m_event_size; 
    190185 
    191186    // we have to keep in mind that there are also 
  • branches/libffado-2.0/src/libstreaming/motu/MotuTransmitStreamProcessor.cpp

    r1344 r1355  
    440440{ 
    441441    quadlet_t *quadlet = (quadlet_t *)data; 
    442     // Size of a single data frame in quadlets 
     442    // Size of a single data frame in quadlets.  For data sent by the 
     443    // Ultralite this is not strictly true (with m_event_size 52, dbs is set 
     444    // to 19).  Even so, we'll run with the assumption that a different dbs 
     445    // will be fine unless proven otherwise. 
    443446    unsigned dbs = m_event_size / 4; 
    444447 
     
    463466{ 
    464467    quadlet_t *quadlet = (quadlet_t *)data; 
    465     // Size of a single data frame in quadlets 
     468    // Size of a single data frame in quadlets.  See comment in 
     469    // fillDataPacketHeader() regarding the Ultralite. 
    466470    unsigned dbs = m_event_size / 4; 
    467471    // construct the packet CIP-like header.  Even if this is a data-less 
  • branches/libffado-2.0/src/motu/motu_avdevice.cpp

    r1323 r1355  
    193193const PortEntry Ports_ULTRALITE[] = 
    194194{ 
    195     {"Main-L", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 40}, 
    196     {"Main-R", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 43}, 
     195    {"Main-L", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 46}, 
     196    {"Main-R", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 49}, 
     197    {"Padding1", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY|MOTU_PA_PADDING, 46}, 
     198    {"Padding2", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY|MOTU_PA_PADDING, 49}, 
    197199    {"Mix-L", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, 
    198200    {"Mix-R", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, 
     
    209211    {"Phones-L", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, 
    210212    {"Phones-R", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, 
    211     {"SPDIF1", MOTU_DIR_INOUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 46}, 
    212     {"SPDIF2", MOTU_DIR_INOUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 49}, 
     213    {"SPDIF1", MOTU_DIR_INOUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 40}, 
     214    {"SPDIF2", MOTU_DIR_INOUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 43}, 
    213215}; 
    214216 
     
    15171519        flags |= MOTU_PA_RATE_1x; 
    15181520 
     1521    // Don't test for padding port flag here since we need to include such 
     1522    // pseudo-ports when calculating the event size. 
    15191523    for (i=0; i < DevicesProperty[m_motu_model-1].n_port_entries; i++) { 
    15201524        if (( DevicesProperty[m_motu_model-1].port_entry[i].port_dir & dir ) && 
     
    15911595        if (( DevicesProperty[m_motu_model-1].port_entry[i].port_dir & dir ) && 
    15921596           ( DevicesProperty[m_motu_model-1].port_entry[i].port_flags & MOTU_PA_RATE_MASK & flags ) && 
    1593            ( DevicesProperty[m_motu_model-1].port_entry[i].port_flags & MOTU_PA_OPTICAL_MASK & flags )) { 
     1597           ( DevicesProperty[m_motu_model-1].port_entry[i].port_flags & MOTU_PA_OPTICAL_MASK & flags ) && 
     1598           !( DevicesProperty[m_motu_model-1].port_entry[i].port_flags & MOTU_PA_PADDING )) { 
    15941599            asprintf(&buff,"%s_%s_%s" , id.c_str(), mode_str, 
    15951600              DevicesProperty[m_motu_model-1].port_entry[i].port_name); 
  • branches/libffado-2.0/src/motu/motu_avdevice.h

    r1322 r1355  
    102102#define MOTU_PA_OPTICAL_ANY      (MOTU_PA_OPTICAL_OFF|MOTU_PA_OPTICAL_ON) 
    103103#define MOTU_PA_OPTICAL_MASK     MOTU_PA_OPTICAL_ANY 
     104#define MOTU_PA_PADDING          0x0100 
    104105 
    105106class ConfigRom;