Changeset 509 for branches

Show
Ignore:
Timestamp:
07/29/07 11:02:25 (17 years ago)
Author:
ppalmers
Message:

- Moved all generic stuff but the functionblocks over to libavc
- compiles and works

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/echoaudio/src/bebob/bebob_avdevice.cpp

    r507 r509  
    7575                    int nodeId ) 
    7676    : FFADODevice( configRom, ieee1394service, nodeId ) 
    77     , AVC::Unit( configRom, ieee1394service, nodeId
     77    , AVC::Unit(
    7878    , m_model ( NULL ) 
    7979    , m_Mixer ( NULL ) 
     
    9292        delete m_Mixer; 
    9393    } 
    94  
    95     for ( SubunitVector::iterator it = m_subunits.begin(); 
    96           it != m_subunits.end(); 
    97           ++it ) 
    98     { 
    99         delete *it; 
    100     } 
    101     for ( PlugConnectionVector::iterator it = m_plugConnections.begin(); 
    102           it != m_plugConnections.end(); 
    103           ++it ) 
    104     { 
    105         delete *it; 
    106     } 
    107     for ( PlugVector::iterator it = m_pcrPlugs.begin(); 
    108           it != m_pcrPlugs.end(); 
    109           ++it ) 
    110     { 
    111         delete *it; 
    112     } 
    113     for ( PlugVector::iterator it = m_externalPlugs.begin(); 
    114           it != m_externalPlugs.end(); 
    115           ++it ) 
    116     { 
    117         delete *it; 
    118     } 
    11994} 
    12095 
     
    125100 
    126101    FFADODevice::setVerboseLevel(l); 
     102    AVC::Unit::setVerboseLevel(l); 
    127103} 
    128104 
     
    143119        } 
    144120    } 
    145  
    146121    return false; 
    147122} 
     
    191166//     } 
    192167 
     168    // bebob specific discovery procedure 
    193169    if ( !discoverPlugs() ) { 
    194170        debugError( "Detecting plugs failed\n" ); 
     
    234210 
    235211bool 
     212AvDevice::enumerateSubUnits() 
     213{ 
     214    SubUnitInfoCmd subUnitInfoCmd( get1394Service() ); 
     215    subUnitInfoCmd.setCommandType( AVCCommand::eCT_Status ); 
     216 
     217    // NOTE: BeBoB has always exactly one audio and one music subunit. This 
     218    // means is fits into the first page of the SubUnitInfo command. 
     219    // So there is no need to do more than needed 
     220 
     221    subUnitInfoCmd.m_page = 0; 
     222    subUnitInfoCmd.setNodeId( getConfigRom().getNodeId() ); 
     223    subUnitInfoCmd.setVerbose( getDebugLevel() ); 
     224    if ( !subUnitInfoCmd.fire() ) { 
     225        debugError( "Subunit info command failed\n" ); 
     226        // shouldn't this be an error situation? 
     227        return false; 
     228    } 
     229 
     230    for ( int i = 0; i < subUnitInfoCmd.getNrOfValidEntries(); ++i ) { 
     231        subunit_type_t subunit_type 
     232            = subUnitInfoCmd.m_table[i].m_subunit_type; 
     233 
     234        unsigned int subunitId = getNrOfSubunits( subunit_type ); 
     235 
     236        debugOutput( DEBUG_LEVEL_VERBOSE, 
     237                     "subunit_id = %2d, subunit_type = %2d (%s)\n", 
     238                     subunitId, 
     239                     subunit_type, 
     240                     subunitTypeToString( subunit_type ) ); 
     241 
     242        AVC::Subunit* subunit = 0; 
     243        switch( subunit_type ) { 
     244        case eST_Audio: 
     245            subunit = new BeBoB::SubunitAudio( *this, 
     246                                               subunitId ); 
     247            if ( !subunit ) { 
     248                debugFatal( "Could not allocate SubunitAudio\n" ); 
     249                return false; 
     250            } 
     251             
     252            if ( !subunit->discover() ) { 
     253                debugError( "enumerateSubUnits: Could not discover " 
     254                            "subunit_id = %2d, subunit_type = %2d (%s)\n", 
     255                            subunitId, 
     256                            subunit_type, 
     257                            subunitTypeToString( subunit_type ) ); 
     258                delete subunit; 
     259                return false; 
     260            } else { 
     261                m_subunits.push_back( subunit ); 
     262            } 
     263             
     264            break; 
     265        case eST_Music: 
     266            subunit = new BeBoB::SubunitMusic( *this, 
     267                                               subunitId ); 
     268            if ( !subunit ) { 
     269                debugFatal( "Could not allocate SubunitMusic\n" ); 
     270                return false; 
     271            } 
     272            if ( !subunit->discover() ) { 
     273                debugError( "enumerateSubUnits: Could not discover " 
     274                            "subunit_id = %2d, subunit_type = %2d (%s)\n", 
     275                            subunitId, 
     276                            subunit_type, 
     277                            subunitTypeToString( subunit_type ) ); 
     278                delete subunit; 
     279                return false; 
     280            } else { 
     281                m_subunits.push_back( subunit ); 
     282            } 
     283 
     284            break; 
     285        default: 
     286            debugOutput( DEBUG_LEVEL_NORMAL, 
     287                         "Unsupported subunit found, subunit_type = %d (%s)\n", 
     288                         subunit_type, 
     289                         subunitTypeToString( subunit_type ) ); 
     290            continue; 
     291 
     292        } 
     293    } 
     294 
     295    return true; 
     296} 
     297 
     298bool 
    236299AvDevice::discoverPlugs() 
    237300{ 
     301    debugOutput( DEBUG_LEVEL_NORMAL, "Discovering plugs...\n"); 
     302 
    238303    ////////////////////////////////////////////// 
    239304    // Get number of available isochronous input 
     
    294359                            plug_id_t plugMaxId ) 
    295360{ 
     361    debugOutput( DEBUG_LEVEL_NORMAL, "Discovering PCR plugs, direction %d...\n",plugDirection); 
    296362    for ( int plugId = 0; 
    297363          plugId < plugMaxId; 
     
    323389                                 plug_id_t plugMaxId ) 
    324390{ 
     391    debugOutput( DEBUG_LEVEL_NORMAL, "Discovering Externals plugs, direction %d...\n",plugDirection); 
    325392    for ( int plugId = 0; 
    326393          plugId < plugMaxId; 
     
    353420          ++it ) 
    354421    { 
    355         AVC::Plug* plug = *it; 
     422        BeBoB::Plug* plug = dynamic_cast<BeBoB::Plug*>(*it); 
     423        if(!plug) { 
     424            debugError("BUG: not a bebob plug\n"); 
     425            return false; 
     426        } 
    356427        if ( !plug->discoverConnections() ) { 
    357428            debugError( "Could not discover plug connections\n" ); 
     
    363434          ++it ) 
    364435    { 
    365         AVC::Plug* plug = *it; 
     436        BeBoB::Plug* plug = dynamic_cast<BeBoB::Plug*>(*it); 
     437        if(!plug) { 
     438            debugError("BUG: not a bebob plug\n"); 
     439            return false; 
     440        } 
    366441        if ( !plug->discoverConnections() ) { 
    367442            debugError( "Could not discover plug connections\n" ); 
     
    376451AvDevice::discoverSubUnitsPlugConnections() 
    377452{ 
    378 //     for ( SubunitVector::iterator it = m_subunits.begin(); 
    379 //           it != m_subunits.end(); 
    380 //           ++it ) 
    381 //     { 
    382 //         Subunit* subunit = *it; 
    383 //         if ( !subunit->discoverConnections() ) { 
    384 //             debugError( "Subunit '%s'  plug connections failed\n", 
    385 //                         subunit->getName() ); 
    386 //             return false; 
    387 //         } 
    388 //     } 
     453    for ( SubunitVector::iterator it = m_subunits.begin(); 
     454          it != m_subunits.end(); 
     455          ++it ) 
     456    { 
     457        BeBoB::Subunit* subunit = dynamic_cast<BeBoB::Subunit*>(*it); 
     458        if (subunit==NULL) { 
     459            debugError("BUG: subunit is not a BeBoB::Subunit\n"); 
     460            return false; 
     461        } 
     462 
     463        if ( !subunit->discoverConnections() ) { 
     464            debugError( "Subunit '%s'  plug connections failed\n", 
     465                        subunit->getName() ); 
     466            return false; 
     467        } 
     468    } 
    389469    return true; 
    390470} 
     
    738818 
    739819    m_pPlugManager->showPlugs(); 
     820    flushDebugOutput(); 
    740821} 
    741822 
  • branches/echoaudio/src/bebob/bebob_avdevice.h

    r507 r509  
    9797    // redefinition to resolve ambiguity 
    9898    Ieee1394Service& get1394Service() 
    99         { return *m_p1394Service; } 
     99        { return FFADODevice::get1394Service(); }; 
    100100    ConfigRom& getConfigRom() const  
    101         {return FFADODevice::getConfigRom();}; 
    102          
     101        { return FFADODevice::getConfigRom(); }; 
     102 
    103103protected: 
     104 
     105    bool enumerateSubUnits(); 
    104106 
    105107    bool discoverPlugs(); 
  • branches/echoaudio/src/bebob/bebob_avdevice_subunit.cpp

    r507 r509  
    3636using namespace AVC; 
    3737 
     38IMPL_DEBUG_MODULE( BeBoB::Subunit, BeBoB::Subunit, DEBUG_LEVEL_VERBOSE ); 
     39IMPL_DEBUG_MODULE( BeBoB::SubunitAudio, BeBoB::SubunitAudio, DEBUG_LEVEL_VERBOSE ); 
     40IMPL_DEBUG_MODULE( BeBoB::SubunitMusic, BeBoB::SubunitMusic, DEBUG_LEVEL_VERBOSE ); 
     41 
     42bool 
     43BeBoB::Subunit::discover() 
     44{ 
     45    if ( !discoverPlugs() ) { 
     46        debugError( "plug discovering failed\n" ); 
     47        return false; 
     48    } 
     49 
     50    return true; 
     51} 
     52 
     53bool 
     54BeBoB::Subunit::discoverPlugs() 
     55{ 
     56    PlugInfoCmd plugInfoCmd( getUnit().get1394Service(), 
     57                             PlugInfoCmd::eSF_SerialBusIsochronousAndExternalPlug ); 
     58    plugInfoCmd.setNodeId( getUnit().getConfigRom().getNodeId() ); 
     59    plugInfoCmd.setCommandType( AVCCommand::eCT_Status ); 
     60    plugInfoCmd.setSubunitType( getSubunitType() ); 
     61    plugInfoCmd.setSubunitId( getSubunitId() ); 
     62    plugInfoCmd.setVerbose( getDebugLevel() ); 
     63 
     64    if ( !plugInfoCmd.fire() ) { 
     65        debugError( "plug info command failed\n" ); 
     66        return false; 
     67    } 
     68 
     69    debugOutput( DEBUG_LEVEL_NORMAL, "number of source plugs = %d\n", 
     70                 plugInfoCmd.m_sourcePlugs ); 
     71    debugOutput( DEBUG_LEVEL_NORMAL, "number of destination output " 
     72                 "plugs = %d\n", plugInfoCmd.m_destinationPlugs ); 
     73 
     74    if ( !discoverPlugs( Plug::eAPD_Input, 
     75                         plugInfoCmd.m_destinationPlugs ) ) 
     76    { 
     77        debugError( "destination plug discovering failed\n" ); 
     78        return false; 
     79    } 
     80 
     81    if ( !discoverPlugs(  Plug::eAPD_Output, 
     82                          plugInfoCmd.m_sourcePlugs ) ) 
     83    { 
     84        debugError( "source plug discovering failed\n" ); 
     85        return false; 
     86    } 
     87 
     88    return true; 
     89} 
     90 
     91bool 
     92BeBoB::Subunit::discoverConnections() 
     93{ 
     94    debugOutput(DEBUG_LEVEL_NORMAL, "Discovering connections...\n"); 
     95     
     96    for ( PlugVector::iterator it = getPlugs().begin(); 
     97          it != getPlugs().end(); 
     98          ++it ) 
     99    { 
     100        BeBoB::Plug* plug = dynamic_cast<BeBoB::Plug*>(*it); 
     101        if(!plug) { 
     102            debugError("BUG: not a bebob plug\n"); 
     103            return false; 
     104        } 
     105        if ( !plug->discoverConnections() ) { 
     106            debugError( "plug connection discovering failed ('%s')\n", 
     107                        plug->getName() ); 
     108            return false; 
     109        } 
     110    } 
     111 
     112    return true; 
     113} 
     114 
     115bool 
     116BeBoB::Subunit::discoverPlugs(Plug::EPlugDirection plugDirection, 
     117                                      plug_id_t plugMaxId ) 
     118{ 
     119    debugOutput(DEBUG_LEVEL_NORMAL, "Discovering plugs...\n"); 
     120    for ( int plugIdx = 0; 
     121          plugIdx < plugMaxId; 
     122          ++plugIdx ) 
     123    { 
     124        ESubunitType subunitType = 
     125            static_cast<ESubunitType>( getSubunitType() ); 
     126        BeBoB::Plug* plug = new BeBoB::Plug( &getUnit(), 
     127                                             &getSubunit(), 
     128                                             0xff, 
     129                                             0xff, 
     130                                             Plug::eAPA_SubunitPlug, 
     131                                             plugDirection, 
     132                                             plugIdx ); 
     133        if ( !plug ) { 
     134            debugError( "plug creation failed\n" ); 
     135            return false; 
     136        } 
     137         
     138        plug->setVerboseLevel(getDebugLevel()); 
     139         
     140        if ( !plug->discover() ) { 
     141            debugError( "plug discover failed\n" ); 
     142            return false; 
     143        } 
     144 
     145        debugOutput( DEBUG_LEVEL_NORMAL, "plug '%s' found\n", 
     146                     plug->getName() ); 
     147        getPlugs().push_back( plug ); 
     148    } 
     149    return true; 
     150} 
     151 
     152 
     153////////////////////////// 
    38154 
    39155BeBoB::SubunitAudio::SubunitAudio( AVC::Unit& avDevice, 
    40156                                   subunit_t id ) 
    41157    : AVC::SubunitAudio( avDevice, id ) 
     158    , BeBoB::Subunit() 
    42159{ 
    43160} 
     
    56173BeBoB::SubunitAudio::discover() 
    57174{ 
    58     debugOutput(DEBUG_LEVEL_NORMAL, "Discovering Audio Subunit...\n"); 
     175    debugOutput(DEBUG_LEVEL_NORMAL, "Discovering %s...\n", getName()); 
    59176     
     177    // discover the AV/C generic part 
    60178    if ( !AVC::SubunitAudio::discover() ) { 
    61179        return false; 
    62180    } 
    63  
     181     
     182    // do BeBoB subunit specific discovery 
     183    if ( !BeBoB::Subunit::discover() ) { 
     184        return false; 
     185    } 
     186 
     187    // do the remaining BeBoB audio subunit discovery 
    64188    if ( !discoverFunctionBlocks() ) { 
    65189        debugError( "function block discovering failed\n" ); 
     
    74198{ 
    75199    debugOutput(DEBUG_LEVEL_NORMAL, "Discovering connections...\n"); 
    76     if ( !Subunit::discoverConnections() ) { 
     200    if ( !BeBoB::Subunit::discoverConnections() ) { 
    77201        return false; 
    78202    } 
     
    362486 
    363487BeBoB::SubunitMusic::SubunitMusic( AVC::Unit& avDevice, 
    364                                                    subunit_t id ) 
     488                                   subunit_t id ) 
    365489    : AVC::SubunitMusic( avDevice, id ) 
     490    , BeBoB::Subunit() 
    366491{ 
    367492} 
     
    369494BeBoB::SubunitMusic::SubunitMusic() 
    370495    : AVC::SubunitMusic() 
     496    , BeBoB::Subunit() 
    371497{ 
    372498} 
     
    374500BeBoB::SubunitMusic::~SubunitMusic() 
    375501{ 
     502} 
     503 
     504bool 
     505BeBoB::SubunitMusic::discover() 
     506{ 
     507    debugOutput(DEBUG_LEVEL_NORMAL, "Discovering %s...\n", getName()); 
     508     
     509    // discover the AV/C generic part 
     510    if ( !AVC::SubunitMusic::discover() ) { 
     511        return false; 
     512    } 
     513     
     514    // do BeBoB subunit specific discovery 
     515    if ( !BeBoB::Subunit::discover() ) { 
     516        return false; 
     517    } 
     518 
     519    // do the remaining BeBoB music subunit discovery 
     520    // which is nothing 
     521 
     522    return true; 
    376523} 
    377524 
  • branches/echoaudio/src/bebob/bebob_avdevice_subunit.h

    r508 r509  
    4444///////////////////////////// 
    4545 
    46 class SubunitAudio: public AVC::SubunitAudio { 
    47  public: 
     46class Subunit { 
     47public: 
     48    Subunit() {}; 
     49    virtual ~Subunit() {}; 
     50    virtual bool discover(); 
     51    virtual bool discoverConnections(); 
     52     
     53    // required functions 
     54    // implemented by the derived class 
     55    virtual const char* getName() = 0; 
     56    virtual AVC::subunit_t getSubunitId() = 0; 
     57    virtual AVC::ESubunitType getSubunitType() = 0; 
     58    virtual AVC::Unit& getUnit() const = 0; 
     59    virtual AVC::Subunit& getSubunit() = 0; 
     60    virtual AVC::PlugVector& getPlugs() = 0; 
     61 
     62protected: 
     63    bool discoverPlugs(); 
     64    bool discoverPlugs(Plug::EPlugDirection plugDirection, 
     65                       AVC::plug_id_t plugMaxId ); 
     66private: 
     67    DECLARE_DEBUG_MODULE; 
     68}; 
     69 
     70///////////////////////////// 
     71 
     72class SubunitAudio : public AVC::SubunitAudio 
     73                   , public BeBoB::Subunit 
     74
     75public: 
    4876    SubunitAudio( AVC::Unit& avDevice, 
    49               AVC::subunit_t id ); 
     77                  AVC::subunit_t id ); 
    5078    SubunitAudio(); 
    5179    virtual ~SubunitAudio(); 
     
    5482    virtual bool discoverConnections(); 
    5583 
     84    // required interface for BeBoB::Subunit 
    5685    virtual const char* getName(); 
     86    virtual AVC::subunit_t getSubunitId()  
     87        { return AVC::SubunitAudio::getSubunitId(); }; 
     88    virtual AVC::ESubunitType getSubunitType() 
     89        { return AVC::SubunitAudio::getSubunitType(); }; 
     90    virtual AVC::Unit& getUnit() const 
     91        { return AVC::SubunitAudio::getUnit(); }; 
     92    virtual AVC::Subunit& getSubunit() 
     93        { return *this; }; 
     94    virtual AVC::PlugVector& getPlugs() 
     95        { return AVC::SubunitAudio::getPlugs(); }; 
    5796 
    58     FunctionBlockVector getFunctionBlocks() { return m_functions; }; 
    59      
    6097protected: 
    6198    bool discoverFunctionBlocks(); 
     
    74111                                   Util::IODeserialize& deser, 
    75112                                   AVC::Unit& unit ); 
    76  
    77 protected: 
    78     FunctionBlockVector m_functions; 
     113private: 
     114    DECLARE_DEBUG_MODULE; 
    79115}; 
    80116 
    81117///////////////////////////// 
    82118 
    83 class SubunitMusic: public AVC::SubunitMusic { 
     119class SubunitMusic : public AVC::SubunitMusic 
     120                   , public BeBoB::Subunit 
     121
    84122 public: 
    85123    SubunitMusic( AVC::Unit& avDevice, 
     
    88126    virtual ~SubunitMusic(); 
    89127 
     128    // required interface for BeBoB::Subunit 
    90129    virtual const char* getName(); 
     130    virtual AVC::subunit_t getSubunitId()  
     131        { return AVC::SubunitMusic::getSubunitId(); }; 
     132    virtual AVC::ESubunitType getSubunitType() 
     133        { return AVC::SubunitMusic::getSubunitType(); }; 
     134    virtual AVC::Unit& getUnit() const 
     135        { return AVC::SubunitMusic::getUnit(); }; 
     136    virtual AVC::Subunit& getSubunit() 
     137        { return *this; }; 
     138    virtual AVC::PlugVector& getPlugs() 
     139        { return AVC::SubunitMusic::getPlugs(); }; 
     140 
     141     
     142    virtual bool discover(); 
    91143 
    92144protected: 
     
    96148                                   Util::IODeserialize& deser, 
    97149                                   AVC::Unit& unit ); 
     150private: 
     151    DECLARE_DEBUG_MODULE; 
    98152}; 
    99153 
  • branches/echoaudio/src/bebob/bebob_avplug.cpp

    r507 r509  
    5050                 plugId ) 
    5151{ 
    52  
     52    debugOutput( DEBUG_LEVEL_VERBOSE, 
     53                 "nodeId = %d, subunitType = %d, " 
     54                 "subunitId = %d, functionBlockType = %d, " 
     55                 "functionBlockId = %d, addressType = %d, " 
     56                 "direction = %d, id = %d\n", 
     57                 unit->getConfigRom().getNodeId(), 
     58                 getSubunitType(), 
     59                 getSubunitId(), 
     60                 functionBlockType, 
     61                 functionBlockId, 
     62                 plugAddressType, 
     63                 plugDirection, 
     64                 plugId ); 
    5365} 
    5466 
     
    5668    : AVC::Plug( rhs ) 
    5769{ 
     70 
    5871} 
    5972 
     
    600613 
    601614            if ( formatInfoIsValid ) { 
     615                flushDebugOutput(); 
    602616                debugOutput( DEBUG_LEVEL_VERBOSE, 
    603617                             "[%s:%d] formatInfo[%d].m_samplingFrequency " 
     
    618632                             i, formatInfo.m_midiChannels ); 
    619633                m_formatInfos.push_back( formatInfo ); 
     634                flushDebugOutput(); 
    620635            } 
    621636        } 
  • branches/echoaudio/src/bebob/bebob_functionblock.cpp

    r507 r509  
    3434 
    3535FunctionBlock::FunctionBlock( 
    36     Subunit& subunit, 
     36    AVC::Subunit& subunit, 
    3737    function_block_type_t type, 
    3838    function_block_type_t subtype, 
     
    146146          ++it ) 
    147147    { 
    148         AVC::Plug* plug = *it; 
     148        BeBoB::Plug* plug = dynamic_cast<BeBoB::Plug*>(*it); 
     149        if(!plug) { 
     150            debugError("BUG: not a bebob plug\n"); 
     151            return false; 
     152        } 
    149153        if ( !plug->discoverConnections() ) { 
    150154            debugError( "Could not discover plug connections\n" ); 
  • branches/echoaudio/src/debugmodule/debugmodule.cpp

    r499 r509  
    3030#include <iostream> 
    3131 
    32 #define DO_MESSAGE_BUFFER_PRINT 
     32#include <time.h> 
     33 
     34//#define DO_MESSAGE_BUFFER_PRINT 
    3335 
    3436using namespace std; 
     
    113115        fname=f; 
    114116    } 
    115  
    116     DebugModuleManager::instance()->print( "%s (%s)[%4d] %s: ", getPreSequence( level ), 
     117     
     118    // add a timing timestamp 
     119    struct timespec ts; 
     120    clock_gettime(CLOCK_MONOTONIC, &ts); 
     121    uint32_t ts_usec=(uint32_t)(ts.tv_sec * 1000000LL + ts.tv_nsec / 1000LL); 
     122     
     123    DebugModuleManager::instance()->print( "%010lu: %s (%s)[%4d] %s: ",  
     124                 ts_usec, getPreSequence( level ), 
    117125                 fname,  line,  function ); 
    118126    DebugModuleManager::instance()->va_print( format, arg ); 
     
    197205 
    198206    pthread_mutex_init(&mb_write_lock, NULL); 
     207    pthread_mutex_init(&mb_flush_lock, NULL); 
    199208    pthread_cond_init(&mb_ready_cond, NULL); 
    200209 
     
    288297DebugModuleManager::flush() 
    289298{ 
    290     mb_flush(); 
     299//     mb_flush(); 
    291300} 
    292301 
     
    295304{ 
    296305    /* called WITHOUT the mb_write_lock */ 
     306     
     307    /* the flush lock is to allow a flush from multiple threads  
     308     * this allows a code section that outputs a lot of debug messages 
     309     * and that can be blocked to flush the buffer itself such that it  
     310     * does not overflow. 
     311     */ 
     312    DebugModuleManager *m=DebugModuleManager::instance(); 
     313    pthread_mutex_lock(&m->mb_flush_lock); 
    297314    while (mb_outbuffer != mb_inbuffer) { 
    298315        fputs(mb_buffers[mb_outbuffer], stderr); 
    299316        mb_outbuffer = MB_NEXT(mb_outbuffer); 
    300317    } 
     318    pthread_mutex_unlock(&m->mb_flush_lock); 
    301319} 
    302320 
     
    376394        return; 
    377395    } 
    378  
     396     
    379397#ifdef DO_MESSAGE_BUFFER_PRINT 
    380398    if (pthread_mutex_trylock(&mb_write_lock) == 0) { 
  • branches/echoaudio/src/debugmodule/debugmodule.h

    r499 r509  
    230230    pthread_t mb_writer_thread; 
    231231    pthread_mutex_t mb_write_lock; 
     232    pthread_mutex_t mb_flush_lock; 
    232233    pthread_cond_t mb_ready_cond; 
    233234 
  • branches/echoaudio/src/devicemanager.cpp

    r500 r509  
    228228 
    229229            FFADODevice* avDevice = getDriverForDevice( configRom, 
    230                                                       nodeId ); 
     230                                                        nodeId ); 
    231231            if ( avDevice ) { 
    232232                debugOutput( DEBUG_LEVEL_NORMAL, 
     
    266266                    debugWarning("failed to register AvDevice at OSC server\n"); 
    267267                } 
     268                 
     269                debugOutput( DEBUG_LEVEL_NORMAL, "discovery of node %d done...\n", nodeId ); 
    268270 
    269271            } 
    270272        } 
     273 
     274        debugOutput( DEBUG_LEVEL_NORMAL, "discovery finished...\n" ); 
     275 
    271276        return true; 
    272277 
     
    313318 
    314319            m_avDevices.push_back( avDevice ); 
    315         } 
     320 
     321            debugOutput( DEBUG_LEVEL_NORMAL, "discovery of node %d done...\n", nodeId ); 
     322        } 
     323 
     324        debugOutput( DEBUG_LEVEL_NORMAL, "discovery finished...\n" ); 
    316325 
    317326        return true; 
  • branches/echoaudio/src/ffadodevice.h

    r505 r509  
    5454    virtual ~FFADODevice() {}; 
    5555 
     56    /// Returns the 1394 service of the FFADO device 
     57    virtual Ieee1394Service& get1394Service() 
     58        { return *m_p1394Service; }; 
    5659    /// Returns the ConfigRom object of the device node. 
    57     ConfigRom& getConfigRom() const; 
     60    virtual ConfigRom& getConfigRom() const; 
    5861 
    5962    /** 
  • branches/echoaudio/src/libavc/audiosubunit/avc_audiosubunit.cpp

    r508 r509  
    6060SubunitAudio::discover() 
    6161{ 
    62     debugOutput(DEBUG_LEVEL_NORMAL, "Discovering Audio Subunit...\n"); 
     62    debugOutput(DEBUG_LEVEL_NORMAL, "Discovering %s...\n", getName()); 
    6363     
    6464    if ( !Subunit::discover() ) { 
     
    6666    } 
    6767 
    68 //     if ( !discoverBeBoB::FunctionBlocks() ) { 
    69 //         debugError( "function block discovering failed\n" ); 
    70 //         return false; 
    71 //     } 
    72  
    7368    return true; 
    7469} 
     
    7873SubunitAudio::getName() 
    7974{ 
    80     return "AudioSubunit"; 
     75    return "AVC::AudioSubunit"; 
    8176} 
    8277 
  • branches/echoaudio/src/libavc/general/avc_plug.cpp

    r507 r509  
    119119Plug::getSubunitId() const 
    120120{ 
    121     return (m_subunit==NULL?eST_Unit:m_subunit->getSubunitId()); 
    122 
    123  
    124 /* 
    125 bool 
    126 Plug::discover() 
    127 
    128     if ( !discoverPlugType() ) { 
    129         debugError( "discover: Could not discover plug type (%d,%d,%d,%d,%d)\n", 
    130                     m_unit->getConfigRom().getNodeId(), m_subunitType, m_subunitId, m_direction, m_id ); 
    131         return false; 
    132     } 
    133  
    134     if ( !discoverName() ) { 
    135         debugError( "Could not discover name (%d,%d,%d,%d,%d)\n", 
    136                     m_unit->getConfigRom().getNodeId(), m_subunitType, m_subunitId, m_direction, m_id ); 
    137         return false; 
    138     } 
    139  
    140     if ( !discoverNoOfChannels() ) { 
    141         debugError( "Could not discover number of channels " 
    142                     "(%d,%d,%d,%d,%d)\n", 
    143                     m_unit->getConfigRom().getNodeId(), m_subunitType, m_subunitId, m_direction, m_id ); 
    144         return false; 
    145     } 
    146  
    147     if ( !discoverChannelPosition() ) { 
    148         debugError( "Could not discover channel positions " 
    149                     "(%d,%d,%d,%d,%d)\n", 
    150                     m_unit->getConfigRom().getNodeId(), m_subunitType, m_subunitId, m_direction, m_id ); 
    151         return false; 
    152     } 
    153  
    154     if ( !discoverChannelName() ) { 
    155         debugError( "Could not discover channel name " 
    156                     "(%d,%d,%d,%d,%d)\n", 
    157                     m_unit->getConfigRom().getNodeId(), m_subunitType, m_subunitId, m_direction, m_id ); 
    158         return false; 
    159     } 
    160  
    161     if ( !discoverClusterInfo() ) { 
    162         debugError( "Could not discover channel name " 
    163                     "(%d,%d,%d,%d,%d)\n", 
    164                     m_unit->getConfigRom().getNodeId(), m_subunitType, m_subunitId, m_direction, m_id ); 
    165         return false; 
    166     } 
    167  
    168     if ( !discoverStreamFormat() ) { 
    169         debugError( "Could not discover stream format " 
    170                     "(%d,%d,%d,%d,%d)\n", 
    171                     m_unit->getConfigRom().getNodeId(), m_subunitType, m_subunitId, m_direction, m_id ); 
    172         return false; 
    173     } 
    174  
    175     if ( !discoverSupportedStreamFormats() ) { 
    176         debugError( "Could not discover supported stream formats " 
    177                     "(%d,%d,%d,%d,%d)\n", 
    178                     m_unit->getConfigRom().getNodeId(), m_subunitType, m_subunitId, m_direction, m_id ); 
    179         return false; 
    180     } 
    181  
    182     return unit->getPlugManager().addPlug( *this ); 
    183 
    184  
    185 bool 
    186 Plug::discoverConnections() 
    187 
    188     return discoverConnectionsInput() && discoverConnectionsOutput(); 
    189 
    190 */ 
     121    return (m_subunit==NULL?0xFF:m_subunit->getSubunitId()); 
     122
    191123 
    192124bool 
     
    527459    debugOutput( DEBUG_LEVEL_VERBOSE, "\tNumber of Streams  = %d\n", 
    528460                 getNrOfStreams() ); 
     461    flushDebugOutput(); 
    529462} 
    530463 
     
    948881                     PlugManager& plugManager ) 
    949882{ 
     883    #warning FIXME: The derived class should be creating these 
     884    // FIXME: The derived class should be creating these, such that discover() can become pure virtual 
     885 
    950886    Plug* pPlug = new Plug; 
    951887    if ( !pPlug ) { 
  • branches/echoaudio/src/libavc/general/avc_plug.h

    r507 r509  
    9292    virtual bool discover()  
    9393    {//FIXME: 
    94     #warning FIXME 
    95     };; 
    96     virtual bool discoverConnections()  
    97     {//FIXME: 
    98     #warning FIXME 
    99     };; 
     94        #warning FIXME i want to be pure!! 
     95        return true; 
     96    }; 
    10097 
    10198    bool inquireConnnection( Plug& plug ); 
     
    171168    ClusterInfoVector& getClusterInfos() 
    172169        { return m_clusterInfos; } 
    173  
     170         
     171    virtual void setVerboseLevel( int i )  
     172            {setDebugLevel(i);}; 
    174173protected: 
    175174    Plug(); 
  • branches/echoaudio/src/libavc/general/avc_subunit.cpp

    r508 r509  
    3636#include <sstream> 
    3737 
    38 #warning do we need this? 
    39 #include "bebob/bebob_avplug.h" 
    40  
    4138namespace AVC { 
    4239 
     
    7370{ 
    7471    // There is nothing we can discover for a generic subunit 
    75     // Maybe its plugs, but there are multiple ways of doing that. 
     72    // Maybe the plugs, but there are multiple ways of doing that. 
     73    // subclasses should implement this 
    7674    return true; 
    7775} 
     
    118116Subunit* 
    119117Subunit::deserialize( Glib::ustring basePath, 
    120                                      Util::IODeserialize& deser, 
    121                                      Unit& unit ) 
     118                      Util::IODeserialize& deser, 
     119                      Unit& unit ) 
    122120{ 
    123121    bool result; 
     
    126124 
    127125    Subunit* pSubunit = 0; 
     126     
     127    #warning FIXME: The derived class should be creating these 
     128    // FIXME: The derived class should be creating these, such that discover() can become pure virtual 
    128129    switch( sbType ) { 
    129130    case eST_Audio: 
  • branches/echoaudio/src/libavc/general/avc_subunit.h

    r508 r509  
    5151 
    5252    virtual bool discover(); 
    53     virtual bool discoverConnections() 
    54     {//FIXME: 
    55     #warning FIXME 
    56     }; 
    57  
    5853    virtual const char* getName() = 0; 
    5954 
     
    6358    { return m_sbType; } 
    6459 
     60    Unit& getUnit() const 
     61        { return *m_unit; } 
     62 
     63 
    6564    bool addPlug( Plug& plug ); 
    6665 
     
    6867    { return m_plugs; } 
    6968    Plug* getPlug(Plug::EPlugDirection direction, plug_id_t plugId); 
    70  
    71  
    72     Unit& getUnit() const 
    73         { return *m_unit; } 
    7469 
    7570 
     
    8176    Subunit(); 
    8277 
    83 //     bool discoverPlugs(); 
    84 //     bool discoverPlugs(Plug::EPlugDirection plugDirection, 
    85 //                        plug_id_t plugMaxId ); 
    86 //  
    8778    virtual bool serializeChild( Glib::ustring basePath, 
    8879                                 Util::IOSerialize& ser ) const = 0; 
     
    9687    subunit_t       m_sbId; 
    9788 
    98     PlugVector             m_plugs; 
     89    PlugVector      m_plugs; 
    9990 
    10091    DECLARE_DEBUG_MODULE; 
  • branches/echoaudio/src/libavc/general/avc_unit.cpp

    r507 r509  
    4646IMPL_DEBUG_MODULE( Unit, Unit, DEBUG_LEVEL_VERBOSE ); 
    4747 
    48 Unit::Unit( std::auto_ptr< ConfigRom >( configRom ), 
    49                   Ieee1394Service& ieee1394service, 
    50                   int nodeId ) 
     48Unit::Unit( ) 
    5149    : m_pPlugManager( new PlugManager( ) ) 
    5250    , m_activeSyncInfo( 0 ) 
    53     , m_puConfigRom( configRom ) 
    54     , m_pu1394Service( &ieee1394service ) 
    55 
    56     debugOutput( DEBUG_LEVEL_VERBOSE, "Created AVC::Unit (NodeID %d)\n", 
    57                  nodeId ); 
     51
     52    debugOutput( DEBUG_LEVEL_VERBOSE, "Created AVC::Unit\n" ); 
    5853} 
    5954 
     
    107102Unit::enumerateSubUnits() 
    108103{ 
    109     SubUnitInfoCmd subUnitInfoCmd( *m_pu1394Service ); 
     104    SubUnitInfoCmd subUnitInfoCmd( get1394Service() ); 
    110105    subUnitInfoCmd.setCommandType( AVCCommand::eCT_Status ); 
    111106 
     
    117112 
    118113    subUnitInfoCmd.m_page = 0; 
    119     subUnitInfoCmd.setNodeId( m_puConfigRom->getNodeId() ); 
     114    subUnitInfoCmd.setNodeId( getConfigRom().getNodeId() ); 
    120115    subUnitInfoCmd.setVerbose( getDebugLevel() ); 
    121116    if ( !subUnitInfoCmd.fire() ) { 
  • branches/echoaudio/src/libavc/general/avc_unit.h

    r508 r509  
    4949class Unit { 
    5050public: 
    51     Unit( std::auto_ptr<ConfigRom>( configRom ), 
    52               Ieee1394Service& ieee1394Service, 
    53               int nodeId ); 
     51    Unit( ); 
    5452    virtual ~Unit(); 
    5553 
     
    5755    virtual void showDevice(); 
    5856 
    59     Ieee1394Service& get1394Service() 
    60         { return *m_pu1394Service; } 
    61      
     57    // these have to be implemented by the parent class 
     58    /// Returns the 1394 service 
     59    virtual Ieee1394Service& get1394Service() = 0; 
    6260    /// Returns the ConfigRom 
    63     ConfigRom& getConfigRom() const  
    64         {return *m_puConfigRom;}; 
     61    virtual ConfigRom& getConfigRom() const = 0; 
    6562     
    6663    /// Discovers the unit's internals 
     
    150147 
    151148private: 
    152     std::auto_ptr<ConfigRom>( m_puConfigRom ); 
    153     Ieee1394Service*          m_pu1394Service; 
    154      
    155149    DECLARE_DEBUG_MODULE; 
    156150