Ticket #8371: darwinfirewire.patch

File darwinfirewire.patch, 3.0 KB (added by Ojas Parekh <mythtv@…>, 16 years ago)

libs/libmythtv/darwinfirewire.cpp patch

  • darwinfirewiredevice.cpp

     
    1313#undef always_inline
    1414#include <IOKit/IOMessage.h>
    1515#include <IOKit/IOKitLib.h>
    16 #include <IOKit/firewire/IOFireWireLib.h>
    17 #include <IOKit/firewire/IOFireWireLibIsoch.h>
    18 #include <IOKit/firewire/IOFireWireFamilyCommon.h>
    19 #include <IOKit/avc/IOFireWireAVCLib.h>
    2016
    2117// Std C++ headers
    2218#include <algorithm>
     
    2925#include "mythverbose.h"
    3026
    3127// Apple Firewire example headers
    32 #include <AVCVideoServices/StringLogger.h>
    33 #include <AVCVideoServices/AVSShared.h>
    34 #include <AVCVideoServices/MPEG2Receiver.h>
     28#include <AVCVideoServices/AVCVideoServices.h>
    3529
    36 // header not used because it also requires MPEG2Transmitter.h
    37 //#include <AVCVideoServices/FireWireMPEG.h>
    38 namespace AVS
    39 {
    40     IOReturn CreateMPEG2Receiver(
    41         MPEG2Receiver           **ppReceiver,
    42         DataPushProc              dataPushProcHandler,
    43         void                     *pDataPushProcRefCon = nil,
    44         MPEG2ReceiverMessageProc  messageProcHandler  = nil,
    45         void                     *pMessageProcRefCon  = nil,
    46         StringLogger             *stringLogger        = nil,
    47         IOFireWireLibNubRef       nubInterface        = nil,
    48         unsigned int              cyclesPerSegment    =
    49             kCyclesPerReceiveSegment,
    50         unsigned int              numSegments         =
    51             kNumReceiveSegments,
    52         bool                      doIRMAllocations    = false);
    53     IOReturn DestroyMPEG2Receiver(MPEG2Receiver *pReceiver);
    54 }
    55 
    5630#define LOC      QString("DFireDev(%1): ").arg(guid_to_string(m_guid))
    5731#define LOC_WARN QString("DFireDev(%1), Warning: ").arg(guid_to_string(m_guid))
    5832#define LOC_ERR  QString("DFireDev(%1), Error: ").arg(guid_to_string(m_guid))
     
    375349        uint32_t val;
    376350        int ret = (*fw_handle)->ReadQuadlet(
    377351            fw_handle, dev, &addr, (UInt32*) &val, false, 0);
    378 
     352        val = EndianU32_BtoN(val);
     353     
    379354        return (ret == kIOReturnSuccess) ? (int)((val>>30) & 0x3) : -1;
    380355    }
    381356
     
    400375    uint32_t val;
    401376    int ret = (*fw_handle)->ReadQuadlet(
    402377        fw_handle, dev, &addr, (UInt32*) &val, false, 0);
     378    val = EndianU32_BtoN(val);
    403379
    404380    if (ret != kIOReturnSuccess)
    405381        return false;
     
    706682    {
    707683        return false;
    708684    }
    709 
     685    old_plug_val = EndianU32_BtoN(old_plug_val);
     686 
    710687    int old_plug_cnt = (old_plug_val >> 24) & 0x3f;
    711688    int old_fw_chan  = (old_plug_val >> 16) & 0x3f;
    712689    int old_speed    = (old_plug_val >> 14) & 0x03;
     
    750727    new_plug_val &= ~(0x03<<14);
    751728    new_plug_val |= (new_speed & 0x03) << 14;
    752729
     730    old_plug_val = EndianU32_NtoB(old_plug_val);
     731    new_plug_val = EndianU32_NtoB(new_plug_val);
    753732    return (kIOReturnSuccess == (*fw_handle)->CompareSwap(
    754733                fw_handle, dev, &addr, old_plug_val, new_plug_val, false, 0));
    755734}