Changeset 1684

Show
Ignore:
Timestamp:
10/12/09 05:11:09 (14 years ago)
Author:
jwoithe
Message:

RME: more preparatory work on the streaming system

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/libstreaming/rme/RmeReceiveStreamProcessor.cpp

    r1674 r1684  
    9797 
    9898 
    99 /** 
    100  * Processes packet header to extract timestamps and check if the packet is valid 
    101  * @param data  
    102  * @param length  
    103  * @param channel  
    104  * @param tag  
    105  * @param sy  
    106  * @param cycle  
    107  * @return  
     99/* 
     100 * Processes packet header to extract timestamps and check if the packet is  
     101 * valid. 
    108102 */ 
    109103enum StreamProcessor::eChildReturnValue 
     
    113107{ 
    114108    if (length > 8) { 
    115         // The iso data blocks from the RMEs comprise a CIP-like 
    116         // header followed by a number of events (8 for 1x rates, 16 
    117         // for 2x rates, 32 for 4x rates)
    118         quadlet_t *quadlet = (quadlet_t *)data; 
    119         unsigned int dbs = get_bits(CondSwapFromBus32(quadlet[0]), 23, 8);  // Size of one event in terms of fdf_size 
    120         unsigned int fdf_size = get_bits(CondSwapFromBus32(quadlet[1]), 23, 8) == 0x22 ? 32:0; // Event unit size in bits 
     109        // The iso data blocks from the RMEs comprise 24-bit audio 
     110        // data encoded in 32-bit integers.  The LSB of the 32-bit integers 
     111        // of certain channels are used for house-keeping information
     112        // The number of samples for each channel present in a packet 
     113        // varies: 7 for 1x rates, 15 for 2x rates and 25 for 4x rates. 
     114        // quadlet_t *quadlet = (quadlet_t *)data; 
    121115 
    122116        // Don't even attempt to process a packet if it isn't what we expect 
    123         // from a RME.  Yes, an FDF value of 32 bears little relationship 
    124         // to the actual data (24 bit integer) sent by the RME - it's one 
    125         // of those areas where RME have taken a curious detour around the 
    126         // standards.  Do this check early on because for invalid packets 
    127         // dbs may not be what we expect, potentially causing issues later 
    128         // on. 
    129         if (tag!=1 || fdf_size!=32 || dbs==0) { 
     117        // from an RME.  For now the only condition seems to be a tag of 0. 
     118        // This will be fleshed out in due course. 
     119        if (tag!=1) { 
    130120            return eCRV_Invalid; 
    131121        } 
    132122 
    133         // m_event_size is the event size in bytes 
    134 //        unsigned int n_events = (length-8) / m_event_size; 
    135  
    136         // Acquire the timestamp of the last frame in the packet just 
    137         // received.  Since every frame from the RME has its own timestamp 
    138         // we can just pick it straight from the packet. 
    139 //        uint32_t last_sph = CondSwapFromBus32(*(quadlet_t *)(data+8+(n_events-1)*m_event_size)); 
    140 //        m_last_timestamp = sphRecvToFullTicks(last_sph, m_Parent.get1394Service().getCycleTimer()); 
     123        // Timestamps are not transmitted explicitly by the RME interfaces 
     124        // so we'll have to fake it somehow in order to fit in with the 
     125        // rest of the FFADO infrastructure.  For now just take the current 
     126        // value of the cycle timer as the "last timestamp".  In practice  
     127        // there a fixed offset that we'll have to include eventually. 
     128        m_last_timestamp = CYCLE_TIMER_TO_TICKS(m_Parent.get1394Service().getCycleTimer()); 
    141129 
    142130        return eCRV_OK; 
     
    176164    #endif 
    177165 
    178     if(m_data_buffer->writeFrames(n_events, (char *)(data+8), m_last_timestamp)) { 
     166    if(m_data_buffer->writeFrames(n_events, (char *)data, m_last_timestamp)) { 
    179167        return eCRV_OK; 
    180168    } else { 
     
    229217 
    230218    // Use char here since a port's source address won't necessarily be 
    231     // aligned; use of an unaligned quadlet_t may cause issues on 
    232     // certain architectures.  Besides, the source (data coming directly 
    233     // from the RME) isn't structured in quadlets anyway; it mainly 
    234     // consists of packed 24-bit integers
     219    // aligned; use of an unaligned quadlet_t may cause issues on certain 
     220    // architectures.  Besides, the source (data coming directly from the 
     221    // RME) isn't structured in quadlets anyway; it consists 24-bit integers 
     222    // within 32-bit quadlets with the LSB being a housekeeping byte
    235223 
    236224    unsigned char *src_data; 
  • trunk/libffado/src/rme/rme_avdevice.cpp

    r1671 r1684  
    8989    , iso_tx_channel( -1 ) 
    9090    , iso_rx_channel( -1 ) 
     91    , m_receiveProcessor( NULL ) 
     92    , m_transmitProcessor( NULL ) 
    9193    , m_MixerContainer( NULL ) 
    9294    , m_ControlContainer( NULL ) 
     
    614616    config.getValueForDeviceSetting(getConfigRom().getNodeVendorId(), getConfigRom().getModelId(), "xmit_sp_dll_bw", xmit_sp_dll_bw); 
    615617 
     618    // Set up receive stream processor, initialise it and set DLL bw 
     619    // TODO: set event_size properly; the value below is just a placeholder. 
     620    signed int event_size = 0x150; 
     621    #warning event_size needs setting up 
     622    m_receiveProcessor = new Streaming::RmeReceiveStreamProcessor(*this,  
     623      m_rme_model, event_size); 
     624    m_receiveProcessor->setVerboseLevel(getDebugLevel()); 
     625    if (!m_receiveProcessor) { 
     626        debugFatal("Could not initialize receive processor!\n"); 
     627        return false; 
     628    } 
     629    if (!m_receiveProcessor->setDllBandwidth(recv_sp_dll_bw)) { 
     630        debugFatal("Could not set DLL bandwidth\n"); 
     631        delete m_receiveProcessor; 
     632        m_receiveProcessor = NULL; 
     633        return false; 
     634    } 
     635 
     636    // Add ports to the processor - TODO 
     637    std::string id=std::string("dev?"); 
     638    if (!getOption("id", id)) { 
     639        debugWarning("Could not retrieve id parameter, defaulting to 'dev?'\n"); 
     640    } 
     641 
    616642    // Other things to be done: 
    617     //  * create a receive stream processor, set DLL bandwidth, add ports 
    618643    //  * create a transmit stream processor, set DLL bandwidth, add ports 
    619644 
  • trunk/libffado/src/rme/rme_avdevice.h

    r1660 r1684  
    3434 
    3535#include "fireface_def.h" 
    36 // #include "libstreaming/rme/RmeStreamProcessor.h" 
     36#include "libstreaming/rme/RmeReceiveStreamProcessor.h" 
     37#include "libstreaming/rme/RmeTransmitStreamProcessor.h" 
    3738 
    3839#include "rme_shm.h" 
     
    128129    signed int iso_tx_channel, iso_rx_channel; 
    129130 
     131    Streaming::RmeReceiveStreamProcessor *m_receiveProcessor; 
     132    Streaming::RmeTransmitStreamProcessor *m_transmitProcessor; 
     133 
    130134private: 
    131135    unsigned long long int cmd_buffer_addr();