Changeset 992
- Timestamp:
- 04/06/08 16:19:31 (15 years ago)
- Files:
-
- trunk/libffado/src/motu/motu_avdevice.cpp (modified) (8 diffs)
- trunk/libffado/src/motu/motu_avdevice.h (modified) (3 diffs)
- trunk/libffado/src/motu/motu_controls.cpp (added)
- trunk/libffado/src/motu/motu_controls.h (added)
- trunk/libffado/src/SConscript (modified) (1 diff)
- trunk/libffado/support/dbus/control-interface.xml (modified) (1 diff)
- trunk/libffado/support/dbus/controlserver.cpp (modified) (1 diff)
- trunk/libffado/support/dbus/controlserver.h (modified) (1 diff)
- trunk/libffado/support/mixer/ffadomixer.in (modified) (5 diffs)
- trunk/libffado/support/mixer/mixer_motu.py (added)
- trunk/libffado/support/mixer/mixer_motu.ui (added)
- trunk/libffado/support/mixer/SConscript (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/motu/motu_avdevice.cpp
r984 r992 38 38 #include "libutil/DelayLockedLoop.h" 39 39 #include "libutil/Time.h" 40 41 #include "libcontrol/BasicElements.h" 40 42 41 43 #include <string> … … 245 247 }; 246 248 249 // Mixer registers 250 const MixerCtrl MixerCtrls_Traveler[] = { 251 {"Mix1/Ana1_", "Mix 1 analog 1 ", "", MOTU_CTRL_STD_CHANNEL, 0x4000, }, 252 {"Mix1/Ana2_", "Mix 1 analog 2 ", "", MOTU_CTRL_STD_CHANNEL, 0x4004, }, 253 {"Mix1/Ana3_", "Mix 1 analog 3 ", "", MOTU_CTRL_STD_CHANNEL, 0x4008, }, 254 {"Mix1/Ana4_", "Mix 1 analog 4 ", "", MOTU_CTRL_STD_CHANNEL, 0x400c, }, 255 {"Mix1/Ana5_", "Mix 1 analog 5 ", "", MOTU_CTRL_STD_CHANNEL, 0x4010, }, 256 {"Mix1/Ana6_", "Mix 1 analog 6 ", "", MOTU_CTRL_STD_CHANNEL, 0x4014, }, 257 {"Mix1/Ana7_", "Mix 1 analog 7 ", "", MOTU_CTRL_STD_CHANNEL, 0x4018, }, 258 {"Mix1/Ana8_", "Mix 1 analog 8 ", "", MOTU_CTRL_STD_CHANNEL, 0x401c, }, 259 }; 260 261 // For convenience during initial testing, just make the 828MkII and 896HD 262 // use the Traveler's mixer definition. Separate definitions for these 263 // models will come once the final mixer structure is in place. For now 264 // it's in a state of flux and subject to significant change. 265 #define MixerCtrls_828MkII MixerCtrls_Traveler 266 #define MixerCtrls_896HD MixerCtrls_Traveler 267 247 268 /* The order of DevicesProperty entries must match the numeric order of the 248 269 * MOTU model enumeration (EMotuModel). 249 270 */ 250 271 const DevicePropertyEntry DevicesProperty[] = { 251 // { Ports_map, sizeof( Ports_map ), MaxSR },252 { Ports_828MKII, sizeof( Ports_828MKII ), 96000},253 { Ports_TRAVELER, sizeof( Ports_TRAVELER ), 192000},254 { Ports_ULTRALITE, sizeof( Ports_ULTRALITE ), 96000 },255 { Ports_8PRE, sizeof( Ports_8PRE ), 96000 },256 { Ports_828MKI, sizeof( Ports_828MKI ), 48000 },257 { Ports_896HD, sizeof( Ports_896HD ), 192000},272 // { Ports_map, N_ELEMENTS( Ports_map ), MaxSR }, 273 { Ports_828MKII, N_ELEMENTS( Ports_828MKII ), 96000, MixerCtrls_828MkII, N_ELEMENTS(MixerCtrls_828MkII), }, 274 { Ports_TRAVELER, N_ELEMENTS( Ports_TRAVELER ), 192000, MixerCtrls_Traveler, N_ELEMENTS(MixerCtrls_Traveler), }, 275 { Ports_ULTRALITE, N_ELEMENTS( Ports_ULTRALITE ), 96000 }, 276 { Ports_8PRE, N_ELEMENTS( Ports_8PRE ), 96000 }, 277 { Ports_828MKI, N_ELEMENTS( Ports_828MKI ), 48000 }, 278 { Ports_896HD, N_ELEMENTS( Ports_896HD ), 192000, MixerCtrls_896HD, N_ELEMENTS(MixerCtrls_896HD), }, 258 279 }; 259 280 … … 267 288 , m_receiveProcessor ( 0 ) 268 289 , m_transmitProcessor ( 0 ) 269 290 , m_MixerContainer ( NULL ) 291 , m_ControlContainer ( NULL ) 270 292 { 271 293 debugOutput( DEBUG_LEVEL_VERBOSE, "Created Motu::MotuDevice (NodeID %d)\n", … … 285 307 debugOutput(DEBUG_LEVEL_VERBOSE, "Could not free send iso channel %d\n", m_iso_send_channel); 286 308 } 309 310 destroyMixer(); 311 } 312 313 bool 314 MotuDevice::buildMixer() { 315 unsigned int i; 316 bool result = true; 317 debugOutput(DEBUG_LEVEL_VERBOSE, "Building a MOTU mixer...\n"); 318 319 destroyMixer(); 320 321 // create the mixer object container 322 m_MixerContainer = new Control::Container("Mixer"); 323 if (!m_MixerContainer) { 324 debugError("Could not create mixer container...\n"); 325 return false; 326 } 327 328 // Mixer controls get added here 329 for (i=0; i<DevicesProperty[m_motu_model-1].n_mixer_ctrls; i++) { 330 unsigned int type = DevicesProperty[m_motu_model-1].mixer_ctrl[i].type; 331 char name[100]; 332 char label[100]; 333 if (type & MOTU_CTRL_CHANNEL_FADER) { 334 snprintf(name, 100, "%s%s", DevicesProperty[m_motu_model-1].mixer_ctrl[i].name, "fader"); 335 snprintf(label,100, "%s%s", DevicesProperty[m_motu_model-1].mixer_ctrl[i].label,"fader"); 336 result &= m_MixerContainer->addElement( 337 new ChannelFader(*this, 338 DevicesProperty[m_motu_model-1].mixer_ctrl[i].dev_register, 339 name, label, 340 DevicesProperty[m_motu_model-1].mixer_ctrl[i].desc)); 341 type &= ~MOTU_CTRL_CHANNEL_FADER; 342 } 343 if (type & MOTU_CTRL_CHANNEL_PAN) { 344 snprintf(name, 100, "%s%s", DevicesProperty[m_motu_model-1].mixer_ctrl[i].name, "pan"); 345 snprintf(label,100, "%s%s", DevicesProperty[m_motu_model-1].mixer_ctrl[i].label,"pan"); 346 result &= m_MixerContainer->addElement( 347 new ChannelPan(*this, 348 DevicesProperty[m_motu_model-1].mixer_ctrl[i].dev_register, 349 name, label, 350 DevicesProperty[m_motu_model-1].mixer_ctrl[i].desc)); 351 type &= ~MOTU_CTRL_CHANNEL_PAN; 352 } 353 if (type) { 354 debugOutput(DEBUG_LEVEL_VERBOSE, "Unknown mixer control type flag bits 0x%08x\n", DevicesProperty[m_motu_model-1].mixer_ctrl[i].type); 355 } 356 } 357 358 if (!addElement(m_MixerContainer)) { 359 debugWarning("Could not register mixer to device\n"); 360 // clean up 361 destroyMixer(); 362 return false; 363 } 364 365 // Special controls 366 m_ControlContainer = new Control::Container("Control"); 367 if (!m_ControlContainer) { 368 debugError("Could not create control container...\n"); 369 return false; 370 } 371 372 // Special controls get added here 373 374 if (!result) { 375 debugWarning("One or more device control elements could not be created."); 376 // clean up those that couldn't be created 377 destroyMixer(); 378 return false; 379 } 380 if (!addElement(m_ControlContainer)) { 381 debugWarning("Could not register controls to device\n"); 382 // clean up 383 destroyMixer(); 384 return false; 385 } 386 387 return true; 388 } 389 390 391 bool 392 MotuDevice::destroyMixer() { 393 debugOutput(DEBUG_LEVEL_VERBOSE, "destroy mixer...\n"); 394 395 if (m_MixerContainer == NULL) { 396 debugOutput(DEBUG_LEVEL_VERBOSE, "no mixer to destroy...\n"); 397 return true; 398 } 399 400 if (!deleteElement(m_MixerContainer)) { 401 debugError("Mixer present but not registered to the avdevice\n"); 402 return false; 403 } 404 405 // remove and delete (as in free) child control elements 406 m_MixerContainer->clearElements(true); 407 delete m_MixerContainer; 408 m_MixerContainer = NULL; 409 410 // remove control container 411 if (m_ControlContainer == NULL) { 412 debugOutput(DEBUG_LEVEL_VERBOSE, "no controls to destroy...\n"); 413 return true; 414 } 415 416 if (!deleteElement(m_ControlContainer)) { 417 debugError("Controls present but not registered to the avdevice\n"); 418 return false; 419 } 420 421 // remove and delete (as in free) child control elements 422 m_ControlContainer->clearElements(true); 423 delete m_ControlContainer; 424 m_ControlContainer = NULL; 425 426 return true; 287 427 } 288 428 … … 337 477 } 338 478 339 if (m_model != NULL) { 340 debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", 341 m_model->vendor_name, m_model->model_name); 342 return true; 343 } 344 345 return false; 479 if (m_model == NULL) { 480 return false; 481 } 482 483 debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", 484 m_model->vendor_name, m_model->model_name); 485 486 if (!buildMixer()) { 487 debugWarning("Could not build mixer\n"); 488 } 489 490 return true; 346 491 } 347 492 … … 894 1039 flags |= MOTUFW_PA_RATE_1x; 895 1040 896 for (i=0; i < ( DevicesProperty[m_motu_model-1].PortsListLength /sizeof( PortEntry ) ); i++) {897 if (( DevicesProperty[m_motu_model-1]. PortsList[i].port_dir & dir ) &&898 ( DevicesProperty[m_motu_model-1]. PortsList[i].port_flags & MOTUFW_PA_RATE_MASK & flags ) &&899 ( DevicesProperty[m_motu_model-1]. PortsList[i].port_flags & MOTUFW_PA_OPTICAL_MASK & flags )) {1041 for (i=0; i < DevicesProperty[m_motu_model-1].n_port_entries; i++) { 1042 if (( DevicesProperty[m_motu_model-1].port_entry[i].port_dir & dir ) && 1043 ( DevicesProperty[m_motu_model-1].port_entry[i].port_flags & MOTUFW_PA_RATE_MASK & flags ) && 1044 ( DevicesProperty[m_motu_model-1].port_entry[i].port_flags & MOTUFW_PA_OPTICAL_MASK & flags )) { 900 1045 size += 3; 901 1046 } … … 956 1101 std::string id=std::string("dev?"); 957 1102 if(!getOption("id", id)) { 958 debugWarning("Could not retrieve id parameter, defaul ing to 'dev?'\n");1103 debugWarning("Could not retrieve id parameter, defaulting to 'dev?'\n"); 959 1104 } 960 1105 … … 965 1110 } 966 1111 967 for (i=0; i < ( DevicesProperty[m_motu_model-1].PortsListLength /sizeof( PortEntry ) ); i++) {968 if (( DevicesProperty[m_motu_model-1]. PortsList[i].port_dir & dir ) &&969 ( DevicesProperty[m_motu_model-1]. PortsList[i].port_flags & MOTUFW_PA_RATE_MASK & flags ) &&970 ( DevicesProperty[m_motu_model-1]. PortsList[i].port_flags & MOTUFW_PA_OPTICAL_MASK & flags )) {1112 for (i=0; i < DevicesProperty[m_motu_model-1].n_port_entries; i++) { 1113 if (( DevicesProperty[m_motu_model-1].port_entry[i].port_dir & dir ) && 1114 ( DevicesProperty[m_motu_model-1].port_entry[i].port_flags & MOTUFW_PA_RATE_MASK & flags ) && 1115 ( DevicesProperty[m_motu_model-1].port_entry[i].port_flags & MOTUFW_PA_OPTICAL_MASK & flags )) { 971 1116 asprintf(&buff,"%s_%s_%s" , id.c_str(), mode_str, 972 DevicesProperty[m_motu_model-1]. PortsList[i].port_name);973 if (!addPort(s_processor, buff, direction, DevicesProperty[m_motu_model-1]. PortsList[i].port_offset, 0))1117 DevicesProperty[m_motu_model-1].port_entry[i].port_name); 1118 if (!addPort(s_processor, buff, direction, DevicesProperty[m_motu_model-1].port_entry[i].port_offset, 0)) 974 1119 return false; 975 1120 } trunk/libffado/src/motu/motu_avdevice.h
r981 r992 34 34 #include "libstreaming/motu/MotuTransmitStreamProcessor.h" 35 35 36 #define MOTUFW_BASE_ADDR 0xfffff0000000ULL 37 38 #define MOTUFW_RATE_BASE_44100 (0<<3) 39 #define MOTUFW_RATE_BASE_48000 (1<<3) 40 #define MOTUFW_RATE_MULTIPLIER_1X (0<<4) 41 #define MOTUFW_RATE_MULTIPLIER_2X (1<<4) 42 #define MOTUFW_RATE_MULTIPLIER_4X (2<<4) 43 #define MOTUFW_RATE_BASE_MASK (0x00000008) 44 #define MOTUFW_RATE_MULTIPLIER_MASK (0x00000030) 36 #include "motu_controls.h" 37 38 #define MOTUFW_BASE_ADDR 0xfffff0000000ULL 39 40 #define MOTUFW_RATE_BASE_44100 (0<<3) 41 #define MOTUFW_RATE_BASE_48000 (1<<3) 42 #define MOTUFW_RATE_MULTIPLIER_1X (0<<4) 43 #define MOTUFW_RATE_MULTIPLIER_2X (1<<4) 44 #define MOTUFW_RATE_MULTIPLIER_4X (2<<4) 45 #define MOTUFW_RATE_BASE_MASK (0x00000008) 46 #define MOTUFW_RATE_MULTIPLIER_MASK (0x00000030) 45 47 46 48 #define MOTUFW_OPTICAL_MODE_OFF 0x00 47 #define MOTUFW_OPTICAL_MODE_ADAT 0x0149 #define MOTUFW_OPTICAL_MODE_ADAT 0x01 48 50 #define MOTUFW_OPTICAL_MODE_TOSLINK 0x02 49 51 #define MOTUFW_OPTICAL_IN_MODE_MASK (0x00000300) 50 #define MOTUFW_OPTICAL_OUT_MODE_MASK 51 #define MOTUFW_OPTICAL_MODE_MASK (MOTUFW_OPTICAL_IN_MODE_MASK|MOTUFW_OPTICAL_MODE_MASK)52 53 #define MOTUFW_CLKSRC_MASK 0x0000000754 #define MOTUFW_CLKSRC_INTERNAL 055 #define MOTUFW_CLKSRC_ADAT_OPTICAL 152 #define MOTUFW_OPTICAL_OUT_MODE_MASK (0x00000c00) 53 #define MOTUFW_OPTICAL_MODE_MASK (MOTUFW_OPTICAL_IN_MODE_MASK|MOTUFW_OPTICAL_MODE_MASK) 54 55 #define MOTUFW_CLKSRC_MASK 0x00000007 56 #define MOTUFW_CLKSRC_INTERNAL 0 57 #define MOTUFW_CLKSRC_ADAT_OPTICAL 1 56 58 #define MOTUFW_CLKSRC_SPDIF_TOSLINK 2 57 #define MOTUFW_CLKSRC_SMTPE 359 #define MOTUFW_CLKSRC_SMTPE 3 58 60 #define MOTUFW_CLKSRC_WORDCLOCK 4 59 61 #define MOTUFW_CLKSRC_ADAT_9PIN 5 60 #define MOTUFW_CLKSRC_AES_EBU 761 62 #define MOTUFW_DIR_IN 63 #define MOTUFW_DIR_OUT 64 #define MOTUFW_DIR_INOUT 62 #define MOTUFW_CLKSRC_AES_EBU 7 63 64 #define MOTUFW_DIR_IN 1 65 #define MOTUFW_DIR_OUT 2 66 #define MOTUFW_DIR_INOUT (MOTUFW_DIR_IN | MOTUFW_DIR_OUT) 65 67 66 68 /* Device registers */ 67 #define MOTUFW_REG_ISOCTRL 0x0b0068 #define MOTUFW_REG_OPTICAL_CTRL 69 #define MOTUFW_REG_ISOCTRL 0x0b00 70 #define MOTUFW_REG_OPTICAL_CTRL 0x0b10 69 71 #define MOTUFW_REG_CLK_CTRL 0x0b14 70 #define MOTUFW_REG_ROUTE_PORT_CONF 71 #define MOTUFW_REG_CLKSRC_NAME0 72 #define MOTUFW_REG_ROUTE_PORT_CONF 0x0c04 73 #define MOTUFW_REG_CLKSRC_NAME0 0x0c60 72 74 73 75 /* Port Active Flags (ports declaration) */ … … 117 119 }; 118 120 121 struct MixerCtrl { 122 const char *name, *label, *desc; 123 unsigned int type; 124 unsigned int dev_register; 125 }; 126 119 127 struct DevicePropertyEntry { 120 const PortEntry* PortsList; 121 int PortsListLength; 122 int MaxSampleRate; 128 const PortEntry* port_entry; 129 unsigned int n_port_entries; 130 signed int MaxSampleRate; 131 const MixerCtrl *mixer_ctrl; 132 unsigned int n_mixer_ctrls; 123 133 // Others features can be added here like MIDI port presence. 124 134 }; 125 135 136 /* Macro to calculate the size of an array */ 137 #define N_ELEMENTS(_array) (sizeof(_array) / sizeof((_array)[0])) 138 126 139 class MotuDevice : public FFADODevice { 140 // Declare mixer controls as friends so they can access the register 141 // transaction functions. 142 friend class ChannelFader; 143 friend class ChannelPan; 127 144 public: 128 145 129 146 MotuDevice( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom ) ); 130 147 virtual ~MotuDevice(); 148 149 virtual bool buildMixer(); 150 virtual bool destroyMixer(); 131 151 132 152 static bool probe( ConfigRom& configRom ); … … 182 202 signed int WriteRegister(unsigned int reg, quadlet_t data); 183 203 204 Control::Container *m_MixerContainer; 205 Control::Container *m_ControlContainer; 184 206 }; 185 207 trunk/libffado/src/SConscript
r967 r992 144 144 motu_source = env.Split( '\ 145 145 motu/motu_avdevice.cpp \ 146 motu/motu_controls.cpp \ 146 147 libstreaming/motu/MotuPort.cpp \ 147 148 libstreaming/motu/MotuPortInfo.cpp \ trunk/libffado/support/dbus/control-interface.xml
r973 r992 42 42 <method name="getModelId"> 43 43 <arg type="i" name="modelid" direction="out"/> 44 </method> 45 <method name="getUnitVersion"> 46 <arg type="i" name="unitversion" direction="out"/> 44 47 </method> 45 48 </interface> trunk/libffado/support/dbus/controlserver.cpp
r973 r992 495 495 } 496 496 497 DBus::Int32 498 ConfigRomX::getUnitVersion( ) 499 { 500 return m_Slave.getUnitVersion(); 501 } 502 497 503 // --- MatrixMixer 498 504 trunk/libffado/support/dbus/controlserver.h
r973 r992 211 211 DBus::Int32 getVendorId( ); 212 212 DBus::Int32 getModelId( ); 213 DBus::Int32 getUnitVersion( ); 213 214 214 215 private: trunk/libffado/support/mixer/ffadomixer.in
r973 r992 42 42 from mixer_mackie_generic import * 43 43 from mixer_quatafire import * 44 from mixer_motu import * 44 45 45 46 SupportedDevices=[ … … 55 56 [(0x00000f, 0x00010067),'MackieGenericControl'], 56 57 [(0x000f1b, 0x00010064),'QuataFireMixer'], 58 [(0x0001f2, 0x00000000),'MotuMixer'], 57 59 ] 58 60 … … 175 177 def getModelId(self): 176 178 return self.iface.getModelId() 179 def getUnitVersion(self): 180 return self.iface.getUnitVersion() 177 181 178 182 class ClockSelectInterface: … … 243 247 vendorId = cfgrom.getVendorId() 244 248 modelId = cfgrom.getModelId() 249 unitVersion = cfgrom.getUnitVersion() 245 250 GUID = cfgrom.getGUID() 246 251 print " Found (%s, %X, %X) %s %s" % (str(GUID), vendorId, modelId, cfgrom.getVendorName(), cfgrom.getModelName()) 247 252 248 253 thisdev=(vendorId, modelId); 254 # The MOTU devices use unitVersion to differentiate models. For the 255 # moment thought we don't need to know precisely which model we're 256 # using. 257 if vendorId == 0x1f2: 258 thisdev=(vendorId, 0x00000000) 249 259 250 260 for dev in SupportedDevices: … … 260 270 else: 261 271 mixerapp = "SaffireLEMixer" 262 263 272 print mixerapp 264 273 exec('forms.append('+mixerapp+'())') trunk/libffado/support/mixer/SConscript
r971 r992 32 32 e['MIXERAPPS'] = [ 'phase24', 'phase88', 'saffirepro', 'saffire', 33 33 'saffirele', 'af2', 'bcoaudio5', 'edirolfa66', 34 'mackie_generic', 'quatafire' ]34 'mackie_generic', 'quatafire', 'motu' ] 35 35 # 36 36 # For the ffadomixer.in