Changeset 1547
- Timestamp:
- 04/27/09 16:13:39 (14 years ago)
- Files:
-
- trunk/libffado/doc/rme_notes/rme_config_register_map.txt (modified) (2 diffs)
- trunk/libffado/src/rme/fireface_def.h (modified) (5 diffs)
- trunk/libffado/src/rme/fireface_hw.cpp (modified) (5 diffs)
- trunk/libffado/src/rme/rme_avdevice.cpp (modified) (9 diffs)
- trunk/libffado/src/rme/rme_avdevice.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/doc/rme_notes/rme_config_register_map.txt
r1537 r1547 2 2 ============================================ 3 3 4 Version: 0. 84 Version: 0.9 5 5 Author: Jonathan Woithe 6 Date: 13April 20096 Date: 27 April 2009 7 7 8 8 … … 118 118 01 = -10 dBV 119 119 10 = hi-gain 120 bits 15-1 4: unknown, set to 0121 bits 1 3-11: Output level control (part 1 of 2: FPGA LED drive):120 bits 15-13: unknown, set to 0 121 bits 12-10: Output level control (part 1 of 2: FPGA LED drive): 122 122 001 = hi-gain 123 123 010 = +4dBU 124 124 100 = -10dBV 125 bit 10: Instrument option: Drive (part 1 of 2: FPGA LED drive) (active = 1) 126 bit 9: unknown, set to 0 125 bit 9: Instrument option: Drive (part 1 of 2: FPGA LED drive) (active = 1) 127 126 bit 8: Phantom power, mic 10 (active = 1) 128 127 bit 7: Phantom power, mic 8 (active = 1) trunk/libffado/src/rme/fireface_def.h
r1542 r1547 41 41 42 42 /* Offsets for registers at fixed offsets from the device's command buffer address */ 43 #define RME_FF_ SRATE_CTRL_OFS(0*4)43 #define RME_FF_DDS_SRATE_OFS (0*4) 44 44 #define RME_FF_CONF1_OFS (5*4) 45 45 #define RME_FF_CONF2_OFS (6*4) … … 52 52 #define RME_FF800_CONF_REG (RME_FF800_CMD_BUFFER + RME_FF_CONF1_OFS) 53 53 54 #define RME_FF400_STREAM_INIT_REG (RME_FF400_CMD_BUFFER) // 3 quadlets wide 54 55 #define RME_FF400_STREAM_SRATE (RME_FF400_CMD_BUFFER) 55 56 #define RME_FF400_STREAM_CONF0 (RME_FF400_CMD_BUFFER+4) 56 57 #define RME_FF400_STREAM_CONF1 (RME_FF400_CMD_BUFFER+8) 57 #define RME_FF800_STREAM_SRATE 0x20000001c 58 #define RME_FF800_STREAM_CONF0 (0x20000001c+4) 59 #define RME_FF800_STREAM_CONF1 (0x20000001c+8) 60 #define RME_FF400_STREAM_START_REG0 (RME_FF400_CMD_BUFFER + 0x001c) 61 #define RME_FF800_STREAM_START_REG0 0x200000028LL 58 #define RME_FF800_STREAM_INIT_REG 0x20000001cLL // 3 quadlets wide 59 #define RME_FF800_STREAM_SRATE 0x20000001cLL 60 #define RME_FF800_STREAM_CONF0 (0x20000001cLL+4) 61 #define RME_FF800_STREAM_CONF1 (0x20000001cLL+8) 62 #define RME_FF400_STREAM_START_REG (RME_FF400_CMD_BUFFER + 0x001c) // 1 quadlet 63 #define RME_FF800_STREAM_START_REG 0x200000028LL // 1 quadlet 62 64 #define RME_FF400_STREAM_END_REG (RME_FF400_CMD_BUFFER + 0x0004) // 4 quadlets wide 63 #define RME_FF800_STREAM_END_REG 0x200000034LL 65 #define RME_FF800_STREAM_END_REG 0x200000034LL // 3 quadlets wide 64 66 65 67 #define RME_FF800_HOST_LED_REG 0x200000324LL … … 117 119 #define CR0_PHANTOM_MIC3 0x00000100 118 120 #define CR0_ZEROBIT09 0x00000200 119 #define CR0_INSTR_DRIVE_FPGA 0x00000400 120 #define CRO_OLEVEL_FPGA_CTRL_0 0x00000800 121 #define CRO_OLEVEL_FPGA_CTRL_1 0x00001000 122 #define CRO_OLEVEL_FPGA_CTRL_2 0x00002000 121 #define CR0_INSTR_DRIVE_FPGA 0x00000200 122 #define CRO_OLEVEL_FPGA_CTRL_0 0x00000400 123 #define CRO_OLEVEL_FPGA_CTRL_1 0x00000800 124 #define CRO_OLEVEL_FPGA_CTRL_2 0x00001000 125 #define CR0_ZEROBIT13 0x00002000 123 126 #define CRO_ZEROBIT14 0x00004000 124 127 #define CRO_ZEROBIT15 0x00008000 … … 200 203 /* Structure used to store device settings in the device flash RAM. This 201 204 * structure mirrors the layout in the Fireface's flash, so it cannot be 202 * altered. 205 * altered. Fields named as unused_* are not utilised at present. 203 206 */ 204 207 typedef struct { … … 261 264 #define FF_DEV_FLASH_MIC_PHANTOM_ON 0x00000001 262 265 266 typedef struct { 267 uint32_t mic_phantom[4]; 268 } FF_software_settings_t; 269 263 270 #endif trunk/libffado/src/rme/fireface_hw.cpp
r1543 r1547 34 34 Device::init_hardware(void) 35 35 { 36 // Initialises the hardware to a known state. This has the side effect 37 // of extinguishing the "Host" LED on the FF400 when done for the first 38 // time after the interface has been powered up. 36 // Initialises the hardware the state defined by the Device's settings 37 // structure. This has the side effect of extinguishing the "Host" LED 38 // on the FF400 when done for the first time after the interface has 39 // been powered up. 39 40 // 40 41 // FIXME: currently this is a minimum skeleton to prove basic … … 43 44 unsigned int conf_reg; 44 45 46 if (settings.mic_phantom[0]) 47 data[0] |= CR0_PHANTOM_MIC0; 48 if (settings.mic_phantom[1]) 49 data[0] |= CR0_PHANTOM_MIC1; 50 if (settings.mic_phantom[2]) 51 data[0] |= CR0_PHANTOM_MIC2; 52 if (settings.mic_phantom[3]) 53 data[0] |= CR0_PHANTOM_MIC3; 54 45 55 /* Input level */ 46 56 switch (1) { 47 57 case 1: // Low gain 48 data[1] |= 0x0; // CPLD49 data[0] |= 0x8; // LED control (used on FF800 only)58 data[1] |= CR1_ILEVEL_CPLD_LOGAIN; // CPLD 59 data[0] |= CR0_ILEVEL_FPGA_LOGAIN; // LED control (used on FF800 only) 50 60 break; 51 61 case 2: // +4 dBu 52 data[1] |= 0x2;53 data[0] |= 0x10;62 data[1] |= CR1_ILEVEL_CPLD_4dBU; 63 data[0] |= CR0_ILEVEL_FPGA_4dBU; 54 64 break; 55 65 case 3: // -10 dBV 56 data[1] |= 0x3;57 data[0] |= 0x20;66 data[1] |= CR1_ILEVEL_CPLD_m10dBV; 67 data[0] |= CR0_ILEVEL_FPGA_m10dBV; 58 68 break; 59 69 } … … 62 72 switch (1) { 63 73 case 1: // High gain 64 data[1] |= 0x10; // CPLD65 data[0] |= 0x400;// LED control (used on FF800 only)74 data[1] |= CR1_OLEVEL_CPLD_HIGAIN; // CPLD 75 data[0] |= CR0_OLEVEL_FPGA_HIGAIN; // LED control (used on FF800 only) 66 76 break; 67 77 case 2: // +4 dBu 68 data[1] |= 0x18;69 data[0] |= 0x800;78 data[1] |= CR1_OLEVEL_CPLD_4dBU; 79 data[0] |= CR0_OLEVEL_FPGA_4dBU; 70 80 break; 71 81 case 3: // -10 dBV 72 data[1] |= 0x8;73 data[0] |= 0x1000;82 data[1] |= CR1_OLEVEL_CPLD_m10dBV; 83 data[0] |= CR0_OLEVEL_FPGA_m10dBV; 74 84 break; 75 85 } … … 82 92 83 93 /* Drop-and-stop is hardwired on */ 84 data[2] |= 0x8000000;94 data[2] |= CR2_DROP_AND_STOP; 85 95 86 96 if (m_rme_model == RME_MODEL_FIREFACE400) { 87 data[2] |= 0x04000000;97 data[2] |= CR2_FF400_BIT; 88 98 } 89 99 … … 95 105 data[2] = 0xc400101f; 96 106 97 //data[0] = 0x10080200; // Phantom off98 //data[0] = 0x11080200; // Phantom on99 //data[1] = 0x1e030000;100 //data[2] = 0x1f1000c4;101 102 107 conf_reg = (m_rme_model==RME_MODEL_FIREFACE800)?RME_FF800_CONF_REG:RME_FF400_CONF_REG; 103 108 if (writeBlock(conf_reg, data, 3) != 0) trunk/libffado/src/rme/rme_avdevice.cpp
r1543 r1547 44 44 45 45 #include <libraw1394/csr.h> 46 47 // Known values for the unit version of RME devices 48 #define RME_UNITVERSION_FF800 0x0001 49 #define RME_UNITVERSION_FF400 0x0002 46 50 47 51 namespace Rme { … … 73 77 #endif 74 78 75 // Template for a RmeDevice object method which intelligently returns a79 // Template for an RME Device object method which intelligently returns a 76 80 // register or value applicable to the connected model and warns if something 77 81 // isn't quite right. … … 104 108 105 109 MODEL_SELECTOR(cmd_buffer_addr, RME_FF400_CMD_BUFFER, RME_FF800_CMD_BUFFER) 106 MODEL_SELECTOR(stream_start_reg, RME_FF400_STREAM_START_REG0, RME_FF800_STREAM_START_REG0) 110 MODEL_SELECTOR(stream_init_reg, RME_FF400_STREAM_INIT_REG, RME_FF800_STREAM_INIT_REG) 111 MODEL_SELECTOR(stream_start_reg, RME_FF400_STREAM_START_REG, RME_FF800_STREAM_START_REG) 107 112 MODEL_SELECTOR(stream_end_reg, RME_FF400_STREAM_END_REG, RME_FF800_STREAM_END_REG) 108 113 MODEL_SELECTOR(flash_settings_addr, RME_FF400_FLASH_SETTINGS_ADDR, RME_FF800_FLASH_SETTINGS_ADDR) … … 117 122 return false; 118 123 } else { 119 // check if device is in supported devices list 124 // check if device is in supported devices list. Note that the RME 125 // devices use the unit version to identify the individual devices. 126 // To avoid having to extend the configuration file syntax to 127 // include this at this point, we'll use the configuration file 128 // model ID to test against the device unit version. This can be 129 // tidied up if the configuration file is extended at some point to 130 // include the unit version. 120 131 unsigned int vendorId = configRom.getNodeVendorId(); 121 unsigned int modelId = configRom.getModelId();122 123 Util::Configuration::VendorModelEntry vme = c.findDeviceVME( vendorId, modelId);132 unsigned int unitVersion = configRom.getUnitVersion(); 133 134 Util::Configuration::VendorModelEntry vme = c.findDeviceVME( vendorId, unitVersion ); 124 135 return c.isValid(vme) && vme.driver == Util::Configuration::eD_RME; 125 136 } … … 136 147 { 137 148 unsigned int vendorId = getConfigRom().getNodeVendorId(); 138 unsigned int modelId = getConfigRom().getModelId(); 149 // See note in Device::probe() about why we use the unit version here. 150 unsigned int unitVersion = getConfigRom().getUnitVersion(); 139 151 140 152 Util::Configuration &c = getDeviceManager().getConfiguration(); 141 Util::Configuration::VendorModelEntry vme = c.findDeviceVME( vendorId, modelId);153 Util::Configuration::VendorModelEntry vme = c.findDeviceVME( vendorId, unitVersion ); 142 154 143 155 if (c.isValid(vme) && vme.driver == Util::Configuration::eD_RME) { … … 146 158 vme.model_name.c_str()); 147 159 } else { 148 debugWarning(" Using generic RME support for unsupported device '%s %s'\n",160 debugWarning("Device '%s %s' unsupported by RME driver (no generic RME support)\n", 149 161 getConfigRom().getVendorName().c_str(), getConfigRom().getModelName().c_str()); 150 162 } 151 163 152 if ( modelId == RME_MODEL_FIREFACE800) {164 if (unitVersion == RME_UNITVERSION_FF800) { 153 165 m_rme_model = RME_MODEL_FIREFACE800; 154 } else if (modelId == RME_MODEL_FIREFACE400) { 166 } else 167 if (unitVersion == RME_MODEL_FIREFACE400) { 155 168 m_rme_model = RME_MODEL_FIREFACE400; 156 169 } else { 157 170 debugError("Unsupported model\n"); 171 return false; 158 172 } 159 173 … … 192 206 * Set the RME device's samplerate. The RME can do sampling frequencies of 193 207 * 32k, 44.1k and 48k along with the corresponding 2x and 4x rates. 194 * However, it can also do +/- 4% from any of these "base" frequencies. 195 * This makes it a little long-winded to work out whether a given frequency 196 * is supported or not. 208 * However, it can also do +/- 4% from any of these "base" frequencies using 209 * its DDS. This makes it a little long-winded to work out whether a given 210 * frequency is supported or not. 211 * 212 * This function is concerned with setting the device up for streaming, so the 213 * register we want to write to is in fact the streaming sample rate portion of 214 * the streaming initialisation function (as opposed to the DDS frequency register 215 * which is distinct on the FF800. How the FF800's DDS register will ultimately 216 * be controlled is yet to be determined. 197 217 */ 198 218 199 219 /* Work out whether the requested rate is supported */ 220 /* FIXME: the +/- 4% range is only doable if the DDS is engaged */ 200 221 if (!((samplingFrequency >= 32000*0.96 && samplingFrequency <= 32000*1.04) || 201 222 (samplingFrequency >= 44100*0.96 && samplingFrequency <= 44100*1.04) || … … 211 232 212 233 /* Send the desired frequency to the RME */ 213 if (writeRegister( RME_REG_DDS_CONTROL, samplingFrequency) != 0)234 if (writeRegister(stream_init_reg(), samplingFrequency) != 0) 214 235 return false; 215 236 … … 236 257 { 237 258 std::vector<int> frequencies; 259 /* FIXME: the +/- 4% frequency range is only doable if the DDS is 260 * engaged. 261 */ 238 262 RME_CHECK_AND_ADD_SR(frequencies, 32000); 239 263 RME_CHECK_AND_ADD_SR(frequencies, 44100); trunk/libffado/src/rme/rme_avdevice.h
r1543 r1547 33 33 #include "libutil/Configuration.h" 34 34 35 #include "fireface_def.h" 35 36 // #include "libstreaming/rme/RmeStreamProcessor.h" 36 37 /* RME Fireface register definitions */38 #define RME_REG_DDS_CONTROL 0xfc88f00039 37 40 38 class ConfigRom; … … 95 93 signed int m_ddsFreq; 96 94 95 FF_software_settings_t settings; 96 97 97 private: 98 98 unsigned long long int cmd_buffer_addr(); 99 unsigned long long int stream_init_reg(); 99 100 unsigned long long int stream_start_reg(); 100 101 unsigned long long int stream_end_reg();