Show
Ignore:
Timestamp:
03/11/07 12:50:16 (14 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/libieee1394/ieee1394service.cpp

    r429 r436  
    214214} 
    215215 
     216fb_octlet_t 
     217Ieee1394Service::byteSwap_octlet(fb_octlet_t value) { 
     218    #if __BYTE_ORDER == __BIG_ENDIAN 
     219        return value; 
     220    #elif __BYTE_ORDER == __LITTLE_ENDIAN 
     221        fb_octlet_t value_new; 
     222        fb_quadlet_t *in_ptr=reinterpret_cast<fb_quadlet_t *>(&value); 
     223        fb_quadlet_t *out_ptr=reinterpret_cast<fb_quadlet_t *>(&value_new); 
     224        *(out_ptr+1)=htonl(*(in_ptr)); 
     225        *(out_ptr)=htonl(*(in_ptr+1)); 
     226        return value_new; 
     227    #else 
     228        #error Unknown endiannes 
     229    #endif 
     230} 
     231 
    216232bool  
    217233Ieee1394Service::lockCompareSwap64(  fb_nodeid_t nodeId, 
     
    222238{ 
    223239    #ifdef DEBUG 
    224     debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"lockCompareSwap64: node 0x%X, addr = 0x%016X\n", 
     240    debugOutput(DEBUG_LEVEL_VERBOSE,"lockCompareSwap64: node 0x%X, addr = 0x%016llX\n", 
    225241                nodeId, addr); 
    226     debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"  if (*(addr)==0x%016llX) *(addr)=0x%016llX\n", 
     242    debugOutput(DEBUG_LEVEL_VERBOSE,"  if (*(addr)==0x%016llX) *(addr)=0x%016llX\n", 
    227243                compare_value, swap_value); 
     244    fb_octlet_t buffer; 
     245    if(!read_octlet( nodeId, addr,&buffer )) { 
     246        debugOutput(DEBUG_LEVEL_VERBOSE,"Could not read owner register\n"); 
     247    } else { 
     248        debugOutput(DEBUG_LEVEL_VERBOSE,"Owner register before = 0x%016llX\n", buffer); 
     249    } 
     250     
     251    buffer=0x123456789ABCDEF0LL; 
     252        debugOutput(DEBUG_LEVEL_VERBOSE,"before byteswap = 0x%016llX\n", buffer); 
     253    buffer=byteSwap_octlet(buffer); 
     254        debugOutput(DEBUG_LEVEL_VERBOSE,"after byteswap = 0x%016llX\n", buffer); 
     255     
     256     
    228257    #endif 
    229  
    230     return raw1394_lock64(m_handle, nodeId, addr, RAW1394_EXTCODE_COMPARE_SWAP, 
    231                           swap_value, compare_value, result) == 0; 
     258     
     259    // do endiannes swapping 
     260    compare_value=byteSwap_octlet(compare_value); 
     261    swap_value=byteSwap_octlet(swap_value); 
     262     
     263    int retval=raw1394_lock64(m_handle, nodeId, addr, RAW1394_EXTCODE_COMPARE_SWAP, 
     264                          swap_value, compare_value, result); 
     265     
     266    #ifdef DEBUG 
     267    if(!read_octlet( nodeId, addr,&buffer )) { 
     268        debugOutput(DEBUG_LEVEL_VERBOSE,"Could not read owner register\n"); 
     269    } else { 
     270        debugOutput(DEBUG_LEVEL_VERBOSE,"Owner register after = 0x%016llX\n", buffer); 
     271    } 
     272    #endif 
     273     
     274    *result=byteSwap_octlet(*result); 
     275     
     276    return (retval == 0); 
    232277} 
    233278 
     
    272317{ 
    273318    avc1394_transaction_block_close( m_handle ); 
    274     return true; 
    275 } 
    276  
    277 bool 
    278 Ieee1394Service::setVerbose( int verboseLevel ) 
    279 { 
    280     setDebugLevel(verboseLevel); 
    281319    return true; 
    282320} 
     
    796834    return ntohl(buffer); 
    797835} 
     836 
     837void 
     838Ieee1394Service::setVerboseLevel(int l)  
     839{ 
     840    setDebugLevel(l); 
     841} 
  • branches/streaming-rework/src/libieee1394/ieee1394service.h

    r424 r436  
    124124     * the content of \ref addr equals \ref compare_with 
    125125     * 
     126     * @note takes care of endiannes 
     127     * 
    126128     * @param nodeId target node ID 
    127129     * @param addr address within target node address space 
     
    147149    raw1394handle_t getHandle() {return m_handle;}; 
    148150 
    149     bool setVerbose( int verboseLevel ); 
    150151    int getVerboseLevel(); 
    151152 
     
    240241    arm_handler_vec_t m_armHandlers; 
    241242     
     243    fb_octlet_t byteSwap_octlet(fb_octlet_t value); 
     244     
     245public: 
     246    void setVerboseLevel(int l); 
     247private: 
    242248    DECLARE_DEBUG_MODULE; 
    243249};