Changeset 1524
- Timestamp:
- 03/24/09 15:12:35 (15 years ago)
- Files:
-
- branches/libffado-2.0/configuration (modified) (2 diffs)
- branches/libffado-2.0/SConstruct (modified) (1 diff)
- branches/libffado-2.0/src/bebob/focusrite/focusrite_generic.cpp (modified) (4 diffs)
- branches/libffado-2.0/src/bebob/focusrite/focusrite_generic.h (modified) (2 diffs)
- branches/libffado-2.0/src/bebob/focusrite/focusrite_saffire.cpp (modified) (2 diffs)
- branches/libffado-2.0/src/devicemanager.cpp (modified) (3 diffs)
- branches/libffado-2.0/src/libieee1394/CycleTimerHelper.cpp (modified) (1 diff)
- branches/libffado-2.0/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.cpp (modified) (2 diffs)
- branches/libffado-2.0/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.h (modified) (1 diff)
- branches/libffado-2.0/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.h (modified) (1 diff)
- branches/libffado-2.0/src/libutil/Configuration.cpp (modified) (3 diffs)
- branches/libffado-2.0/src/libutil/Configuration.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/libffado-2.0/configuration
r1497 r1524 106 106 driver = 1; # BeBoB 107 107 mixer = "SaffireMixer"; 108 cmd_interval_time = 10000; 108 109 }, 109 110 { … … 231 232 modelname = "Onyx 1200F"; 232 233 driver = 2; 234 }, 235 { 236 vendorid = 0x00001260; 237 modelid = 0x00001000; 238 vendorname = "Stanton DJ"; 239 modelname = "SCS.1m"; 240 driver = 3; 233 241 }, 234 242 { # added by arnonym from ffado-mixers list branches/libffado-2.0/SConstruct
r1513 r1524 53 53 BoolOption( "DEBUG", """\ 54 54 Toggle debug-build. DEBUG means \"-g -Wall\" and more, otherwise we will use 55 \"-O2\" to optimi se.""", True ),55 \"-O2\" to optimize.""", True ), 56 56 BoolOption( "PROFILE", "Build with symbols and other profiling info", False ), 57 57 PathOption( "PREFIX", "The prefix where ffado will be installed to.", "/usr/local", PathOption.PathAccept ), branches/libffado-2.0/src/bebob/focusrite/focusrite_generic.cpp
r1371 r1524 26 26 27 27 #include "libutil/ByteSwap.h" 28 #include "libutil/SystemTimeSource.h"29 28 30 29 namespace BeBoB { … … 33 32 FocusriteDevice::FocusriteDevice( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom )) 34 33 : BeBoB::AvDevice( d, configRom) 34 , m_cmd_time_interval( 0 ) 35 , m_earliest_next_cmd_time( 0 ) 35 36 { 36 37 debugOutput( DEBUG_LEVEL_VERBOSE, "Created BeBoB::Focusrite::FocusriteDevice (NodeID %d)\n", … … 61 62 bool use_avc = false; 62 63 if(!getOption("useAvcForParameters", use_avc)) { 63 debugWarning("Could not retrieve useAvcForParameters parameter, defauling to false\n"); 64 } 64 debugWarning("Could not retrieve useAvcForParameters parameter, defaulting to false\n"); 65 } 66 67 // rate control 68 ffado_microsecs_t now = Util::SystemTimeSource::getCurrentTimeAsUsecs(); 69 if(m_cmd_time_interval && (m_earliest_next_cmd_time > now)) { 70 ffado_microsecs_t wait = m_earliest_next_cmd_time - now; 71 debugOutput( DEBUG_LEVEL_VERBOSE, "Rate control... %llu\n", wait ); 72 Util::SystemTimeSource::SleepUsecRelative(wait); 73 } 74 m_earliest_next_cmd_time = now + m_cmd_time_interval; 75 65 76 if (use_avc) { 66 77 return setSpecificValueAvc(id, v); … … 76 87 bool use_avc = false; 77 88 if(!getOption("useAvcForParameters", use_avc)) { 78 debugWarning("Could not retrieve useAvcForParameters parameter, defauling to false\n"); 79 } 89 debugWarning("Could not retrieve useAvcForParameters parameter, defaulting to false\n"); 90 } 91 92 // rate control 93 ffado_microsecs_t now = Util::SystemTimeSource::getCurrentTimeAsUsecs(); 94 if(m_cmd_time_interval && (m_earliest_next_cmd_time > now)) { 95 ffado_microsecs_t wait = m_earliest_next_cmd_time - now; 96 debugOutput( DEBUG_LEVEL_VERBOSE, "Rate control... %llu\n", wait ); 97 Util::SystemTimeSource::SleepUsecRelative(wait); 98 } 99 m_earliest_next_cmd_time = now + m_cmd_time_interval; 100 101 // execute 80 102 if (use_avc) { 81 103 retval = getSpecificValueAvc(id, v); branches/libffado-2.0/src/bebob/focusrite/focusrite_generic.h
r1370 r1524 31 31 #include "libcontrol/BasicElements.h" 32 32 #include "libcontrol/MatrixMixer.h" 33 34 #include "libutil/SystemTimeSource.h" 33 35 34 36 #define FR_PARAM_SPACE_START 0x000100000000LL … … 236 238 bool setSpecificValueARM(uint32_t id, uint32_t v); 237 239 bool getSpecificValueARM(uint32_t id, uint32_t *v); 240 241 protected: 242 ffado_microsecs_t m_cmd_time_interval; 243 ffado_microsecs_t m_earliest_next_cmd_time; 238 244 }; 239 245 branches/libffado-2.0/src/bebob/focusrite/focusrite_saffire.cpp
r1413 r1524 25 25 #include "focusrite_cmd.h" 26 26 27 #include "devicemanager.h" 28 27 29 namespace BeBoB { 28 30 namespace Focusrite { … … 39 41 } else { 40 42 m_isSaffireLE = true; 43 } 44 45 // find the configured delay time for this device 46 Util::Configuration &config = d.getConfiguration(); 47 int delaytime = 0; 48 if(config.getValueForDeviceSetting(getConfigRom().getNodeVendorId(), getConfigRom().getModelId(), "cmd_interval_time", delaytime)) { 49 m_cmd_time_interval = delaytime; 50 debugOutput( DEBUG_LEVEL_VERBOSE, "Setting command interval time to %llu\n", 51 m_cmd_time_interval ); 52 } else { 53 m_cmd_time_interval = 10000; 54 debugOutput( DEBUG_LEVEL_VERBOSE, "No command interval time setting found, defaulting to %llu\n", 55 m_cmd_time_interval ); 41 56 } 42 57 } branches/libffado-2.0/src/devicemanager.cpp
r1452 r1524 948 948 if(dev) { 949 949 debugOutput( DEBUG_LEVEL_VERBOSE, " found supported device...\n" ); 950 dev->setVerboseLevel(getDebugLevel()); 950 951 return dev; 951 952 } … … 955 956 if(dev) { 956 957 debugOutput( DEBUG_LEVEL_VERBOSE, " found generic support for device...\n" ); 958 dev->setVerboseLevel(getDebugLevel()); 957 959 return dev; 958 960 } 959 961 debugOutput( DEBUG_LEVEL_VERBOSE, " device not supported...\n" ); 960 return 0;962 return NULL; 961 963 } 962 964 … … 964 966 DeviceManager::getSlaveDriver( std::auto_ptr<ConfigRom>( configRom ) ) 965 967 { 966 return 0;968 return NULL; 967 969 } 968 970 branches/libffado-2.0/src/libieee1394/CycleTimerHelper.cpp
r1466 r1524 455 455 // i.e. DLL error signal 456 456 int64_t diff_ticks_corr; 457 if (ticks_late > 0) {457 if (ticks_late >= 0) { 458 458 diff_ticks_corr = diff_ticks - ticks_late; 459 459 debugOutputExtreme(DEBUG_LEVEL_ULTRA_VERBOSE, branches/libffado-2.0/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.cpp
r1448 r1524 181 181 debugOutputExtreme( DEBUG_LEVEL_VERY_VERBOSE, 182 182 "(%p)->processReadBlock(%u, %u)\n", 183 this, nevents,offset);183 this, nevents, offset); 184 184 185 185 // update the variable parts of the cache … … 366 366 for (i = 0; i < m_nb_midi_ports; i++) { 367 367 struct _MIDI_port_cache &p = m_midi_ports.at(i); 368 if (p.buffer && p.enabled) { 368 if (p.buffer && p.enabled) { 369 369 uint32_t *buffer = (quadlet_t *)(p.buffer); 370 370 buffer += offset; 371 372 371 for (j = p.location;j < nevents; j += 8) { 373 372 target_event = (quadlet_t *) (data + ((j * m_dimension) + p.position)); 374 sample_int=CondSwapFromBus32(*target_event); 373 sample_int = CondSwapFromBus32(*target_event); 374 375 375 // FIXME: this assumes that 2X and 3X speed isn't used, 376 376 // because only the 1X slot is put into the ringbuffer 377 if(IEC61883_AM824_ GET_LABEL(sample_int) != IEC61883_AM824_LABEL_MIDI_NO_DATA) {377 if(IEC61883_AM824_HAS_LABEL(sample_int, IEC61883_AM824_LABEL_MIDI_1X)) { 378 378 sample_int=(sample_int >> 16) & 0x000000FF; 379 379 sample_int |= 0x01000000; // flag that there is a midi event present 380 380 *buffer = sample_int; 381 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "Received midi byte %08X on port %p index %d\n", sample_int, p, j-p.location); 381 } else if(IEC61883_AM824_HAS_LABEL(sample_int, IEC61883_AM824_LABEL_MIDI_2X) 382 || IEC61883_AM824_HAS_LABEL(sample_int, IEC61883_AM824_LABEL_MIDI_3X) ) { 383 debugOutput(DEBUG_LEVEL_VERBOSE, "Midi mode %X not supported.\n", IEC61883_AM824_GET_LABEL(sample_int)); 382 384 } else { 383 385 // make sure no event is received branches/libffado-2.0/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.h
r1419 r1524 51 51 #define IEC61883_AM824_LABEL_MIDI_2X 0x82 52 52 #define IEC61883_AM824_LABEL_MIDI_3X 0x83 53 54 #define IEC61883_AM824_HAS_LABEL(x, lbl) (((x) & 0xFF000000) == (((quadlet_t)(lbl))<<24)) 53 55 54 56 namespace Streaming { branches/libffado-2.0/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.h
r1419 r1524 51 51 #define IEC61883_AM824_LABEL_MIDI_2X 0x82 52 52 #define IEC61883_AM824_LABEL_MIDI_3X 0x83 53 54 #define IEC61883_AM824_HAS_LABEL(x, lbl) (((x) & 0xFF000000) == (((quadlet_t)(lbl))<<24)) 53 55 54 56 namespace Streaming { branches/libffado-2.0/src/libutil/Configuration.cpp
r1405 r1524 289 289 } 290 290 291 292 Configuration::VendorModelEntry 293 Configuration::findDeviceVME( unsigned int vendor_id, unsigned model_id ) 291 bool 292 Configuration::getValueForDeviceSetting(unsigned int vendor_id, unsigned model_id, std::string setting, int32_t &ref) 293 { 294 libconfig::Setting *s = getDeviceSetting( vendor_id, model_id ); 295 if(s) { 296 try { 297 return s->lookupValue(setting, ref); 298 } catch (...) { 299 debugOutput(DEBUG_LEVEL_VERBOSE, "Setting %s not found\n", setting.c_str()); 300 return false; 301 } 302 } else { 303 debugOutput(DEBUG_LEVEL_VERBOSE, "device %X/%X not found\n", vendor_id, model_id); 304 return false; 305 } 306 } 307 308 bool 309 Configuration::getValueForDeviceSetting(unsigned int vendor_id, unsigned model_id, std::string setting, int64_t &ref) 310 { 311 libconfig::Setting *s = getDeviceSetting( vendor_id, model_id ); 312 if(s) { 313 try { 314 return s->lookupValue(setting, ref); 315 } catch (...) { 316 debugOutput(DEBUG_LEVEL_VERBOSE, "Setting %s not found\n", setting.c_str()); 317 return false; 318 } 319 } else { 320 debugOutput(DEBUG_LEVEL_VERBOSE, "device %X/%X not found\n", vendor_id, model_id); 321 return false; 322 } 323 } 324 325 libconfig::Setting * 326 Configuration::getDeviceSetting( unsigned int vendor_id, unsigned model_id ) 294 327 { 295 328 for ( std::vector<ConfigFile *>::iterator it = m_ConfigFiles.begin(); … … 309 342 uint32_t mid = modelid; 310 343 if (vendor_id == vid && model_id == mid) { 311 struct VendorModelEntry vme;312 vme.vendor_id = vendorid;313 vme.model_id = modelid;314 315 const char *tmp = s["vendorname"];316 vme.vendor_name = tmp;317 tmp = s["modelname"];318 vme.model_name = tmp;319 vme.driver = s["driver"];320 344 debugOutput(DEBUG_LEVEL_VERBOSE, 321 345 " device VME for %X:%x found in %s\n", 322 346 vendor_id, model_id, c->getName().c_str()); 323 347 c->showSetting(s); 324 return vme;348 return &s; 325 349 } 326 350 } catch (...) { … … 330 354 } catch (...) { 331 355 debugOutput(DEBUG_LEVEL_VERBOSE, " %s has no device definitions\n", c->getName().c_str()); 356 } 357 } 358 return NULL; 359 } 360 361 362 363 Configuration::VendorModelEntry 364 Configuration::findDeviceVME( unsigned int vendor_id, unsigned model_id ) 365 { 366 367 // FIXME: clean this pointer/reference mess please 368 Setting *ps = getDeviceSetting(vendor_id, model_id); 369 370 if(ps) { 371 Setting &s = *ps; 372 try { 373 Setting &vendorid = s["vendorid"]; 374 Setting &modelid = s["modelid"]; 375 uint32_t vid = vendorid; 376 uint32_t mid = modelid; 377 if (vendor_id == vid && model_id == mid) { 378 struct VendorModelEntry vme; 379 vme.vendor_id = vendorid; 380 vme.model_id = modelid; 381 382 const char *tmp = s["vendorname"]; 383 vme.vendor_name = tmp; 384 tmp = s["modelname"]; 385 vme.model_name = tmp; 386 vme.driver = s["driver"]; 387 return vme; 388 } else { 389 debugError("BUG: vendor/model found but not found?\n"); 390 } 391 } catch (...) { 392 debugWarning("Bogus format\n"); 332 393 } 333 394 } branches/libffado-2.0/src/libutil/Configuration.h
r1373 r1524 127 127 bool getValueForSetting(std::string path, int64_t &ref); 128 128 129 /** 130 * @brief retrieves a setting for a given device 131 * 132 * the value in the ref parameter is not changed if 133 * the function returns false. 134 * 135 * @param vendor_id vendor id for the device 136 * @param model_id model id for the device 137 * @param setting name of the setting 138 * @param ref reference to the integer that will hold the value. 139 * @return true if successful, false if not 140 */ 141 bool getValueForDeviceSetting(unsigned int vendor_id, unsigned model_id, std::string setting, int32_t &ref); 142 bool getValueForDeviceSetting(unsigned int vendor_id, unsigned model_id, std::string setting, int64_t &ref); 143 129 144 virtual void setVerboseLevel(int l) {setDebugLevel(l);}; 130 145 virtual void show(); … … 132 147 private: 133 148 libconfig::Setting *getSetting( std::string path ); 149 libconfig::Setting *getDeviceSetting( unsigned int vendor_id, unsigned model_id ); 134 150 135 151 int findFileName(std::string s);