Changeset 119

Show
Ignore:
Timestamp:
06/20/05 15:18:09 (19 years ago)
Author:
wagi
Message:

sync_mode program debugged and lot's of small bug fixes.
still open: sync stream mode is accepted

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/freebob/tests/avc_extended_stream_format.cpp

    r111 r119  
    476476    bool result = false; 
    477477 
    478     #define STREAM_FORMAT_REQUEST_SIZE 10 // XXX random length 
     478    #define STREAM_FORMAT_REQUEST_SIZE 6 // XXX random length 
    479479    union UPacket { 
    480480        quadlet_t     quadlet[STREAM_FORMAT_REQUEST_SIZE]; 
  • trunk/freebob/tests/avc_generic.cpp

    r109 r119  
    5353{ 
    5454    m_ctype = commandType; 
     55    m_commandType = commandType; 
    5556    return true; 
     57} 
     58 
     59AVCCommand::ECommandType 
     60AVCCommand::getCommandType() 
     61{ 
     62    return m_commandType; 
    5663} 
    5764 
     
    109116    return m_verbose; 
    110117} 
    111  
    112 AVCCommand::ECommandType 
    113 AVCCommand::getCommandType() 
    114 { 
    115     return static_cast<ECommandType>( m_ctype ); 
    116 } 
  • trunk/freebob/tests/avc_generic.h

    r109 r119  
    106106 
    107107private: 
    108     ctype_t   m_ctype; 
    109     subunit_t m_subunit; 
    110     opcode_t  m_opcode; 
    111     EResponse m_eResponse; 
    112     bool      m_verbose; 
     108    ctype_t      m_ctype; 
     109    subunit_t    m_subunit; 
     110    opcode_t     m_opcode; 
     111    EResponse    m_eResponse; 
     112    bool         m_verbose; 
     113    ECommandType m_commandType; 
    113114}; 
    114115 
  • trunk/freebob/tests/avc_plug_info.cpp

    r112 r119  
    104104            break; 
    105105        default: 
    106             cerr << "Could not deserialize with subfucntion " << m_subFunction << endl; 
     106            cerr << "Could not deserialize with subfunction " << m_subFunction << endl; 
    107107            return false; 
    108108        } 
     
    123123    bool result = false; 
    124124 
    125     #define STREAM_FORMAT_REQUEST_SIZE 10 // XXX random length 
     125    #define STREAM_FORMAT_REQUEST_SIZE 5 // XXX random length 
    126126    union UPacket { 
    127127        quadlet_t     quadlet[STREAM_FORMAT_REQUEST_SIZE]; 
  • trunk/freebob/tests/avc_signal_source.cpp

    r116 r119  
    119119{ 
    120120    AVCCommand::serialize( se ); 
     121 
     122    byte_t operand; 
     123    switch ( getCommandType() ) { 
     124    case eCT_Status: 
     125        operand = ( m_outputStatus << 5 ) 
     126                  | ( ( m_conv & 0x1 ) << 4 ) 
     127                  | ( m_signalStatus & 0xf ); 
     128        se.write( operand, "SignalSourceCmd outputStatus & conv & signalStatus" ); 
     129        break; 
     130    case eCT_Control: 
     131    case eCT_SpecificInquiry: 
     132        operand = m_resultStatus & 0xf; 
     133        se.write( operand, "SignalSourceCmd resultStatus" ); 
     134        break; 
     135    default: 
     136        cerr << "Can't handle command type " << getCommandType() << endl; 
     137        return false; 
     138    } 
     139 
    121140    switch( getSubunitType() ) { 
    122141    case eST_Unit: 
     142    case eST_Audio: 
     143    case eST_Music: 
    123144        { 
    124             byte_t operand = m_resultStatus & 0xf; 
    125             se.write( operand, "SignalSourceCmd resultStatus" ); 
    126  
    127145            if ( m_signalSource ) { 
    128146                m_signalSource->serialize( se ); 
     
    142160        } 
    143161        break; 
    144     case eST_Audio: 
    145     case eST_Music: 
    146         { 
    147             byte_t operand = ( m_outputStatus << 5 ) | ( ( m_conv & 0x1 ) << 4 ) | ( m_signalStatus & 0x7 ); 
    148             se.write( operand, "SignalSourceCmd outputStatus & conv & signalStatus" ); 
    149  
    150             if ( m_signalSource ) { 
    151                 m_signalSource->serialize( se ); 
    152             } else { 
    153                 byte_t reserved = 0xff; 
    154                 se.write( reserved, "SignalSourceCmd" ); 
    155                 se.write( reserved, "SignalSourceCmd" ); 
    156             } 
    157  
    158             if ( m_signalDestination ) { 
    159                 m_signalDestination->serialize( se ); 
    160             } else { 
    161                 byte_t reserved = 0xff; 
    162                 se.write( reserved, "SignalSourceCmd" ); 
    163                 se.write( reserved, "SignalSourceCmd" ); 
    164             } 
    165         } 
    166         break; 
    167162    default: 
    168163        cerr << "Can't handle subunit type " << getSubunitType() << endl; 
     
    182177 
    183178    AVCCommand::deserialize( de ); 
     179 
     180    byte_t operand; 
     181    switch ( getCommandType() ) { 
     182    case eCT_Status: 
     183        de.read( &operand ); 
     184        m_outputStatus = operand >> 5; 
     185        m_conv = ( operand & 0x10 ) >> 4; 
     186        m_signalStatus = operand & 0xf; 
     187        break; 
     188    case eCT_Control: 
     189    case eCT_SpecificInquiry: 
     190        de.read( &operand ); 
     191        m_resultStatus = operand & 0xf; 
     192        break; 
     193    default: 
     194        cerr << "Can't handle command type " << getCommandType() << endl; 
     195        return false; 
     196    } 
     197 
    184198    switch( getSubunitType() ) { 
    185199    case eST_Unit: 
     200    case eST_Audio: 
     201    case eST_Music: 
    186202        { 
    187203            byte_t operand; 
    188  
    189             de.read( &operand ); 
    190             m_resultStatus = operand & 0xf; 
    191  
    192204            de.peek( &operand ); 
    193205            if ( operand == 0xff ) { 
     
    196208                m_signalSource = new SignalSubunitAddress; 
    197209            } 
     210 
    198211            m_signalSource->deserialize( de ); 
    199212 
     
    207220        } 
    208221        break; 
    209     case eST_Audio: 
    210     case eST_Music: 
    211         { 
    212             byte_t operand; 
    213  
    214             de.read( &operand ); 
    215             m_outputStatus = operand >> 5; 
    216             m_conv = ( operand & 0x10 ) >> 4; 
    217             m_signalStatus = operand & 0xf; 
    218  
    219             de.peek( &operand ); 
    220             if ( operand == 0xff ) { 
    221                 m_signalSource = new SignalUnitAddress; 
    222             } else { 
    223                 m_signalSource = new SignalSubunitAddress; 
    224             } 
    225  
    226             m_signalSource->deserialize( de ); 
    227  
    228             de.peek( &operand ); 
    229             if ( operand == 0xff ) { 
    230                 m_signalDestination = new SignalUnitAddress; 
    231             } else { 
    232                 m_signalDestination = new SignalSubunitAddress; 
    233             } 
    234             m_signalDestination->deserialize( de ); 
    235         } 
    236         break; 
    237222    default: 
    238223        cerr << "Can't handle subunit type " << getSubunitType() << endl; 
     
    249234    bool result = false; 
    250235 
    251     #define STREAM_FORMAT_REQUEST_SIZE 10 // XXX random length 
     236    #define STREAM_FORMAT_REQUEST_SIZE 5 // XXX random length 
    252237    union UPacket { 
    253238        quadlet_t     quadlet[STREAM_FORMAT_REQUEST_SIZE]; 
  • trunk/freebob/tests/serialize.cpp

    r108 r119  
    106106    bool result = false; 
    107107    if ( isCurPosValid() ) { 
    108         *value = *( m_curPos + sizeof( byte_t ) )
     108        *value = *m_curPos
    109109        result = true; 
    110110    } 
  • trunk/freebob/tests/sync_mode.cpp

    r116 r119  
    233233{ 
    234234    SignalSourceCmd signalSourceCmd; 
    235     signalSourceCmd.setSubunitType( destPlug.m_subunitType ); 
    236     signalSourceCmd.setSubunitId( destPlug.m_subunitId ); 
     235    signalSourceCmd.setSubunitType( AVCCommand::eST_Unit ); 
    237236    signalSourceCmd.setCommandType( AVCCommand::eCT_SpecificInquiry ); 
    238237    signalSourceCmd.setVerbose( arguments.verbose ); 
     
    251250 
    252251    if ( signalSourceCmd.fire( handle,  node_id ) ) { 
    253         usleep( 10000 ); 
    254252        if ( signalSourceCmd.getResponse() == AVCCommand::eR_Implemented ) { 
    255253            syncConnectionInfos.push_back( SyncConnectionInfo( connectionName, syncConnectionInfos.size(), sourcePlug, destPlug ) ); 
     
    285283    // First we have to find the music subunit sync input plug (address) 
    286284    PlugInfoCmd plugInfoCmd; 
    287     plugInfoCmd.setVerbose( arguments.verbose ); 
    288285    plugInfoCmd.setCommandType( AVCCommand::eCT_Status ); 
    289286    plugInfoCmd.setSubunitType( AVCCommand::eST_Music ); 
     
    292289    // find input sync plug 
    293290    if ( plugInfoCmd.fire( handle,  node_id ) ) { 
    294         usleep( 10000 ); 
    295291        for ( int plugIdx = 0; 
    296292              plugIdx < plugInfoCmd.m_destinationPlugs; 
     
    306302            extendedStreamFormatCmd.setSubunitId( 0x00 ); 
    307303            extendedStreamFormatCmd.setCommandType( AVCCommand::eCT_Status ); 
    308             extendedStreamFormatCmd.setVerbose( arguments.verbose ); 
    309304 
    310305            if ( extendedStreamFormatCmd.fire( handle, node_id ) ) { 
    311                 usleep( 10000 ); 
    312306                FormatInformation* formatInformation = extendedStreamFormatCmd.getFormatInformation(); 
    313307                if ( formatInformation 
     
    338332            extendedStreamFormatCmd.setSubunitId( 0x00 ); 
    339333            extendedStreamFormatCmd.setCommandType( AVCCommand::eCT_Status ); 
    340             extendedStreamFormatCmd.setVerbose( arguments.verbose ); 
    341334 
    342335            if ( extendedStreamFormatCmd.fire( handle, node_id ) ) { 
    343                 usleep( 10000 ); 
    344336                FormatInformation* formatInformation = extendedStreamFormatCmd.getFormatInformation(); 
    345337                if ( formatInformation 
     
    373365{ 
    374366    // - Music subunit sync output plug = internal sync (CSP) 
    375     inquireConnection( handle, 
    376                        node_id, 
    377                        syncConnectionInfos, 
    378                        syncOutputPlug, 
    379                        syncInputPlug, 
    380                        "internal (CSP)" ); 
     367    if ( !inquireConnection( handle, 
     368                             node_id, 
     369                             syncConnectionInfos, 
     370                             syncOutputPlug, 
     371                             syncInputPlug, 
     372                             "internal (CSP)" ) ) 
     373    { 
     374        return false; 
     375    } 
    381376 
    382377    // - Unit input plug 0 = SYT match 
    383378    PlugInfo iPCR0( "iPCR[0]", AVCCommand::eST_Unit, 0xff, 0x00 ); 
    384     inquireConnection( handle, 
    385                        node_id, 
    386                        syncConnectionInfos, 
    387                        iPCR0, 
    388                        syncInputPlug, 
    389                        "SYT match" ); 
     379    if ( !inquireConnection( handle, 
     380                             node_id, 
     381                             syncConnectionInfos, 
     382                             iPCR0, 
     383                             syncInputPlug, 
     384                             "SYT match" ) ) 
     385    { 
     386        return false; 
     387    } 
    390388 
    391389    // - Unit input plut 1 = sync stream 
    392390    PlugInfo iPCR1( "iPCR[1]", AVCCommand::eST_Unit, 0xff, 0x01 ); 
    393     inquireConnection( handle, 
    394                        node_id, 
    395                        syncConnectionInfos, 
    396                        iPCR1, 
    397                        syncInputPlug, 
    398                        "sync stream" ); 
     391    if ( !inquireConnection( handle, 
     392                             node_id, 
     393                             syncConnectionInfos, 
     394                             iPCR1, 
     395                             syncInputPlug, 
     396                             "sync stream" ) ) 
     397    { 
     398        return false; 
     399    } 
    399400 
    400401    // Find out how many external input plugs exits. 
     
    402403    { 
    403404        PlugInfoCmd plugInfoCmd; 
    404         plugInfoCmd.setVerbose( arguments.verbose ); 
    405405        plugInfoCmd.setCommandType( AVCCommand::eCT_Status ); 
    406406 
    407407        if ( plugInfoCmd.fire( handle, node_id ) ) { 
    408             usleep( 10000 ); // Don't overload device with requests 
    409408            for ( int plugIdx = 0; 
    410409                  plugIdx < plugInfoCmd.m_externalInputPlugs; 
     
    419418                                       0xff, 
    420419                                       0x80 + plugIdx ); 
    421                 inquireConnection( handle, 
    422                                    node_id, 
    423                                    syncConnectionInfos, 
    424                                    externalPlug, 
    425                                    syncInputPlug, 
    426                                    plugName); 
     420                if ( !inquireConnection( handle, 
     421                                         node_id, 
     422                                         syncConnectionInfos, 
     423                                         externalPlug, 
     424                                         syncInputPlug, 
     425                                         plugName) ) 
     426                { 
     427                    return false; 
     428                } 
    427429            } 
     430        } else { 
     431            return false; 
    428432        } 
    429433    } 
     
    454458    if ( info ) { 
    455459        SignalSourceCmd signalSourceCmd; 
    456         signalSourceCmd.setSubunitType( syncInputPlug.m_subunitType ); 
    457         signalSourceCmd.setSubunitId( syncInputPlug.m_subunitId ); 
     460        signalSourceCmd.setSubunitType( AVCCommand::eST_Unit ); 
    458461        signalSourceCmd.setCommandType( AVCCommand::eCT_Control ); 
    459462        signalSourceCmd.setVerbose( arguments.verbose ); 
     
    478481 
    479482        if ( signalSourceCmd.fire( handle, node_id ) ) { 
    480             usleep( 10000 ); 
    481483            switch ( signalSourceCmd.getResponse() ) 
    482484            { 
     
    527529{ 
    528530    SignalSourceCmd signalSourceCmd; 
    529     signalSourceCmd.setSubunitType( syncInputPlug.m_subunitType ); 
    530     signalSourceCmd.setSubunitId( syncInputPlug.m_subunitId ); 
     531    signalSourceCmd.setSubunitType( AVCCommand::eST_Unit ); 
    531532    signalSourceCmd.setCommandType( AVCCommand::eCT_Status ); 
    532533    signalSourceCmd.setVerbose( arguments.verbose ); 
     
    545546 
    546547    if ( signalSourceCmd.fire( handle, node_id ) ) { 
    547         usleep( 10000 ); 
    548548        if ( signalSourceCmd.getResponse() == AVCCommand::eR_Implemented ) { 
    549549            cout << endl << "Currently activated mode:" << endl; 
     
    554554            } catch ( bad_cast ) { } 
    555555 
    556             SignalSubunitAddress* signalSubnitAddress = 0; 
     556            SignalSubunitAddress* signalSubunitAddress = 0; 
    557557            try { 
    558                 signalSubnitAddress = dynamic_cast<SignalSubunitAddress*>( signalSourceCmd.getSignalSource() ); 
     558                signalSubunitAddress = dynamic_cast<SignalSubunitAddress*>( signalSourceCmd.getSignalSource() ); 
    559559            } catch ( bad_cast ) { } 
    560560 
     
    562562            if ( signalUnitAddress ) { 
    563563                sourcePlug.m_subunitType = AVCCommand::eST_Unit; 
    564                 sourcePlug.m_subunitId = 0x00
     564                sourcePlug.m_subunitId = 0xff
    565565                sourcePlug.m_plugId = signalUnitAddress->m_plugId; 
    566             } else if ( signalSubnitAddress ) { 
    567                 sourcePlug.m_subunitType = static_cast<AVCCommand::ESubunitType>( signalSubnitAddress->m_subunitType ); 
    568                 sourcePlug.m_subunitId = signalSubnitAddress->m_subunitId; 
    569                 sourcePlug.m_plugId = signalSubnitAddress->m_plugId; 
     566            } else if ( signalSubunitAddress ) { 
     567                sourcePlug.m_subunitType = static_cast<AVCCommand::ESubunitType>( signalSubunitAddress->m_subunitType ); 
     568                sourcePlug.m_subunitId = signalSubunitAddress->m_subunitId; 
     569                sourcePlug.m_plugId = signalSubunitAddress->m_plugId; 
    570570            } 
    571571 
     
    575575            } 
    576576        } 
     577    } else { 
     578        return false; 
    577579    } 
    578580 
     
    596598    SyncConnectionInfos syncConnectionInfos; 
    597599 
    598     findSyncPlugs( handle, node_id, syncInputPlug, syncOutputPlug ); 
    599     findSupportedConnections( handle, node_id, syncInputPlug, syncOutputPlug, syncConnectionInfos ); 
    600  
     600    if ( !findSyncPlugs( handle, node_id, syncInputPlug, syncOutputPlug ) ) { 
     601        cerr << "Could not discover sync plugs" << endl; 
     602        return false; 
     603    } 
     604 
     605    if ( !findSupportedConnections( handle, node_id, syncInputPlug, syncOutputPlug, syncConnectionInfos ) ) { 
     606        cerr << "Could not find supported connections" << endl; 
     607        return false; 
     608    } 
     609 
     610    bool result = false; 
    601611    printSupportedModes( handle, node_id, syncConnectionInfos ); 
    602612    if ( sync_mode_id != -1 ) { 
    603         setCurrentActive( handle, node_id, syncInputPlug, syncConnectionInfos, sync_mode_id ); 
     613        if ( !setCurrentActive( handle, node_id, syncInputPlug, syncConnectionInfos, sync_mode_id ) ) { 
     614            cerr << "Could not set new sync mode" << endl; 
     615        } else { 
     616            result = true; 
     617        } 
    604618    } 
    605619    printCurrentActive( handle, node_id, syncConnectionInfos, syncInputPlug ); 
    606620 
    607     return true
     621    return result
    608622} 
    609623