Changeset 1410

Show
Ignore:
Timestamp:
11/02/08 02:33:07 (12 years ago)
Author:
ppalmers
Message:

- Fix stupid bug in clock source selection
- (try to) Fix sample rate selection (nodeid was not updated, therefore wrong id could be used)
- Implement 'direct register access' control

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libffado-2.0/src/bebob/focusrite/focusrite_saffirepro.cpp

    r1406 r1410  
    312312    result &= m_ControlContainer->addElement(m_deviceNameControl); 
    313313 
     314    // add a direct register access element 
     315    result &= addElement(new RegisterControl(*this, "Register", "Register Access", "Direct register access")); 
     316 
    314317    if (!result) { 
    315318        debugWarning("One or more device control elements could not be created."); 
     
    422425    debugOutput(DEBUG_LEVEL_VERBOSE, "SYNC_CONFIG field value: %08lX\n", sync ); 
    423426 
    424     switch(sync & 0xFF) { 
     427    switch(sync & FR_SAFFIREPRO_CMD_ID_SYNC_CONFIG_MASK) { 
    425428        default: 
    426429            debugWarning( "Unexpected SYNC_CONFIG field value: %08lX\n", sync ); 
     
    434437            break; 
    435438        case FR_SAFFIREPRO_CMD_SYNC_CONFIG_ADAT1: 
     439            m_adat1_clocksource.active=true; 
     440            m_active_clocksource = &m_adat1_clocksource; 
     441            break; 
     442        case FR_SAFFIREPRO_CMD_SYNC_CONFIG_ADAT2: 
     443            m_adat2_clocksource.active=true; 
     444            m_active_clocksource = &m_adat2_clocksource; 
     445            break; 
     446        case FR_SAFFIREPRO_CMD_SYNC_CONFIG_WORDCLOCK: 
    436447            m_wordclock_clocksource.active=true; 
    437448            m_active_clocksource = &m_wordclock_clocksource; 
    438449            break; 
    439         case FR_SAFFIREPRO_CMD_SYNC_CONFIG_ADAT2: 
    440             m_adat1_clocksource.active=true; 
    441             m_active_clocksource = &m_adat1_clocksource; 
    442             break; 
    443         case FR_SAFFIREPRO_CMD_SYNC_CONFIG_WORDCLOCK: 
    444             m_adat2_clocksource.active=true; 
    445             m_active_clocksource = &m_adat2_clocksource; 
    446             break; 
    447     } 
    448     switch((sync >> 8) & 0xFF) { 
     450    } 
     451    switch((sync && FR_SAFFIREPRO_CMD_ID_SYNC_LOCK_MASK) >> 8) { 
    449452        case FR_SAFFIREPRO_CMD_SYNC_CONFIG_INTERNAL: 
    450453            // always locked 
     
    454457            break; 
    455458        case FR_SAFFIREPRO_CMD_SYNC_CONFIG_ADAT1: 
    456             m_wordclock_clocksource.locked=true; 
     459            m_adat1_clocksource.locked=true; 
    457460            break; 
    458461        case FR_SAFFIREPRO_CMD_SYNC_CONFIG_ADAT2: 
    459             m_adat1_clocksource.locked=true; 
     462            m_adat2_clocksource.locked=true; 
    460463            break; 
    461464        case FR_SAFFIREPRO_CMD_SYNC_CONFIG_WORDCLOCK: 
    462             m_adat2_clocksource.locked=true; 
     465            m_wordclock_clocksource.locked=true; 
    463466            break; 
    464467        default: 
     
    513516    } 
    514517    return r; 
     518} 
     519 
     520std::vector<int> 
     521SaffireProDevice::getSupportedSamplingFrequencies() 
     522{ 
     523    std::vector<int> frequencies; 
     524    frequencies.push_back(44100); 
     525    frequencies.push_back(48000); 
     526    frequencies.push_back(88200); 
     527    frequencies.push_back(96000); 
     528    frequencies.push_back(176400); 
     529    frequencies.push_back(192000); 
     530    return frequencies; 
    515531} 
    516532 
     
    697713 
    698714                    // the device needs quite some time to reboot 
    699                     Util::SystemTimeSource::SleepUsecRelative(2 * 1000 * 1000); 
     715                    Util::SystemTimeSource::SleepUsecRelative(6 * 1000 * 1000); 
    700716 
    701717                    // wait for the device to finish the reboot 
     
    727743                Util::SystemTimeSource::SleepUsecRelative(1 * 1000 * 1000); 
    728744 
     745                // update the generation of the 1394 service 
     746                get1394Service().updateGeneration(); 
     747 
     748                // update our config rom since it might have changed 
     749                // if this fails it means we have disappeared from the bus 
     750                // that's bad. 
     751                if(!getConfigRom().updatedNodeId()) { 
     752                    debugError("Could not update node id\n"); 
     753                    getDeviceManager().unlockBusResetHandler(); 
     754                    return false; 
     755                } 
     756 
    729757                // we have to rediscover the device 
    730758                if (discover()) break; 
     
    754782            return false; 
    755783        } 
    756  
    757784        return true; 
    758785    } 
    759786    // not executable 
    760787    return false; 
    761  
    762788} 
    763789 
  • branches/libffado-2.0/src/bebob/focusrite/focusrite_saffirepro.h

    r1406 r1410  
    168168#define FR_SAFFIREPRO_CMD_ID_USING_HIGHVOLTAGE_RAIL 92 
    169169 
     170#define FR_SAFFIREPRO_CMD_ID_SYNC_CONFIG_MASK  0x000000FF 
     171#define FR_SAFFIREPRO_CMD_ID_SYNC_LOCK_MASK    0x0000FF00 
    170172#define FR_SAFFIREPRO_CMD_ID_SYNC_CONFIG            93 
    171173#define FR_SAFFIREPRO_CMD_SYNC_CONFIG_INTERNAL       0 
     
    363365    virtual bool setSamplingFrequency( int ); 
    364366    virtual int getSamplingFrequency( ); 
     367    virtual std::vector<int> getSupportedSamplingFrequencies(); 
    365368 
    366369    virtual bool buildMixer();