Changeset 1606

Show
Ignore:
Timestamp:
07/25/09 06:58:45 (14 years ago)
Author:
jwoithe
Message:

RME: phantom switches in mixer GUI now control the respective Fireface hardware. Tested only on FF400 to date.
RME: add some more TCO glue.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/rme/fireface_hw.cpp

    r1599 r1606  
    6464    m_dds_freq = 0; 
    6565 
    66     return set_hardware_params(&settings); 
     66    if (set_hardware_params(&settings) != 0) 
     67        return -1; 
     68 
     69    // Also configure the TCO (Time Code Option) settings for those devices 
     70    // which have a TCO. 
     71    if (tco_present) { 
     72        memset(&tco_settings, 0, sizeof(tco_settings)); 
     73        return write_tco_settings(&tco_settings); 
     74    } 
     75 
     76    return 0; 
    6777} 
    6878 
     
    345355//This is just for testing - it's a known consistent configuration 
    346356//data[0] = 0x00020811;      // Phantom off 
    347 data[0] = 0x00020811;      // Phantom on 
    348 data[1] = 0x0000031e; 
    349 data[2] = 0xc400101f; 
     357//data[0] = 0x00020811;      // Phantom on 
     358//data[1] = 0x0000031e; 
     359//data[2] = 0xc400101f; 
     360    debugOutput(DEBUG_LEVEL_VERBOSE, "set hardware registers: 0x%08x 0x%08x 0x%08x\n", 
     361      data[0], data[1], data[2]); 
    350362 
    351363    conf_reg = (m_rme_model==RME_MODEL_FIREFACE800)?RME_FF800_CONF_REG:RME_FF400_CONF_REG; 
  • trunk/libffado/src/rme/fireface_settings_ctrls.cpp

    r1600 r1606  
    8181                    unsigned int on = (v & (0x00000001 << i)) != 0; 
    8282                    err = m_parent.setPhantom(i, on); 
    83                     if (!err && on) { 
    84                         m_value |= (0x01 << i); 
    85                     } else { 
    86                         m_value &= ~(0x01 << i); 
     83                    if (!err) { 
     84                        if (on) { 
     85                            m_value |= (0x01 << i); 
     86                        } else { 
     87                            m_value &= ~(0x01 << i); 
     88                        } 
    8789                    } 
    8890                } 
     
    9395        // set these. 
    9496        case RME_CTRL_INFO_MODEL: 
     97        case RME_CTRL_INFO_TCO_PRESENT: 
    9598            debugOutput(DEBUG_LEVEL_ERROR, "Attempt to set readonly info control 0x%08x\n", m_type); 
    9699            err = 1; 
     
    108111RmeSettingsCtrl::getValue() { 
    109112 
     113signed int i; 
     114signed int val = 0; 
     115 
    110116    switch (m_type) { 
    111117        case RME_CTRL_NONE: 
     
    114120 
    115121        case RME_CTRL_PHANTOM_SW: 
    116             return m_value; 
     122            for (i=0; i<3; i++) 
     123                val |= (m_parent.getPhantom(i) << i); 
     124            return val; 
    117125            break; 
    118126 
     
    120128            return m_parent.getRmeModel(); 
    121129            break; 
     130 
     131        case RME_CTRL_INFO_TCO_PRESENT: 
     132            return m_parent.getTcoPresent(); 
    122133 
    123134        default: 
  • trunk/libffado/src/rme/fireface_settings_ctrls.h

    r1605 r1606  
    4747 
    4848#define RME_CTRL_INFO_MODEL            0x0100 
     49#define RME_CTRL_INFO_TCO_PRESENT      0x0200 
    4950 
    5051class Device; 
     
    6970    unsigned int m_type; 
    7071    unsigned int m_value, m_info; 
     72 
    7173}; 
    7274 
  • trunk/libffado/src/rme/rme_avdevice.cpp

    r1605 r1606  
    8989    , samples_per_packet( 0 ) 
    9090    , speed800( 0 ) 
     91    , m_MixerContainer( NULL ) 
     92    , m_ControlContainer( NULL ) 
    9193{ 
    9294    debugOutput( DEBUG_LEVEL_VERBOSE, "Created Rme::Device (NodeID %d)\n", 
    9395                 getConfigRom().getNodeId() ); 
     96    memset(&settings, 0, sizeof(settings)); 
     97    memset(&tco_settings, 0, sizeof(tco_settings)); 
    9498} 
    9599 
     
    114118        return false; 
    115119    } 
     120 
     121    result &= m_ControlContainer->addElement( 
     122        new RmeSettingsCtrl(*this, RME_CTRL_INFO_MODEL, 0, 
     123            "Model", "Model ID", "")); 
     124    result &= m_ControlContainer->addElement( 
     125        new RmeSettingsCtrl(*this, RME_CTRL_INFO_TCO_PRESENT, 0, 
     126            "TCO_present", "TCO is present", "")); 
    116127 
    117128    result &= m_ControlContainer->addElement( 
     
    230241        tco_present = (read_tco(NULL, 0) == 0); 
    231242    } 
     243    debugOutput(DEBUG_LEVEL_VERBOSE, "TCO present: %s\n", 
     244      tco_present?"yes":"no"); 
    232245 
    233246    // Find out the device's streaming status 
  • trunk/libffado/src/rme/rme_avdevice.h

    r1605 r1606  
    9393 
    9494    /* Device control functions */ 
     95    signed int getPhantom(unsigned int channel); 
    9596    signed int setPhantom(unsigned int channel, unsigned int status); 
    9697 
    9798    /* General information functions */ 
    9899    signed int getRmeModel(void) { return m_rme_model; } 
     100    signed int getTcoPresent(void) { return tco_present; } 
    99101 
    100102protected: 
     
    107109    signed int tco_present; 
    108110    FF_software_settings_t settings; 
     111    FF_TCO_settings_t tco_settings; 
    109112 
    110113    signed int num_channels; 
  • trunk/libffado/src/rme/rme_avdevice_settings.cpp

    r1599 r1606  
    2929 
    3030signed int 
     31Device::getPhantom(unsigned int channel) { 
     32 
     33    if (channel > 3) { 
     34        debugOutput(DEBUG_LEVEL_WARNING, "Channel %d phantom power not supported\n", channel); 
     35        return -1; 
     36    } 
     37 
     38    return settings.mic_phantom[channel] != 0; 
     39} 
     40 
     41signed int 
    3142Device::setPhantom(unsigned int channel, unsigned int status) { 
    3243 
  • trunk/libffado/support/mixer-qt4/mixer_rme.py

    r1602 r1606  
    4242    def init(self): 
    4343 
     44        self.PhantomSwitches={ 
     45            self.phantom_0: ['/Control/Phantom', 0], 
     46            self.phantom_1: ['/Control/Phantom', 1], 
     47            self.phantom_2: ['/Control/Phantom', 2], 
     48            self.phantom_3: ['/Control/Phantom', 3], 
     49        } 
     50 
    4451        # Other mixer variables 
    4552        self.is_streaming = 0 
    4653        self.sample_rate = 0 
    4754        self.model = 0 
     55        self.tco_present = 0 
     56 
     57    # Public slot: update phantom power hardware switchs 
     58    def updatePhantomSwitch(self, a0): 
     59        sender = self.sender() 
     60        # Value is the phantom switch value, with a corresponding enable 
     61        # bit in the high 16 bit word 
     62        val = (a0 << self.PhantomSwitches[sender][1]) | (0x00010000 << self.PhantomSwitches[sender][1]) 
     63        log.debug("phantom switch %d set to %d" % (self.PhantomSwitches[sender][1], a0)) 
     64        self.hw.setDiscrete(self.PhantomSwitches[sender][0], val) 
    4865 
    4966    # Hide and disable a control 
     
    6077        # Retrieve other device settings as needed and customise the UI 
    6178        # based on these options. 
    62         #self.model = self.hw.getDiscrete('/Mixer/Info/Model') 
    63         #log.debug("device model identifier: %d" % (self.model)) 
     79        self.model = self.hw.getDiscrete('/Control/Model') 
     80        log.debug("device model identifier: %d" % (self.model)) 
     81        self.tco_present = self.hw.getDiscrete('/Control/TCO_present') 
     82        log.debug("device has TCO: %d" % (self.tco_present)) 
    6483        #self.sample_rate = self.hw.getDiscrete('/Mixer/Info/SampleRate') 
    6584        #log.debug("device sample rate: %d" % (self.sample_rate)) 
     85 
     86        # The Fireface-400 only has 2 phantom-capable channels 
     87        if (self.model == RME_MODEL_FF400): 
     88            self.phantom_2.setEnabled(False) 
     89            self.phantom_3.setEnabled(False) 
     90 
     91        # Get current hardware values and connect GUI element signals to  
     92        # their respective slots 
     93        for ctrl, info in self.PhantomSwitches.iteritems(): 
     94            if (not(ctrl.isEnabled())): 
     95                continue 
     96            val = (self.hw.getDiscrete(info[0]) >> info[1]) & 0x01 
     97            log.debug("phantom switch %d is %d" % (info[1], val)) 
     98            if val: 
     99                ctrl.setChecked(True) 
     100            else: 
     101                ctrl.setChecked(False) 
     102            QObject.connect(ctrl, SIGNAL('toggled(bool)'), self.updatePhantomSwitch)