- Timestamp:
- 11/28/07 12:02:08 (16 years ago)
- Files:
-
- trunk/libffado/config.h.in (modified) (1 diff)
- trunk/libffado/libffado/ffado.h (modified) (9 diffs)
- trunk/libffado/SConstruct (modified) (1 diff)
- trunk/libffado/src/bebob/bebob_avdevice.cpp (modified) (9 diffs)
- trunk/libffado/src/bebob/bebob_avdevice.h (modified) (2 diffs)
- trunk/libffado/src/bebob/focusrite/focusrite_generic.cpp (modified) (3 diffs)
- trunk/libffado/src/bebob/focusrite/focusrite_generic.h (modified) (1 diff)
- trunk/libffado/src/bebob/focusrite/focusrite_saffire.cpp (modified) (2 diffs)
- trunk/libffado/src/bebob/focusrite/focusrite_saffire.h (modified) (1 diff)
- trunk/libffado/src/bebob/focusrite/focusrite_saffirepro.cpp (modified) (1 diff)
- trunk/libffado/src/bebob/focusrite/focusrite_saffirepro.h (modified) (1 diff)
- trunk/libffado/src/bebob/terratec/terratec_device.cpp (modified) (1 diff)
- trunk/libffado/src/bebob/terratec/terratec_device.h (modified) (1 diff)
- trunk/libffado/src/devicemanager.cpp (modified) (20 diffs)
- trunk/libffado/src/devicemanager.h (modified) (5 diffs)
- trunk/libffado/src/dice/dice_avdevice.cpp (modified) (16 diffs)
- trunk/libffado/src/dice/dice_avdevice.h (modified) (1 diff)
- trunk/libffado/src/ffado.cpp (modified) (4 diffs)
- trunk/libffado/src/ffadodevice.cpp (modified) (4 diffs)
- trunk/libffado/src/ffadodevice.h (modified) (4 diffs)
- trunk/libffado/src/ffado_streaming.cpp (deleted)
- trunk/libffado/src/fireworks/audiofire/audiofire_device.cpp (modified) (1 diff)
- trunk/libffado/src/fireworks/audiofire/audiofire_device.h (modified) (1 diff)
- trunk/libffado/src/fireworks/efc/efc_cmd.cpp (modified) (1 diff)
- trunk/libffado/src/fireworks/efc/efc_cmd.h (modified) (1 diff)
- trunk/libffado/src/fireworks/fireworks_device.cpp (modified) (7 diffs)
- trunk/libffado/src/fireworks/fireworks_device.h (modified) (1 diff)
- trunk/libffado/src/genericavc/avc_avdevice.cpp (modified) (9 diffs)
- trunk/libffado/src/genericavc/avc_avdevice.h (modified) (1 diff)
- trunk/libffado/src/libieee1394/configrom.cpp (modified) (7 diffs)
- trunk/libffado/src/libieee1394/configrom.h (modified) (4 diffs)
- trunk/libffado/src/libieee1394/ieee1394service.cpp (modified) (4 diffs)
- trunk/libffado/src/libieee1394/ieee1394service.h (modified) (4 diffs)
- trunk/libffado/src/libstreaming/util/IsoHandlerManager.cpp (modified) (2 diffs)
- trunk/libffado/src/libutil/Thread.h (modified) (1 diff)
- trunk/libffado/src/maudio/maudio_avdevice.cpp (modified) (3 diffs)
- trunk/libffado/src/maudio/maudio_avdevice.h (modified) (1 diff)
- trunk/libffado/src/motu/motu_avdevice.cpp (modified) (10 diffs)
- trunk/libffado/src/motu/motu_avdevice.h (modified) (1 diff)
- trunk/libffado/src/SConscript (modified) (1 diff)
- trunk/libffado/support/dbus/ffado-dbus-server.cpp (modified) (1 diff)
- trunk/libffado/support/firmware/fireworks-downloader.cpp (modified) (1 diff)
- trunk/libffado/tests/streaming/testmidistreaming1.c (modified) (2 diffs)
- trunk/libffado/tests/streaming/teststreaming.c (modified) (2 diffs)
- trunk/libffado/tests/streaming/teststreaming2.c (modified) (2 diffs)
- trunk/libffado/tests/streaming/teststreaming3.c (modified) (2 diffs)
- trunk/libffado/tests/test-ffado.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/config.h.in
r734 r739 21 21 #define PACKAGE_VERSION "$VERSION-$REVISION" 22 22 23 /* Define to the api version */ 24 #define FFADO_API_VERSION $FFADO_API_VERSION 25 23 26 /* Define to 1 if SSE assembly is available. */ 24 27 /*#define USE_SSE 1*/ trunk/libffado/libffado/ffado.h
r734 r739 29 29 #define FFADO_MAX_NAME_LEN 256 30 30 31 #define FFADO_BOUNCE_SERVER_VENDORNAME "FFADO Server" 32 #define FFADO_BOUNCE_SERVER_MODELNAME "ffado-server" 33 34 #define FFADO_BOUNCE_SERVER_GETXMLDESCRIPTION_CMD 35 #define AVC1394_SUBUNIT_TYPE_FFADO_BOUNCE_SERVER 0x0D 36 37 #define FFADO_API_VERSION 2 31 #include <stdlib.h> 32 33 #define FFADO_STREAMING_MAX_URL_LENGTH 2048 34 35 #define FFADO_IGNORE_CAPTURE (1<<0) 36 #define FFADO_IGNORE_PLAYBACK (1<<1) 38 37 39 38 enum ffado_direction { … … 48 47 #endif 49 48 50 ffado_handle_t51 ffado_new_handle( int port );52 53 int54 ffado_destroy_handle( ffado_handle_t ffado_handle );55 56 int57 ffado_discover_devices( ffado_handle_t ffado_handle, int verbose_level );58 59 int ffado_node_is_valid_ffado_device(ffado_handle_t fb_handle, int node_id);60 int ffado_get_nb_devices_on_bus(ffado_handle_t fb_handle);61 62 int ffado_get_device_node_id(ffado_handle_t fb_handle, int device_nr);63 int ffado_set_samplerate(ffado_handle_t ffado_handle, int node_id, int samplerate);64 65 49 /* ABI stuff */ 66 50 const char* … … 75 59 will disapear as soon bug is fixed */ 76 60 void ffado_sleep_after_avc_command( int time ); 77 78 #ifdef __cplusplus79 }80 #endif81 82 #endif /* FFADO_H */83 84 /* ffado_streaming.h85 *86 * Specification for the FFADO Streaming API87 *88 */89 #ifndef __FFADO_STREAMING_H__90 #define __FFADO_STREAMING_H__91 92 #include <stdlib.h>93 94 #ifdef __cplusplus95 extern "C" {96 #endif97 98 #define FFADO_STREAMING_MAX_URL_LENGTH 204899 100 #define FFADO_IGNORE_CAPTURE (1<<0)101 #define FFADO_IGNORE_PLAYBACK (1<<1)102 61 103 62 … … 137 96 */ 138 97 139 typedef unsigned int ffado_sample_t; 140 141 98 typedef unsigned int ffado_sample_t; // FIXME 142 99 typedef unsigned int ffado_nframes_t; 143 100 144 101 #define FFADO_MAX_SPECSTRING_LENGTH 256 102 #define FFADO_MAX_SPECSTRINGS 64 103 /** 104 * This struct serves to define the devices that should be used by the library 105 * device_spec_strings is an array of pointers that should contain nb_device_spec_strings 106 * valid pointers to strings. 107 * 108 * The spec strings should be null terminated and can be no longer 109 * than FFADO_MAX_SPECSTRINGS. 110 * 111 * nb_device_spec_strings < FFADO_MAX_SPECSTRING_LENGTH 112 * nb_device_spec_strings >= 0 113 * 114 * If nb_device_spec_strings == 0, all busses are scanned for attached devices, and 115 * all found devices that are supported are combined into one large pseudo-device. The 116 * device order is defined by the GUID of the device. Devices with lower GUID's will 117 * be the first ones. 118 * 119 * If multiple device specifications are present, the device order is defined as follows: 120 * - device(s) that correspond to a spec string with a lower index will be added before 121 * devices from higher indexes. 122 * - if a spec string results in multiple devices, they are sorted by GUID unless the 123 * spec format dictates otherwise. 124 * 125 * The actual meaning of the device specification should be one of the following: 126 * - Format 1: "hw:x[,y[,z]]" 127 * x = the firewire bus to use ('port' in raw1394 terminology) 128 * (mandatory) 129 * y = the node id the device currently has (bus resets might change that, but FFADO 130 * will track these changes and keep using the device specified on startup) 131 * (optional) 132 * z = the stream direction to use. 133 * 0 => capture (record) channels only 134 * 1 => playback channels only 135 * other/unspecified => both playback and capture 136 * (optional) 137 * 138 * - Format 2: the device alias as defined in the ffado config file (UNIMPLEMENTED) 139 */ 145 140 typedef struct ffado_device_info { 146 /* TODO: How is the device specification done? */ 147 // ffado_device_info_location_type location_type; 141 unsigned int nb_device_spec_strings; 142 char **device_spec_strings; 143 144 /* add some extra space to allow for future API extention 145 w/o breaking binary compatibility */ 146 int32_t reserved[32]; 148 147 } ffado_device_info_t; 149 148 … … 153 152 typedef struct ffado_options { 154 153 /* driver related setup */ 155 int sample_rate; /* this is acutally dictated by the device154 int32_t sample_rate; /* 156 155 * you can specify a value here or -1 to autodetect 157 156 */ 158 157 159 158 /* buffer setup */ 160 int period_size; /* one period is the amount of frames that159 int32_t period_size; /* one period is the amount of frames that 161 160 * has to be sent or received in order for 162 161 * a period boundary to be signalled. 163 162 * (unit: frames) 164 163 */ 165 int nb_buffers; /* the size of the frame buffer (in periods) */164 int32_t nb_buffers; /* the size of the frame buffer (in periods) */ 166 165 167 166 /* packetizer thread options */ 168 int realtime; 169 int packetizer_priority; 170 171 /* libffado related setup */ 172 int node_id; 173 int port; 174 175 /* direction map */ 176 int directions; 177 167 int32_t realtime; 168 int32_t packetizer_priority; 169 178 170 /* verbosity */ 179 int verbose;180 171 int32_t verbose; 172 181 173 /* slave mode */ 182 int slave_mode; 183 174 int32_t slave_mode; 184 175 /* snoop mode */ 185 int snoop_mode; 176 int32_t snoop_mode; 177 178 /* add some extra space to allow for future API extention 179 w/o breaking binary compatibility */ 180 int32_t reserved[24]; 186 181 187 182 } ffado_options_t; … … 197 192 * A ffado_midi type stream is a stream of midi bytes. The bytes are 8bit UINT, 198 193 * aligned as the first 8LSB's of the 32bit UINT of the read/write buffer. 194 * 195 * A ffado_control type stream is a stream that provides control information. The 196 * format of this control information is undefined, and the stream should be ignored. 199 197 * 200 198 */ 201 199 typedef enum { 202 ffado_stream_type_invalid = -1,200 ffado_stream_type_invalid = -1, 203 201 ffado_stream_type_unknown = 0, 204 202 ffado_stream_type_audio = 1, … … 213 211 */ 214 212 typedef enum { 215 ffado_buffer_type_per_stream = -1, // use this to use the per-stream read functions 216 ffado_buffer_type_int24 = 0, 217 ffado_buffer_type_float = 1, 218 ffado_buffer_type_midi = 2, 219 // ffado_buffer_type_uint32 = 2, 220 // ffado_buffer_type_double = 3, 221 // ... 213 ffado_buffer_type_per_stream = -1, // use this to use the per-stream read functions 214 ffado_buffer_type_int24 = 0, 215 ffado_buffer_type_float = 1, 216 ffado_buffer_type_midi = 2, 222 217 } ffado_streaming_buffer_type; 223 218 … … 237 232 * 238 233 */ 239 ffado_device_t *ffado_streaming_init (ffado_device_info_t *device_info, 234 ffado_device_t *ffado_streaming_init( 235 ffado_device_info_t device_info, 240 236 ffado_options_t options); 241 237 … … 327 323 * 328 324 */ 329 330 331 325 332 326 /** 333 327 * Sets the decode buffer for the stream. This allows for zero-copy decoding. trunk/libffado/SConstruct
r736 r739 206 206 env['REVISION'] = '' 207 207 208 env['FFADO_API_VERSION']="3" 209 208 210 env['PACKAGE'] = "libffado" 209 211 env['VERSION'] = "1.999.7" trunk/libffado/src/bebob/bebob_avdevice.cpp
r728 r739 55 55 namespace BeBoB { 56 56 57 AvDevice::AvDevice( Ieee1394Service& ieee1394service, 58 std::auto_ptr< ConfigRom >( configRom ) ) 59 : GenericAVC::AvDevice( ieee1394service, configRom ) 57 AvDevice::AvDevice(std::auto_ptr< ConfigRom >( configRom ) ) 58 : GenericAVC::AvDevice( configRom ) 60 59 , m_Mixer ( 0 ) 61 60 { … … 91 90 92 91 FFADODevice * 93 AvDevice::createDevice( Ieee1394Service& ieee1394Service, 94 std::auto_ptr<ConfigRom>( configRom )) 92 AvDevice::createDevice(std::auto_ptr<ConfigRom>( configRom )) 95 93 { 96 94 unsigned int vendorId = configRom->getNodeVendorId(); … … 99 97 switch (vendorId) { 100 98 case FW_VENDORID_TERRATEC: 101 return new Terratec::PhaseSeriesDevice( ieee1394Service,configRom);99 return new Terratec::PhaseSeriesDevice(configRom); 102 100 case FW_VENDORID_FOCUSRITE: 103 101 switch(modelId) { 104 102 case 0x00000003: 105 103 case 0x00000006: 106 return new Focusrite::SaffireProDevice( ieee1394Service,configRom);104 return new Focusrite::SaffireProDevice(configRom); 107 105 case 0x00000000: 108 return new Focusrite::SaffireDevice( ieee1394Service,configRom);106 return new Focusrite::SaffireDevice(configRom); 109 107 default: // return a plain BeBoB device 110 return new AvDevice( ieee1394Service,configRom);108 return new AvDevice(configRom); 111 109 } 112 110 default: 113 return new AvDevice( ieee1394Service,configRom);111 return new AvDevice(configRom); 114 112 } 115 113 return NULL; … … 119 117 AvDevice::discover() 120 118 { 121 unsigned int vendorId = m_pConfigRom->getNodeVendorId();122 unsigned int modelId = m_pConfigRom->getModelId();119 unsigned int vendorId = getConfigRom().getNodeVendorId(); 120 unsigned int modelId = getConfigRom().getModelId(); 123 121 124 122 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_bebob.txt" ); … … 242 240 AvDevice::getConfigurationIdSampleRate() 243 241 { 244 ExtendedStreamFormatCmd extStreamFormatCmd( *m_p1394Service);242 ExtendedStreamFormatCmd extStreamFormatCmd( get1394Service() ); 245 243 UnitPlugAddress unitPlugAddress( UnitPlugAddress::ePT_PCR, 0 ); 246 244 extStreamFormatCmd.setPlugAddress( PlugAddress( PlugAddress::ePD_Input, … … 275 273 AvDevice::getConfigurationIdNumberOfChannel( PlugAddress::EPlugDirection ePlugDirection ) 276 274 { 277 ExtendedPlugInfoCmd extPlugInfoCmd( *m_p1394Service);275 ExtendedPlugInfoCmd extPlugInfoCmd( get1394Service() ); 278 276 UnitPlugAddress unitPlugAddress( UnitPlugAddress::ePT_PCR, 279 277 getNodeId() ); … … 310 308 AvDevice::getConfigurationIdSyncMode() 311 309 { 312 SignalSourceCmd signalSourceCmd( *m_p1394Service);310 SignalSourceCmd signalSourceCmd( get1394Service() ); 313 311 SignalUnitAddress signalUnitAddr; 314 312 signalUnitAddr.m_plugId = 0x01; … … 409 407 AvDevice::loadFromCache() 410 408 { 411 Glib::ustring sDevicePath = getCachePath() + m_pConfigRom->getGuidString();409 Glib::ustring sDevicePath = getCachePath() + getConfigRom().getGuidString(); 412 410 413 411 char* configId; … … 449 447 // the path looks like this: 450 448 // PATH_TO_CACHE + GUID + CONFIGURATION_ID 451 string tmp_path = getCachePath() + m_pConfigRom->getGuidString();449 string tmp_path = getCachePath() + getConfigRom().getGuidString(); 452 450 453 451 // the following piece should do something like trunk/libffado/src/bebob/bebob_avdevice.h
r734 r739 60 60 class AvDevice : public GenericAVC::AvDevice { 61 61 public: 62 AvDevice( Ieee1394Service& ieee1394Service, 63 std::auto_ptr<ConfigRom>( configRom )); 62 AvDevice( std::auto_ptr<ConfigRom>( configRom )); 64 63 virtual ~AvDevice(); 65 64 … … 69 68 virtual bool discover(); 70 69 71 static FFADODevice * createDevice( Ieee1394Service& ieee1394Service, 72 std::auto_ptr<ConfigRom>( configRom )); 70 static FFADODevice * createDevice( std::auto_ptr<ConfigRom>( configRom )); 73 71 74 72 virtual AVC::Subunit* createSubunit(AVC::Unit& unit, trunk/libffado/src/bebob/focusrite/focusrite_generic.cpp
r680 r739 30 30 namespace Focusrite { 31 31 32 FocusriteDevice::FocusriteDevice( Ieee1394Service& ieee1394Service, 33 std::auto_ptr<ConfigRom>( configRom )) 34 : BeBoB::AvDevice( ieee1394Service, configRom) 32 FocusriteDevice::FocusriteDevice( std::auto_ptr<ConfigRom>( configRom )) 33 : BeBoB::AvDevice( configRom) 35 34 { 36 35 debugOutput( DEBUG_LEVEL_VERBOSE, "Created BeBoB::Focusrite::FocusriteDevice (NodeID %d)\n", … … 141 140 fb_nodeid_t nodeId = getNodeId() | 0xFFC0; 142 141 143 if(! m_p1394Service->write_quadlet( nodeId, addr, htonl(data) ) ) {142 if(!get1394Service().write_quadlet( nodeId, addr, htonl(data) ) ) { 144 143 debugError("Could not write to node 0x%04X addr 0x%012X\n", nodeId, addr); 145 144 return false; … … 157 156 fb_nodeid_t nodeId = getNodeId() | 0xFFC0; 158 157 159 if(! m_p1394Service->read_quadlet( nodeId, addr, &result ) ) {158 if(!get1394Service().read_quadlet( nodeId, addr, &result ) ) { 160 159 debugError("Could not read from node 0x%04llX addr 0x%012llX\n", nodeId, addr); 161 160 return false; trunk/libffado/src/bebob/focusrite/focusrite_generic.h
r676 r739 136 136 class FocusriteDevice : public BeBoB::AvDevice { 137 137 public: 138 FocusriteDevice( Ieee1394Service& ieee1394Service, 139 std::auto_ptr<ConfigRom>( configRom )); 138 FocusriteDevice(std::auto_ptr<ConfigRom>( configRom )); 140 139 virtual ~FocusriteDevice() {}; 141 140 trunk/libffado/src/bebob/focusrite/focusrite_saffire.cpp
r664 r739 28 28 namespace Focusrite { 29 29 30 SaffireDevice::SaffireDevice( Ieee1394Service& ieee1394Service, 31 std::auto_ptr<ConfigRom>( configRom )) 32 : FocusriteDevice( ieee1394Service, configRom) 30 SaffireDevice::SaffireDevice( std::auto_ptr<ConfigRom>( configRom )) 31 : FocusriteDevice( configRom) 33 32 { 34 33 debugOutput( DEBUG_LEVEL_VERBOSE, "Created BeBoB::Focusrite::SaffireDevice (NodeID %d)\n", … … 39 38 AVC::AVCCommand::setSleepAfterAVCCommand( 1000 ); 40 39 } 41 42 }43 44 SaffireDevice::~SaffireDevice()45 {46 40 47 41 } trunk/libffado/src/bebob/focusrite/focusrite_saffire.h
r662 r739 142 142 class SaffireDevice : public FocusriteDevice { 143 143 public: 144 SaffireDevice( Ieee1394Service& ieee1394Service, 145 std::auto_ptr<ConfigRom>( configRom )); 146 virtual ~SaffireDevice(); 144 SaffireDevice(std::auto_ptr<ConfigRom>( configRom )); 145 virtual ~SaffireDevice() {}; 147 146 148 147 virtual void showDevice(); trunk/libffado/src/bebob/focusrite/focusrite_saffirepro.cpp
r684 r739 28 28 namespace Focusrite { 29 29 30 SaffireProDevice::SaffireProDevice( Ieee1394Service& ieee1394Service, 31 std::auto_ptr<ConfigRom>( configRom )) 32 : FocusriteDevice( ieee1394Service, configRom) 33 , m_MixerContainer ( NULL ) 34 , m_ControlContainer ( NULL ) 30 SaffireProDevice::SaffireProDevice(std::auto_ptr<ConfigRom>( configRom )) 31 : FocusriteDevice( configRom ) 32 , m_MixerContainer( NULL ) 33 , m_ControlContainer( NULL ) 35 34 { 36 35 debugOutput( DEBUG_LEVEL_VERBOSE, "Created BeBoB::Focusrite::SaffireProDevice (NodeID %d)\n", trunk/libffado/src/bebob/focusrite/focusrite_saffirepro.h
r684 r739 302 302 303 303 public: 304 SaffireProDevice( Ieee1394Service& ieee1394Service, 305 std::auto_ptr<ConfigRom>( configRom )); 304 SaffireProDevice(std::auto_ptr<ConfigRom>( configRom )); 306 305 virtual ~SaffireProDevice(); 307 306 trunk/libffado/src/bebob/terratec/terratec_device.cpp
r584 r739 27 27 namespace Terratec { 28 28 29 PhaseSeriesDevice::PhaseSeriesDevice( Ieee1394Service& ieee1394Service, 30 std::auto_ptr<ConfigRom>( configRom )) 31 : BeBoB::AvDevice( ieee1394Service, configRom) 29 PhaseSeriesDevice::PhaseSeriesDevice(std::auto_ptr<ConfigRom>( configRom )) 30 : BeBoB::AvDevice( configRom) 32 31 { 33 32 debugOutput( DEBUG_LEVEL_VERBOSE, "Created BeBoB::Terratec::PhaseSeriesDevice (NodeID %d)\n", trunk/libffado/src/bebob/terratec/terratec_device.h
r584 r739 34 34 class PhaseSeriesDevice : public BeBoB::AvDevice { 35 35 public: 36 PhaseSeriesDevice( Ieee1394Service& ieee1394Service, 37 std::auto_ptr<ConfigRom>( configRom )); 36 PhaseSeriesDevice( std::auto_ptr<ConfigRom>( configRom )); 38 37 virtual ~PhaseSeriesDevice(); 39 38 trunk/libffado/src/devicemanager.cpp
r734 r739 80 80 DeviceManager::DeviceManager() 81 81 : Control::Container("devicemanager") 82 , m_1394Service( 0 )83 82 { 84 83 addOption(Util::OptionContainer::Option("slaveMode",false)); … … 98 97 } 99 98 100 delete m_1394Service; 99 for ( Ieee1394ServiceVectorIterator it = m_1394Services.begin(); 100 it != m_1394Services.end(); 101 ++it ) 102 { 103 delete *it; 104 } 105 for ( FunctorVectorIterator it = m_busreset_functors.begin(); 106 it != m_busreset_functors.end(); 107 ++it ) 108 { 109 delete *it; 110 } 101 111 } 102 112 … … 106 116 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l ); 107 117 setDebugLevel(l); 108 109 if (m_1394Service) m_1394Service->setVerboseLevel(l);110 118 Control::Element::setVerboseLevel(l); 111 112 119 for ( FFADODeviceVectorIterator it = m_avDevices.begin(); 113 120 it != m_avDevices.end(); 121 ++it ) 122 { 123 (*it)->setVerboseLevel(l); 124 } 125 for ( Ieee1394ServiceVectorIterator it = m_1394Services.begin(); 126 it != m_1394Services.end(); 114 127 ++it ) 115 128 { … … 122 135 debugOutput(DEBUG_LEVEL_NORMAL, "===== Device Manager =====\n"); 123 136 Control::Element::show(); 124 125 if (m_1394Service) debugOutput(DEBUG_LEVEL_NORMAL, "1394 port: %d\n", m_1394Service->getPort());126 137 127 138 int i=0; 139 for ( Ieee1394ServiceVectorIterator it = m_1394Services.begin(); 140 it != m_1394Services.end(); 141 ++it ) 142 { 143 debugOutput(DEBUG_LEVEL_NORMAL, "--- IEEE1394 Service %2d ---\n", i++); 144 (*it)->show(); 145 } 146 147 i=0; 128 148 for ( FFADODeviceVectorIterator it = m_avDevices.begin(); 129 149 it != m_avDevices.end(); … … 145 165 FFADODevice::ClockSourceTypeToString(c.type), c.id, c.valid, c.active, c.description.c_str()); 146 166 } 147 148 167 } 149 168 } 150 169 151 170 bool 152 DeviceManager::initialize( int port ) 153 { 154 m_1394Service = new Ieee1394Service(); 155 if ( !m_1394Service ) { 156 debugFatal( "Could not create Ieee1349Service object\n" ); 171 DeviceManager::initialize() 172 { 173 assert(m_1394Services.size() == 0); 174 assert(m_busreset_functors.size() == 0); 175 176 unsigned int nb_detected_ports = Ieee1394Service::detectNbPorts(); 177 if (nb_detected_ports == 0) { 178 debugFatal("No firewire ports found.\n"); 157 179 return false; 158 180 } 159 160 if ( !m_1394Service->initialize( port ) ) { 161 debugFatal( "Could not initialize Ieee1349Service object\n" ); 162 delete m_1394Service; 163 m_1394Service = 0; 181 debugOutput( DEBUG_LEVEL_VERBOSE, "Found %d firewire adapters (ports)\n", nb_detected_ports); 182 for (unsigned int port = 0; port < nb_detected_ports; port++) { 183 Ieee1394Service* tmp1394Service = new Ieee1394Service(); 184 if ( !tmp1394Service ) { 185 debugFatal( "Could not create Ieee1349Service object for port %d\n", port ); 186 return false; 187 } 188 m_1394Services.push_back(tmp1394Service); 189 190 if ( !tmp1394Service->initialize( port ) ) { 191 debugFatal( "Could not initialize Ieee1349Service object for port %d\n", port ); 192 return false; 193 } 194 // add the bus reset handler 195 Functor* tmp_busreset_functor = new MemberFunctor0< DeviceManager*, 196 void (DeviceManager::*)() > 197 ( this, &DeviceManager::busresetHandler, false ); 198 if ( !tmp_busreset_functor ) { 199 debugFatal( "Could not create busreset handler for port %d\n", port ); 200 return false; 201 } 202 m_busreset_functors.push_back(tmp_busreset_functor); 203 204 tmp1394Service->addBusResetHandler( tmp_busreset_functor ); 205 tmp1394Service->setVerboseLevel( getDebugLevel() ); 206 } 207 return true; 208 } 209 210 bool 211 DeviceManager::addSpecString(char *s) { 212 std::string spec = s; 213 if(isSpecStringValid(spec)) { 214 debugOutput(DEBUG_LEVEL_VERBOSE, "Adding spec string %s\n", spec.c_str()); 215 m_SpecStrings.push_back(spec); 216 return true; 217 } else { 218 debugError("Invalid spec string: %s\n", spec.c_str()); 164 219 return false; 165 220 } 166 167 // add the bus reset handler 168 m_busreset_functor = new MemberFunctor0< DeviceManager*, 169 void (DeviceManager::*)() > 170 ( this, &DeviceManager::busresetHandler, false ); 171 m_1394Service->addBusResetHandler( m_busreset_functor ); 172 173 setVerboseLevel(getDebugLevel()); 221 } 222 223 bool 224 DeviceManager::isSpecStringValid(std::string s) { 174 225 return true; 175 226 } … … 179 230 { 180 231 debugOutput( DEBUG_LEVEL_VERBOSE, "Bus reset...\n" ); 181 232 // FIXME: what port was the bus reset on? 182 233 // propagate the bus reset to all avDevices 183 234 for ( FFADODeviceVectorIterator it = m_avDevices.begin(); … … 215 266 216 267 if (!slaveMode) { 217 for ( fb_nodeid_t nodeId = 0;218 nodeId < m_1394Service->getNodeCount();219 ++nodeId)268 for ( Ieee1394ServiceVectorIterator it = m_1394Services.begin(); 269 it != m_1394Services.end(); 270 ++it ) 220 271 { 221 debugOutput( DEBUG_LEVEL_VERBOSE, "Probing node %d...\n", nodeId ); 222 223 if (nodeId == m_1394Service->getLocalNodeId()) { 224 debugOutput( DEBUG_LEVEL_VERBOSE, "Skipping local node (%d)...\n", nodeId ); 225 continue; 226 } 227 228 std::auto_ptr<ConfigRom> configRom = 229 std::auto_ptr<ConfigRom>( new ConfigRom( *m_1394Service, 230 nodeId ) ); 231 if ( !configRom->initialize() ) { 232 // \todo If a PHY on the bus is in power safe mode then 233 // the config rom is missing. So this might be just 234 // such this case and we can safely skip it. But it might 235 // be there is a real software problem on our side. 236 // This should be handlede more carefuly. 237 debugOutput( DEBUG_LEVEL_NORMAL, 238 "Could not read config rom from device (node id %d). " 239 "Skip device discovering for this node\n", 240 nodeId ); 241 continue; 242 } 243 244 FFADODevice* avDevice = getDriverForDevice( configRom, 245 nodeId ); 246 247 if ( avDevice ) { 248 debugOutput( DEBUG_LEVEL_NORMAL, 249 "driver found for device %d\n", 250 nodeId ); 251 252 avDevice->setVerboseLevel( getDebugLevel() ); 253 bool isFromCache = false; 254 if ( avDevice->loadFromCache() ) { 255 debugOutput( DEBUG_LEVEL_VERBOSE, "could load from cache\n" ); 256 isFromCache = true; 257 } else if ( avDevice->discover() ) { 258 debugOutput( DEBUG_LEVEL_VERBOSE, "discovering successful\n" ); 259 } else { 260 debugError( "could not discover device\n" ); 261 delete avDevice; 272 Ieee1394Service *portService = *it; 273 for ( fb_nodeid_t nodeId = 0; 274 nodeId < portService->getNodeCount(); 275 ++nodeId ) 276 { 277 debugOutput( DEBUG_LEVEL_VERBOSE, "Probing node %d...\n", nodeId ); 278 279 if (nodeId == portService->getLocalNodeId()) { 280 debugOutput( DEBUG_LEVEL_VERBOSE, "Skipping local node (%d)...\n", nodeId ); 262 281 continue; 263 282 } 264 265 if (snoopMode) { 266 debugOutput( DEBUG_LEVEL_VERBOSE, 267 "Enabling snoop mode on node %d...\n", nodeId ); 268 269 if(!avDevice->setOption("snoopMode", snoopMode)) { 270 debugWarning("Could not set snoop mode for device on node %d\n", nodeId); 283 284 std::auto_ptr<ConfigRom> configRom = 285 std::auto_ptr<ConfigRom>( new ConfigRom( *portService, nodeId ) ); 286 if ( !configRom->initialize() ) { 287 // \todo If a PHY on the bus is in power safe mode then 288 // the config rom is missing. So this might be just 289 // such this case and we can safely skip it. But it might 290 // be there is a real software problem on our side. 291 // This should be handlede more carefuly. 292 debugOutput( DEBUG_LEVEL_NORMAL, 293 "Could not read config rom from device (node id %d). " 294 "Skip device discovering for this node\n", 295 nodeId ); 296 continue; 297 } 298 299 bool already_in_vector = false; 300 for ( FFADODeviceVectorIterator it = m_avDevices.begin(); 301 it != m_avDevices.end(); 302 ++it ) 303 { 304 if ((*it)->getConfigRom().getGuid() == configRom->getGuid()) { 305 already_in_vector = true; 306 break; 307 } 308 } 309 if (already_in_vector) { 310 debugWarning("Device with GUID %s already discovered on other port, skipping device...\n", 311 configRom->getGuidString().c_str()); 312 continue; 313 } 314 315 if( getDebugLevel() >= DEBUG_LEVEL_VERBOSE) { 316 configRom->printConfigRom(); 317 } 318 319 FFADODevice* avDevice = getDriverForDevice( configRom, 320 nodeId ); 321 322 if ( avDevice ) { 323 debugOutput( DEBUG_LEVEL_NORMAL, 324 "driver found for device %d\n", 325 nodeId ); 326 327 avDevice->setVerboseLevel( getDebugLevel() ); 328 bool isFromCache = false; 329 if ( avDevice->loadFromCache() ) { 330 debugOutput( DEBUG_LEVEL_VERBOSE, "could load from cache\n" ); 331 isFromCache = true; 332 } else if ( avDevice->discover() ) { 333 debugOutput( DEBUG_LEVEL_VERBOSE, "discovering successful\n" ); 334 } else { 335 debugError( "could not discover device\n" ); 271 336 delete avDevice; 272 337 continue; 273 338 } 339 340 if (snoopMode) { 341 debugOutput( DEBUG_LEVEL_VERBOSE, 342 "Enabling snoop mode on node %d...\n", nodeId ); 343 344 if(!avDevice->setOption("snoopMode", snoopMode)) { 345 debugWarning("Could not set snoop mode for device on node %d\n", nodeId); 346 delete avDevice; 347 continue; 348 } 349 } 350 351 if ( !isFromCache && !avDevice->saveCache() ) { 352 debugOutput( DEBUG_LEVEL_VERBOSE, "No cached version of AVC model created\n" ); 353 } 354 355 m_avDevices.push_back( avDevice ); 356 357 if (!addElement(avDevice)) { 358 debugWarning("failed to add AvDevice to Control::Container\n"); 359 } 360 361 debugOutput( DEBUG_LEVEL_NORMAL, "discovery of node %d on port %d done...\n", nodeId, portService->getPort() ); 274 362 } 275 276 if ( !isFromCache && !avDevice->saveCache() ) {277 debugOutput( DEBUG_LEVEL_VERBOSE, "No cached version of AVC model created\n" );278 }279 280 m_avDevices.push_back( avDevice );281 282 if (!addElement(avDevice)) {283 debugWarning("failed to add AvDevice to Control::Container\n");284 }285 286 debugOutput( DEBUG_LEVEL_NORMAL, "discovery of node %d done...\n", nodeId );287 288 363 } 289 364 } 290 365 291 366 debugOutput( DEBUG_LEVEL_NORMAL, "Discovery finished...\n" ); 292 367 // FIXME: do better sorting 293 368 // sort the m_avDevices vector on their GUID 294 369 // then assign reassign the id's to the devices … … 296 371 // a device id always corresponds to the same device 297 372 sort(m_avDevices.begin(), m_avDevices.end(), FFADODevice::compareGUID); 298 299 373 int i=0; 300 374 for ( FFADODeviceVectorIterator it = m_avDevices.begin(); … … 306 380 } 307 381 } 308 309 382 show(); 310 383 return true; 311 312 384 } else { // slave mode 313 fb_nodeid_t nodeId = m_1394Service->getLocalNodeId(); 385 Ieee1394Service *portService = m_1394Services.at(0); 386 fb_nodeid_t nodeId = portService->getLocalNodeId(); 314 387 debugOutput( DEBUG_LEVEL_VERBOSE, "Starting in slave mode on node %d...\n", nodeId ); 315 388 316 389 std::auto_ptr<ConfigRom> configRom = 317 std::auto_ptr<ConfigRom>( new ConfigRom( * m_1394Service,390 std::auto_ptr<ConfigRom>( new ConfigRom( *portService, 318 391 nodeId ) ); 319 392 if ( !configRom->initialize() ) { … … 350 423 avDevice->showDevice(); 351 424 } 352 353 425 m_avDevices.push_back( avDevice ); 354 355 debugOutput( DEBUG_LEVEL_NORMAL, "discovery of node %d done...\n", nodeId ); 426 debugOutput( DEBUG_LEVEL_NORMAL, "discovery of node %d on port %d done...\n", nodeId, portService->getPort() ); 356 427 } 357 428 358 429 debugOutput( DEBUG_LEVEL_NORMAL, "discovery finished...\n" ); 359 360 430 return true; 361 431 } … … 369 439 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying BeBoB...\n" ); 370 440 if ( BeBoB::AvDevice::probe( *configRom.get() ) ) { 371 return BeBoB::AvDevice::createDevice( *m_1394Service,configRom );441 return BeBoB::AvDevice::createDevice( configRom ); 372 442 } 373 443 #endif … … 376 446 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying Generic AV/C...\n" ); 377 447 if ( GenericAVC::AvDevice::probe( *configRom.get() ) ) { 378 return GenericAVC::AvDevice::createDevice( *m_1394Service,configRom );448 return GenericAVC::AvDevice::createDevice( configRom ); 379 449 } 380 450 #endif … … 383 453 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying ECHO Audio FireWorks...\n" ); 384 454 if ( FireWorks::Device::probe( *configRom.get() ) ) { 385 return FireWorks::Device::createDevice( *m_1394Service,configRom );455 return FireWorks::Device::createDevice( configRom ); 386 456 } 387 457 #endif … … 390 460 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying M-Audio...\n" ); 391 461 if ( MAudio::AvDevice::probe( *configRom.get() ) ) { 392 return MAudio::AvDevice::createDevice( *m_1394Service,configRom );462 return MAudio::AvDevice::createDevice( configRom ); 393 463 } 394 464 #endif … … 397 467 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying Motu...\n" ); 398 468 if ( Motu::MotuDevice::probe( *configRom.get() ) ) { 399 return Motu::MotuDevice::createDevice( *m_1394Service,configRom );469 return Motu::MotuDevice::createDevice( configRom ); 400 470 } 401 471 #endif … … 404 474 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying Dice...\n" ); 405 475 if ( Dice::DiceAvDevice::probe( *configRom.get() ) ) { 406 return Dice::DiceAvDevice::createDevice( *m_1394Service,configRom );476 return Dice::DiceAvDevice::createDevice( configRom ); 407 477 } 408 478 #endif … … 411 481 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying Metric Halo...\n" ); 412 482 if ( MetricHalo::MHAvDevice::probe( *configRom.get() ) ) { 413 return MetricHalo::MHAvDevice::createDevice( *m_1394Service,configRom );483 return MetricHalo::MHAvDevice::createDevice( configRom ); 414 484 } 415 485 #endif … … 418 488 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying RME...\n" ); 419 489 if ( Rme::RmeDevice::probe( *configRom.get() ) ) { 420 return Rme::RmeDevice::createDevice( *m_1394Service,configRom );490 return Rme::RmeDevice::createDevice( configRom ); 421 491 } 422 492 #endif … … 425 495 debugOutput( DEBUG_LEVEL_VERBOSE, "Trying Bounce...\n" ); 426 496 if ( Bounce::BounceDevice::probe( *configRom.get() ) ) { 427 return Bounce::BounceDevice::createDevice( *m_1394Service,configRom );497 return Bounce::BounceDevice::createDevice( configRom ); 428 498 } 429 499 #endif … … 438 508 #ifdef ENABLE_BOUNCE 439 509 if ( Bounce::BounceSlaveDevice::probe( *configRom.get() ) ) { 440 return Bounce::BounceSlaveDevice::createDevice( *m_1394Service,configRom );510 return Bounce::BounceSlaveDevice::createDevice( configRom ); 441 511 } 442 512 #endif trunk/libffado/src/devicemanager.h
r734 r739 37 37 38 38 #include <vector> 39 #include <string> 39 40 40 41 class Ieee1394Service; … … 47 48 typedef std::vector< FFADODevice* >::iterator FFADODeviceVectorIterator; 48 49 50 typedef std::vector< Ieee1394Service* > Ieee1394ServiceVector; 51 typedef std::vector< Ieee1394Service* >::iterator Ieee1394ServiceVectorIterator; 52 53 typedef std::vector< Functor* > FunctorVector; 54 typedef std::vector< Functor* >::iterator FunctorVectorIterator; 55 49 56 class DeviceManager 50 57 : public Util::OptionContainer, … … 55 62 ~DeviceManager(); 56 63 57 bool initialize( int port);64 bool initialize(); 58 65 bool deinitialize(); 59 66 60 bool discover( ); 67 bool addSpecString(char *); 68 bool isSpecStringValid(std::string s); 69 70 bool discover(); 61 71 62 72 bool isValidNode( int node ); … … 80 90 protected: 81 91 FFADODevice* getDriverForDevice( std::auto_ptr<ConfigRom>( configRom ), 82 int id );92 int id ); 83 93 FFADODevice* getSlaveDriver( std::auto_ptr<ConfigRom>( configRom ) ); 84 94 … … 86 96 87 97 protected: 88 Ieee1394Service* m_1394Service; 89 FFADODeviceVector m_avDevices; 90 Functor* m_busreset_functor; 98 // we have one service for each port 99 // found on the system. We don't allow dynamic addition of ports (yet) 100 Ieee1394ServiceVector m_1394Services; 101 FFADODeviceVector m_avDevices; 102 FunctorVector m_busreset_functors; 103 104 std::vector<std::string> m_SpecStrings; 91 105 92 106 // debug stuff trunk/libffado/src/dice/dice_avdevice.cpp
r734 r739 52 52 }; 53 53 54 DiceAvDevice::DiceAvDevice( Ieee1394Service& ieee1394Service, 55 std::auto_ptr<ConfigRom>( configRom )) 56 : FFADODevice( ieee1394Service, configRom ) 54 DiceAvDevice::DiceAvDevice( std::auto_ptr<ConfigRom>( configRom )) 55 : FFADODevice( configRom ) 57 56 , m_model( NULL ) 58 57 , m_global_reg_offset (0xFFFFFFFFLU) … … 108 107 109 108 FFADODevice * 110 DiceAvDevice::createDevice( Ieee1394Service& ieee1394Service, 111 std::auto_ptr<ConfigRom>( configRom )) 109 DiceAvDevice::createDevice( std::auto_ptr<ConfigRom>( configRom )) 112 110 { 113 return new DiceAvDevice( ieee1394Service,configRom );111 return new DiceAvDevice( configRom ); 114 112 } 115 113 … … 117 115 DiceAvDevice::discover() 118 116 { 119 unsigned int vendorId = m_pConfigRom->getNodeVendorId();120 unsigned int modelId = m_pConfigRom->getModelId();117 unsigned int vendorId = getConfigRom().getNodeVendorId(); 118 unsigned int modelId = getConfigRom().getModelId(); 121 119 122 120 for ( unsigned int i = 0; … … 490 488 Streaming::AmdtpReceiveStreamProcessor *p; 491 489 p=new Streaming::AmdtpReceiveStreamProcessor( 492 m_p1394Service->getPort(),490 get1394Service().getPort(), 493 491 nb_channels); 494 492 … … 576 574 Streaming::AmdtpTransmitStreamProcessor *p; 577 575 p=new Streaming::AmdtpTransmitStreamProcessor( 578 m_p1394Service->getPort(),576 get1394Service().getPort(), 579 577 nb_channels); 580 578 … … 690 688 // get a notifier to handle device notifications 691 689 nodeaddr_t notify_address; 692 notify_address = m_p1394Service->findFreeARMBlock(690 notify_address = get1394Service().findFreeARMBlock( 693 691 DICE_NOTIFIER_BASE_ADDRESS, 694 692 DICE_NOTIFIER_BLOCK_LENGTH, … … 707 705 } 708 706 709 if (! m_p1394Service->registerARMHandler(m_notifier)) {707 if (!get1394Service().registerARMHandler(m_notifier)) { 710 708 debugError("Could not register notifier\n"); 711 709 delete m_notifier; … … 726 724 } 727 725 728 fb_nodeaddr_t swap_value = ((0xFFC0) | m_p1394Service->getLocalNodeId());726 fb_nodeaddr_t swap_value = ((0xFFC0) | get1394Service().getLocalNodeId()); 729 727 swap_value = swap_value << 48; 730 728 swap_value |= m_notifier->getStart(); 731 729 732 if (! m_p1394Service->lockCompareSwap64( getNodeId() | 0xFFC0, addr, DICE_OWNER_NO_OWNER,730 if (!get1394Service().lockCompareSwap64( getNodeId() | 0xFFC0, addr, DICE_OWNER_NO_OWNER, 733 731 swap_value, &result )) { 734 732 debugWarning("Could not register ourselves as device owner\n"); … … 765 763 } 766 764 767 fb_nodeaddr_t compare_value = ((0xFFC0) | m_p1394Service->getLocalNodeId());765 fb_nodeaddr_t compare_value = ((0xFFC0) | get1394Service().getLocalNodeId()); 768 766 compare_value <<= 48; 769 767 compare_value |= m_notifier->getStart(); 770 768 771 if (! m_p1394Service->lockCompareSwap64( getNodeId() | 0xFFC0, addr, compare_value,769 if (!get1394Service().lockCompareSwap64( getNodeId() | 0xFFC0, addr, compare_value, 772 770 DICE_OWNER_NO_OWNER, &result )) { 773 771 debugWarning("Could not unregister ourselves as device owner\n"); … … 775 773 } 776 774 777 m_p1394Service->unregisterARMHandler(m_notifier);775 get1394Service().unregisterARMHandler(m_notifier); 778 776 delete m_notifier; 779 777 m_notifier=NULL; … … 984 982 unsigned int bandwidth=8+packet_size; 985 983 986 int ch= m_p1394Service->allocateIsoChannelGeneric(bandwidth);984 int ch=get1394Service().allocateIsoChannelGeneric(bandwidth); 987 985 988 986 debugOutput(DEBUG_LEVEL_VERBOSE, "allocated channel %d, bandwidth %d\n", … … 994 992 bool DiceAvDevice::deallocateIsoChannel(int channel) { 995 993 debugOutput(DEBUG_LEVEL_VERBOSE, "freeing channel %d\n",channel); 996 return m_p1394Service->freeIsoChannel(channel);994 return get1394Service().freeIsoChannel(channel); 997 995 } 998 996 … … 1227 1225 fb_nodeid_t nodeId=getNodeId() | 0xFFC0; 1228 1226 1229 if(! m_p1394Service->read_quadlet( nodeId, addr, result ) ) {1227 if(!get1394Service().read_quadlet( nodeId, addr, result ) ) { 1230 1228 debugError("Could not read from node 0x%04X addr 0x%012X\n", nodeId, addr); 1231 1229 return false; … … 1252 1250 fb_nodeid_t nodeId=getNodeId() | 0xFFC0; 1253 1251 1254 if(! m_p1394Service->write_quadlet( nodeId, addr, htonl(data) ) ) {1252 if(!get1394Service().write_quadlet( nodeId, addr, htonl(data) ) ) { 1255 1253 debugError("Could not write to node 0x%04X addr 0x%012X\n", nodeId, addr); 1256 1254 return false; … … 1272 1270 fb_nodeid_t nodeId=getNodeId() | 0xFFC0; 1273 1271 1274 if(! m_p1394Service->read( nodeId, addr, length/4, data ) ) {1272 if(!get1394Service().read( nodeId, addr, length/4, data ) ) { 1275 1273 debugError("Could not read from node 0x%04X addr 0x%012llX\n", nodeId, addr); 1276 1274 return false; … … 1303 1301 } 1304 1302 1305 if(! m_p1394Service->write( nodeId, addr, length/4, data_out ) ) {1303 if(!get1394Service().write( nodeId, addr, length/4, data_out ) ) { 1306 1304 debugError("Could not write to node 0x%04X addr 0x%012llX\n", nodeId, addr); 1307 1305 return false; trunk/libffado/src/dice/dice_avdevice.h
r734 r739 57 57 class DiceNotifier; 58 58 public: 59 DiceAvDevice( Ieee1394Service& ieee1394Service, 60 std::auto_ptr<ConfigRom>( configRom )); 59 DiceAvDevice( std::auto_ptr<ConfigRom>( configRom )); 61 60 ~DiceAvDevice(); 62 61 63 62 static bool probe( ConfigRom& configRom ); 64 static FFADODevice * createDevice( Ieee1394Service& ieee1394Service, 65 std::auto_ptr<ConfigRom>( configRom )); 63 static FFADODevice * createDevice( std::auto_ptr<ConfigRom>( configRom )); 66 64 virtual bool discover(); 67 65 trunk/libffado/src/ffado.cpp
r554 r739 23 23 */ 24 24 25 /* 26 * Implementation of the FFADO external C API 27 */ 28 25 29 #include "config.h" 26 30 … … 31 35 #include "devicemanager.h" 32 36 #include "ffadodevice.h" 37 #include "libstreaming/StreamProcessorManager.h" 33 38 34 39 #include <stdio.h> 35 40 #include <stdlib.h> 36 41 #include <string.h> 42 #include <assert.h> 43 #include <string> 37 44 38 45 DECLARE_GLOBAL_DEBUG_MODULE; … … 63 70 } 64 71 65 66 72 int 67 73 ffado_get_api_version() { 68 74 return FFADO_API_VERSION; 69 }70 71 ffado_handle_t72 ffado_new_handle( int port )73 {74 ffado_handle_t handle = new struct ffado_handle;75 if (! handle ) {76 debugFatal( "Could not allocate memory for new handle\n" );77 return 0;78 }79 80 handle->m_deviceManager = new DeviceManager();81 if ( !handle->m_deviceManager ) {82 debugFatal( "Could not allocate device manager\n" );83 delete handle;84 return 0;85 }86 if ( !handle->m_deviceManager->initialize( port ) ) {87 debugFatal( "Could not initialize device manager\n" );88 delete handle->m_deviceManager;89 delete handle;90 return 0;91 }92 return handle;93 }94 95 int96 ffado_destroy_handle( ffado_handle_t ffado_handle )97 {98 delete ffado_handle->m_deviceManager;99 delete ffado_handle;100 return 0;101 }102 103 int104 ffado_discover_devices( ffado_handle_t ffado_handle, int verbose )105 {106 if (verbose) {107 ffado_handle->m_deviceManager->setVerboseLevel(DEBUG_LEVEL_VERBOSE);108 }109 return ffado_handle->m_deviceManager->discover()? 0 : -1;110 }111 112 int113 ffado_node_is_valid_ffado_device( ffado_handle_t ffado_handle, int node_id )114 {115 return ffado_handle->m_deviceManager->isValidNode( node_id );116 }117 118 int119 ffado_get_nb_devices_on_bus( ffado_handle_t ffado_handle )120 {121 return ffado_handle->m_deviceManager->getNbDevices();122 }123 124 int125 ffado_get_device_node_id( ffado_handle_t ffado_handle, int device_nr )126 {127 return ffado_handle->m_deviceManager->getDeviceNodeId(device_nr);128 }129 130 int131 ffado_set_samplerate( ffado_handle_t ffado_handle, int node_id, int samplerate )132 {133 FFADODevice* avDevice = ffado_handle->m_deviceManager->getAvDevice( node_id );134 if ( avDevice ) {135 if ( avDevice->setSamplingFrequency( samplerate ) ) {136 return ffado_handle->m_deviceManager->discover()? 0 : -1;137 }138 }139 return -1;140 75 } 141 76 … … 146 81 AVC::AVCCommand::setSleepAfterAVCCommand( time ); 147 82 } 83 84 85 using namespace Streaming; 86 87 struct _ffado_device 88 { 89 DeviceManager * m_deviceManager; 90 StreamProcessorManager *processorManager; 91 92 ffado_options_t options; 93 ffado_device_info_t device_info; 94 }; 95 96 ffado_device_t *ffado_streaming_init (ffado_device_info_t device_info, ffado_options_t options) { 97 unsigned int i=0; 98 setDebugLevel(options.verbose); 99 100 struct _ffado_device *dev = new struct _ffado_device; 101 102 debugWarning("%s built %s %s\n", ffado_get_version(), __DATE__, __TIME__); 103 104 if(!dev) { 105 debugFatal( "Could not allocate streaming device\n" ); 106 return 0; 107 } 108 109 memcpy((void *)&dev->options, (void *)&options, sizeof(dev->options)); 110 111 dev->m_deviceManager = new DeviceManager(); 112 if ( !dev->m_deviceManager ) { 113 debugFatal( "Could not allocate device manager\n" ); 114 delete dev; 115 return 0; 116 } 117 118 dev->m_deviceManager->setVerboseLevel(dev->options.verbose); 119 if ( !dev->m_deviceManager->initialize() ) { 120 debugFatal( "Could not initialize device manager\n" ); 121 delete dev->m_deviceManager; 122 delete dev; 123 return 0; 124 } 125 126 for (i = 0; i < device_info.nb_device_spec_strings; i++) { 127 char *s = device_info.device_spec_strings[i]; 128 if ( !dev->m_deviceManager->addSpecString(s) ) { 129 debugFatal( "Could not add spec string %s to device manager\n", s ); 130 delete dev->m_deviceManager; 131 delete dev; 132 return 0; 133 } 134 } 135 136 137 // create a processor manager to manage the actual stream 138 // processors 139 dev->processorManager = new StreamProcessorManager( dev->options.period_size, 140 dev->options.sample_rate, 141 dev->options.nb_buffers); 142 if(!dev->processorManager) { 143 debugFatal("Could not create StreamProcessorManager\n"); 144 delete dev->m_deviceManager; 145 delete dev; 146 return 0; 147 } 148 149 dev->processorManager->setThreadParameters(dev->options.realtime, dev->options.packetizer_priority); 150 151 dev->processorManager->setVerboseLevel(dev->options.verbose); 152 if(!dev->processorManager->init()) { 153 debugFatal("Could not init StreamProcessorManager\n"); 154 delete dev->processorManager; 155 delete dev->m_deviceManager; 156 delete dev; 157 return 0; 158 } 159 160 // set slave mode option 161 bool slaveMode=(dev->options.slave_mode != 0); 162 debugOutput(DEBUG_LEVEL_VERBOSE, "setting slave mode to %d\n", slaveMode); 163 if(!dev->m_deviceManager->setOption("slaveMode", slaveMode)) { 164 debugWarning("Failed to set slave mode option\n"); 165 } 166 // set snoop mode option 167 bool snoopMode=(dev->options.snoop_mode != 0); 168 debugOutput(DEBUG_LEVEL_VERBOSE, "setting snoop mode to %d\n", snoopMode); 169 if(!dev->m_deviceManager->setOption("snoopMode", snoopMode)) { 170 debugWarning("Failed to set snoop mode option\n"); 171 } 172 173 // discover the devices on the bus 174 if(!dev->m_deviceManager->discover()) { 175 debugFatal("Could not discover devices\n"); 176 delete dev->processorManager; 177 delete dev->m_deviceManager; 178 delete dev; 179 return 0; 180 } 181 182 // are there devices on the bus? 183 if(dev->m_deviceManager->getAvDeviceCount()==0) { 184 debugFatal("There are no devices on the bus\n"); 185 delete dev->processorManager; 186 delete dev->m_deviceManager; 187 delete dev; 188 return 0; 189 } 190 191 // iterate over the found devices 192 // add the stream processors of the devices to the managers 193 for(i=0;i<dev->m_deviceManager->getAvDeviceCount();i++) { 194 FFADODevice *device=dev->m_deviceManager->getAvDeviceByIndex(i); 195 assert(device); 196 197 debugOutput(DEBUG_LEVEL_VERBOSE, "Locking device (%p)\n", device); 198 199 if (!device->lock()) { 200 debugWarning("Could not lock device, skipping device (%p)!\n", device); 201 continue; 202 } 203 204 debugOutput(DEBUG_LEVEL_VERBOSE, "Setting samplerate to %d for (%p)\n", 205 dev->options.sample_rate, device); 206 207 // Set the device's sampling rate to that requested 208 // FIXME: does this really belong here? If so we need to handle errors. 209 if (!device->setSamplingFrequency(dev->options.sample_rate)) { 210 debugOutput(DEBUG_LEVEL_VERBOSE, " => Retry setting samplerate to %d for (%p)\n", 211 dev->options.sample_rate, device); 212 213 // try again: 214 if (!device->setSamplingFrequency(dev->options.sample_rate)) { 215 delete dev->processorManager; 216 delete dev->m_deviceManager; 217 delete dev; 218 debugFatal("Could not set sampling frequency to %d\n",dev->options.sample_rate); 219 return 0; 220 } 221 } 222 223 // prepare the device 224 device->prepare(); 225 int j=0; 226 for(j=0; j<device->getStreamCount();j++) { 227 StreamProcessor *streamproc=device->getStreamProcessorByIndex(j); 228 debugOutput(DEBUG_LEVEL_VERBOSE, "Registering stream processor %d of device %d with processormanager\n",j,i); 229 if (!dev->processorManager->registerProcessor(streamproc)) { 230 delete dev->processorManager; 231 delete dev->m_deviceManager; 232 delete dev; 233 debugFatal("Could not register stream processor (%p) with the Processor manager\n", streamproc); 234 return 0; 235 } 236 } 237 } 238 239 // set the sync source 240 if (!dev->processorManager->setSyncSource(dev->m_deviceManager->getSyncSource())) { 241 debugWarning("Could not set processorManager sync source (%p)\n", 242 dev->m_deviceManager->getSyncSource()); 243 } 244 245 // we are ready! 246 debugOutputShort(DEBUG_LEVEL_VERBOSE, "\n\n"); 247 return dev; 248 249 } 250 251 int ffado_streaming_prepare(ffado_device_t *dev) { 252 debugOutput(DEBUG_LEVEL_VERBOSE, "Preparing...\n"); 253 254 if (!dev->processorManager->prepare()) { 255 debugFatal("Could not prepare streaming...\n"); 256 return false; 257 } 258 259 return true; 260 } 261 262 void ffado_streaming_finish(ffado_device_t *dev) { 263 unsigned int i=0; 264 265 assert(dev); 266 267 // iterate over the found devices 268 for(i=0;i<dev->m_deviceManager->getAvDeviceCount();i++) { 269 FFADODevice *device=dev->m_deviceManager->getAvDeviceByIndex(i); 270 assert(device); 271 272 debugOutput(DEBUG_LEVEL_VERBOSE, "Unlocking device (%p)\n", device); 273 274 if (!device->unlock()) { 275 debugWarning("Could not unlock device (%p)!\n", device); 276 } 277 } 278 279 delete dev->processorManager; 280 delete dev->m_deviceManager; 281 delete dev; 282 283 return; 284 } 285 286 int ffado_streaming_start(ffado_device_t *dev) { 287 unsigned int i=0; 288 debugOutput(DEBUG_LEVEL_VERBOSE,"------------- Start -------------\n"); 289 290 // create the connections for all devices 291 // iterate over the found devices 292 // add the stream processors of the devices to the managers 293 for(i=0;i<dev->m_deviceManager->getAvDeviceCount();i++) { 294 FFADODevice *device=dev->m_deviceManager->getAvDeviceByIndex(i); 295 assert(device); 296 297 int j=0; 298 for(j=0; j<device->getStreamCount();j++) { 299 debugOutput(DEBUG_LEVEL_VERBOSE,"Starting stream %d of device %d\n",j,i); 300 // start the stream 301 if (!device->startStreamByIndex(j)) { 302 debugWarning("Could not start stream %d of device %d\n",j,i); 303 continue; 304 } 305 } 306 307 if (!device->enableStreaming()) { 308 debugWarning("Could not enable streaming on device %d!\n",i); 309 } 310 } 311 312 if(dev->processorManager->start()) { 313 return 0; 314 } else { 315 ffado_streaming_stop(dev); 316 return -1; 317 } 318 } 319 320 int ffado_streaming_stop(ffado_device_t *dev) { 321 unsigned int i; 322 debugOutput(DEBUG_LEVEL_VERBOSE,"------------- Stop -------------\n"); 323 324 dev->processorManager->stop(); 325 326 // create the connections for all devices 327 // iterate over the found devices 328 // add the stream processors of the devices to the managers 329 for(i=0;i<dev->m_deviceManager->getAvDeviceCount();i++) { 330 FFADODevice *device=dev->m_deviceManager->getAvDeviceByIndex(i); 331 assert(device); 332 333 if (!device->disableStreaming()) { 334 debugWarning("Could not disable streaming on device %d!\n",i); 335 } 336 337 int j=0; 338 for(j=0; j<device->getStreamCount();j++) { 339 debugOutput(DEBUG_LEVEL_VERBOSE,"Stopping stream %d of device %d\n",j,i); 340 // stop the stream 341 // start the stream 342 if (!device->stopStreamByIndex(j)) { 343 debugWarning("Could not stop stream %d of device %d\n",j,i); 344 continue; 345 } 346 } 347 } 348 349 return 0; 350 } 351 352 int ffado_streaming_reset(ffado_device_t *dev) { 353 debugOutput(DEBUG_LEVEL_VERBOSE,"------------- Reset -------------\n"); 354 355 // dev->processorManager->reset(); 356 357 return 0; 358 } 359 360 int ffado_streaming_wait(ffado_device_t *dev) { 361 static int periods=0; 362 static int periods_print=0; 363 static int xruns=0; 364 365 periods++; 366 if(periods>periods_print) { 367 debugOutputShort(DEBUG_LEVEL_VERBOSE, "\nffado_streaming_wait\n"); 368 debugOutputShort(DEBUG_LEVEL_VERBOSE, "============================================\n"); 369 debugOutputShort(DEBUG_LEVEL_VERBOSE, "Xruns: %d\n",xruns); 370 debugOutputShort(DEBUG_LEVEL_VERBOSE, "============================================\n"); 371 dev->processorManager->dumpInfo(); 372 debugOutputShort(DEBUG_LEVEL_VERBOSE, "\n"); 373 periods_print+=100; 374 } 375 376 if(dev->processorManager->waitForPeriod()) { 377 return dev->options.period_size; 378 } else { 379 debugWarning("XRUN detected\n"); 380 381 // do xrun recovery 382 dev->processorManager->handleXrun(); 383 xruns++; 384 return -1; 385 } 386 } 387 388 int ffado_streaming_transfer_capture_buffers(ffado_device_t *dev) { 389 return dev->processorManager->transfer(StreamProcessor::ePT_Receive); 390 } 391 392 int ffado_streaming_transfer_playback_buffers(ffado_device_t *dev) { 393 return dev->processorManager->transfer(StreamProcessor::ePT_Transmit); 394 } 395 396 int ffado_streaming_transfer_buffers(ffado_device_t *dev) { 397 return dev->processorManager->transfer(); 398 } 399 400 401 int ffado_streaming_write(ffado_device_t *dev, int i, ffado_sample_t *buffer, int nsamples) { 402 Port *p=dev->processorManager->getPortByIndex(i, Port::E_Playback); 403 // use an assert here performancewise, 404 // it should already have failed before, if not correct 405 assert(p); 406 407 return p->writeEvents((void *)buffer, nsamples); 408 } 409 410 int ffado_streaming_read(ffado_device_t *dev, int i, ffado_sample_t *buffer, int nsamples) { 411 Port *p=dev->processorManager->getPortByIndex(i, Port::E_Capture); 412 // use an assert here performancewise, 413 // it should already have failed before, if not correct 414 assert(p); 415 416 return p->readEvents((void *)buffer, nsamples); 417 } 418 419 int ffado_streaming_get_nb_capture_streams(ffado_device_t *dev) { 420 return dev->processorManager->getPortCount(Port::E_Capture); 421 } 422 423 int ffado_streaming_get_nb_playback_streams(ffado_device_t *dev) { 424 return dev->processorManager->getPortCount(Port::E_Playback); 425 } 426 427 int ffado_streaming_get_capture_stream_name(ffado_device_t *dev, int i, char* buffer, size_t buffersize) { 428 Port *p=dev->processorManager->getPortByIndex(i, Port::E_Capture); 429 if(!p) { 430 debugWarning("Could not get capture port at index %d\n",i); 431 return -1; 432 } 433 434 std::string name=p->getName(); 435 if (!strncpy(buffer, name.c_str(), buffersize)) { 436 debugWarning("Could not copy name\n"); 437 return -1; 438 } else return 0; 439 } 440 441 int ffado_streaming_get_playback_stream_name(ffado_device_t *dev, int i, char* buffer, size_t buffersize) { 442 Port *p=dev->processorManager->getPortByIndex(i, Port::E_Playback); 443 if(!p) { 444 debugWarning("Could not get playback port at index %d\n",i); 445 return -1; 446 } 447 448 std::string name=p->getName(); 449 if (!strncpy(buffer, name.c_str(), buffersize)) { 450 debugWarning("Could not copy name\n"); 451 return -1; 452 } else return 0; 453 } 454 455 ffado_streaming_stream_type ffado_streaming_get_capture_stream_type(ffado_device_t *dev, int i) { 456 Port *p=dev->processorManager->getPortByIndex(i, Port::E_Capture); 457 if(!p) { 458 debugWarning("Could not get capture port at index %d\n",i); 459 return ffado_stream_type_invalid; 460 } 461 switch(p->getPortType()) { 462 case Port::E_Audio: 463 return ffado_stream_type_audio; 464 case Port::E_Midi: 465 return ffado_stream_type_midi; 466 case Port::E_Control: 467 return ffado_stream_type_control; 468 default: 469 return ffado_stream_type_unknown; 470 } 471 } 472 473 ffado_streaming_stream_type ffado_streaming_get_playback_stream_type(ffado_device_t *dev, int i) { 474 Port *p=dev->processorManager->getPortByIndex(i, Port::E_Playback); 475 if(!p) { 476 debugWarning("Could not get playback port at index %d\n",i); 477 return ffado_stream_type_invalid; 478 } 479 switch(p->getPortType()) { 480 case Port::E_Audio: 481 return ffado_stream_type_audio; 482 case Port::E_Midi: 483 return ffado_stream_type_midi; 484 case Port::E_Control: 485 return ffado_stream_type_control; 486 default: 487 return ffado_stream_type_unknown; 488 } 489 } 490 491 int ffado_streaming_set_stream_buffer_type(ffado_device_t *dev, int i, 492 ffado_streaming_buffer_type t, enum Port::E_Direction direction) { 493 494 Port *p=dev->processorManager->getPortByIndex(i, direction); 495 if(!p) { 496 debugWarning("Could not get %s port at index %d\n", 497 (direction==Port::E_Playback?"Playback":"Capture"),i); 498 return -1; 499 } 500 501 switch(t) { 502 case ffado_buffer_type_int24: 503 if (!p->setDataType(Port::E_Int24)) { 504 debugWarning("%s: Could not set data type to Int24\n",p->getName().c_str()); 505 return -1; 506 } 507 if (!p->setBufferType(Port::E_PointerBuffer)) { 508 debugWarning("%s: Could not set buffer type to Pointerbuffer\n",p->getName().c_str()); 509 return -1; 510 } 511 break; 512 case ffado_buffer_type_float: 513 if (!p->setDataType(Port::E_Float)) { 514 debugWarning("%s: Could not set data type to Float\n",p->getName().c_str()); 515 return -1; 516 } 517 if (!p->setBufferType(Port::E_PointerBuffer)) { 518 debugWarning("%s: Could not set buffer type to Pointerbuffer\n",p->getName().c_str()); 519 return -1; 520 } 521 break; 522 case ffado_buffer_type_midi: 523 if (!p->setDataType(Port::E_MidiEvent)) { 524 debugWarning("%s: Could not set data type to MidiEvent\n",p->getName().c_str()); 525 return -1; 526 } 527 if (!p->setBufferType(Port::E_RingBuffer)) { 528 debugWarning("%s: Could not set buffer type to Ringbuffer\n",p->getName().c_str()); 529 return -1; 530 } 531 break; 532 default: 533 debugWarning("%s: Unsupported buffer type\n",p->getName().c_str()); 534 return -1; 535 } 536 return 0; 537 538 } 539 540 int ffado_streaming_set_playback_buffer_type(ffado_device_t *dev, int i, ffado_streaming_buffer_type t) { 541 return ffado_streaming_set_stream_buffer_type(dev, i, t, Port::E_Playback); 542 } 543 544 int ffado_streaming_set_capture_buffer_type(ffado_device_t *dev, int i, ffado_streaming_buffer_type t) { 545 return ffado_streaming_set_stream_buffer_type(dev, i, t, Port::E_Capture); 546 } 547 548 int ffado_streaming_stream_onoff(ffado_device_t *dev, int i, 549 int on, enum Port::E_Direction direction) { 550 Port *p=dev->processorManager->getPortByIndex(i, direction); 551 if(!p) { 552 debugWarning("Could not get %s port at index %d\n", 553 (direction==Port::E_Playback?"Playback":"Capture"),i); 554 return -1; 555 } 556 if(on) { 557 p->enable(); 558 } else { 559 p->disable(); 560 } 561 return 0; 562 } 563 564 int ffado_streaming_playback_stream_onoff(ffado_device_t *dev, int number, int on) { 565 return ffado_streaming_stream_onoff(dev, number, on, Port::E_Playback); 566 } 567 568 int ffado_streaming_capture_stream_onoff(ffado_device_t *dev, int number, int on) { 569 return ffado_streaming_stream_onoff(dev, number, on, Port::E_Capture); 570 } 571 572 // TODO: the way port buffers are set in the C api doesn't satisfy me 573 int ffado_streaming_set_capture_stream_buffer(ffado_device_t *dev, int i, char *buff) { 574 Port *p=dev->processorManager->getPortByIndex(i, Port::E_Capture); 575 576 // use an assert here performancewise, 577 // it should already have failed before, if not correct 578 assert(p); 579 580 p->useExternalBuffer(true); 581 p->setExternalBufferAddress((void *)buff); 582 583 return 0; 584 585 } 586 587 int ffado_streaming_set_playback_stream_buffer(ffado_device_t *dev, int i, char *buff) { 588 Port *p=dev->processorManager->getPortByIndex(i, Port::E_Playback); 589 // use an assert here performancewise, 590 // it should already have failed before, if not correct 591 assert(p); 592 593 p->useExternalBuffer(true); 594 p->setExternalBufferAddress((void *)buff); 595 596 return 0; 597 } trunk/libffado/src/ffadodevice.cpp
r734 r739 33 33 #include <assert.h> 34 34 35 IMPL_DEBUG_MODULE( FFADODevice, FFADODevice, DEBUG_LEVEL_ VERBOSE);35 IMPL_DEBUG_MODULE( FFADODevice, FFADODevice, DEBUG_LEVEL_NORMAL ); 36 36 37 FFADODevice::FFADODevice( Ieee1394Service& ieee1394Service, 38 std::auto_ptr<ConfigRom>( configRom )) 37 FFADODevice::FFADODevice( std::auto_ptr<ConfigRom>( configRom )) 39 38 : Control::Container() 40 39 , m_pConfigRom( configRom ) 41 , m_p1394Service( &ieee1394Service )42 40 { 43 41 addOption(Util::OptionContainer::Option("id",std::string("dev?"))); … … 59 57 60 58 FFADODevice * 61 FFADODevice::createDevice( Ieee1394Service& , 62 std::auto_ptr<ConfigRom>( x )) 59 FFADODevice::createDevice(std::auto_ptr<ConfigRom>( x )) 63 60 { 64 61 // re-implement this!! … … 89 86 { 90 87 return *m_pConfigRom; 88 } 89 90 Ieee1394Service& 91 FFADODevice::get1394Service() 92 { 93 return getConfigRom().get1394Service(); 91 94 } 92 95 … … 144 147 FFADODevice::showDevice() 145 148 { 146 debugOutput(DEBUG_LEVEL_NORMAL, "Node...........: %d\n", getNodeId()); 147 debugOutput(DEBUG_LEVEL_NORMAL, "GUID...........: %s\n", getConfigRom().getGuidString().c_str()); 148 149 Ieee1394Service& s = getConfigRom().get1394Service(); 150 debugOutput(DEBUG_LEVEL_NORMAL, "Attached to port.......: %d (%s)\n", 151 s.getPort(), s.getPortName().c_str()); 152 debugOutput(DEBUG_LEVEL_NORMAL, "Node...................: %d\n", getNodeId()); 153 debugOutput(DEBUG_LEVEL_NORMAL, "GUID...................: %s\n", 154 getConfigRom().getGuidString().c_str()); 155 149 156 std::string id=std::string("dev? [none]"); 150 157 getOption("id", id); 151 158 152 159 debugOutput(DEBUG_LEVEL_NORMAL, "Assigned ID....: %s\n", id.c_str()); 153 160 trunk/libffado/src/ffadodevice.h
r674 r739 53 53 { 54 54 public: 55 FFADODevice( Ieee1394Service& ieee1394service, 56 std::auto_ptr< ConfigRom >( configRom ) ); 55 FFADODevice( std::auto_ptr< ConfigRom >( configRom ) ); 57 56 58 57 virtual ~FFADODevice(); 59 58 60 61 59 /** 62 60 * @brief Compares the GUID of two FFADODevices … … 76 74 77 75 /// Returns the 1394 service of the FFADO device 78 virtual Ieee1394Service& get1394Service() 79 { return *m_p1394Service; }; 76 virtual Ieee1394Service& get1394Service(); 80 77 /// Returns the ConfigRom object of the device node. 81 78 virtual ConfigRom& getConfigRom() const; 82 79 83 80 /** 84 81 * @brief Called by DeviceManager to load device model from cache. … … 114 111 * @return a new instance of the AvDevice type, NULL when unsuccessful 115 112 */ 116 static FFADODevice * createDevice( Ieee1394Service& , 117 std::auto_ptr<ConfigRom>( x )); 113 static FFADODevice * createDevice( std::auto_ptr<ConfigRom>( x )); 118 114 119 115 /** … … 417 413 418 414 415 private: 416 std::auto_ptr<ConfigRom>( m_pConfigRom ); 419 417 protected: 420 std::auto_ptr<ConfigRom>( m_pConfigRom );421 Ieee1394Service* m_p1394Service;422 423 418 DECLARE_DEBUG_MODULE; 424 419 }; trunk/libffado/src/fireworks/audiofire/audiofire_device.cpp
r587 r739 30 30 namespace ECHO { 31 31 32 AudioFire::AudioFire( Ieee1394Service& ieee1394Service, 33 std::auto_ptr<ConfigRom>( configRom )) 34 : FireWorks::Device( ieee1394Service, configRom) 32 AudioFire::AudioFire(std::auto_ptr<ConfigRom>( configRom )) 33 : FireWorks::Device(configRom) 35 34 { 36 35 debugOutput( DEBUG_LEVEL_VERBOSE, "Created FireWorks::ECHO::AudioFire (NodeID %d)\n", trunk/libffado/src/fireworks/audiofire/audiofire_device.h
r639 r739 35 35 36 36 public: 37 AudioFire( Ieee1394Service& ieee1394Service, 38 std::auto_ptr<ConfigRom>( configRom )); 37 AudioFire(std::auto_ptr<ConfigRom>( configRom )); 39 38 virtual ~AudioFire(); 40 39 trunk/libffado/src/fireworks/efc/efc_cmd.cpp
r687 r739 177 177 } 178 178 179 void 180 EfcCmd::setVerboseLevel(int l) 181 { 182 setDebugLevel(l); 183 } 184 179 185 } // namespace FireWorks trunk/libffado/src/fireworks/efc/efc_cmd.h
r687 r739 219 219 220 220 virtual void showEfcCmd(); 221 virtual void setVerboseLevel(int l); 221 222 222 223 uint32_t m_length; // in quadlets, including length field and header. trunk/libffado/src/fireworks/fireworks_device.cpp
r689 r739 43 43 namespace FireWorks { 44 44 45 Device::Device( Ieee1394Service& ieee1394Service, 46 std::auto_ptr<ConfigRom>( configRom )) 47 : GenericAVC::AvDevice( ieee1394Service, configRom) 45 Device::Device(std::auto_ptr<ConfigRom>( configRom )) 46 : GenericAVC::AvDevice(configRom) 48 47 , m_efc_discovery_done ( false ) 49 48 , m_MixerContainer ( NULL ) … … 91 90 Device::discover() 92 91 { 93 unsigned int vendorId = m_pConfigRom->getNodeVendorId();94 unsigned int modelId = m_pConfigRom->getModelId();92 unsigned int vendorId = getConfigRom().getNodeVendorId(); 93 unsigned int modelId = getConfigRom().getModelId(); 95 94 96 95 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_fireworks.txt" ); … … 128 127 { 129 128 m_efc_discovery_done = false; 129 m_HwInfo.setVerboseLevel(getDebugLevel()); 130 130 131 131 if (!doEfcOverAVC(m_HwInfo)) { … … 148 148 149 149 FFADODevice * 150 Device::createDevice( Ieee1394Service& ieee1394Service, 151 std::auto_ptr<ConfigRom>( configRom )) 150 Device::createDevice(std::auto_ptr<ConfigRom>( configRom )) 152 151 { 153 152 unsigned int vendorId = configRom->getNodeVendorId(); … … 155 154 156 155 switch(vendorId) { 157 case FW_VENDORID_ECHO: return new ECHO::AudioFire( ieee1394Service,configRom );158 default: return new Device( ieee1394Service,configRom );156 case FW_VENDORID_ECHO: return new ECHO::AudioFire(configRom ); 157 default: return new Device(configRom ); 159 158 } 160 159 } … … 169 168 170 169 cmd.setVerbose( getDebugLevel() ); 171 // cmd.setVerbose( DEBUG_LEVEL_VERY_VERBOSE );172 173 170 cmd.m_cmd = &c; 174 175 // c.showEfcCmd();176 171 177 172 if ( !cmd.fire()) { … … 180 175 return false; 181 176 } 182 // c.showEfcCmd();183 177 184 178 if ( cmd.getResponse() != AVC::AVCCommand::eR_Accepted) { trunk/libffado/src/fireworks/fireworks_device.h
r664 r739 42 42 class Device : public GenericAVC::AvDevice { 43 43 public: 44 Device( Ieee1394Service& ieee1394Service, 45 std::auto_ptr<ConfigRom>( configRom )); 44 Device(std::auto_ptr<ConfigRom>( configRom )); 46 45 virtual ~Device(); 47 46 48 47 static bool probe( ConfigRom& configRom ); 49 static FFADODevice * createDevice( Ieee1394Service& ieee1394Service, 50 std::auto_ptr<ConfigRom>( configRom )); 48 static FFADODevice * createDevice( std::auto_ptr<ConfigRom>( configRom )); 51 49 virtual bool discover(); 52 50 trunk/libffado/src/genericavc/avc_avdevice.cpp
r736 r739 49 49 namespace GenericAVC { 50 50 51 IMPL_DEBUG_MODULE( AvDevice, AvDevice, DEBUG_LEVEL_VERBOSE ); 52 53 54 AvDevice::AvDevice( Ieee1394Service& ieee1394Service, 55 std::auto_ptr<ConfigRom>( configRom )) 56 : FFADODevice( ieee1394Service, configRom ) 51 IMPL_DEBUG_MODULE( AvDevice, AvDevice, DEBUG_LEVEL_NORMAL ); 52 53 AvDevice::AvDevice(std::auto_ptr<ConfigRom>( configRom )) 54 : FFADODevice( configRom ) 57 55 { 58 56 debugOutput( DEBUG_LEVEL_VERBOSE, "Created GenericAVC::AvDevice (NodeID %d)\n", … … 61 59 } 62 60 63 AvDevice::~AvDevice()64 {65 66 }67 68 61 bool 69 62 AvDevice::probe( ConfigRom& configRom ) … … 81 74 82 75 FFADODevice * 83 AvDevice::createDevice( Ieee1394Service& ieee1394Service, 84 std::auto_ptr<ConfigRom>( configRom )) 85 { 86 return new AvDevice(ieee1394Service, configRom ); 76 AvDevice::createDevice(std::auto_ptr<ConfigRom>( configRom )) 77 { 78 return new AvDevice(configRom ); 87 79 } 88 80 … … 93 85 // e.g. because a subclass called this function 94 86 if (!GenericAVC::VendorModel::isValid(m_model)) { 95 unsigned int vendorId = m_pConfigRom->getNodeVendorId();96 unsigned int modelId = m_pConfigRom->getModelId();87 unsigned int vendorId = getConfigRom().getNodeVendorId(); 88 unsigned int modelId = getConfigRom().getModelId(); 97 89 98 90 GenericAVC::VendorModel vendorModel( SHAREDIR "/ffado_driver_genericavc.txt" ); … … 128 120 AvDevice::setVerboseLevel(int l) 129 121 { 130 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l ); 131 122 setDebugLevel(l); 132 123 m_pPlugManager->setVerboseLevel(l); 133 134 124 FFADODevice::setVerboseLevel(l); 135 125 AVC::Unit::setVerboseLevel(l); 126 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l ); 136 127 } 137 128 … … 628 619 if (iec61883_get_oPCRX( 629 620 get1394Service().getHandle(), 630 m_pConfigRom->getNodeId() | 0xffc0,621 getConfigRom().getNodeId() | 0xffc0, 631 622 (quadlet_t *)&opcr, 632 623 n)) { … … 639 630 } else { 640 631 iso_channel=get1394Service().allocateIsoChannelCMP( 641 m_pConfigRom->getNodeId() | 0xffc0, n,632 getConfigRom().getNodeId() | 0xffc0, n, 642 633 get1394Service().getLocalNodeId()| 0xffc0, -1); 643 634 } … … 662 653 if (iec61883_get_iPCRX( 663 654 get1394Service().getHandle(), 664 m_pConfigRom->getNodeId() | 0xffc0,655 getConfigRom().getNodeId() | 0xffc0, 665 656 (quadlet_t *)&ipcr, 666 657 n)) { … … 675 666 iso_channel=get1394Service().allocateIsoChannelCMP( 676 667 get1394Service().getLocalNodeId()| 0xffc0, -1, 677 m_pConfigRom->getNodeId() | 0xffc0, n);668 getConfigRom().getNodeId() | 0xffc0, n); 678 669 } 679 670 trunk/libffado/src/genericavc/avc_avdevice.h
r734 r739 48 48 class AvDevice : public FFADODevice, public AVC::Unit { 49 49 public: 50 AvDevice( Ieee1394Service& ieee1394Service, 51 std::auto_ptr<ConfigRom>( configRom )); 52 virtual ~AvDevice(); 50 AvDevice( std::auto_ptr<ConfigRom>( configRom )); 51 virtual ~AvDevice() {}; 53 52 54 53 static bool probe( ConfigRom& configRom ); 55 54 virtual bool discover(); 56 static FFADODevice * createDevice( Ieee1394Service& ieee1394Service, 57 std::auto_ptr<ConfigRom>( configRom )); 55 static FFADODevice * createDevice( std::auto_ptr<ConfigRom>( configRom )); 58 56 59 57 virtual bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const; trunk/libffado/src/libieee1394/configrom.cpp
r736 r739 62 62 ConfigRom::ConfigRom( Ieee1394Service& ieee1394service, fb_nodeid_t nodeId ) 63 63 : Control::Element("ConfigRom") 64 , m_1394Service( &ieee1394service )64 , m_1394Service( ieee1394service ) 65 65 , m_nodeId( nodeId ) 66 66 , m_avcDevice( false ) // FIXME: this does not seem veryu … … 89 89 ConfigRom::ConfigRom() 90 90 : Control::Element("ConfigRom") 91 , m_1394Service( 0)91 , m_1394Service( *(new Ieee1394Service()) ) 92 92 , m_nodeId( -1 ) 93 93 , m_avcDevice( false ) // FIXME: this does not seem veryu … … 114 114 } 115 115 116 ConfigRom::~ConfigRom() 117 { 116 Ieee1394Service& 117 ConfigRom::get1394Service() 118 { 119 return m_1394Service; 118 120 } 119 121 … … 133 135 { 134 136 struct config_csr_info csr_info; 135 csr_info.service = m_1394Service;137 csr_info.service = &m_1394Service; 136 138 csr_info.nodeId = 0xffc0 | m_nodeId; 137 139 … … 140 142 &csr_info ); 141 143 if (!m_csr || csr1212_parse_csr( m_csr ) != CSR1212_SUCCESS) { 142 debugError( "Could not parse config rom of node %d on port %d\n", m_nodeId, m_1394Service ->getPort() );144 debugError( "Could not parse config rom of node %d on port %d\n", m_nodeId, m_1394Service.getPort() ); 143 145 if (m_csr) { 144 146 csr1212_destroy_csr(m_csr); … … 451 453 struct csr1212_csr* csr = NULL; 452 454 for ( fb_nodeid_t nodeId = 0; 453 nodeId < m_1394Service ->getNodeCount();455 nodeId < m_1394Service.getNodeCount(); 454 456 ++nodeId ) 455 457 { 456 458 struct config_csr_info csr_info; 457 csr_info.service = m_1394Service;459 csr_info.service = &m_1394Service; 458 460 csr_info.nodeId = 0xffc0 | nodeId; 459 461 debugOutput( DEBUG_LEVEL_VERBOSE, "Looking at node %d...\n", nodeId); … … 577 579 } 578 580 579 pConfigRom->m_1394Service = &ieee1394Service;581 pConfigRom->m_1394Service = ieee1394Service; 580 582 581 583 bool result; trunk/libffado/src/libieee1394/configrom.h
r673 r739 44 44 public: 45 45 ConfigRom( Ieee1394Service& ieee1394service, fb_nodeid_t nodeId ); 46 virtual ~ConfigRom(); 46 virtual ~ConfigRom() {}; 47 48 Ieee1394Service& get1394Service(); 47 49 48 50 bool initialize(); … … 98 100 static bool compareGUID( const ConfigRom& a, const ConfigRom& b ); 99 101 100 void printConfigRom() const;101 102 102 bool serialize( Glib::ustring path, Util::IOSerialize& ser ); 103 103 static ConfigRom* deserialize( Glib::ustring path, … … 105 105 Ieee1394Service& ieee1394Service ); 106 106 107 void printConfigRom() const; 107 108 void setVerboseLevel(int level) { 108 109 setDebugLevel(level); … … 117 118 void processRootDirectory( struct csr1212_csr* csr ); 118 119 119 Ieee1394Service *m_1394Service;120 Ieee1394Service& m_1394Service; 120 121 fb_nodeid_t m_nodeId; 121 122 bool m_avcDevice; trunk/libffado/src/libieee1394/ieee1394service.cpp
r677 r739 37 37 #include <iostream> 38 38 #include <iomanip> 39 40 #define FFADO_MAX_FIREWIRE_PORTS 8 39 41 40 42 IMPL_DEBUG_MODULE( Ieee1394Service, Ieee1394Service, DEBUG_LEVEL_NORMAL ); … … 83 85 } 84 86 87 unsigned int 88 Ieee1394Service::detectNbPorts( ) 89 { 90 raw1394handle_t tmp_handle = raw1394_new_handle(); 91 if ( tmp_handle == NULL ) { 92 debugError("Could not get libraw1394 handle.\n"); 93 return 0; 94 } 95 struct raw1394_portinfo pinf[FFADO_MAX_FIREWIRE_PORTS]; 96 int nb_detected_ports = raw1394_get_port_info(tmp_handle, pinf, FFADO_MAX_FIREWIRE_PORTS); 97 raw1394_destroy_handle(tmp_handle); 98 99 if (nb_detected_ports < 0) { 100 debugError("Failed to detect number of ports\n"); 101 return 0; 102 } 103 return nb_detected_ports; 104 } 105 85 106 bool 86 107 Ieee1394Service::initialize( int port ) … … 113 134 114 135 m_port = port; 136 137 // obtain port name 138 struct raw1394_portinfo pinf[FFADO_MAX_FIREWIRE_PORTS]; 139 int nb_detected_ports = raw1394_get_port_info(m_handle, pinf, FFADO_MAX_FIREWIRE_PORTS); 140 141 if(nb_detected_ports && port < FFADO_MAX_FIREWIRE_PORTS) { 142 m_portName = pinf[port].name; 143 } else { 144 m_portName = "Unknown"; 145 } 146 if (m_portName == "") { 147 m_portName = "Unknown"; 148 } 115 149 116 150 raw1394_set_userdata( m_handle, this ); … … 840 874 setDebugLevel(l); 841 875 } 876 877 void 878 Ieee1394Service::show() 879 { 880 debugOutput( DEBUG_LEVEL_VERBOSE, "Port: %d\n", getPort() ); 881 debugOutput( DEBUG_LEVEL_VERBOSE, " Name: %s\n", getPortName().c_str() ); 882 } trunk/libffado/src/libieee1394/ieee1394service.h
r677 r739 37 37 38 38 #include <vector> 39 #include <string> 39 40 40 41 class ARMHandler; … … 47 48 bool initialize( int port ); 48 49 50 /** 51 * @brief get number of ports (firewire adapters) in this machine 52 * 53 * @return the number of ports 54 */ 55 static unsigned int detectNbPorts(); 56 57 /** 58 * @brief get port (adapter) id 59 * 60 * @return get port (adapter) id 61 */ 49 62 int getPort() 50 { return m_port; } 63 { return m_port; } 64 65 /** 66 * @brief get port (adapter) name 67 * 68 * @return get port (adapter) name 69 */ 70 std::string getPortName() 71 { return m_portName; }; 72 51 73 /** 52 74 * @brief get number of nodes on the bus … … 238 260 raw1394handle_t m_resetHandle; 239 261 int m_port; 262 std::string m_portName; 240 263 241 264 pthread_t m_thread; … … 256 279 public: 257 280 void setVerboseLevel(int l); 281 void show(); 258 282 private: 259 283 DECLARE_DEBUG_MODULE; trunk/libffado/src/libstreaming/util/IsoHandlerManager.cpp
r729 r739 69 69 70 70 // propagate the debug level 71 //m_isoManagerThread->setVerboseLevel(getDebugLevel());71 m_isoManagerThread->setVerboseLevel(getDebugLevel()); 72 72 73 73 return true; … … 705 705 setDebugLevel(i); 706 706 707 // propagate the debug level 708 if(m_isoManagerThread) { 709 m_isoManagerThread->setVerboseLevel(getDebugLevel()); 710 } 711 707 712 for ( IsoHandlerVectorIterator it = m_IsoHandlers.begin(); 708 713 it != m_IsoHandlers.end(); trunk/libffado/src/libutil/Thread.h
r445 r739 88 88 virtual pthread_t GetThreadID() = 0; 89 89 90 virtual void setVerboseLevel(int l) 91 {setDebugLevel(l);}; 90 92 protected: 91 93 DECLARE_DEBUG_MODULE; trunk/libffado/src/maudio/maudio_avdevice.cpp
r587 r739 40 40 namespace MAudio { 41 41 42 AvDevice::AvDevice( Ieee1394Service& ieee1394Service, 43 std::auto_ptr<ConfigRom>( configRom )) 44 : BeBoB::AvDevice( ieee1394Service, configRom) 42 AvDevice::AvDevice(std::auto_ptr<ConfigRom>( configRom )) 43 : BeBoB::AvDevice( configRom) 45 44 , m_model ( NULL ) 46 45 { … … 82 81 83 82 FFADODevice * 84 AvDevice::createDevice( Ieee1394Service& ieee1394Service, 85 std::auto_ptr<ConfigRom>( configRom )) 83 AvDevice::createDevice(std::auto_ptr<ConfigRom>( configRom )) 86 84 { 87 return new AvDevice( ieee1394Service,configRom );85 return new AvDevice(configRom ); 88 86 } 89 87 … … 91 89 AvDevice::discover() 92 90 { 93 unsigned int vendorId = m_pConfigRom->getNodeVendorId();94 unsigned int modelId = m_pConfigRom->getModelId();91 unsigned int vendorId = getConfigRom().getNodeVendorId(); 92 unsigned int modelId = getConfigRom().getModelId(); 95 93 96 94 for ( unsigned int i = 0; trunk/libffado/src/maudio/maudio_avdevice.h
r734 r739 54 54 class AvDevice : public BeBoB::AvDevice { 55 55 public: 56 AvDevice( Ieee1394Service& ieee1394Service, 57 std::auto_ptr<ConfigRom>( configRom )); 56 AvDevice(std::auto_ptr<ConfigRom>( configRom )); 58 57 virtual ~AvDevice(); 59 58 60 59 static bool probe( ConfigRom& configRom ); 61 static FFADODevice * createDevice( Ieee1394Service& ieee1394Service, 62 std::auto_ptr<ConfigRom>( configRom )); 60 static FFADODevice * createDevice(std::auto_ptr<ConfigRom>( configRom )); 63 61 virtual bool discover(); 64 62 trunk/libffado/src/motu/motu_avdevice.cpp
r734 r739 186 186 }; 187 187 188 MotuDevice::MotuDevice( Ieee1394Service& ieee1394Service, 189 std::auto_ptr<ConfigRom>( configRom )) 190 : FFADODevice( ieee1394Service, configRom ) 188 MotuDevice::MotuDevice( std::auto_ptr<ConfigRom>( configRom )) 189 : FFADODevice( configRom ) 191 190 , m_motu_model( MOTUFW_MODEL_NONE ) 192 191 , m_iso_recv_channel ( -1 ) … … 206 205 { 207 206 // Free ieee1394 bus resources if they have been allocated 208 if (m_p1394Service != NULL) { 209 if (m_iso_recv_channel>=0 && !m_p1394Service->freeIsoChannel(m_iso_recv_channel)) { 210 debugOutput(DEBUG_LEVEL_VERBOSE, "Could not free recv iso channel %d\n", m_iso_recv_channel); 211 } 212 if (m_iso_send_channel>=0 && !m_p1394Service->freeIsoChannel(m_iso_send_channel)) { 213 debugOutput(DEBUG_LEVEL_VERBOSE, "Could not free send iso channel %d\n", m_iso_send_channel); 214 } 207 if (m_iso_recv_channel>=0 && !get1394Service().freeIsoChannel(m_iso_recv_channel)) { 208 debugOutput(DEBUG_LEVEL_VERBOSE, "Could not free recv iso channel %d\n", m_iso_recv_channel); 209 } 210 if (m_iso_send_channel>=0 && !get1394Service().freeIsoChannel(m_iso_send_channel)) { 211 debugOutput(DEBUG_LEVEL_VERBOSE, "Could not free send iso channel %d\n", m_iso_send_channel); 215 212 } 216 213 } … … 242 239 243 240 FFADODevice * 244 MotuDevice::createDevice( Ieee1394Service& ieee1394Service, 245 std::auto_ptr<ConfigRom>( configRom )) 246 { 247 return new MotuDevice(ieee1394Service, configRom ); 241 MotuDevice::createDevice(std::auto_ptr<ConfigRom>( configRom )) 242 { 243 return new MotuDevice(configRom); 248 244 } 249 245 … … 251 247 MotuDevice::discover() 252 248 { 253 unsigned int vendorId = m_pConfigRom->getNodeVendorId();254 // unsigned int modelId = m_pConfigRom->getModelId();255 unsigned int unitVersion = m_pConfigRom->getUnitVersion();256 unsigned int unitSpecifierId = m_pConfigRom->getUnitSpecifierId();249 unsigned int vendorId = getConfigRom().getNodeVendorId(); 250 // unsigned int modelId = getConfigRom().getModelId(); 251 unsigned int unitVersion = getConfigRom().getUnitVersion(); 252 unsigned int unitSpecifierId = getConfigRom().getUnitSpecifierId(); 257 253 258 254 for ( unsigned int i = 0; … … 504 500 // Assign iso channels if not already done 505 501 if (m_iso_recv_channel < 0) 506 m_iso_recv_channel = m_p1394Service->allocateIsoChannelGeneric(m_rx_bandwidth);502 m_iso_recv_channel = get1394Service().allocateIsoChannelGeneric(m_rx_bandwidth); 507 503 508 504 if (m_iso_send_channel < 0) 509 m_iso_send_channel = m_p1394Service->allocateIsoChannelGeneric(m_tx_bandwidth);505 m_iso_send_channel = get1394Service().allocateIsoChannelGeneric(m_tx_bandwidth); 510 506 511 507 debugOutput(DEBUG_LEVEL_VERBOSE, "recv channel = %d, send channel = %d\n", … … 515 511 // be nice and deallocate 516 512 if (m_iso_recv_channel >= 0) 517 m_p1394Service->freeIsoChannel(m_iso_recv_channel);513 get1394Service().freeIsoChannel(m_iso_recv_channel); 518 514 if (m_iso_send_channel >= 0) 519 m_p1394Service->freeIsoChannel(m_iso_send_channel);515 get1394Service().freeIsoChannel(m_iso_send_channel); 520 516 521 517 debugFatal("Could not allocate iso channels!\n"); … … 524 520 525 521 m_receiveProcessor=new Streaming::MotuReceiveStreamProcessor( 526 m_p1394Service->getPort(), event_size_in);522 get1394Service().getPort(), event_size_in); 527 523 528 524 // The first thing is to initialize the processor. This creates the … … 594 590 // Do the same for the transmit processor 595 591 m_transmitProcessor=new Streaming::MotuTransmitStreamProcessor( 596 m_p1394Service->getPort(), event_size_out);592 get1394Service().getPort(), event_size_out); 597 593 598 594 m_transmitProcessor->setVerboseLevel(getDebugLevel()); … … 940 936 */ 941 937 942 quadlet_t quadlet; 943 assert(m_p1394Service); 938 quadlet_t quadlet; 944 939 945 940 quadlet = 0; 946 941 // Note: 1394Service::read() expects a physical ID, not the node id 947 if ( m_p1394Service->read(0xffc0 | getNodeId(), MOTUFW_BASE_ADDR+reg, 1, &quadlet) < 0) {942 if (get1394Service().read(0xffc0 | getNodeId(), MOTUFW_BASE_ADDR+reg, 1, &quadlet) < 0) { 948 943 debugError("Error doing motu read from register 0x%06x\n",reg); 949 944 } … … 961 956 962 957 // Note: 1394Service::write() expects a physical ID, not the node id 963 if ( m_p1394Service->write(0xffc0 | getNodeId(), MOTUFW_BASE_ADDR+reg, 1, &data) < 0) {958 if (get1394Service().write(0xffc0 | getNodeId(), MOTUFW_BASE_ADDR+reg, 1, &data) < 0) { 964 959 err = 1; 965 960 debugError("Error doing motu write to register 0x%06x\n",reg); trunk/libffado/src/motu/motu_avdevice.h
r734 r739 125 125 public: 126 126 127 MotuDevice( Ieee1394Service& ieee1394Service, 128 std::auto_ptr<ConfigRom>( configRom )); 127 MotuDevice(std::auto_ptr<ConfigRom>( configRom )); 129 128 virtual ~MotuDevice(); 130 129 131 130 static bool probe( ConfigRom& configRom ); 132 static FFADODevice * createDevice( Ieee1394Service& ieee1394Service, 133 std::auto_ptr<ConfigRom>( configRom )); 131 static FFADODevice * createDevice(std::auto_ptr<ConfigRom>( configRom )); 134 132 static int getConfigurationId( ); 135 133 virtual bool discover(); trunk/libffado/src/SConscript
r734 r739 12 12 devicemanager.cpp \ 13 13 ffado.cpp \ 14 ffado_streaming.cpp \15 14 ffadodevice.cpp \ 16 15 debugmodule/debugmodule.cpp \ trunk/libffado/support/dbus/ffado-dbus-server.cpp
r730 r739 213 213 return exitfunction(-1); 214 214 } 215 if ( !m_deviceManager->initialize( arguments.port) ) {215 if ( !m_deviceManager->initialize() ) { 216 216 debugError("Could not initialize device manager\n" ); 217 217 delete m_deviceManager; trunk/libffado/support/firmware/fireworks-downloader.cpp
r689 r739 166 166 } 167 167 168 Device *dev = new Device( s ervice, std::auto_ptr<ConfigRom>(configRom) );168 Device *dev = new Device( std::auto_ptr<ConfigRom>(configRom) ); 169 169 if (dev == NULL) { 170 170 debugError("Could not create FireWorks::Device\n"); trunk/libffado/tests/streaming/testmidistreaming1.c
r554 r739 170 170 dev_options.nb_buffers=3; 171 171 172 dev_options.port=0;173 dev_options.node_id=-1;174 175 172 dev_options.realtime=0; 176 173 dev_options.packetizer_priority=60; 177 178 dev_options.directions=0;179 174 180 175 dev_options.verbose=5; … … 183 178 dev_options.snoop_mode=0; 184 179 185 ffado_device_t *dev=ffado_streaming_init( &device_info, dev_options);180 ffado_device_t *dev=ffado_streaming_init(device_info, dev_options); 186 181 if (!dev) { 187 182 fprintf(stderr,"Could not init Ffado Streaming layer\n"); trunk/libffado/tests/streaming/teststreaming.c
r554 r739 79 79 dev_options.nb_buffers=3; 80 80 81 dev_options.port=0;82 dev_options.node_id=-1;83 84 81 dev_options.realtime=1; 85 82 dev_options.packetizer_priority=60; 86 83 87 dev_options.directions=0;88 89 84 dev_options.verbose=5; 90 85 … … 92 87 dev_options.snoop_mode=0; 93 88 94 ffado_device_t *dev=ffado_streaming_init( &device_info, dev_options);89 ffado_device_t *dev=ffado_streaming_init(device_info, dev_options); 95 90 96 91 if (!dev) { trunk/libffado/tests/streaming/teststreaming2.c
r554 r739 81 81 dev_options.nb_buffers=3; 82 82 83 dev_options.port=0;84 dev_options.node_id=-1;85 86 83 dev_options.realtime=0; 87 84 dev_options.packetizer_priority=60; 88 89 dev_options.directions=0;90 85 91 86 dev_options.verbose=5; … … 94 89 dev_options.snoop_mode=0; 95 90 96 ffado_device_t *dev=ffado_streaming_init( &device_info, dev_options);91 ffado_device_t *dev=ffado_streaming_init(device_info, dev_options); 97 92 if (!dev) { 98 93 fprintf(stderr,"Could not init Ffado Streaming layer\n"); trunk/libffado/tests/streaming/teststreaming3.c
r554 r739 85 85 dev_options.nb_buffers=3; 86 86 87 dev_options.port=0;88 dev_options.node_id=-1;89 90 87 dev_options.realtime=1; 91 88 dev_options.packetizer_priority=70; 92 93 dev_options.directions=0;94 89 95 90 dev_options.verbose=5; … … 98 93 dev_options.snoop_mode=0; 99 94 100 ffado_device_t *dev=ffado_streaming_init( &device_info, dev_options);95 ffado_device_t *dev=ffado_streaming_init(device_info, dev_options); 101 96 102 97 if (!dev) { trunk/libffado/tests/test-ffado.cpp
r734 r739 207 207 m_deviceManager->setVerboseLevel(arguments.verbose); 208 208 } 209 if ( !m_deviceManager->initialize( arguments.port) ) {209 if ( !m_deviceManager->initialize() ) { 210 210 fprintf( stderr, "Could not initialize device manager\n" ); 211 211 delete m_deviceManager; … … 238 238 m_deviceManager->setVerboseLevel(arguments.verbose); 239 239 } 240 if ( !m_deviceManager->initialize( arguments.port) ) {240 if ( !m_deviceManager->initialize() ) { 241 241 fprintf( stderr, "Could not initialize device manager\n" ); 242 242 delete m_deviceManager; … … 295 295 m_deviceManager->setVerboseLevel(arguments.verbose); 296 296 } 297 if ( !m_deviceManager->initialize( arguments.port) ) {297 if ( !m_deviceManager->initialize() ) { 298 298 fprintf( stderr, "Could not initialize device manager\n" ); 299 299 delete m_deviceManager;