Changeset 276

Show
Ignore:
Timestamp:
06/27/06 14:46:41 (17 years ago)
Author:
wagi
Message:

2006-06-27 Daniel Wagner <wagi@monom.org>

  • configure.ac: Version bump to 1.1.0
  • remove bebob_light code
  • downloader various improvements
  • ConfigRom::isAvcDevice() removed. Device probe code added.
    Each device driver class can check if it supports a device.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libfreebob-downloader/ChangeLog

    r271 r276  
     12006-06-27  Daniel Wagner  <wagi@monom.org> 
     2 
     3        * configure.ac: Version bump to 1.1.0 
     4        * remove bebob_light code 
     5        * downloader various improvements 
     6        * ConfigRom::isAvcDevice() removed. Device probe code added.  
     7        Each device driver class can check if it supports a device. 
     8 
    192006-06-21  Daniel Wagner  <wagi@monom.org> 
    210 
  • branches/libfreebob-downloader/configure.ac

    r259 r276  
    2323 
    2424m4_define(freebob_major_version, 1) 
    25 m4_define(freebob_minor_version, 0
     25m4_define(freebob_minor_version, 1
    2626m4_define(freebob_micro_version, 0) 
    2727 
  • branches/libfreebob-downloader/src/bebob/bebob_avdevice.cpp

    r241 r276  
    3939IMPL_DEBUG_MODULE( AvDevice, AvDevice, DEBUG_LEVEL_NORMAL ); 
    4040 
    41 AvDevice::AvDevice( Ieee1394Service& ieee1394service, 
    42                     int nodeId, 
    43                     int verboseLevel ) 
    44     :  m_1394Service( &ieee1394service ) 
     41    AvDevice::AvDevice( std::auto_ptr< ConfigRom >( configRom ), 
     42                        Ieee1394Service& ieee1394service, 
     43                        int nodeId, 
     44                        int verboseLevel ) 
     45    :  m_configRom( configRom ) 
     46    , m_1394Service( &ieee1394service ) 
    4547    , m_nodeId( nodeId ) 
    4648    , m_verboseLevel( verboseLevel ) 
     
    5254    debugOutput( DEBUG_LEVEL_VERBOSE, "Created BeBoB::AvDevice (NodeID %d)\n", 
    5355                 nodeId ); 
    54  
    55     m_configRom = new ConfigRom( m_1394Service, m_nodeId ); 
    56     m_configRom->initialize(); 
    5756} 
    5857 
    5958AvDevice::~AvDevice() 
    6059{ 
    61     delete m_configRom; 
    6260    for ( AvDeviceSubunitVector::iterator it = m_subunits.begin(); 
    6361          it != m_subunits.end(); 
     
    9088{ 
    9189    return *m_configRom; 
     90} 
     91 
     92struct VendorModelEntry { 
     93    unsigned int vendor_id; 
     94    unsigned int model_id; 
     95}; 
     96 
     97static VendorModelEntry supportedDeviceList[] = 
     98{ 
     99    {0x000d6c, 0x00010060},  // M-Audio, Audiophile 
     100    {0x0007f5, 0x00010048},  // BridgeCo, RD Audio1 
     101}; 
     102 
     103bool 
     104AvDevice::probe( ConfigRom& configRom ) 
     105{ 
     106    unsigned int vendorId = configRom.getNodeVendorId(); 
     107    unsigned int modelId = configRom.getModelId(); 
     108 
     109    for ( unsigned int i = 0; 
     110          i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) ); 
     111          ++i ) 
     112    { 
     113        if ( ( supportedDeviceList[i].vendor_id == vendorId ) 
     114             && ( supportedDeviceList[i].model_id == modelId ) ) 
     115        { 
     116            return true; 
     117        } 
     118    } 
     119 
     120    return false; 
    92121} 
    93122 
  • branches/libfreebob-downloader/src/bebob/bebob_avdevice.h

    r241 r276  
    4242class AvDevice : public IAvDevice { 
    4343public: 
    44     AvDevice( Ieee1394Service& ieee1394Service, 
     44    AvDevice( std::auto_ptr<ConfigRom>( configRom ), 
     45              Ieee1394Service& ieee1394Service, 
    4546              int nodeId, 
    4647              int verboseLevel ); 
    4748    virtual ~AvDevice(); 
    4849 
     50    static bool probe( ConfigRom& configRom ); 
    4951    virtual bool discover(); 
    5052    virtual ConfigRom& getConfigRom() const; 
     
    9597    bool checkSyncConnections( AvPlugVector& plhs, AvPlugVector& prhs ); 
    9698protected: 
     99    std::auto_ptr<ConfigRom>( m_configRom ); 
    97100    Ieee1394Service* m_1394Service; 
    98     ConfigRom*       m_configRom; 
    99101    int              m_nodeId; 
    100102    int              m_verboseLevel; 
  • branches/libfreebob-downloader/src/bebob/bebob_dl_bcd.cpp

    r271 r276  
    9999    , m_softwareId( 0 ) 
    100100    , m_softwareVersion( 0 ) 
     101    , m_hardwareId( 0 ) 
     102    , m_vendorOUI( 0 ) 
    101103    , m_imageBaseAddress( 0 ) 
    102104    , m_imageLength( 0 ) 
     
    200202        return false; 
    201203    } 
     204    if ( !read( 0x20, &m_hardwareId ) ) { 
     205        return false; 
     206    } 
     207    if ( !read( 0x24, &m_vendorOUI ) ) { 
     208        return false; 
     209    } 
    202210    if ( !read( 0x30, &m_imageOffset ) ) { 
    203211        return false; 
     
    360368    printf( "\tBCD File Version\t%d\n", m_bcd_version ); 
    361369    printf( "\tSoftware Date:\t\t%s, %s\n", 
    362             makeDate(m_softwareDate ).c_str(), 
     370            makeDate( m_softwareDate ).c_str(), 
    363371            makeTime( m_softwareTime ).c_str() ); 
    364372    printf( "\tSoftware Version:\t0x%08x\n", m_softwareVersion ); 
    365373    printf( "\tSoftware Id:\t\t0x%08x\n", m_softwareId ); 
     374    printf( "\tHardware ID:\t\t0x%08x\n", m_hardwareId ); 
     375    printf( "\tVendor OUI:\t\t0x%08x\n", m_vendorOUI ); 
    366376    printf( "\tImage Offset:\t\t0x%08x\n", m_imageOffset ); 
    367377    printf( "\tImage Base Address:\t0x%08x\n", m_imageBaseAddress ); 
  • branches/libfreebob-downloader/src/bebob/bebob_dl_bcd.h

    r271 r276  
    4646        fb_quadlet_t getSoftwareVersion() const 
    4747            { return m_softwareVersion; } 
    48  
     48        fb_quadlet_t getHardwareId() const 
     49            { return m_hardwareId; } 
     50        fb_quadlet_t getVendorOUI() const 
     51            { return m_vendorOUI; } 
     52         
    4953        fb_quadlet_t getImageBaseAddress() const 
    5054            { return m_imageBaseAddress; } 
     
    8690        fb_quadlet_t m_softwareId; 
    8791        fb_quadlet_t m_softwareVersion; 
     92        fb_quadlet_t m_hardwareId; 
     93        fb_quadlet_t m_vendorOUI; 
     94             
    8895 
    8996        fb_quadlet_t m_imageBaseAddress; 
  • branches/libfreebob-downloader/src/bebob/bebob_dl_codes.cpp

    r271 r276  
    170170    bool result = CommandCodes::serialize( se ); 
    171171 
    172     fb_quadlet_t tmp; 
    173172    result &= se.write( m_object,  "CommandCodesDownloadStart: object" ); 
    174     tmp = m_date >> 32; 
    175     result &= se.write( tmp,       "CommandCodesDownloadStart: date high" ); 
    176     tmp = m_date & 0xffffffff
    177     result &= se.write( tmp,       "CommandCodesDownloadStart: date low" ); 
    178     tmp = m_time >> 32; 
    179     result &= se.write( tmp   ,    "CommandCodesDownloadStart: time high" ); 
    180     tmp = m_time & 0xffffffff
    181     result &= se.write( tmp,       "CommandCodesDownloadStart: time low" ); 
     173    for (  unsigned int i = 0; i < sizeof( m_date ); ++i ) { 
     174        fb_byte_t* tmp = ( fb_byte_t* )( &m_date ); 
     175        result &= se.write( tmp[i], "CommandCodesDownloadStart: date" )
     176    } 
     177    for (  unsigned int i = 0; i < sizeof( m_date ); ++i ) { 
     178        fb_byte_t* tmp = ( fb_byte_t* )( &m_time ); 
     179        result &= se.write( tmp[i], "CommandCodesDownloadStart: time" )
     180    } 
    182181    result &= se.write( m_id,      "CommandCodesDownloadStart: id" ); 
    183182    result &= se.write( m_version, "CommandCodesDownloadStart: version" ); 
     
    315314} 
    316315 
     316//////////////////////////////// 
     317 
     318BeBoB::CommandCodesGo::CommandCodesGo( fb_quadlet_t protocolVersion, 
     319                                             EStartMode startMode ) 
     320    : CommandCodes( protocolVersion, eCmdC_Go, sizeof( m_startMode ), 1, 1 ) 
     321    , m_startMode( startMode ) 
     322{ 
     323} 
     324 
     325BeBoB::CommandCodesGo::~CommandCodesGo() 
     326{ 
     327} 
     328 
     329bool 
     330BeBoB::CommandCodesGo::serialize( IOSSerialize& se ) 
     331{ 
     332    bool result = CommandCodes::serialize( se ); 
     333    result &= se.write( m_startMode, "CommandCodesGo: start mode" ); 
     334 
     335    return result; 
     336} 
     337 
     338bool 
     339BeBoB::CommandCodesGo::deserialize( IISDeserialize& de ) 
     340{ 
     341    bool result = CommandCodes::deserialize( de ); 
     342    result &= de.read( &m_resp_validCRC ); 
     343 
     344    return result; 
     345} 
  • branches/libfreebob-downloader/src/bebob/bebob_dl_codes.h

    r271 r276  
    279279    }; 
    280280 
     281    ///////////////////////// 
     282 
     283    class CommandCodesGo : public CommandCodes { 
     284    public: 
     285        enum EStartMode { 
     286            eSM_Application = 0, 
     287            eSM_Debugger = 2, 
     288        }; 
     289 
     290        CommandCodesGo( fb_quadlet_t protocolVersion, EStartMode startMode ); 
     291        virtual ~CommandCodesGo(); 
     292 
     293        virtual bool serialize( IOSSerialize& se ); 
     294        virtual bool deserialize( IISDeserialize& de ); 
     295 
     296        EStartMode getStartMode() const 
     297            { return static_cast<EStartMode>( m_startMode ); } 
     298        bool setStartMode( EStartMode startMode ) 
     299            { m_startMode = startMode; return true; } 
     300 
     301        fb_quadlet_t getRespIsValidCRC() const 
     302            { return m_resp_validCRC; } 
     303 
     304    private: 
     305        fb_quadlet_t m_startMode; 
     306        fb_quadlet_t m_resp_validCRC; 
     307    }; 
     308 
     309 
     310 
    281311}; 
    282312#endif 
  • branches/libfreebob-downloader/src/bebob/bebob_dl_mgr.cpp

    r271 r276  
    7676    memset( &m_cachedInfoRegs, 0, sizeof( m_cachedInfoRegs ) ); 
    7777 
    78     m_configRom = new ConfigRom( m_ieee1394service, nodeId ); 
     78    m_configRom = new ConfigRom( *m_ieee1394service, nodeId ); 
    7979    // XXX throw exception if initialize fails! 
    8080    m_configRom->initialize(); 
     
    214214    using namespace std; 
    215215 
     216    printf( "parse BCD file\n" ); 
    216217    std::auto_ptr<BCD> bcd = std::auto_ptr<BCD>( new BCD( filename ) ); 
    217218    if ( !bcd.get() ) { 
     
    220221        return false; 
    221222    } 
    222  
    223223    if ( !bcd->parse() ) { 
    224224        debugError( "downloadFirmware: BCD parsing failed\n" ); 
     
    226226    } 
    227227 
     228    printf( "prepare for download (start bootloader)\n" ); 
    228229    if ( !startBootloaderCmd() ) { 
    229230        debugError( "downloadFirmware: Could not start bootloader\n" ); 
    230231        return false; 
    231232    } 
    232     waitForBusReset(); 
    233     if ( !cacheInfoRegisters( MaxRetries ) ) { 
    234         debugError( "downloadFirmware: Could not read info registers\n" ); 
    235         return false; 
    236     } 
    237  
    238     // wait for bootloader finish startup sequence 
    239     // there is no way to find out when it has finished 
    240     sleep( 10 ); 
    241  
     233 
     234    printf( "start downloading protocol for application image\n" ); 
    242235    if ( !downloadObject( *bcd, eOT_Application ) ) { 
    243236        debugError( "downloadFirmware: Firmware download failed\n" ); 
     
    245238    } 
    246239 
     240    printf( "start downloading protocol for CnE\n" ); 
    247241    if ( !downloadObject( *bcd, eOT_CnE ) ) { 
    248242        debugError( "downloadFirmware: CnE download failed\n" ); 
     
    250244    } 
    251245 
    252     sleep( 5 ); 
    253  
    254     // Let's try to start the image in any case... 
     246    printf( "setting CnE to factory default settings\n" ); 
     247    if ( !initializeConfigToFactorySettingCmd() ) { 
     248        debugError( "downloadFirmware: Could not reinitalize CnE\n" ); 
     249        return false; 
     250    } 
     251 
     252    printf( "start application\n" ); 
    255253    if ( !startApplicationCmd() ) { 
    256254        debugError( "downloadFirmware: Could not restart application\n" ); 
     
    266264    using namespace std; 
    267265 
     266    printf( "parse BCD file\n" ); 
    268267    std::auto_ptr<BCD> bcd = std::auto_ptr<BCD>( new BCD( filename ) ); 
    269268    if ( !bcd.get() ) { 
     
    272271        return false; 
    273272    } 
    274  
    275273    if ( !bcd->parse() ) { 
    276274        debugError( "downloadCnE: BCD parsing failed\n" ); 
     
    278276    } 
    279277 
     278    printf( "prepare for download (start bootloader)\n" ); 
    280279    if ( !startBootloaderCmd() ) { 
    281280        debugError( "downloadCnE: Could not start bootloader\n" ); 
    282281        return false; 
    283282    } 
    284     waitForBusReset(); 
    285     if ( !cacheInfoRegisters( MaxRetries ) ) { 
    286         debugError( "downloadCnE: Could not read info registers\n" ); 
    287         return false; 
    288     } 
    289  
    290     // wait for bootloader finish startup sequence 
    291     // there is no way to find out when it has finished 
    292     sleep( 10 ); 
    293  
    294     get1394Serivce()->setVerbose( true ); 
    295  
     283 
     284    printf( "start downloading protocol for CnE\n" ); 
    296285    if ( !downloadObject( *bcd, eOT_CnE ) ) { 
    297286        debugError( "downloadCnE: CnE download failed\n" ); 
     
    299288    } 
    300289 
     290    printf( "setting CnE to factory default settings\n" ); 
    301291    if ( !initializeConfigToFactorySettingCmd() ) { 
    302         debugError( "downloadCnE: Setting default config " 
    303                     "settings failed\n" ); 
    304         return false; 
    305     } 
    306  
    307     sleep( 5 ); 
    308  
    309     // Let's try to start the image in any case... 
     292        debugError( "downloadFirmware: Could not reinitalize CnE\n" ); 
     293        return false; 
     294    } 
     295 
     296    printf( "start application\n" ); 
    310297    if ( !startApplicationCmd() ) { 
    311298        debugError( "downloadCnE: Could not restart application\n" ); 
     
    363350    // bootloader erases the flash, have to wait until is ready 
    364351    // to answer our next request 
     352    printf( "wait unitl flash ereasing has terminated\n" ); 
    365353    sleep( 20 ); 
    366354 
     
    380368    fb_quadlet_t address = 0; 
    381369    bool result = true; 
    382     int nrBlocks = ( imageLength + maxBlockSize - 1 ) / maxBlockSize; 
     370    int totalBytes = imageLength; 
     371    int downloadedBytes = 0; 
    383372    while ( imageLength > 0 ) { 
    384373        unsigned int blockSize = imageLength > maxBlockSize ? 
     
    412401            break; 
    413402        } 
    414         usleep( 1000 ); 
     403        usleep( 100 ); 
    415404 
    416405        if ( !readResponse( ccBlock ) ) { 
     
    434423        } 
    435424 
    436         if ( ( i % 1000 ) == 0 ) { 
    437            printf( "[%04d/%04d] packets downloaded\n", i, nrBlocks ); 
     425        downloadedBytes += blockSize; 
     426        if ( ( i % 100 ) == 0 ) { 
     427           printf( "%10d/%d bytes downloaded\n", 
     428                   downloadedBytes, totalBytes ); 
    438429        } 
    439430 
     
    443434        i++; 
    444435    } 
     436    printf( "%10d/%d bytes downloaded\n", 
     437            downloadedBytes, totalBytes ); 
    445438 
    446439    if ( !result ) { 
     
    456449    } 
    457450 
     451    printf( "wait for transaction completion\n" ); 
    458452    sleep( 10 ); 
    459453 
     
    478472        } 
    479473    } 
     474    printf( "download protocol successfuly completed\n" ); 
    480475    return result; 
    481476} 
     
    488483        return false; 
    489484    } 
    490  
    491     waitForBusReset(); 
    492     if ( !cacheInfoRegisters( MaxRetries ) ) { 
    493         debugError( "programGUID: Could not read info registers\n" ); 
    494         return false; 
    495     } 
    496  
    497     // wait for bootloader finish startup sequence 
    498     // there is no way to find out when it has finished 
    499     sleep( 10 ); 
    500485 
    501486    if ( !programGUIDCmd( guid ) ) { 
     
    609594    } 
    610595 
     596    waitForBusReset(); 
     597    if ( !cacheInfoRegisters( MaxRetries ) ) { 
     598        debugError( "startBootloaderCmd: Could not read info registers\n" ); 
     599        return false; 
     600    } 
     601 
     602    // wait for bootloader finish startup sequence 
     603    // there is no way to find out when it has finished 
     604    sleep( 10 ); 
     605 
    611606    return true; 
    612607} 
     
    615610BeBoB::BootloaderManager::startApplicationCmd() 
    616611{ 
    617     CommandCodesReset cmd( m_protocolVersion, 
    618                            CommandCodesReset::eSM_Application ) ; 
     612    CommandCodesGo cmd( m_protocolVersion, 
     613                           CommandCodesGo::eSM_Application ) ; 
    619614    if ( !writeRequest( cmd ) ) { 
    620615        debugError( "startApplicationCmd: writeRequest failed\n" ); 
     
    634629    } 
    635630 
     631    sleep( 1 ); 
     632 
    636633    return true; 
    637634} 
     
    646643    } 
    647644 
     645    sleep( 1 ); 
     646 
    648647    return true; 
    649648} 
     
    658657    } 
    659658 
    660     return true; 
    661 
     659    sleep( 5 ); 
     660 
     661    return true; 
     662
  • branches/libfreebob-downloader/src/bounce/bounce_avdevice.cpp

    r241 r276  
    4747    debugOutput( DEBUG_LEVEL_VERBOSE, "Created Bounce::BounceDevice (NodeID %d)\n", 
    4848                 nodeId ); 
    49     m_configRom = new ConfigRom( m_1394Service, m_nodeId ); 
     49    m_configRom = new ConfigRom( *m_1394Service, m_nodeId ); 
    5050    m_configRom->initialize(); 
    5151} 
  • branches/libfreebob-downloader/src/configrom.cpp

    r271 r276  
    3030using namespace std; 
    3131 
    32 IMPL_DEBUG_MODULE( ConfigRom, ConfigRom, DEBUG_LEVEL_NORMAL ); 
     32IMPL_DEBUG_MODULE( ConfigRom, ConfigRom, DEBUG_LEVEL_VERBOSE ); 
    3333 
    3434static int busRead( struct csr1212_csr* csr, 
     
    5555//------------------------------------------------------------- 
    5656 
    57 ConfigRom::ConfigRom( Ieee1394Service* ieee1394service, fb_nodeid_t nodeId ) 
    58     : m_1394Service( ieee1394service ) 
     57ConfigRom::ConfigRom( Ieee1394Service& ieee1394service, fb_nodeid_t nodeId ) 
     58    : m_1394Service( &ieee1394service ) 
    5959    , m_nodeId( nodeId ) 
    6060    , m_avcDevice( false ) 
     
    103103 
    104104    // Process Bus_Info_Block 
    105     m_isIsoResourceManager = m_csr->bus_info_data[2] >> 31; 
    106     m_isCycleMasterCapable = ( m_csr->bus_info_data[2] >> 30 ) & 0x1; 
    107     m_isSupportIsoOperations = ( m_csr->bus_info_data[2] >> 29 ) & 0x1; 
    108     m_isBusManagerCapable = ( m_csr->bus_info_data[2] >> 28 ) & 0x1; 
    109     m_cycleClkAcc = ( m_csr->bus_info_data[2] >> 16 ) & 0xff; 
    110     m_maxRec = ( m_csr->bus_info_data[2] >> 12 ) & 0xf; 
    111     m_nodeVendorId = ( m_csr->bus_info_data[3] >> 8 ); 
    112     m_chipIdHi = ( m_csr->bus_info_data[3] ) & 0xff; 
    113     m_chipIdLow = m_csr->bus_info_data[4]
     105    m_isIsoResourceManager = CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 31; 
     106    m_isCycleMasterCapable = ( CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 30 ) & 0x1; 
     107    m_isSupportIsoOperations = ( CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 29 ) & 0x1; 
     108    m_isBusManagerCapable = ( CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 28 ) & 0x1; 
     109    m_cycleClkAcc = ( CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 16 ) & 0xff; 
     110    m_maxRec = ( CSR1212_BE32_TO_CPU( m_csr->bus_info_data[2] ) >> 12 ) & 0xf; 
     111    m_nodeVendorId = ( CSR1212_BE32_TO_CPU( m_csr->bus_info_data[3] ) >> 8 ); 
     112    m_chipIdHi = ( CSR1212_BE32_TO_CPU( m_csr->bus_info_data[3] ) ) & 0xff; 
     113    m_chipIdLow = CSR1212_BE32_TO_CPU( m_csr->bus_info_data[4] )
    114114 
    115115    // Process Root Directory 
     
    173173} 
    174174 
    175 const bool 
    176 ConfigRom::isAvcDevice() const 
    177 { 
    178     return m_avcDevice; 
    179 } 
    180  
    181 // XXX This might work only for the M-Audio Audiophile 
    182 // but can easily extended. 
    183 #define VENDOR_ID_MAUDIO    0x00000d6c 
    184 #define MODEL_ID_MAUDIO_BOOTLOADER 0x00010060 
    185  
    186 const bool 
    187 ConfigRom::isBootloader() const 
    188 { 
    189     if ( ( m_vendorId == VENDOR_ID_MAUDIO ) 
    190          && ( m_modelId == MODEL_ID_MAUDIO_BOOTLOADER ) ) 
    191     { 
    192         return true; 
    193     } 
    194     return false; 
    195 } 
    196  
    197175static int 
    198176busRead( struct csr1212_csr* csr, 
     
    434412{ 
    435413    using namespace std; 
    436     cout << "Config ROM" << endl; 
    437     cout << "\tCurrent Node Id:\t" << getNodeId() << endl; 
    438     cout << "\tGUID:\t\t\t0x" << setfill( '0' ) << setw( 16 ) << hex << getGuid() << endl; 
    439     cout << "\tVendor Name:\t\t" << getVendorName() << endl; 
    440     cout << "\tModel Name:\t\t" << getModelName() << endl; 
     414    printf( "Config ROM\n" ); 
     415    printf( "\tCurrent Node Id:\t%d\n",       getNodeId() ); 
     416    printf( "\tGUID:\t\t\t0x%08x%08x\n", 
     417            ( unsigned int )( getGuid() >> 32 ), 
     418            ( unsigned int ) ( getGuid() & 0xffffffff ) ); 
     419    printf( "\tVendor Name:\t\t%s\n",         getVendorName().c_str() ); 
     420    printf( "\tModel Name:\t\t%s\n",          getModelName().c_str() ); 
     421    printf( "\tNode Vendor ID:\t\t0x%06x\n",  getNodeVendorId() ); 
     422    printf( "\tModel Id:\t\t0x%08x\n",        getModelId() ); 
     423    printf( "\tISO resource manager:\t%d\n",  isIsoResourseManager() ); 
     424    printf( "\tCycle master capable:\t%d\n",  isSupportsIsoOperations() ); 
     425    printf( "\tBus manager capable:\t%d\n",   isBusManagerCapable() ); 
     426    printf( "\tCycle clock accurancy:\t%d\n", getCycleClockAccurancy() ); 
     427    printf( "\tMax rec:\t\t%d (max asy payload: %d bytes)\n", 
     428            getMaxRec(), getAsyMaxPayload() ); 
    441429} 
    442430 
     
    444432ConfigRom::getAsyMaxPayload() const 
    445433{ 
    446     // XXX use pow instead 
     434    // XXX use pow instead? 
    447435    return 1 << ( m_maxRec + 1 ); 
    448436} 
  • branches/libfreebob-downloader/src/configrom.h

    r271 r276  
    3333class ConfigRom { 
    3434 public: 
    35     ConfigRom( Ieee1394Service* ieee1394service, fb_nodeid_t nodeId ); 
     35    ConfigRom( Ieee1394Service& ieee1394service, fb_nodeid_t nodeId ); 
    3636    virtual ~ConfigRom(); 
    3737 
    3838    bool initialize(); 
    3939 
    40     const bool isAvcDevice() const; 
    41     const bool isBootloader() const; 
    4240    const fb_nodeid_t getNodeId() const; 
    4341    const fb_octlet_t getGuid() const; 
     
    5755        { return m_maxRec; } 
    5856    unsigned short getAsyMaxPayload() const; 
     57 
     58    fb_quadlet_t getNodeVendorId() const 
     59        { return m_nodeVendorId; } 
     60    unsigned int getModelId() const 
     61        { return m_modelId; } 
    5962 
    6063    bool updatedNodeId(); 
     
    8386    fb_byte_t        m_cycleClkAcc; 
    8487    fb_byte_t        m_maxRec; 
    85     unsigned short   m_nodeVendorId; 
     88    fb_quadlet_t     m_nodeVendorId; 
    8689    fb_byte_t        m_chipIdHi; 
    8790    fb_quadlet_t     m_chipIdLow; 
  • branches/libfreebob-downloader/src/devicemanager.cpp

    r241 r276  
    1 /* devicemanager.cpp 
     1 /* devicemanager.cpp 
    22 * Copyright (C) 2005,06 by Daniel Wagner 
    33 * 
     
    2828#include "debugmodule/debugmodule.h" 
    2929#include "bebob/bebob_avdevice.h" 
    30 #include "bebob_light/bebob_light_avdevice.h" 
    3130#include "bounce/bounce_avdevice.h" 
    3231 
     
    4039    : m_1394Service( 0 ) 
    4140{ 
    42     m_probeList.push_back( probeBeBoB ); 
    43     // m_probeList.push_back( probeBounce ); 
    4441} 
    4542 
     
    9390          ++nodeId ) 
    9491    { 
    95         ConfigRom configRom( m_1394Service, nodeId ); 
    96         if ( !configRom.initialize() ) { 
    97             // \todo If a PHY on the bus in power safe mode than 
     92        std::auto_ptr<ConfigRom> configRom = 
     93            std::auto_ptr<ConfigRom>( new ConfigRom( *m_1394Service, 
     94                                                     nodeId ) ); 
     95        if ( !configRom->initialize() ) { 
     96            // \todo If a PHY on the bus is in power safe mode then 
    9897            // the config rom is missing. So this might be just 
    99             // such a case and we can safely skip it. But it might 
     98            // such this case and we can safely skip it. But it might 
    10099            // be there is a real software problem on our side. 
    101100            // This should be handled more carefuly. 
     
    107106        } 
    108107 
    109         if ( !configRom.isAvcDevice() ) { 
    110             continue; 
    111         } 
    112  
    113         for ( ProbeFunctionVector::iterator it = m_probeList.begin(); 
    114               it != m_probeList.end(); 
    115               ++it ) 
    116         { 
    117             ProbeFunction func = *it; 
    118             IAvDevice* avDevice = func(*m_1394Service, nodeId, verboseLevel); 
    119             if ( avDevice ) { 
    120                 m_avDevices.push_back( avDevice ); 
    121  
    122                 if ( !avDevice->setId( m_avDevices.size() ) ) { 
    123                     debugError( "setting Id failed\n" ); 
    124                 } 
    125                 if ( verboseLevel ) { 
    126                     avDevice->showDevice(); 
    127                 } 
    128                 break; 
     108        configRom->printConfigRom(); 
     109        IAvDevice* avDevice = getDriverForDevice( configRom, 
     110                                                  nodeId, 
     111                                                  verboseLevel ); 
     112        if ( avDevice ) { 
     113            debugOutput( DEBUG_LEVEL_NORMAL, 
     114                         "discover: driver found for device %d\n", 
     115                         nodeId ); 
     116 
     117            if ( !avDevice->discover() ) { 
     118                debugError( "discover: could not discover device\n" ); 
     119                delete avDevice; 
     120                continue; 
    129121            } 
    130         } 
    131  
     122 
     123            if ( !avDevice->setId( m_avDevices.size() ) ) { 
     124                debugError( "setting Id failed\n" ); 
     125            } 
     126            if ( verboseLevel ) { 
     127                avDevice->showDevice(); 
     128            } 
     129 
     130            m_avDevices.push_back( avDevice ); 
     131        } 
    132132    } 
    133133 
     
    137137 
    138138IAvDevice* 
    139 DeviceManager::probeBeBoB(Ieee1394Service& service, int id, int level) 
    140 
    141     IAvDevice* avDevice = new BeBoB_Light::AvDevice( service, id, level ); 
    142     if ( !avDevice ) { 
    143         return 0; 
    144     } 
    145  
    146     if ( !avDevice->discover() ) { 
    147         delete avDevice; 
    148         return 0; 
    149     } 
    150     return avDevice; 
    151 
    152  
    153 IAvDevice* 
    154 DeviceManager::probeBounce(Ieee1394Service& service, int id, int level) 
    155 
    156     IAvDevice* avDevice = new Bounce::BounceDevice( service, id, level ); 
    157     if ( !avDevice ) { 
    158         return 0; 
    159     } 
    160  
    161     if ( !avDevice->discover() ) { 
    162         delete avDevice; 
    163         return 0; 
    164     } 
    165     return avDevice; 
     139DeviceManager::getDriverForDevice( std::auto_ptr<ConfigRom>( configRom ), 
     140                                   int id,  int level ) 
     141
     142    if ( BeBoB::AvDevice::probe( *configRom.get() ) ) { 
     143        return new BeBoB::AvDevice( configRom, *m_1394Service, id, level ); 
     144    } 
     145 
     146    return 0; 
    166147} 
    167148 
  • branches/libfreebob-downloader/src/devicemanager.h

    r241 r276  
    3434typedef std::vector< IAvDevice* >::iterator IAvDeviceVectorIterator; 
    3535 
    36 typedef IAvDevice* (*ProbeFunction)(Ieee1394Service&, int, int); 
    37 typedef std::vector<ProbeFunction> ProbeFunctionVector; 
    38 typedef std::vector<ProbeFunction>::iterator ProbeFunctionVectorIterator; 
     36class ConfigRom; 
    3937 
    4038class DeviceManager{ 
     
    5755 
    5856protected: 
    59     static IAvDevice* probeBeBoB(Ieee1394Service& service, int id, int level); 
    60     static IAvDevice* probeBounce(Ieee1394Service& service, int id, int level); 
     57    IAvDevice* getDriverForDevice( std::auto_ptr<ConfigRom>( configRom ), 
     58                                   int id, 
     59                                   int level ); 
    6160 
    6261protected: 
    6362    Ieee1394Service* m_1394Service; 
    6463    IAvDeviceVector  m_avDevices; 
    65     ProbeFunctionVector m_probeList; 
    6664 
    6765    DECLARE_DEBUG_MODULE;