Show
Ignore:
Timestamp:
03/11/07 12:50:16 (16 years ago)
Author:
pieterpalmers
Message:

- fixed verbose level setting
- debugged DICE code, works with EVM

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/streaming-rework/src/dice/dice_avdevice.cpp

    r433 r436  
    1818 * MA 02111-1307 USA. 
    1919 */ 
    20 #warning DICE support is currently untested 
    2120 
    2221#include "dice/dice_avdevice.h" 
     
    4544static VendorModelEntry supportedDeviceList[] = 
    4645{ 
    47     {0x00000000, 0x0000, "DICE VENDOR", "XXX"}, 
     46    // vendor id, model id, vendor name, model name 
     47    {0x00000166, 0x00000002, "TCAT", "DiceII EVM"}, 
    4848}; 
    4949 
     
    107107DiceAvDevice::discover() 
    108108{ 
    109     unsigned int vendorId = m_configRom->getNodeVendorId(); 
    110     unsigned int modelId = m_configRom->getModelId(); 
     109    unsigned int vendorId = m_pConfigRom->getNodeVendorId(); 
     110    unsigned int modelId = m_pConfigRom->getModelId(); 
    111111 
    112112    for ( unsigned int i = 0; 
     
    171171DiceAvDevice::setSamplingFrequency( ESamplingFrequency samplingFrequency ) 
    172172{ 
     173    debugOutput(DEBUG_LEVEL_VERBOSE, "Setting sample rate: %d\n",  
     174        convertESamplingFrequency(samplingFrequency)); 
     175         
    173176    bool supported=false; 
    174177    fb_quadlet_t select=0x0; 
     
    239242        return false; 
    240243    } 
    241      
     244 
    242245    clockreg = DICE_SET_RATE(clockreg, select); 
    243      
     246 
    244247    if (!writeGlobalReg(DICE_REGISTER_GLOBAL_CLOCK_SELECT, clockreg)) { 
    245248        debugError("Could not write CLOCK_SELECT register\n"); 
     
    247250    } 
    248251 
     252    // check if the write succeeded 
     253    fb_quadlet_t clockreg_verify; 
     254    if (!readGlobalReg(DICE_REGISTER_GLOBAL_CLOCK_SELECT, &clockreg_verify)) { 
     255        debugError("Could not read CLOCK_SELECT register\n"); 
     256        return false; 
     257    } 
     258     
     259    if(clockreg != clockreg_verify) { 
     260        debugError("Samplerate register write failed\n"); 
     261        return false; 
     262    } 
     263     
    249264    return true; 
    250265} 
    251266 
    252267void 
    253 DiceAvDevice::showDevice() const 
     268DiceAvDevice::showDevice() 
    254269{ 
     270    fb_quadlet_t tmp_quadlet; 
     271    fb_octlet_t tmp_octlet; 
     272     
    255273    debugOutput(DEBUG_LEVEL_VERBOSE, 
    256274        "%s %s at node %d\n", m_model->vendor_name, m_model->model_name, 
    257275        m_nodeId); 
     276 
     277    debugOutput(DEBUG_LEVEL_VERBOSE," DICE Parameter Space info:\n"); 
     278    debugOutput(DEBUG_LEVEL_VERBOSE,"  Global  : offset=0x%04X size=%04d\n", m_global_reg_offset, m_global_reg_size); 
     279    debugOutput(DEBUG_LEVEL_VERBOSE,"  TX      : offset=0x%04X size=%04d\n", m_tx_reg_offset, m_tx_reg_size); 
     280    debugOutput(DEBUG_LEVEL_VERBOSE,"                nb=%4d size=%04d\n", m_nb_tx, m_tx_size); 
     281    debugOutput(DEBUG_LEVEL_VERBOSE,"  RX      : offset=0x%04X size=%04d\n", m_rx_reg_offset, m_rx_reg_size); 
     282    debugOutput(DEBUG_LEVEL_VERBOSE,"                nb=%4d size=%04d\n", m_nb_rx, m_rx_size); 
     283    debugOutput(DEBUG_LEVEL_VERBOSE,"  UNUSED1 : offset=0x%04X size=%04d\n", m_unused1_reg_offset, m_unused1_reg_size); 
     284    debugOutput(DEBUG_LEVEL_VERBOSE,"  UNUSED2 : offset=0x%04X size=%04d\n", m_unused2_reg_offset, m_unused2_reg_size); 
     285 
     286    debugOutput(DEBUG_LEVEL_VERBOSE," Global param space:\n"); 
     287     
     288    readGlobalRegBlock(DICE_REGISTER_GLOBAL_OWNER, (fb_quadlet_t *)&tmp_octlet,sizeof(fb_octlet_t)); 
     289    debugOutput(DEBUG_LEVEL_VERBOSE,"  Owner            : 0x%016X\n",tmp_octlet); 
     290     
     291    readGlobalReg(DICE_REGISTER_GLOBAL_NOTIFICATION, &tmp_quadlet); 
     292    debugOutput(DEBUG_LEVEL_VERBOSE,"  Notification     : 0x%08X\n",tmp_quadlet); 
     293     
     294    readGlobalReg(DICE_REGISTER_GLOBAL_NOTIFICATION, &tmp_quadlet); 
     295    debugOutput(DEBUG_LEVEL_VERBOSE,"  Nick name        : %s\n",getDeviceNickName().c_str()); 
     296     
     297    readGlobalReg(DICE_REGISTER_GLOBAL_CLOCK_SELECT, &tmp_quadlet); 
     298    debugOutput(DEBUG_LEVEL_VERBOSE,"  Clock Select     : 0x%02X 0x%02X\n", 
     299        (tmp_quadlet>>8) & 0xFF, tmp_quadlet & 0xFF); 
     300     
     301    readGlobalReg(DICE_REGISTER_GLOBAL_ENABLE, &tmp_quadlet); 
     302    debugOutput(DEBUG_LEVEL_VERBOSE,"  Enable           : %s\n", 
     303        (tmp_quadlet&0x1?"true":"false")); 
     304     
     305    readGlobalReg(DICE_REGISTER_GLOBAL_STATUS, &tmp_quadlet); 
     306    debugOutput(DEBUG_LEVEL_VERBOSE,"  Clock Status     : %s 0x%02X\n", 
     307        (tmp_quadlet&0x1?"locked":"not locked"), (tmp_quadlet>>8) & 0xFF); 
     308     
     309    readGlobalReg(DICE_REGISTER_GLOBAL_EXTENDED_STATUS, &tmp_quadlet); 
     310    debugOutput(DEBUG_LEVEL_VERBOSE,"  Extended Status  : 0x%08X\n",tmp_quadlet); 
     311     
     312    readGlobalReg(DICE_REGISTER_GLOBAL_SAMPLE_RATE, &tmp_quadlet); 
     313    debugOutput(DEBUG_LEVEL_VERBOSE,"  Samplerate       : 0x%08X (%lu)\n",tmp_quadlet,tmp_quadlet); 
     314     
     315    readGlobalReg(DICE_REGISTER_GLOBAL_VERSION, &tmp_quadlet); 
     316    debugOutput(DEBUG_LEVEL_VERBOSE,"  Version          : 0x%08X (%u.%u.%u.%u)\n", 
     317        tmp_quadlet, 
     318        DICE_DRIVER_SPEC_VERSION_NUMBER_GET_A(tmp_quadlet), 
     319        DICE_DRIVER_SPEC_VERSION_NUMBER_GET_B(tmp_quadlet), 
     320        DICE_DRIVER_SPEC_VERSION_NUMBER_GET_C(tmp_quadlet), 
     321        DICE_DRIVER_SPEC_VERSION_NUMBER_GET_D(tmp_quadlet) 
     322        ); 
     323     
     324    readGlobalReg(DICE_REGISTER_GLOBAL_CLOCKCAPABILITIES, &tmp_quadlet); 
     325    debugOutput(DEBUG_LEVEL_VERBOSE,"  Clock caps       : 0x%08X\n",tmp_quadlet & 0x1FFF007F); 
     326 
     327    diceNameVector names=getClockSourceNameString(); 
     328    debugOutput(DEBUG_LEVEL_VERBOSE,"  Clock sources    :\n"); 
     329     
     330    for ( diceNameVectorIterator it = names.begin(); 
     331          it != names.end(); 
     332          ++it ) 
     333    { 
     334        debugOutput(DEBUG_LEVEL_VERBOSE,"    %s\n", (*it).c_str()); 
     335    } 
     336     
     337    debugOutput(DEBUG_LEVEL_VERBOSE," TX param space:\n"); 
     338    debugOutput(DEBUG_LEVEL_VERBOSE,"  Nb of xmit        : %1d\n", m_nb_tx); 
     339    for (unsigned int i=0;i<m_nb_tx;i++) { 
     340        debugOutput(DEBUG_LEVEL_VERBOSE,"  Transmitter %d:\n",i); 
     341         
     342        readTxReg(i, DICE_REGISTER_TX_ISOC_BASE, &tmp_quadlet); 
     343        debugOutput(DEBUG_LEVEL_VERBOSE,"   ISO channel       : %3d\n", tmp_quadlet); 
     344        readTxReg(i, DICE_REGISTER_TX_SPEED_BASE, &tmp_quadlet); 
     345        debugOutput(DEBUG_LEVEL_VERBOSE,"   ISO speed         : %3d\n", tmp_quadlet); 
     346         
     347        readTxReg(i, DICE_REGISTER_TX_NB_AUDIO_BASE, &tmp_quadlet); 
     348        debugOutput(DEBUG_LEVEL_VERBOSE,"   Nb audio channels : %3d\n", tmp_quadlet); 
     349        readTxReg(i, DICE_REGISTER_TX_MIDI_BASE, &tmp_quadlet); 
     350        debugOutput(DEBUG_LEVEL_VERBOSE,"   Nb midi channels  : %3d\n", tmp_quadlet); 
     351         
     352        readTxReg(i, DICE_REGISTER_TX_AC3_CAPABILITIES_BASE, &tmp_quadlet); 
     353        debugOutput(DEBUG_LEVEL_VERBOSE,"   AC3 caps          : 0x%08X\n", tmp_quadlet); 
     354        readTxReg(i, DICE_REGISTER_TX_AC3_ENABLE_BASE, &tmp_quadlet); 
     355        debugOutput(DEBUG_LEVEL_VERBOSE,"   AC3 enable        : 0x%08X\n", tmp_quadlet); 
     356         
     357        diceNameVector channel_names=getTxNameString(i); 
     358        debugOutput(DEBUG_LEVEL_VERBOSE,"   Channel names     :\n"); 
     359        for ( diceNameVectorIterator it = channel_names.begin(); 
     360            it != channel_names.end(); 
     361            ++it ) 
     362        { 
     363            debugOutput(DEBUG_LEVEL_VERBOSE,"     %s\n", (*it).c_str()); 
     364        } 
     365    } 
     366     
     367    debugOutput(DEBUG_LEVEL_VERBOSE," RX param space:\n"); 
     368    debugOutput(DEBUG_LEVEL_VERBOSE,"  Nb of recv        : %1d\n", m_nb_tx); 
     369    for (unsigned int i=0;i<m_nb_rx;i++) { 
     370        debugOutput(DEBUG_LEVEL_VERBOSE,"  Receiver %d:\n",i); 
     371         
     372        readTxReg(i, DICE_REGISTER_RX_ISOC_BASE, &tmp_quadlet); 
     373        debugOutput(DEBUG_LEVEL_VERBOSE,"   ISO channel       : %3d\n", tmp_quadlet); 
     374        readTxReg(i, DICE_REGISTER_RX_SEQ_START_BASE, &tmp_quadlet); 
     375        debugOutput(DEBUG_LEVEL_VERBOSE,"   Sequence start    : %3d\n", tmp_quadlet); 
     376         
     377        readTxReg(i, DICE_REGISTER_RX_NB_AUDIO_BASE, &tmp_quadlet); 
     378        debugOutput(DEBUG_LEVEL_VERBOSE,"   Nb audio channels : %3d\n", tmp_quadlet); 
     379        readTxReg(i, DICE_REGISTER_RX_MIDI_BASE, &tmp_quadlet); 
     380        debugOutput(DEBUG_LEVEL_VERBOSE,"   Nb midi channels  : %3d\n", tmp_quadlet); 
     381         
     382        readTxReg(i, DICE_REGISTER_RX_AC3_CAPABILITIES_BASE, &tmp_quadlet); 
     383        debugOutput(DEBUG_LEVEL_VERBOSE,"   AC3 caps          : 0x%08X\n", tmp_quadlet); 
     384        readTxReg(i, DICE_REGISTER_RX_AC3_ENABLE_BASE, &tmp_quadlet); 
     385        debugOutput(DEBUG_LEVEL_VERBOSE,"   AC3 enable        : 0x%08X\n", tmp_quadlet); 
     386         
     387        diceNameVector channel_names=getRxNameString(i); 
     388        debugOutput(DEBUG_LEVEL_VERBOSE,"   Channel names     :\n"); 
     389        for ( diceNameVectorIterator it = channel_names.begin(); 
     390            it != channel_names.end(); 
     391            ++it ) 
     392        { 
     393            debugOutput(DEBUG_LEVEL_VERBOSE,"     %s\n", (*it).c_str()); 
     394        } 
     395    } 
    258396} 
    259397 
     
    264402// Currently we assume the following. 
    265403//   * Ack/iso gap = 0.05 us 
    266 //   * DATA_PREFIX = 0.16 us 
     404//   * DATA_PREFIX = 0.16 us1 
    267405//   * DATA_END    = 0.26 us 
    268406// These numbers are the worst-case figures given in the ieee1394 
     
    334472        for (unsigned int j=0;j<nb_audio;j++) { 
    335473            diceChannelInfo channelInfo; 
    336             channelInfo.name=names_audio.at(i); 
     474            channelInfo.name=names_audio.at(j); 
    337475            channelInfo.portType=ePT_Analog; 
    338476            channelInfo.streamPosition=j; 
     
    349487        for (unsigned int j=0;j<nb_midi;j++) { 
    350488            diceChannelInfo channelInfo; 
    351             channelInfo.name=names_midi.at(i); 
     489            channelInfo.name=names_midi.at(j); 
    352490            channelInfo.portType=ePT_MIDI; 
    353491            channelInfo.streamPosition=nb_audio; 
     
    421559        for (unsigned int j=0;j<nb_audio;j++) { 
    422560            diceChannelInfo channelInfo; 
    423             channelInfo.name=names_audio.at(i); 
     561            channelInfo.name=names_audio.at(j); 
    424562            channelInfo.portType=ePT_Analog; 
    425563            channelInfo.streamPosition=j; 
     
    436574        for (unsigned int j=0;j<nb_midi;j++) { 
    437575            diceChannelInfo channelInfo; 
    438             channelInfo.name=names_midi.at(i); 
     576            channelInfo.name=names_midi.at(j); 
    439577            channelInfo.portType=ePT_MIDI; 
    440578            channelInfo.streamPosition=nb_audio; 
     
    465603 
    466604    std::ostringstream portname; 
    467     portname << id << "_" << channelInfo->name; 
     605    portname << id; 
     606    if(direction == Streaming::Port::E_Playback) { 
     607        portname << "p"; 
     608    } else { 
     609        portname << "c"; 
     610    } 
     611     
     612    portname << "_" << channelInfo->name; 
    468613 
    469614    Streaming::Port *p=NULL; 
     
    552697    } 
    553698     
    554     fb_nodeaddr_t swap_value = ((0xFFC0) | m_p1394Service->getLocalNodeId()) << 24; 
     699    fb_nodeaddr_t swap_value = ((0xFFC0) | m_p1394Service->getLocalNodeId()); 
     700    swap_value = swap_value << 48; 
    555701    swap_value |= m_notifier->getStart(); 
    556702     
    557     if (!m_p1394Service->lockCompareSwap64(  m_nodeId, addr, DICE_OWNER_NO_OWNER,  
     703    if (!m_p1394Service->lockCompareSwap64(  m_nodeId | 0xFFC0, addr, DICE_OWNER_NO_OWNER,  
    558704                                       swap_value, &result )) { 
    559705        debugWarning("Could not register ourselves as device owner\n"); 
     706    } 
     707     
     708    if (result != DICE_OWNER_NO_OWNER) { 
     709        debugWarning("Could not register ourselves as device owner, unexpected register value: 0x%016llX\n", result); 
    560710    } 
    561711 
     
    584734    } 
    585735     
    586     fb_nodeaddr_t compare_value = ((0xFFC0) | m_p1394Service->getLocalNodeId()) << 24; 
     736    fb_nodeaddr_t compare_value = ((0xFFC0) | m_p1394Service->getLocalNodeId()); 
     737    compare_value <<= 48;  
    587738    compare_value |= m_notifier->getStart(); 
    588739     
    589     if (!m_p1394Service->lockCompareSwap64(  m_nodeId, addr, compare_value,  
     740    if (!m_p1394Service->lockCompareSwap64(  m_nodeId | 0xFFC0, addr, compare_value,  
    590741                                       DICE_OWNER_NO_OWNER, &result )) { 
    591742        debugWarning("Could not unregister ourselves as device owner\n"); 
     
    597748 
    598749    return true; 
     750} 
     751 
     752bool 
     753DiceAvDevice::enableStreaming() { 
     754    return enableIsoStreaming(); 
     755} 
     756 
     757bool 
     758DiceAvDevice::disableStreaming() { 
     759    return disableIsoStreaming(); 
    599760} 
    600761 
     
    8451006DiceAvDevice::getTxNameString(unsigned int i) { 
    8461007    diceNameVector names; 
    847     char namestring[DICE_TX_NAMES_SIZE*4+1]; 
     1008    char namestring[DICE_TX_NAMES_SIZE+1]; 
    8481009     
    8491010    if (!readTxRegBlock(i, DICE_REGISTER_TX_NAMES_BASE,  
    850                         (fb_quadlet_t *)namestring, DICE_TX_NAMES_SIZE*4)) { 
     1011                        (fb_quadlet_t *)namestring, DICE_TX_NAMES_SIZE)) { 
    8511012        debugError("Could not read TX name string \n"); 
    8521013        return names; 
    8531014    } 
    8541015     
    855     namestring[DICE_TX_NAMES_SIZE*4]='\0'; 
     1016    namestring[DICE_TX_NAMES_SIZE]='\0'; 
    8561017    return splitNameString(std::string(namestring)); 
    8571018} 
     
    8601021DiceAvDevice::getRxNameString(unsigned int i) { 
    8611022    diceNameVector names; 
    862     char namestring[DICE_RX_NAMES_SIZE*4+1]; 
     1023    char namestring[DICE_RX_NAMES_SIZE+1]; 
    8631024     
    8641025    if (!readRxRegBlock(i, DICE_REGISTER_RX_NAMES_BASE,  
    865                         (fb_quadlet_t *)namestring, DICE_RX_NAMES_SIZE*4)) { 
     1026                        (fb_quadlet_t *)namestring, DICE_RX_NAMES_SIZE)) { 
    8661027        debugError("Could not read RX name string \n"); 
    8671028        return names; 
    8681029    } 
    8691030     
    870     namestring[DICE_RX_NAMES_SIZE*4]='\0'; 
     1031    namestring[DICE_RX_NAMES_SIZE]='\0'; 
    8711032    return splitNameString(std::string(namestring)); 
    8721033} 
     
    8751036DiceAvDevice::getClockSourceNameString() { 
    8761037    diceNameVector names; 
    877     char namestring[DICE_CLOCKSOURCENAMES_SIZE*4+1]; 
     1038    char namestring[DICE_CLOCKSOURCENAMES_SIZE+1]; 
    8781039     
    8791040    if (!readGlobalRegBlock(DICE_REGISTER_GLOBAL_CLOCKSOURCENAMES,  
    880                         (fb_quadlet_t *)namestring, DICE_CLOCKSOURCENAMES_SIZE*4)) { 
     1041                        (fb_quadlet_t *)namestring, DICE_CLOCKSOURCENAMES_SIZE)) { 
    8811042        debugError("Could not read CLOCKSOURCE name string \n"); 
    8821043        return names; 
    8831044    } 
    8841045     
    885     namestring[DICE_CLOCKSOURCENAMES_SIZE*4]='\0'; 
     1046    namestring[DICE_CLOCKSOURCENAMES_SIZE]='\0'; 
    8861047    return splitNameString(std::string(namestring)); 
    8871048} 
     
    8891050std::string 
    8901051DiceAvDevice::getDeviceNickName() { 
    891     char namestring[DICE_NICK_NAME_SIZE*4+1]; 
     1052    char namestring[DICE_NICK_NAME_SIZE+1]; 
    8921053     
    8931054    if (!readGlobalRegBlock(DICE_REGISTER_GLOBAL_NICK_NAME,  
    894                         (fb_quadlet_t *)namestring, DICE_NICK_NAME_SIZE*4)) { 
     1055                        (fb_quadlet_t *)namestring, DICE_NICK_NAME_SIZE)) { 
    8951056        debugError("Could not read nickname string \n"); 
    8961057        return std::string("(unknown)"); 
    8971058    } 
    8981059     
    899     namestring[DICE_NICK_NAME_SIZE*4]='\0'; 
     1060    namestring[DICE_NICK_NAME_SIZE]='\0'; 
    9001061    return std::string(namestring); 
    9011062} 
     
    9061067 
    9071068    // find the end of the string 
    908     unsigned int end=in.find_first_of("\\\\"); 
     1069    unsigned int end=in.find(string("\\\\")); 
    9091070    // cut the end 
    910     in=in.substr(0,end-2); 
     1071    in=in.substr(0,end); 
    9111072 
    9121073    unsigned int cut; 
    913     while( (cut = in.find_first_of("\\")) != in.npos ) { 
     1074    while( (cut = in.find(string("\\"))) != in.npos ) { 
    9141075        if(cut > 0) { 
    9151076            names.push_back(in.substr(0,cut)); 
     
    9281089DiceAvDevice::initIoFunctions() { 
    9291090 
     1091    // offsets and sizes are returned in quadlets, but we use byte values 
     1092 
    9301093    if(!readReg(DICE_REGISTER_GLOBAL_PAR_SPACE_OFF, &m_global_reg_offset)) { 
    9311094        debugError("Could not initialize m_global_reg_offset\n"); 
    9321095        return false; 
    9331096    } 
     1097    m_global_reg_offset*=4; 
     1098     
    9341099    if(!readReg(DICE_REGISTER_GLOBAL_PAR_SPACE_SZ, &m_global_reg_size)) { 
    9351100        debugError("Could not initialize m_global_reg_size\n"); 
    9361101        return false; 
    9371102    } 
     1103    m_global_reg_size*=4; 
     1104     
    9381105    if(!readReg(DICE_REGISTER_TX_PAR_SPACE_OFF, &m_tx_reg_offset)) { 
    9391106        debugError("Could not initialize m_tx_reg_offset\n"); 
    9401107        return false; 
    9411108    } 
     1109    m_tx_reg_offset*=4; 
     1110     
    9421111    if(!readReg(DICE_REGISTER_TX_PAR_SPACE_SZ, &m_tx_reg_size)) { 
    9431112        debugError("Could not initialize m_tx_reg_size\n"); 
    9441113        return false; 
    9451114    } 
     1115    m_tx_reg_size*=4; 
     1116     
    9461117    if(!readReg(DICE_REGISTER_RX_PAR_SPACE_OFF, &m_rx_reg_offset)) { 
    9471118        debugError("Could not initialize m_rx_reg_offset\n"); 
    9481119        return false; 
    9491120    } 
     1121    m_rx_reg_offset*=4; 
     1122     
    9501123    if(!readReg(DICE_REGISTER_RX_PAR_SPACE_SZ, &m_rx_reg_size)) { 
    9511124        debugError("Could not initialize m_rx_reg_size\n"); 
    9521125        return false; 
    9531126    } 
     1127    m_rx_reg_size*=4; 
     1128     
    9541129    if(!readReg(DICE_REGISTER_UNUSED1_SPACE_OFF, &m_unused1_reg_offset)) { 
    9551130        debugError("Could not initialize m_unused1_reg_offset\n"); 
    9561131        return false; 
    9571132    } 
     1133    m_unused1_reg_offset*=4; 
     1134     
    9581135    if(!readReg(DICE_REGISTER_UNUSED1_SPACE_SZ, &m_unused1_reg_size)) { 
    9591136        debugError("Could not initialize m_unused1_reg_size\n"); 
    9601137        return false; 
    9611138    } 
     1139    m_unused1_reg_size*=4; 
     1140     
    9621141    if(!readReg(DICE_REGISTER_UNUSED2_SPACE_OFF, &m_unused2_reg_offset)) { 
    9631142        debugError("Could not initialize m_unused2_reg_offset\n"); 
    9641143        return false; 
    9651144    } 
     1145    m_unused2_reg_offset*=4; 
     1146     
    9661147    if(!readReg(DICE_REGISTER_UNUSED2_SPACE_SZ, &m_unused2_reg_size)) { 
    9671148        debugError("Could not initialize m_unused2_reg_size\n"); 
    9681149        return false; 
    9691150    } 
     1151    m_unused2_reg_size*=4; 
    9701152 
    9711153    if(!readReg(m_tx_reg_offset + DICE_REGISTER_TX_NB_TX, &m_nb_tx)) { 
     
    9771159        return false; 
    9781160    } 
     1161    m_tx_size*=4; 
     1162     
    9791163    if(!readReg(m_tx_reg_offset + DICE_REGISTER_RX_NB_RX, &m_nb_rx)) { 
    9801164        debugError("Could not initialize m_nb_rx\n"); 
     
    9851169        return false; 
    9861170    } 
     1171    m_rx_size*=4; 
     1172     
     1173    debugOutput(DEBUG_LEVEL_VERBOSE,"DICE Parameter Space info:\n"); 
     1174    debugOutput(DEBUG_LEVEL_VERBOSE," Global  : offset=%04X size=%04d\n", m_global_reg_offset, m_global_reg_size); 
     1175    debugOutput(DEBUG_LEVEL_VERBOSE," TX      : offset=%04X size=%04d\n", m_tx_reg_offset, m_tx_reg_size); 
     1176    debugOutput(DEBUG_LEVEL_VERBOSE,"               nb=%4d size=%04d\n", m_nb_tx, m_tx_size); 
     1177    debugOutput(DEBUG_LEVEL_VERBOSE," RX      : offset=%04X size=%04d\n", m_rx_reg_offset, m_rx_reg_size); 
     1178    debugOutput(DEBUG_LEVEL_VERBOSE,"               nb=%4d size=%04d\n", m_nb_rx, m_rx_size); 
     1179    debugOutput(DEBUG_LEVEL_VERBOSE," UNUSED1 : offset=%04X size=%04d\n", m_unused1_reg_offset, m_unused1_reg_size); 
     1180    debugOutput(DEBUG_LEVEL_VERBOSE," UNUSED2 : offset=%04X size=%04d\n", m_unused2_reg_offset, m_unused2_reg_size); 
    9871181     
    9881182    return true; 
     
    10051199        return false; 
    10061200    } 
     1201     
     1202    *result=ntohl(*result); 
     1203     
    10071204    debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Read result: 0x%08X\n", *result); 
    10081205    
     
    10231220    fb_nodeid_t nodeId=m_nodeId | 0xFFC0; 
    10241221     
    1025     if(!m_p1394Service->write_quadlet( nodeId, addr, data ) ) { 
     1222    if(!m_p1394Service->write_quadlet( nodeId, addr, htonl(data) ) ) { 
    10261223        debugError("Could not write to node 0x%04X addr 0x%012X\n", nodeId, addr); 
    10271224        return false; 
     
    10431240    fb_nodeid_t nodeId=m_nodeId | 0xFFC0; 
    10441241     
    1045     if(!m_p1394Service->read( nodeId, addr, length, data ) ) { 
     1242    if(!m_p1394Service->read( nodeId, addr, length/4, data ) ) { 
    10461243        debugError("Could not read from node 0x%04X addr 0x%012llX\n", nodeId, addr); 
    10471244        return false; 
    10481245    } 
     1246     
     1247    for(unsigned int i=0;i<length/4;i++) { 
     1248        *(data+i)=ntohl(*(data+i)); 
     1249    } 
     1250     
    10491251    return true; 
    10501252} 
     
    10621264    fb_nodeaddr_t addr=DICE_REGISTER_BASE + offset; 
    10631265    fb_nodeid_t nodeId=m_nodeId | 0xFFC0; 
    1064  
    1065     if(!m_p1394Service->write( nodeId, addr, length, data ) ) { 
     1266     
     1267    fb_quadlet_t data_out[length/4]; 
     1268     
     1269    for(unsigned int i=0;i<length/4;i++) { 
     1270        data_out[i]=ntohl(*(data+i)); 
     1271    } 
     1272     
     1273    if(!m_p1394Service->write( nodeId, addr, length/4, data_out ) ) { 
    10661274        debugError("Could not write to node 0x%04X addr 0x%012llX\n", nodeId, addr); 
    10671275        return false; 
    10681276    } 
     1277     
    10691278    return true; 
    10701279} 
     
    11151324    } 
    11161325    // out-of-range check 
    1117     if(offset + length > m_global_reg_size) { 
     1326    if(offset+length > m_global_reg_offset+m_global_reg_size) { 
    11181327        debugError("register offset+length too large: 0x%0llX\n", offset + length); 
    11191328        return DICE_INVALID_OFFSET; 
     
    11741383        return DICE_INVALID_OFFSET; 
    11751384    } 
    1176     if(i >= m_nb_rx) { 
     1385    if(i >= m_nb_tx) { 
    11771386        debugError("TX index out of range\n"); 
    11781387        return DICE_INVALID_OFFSET; 
     
    11821391 
    11831392    // out-of-range check 
    1184     if(offset_tx + length > m_tx_reg_size) { 
     1393    if(offset_tx + length > m_tx_reg_offset+4+m_tx_reg_size*m_nb_tx) { 
    11851394        debugError("register offset+length too large: 0x%0llX\n", offset_tx + length); 
    11861395        return DICE_INVALID_OFFSET; 
     
    12491458 
    12501459    // out-of-range check 
    1251     if(offset_rx + length > m_rx_reg_size) { 
     1460    if(offset_rx + length > m_rx_reg_offset+4+m_rx_reg_size*m_nb_rx) { 
    12521461        debugError("register offset+length too large: 0x%0llX\n", offset_rx + length); 
    12531462        return DICE_INVALID_OFFSET; 
  • branches/streaming-rework/src/dice/dice_avdevice.h

    r433 r436  
    6060    bool discover(); 
    6161 
    62     void showDevice() const
     62    void showDevice()
    6363 
    6464    bool setSamplingFrequency( ESamplingFrequency samplingFrequency ); 
     
    7575    bool startStreamByIndex(int i); 
    7676    bool stopStreamByIndex(int i); 
    77    
     77     
     78    bool enableStreaming(); 
     79    bool disableStreaming(); 
     80     
    7881protected: 
    79     std::auto_ptr<ConfigRom>( m_configRom ); 
    80     Ieee1394Service* m_p1394Service; 
    81      
    8282    struct VendorModelEntry *m_model; 
    8383     
     
    116116     
    117117    typedef std::vector< std::string > diceNameVector; 
     118    typedef std::vector< std::string >::iterator diceNameVectorIterator; 
    118119    diceNameVector splitNameString(std::string in); 
    119120    diceNameVector getTxNameString(unsigned int i); 
  • branches/streaming-rework/src/dice/dice_defines.h

    r433 r436  
    2020#ifndef DICEDEFINES_H 
    2121#define DICEDEFINES_H 
     22 
     23#define DICE_VER_1_0_4_0 
     24// #define DICE_VER_1_0_7_0 
     25 
    2226 
    2327#define DICE_INVALID_OFFSET                  0xFFFFF00000000000ULL 
     
    7276 
    7377#define DICE_REGISTER_TX_PARAM(size, i, offset) \ 
    74             ( ((i) * (size) * 4ULL) + (offset) ) 
     78            ( ((i) * (size) ) + (offset) ) 
    7579 
    7680//  RX_PAR_SPACE registers 
     
    7882#define DICE_REGISTER_RX_SZ_RX                  0x0004 
    7983 
    80 #define DICE_REGISTER_RX_ISOC_BASE              0x0008 
    81 #define DICE_REGISTER_RX_SEQ_START_BASE         0x000C 
    82 #define DICE_REGISTER_RX_NB_AUDIO_BASE          0x0010 
    83 #define DICE_REGISTER_RX_MIDI_BASE              0x0014 
    84 #define DICE_REGISTER_RX_NAMES_BASE             0x0018 
    85 #define DICE_REGISTER_RX_AC3_CAPABILITIES_BASE  0x0118 
    86 #define DICE_REGISTER_RX_AC3_ENABLE_BASE        0x011C 
     84#ifdef DICE_VER_1_0_4_0 
     85    #define DICE_REGISTER_RX_ISOC_BASE              0x0008 
     86    #define DICE_REGISTER_RX_SEQ_START_BASE         0x0014 
     87    #define DICE_REGISTER_RX_NB_AUDIO_BASE          0x000C 
     88    #define DICE_REGISTER_RX_MIDI_BASE              0x0010 
     89    #define DICE_REGISTER_RX_NAMES_BASE             0x0018 
     90    #define DICE_REGISTER_RX_AC3_CAPABILITIES_BASE  0x0118 
     91    #define DICE_REGISTER_RX_AC3_ENABLE_BASE        0x011C 
     92#endif 
     93 
     94#ifdef DICE_VER_1_0_7_0 
     95    #define DICE_REGISTER_RX_ISOC_BASE              0x0008 
     96    #define DICE_REGISTER_RX_SEQ_START_BASE         0x000C 
     97    #define DICE_REGISTER_RX_NB_AUDIO_BASE          0x0010 
     98    #define DICE_REGISTER_RX_MIDI_BASE              0x0014 
     99    #define DICE_REGISTER_RX_NAMES_BASE             0x0018 
     100    #define DICE_REGISTER_RX_AC3_CAPABILITIES_BASE  0x0118 
     101    #define DICE_REGISTER_RX_AC3_ENABLE_BASE        0x011C 
     102#endif 
    87103 
    88104#define DICE_REGISTER_RX_PARAM(size, i, offset) \ 
    89             ( ((i) * (size) * 4ULL) + (offset) ) 
     105            ( ((i) * (size) ) + (offset) ) 
    90106 
    91107// Register Bitfields 
     
    184200#define DICE_RATE_NONE                  0x0A 
    185201 
    186 #define DICE_RATE_MASK                  0xFFFF0000LU 
     202#define DICE_RATE_MASK                  0x0000FF00LU 
    187203#define DICE_GET_RATE(reg)              (((reg) & DICE_RATE_MASK) >> 8) 
    188204#define DICE_SET_RATE(reg,rate)         (((reg) & ~DICE_RATE_MASK) | (((rate) << 8) & DICE_RATE_MASK) )