Show
Ignore:
Timestamp:
04/02/07 12:35:17 (15 years ago)
Author:
pieterpalmers
Message:

* name change from FreeBoB to FFADO
* replaced tabs by 4 spaces
* got rid of end-of-line spaces
* made all license and copyrights conform

library becomes LGPL, apps become GPL
explicitly state LGPL v2.1 and GPL v2 (don't like v3 draft)

copyrights are 2005-2007 Daniel & Pieter
except for the MotU stuff (C) Jonathan, Pieter

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/bounce/bounce_avdevice.cpp

    r436 r445  
    1 /* bounce_avdevice.cpp 
    2  * Copyright (C) 2006 by Pieter Palmers 
    3  * Copyright (C) 2006 by Daniel Wagner 
     1/* 
     2 * Copyright (C) 2005-2007 by Pieter Palmers 
     3 * Copyright (C) 2005-2007 by Daniel Wagner 
    44 * 
    5  * This file is part of FreeBoB. 
     5 * This file is part of FFADO 
     6 * FFADO = Free Firewire (pro-)audio drivers for linux 
    67 * 
    7  * FreeBoB is free software; you can redistribute it and/or modify 
    8  * it under the terms of the GNU General Public License as published by 
    9  * the Free Software Foundation; either version 2 of the License, or 
    10  * (at your option) any later version. 
    11  * FreeBoB is distributed in the hope that it will be useful, 
     8 * FFADO is based upon FreeBoB 
     9 * 
     10 * This library is free software; you can redistribute it and/or 
     11 * modify it under the terms of the GNU Lesser General Public 
     12 * License version 2.1, as published by the Free Software Foundation; 
     13 * 
     14 * This library is distributed in the hope that it will be useful, 
    1215 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    14  * GNU General Public License for more details. 
     16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     17 * Lesser General Public License for more details. 
    1518 * 
    16  * You should have received a copy of the GNU General Public License 
    17  * along with FreeBoB; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    19  * MA 02111-1307 USA. 
     19 * You should have received a copy of the GNU Lesser General Public 
     20 * License along with this library; if not, write to the Free Software 
     21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
     22 * MA 02110-1301 USA 
    2023 */ 
     24 
    2125#include "bounce/bounce_avdevice.h" 
    2226 
     
    4549static VendorModelEntry supportedDeviceList[] = 
    4650{ 
    47     {0x0B0001LU, 0x0B0001LU, 0x0B0001LU, "FreeBoB", "Bounce"}, 
     51    {0x0B0001LU, 0x0B0001LU, 0x0B0001LU, "FFADO", "Bounce"}, 
    4852}; 
    4953 
     
    8084          ++i ) 
    8185    { 
    82         if (  
     86        if ( 
    8387//             ( supportedDeviceList[i].vendor_id == vendorId ) 
    8488             ( supportedDeviceList[i].model_id == modelId ) 
    85              && ( supportedDeviceList[i].unit_specifier_id == unitSpecifierId )  
     89             && ( supportedDeviceList[i].unit_specifier_id == unitSpecifierId ) 
    8690           ) 
    8791        { 
     
    98102    debugOutput( DEBUG_LEVEL_VERBOSE, "discovering BounceDevice (NodeID %d)\n", 
    99103                 m_nodeId ); 
    100                   
     104 
    101105//     unsigned int vendorId = m_pConfigRom->getNodeVendorId(); 
    102106    unsigned int modelId = m_pConfigRom->getModelId(); 
     
    108112    { 
    109113        if ( //( supportedDeviceList[i].vendor_id == vendorId ) 
    110              ( supportedDeviceList[i].model_id == modelId )  
    111              && ( supportedDeviceList[i].unit_specifier_id == unitSpecifierId )  
     114             ( supportedDeviceList[i].model_id == modelId ) 
     115             && ( supportedDeviceList[i].unit_specifier_id == unitSpecifierId ) 
    112116           ) 
    113117        { 
     
    168172 
    169173    debugOutput(DEBUG_LEVEL_VERBOSE,"Adding ports to processor\n"); 
    170      
     174 
    171175    std::string id=std::string("dev?"); 
    172176    if(!getOption("id", id)) { 
    173177        debugWarning("Could not retrieve id parameter, defauling to 'dev?'\n"); 
    174178    } 
    175      
     179 
    176180    int i=0; 
    177181    for (i=0;i<BOUNCE_NB_AUDIO_CHANNELS;i++) { 
     
    205209        free(buff); 
    206210    } 
    207      
     211 
    208212    for (i=0;i<BOUNCE_NB_MIDI_CHANNELS;i++) { 
    209213        char *buff; 
     
    237241     } 
    238242 
    239        return true; 
     243    return true; 
    240244} 
    241245 
     
    243247BounceDevice::prepare() { 
    244248    debugOutput(DEBUG_LEVEL_NORMAL, "Preparing BounceDevice...\n" ); 
    245      
     249 
    246250    bool snoopMode=false; 
    247251    if(!getOption("snoopMode", snoopMode)) { 
     
    251255    // create & add streamprocessors 
    252256    Streaming::StreamProcessor *p; 
    253      
     257 
    254258    p=new Streaming::AmdtpReceiveStreamProcessor( 
    255259                             m_p1394Service->getPort(), 
     
    285289                                BOUNCE_NB_AUDIO_CHANNELS+(BOUNCE_NB_MIDI_CHANNELS?1:0)); 
    286290    } 
    287      
     291 
    288292    if(!p->init()) { 
    289293        debugFatal("Could not initialize transmit processor %s!\n", 
     
    335339        int n=i; 
    336340        Streaming::StreamProcessor *p=m_receiveProcessors.at(n); 
    337          
     341 
    338342        // allocate ISO channel 
    339343        int isochannel=allocateIsoChannel(p->getMaxPacketSize()); 
     
    343347        } 
    344348        p->setChannel(isochannel); 
    345          
     349 
    346350        fb_quadlet_t reg_isoch; 
    347351        // check value of ISO_CHANNEL register 
     
    358362            return false; 
    359363        } 
    360          
     364 
    361365        // write value of ISO_CHANNEL register 
    362366        reg_isoch=isochannel; 
     
    367371            return false; 
    368372        } 
    369          
     373 
    370374        return true; 
    371          
     375 
    372376    } else if (i<(int)m_receiveProcessors.size() + (int)m_transmitProcessors.size()) { 
    373377        int n=i-m_receiveProcessors.size(); 
    374378        Streaming::StreamProcessor *p=m_transmitProcessors.at(n); 
    375          
     379 
    376380        // allocate ISO channel 
    377381        int isochannel=allocateIsoChannel(p->getMaxPacketSize()); 
     
    381385        } 
    382386        p->setChannel(isochannel); 
    383          
     387 
    384388        fb_quadlet_t reg_isoch; 
    385389        // check value of ISO_CHANNEL register 
     
    396400            return false; 
    397401        } 
    398          
     402 
    399403        // write value of ISO_CHANNEL register 
    400404        reg_isoch=isochannel; 
     
    405409            return false; 
    406410        } 
    407          
     411 
    408412        return true; 
    409413    } 
    410      
     414 
    411415    debugError("SP index %d out of range!\n",i); 
    412      
     416 
    413417    return false; 
    414418} 
     
    420424        Streaming::StreamProcessor *p=m_receiveProcessors.at(n); 
    421425        unsigned int isochannel=p->getChannel(); 
    422          
     426 
    423427        fb_quadlet_t reg_isoch; 
    424428        // check value of ISO_CHANNEL register 
     
    431435            return false; 
    432436        } 
    433          
     437 
    434438        // write value of ISO_CHANNEL register 
    435439        reg_isoch=0xFFFFFFFFUL; 
     
    438442            return false; 
    439443        } 
    440          
     444 
    441445        // deallocate ISO channel 
    442446        if(!deallocateIsoChannel(isochannel)) { 
     
    444448            return false; 
    445449        } 
    446          
     450 
    447451        p->setChannel(-1); 
    448452        return true; 
    449          
     453 
    450454    } else if (i<(int)m_receiveProcessors.size() + (int)m_transmitProcessors.size()) { 
    451455        int n=i-m_receiveProcessors.size(); 
    452456        Streaming::StreamProcessor *p=m_transmitProcessors.at(n); 
    453          
     457 
    454458        unsigned int isochannel=p->getChannel(); 
    455          
     459 
    456460        fb_quadlet_t reg_isoch; 
    457461        // check value of ISO_CHANNEL register 
     
    464468            return false; 
    465469        } 
    466          
     470 
    467471        // write value of ISO_CHANNEL register 
    468472        reg_isoch=0xFFFFFFFFUL; 
     
    471475            return false; 
    472476        } 
    473          
     477 
    474478        // deallocate ISO channel 
    475479        if(!deallocateIsoChannel(isochannel)) { 
     
    477481            return false; 
    478482        } 
    479          
     483 
    480484        p->setChannel(-1); 
    481485        return true; 
    482486    } 
    483      
     487 
    484488    debugError("SP index %d out of range!\n",i); 
    485489    return false; 
     
    491495int BounceDevice::allocateIsoChannel(unsigned int packet_size) { 
    492496    unsigned int bandwidth=8+packet_size; 
    493      
     497 
    494498    int ch=m_p1394Service->allocateIsoChannelGeneric(bandwidth); 
    495          
     499 
    496500    debugOutput(DEBUG_LEVEL_VERBOSE, "allocated channel %d, bandwidth %d\n", 
    497501        ch, bandwidth); 
    498      
     502 
    499503    return ch; 
    500504} 
     
    510514BounceDevice::readReg(fb_nodeaddr_t offset, fb_quadlet_t *result) { 
    511515    debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Reading base register offset 0x%08llX\n", offset); 
    512      
     516 
    513517    if(offset >= BOUNCE_INVALID_OFFSET) { 
    514518        debugError("invalid offset: 0x%016llX\n", offset); 
    515519        return false; 
    516520    } 
    517      
     521 
    518522    fb_nodeaddr_t addr=BOUNCE_REGISTER_BASE + offset; 
    519523    fb_nodeid_t nodeId=m_nodeId | 0xFFC0; 
    520      
     524 
    521525    if(!m_p1394Service->read_quadlet( nodeId, addr, result ) ) { 
    522526        debugError("Could not read from node 0x%04X addr 0x%012X\n", nodeId, addr); 
     
    524528    } 
    525529    debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Read result: 0x%08X\n", *result); 
    526     
     530 
    527531    return true; 
    528532} 
     
    530534bool 
    531535BounceDevice::writeReg(fb_nodeaddr_t offset, fb_quadlet_t data) { 
    532     debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Writing base register offset 0x%08llX, data: 0x%08X\n",   
     536    debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Writing base register offset 0x%08llX, data: 0x%08X\n", 
    533537        offset, data); 
    534      
     538 
    535539    if(offset >= BOUNCE_INVALID_OFFSET) { 
    536540        debugError("invalid offset: 0x%016llX\n", offset); 
    537541        return false; 
    538542    } 
    539      
     543 
    540544    fb_nodeaddr_t addr=BOUNCE_REGISTER_BASE + offset; 
    541545    fb_nodeid_t nodeId=m_nodeId | 0xFFC0; 
    542      
     546 
    543547    if(!m_p1394Service->write_quadlet( nodeId, addr, data ) ) { 
    544548        debugError("Could not write to node 0x%04X addr 0x%012X\n", nodeId, addr); 
     
    548552} 
    549553 
    550 bool  
     554bool 
    551555BounceDevice::readRegBlock(fb_nodeaddr_t offset, fb_quadlet_t *data, size_t length) { 
    552     debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Reading base register offset 0x%08llX, length %u\n",  
     556    debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Reading base register offset 0x%08llX, length %u\n", 
    553557        offset, length); 
    554      
     558 
    555559    if(offset >= BOUNCE_INVALID_OFFSET) { 
    556560        debugError("invalid offset: 0x%016llX\n", offset); 
    557561        return false; 
    558562    } 
    559      
     563 
    560564    fb_nodeaddr_t addr=BOUNCE_REGISTER_BASE + offset; 
    561565    fb_nodeid_t nodeId=m_nodeId | 0xFFC0; 
    562      
     566 
    563567    if(!m_p1394Service->read( nodeId, addr, length, data ) ) { 
    564568        debugError("Could not read from node 0x%04X addr 0x%012llX\n", nodeId, addr); 
     
    568572} 
    569573 
    570 bool  
     574bool 
    571575BounceDevice::writeRegBlock(fb_nodeaddr_t offset, fb_quadlet_t *data, size_t length) { 
    572     debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Writing base register offset 0x%08llX, length: %u\n",   
     576    debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Writing base register offset 0x%08llX, length: %u\n", 
    573577        offset, length); 
    574      
     578 
    575579    if(offset >= BOUNCE_INVALID_OFFSET) { 
    576580        debugError("invalid offset: 0x%016llX\n", offset); 
    577581        return false; 
    578582    } 
    579      
     583 
    580584    fb_nodeaddr_t addr=BOUNCE_REGISTER_BASE + offset; 
    581585    fb_nodeid_t nodeId=m_nodeId | 0xFFC0; 
  • trunk/libffado/src/bounce/bounce_avdevice.h

    r436 r445  
    1 /* bounce_avdevice.h 
    2  * Copyright (C) 2006 by Pieter Palmers 
    3  * Copyright (C) 2006 by Daniel Wagner 
     1/* 
     2 * Copyright (C) 2005-2007 by Pieter Palmers 
     3 * Copyright (C) 2005-2007 by Daniel Wagner 
    44 * 
    5  * This file is part of FreeBoB. 
     5 * This file is part of FFADO 
     6 * FFADO = Free Firewire (pro-)audio drivers for linux 
    67 * 
    7  * FreeBoB is free software; you can redistribute it and/or modify 
    8  * it under the terms of the GNU General Public License as published by 
    9  * the Free Software Foundation; either version 2 of the License, or 
    10  * (at your option) any later version. 
    11  * FreeBoB is distributed in the hope that it will be useful, 
     8 * FFADO is based upon FreeBoB 
     9 * 
     10 * This library is free software; you can redistribute it and/or 
     11 * modify it under the terms of the GNU Lesser General Public 
     12 * License version 2.1, as published by the Free Software Foundation; 
     13 * 
     14 * This library is distributed in the hope that it will be useful, 
    1215 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    14  * GNU General Public License for more details. 
     16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     17 * Lesser General Public License for more details. 
    1518 * 
    16  * You should have received a copy of the GNU General Public License 
    17  * along with FreeBoB; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
    19  * MA 02111-1307 USA. 
     19 * You should have received a copy of the GNU Lesser General Public 
     20 * License along with this library; if not, write to the Free Software 
     21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
     22 * MA 02110-1301 USA 
    2023 */ 
     24 
    2125#ifndef BOUNCEDEVICE_H 
    2226#define BOUNCEDEVICE_H 
     
    6670public: 
    6771    BounceDevice( std::auto_ptr<ConfigRom>( configRom ), 
    68                  Ieee1394Service& ieee1394Service, 
    69                  int nodeId ); 
     72          Ieee1394Service& ieee1394Service, 
     73          int nodeId ); 
    7074    virtual ~BounceDevice(); 
    7175 
    7276    static bool probe( ConfigRom& configRom ); 
    7377    bool discover(); 
    74      
     78 
    7579    bool setSamplingFrequency( ESamplingFrequency samplingFrequency ); 
    7680    int getSamplingFrequency( ); 
    77      
     81 
    7882    bool prepare(); 
    7983    bool lock(); 
     
    8690    bool startStreamByIndex(int i); 
    8791    bool stopStreamByIndex(int i); 
    88      
     92 
    8993    void showDevice(); 
    9094 
     
    99103 
    100104    bool addPortsToProcessor( 
    101        Streaming::StreamProcessor *processor,  
     105       Streaming::StreamProcessor *processor, 
    102106       Streaming::Port::E_Direction direction); 
    103      
     107 
    104108private: // generic helpers 
    105109    int allocateIsoChannel(unsigned int packet_size); 
     
    112116    bool readRegBlock(fb_nodeaddr_t, fb_quadlet_t *, size_t); 
    113117    bool writeRegBlock(fb_nodeaddr_t, fb_quadlet_t *, size_t); 
    114      
     118 
    115119private: 
    116120    BounceNotifier *m_Notifier; 
    117121    /** 
    118      * this class reacts on the other side writing to the  
     122     * this class reacts on the other side writing to the 
    119123     * hosts address space 
    120124     */ 
     
    126130        BounceNotifier(BounceDevice *, nodeaddr_t start); 
    127131        virtual ~BounceNotifier(); 
    128          
     132 
    129133    private: 
    130134        BounceDevice *m_bouncedevice; 
  • trunk/libffado/src/bounce/bounce_slave_avdevice.cpp

    r435 r445  
    1 /* $Id$ */ 
    2  
    31/* 
    4  *   FreeBob Streaming API 
    5  *   FreeBob = Firewire (pro-)audio for linux 
     2 * Copyright (C) 2005-2007 by Pieter Palmers 
     3 * Copyright (C) 2005-2007 by Daniel Wagner 
    64 * 
    7  *   http://freebob.sf.net 
     5 * This file is part of FFADO 
     6 * FFADO = Free Firewire (pro-)audio drivers for linux 
    87 * 
    9  *   Copyright (C) 2007 Pieter Palmers <pieterpalmers@users.sourceforge.net> 
     8 * FFADO is based upon FreeBoB 
    109 * 
    11  *   This program is free software {} you can redistribute it and/or modify 
    12  *   it under the terms of the GNU General Public License as published by 
    13  *   the Free Software Foundation {} either version 2 of the License, or 
    14  *   (at your option) any later version. 
     10 * This library is free software; you can redistribute it and/or 
     11 * modify it under the terms of the GNU Lesser General Public 
     12 * License version 2.1, as published by the Free Software Foundation; 
    1513 * 
    16  *   This program is distributed in the hope that it will be useful, 
    17  *   but WITHOUT ANY WARRANTY {} without even the implied warranty of 
    18  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    19  *   GNU General Public License for more details. 
     14 * This library is distributed in the hope that it will be useful, 
     15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     17 * Lesser General Public License for more details. 
    2018 * 
    21  *   You should have received a copy of the GNU General Public License 
    22  *   along with this program {} if not, write to the Free Software 
    23  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
    24  * 
    25  *  
    26  * 
     19 * You should have received a copy of the GNU Lesser General Public 
     20 * License along with this library; if not, write to the Free Software 
     21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
     22 * MA 02110-1301 USA 
    2723 */ 
    2824 
     
    4238{ 
    4339  //{vendor_id, model_id, unit_specifier_id, vendor_name, model_name}, 
    44     {0x0B0001, 0x0B0001, 0x0B0001, "FreeBoB", "Bounce Slave"}, 
     40    {0x0B0001, 0x0B0001, 0x0B0001, "FFADO", "Bounce Slave"}, 
    4541}; 
    4642 
     
    8076    debugOutput(DEBUG_LEVEL_VERBOSE, "Initializing memory space...\n"); 
    8177    fb_quadlet_t result=0xFFFFFFFFLU; 
    82      
     78 
    8379    // initialize the ISO channel registers 
    8480    // this will write to our own registers 
     
    9187        return false; 
    9288    } 
    93      
     89 
    9490    // set everything such that we can be discovered 
    9591    m_original_config_rom=save_config_rom( m_p1394Service->getHandle() ); 
    96      
     92 
    9793    if ( init_config_rom( m_p1394Service->getHandle() ) < 0 ) { 
    9894        debugError("Could not initalize local config rom\n"); 
    9995        return false; 
    10096    } 
    101      
     97 
    10298    // refresh our config rom cache 
    10399    if ( !m_pConfigRom->initialize() ) { 
     
    122118bool 
    123119BounceSlaveDevice::lock() { 
    124     debugOutput(DEBUG_LEVEL_VERBOSE, "Locking %s %s at node %d\n",  
     120    debugOutput(DEBUG_LEVEL_VERBOSE, "Locking %s %s at node %d\n", 
    125121        m_model->vendor_name, m_model->model_name, m_nodeId); 
    126      
     122 
    127123    // get a notifier to handle device notifications 
    128124    nodeaddr_t notify_address; 
     
    131127                        BOUNCE_REGISTER_LENGTH, 
    132128                        BOUNCE_REGISTER_LENGTH); 
    133      
     129 
    134130    if (notify_address == 0xFFFFFFFFFFFFFFFFLLU) { 
    135131        debugError("Could not find free ARM block for notification\n"); 
    136132        return false; 
    137133    } 
    138      
     134 
    139135    m_Notifier=new BounceSlaveDevice::BounceSlaveNotifier(this, notify_address); 
    140      
     136 
    141137    if(!m_Notifier) { 
    142138        debugError("Could not allocate notifier\n"); 
    143139        return false; 
    144140    } 
    145      
     141 
    146142    if (!m_p1394Service->registerARMHandler(m_Notifier)) { 
    147143        debugError("Could not register notifier\n"); 
     
    150146        return false; 
    151147    } 
    152      
     148 
    153149    // (re)initialize the memory space 
    154150    if (!initMemSpace()) { 
     
    156152        return false; 
    157153    } 
    158      
     154 
    159155    return true; 
    160156} 
     
    177173BounceSlaveDevice::prepare() { 
    178174    debugOutput(DEBUG_LEVEL_NORMAL, "Preparing BounceSlaveDevice...\n" ); 
    179      
     175 
    180176    // create & add streamprocessors 
    181177    Streaming::StreamProcessor *p; 
    182      
     178 
    183179    p=new Streaming::AmdtpSlaveReceiveStreamProcessor( 
    184180                             m_p1394Service->getPort(), 
     
    206202                                m_samplerate, 
    207203                                BOUNCE_NB_AUDIO_CHANNELS); 
    208      
     204 
    209205    if(!p->init()) { 
    210206        debugFatal("Could not initialize transmit processor!\n"); 
     
    227223bool 
    228224BounceSlaveDevice::startStreamByIndex(int i) { 
    229      
     225 
    230226    if (i<(int)m_receiveProcessors.size()) { 
    231227        int n=i; 
    232228        Streaming::StreamProcessor *p=m_receiveProcessors.at(n); 
    233          
     229 
    234230        // the other side sends on this channel 
    235231        nodeaddr_t iso_channel_offset = BOUNCE_REGISTER_RX_ISOCHANNEL; 
    236232        iso_channel_offset += ((unsigned)n)*4; 
    237          
     233 
    238234        if (!waitForRegisterNotEqualTo(iso_channel_offset, 0xFFFFFFFFLU)) { 
    239235            debugError("Timeout waiting for stream %d to get an ISO channel\n",i); 
    240236            return false; 
    241237        } 
    242          
     238 
    243239        fb_quadlet_t result; 
    244240        // this will read from our own registers 
     
    247243            return false; 
    248244        } 
    249          
     245 
    250246        // set ISO channel 
    251247        p->setChannel(result); 
    252248 
    253249        return true; 
    254          
     250 
    255251    } else if (i<(int)m_receiveProcessors.size() + (int)m_transmitProcessors.size()) { 
    256252        int n=i-m_receiveProcessors.size(); 
    257253        Streaming::StreamProcessor *p=m_transmitProcessors.at(n); 
    258          
     254 
    259255        // the other side sends on this channel 
    260256        nodeaddr_t iso_channel_offset = BOUNCE_REGISTER_TX_ISOCHANNEL; 
    261257        iso_channel_offset += ((unsigned)n)*4; 
    262          
     258 
    263259        if (!waitForRegisterNotEqualTo(iso_channel_offset, 0xFFFFFFFF)) { 
    264260            debugError("Timeout waiting for stream %d to get an ISO channel\n",i); 
    265261            return false; 
    266262        } 
    267          
     263 
    268264        fb_quadlet_t result; 
    269265        // this will read from our own registers 
     
    272268            return false; 
    273269        } 
    274          
     270 
    275271        // set ISO channel 
    276272        p->setChannel(result); 
     
    279275 
    280276    } 
    281      
     277 
    282278    debugError("SP index %d out of range!\n",i); 
    283      
     279 
    284280    return false; 
    285281} 
     
    301297        debugWarning("Could not retrieve isoTimeoutSecs parameter, defauling to 120secs\n"); 
    302298    } 
    303      
     299 
    304300    int wait_cycles=timeoutSecs*10; // two seconds 
    305      
     301 
    306302    fb_quadlet_t reg=v; 
    307      
     303 
    308304    while ((v == reg) && wait_cycles) { 
    309305        wait_cycles--; 
     
    318314        return false; 
    319315    } 
    320      
     316 
    321317    return true; 
    322318} 
     
    326322 
    327323 
    328 struct BounceSlaveDevice::configrom_backup  
     324struct BounceSlaveDevice::configrom_backup 
    329325BounceSlaveDevice::save_config_rom(raw1394handle_t handle) 
    330326{ 
     
    333329    /* get the current rom image */ 
    334330    retval=raw1394_get_config_rom(handle, tmp.rom, 0x100, &tmp.rom_size, &tmp.rom_version); 
    335 //     tmp.rom_size=rom1394_get_size(tmp.rom); 
     331//     tmp.rom_size=rom1394_get_size(tmp.rom); 
    336332//     printf("save_config_rom get_config_rom returned %d, romsize %d, rom_version %d:\n",retval,tmp.rom_size,tmp.rom_version); 
    337333 
     
    339335} 
    340336 
    341 int  
     337int 
    342338BounceSlaveDevice::restore_config_rom(raw1394handle_t handle, struct BounceSlaveDevice::configrom_backup old) 
    343339{ 
    344340    int retval; 
    345341//     int i; 
    346      
     342 
    347343    quadlet_t current_rom[0x100]; 
    348344    size_t current_rom_size; 
     
    371367} 
    372368 
    373 int  
     369int 
    374370BounceSlaveDevice::init_config_rom(raw1394handle_t handle) 
    375371{ 
     
    380376    rom1394_directory dir; 
    381377    char *leaf; 
    382      
     378 
    383379    /* get the current rom image */ 
    384380    retval=raw1394_get_config_rom(handle, rom, 0x100, &rom_size, &rom_version); 
     
    391387//     } 
    392388//     printf("\n"); 
    393      
     389 
    394390    /* get the local directory */ 
    395391    rom1394_get_directory( handle, raw1394_get_local_id(handle) & 0x3f, &dir); 
    396      
     392 
    397393    /* change the vendor description for kicks */ 
    398394    i = strlen(dir.textual_leafs[0]); 
    399     strncpy(dir.textual_leafs[0], FREEBOB_BOUNCE_SERVER_VENDORNAME "                                          ", i); 
    400      
    401     dir.vendor_id=FREEBOB_BOUNCE_SERVER_VENDORID; 
    402     dir.model_id=FREEBOB_BOUNCE_SERVER_MODELID; 
    403      
     395    strncpy(dir.textual_leafs[0], FFADO_BOUNCE_SERVER_VENDORNAME "                                          ", i); 
     396 
     397    dir.vendor_id=FFADO_BOUNCE_SERVER_VENDORID; 
     398    dir.model_id=FFADO_BOUNCE_SERVER_MODELID; 
     399 
    404400    /* update the rom */ 
    405401    retval = rom1394_set_directory(rom, &dir); 
     
    411407//     } 
    412408//     printf("\n"); 
    413      
     409 
    414410    /* free the allocated mem for the textual leaves */ 
    415411    rom1394_free_directory( &dir); 
    416      
     412 
    417413    /* add an AV/C unit directory */ 
    418     dir.unit_spec_id    = FREEBOB_BOUNCE_SERVER_SPECID; 
     414    dir.unit_spec_id    = FFADO_BOUNCE_SERVER_SPECID; 
    419415    dir.unit_sw_version = 0x00010001; 
    420     leaf = FREEBOB_BOUNCE_SERVER_MODELNAME; 
     416    leaf = FFADO_BOUNCE_SERVER_MODELNAME; 
    421417    dir.nr_textual_leafs = 1; 
    422418    dir.textual_leafs = &leaf; 
    423      
     419 
    424420    /* manipulate the rom */ 
    425421    retval = rom1394_add_unit( rom, &dir); 
    426      
     422 
    427423    /* get the computed size of the rom image */ 
    428424    rom_size = rom1394_get_size(rom); 
    429      
     425 
    430426//     printf("rom1394_add_unit_directory returned %d, romsize %d:",retval,rom_size); 
    431427//     for (i = 0; i < rom_size; i++) 
     
    435431//     } 
    436432//     printf("\n"); 
    437 //      
     433// 
    438434    /* convert computed rom size from quadlets to bytes before update */ 
    439435    rom_size *= sizeof(quadlet_t); 
    440436    retval = raw1394_update_config_rom(handle, rom, rom_size, rom_version); 
    441437//     printf("update_config_rom returned %d\n",retval); 
    442      
     438 
    443439    retval=raw1394_get_config_rom(handle, rom, 0x100, &rom_size, &rom_version); 
    444440//     printf("get_config_rom returned %d, romsize %d, rom_version %d:",retval,rom_size,rom_version); 
     
    449445//     } 
    450446//     printf("\n"); 
    451      
    452 //     printf("You need to reload your ieee1394 modules to reset the rom.\n"); 
    453      
     447 
     448//     printf("You need to reload your ieee1394 modules to reset the rom.\n"); 
     449 
    454450    return 0; 
    455451} 
     
    459455 
    460456BounceSlaveDevice::BounceSlaveNotifier::BounceSlaveNotifier(BounceSlaveDevice *d, nodeaddr_t start) 
    461  : ARMHandler(start, BOUNCE_REGISTER_LENGTH,  
     457 : ARMHandler(start, BOUNCE_REGISTER_LENGTH, 
    462458              RAW1394_ARM_READ | RAW1394_ARM_WRITE, // allowed operations 
    463459              0, //RAW1394_ARM_READ | RAW1394_ARM_WRITE, // operations to be notified of 
     
    468464} 
    469465 
    470 BounceSlaveDevice::BounceSlaveNotifier::~BounceSlaveNotifier()  
     466BounceSlaveDevice::BounceSlaveNotifier::~BounceSlaveNotifier() 
    471467{ 
    472468 
  • trunk/libffado/src/bounce/bounce_slave_avdevice.h

    r435 r445  
    1 /* $Id$ */ 
     1/* 
     2 * Copyright (C) 2005-2007 by Pieter Palmers 
     3 * Copyright (C) 2005-2007 by Daniel Wagner 
     4 * 
     5 * This file is part of FFADO 
     6 * FFADO = Free Firewire (pro-)audio drivers for linux 
     7 * 
     8 * FFADO is based upon FreeBoB 
     9 * 
     10 * This library is free software; you can redistribute it and/or 
     11 * modify it under the terms of the GNU Lesser General Public 
     12 * License version 2.1, as published by the Free Software Foundation; 
     13 * 
     14 * This library is distributed in the hope that it will be useful, 
     15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     17 * Lesser General Public License for more details. 
     18 * 
     19 * You should have received a copy of the GNU Lesser General Public 
     20 * License along with this library; if not, write to the Free Software 
     21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
     22 * MA 02110-1301 USA 
     23 */ 
    224 
    3 /* 
    4  *   FreeBob Streaming API 
    5  *   FreeBob = Firewire (pro-)audio for linux 
    6  * 
    7  *   http://freebob.sf.net 
    8  * 
    9  *   Copyright (C) 2007 Pieter Palmers <pieterpalmers@users.sourceforge.net> 
    10  * 
    11  *   This program is free software {} you can redistribute it and/or modify 
    12  *   it under the terms of the GNU General Public License as published by 
    13  *   the Free Software Foundation {} either version 2 of the License, or 
    14  *   (at your option) any later version. 
    15  * 
    16  *   This program is distributed in the hope that it will be useful, 
    17  *   but WITHOUT ANY WARRANTY {} without even the implied warranty of 
    18  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    19  *   GNU General Public License for more details. 
    20  * 
    21  *   You should have received a copy of the GNU General Public License 
    22  *   along with this program {} if not, write to the Free Software 
    23  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
    24  * 
    25  *  
    26  * 
    27  */ 
    28 #ifndef __FREEBOB_BOUNCESLAVEDEVICE__ 
    29 #define __FREEBOB_BOUNCESLAVEDEVICE__ 
     25#ifndef __FFADO_BOUNCESLAVEDEVICE__ 
     26#define __FFADO_BOUNCESLAVEDEVICE__ 
    3027 
    3128#include "debugmodule/debugmodule.h" 
    3229#include "bounce_avdevice.h" 
    3330 
    34 #define FREEBOB_MAX_NAME_LEN 256 
     31#define FFADO_MAX_NAME_LEN 256 
    3532 
    36 #define FREEBOB_BOUNCE_SERVER_VENDORNAME  "FreeBoB Server" 
    37 #define FREEBOB_BOUNCE_SERVER_MODELNAME   "freebob-server" 
     33#define FFADO_BOUNCE_SERVER_VENDORNAME  "FFADO Server" 
     34#define FFADO_BOUNCE_SERVER_MODELNAME   "ffado-server" 
    3835 
    3936// NOTE: this is currently free, but it is not really allowed to use 
    40 #define FREEBOB_BOUNCE_SERVER_VENDORID    0x000B0001 
    41 #define FREEBOB_BOUNCE_SERVER_MODELID     0x000B0001 
    42 #define FREEBOB_BOUNCE_SERVER_SPECID      0x000B0001 
     37#define FFADO_BOUNCE_SERVER_VENDORID    0x000B0001 
     38#define FFADO_BOUNCE_SERVER_MODELID     0x000B0001 
     39#define FFADO_BOUNCE_SERVER_SPECID      0x000B0001 
    4340 
    4441namespace Bounce { 
     
    5148          Ieee1394Service& ieee1394Service ); 
    5249    virtual ~BounceSlaveDevice(); 
    53      
     50 
    5451    static bool probe( ConfigRom& configRom ); 
    5552    bool discover(); 
     
    5754    bool lock(); 
    5855    bool unlock(); 
    59      
     56 
    6057    bool startStreamByIndex(int i); 
    6158    bool stopStreamByIndex(int i); 
     
    6562    bool initMemSpace(); 
    6663    bool restoreMemSpace(); 
    67      
     64 
    6865private: // configrom shit 
    6966 
     
    7471    }; 
    7572    struct configrom_backup m_original_config_rom; 
    76      
    77     struct configrom_backup  
     73 
     74    struct configrom_backup 
    7875        save_config_rom(raw1394handle_t handle); 
    7976    int restore_config_rom(raw1394handle_t handle, struct configrom_backup old); 
    8077    int init_config_rom(raw1394handle_t handle); 
    81      
     78 
    8279private: 
    8380    BounceSlaveNotifier *m_Notifier; 
    8481    /** 
    85      * this class reacts on the ohter side writing to the  
     82     * this class reacts on the ohter side writing to the 
    8683     * hosts address space 
    8784     */ 
     
    9188        BounceSlaveNotifier(BounceSlaveDevice *, nodeaddr_t start); 
    9289        virtual ~BounceSlaveNotifier(); 
    93          
     90 
    9491    private: 
    9592        BounceSlaveDevice *m_bounceslavedevice; 
     
    9996} // end of namespace Bounce 
    10097 
    101 #endif /* __FREEBOB_BOUNCESLAVEDEVICE__ */ 
     98#endif /* __FFADO_BOUNCESLAVEDEVICE__ */ 
    10299 
    103100