Changeset 447

Show
Ignore:
Timestamp:
04/08/07 04:28:58 (17 years ago)
Author:
ppalmers
Message:

- Better display of the function blocks in the graph
- test-mixer can now switch the front/back switch of the phase88

(function block 10: ./test-mixer PORT NODE 10)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/bebob/bebob_avplug.cpp

    r445 r447  
    19641964        AvPlug* plug = *it; 
    19651965        if ( plug->getFunctionBlockType() != 0xff ) { 
     1966            std::ostringstream strstrm; 
     1967            switch(plug->getFunctionBlockType()) { 
     1968                case 0x80: 
     1969                    strstrm << "Selector FB"; 
     1970                    break; 
     1971                case 0x81: 
     1972                    strstrm << "Feature FB"; 
     1973                    break; 
     1974                case 0x82: 
     1975                    strstrm << "Processing FB"; 
     1976                    break; 
     1977                case 0x83: 
     1978                    strstrm << "CODEC FB"; 
     1979                    break; 
     1980                default: 
     1981                    strstrm << plug->getFunctionBlockType(); 
     1982            } 
     1983             
    19661984            if ( plug->getPlugDirection() == AvPlug::eAPD_Input ) { 
    1967                 printf( "\t\"(%d) %s\" -> \"(0x%02x,%d)\"\n", 
     1985                printf( "\t\"(%d) %s\" -> \"(%s, ID %d)\"\n", 
    19681986                        plug->getGlobalId(), 
    19691987                        plug->getName(), 
    1970                         plug->getFunctionBlockType(), 
     1988                        strstrm.str().c_str(), 
    19711989                        plug->getFunctionBlockId() ); 
    19721990            } else { 
    1973                 printf( "\t\"(0x%02x,%d)\" -> \t\"(%d) %s\"\n", 
    1974                         plug->getFunctionBlockType(), 
     1991                printf( "\t\"(%s, ID %d)\" -> \t\"(%d) %s\"\n", 
     1992                        strstrm.str().c_str(), 
    19751993                        plug->getFunctionBlockId(), 
    19761994                        plug->getGlobalId(), 
  • trunk/libffado/tests/test-mixer.cpp

    r445 r447  
    2525#include "libavc/avc_function_block.h" 
    2626#include "libavc/avc_serialize.h" 
     27#include "debugmodule/debugmodule.h" 
    2728 
    2829#include "libieee1394/ieee1394service.h" 
     30#include <string.h> 
     31 
     32DECLARE_GLOBAL_DEBUG_MODULE; 
    2933 
    3034const bool bVerbose = true; 
     
    4246    fbCmd.m_pFBProcessing->m_pEnhancedMixer = new FunctionBlockProcessingEnhancedMixer; 
    4347 
    44     fbCmd.m_pFBProcessing->m_fbInputPlugNumber = 0x01; 
     48    debugOutput(DEBUG_LEVEL_NORMAL, "Requesting mixer programmable state...\n"); 
     49 
     50    fbCmd.m_pFBProcessing->m_fbInputPlugNumber = 0x00; 
    4551    fbCmd.m_pFBProcessing->m_inputAudioChannelNumber  = 0xff; 
    4652    fbCmd.m_pFBProcessing->m_outputAudioChannelNumber = 0xff; 
    4753    fbCmd.m_pFBProcessing->m_pEnhancedMixer->m_statusSelector 
    4854        = FunctionBlockProcessingEnhancedMixer::eSS_ProgramableState; 
    49 //     fbCmd.m_pFBProcessing->m_pEnhancedMixer->m_statusSelector 
    50 //         = FunctionBlockProcessingEnhancedMixer::eSS_Level; 
    5155 
    5256    fbCmd.setVerbose( bVerbose ); 
     
    5660 
    5761    if ( !fbCmd.fire() ) { 
    58         printf( "cmd failed\n" ); 
     62        debugError( "cmd failed\n" ); 
     63    } 
     64 
     65    if ( bVerbose ) { 
     66        CoutSerializer se; 
     67        fbCmd.serialize( se ); 
     68    } 
     69     
     70    debugOutput(DEBUG_LEVEL_NORMAL, "Requesting mixer level state...\n"); 
     71     
     72    fbCmd.m_pFBProcessing->m_fbInputPlugNumber = 0x00; 
     73    fbCmd.m_pFBProcessing->m_inputAudioChannelNumber  = 0x00; 
     74    fbCmd.m_pFBProcessing->m_outputAudioChannelNumber = 0x00; 
     75    fbCmd.m_pFBProcessing->m_pEnhancedMixer->m_statusSelector 
     76        = FunctionBlockProcessingEnhancedMixer::eSS_Level; 
     77     
     78    if ( !fbCmd.fire() ) { 
     79        debugError( "cmd failed\n" ); 
     80    } 
     81 
     82    if ( bVerbose ) { 
     83        CoutSerializer se; 
     84        fbCmd.serialize( se ); 
     85    } 
     86 
     87    return true; 
     88
     89 
     90bool 
     91doApp2( Ieee1394Service& ieee1394service, int node_id, int fb_id ) 
     92
     93    FunctionBlockCmd fbCmd( ieee1394service, 
     94                            FunctionBlockCmd::eFBT_Selector, 
     95                            fb_id, 
     96                            FunctionBlockCmd::eCA_Current ); 
     97    fbCmd.setNodeId( node_id ); 
     98    fbCmd.setSubunitId( 0x00 ); 
     99    fbCmd.setCommandType( AVCCommand::eCT_Status ); 
     100    fbCmd.m_pFBSelector->m_inputFbPlugNumber=0; 
     101 
     102    debugOutput(DEBUG_LEVEL_NORMAL, "Requesting selector state...\n"); 
     103 
     104    fbCmd.setVerbose( bVerbose ); 
     105    if (bVerbose) { 
     106        ieee1394service.setVerboseLevel( DEBUG_LEVEL_VERY_VERBOSE ); 
     107    } 
     108     
     109    if ( !fbCmd.fire() ) { 
     110        debugError( "cmd failed\n" ); 
     111    } 
     112 
     113    if ( bVerbose ) { 
     114        CoutSerializer se; 
     115        fbCmd.serialize( se ); 
     116    } 
     117 
     118    return true; 
     119
     120 
     121bool 
     122doApp3( Ieee1394Service& ieee1394service, int node_id, int fb_id , int val ) 
     123
     124    FunctionBlockCmd fbCmd( ieee1394service, 
     125                            FunctionBlockCmd::eFBT_Selector, 
     126                            fb_id, 
     127                            FunctionBlockCmd::eCA_Current ); 
     128    fbCmd.setNodeId( node_id ); 
     129    fbCmd.setSubunitId( 0x00 ); 
     130    fbCmd.setCommandType( AVCCommand::eCT_Control ); 
     131    fbCmd.m_pFBSelector->m_inputFbPlugNumber=val; 
     132 
     133    debugOutput(DEBUG_LEVEL_NORMAL, "Setting selector state to %d...\n", val); 
     134 
     135    fbCmd.setVerbose( bVerbose ); 
     136    if (bVerbose) { 
     137        ieee1394service.setVerboseLevel( DEBUG_LEVEL_VERY_VERBOSE ); 
     138    } 
     139     
     140    if ( !fbCmd.fire() ) { 
     141        debugError( "cmd failed\n" ); 
    59142    } 
    60143 
     
    75158 
    76159    if (argc < 3) { 
    77         printf("usage: PORT NODE_ID FB_ID\n"); 
     160        debugError("usage: PORT NODE_ID FB_ID\n"); 
    78161        exit(0); 
    79162    } 
     
    86169 
    87170    if (errno) { 
    88         perror("argument parsing failed:"); 
     171        debugError("argument parsing failed: %s", strerror(errno)); 
    89172        return -1; 
    90173    } 
    91174    Ieee1394Service ieee1394service; 
    92175    if ( !ieee1394service.initialize( port ) ) { 
    93         fprintf( stderr, "could not set port on ieee1394service\n" ); 
     176        debugError( "could not set port on ieee1394service\n" ); 
    94177        return -1; 
    95178    } 
    96179 
    97180    doApp( ieee1394service, node_id, fb_id ); 
     181    doApp2( ieee1394service, node_id, fb_id ); 
     182     doApp3( ieee1394service, node_id, fb_id , 0 ); 
     183     sleep(1); 
     184     doApp3( ieee1394service, node_id, fb_id , 1 ); 
     185     sleep(1); 
     186     doApp3( ieee1394service, node_id, fb_id , 0 ); 
    98187 
    99188    return 0;