Changeset 1498
- Timestamp:
- 12/07/08 05:50:41 (15 years ago)
- Files:
-
- trunk/libffado/config.h.in (modified) (5 diffs)
- trunk/libffado/configuration (modified) (1 diff)
- trunk/libffado/config_debug.h.in (modified) (2 diffs)
- trunk/libffado/external/libconfig/SConscript (modified) (1 diff)
- trunk/libffado/libffado/ffado.h (modified) (1 diff)
- trunk/libffado/README (modified) (3 diffs)
- trunk/libffado/SConstruct (modified) (9 diffs)
- trunk/libffado/src/bebob/bebob_avdevice.cpp (modified) (5 diffs)
- trunk/libffado/src/bebob/bebob_avdevice.h (modified) (2 diffs)
- trunk/libffado/src/bebob/bebob_mixer.cpp (modified) (2 diffs)
- trunk/libffado/src/bebob/edirol/edirol_fa101.cpp (modified) (1 diff)
- trunk/libffado/src/bebob/focusrite/focusrite_cmd.h (modified) (1 diff)
- trunk/libffado/src/bebob/focusrite/focusrite_generic.cpp (modified) (2 diffs)
- trunk/libffado/src/bebob/focusrite/focusrite_generic.h (modified) (2 diffs)
- trunk/libffado/src/bebob/focusrite/focusrite_saffire.cpp (modified) (3 diffs)
- trunk/libffado/src/bebob/focusrite/focusrite_saffire.h (modified) (1 diff)
- trunk/libffado/src/bebob/focusrite/focusrite_saffirepro.cpp (modified) (15 diffs)
- trunk/libffado/src/bebob/focusrite/focusrite_saffirepro.h (modified) (5 diffs)
- trunk/libffado/src/bebob/mackie/onyxmixer.cpp (modified) (1 diff)
- trunk/libffado/src/bebob/terratec/terratec_cmd.h (modified) (1 diff)
- trunk/libffado/src/devicemanager.cpp (modified) (4 diffs)
- trunk/libffado/src/dice/dice_avdevice.cpp (modified) (1 diff)
- trunk/libffado/src/ffado.cpp (modified) (2 diffs)
- trunk/libffado/src/ffadodevice.cpp (modified) (3 diffs)
- trunk/libffado/src/ffadodevice.h (modified) (3 diffs)
- trunk/libffado/src/fireworks/efc/efc_avc_cmd.h (modified) (1 diff)
- trunk/libffado/src/genericavc/avc_avdevice.cpp (modified) (1 diff)
- trunk/libffado/src/genericavc/avc_avdevice.h (modified) (1 diff)
- trunk/libffado/src/libavc/audiosubunit/avc_function_block.h (modified) (1 diff)
- trunk/libffado/src/libavc/avc_definitions.h (modified) (2 diffs)
- trunk/libffado/src/libavc/ccm/avc_signal_source.cpp (modified) (1 diff)
- trunk/libffado/src/libavc/ccm/avc_signal_source.h (modified) (1 diff)
- trunk/libffado/src/libavc/descriptors/avc_descriptor.h (modified) (1 diff)
- trunk/libffado/src/libavc/descriptors/avc_descriptor_cmd.h (modified) (1 diff)
- trunk/libffado/src/libavc/general/avc_connect.h (modified) (1 diff)
- trunk/libffado/src/libavc/general/avc_extended_plug_info.h (modified) (1 diff)
- trunk/libffado/src/libavc/general/avc_extended_subunit_info.h (modified) (1 diff)
- trunk/libffado/src/libavc/general/avc_generic.cpp (modified) (4 diffs)
- trunk/libffado/src/libavc/general/avc_generic.h (modified) (4 diffs)
- trunk/libffado/src/libavc/general/avc_plug.cpp (modified) (3 diffs)
- trunk/libffado/src/libavc/general/avc_plug_info.h (modified) (1 diff)
- trunk/libffado/src/libavc/general/avc_signal_format.cpp (modified) (1 diff)
- trunk/libffado/src/libavc/general/avc_signal_format.h (modified) (1 diff)
- trunk/libffado/src/libavc/general/avc_subunit_info.h (modified) (1 diff)
- trunk/libffado/src/libavc/general/avc_unit.cpp (modified) (12 diffs)
- trunk/libffado/src/libavc/general/avc_unit.h (modified) (5 diffs)
- trunk/libffado/src/libavc/general/avc_unit_info.h (modified) (2 diffs)
- trunk/libffado/src/libavc/general/avc_vendor_dependent_cmd.h (modified) (1 diff)
- trunk/libffado/src/libavc/musicsubunit/avc_descriptor_music.h (modified) (1 diff)
- trunk/libffado/src/libavc/streamformat/avc_extended_stream_format.h (modified) (1 diff)
- trunk/libffado/src/libcontrol/ClockSelect.cpp (modified) (3 diffs)
- trunk/libffado/src/libcontrol/ClockSelect.h (modified) (2 diffs)
- trunk/libffado/src/libcontrol/Element.cpp (modified) (2 diffs)
- trunk/libffado/src/libcontrol/Element.h (modified) (1 diff)
- trunk/libffado/src/libcontrol/Nickname.cpp (modified) (1 diff)
- trunk/libffado/src/libcontrol/Nickname.h (modified) (1 diff)
- trunk/libffado/src/libieee1394/CycleTimerHelper.cpp (modified) (8 diffs)
- trunk/libffado/src/libieee1394/ieee1394service.cpp (modified) (17 diffs)
- trunk/libffado/src/libieee1394/ieee1394service.h (modified) (8 diffs)
- trunk/libffado/src/libieee1394/IsoHandler.cpp (modified) (11 diffs)
- trunk/libffado/src/libieee1394/IsoHandler.h (modified) (2 diffs)
- trunk/libffado/src/libieee1394/IsoHandlerManager.cpp (modified) (15 diffs)
- trunk/libffado/src/libieee1394/IsoHandlerManager.h (modified) (3 diffs)
- trunk/libffado/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.cpp (modified) (2 diffs)
- trunk/libffado/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.h (modified) (1 diff)
- trunk/libffado/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.cpp (modified) (16 diffs)
- trunk/libffado/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.h (modified) (1 diff)
- trunk/libffado/src/libstreaming/generic/Port.cpp (modified) (2 diffs)
- trunk/libffado/src/libstreaming/generic/Port.h (modified) (1 diff)
- trunk/libffado/src/libstreaming/generic/PortManager.cpp (modified) (14 diffs)
- trunk/libffado/src/libstreaming/generic/PortManager.h (modified) (2 diffs)
- trunk/libffado/src/libstreaming/generic/StreamProcessor.cpp (modified) (2 diffs)
- trunk/libffado/src/libstreaming/generic/StreamProcessor.h (modified) (1 diff)
- trunk/libffado/src/libstreaming/motu/MotuReceiveStreamProcessor.cpp (modified) (4 diffs)
- trunk/libffado/src/libstreaming/motu/MotuReceiveStreamProcessor.h (modified) (1 diff)
- trunk/libffado/src/libstreaming/motu/MotuTransmitStreamProcessor.cpp (modified) (8 diffs)
- trunk/libffado/src/libstreaming/motu/MotuTransmitStreamProcessor.h (modified) (1 diff)
- trunk/libffado/src/libstreaming/StreamProcessorManager.cpp (modified) (22 diffs)
- trunk/libffado/src/libstreaming/StreamProcessorManager.h (modified) (4 diffs)
- trunk/libffado/src/libutil/ByteSwap.h (modified) (2 diffs)
- trunk/libffado/src/libutil/cmd_serialize.cpp (modified) (4 diffs)
- trunk/libffado/src/libutil/Configuration.cpp (modified) (2 diffs)
- trunk/libffado/src/libutil/Configuration.h (modified) (1 diff)
- trunk/libffado/src/libutil/Functors.h (modified) (5 diffs)
- trunk/libffado/src/libutil/PosixThread.cpp (modified) (4 diffs)
- trunk/libffado/src/libutil/TimestampedBuffer.cpp (modified) (1 diff)
- trunk/libffado/src/motu/motu_avdevice.cpp (modified) (21 diffs)
- trunk/libffado/src/motu/motu_avdevice.h (modified) (6 diffs)
- trunk/libffado/src/motu/motu_controls.cpp (modified) (28 diffs)
- trunk/libffado/src/motu/motu_controls.h (modified) (2 diffs)
- trunk/libffado/src/SConscript (modified) (1 diff)
- trunk/libffado/support/dbus/control-interface.xml (modified) (1 diff)
- trunk/libffado/support/dbus/controlserver.cpp (modified) (3 diffs)
- trunk/libffado/support/dbus/controlserver.h (modified) (4 diffs)
- trunk/libffado/support/dbus/ffado-dbus-server.cpp (modified) (2 diffs)
- trunk/libffado/support/firmware/bridgeco-downloader.cpp (modified) (4 diffs)
- trunk/libffado/support/firmware/fireworks-downloader.cpp (modified) (3 diffs)
- trunk/libffado/support/firmware/SConscript (modified) (1 diff)
- trunk/libffado/support/mixer/mixer_motu.py (modified) (1 diff)
- trunk/libffado/support/mixer/mixer_saffireprolarge.ui (modified) (5 diffs)
- trunk/libffado/support/mixer/mixer_saffireprosmall.ui (modified) (5 diffs)
- trunk/libffado/support/mixer/SConscript (modified) (2 diffs)
- trunk/libffado/support/SConscript (modified) (1 diff)
- trunk/libffado/support/tools/ffado-diag.py (deleted)
- trunk/libffado/tests/SConscript (modified) (2 diffs)
- trunk/libffado/tests/streaming/SConscript (modified) (1 diff)
- trunk/libffado/tests/systemtests/SConscript (modified) (2 diffs)
- trunk/libffado/tests/test-ffado.cpp (modified) (4 diffs)
- trunk/libffado/tests/test-ieee1394service.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/config.h.in
r1348 r1498 44 44 #define IEEE1394SERVICE_CYCLETIMER_DLL_UPDATE_INTERVAL_USEC 200000 45 45 #define IEEE1394SERVICE_MAX_FIREWIRE_PORTS 4 46 #define IEEE1394SERVICE_MIN_SPLIT_TIMEOUT_USECS 1000000 46 47 47 48 #define IEEE1394SERVICE_CYCLETIMER_HELPER_RUN_REALTIME 1 48 #define IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO _INCREASE -1049 #define IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO 1 49 50 50 51 // config rom read wait interval 51 52 #define IEEE1394SERVICE_CONFIGROM_READ_WAIT_USECS 1000 52 53 54 // FCP defines 55 #define IEEE1394SERVICE_FCP_MAX_TRIES 20 56 #define IEEE1394SERVICE_FCP_SLEEP_BETWEEN_FAILURES_USECS 1000 57 #define IEEE1394SERVICE_FCP_POLL_TIMEOUT_MSEC 200 58 #define IEEE1394SERVICE_FCP_RESPONSE_TIMEOUT_USEC 2000000 53 59 54 60 // The current version of libiec61883 doesn't seem to calculate … … 62 68 // due to weirdness in the kernel layer 63 69 #define MAX_XMIT_PACKET_SIZE (2048-16) 64 #define MAX_XMIT_NB_BUFFERS 200 65 66 // should be PAGE_SIZE (4096) for unpatched kernels 67 #define RAW1394_RCV_MIN_BUF_STRIDE 4096 70 #define MIN_XMIT_PACKET_SIZE 72 71 #define MAX_XMIT_NB_BUFFERS 128 72 #define MAX_RECV_NB_BUFFERS 64 73 #define MIN_RECV_PACKET_SIZE 130 74 75 // the default ISO receive mode. 76 // 0 = auto, 1 = packet-per-buffer, 2 = bufferfill. 77 // 'auto' will automatically choose the mode that is expected 78 // to perform best for the given situation. For large periods 79 // this is 'bufferfill' mode, for small periods this is 80 // 'packet-per-buffer' mode. The 'BUFFERFILL_MODE_THRESHOLD' 81 // defines what a 'large period' is. 82 #define DEFAULT_ISO_RECEIVE_MODE 0 83 84 // the number of packets required to fill one period from which 85 // the bufferfill mode is to be used 86 #define BUFFERFILL_MODE_THRESHOLD 64 87 68 88 69 89 #define ISOHANDLER_FLUSH_BEFORE_ITERATE 0 … … 71 91 #define ISOHANDLER_DEATH_DETECT_TIMEOUT_USECS 1000000LL 72 92 73 #define ISOHANDLER_CHECK_CTR_RECONSTRUCTION 093 #define ISOHANDLER_CHECK_CTR_RECONSTRUCTION 1 74 94 75 95 #define ISOHANDLERMANAGER_MAX_ISO_HANDLERS_PER_PORT 16 … … 85 105 // prio 86 106 #define ISOHANDLERMANAGER_ISO_PRIO_INCREASE 0 87 #define ISOHANDLERMANAGER_ISO_PRIO_INCREASE_RECV - 6107 #define ISOHANDLERMANAGER_ISO_PRIO_INCREASE_RECV -1 88 108 #define ISOHANDLERMANAGER_ISO_PRIO_INCREASE_XMIT 1 89 109 … … 115 135 #define STREAMPROCESSORMANAGER_SYNCSTART_TRIES 10 116 136 #define STREAMPROCESSORMANAGER_SYNC_WAIT_TIME_MSEC 200 137 #define STREAMPROCESSORMANAGER_NB_ALIGN_TRIES 40 117 138 #define STREAMPROCESSORMANAGER_ALIGN_AVERAGE_TIME_MSEC 400 118 #define STREAMPROCESSORMANAGER_NB_ALIGN_TRIES 40119 139 120 140 #define STREAMPROCESSORMANAGER_DYNAMIC_SYNC_DELAY 0 trunk/libffado/configuration
r1435 r1498 158 158 driver = 1; # BeBoB 159 159 }, 160 { 161 vendorid = 0x0000000A; 162 modelid = 0x00030000; 163 vendorname = "CME"; 164 modelname = "Matrix K FW"; 165 driver = 1; # BeBoB 166 }, 160 167 { 161 168 vendorid = 0x1486; trunk/libffado/config_debug.h.in
r1254 r1498 8 8 #define DEBUG_USE_MESSAGE_BUFFER 1 9 9 // max message length in the debug messagebuffer 10 #define DEBUG_MAX_MESSAGE_LENGTH 51210 #define DEBUG_MAX_MESSAGE_LENGTH 2048 11 11 // number of messages in the debug messagebuffer (power of two) 12 12 #define DEBUG_MB_BUFFERS 1024 … … 22 22 #define DEBUG_MESSAGE_BUFFER_COLLISION_WAIT_NTRIES 2 23 23 #define DEBUG_MESSAGE_BUFFER_COLLISION_WAIT_NSEC 50000 24 25 24 26 25 // support a debug backlog trunk/libffado/external/libconfig/SConscript
r1304 r1498 37 37 env.AppendUnique( CCFLAGS=["-DDEBUG","-g"] ) 38 38 39 env.AppendUnique( CCFLAGS=["-DYY_NO_INPUT"] ) 40 39 41 libconfig = env.StaticLibrary('libconfigpp', sources) trunk/libffado/libffado/ffado.h
r967 r1498 55 55 56 56 /* various function */ 57 58 /* workaround: wait usec after each AVC command.59 will disapear as soon bug is fixed */60 void ffado_sleep_after_avc_command( int time );61 62 57 63 58 /* The basic operation of the API is as follows: trunk/libffado/README
r1336 r1498 91 91 match. The chances that it works also with an older versions are good: 92 92 93 libxml++2 (>= 2. 13.0)93 libxml++2 (>= 2.6.13) 94 94 95 95 These libraries here should be at least the version listed: … … 97 97 libraw1394 (>= 1.3.0), http://www.linux1394.org 98 98 libiec61883 (>= 1.1.0), http://www.linux1394.org 99 libavc1394 (>= 0.5.3), http://sourceforge.net/projects/libavc1394100 99 dbus-1 (>= 1.0), http://dbus.freedesktop.org 101 100 … … 111 110 To build the optional ffado device mixer control utility you also require: 112 111 113 Qt (>= 3.0), http://trolltech.com/products/qt112 Qt (>= 4.0), http://trolltech.com/products/qt 114 113 SIP (>= 4.7.0), http://www.riverbankcomputing.co.uk/sip/index.php 115 114 PyQt (note below), http://www.riverbankcomputing.co.uk/pyqt/ 116 115 dbus-python (>= 0.82.0), http://dbus.freedesktop.org/releases/dbus-python/ 117 116 118 The version of PyQt must be chosen to match the version of Qt in use. For 119 Qt 4.x use PyQt 4.x, while PyQt 3.x is applicable for all other Qt versions 120 from 1.43. 117 The mixer applets are available for both QT3 and QT4. However, the QT3 versions 118 are no longer actively developed. The build script will automatically fallback 119 to the QT3 version if you don't have QT4 installed. 120 121 The version of PyQt must be chosen to exactly match the version of Qt in use. 122 For Qt 4.x use PyQt 4.x. 121 123 122 124 SIP is only required to compile PyQt. If using a binary package of PyQt trunk/libffado/SConstruct
r1493 r1498 25 25 26 26 FFADO_API_VERSION="8" 27 FFADO_VERSION="2. 0.900"27 FFADO_VERSION="2.999.0" 28 28 29 29 import os … … 63 63 BoolOption( "ENABLE_FIREWORKS", "Enable/Disable the ECHO Audio FireWorks AV/C part.", True ), 64 64 BoolOption( "ENABLE_MOTU", "Enable/Disable the MOTU part.", True ), 65 BoolOption( "ENABLE_DICE", "Enable/Disable the DICE part.", False ),65 BoolOption( "ENABLE_DICE", "Enable/Disable the DICE part.", True ), 66 66 BoolOption( "ENABLE_METRIC_HALO", "Enable/Disable the Metric Halo part.", False ), 67 67 BoolOption( "ENABLE_RME", "Enable/Disable the RME part.", False ), … … 94 94 'XDG_DATA_DIRS', 95 95 'HOME', 96 'CC', 97 'CFLAGS', 98 'CXX', 99 'CXXFLAGS', 100 'CPPFLAGS', 96 101 ] 97 102 for var in vars_to_check: … … 103 108 env = Environment( tools=['default','scanreplace','pyuic','pyuic4','dbus','doxygen','pkgconfig'], toolpath=['admin'], ENV = buildenv, options=opts ) 104 109 105 if os.environ.has_key('CC'): 106 env['CC'] = os.environ['CC'] 107 if os.environ.has_key('CXX'): 108 env['CXX'] = os.environ['CXX'] 110 if os.environ.has_key('LDFLAGS'): 111 env['LINKFLAGS'] = os.environ['LDFLAGS'] 109 112 110 113 # grab OS CFLAGS / CCFLAGS … … 223 226 pkgs = { 224 227 'libraw1394' : '1.3.0', 225 'libavc1394' : '0.5.3',226 228 'libiec61883' : '1.1.0', 227 229 'dbus-1' : '1.0', … … 529 531 530 532 env['USER_CONFIG_FILE'] = env['CONFIGDIR'] + "/configuration" 531 env['SYSTEM_CONFIG_FILE'] = env[' sharedir'] + "/configuration"533 env['SYSTEM_CONFIG_FILE'] = env['SHAREDIR'] + "/configuration" 532 534 533 535 env['REGISTRATION_URL'] = "http://ffado.org/deviceregistration/register.php?action=register" … … 542 544 # 543 545 env.ScanReplace( "config.h.in" ) 546 env.ScanReplace( "config_debug.h.in" ) 547 env.ScanReplace( "version.h.in" ) 548 544 549 # ensure that the config.h is updated 545 550 env.Depends( "config.h", "SConstruct" ) 546 551 env.Depends( "config.h", 'cache/' + build_base + "options.cache" ) 547 552 548 env.ScanReplace( "config_debug.h.in" ) 549 550 env.ScanReplace( "version.h.in" ) 551 env.Depends( "version.h", "SConstruct" ) 552 env.Depends( "version.h", 'cache/' + build_base + "options.cache" ) 553 # update version.h whenever the SVN revision changes 553 # update version.h whenever the version or SVN revision changes 554 554 env.Depends( "version.h", env.Value(env['REVISION'])) 555 env.Depends( "version.h", env.Value(env['VERSION'])) 555 556 556 557 env.Depends( "libffado.pc", "SConstruct" ) … … 575 576 if env['BUILD_TESTS']: 576 577 Default( 'tests' ) 577 578 if not env.has_key( 'DESTDIR' ):579 env.Execute( env.Action( "rm -f %s/ffadomixer" % env['bindir'] ) )580 578 581 579 # … … 601 599 env.Execute( action ) 602 600 603 if env.has_key( 'XDG_TOOLS' ) and env.has_key( 'PYUIC ' ):601 if env.has_key( 'XDG_TOOLS' ) and env.has_key( 'PYUIC4' ): 604 602 if not env.GetOption("clean"): 605 603 action = "install" trunk/libffado/src/bebob/bebob_avdevice.cpp
r1361 r1498 62 62 AvDevice::AvDevice( DeviceManager& d, std::auto_ptr< ConfigRom >( configRom ) ) 63 63 : GenericAVC::AvDevice( d, configRom ) 64 , m_last_discovery_config_id ( 0xFFFFFFFFFFFFFFFFLLU ) 64 65 , m_Mixer ( 0 ) 65 66 { 66 67 debugOutput( DEBUG_LEVEL_VERBOSE, "Created BeBoB::AvDevice (NodeID %d)\n", 67 68 getConfigRom().getNodeId() ); 68 69 // DM1500 based devices seem to upset the linux1394 stack when commands are70 // sent too fast.71 if (AVC::AVCCommand::getSleepAfterAVCCommand() < 200) {72 AVC::AVCCommand::setSleepAfterAVCCommand( 200 );73 }74 75 69 } 76 70 … … 84 78 { 85 79 if(generic) { 86 return false;87 80 // try a bebob-specific command to check for the firmware 88 81 ExtendedPlugInfoCmd extPlugInfoCmd( configRom.get1394Service() ); … … 99 92 extendedPlugInfoInfoType.initialize(); 100 93 extPlugInfoCmd.setInfoType( extendedPlugInfoInfoType ); 101 94 102 95 if ( !extPlugInfoCmd.fire() ) { 103 96 debugError( "Number of channels command failed\n" ); 104 97 return false; 105 98 } 106 99 100 if((extPlugInfoCmd.getResponse() != AVCCommand::eR_Implemented)) { 101 // command not supported 102 return false; 103 } 104 107 105 ExtendedPlugInfoInfoType* infoType = extPlugInfoCmd.getInfoType(); 108 106 if ( infoType … … 208 206 debugWarning("Could not build mixer\n"); 209 207 } 208 209 // keep track of the config id of this discovery 210 m_last_discovery_config_id = getConfigurationId(); 211 210 212 return true; 211 213 } … … 656 658 } 657 659 660 bool 661 AvDevice::needsRediscovery() 662 { 663 // require rediscovery if the config id differs from the one saved 664 // in the previous discovery 665 return getConfigurationId() != m_last_discovery_config_id; 666 } 667 658 668 uint64_t 659 669 AvDevice::getConfigurationId() trunk/libffado/src/bebob/bebob_avdevice.h
r1361 r1498 112 112 113 113 virtual uint64_t getConfigurationId(); 114 virtual bool needsRediscovery(); 114 115 115 116 std::string getCachePath(); … … 121 122 122 123 std::vector<int> m_supported_frequencies; 124 uint64_t m_last_discovery_config_id; 125 123 126 protected: 124 127 Mixer* m_Mixer; trunk/libffado/src/bebob/bebob_mixer.cpp
r1361 r1498 79 79 ++it ) 80 80 { 81 debugOutput(DEBUG_LEVEL_ NORMAL,"deleting %s...\n", (*it)->getName().c_str());81 debugOutput(DEBUG_LEVEL_VERBOSE,"deleting %s...\n", (*it)->getName().c_str()); 82 82 delete *it; 83 83 } … … 124 124 bool 125 125 Mixer::addElementForAllFunctionBlocks() { 126 debugOutput(DEBUG_LEVEL_ NORMAL,"Adding elements for functionblocks...\n");126 debugOutput(DEBUG_LEVEL_VERBOSE,"Adding elements for functionblocks...\n"); 127 127 128 128 bool retval = true; trunk/libffado/src/bebob/edirol/edirol_fa101.cpp
r1199 r1498 41 41 m_fixed_clocksource.description = "Device Controlled"; 42 42 43 if (AVC::AVCCommand::getSleepAfterAVCCommand() < 500) { 44 AVC::AVCCommand::setSleepAfterAVCCommand( 500 ); 45 } 43 get1394Service().setFCPResponseFiltering(true); 46 44 } 47 45 trunk/libffado/src/bebob/focusrite/focusrite_cmd.h
r864 r1498 29 29 #include "libavc/general/avc_vendor_dependent_cmd.h" 30 30 31 #include <libavc1394/avc1394.h>32 33 31 namespace BeBoB { 34 32 namespace Focusrite { trunk/libffado/src/bebob/focusrite/focusrite_generic.cpp
r1336 r1498 449 449 450 450 // hardware dial control 451 DialPositionControl::DialPositionControl(FocusriteDevice& parent, int id) 452 : Control::Discrete(&parent) 453 , m_Parent(parent) 454 , m_cmd_id ( id ) 451 DialPositionControl::DialPositionControl(FocusriteDevice& parent, int id, int shift) 452 : Control::Discrete(&parent) 453 , m_Parent(parent) 454 , m_cmd_id ( id ) 455 , m_shift ( shift ) 455 456 {} 456 DialPositionControl::DialPositionControl(FocusriteDevice& parent, int id, 457 DialPositionControl::DialPositionControl(FocusriteDevice& parent, int id, int shift, 457 458 std::string name, std::string label, std::string descr) 458 459 : Control::Discrete(&parent) 459 460 , m_Parent(parent) 460 461 , m_cmd_id ( id ) 462 , m_shift ( shift ) 461 463 { 462 464 setName(name); … … 474 476 return 0; 475 477 } else { 476 val = val >> 5; 478 if (m_shift > 0) { 479 val = val >> m_shift; 480 } else if (m_shift < 0) { 481 val = val << -m_shift; 482 } 477 483 debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for %d = %d\n", 478 484 m_cmd_id, val); trunk/libffado/src/bebob/focusrite/focusrite_generic.h
r1336 r1498 150 150 { 151 151 public: 152 DialPositionControl(FocusriteDevice& parent, int id );153 DialPositionControl(FocusriteDevice& parent, int id, 152 DialPositionControl(FocusriteDevice& parent, int id, int shift); 153 DialPositionControl(FocusriteDevice& parent, int id, int shift, 154 154 std::string name, std::string label, std::string descr); 155 155 … … 166 166 FocusriteDevice& m_Parent; 167 167 unsigned int m_cmd_id; 168 int m_shift; 168 169 }; 169 170 trunk/libffado/src/bebob/focusrite/focusrite_saffire.cpp
r1336 r1498 35 35 getConfigRom().getNodeId() ); 36 36 37 // the saffire doesn't seem to like it if the commands are too fast38 if (AVC::AVCCommand::getSleepAfterAVCCommand() < 1000) {39 AVC::AVCCommand::setSleepAfterAVCCommand( 1000 );40 }41 42 37 if(getConfigRom().getGuid() < 0x130e0100040000LL) { 43 38 m_isSaffireLE = false; … … 253 248 result &= m_MixerContainer->addElement( 254 249 new DialPositionControl(*this, 255 FR_SAFFIRE_CMD_ID_MONITOR_DIAL, 250 FR_SAFFIRE_CMD_ID_MONITOR_DIAL, 0, 256 251 "MonitorDial", "Monitor Dial", "Monitor Dial Value")); 257 252 … … 384 379 delete m_MixerContainer; 385 380 return true; 381 } 382 383 std::vector<int> 384 SaffireDevice::getSupportedSamplingFrequencies() 385 { 386 std::vector<int> frequencies; 387 frequencies.push_back(44100); 388 frequencies.push_back(48000); 389 frequencies.push_back(88200); 390 frequencies.push_back(96000); 391 return frequencies; 386 392 } 387 393 trunk/libffado/src/bebob/focusrite/focusrite_saffire.h
r1336 r1498 278 278 virtual bool buildMixer(); 279 279 virtual bool destroyMixer(); 280 virtual std::vector<int> getSupportedSamplingFrequencies(); 280 281 281 282 private: trunk/libffado/src/bebob/focusrite/focusrite_saffirepro.cpp
r1336 r1498 44 44 45 45 addOption(Util::OptionContainer::Option("rebootOnSamplerateChange", true)); 46 // the saffire pro doesn't seem to like it if the commands are too fast47 if (AVC::AVCCommand::getSleepAfterAVCCommand() < 500) {48 AVC::AVCCommand::setSleepAfterAVCCommand( 500 );49 }50 46 51 47 updateClockSources(); … … 62 58 bool result=true; 63 59 debugOutput(DEBUG_LEVEL_VERBOSE, "Building a Focusrite SaffirePro mixer...\n"); 64 60 65 61 destroyMixer(); 66 62 67 63 // create the mixer object container 68 64 m_MixerContainer = new Control::Container(this, "Mixer"); … … 144 140 FR_SAFFIREPRO_CMD_ID_BITFIELD_OUT78, FR_SAFFIREPRO_CMD_BITFIELD_BIT_DIM, 145 141 "Out78Dim", "Out7/8 Dim", "Output 7/8 Level Dim")); 142 143 // front panel dial position 144 result &= m_MixerContainer->addElement( 145 new DialPositionControl(*this, 146 FR_SAFFIREPRO_CMD_ID_MONITOR_DIAL, 0, 147 "MonitorDial", "Monitor Dial", "Monitor Dial Value")); 146 148 147 149 // direct monitoring controls … … 309 311 "DeviceName", "Flash Device Name", "Device name stored in flash memory"); 310 312 result &= m_ControlContainer->addElement(m_deviceNameControl); 313 314 // add a direct register access element 315 result &= addElement(new RegisterControl(*this, "Register", "Register Access", "Direct register access")); 311 316 312 317 if (!result) { … … 420 425 debugOutput(DEBUG_LEVEL_VERBOSE, "SYNC_CONFIG field value: %08lX\n", sync ); 421 426 422 switch(sync & 0xFF) {427 switch(sync & FR_SAFFIREPRO_CMD_ID_SYNC_CONFIG_MASK) { 423 428 default: 424 429 debugWarning( "Unexpected SYNC_CONFIG field value: %08lX\n", sync ); … … 432 437 break; 433 438 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: 434 447 m_wordclock_clocksource.active=true; 435 448 m_active_clocksource = &m_wordclock_clocksource; 436 449 break; 437 case FR_SAFFIREPRO_CMD_SYNC_CONFIG_ADAT2: 438 m_adat1_clocksource.active=true; 439 m_active_clocksource = &m_adat1_clocksource; 440 break; 441 case FR_SAFFIREPRO_CMD_SYNC_CONFIG_WORDCLOCK: 442 m_adat2_clocksource.active=true; 443 m_active_clocksource = &m_adat2_clocksource; 444 break; 445 } 446 switch((sync >> 8) & 0xFF) { 450 } 451 switch((sync && FR_SAFFIREPRO_CMD_ID_SYNC_LOCK_MASK) >> 8) { 447 452 case FR_SAFFIREPRO_CMD_SYNC_CONFIG_INTERNAL: 448 453 // always locked … … 452 457 break; 453 458 case FR_SAFFIREPRO_CMD_SYNC_CONFIG_ADAT1: 454 m_ wordclock_clocksource.locked=true;459 m_adat1_clocksource.locked=true; 455 460 break; 456 461 case FR_SAFFIREPRO_CMD_SYNC_CONFIG_ADAT2: 457 m_adat 1_clocksource.locked=true;462 m_adat2_clocksource.locked=true; 458 463 break; 459 464 case FR_SAFFIREPRO_CMD_SYNC_CONFIG_WORDCLOCK: 460 m_ adat2_clocksource.locked=true;465 m_wordclock_clocksource.locked=true; 461 466 break; 462 467 default: … … 513 518 } 514 519 520 std::vector<int> 521 SaffireProDevice::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; 531 } 532 515 533 uint16_t 516 534 SaffireProDevice::getConfigurationIdSyncMode() … … 524 542 } 525 543 544 uint64_t 545 SaffireProDevice::getConfigurationId() 546 { 547 // have the generic mechanism create a unique configuration id. 548 uint64_t id = BeBoB::AvDevice::getConfigurationId(); 549 550 // there are some parts that can be enabled/disabled and 551 // that have influence on the AV/C model and channel config 552 // so add them to the config id 553 #if 0 554 // FIXME: doesn't seem to be working, but the channel count 555 // makes that it's not that important 556 if(getEnableDigitalChannel(eDC_SPDIF)) { 557 id |= 1ULL << 40; 558 } 559 if(isPro26()) { 560 if(getEnableDigitalChannel(eDC_ADAT1)) { 561 id |= 1ULL << 41; 562 } 563 if(getEnableDigitalChannel(eDC_ADAT2)) { 564 id |= 1ULL << 42; 565 } 566 } 567 #endif 568 return id; 569 } 570 526 571 bool 527 572 SaffireProDevice::setNickname( std::string name) … … 538 583 return m_deviceNameControl->getValue(); 539 584 } else return "Unknown"; 585 } 586 587 bool 588 SaffireProDevice::canChangeNickname() 589 { 590 return true; 540 591 } 541 592 … … 662 713 663 714 // the device needs quite some time to reboot 664 Util::SystemTimeSource::SleepUsecRelative( 2* 1000 * 1000);715 Util::SystemTimeSource::SleepUsecRelative(6 * 1000 * 1000); 665 716 666 717 // wait for the device to finish the reboot … … 692 743 Util::SystemTimeSource::SleepUsecRelative(1 * 1000 * 1000); 693 744 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 694 757 // we have to rediscover the device 695 758 if (discover()) break; … … 719 782 return false; 720 783 } 721 722 784 return true; 723 785 } 724 786 // not executable 725 787 return false; 726 727 788 } 728 789 … … 756 817 void 757 818 SaffireProDevice::flashLed() { 758 int ledFlashDuration =2;819 int ledFlashDuration = 2; 759 820 if(!getOption("ledFlashDuration", ledFlashDuration)) { 760 debug Warning("Could not retrieve ledFlashDuration parameter, defaulting to 2sec\n");761 } 762 int ledFlashFrequency =10;821 debugOutput( DEBUG_LEVEL_VERBOSE, "Could not retrieve ledFlashDuration parameter, defaulting to 2sec\n"); 822 } 823 int ledFlashFrequency = 10; 763 824 if(!getOption("ledFlashFrequency", ledFlashFrequency)) { 764 debug Warning("Could not retrieve ledFlashFrequency parameter, defaulting to 10Hz\n");765 } 766 767 uint32_t reg =0;825 debugOutput( DEBUG_LEVEL_VERBOSE, "Could not retrieve ledFlashFrequency parameter, defaulting to 10Hz\n"); 826 } 827 828 uint32_t reg = 0; 768 829 debugOutput( DEBUG_LEVEL_VERBOSE, "flashing led ...\n" ); 769 830 … … 863 924 "PLL lock range: %d\n", retval ); 864 925 return retval; 926 } 927 928 bool 929 SaffireProDevice::isMidiEnabled() { 930 uint32_t ready; 931 if ( !getSpecificValue(FR_SAFFIREPRO_CMD_ID_AVC_MODEL_MIDI, &ready ) ) { 932 debugError( "getSpecificValue failed\n" ); 933 return false; 934 } 935 936 debugOutput( DEBUG_LEVEL_VERBOSE, 937 "isMidiEnabled: %d\n", ready != 0 ); 938 return ready != 0; 865 939 } 866 940 trunk/libffado/src/bebob/focusrite/focusrite_saffirepro.h
r1336 r1498 158 158 #define FR_SAFFIREPRO_CMD_SWITCH_CONFIG_MUTE910 (1<<8) 159 159 160 #define FR_SAFFIREPRO_CMD_ID_ FRONT_DIAL86160 #define FR_SAFFIREPRO_CMD_ID_MONITOR_DIAL 86 161 161 #define FR_SAFFIREPRO_CMD_ID_DIM_INDICATOR 87 162 162 #define FR_SAFFIREPRO_CMD_ID_MUTE_INDICATOR 88 … … 168 168 #define FR_SAFFIREPRO_CMD_ID_USING_HIGHVOLTAGE_RAIL 92 169 169 170 #define FR_SAFFIREPRO_CMD_ID_SYNC_CONFIG_MASK 0x000000FF 171 #define FR_SAFFIREPRO_CMD_ID_SYNC_LOCK_MASK 0x0000FF00 170 172 #define FR_SAFFIREPRO_CMD_ID_SYNC_CONFIG 93 171 173 #define FR_SAFFIREPRO_CMD_SYNC_CONFIG_INTERNAL 0 … … 363 365 virtual bool setSamplingFrequency( int ); 364 366 virtual int getSamplingFrequency( ); 367 virtual std::vector<int> getSupportedSamplingFrequencies(); 365 368 366 369 virtual bool buildMixer(); … … 369 372 virtual std::string getNickname(); 370 373 virtual bool setNickname(std::string name); 374 virtual bool canChangeNickname(); 371 375 protected: 372 376 void rebootDevice(); 373 377 void flashLed(); 374 378 bool isAudioOn(); 379 bool isMidiEnabled(); 375 380 bool isExtClockLocked(); 376 381 uint32_t getCount32(); … … 409 414 protected: 410 415 virtual uint16_t getConfigurationIdSyncMode(); 416 virtual uint64_t getConfigurationId(); 411 417 412 418 private: trunk/libffado/src/bebob/mackie/onyxmixer.cpp
r1210 r1498 41 41 debugOutput( DEBUG_LEVEL_VERBOSE, "Created BeBoB::Mackie::OnyxMixerDevice (NodeID %d)\n", 42 42 getConfigRom().getNodeId() ); 43 44 // needs a lot of time45 if (AVC::AVCCommand::getSleepAfterAVCCommand() < 1000) {46 AVC::AVCCommand::setSleepAfterAVCCommand( 1000 );47 }48 43 } 49 44 trunk/libffado/src/bebob/terratec/terratec_cmd.h
r864 r1498 28 28 #include "libutil/cmd_serialize.h" 29 29 #include "libavc/general/avc_vendor_dependent_cmd.h" 30 31 #include <libavc1394/avc1394.h>32 30 33 31 namespace BeBoB { trunk/libffado/src/devicemanager.cpp
r1336 r1498 195 195 m_1394Services.push_back(tmp1394Service); 196 196 197 if(!tmp1394Service->useConfiguration(m_configuration)) { 198 debugWarning("Could not load config to 1394service\n"); 199 } 200 197 201 tmp1394Service->setThreadParameters(m_thread_realtime, m_thread_priority); 198 202 if ( !tmp1394Service->initialize( port ) ) { … … 468 472 469 473 if (!slaveMode) { 474 // for the devices that are still in the list check if they require re-discovery 475 FFADODeviceVector failed_to_rediscover; 476 for ( FFADODeviceVectorIterator it_dev = m_avDevices.begin(); 477 it_dev != m_avDevices.end(); 478 ++it_dev ) 479 { 480 FFADODevice* avDevice = *it_dev; 481 if(avDevice->needsRediscovery()) { 482 debugOutput( DEBUG_LEVEL_NORMAL, 483 "Device with GUID %s requires rediscovery (state changed)...\n", 484 avDevice->getConfigRom().getGuidString().c_str()); 485 486 bool isFromCache = false; 487 if ( useCache && avDevice->loadFromCache() ) { 488 debugOutput( DEBUG_LEVEL_VERBOSE, "could load from cache\n" ); 489 isFromCache = true; 490 // restore the debug level for everything that was loaded 491 avDevice->setVerboseLevel( getDebugLevel() ); 492 } else if ( avDevice->discover() ) { 493 debugOutput( DEBUG_LEVEL_VERBOSE, "discovery successful\n" ); 494 } else { 495 debugError( "could not discover device\n" ); 496 failed_to_rediscover.push_back(avDevice); 497 continue; 498 } 499 if ( !isFromCache && !avDevice->saveCache() ) { 500 debugOutput( DEBUG_LEVEL_VERBOSE, "No cached version of AVC model created\n" ); 501 } 502 } else { 503 debugOutput( DEBUG_LEVEL_NORMAL, 504 "Device with GUID %s does not require rediscovery...\n", 505 avDevice->getConfigRom().getGuidString().c_str()); 506 } 507 } 508 // remove devices that failed to rediscover 509 // FIXME: surely there has to be a better way to do this 510 FFADODeviceVector to_keep; 511 for ( FFADODeviceVectorIterator it = m_avDevices.begin(); 512 it != m_avDevices.end(); 513 ++it ) 514 { 515 bool keep_this_device = true; 516 for ( FFADODeviceVectorIterator it2 = failed_to_rediscover.begin(); 517 it2 != failed_to_rediscover.end(); 518 ++it2 ) 519 { 520 if(*it == *it2) { 521 debugOutput( DEBUG_LEVEL_NORMAL, 522 "Removing device with GUID %s due to failed discovery...\n", 523 (*it)->getConfigRom().getGuidString().c_str()); 524 keep_this_device = false; 525 break; 526 } 527 } 528 if(keep_this_device) { 529 to_keep.push_back(*it); 530 } 531 } 532 for ( FFADODeviceVectorIterator it2 = failed_to_rediscover.begin(); 533 it2 != failed_to_rediscover.end(); 534 ++it2 ) 535 { 536 if (!deleteElement(*it2)) { 537 debugWarning("failed to remove AvDevice from Control::Container\n"); 538 } 539 delete *it2; 540 } 541 m_avDevices = to_keep; 542 543 // pick up new devices 470 544 for ( Ieee1394ServiceVectorIterator it = m_1394Services.begin(); 471 545 it != m_1394Services.end(); … … 499 573 500 574 bool already_in_vector = false; 501 for ( FFADODeviceVectorIterator it = m_avDevices.begin();502 it != m_avDevices.end();503 ++it )575 for ( FFADODeviceVectorIterator it_dev = m_avDevices.begin(); 576 it_dev != m_avDevices.end(); 577 ++it_dev ) 504 578 { 505 if ((*it )->getConfigRom().getGuid() == configRom->getGuid()) {579 if ((*it_dev)->getConfigRom().getGuid() == configRom->getGuid()) { 506 580 already_in_vector = true; 507 581 break; … … 713 787 getSyncSource()); 714 788 } 789 715 790 return true; 716 791 } trunk/libffado/src/dice/dice_avdevice.cpp
r1347 r1498 56 56 {FW_VENDORID_TCAT, 0x00000023, "TC Electronic", "Konnekt Live"}, 57 57 {FW_VENDORID_ALESIS, 0x00000001, "Alesis", "io|14"}, 58 {FW_VENDORID_PRESONUS, 0x0000000b, "Presonus", "Firestudio Project"}, 58 59 }; 59 60 trunk/libffado/src/ffado.cpp
r1336 r1498 76 76 } 77 77 78 // FIXME: this should be cleaned up79 #include "libavc/general/avc_generic.h"80 void ffado_sleep_after_avc_command( int time )81 {82 AVC::AVCCommand::setSleepAfterAVCCommand( time );83 }84 85 78 struct _ffado_device 86 79 { … … 120 113 121 114 dev->m_deviceManager->setVerboseLevel(dev->options.verbose); 115 116 if(dev->options.realtime) { 117 debugOutput(DEBUG_LEVEL_VERBOSE, 118 "Starting with realtime scheduling, base priority %d\n", 119 dev->options.packetizer_priority); 120 } else { 121 debugWarning("Realtime scheduling is not enabled. This will cause significant reliability issues.\n"); 122 } 122 123 dev->m_deviceManager->setThreadParameters(dev->options.realtime, dev->options.packetizer_priority); 123 124 trunk/libffado/src/ffadodevice.cpp
r1217 r1498 74 74 debugWarning("failed to add Nickname control to container\n"); 75 75 } 76 // add a generic control for the streaming status 77 if(!m_genericContainer->addElement(new Control::StreamingStatus(*this))) { 78 debugWarning("failed to add StreamingStatus control to container\n"); 79 } 76 80 } 77 81 } … … 144 148 } 145 149 150 bool 151 FFADODevice::needsRediscovery() 152 { 153 // require rediscovery by default 154 return true; 155 } 156 146 157 enum FFADODevice::eSyncState 147 158 FFADODevice::getSyncState( ) { 148 159 return eSS_Unknown; 160 } 161 162 enum FFADODevice::eStreamingState 163 FFADODevice::getStreamingState() 164 { 165 return eSS_Idle; 149 166 } 150 167 … … 172 189 FFADODevice::getNickname() 173 190 { 174 return "Unknown"; 191 return "Unsupported"; 192 } 193 194 bool 195 FFADODevice::canChangeNickname() 196 { 197 return false; 175 198 } 176 199 trunk/libffado/src/ffadodevice.h
r1336 r1498 103 103 */ 104 104 virtual bool saveCache(); 105 106 /** 107 * @brief Called by DeviceManager to check whether a device requires rediscovery 108 * 109 * This function is called to figure out if the device has to be rediscovered 110 * e.g. after a bus reset where the device internal structure changed. 111 * 112 * @returns true if device requires rediscovery 113 */ 114 virtual bool needsRediscovery(); 105 115 106 116 /** … … 251 261 252 262 /** 263 * @brief stream states 264 */ 265 enum eStreamingState { 266 eSS_Idle = 0, ///> not streaming 267 eSS_Sending = 1, ///> the device is sending a stream 268 eSS_Receiving = 2, ///> the device is receiving a stream 269 eSS_Both = 3, ///> the device is sending and receiving a stream 270 }; 271 272 /** 273 * @brief gets the devices current synchronization state 274 * @return the device's sync state 275 */ 276 virtual enum eStreamingState getStreamingState(); 277 278 /** 253 279 * @brief This is called by the device manager to give the device a unique ID. 254 280 * … … 438 464 439 465 /** 466 * @brief return whether the nick name of this device can be changed 467 * 468 * @return true if the nick can be changed 469 */ 470 virtual bool canChangeNickname(); 471 472 /** 440 473 * @brief handle a bus reset 441 474 * trunk/libffado/src/fireworks/efc/efc_avc_cmd.h
r864 r1498 29 29 #include "libavc/general/avc_vendor_dependent_cmd.h" 30 30 31 #include <libavc1394/avc1394.h>32 33 31 #include "efc_cmd.h" 34 32 trunk/libffado/src/genericavc/avc_avdevice.cpp
r1336 r1498 164 164 AVC::Unit::setVerboseLevel(l); 165 165 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l ); 166 } 167 168 #include <libieee1394/IEC61883.h> 169 enum FFADODevice::eStreamingState 170 AvDevice::getStreamingState() 171 { 172 // check the IEC plug control registers to see if the device is streaming 173 // a bit of a hack, but will do until we come up with something better 174 struct iec61883_oPCR oPCR0; 175 struct iec61883_iPCR iPCR0; 176 177 quadlet_t *oPCR0q = (quadlet_t *)&oPCR0; 178 quadlet_t *iPCR0q = (quadlet_t *)&iPCR0; 179 180 if(!get1394Service().read(getNodeId() | 0xFFC0, CSR_REGISTER_BASE + CSR_O_PCR_0, 1, oPCR0q)) { 181 debugWarning("Could not read oPCR0 register\n"); 182 } 183 if(!get1394Service().read(getNodeId() | 0xFFC0, CSR_REGISTER_BASE + CSR_I_PCR_0, 1, iPCR0q)) { 184 debugWarning("Could not read iPCR0 register\n"); 185 } 186 187 *oPCR0q = CondSwapFromBus32(*oPCR0q); 188 *iPCR0q = CondSwapFromBus32(*iPCR0q); 189 190 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "iPCR0: %08X, oPCR0: %08X\n", *iPCR0q, *oPCR0q); 191 192 if(iPCR0.n_p2p_connections > 0 && oPCR0.n_p2p_connections > 0) { 193 return eSS_Both; 194 } else if (iPCR0.n_p2p_connections > 0) { 195 return eSS_Receiving; 196 } else if (oPCR0.n_p2p_connections > 0) { 197 return eSS_Sending; 198 } else { 199 return eSS_Idle; 200 } 166 201 } 167 202 trunk/libffado/src/genericavc/avc_avdevice.h
r1336 r1498 74 74 virtual Streaming::StreamProcessor *getStreamProcessorByIndex(int i); 75 75 76 virtual enum eStreamingState getStreamingState(); 77 76 78 virtual bool prepare(); 77 79 virtual bool lock(); trunk/libffado/src/libavc/audiosubunit/avc_function_block.h
r1361 r1498 28 28 #include "../general/avc_generic.h" 29 29 30 #include <libavc1394/avc1394.h>31 30 #include <vector> 32 31 using namespace std; trunk/libffado/src/libavc/avc_definitions.h
r1234 r1498 25 25 #define AVCDEFINITIONS_H 26 26 27 #include <libavc1394/avc1394.h>28 27 #include <cstring> 29 28 #include <cstdlib> 30 29 #include <ostream> 31 30 #include <libraw1394/raw1394.h> 32 31 33 32 namespace AVC { … … 88 87 typedef quadlet_t company_id_t; 89 88 90 #define AVC1394_SUBUNIT_AUDIO 1 91 #define AVC1394_SUBUNIT_PRINTER 2 92 #define AVC1394_SUBUNIT_CA 6 93 #define AVC1394_SUBUNIT_PANEL 9 94 #define AVC1394_SUBUNIT_BULLETIN_BOARD 0xA 95 #define AVC1394_SUBUNIT_CAMERA_STORAGE 0xB 96 #define AVC1394_SUBUNIT_MUSIC 0xC 97 #define AVC1394_SUBUNIT_RESERVED 0x1D 89 enum ESubunitType { 90 eST_Monitor = 0x00, 91 eST_Audio = 0x01, 92 eST_Printer = 0x02, 93 eST_Disc = 0x03, 94 eST_VCR = 0x04, 95 eST_Tuner = 0x05, 96 eST_CA = 0x06, 97 eST_Camera = 0x07, 98 eST_Panel = 0x09, 99 eST_BulltinBoard = 0x0A, 100 eST_CameraStorage = 0x0B, 101 eST_Music = 0x0C, 102 eST_VendorUnique = 0x1C, 103 eST_Reserved = 0x1D, 104 eST_Extended = 0x1E, 105 eST_Unit = 0x1F, 106 }; 98 107 99 108 #define AVC1394_SUBUNIT_ID_RESERVED 0x06 100 101 enum ESubunitType {102 eST_Monitor = AVC1394_SUBUNIT_VIDEO_MONITOR,103 eST_Audio = AVC1394_SUBUNIT_AUDIO,104 eST_Printer = AVC1394_SUBUNIT_PRINTER,105 eST_Disc = AVC1394_SUBUNIT_DISC_RECORDER,106 eST_VCR = AVC1394_SUBUNIT_VCR,107 eST_Tuner = AVC1394_SUBUNIT_TUNER,108 eST_CA = AVC1394_SUBUNIT_CA,109 eST_Camera = AVC1394_SUBUNIT_VIDEO_CAMERA,110 eST_Panel = AVC1394_SUBUNIT_PANEL,111 eST_BulltinBoard = AVC1394_SUBUNIT_BULLETIN_BOARD,112 eST_CameraStorage = AVC1394_SUBUNIT_CAMERA_STORAGE,113 eST_Music = AVC1394_SUBUNIT_MUSIC,114 eST_VendorUnique = AVC1394_SUBUNIT_VENDOR_UNIQUE,115 eST_Reserved = AVC1394_SUBUNIT_RESERVED,116 eST_Extended = AVC1394_SUBUNIT_EXTENDED,117 eST_Unit = AVC1394_SUBUNIT_UNIT,118 };119 109 120 110 enum ESubunitType byteToSubunitType(byte_t s); trunk/libffado/src/libavc/ccm/avc_signal_source.cpp
r1135 r1498 68 68 69 69 SignalSubunitAddress::SignalSubunitAddress() 70 : m_subunitType( AVC1394_SUBUNIT_RESERVED)70 : m_subunitType( eST_Reserved ) 71 71 , m_subunitId( AVC1394_SUBUNIT_ID_RESERVED ) 72 72 , m_plugId( ePI_Invalid ) trunk/libffado/src/libavc/ccm/avc_signal_source.h
r1239 r1498 27 27 #include "../general/avc_generic.h" 28 28 #include "../avc_definitions.h" 29 30 #include <libavc1394/avc1394.h>31 29 32 30 namespace AVC { trunk/libffado/src/libavc/descriptors/avc_descriptor.h
r1361 r1498 41 41 #include "debugmodule/debugmodule.h" 42 42 43 #include <libavc1394/avc1394.h>44 43 #include <string> 45 44 trunk/libffado/src/libavc/descriptors/avc_descriptor_cmd.h
r864 r1498 27 27 #include "../general/avc_generic.h" 28 28 29 #include <libavc1394/avc1394.h>30 31 29 namespace AVC { 32 30 31 #define AVC1394_CMD_OPEN_DESCRIPTOR 0x08 32 #define AVC1394_CMD_READ_DESCRIPTOR 0x09 33 #define AVC1394_CMD_WRITE_DESCRIPTOR 0x0A 34 #define AVC1394_CMD_SEARCH_DESCRIPTOR 0x0B 35 #define AVC1394_CMD_OBJECT_NUMBER_SELECT 0x0D 33 36 34 // defined in avc1394.h35 // #define AVC1394_CMD_OPEN_DESCRIPTOR 0x0836 // #define AVC1394_CMD_READ_DESCRIPTOR 0x0937 // #define AVC1394_CMD_WRITE_DESCRIPTOR 0x0A38 // #define AVC1394_CMD_SEARCH_DESCRIPTOR 0x0B39 // #define AVC1394_CMD_OBJECT_NUMBER_SELECT 0x0D40 41 // not yet defined42 37 #define AVC1394_CMD_CREATE_DESCRIPTOR 0x0C 43 38 #define AVC1394_CMD_OPEN_INFOBLOCK 0x05 trunk/libffado/src/libavc/general/avc_connect.h
r864 r1498 27 27 #include "avc_generic.h" 28 28 29 #include <libavc1394/avc1394.h> 29 #define AVC1394_CMD_CONNECT 0x24 30 30 31 namespace AVC { 31 32 trunk/libffado/src/libavc/general/avc_extended_plug_info.h
r864 r1498 28 28 #include "avc_generic.h" 29 29 30 #include <libavc1394/avc1394.h>31 32 30 #include <string> 33 31 #include <vector> 32 33 #define AVC1394_CMD_PLUG_INFO 0x02 34 34 35 35 namespace AVC { trunk/libffado/src/libavc/general/avc_extended_subunit_info.h
r864 r1498 27 27 #include "avc_generic.h" 28 28 29 #include <libavc1394/avc1394.h>30 31 29 #include <string> 32 30 #include <vector> 31 32 #define AVC1394_CMD_SUBUNIT_INFO 0x31 33 33 34 34 namespace AVC { trunk/libffado/src/libavc/general/avc_generic.cpp
r1234 r1498 42 42 IMPL_DEBUG_MODULE( AVCCommand, AVCCommand, DEBUG_LEVEL_NORMAL ); 43 43 IMPL_DEBUG_MODULE( IBusData, IBusData, DEBUG_LEVEL_VERBOSE ); 44 45 int AVCCommand::m_time = 0;46 44 47 45 AVCCommand::AVCCommand( Ieee1394Service& ieee1394service, … … 213 211 } 214 212 213 bool result = false; 215 214 unsigned int resp_len; 216 215 quadlet_t* resp = m_p1394Service->transactionBlock( m_nodeId, … … 218 217 ( fcpFrameSize+3 ) / 4, 219 218 &resp_len ); 220 bool result = false;221 219 if ( resp ) { 222 220 resp_len *= 4; … … 226 224 switch ( m_eResponse ) 227 225 { 228 case eR_Accepted: 229 case eR_Implemented: 230 case eR_Rejected: 231 case eR_NotImplemented: 232 { 233 Util::Cmd::BufferDeserialize de( buf, resp_len ); 234 result = deserialize( de ); 235 236 debugOutputShort( DEBUG_LEVEL_VERY_VERBOSE," Response:\n"); 237 showFcpFrame( buf, de.getNrOfConsumedBytes() ); 238 239 Util::Cmd::StringSerializer se_dbg; 240 serialize( se_dbg ); 241 242 // output the debug message in smaller chunks to avoid problems 243 // with a max message size 244 unsigned int chars_to_write=se_dbg.getString().size(); 245 unsigned int chars_written=0; 246 while (chars_written<chars_to_write) { 247 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s\n", 248 se_dbg.getString().substr(chars_written, DEBUG_MAX_MESSAGE_LENGTH).c_str()); 249 chars_written += DEBUG_MAX_MESSAGE_LENGTH-1; 226 case eR_Accepted: 227 case eR_Implemented: 228 case eR_Rejected: 229 case eR_NotImplemented: 230 { 231 Util::Cmd::BufferDeserialize de( buf, resp_len ); 232 result = deserialize( de ); 233 234 debugOutputShort( DEBUG_LEVEL_VERY_VERBOSE," Response:\n"); 235 showFcpFrame( buf, de.getNrOfConsumedBytes() ); 236 237 Util::Cmd::StringSerializer se_dbg; 238 serialize( se_dbg ); 239 240 // output the debug message in smaller chunks to avoid problems 241 // with a max message size 242 unsigned int chars_to_write=se_dbg.getString().size(); 243 unsigned int chars_written=0; 244 while (chars_written<chars_to_write) { 245 debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, "%s\n", 246 se_dbg.getString().substr(chars_written, DEBUG_MAX_MESSAGE_LENGTH).c_str()); 247 chars_written += DEBUG_MAX_MESSAGE_LENGTH-1; 248 } 250 249 } 250 break; 251 default: 252 debugWarning( "unexpected response received (0x%x)\n", m_eResponse ); 253 debugOutputShort( DEBUG_LEVEL_VERY_VERBOSE," Response:\n"); 254 255 Util::Cmd::BufferDeserialize de( buf, resp_len ); 256 deserialize( de ); 257 258 showFcpFrame( buf, de.getNrOfConsumedBytes() ); 259 result = false; 251 260 252 261 } 253 break; 254 default: 255 debugWarning( "unexpected response received (0x%x)\n", m_eResponse ); 256 debugOutputShort( DEBUG_LEVEL_VERY_VERBOSE," Response:\n"); 257 258 Util::Cmd::BufferDeserialize de( buf, resp_len ); 259 deserialize( de ); 260 261 showFcpFrame( buf, de.getNrOfConsumedBytes() ); 262 263 } 262 debugOutputShort( DEBUG_LEVEL_VERY_VERBOSE, "\n" ); 263 m_p1394Service->transactionBlockClose(); 264 264 } else { 265 debugWarning( "no response\n" ); 266 } 267 268 debugOutputShort( DEBUG_LEVEL_VERY_VERBOSE, "\n" ); 269 270 m_p1394Service->transactionBlockClose(); 271 272 SleepRelativeUsec( m_time ); 265 debugOutput( DEBUG_LEVEL_VERBOSE, "no response\n" ); 266 result = false; 267 m_p1394Service->transactionBlockClose(); 268 } 273 269 274 270 return result; 275 }276 277 void278 AVCCommand::setSleepAfterAVCCommand( int time )279 {280 m_time = time;281 271 } 282 272 trunk/libffado/src/libavc/general/avc_generic.h
r864 r1498 29 29 30 30 #include "fbtypes.h" 31 32 #include <libavc1394/avc1394.h>33 31 34 32 class Ieee1394Service; … … 70 68 public: 71 69 enum EResponse { 72 eR_Unknown = 0 ,73 eR_NotImplemented = AVC1394_RESP_NOT_IMPLEMENTED,74 eR_Accepted = AVC1394_RESP_ACCEPTED,75 eR_Rejected = AVC1394_RESP_REJECTED,76 eR_InTransition = AVC1394_RESP_IN_TRANSITION,77 eR_Implemented = AVC1394_RESP_IMPLEMENTED,78 eR_Changed = AVC1394_RESP_CHANGED,79 eR_Interim = AVC1394_RESP_INTERIM,70 eR_Unknown = 0xff, 71 eR_NotImplemented = 0x08, 72 eR_Accepted = 0x09, 73 eR_Rejected = 0x0A, 74 eR_InTransition = 0x0B, 75 eR_Implemented = 0x0C, 76 eR_Changed = 0x0D, 77 eR_Interim = 0x0F, 80 78 }; 81 79 82 80 enum ECommandType { 83 eCT_Control = AVC1394_CTYP_CONTROL,84 eCT_Status = AVC1394_CTYP_STATUS,85 eCT_SpecificInquiry = AVC1394_CTYP_SPECIFIC_INQUIRY,86 eCT_Notify = AVC1394_CTYP_NOTIFY,87 eCT_GeneralInquiry = AVC1394_CTYP_GENERAL_INQUIRY,81 eCT_Control = 0x00, 82 eCT_Status = 0x01, 83 eCT_SpecificInquiry = 0x02, 84 eCT_Notify = 0x03, 85 eCT_GeneralInquiry = 0x04, 88 86 eCT_Unknown = 0xff, 89 87 }; … … 112 110 virtual const char* getCmdName() const = 0; 113 111 114 // workaround115 static void setSleepAfterAVCCommand( int time );116 static int getSleepAfterAVCCommand( ) {return m_time;};117 112 protected: 118 113 void showFcpFrame( const unsigned char* buf, … … 136 131 EResponse m_eResponse; 137 132 ECommandType m_commandType; 138 static int m_time; 139 133 140 134 protected: 141 135 DECLARE_DEBUG_MODULE; trunk/libffado/src/libavc/general/avc_plug.cpp
r1336 r1498 267 267 Plug::discoverPlugType() 268 268 { 269 270 269 return true; 271 270 } … … 541 540 debugOutput( DEBUG_LEVEL_VERBOSE, "Discovering incoming connections...\n"); 542 541 542 m_inputConnections.clear(); 543 543 int sourcePlugGlobalId=getSignalSource(); 544 544 … … 1990 1990 PlugManager::tidyPlugConnections(PlugConnectionVector& connections) 1991 1991 { 1992 connections.clear(); 1992 1993 for ( PlugVector::const_iterator it = m_plugs.begin(); 1993 1994 it != m_plugs.end(); trunk/libffado/src/libavc/general/avc_plug_info.h
r864 r1498 27 27 #include "avc_generic.h" 28 28 29 # include <libavc1394/avc1394.h>29 #define AVC1394_CMD_PLUG_INFO 0x02 30 30 31 31 #define AVC1394_PLUG_INFO_SUBFUNCTION_SERIAL_BUS_ISOCHRONOUS_AND_EXTERNAL_PLUG 0x00 trunk/libffado/src/libavc/general/avc_signal_format.cpp
r1135 r1498 28 28 #include "libutil/ByteSwap.h" 29 29 #include <iostream> 30 31 #define AVC1394_CMD_INPUT_PLUG_SIGNAL_FORMAT 0x19 32 #define AVC1394_CMD_OUTPUT_PLUG_SIGNAL_FORMAT 0x18 30 33 31 34 using namespace std; trunk/libffado/src/libavc/general/avc_signal_format.h
r864 r1498 27 27 28 28 #include "avc_generic.h" 29 30 #include <libavc1394/avc1394.h>31 29 32 30 namespace AVC { trunk/libffado/src/libavc/general/avc_subunit_info.h
r864 r1498 27 27 #include "avc_generic.h" 28 28 29 #include <libavc1394/avc1394.h> 30 29 #define AVC1394_CMD_SUBUNIT_INFO 0x31 31 30 32 31 namespace AVC { trunk/libffado/src/libavc/general/avc_unit.cpp
r1336 r1498 48 48 Unit::Unit( ) 49 49 : m_pPlugManager( new PlugManager( ) ) 50 , m_activeSyncInfo( 0 )51 50 { 52 51 debugOutput( DEBUG_LEVEL_VERBOSE, "Created Unit\n" ); … … 163 162 m_syncInfos.clear(); 164 163 165 m_activeSyncInfo = NULL;166 167 164 return true; 168 165 } … … 171 168 Unit::discover() 172 169 { 173 170 debugOutput( DEBUG_LEVEL_VERBOSE, "Discovering AVC::Unit...\n"); 174 171 if( !clean() ) { 175 172 debugError( "Could not clean unit data structures\n" ); … … 187 184 } 188 185 186 if ( !rediscoverConnections() ) { 187 debugError( "Detecting connections failed\n" ); 188 return false; 189 } 190 191 if ( !discoverSyncModes() ) { 192 debugError( "Detecting sync modes failed\n" ); 193 return false; 194 } 195 196 if ( !propagatePlugInfo() ) { 197 debugError( "Failed to propagate plug info\n" ); 198 return false; 199 } 200 201 return true; 202 } 203 204 bool 205 Unit::rediscoverConnections() { 206 debugOutput( DEBUG_LEVEL_VERBOSE, "Re-discovering plug connections...\n"); 207 208 // clear the previous connections 209 for ( PlugConnectionVector::iterator it = m_plugConnections.begin(); 210 it != m_plugConnections.end(); 211 ++it ) 212 { 213 delete *it; 214 } 215 m_plugConnections.clear(); 216 189 217 if ( !discoverPlugConnections() ) { 190 218 debugError( "Detecting plug connections failed\n" ); … … 201 229 return false; 202 230 } 203 204 if ( !discoverSyncModes() ) {205 debugError( "Detecting sync modes failed\n" );206 return false;207 }208 209 if ( !propagatePlugInfo() ) {210 debugError( "Failed to propagate plug info\n" );211 return false;212 }213 214 231 return true; 215 232 } … … 717 734 showPlugs( syncMSUOutputPlugs ); 718 735 736 m_syncInfos.clear(); 719 737 // Currently there is no usable setup for sync streams. 720 738 // There is no point in wasting time here. Let's skip … … 745 763 "Digital Input Sync" ); 746 764 747 return updateActiveSyncInfo(); 748 } 749 750 bool 751 Unit::updateActiveSyncInfo() 752 { 765 return true; 766 } 767 768 const Unit::SyncInfo* 769 Unit::getActiveSyncInfo() 770 { 771 SyncInfo* activeSyncInfo = NULL; 753 772 PlugVector syncMSUInputPlugs = m_pPlugManager->getPlugsByType( 754 773 eST_Music, … … 785 804 && ( pSyncInfo->m_destination == msuPlug ) ) 786 805 { 787 m_activeSyncInfo = pSyncInfo;806 activeSyncInfo = pSyncInfo; 788 807 break; 789 808 } 790 809 } 791 if( m_activeSyncInfo) {810 if(activeSyncInfo) { 792 811 debugOutput( DEBUG_LEVEL_NORMAL, 793 812 "Active Sync Connection: %s, '%s' -> '%s'\n", 794 m_activeSyncInfo->m_description.c_str(),813 activeSyncInfo->m_description.c_str(), 795 814 plug->getName(), 796 815 msuPlug->getName() ); … … 798 817 } 799 818 } 800 return true;819 return activeSyncInfo; 801 820 } 802 821 … … 831 850 bool Unit::setActiveSync(const SyncInfo& syncInfo) 832 851 { 833 bool result = true; 852 bool retval = true; 853 854 if ( ! syncInfo.m_source->inquireConnnection( *syncInfo.m_destination ) ) { 855 // this should not happen 856 debugError("Sync connection '%s' -> '%s' not possible. This might be a bug.\n", 857 syncInfo.m_source->getName(), syncInfo.m_destination->getName()); 858 } 834 859 835 860 if(!syncInfo.m_source->setConnection( *syncInfo.m_destination )) { 836 debugWarning("Could not set sync source connection.\n"); 837 } 838 839 result &= updateActiveSyncInfo(); 840 return result; 861 debugError("Could not set sync source connection while device reported it as possible.\n"); 862 retval = false; // proceed to rediscovery anyway 863 } 864 865 // we now have to rediscover the connections 866 if ( !rediscoverConnections() ) { 867 debugError( "Re-discovery of plug connections failed\n" ); 868 return false; 869 } 870 return retval; 841 871 } 842 872 … … 985 1015 result &= serializeSyncInfoVector( basePath + "SyncInfo", ser, m_syncInfos ); 986 1016 987 int i = 0;988 for ( SyncInfoVector::const_iterator it = m_syncInfos.begin();989 it != m_syncInfos.end();990 ++it )991 {992 const SyncInfo& info = *it;993 if ( m_activeSyncInfo == &info ) {994 result &= ser.write( basePath + "m_activeSyncInfo", i );995 break;996 }997 i++;998 }999 1000 1017 return result; 1001 1018 } … … 1042 1059 m_pPlugManager->deserializeUpdate( basePath, deser ); 1043 1060 1044 if ( deser.isExisting(basePath + "m_activeSyncInfo" ) ) { 1045 // the sync info doesn't have to be there. 1046 1047 unsigned int i; 1048 result &= deser.read( basePath + "m_activeSyncInfo", i ); 1049 if ( i < m_syncInfos.size() ) { 1050 m_activeSyncInfo = &m_syncInfos[i]; 1051 // but if it is we want it selected 1052 result &= setActiveSync(*m_activeSyncInfo); 1053 } 1054 } 1061 // this might have changed since the cache was saved 1062 // if the config ID doesn't account for the clock source 1063 if(!rediscoverConnections()) { 1064 debugError("Could not rediscover plug connections\n"); 1065 } 1066 1055 1067 return result; 1056 1068 } trunk/libffado/src/libavc/general/avc_unit.h
r1239 r1498 88 88 virtual const SyncInfoVector& getSyncInfos() const 89 89 { return m_syncInfos; } 90 virtual const SyncInfo* getActiveSyncInfo() const 91 { return m_activeSyncInfo; } 90 virtual const SyncInfo* getActiveSyncInfo(); 92 91 93 92 virtual bool setActiveSync( const SyncInfo& syncInfo ); … … 98 97 SubunitAudio* getAudioSubunit( subunit_id_t subunitId ) 99 98 { return dynamic_cast<SubunitAudio*>( 100 getSubunit( AVC1394_SUBUNIT_AUDIO, subunitId ));};99 getSubunit( eST_Audio , subunitId ));}; 101 100 SubunitMusic* getMusicSubunit( subunit_id_t subunitId ) 102 101 { return dynamic_cast<SubunitMusic*>( 103 getSubunit( AVC1394_SUBUNIT_MUSIC, subunitId ));};102 getSubunit( eST_Music , subunitId ));}; 104 103 Subunit* getSubunit( subunit_type_t subunitType, 105 104 subunit_id_t subunitId ) const; … … 122 121 123 122 virtual bool enumerateSubUnits(); 123 virtual bool rediscoverConnections(); 124 124 virtual bool discoverPlugConnections(); 125 125 virtual bool discoverSubUnitsPlugConnections(); … … 131 131 virtual bool propagatePlugInfo(); 132 132 virtual bool discoverSyncModes(); 133 virtual bool updateActiveSyncInfo();134 133 virtual bool checkSyncConnectionsAndAddToList( AVC::PlugVector& plhs, 135 134 AVC::PlugVector& prhs, … … 167 166 PlugManager* m_pPlugManager; 168 167 SyncInfoVector m_syncInfos; 169 SyncInfo* m_activeSyncInfo;170 168 171 169 private: trunk/libffado/src/libavc/general/avc_unit_info.h
r864 r1498 27 27 #include "avc_generic.h" 28 28 29 # include <libavc1394/avc1394.h>29 #define AVC1394_CMD_UNIT_INFO 0x30 30 30 31 31 namespace AVC { … … 35 35 { 36 36 public: 37 38 enum EUnitType {39 eUT_Monitor = AVC1394_SUBUNIT_VIDEO_MONITOR,40 eUT_Audio = AVC1394_SUBUNIT_AUDIO,41 eUT_Printer = AVC1394_SUBUNIT_PRINTER,42 eUT_Disc = AVC1394_SUBUNIT_DISC_RECORDER,43 eUT_VCR = AVC1394_SUBUNIT_VCR,44 eUT_Tuner = AVC1394_SUBUNIT_TUNER,45 eUT_CA = AVC1394_SUBUNIT_CA,46 eUT_Camera = AVC1394_SUBUNIT_VIDEO_CAMERA,47 eUT_Panel = AVC1394_SUBUNIT_PANEL,48 eUT_BulltinBoard = AVC1394_SUBUNIT_BULLETIN_BOARD,49 eUT_CameraStorage = AVC1394_SUBUNIT_CAMERA_STORAGE,50 eUT_Music = AVC1394_SUBUNIT_MUSIC,51 eUT_VendorUnique = AVC1394_SUBUNIT_VENDOR_UNIQUE,52 eUT_Reserved = AVC1394_SUBUNIT_RESERVED,53 eUT_Extended = AVC1394_SUBUNIT_EXTENDED,54 eUT_Unit = AVC1394_SUBUNIT_UNIT,55 };56 57 37 UnitInfoCmd( Ieee1394Service& ieee1349service ); 58 38 virtual ~UnitInfoCmd(); trunk/libffado/src/libavc/general/avc_vendor_dependent_cmd.h
r864 r1498 27 27 #include "avc_generic.h" 28 28 29 #include <libavc1394/avc1394.h>30 29 namespace AVC { 31 30 trunk/libffado/src/libavc/musicsubunit/avc_descriptor_music.h
r1361 r1498 37 37 38 38 #include "debugmodule/debugmodule.h" 39 40 #include <libavc1394/avc1394.h>41 39 42 40 #include <vector> trunk/libffado/src/libavc/streamformat/avc_extended_stream_format.h
r1361 r1498 28 28 #include "../general/avc_extended_cmd_generic.h" 29 29 30 #include <libavc1394/avc1394.h>31 30 #include <iostream> 32 31 #include <vector> trunk/libffado/src/libcontrol/ClockSelect.cpp
r1336 r1498 171 171 } 172 172 173 bool 174 ClockSelect::canChangeValue() 175 { 176 return m_Device.getStreamingState() == FFADODevice::eSS_Idle; 177 } 178 173 179 void 174 180 ClockSelect::show() … … 240 246 } 241 247 248 bool 249 SamplerateSelect::canChangeValue() 250 { 251 return m_Device.getStreamingState() == FFADODevice::eSS_Idle; 252 } 253 242 254 void 243 255 SamplerateSelect::show() … … 248 260 } 249 261 262 // --- stream status feedback selection --- 263 264 StreamingStatus::StreamingStatus(FFADODevice &d) 265 : Enum(&d) 266 , m_Device( d ) 267 { 268 setName("StreamingStatus"); 269 setLabel("Streaming Status"); 270 setDescription("Obtain information of the current streaming status of a device"); 271 } 272 273 bool 274 StreamingStatus::select(int idx) 275 { 276 debugWarning("Cannot change stream status through control interface\n"); 277 return false; 278 } 279 280 int 281 StreamingStatus::selected() 282 { 283 return m_Device.getStreamingState(); 284 } 285 286 int 287 StreamingStatus::count() 288 { 289 // NOTE: this should correspond to the number of enums in FFADODevice::eStreamingState 290 return 4; 291 } 292 293 std::string 294 StreamingStatus::getEnumLabel(int idx) 295 { 296 switch(idx) { 297 case FFADODevice::eSS_Idle: 298 return "Idle"; 299 case FFADODevice::eSS_Sending: 300 return "Sending"; 301 case FFADODevice::eSS_Receiving: 302 return "Receiving"; 303 case FFADODevice::eSS_Both: 304 return "Both"; 305 default: 306 debugError("Invalid enum index specified: %d\n", idx); 307 return "Invalid enum index"; 308 } 309 } 310 311 bool 312 StreamingStatus::canChangeValue() 313 { 314 return false; 315 } 316 317 void 318 StreamingStatus::show() 319 { 320 debugOutput( DEBUG_LEVEL_NORMAL, "StreamingStatus Element %s, current: %d\n", 321 getName().c_str(), m_Device.getStreamingState()); 322 } 323 250 324 251 325 } // namespace Control trunk/libffado/src/libcontrol/ClockSelect.h
r1336 r1498 58 58 virtual std::string getAttributeName(int attridx); 59 59 60 virtual bool canChangeValue(); 61 60 62 virtual void show(); 61 63 … … 80 82 virtual std::string getEnumLabel(int idx); 81 83 84 virtual bool canChangeValue(); 85 86 virtual void show(); 87 88 protected: 89 FFADODevice &m_Device; 90 }; 91 92 /*! 93 * @brief Stream status control element 94 */ 95 class StreamingStatus 96 : public Enum 97 { 98 public: 99 StreamingStatus(FFADODevice &); 100 virtual ~StreamingStatus() {}; 101 102 virtual bool select(int idx); 103 virtual int selected(); 104 virtual int count(); 105 virtual std::string getEnumLabel(int idx); 106 107 virtual bool canChangeValue(); 108 82 109 virtual void show(); 83 110 trunk/libffado/src/libcontrol/Element.cpp
r1336 r1498 92 92 } 93 93 94 bool 95 Element::isControlLocked() 96 { 97 return getLock().isLocked(); 98 } 99 94 100 Util::Mutex& 95 101 Element::getLock() … … 101 107 return *m_element_lock; 102 108 } 109 } 110 111 bool 112 Element::canChangeValue() 113 { 114 return true; 103 115 } 104 116 trunk/libffado/src/libcontrol/Element.h
r1336 r1498 83 83 {return m_id;}; 84 84 85 // can the value of this element change? 86 virtual bool canChangeValue(); 87 85 88 // these allow to prevent external access to the control elements 86 89 // e.g. when the config tree is rebuilt 87 90 virtual void lockControl(); 88 91 virtual void unlockControl(); 92 virtual bool isControlLocked(); 89 93 90 94 /** trunk/libffado/src/libcontrol/Nickname.cpp
r1158 r1498 53 53 } 54 54 55 bool 56 Nickname::canChangeValue() 57 { 58 return m_Device.canChangeNickname(); 59 } 55 60 56 61 void trunk/libffado/src/libcontrol/Nickname.h
r1063 r1498 49 49 virtual std::string getValue(); 50 50 51 virtual bool canChangeValue(); 52 51 53 virtual void show(); 52 54 trunk/libffado/src/libieee1394/CycleTimerHelper.cpp
r1348 r1498 357 357 uint64_t local_time; 358 358 int64_t usecs_late; 359 int ntries= 4;359 int ntries=10; 360 360 uint64_t cycle_timer_ticks; 361 double diff_ticks; 362 363 // if the difference between the predicted value and the 361 int64_t err_ticks; 362 bool not_good; 363 364 // if the difference between the predicted value at readout time and the 364 365 // actual value seems to be too large, retry reading the cycle timer 365 366 // some host controllers return bogus values on some reads … … 373 374 usecs_late = local_time - m_sleep_until; 374 375 cycle_timer_ticks = CYCLE_TIMER_TO_TICKS(cycle_timer); 375 diff_ticks = diffTicks(cycle_timer_ticks, (int64_t)m_next_time_ticks); 376 377 // calculate the CTR_TICKS we expect to read at "local_time" 378 // then calculate the difference with what we actually read, 379 // taking wraparound into account. If these deviate too much 380 // from eachother then read the register again (bogus read). 381 int64_t expected_ticks = getCycleTimerTicks(local_time); 382 err_ticks = diffTicks(cycle_timer_ticks, expected_ticks); 376 383 377 384 // check for unrealistic CTR reads (NEC controller does that sometimes) 378 if(diff_ticks < -((double)TICKS_PER_HALFCYCLE)) { 379 debugOutput(DEBUG_LEVEL_ULTRA_VERBOSE, 380 "(%p) have to retry CTR read, diff unrealistic: diff: %f, max: %f (try: %d)\n", 381 this, diff_ticks, -((double)TICKS_PER_HALFCYCLE), ntries); 382 } 383 384 } while( diff_ticks < -((double)TICKS_PER_HALFCYCLE) 385 && --ntries && !m_first_run && !m_unhandled_busreset); 385 not_good = (-err_ticks > 1*TICKS_PER_HALFCYCLE || err_ticks > 1*TICKS_PER_HALFCYCLE); 386 if(not_good) { 387 debugOutput(DEBUG_LEVEL_VERBOSE, 388 "(%p) have to retry CTR read, diff unrealistic: diff: %lld, max: +/- %ld (try: %d) %lld\n", 389 this, err_ticks, 1*TICKS_PER_CYCLE, ntries, expected_ticks); 390 // sleep half a cycle to make sure the hardware moved on 391 Util::SystemTimeSource::SleepUsecRelative(USECS_PER_CYCLE/2); 392 } 393 394 } while(not_good && --ntries && !m_first_run && !m_unhandled_busreset); 386 395 387 396 // grab the lock after sleeping, otherwise we can't be interrupted by … … 390 399 // wakeup and read is as small as possible 391 400 Util::MutexLockHelper lock(*m_update_lock); 401 402 // the difference between the measured and the expected time 403 int64_t diff_ticks = diffTicks(cycle_timer_ticks, (int64_t)m_next_time_ticks); 392 404 393 405 // // simulate a random scheduling delay between (0-10ms) … … 418 430 } 419 431 m_first_run = false; 420 } else if (diff_ticks > 20.0*m_ticks_per_update) {432 } else if (diff_ticks > m_ticks_per_update * 20) { 421 433 debugOutput(DEBUG_LEVEL_VERBOSE, 422 "re-init dll due to too large tick diff: % f>> %f\n",423 diff_ticks, (float)( 20.0*m_ticks_per_update));434 "re-init dll due to too large tick diff: %lld >> %f\n", 435 diff_ticks, (float)(m_ticks_per_update * 20)); 424 436 if(!initDLL()) { 425 437 debugError("(%p) Could not init DLL\n", this); … … 442 454 // the corrected difference between predicted and actual ctr 443 455 // i.e. DLL error signal 444 doublediff_ticks_corr;456 int64_t diff_ticks_corr; 445 457 if (ticks_late > 0) { 446 458 diff_ticks_corr = diff_ticks - ticks_late; 447 459 debugOutputExtreme(DEBUG_LEVEL_ULTRA_VERBOSE, 448 "diff_ticks_corr=% f, diff_ticks = %f, ticks_late = %lld\n",460 "diff_ticks_corr=%lld, diff_ticks = %lld, ticks_late = %lld\n", 449 461 diff_ticks_corr, diff_ticks, ticks_late); 450 462 } else { … … 487 499 // and coeff_b < 1, hence tmp is not near wrapping 488 500 489 double step_ticks = (coeff_b * diff_ticks_corr); 501 double diff_ticks_corr_d = (double)diff_ticks_corr; 502 double step_ticks = (coeff_b * diff_ticks_corr_d); 490 503 debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, 491 504 "diff_ticks_corr=%f, step_ticks=%f\n", 492 diff_ticks_corr , step_ticks);505 diff_ticks_corr_d, step_ticks); 493 506 494 507 // the same goes for m_dll_e2, which should be approx equal … … 515 528 516 529 // update the DLL state 517 m_dll_e2 += coeff_c * diff_ticks_corr ;530 m_dll_e2 += coeff_c * diff_ticks_corr_d; 518 531 519 532 // update the y-axis values … … 525 538 m_current_time_usecs, m_next_time_usecs, usecs_late, ticks_late); 526 539 debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, 527 " ticks: current: %f next: %f diff=% f\n",540 " ticks: current: %f next: %f diff=%lld\n", 528 541 m_current_time_ticks, m_next_time_ticks, diff_ticks); 529 542 debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, trunk/libffado/src/libieee1394/ieee1394service.cpp
r1441 r1498 31 31 #include "CycleTimerHelper.h" 32 32 33 #include <libavc1394/avc1394.h>34 33 #include <libraw1394/csr.h> 35 34 #include <libiec61883/iec61883.h> … … 38 37 #include "libutil/Watchdog.h" 39 38 #include "libutil/PosixMutex.h" 39 #include "libutil/Configuration.h" 40 40 41 41 #include <errno.h> … … 52 52 53 53 Ieee1394Service::Ieee1394Service() 54 : m_handle( 0 ) 54 : m_configuration( NULL ) 55 , m_handle( 0 ) 55 56 , m_handle_lock( new Util::PosixMutex("SRCVHND") ) 56 57 , m_resetHandle( 0 ) … … 64 65 , m_pCTRHelper ( new CycleTimerHelper( *this, IEEE1394SERVICE_CYCLETIMER_DLL_UPDATE_INTERVAL_USEC ) ) 65 66 , m_have_new_ctr_read ( false ) 67 , m_filterFCPResponse ( false ) 66 68 , m_pWatchdog ( new Util::Watchdog() ) 67 69 { … … 78 80 79 81 Ieee1394Service::Ieee1394Service(bool rt, int prio) 80 : m_handle( 0 ) 82 : m_configuration( NULL ) 83 , m_handle( 0 ) 81 84 , m_handle_lock( new Util::PosixMutex("SRCVHND") ) 82 85 , m_resetHandle( 0 ) … … 90 93 , m_pCTRHelper ( new CycleTimerHelper( *this, IEEE1394SERVICE_CYCLETIMER_DLL_UPDATE_INTERVAL_USEC, 91 94 rt && IEEE1394SERVICE_CYCLETIMER_HELPER_RUN_REALTIME, 92 prio + IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO_INCREASE) )95 IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO ) ) 93 96 , m_have_new_ctr_read ( false ) 97 , m_filterFCPResponse ( false ) 94 98 , m_pWatchdog ( new Util::Watchdog() ) 95 99 { … … 137 141 } 138 142 143 bool 144 Ieee1394Service::useConfiguration(Util::Configuration *c) 145 { 146 m_configuration = c; 147 return configurationUpdated(); 148 } 149 150 bool 151 Ieee1394Service::configurationUpdated() 152 { 153 if(m_configuration) { 154 155 } 156 return true; 157 } 158 139 159 #define DEVICEFAILTEXT "Could not get libraw1394 handle.\n\ 140 160 This usually means:\n\ … … 190 210 Util::SystemTimeSource::SleepUsecRelative( sleep_time_ms * 1000); 191 211 } while (gen_current != getGeneration() && --nb_tries); 212 213 debugOutput(DEBUG_LEVEL_VERBOSE, "Bus reset storm over at gen: %u\n", gen_current); 192 214 193 215 if (!nb_tries) { … … 278 300 raw1394handle_t tmp_handle = raw1394_new_handle(); 279 301 if ( tmp_handle == NULL ) { 280 debugError("Could not get tempora ty libraw1394 handle.\n");302 debugError("Could not get temporary libraw1394 handle.\n"); 281 303 return false; 282 304 } … … 299 321 } 300 322 323 // set userdata 301 324 raw1394_set_userdata( m_handle, this ); 302 325 raw1394_set_userdata( m_resetHandle, this ); … … 308 331 this->armHandlerLowLevel ); 309 332 333 int split_timeout = IEEE1394SERVICE_MIN_SPLIT_TIMEOUT_USECS; 334 if(m_configuration) { 335 m_configuration->getValueForSetting("ieee1394.min_split_timeout_usecs", split_timeout); 336 } 337 338 // set SPLIT_TIMEOUT to one second to cope with DM1x00 devices that 339 // send responses regardless of the timeout 340 int timeout = getSplitTimeoutUsecs(getLocalNodeId()); 341 debugOutput(DEBUG_LEVEL_VERBOSE, "Minimum SPLIT_TIMEOUT: %d. Current: %d\n", split_timeout, timeout); 342 if (timeout < split_timeout) { 343 if(!setSplitTimeoutUsecs(getLocalNodeId(), split_timeout+124)) { 344 debugWarning("Could not set SPLIT_TIMEOUT to min requested (%d)\n", split_timeout); 345 } 346 timeout = getSplitTimeoutUsecs(getLocalNodeId()); 347 if (timeout < split_timeout) { 348 debugWarning("Set SPLIT_TIMEOUT to min requested (%d) did not succeed\n", split_timeout); 349 } 350 } 351 352 // init helpers 310 353 if(!m_pCTRHelper) { 311 354 debugFatal("No CycleTimerHelper available, bad!\n"); … … 323 366 } 324 367 m_pIsoManager->setVerboseLevel(getDebugLevel()); 368 325 369 if(!m_pIsoManager->init()) { 326 370 debugFatal("Could not initialize IsoHandlerManager\n"); … … 342 386 bool result = true; 343 387 if (priority > THREAD_MAX_RTPRIO) priority = THREAD_MAX_RTPRIO; 388 if (priority < THREAD_MIN_RTPRIO) priority = THREAD_MIN_RTPRIO; 344 389 m_base_priority = priority; 345 390 m_realtime = rt; … … 352 397 debugOutput(DEBUG_LEVEL_VERBOSE, "Switching CycleTimerHelper to (rt=%d, prio=%d)\n", 353 398 rt && IEEE1394SERVICE_CYCLETIMER_HELPER_RUN_REALTIME, 354 priority + IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO_INCREASE);399 IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO); 355 400 result &= m_pCTRHelper->setThreadParameters(rt && IEEE1394SERVICE_CYCLETIMER_HELPER_RUN_REALTIME, 356 priority + IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO_INCREASE);401 IEEE1394SERVICE_CYCLETIMER_HELPER_PRIO); 357 402 } 358 403 return result; … … 463 508 { 464 509 Util::MutexLockHelper lock(*m_handle_lock); 510 return readNoLock(nodeId, addr, length, buffer); 511 } 512 513 bool 514 Ieee1394Service::readNoLock( fb_nodeid_t nodeId, 515 fb_nodeaddr_t addr, 516 size_t length, 517 fb_quadlet_t* buffer ) 518 { 465 519 if (nodeId == INVALID_NODE_ID) { 466 520 debugWarning("operation on invalid node\n"); … … 511 565 { 512 566 Util::MutexLockHelper lock(*m_handle_lock); 567 return writeNoLock(nodeId, addr, length, data); 568 } 569 570 bool 571 Ieee1394Service::writeNoLock( fb_nodeid_t nodeId, 572 fb_nodeaddr_t addr, 573 size_t length, 574 fb_quadlet_t* data ) 575 { 513 576 if (nodeId == INVALID_NODE_ID) { 514 577 debugWarning("operation on invalid node\n"); … … 601 664 unsigned int* resp_len ) 602 665 { 666 // FIXME: simplify semantics 603 667 if (nodeId == INVALID_NODE_ID) { 604 668 debugWarning("operation on invalid node\n"); 605 669 return false; 606 670 } 607 // FIXME: this requirestransactionBlockClose to unlock671 // NOTE: this expects a call to transactionBlockClose to unlock 608 672 m_handle_lock->Lock(); 609 for (int i = 0; i < len; ++i) { 610 buf[i] = CondSwapFromBus32( buf[i] ); 611 } 612 613 fb_quadlet_t* result = 614 avc1394_transaction_block2( m_handle, 615 nodeId, 616 buf, 617 len, 618 resp_len, 619 10 ); 620 621 for ( unsigned int i = 0; i < *resp_len; ++i ) { 622 result[i] = CondSwapToBus32( result[i] ); 623 } 624 625 return result; 626 } 627 673 674 // clear the request & response memory 675 memset(&m_fcp_block, 0, sizeof(m_fcp_block)); 676 677 // make a local copy of the request 678 if(len < MAX_FCP_BLOCK_SIZE_QUADS) { 679 memcpy(m_fcp_block.request, buf, len*sizeof(quadlet_t)); 680 m_fcp_block.request_length = len; 681 } else { 682 debugWarning("Truncating FCP request\n"); 683 memcpy(m_fcp_block.request, buf, MAX_FCP_BLOCK_SIZE_BYTES); 684 m_fcp_block.request_length = MAX_FCP_BLOCK_SIZE_QUADS; 685 } 686 m_fcp_block.target_nodeid = 0xffc0 | nodeId; 687 688 bool success = doFcpTransaction(); 689 if(success) { 690 *resp_len = m_fcp_block.response_length; 691 return m_fcp_block.response; 692 } else { 693 debugWarning("FCP transaction failed\n"); 694 *resp_len = 0; 695 return NULL; 696 } 697 } 628 698 629 699 bool 630 700 Ieee1394Service::transactionBlockClose() 631 701 { 632 avc1394_transaction_block_close( m_handle );633 702 m_handle_lock->Unlock(); 634 703 return true; 704 } 705 706 // FCP code 707 bool 708 Ieee1394Service::doFcpTransaction() 709 { 710 for(int i=0; i < IEEE1394SERVICE_FCP_MAX_TRIES; i++) { 711 if(doFcpTransactionTry()) { 712 return true; 713 } else { 714 debugOutput(DEBUG_LEVEL_VERBOSE, "FCP transaction try %d failed\n", i); 715 Util::SystemTimeSource::SleepUsecRelative( IEEE1394SERVICE_FCP_SLEEP_BETWEEN_FAILURES_USECS); 716 } 717 } 718 debugError("FCP transaction didn't succeed in %d tries\n", IEEE1394SERVICE_FCP_MAX_TRIES); 719 return false; 720 } 721 722 #define FCP_COMMAND_ADDR 0xFFFFF0000B00ULL 723 #define FCP_RESPONSE_ADDR 0xFFFFF0000D00ULL 724 725 /* AV/C FCP response codes */ 726 #define FCP_RESPONSE_NOT_IMPLEMENTED 0x08000000 727 #define FCP_RESPONSE_ACCEPTED 0x09000000 728 #define FCP_RESPONSE_REJECTED 0x0A000000 729 #define FCP_RESPONSE_IN_TRANSITION 0x0B000000 730 #define FCP_RESPONSE_IMPLEMENTED 0x0C000000 731 #define FCP_RESPONSE_STABLE 0x0C000000 732 #define FCP_RESPONSE_CHANGED 0x0D000000 733 #define FCP_RESPONSE_INTERIM 0x0F000000 734 735 /* AV/C FCP mask macros */ 736 #define FCP_MASK_START(x) ((x) & 0xF0000000) 737 #define FCP_MASK_CTYPE(x) ((x) & 0x0F000000) 738 #define FCP_MASK_RESPONSE(x) ((x) & 0x0F000000) 739 #define FCP_MASK_SUBUNIT(x) ((x) & 0x00FF0000) 740 #define FCP_MASK_SUBUNIT_TYPE(x) ((x) & 0x00F80000) 741 #define FCP_MASK_SUBUNIT_ID(x) ((x) & 0x00070000) 742 #define FCP_MASK_OPCODE(x) ((x) & 0x0000FF00) 743 #define FCP_MASK_SUBUNIT_AND_OPCODE(x) ((x) & 0x00FFFF00) 744 #define FCP_MASK_OPERAND0(x) ((x) & 0x000000FF) 745 #define FCP_MASK_OPERAND(x, n) ((x) & (0xFF000000 >> ((((n)-1)%4)*8))) 746 #define FCP_MASK_RESPONSE_OPERAND(x, n) ((x) & (0xFF000000 >> (((n)%4)*8))) 747 748 bool 749 Ieee1394Service::doFcpTransactionTry() 750 { 751 // NOTE that access to this is protected by the m_handle lock 752 int err; 753 bool retval = true; 754 uint64_t timeout; 755 756 // prepare an fcp response handler 757 raw1394_set_fcp_handler(m_handle, _avc_fcp_handler); 758 759 // start listening for FCP requests 760 // this fails if some other program is listening for a FCP response 761 err = raw1394_start_fcp_listen(m_handle); 762 if(err) { 763 debugOutput(DEBUG_LEVEL_VERBOSE, "could not start FCP listen (err=%d, errno=%d)\n", err, errno); 764 retval = false; 765 goto out; 766 } 767 768 m_fcp_block.status = eFS_Waiting; 769 770 #ifdef DEBUG 771 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"fcp request: node 0x%hX, length = %d bytes\n", 772 m_fcp_block.target_nodeid, m_fcp_block.request_length*4); 773 printBuffer(DEBUG_LEVEL_VERY_VERBOSE, m_fcp_block.request_length, m_fcp_block.request ); 774 #endif 775 776 // write the FCP request 777 if(!writeNoLock( m_fcp_block.target_nodeid, FCP_COMMAND_ADDR, 778 m_fcp_block.request_length, m_fcp_block.request)) { 779 debugOutput(DEBUG_LEVEL_VERBOSE, "write of FCP request failed\n"); 780 retval = false; 781 goto out; 782 } 783 784 // wait for the response to arrive 785 struct pollfd raw1394_poll; 786 raw1394_poll.fd = raw1394_get_fd(m_handle); 787 raw1394_poll.events = POLLIN; 788 789 timeout = Util::SystemTimeSource::getCurrentTimeAsUsecs() + 790 IEEE1394SERVICE_FCP_RESPONSE_TIMEOUT_USEC; 791 792 while(m_fcp_block.status == eFS_Waiting 793 && Util::SystemTimeSource::getCurrentTimeAsUsecs() < timeout) { 794 if(poll( &raw1394_poll, 1, IEEE1394SERVICE_FCP_POLL_TIMEOUT_MSEC) > 0) { 795 if (raw1394_poll.revents & POLLIN) { 796 raw1394_loop_iterate(m_handle); 797 } 798 } 799 } 800 801 // stop listening for FCP responses 802 err = raw1394_stop_fcp_listen(m_handle); 803 if(err) { 804 debugOutput(DEBUG_LEVEL_VERBOSE, "could not stop FCP listen (err=%d, errno=%d)\n", err, errno); 805 retval = false; 806 goto out; 807 } 808 809 // check the request and figure out what happened 810 if(m_fcp_block.status == eFS_Waiting) { 811 debugOutput(DEBUG_LEVEL_VERBOSE, "FCP response timed out\n"); 812 retval = false; 813 goto out; 814 } 815 if(m_fcp_block.status == eFS_Error) { 816 debugError("FCP request/response error\n"); 817 retval = false; 818 goto out; 819 } 820 821 out: 822 m_fcp_block.status = eFS_Empty; 823 return retval; 824 } 825 826 int 827 Ieee1394Service::_avc_fcp_handler(raw1394handle_t handle, nodeid_t nodeid, 828 int response, size_t length, 829 unsigned char *data) 830 { 831 Ieee1394Service *service = static_cast<Ieee1394Service *>(raw1394_get_userdata(handle)); 832 if(service) { 833 return service->handleFcpResponse(nodeid, response, length, data); 834 } else return -1; 835 } 836 837 int 838 Ieee1394Service::handleFcpResponse(nodeid_t nodeid, 839 int response, size_t length, 840 unsigned char *data) 841 { 842 static struct sFcpBlock fcp_block_last; 843 844 fb_quadlet_t *data_quads = (fb_quadlet_t *)data; 845 #ifdef DEBUG 846 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"fcp response: node 0x%hX, response = %d, length = %d bytes\n", 847 nodeid, response, length); 848 printBuffer(DEBUG_LEVEL_VERY_VERBOSE, (length+3)/4, data_quads ); 849 #endif 850 851 if (response && length > 3) { 852 if(length > MAX_FCP_BLOCK_SIZE_BYTES) { 853 length = MAX_FCP_BLOCK_SIZE_BYTES; 854 debugWarning("Truncated FCP response\n"); 855 } 856 857 // is it an actual response or is it INTERIM? 858 quadlet_t first_quadlet = CondSwapFromBus32(data_quads[0]); 859 if(FCP_MASK_RESPONSE(first_quadlet) == FCP_RESPONSE_INTERIM) { 860 debugOutput(DEBUG_LEVEL_VERBOSE, "INTERIM\n"); 861 } else { 862 // it's an actual response, check if it matches our request 863 if(nodeid != m_fcp_block.target_nodeid) { 864 debugOutput(DEBUG_LEVEL_VERBOSE, "FCP response node id's don't match! (%x, %x)\n", 865 m_fcp_block.target_nodeid, nodeid); 866 } else if (first_quadlet == 0) { 867 debugWarning("Bogus FCP response\n"); 868 printBuffer(DEBUG_LEVEL_WARNING, (length+3)/4, data_quads ); 869 #ifdef DEBUG 870 } else if(FCP_MASK_RESPONSE(first_quadlet) < 0x08000000) { 871 debugWarning("Bogus AV/C FCP response code\n"); 872 printBuffer(DEBUG_LEVEL_WARNING, (length+3)/4, data_quads ); 873 #endif 874 } else if(FCP_MASK_SUBUNIT_AND_OPCODE(first_quadlet) 875 != FCP_MASK_SUBUNIT_AND_OPCODE(CondSwapFromBus32(m_fcp_block.request[0]))) { 876 debugOutput(DEBUG_LEVEL_VERBOSE, "FCP response not for this request: %08lX != %08lX\n", 877 FCP_MASK_SUBUNIT_AND_OPCODE(first_quadlet), 878 FCP_MASK_SUBUNIT_AND_OPCODE(CondSwapFromBus32(m_fcp_block.request[0]))); 879 } else if(m_filterFCPResponse && (memcmp(fcp_block_last.response, data, length) == 0)) { 880 // This is workaround for the Edirol FA-101. The device tends to send more than 881 // one responde to one request. This seems to happen when discovering 882 // function blocks and looks very likely there is a race condition in the 883 // device. The workaround here compares the just arrived FCP responde 884 // to the last one. If it is the same as the previously one then we 885 // just ignore it. The downside of this approach is, we cannot issue 886 // the same FCP twice. 887 debugWarning("Received duplicate FCP response. Ignore it\n"); 888 } else { 889 m_fcp_block.response_length = (length + sizeof(quadlet_t) - 1) / sizeof(quadlet_t); 890 memcpy(m_fcp_block.response, data, length); 891 if (m_filterFCPResponse) { 892 memcpy(fcp_block_last.response, data, length); 893 } 894 m_fcp_block.status = eFS_Responded; 895 } 896 } 897 } 898 return 0; 899 } 900 901 bool 902 Ieee1394Service::setSplitTimeoutUsecs(fb_nodeid_t nodeId, unsigned int timeout) 903 { 904 Util::MutexLockHelper lock(*m_handle_lock); 905 debugOutput(DEBUG_LEVEL_VERBOSE, "setting SPLIT_TIMEOUT on node 0x%X to %uusecs...\n", nodeId, timeout); 906 unsigned int secs = timeout / 1000000; 907 unsigned int usecs = timeout % 1000000; 908 909 quadlet_t split_timeout_hi = CondSwapToBus32(secs & 7); 910 quadlet_t split_timeout_low = CondSwapToBus32(((usecs / 125) & 0x1FFF) << 19); 911 912 // write the CSR registers 913 if(!writeNoLock( 0xffc0 | nodeId, CSR_REGISTER_BASE + CSR_SPLIT_TIMEOUT_HI, 1, 914 &split_timeout_hi)) { 915 debugOutput(DEBUG_LEVEL_VERBOSE, "write of CSR_SPLIT_TIMEOUT_HI failed\n"); 916 return false; 917 } 918 if(!writeNoLock( 0xffc0 | nodeId, CSR_REGISTER_BASE + CSR_SPLIT_TIMEOUT_LO, 1, 919 &split_timeout_low)) { 920 debugOutput(DEBUG_LEVEL_VERBOSE, "write of CSR_SPLIT_TIMEOUT_LO failed\n"); 921 return false; 922 } 923 return true; 924 } 925 926 int 927 Ieee1394Service::getSplitTimeoutUsecs(fb_nodeid_t nodeId) 928 { 929 Util::MutexLockHelper lock(*m_handle_lock); 930 quadlet_t split_timeout_hi; 931 quadlet_t split_timeout_low; 932 933 debugOutput(DEBUG_LEVEL_VERBOSE, "reading SPLIT_TIMEOUT on node 0x%X...\n", nodeId); 934 935 if(!readNoLock( 0xffc0 | nodeId, CSR_REGISTER_BASE + CSR_SPLIT_TIMEOUT_HI, 1, 936 &split_timeout_hi)) { 937 debugOutput(DEBUG_LEVEL_VERBOSE, "read of CSR_SPLIT_TIMEOUT_HI failed\n"); 938 return 0; 939 } 940 debugOutput(DEBUG_LEVEL_VERBOSE, " READ HI: 0x%08lX\n", split_timeout_hi); 941 942 if(!readNoLock( 0xffc0 | nodeId, CSR_REGISTER_BASE + CSR_SPLIT_TIMEOUT_LO, 1, 943 &split_timeout_low)) { 944 debugOutput(DEBUG_LEVEL_VERBOSE, "read of CSR_SPLIT_TIMEOUT_LO failed\n"); 945 return 0; 946 } 947 debugOutput(DEBUG_LEVEL_VERBOSE, " READ LO: 0x%08lX\n", split_timeout_low); 948 949 split_timeout_hi = CondSwapFromBus32(split_timeout_hi); 950 split_timeout_low = CondSwapFromBus32(split_timeout_low); 951 952 return (split_timeout_hi & 7) * 1000000 + (split_timeout_low >> 19) * 125; 953 } 954 955 void 956 Ieee1394Service::setFCPResponseFiltering(bool enable) 957 { 958 m_filterFCPResponse = enable; 635 959 } 636 960 trunk/libffado/src/libieee1394/ieee1394service.h
r1348 r1498 41 41 42 42 class ARMHandler; 43 44 #define MAX_FCP_BLOCK_SIZE_BYTES (512) 45 #define MAX_FCP_BLOCK_SIZE_QUADS (MAX_FCP_BLOCK_SIZE_BYTES / 4) 46 43 47 class IsoHandlerManager; 44 48 class CycleTimerHelper; … … 46 50 namespace Util { 47 51 class Watchdog; 52 class Configuration; 48 53 } 49 54 … … 227 232 * @return true if succesful, false otherwise 228 233 */ 229 bool lockCompareSwap64( fb_nodeid_t nodeId, 230 fb_nodeaddr_t addr, 231 fb_octlet_t compare_value, 232 fb_octlet_t swap_value, 233 fb_octlet_t* result ); 234 234 bool lockCompareSwap64( fb_nodeid_t nodeId, 235 fb_nodeaddr_t addr, 236 fb_octlet_t compare_value, 237 fb_octlet_t swap_value, 238 fb_octlet_t* result ); 239 240 /** 241 * initiate AV/C transaction 242 * @param nodeId 243 * @param buf 244 * @param len 245 * @param resp_len 246 * @return 247 */ 235 248 fb_quadlet_t* transactionBlock( fb_nodeid_t nodeId, 236 249 fb_quadlet_t* buf, 237 250 int len, 238 unsigned int* resp_len ); 239 251 unsigned int* resp_len ); 252 253 /** 254 * close AV/C transaction. 255 * @param nodeId 256 * @param buf 257 * @param len 258 * @param resp_len 259 * @return 260 */ 240 261 bool transactionBlockClose(); 241 262 … … 247 268 void doBusReset(); 248 269 bool waitForBusResetStormToEnd( int nb_tries, int sleep_time_ms ); 270 271 /** 272 * @brief register an AddressRangeMapping Handler 273 * @param h pointer to the handler to register 274 * 275 * @return true on success or false on failure 276 **/ 277 278 bool registerARMHandler( ARMHandler *h ); 279 280 /** 281 * @brief unregister ARM range 282 * @param h pointer to the handler to unregister 283 * @return true if successful, false otherwise 284 */ 285 bool unregisterARMHandler( ARMHandler *h ); 286 287 nodeaddr_t findFreeARMBlock( nodeaddr_t start, size_t length, size_t step ); 249 288 250 289 /** … … 259 298 260 299 /** 261 * @brief register an AddressRangeMapping Handler 262 * @param h pointer to the handler to register 263 * 264 * @return true on success or false on failure 300 * @brief update the current generation 301 * 302 * @return the current generation 265 303 **/ 266 267 bool registerARMHandler( ARMHandler *h ); 268 269 /** 270 * @brief unregister ARM range 271 * @param h pointer to the handler to unregister 272 * @return true if successful, false otherwise 273 */ 274 bool unregisterARMHandler( ARMHandler *h ); 275 276 nodeaddr_t findFreeARMBlock( nodeaddr_t start, size_t length, size_t step ); 304 void updateGeneration() { 305 Util::MutexLockHelper lock(*m_handle_lock); 306 raw1394_update_generation( m_handle, getGeneration()); 307 } 308 309 /** 310 * @brief sets the SPLIT_TIMEOUT_HI and SPLIT_TIMEOUT_LO CSR registers 311 * 312 * sets the SPLIT_TIMEOUT_HI and SPLIT_TIMEOUT_LO CSR registers on node 313 * nodeId such that the timeout is equal to timeout 314 * 315 * @param nodeId node to set CSR registers on 316 * @param timeout timeout in usecs 317 * @return true if successful 318 */ 319 bool setSplitTimeoutUsecs(fb_nodeid_t nodeId, unsigned int timeout); 320 321 /** 322 * @brief gets the SPLIT_TIMEOUT_X timeout value 323 * 324 * gets the SPLIT_TIMEOUT_HI and SPLIT_TIMEOUT_LO CSR registers on node 325 * nodeId and recombine them into one usec value 326 * 327 * @param nodeId node to get CSR registers from 328 * @return timeout in usecs if successful, 0 else 329 */ 330 int getSplitTimeoutUsecs(fb_nodeid_t nodeId); 331 332 /** 333 * @brief use the provided configuration for this service 334 * 335 * only update the config once, before init. not thread safe, 336 * and no effect when things are already running. 337 * 338 * @param c configuration to use 339 * @return bool if this config is ok. 340 */ 341 bool useConfiguration(Util::Configuration *c); 342 343 Util::Configuration *getConfiguration() {return m_configuration;}; 344 345 /** 346 * @brief enable or disable FCP response doublicate filtering 347 * 348 * this is use only for devices (e.g. edirol fa101) which have a 349 * buggy FCP implementation and send more then one FCP response 350 * for one request. 351 */ 352 void setFCPResponseFiltering(bool enable); 277 353 278 354 // ISO channel stuff … … 312 388 raw1394handle_t getHandle() {return m_handle;}; 313 389 390 protected: 391 Util::Configuration *m_configuration; 392 314 393 private: 394 bool configurationUpdated(); 395 315 396 bool startRHThread(); 316 397 void stopRHThread(); … … 349 430 bool m_have_new_ctr_read; 350 431 432 bool m_filterFCPResponse; 433 351 434 // the RT watchdog 352 435 Util::Watchdog* m_pWatchdog; … … 360 443 typedef std::vector< ARMHandler * > arm_handler_vec_t; 361 444 arm_handler_vec_t m_armHandlers; 445 446 // unprotected variants 447 bool writeNoLock( fb_nodeid_t nodeId, 448 fb_nodeaddr_t addr, 449 size_t length, 450 fb_quadlet_t* data ); 451 bool readNoLock( fb_nodeid_t nodeId, 452 fb_nodeaddr_t addr, 453 size_t length, 454 fb_quadlet_t* buffer ); 455 456 // FCP transaction support 457 static int _avc_fcp_handler(raw1394handle_t handle, nodeid_t nodeid, 458 int response, size_t length, 459 unsigned char *data); 460 int handleFcpResponse(nodeid_t nodeid, 461 int response, size_t length, 462 unsigned char *data); 463 464 enum eFcpStatus { 465 eFS_Empty, 466 eFS_Waiting, 467 eFS_Responded, 468 eFS_Error, 469 }; 470 471 struct sFcpBlock { 472 enum eFcpStatus status; 473 nodeid_t target_nodeid; 474 unsigned int request_length; 475 quadlet_t request[MAX_FCP_BLOCK_SIZE_QUADS]; 476 unsigned int response_length; 477 quadlet_t response[MAX_FCP_BLOCK_SIZE_QUADS]; 478 }; 479 struct sFcpBlock m_fcp_block; 480 481 bool doFcpTransaction(); 482 bool doFcpTransactionTry(); 362 483 363 484 public: trunk/libffado/src/libieee1394/IsoHandler.cpp
r1348 r1498 81 81 , m_last_now( 0xFFFFFFFF ) 82 82 , m_last_packet_handled_at( 0xFFFFFFFF ) 83 , m_receive_mode ( RAW1394_DMA_PACKET_PER_BUFFER ) 83 84 , m_Client( 0 ) 84 85 , m_speed( RAW1394_ISO_SPEED_400 ) … … 106 107 , m_last_now( 0xFFFFFFFF ) 107 108 , m_last_packet_handled_at( 0xFFFFFFFF ) 109 , m_receive_mode ( RAW1394_DMA_PACKET_PER_BUFFER ) 108 110 , m_Client( 0 ) 109 111 , m_speed( RAW1394_ISO_SPEED_400 ) … … 131 133 , m_last_now( 0xFFFFFFFF ) 132 134 , m_last_packet_handled_at( 0xFFFFFFFF ) 135 , m_receive_mode ( RAW1394_DMA_PACKET_PER_BUFFER ) 133 136 , m_Client( 0 ) 134 137 , m_speed( speed ) … … 376 379 unsigned char channel, unsigned char tag, unsigned char sy, 377 380 unsigned int cycle, unsigned int dropped) { 378 379 381 // keep track of dropped cycles 380 382 int dropped_cycles = 0; … … 396 398 m_last_cycle = cycle; 397 399 398 uint32_t pkt_ctr = cycle << 12; 399 400 // if we assume that one iterate() loop doesn't take longer than 0.5 seconds, 401 // the seconds field won't change while the iterate loop runs 402 // this means that we can preset 'now' before running iterate() 403 uint32_t now_secs = CYCLE_TIMER_GET_SECS(m_last_now); 404 // causality results in the fact that 'now' is always after 'cycle' 405 // except if additional packets are received between setting the 406 // m_last_now and the starting the iterate() loop. 407 // this causes the m_last_now to be set at a time before the last packet 408 // in this loop is received. however, it's not going to be >4000 cycles. 409 // hence: 410 // - if the m_last_now > cycle, there is no need to unwrap 411 // both values are within the same second 412 // - if m_last_now < cycle it can mean two things: 413 // * m_last_now has wrapped, but is still later than cycle 414 // hence diffCycles(m_last_now, cycle) > 0. We should unwrap 415 // * m_last_now has not wrapped, and cycle is ahead of m_last_now 416 // this means that the cycle is more recent than the saved 417 // m_last_now value 418 // . Hence if we calculate 419 // the unwrapped difference, and it's larger than 0, this means 420 // that m_last_now is after the current cycle. . 421 // it m_last_now is before the current cycle, we should not unwrap 422 // NOTE: another option is to reread the m_last_now 423 if( (CYCLE_TIMER_GET_CYCLES(m_last_now) < cycle) 424 && diffCycles(CYCLE_TIMER_GET_CYCLES(m_last_now), cycle) >= 0) { 425 debugOutputExtreme(DEBUG_LEVEL_VERBOSE, 426 "unwrapping %d => %d, %d\n", 427 CYCLE_TIMER_GET_CYCLES(m_last_now), 428 cycle); 429 // the cycle field has wrapped, substract one second 430 if(now_secs == 0) { 431 now_secs = 127; 432 } else { 433 now_secs -= 1; 434 } 435 } 436 400 // the m_last_now value is set when the iterate() function is called. 401 uint32_t now_cycles = CYCLE_TIMER_GET_CYCLES(m_last_now); 402 403 // two cases can occur: 404 // (1) this packet has been received before iterate() was called (normal case). 405 // (2) this packet has been received after iterate() was called. 406 // happens when the kernel flushes more packets while we are already processing. 407 // 408 // In case (1) now_cycles is a small number of cycles larger than cycle. In 409 // case (2) now_cycles is a small number of cycles smaller than cycle. 410 // hence abs(diffCycles(now_cycles, cycles)) has to be 'small' 411 412 // we can calculate the time of arrival for this packet as 413 // 'now' + diffCycles(cycles, now_cycles) * TICKS_PER_CYCLE 414 // in its properly wrapped version 415 int64_t diff_cycles = diffCycles(cycle, now_cycles); 416 int64_t tmp = CYCLE_TIMER_TO_TICKS(m_last_now); 417 tmp += diff_cycles * (int64_t)TICKS_PER_CYCLE; 418 uint64_t pkt_ctr_ticks = wrapAtMinMaxTicks(tmp); 419 uint32_t pkt_ctr = TICKS_TO_CYCLE_TIMER(pkt_ctr_ticks); 437 420 #ifdef DEBUG 438 if( ( CYCLE_TIMER_GET_CYCLES(m_last_now)< cycle)439 && diffCycles( CYCLE_TIMER_GET_CYCLES(m_last_now), cycle) < 0421 if( (now_cycles < cycle) 422 && diffCycles(now_cycles, cycle) < 0 440 423 // ignore this on dropped cycles, since it's normal 441 424 // that now is ahead on the received packets (as we miss packets) … … 445 428 } 446 429 #endif 447 pkt_ctr |= (now_secs & 0x7F) << 25;448 430 449 431 #if ISOHANDLER_CHECK_CTR_RECONSTRUCTION … … 465 447 pkt_ctr_ref |= (now_secs_ref & 0x7F) << 25; 466 448 467 if( pkt_ctr!= pkt_ctr_ref) {449 if((pkt_ctr & ~0x0FFFL) != pkt_ctr_ref) { 468 450 debugWarning("reconstructed CTR counter discrepancy\n"); 469 debugWarning(" ingredients: %X, %lX, %lX, %lX, %lX, %ld, %ld\n", 470 cycle, pkt_ctr_ref, pkt_ctr, now, m_last_now, now_secs_ref, now_secs); 451 debugWarning(" ingredients: %X, %lX, %lX, %lX, %lX, %ld, %ld, %ld, %lld\n", 452 cycle, pkt_ctr_ref, pkt_ctr, now, m_last_now, now_secs_ref, CYCLE_TIMER_GET_SECS(now), CYCLE_TIMER_GET_SECS(m_last_now), tmp); 453 debugWarning(" diffcy = %ld \n", diff_cycles); 471 454 } 472 455 #endif … … 520 503 pkt_ctr = 0xFFFFFFFF; 521 504 } else { 522 pkt_ctr = cycle << 12; 523 524 // if we assume that one iterate() loop doesn't take longer than 0.5 seconds, 525 // the seconds field won't change while the iterate loop runs 526 // this means that we can preset 'now' before running iterate() 527 uint32_t now_secs = CYCLE_TIMER_GET_SECS(m_last_now); 528 // causality results in the fact that 'now' is always after 'cycle' 529 if(CYCLE_TIMER_GET_CYCLES(m_last_now) > (unsigned int)cycle) { 530 // the cycle field has wrapped, add one second 531 now_secs += 1; 532 // no need for this: 533 //if(now_secs == 128) { 534 // now_secs = 0; 535 //} 536 // since we mask later on 537 } 538 pkt_ctr |= (now_secs & 0x7F) << 25; 505 // the m_last_now value is set when the iterate() function is called. 506 uint32_t now_cycles = CYCLE_TIMER_GET_CYCLES(m_last_now); 507 508 // two cases can occur: 509 // (1) this packet has been received before iterate() was called (normal case). 510 // (2) this packet has been received after iterate() was called. 511 // happens when the kernel flushes more packets while we are already processing. 512 // 513 // In case (1) now_cycles is a small number of cycles larger than cycle. In 514 // case (2) now_cycles is a small number of cycles smaller than cycle. 515 // hence abs(diffCycles(now_cycles, cycles)) has to be 'small' 516 517 // we can calculate the time of arrival for this packet as 518 // 'now' + diffCycles(cycles, now_cycles) * TICKS_PER_CYCLE 519 // in its properly wrapped version 520 int64_t diff_cycles = diffCycles(cycle, now_cycles); 521 int64_t tmp = CYCLE_TIMER_TO_TICKS(m_last_now); 522 tmp += diff_cycles * (int64_t)TICKS_PER_CYCLE; 523 uint64_t pkt_ctr_ticks = wrapAtMinMaxTicks(tmp); 524 pkt_ctr = TICKS_TO_CYCLE_TIMER(pkt_ctr_ticks); 539 525 540 526 #if ISOHANDLER_CHECK_CTR_RECONSTRUCTION … … 547 533 now_secs_ref += 1; 548 534 // no need for this: 549 //if(now_secs == 128) { 550 // now_secs = 0; 551 //} 552 // since we mask later on 535 if(now_secs_ref == 128) { 536 now_secs_ref = 0; 537 } 553 538 } 554 539 uint32_t pkt_ctr_ref = cycle << 12; 555 540 pkt_ctr_ref |= (now_secs_ref & 0x7F) << 25; 556 541 557 if( pkt_ctr!= pkt_ctr_ref) {542 if((pkt_ctr & ~0x0FFFL) != pkt_ctr_ref) { 558 543 debugWarning("reconstructed CTR counter discrepancy\n"); 559 pkt_ctr=pkt_ctr_ref; 544 debugWarning(" ingredients: %X, %lX, %lX, %lX, %lX, %ld, %ld, %ld, %lld\n", 545 cycle, pkt_ctr_ref, pkt_ctr, now, m_last_now, now_secs_ref, CYCLE_TIMER_GET_SECS(now), CYCLE_TIMER_GET_SECS(m_last_now), tmp); 546 debugWarning(" diffcy = %ld \n", diff_cycles); 560 547 } 561 548 #endif … … 675 662 m_max_packet_size, 676 663 m_Client->getChannel(), 677 RAW1394_DMA_PACKET_PER_BUFFER,664 m_receive_mode, 678 665 m_irq_interval)) { 679 debugFatal("Could not do receive initialisation (DMA_BUFFERFILL)!\n" );666 debugFatal("Could not do receive initialisation!\n" ); 680 667 debugFatal(" %s\n",strerror(errno)); 681 668 return false; … … 728 715 // indicate that the first iterate() still has to occur. 729 716 m_last_now = 0xFFFFFFFF; 717 m_last_packet_handled_at = 0xFFFFFFFF; 730 718 731 719 m_State = E_Running; trunk/libffado/src/libieee1394/IsoHandler.h
r1348 r1498 168 168 uint32_t getLastPacketTime() {return m_last_packet_handled_at;}; 169 169 170 /** 171 * @brief set iso receive mode. doesn't have any effect if the stream is running 172 * @param m receive mode 173 */ 174 void setReceiveMode(enum raw1394_iso_dma_recv_mode m) 175 {m_receive_mode = m;} 176 170 177 void notifyOfDeath(); 171 178 bool handleBusReset(); … … 181 188 uint32_t m_last_now; 182 189 uint32_t m_last_packet_handled_at; 190 enum raw1394_iso_dma_recv_mode m_receive_mode; 183 191 184 192 Streaming::StreamProcessor *m_Client; // FIXME: implement with functors trunk/libffado/src/libieee1394/IsoHandlerManager.cpp
r1348 r1498 33 33 #include "libutil/SystemTimeSource.h" 34 34 #include "libutil/Watchdog.h" 35 #include "libutil/Configuration.h" 35 36 36 37 #include <cstring> … … 50 51 , m_running( false ) 51 52 , m_in_busreset( false ) 53 , m_activity_wait_timeout_nsec (ISOHANDLERMANAGER_ISO_TASK_WAIT_TIMEOUT_USECS * 1000LL) 52 54 { 53 55 } … … 344 346 } 345 347 } 348 346 349 if(handler_died) { 347 350 m_running = false; … … 389 392 struct timespec ts; 390 393 int result; 391 long long int timeout_nsec = ISOHANDLERMANAGER_ISO_TASK_WAIT_TIMEOUT_USECS * 1000LL;392 394 393 395 if (clock_gettime(CLOCK_REALTIME, &ts) == -1) { … … 396 398 } 397 399 398 ts.tv_nsec += timeout_nsec;400 ts.tv_nsec += m_activity_wait_timeout_nsec; 399 401 while(ts.tv_nsec >= 1000000000LL) { 400 402 ts.tv_sec += 1; … … 419 421 this, result); 420 422 debugError("(%p) timeout_nsec=%lld ts.sec=%d ts.nsec=%lld\n", 421 this, timeout_nsec, ts.tv_sec, ts.tv_nsec);423 this, m_activity_wait_timeout_nsec, ts.tv_sec, ts.tv_nsec); 422 424 return eAR_Error; 423 425 } else { … … 425 427 this, result, errno); 426 428 debugError("(%p) timeout_nsec=%lld ts.sec=%d ts.nsec=%lld\n", 427 this, timeout_nsec, ts.tv_sec, ts.tv_nsec);429 this, m_activity_wait_timeout_nsec, ts.tv_sec, ts.tv_nsec); 428 430 return eAR_Error; 429 431 } … … 533 535 debugOutput( DEBUG_LEVEL_VERBOSE, "(%p) switch to: (rt=%d, prio=%d)...\n", this, rt, priority); 534 536 if (priority > THREAD_MAX_RTPRIO) priority = THREAD_MAX_RTPRIO; // cap the priority 537 if (priority < THREAD_MIN_RTPRIO) priority = THREAD_MIN_RTPRIO; // cap the priority 535 538 m_realtime = rt; 536 539 m_priority = priority; 540 541 // grab the options from the parent 542 Util::Configuration *config = m_service.getConfiguration(); 543 int ihm_iso_prio_increase = ISOHANDLERMANAGER_ISO_PRIO_INCREASE; 544 int ihm_iso_prio_increase_xmit = ISOHANDLERMANAGER_ISO_PRIO_INCREASE_XMIT; 545 int ihm_iso_prio_increase_recv = ISOHANDLERMANAGER_ISO_PRIO_INCREASE_RECV; 546 if(config) { 547 config->getValueForSetting("ieee1394.isomanager.prio_increase", ihm_iso_prio_increase); 548 config->getValueForSetting("ieee1394.isomanager.prio_increase_xmit", ihm_iso_prio_increase_xmit); 549 config->getValueForSetting("ieee1394.isomanager.prio_increase_recv", ihm_iso_prio_increase_recv); 550 } 537 551 538 552 if (m_IsoThreadTransmit) { 539 553 if (m_realtime) { 540 554 m_IsoThreadTransmit->AcquireRealTime(m_priority 541 + ISOHANDLERMANAGER_ISO_PRIO_INCREASE542 + ISOHANDLERMANAGER_ISO_PRIO_INCREASE_XMIT);555 + ihm_iso_prio_increase 556 + ihm_iso_prio_increase_xmit); 543 557 } else { 544 558 m_IsoThreadTransmit->DropRealTime(); … … 548 562 if (m_realtime) { 549 563 m_IsoThreadReceive->AcquireRealTime(m_priority 550 + ISOHANDLERMANAGER_ISO_PRIO_INCREASE551 + ISOHANDLERMANAGER_ISO_PRIO_INCREASE_RECV);564 + ihm_iso_prio_increase 565 + ihm_iso_prio_increase_recv); 552 566 } else { 553 567 m_IsoThreadReceive->DropRealTime(); … … 565 579 debugError("Manager already initialized...\n"); 566 580 return false; 581 } 582 583 // grab the options from the parent 584 Util::Configuration *config = m_service.getConfiguration(); 585 int ihm_iso_prio_increase = ISOHANDLERMANAGER_ISO_PRIO_INCREASE; 586 int ihm_iso_prio_increase_xmit = ISOHANDLERMANAGER_ISO_PRIO_INCREASE_XMIT; 587 int ihm_iso_prio_increase_recv = ISOHANDLERMANAGER_ISO_PRIO_INCREASE_RECV; 588 int64_t isotask_activity_timeout_usecs = ISOHANDLERMANAGER_ISO_TASK_WAIT_TIMEOUT_USECS; 589 if(config) { 590 config->getValueForSetting("ieee1394.isomanager.prio_increase", ihm_iso_prio_increase); 591 config->getValueForSetting("ieee1394.isomanager.prio_increase_xmit", ihm_iso_prio_increase_xmit); 592 config->getValueForSetting("ieee1394.isomanager.prio_increase_recv", ihm_iso_prio_increase_recv); 593 config->getValueForSetting("ieee1394.isomanager.isotask_activity_timeout_usecs", isotask_activity_timeout_usecs); 567 594 } 568 595 … … 575 602 } 576 603 m_IsoTaskTransmit->setVerboseLevel(getDebugLevel()); 604 m_IsoTaskTransmit->m_activity_wait_timeout_nsec = isotask_activity_timeout_usecs * 1000LL; 577 605 m_IsoThreadTransmit = new Util::PosixThread(m_IsoTaskTransmit, "ISOXMT", m_realtime, 578 m_priority + ISOHANDLERMANAGER_ISO_PRIO_INCREASE579 + ISOHANDLERMANAGER_ISO_PRIO_INCREASE_XMIT,606 m_priority + ihm_iso_prio_increase 607 + ihm_iso_prio_increase_xmit, 580 608 PTHREAD_CANCEL_DEFERRED); 581 609 … … 594 622 m_IsoTaskReceive->setVerboseLevel(getDebugLevel()); 595 623 m_IsoThreadReceive = new Util::PosixThread(m_IsoTaskReceive, "ISORCV", m_realtime, 596 m_priority + ISOHANDLERMANAGER_ISO_PRIO_INCREASE597 + ISOHANDLERMANAGER_ISO_PRIO_INCREASE_RECV,624 m_priority + ihm_iso_prio_increase 625 + ihm_iso_prio_increase_recv, 598 626 PTHREAD_CANCEL_DEFERRED); 599 627 … … 759 787 // allocate a handler for this stream 760 788 if (stream->getType()==StreamProcessor::ePT_Receive) { 789 // grab the options from the parent 790 Util::Configuration *config = m_service.getConfiguration(); 791 int receive_mode_setting = DEFAULT_ISO_RECEIVE_MODE; 792 int bufferfill_mode_threshold = BUFFERFILL_MODE_THRESHOLD; 793 int min_interrupts_per_period = MINIMUM_INTERRUPTS_PER_PERIOD; 794 int max_nb_buffers_recv = MAX_RECV_NB_BUFFERS; 795 int min_packetsize_recv = MIN_RECV_PACKET_SIZE; 796 if(config) { 797 config->getValueForSetting("ieee1394.isomanager.iso_receive_mode", receive_mode_setting); 798 config->getValueForSetting("ieee1394.isomanager.bufferfill_mode_threshold", bufferfill_mode_threshold); 799 config->getValueForSetting("ieee1394.isomanager.min_interrupts_per_period", min_interrupts_per_period); 800 config->getValueForSetting("ieee1394.isomanager.max_nb_buffers_recv", max_nb_buffers_recv); 801 config->getValueForSetting("ieee1394.isomanager.min_packetsize_recv", min_packetsize_recv); 802 } 803 761 804 // setup the optimal parameters for the raw1394 ISO buffering 762 805 unsigned int packets_per_period = stream->getPacketsPerPeriod(); 763 unsigned int max_packet_size = stream->getMaxPacketSize() + 8; // bufferfill takes another 8 bytes for headers 806 // reserve space for the 1394 header too (might not be necessary) 807 unsigned int max_packet_size = stream->getMaxPacketSize() + 8; 764 808 unsigned int page_size = getpagesize(); 809 810 enum raw1394_iso_dma_recv_mode receive_mode; 811 switch(receive_mode_setting) { 812 case 0: 813 if(packets_per_period < (unsigned)bufferfill_mode_threshold) { 814 debugOutput( DEBUG_LEVEL_VERBOSE, "Using packet-per-buffer mode (auto) [%d, %d]\n", 815 packets_per_period, bufferfill_mode_threshold); 816 receive_mode = RAW1394_DMA_PACKET_PER_BUFFER; 817 } else { 818 debugOutput( DEBUG_LEVEL_VERBOSE, "Using bufferfill mode (auto) [%d, %d]\n", 819 packets_per_period, bufferfill_mode_threshold); 820 receive_mode = RAW1394_DMA_BUFFERFILL; 821 } 822 break; 823 case 1: 824 debugOutput( DEBUG_LEVEL_VERBOSE, "Using packet-per-buffer mode (config)\n"); 825 receive_mode = RAW1394_DMA_PACKET_PER_BUFFER; 826 break; 827 case 2: 828 debugOutput( DEBUG_LEVEL_VERBOSE, "Using bufferfill mode (config)\n"); 829 receive_mode = RAW1394_DMA_BUFFERFILL; 830 break; 831 default: debugWarning("Bogus receive mode setting in config: %d\n", receive_mode_setting); 832 } 765 833 766 834 // Ensure we don't request a packet size bigger than the … … 771 839 return false; 772 840 } 841 if (max_packet_size < (unsigned)min_packetsize_recv) { 842 debugError("min packet size (%u) < MIN_RECV_PACKET_SIZE (%u), using min value\n", 843 max_packet_size, min_packetsize_recv); 844 max_packet_size = min_packetsize_recv; 845 } 773 846 774 847 // the interrupt/wakeup interval prediction of raw1394 is a mess... 775 int irq_interval = (packets_per_period-1) / MINIMUM_INTERRUPTS_PER_PERIOD;848 int irq_interval = (packets_per_period-1) / min_interrupts_per_period; 776 849 if(irq_interval <= 0) irq_interval=1; 777 850 778 851 // the receive buffer size doesn't matter for the latency, 779 // but it has a minimal value in order for libraw to operate correctly (300) 780 int buffers=400; 852 // it does seem to be confined to a certain region for correct 853 // operation. However it is not clear how many. 854 int buffers = max_nb_buffers_recv; 855 856 // ensure at least 2 hardware interrupts per ISO buffer wraparound 857 if(irq_interval > buffers/2) { 858 irq_interval = buffers/2; 859 } 781 860 782 861 // create the actual handler 862 debugOutput( DEBUG_LEVEL_VERBOSE, " creating IsoRecvHandler\n"); 783 863 h = new IsoHandler(*this, IsoHandler::eHT_Receive, 784 864 buffers, max_packet_size, irq_interval); 785 786 debugOutput( DEBUG_LEVEL_VERBOSE, " creating IsoRecvHandler\n");787 865 788 866 if(!h) { … … 791 869 } 792 870 871 h->setReceiveMode(receive_mode); 872 793 873 } else if (stream->getType()==StreamProcessor::ePT_Transmit) { 874 // grab the options from the parent 875 Util::Configuration *config = m_service.getConfiguration(); 876 int min_interrupts_per_period = MINIMUM_INTERRUPTS_PER_PERIOD; 877 int max_nb_buffers_xmit = MAX_XMIT_NB_BUFFERS; 878 int max_packetsize_xmit = MAX_XMIT_PACKET_SIZE; 879 int min_packetsize_xmit = MIN_XMIT_PACKET_SIZE; 880 if(config) { 881 config->getValueForSetting("ieee1394.isomanager.min_interrupts_per_period", min_interrupts_per_period); 882 config->getValueForSetting("ieee1394.isomanager.max_nb_buffers_xmit", max_nb_buffers_xmit); 883 config->getValueForSetting("ieee1394.isomanager.max_packetsize_xmit", max_packetsize_xmit); 884 config->getValueForSetting("ieee1394.isomanager.min_packetsize_xmit", min_packetsize_xmit); 885 } 886 794 887 // setup the optimal parameters for the raw1394 ISO buffering 795 // unsigned int packets_per_period = stream->getPacketsPerPeriod(); 796 unsigned int max_packet_size = stream->getMaxPacketSize(); 797 // unsigned int page_size = getpagesize(); 798 799 // Ensure we don't request a packet size bigger than the 800 // kernel-enforced maximum which is currently 1 page. 801 // if (max_packet_size > page_size) { 802 // debugError("max packet size (%u) > page size (%u)\n", max_packet_size, page_size); 803 // return false; 804 // } 805 if (max_packet_size > MAX_XMIT_PACKET_SIZE) { 888 // reserve space for the 1394 header too (might not be necessary) 889 unsigned int max_packet_size = stream->getMaxPacketSize() + 8; 890 891 if (max_packet_size > (unsigned)max_packetsize_xmit) { 806 892 debugError("max packet size (%u) > MAX_XMIT_PACKET_SIZE (%u)\n", 807 max_packet_size, MAX_XMIT_PACKET_SIZE);893 max_packet_size, max_packetsize_xmit); 808 894 return false; 809 895 } 810 811 // the SP specifies how many packets to ISO-buffer812 int buffers = stream->getNbPacketsIsoXmitBuffer();813 if (buffers > MAX_XMIT_NB_BUFFERS) {814 debugOutput(DEBUG_LEVEL_VERBOSE,815 "nb buffers (%u) > MAX_XMIT_NB_BUFFERS (%u)\n", 816 buffers, MAX_XMIT_NB_BUFFERS);817 buffers = MAX_XMIT_NB_BUFFERS;818 } 819 unsigned int irq_interval = buffers / MINIMUM_INTERRUPTS_PER_PERIOD;896 if (max_packet_size < (unsigned)min_packetsize_xmit) { 897 debugError("min packet size (%u) < MIN_XMIT_PACKET_SIZE (%u), using min value\n", 898 max_packet_size, min_packetsize_xmit); 899 max_packet_size = min_packetsize_xmit; 900 } 901 902 int buffers = max_nb_buffers_xmit; 903 unsigned int packets_per_period = stream->getPacketsPerPeriod(); 904 905 int irq_interval = (packets_per_period-1) / min_interrupts_per_period; 820 906 if(irq_interval <= 0) irq_interval=1; 907 // ensure at least 2 hardware interrupts per ISO buffer wraparound 908 if(irq_interval > buffers/2) { 909 irq_interval = buffers/2; 910 } 821 911 822 912 debugOutput( DEBUG_LEVEL_VERBOSE, " creating IsoXmitHandler\n"); trunk/libffado/src/libieee1394/IsoHandlerManager.h
r1336 r1498 58 58 class IsoTask : public Util::RunnableInterface 59 59 { 60 friend class IsoHandlerManager; 60 61 public: 61 62 IsoTask(IsoHandlerManager& manager, enum IsoHandler::EHandlerType); … … 114 115 #endif 115 116 116 // activity signaling117 sem_t m_activity_semaphore;118 119 117 enum IsoHandler::EHandlerType m_handlerType; 120 118 bool m_running; 121 119 bool m_in_busreset; 120 121 // activity signaling 122 sem_t m_activity_semaphore; 123 long long int m_activity_wait_timeout_nsec; 122 124 123 125 // debug stuff … … 198 200 */ 199 201 bool handleBusReset(); 202 200 203 // the state machine 201 204 private: trunk/libffado/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.cpp
r1348 r1498 67 67 } 68 68 69 unsigned int70 AmdtpReceiveStreamProcessor::getAveragePacketSize()71 {72 // in one second we have 8000 packets73 // containing FRAMERATE frames of m_dimension quadlets74 // so 8000 packet headers + FRAMERATE*m_dimension quadlets75 unsigned int one_second = 8000 * 2 * sizeof(quadlet_t) + m_StreamProcessorManager.getNominalRate() * m_dimension * sizeof(quadlet_t);76 return one_second / 8000;77 }78 79 69 bool AmdtpReceiveStreamProcessor::prepareChild() { 80 70 debugOutput( DEBUG_LEVEL_VERBOSE, "Preparing (%p)...\n", this); … … 389 379 sample_int |= 0x01000000; // flag that there is a midi event present 390 380 *buffer = sample_int; 391 debugOutput(DEBUG_LEVEL_VER BOSE, "Received midi byte %08X on port %p index %d\n", sample_int, p, j-p.location);381 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "Received midi byte %08X on port %p index %d\n", sample_int, p, j-p.location); 392 382 } else { 393 383 // make sure no event is received trunk/libffado/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.h
r1348 r1498 90 90 virtual unsigned int getMaxPacketSize() 91 91 {return 4 * (2 + getSytInterval() * m_dimension);}; 92 virtual unsigned int getAveragePacketSize();93 92 virtual unsigned int getEventsPerFrame() 94 93 { return m_dimension; }; trunk/libffado/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.cpp
r1348 r1498 40 40 #include <cstring> 41 41 42 #define AMDTP_FLOAT_MULTIPLIER 2147483392.0 43 42 #define likely(x) __builtin_expect((x),1) 43 #define unlikely(x) __builtin_expect((x),0) 44 45 #define AMDTP_FLOAT_MULTIPLIER (1.0f * ((1<<23) - 1)) 44 46 namespace Streaming 45 47 { … … 408 410 409 411 unsigned int 410 AmdtpTransmitStreamProcessor::getAveragePacketSize()411 {412 // in one second we have 8000 packets413 // containing FRAMERATE frames of m_dimension quadlets414 // so 8000 packet headers + FRAMERATE*m_dimension quadlets415 unsigned int one_second = 8000 * 2 * sizeof(quadlet_t) + m_StreamProcessorManager.getNominalRate() * m_dimension * sizeof(quadlet_t);416 return one_second / 8000;417 }418 419 unsigned int420 412 AmdtpTransmitStreamProcessor::getFDF() { 421 413 switch (m_StreamProcessorManager.getNominalRate()) { … … 517 509 518 510 #ifdef __SSE2__ 519 //#if 0520 511 #include <emmintrin.h> 521 512 #warning SSE2 build … … 545 536 546 537 const __m128i label = _mm_set_epi32 (0x40000000, 0x40000000, 0x40000000, 0x40000000); 538 const __m128i mask = _mm_set_epi32 (0x00FFFFFF, 0x00FFFFFF, 0x00FFFFFF, 0x00FFFFFF); 547 539 const __m128 mult = _mm_set_ps(AMDTP_FLOAT_MULTIPLIER, AMDTP_FLOAT_MULTIPLIER, AMDTP_FLOAT_MULTIPLIER, AMDTP_FLOAT_MULTIPLIER); 548 540 … … 560 552 for (j=0; j<4; j++) { 561 553 p = &(m_audio_ports.at(i+j)); 562 if( p->buffer && p->enabled) {554 if(likely(p->buffer && p->enabled)) { 563 555 client_buffers[j] = (float *) p->buffer; 564 556 client_buffers[j] += offset; … … 572 564 // the base event for this position 573 565 target_event = (quadlet_t *)(data + i); 574 575 566 // process the events 576 567 for (j=0;j < nevents; j += 1) … … 598 589 // convert to signed integer 599 590 v_int = _mm_cvttps_epi32( v_float ); 600 // shift right 8 bits601 v_int = _mm_ srli_epi32( v_int, 8);591 // mask 592 v_int = _mm_and_si128( v_int, mask ); 602 593 // label it 603 594 v_int = _mm_or_si128( v_int, label ); … … 608 599 // do second swap 609 600 v_int = _mm_or_si128( _mm_slli_epi32( v_int, 16 ), _mm_srli_epi32( v_int, 16 ) ); 610 611 601 // store the packed int 612 602 // (target misalignment is assumed since we don't know the m_dimension) … … 631 621 assert(nevents + offset <= p.buffer_size ); 632 622 633 if( p.buffer && p.enabled) {623 if(likely(p.buffer && p.enabled)) { 634 624 float *buffer = (float *)(p.buffer); 635 625 buffer += offset; … … 656 646 v_float = _mm_min_ps(v_float, v_max); 657 647 #endif 658 659 648 // multiply 660 649 v_float = _mm_mul_ps(v_float, mult); 661 650 // convert to signed integer 662 651 v_int = _mm_cvttps_epi32( v_float ); 663 // shift right 8 bits664 v_int = _mm_ srli_epi32( v_int, 8);652 // mask 653 v_int = _mm_and_si128( v_int, mask ); 665 654 // label it 666 655 v_int = _mm_or_si128( v_int, label ); … … 690 679 float *in = (float *)buffer; 691 680 #if AMDTP_CLIP_FLOATS 692 if(*in > 1.0) *in=1.0; 693 if(*in < -1.0) *in=-1.0; 694 #endif 681 // clip directly to the value of a maxed event 682 if(unlikely(*in > 1.0)) { 683 *target_event = CONDSWAPTOBUS32_CONST(0x407FFFFF); 684 } else if(unlikely(*in < -1.0)) { 685 *target_event = CONDSWAPTOBUS32_CONST(0x40800001); 686 } else { 687 float v = (*in) * AMDTP_FLOAT_MULTIPLIER; 688 unsigned int tmp = ((int) v); 689 tmp = ( tmp & 0x00FFFFFF ) | 0x40000000; 690 *target_event = CondSwapToBus32((quadlet_t)tmp); 691 } 692 #else 695 693 float v = (*in) * AMDTP_FLOAT_MULTIPLIER; 696 694 unsigned int tmp = ((int) v); 697 tmp = ( tmp >> 8) | 0x40000000;695 tmp = ( tmp & 0x00FFFFFF ) | 0x40000000; 698 696 *target_event = CondSwapToBus32((quadlet_t)tmp); 697 #endif 699 698 buffer++; 700 699 target_event += m_dimension; … … 746 745 for (j=0; j<4; j++) { 747 746 p = &(m_audio_ports.at(i+j)); 748 if( p->buffer && p->enabled) {747 if(likely(p->buffer && p->enabled)) { 749 748 client_buffers[j] = (uint32_t *) p->buffer; 750 749 client_buffers[j] += offset; … … 805 804 assert(nevents + offset <= p.buffer_size ); 806 805 807 if( p.buffer && p.enabled) {806 if(likely(p.buffer && p.enabled)) { 808 807 uint32_t *buffer = (uint32_t *)(p.buffer); 809 808 buffer += offset; … … 890 889 assert(nevents + offset <= p.buffer_size ); 891 890 892 if( p.buffer && p.enabled) {891 if(likely(p.buffer && p.enabled)) { 893 892 quadlet_t *buffer = (quadlet_t *)(p.buffer); 894 893 buffer += offset; … … 931 930 assert(nevents + offset <= p.buffer_size ); 932 931 933 if( p.buffer && p.enabled) {932 if(likely(p.buffer && p.enabled)) { 934 933 quadlet_t *buffer = (quadlet_t *)(p.buffer); 935 934 buffer += offset; … … 939 938 float *in = (float *)buffer; 940 939 #if AMDTP_CLIP_FLOATS 941 if(*in > 1.0) *in=1.0; 942 if(*in < -1.0) *in=-1.0; 940 // clip directly to the value of a maxed event 941 if(unlikely(*in > 1.0)) { 942 *target_event = CONDSWAPTOBUS32_CONST(0x407FFFFF); 943 } else if(unlikely(*in < -1.0)) { 944 *target_event = CONDSWAPTOBUS32_CONST(0x40800001); 945 } else { 946 float v = (*in) * AMDTP_FLOAT_MULTIPLIER; 947 unsigned int tmp = ((int) v); 948 tmp = ( tmp & 0x00FFFFFF ) | 0x40000000; 949 *target_event = CondSwapToBus32((quadlet_t)tmp); 950 } 951 #else 952 float v = (*in) * AMDTP_FLOAT_MULTIPLIER; 953 unsigned int tmp = ((int) v); 954 tmp = ( tmp & 0x00FFFFFF ) | 0x40000000; 955 *target_event = CondSwapToBus32((quadlet_t)tmp); 943 956 #endif 944 float v = (*in) * AMDTP_FLOAT_MULTIPLIER;945 unsigned int tmp = ((int) lrintf(v));946 947 tmp = ( tmp >> 8 ) | 0x40000000;948 *target_event = CondSwapToBus32((quadlet_t)tmp);949 957 buffer++; 950 958 target_event += m_dimension; trunk/libffado/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.h
r1348 r1498 105 105 virtual unsigned int getMaxPacketSize() 106 106 {return 4 * (2 + getSytInterval() * m_dimension);}; 107 virtual unsigned int getAveragePacketSize();108 107 virtual unsigned int getEventsPerFrame() 109 108 { return m_dimension; }; trunk/libffado/src/libstreaming/generic/Port.cpp
r904 r1498 126 126 Port::enable() { 127 127 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "Enabling port %s...\n",m_Name.c_str()); 128 m_disabled =false;128 m_disabled = false; 129 129 } 130 130 … … 133 133 Port::disable() { 134 134 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "Disabling port %s...\n",m_Name.c_str()); 135 m_disabled=false; 135 m_disabled = true; 136 } 137 138 139 /** 140 * Obtain the port type in string format 141 * @return type name of the port 142 */ 143 std::string 144 Port::getPortTypeName() 145 { 146 switch(m_PortType) { 147 case E_Audio: 148 return "Audio"; 149 case E_Midi: 150 return "MIDI"; 151 case E_Control: 152 return "Control"; 153 default: 154 return "Invalid"; 155 } 136 156 } 137 157 138 158 void Port::show() { 139 159 debugOutput(DEBUG_LEVEL_VERBOSE,"Name : %s\n", m_Name.c_str()); 140 debugOutput(DEBUG_LEVEL_VERBOSE,"Enabled? : %d\n", m_disabled );160 debugOutput(DEBUG_LEVEL_VERBOSE,"Enabled? : %d\n", m_disabled==false); 141 161 debugOutput(DEBUG_LEVEL_VERBOSE,"State? : %d\n", m_State); 142 162 debugOutput(DEBUG_LEVEL_VERBOSE,"Buffer Size : %d\n", m_buffersize); trunk/libffado/src/libstreaming/generic/Port.h
r864 r1498 105 105 106 106 enum E_PortType getPortType() {return m_PortType;}; ///< returns the port type (is fixed) 107 std::string getPortTypeName(); 107 108 enum E_Direction getDirection() {return m_Direction;}; ///< returns the direction (is fixed) 108 109 trunk/libffado/src/libstreaming/generic/PortManager.cpp
r876 r1498 35 35 IMPL_DEBUG_MODULE( PortManager, PortManager, DEBUG_LEVEL_NORMAL ); 36 36 37 PortManager::PortManager() { 38 } 39 40 PortManager::~PortManager() { 37 PortManager::PortManager() 38 { 39 } 40 41 PortManager::~PortManager() 42 { 41 43 flushDebugOutput(); 42 44 // delete all ports that are still registered to the manager … … 46 48 delete m_Ports.front(); 47 49 } 48 } 49 50 bool PortManager::makeNameUnique(Port *port) 51 { 52 bool done=false; 53 int idx=0; 54 std::string portname_orig=port->getName(); 55 56 while(!done && idx<10000) { 50 for ( Util::FunctorVectorIterator it = m_UpdateHandlers.begin(); 51 it != m_UpdateHandlers.end(); 52 ++it ) 53 { 54 Util::Functor* func = *it; 55 delete func; 56 } 57 } 58 59 bool 60 PortManager::makeNameUnique(Port *port) 61 { 62 bool done = false; 63 int idx = 0; 64 std::string portname_orig = port->getName(); 65 66 while(!done && idx < 10000) { 57 67 bool is_unique=true; 58 68 59 69 for ( PortVectorIterator it = m_Ports.begin(); 60 70 it != m_Ports.end(); … … 63 73 is_unique &= !((*it)->getName() == port->getName()); 64 74 } 65 75 66 76 if (is_unique) { 67 done =true;77 done = true; 68 78 } else { 69 79 std::ostringstream portname; 70 80 portname << portname_orig << idx++; 71 72 81 port->setName(portname.str()); 73 82 } 74 83 } 75 76 if(idx <10000) return true;84 85 if(idx < 10000) return true; 77 86 else return false; 78 87 } … … 83 92 * @return 84 93 */ 85 bool PortManager::registerPort(Port *port) 94 bool 95 PortManager::registerPort(Port *port) 86 96 { 87 97 assert(port); … … 94 104 if (makeNameUnique(port)) { 95 105 m_Ports.push_back(port); 106 callUpdateHandlers(); 96 107 return true; 97 108 } else { … … 100 111 } 101 112 102 bool PortManager::unregisterPort(Port *port) 113 bool 114 PortManager::unregisterPort(Port *port) 103 115 { 104 116 assert(port); … … 111 123 if(*it == port) { 112 124 m_Ports.erase(it); 125 callUpdateHandlers(); 113 126 return true; 114 127 } … … 118 131 119 132 return false; //not found 120 121 } 122 123 int PortManager::getPortCount(enum Port::E_PortType type) { 133 } 134 135 int 136 PortManager::getPortCount(enum Port::E_PortType type) 137 { 124 138 int count=0; 125 139 … … 135 149 } 136 150 137 int PortManager::getPortCount() { 138 int count=0; 139 140 count+=m_Ports.size(); 151 int 152 PortManager::getPortCount() 153 { 154 int count = 0; 155 156 count += m_Ports.size(); 141 157 142 158 return count; 143 159 } 144 160 145 Port * PortManager::getPortAtIdx(unsigned int index) { 161 Port * 162 PortManager::getPortAtIdx(unsigned int index) 163 { 146 164 147 165 return m_Ports.at(index); … … 149 167 } 150 168 151 void PortManager::setVerboseLevel(int i) { 169 void 170 PortManager::setVerboseLevel(int i) 171 { 152 172 setDebugLevel(i); 153 173 for ( PortVectorIterator it = m_Ports.begin(); … … 160 180 161 181 162 bool PortManager::resetPorts() { 182 bool 183 PortManager::resetPorts() 184 { 163 185 debugOutput( DEBUG_LEVEL_VERBOSE, "reset ports\n"); 164 186 … … 175 197 } 176 198 177 bool PortManager::initPorts() { 199 bool 200 PortManager::initPorts() 201 { 178 202 debugOutput( DEBUG_LEVEL_VERBOSE, "init ports\n"); 179 203 … … 190 214 } 191 215 192 bool PortManager::preparePorts() { 216 bool 217 PortManager::preparePorts() 218 { 193 219 debugOutput( DEBUG_LEVEL_VERBOSE, "preparing ports\n"); 194 220 … … 201 227 return false; 202 228 } 203 204 } 205 return true; 206 } 207 208 } 229 } 230 return true; 231 } 232 233 bool 234 PortManager::addPortManagerUpdateHandler( Util::Functor* functor ) 235 { 236 debugOutput(DEBUG_LEVEL_VERBOSE, "Adding PortManagerUpdate handler (%p)\n", functor); 237 m_UpdateHandlers.push_back( functor ); 238 return true; 239 } 240 241 bool 242 PortManager::remPortManagerUpdateHandler( Util::Functor* functor ) 243 { 244 debugOutput(DEBUG_LEVEL_VERBOSE, "Removing PortManagerUpdate handler (%p)\n", functor); 245 246 for ( Util::FunctorVectorIterator it = m_UpdateHandlers.begin(); 247 it != m_UpdateHandlers.end(); 248 ++it ) 249 { 250 if ( *it == functor ) { 251 debugOutput(DEBUG_LEVEL_VERBOSE, " found\n"); 252 m_UpdateHandlers.erase( it ); 253 return true; 254 } 255 } 256 debugOutput(DEBUG_LEVEL_VERBOSE, " not found\n"); 257 return false; 258 } 259 260 Util::Functor* 261 PortManager::getUpdateHandlerForPtr(void *ptr) 262 { 263 for ( Util::FunctorVectorIterator it = m_UpdateHandlers.begin(); 264 it != m_UpdateHandlers.end(); 265 ++it ) 266 { 267 if ( (*it)->matchCallee(ptr) ) { 268 debugOutput(DEBUG_LEVEL_VERBOSE, " found\n"); 269 return *it; 270 } 271 } 272 return NULL; 273 } 274 275 void 276 PortManager::callUpdateHandlers() 277 { 278 for ( Util::FunctorVectorIterator it = m_UpdateHandlers.begin(); 279 it != m_UpdateHandlers.end(); 280 ++it ) 281 { 282 Util::Functor* func = *it; 283 debugOutput(DEBUG_LEVEL_VERBOSE, "Calling PortManagerUpdate handler (%p)\n", func); 284 ( *func )(); 285 } 286 } 287 288 } trunk/libffado/src/libstreaming/generic/PortManager.h
r864 r1498 27 27 #include "Port.h" 28 28 29 #include "libutil/Functors.h" 29 30 #include "debugmodule/debugmodule.h" 30 31 … … 61 62 virtual bool preparePorts(); 62 63 63 virtual void setVerboseLevel(int l); 64 virtual void setVerboseLevel(int l); 65 66 bool addPortManagerUpdateHandler( Util::Functor* functor ); 67 bool remPortManagerUpdateHandler( Util::Functor* functor ); 68 Util::Functor* getUpdateHandlerForPtr(void *ptr); // ugly!! 64 69 65 70 protected: 71 void callUpdateHandlers(); 66 72 PortVector m_Ports; 67 73 74 Util::FunctorVector m_UpdateHandlers; 68 75 DECLARE_DEBUG_MODULE; 69 76 }; trunk/libffado/src/libstreaming/generic/StreamProcessor.cpp
r1348 r1498 413 413 int64_t last_timestamp_fixed; 414 414 // first try to add one second 415 last_timestamp_fixed = m_last_timestamp + TICKS_PER_SECOND;415 last_timestamp_fixed = addTicks(m_last_timestamp, TICKS_PER_SECOND); 416 416 diff = diffTicks(last_timestamp_fixed, m_last_timestamp2); 417 417 if(diff-ticks_per_packet < 50 && diff-ticks_per_packet > -50) { … … 421 421 debugWarning("HACK: fixed by adding one second of ticks. This is a bug being run-time fixed.\n"); 422 422 m_last_timestamp = last_timestamp_fixed; 423 } 424 // then try to subtract one second 425 last_timestamp_fixed = m_last_timestamp - TICKS_PER_SECOND; 426 if(last_timestamp_fixed >= 0) { 423 } else { 424 // if that didn't work, try to subtract one second 425 last_timestamp_fixed = substractTicks(m_last_timestamp, TICKS_PER_SECOND); 427 426 diff = diffTicks(last_timestamp_fixed, m_last_timestamp2); 428 427 if(diff-ticks_per_packet < 50 && diff-ticks_per_packet > -50) { trunk/libffado/src/libstreaming/generic/StreamProcessor.h
r1348 r1498 290 290 virtual unsigned int getPacketsPerPeriod(); 291 291 virtual unsigned int getMaxPacketSize() = 0; 292 virtual unsigned int getAveragePacketSize() = 0;293 292 private: 294 293 int m_channel; trunk/libffado/src/libstreaming/motu/MotuReceiveStreamProcessor.cpp
r1361 r1498 96 96 97 97 unsigned int 98 MotuReceiveStreamProcessor::getAveragePacketSize()99 {100 // in one second we have 8000 packets101 // containing FRAMERATE frames102 // so on average bytes/packet: (8000 packet headers + FRAMERATE * frame_size) / 8000103 #warning FIXME104 int framerate = m_Parent.getDeviceManager().getStreamProcessorManager().getNominalRate();105 return framerate<=48000?616:(framerate<=96000?1032:1160);106 }107 108 unsigned int109 98 MotuReceiveStreamProcessor::getNominalFramesPerPacket() { 110 99 int framerate = m_Parent.getDeviceManager().getStreamProcessorManager().getNominalRate(); … … 235 224 case Port::E_Audio: 236 225 if(decodeMotuEventsToPort(static_cast<MotuAudioPort *>(*it), (quadlet_t *)data, offset, nevents)) { 237 debugWarning("Could not decode packet data to port %s ",(*it)->getName().c_str());226 debugWarning("Could not decode packet data to port %s\n",(*it)->getName().c_str()); 238 227 no_problem=false; 239 228 } … … 241 230 case Port::E_Midi: 242 231 if(decodeMotuMidiEventsToPort(static_cast<MotuMidiPort *>(*it), (quadlet_t *)data, offset, nevents)) { 243 debugWarning("Could not decode packet midi data to port %s ",(*it)->getName().c_str());232 debugWarning("Could not decode packet midi data to port %s\n",(*it)->getName().c_str()); 244 233 no_problem=false; 245 234 } … … 284 273 *buffer = (*src_data<<16)+(*(src_data+1)<<8)+*(src_data+2); 285 274 // Sign-extend highest bit of 24-bit int. 286 // FIXME: this isn't strictly needed since E_Int24 is a 24-bit,275 // This isn't strictly needed since E_Int24 is a 24-bit, 287 276 // but doing so shouldn't break anything and makes the data 288 277 // easier to deal with during debugging. trunk/libffado/src/libstreaming/motu/MotuReceiveStreamProcessor.h
r1348 r1498 152 152 {return m_event_size;}; 153 153 virtual unsigned int getMaxPacketSize(); 154 virtual unsigned int getAveragePacketSize();155 154 virtual unsigned int getEventsPerFrame() 156 { return 1; }; // FIXME: check155 { return 1; }; 157 156 virtual unsigned int getNominalFramesPerPacket(); 158 157 trunk/libffado/src/libstreaming/motu/MotuTransmitStreamProcessor.cpp
r1361 r1498 91 91 92 92 unsigned int 93 MotuTransmitStreamProcessor::getAveragePacketSize()94 {95 // in one second we have 8000 packets96 // containing FRAMERATE frames97 // so on average bytes/packet: (8000 packet headers + FRAMERATE * frame_size) / 800098 #warning FIXME99 int framerate = m_Parent.getDeviceManager().getStreamProcessorManager().getNominalRate();100 return framerate<=48000?616:(framerate<=96000?1032:1160);101 }102 103 unsigned int104 93 MotuTransmitStreamProcessor::getNominalFramesPerPacket() { 105 94 int framerate = m_Parent.getDeviceManager().getStreamProcessorManager().getNominalRate(); … … 481 470 { 482 471 quadlet_t *quadlet = (quadlet_t *)data; 483 // Size of a single data frame in quadlets. For data sent bythe472 // Size of a single data frame in quadlets. For data sent TO the 484 473 // Ultralite this is not strictly true (with m_event_size 52, dbs is set 485 // to 19). Even so, we'll run with the assumption that a different dbs 486 // will be fine unless proven otherwise. 474 // to 13, even though data sent by the Ultralite uses 19 as one would 475 // expect from a 52-byte event). Even so, we'll run with the assumption 476 // that a different dbs will be fine unless proven otherwise. 487 477 unsigned dbs = m_event_size / 4; 488 478 … … 545 535 it != m_Ports.end(); 546 536 ++it ) { 547 // If this port is disabled, don't process it 548 if((*it)->isDisabled()) {continue;}; 537 // If this port is disabled, unconditionally send it silence. 538 if((*it)->isDisabled()) { 539 if (encodeSilencePortToMotuEvents(static_cast<MotuAudioPort *>(*it), (quadlet_t *)data, offset, nevents)) { 540 debugWarning("Could not encode silence for disabled port %s to Motu events\n",(*it)->getName().c_str()); 541 // Don't treat this as a fatal error at this point 542 } 543 continue; 544 } 549 545 550 546 Port *port=(*it); … … 554 550 case Port::E_Audio: 555 551 if (encodePortToMotuEvents(static_cast<MotuAudioPort *>(*it), (quadlet_t *)data, offset, nevents)) { 556 debugWarning("Could not encode port %s to Motu events ",(*it)->getName().c_str());552 debugWarning("Could not encode port %s to Motu events\n",(*it)->getName().c_str()); 557 553 no_problem=false; 558 554 } … … 560 556 case Port::E_Midi: 561 557 if (encodePortToMotuMidiEvents(static_cast<MotuMidiPort *>(*it), (quadlet_t *)data, offset, nevents)) { 562 debugWarning("Could not encode port %s to Midi events ",(*it)->getName().c_str());558 debugWarning("Could not encode port %s to Midi events\n",(*it)->getName().c_str()); 563 559 no_problem=false; 564 560 } … … 586 582 case Port::E_Audio: 587 583 if (encodeSilencePortToMotuEvents(static_cast<MotuAudioPort *>(*it), (quadlet_t *)data, offset, nevents)) { 588 debugWarning("Could not encode port %s to MBLA events ",(*it)->getName().c_str());584 debugWarning("Could not encode port %s to MBLA events\n",(*it)->getName().c_str()); 589 585 no_problem = false; 590 586 } … … 592 588 case Port::E_Midi: 593 589 if (encodeSilencePortToMotuMidiEvents(static_cast<MotuMidiPort *>(*it), (quadlet_t *)data, offset, nevents)) { 594 debugWarning("Could not encode port %s to Midi events ",(*it)->getName().c_str());590 debugWarning("Could not encode port %s to Midi events\n",(*it)->getName().c_str()); 595 591 no_problem = false; 596 592 } … … 727 723 mb_head &= MIDIBUFFER_SIZE-1; 728 724 if (unlikely(mb_head == mb_tail)) { 729 /* Buffer overflow - dump oldest byte */730 /* FIXME: ideally this would dump an entire MIDI message, but this is only725 /* Buffer overflow - dump oldest byte. */ 726 /* Ideally this would dump an entire MIDI message, but this is only 731 727 * feasible if it's possible to determine the message size easily. 732 728 */ trunk/libffado/src/libstreaming/motu/MotuTransmitStreamProcessor.h
r1348 r1498 76 76 {return m_event_size;}; 77 77 virtual unsigned int getMaxPacketSize(); 78 virtual unsigned int getAveragePacketSize();79 78 virtual unsigned int getEventsPerFrame() 80 { return 1; }; // FIXME: check79 { return 1; }; 81 80 virtual unsigned int getNominalFramesPerPacket(); 82 81 trunk/libffado/src/libstreaming/StreamProcessorManager.cpp
r1348 r1498 46 46 , m_parent( p ) 47 47 , m_xrun_happened( false ) 48 , m_activity_wait_timeout_ usec( 1000*1000 )48 , m_activity_wait_timeout_nsec( 0 ) // dynamically set 49 49 , m_nb_buffers( 0 ) 50 50 , m_period( 0 ) … … 66 66 , m_parent( p ) 67 67 , m_xrun_happened( false ) 68 , m_activity_wait_timeout_ usec( 1000*1000 )68 , m_activity_wait_timeout_nsec( 0 ) // dynamically set 69 69 , m_nb_buffers(nb_buffers) 70 70 , m_period(period) … … 150 150 int result; 151 151 152 long long int timeout_nsec=0; 153 if (m_activity_wait_timeout_usec >= 0) { 154 timeout_nsec = m_activity_wait_timeout_usec * 1000LL; 152 if (m_activity_wait_timeout_nsec >= 0) { 155 153 156 154 if (clock_gettime(CLOCK_REALTIME, &ts) == -1) { … … 158 156 return eAR_Error; 159 157 } 160 ts.tv_nsec += timeout_nsec;158 ts.tv_nsec += m_activity_wait_timeout_nsec; 161 159 while(ts.tv_nsec >= 1000000000LL) { 162 160 ts.tv_sec += 1; … … 165 163 } 166 164 167 if (m_activity_wait_timeout_ usec >= 0) {165 if (m_activity_wait_timeout_nsec >= 0) { 168 166 result = sem_timedwait(&m_activity_semaphore, &ts); 169 167 } else { … … 186 184 this, result); 187 185 debugError("(%p) timeout_nsec=%lld ts.sec=%d ts.nsec=%lld\n", 188 this, timeout_nsec, ts.tv_sec, ts.tv_nsec);186 this, m_activity_wait_timeout_nsec, ts.tv_sec, ts.tv_nsec); 189 187 return eAR_Error; 190 188 } else { … … 192 190 this, result, errno); 193 191 debugError("(%p) timeout_nsec=%lld ts.sec=%d ts.nsec=%lld\n", 194 this, timeout_nsec, ts.tv_sec, ts.tv_nsec);192 this, m_activity_wait_timeout_nsec, ts.tv_sec, ts.tv_nsec); 195 193 return eAR_Error; 196 194 } … … 219 217 processor->setVerboseLevel(getDebugLevel()); // inherit debug level 220 218 m_ReceiveProcessors.push_back(processor); 219 Util::Functor* f = new Util::MemberFunctor0< StreamProcessorManager*, void (StreamProcessorManager::*)() > 220 ( this, &StreamProcessorManager::updateShadowLists, false ); 221 processor->addPortManagerUpdateHandler(f); 222 updateShadowLists(); 221 223 return true; 222 224 } 223 224 225 if (processor->getType() == StreamProcessor::ePT_Transmit) { 225 226 processor->setVerboseLevel(getDebugLevel()); // inherit debug level 226 227 m_TransmitProcessors.push_back(processor); 228 Util::Functor* f = new Util::MemberFunctor0< StreamProcessorManager*, void (StreamProcessorManager::*)() > 229 ( this, &StreamProcessorManager::updateShadowLists, false ); 230 processor->addPortManagerUpdateHandler(f); 231 updateShadowLists(); 227 232 return true; 228 233 } … … 249 254 } 250 255 m_ReceiveProcessors.erase(it); 256 // remove the functor 257 Util::Functor * f = processor->getUpdateHandlerForPtr(this); 258 if(f) { 259 processor->remPortManagerUpdateHandler(f); 260 delete f; 261 } 262 updateShadowLists(); 251 263 return true; 252 264 } … … 265 277 } 266 278 m_TransmitProcessors.erase(it); 279 // remove the functor 280 Util::Functor * f = processor->getUpdateHandlerForPtr(this); 281 if(f) { 282 processor->remPortManagerUpdateHandler(f); 283 delete f; 284 } 285 updateShadowLists(); 267 286 return true; 268 287 } … … 276 295 bool StreamProcessorManager::setSyncSource(StreamProcessor *s) { 277 296 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting sync source to (%p)\n", s); 278 m_SyncSource =s;297 m_SyncSource = s; 279 298 return true; 280 299 } … … 356 375 debugOutput(DEBUG_LEVEL_VERBOSE, "setting activity timeout to %d\n", timeout_usec); 357 376 setActivityWaitTimeoutUsec(timeout_usec); 377 378 updateShadowLists(); 358 379 359 380 return true; … … 440 461 bool StreamProcessorManager::syncStartAll() { 441 462 if(m_SyncSource == NULL) return false; 463 464 // get the options 465 int signal_delay_ticks = STREAMPROCESSORMANAGER_SIGNAL_DELAY_TICKS; 466 int sync_wait_time_msec = STREAMPROCESSORMANAGER_SYNC_WAIT_TIME_MSEC; 467 int cycles_for_startup = STREAMPROCESSORMANAGER_CYCLES_FOR_STARTUP; 468 int prestart_cycles_for_xmit = STREAMPROCESSORMANAGER_PRESTART_CYCLES_FOR_XMIT; 469 int prestart_cycles_for_recv = STREAMPROCESSORMANAGER_PRESTART_CYCLES_FOR_RECV; 470 Util::Configuration &config = m_parent.getConfiguration(); 471 config.getValueForSetting("streaming.spm.signal_delay_ticks", signal_delay_ticks); 472 config.getValueForSetting("streaming.spm.sync_wait_time_msec", sync_wait_time_msec); 473 config.getValueForSetting("streaming.spm.cycles_for_startup", cycles_for_startup); 474 config.getValueForSetting("streaming.spm.prestart_cycles_for_xmit", prestart_cycles_for_xmit); 475 config.getValueForSetting("streaming.spm.prestart_cycles_for_recv", prestart_cycles_for_recv); 476 442 477 // figure out when to get the SP's running. 443 478 // the xmit SP's should also know the base timestamp … … 461 496 // time to a later time instant also causes the xmit buffer fill to be 462 497 // lower on average. 463 max_of_min_delay += STREAMPROCESSORMANAGER_SIGNAL_DELAY_TICKS;498 max_of_min_delay += signal_delay_ticks; 464 499 465 500 m_SyncSource->setSyncDelay(max_of_min_delay); … … 480 515 debugOutput( DEBUG_LEVEL_VERBOSE, "Waiting for sync...\n"); 481 516 482 unsigned int nb_sync_runs = ( STREAMPROCESSORMANAGER_SYNC_WAIT_TIME_MSEC* getNominalRate());517 unsigned int nb_sync_runs = (sync_wait_time_msec * getNominalRate()); 483 518 nb_sync_runs /= 1000; 484 519 nb_sync_runs /= getPeriodSize(); … … 513 548 // can start wet-running correctly. 514 549 time_of_first_sample = addTicks(time_of_first_sample, 515 STREAMPROCESSORMANAGER_CYCLES_FOR_STARTUP* TICKS_PER_CYCLE);550 cycles_for_startup * TICKS_PER_CYCLE); 516 551 517 552 debugOutput( DEBUG_LEVEL_VERBOSE, " => first sample at TS=%011llu (%03us %04uc %04ut)...\n", … … 524 559 // such that we know it is wet-running when it should output its first sample 525 560 uint64_t time_to_start_xmit = substractTicks(time_of_first_sample, 526 STREAMPROCESSORMANAGER_PRESTART_CYCLES_FOR_XMIT* TICKS_PER_CYCLE);561 prestart_cycles_for_xmit * TICKS_PER_CYCLE); 527 562 528 563 uint64_t time_to_start_recv = substractTicks(time_of_first_sample, 529 STREAMPROCESSORMANAGER_PRESTART_CYCLES_FOR_RECV* TICKS_PER_CYCLE);564 prestart_cycles_for_recv * TICKS_PER_CYCLE); 530 565 debugOutput( DEBUG_LEVEL_VERBOSE, " => xmit starts at TS=%011llu (%03us %04uc %04ut)...\n", 531 566 time_to_start_xmit, … … 586 621 // note: the SP's are scheduled to start in STREAMPROCESSORMANAGER_CYCLES_FOR_STARTUP cycles, 587 622 // so a 20 times this value should be a good timeout 588 int cnt = STREAMPROCESSORMANAGER_CYCLES_FOR_STARTUP* 20; // by then it should have started623 int cnt = cycles_for_startup * 20; // by then it should have started 589 624 while (!m_SyncSource->isRunning() && cnt) { 590 625 SleepRelativeUsec(125); … … 650 685 unsigned int i; 651 686 652 unsigned int periods_per_align_try = (STREAMPROCESSORMANAGER_ALIGN_AVERAGE_TIME_MSEC * getNominalRate()); 687 int cnt = STREAMPROCESSORMANAGER_NB_ALIGN_TRIES; 688 int align_average_time_msec = STREAMPROCESSORMANAGER_ALIGN_AVERAGE_TIME_MSEC; 689 Util::Configuration &config = m_parent.getConfiguration(); 690 config.getValueForSetting("streaming.spm.align_tries", cnt); 691 config.getValueForSetting("streaming.spm.align_average_time_msec", align_average_time_msec); 692 693 unsigned int periods_per_align_try = (align_average_time_msec * getNominalRate()); 653 694 periods_per_align_try /= 1000; 654 695 periods_per_align_try /= getPeriodSize(); … … 656 697 657 698 bool aligned = false; 658 int cnt = STREAMPROCESSORMANAGER_NB_ALIGN_TRIES;659 699 while (!aligned && cnt--) { 660 700 nb_sync_runs = periods_per_align_try; … … 1301 1341 debugOutputShort( DEBUG_LEVEL_NORMAL, "----------------------------------------------------\n"); 1302 1342 1343 // list port info in verbose mode 1344 debugOutputShort( DEBUG_LEVEL_VERBOSE, "Port Information\n"); 1345 int nb_ports; 1346 1347 debugOutputShort( DEBUG_LEVEL_VERBOSE, " Playback\n"); 1348 nb_ports = getPortCount(Port::E_Playback); 1349 for(int i=0; i < nb_ports; i++) { 1350 Port *p = getPortByIndex(i, Port::E_Playback); 1351 debugOutputShort( DEBUG_LEVEL_VERBOSE, " %3d (%p): ", i, p); 1352 if (p) { 1353 bool disabled = p->isDisabled(); 1354 debugOutputShort( DEBUG_LEVEL_VERBOSE, "[%p] [%3s] ", &p->getManager(), (disabled?"off":"on")); 1355 debugOutputShort( DEBUG_LEVEL_VERBOSE, "[%7s] ", p->getPortTypeName().c_str()); 1356 debugOutputShort( DEBUG_LEVEL_VERBOSE, "%3s ", p->getName().c_str()); 1357 } else { 1358 debugOutputShort( DEBUG_LEVEL_VERBOSE, "invalid "); 1359 } 1360 debugOutputShort( DEBUG_LEVEL_VERBOSE, "\n"); 1361 } 1362 debugOutputShort( DEBUG_LEVEL_VERBOSE, " Capture\n"); 1363 nb_ports = getPortCount(Port::E_Capture); 1364 for(int i=0; i < nb_ports; i++) { 1365 Port *p = getPortByIndex(i, Port::E_Capture); 1366 debugOutputShort( DEBUG_LEVEL_VERBOSE, " %3d (%p): ", i, p); 1367 if (p) { 1368 bool disabled = p->isDisabled(); 1369 debugOutputShort( DEBUG_LEVEL_VERBOSE, "[%p] [%3s] ", &p->getManager(), (disabled?"off":"on")); 1370 debugOutputShort( DEBUG_LEVEL_VERBOSE, "[%7s] ", p->getPortTypeName().c_str()); 1371 debugOutputShort( DEBUG_LEVEL_VERBOSE, " %3s ", p->getName().c_str()); 1372 } else { 1373 debugOutputShort( DEBUG_LEVEL_VERBOSE, " invalid "); 1374 } 1375 debugOutputShort( DEBUG_LEVEL_VERBOSE, "\n"); 1376 } 1377 1378 debugOutputShort( DEBUG_LEVEL_VERBOSE, "----------------------------------------------------\n"); 1379 1303 1380 } 1304 1381 … … 1358 1435 } 1359 1436 1360 // TODO: implement a port map here, instead of the loop 1437 void 1438 StreamProcessorManager::updateShadowLists() 1439 { 1440 debugOutput( DEBUG_LEVEL_VERBOSE, "Updating port shadow lists...\n"); 1441 m_CapturePorts_shadow.clear(); 1442 m_PlaybackPorts_shadow.clear(); 1443 1444 for ( StreamProcessorVectorIterator it = m_ReceiveProcessors.begin(); 1445 it != m_ReceiveProcessors.end(); 1446 ++it ) { 1447 PortManager *pm = *it; 1448 for (int i=0; i < pm->getPortCount(); i++) { 1449 Port *p = pm->getPortAtIdx(i); 1450 if (!p) { 1451 debugError("getPortAtIdx(%d) returned NULL\n", i); 1452 continue; 1453 } 1454 if(p->getDirection() != Port::E_Capture) { 1455 debugError("port at idx %d for receive SP is not a capture port!\n", i); 1456 continue; 1457 } 1458 m_CapturePorts_shadow.push_back(p); 1459 } 1460 } 1461 for ( StreamProcessorVectorIterator it = m_TransmitProcessors.begin(); 1462 it != m_TransmitProcessors.end(); 1463 ++it ) { 1464 PortManager *pm = *it; 1465 for (int i=0; i < pm->getPortCount(); i++) { 1466 Port *p = pm->getPortAtIdx(i); 1467 if (!p) { 1468 debugError("getPortAtIdx(%d) returned NULL\n", i); 1469 continue; 1470 } 1471 if(p->getDirection() != Port::E_Playback) { 1472 debugError("port at idx %d for transmit SP is not a playback port!\n", i); 1473 continue; 1474 } 1475 m_PlaybackPorts_shadow.push_back(p); 1476 } 1477 } 1478 } 1479 1361 1480 Port* StreamProcessorManager::getPortByIndex(int idx, enum Port::E_Direction direction) { 1362 int count=0; 1363 int prevcount=0; 1364 1481 debugOutputExtreme( DEBUG_LEVEL_ULTRA_VERBOSE, "getPortByIndex(%d, %d)...\n", idx, direction); 1365 1482 if (direction == Port::E_Capture) { 1366 for ( StreamProcessorVectorIterator it = m_ReceiveProcessors.begin(); 1367 it != m_ReceiveProcessors.end(); 1368 ++it ) { 1369 count += (*it)->getPortCount(); 1370 if (count > idx) { 1371 return (*it)->getPortAtIdx(idx-prevcount); 1372 } 1373 prevcount=count; 1374 } 1483 #ifdef DEBUG 1484 if(idx >= (int)m_CapturePorts_shadow.size()) { 1485 debugError("Capture port %d out of range (%d)\n", idx, m_CapturePorts_shadow.size()); 1486 return NULL; 1487 } 1488 #endif 1489 return m_CapturePorts_shadow.at(idx); 1375 1490 } else { 1376 for ( StreamProcessorVectorIterator it = m_TransmitProcessors.begin(); 1377 it != m_TransmitProcessors.end(); 1378 ++it ) { 1379 count += (*it)->getPortCount(); 1380 if (count > idx) { 1381 return (*it)->getPortAtIdx(idx-prevcount); 1382 } 1383 prevcount=count; 1384 } 1491 #ifdef DEBUG 1492 if(idx >= (int)m_PlaybackPorts_shadow.size()) { 1493 debugError("Playback port %d out of range (%d)\n", idx, m_PlaybackPorts_shadow.size()); 1494 return NULL; 1495 } 1496 #endif 1497 return m_PlaybackPorts_shadow.at(idx); 1385 1498 } 1386 1499 return NULL; trunk/libffado/src/libstreaming/StreamProcessorManager.h
r1336 r1498 25 25 #define __FFADO_STREAMPROCESSORMANAGER__ 26 26 27 #include "generic/PortManager.h" 27 28 #include "generic/Port.h" 28 29 #include "generic/StreamProcessor.h" … … 102 103 // timeout occurs. 103 104 void setActivityWaitTimeoutUsec(int usec) 104 {m_activity_wait_timeout_ usec = usec;};105 {m_activity_wait_timeout_nsec = usec*1000LL;}; 105 106 int getActivityWaitTimeoutUsec() 106 {return m_activity_wait_timeout_ usec;};107 {return m_activity_wait_timeout_nsec/1000;}; 107 108 108 109 int getPortCount(enum Port::E_PortType, enum Port::E_Direction); … … 168 169 // thread related vars 169 170 bool m_xrun_happened; 170 int m_activity_wait_timeout_usec;171 int64_t m_activity_wait_timeout_nsec; 171 172 bool m_thread_realtime; 172 173 int m_thread_priority; … … 178 179 StreamProcessorVector m_ReceiveProcessors; 179 180 StreamProcessorVector m_TransmitProcessors; 181 182 // port shadow lists 183 PortVector m_CapturePorts_shadow; 184 PortVector m_PlaybackPorts_shadow; 185 void updateShadowLists(); 180 186 181 187 unsigned int m_nb_buffers; trunk/libffado/src/libutil/ByteSwap.h
r1254 r1498 155 155 #ifdef __SSE2__ 156 156 #include <emmintrin.h> 157 #warning SSE2 build 158 159 static 160 //inline void 161 void 157 158 static inline void 162 159 byteSwapToBus(quadlet_t *data, unsigned int nb_elements) 163 160 { … … 207 204 } 208 205 209 static 210 //inline void 211 void 206 static inline void 212 207 byteSwapFromBus(quadlet_t *data, unsigned int nb_elements) 213 208 { trunk/libffado/src/libutil/cmd_serialize.cpp
r1234 r1498 44 44 CoutSerializer::write( byte_t d, const char* name ) 45 45 { 46 debugOutput( DEBUG_LEVEL_NORMAL, " %3d: 0x%02x %- 40.40s\n", m_cnt, d, name );46 debugOutput( DEBUG_LEVEL_NORMAL, " %3d: 0x%02x %-60.60s\n", m_cnt, d, name ); 47 47 m_cnt += sizeof( byte_t ); 48 48 … … 53 53 CoutSerializer::write( uint16_t d, const char* name ) 54 54 { 55 debugOutput( DEBUG_LEVEL_NORMAL, " %3d: 0x%04x %- 40.40s\n", m_cnt, d, name );55 debugOutput( DEBUG_LEVEL_NORMAL, " %3d: 0x%04x %-60.60s\n", m_cnt, d, name ); 56 56 m_cnt += sizeof( uint16_t ); 57 57 … … 62 62 CoutSerializer::write( quadlet_t d, const char* name ) 63 63 { 64 debugOutput( DEBUG_LEVEL_NORMAL, " %3d: 0x%08x %- 40.40s\n", m_cnt, d, name );64 debugOutput( DEBUG_LEVEL_NORMAL, " %3d: 0x%08x %-60.60s\n", m_cnt, d, name ); 65 65 m_cnt += sizeof( quadlet_t ); 66 66 return true; … … 70 70 CoutSerializer::write( const char * v, size_t len, const char* name ) 71 71 { 72 debugOutput( DEBUG_LEVEL_NORMAL, " %3d: %s %- 40.40s\n", m_cnt, v, name );72 debugOutput( DEBUG_LEVEL_NORMAL, " %3d: %s %-60.60s\n", m_cnt, v, name ); 73 73 m_cnt += len; 74 74 return true; trunk/libffado/src/libutil/Configuration.cpp
r1336 r1498 29 29 namespace Util { 30 30 31 IMPL_DEBUG_MODULE( Configuration, Configuration, DEBUG_LEVEL_ VERBOSE);31 IMPL_DEBUG_MODULE( Configuration, Configuration, DEBUG_LEVEL_NORMAL ); 32 32 33 33 Configuration::Configuration() … … 228 228 } 229 229 230 bool 231 Configuration::getValueForSetting(std::string path, int32_t &ref) 232 { 233 libconfig::Setting *s = getSetting( path ); 234 if(s) { 235 // FIXME: this can be done using the libconfig methods 236 Setting::Type t = s->getType(); 237 if(t == Setting::TypeInt) { 238 ref = *s; 239 debugOutput(DEBUG_LEVEL_VERBOSE, "path '%s' has value %d\n", path.c_str(), ref); 240 return true; 241 } else { 242 debugOutput(DEBUG_LEVEL_VERBOSE, "path '%s' has wrong type\n", path.c_str()); 243 return false; 244 } 245 } else { 246 debugOutput(DEBUG_LEVEL_VERBOSE, "path '%s' not found\n", path.c_str()); 247 return false; 248 } 249 } 250 251 bool 252 Configuration::getValueForSetting(std::string path, int64_t &ref) 253 { 254 libconfig::Setting *s = getSetting( path ); 255 if(s) { 256 // FIXME: this can be done using the libconfig methods 257 Setting::Type t = s->getType(); 258 if(t == Setting::TypeInt64) { 259 ref = *s; 260 debugOutput(DEBUG_LEVEL_VERBOSE, "path '%s' has value %d\n", path.c_str(), ref); 261 return true; 262 } else { 263 debugOutput(DEBUG_LEVEL_VERBOSE, "path '%s' has wrong type\n", path.c_str()); 264 return false; 265 } 266 } else { 267 debugOutput(DEBUG_LEVEL_VERBOSE, "path '%s' not found\n", path.c_str()); 268 return false; 269 } 270 } 271 272 libconfig::Setting * 273 Configuration::getSetting( std::string path ) 274 { 275 for ( std::vector<ConfigFile *>::iterator it = m_ConfigFiles.begin(); 276 it != m_ConfigFiles.end(); 277 ++it ) 278 { 279 ConfigFile *c = *it; 280 try { 281 Setting &s = c->lookup(path); 282 return &s; 283 } catch (...) { 284 debugOutput(DEBUG_LEVEL_VERBOSE, " %s has no setting %s\n", 285 c->getName().c_str(), path.c_str()); 286 } 287 } 288 return NULL; 289 } 290 230 291 231 292 Configuration::VendorModelEntry trunk/libffado/src/libutil/Configuration.h
r1336 r1498 113 113 static bool isValid( const VendorModelEntry& vme ); 114 114 115 // access functions 116 /** 117 * @brief retrieves a setting for a given path 118 * 119 * the value in the ref parameter is not changed if 120 * the function returns false. 121 * 122 * @param path path to the setting 123 * @param ref reference to the integer that will hold the value. 124 * @return true if successful, false if not 125 */ 126 bool getValueForSetting(std::string path, int32_t &ref); 127 bool getValueForSetting(std::string path, int64_t &ref); 128 115 129 virtual void setVerboseLevel(int l) {setDebugLevel(l);}; 116 130 virtual void show(); 117 131 118 132 private: 133 libconfig::Setting *getSetting( std::string path ); 134 119 135 int findFileName(std::string s); 120 136 trunk/libffado/src/libutil/Functors.h
r960 r1498 26 26 27 27 #include <semaphore.h> 28 #include <vector> 28 29 29 30 namespace Util { … … 36 37 37 38 virtual void operator() () = 0; 39 virtual bool matchCallee(void *) = 0; 38 40 }; 41 42 typedef std::vector<Functor *> FunctorVector; 43 typedef std::vector<Functor *>::iterator FunctorVectorIterator; 39 44 40 45 //////////////////////////////////////////////////////////////////////// … … 74 79 } 75 80 if (m_bDelete) { 76 delete this; 81 delete this; 82 } 77 83 } 78 } 84 virtual bool matchCallee(void *p) 85 { 86 return p == (void *)m_pCallee; 87 } 79 88 80 89 private: … … 126 135 } 127 136 137 virtual bool matchCallee(void *p) 138 { 139 return p == (void *)m_pCallee; 140 } 141 128 142 private: 129 143 CalleePtr m_pCallee; … … 167 181 } 168 182 } 183 virtual bool matchCallee(void *p) 184 { 185 return false; 186 } 169 187 170 188 private: trunk/libffado/src/libutil/PosixThread.cpp
r1336 r1498 125 125 126 126 memset(&rt_param, 0, sizeof(rt_param)); 127 rt_param.sched_priority = fPriority; 127 if(fPriority <= 0) { 128 debugWarning("Clipping to minimum priority (%d -> 1)\n", fPriority); 129 rt_param.sched_priority = 1; 130 } else if(fPriority >= 99) { 131 debugWarning("Clipping to maximum priority (%d -> 98)\n", fPriority); 132 rt_param.sched_priority = 98; 133 } else { 134 rt_param.sched_priority = fPriority; 135 } 128 136 129 137 if ((res = pthread_attr_setschedparam(&attributes, &rt_param))) { … … 133 141 134 142 if ((res = pthread_create(&fThread, &attributes, ThreadHandler, this))) { 135 debugError("Cannot set create thread %d %s\n", res, strerror(res)); 143 debugError("Cannot create realtime thread (%d: %s)\n", res, strerror(res)); 144 debugError(" priority: %d %s\n", fPriority); 136 145 return -1; 137 146 } … … 142 151 143 152 if ((res = pthread_create(&fThread, 0, ThreadHandler, this))) { 144 debugError("Cannot setcreate thread %d %s\n", res, strerror(res));153 debugError("Cannot create thread %d %s\n", res, strerror(res)); 145 154 return -1; 146 155 } … … 188 197 189 198 memset(&rtparam, 0, sizeof(rtparam)); 190 rtparam.sched_priority = fPriority; 199 if(fPriority <= 0) { 200 debugWarning("Clipping to minimum priority (%d -> 1)\n", fPriority); 201 rtparam.sched_priority = 1; 202 } else if(fPriority >= 99) { 203 debugWarning("Clipping to maximum priority (%d -> 98)\n", fPriority); 204 rtparam.sched_priority = 98; 205 } else { 206 rtparam.sched_priority = fPriority; 207 } 191 208 192 209 //if ((res = pthread_setschedparam(fThread, SCHED_FIFO, &rtparam)) != 0) { trunk/libffado/src/libutil/TimestampedBuffer.cpp
r1336 r1498 959 959 #ifdef DEBUG 960 960 // check whether the update is within the allowed bounds 961 /* const float max_deviation = (50.0/100.0); // maximal relative difference considered normal 962 ffado_timestamp_t one_update_step = nbframes * getRate(); 963 ffado_timestamp_t max_abs_diff = one_update_step * (1.0 + max_deviation);*/ 964 ffado_timestamp_t max_abs_diff = 200; 961 ffado_timestamp_t max_abs_diff = 3072/2; // half a cycle is what we consider 'normal' 965 962 966 963 debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, trunk/libffado/src/motu/motu_avdevice.cpp
r1361 r1498 63 63 {FW_VENDORID_MOTU, 0, 0x00000001, 0x000001f2, MOTU_MODEL_828MkI, "MOTU", "828MkI"}, 64 64 {FW_VENDORID_MOTU, 0, 0x00000005, 0x000001f2, MOTU_MODEL_896HD, "MOTU", "896HD"}, 65 {FW_VENDORID_MOTU, 0, 0x00000015, 0x000001f2, MOTU_MODEL_828mk3, "MOTU", "828Mk3"}, 65 66 }; 66 67 … … 68 69 const PortEntry Ports_828MKI[] = 69 70 { 70 {"Analog1", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10},71 {"Analog2", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13},72 {"Analog3", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 16},73 {"Analog4", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 19},74 {"Analog5", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 22},75 {"Analog6", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 25},76 {"Analog7", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 28},77 {"Analog8", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 31},78 {"SPDIF1", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 34},79 {"SPDIF2", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 37},80 {"ADAT1", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 40},81 {"ADAT2", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 43},82 {"ADAT3", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 46},83 {"ADAT4", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 49},84 {"ADAT5", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 52},85 {"ADAT6", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 55},86 {"ADAT7", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 58},87 {"ADAT8", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 61},71 {"Analog1", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, 72 {"Analog2", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, 73 {"Analog3", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 16}, 74 {"Analog4", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 19}, 75 {"Analog5", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 22}, 76 {"Analog6", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 25}, 77 {"Analog7", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 28}, 78 {"Analog8", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 31}, 79 {"SPDIF1", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 34}, 80 {"SPDIF2", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 37}, 81 {"ADAT1", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 40}, 82 {"ADAT2", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 43}, 83 {"ADAT3", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 46}, 84 {"ADAT4", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 49}, 85 {"ADAT5", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 52}, 86 {"ADAT6", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 55}, 87 {"ADAT7", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 58}, 88 {"ADAT8", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 61}, 88 89 }; 89 90 90 91 const PortEntry Ports_896HD[] = 91 92 { 92 {"Mix-L", MOTU_ DIR_IN,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 10},93 {"Mix-R", MOTU_ DIR_IN,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 13},94 {"Phones-L", MOTU_ DIR_OUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 10},95 {"Phones-R", MOTU_ DIR_OUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 13},96 {"Analog1", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 16},97 {"Analog1", MOTU_ DIR_INOUT,MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 10},98 {"Analog2", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 19},99 {"Analog2", MOTU_ DIR_INOUT,MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 13},100 {"Analog3", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 22},101 {"Analog3", MOTU_ DIR_INOUT,MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 16},102 {"Analog4", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 25},103 {"Analog4", MOTU_ DIR_INOUT,MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 19},104 {"Analog5", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 28},105 {"Analog5", MOTU_ DIR_INOUT,MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 22},106 {"Analog6", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 31},107 {"Analog6", MOTU_ DIR_INOUT,MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 25},108 {"Analog7", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 34},109 {"Analog7", MOTU_ DIR_INOUT,MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 28},110 {"Analog8", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 37},111 {"Analog8", MOTU_ DIR_INOUT,MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 31},112 {"MainOut-L", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 40},113 {"MainOut-R", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 43},114 {"AES/EBU1", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 46},115 {"AES/EBU2", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 49},116 {"ADAT1", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 52},117 {"ADAT2", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 55},118 {"ADAT3", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 58},119 {"ADAT4", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 61},120 {"ADAT5", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 64},121 {"ADAT6", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 67},122 {"ADAT7", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 70},123 {"ADAT8", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 73},93 {"Mix-L", MOTU_PA_IN | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 10}, 94 {"Mix-R", MOTU_PA_IN | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 13}, 95 {"Phones-L", MOTU_PA_OUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 10}, 96 {"Phones-R", MOTU_PA_OUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 13}, 97 {"Analog1", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 16}, 98 {"Analog1", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 10}, 99 {"Analog2", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 19}, 100 {"Analog2", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 13}, 101 {"Analog3", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 22}, 102 {"Analog3", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 16}, 103 {"Analog4", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 25}, 104 {"Analog4", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 19}, 105 {"Analog5", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 28}, 106 {"Analog5", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 22}, 107 {"Analog6", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 31}, 108 {"Analog6", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 25}, 109 {"Analog7", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 34}, 110 {"Analog7", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 28}, 111 {"Analog8", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 37}, 112 {"Analog8", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 31}, 113 {"MainOut-L", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 40}, 114 {"MainOut-R", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 43}, 115 {"AES/EBU1", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 46}, 116 {"AES/EBU2", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 49}, 117 {"ADAT1", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 52}, 118 {"ADAT2", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 55}, 119 {"ADAT3", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 58}, 120 {"ADAT4", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 61}, 121 {"ADAT5", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 64}, 122 {"ADAT6", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 67}, 123 {"ADAT7", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 70}, 124 {"ADAT8", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 73}, 124 125 }; 125 126 126 127 const PortEntry Ports_828MKII[] = 127 128 { 128 {"Main-L", MOTU_ DIR_OUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 40},129 {"Main-R", MOTU_ DIR_OUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 43},130 {"Mix-L", MOTU_ DIR_IN,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10},131 {"Mix-R", MOTU_ DIR_IN,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13},132 {"Analog1", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 16},133 {"Analog2", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 19},134 {"Analog3", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 22},135 {"Analog4", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 25},136 {"Analog5", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 28},137 {"Analog6", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 31},138 {"Analog7", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 34},139 {"Analog8", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 37},140 {"Phones-L", MOTU_ DIR_OUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10},141 {"Phones-R", MOTU_ DIR_OUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13},142 {"Mic1", MOTU_ DIR_IN,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 40},143 {"Mic2", MOTU_ DIR_IN,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 43},144 {"SPDIF1", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 46},145 {"SPDIF2", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 49},146 {"ADAT1", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 52},147 {"ADAT2", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 55},148 {"ADAT3", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 58},149 {"ADAT4", MOTU_ DIR_INOUT,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 61},150 {"ADAT5", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 64},151 {"ADAT6", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 67},152 {"ADAT7", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 70},153 {"ADAT8", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 73},129 {"Main-L", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 40}, 130 {"Main-R", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 43}, 131 {"Mix-L", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, 132 {"Mix-R", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, 133 {"Analog1", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 16}, 134 {"Analog2", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 19}, 135 {"Analog3", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 22}, 136 {"Analog4", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 25}, 137 {"Analog5", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 28}, 138 {"Analog6", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 31}, 139 {"Analog7", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 34}, 140 {"Analog8", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 37}, 141 {"Phones-L", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, 142 {"Phones-R", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, 143 {"Mic1", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 40}, 144 {"Mic2", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 43}, 145 {"SPDIF1", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 46}, 146 {"SPDIF2", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 49}, 147 {"ADAT1", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 52}, 148 {"ADAT2", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 55}, 149 {"ADAT3", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 58}, 150 {"ADAT4", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 61}, 151 {"ADAT5", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 64}, 152 {"ADAT6", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 67}, 153 {"ADAT7", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 70}, 154 {"ADAT8", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 73}, 154 155 }; 155 156 156 157 const PortEntry Ports_TRAVELER[] = 157 158 { 158 {"Mix-L", MOTU_ DIR_IN,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 10},159 {"Mix-R", MOTU_ DIR_IN,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 13},160 {"Phones-L", MOTU_ DIR_OUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 10},161 {"Phones-R", MOTU_ DIR_OUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 13},162 {"Analog1", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 16},163 {"Analog1", MOTU_ DIR_INOUT,MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 10},164 {"Analog2", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 19},165 {"Analog2", MOTU_ DIR_INOUT,MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 13},166 {"Analog3", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 22},167 {"Analog3", MOTU_ DIR_INOUT,MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 16},168 {"Analog4", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 25},169 {"Analog4", MOTU_ DIR_INOUT,MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 19},170 {"Analog5", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 28},171 {"Analog5", MOTU_ DIR_INOUT,MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 22},172 {"Analog6", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 31},173 {"Analog6", MOTU_ DIR_INOUT,MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 25},174 {"Analog7", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 34},175 {"Analog7", MOTU_ DIR_INOUT,MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 28},176 {"Analog8", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 37},177 {"Analog8", MOTU_ DIR_INOUT,MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 31},178 {"AES/EBU1", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 40},179 {"AES/EBU2", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 43},180 {"SPDIF1", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_OFF|MOTU_PA_OPTICAL_ADAT, 46},181 {"SPDIF2", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_OFF|MOTU_PA_OPTICAL_ADAT, 49},182 {"Toslink1", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_TOSLINK, 46},183 {"Toslink2", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_TOSLINK, 49},184 {"ADAT1", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 52},185 {"ADAT2", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 55},186 {"ADAT3", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 58},187 {"ADAT4", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 61},188 {"ADAT5", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 64},189 {"ADAT6", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 67},190 {"ADAT7", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 70},191 {"ADAT8", MOTU_ DIR_INOUT,MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 73},159 {"Mix-L", MOTU_PA_IN | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 10}, 160 {"Mix-R", MOTU_PA_IN | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 13}, 161 {"Phones-L", MOTU_PA_OUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 10}, 162 {"Phones-R", MOTU_PA_OUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 13}, 163 {"Analog1", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 16}, 164 {"Analog1", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 10}, 165 {"Analog2", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 19}, 166 {"Analog2", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 13}, 167 {"Analog3", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 22}, 168 {"Analog3", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 16}, 169 {"Analog4", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 25}, 170 {"Analog4", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 19}, 171 {"Analog5", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 28}, 172 {"Analog5", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 22}, 173 {"Analog6", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 31}, 174 {"Analog6", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 25}, 175 {"Analog7", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 34}, 176 {"Analog7", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 28}, 177 {"Analog8", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 37}, 178 {"Analog8", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 31}, 179 {"AES/EBU1", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 40}, 180 {"AES/EBU2", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 43}, 181 {"SPDIF1", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_OFF|MOTU_PA_OPTICAL_ADAT, 46}, 182 {"SPDIF2", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_OFF|MOTU_PA_OPTICAL_ADAT, 49}, 183 {"Toslink1", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_TOSLINK, 46}, 184 {"Toslink2", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_TOSLINK, 49}, 185 {"ADAT1", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 52}, 186 {"ADAT2", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 55}, 187 {"ADAT3", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 58}, 188 {"ADAT4", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 61}, 189 {"ADAT5", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 64}, 190 {"ADAT6", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 67}, 191 {"ADAT7", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 70}, 192 {"ADAT8", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 73}, 192 193 }; 193 194 194 195 const PortEntry Ports_ULTRALITE[] = 195 196 { 196 {"Main-L", MOTU_ DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 46},197 {"Main-R", MOTU_ DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 49},198 {" Padding1", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY|MOTU_PA_PADDING, 46},199 {" Padding2", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY|MOTU_PA_PADDING, 49},200 {"Mi x-L", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10},201 {"Mi x-R", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13},202 {" Mic1", MOTU_DIR_IN,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 16},203 {" Mic2", MOTU_DIR_IN,MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 19},204 {"Analog 1", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 16},205 {"Analog 2", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 19},206 {"Analog 3", MOTU_DIR_INOUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 22},207 {"Analog 4", MOTU_DIR_INOUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 25},208 {"Analog 5", MOTU_DIR_INOUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 28},209 {"Analog 6", MOTU_DIR_INOUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 31},210 {" Analog7", MOTU_DIR_INOUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 34},211 {" Analog8", MOTU_DIR_INOUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 37},212 {"P hones-L", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10},213 {"P hones-R", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13},214 {"SPDIF1", MOTU_ DIR_INOUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 40},215 {"SPDIF2", MOTU_ DIR_INOUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 43},197 {"Main-L", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 40}, 198 {"Main-R", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 43}, 199 {"Mix-L", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, 200 {"Mix-R", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, 201 {"Mic1", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 16}, 202 {"Mic2", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 19}, 203 {"Analog1", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 16}, 204 {"Analog2", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 19}, 205 {"Analog3", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 22}, 206 {"Analog4", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 25}, 207 {"Analog5", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 28}, 208 {"Analog6", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 31}, 209 {"Analog7", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 34}, 210 {"Analog8", MOTU_PA_INOUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 37}, 211 {"Phones-L", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, 212 {"Phones-R", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, 213 {"Padding1", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY|MOTU_PA_PADDING, 46}, 214 {"Padding2", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY|MOTU_PA_PADDING, 49}, 215 {"SPDIF1", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 46}, 216 {"SPDIF2", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 49}, 216 217 }; 217 218 218 219 const PortEntry Ports_8PRE[] = 219 220 { 220 {"Analog1", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 16}, 221 {"Analog2", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 19}, 222 {"Analog3", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 22}, 223 {"Analog4", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 25}, 224 {"Analog5", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 28}, 225 {"Analog6", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 31}, 226 {"Analog7", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 34}, 227 {"Analog8", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 37}, 228 {"Mix-L", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, 229 {"Mix-R", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, 230 {"Main-L", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 16}, 231 {"Main-R", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 19}, 232 {"Phones-L", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, 233 {"Phones-R", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, 234 {"ADAT1", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 40}, 235 {"ADAT1", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 22}, 236 {"ADAT2", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 43}, 237 {"ADAT2", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 25}, 238 {"ADAT3", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 46}, 239 {"ADAT3", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 28}, 240 {"ADAT4", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 49}, 241 {"ADAT4", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 31}, 242 {"ADAT5", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 52}, 243 {"ADAT5", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 34}, 244 {"ADAT6", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 55}, 245 {"ADAT6", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 37}, 246 {"ADAT7", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 58}, 247 {"ADAT7", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 40}, 248 {"ADAT8", MOTU_DIR_IN, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 61}, 249 {"ADAT8", MOTU_DIR_OUT, MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 43}, 221 {"Analog1", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 16}, 222 {"Analog2", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 19}, 223 {"Analog3", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 22}, 224 {"Analog4", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 25}, 225 {"Analog5", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 28}, 226 {"Analog6", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 31}, 227 {"Analog7", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 34}, 228 {"Analog8", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 37}, 229 {"Mix-L", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, 230 {"Mix-R", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, 231 {"Main-L", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 16}, 232 {"Main-R", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 19}, 233 {"Phones-L", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 10}, 234 {"Phones-R", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ANY, 13}, 235 {"ADAT1", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 40}, 236 {"ADAT1", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 22}, 237 {"ADAT2", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 43}, 238 {"ADAT2", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 25}, 239 {"ADAT3", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 46}, 240 {"ADAT3", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 28}, 241 {"ADAT4", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 49}, 242 {"ADAT4", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 31}, 243 {"ADAT5", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 52}, 244 {"ADAT5", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 34}, 245 {"ADAT6", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 55}, 246 {"ADAT6", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 37}, 247 {"ADAT7", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 58}, 248 {"ADAT7", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 40}, 249 {"ADAT8", MOTU_PA_IN | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 61}, 250 {"ADAT8", MOTU_PA_OUT | MOTU_PA_RATE_ANY|MOTU_PA_OPTICAL_ADAT, 43}, 251 }; 252 253 const PortEntry Ports_828mk3[] = 254 { 255 {"Mix-L", MOTU_PA_IN | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 10}, 256 {"Mix-R", MOTU_PA_IN | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 13}, 257 {"Phones-L", MOTU_PA_OUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 10}, 258 {"Phones-R", MOTU_PA_OUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 13}, 259 {"Analog1", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 16}, 260 {"Analog1", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 10}, 261 {"Analog2", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 19}, 262 {"Analog2", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 13}, 263 {"Analog3", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 22}, 264 {"Analog3", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 16}, 265 {"Analog4", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 25}, 266 {"Analog4", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 19}, 267 {"Analog5", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 28}, 268 {"Analog5", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 22}, 269 {"Analog6", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 31}, 270 {"Analog6", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 25}, 271 {"Analog7", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 34}, 272 {"Analog7", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 28}, 273 {"Analog8", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ANY, 37}, 274 {"Analog8", MOTU_PA_INOUT | MOTU_PA_RATE_4x|MOTU_PA_OPTICAL_ANY, 31}, 275 {"SPDIF1", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_OFF|MOTU_PA_OPTICAL_ADAT, 40}, 276 {"SPDIF2", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_OFF|MOTU_PA_OPTICAL_ADAT, 43}, 277 {"Padding1", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_OFF|MOTU_PA_OPTICAL_ADAT|MOTU_PA_PADDING, 46}, 278 {"Padding2", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_OFF|MOTU_PA_OPTICAL_ADAT|MOTU_PA_PADDING, 49}, 279 {"Toslink1", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_TOSLINK, 40}, 280 {"Toslink2", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_TOSLINK, 43}, 281 {"Toslink3", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_TOSLINK, 46}, 282 {"Toslink4", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_TOSLINK, 49}, 283 {"ADAT1", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 52}, 284 {"ADAT2", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 55}, 285 {"ADAT3", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 58}, 286 {"ADAT4", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 61}, 287 {"ADAT5", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 64}, 288 {"ADAT6", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 67}, 289 {"ADAT7", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 70}, 290 {"ADAT8", MOTU_PA_INOUT | MOTU_PA_RATE_1x2x|MOTU_PA_OPTICAL_ADAT, 73}, 291 {"ADAT9", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 76}, 292 {"ADAT10", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 79}, 293 {"ADAT11", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 82}, 294 {"ADAT12", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 85}, 295 {"ADAT13", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 88}, 296 {"ADAT14", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 91}, 297 {"ADAT15", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 94}, 298 {"ADAT16", MOTU_PA_INOUT | MOTU_PA_RATE_1x|MOTU_PA_OPTICAL_ADAT, 97}, 250 299 }; 251 300 … … 301 350 302 351 /* For optical mode controls, the "register" is used to indicate direction */ 303 {"Control/OpticalIn_mode", "Optical input mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_ DIR_IN},304 {"Control/OpticalOut_mode", "Optical output mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_ DIR_OUT},352 {"Control/OpticalIn_mode", "Optical input mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_IN}, 353 {"Control/OpticalOut_mode", "Optical output mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_OUT}, 305 354 }; 306 355 … … 321 370 {"Analog 7", MOTU_CTRL_STD_CHANNEL, 0x0018, }, 322 371 {"Analog 8", MOTU_CTRL_STD_CHANNEL, 0x001c, }, 372 {"AES/EBU 1", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 373 {"AES/EBU 2", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 323 374 {"SPDIF 1", MOTU_CTRL_STD_CHANNEL, 0x0020, }, 324 375 {"SPDIF 2", MOTU_CTRL_STD_CHANNEL, 0x0024, }, 376 {"ADAT 1", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 377 {"ADAT 2", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 378 {"ADAT 3", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 379 {"ADAT 4", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 380 {"ADAT 5", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 381 {"ADAT 6", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 382 {"ADAT 7", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 383 {"ADAT 8", MOTU_CTRL_STD_CHANNEL, MOTU_CTRL_NONE, }, 325 384 }; 326 385 … … 345 404 346 405 /* For optical mode controls, the "register" is used to indicate direction */ 347 {"Control/OpticalIn_mode", "Optical input mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_ DIR_IN},348 {"Control/OpticalOut_mode", "Optical output mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_ DIR_OUT},406 {"Control/OpticalIn_mode", "Optical input mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_IN}, 407 {"Control/OpticalOut_mode", "Optical output mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_OUT}, 349 408 }; 350 409 … … 359 418 360 419 /* For optical mode controls, the "register" is used to indicate direction */ 361 {"Control/OpticalIn_mode", "Optical input mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_ DIR_IN},362 {"Control/OpticalOut_mode", "Optical output mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_ DIR_OUT},420 {"Control/OpticalIn_mode", "Optical input mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_IN}, 421 {"Control/OpticalOut_mode", "Optical output mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_OUT}, 363 422 364 423 /* For meter controls the "register" indicates which meter controls are available */ … … 388 447 389 448 /* For optical mode controls, the "register" is used to indicate direction */ 390 {"Control/OpticalIn_mode", "Optical input mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_ DIR_IN},391 {"Control/OpticalOut_mode", "Optical output mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_ DIR_OUT},449 {"Control/OpticalIn_mode", "Optical input mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_IN}, 450 {"Control/OpticalOut_mode", "Optical output mode ", "", MOTU_CTRL_OPTICAL_MODE, MOTU_CTRL_DIR_OUT}, 392 451 }; 393 452 … … 415 474 { Ports_828MKI, N_ELEMENTS( Ports_828MKI ), 48000 }, 416 475 { Ports_896HD, N_ELEMENTS( Ports_896HD ), 192000, &Mixer_896HD, }, 476 { Ports_828mk3, N_ELEMENTS( Ports_828mk3 ), 192000 }, 417 477 }; 418 478 … … 451 511 bool 452 512 MotuDevice::buildMixer() { 453 unsigned int i;454 513 bool result = true; 455 514 MotuMatrixMixer *fader_mmixer = NULL; … … 457 516 MotuMatrixMixer *solo_mmixer = NULL; 458 517 MotuMatrixMixer *mute_mmixer = NULL; 459 unsigned int bus, ch; 460 debugOutput(DEBUG_LEVEL_VERBOSE, "Building a MOTU mixer...\n"); 518 const struct MatrixMixBus *buses = NULL; 519 const struct MatrixMixChannel *channels = NULL; 520 unsigned int bus, ch, i; 461 521 462 522 destroyMixer(); 463 523 464 524 // create the mixer object container 465 525 m_MixerContainer = new Control::Container(this, "Mixer"); … … 467 527 debugError("Could not create mixer container...\n"); 468 528 return false; 529 } else { 530 buses = DevicesProperty[m_motu_model-1].mixer->mixer_buses; 531 if (buses == NULL) { 532 debugOutput(DEBUG_LEVEL_WARNING, "No buses defined for model %d\n", m_motu_model); 533 result = false; 534 } 535 channels = DevicesProperty[m_motu_model-1].mixer->mixer_channels; 536 if (channels == NULL) { 537 debugOutput(DEBUG_LEVEL_WARNING, "No channels defined for model %d\n", m_motu_model); 538 result = false; 539 } 540 } 541 542 if (result == false) { 543 return true; 469 544 } 470 545 … … 480 555 MOTU_CTRL_MASK_MUTE_VALUE, MOTU_CTRL_MASK_MUTE_SETENABLE); 481 556 result &= m_MixerContainer->addElement(mute_mmixer); 482 const struct MatrixMixBus *buses = DevicesProperty[m_motu_model-1].mixer->mixer_buses;557 buses = DevicesProperty[m_motu_model-1].mixer->mixer_buses; 483 558 for (bus=0; bus<DevicesProperty[m_motu_model-1].mixer->n_mixer_buses; bus++) { 484 559 fader_mmixer->addRowInfo(buses[bus].name, 0, buses[bus].address); … … 487 562 mute_mmixer->addRowInfo(buses[bus].name, 0, buses[bus].address); 488 563 } 489 c onst struct MatrixMixChannel *channels = DevicesProperty[m_motu_model-1].mixer->mixer_channels;564 channels = DevicesProperty[m_motu_model-1].mixer->mixer_channels; 490 565 for (ch=0; ch<DevicesProperty[m_motu_model-1].mixer->n_mixer_channels; ch++) { 491 566 uint32_t flags = channels[ch].flags; … … 807 882 } 808 883 884 enum FFADODevice::eStreamingState 885 MotuDevice::getStreamingState() 886 { 887 unsigned int val = ReadRegister(MOTU_REG_ISOCTRL); 888 /* Streaming is active if either bit 22 (Motu->PC streaming 889 * enable) or bit 30 (PC->Motu streaming enable) is set. 890 */ 891 debugOutput(DEBUG_LEVEL_VERBOSE, "MOTU_REG_ISOCTRL: %08x\n", val); 892 893 if((val & 0x40400000) != 0) { 894 return eSS_Both; 895 } else if ((val & 0x40000000) != 0) { 896 return eSS_Receiving; 897 } else if ((val & 0x00400000) != 0) { 898 return eSS_Sending; 899 } else { 900 return eSS_Idle; 901 } 902 } 903 809 904 int 810 905 MotuDevice::getSamplingFrequency( ) { … … 903 998 // port if the sample rate is set to a 1x or 2x rate later. 904 999 if (cancel_adat) { 905 setOpticalMode(MOTU_ DIR_INOUT, MOTU_OPTICAL_MODE_OFF);1000 setOpticalMode(MOTU_CTRL_DIR_INOUT, MOTU_OPTICAL_MODE_OFF); 906 1001 } 907 1002 … … 918 1013 } 919 1014 920 // In other OSes bit 26 of MOTU_REG_CLK_CTRL always seems 921 // to be set when this register is written to although the 922 // reason isn't currently known. When we set it, it appears 923 // to prevent output being produced so we'll leave it unset 924 // until we work out what's going on. Other systems write 925 // to MOTU_REG_CLK_CTRL multiple times, so that may be 926 // part of the mystery. 927 // value |= 0x04000000; 1015 // Bits 24-26 of MOTU_REG_CLK_CTRL behave a little differently 1016 // depending on the model. In addition, different bit patterns are 1017 // written depending on whether streaming is enabled, disabled or is 1018 // changing state. For now we go with the combination used when 1019 // streaming is enabled since it seems to work for the other states 1020 // as well. Since device muting can be effected by these bits, we 1021 // may utilise this in future during streaming startup to prevent 1022 // noises during stabilisation. 1023 // 1024 // For most models (possibly all except the Ultralite) all 3 bits 1025 // can be zero and audio is still output. 1026 // 1027 // For the Traveler, if bit 26 is set (as it is under other OSes), 1028 // bit 25 functions as a device mute bit: if set, audio is output 1029 // while if 0 the entire device is muted. If bit 26 is unset, 1030 // setting bit 25 doesn't appear to be detrimental. 1031 // 1032 // For the Ultralite, other OSes leave bit 26 unset. However, unlike 1033 // other devices bit 25 seems to function as a mute bit in this case. 1034 // 1035 // The function of bit 24 is currently unknown. Other OSes set it 1036 // for all devices so we will too. 1037 reg &= 0xf8ffffff; 1038 if (m_motu_model == MOTU_MODEL_TRAVELER) 1039 reg |= 0x04000000; 1040 reg |= 0x03000000; 928 1041 if (WriteRegister(MOTU_REG_CLK_CTRL, reg) == 0) { 929 1042 supported=true; … … 1265 1378 asprintf(&buff,"%s_pbk_MIDI0",id.c_str()); 1266 1379 p = new Streaming::MotuMidiPort(*m_transmitProcessor, buff, 1267 Streaming::Port::E_ Capture, 4);1380 Streaming::Port::E_Playback, 4); 1268 1381 if (!p) { 1269 1382 debugOutput(DEBUG_LEVEL_VERBOSE, "Skipped port %s\n", buff); … … 1477 1590 1478 1591 unsigned int i; 1479 unsigned int dir = direction==Streaming::Port::E_Capture?MOTU_ DIR_IN:MOTU_DIR_OUT;1592 unsigned int dir = direction==Streaming::Port::E_Capture?MOTU_PA_IN:MOTU_PA_OUT; 1480 1593 unsigned int flags = (1 << ( optical_mode + 4 )); 1481 1594 … … 1490 1603 // pseudo-ports when calculating the event size. 1491 1604 for (i=0; i < DevicesProperty[m_motu_model-1].n_port_entries; i++) { 1492 if (( DevicesProperty[m_motu_model-1].port_entry[i].port_ dir& dir ) &&1605 if (( DevicesProperty[m_motu_model-1].port_entry[i].port_flags & dir ) && 1493 1606 ( DevicesProperty[m_motu_model-1].port_entry[i].port_flags & MOTU_PA_RATE_MASK & flags ) && 1494 1607 ( DevicesProperty[m_motu_model-1].port_entry[i].port_flags & MOTU_PA_OPTICAL_MASK & flags )) { … … 1538 1651 unsigned int i; 1539 1652 char *buff; 1540 unsigned int dir = direction==Streaming::Port::E_Capture?MOTU_ DIR_IN:MOTU_DIR_OUT;1653 unsigned int dir = direction==Streaming::Port::E_Capture?MOTU_PA_IN:MOTU_PA_OUT; 1541 1654 unsigned int flags = (1 << ( optical_mode + 4 )); 1542 1655 … … 1561 1674 1562 1675 for (i=0; i < DevicesProperty[m_motu_model-1].n_port_entries; i++) { 1563 if (( DevicesProperty[m_motu_model-1].port_entry[i].port_ dir& dir ) &&1676 if (( DevicesProperty[m_motu_model-1].port_entry[i].port_flags & dir ) && 1564 1677 ( DevicesProperty[m_motu_model-1].port_entry[i].port_flags & MOTU_PA_RATE_MASK & flags ) && 1565 1678 ( DevicesProperty[m_motu_model-1].port_entry[i].port_flags & MOTU_PA_OPTICAL_MASK & flags ) && trunk/libffado/src/motu/motu_avdevice.h
r1361 r1498 38 38 #define MOTU_BASE_ADDR 0xfffff0000000ULL 39 39 40 /* Bitmasks and values used when setting MOTU device registers */ 40 41 #define MOTU_RATE_BASE_44100 (0<<3) 41 42 #define MOTU_RATE_BASE_48000 (1<<3) … … 63 64 #define MOTU_CLKSRC_NONE 0xffff 64 65 #define MOTU_CLKSRC_UNCHANGED MOTU_CLKSRC_NONE 65 66 #define MOTU_DIR_IN 167 #define MOTU_DIR_OUT 268 #define MOTU_DIR_INOUT (MOTU_DIR_IN | MOTU_DIR_OUT)69 66 70 67 #define MOTU_METER_PEAKHOLD_MASK 0x3800 … … 103 100 #define MOTU_PA_OPTICAL_MASK MOTU_PA_OPTICAL_ANY 104 101 #define MOTU_PA_PADDING 0x0100 102 #define MOTU_PA_IN 0x0200 103 #define MOTU_PA_OUT 0x0400 104 #define MOTU_PA_INOUT (MOTU_PA_IN | MOTU_PA_OUT) 105 106 /* Generic "direction" flags */ 107 #define MOTU_DIR_IN 1 108 #define MOTU_DIR_OUT 2 109 #define MOTU_DIR_INOUT (MOTU_DIR_IN | MOTU_DIR_OUT) 105 110 106 111 class ConfigRom; … … 121 126 MOTU_MODEL_828MkI = 0x0005, 122 127 MOTU_MODEL_896HD = 0x0006, 128 MOTU_MODEL_828mk3 = 0x0007, 123 129 }; 124 130 … … 135 141 struct PortEntry { 136 142 const char *port_name; 137 unsigned int port_dir;138 143 unsigned int port_flags; 139 144 unsigned int port_offset; … … 209 214 virtual int getStreamCount(); 210 215 virtual Streaming::StreamProcessor *getStreamProcessorByIndex(int i); 216 enum FFADODevice::eStreamingState getStreamingState(); 211 217 212 218 virtual bool prepare(); trunk/libffado/src/motu/motu_controls.cpp
r1336 r1498 76 76 getName().c_str(), m_register, v); 77 77 78 if (m_register == MOTU_CTRL_NONE) { 79 debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 80 return true; 81 } 82 78 83 // Set the value 79 84 if (m_setenable_mask) { … … 103 108 getName().c_str(), m_register); 104 109 110 if (m_register == MOTU_CTRL_NONE) { 111 debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 112 return 0; 113 } 114 105 115 // FIXME: we could just read the appropriate mixer status field from the 106 116 // receive stream processor once we work out an efficient way to do this. … … 125 135 unsigned int val; 126 136 debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for channel fader 0x%04x to %d\n", m_register, v); 137 138 if (m_register == MOTU_CTRL_NONE) { 139 debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 140 return true; 141 } 127 142 128 143 val = v<0?0:v; … … 142 157 debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for channel fader 0x%04x\n", m_register); 143 158 159 // Silently swallow attempts to read non-existent controls for now 160 if (m_register == MOTU_CTRL_NONE) { 161 debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 162 return 0; 163 } 164 144 165 // FIXME: we could just read the appropriate mixer status field from the 145 166 // receive stream processor once we work out an efficient way to do this. … … 164 185 unsigned int val; 165 186 debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for channel pan 0x%04x to %d\n", m_register, v); 187 188 if (m_register == MOTU_CTRL_NONE) { 189 debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 190 return true; 191 } 166 192 167 193 val = ((v<-64?-64:v)+64) & 0xff; … … 181 207 debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for channel pan 0x%04x\n", m_register); 182 208 209 // Silently swallow attempts to read non-existent controls for now 210 if (m_register == MOTU_CTRL_NONE) { 211 debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 212 return 0; 213 } 214 183 215 // FIXME: we could just read the appropriate mixer status field from the 184 216 // receive stream processor once we work out an efficient way to do this. … … 222 254 uint32_t MotuMatrixMixer::getCellRegister(const unsigned int row, const unsigned int col) 223 255 { 256 if (m_RowInfo.at(row).address==MOTU_CTRL_NONE || 257 m_ColInfo.at(col).address==MOTU_CTRL_NONE) 258 return MOTU_CTRL_NONE; 224 259 return m_RowInfo.at(row).address + m_ColInfo.at(col).address; 225 260 } … … 262 297 double ChannelFaderMatrixMixer::setValue(const int row, const int col, const double val) 263 298 { 264 uint32_t v ;299 uint32_t v, reg; 265 300 v = val<0?0:(uint32_t)val; 266 301 if (v > 0x80) … … 268 303 debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelFader setValue for row %d col %d to %lf (%ld)\n", 269 304 row, col, val, v); 270 305 reg = getCellRegister(row,col); 306 307 // Silently swallow attempts to set non-existent controls for now 308 if (reg == MOTU_CTRL_NONE) { 309 debugOutput(DEBUG_LEVEL_VERBOSE, "ignoring control marked as non-existent\n"); 310 return true; 311 } 271 312 // Bit 30 indicates that the channel fader is being set 272 313 v |= 0x40000000; 273 m_parent.WriteRegister( getCellRegister(row,col), v);314 m_parent.WriteRegister(reg, v); 274 315 275 316 return true; … … 278 319 double ChannelFaderMatrixMixer::getValue(const int row, const int col) 279 320 { 280 uint32_t val; 321 uint32_t val, reg; 322 reg = getCellRegister(row,col); 323 324 // Silently swallow attempts to read non-existent controls for now 325 if (reg == MOTU_CTRL_NONE) { 326 debugOutput(DEBUG_LEVEL_VERBOSE, "ignoring control marked as non-existent\n"); 327 return 0; 328 } 281 329 // FIXME: we could just read the appropriate mixer status field from the 282 330 // receive stream processor once we work out an efficient way to do this. 283 val = m_parent.ReadRegister( getCellRegister(row,col)) & 0xff;331 val = m_parent.ReadRegister(reg) & 0xff; 284 332 285 333 debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelFader getValue for row %d col %d = %lu\n", … … 300 348 double ChannelPanMatrixMixer::setValue(const int row, const int col, const double val) 301 349 { 302 uint32_t v ;350 uint32_t v, reg; 303 351 v = ((val<-64?-64:(int32_t)val)+64) & 0xff; 304 352 if (v > 0x80) … … 307 355 debugOutput(DEBUG_LEVEL_VERBOSE, "ChannelPan setValue for row %d col %d to %lf (%ld)\n", 308 356 row, col, val, v); 357 reg = getCellRegister(row,col); 358 359 // Silently swallow attempts to set non-existent controls for now 360 if (reg == MOTU_CTRL_NONE) { 361 debugOutput(DEBUG_LEVEL_VERBOSE, "ignoring control marked as non-existent\n"); 362 return true; 363 } 309 364 310 365 // Bit 31 indicates that pan is being set 311 366 v = (v << 8) | 0x80000000; 312 m_parent.WriteRegister( getCellRegister(row,col), v);367 m_parent.WriteRegister(reg, v); 313 368 314 369 return true; … … 318 373 { 319 374 int32_t val; 375 uint32_t reg; 376 reg = getCellRegister(row,col); 377 378 // Silently swallow attempts to read non-existent controls for now 379 if (reg == MOTU_CTRL_NONE) { 380 debugOutput(DEBUG_LEVEL_VERBOSE, "ignoring control marked as non-existent\n"); 381 return 0; 382 } 383 320 384 // FIXME: we could just read the appropriate mixer status field from the 321 385 // receive stream processor once we work out an efficient way to do this. 322 val = m_parent.ReadRegister( getCellRegister(row,col));386 val = m_parent.ReadRegister(reg); 323 387 val = ((val >> 8) & 0xff) - 0x40; 324 388 … … 348 412 double ChannelBinSwMatrixMixer::setValue(const int row, const int col, const double val) 349 413 { 350 uint32_t v ;414 uint32_t v, reg; 351 415 352 416 debugOutput(DEBUG_LEVEL_VERBOSE, "BinSw setValue for row %d col %d to %lf (%ld)\n", 353 417 row, col, val, val==0?0:1); 418 reg = getCellRegister(row,col); 419 420 // Silently swallow attempts to set non-existent controls for now 421 if (reg == MOTU_CTRL_NONE) { 422 debugOutput(DEBUG_LEVEL_VERBOSE, "ignoring control marked as non-existent\n"); 423 return true; 424 } 354 425 355 426 // Set the value … … 362 433 // processor (if running) later on. For now we'll just fetch the 363 434 // current register value directly when needed. 364 v = m_parent.ReadRegister( getCellRegister(row,col));435 v = m_parent.ReadRegister(reg); 365 436 if (v==0) 366 437 v &= ~m_value_mask; … … 368 439 v |= m_value_mask; 369 440 } 370 m_parent.WriteRegister( getCellRegister(row,col), v);441 m_parent.WriteRegister(reg, v); 371 442 372 443 return true; … … 375 446 double ChannelBinSwMatrixMixer::getValue(const int row, const int col) 376 447 { 377 uint32_t val; 448 uint32_t val, reg; 449 reg = getCellRegister(row,col); 450 451 // Silently swallow attempts to read non-existent controls for now 452 if (reg == MOTU_CTRL_NONE) { 453 debugOutput(DEBUG_LEVEL_VERBOSE, "ignoring control marked as non-existent\n"); 454 return 0; 455 } 378 456 379 457 // FIXME: we could just read the appropriate mixer status field from the 380 458 // receive stream processor once we work out an efficient way to do this. 381 val = m_parent.ReadRegister( getCellRegister(row,col));459 val = m_parent.ReadRegister(reg); 382 460 val = (val & m_value_mask) != 0; 383 461 … … 405 483 debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for mix fader 0x%04x to %d\n", m_register, v); 406 484 485 // Silently swallow attempts to set non-existent controls for now 486 if (m_register == MOTU_CTRL_NONE) { 487 debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 488 return true; 489 } 407 490 val = v<0?0:v; 408 491 if (val > 0x80) … … 421 504 debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for mix fader 0x%04x\n", m_register); 422 505 506 // Silently swallow attempts to read non-existent controls for now 507 if (m_register == MOTU_CTRL_NONE) { 508 debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 509 return 0; 510 } 511 423 512 // FIXME: we could just read the appropriate mixer status field from the 424 513 // receive stream processor once we work out an efficient way to do this. … … 443 532 unsigned int val, dest; 444 533 debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for mix mute 0x%04x to %d\n", m_register, v); 534 535 // Silently swallow attempts to set non-existent controls for now 536 if (m_register == MOTU_CTRL_NONE) { 537 debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 538 return true; 539 } 445 540 446 541 // Need to read current destination so we can preserve that when setting … … 463 558 debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for mix mute 0x%04x\n", m_register); 464 559 560 // Silently swallow attempts to read non-existent controls for now 561 if (m_register == MOTU_CTRL_NONE) { 562 debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 563 return 0; 564 } 565 465 566 // FIXME: we could just read the appropriate mixer status field from the 466 567 // receive stream processor once we work out an efficient way to do this. … … 486 587 debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for mix destination 0x%04x to %d\n", m_register, v); 487 588 589 // Silently swallow attempts to set non-existent controls for now 590 if (m_register == MOTU_CTRL_NONE) { 591 debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 592 return true; 593 } 488 594 // Need to get current mute status so we can preserve it 489 595 mute = m_parent.ReadRegister(m_register) & 0x00001000; … … 511 617 debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for mix destination 0x%04x\n", m_register); 512 618 619 // Silently swallow attempts to read non-existent controls for now 620 if (m_register == MOTU_CTRL_NONE) { 621 debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 622 return true; 623 } 513 624 // FIXME: we could just read the appropriate mixer status field from the 514 625 // receive stream processor once we work out an efficient way to do this. … … 583 694 // Set mode as requested. An invalid setting is effectively ignored. 584 695 if (v>=0 && v<=3) { 585 if (m_register == MOTU_ DIR_IN) {696 if (m_register == MOTU_CTRL_DIR_IN) { 586 697 val = (val & ~0x0300) | ((v & 0x03) << 8); 587 698 } else { … … 605 716 // receive stream processor once we work out an efficient way to do this. 606 717 val = m_parent.ReadRegister(MOTU_REG_ROUTE_PORT_CONF); 607 if (m_register == MOTU_ DIR_IN)718 if (m_register == MOTU_CTRL_DIR_IN) 608 719 val = (val >> 8) & 0x03; 609 720 else … … 655 766 unsigned int reg, reg_shift; 656 767 debugOutput(DEBUG_LEVEL_VERBOSE, "setValue for mode %d input pad/trim %d to %d\n", m_mode, m_register, v); 768 769 if (m_register == MOTU_CTRL_NONE) { 770 debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 771 return true; 772 } 657 773 658 774 reg = dev_register(); … … 703 819 debugOutput(DEBUG_LEVEL_VERBOSE, "getValue for mode %d input pad/trim %d\n", m_mode, m_register); 704 820 821 if (m_register == MOTU_CTRL_NONE) { 822 debugOutput(DEBUG_LEVEL_WARNING, "use of MOTU_CTRL_NONE in non-matrix control\n"); 823 return 0; 824 } 825 705 826 reg = dev_register(); 706 827 if (reg == 0) … … 743 864 744 865 void MeterControl::validate(void) { 745 if ( m_register & (1<< m_shift) == 0) {866 if ((m_register & (1<< m_shift)) == 0) { 746 867 debugOutput(DEBUG_LEVEL_VERBOSE, "Inconsistent mask/shift: 0x%08x/%d\n", m_register, m_shift); 747 868 } trunk/libffado/src/motu/motu_controls.h
r1361 r1498 81 81 #define MOTU_CTRL_METER_PROG_SRC 0x00000008 82 82 83 #define MOTU_CTRL_DIR_IN 0x00000001 84 #define MOTU_CTRL_DIR_OUT 0x00000002 85 #define MOTU_CTRL_DIR_INOUT (MOTU_CTRL_DIR_IN | MOTU_CTRL_DIR_OUT) 86 83 87 #define MOTU_INFO_MODEL 0x00000001 84 88 #define MOTU_INFO_IS_STREAMING 0x00000002 … … 91 95 #define MOTU_CTRL_TRIMGAINPAD_MAX_CHANNEL 3 92 96 97 /* A "register" value used to signify that a particular control in a matrix 98 * mixer is not available on the current interface. 99 */ 100 #define MOTU_CTRL_NONE 0xffffffff 101 93 102 class MotuDiscreteCtrl 94 103 : public Control::Discrete trunk/libffado/src/SConscript
r1336 r1498 224 224 libenv.MergeFlags( "-lrt" ) 225 225 libenv.MergeFlags( env['LIBRAW1394_FLAGS'] ) 226 libenv.MergeFlags( env['LIBAVC1394_FLAGS'] )227 226 libenv.MergeFlags( env['LIBIEC61883_FLAGS'] ) 228 227 if not env['SERIALIZE_USE_EXPAT']: trunk/libffado/support/dbus/control-interface.xml
r1336 r1498 14 14 <method name="getDescription"> 15 15 <arg type="s" name="description" direction="out"/> 16 </method> 17 <method name="canChangeValue"> 18 <arg type="b" name="can_change" direction="out"/> 16 19 </method> 17 20 <method name="getVerboseLevel"> trunk/libffado/support/dbus/controlserver.cpp
r1336 r1498 64 64 } 65 65 66 DBus::Bool 67 Element::canChangeValue() 68 { 69 return m_Slave.canChangeValue(); 70 } 71 66 72 void 67 73 Element::Lock() … … 81 87 } else { 82 88 m_UpdateLock->Unlock(); 89 } 90 } 91 92 bool 93 Element::isLocked() 94 { 95 if(m_Parent) { 96 return m_Parent->isLocked(); 97 } else { 98 return m_UpdateLock->isLocked(); 83 99 } 84 100 } … … 341 357 debugOutput( DEBUG_LEVEL_VERBOSE, "Creating handler for '%s'\n", 342 358 e.getName().c_str() ); 343 344 if (dynamic_cast<Control::Container *>(&e) != NULL) { 345 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Container\n"); 359 try { 360 if (dynamic_cast<Control::Container *>(&e) != NULL) { 361 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Container\n"); 362 363 return new Container(conn(), std::string(path()+"/"+e.getName()), 364 parent, *dynamic_cast<Control::Container *>(&e)); 365 } 346 366 347 return new Container(conn(), std::string(path()+"/"+e.getName()),348 parent, *dynamic_cast<Control::Container *>(&e));349 }350 351 if (dynamic_cast<Control::Continuous *>(&e) != NULL) {352 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Continuous\n");367 if (dynamic_cast<Control::Continuous *>(&e) != NULL) { 368 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Continuous\n"); 369 370 return new Continuous(conn(), std::string(path()+"/"+e.getName()), 371 parent, *dynamic_cast<Control::Continuous *>(&e)); 372 } 353 373 354 return new Continuous(conn(), std::string(path()+"/"+e.getName()),355 parent, *dynamic_cast<Control::Continuous *>(&e));356 }357 358 if (dynamic_cast<Control::Discrete *>(&e) != NULL) {359 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Discrete\n");374 if (dynamic_cast<Control::Discrete *>(&e) != NULL) { 375 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Discrete\n"); 376 377 return new Discrete(conn(), std::string(path()+"/"+e.getName()), 378 parent, *dynamic_cast<Control::Discrete *>(&e)); 379 } 360 380 361 return new Discrete(conn(), std::string(path()+"/"+e.getName()), 362 parent, *dynamic_cast<Control::Discrete *>(&e)); 363 } 364 365 if (dynamic_cast<Control::Text *>(&e) != NULL) { 366 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Text\n"); 381 if (dynamic_cast<Control::Text *>(&e) != NULL) { 382 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Text\n"); 383 384 return new Text(conn(), std::string(path()+"/"+e.getName()), 385 parent, *dynamic_cast<Control::Text *>(&e)); 386 } 387 388 if (dynamic_cast<Control::Register *>(&e) != NULL) { 389 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Register\n"); 390 391 return new Register(conn(), std::string(path()+"/"+e.getName()), 392 parent, *dynamic_cast<Control::Register *>(&e)); 393 } 394 395 // note that we have to check this before checking the Enum, 396 // since Enum is a base class 397 if (dynamic_cast<Control::AttributeEnum *>(&e) != NULL) { 398 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::AttributeEnum\n"); 399 400 return new AttributeEnum(conn(), std::string(path()+"/"+e.getName()), 401 parent, *dynamic_cast<Control::AttributeEnum *>(&e)); 402 } 367 403 368 return new Text(conn(), std::string(path()+"/"+e.getName()),369 parent, *dynamic_cast<Control::Text *>(&e));370 }371 372 if (dynamic_cast<Control::Register *>(&e) != NULL) {373 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Register\n");404 if (dynamic_cast<Control::Enum *>(&e) != NULL) { 405 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Enum\n"); 406 407 return new Enum(conn(), std::string(path()+"/"+e.getName()), 408 parent, *dynamic_cast<Control::Enum *>(&e)); 409 } 374 410 375 return new Register(conn(), std::string(path()+"/"+e.getName()), 376 parent, *dynamic_cast<Control::Register *>(&e)); 377 } 378 379 // note that we have to check this before checking the Enum, 380 // since Enum is a base class 381 if (dynamic_cast<Control::AttributeEnum *>(&e) != NULL) { 382 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::AttributeEnum\n"); 411 if (dynamic_cast<ConfigRom *>(&e) != NULL) { 412 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a ConfigRom\n"); 413 414 return new ConfigRomX(conn(), std::string(path()+"/"+e.getName()), 415 parent, *dynamic_cast<ConfigRom *>(&e)); 416 } 383 417 384 return new AttributeEnum(conn(), std::string(path()+"/"+e.getName()),385 parent, *dynamic_cast<Control::AttributeEnum *>(&e));386 }387 388 if (dynamic_cast<Control::Enum *>(&e) != NULL) {389 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Enum\n");418 if (dynamic_cast<Control::MatrixMixer *>(&e) != NULL) { 419 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::MatrixMixer\n"); 420 421 return new MatrixMixer(conn(), std::string(path()+"/"+e.getName()), 422 parent, *dynamic_cast<Control::MatrixMixer *>(&e)); 423 } 390 424 391 return new Enum(conn(), std::string(path()+"/"+e.getName()), 392 parent, *dynamic_cast<Control::Enum *>(&e)); 393 } 394 395 if (dynamic_cast<ConfigRom *>(&e) != NULL) { 396 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a ConfigRom\n"); 397 398 return new ConfigRomX(conn(), std::string(path()+"/"+e.getName()), 399 parent, *dynamic_cast<ConfigRom *>(&e)); 400 } 401 402 if (dynamic_cast<Control::MatrixMixer *>(&e) != NULL) { 403 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::MatrixMixer\n"); 404 405 return new MatrixMixer(conn(), std::string(path()+"/"+e.getName()), 406 parent, *dynamic_cast<Control::MatrixMixer *>(&e)); 407 } 408 409 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Element\n"); 410 return new Element(conn(), std::string(path()+"/"+e.getName()), parent, e); 425 debugOutput( DEBUG_LEVEL_VERBOSE, "Source is a Control::Element\n"); 426 return new Element(conn(), std::string(path()+"/"+e.getName()), parent, e); 427 } catch (...) { 428 debugWarning("Could not register %s\n", std::string(path()+"/"+e.getName()).c_str()); 429 if(e.isControlLocked()) { 430 e.unlockControl(); 431 } 432 if(isLocked()) { 433 Unlock(); 434 } 435 return NULL; 436 }; 411 437 } 412 438 trunk/libffado/support/dbus/controlserver.h
r1336 r1498 102 102 , public DBus::ObjectAdaptor 103 103 { 104 friend class Container; // This should not be necessary since Container derives from Element104 friend class Container; // required to have container access other slave elements 105 105 public: 106 106 … … 114 114 DBus::String getDescription( ); 115 115 116 DBus::Bool canChangeValue( ); 117 116 118 void setVerboseLevel( const DBus::Int32 &); 117 119 DBus::Int32 getVerboseLevel(); … … 120 122 void Lock(); 121 123 void Unlock(); 124 bool isLocked(); 122 125 Util::Mutex* getLock(); 123 126 … … 135 138 class Container 136 139 : public org::ffado::Control::Element::Container 137 , public Element140 , public DBusControl::Element 138 141 { 139 142 public: trunk/libffado/support/dbus/ffado-dbus-server.cpp
r1336 r1498 229 229 { 230 230 struct arguments arguments; 231 232 printf("-----------------------------------------------\n"); 233 printf("FFADO Control DBUS service\n"); 234 printf("Part of the FFADO project -- www.ffado.org\n"); 235 printf("Version: %s\n", PACKAGE_VERSION); 236 printf("(C) 2008, Pieter Palmers\n"); 237 printf("This program comes with ABSOLUTELY NO WARRANTY.\n"); 238 printf("-----------------------------------------------\n\n"); 239 240 // check the library version 241 const char *libversion = ffado_get_version(); 242 const char *progversion = PACKAGE_STRING; 243 if(strcmp(libversion, progversion) != 0) { 244 printf("Library version mismatch. (required: %s, present: %s)\n", progversion, libversion); 245 printf("Please run this application against the exact corresponding library\n"); 246 printf("it was compiled for. The most common cause for this is having more\n"); 247 printf("than one version of libffado installed.\n\n"); 248 return exitfunction(-1); 249 } 231 250 232 251 // Default values. … … 249 268 } 250 269 251 debugOutput( DEBUG_LEVEL_NORMAL, "verbose level = %d\n", arguments.verbose); 252 debugOutput( DEBUG_LEVEL_NORMAL, "Using ffado library version: %s\n\n", ffado_get_version() ); 253 270 printMessage(" Discovering devices...\n"); 254 271 m_deviceManager = new DeviceManager(); 255 272 if ( !m_deviceManager ) { trunk/libffado/support/firmware/bridgeco-downloader.cpp
r1336 r1498 29 29 #include "libieee1394/configrom.h" 30 30 #include "libieee1394/ieee1394service.h" 31 #include "version.h" 31 32 32 33 #include <iostream> 33 34 #include <cstdlib> 34 35 #include <cstring> 36 37 #define MAGIC_THAT_SAYS_I_KNOW_WHAT_IM_DOING 0x001807198000LL 35 38 36 39 using namespace std; … … 52 55 {"force", 'f', 0, 0, "Force firmware download" }, 53 56 {"noboot", 'b', 0, 0, "Do no start bootloader (bootloader is already running)" }, 57 {"magic", 'm', "MAGIC", 0, "A magic number you have to obtain before this code will work." 58 "Specifying it means that you accept the risks that come with this tool."}, 54 59 { 0 } 55 60 }; … … 59 64 main( int argc, char** argv ) 60 65 { 66 printf("-----------------------------------------------\n"); 67 printf("BridgeCo BeBoB platform firmware downloader\n"); 68 printf("Part of the FFADO project -- www.ffado.org\n"); 69 printf("Version: %s\n", PACKAGE_VERSION); 70 printf("(C) 2008, Daniel Wagner, Pieter Palmers\n"); 71 printf("This program comes with ABSOLUTELY NO WARRANTY.\n"); 72 printf("-----------------------------------------------\n\n"); 61 73 62 74 // arg parsing … … 76 88 perror("argument parsing failed:"); 77 89 return -1; 90 } 91 92 if(args->magic != MAGIC_THAT_SAYS_I_KNOW_WHAT_IM_DOING) { 93 printf("Magic number not correct. Please specify the correct magic using the '-m' option.\n"); 94 printf("Manipulating firmware can cause your device to magically stop working (a.k.a. 'bricking').\n"); 95 printf("Specifying the magic number indicates that you accept the risks involved\n"); 96 printf("with using this tool. The magic number can be found in the source code.\n\n"); 97 return -1; 98 } else { 99 printf("YOU HAVE SPECIFIED THE CORRECT MAGIC NUMBER.\n"); 100 printf("HENCE YOU ACCEPT THE RISKS INVOLVED.\n"); 78 101 } 79 102 trunk/libffado/support/firmware/fireworks-downloader.cpp
r1336 r1498 38 38 39 39 #include "devicemanager.h" 40 #include "version.h" 40 41 41 42 #include <iostream> … … 96 97 using namespace std; 97 98 99 printf("-----------------------------------------------\n"); 100 printf("ECHO FireWorks platform firmware downloader\n"); 101 printf("Part of the FFADO project -- www.ffado.org\n"); 102 printf("Version: %s\n", PACKAGE_VERSION); 103 printf("(C) 2008, Pieter Palmers\n"); 104 printf("This program comes with ABSOLUTELY NO WARRANTY.\n"); 105 printf("-----------------------------------------------\n\n"); 106 98 107 memset(args, 0, sizeof(args)); 99 108 … … 114 123 115 124 if(args->magic != MAGIC_THAT_SAYS_I_KNOW_WHAT_IM_DOING) { 116 print Message("Magic number not correct. Please specify the correct magic using the '-m' option.\n");117 print Message("Manipulating firmware can cause your device to magically stop working (a.k.a. 'bricking').\n");118 print Message("Specifying the magic number indicates that you accept the risks involved\n");119 print Message("with using this tool. The magic number can be found in the source code.\n");125 printf("Magic number not correct. Please specify the correct magic using the '-m' option.\n"); 126 printf("Manipulating firmware can cause your device to magically stop working (a.k.a. 'bricking').\n"); 127 printf("Specifying the magic number indicates that you accept the risks involved\n"); 128 printf("with using this tool. The magic number can be found in the source code.\n\n"); 120 129 return -1; 121 130 } else { 122 print Message("YOU HAVE SPECIFIED THE CORRECT MAGIC NUMBER.\n");123 print Message("HENCE YOU ACCEPT THE RISKS INVOLVED.\n");131 printf("YOU HAVE SPECIFIED THE CORRECT MAGIC NUMBER.\n"); 132 printf("HENCE YOU ACCEPT THE RISKS INVOLVED.\n"); 124 133 } 125 134 trunk/libffado/support/firmware/SConscript
r1185 r1498 31 31 env.MergeFlags( "-lrt" ) 32 32 env.MergeFlags( env['LIBRAW1394_FLAGS'] ) 33 env.MergeFlags( env['LIBAVC1394_FLAGS'] )34 33 env.MergeFlags( env['LIBIEC61883_FLAGS'] ) 35 34 if not env['SERIALIZE_USE_EXPAT']: trunk/libffado/support/mixer/mixer_motu.py
r1336 r1498 635 635 self.mix4_dest.changeItem("AES/EBU", 7) 636 636 self.phones_src.changeItem("AES/EBU", 7) 637 638 # The Ultralite doesn't have ADAT channels (or any optical ports at 639 # all) 640 if (self.model == MOTU_MODEL_ULTRALITE): 641 self.mix1_tab.page(3).setEnabled(False) # ADAT page 642 self.mix2_tab.page(3).setEnabled(False) # ADAT page 643 self.mix3_tab.page(3).setEnabled(False) # ADAT page 644 self.mix4_tab.page(3).setEnabled(False) # ADAT page 645 self.optical_in_mode.setEnabled(False) 646 self.optical_out_mode.setEnabled(False) 637 647 638 648 # Some devices don't have the option of selecting an optical SPDIF trunk/libffado/support/mixer/mixer_saffireprolarge.ui
r1217 r1498 2545 2545 </property> 2546 2546 <property name="text"> 2547 <string>IMix L</string>2547 <string>IMixR</string> 2548 2548 </property> 2549 2549 <property name="alignment"> … … 2977 2977 </property> 2978 2978 <property name="text"> 2979 <string>IMix L</string>2979 <string>IMixR</string> 2980 2980 </property> 2981 2981 <property name="alignment"> … … 3360 3360 </property> 3361 3361 <property name="text"> 3362 <string>IMix L</string>3362 <string>IMixR</string> 3363 3363 </property> 3364 3364 <property name="alignment"> … … 3732 3732 </property> 3733 3733 <property name="text"> 3734 <string>IMix L</string>3734 <string>IMixR</string> 3735 3735 </property> 3736 3736 <property name="alignment"> … … 4153 4153 </property> 4154 4154 <property name="text"> 4155 <string>IMix L</string>4155 <string>IMixR</string> 4156 4156 </property> 4157 4157 <property name="alignment"> trunk/libffado/support/mixer/mixer_saffireprosmall.ui
r1217 r1498 263 263 </property> 264 264 <property name="text"> 265 <string>IMix L</string>265 <string>IMixR</string> 266 266 </property> 267 267 <property name="alignment"> … … 695 695 </property> 696 696 <property name="text"> 697 <string>IMix L</string>697 <string>IMixR</string> 698 698 </property> 699 699 <property name="alignment"> … … 1078 1078 </property> 1079 1079 <property name="text"> 1080 <string>IMix L</string>1080 <string>IMixR</string> 1081 1081 </property> 1082 1082 <property name="alignment"> … … 1450 1450 </property> 1451 1451 <property name="text"> 1452 <string>IMix L</string>1452 <string>IMixR</string> 1453 1453 </property> 1454 1454 <property name="alignment"> … … 1871 1871 </property> 1872 1872 <property name="text"> 1873 <string>IMix L</string>1873 <string>IMixR</string> 1874 1874 </property> 1875 1875 <property name="alignment"> trunk/libffado/support/mixer/SConscript
r1439 r1498 35 35 'saffirelelarge', 'saffirelesmall', 36 36 'audiofire_strip', 'audiofire_settings', 37 'bcoaudio5', 38 'edirolfa66','edirolfa101', 37 'bcoaudio5', 'edirolfa66', 'edirolfa101', 39 38 'mackie_generic', 'quatafire', 'motu', 40 39 'global', 'dummy' … … 45 44 'saffirele', 46 45 'audiofire', 47 'bcoaudio5', 48 'edirolfa66','edirolfa101', 46 'bcoaudio5', 'edirolfa66', 'edirolfa101', 49 47 'mackie_generic', 'quatafire', 'motu', 50 48 'global', 'dummy' trunk/libffado/support/SConscript
r1336 r1498 26 26 env = env.Clone() 27 27 28 env.SConscript( dirs=["mixer","mixer-qt4","firmware","dbus", 28 env.SConscript( dirs=["mixer","mixer-qt4","firmware","dbus","tools","alsa"], exports="env" ) trunk/libffado/tests/SConscript
r1349 r1498 44 44 # 45 45 apps = { 46 " test-ffado" : "test-ffado.cpp",46 "ffado-test" : "test-ffado.cpp", 47 47 "test-fw410" : "test-fw410.cpp", 48 48 "test-avccmd" : "test-avccmd.cpp", … … 71 71 for app in apps.keys(): 72 72 env.Program( target=app, source = env.Split( apps[app] ) ) 73 env.Install( "$bindir", app ) 73 74 74 75 env.SConscript( dirs=["streaming", "systemtests"], exports="env" ) trunk/libffado/tests/streaming/SConscript
r1199 r1498 30 30 env.PrependUnique( LIBS=["ffado"] ) 31 31 32 cppapps = "teststreaming3 teststreaming-ipc test-ipcclient"33 32 34 for app in env.Split( cppapps ): 35 env.Program( target=app, source = [ app+".cpp" ] ) 33 apps = { 34 "ffado-test-streaming" : "teststreaming3.cpp", 35 "ffado-test-streaming-ipc" : "teststreaming-ipc.cpp", 36 "ffado-test-streaming-ipcclient" : "test-ipcclient.cpp", 37 } 36 38 39 for app in apps.keys(): 40 env.Program( target=app, source = env.Split( apps[app] ) ) 41 env.Install( "$bindir", app ) 37 42 trunk/libffado/tests/systemtests/SConscript
r1199 r1498 40 40 # 41 41 apps = { 42 " test-isorecv-1" : ["test-isorecv-1.cpp", "realtimetools.cpp"],43 " test-isoxmit-1" : ["test-isoxmit-1.cpp", "realtimetools.cpp"],42 "ffado-test-isorecv" : ["test-isorecv-1.cpp", "realtimetools.cpp"], 43 "ffado-test-isoxmit" : ["test-isoxmit-1.cpp", "realtimetools.cpp"], 44 44 "test-sysload" : ["test-sysload.cpp", "realtimetools.cpp"], 45 45 "gen-loadpulses" : ["gen-loadpulses.cpp", "realtimetools.cpp"], … … 49 49 for app in apps.keys(): 50 50 env.Program( target=app, source = env.Split( apps[app] ) ) 51 env.Install( "$bindir", app ) 51 52 trunk/libffado/tests/test-ffado.cpp
r1254 r1498 67 67 " BusReset\n" 68 68 " ListDevices\n" 69 " SetSplitTimeout timeout_usec\n" 70 " GetSplitTimeout\n" 69 71 ; 70 72 … … 238 240 struct arguments arguments; 239 241 242 printf("-----------------------------------------------\n"); 243 printf("FFADO test and diagnostic utility\n"); 244 printf("Part of the FFADO project -- www.ffado.org\n"); 245 printf("Version: %s\n", PACKAGE_VERSION); 246 printf("(C) 2008, Daniel Wagner, Pieter Palmers\n"); 247 printf("This program comes with ABSOLUTELY NO WARRANTY.\n"); 248 printf("-----------------------------------------------\n\n"); 249 250 // check the library version 251 const char *libversion = ffado_get_version(); 252 const char *progversion = PACKAGE_STRING; 253 if(strcmp(libversion, progversion) != 0) { 254 printf("Library version mismatch. (required: %s, present: %s)\n", progversion, libversion); 255 printf("Please run this application against the exact corresponding library\n"); 256 printf("it was compiled for. The most common cause for this is having more\n"); 257 printf("than one version of libffado installed.\n\n"); 258 return exitfunction(-1); 259 } 260 240 261 // Default values. 241 262 arguments.nargs = 0; … … 255 276 return exitfunction(-1); 256 277 } 257 258 printf("verbose level = %ld\n", arguments.verbose);259 278 setDebugLevel(arguments.verbose); 260 261 printf( "Using ffado library version: %s\n\n", ffado_get_version() );262 279 263 280 if ( strcmp( arguments.args[0], "Discover" ) == 0 ) { … … 414 431 delete m_deviceManager; 415 432 return exitfunction(0); 433 } else if ( strcmp( arguments.args[0], "SetSplitTimeout" ) == 0 ) { 434 char* tail; 435 int usecs = strtol( arguments.args[1], &tail, 0 ); 436 if ( errno ) { 437 fprintf( stderr, "Could not parse timeout argument\n" ); 438 return exitfunction(-1); 439 } 440 441 Ieee1394Service service; 442 // switch off all messages since they mess up the list 443 service.setVerboseLevel(arguments.verbose); 444 if ( !service.initialize( arguments.port ) ) { 445 printf("Could not initialize IEEE 1394 service on port %ld\n", arguments.port); 446 return exitfunction(-1); 447 } 448 449 nodeid_t nodeid; 450 if(arguments.node_id_set) { 451 nodeid = arguments.node_id; 452 } else { 453 nodeid = service.getLocalNodeId(); 454 } 455 456 if (!service.setSplitTimeoutUsecs(nodeid, usecs)) { 457 printf("Failed to set SPLIT_TIMEOUT to %u for node %X on port %ld\n", 458 usecs, nodeid, arguments.port); 459 return exitfunction(-1); 460 } 461 462 return exitfunction(0); 463 } else if ( strcmp( arguments.args[0], "GetSplitTimeout" ) == 0 ) { 464 Ieee1394Service service; 465 // switch off all messages since they mess up the list 466 service.setVerboseLevel(arguments.verbose); 467 if ( !service.initialize( arguments.port ) ) { 468 printf("Could not initialize IEEE 1394 service on port %ld\n", arguments.port); 469 return exitfunction(-1); 470 } 471 472 nodeid_t nodeid; 473 if(arguments.node_id_set) { 474 nodeid = arguments.node_id; 475 } else { 476 nodeid = service.getLocalNodeId(); 477 } 478 int usecs = service.getSplitTimeoutUsecs(nodeid); 479 if (usecs < 0) { 480 printf("Failed to get SPLIT_TIMEOUT for node %X on port %ld\n", 481 nodeid, arguments.port); 482 return exitfunction(-1); 483 } 484 printf("SPLIT_TIMEOUT for node %X on port %ld is %u\n", 485 nodeid, arguments.port, usecs); 486 487 return exitfunction(0); 416 488 } else if ( strcmp( arguments.args[0], "SytCalcTest" ) == 0 ) { 417 489 if (arguments.nargs < 4) { trunk/libffado/tests/test-ieee1394service.cpp
r1135 r1498 83 83 printf("hello from the functor (%p)\n", this); 84 84 }; 85 virtual bool matchCallee(void *) {return false;}; 85 86 }; 86 87