Changeset 1573

Show
Ignore:
Timestamp:
06/11/09 06:58:35 (14 years ago)
Author:
jwoithe
Message:

RME: add I/O functions for the TCO. Clarify some comments. Fix compile issue which wasn't picked up earlier to do an incorrect scons setting.

Files:

Legend:

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

    r1572 r1573  
    231231#define SR0_SEL_SYNC_REF2       0x01000000 
    232232#define SR0_INP_FREQ0           0x02000000 
    233 #define SR0_INP_FREQ0           0x04000000 
    234 #define SR0_INP_FREQ0           0x08000000 
    235 #define SR0_INP_FREQ0           0x10000000 
     233#define SR0_INP_FREQ1           0x04000000 
     234#define SR0_INP_FREQ2           0x08000000 
     235#define SR0_INP_FREQ3           0x10000000 
    236236#define SR0_WC_SYNC             0x20000000 
    237237#define SR0_WC_LOCK             0x40000000 
  • trunk/libffado/src/rme/fireface_hw.cpp

    r1570 r1573  
    163163    data[2] |= (CR2_FREQ0 + CR2_FREQ1 + CR2_DSPEED + CR2_QSSPEED); 
    164164 
     165    // The FF800 limiter applies to the front panel instrument input, so it 
     166    // only makes sense that it is disabled when that input is in use. 
    165167    data[2] |= (settings.limiter_disable &&  
    166168                (settings.input_opt[0] & FF_SWPARAM_FF800_INPUT_OPT_FRONT)) ?  
     
    180182} 
    181183 
    182 
     184signed int Device::read_tco(quadlet_t *tco_data, signed int size) 
     185
     186    // Read the TCO registers and return the respective values in *tco_data.  
     187    // Return value is 0 on success, or -1 if there is no TCO present.  
     188    // "size" is the size (in quadlets) of the array pointed to by tco_data.  
     189    // To obtain all TCO data "size" should be at least 4.  If the caller 
     190    // doesn't care about the data returned by the TCO, tco_data can be 
     191    // NULL. 
     192    quadlet_t buf[4]; 
     193    signed int i; 
     194 
     195    // The Fireface 400 can't have the TCO fitted 
     196    if (m_rme_model==RME_MODEL_FIREFACE400) 
     197        return -1; 
     198 
     199    if (readBlock(RME_FF_TCO_READ_REG, buf, 4) != 0) 
     200        return -1; 
     201 
     202    if (tco_data != NULL) { 
     203        for (i=0; i<(size<4)?size:4; i++) 
     204            tco_data[i] = buf[i]; 
     205    } 
     206 
     207    if ( (buf[0] & 0x80808080) == 0x80808080 && 
     208         (buf[1] & 0x80808080) == 0x80808080 && 
     209         (buf[2] & 0x80808080) == 0x80808080 && 
     210         (buf[3] & 0x8000FFFF) == 0x80008000) { 
     211        // A TCO is present 
     212        return 0; 
     213    } 
     214 
     215    return -1; 
     216
     217 
     218signed int Device::write_tco(quadlet_t *tco_data, signed int size) 
     219
     220    // Writes data to the TCO.  No check is made as to whether a TCO 
     221    // is present in the current device.  Return value is 0 on success 
     222    // or -1 on error.  The first 4 quadlets of tco_data are significant; 
     223    // all others are ignored.  If fewer than 4 quadlets are supplied (as 
     224    // indicated by the "size" parameter, -1 will be returned. 
     225    if (size < 4) 
     226        return -1; 
     227 
     228    // Don't bother trying to write if the device is a FF400 since the TCO 
     229    // can't be fitted to this device. 
     230    if (m_rme_model==RME_MODEL_FIREFACE400) 
     231        return -1; 
     232 
     233    if (writeBlock(RME_FF_TCO_WRITE_REG, tco_data, 4) != 0) 
     234        return -1; 
     235 
     236    return 0; 
     237
     238 
     239
  • trunk/libffado/src/rme/rme_avdevice.h

    r1547 r1573  
    115115    /* Hardware functions */ 
    116116    signed int init_hardware(void); 
     117    signed int read_tco(quadlet_t *tco_data, signed int size); 
     118    signed int write_tco(quadlet_t *tco_data, signed int size); 
     119     
    117120}; 
    118121