Changeset 1534
- Timestamp:
- 04/05/09 17:36:45 (15 years ago)
- Files:
-
- trunk/libffado/doc/rme_notes/rme_config_register_map.txt (modified) (9 diffs)
- trunk/libffado/src/rme/fireface_def.h (modified) (4 diffs)
- trunk/libffado/src/rme/fireface_flash.cpp (added)
- trunk/libffado/src/rme/fireface_hw.cpp (added)
- trunk/libffado/src/rme/rme_avdevice.cpp (modified) (3 diffs)
- trunk/libffado/src/rme/rme_avdevice.h (modified) (2 diffs)
- trunk/libffado/src/SConscript (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/doc/rme_notes/rme_config_register_map.txt
r1533 r1534 2 2 ============================================ 3 3 4 Version: 0. 64 Version: 0.7 5 5 Author: Jonathan Woithe 6 Date: 27 March20096 Date: 4 April 2009 7 7 8 8 … … 14 14 FF400 = Fireface-400 15 15 16 Multi-byte values sent to/from the Fireface are generally little endian. 16 Multi-byte values sent to/from the Fireface are generally little endian - 17 that is, the device interprets quadlets in asynchronous packets as little 18 endian even though the bus definition is big-endian. If writing a driver 19 for use on a little endian machine, this means that a lack of byte swapping 20 (to account for the bus endianness standard) will cause bit 0 on the host to 21 be bit 0 on the device. 22 23 FFADO however adheres to the bus standards and byteswaps on little endian 24 machines. Under FFADO therefore, bit 0 on the host will in fact be read by 25 the device as the least significant bit in the most significant byte. 26 27 The bit maps in this document regarding the configuration registers are 28 written from the device's point of view. 29 30 Curiously enough, audio data appears to be send on the bus in big endian 31 format (although this is to be confirmed). 17 32 18 33 … … 143 158 bit 0: Clock mode: 0 = Master, 1 = Autosync 144 159 160 On the FF400, writing to these registers with valid values for the first 161 time after power up has the side effect of extingishing the "Host" LED. 162 145 163 146 164 Interfacing to device flash … … 172 190 173 191 174 Reading the flash192 Reading blocks from the flash (flash command 0x2) 175 193 176 194 For the FF800 the entire buffer is read directly from flash as a single block. … … 182 200 0x80100288 and the sub-block size (in bytes) in 0x8010028c. A 0x02 is 183 201 then written to CBA+(8*4) to initiate the read. Polling for "device not 184 busy" should commence after a wait of 2 ms. 185 186 187 Writing the flash 202 busy" should commence after a wait of 2 ms. Once not busy the data is 203 available for reading from 0x80100290. 204 205 206 Writing blocks to the flash (flash command 1) 188 207 189 208 For the FF800, the entire buffer is written to flash as a single block. … … 200 219 201 220 221 Getting other data from flash 222 223 There are a few other commands issued to the flash memory system for 224 obtaining data about the connected interface: 225 226 * Device revision 227 228 On the FF800 this is read directly from register 0x200000100. 229 230 On the FF400, 0xf is written to CBA+(8*4). Poll for "not busy" after a 231 wait of 2ms. Once not busy the revision is read from register 232 0x80100290. 233 234 202 235 Erasing the flash 203 236 … … 247 280 ---------------------- 248 281 249 The device settings are stored in flash as an array of 32bit unsigned282 The device settings are stored in flash as an array of 44 32-bit unsigned 250 283 integers. These are: 251 - Device ID252 - Device revision253 - ASIO latency254 - Samples per frame284 0 - Device ID 285 1 - Device revision 286 2 - ASIO latency 287 3 - Samples per frame 255 288 SPDIF input mode (0=coax?, 1=optical?) 256 289 SPDIF output emphasis active … … 269 302 - TMS 270 303 - Speed 271 - Channels available (high)304 20 - Channels available (high) 272 305 - Channels available (low) 273 306 Limit bandwidth setting 274 307 - Bandwidth allocated 275 308 - Stop on dropout 276 Input level309 25 Input level 277 310 Output level 278 Mic level [0] - FF400:Phoneslevel-1 / F800:AnalogInput[1]* ???279 Mic level [1] - AnalogInput[2] ???280 Mic phantom power [4]281 Instrument - AnalogInput[0]-1 ???311 27 Mic level [0] - FF400:Phoneslevel-1 / F800:AnalogInput[1]* ??? 312 28 Mic level [1] - AnalogInput[2] ??? 313 29 Mic phantom power [4] 314 33 Instrument - AnalogInput[0]-1 ??? 282 315 Filter (aka speaker emulation) 283 316 Fuzz (aka drive) 284 317 Sync align 285 - Device index318 37 - Device index 286 319 - Advanced dialog 287 Sample rate288 - Interleaved289 - Sn290 Word clock single speed291 - Number of channels292 - Dropped samples293 p12db_an[0] - Limiter==0&&AnalogInput[0]==2*: 1 else 0 ???294 - p12db_an[1-9]320 39 Sample rate 321 40 - Interleaved 322 41 - Sn 323 42 Word clock single speed 324 43 - Number of channels 325 44 - Dropped samples 326 45 p12db_an[0] - Limiter==0&&AnalogInput[0]==2*: 1 else 0 ??? 327 46 - p12db_an[1-9] 295 328 296 329 "-" = elements not used 297 330 331 Total size: 55 quadlets 298 332 299 333 Streaming control registers … … 475 509 0x200000324. Note that this register address goes beyond the 32-bit 476 510 boundary. 511 512 On the FF400 the host LED is controlled internally. On power up it is 513 turned on. Once the host PC programs the configuration registers with 514 valid values the host LED will automatically turn off. trunk/libffado/src/rme/fireface_def.h
r1533 r1534 37 37 38 38 /* The Command Buffer Address (CBA) is different for the two interfaces */ 39 #define RME_FF400_CMD_BUFFER 0x fc88f00040 #define RME_FF800_CMD_BUFFER 0x 8010050039 #define RME_FF400_CMD_BUFFER 0x80100500 40 #define RME_FF800_CMD_BUFFER 0xfc88f000 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) 44 #define RME_FF_CONF1_OFS (5*4) 45 #define RME_FF_CONF2_OFS (6*4) 46 #define RME_FF_CONF3_OFS (7*4) 47 #define RME_FF400_FLASH_CMD_OFS (8*4) 43 #define RME_FF_SRATE_CTRL_OFS (0*4) 44 #define RME_FF_CONF1_OFS (5*4) 45 #define RME_FF_CONF2_OFS (6*4) 46 #define RME_FF_CONF3_OFS (7*4) 47 #define RME_FF400_FLASH_CMD_OFS (8*4) // Write only 48 #define RME_FF400_FLASH_STAT_OFS (8*4) // Read only 48 49 49 50 /* General register definitions */ 51 #define RME_FF400_CONF_REG (RME_FF400_CMD_BUFFER + RME_FF_CONF1_OFS) 52 #define RME_FF800_CONF_REG (RME_FF800_CMD_BUFFER + RME_FF_CONF1_OFS) 53 50 54 #define RME_FF400_STREAM_START_REG (RME_FF400_CMD_BUFFER + 0x001c) 51 55 #define RME_FF800_STREAM_START_REG 0x200000028LL … … 53 57 #define RME_FF800_STREAM_END_REG 0x200000034LL // 3 quadlets wide 54 58 55 #define RME_FF _HOST_LED_REG0x200000324LL59 #define RME_FF800_HOST_LED_REG 0x200000324LL 56 60 57 #define RME_FF_CHANNEL_MUTE_MASK 0x801c0000 /* Write only */ 58 #define RME_FF_STATUS_REG 0x801c0000 /* Read only */ 61 #define RME_FF800_REVISION_REG 0x200000100LL 62 63 #define RME_FF_CHANNEL_MUTE_MASK 0x801c0000 // Write only 64 #define RME_FF_STATUS_REG0 0x801c0000 // Read only 65 #define RME_FF_STATUS_REG1 0x801c0004 // Read only 59 66 60 67 /* Addresses of various blocks in memory-mapped flash */ … … 72 79 #define RME_FF400_FLASH_BLOCK_ADDR_REG 0x80100288 73 80 #define RME_FF400_FLASH_BLOCK_SIZE_REG 0x8010028c 74 #define RME_FF400_FLASH_CMD_REG (RME_FF400_CMD_BUFFER+RME_FF400_FLASH_CMD_OFS) 81 #define RME_FF400_FLASH_CMD_REG (RME_FF400_CMD_BUFFER + RME_FF400_FLASH_CMD_OFS) 82 #define RME_FF400_FLASH_STAT_REG (RME_FF400_CMD_BUFFER + RME_FF400_FLASH_STAT_OFS) 75 83 #define RME_FF400_FLASH_WRITE_BUFFER 0x80100290 84 #define RME_FF400_FLASH_READ_BUFFER 0x80100290 76 85 77 86 /* Erase control registers on the FF800 */ … … 82 91 83 92 /* Flags and special values */ 84 #define RME_FF400_FLASH_CMD_WRITE 0x1 85 #define RME_FF400_FLASH_CMD_READ 0x2 86 #define RME_FF400_FLASH_CMD_ERASE_VOLUME 0xe 87 #define RME_FF400_FLASH_CMD_ERASE_SETTINGS 0xd 88 #define RME_FF400_FLASH_CMD_ERASE_CONFIG 0xc 93 #define RME_FF400_FLASH_CMD_WRITE 0x01000000 94 #define RME_FF400_FLASH_CMD_READ 0x02000000 95 #define RME_FF400_FLASH_CMD_ERASE_VOLUME 0x0e000000 96 #define RME_FF400_FLASH_CMD_ERASE_SETTINGS 0x0d000000 97 #define RME_FF400_FLASH_CMD_ERASE_CONFIG 0x0c000000 98 #define RME_FF400_FLASH_CMD_GET_REVISION 0x0f000000 99 100 101 /* Defines for components of the control register */ 102 /* FIXME: flesh this out once the details of how this gets used have been 103 * finalised 104 */ 105 #define CR_FREQ0 0x02000000 106 #define CR_FREQ1 0x04000000 107 #define CR_DS 0x08000000 108 #define CR_QS 0x10000000 109 89 110 90 111 #endif trunk/libffado/src/rme/rme_avdevice.cpp
r1533 r1534 139 139 } 140 140 141 if (m_model != NULL) { 142 debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", 143 m_model->vendor_name, m_model->model_name); 144 return true; 145 } 146 147 return false; 141 if (m_model == NULL) 142 return false; 143 144 debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", 145 m_model->vendor_name, m_model->model_name); 146 147 init_hardware(); 148 read_device_settings(); 149 150 return true; 148 151 } 149 152 … … 311 314 } 312 315 316 signed int 317 RmeDevice::readBlock(fb_nodeaddr_t reg, quadlet_t *buf, unsigned int n_quads) { 318 319 unsigned int i; 320 321 if (get1394Service().read(0xffc0 | getNodeId(), reg, n_quads, buf) <= 0) { 322 debugError("Error doing RME block read of %d quadlets from register 0x%06x\n", 323 n_quads, reg); 324 return -1; 325 } 326 for (i=0; i<n_quads; i++) { 327 buf[i] = CondSwapFromBus32(buf[i]); 328 } 329 330 return 0; 331 } 332 313 333 signed int 314 334 RmeDevice::writeRegister(fb_nodeaddr_t reg, quadlet_t data) { … … 320 340 debugError("Error doing RME write to register 0x%06x\n",reg); 321 341 } 322 // SleepRelativeUsec(100);323 342 return (err==0)?0:-1; 324 343 } 344 345 signed int 346 RmeDevice::writeBlock(fb_nodeaddr_t reg, quadlet_t *data, unsigned int n_quads) { 347 // 348 // Write a block of data to the device starting at address "reg". Note that 349 // the conditional byteswap is done "in place" on data, so the contents of 350 // data may be modified by calling this function. 351 // 352 unsigned int err = 0; 353 unsigned int i; 354 355 for (i=0; i<n_quads; i++) 356 data[i] = CondSwapToBus32(data[i]); 357 if (get1394Service().write(0xffc0 | getNodeId(), reg, n_quads, data) <= 0) { 358 err = 1; 359 debugError("Error doing RME block write of %d quadlets to register 0x%06x\n", 360 n_quads, reg); 361 } 362 return (err==0)?0:-1; 363 } 325 364 326 365 } trunk/libffado/src/rme/rme_avdevice.h
r1533 r1534 93 93 94 94 unsigned int readRegister(fb_nodeaddr_t reg); 95 signed int readBlock(fb_nodeaddr_t reg, quadlet_t *buf, unsigned int n_quads); 95 96 signed int writeRegister(fb_nodeaddr_t reg, quadlet_t data); 97 signed int writeBlock(fb_nodeaddr_t reg, quadlet_t *data, unsigned int n_quads); 96 98 97 99 protected: … … 109 111 unsigned long long int flash_mixer_pan_addr(); 110 112 unsigned long long int flash_mixer_hw_addr(); 113 114 /* Low-level flash memory functions */ 115 signed int wait_while_busy(unsigned int init_delay); 116 signed int get_revision(unsigned int *revision); 117 signed int read_flash(fb_nodeaddr_t addr, quadlet_t *buf, unsigned int n_quads); 118 119 /* Upper level flash memory functions */ 120 signed int read_device_settings(void); 121 122 /* Hardware functions */ 123 signed int init_hardware(void); 111 124 }; 112 125 trunk/libffado/src/SConscript
r1498 r1534 178 178 rme_source = env.Split( '\ 179 179 rme/rme_avdevice.cpp \ 180 rme/fireface_flash.cpp \ 181 rme/fireface_hw.cpp \ 180 182 ' ) 181 183