Changeset 1589

Show
Ignore:
Timestamp:
06/27/09 06:25:55 (14 years ago)
Author:
jwoithe
Message:

RME: tidied up software settings structure and removed unused fields.
RME: map configuration flash contents into software settings structure after flash is read.
RME: rename some methods to better reflect their function.
RME: documentation update to reflect the information embodied in these changes.

Files:

Legend:

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

    r1570 r1589  
    44Version: 0.10 
    55Author: Jonathan Woithe 
    6 Date: 29 May 2009 
     6Date: 27 June 2009 
    77 
    88 
     
    345345 29 Input level (0=default, 1=lo-gain, 2=+4dBU, 3=-10dBV ???) 
    346346 30 Output level (0=default, 1=hi-gain, 2=+4dBU, 3=-10dBV ???) 
    347  31 Mic level [0] - FF400:Phoneslevel-1 / F800:AnalogInput[1]* ??? 
    348  32 Mic level [1] - AnalogInput[2] ??? 
     347 31 Mic level [0] - FF400: Phoneslevel-1  
     348                    FF800: Channel 7 front/rear select (0=rear, 1=front [TBC]) 
     349 32 Mic level [1] - FF400: unused 
     350                    FF800: Channel 8 front/rear select (0=rear, 1=front [TBC]) 
    349351 33 Mic phantom power [4] 
    350  37 Instrument - AnalogInput[0]-1 ??? 
     352 37 Instrument - FF400: unused 
     353                 FF800: Channel 1 front/rear selector (0=rear, 1=font [TBC]) 
    351354 38 Filter (aka speaker emulation) 
    352355 39 Fuzz (aka drive) 
     
    360363 47 - Number of channels (FF400=0x000000f0) 
    361364 48 - Dropped samples 
    362  49 p12db_an[0] - Disable limiter, settable only if input 1 front jack active 
     365 49 p12db_an[0] - Disable limiter, settable only if channel 1 front jack active 
    363366 50 - p12db_an[1-9] 
    364367 
  • trunk/libffado/src/rme/fireface_def.h

    r1587 r1589  
    278278    uint32_t input_level; 
    279279    uint32_t output_level; 
    280     uint32_t mic_level[2]; 
     280    uint32_t mic_plug_select[2];     // Front/rear select for FF800 ch 7/8 
     281                                     // [0] = phones level on FF400 
    281282    uint32_t mic_phantom[4]; 
    282     uint32_t instrument; 
     283    uint32_t instrument_plug_select; // Front/rear select for FF800 ch 1 
    283284    uint32_t filter; 
    284285    uint32_t fuzz; 
     
    326327#define FF_DEV_FLASH_MIC_PHANTOM_ON            0x00000001 
    327328#define FF_DEV_FLASH_WORD_CLOCK_1x             0x00000001 
     329#define FF_DEV_FLASH_PLUG_SELECT_FRONT         0x00000001  // To be confirmed 
     330#define FF_DEV_FLASH_PLUG_SELECT_REAR          0x00000000  // To be confirmed 
    328331 
    329332// Structure used by FFADO to keep track of the device status.  This is 
     
    346349    uint32_t input_level; 
    347350    uint32_t output_level; 
    348     uint32_t mic_level[2]; 
    349     uint32_t instrument; 
    350351    uint32_t filter; 
    351352    uint32_t fuzz; 
     
    353354    uint32_t sample_rate; 
    354355    uint32_t word_clock_single_speed; 
    355     uint32_t phones_level;             // No equivalent in device flash 
    356     uint32_t input_opt[3];             // No equivalent in device flash 
     356    uint32_t phones_level;             // Derived from fields in device flash 
     357    uint32_t input_opt[3];             // Derived from fields in device flash 
    357358} FF_software_settings_t; 
    358359 
     
    387388#define FF_SWPARAM_WORD_CLOCK_1x               FF_DEV_FLASH_WORD_CLOCK_1x 
    388389// 
    389 // The following defines refer to fields in the software parameter record which have no 
    390 // equivalent in the device flash. 
     390// The following defines refer to fields in the software parameter record 
     391// which are derived from one or more fields in device flash. 
    391392#define FF_SWPARAM_PHONESLEVEL_HIGAIN          0x00000001 
    392393#define FF_SWPARAM_PHONESLEVEL_4dBU            0x00000002 
  • trunk/libffado/src/rme/fireface_flash.cpp

    r1588 r1589  
    205205 
    206206signed int  
    207 Device::read_device_settings(void)  
     207Device::read_device_flash_settings(FF_software_settings_t *settings)  
    208208{ 
    209209    // Read the device's configuration flash RAM and use this to set up  
    210     // the object's "settings" data member field
     210    // the given settings structure
    211211 
    212212    FF_device_flash_settings_t hw_settings; 
    213     signed int i
     213    signed int i, err = 0
    214214    unsigned int rev; 
    215215 
     
    225225 
    226226    // Read settings flash ram block 
    227     i = read_flash(m_rme_model==RME_MODEL_FIREFACE800? 
     227    err = read_flash(m_rme_model==RME_MODEL_FIREFACE800? 
    228228      RME_FF800_FLASH_SETTINGS_ADDR:RME_FF400_FLASH_SETTINGS_ADDR,  
    229229        (quadlet_t *)&hw_settings, sizeof(hw_settings)/sizeof(uint32_t)); 
    230     if (i != 0) { 
     230    if (err != 0) { 
    231231        debugOutput(DEBUG_LEVEL_WARNING, "Error reading device flash settings: %d\n", i); 
    232232    } else { 
     
    248248    } 
    249249 
     250    if (settings != NULL) { 
     251        memset(settings, 0, sizeof(settings)); 
     252        // Copy hardware details to the software settings structure as 
     253        // appropriate. 
     254        for (i=0; i<4; i++) 
     255            settings->mic_phantom[i] = hw_settings.mic_phantom[i]; 
     256        settings->spdif_input_mode = hw_settings.spdif_input_mode; 
     257        settings->spdif_output_emphasis = hw_settings.spdif_output_emphasis; 
     258        settings->spdif_output_pro = hw_settings.spdif_output_pro; 
     259        settings->spdif_output_nonaudio = hw_settings.spdif_output_nonaudio; 
     260        settings->spdif_output_mode = hw_settings.spdif_output_mode; 
     261        settings->clock_mode = hw_settings.clock_mode; 
     262        settings->sync_ref = hw_settings.sync_ref; 
     263        settings->tms = hw_settings.tms; 
     264        settings->limit_bandwidth = hw_settings.limit_bandwidth; 
     265        settings->stop_on_dropout = hw_settings.stop_on_dropout; 
     266        settings->input_level = hw_settings.input_level; 
     267        settings->output_level = hw_settings.output_level; 
     268        settings->filter = hw_settings.filter; 
     269        settings->fuzz = hw_settings.fuzz; 
     270        settings->limiter_disable = (hw_settings.p12db_an[0] == 0)?1:0; 
     271        settings->sample_rate = hw_settings.sample_rate; 
     272        settings->word_clock_single_speed = hw_settings.word_clock_single_speed; 
     273 
     274        // The FF800 has front/rear selectors for the "instrument" input  
     275        // (aka channel 1) and the two "mic" channels (aka channels 7 and 8). 
     276        // The FF400 does not.  The FF400 borrows the mic0 selector field  
     277        // in the flash configuration structure to use for the "phones" 
     278        // level which the FF800 doesn't have. 
     279        // The offset of 1 here is to maintain consistency with the values 
     280        // used in the flash by other operating systems. 
     281        if (m_rme_model == RME_MODEL_FIREFACE400) 
     282            settings->phones_level = hw_settings.mic_plug_select[0] + 1; 
     283        else { 
     284            settings->input_opt[0] = hw_settings.instrument_plug_select + 1; 
     285            settings->input_opt[1] = hw_settings.mic_plug_select[0] + 1; 
     286            settings->input_opt[2] = hw_settings.mic_plug_select[1] + 1; 
     287        } 
     288    } 
     289 
    250290{ 
    251291quadlet_t buf[4]; 
     
    272312#endif 
    273313 
    274     return 0; 
    275 
    276  
    277 signed int  
    278 Device::write_device_settings(void)  
    279 
    280     // Write the current settings as held in the "settings" data field to 
    281     // the device configuration flash. 
     314    return err!=0?-1:0; 
     315
     316 
     317signed int  
     318Device::write_device_flash_settings(FF_software_settings_t *settings)  
     319
     320    // Write the given device settings to the device's configuration flash. 
    282321 
    283322    // FIXME: fairly obviously the detail needs to be filled in here. 
  • trunk/libffado/src/rme/rme_avdevice.cpp

    r1588 r1589  
    182182 
    183183    // This is just for testing 
    184     read_device_settings(); 
     184    read_device_flash_settings(NULL); 
    185185 
    186186    return true; 
  • trunk/libffado/src/rme/rme_avdevice.h

    r1588 r1589  
    115115 
    116116    /* Upper level flash memory functions */ 
    117     signed int read_device_settings(void); 
    118     signed int write_device_settings(void); 
     117    signed int read_device_flash_settings(FF_software_settings_t *settings); 
     118    signed int write_device_flash_settings(FF_software_settings_t *settings); 
    119119 
    120120    /* Hardware functions */