Changeset 2416

Show
Ignore:
Timestamp:
09/30/13 06:03:04 (10 years ago)
Author:
jwoithe
Message:

motu: implement block async functions since they are ultimately required when dealing with mixers on mk3 devices. These were templated off those in the RME driver, but note that the byte swapping requirements are different. The new functions have been compile-tested only.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/dice/dice_avdevice.cpp

    r2258 r2416  
    6060Device::Device( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom )) 
    6161    : FFADODevice( d, configRom ) 
     62    , m_rate_cache( -1 ) 
    6263    , m_eap( NULL ) 
    6364    , m_global_reg_offset (0xFFFFFFFFLU) 
     
    251252        case DICE_RATE_NONE:     samplingFrequency = 0;     break; 
    252253        default:                 samplingFrequency = 0; break; 
     254    } 
     255 
     256    if (samplingFrequency != m_rate_cache) { 
     257        if (m_rate_cache>0 && m_eap) 
     258            m_eap->update(); 
     259        m_rate_cache = samplingFrequency; 
    253260    } 
    254261 
     
    423430 
    424431    if (m_eap) { 
     432        m_rate_cache = samplingFrequency; 
    425433        m_eap->update(); 
    426434    } 
  • trunk/libffado/src/dice/dice_avdevice.h

    r2204 r2416  
    175175// EAP stuff 
    176176private: 
     177    int m_rate_cache; 
    177178    EAP*         m_eap; 
    178179protected: 
  • trunk/libffado/src/motu/motu_avdevice.cpp

    r2372 r2416  
    25752575} 
    25762576 
     2577signed int 
     2578MotuDevice::readBlock(fb_nodeaddr_t reg, quadlet_t *buf, signed int n_quads) { 
     2579// 
     2580// Read "n_quads" quadlets from the device starting at register "reg" into 
     2581// the buffer pointed to by "buf".  "buf" is assumed to have been 
     2582// preallocated and be large enough for the requested data. 
     2583// 
     2584    signed int i; 
     2585 
     2586    if (get1394Service().read(0xffc0 | getNodeId(), reg, n_quads, buf) <= 0) { 
     2587        debugError("Error doing motu block read of %d quadlets from register 0x%llx\n", n_quads, reg); 
     2588        return -1; 
     2589    } 
     2590    for (i=0; i<n_quads; i++) { 
     2591        buf[i] = CondSwapFromBus32(buf[i]); 
     2592    } 
     2593    return 0; 
     2594} 
     2595 
    25772596signed int MotuDevice::WriteRegister(fb_nodeaddr_t reg, quadlet_t data) { 
    25782597/* 
     
    25992618} 
    26002619 
    2601 
     2620signed int 
     2621MotuDevice::writeBlock(fb_nodeaddr_t reg, quadlet_t *data, signed int n_quads) { 
     2622// 
     2623// Write n_quads quadlets from "data" to the device register "reg".  Note that 
     2624// any necessary byte swapping is done in place, so the contents of "data" 
     2625// may be altered by this function. 
     2626// 
     2627    signed int ret = 0; 
     2628    signed int i; 
     2629    for (i=0; i<n_quads; i++) { 
     2630        data[i] = CondSwapToBus32(data[i]); 
     2631    } 
     2632    if (get1394Service().write(0xffc0 | getNodeId(), reg, n_quads, data) <= 0) { 
     2633        ret = -1; 
     2634        debugError("Error doing motu block write of %d quadlets to register 0x%llx\n", n_quads, reg); 
     2635    } 
     2636    return ret; 
     2637
     2638 
     2639
  • trunk/libffado/src/motu/motu_avdevice.h

    r2368 r2416  
    461461public: 
    462462    unsigned int ReadRegister(fb_nodeaddr_t reg); 
     463    signed int readBlock(fb_nodeaddr_t reg, quadlet_t *buf, signed int n_quads); 
    463464    signed int WriteRegister(fb_nodeaddr_t reg, quadlet_t data); 
     465    signed int writeBlock(fb_nodeaddr_t reg, quadlet_t *data, signed int n_quads); 
    464466 
    465467private: