Index: /trunk/libffado/src/rme/rme_avdevice.h =================================================================== --- /trunk/libffado/src/rme/rme_avdevice.h (revision 1605) +++ /trunk/libffado/src/rme/rme_avdevice.h (revision 1606) @@ -93,8 +93,10 @@ /* Device control functions */ + signed int getPhantom(unsigned int channel); signed int setPhantom(unsigned int channel, unsigned int status); /* General information functions */ signed int getRmeModel(void) { return m_rme_model; } + signed int getTcoPresent(void) { return tco_present; } protected: @@ -107,4 +109,5 @@ signed int tco_present; FF_software_settings_t settings; + FF_TCO_settings_t tco_settings; signed int num_channels; Index: /trunk/libffado/src/rme/fireface_settings_ctrls.h =================================================================== --- /trunk/libffado/src/rme/fireface_settings_ctrls.h (revision 1605) +++ /trunk/libffado/src/rme/fireface_settings_ctrls.h (revision 1606) @@ -47,4 +47,5 @@ #define RME_CTRL_INFO_MODEL 0x0100 +#define RME_CTRL_INFO_TCO_PRESENT 0x0200 class Device; @@ -69,4 +70,5 @@ unsigned int m_type; unsigned int m_value, m_info; + }; Index: /trunk/libffado/src/rme/fireface_hw.cpp =================================================================== --- /trunk/libffado/src/rme/fireface_hw.cpp (revision 1599) +++ /trunk/libffado/src/rme/fireface_hw.cpp (revision 1606) @@ -64,5 +64,15 @@ m_dds_freq = 0; - return set_hardware_params(&settings); + if (set_hardware_params(&settings) != 0) + return -1; + + // Also configure the TCO (Time Code Option) settings for those devices + // which have a TCO. + if (tco_present) { + memset(&tco_settings, 0, sizeof(tco_settings)); + return write_tco_settings(&tco_settings); + } + + return 0; } @@ -345,7 +355,9 @@ //This is just for testing - it's a known consistent configuration //data[0] = 0x00020811; // Phantom off -data[0] = 0x00020811; // Phantom on -data[1] = 0x0000031e; -data[2] = 0xc400101f; +//data[0] = 0x00020811; // Phantom on +//data[1] = 0x0000031e; +//data[2] = 0xc400101f; + debugOutput(DEBUG_LEVEL_VERBOSE, "set hardware registers: 0x%08x 0x%08x 0x%08x\n", + data[0], data[1], data[2]); conf_reg = (m_rme_model==RME_MODEL_FIREFACE800)?RME_FF800_CONF_REG:RME_FF400_CONF_REG; Index: /trunk/libffado/src/rme/rme_avdevice.cpp =================================================================== --- /trunk/libffado/src/rme/rme_avdevice.cpp (revision 1605) +++ /trunk/libffado/src/rme/rme_avdevice.cpp (revision 1606) @@ -89,7 +89,11 @@ , samples_per_packet( 0 ) , speed800( 0 ) + , m_MixerContainer( NULL ) + , m_ControlContainer( NULL ) { debugOutput( DEBUG_LEVEL_VERBOSE, "Created Rme::Device (NodeID %d)\n", getConfigRom().getNodeId() ); + memset(&settings, 0, sizeof(settings)); + memset(&tco_settings, 0, sizeof(tco_settings)); } @@ -114,4 +118,11 @@ return false; } + + result &= m_ControlContainer->addElement( + new RmeSettingsCtrl(*this, RME_CTRL_INFO_MODEL, 0, + "Model", "Model ID", "")); + result &= m_ControlContainer->addElement( + new RmeSettingsCtrl(*this, RME_CTRL_INFO_TCO_PRESENT, 0, + "TCO_present", "TCO is present", "")); result &= m_ControlContainer->addElement( @@ -230,4 +241,6 @@ tco_present = (read_tco(NULL, 0) == 0); } + debugOutput(DEBUG_LEVEL_VERBOSE, "TCO present: %s\n", + tco_present?"yes":"no"); // Find out the device's streaming status Index: /trunk/libffado/src/rme/rme_avdevice_settings.cpp =================================================================== --- /trunk/libffado/src/rme/rme_avdevice_settings.cpp (revision 1599) +++ /trunk/libffado/src/rme/rme_avdevice_settings.cpp (revision 1606) @@ -29,4 +29,15 @@ signed int +Device::getPhantom(unsigned int channel) { + + if (channel > 3) { + debugOutput(DEBUG_LEVEL_WARNING, "Channel %d phantom power not supported\n", channel); + return -1; + } + + return settings.mic_phantom[channel] != 0; +} + +signed int Device::setPhantom(unsigned int channel, unsigned int status) { Index: /trunk/libffado/src/rme/fireface_settings_ctrls.cpp =================================================================== --- /trunk/libffado/src/rme/fireface_settings_ctrls.cpp (revision 1600) +++ /trunk/libffado/src/rme/fireface_settings_ctrls.cpp (revision 1606) @@ -81,8 +81,10 @@ unsigned int on = (v & (0x00000001 << i)) != 0; err = m_parent.setPhantom(i, on); - if (!err && on) { - m_value |= (0x01 << i); - } else { - m_value &= ~(0x01 << i); + if (!err) { + if (on) { + m_value |= (0x01 << i); + } else { + m_value &= ~(0x01 << i); + } } } @@ -93,4 +95,5 @@ // set these. case RME_CTRL_INFO_MODEL: + case RME_CTRL_INFO_TCO_PRESENT: debugOutput(DEBUG_LEVEL_ERROR, "Attempt to set readonly info control 0x%08x\n", m_type); err = 1; @@ -108,4 +111,7 @@ RmeSettingsCtrl::getValue() { +signed int i; +signed int val = 0; + switch (m_type) { case RME_CTRL_NONE: @@ -114,5 +120,7 @@ case RME_CTRL_PHANTOM_SW: - return m_value; + for (i=0; i<3; i++) + val |= (m_parent.getPhantom(i) << i); + return val; break; @@ -120,4 +128,7 @@ return m_parent.getRmeModel(); break; + + case RME_CTRL_INFO_TCO_PRESENT: + return m_parent.getTcoPresent(); default: Index: /trunk/libffado/support/mixer-qt4/mixer_rme.py =================================================================== --- /trunk/libffado/support/mixer-qt4/mixer_rme.py (revision 1602) +++ /trunk/libffado/support/mixer-qt4/mixer_rme.py (revision 1606) @@ -42,8 +42,25 @@ def init(self): + self.PhantomSwitches={ + self.phantom_0: ['/Control/Phantom', 0], + self.phantom_1: ['/Control/Phantom', 1], + self.phantom_2: ['/Control/Phantom', 2], + self.phantom_3: ['/Control/Phantom', 3], + } + # Other mixer variables self.is_streaming = 0 self.sample_rate = 0 self.model = 0 + self.tco_present = 0 + + # Public slot: update phantom power hardware switchs + def updatePhantomSwitch(self, a0): + sender = self.sender() + # Value is the phantom switch value, with a corresponding enable + # bit in the high 16 bit word + val = (a0 << self.PhantomSwitches[sender][1]) | (0x00010000 << self.PhantomSwitches[sender][1]) + log.debug("phantom switch %d set to %d" % (self.PhantomSwitches[sender][1], a0)) + self.hw.setDiscrete(self.PhantomSwitches[sender][0], val) # Hide and disable a control @@ -60,6 +77,26 @@ # Retrieve other device settings as needed and customise the UI # based on these options. - #self.model = self.hw.getDiscrete('/Mixer/Info/Model') - #log.debug("device model identifier: %d" % (self.model)) + self.model = self.hw.getDiscrete('/Control/Model') + log.debug("device model identifier: %d" % (self.model)) + self.tco_present = self.hw.getDiscrete('/Control/TCO_present') + log.debug("device has TCO: %d" % (self.tco_present)) #self.sample_rate = self.hw.getDiscrete('/Mixer/Info/SampleRate') #log.debug("device sample rate: %d" % (self.sample_rate)) + + # The Fireface-400 only has 2 phantom-capable channels + if (self.model == RME_MODEL_FF400): + self.phantom_2.setEnabled(False) + self.phantom_3.setEnabled(False) + + # Get current hardware values and connect GUI element signals to + # their respective slots + for ctrl, info in self.PhantomSwitches.iteritems(): + if (not(ctrl.isEnabled())): + continue + val = (self.hw.getDiscrete(info[0]) >> info[1]) & 0x01 + log.debug("phantom switch %d is %d" % (info[1], val)) + if val: + ctrl.setChecked(True) + else: + ctrl.setChecked(False) + QObject.connect(ctrl, SIGNAL('toggled(bool)'), self.updatePhantomSwitch)