Changeset 1547

Show
Ignore:
Timestamp:
04/27/09 16:13:39 (14 years ago)
Author:
jwoithe
Message:

RME:
- quickly fix device detection by comparing config file modelid against the unit's unit version since RME use unit version to differentiate models
- documentation update
- refinements to device defines
- begin to fill in device initialisation details

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/doc/rme_notes/rme_config_register_map.txt

    r1537 r1547  
    22============================================ 
    33 
    4 Version: 0.8 
     4Version: 0.9 
    55Author: Jonathan Woithe 
    6 Date: 13 April 2009 
     6Date: 27 April 2009 
    77 
    88 
     
    118118    01 = -10 dBV 
    119119    10 = hi-gain 
    120   bits 15-14: unknown, set to 0 
    121   bits 13-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): 
    122122    001 = hi-gain 
    123123    010 = +4dBU 
    124124    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) 
    127126  bit 8: Phantom power, mic 10 (active = 1) 
    128127  bit 7: Phantom power, mic 8 (active = 1) 
  • trunk/libffado/src/rme/fireface_def.h

    r1542 r1547  
    4141 
    4242/* 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) 
    4444#define RME_FF_CONF1_OFS          (5*4) 
    4545#define RME_FF_CONF2_OFS          (6*4) 
     
    5252#define RME_FF800_CONF_REG          (RME_FF800_CMD_BUFFER + RME_FF_CONF1_OFS) 
    5353 
     54#define RME_FF400_STREAM_INIT_REG   (RME_FF400_CMD_BUFFER)           // 3 quadlets wide 
    5455#define RME_FF400_STREAM_SRATE      (RME_FF400_CMD_BUFFER) 
    5556#define RME_FF400_STREAM_CONF0      (RME_FF400_CMD_BUFFER+4) 
    5657#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 
    6264#define RME_FF400_STREAM_END_REG    (RME_FF400_CMD_BUFFER + 0x0004)  // 4 quadlets wide 
    63 #define RME_FF800_STREAM_END_REG    0x200000034LL                    // 3 quadlets wide 
     65#define RME_FF800_STREAM_END_REG    0x200000034LL                    // 3 quadlets wide 
    6466 
    6567#define RME_FF800_HOST_LED_REG      0x200000324LL 
     
    117119#define CR0_PHANTOM_MIC3        0x00000100 
    118120#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 
    123126#define CRO_ZEROBIT14           0x00004000 
    124127#define CRO_ZEROBIT15           0x00008000 
     
    200203/* Structure used to store device settings in the device flash RAM.  This 
    201204 * 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. 
    203206 */ 
    204207typedef struct { 
     
    261264#define FF_DEV_FLASH_MIC_PHANTOM_ON            0x00000001 
    262265 
     266typedef struct { 
     267    uint32_t mic_phantom[4]; 
     268} FF_software_settings_t; 
     269 
    263270#endif 
  • trunk/libffado/src/rme/fireface_hw.cpp

    r1543 r1547  
    3434Device::init_hardware(void) 
    3535{ 
    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. 
    3940    // 
    4041    // FIXME: currently this is a minimum skeleton to prove basic 
     
    4344    unsigned int conf_reg; 
    4445 
     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 
    4555    /* Input level */ 
    4656    switch (1) { 
    4757        case 1: // Low gain 
    48             data[1] |= 0x0;    // CPLD 
    49             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) 
    5060            break; 
    5161        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
    5464            break; 
    5565        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
    5868            break; 
    5969    } 
     
    6272    switch (1) { 
    6373        case 1: // High gain 
    64             data[1] |= 0x10;   // CPLD 
    65             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) 
    6676            break; 
    6777        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
    7080            break; 
    7181        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
    7484            break; 
    7585    } 
     
    8292 
    8393    /* Drop-and-stop is hardwired on */ 
    84     data[2] |= 0x8000000
     94    data[2] |= CR2_DROP_AND_STOP
    8595 
    8696    if (m_rme_model == RME_MODEL_FIREFACE400) { 
    87         data[2] |= 0x04000000
     97        data[2] |= CR2_FF400_BIT
    8898    } 
    8999 
     
    95105data[2] = 0xc400101f; 
    96106 
    97 //data[0] = 0x10080200;    // Phantom off 
    98 //data[0] = 0x11080200;    // Phantom on 
    99 //data[1] = 0x1e030000; 
    100 //data[2] = 0x1f1000c4; 
    101  
    102107    conf_reg = (m_rme_model==RME_MODEL_FIREFACE800)?RME_FF800_CONF_REG:RME_FF400_CONF_REG; 
    103108    if (writeBlock(conf_reg, data, 3) != 0) 
  • trunk/libffado/src/rme/rme_avdevice.cpp

    r1543 r1547  
    4444 
    4545#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 
    4650 
    4751namespace Rme { 
     
    7377#endif 
    7478 
    75 // Template for a RmeDevice object method which intelligently returns a 
     79// Template for an RME Device object method which intelligently returns a 
    7680// register or value applicable to the connected model and warns if something 
    7781// isn't quite right. 
     
    104108 
    105109MODEL_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) 
     110MODEL_SELECTOR(stream_init_reg, RME_FF400_STREAM_INIT_REG, RME_FF800_STREAM_INIT_REG) 
     111MODEL_SELECTOR(stream_start_reg, RME_FF400_STREAM_START_REG, RME_FF800_STREAM_START_REG) 
    107112MODEL_SELECTOR(stream_end_reg, RME_FF400_STREAM_END_REG, RME_FF800_STREAM_END_REG) 
    108113MODEL_SELECTOR(flash_settings_addr, RME_FF400_FLASH_SETTINGS_ADDR, RME_FF800_FLASH_SETTINGS_ADDR) 
     
    117122        return false; 
    118123    } 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. 
    120131        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 ); 
    124135        return c.isValid(vme) && vme.driver == Util::Configuration::eD_RME; 
    125136    } 
     
    136147{ 
    137148    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(); 
    139151 
    140152    Util::Configuration &c = getDeviceManager().getConfiguration(); 
    141     Util::Configuration::VendorModelEntry vme = c.findDeviceVME( vendorId, modelId ); 
     153    Util::Configuration::VendorModelEntry vme = c.findDeviceVME( vendorId, unitVersion ); 
    142154 
    143155    if (c.isValid(vme) && vme.driver == Util::Configuration::eD_RME) { 
     
    146158                     vme.model_name.c_str()); 
    147159    } 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", 
    149161                     getConfigRom().getVendorName().c_str(), getConfigRom().getModelName().c_str()); 
    150162    } 
    151163 
    152     if (modelId == RME_MODEL_FIREFACE800) { 
     164    if (unitVersion == RME_UNITVERSION_FF800) { 
    153165        m_rme_model = RME_MODEL_FIREFACE800; 
    154     } else if (modelId == RME_MODEL_FIREFACE400) { 
     166    } else 
     167    if (unitVersion == RME_MODEL_FIREFACE400) { 
    155168        m_rme_model = RME_MODEL_FIREFACE400; 
    156169    } else { 
    157170        debugError("Unsupported model\n"); 
     171        return false; 
    158172    } 
    159173 
     
    192206 * Set the RME device's samplerate.  The RME can do sampling frequencies of 
    193207 * 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. 
    197217 */ 
    198218 
    199219    /* Work out whether the requested rate is supported */ 
     220    /* FIXME: the +/- 4% range is only doable if the DDS is engaged */ 
    200221    if (!((samplingFrequency >= 32000*0.96 && samplingFrequency <= 32000*1.04) || 
    201222        (samplingFrequency >= 44100*0.96 && samplingFrequency <= 44100*1.04) || 
     
    211232     
    212233    /* Send the desired frequency to the RME */ 
    213     if (writeRegister(RME_REG_DDS_CONTROL, samplingFrequency) != 0) 
     234    if (writeRegister(stream_init_reg(), samplingFrequency) != 0) 
    214235      return false; 
    215236 
     
    236257{ 
    237258    std::vector<int> frequencies; 
     259    /* FIXME: the +/- 4% frequency range is only doable if the DDS is 
     260     * engaged. 
     261     */ 
    238262    RME_CHECK_AND_ADD_SR(frequencies, 32000); 
    239263    RME_CHECK_AND_ADD_SR(frequencies, 44100); 
  • trunk/libffado/src/rme/rme_avdevice.h

    r1543 r1547  
    3333#include "libutil/Configuration.h" 
    3434 
     35#include "fireface_def.h" 
    3536// #include "libstreaming/rme/RmeStreamProcessor.h" 
    36  
    37 /* RME Fireface register definitions */ 
    38 #define RME_REG_DDS_CONTROL       0xfc88f000 
    3937 
    4038class ConfigRom; 
     
    9593    signed int m_ddsFreq; 
    9694 
     95    FF_software_settings_t settings; 
     96 
    9797private: 
    9898    unsigned long long int cmd_buffer_addr(); 
     99    unsigned long long int stream_init_reg(); 
    99100    unsigned long long int stream_start_reg(); 
    100101    unsigned long long int stream_end_reg();