Changeset 1136

Show
Ignore:
Timestamp:
05/08/08 02:38:15 (13 years ago)
Author:
ppalmers
Message:

keep bus direction in endian swapping functions

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/bebob/focusrite/focusrite_cmd.cpp

    r1135 r1136  
    5454    result &= se.write(m_arg1,"FocusriteVendorDependentCmd arg1"); 
    5555    result &= se.write(m_arg2,"FocusriteVendorDependentCmd arg2"); 
    56     // FIXME: this is not consistent, we should not have to care about CondSwap32 here 
    57     result &= se.write(CondSwap32(m_id),"FocusriteVendorDependentCmd ID"); 
    58     result &= se.write(CondSwap32(m_value),"FocusriteVendorDependentCmd value"); 
     56    // FIXME: this is not consistent, we should not have to care about CondSwapFromBus32 here 
     57    result &= se.write(CondSwapToBus32(m_id),"FocusriteVendorDependentCmd ID"); 
     58    result &= se.write(CondSwapToBus32(m_value),"FocusriteVendorDependentCmd value"); 
    5959     
    6060    return result; 
     
    6969    result &= de.read(&m_arg2); 
    7070    result &= de.read(&m_id); 
    71     m_id=CondSwap32(m_id); 
     71    m_id=CondSwapFromBus32(m_id); 
    7272    result &= de.read(&m_value); 
    73     m_value=CondSwap32(m_value); 
     73    m_value=CondSwapFromBus32(m_value); 
    7474 
    7575    return result; 
  • trunk/libffado/src/bebob/focusrite/focusrite_generic.cpp

    r1135 r1136  
    140140    fb_nodeid_t nodeId = getNodeId() | 0xFFC0; 
    141141 
    142     if(!get1394Service().write_quadlet( nodeId, addr, CondSwap32(data) ) ) { 
     142    if(!get1394Service().write_quadlet( nodeId, addr, CondSwapToBus32(data) ) ) { 
    143143        debugError("Could not write to node 0x%04X addr 0x%012X\n", nodeId, addr); 
    144144        return false; 
     
    161161    } 
    162162 
    163     result=CondSwap32(result); 
     163    result=CondSwapFromBus32(result); 
    164164    debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Read result: 0x%08llX\n", result); 
    165165 
  • trunk/libffado/src/bebob/focusrite/focusrite_saffirepro.cpp

    r1135 r1136  
    757757        char *ptr = (char *) &name[i*4]; 
    758758        tmp = *((uint32_t *)ptr); 
    759         tmp = CondSwap32(tmp); 
     759        tmp = CondSwapToBus32(tmp); 
    760760        if ( !setSpecificValue(FR_SAFFIREPRO_CMD_ID_DEVICE_NAME_1 + i, tmp ) ) { 
    761761            debugError( "setSpecificValue failed\n" ); 
     
    776776            return ""; 
    777777        } 
    778         tmp = CondSwap32(tmp); 
     778        tmp = CondSwapFromBus32(tmp); 
    779779        unsigned int j; 
    780780        char *ptr = (char *) &tmp; 
  • trunk/libffado/src/bounce/bounce_slave_avdevice.cpp

    r1135 r1136  
    367367//     { 
    368368//         if (i % 4 == 0) printf("\n0x%04x:", CSR_CONFIG_ROM+i*4); 
    369 //         printf(" %08x", CondSwap32(current_rom[i])); 
     369//         printf(" %08x", CondSwapFromBus32(current_rom[i])); 
    370370//     } 
    371371//     printf("\n"); 
     
    391391//     { 
    392392//         if (i % 4 == 0) printf("\n0x%04x:", CSR_CONFIG_ROM+i*4); 
    393 //         printf(" %08x", CondSwap32(rom[i])); 
     393//         printf(" %08x", CondSwapFromBus32(rom[i])); 
    394394//     } 
    395395//     printf("\n"); 
     
    411411//     { 
    412412//         if (i % 4 == 0) printf("\n0x%04x:", CSR_CONFIG_ROM+i*4); 
    413 //         printf(" %08x", CondSwap32(rom[i])); 
     413//         printf(" %08x", CondSwapFromBus32(rom[i])); 
    414414//     } 
    415415//     printf("\n"); 
     
    435435//     { 
    436436//         if (i % 4 == 0) printf("\n0x%04x:", CSR_CONFIG_ROM+i*4); 
    437 //         printf(" %08x", CondSwap32(rom[i])); 
     437//         printf(" %08x", CondSwapFromBus32(rom[i])); 
    438438//     } 
    439439//     printf("\n"); 
     
    449449//     { 
    450450//         if (i % 4 == 0) printf("\n0x%04x:", CSR_CONFIG_ROM+i*4); 
    451 //         printf(" %08x", CondSwap32(rom[i])); 
     451//         printf(" %08x", CondSwapFromBus32(rom[i])); 
    452452//     } 
    453453//     printf("\n"); 
  • trunk/libffado/src/debugmodule/debugmodule.cpp

    r1135 r1136  
    802802    for (i = 0; i< length; i += 1) { 
    803803        printf( "%02d %04X: %08X (%08X)" 
    804                 "\n", i, i*4, data[i],CondSwap32(data[i])); 
    805     } 
    806 } 
    807  
    808  
     804                "\n", i, i*4, data[i],CondSwapFromBus32(data[i])); 
     805    } 
     806} 
     807 
     808 
  • trunk/libffado/src/dice/dice_avdevice.cpp

    r1135 r1136  
    14631463    } 
    14641464 
    1465     *result=CondSwap32(*result); 
     1465    *result=CondSwapFromBus32(*result); 
    14661466 
    14671467    debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"Read result: 0x%08X\n", *result); 
     
    14831483    fb_nodeid_t nodeId=getNodeId() | 0xFFC0; 
    14841484 
    1485     if(!get1394Service().write_quadlet( nodeId, addr, CondSwap32(data) ) ) { 
     1485    if(!get1394Service().write_quadlet( nodeId, addr, CondSwapToBus32(data) ) ) { 
    14861486        debugError("Could not write to node 0x%04X addr 0x%012X\n", nodeId, addr); 
    14871487        return false; 
     
    15091509 
    15101510    for(unsigned int i=0;i<length/4;i++) { 
    1511         *(data+i)=CondSwap32(*(data+i)); 
     1511        *(data+i)=CondSwapFromBus32(*(data+i)); 
    15121512    } 
    15131513 
     
    15311531 
    15321532    for(unsigned int i=0;i<length/4;i++) { 
    1533         data_out[i]=CondSwap32(*(data+i)); 
     1533        data_out[i]=CondSwapFromBus32(*(data+i)); 
    15341534    } 
    15351535 
  • trunk/libffado/src/fireworks/efc/efc_cmd.cpp

    r1135 r1136  
    110110    bool result=true; 
    111111     
    112     result &= se.write(CondSwap32(m_length), "EFC length"); 
     112    result &= se.write(CondSwapToBus32(m_length), "EFC length"); 
    113113     
    114114    unsigned int i=0; 
     
    123123    // serialize the header 
    124124    quadlet_t *header_as_quadlets=(quadlet_t *)&m_header; 
    125     result &= se.write(CondSwap32(*(header_as_quadlets+i)), "EFC header version"); i++; 
    126     result &= se.write(CondSwap32(*(header_as_quadlets+i)), "EFC header seqnum"); i++; 
    127     result &= se.write(CondSwap32(*(header_as_quadlets+i)), "EFC header category"); i++; 
    128     result &= se.write(CondSwap32(*(header_as_quadlets+i)), "EFC header command"); i++; 
    129     result &= se.write(CondSwap32(*(header_as_quadlets+i)), "EFC header return value"); i++; 
     125    result &= se.write(CondSwapToBus32(*(header_as_quadlets+i)), "EFC header version"); i++; 
     126    result &= se.write(CondSwapToBus32(*(header_as_quadlets+i)), "EFC header seqnum"); i++; 
     127    result &= se.write(CondSwapToBus32(*(header_as_quadlets+i)), "EFC header category"); i++; 
     128    result &= se.write(CondSwapToBus32(*(header_as_quadlets+i)), "EFC header command"); i++; 
     129    result &= se.write(CondSwapToBus32(*(header_as_quadlets+i)), "EFC header return value"); i++; 
    130130     
    131131    return result; 
     
    138138     
    139139    result &= de.read(&m_length); 
    140     m_length=CondSwap32(m_length); 
     140    m_length=CondSwapFromBus32(m_length); 
    141141     
    142142    // read the EFC header 
     
    144144    for (unsigned int i=0; i<sizeof(m_header)/4; i++) { 
    145145        result &= de.read((header_as_quadlets+i)); 
    146         *(header_as_quadlets+i)=CondSwap32(*(header_as_quadlets+i)); 
     146        *(header_as_quadlets+i)=CondSwapFromBus32(*(header_as_quadlets+i)); 
    147147    } 
    148148 
  • trunk/libffado/src/fireworks/efc/efc_cmd.h

    r1135 r1136  
    100100#define EFC_DESERIALIZE_AND_SWAP(__de__, __value__, __result__) \ 
    101101    { __result__ &= __de__.read(__value__); \ 
    102       *(__value__)=CondSwap32(*(__value__)); } \ 
     102      *(__value__)=CondSwapFromBus32(*(__value__)); } \ 
    103103 
    104104 
  • trunk/libffado/src/fireworks/efc/efc_cmds_flash.cpp

    r1135 r1136  
    4848 
    4949    result &= EfcCmd::serialize ( se ); 
    50     result &= se.write(CondSwap32(m_address), "Address" ); 
     50    result &= se.write(CondSwapToBus32(m_address), "Address" ); 
    5151 
    5252    return result; 
     
    9090    result &= EfcCmd::serialize ( se ); 
    9191 
    92     result &= se.write(CondSwap32(m_address), "Address" ); 
    93     result &= se.write(CondSwap32(m_nb_quadlets), "Length (quadlets)" ); 
     92    result &= se.write(CondSwapToBus32(m_address), "Address" ); 
     93    result &= se.write(CondSwapToBus32(m_nb_quadlets), "Length (quadlets)" ); 
    9494 
    9595    return result; 
     
    152152    result &= EfcCmd::serialize ( se ); 
    153153 
    154     result &= se.write(CondSwap32(m_address), "Address" ); 
    155     result &= se.write(CondSwap32(m_nb_quadlets), "Length (quadlets)" ); 
    156  
    157     for (unsigned int i=0; i < m_nb_quadlets; i++) { 
    158         result &= se.write(CondSwap32(m_data[i]), "Data"); 
     154    result &= se.write(CondSwapToBus32(m_address), "Address" ); 
     155    result &= se.write(CondSwapToBus32(m_nb_quadlets), "Length (quadlets)" ); 
     156 
     157    for (unsigned int i=0; i < m_nb_quadlets; i++) { 
     158        result &= se.write(CondSwapToBus32(m_data[i]), "Data"); 
    159159    } 
    160160    return result; 
     
    200200 
    201201    result &= EfcCmd::serialize ( se ); 
    202     result &= se.write(CondSwap32(m_lock), "Locked" ); 
     202    result &= se.write(CondSwapToBus32(m_lock), "Locked" ); 
    203203 
    204204    return result; 
  • trunk/libffado/src/fireworks/efc/efc_cmds_hardware_ctrl.cpp

    r1135 r1136  
    9898    result &= EfcCmd::serialize ( se ); 
    9999 
    100     result &= se.write(CondSwap32(m_clock), "Clock" ); 
    101     result &= se.write(CondSwap32(m_samplerate), "Samplerate" ); 
    102     result &= se.write(CondSwap32(m_index), "Index" ); 
     100    result &= se.write(CondSwapToBus32(m_clock), "Clock" ); 
     101    result &= se.write(CondSwapToBus32(m_samplerate), "Samplerate" ); 
     102    result &= se.write(CondSwapToBus32(m_index), "Index" ); 
    103103 
    104104    return result; 
  • trunk/libffado/src/fireworks/efc/efc_cmds_ioconfig.cpp

    r1135 r1136  
    6060        result &= EfcCmd::serialize ( se ); 
    6161 
    62         result &= se.write(CondSwap32(m_value), "Value" ); 
     62        result &= se.write(CondSwapToBus32(m_value), "Value" ); 
    6363    } 
    6464    return result; 
  • trunk/libffado/src/fireworks/efc/efc_cmds_mixer.cpp

    r1135 r1136  
    7373        result &= EfcCmd::serialize ( se ); 
    7474         
    75         result &= se.write(CondSwap32(m_channel), "Channel" ); 
     75        result &= se.write(CondSwapToBus32(m_channel), "Channel" ); 
    7676         
    7777    } else { 
     
    8282        result &= EfcCmd::serialize ( se ); 
    8383         
    84         result &= se.write(CondSwap32(m_channel), "Channel" ); 
    85         result &= se.write(CondSwap32(m_value), "Value" ); 
     84        result &= se.write(CondSwapToBus32(m_channel), "Channel" ); 
     85        result &= se.write(CondSwapToBus32(m_value), "Value" ); 
    8686    } 
    8787 
  • trunk/libffado/src/fireworks/efc/efc_cmds_monitor.cpp

    r1135 r1136  
    106106        result &= EfcCmd::serialize ( se ); 
    107107         
    108         result &= se.write(CondSwap32(m_input), "Input" ); 
    109         result &= se.write(CondSwap32(m_output), "Output" ); 
     108        result &= se.write(CondSwapToBus32(m_input), "Input" ); 
     109        result &= se.write(CondSwapToBus32(m_output), "Output" ); 
    110110         
    111111    } else { 
     
    116116        result &= EfcCmd::serialize ( se ); 
    117117         
    118         result &= se.write(CondSwap32(m_input), "Input" ); 
    119         result &= se.write(CondSwap32(m_output), "Output" ); 
    120         result &= se.write(CondSwap32(m_value), "Value" ); 
     118        result &= se.write(CondSwapToBus32(m_input), "Input" ); 
     119        result &= se.write(CondSwapToBus32(m_output), "Output" ); 
     120        result &= se.write(CondSwapToBus32(m_value), "Value" ); 
    121121    } 
    122122    return result; 
  • trunk/libffado/src/libavc/musicsubunit/avc_descriptor_music.cpp

    r1135 r1136  
    5353    result &= AVCInfoBlock::serialize(se); 
    5454     
    55     quadlet_t tmp=CondSwap32(m_current_latency_capability); 
     55    quadlet_t tmp=CondSwapToBus32(m_current_latency_capability); 
    5656     
    5757    result &= se.write(m_current_transmit_capability, "AVCMusicGeneralStatusInfoBlock m_current_transmit_capability"); 
     
    7575    result &= de.read(&m_current_receive_capability); 
    7676    result &= de.read(&m_current_latency_capability); 
    77     m_current_latency_capability=CondSwap32(m_current_latency_capability); 
     77    m_current_latency_capability=CondSwapFromBus32(m_current_latency_capability); 
    7878     
    7979    return result; 
  • trunk/libffado/src/libieee1394/ieee1394service.cpp

    r1135 r1136  
    388388                CSR_REGISTER_BASE | CSR_CYCLE_TIME, 
    389389                sizeof(uint32_t), cycle_timer ) == 0 ) { 
    390             *cycle_timer = CondSwap32(*cycle_timer); 
     390            *cycle_timer = CondSwapFromBus32(*cycle_timer); 
    391391            return true; 
    392392        } else { 
     
    479479    return write( nodeId, addr, sizeof( data )/4, 
    480480                  reinterpret_cast<fb_quadlet_t*>( &data ) ); 
    481 } 
    482  
    483 fb_octlet_t 
    484 Ieee1394Service::byteSwap_octlet(fb_octlet_t value) { 
    485     #if __BYTE_ORDER == __BIG_ENDIAN 
    486         return value; 
    487     #elif __BYTE_ORDER == __LITTLE_ENDIAN 
    488         fb_quadlet_t in_hi = (value >> 32) & 0xFFFFFFFF; 
    489         fb_quadlet_t in_lo = value & 0xFFFFFFFF; 
    490         in_hi = CondSwap32(in_hi); 
    491         in_lo = CondSwap32(in_lo); 
    492         fb_octlet_t value_new = in_lo; 
    493         value_new <<= 32; 
    494         value_new |= in_hi; 
    495         return value_new; 
    496     #else 
    497         #error Unknown endiannes 
    498     #endif 
    499481} 
    500482 
     
    520502 
    521503    // do endiannes swapping 
    522     compare_value = byteSwap_octlet(compare_value); 
    523     swap_value    = byteSwap_octlet(swap_value); 
     504    compare_value = CondSwapToBus64(compare_value); 
     505    swap_value    = CondSwapToBus64(swap_value); 
    524506 
    525507    // do separate locking here (no MutexLockHelper) since  
     
    543525    #endif 
    544526 
    545     *result = byteSwap_octlet(*result); 
     527    *result = CondSwapFromBus64(*result); 
    546528 
    547529    return (retval == 0); 
     
    557539    m_handle_lock->Lock(); 
    558540    for (int i = 0; i < len; ++i) { 
    559         buf[i] = CondSwap32( buf[i] ); 
     541        buf[i] = CondSwapFromBus32( buf[i] ); 
    560542    } 
    561543 
     
    569551 
    570552    for ( unsigned int i = 0; i < *resp_len; ++i ) { 
    571         result[i] = CondSwap32( result[i] ); 
     553        result[i] = CondSwapToBus32( result[i] ); 
    572554    } 
    573555 
     
    11141096    if (result < 0) 
    11151097        return -1; 
    1116     return CondSwap32(buffer); 
     1098    return CondSwapFromBus32(buffer); 
    11171099} 
    11181100 
  • trunk/libffado/src/libieee1394/ieee1394service.h

    r1134 r1136  
    345345    arm_handler_vec_t m_armHandlers; 
    346346 
    347     fb_octlet_t byteSwap_octlet(fb_octlet_t value); 
    348  
    349347public: 
    350348    void setVerboseLevel(int l); 
  • trunk/libffado/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.cpp

    r1135 r1136  
    102102              (length >= 2*sizeof(quadlet_t)); 
    103103    if(ok) { 
    104         m_last_timestamp = sytRecvToFullTicks2((uint32_t)CondSwap16(packet->syt), pkt_ctr); 
     104        m_last_timestamp = sytRecvToFullTicks2((uint32_t)CondSwapFromBus16(packet->syt), pkt_ctr); 
    105105        //#ifdef DEBUG 
    106106        #if 0 
     
    108108 
    109109        //=> convert the SYT to a full timestamp in ticks 
    110         uint64_t old_last_timestamp = sytRecvToFullTicks((uint32_t)CondSwap16(packet->syt), 
     110        uint64_t old_last_timestamp = sytRecvToFullTicks((uint32_t)CondSwapFromBus16(packet->syt), 
    111111                                              CYCLE_TIMER_GET_CYCLES(pkt_ctr), now); 
    112112        if(m_last_timestamp != old_last_timestamp) { 
     
    224224 
    225225            for(j = 0; j < nevents; j += 1) { 
    226                 *(buffer)=(CondSwap32((*target_event) ) & 0x00FFFFFF); 
     226                *(buffer)=(CondSwapFromBus32((*target_event) ) & 0x00FFFFFF); 
    227227                buffer++; 
    228228                target_event+=m_dimension; 
     
    258258 
    259259            for(j = 0; j < nevents; j += 1) { 
    260                 unsigned int v = CondSwap32(*target_event) & 0x00FFFFFF; 
     260                unsigned int v = CondSwapFromBus32(*target_event) & 0x00FFFFFF; 
    261261                // sign-extend highest bit of 24-bit int 
    262262                int tmp = (int)(v << 8) / 256; 
     
    295295 
    296296            for(j = 0; j < nevents; j += 1) { 
    297                 *(buffer)=(CondSwap32((*target_event) ) & 0x00FFFFFF); 
     297                *(buffer)=(CondSwapFromBus32((*target_event) ) & 0x00FFFFFF); 
    298298                buffer++; 
    299299                target_event+=m_dimension; 
     
    329329 
    330330            for(j = 0; j < nevents; j += 1) { 
    331                 unsigned int v = CondSwap32(*target_event) & 0x00FFFFFF; 
     331                unsigned int v = CondSwapFromBus32(*target_event) & 0x00FFFFFF; 
    332332                // sign-extend highest bit of 24-bit int 
    333333                int tmp = (int)(v << 8) / 256; 
     
    365365            for (j = p.location;j < nevents; j += 8) { 
    366366                target_event = (quadlet_t *) (data + ((j * m_dimension) + p.position)); 
    367                 sample_int=CondSwap32(*target_event); 
     367                sample_int=CondSwapFromBus32(*target_event); 
    368368                // FIXME: this assumes that 2X and 3X speed isn't used, 
    369369                // because only the 1X slot is put into the ringbuffer 
  • trunk/libffado/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.cpp

    r1135 r1136  
    353353    // convert the timestamp to SYT format 
    354354    uint16_t timestamp_SYT = TICKS_TO_SYT ( ts ); 
    355     packet->syt = CondSwap16 ( timestamp_SYT ); 
     355    packet->syt = CondSwapToBus16 ( timestamp_SYT ); 
    356356 
    357357    // FIXME: use a precomputed value here 
     
    683683                unsigned int tmp = ((int) v); 
    684684                tmp = ( tmp >> 8 ) | 0x40000000; 
    685                 *target_event = CondSwap32((quadlet_t)tmp); 
     685                *target_event = CondSwapToBus32((quadlet_t)tmp); 
    686686                buffer++; 
    687687                target_event += m_dimension; 
     
    839839            for(;j < nevents; j += 1) { 
    840840                uint32_t in = (uint32_t)(*buffer); 
    841                 *target_event = CondSwap32((quadlet_t)((in & 0x00FFFFFF) | 0x40000000)); 
     841                *target_event = CondSwapToBus32((quadlet_t)((in & 0x00FFFFFF) | 0x40000000)); 
    842842                buffer++; 
    843843                target_event += m_dimension; 
     
    884884            { 
    885885                uint32_t in = (uint32_t)(*buffer); 
    886                 *target_event = CondSwap32((quadlet_t)((in & 0x00FFFFFF) | 0x40000000)); 
     886                *target_event = CondSwapToBus32((quadlet_t)((in & 0x00FFFFFF) | 0x40000000)); 
    887887                buffer++; 
    888888                target_event += m_dimension; 
     
    933933 
    934934                tmp = ( tmp >> 8 ) | 0x40000000; 
    935                 *target_event = CondSwap32((quadlet_t)tmp); 
     935                *target_event = CondSwapToBus32((quadlet_t)tmp); 
    936936                buffer++; 
    937937                target_event += m_dimension; 
     
    968968        for (j = p.location;j < nevents; j += 8) { 
    969969            target_event = (quadlet_t *) (data + ((j * m_dimension) + p.position)); 
    970             *target_event = CondSwap32(IEC61883_AM824_SET_LABEL(0, IEC61883_AM824_LABEL_MIDI_NO_DATA)); 
     970            *target_event = CondSwapToBus32(IEC61883_AM824_SET_LABEL(0, IEC61883_AM824_LABEL_MIDI_NO_DATA)); 
    971971        } 
    972972    } 
     
    10011001                    tmpval = ((*buffer)<<16) & 0x00FF0000; 
    10021002                    tmpval = IEC61883_AM824_SET_LABEL(tmpval, IEC61883_AM824_LABEL_MIDI_1X); 
    1003                     *target_event = CondSwap32(tmpval); 
     1003                    *target_event = CondSwapToBus32(tmpval); 
    10041004 
    10051005//                     debugOutput ( DEBUG_LEVEL_VERBOSE, "MIDI port %s, pos=%u, loc=%u, nevents=%u, dim=%d\n", 
     
    10111011                    // or because this would exceed the maximum rate 
    10121012                    // FIXME: this can be ifdef optimized since it's a constant 
    1013                     *target_event = CondSwap32(IEC61883_AM824_SET_LABEL(0, IEC61883_AM824_LABEL_MIDI_NO_DATA)); 
     1013                    *target_event = CondSwapToBus32(IEC61883_AM824_SET_LABEL(0, IEC61883_AM824_LABEL_MIDI_NO_DATA)); 
    10141014                } 
    10151015                buffer+=8; 
     
    10191019                target_event = (quadlet_t *)(data + ((j * m_dimension) + p.position)); 
    10201020                __builtin_prefetch(target_event, 1, 0); // prefetch events for write, no temporal locality 
    1021                 *target_event = CondSwap32(IEC61883_AM824_SET_LABEL(0, IEC61883_AM824_LABEL_MIDI_NO_DATA)); 
     1021                *target_event = CondSwapToBus32(IEC61883_AM824_SET_LABEL(0, IEC61883_AM824_LABEL_MIDI_NO_DATA)); 
    10221022            } 
    10231023        } 
  • trunk/libffado/src/libstreaming/motu/MotuReceiveStreamProcessor.cpp

    r1135 r1136  
    131131        // for 2x rates, 32 for 4x rates). 
    132132        quadlet_t *quadlet = (quadlet_t *)data; 
    133         unsigned int dbs = get_bits(CondSwap32(quadlet[0]), 23, 8);  // Size of one event in terms of fdf_size 
    134         unsigned int fdf_size = get_bits(CondSwap32(quadlet[1]), 23, 8) == 0x22 ? 32:0; // Event unit size in bits 
     133        unsigned int dbs = get_bits(CondSwapFromBus32(quadlet[0]), 23, 8);  // Size of one event in terms of fdf_size 
     134        unsigned int fdf_size = get_bits(CondSwapFromBus32(quadlet[1]), 23, 8) == 0x22 ? 32:0; // Event unit size in bits 
    135135 
    136136        // Don't even attempt to process a packet if it isn't what 
     
    150150        // received.  Since every frame from the MOTU has its own timestamp 
    151151        // we can just pick it straight from the packet. 
    152         uint32_t last_sph = CondSwap32(*(quadlet_t *)(data+8+(n_events-1)*event_length)); 
     152        uint32_t last_sph = CondSwapFromBus32(*(quadlet_t *)(data+8+(n_events-1)*event_length)); 
    153153        m_last_timestamp = sphRecvToFullTicks(last_sph, m_Parent.get1394Service().getCycleTimer()); 
    154154 
     
    174174    quadlet_t* quadlet = (quadlet_t*) data; 
    175175 
    176     unsigned int dbs = get_bits(CondSwap32(quadlet[0]), 23, 8);  // Size of one event in terms of fdf_size 
    177     unsigned int fdf_size = get_bits(CondSwap32(quadlet[1]), 23, 8) == 0x22 ? 32:0; // Event unit size in bits 
     176    unsigned int dbs = get_bits(CondSwapFromBus32(quadlet[0]), 23, 8);  // Size of one event in terms of fdf_size 
     177    unsigned int fdf_size = get_bits(CondSwapFromBus32(quadlet[1]), 23, 8) == 0x22 ? 32:0; // Event unit size in bits 
    178178    // this is only called for packets that return eCRV_OK on processPacketHeader 
    179179    // so event_length won't become 0 
  • trunk/libffado/src/libstreaming/motu/MotuTransmitStreamProcessor.cpp

    r1135 r1136  
    293293            // network byte order).  After byte order swap, the 24-bit 
    294294            // MSB is in the second byte of val. 
    295             signed int val = CondSwap32(lrintf(0x7fffff*sin((1000.0*2.0*M_PI/24576000.0)*a_cx))); 
     295            signed int val = CondSwapToBus32(lrintf(0x7fffff*sin((1000.0*2.0*M_PI/24576000.0)*a_cx))); 
    296296            memcpy(sample,((char *)&val)+1,3); 
    297297            if ((a_cx+=int_tpf) >= 24576000) { 
     
    309309        for (int i=0; i < n_events; i++, quadlet += dbs) { 
    310310            int64_t ts_frame = addTicks(m_last_timestamp, (unsigned int)lrintf(i * ticks_per_frame)); 
    311             *quadlet = CondSwap32(fullTicksToSph(ts_frame)); 
     311            *quadlet = CondSwapToBus32(fullTicksToSph(ts_frame)); 
    312312//fprintf(stderr,"tx: %d/%d\n", 
    313313//  CYCLE_TIMER_GET_CYCLES(fullTicksToSph(ts_frame)), 
     
    405405    for (int i=0; i < n_events; i++, quadlet += dbs) { 
    406406        int64_t ts_frame = addTicks(m_last_timestamp, (unsigned int)lrintf(i * ticks_per_frame)); 
    407         *quadlet = CondSwap32(fullTicksToSph(ts_frame)); 
     407        *quadlet = CondSwapToBus32(fullTicksToSph(ts_frame)); 
    408408    } 
    409409 
     
    428428    // present.  For data-less packets the dbc is the same as the previously 
    429429    // transmitted block. 
    430     *quadlet = CondSwap32(0x00000400 | ((m_Parent.get1394Service().getLocalNodeId()&0x3f)<<24) | m_tx_dbc | (dbs<<16)); 
     430    *quadlet = CondSwapToBus32(0x00000400 | ((m_Parent.get1394Service().getLocalNodeId()&0x3f)<<24) | m_tx_dbc | (dbs<<16)); 
    431431    quadlet++; 
    432     *quadlet = CondSwap32(0x8222ffff); 
     432    *quadlet = CondSwapToBus32(0x8222ffff); 
    433433    quadlet++; 
    434434    return n_events; 
     
    445445    // present.  For data-less packets the dbc is the same as the previously 
    446446    // transmitted block. 
    447     *quadlet = CondSwap32(0x00000400 | ((m_Parent.get1394Service().getLocalNodeId()&0x3f)<<24) | m_tx_dbc | (dbs<<16)); 
     447    *quadlet = CondSwapToBus32(0x00000400 | ((m_Parent.get1394Service().getLocalNodeId()&0x3f)<<24) | m_tx_dbc | (dbs<<16)); 
    448448    quadlet++; 
    449     *quadlet = CondSwap32(0x8222ffff); 
     449    *quadlet = CondSwapToBus32(0x8222ffff); 
    450450    quadlet++; 
    451451    *length = 8; 
  • trunk/libffado/src/libutil/ByteSwap.h

    r1135 r1136  
    3535#include <stdio.h> 
    3636 
     37static inline uint64_t 
     38ByteSwap64(uint64_t d) 
     39{ 
     40    return bswap_64(d); 
     41} 
     42 
     43static inline uint32_t 
     44ByteSwap32(uint32_t d) 
     45{ 
     46    return bswap_32(d); 
     47} 
     48 
     49static inline uint16_t 
     50ByteSwap16(uint16_t d) 
     51{ 
     52    return bswap_16(d); 
     53} 
     54 
     55 
    3756#if __BYTE_ORDER == __BIG_ENDIAN 
    3857 
     
    4059 
    4160static inline uint64_t 
    42 CondSwap64(uint64_t d) 
    43 
    44     return d; 
    45 
    46  
    47 static inline uint32_t 
    48 CondSwap32(uint32_t d) 
    49 
    50     return d; 
    51 
    52  
    53 static inline uint16_t 
    54 CondSwap16(uint16_t d) 
     61CondSwapToBus64(uint64_t d) 
     62
     63    return d; 
     64
     65 
     66static inline uint32_t 
     67CondSwapToBus32(uint32_t d) 
     68
     69    return d; 
     70
     71 
     72static inline uint16_t 
     73CondSwapToBus16(uint16_t d) 
     74
     75    return d; 
     76
     77 
     78static inline uint64_t 
     79CondSwapFromBus64(uint64_t d) 
     80
     81    return d; 
     82
     83 
     84static inline uint32_t 
     85CondSwapFromBus32(uint32_t d) 
     86
     87    return d; 
     88
     89 
     90static inline uint16_t 
     91CondSwapFromBus16(uint16_t d) 
    5592{ 
    5693    return d; 
     
    72109 
    73110static inline uint64_t 
    74 CondSwap64(uint64_t d) 
    75 
    76     return bswap_64(d); 
    77 
    78  
    79 static inline uint32_t 
    80 CondSwap32(uint32_t d) 
    81 
    82     return bswap_32(d); 
    83 
    84  
    85 static inline uint16_t 
    86 CondSwap16(uint16_t d) 
    87 
    88     return bswap_16(d); 
     111CondSwapToBus64(uint64_t d) 
     112
     113    return ByteSwap64(d); 
     114
     115 
     116static inline uint32_t 
     117CondSwapToBus32(uint32_t d) 
     118
     119    return ByteSwap32(d); 
     120
     121 
     122static inline uint16_t 
     123CondSwapToBus16(uint16_t d) 
     124
     125    return ByteSwap16(d); 
     126
     127 
     128static inline uint64_t 
     129CondSwapFromBus64(uint64_t d) 
     130
     131    return ByteSwap64(d); 
     132
     133 
     134static inline uint32_t 
     135CondSwapFromBus32(uint32_t d) 
     136
     137    return ByteSwap32(d); 
     138
     139 
     140static inline uint16_t 
     141CondSwapFromBus16(uint16_t d) 
     142
     143    return ByteSwap16(d); 
    89144} 
    90145 
     
    99154    // Work input until data reaches 16 byte alignment 
    100155    while ((((unsigned long)data) & 0xF) && nb_elements > 0) { 
    101         *data = CondSwap32(*data); 
     156        *data = ByteSwap32(*data); 
    102157        data++; 
    103158        nb_elements--; 
     
    136191    // and do the remaining ones 
    137192    while (nb_elements > 0) { 
    138         *data = CondSwap32(*data); 
     193        *data = ByteSwap32(*data); 
    139194        data++; 
    140195        nb_elements--; 
     
    148203    // Work input until data reaches 16 byte alignment 
    149204    while ((((unsigned long)data) & 0xF) && nb_elements > 0) { 
    150         *data = CondSwap32(*data); 
     205        *data = ByteSwap32(*data); 
    151206        data++; 
    152207        nb_elements--; 
     
    182237    // and do the remaining ones 
    183238    while (nb_elements > 0) { 
    184         *data = CondSwap32(*data); 
     239        *data = ByteSwap32(*data); 
    185240        data++; 
    186241        nb_elements--; 
     
    195250    unsigned int i=0; 
    196251    for(; i<nb_elements; i++) { 
    197         *data = CondSwap32(*data); 
     252        *data = ByteSwap32(*data); 
    198253        data++; 
    199254    } 
     
    205260    unsigned int i=0; 
    206261    for(; i<nb_elements; i++) { 
    207         *data = CondSwap32(*data); 
     262        *data = ByteSwap32(*data); 
    208263        data++; 
    209264    } 
  • trunk/libffado/src/motu/motu_avdevice.cpp

    r1135 r1136  
    13891389  } 
    13901390 
    1391   return CondSwap32(quadlet); 
     1391  return CondSwapFromBus32(quadlet); 
    13921392} 
    13931393 
     
    13981398 
    13991399  unsigned int err = 0; 
    1400   data = CondSwap32(data); 
     1400  data = CondSwapToBus32(data); 
    14011401 
    14021402  // Note: 1394Service::write() expects a physical ID, not the node id 
  • trunk/libffado/src/rme/rme_avdevice.cpp

    r1135 r1136  
    252252        debugError("Error doing RME read from register 0x%06x\n",reg); 
    253253    } 
    254     return CondSwap32(quadlet); 
     254    return CondSwapFromBus32(quadlet); 
    255255} 
    256256 
     
    259259 
    260260    unsigned int err = 0; 
    261     data = CondSwap32(data); 
     261    data = CondSwapToBus32(data); 
    262262    if (get1394Service().write(0xffc0 | getNodeId(), reg, 1, &data) <= 0) { 
    263263        err = 1; 
  • trunk/libffado/tests/dumpiso_mod.cpp

    r1135 r1136  
    210210                    (length >= 2*sizeof(quadlet_t)); 
    211211        if(ok) { 
    212             timestamp = sytRecvToFullTicks((uint32_t)CondSwap16(packet->syt), 
     212            timestamp = sytRecvToFullTicks((uint32_t)CondSwapFromBus16(packet->syt), 
    213213                                    cycle, cycle_timer); 
    214214        } 
  • trunk/libffado/tests/scan-devreg.cpp

    r1135 r1136  
    284284                continue; 
    285285            } else { 
    286                 quadlet = CondSwap32(quadlet); 
     286                quadlet = CondSwapFromBus32(quadlet); 
    287287            } 
    288288             
  • trunk/libffado/tests/test-bufferops.cpp

    r1135 r1136  
    6565     
    6666    for (i=0; i<nb_quadlets; i++) { 
    67         buffer_ref[i] = CondSwap32(buffer_1[i]); 
     67        buffer_ref[i] = CondSwapToBus32(buffer_1[i]); 
    6868    } 
    6969