Changeset 1574

Show
Ignore:
Timestamp:
06/14/09 04:48:47 (15 years ago)
Author:
jwoithe
Message:

RME: Fix some typos.
RME: Separate device state initialisation and hardware parameter setting since the latter is needed whenever a single parameter is changed.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/rme/fireface_def.h

    r1573 r1574  
    321321#define FF_DEV_FLASH_OLEVEL_m10dBV             0x00000003 
    322322#define FF_DEV_FLASH_MIC_PHANTOM_ON            0x00000001 
    323 #define FF_DEV_FLAS_WORD_CLOCK_1x              0x00000001 
     323#define FF_DEV_FLASH_WORD_CLOCK_1x              0x00000001 
    324324 
    325325// Structure used by FFADO to keep track of the device status.  This is 
     
    381381#define FF_SWPARAM_OLEVEL_m10dBV               FF_DEV_FLASH_OLEVEL_m10dBV 
    382382#define FF_SWPARAM_MIC_PHANTOM_ON              FF_DEV_FLASH_MIC_PHANTOM_ON 
    383 #define FF_SWPARAM_WORD_CLOCK_1x               FF_DEV_FLAS_WORD_CLOCK_1x 
     383#define FF_SWPARAM_WORD_CLOCK_1x               FF_DEV_FLASH_WORD_CLOCK_1x 
    384384// 
    385385// The following defines refer to fields in the software parameter record which have no 
  • trunk/libffado/src/rme/fireface_hw.cpp

    r1573 r1574  
    3131namespace Rme { 
    3232 
     33signed int 
     34Device::init_hardware(void) 
     35{ 
     36    // Initialises the device's settings structure to a known state and then 
     37    // sets the hardware to reflect this state. 
     38    // 
     39    // In time this function may read a cached device setup and initialise 
     40    // based on that.  It may also read the device configuration from the 
     41    // device flash and adopt that.  For now (for initial testing purposes) 
     42    // we'll go with a static state. 
     43    memset(&settings, 0, sizeof(settings)); 
     44    settings.spdif_input_mode = FF_SWPARAM_SPDIF_INPUT_COAX; 
     45    settings.spdif_output_mode = FF_SWPARAM_SPDIF_OUTPUT_COAX; 
     46    settings.clock_mode = FF_SWPARAM_SPDIF_CLOCK_MODE_MASTER; 
     47    settings.sync_ref = FF_SWPARAM_SYNCREF_WORDCLOCK; 
     48    settings.input_level = FF_SWPARAM_ILEVEL_LOGAIN; 
     49    settings.output_level = FF_SWPARAM_OLEVEL_HIGAIN; 
     50 
     51    return set_hardware_params(&settings); 
     52} 
     53 
    3354signed int  
    34 Device::init_hardware(void) 
    35 
    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. 
    40     // 
    41     // FIXME: currently this is a minimum skeleton to prove basic 
    42     // functionality.  It requires details to be filled in. 
     55Device::set_hardware_params(FF_software_settings_t *sw_settings) 
     56
     57    // Initialises the hardware to the state defined by the supplied 
     58    // software settings structure (which will usually be the device's 
     59    // "settings" structure).  This has the side effect of extinguishing the 
     60    // "Host" LED on the FF400 when done for the first time after the 
     61    // interface has been powered up. 
     62 
    4363    quadlet_t data[3] = {0, 0, 0}; 
    4464    unsigned int conf_reg; 
    4565 
    46     if (settings.mic_phantom[0]) 
     66    if (sw_settings->mic_phantom[0]) 
    4767      data[0] |= CR0_PHANTOM_MIC0; 
    48     if (settings.mic_phantom[1]) 
     68    if (sw_settings->mic_phantom[1]) 
    4969      data[0] |= CR0_PHANTOM_MIC1; 
    50     if (settings.mic_phantom[2]) 
     70    if (sw_settings->mic_phantom[2]) 
    5171      data[0] |= CR0_PHANTOM_MIC2; 
    52     if (settings.mic_phantom[3]) 
     72    if (sw_settings->mic_phantom[3]) 
    5373      data[0] |= CR0_PHANTOM_MIC3; 
    5474 
    5575    /* Phones level */ 
    56     switch (settings.phones_level) { 
     76    switch (sw_settings->phones_level) { 
    5777        case FF_SWPARAM_PHONESLEVEL_HIGAIN: 
    5878            data[0] |= CRO_PHLEVEL_HIGAIN; 
     
    6787 
    6888    /* Input level */ 
    69     switch (settings.input_level) { 
     89    switch (sw_settings->input_level) { 
    7090        case FF_SWPARAM_ILEVEL_LOGAIN: // Low gain 
    7191            data[1] |= CR1_ILEVEL_CPLD_LOGAIN;    // CPLD 
     
    83103 
    84104    /* Output level */ 
    85     switch (settings.output_level) { 
     105    switch (sw_settings->output_level) { 
    86106        case FF_SWPARAM_OLEVEL_HIGAIN: // High gain 
    87107            data[1] |= CR1_OLEVEL_CPLD_HIGAIN;   // CPLD 
     
    101121     * devices, so we use the generic identifiers here. 
    102122     */ 
    103     data[1] |= (settings.input_opt[1] & FF_SWPARAM_INPUT_OPT_A) ? CR1_INPUT_OPT1_A : 0; 
    104     data[1] |= (settings.input_opt[1] & FF_SWPARAM_INPUT_OPT_B) ? CR1_INPUT_OPT1_B : 0; 
    105     data[1] |= (settings.input_opt[2] & FF_SWPARAM_INPUT_OPT_A) ? CR1_INPUT_OPT2_A : 0; 
    106     data[1] |= (settings.input_opt[2] & FF_SWPARAM_INPUT_OPT_B) ? CR1_INPUT_OPT2_B : 0; 
     123    data[1] |= (sw_settings->input_opt[1] & FF_SWPARAM_INPUT_OPT_A) ? CR1_INPUT_OPT1_A : 0; 
     124    data[1] |= (sw_settings->input_opt[1] & FF_SWPARAM_INPUT_OPT_B) ? CR1_INPUT_OPT1_B : 0; 
     125    data[1] |= (sw_settings->input_opt[2] & FF_SWPARAM_INPUT_OPT_A) ? CR1_INPUT_OPT2_A : 0; 
     126    data[1] |= (sw_settings->input_opt[2] & FF_SWPARAM_INPUT_OPT_B) ? CR1_INPUT_OPT2_B : 0; 
    107127 
    108128    // Drive the speaker emulation / filter LED via FPGA 
    109     data[0] |= (settings.filter) ? CR0_FILTER_FPGA : 0; 
     129    data[0] |= (sw_settings->filter) ? CR0_FILTER_FPGA : 0; 
    110130 
    111131    // Set the "rear" option for input 0 if selected 
    112     data[1] |= (settings.input_opt[0] & FF_SWPARAM_FF800_INPUT_OPT_REAR) ? CR1_FF800_INPUT1_REAR : 0; 
     132    data[1] |= (sw_settings->input_opt[0] & FF_SWPARAM_FF800_INPUT_OPT_REAR) ? CR1_FF800_INPUT1_REAR : 0; 
    113133 
    114134    // The input 0 "front" option is activated using one of two bits 
    115135    // depending on whether the filter (aka "speaker emulation") setting is 
    116136    // active. 
    117     if (settings.input_opt[0] & FF_SWPARAM_FF800_INPUT_OPT_FRONT) { 
    118         data[1] |= (settings.filter) ? CR1_FF800_INPUT1_FRONT_WITH_FILTER : CR1_FF800_INPUT1_FRONT; 
    119     } 
    120  
    121     data[2] |= (settings.spdif_output_emphasis==FF_SWPARAM_SPDIF_OUTPUT_EMPHASIS_ON) ? CR2_SPDIF_OUT_EMP : 0; 
    122     data[2] |= (settings.spdif_output_pro==FF_SWPARAM_SPDIF_OUTPUT_PRO_ON) ? CR2_SPDIF_OUT_PRO : 0; 
    123     data[2] |= (settings.spdif_output_nonaudio==FF_SWPARAM_SPDIF_OUTPUT_NONAUDIO_ON) ? CR2_SPDIF_OUT_NONAUDIO : 0; 
    124     data[2] |= (settings.spdif_output_mode==FF_SWPARAM_SPDIF_OUTPUT_OPTICAL) ? CR2_SPDIF_OUT_ADAT2 : 0; 
    125     data[2] |= (settings.clock_mode==FF_SWPARAM_SPDIF_CLOCK_MODE_AUTOSYNC) ? CR2_CLOCKMODE_AUTOSYNC : CR2_CLOCKMODE_MASTER; 
    126     data[2] |= (settings.spdif_input_mode==FF_SWPARAM_SPDIF_INPUT_COAX) ? CR2_SPDIF_IN_COAX : CR2_SPDIF_IN_ADAT2; 
    127     data[2] |= (settings.word_clock_single_speed=FF_SWPARAM_WORD_CLOCK_1x) ? CR2_WORD_CLOCK_1x : 0; 
     137    if (sw_settings->input_opt[0] & FF_SWPARAM_FF800_INPUT_OPT_FRONT) { 
     138        data[1] |= (sw_settings->filter) ? CR1_FF800_INPUT1_FRONT_WITH_FILTER : CR1_FF800_INPUT1_FRONT; 
     139    } 
     140 
     141    data[2] |= (sw_settings->spdif_output_emphasis==FF_SWPARAM_SPDIF_OUTPUT_EMPHASIS_ON) ? CR2_SPDIF_OUT_EMP : 0; 
     142    data[2] |= (sw_settings->spdif_output_pro==FF_SWPARAM_SPDIF_OUTPUT_PRO_ON) ? CR2_SPDIF_OUT_PRO : 0; 
     143    data[2] |= (sw_settings->spdif_output_nonaudio==FF_SWPARAM_SPDIF_OUTPUT_NONAUDIO_ON) ? CR2_SPDIF_OUT_NONAUDIO : 0; 
     144    data[2] |= (sw_settings->spdif_output_mode==FF_SWPARAM_SPDIF_OUTPUT_OPTICAL) ? CR2_SPDIF_OUT_ADAT2 : 0; 
     145    data[2] |= (sw_settings->clock_mode==FF_SWPARAM_SPDIF_CLOCK_MODE_AUTOSYNC) ? CR2_CLOCKMODE_AUTOSYNC : CR2_CLOCKMODE_MASTER; 
     146    data[2] |= (sw_settings->spdif_input_mode==FF_SWPARAM_SPDIF_INPUT_COAX) ? CR2_SPDIF_IN_COAX : CR2_SPDIF_IN_ADAT2; 
     147    data[2] |= (sw_settings->word_clock_single_speed=FF_SWPARAM_WORD_CLOCK_1x) ? CR2_WORD_CLOCK_1x : 0; 
    128148 
    129149    /* TMS / TCO toggle bits in CR2 are not set by other drivers */ 
    130150 
    131151    /* Drive / fuzz */ 
    132     if (settings.fuzz) 
     152    if (sw_settings->fuzz) 
    133153      data[0] |= CR0_INSTR_DRIVE_FPGA; // FPGA LED control 
    134154    else 
     
    142162    } 
    143163 
    144     switch (settings.sync_ref) { 
     164    switch (sw_settings->sync_ref) { 
    145165        case FF_SWPARAM_SYNCREF_WORDCLOCK: 
    146166            data[2] |= CR2_SYNC_WORDCLOCK; 
     
    165185    // The FF800 limiter applies to the front panel instrument input, so it 
    166186    // only makes sense that it is disabled when that input is in use. 
    167     data[2] |= (settings.limiter_disable &&  
    168                 (settings.input_opt[0] & FF_SWPARAM_FF800_INPUT_OPT_FRONT)) ?  
     187    data[2] |= (sw_settings->limiter_disable &&  
     188                (sw_settings->input_opt[0] & FF_SWPARAM_FF800_INPUT_OPT_FRONT)) ?  
    169189                CR2_DISABLE_LIMITER : 0; 
    170190 
  • trunk/libffado/src/rme/rme_avdevice.h

    r1573 r1574  
    115115    /* Hardware functions */ 
    116116    signed int init_hardware(void); 
     117    signed int set_hardware_params(FF_software_settings_t *sw_settings); 
    117118    signed int read_tco(quadlet_t *tco_data, signed int size); 
    118119    signed int write_tco(quadlet_t *tco_data, signed int size);