AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
ntv2macdriverinterface.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #ifndef NTV2MACDRIVERINTERFACE_H
9 #define NTV2MACDRIVERINTERFACE_H
10 
11 
12 #include "ntv2publicinterface.h"
13 #include "ntv2macpublicinterface.h"
14 #include "ntv2driverinterface.h"
15 
16 //#define USE_DEVICE_MAP // Define to use one io_connect_t for all CNTV2Card instances (per device)
17 //#define OPEN_UNSUPPORTED_DEVICES // Define to open device, even if it's not support (see NTV2GetSupportedDevices)
18 
19 
24 {
28  public:
32 
37  AJA_VIRTUAL bool WriteRegister (const ULWord inRegNum, const ULWord inValue, const ULWord inMask = 0xFFFFFFFF, const ULWord inShift = 0);
39  AJA_VIRTUAL bool ReadRegister (const ULWord inRegNum, ULWord & outValue, const ULWord inMask = 0xFFFFFFFF, const ULWord inShift = 0);
40 
41  AJA_VIRTUAL bool AcquireStreamForApplication (ULWord inApplicationType, int32_t inProcessID);
42  AJA_VIRTUAL bool ReleaseStreamForApplication (ULWord inApplicationType, int32_t inProcessID);
43  AJA_VIRTUAL bool AcquireStreamForApplicationWithReference (ULWord inApplicationType, int32_t inProcessID);
44  AJA_VIRTUAL bool ReleaseStreamForApplicationWithReference (ULWord inApplicationType, int32_t inProcessID);
45  AJA_VIRTUAL bool SetStreamingApplication (const ULWord appType, const int32_t pid);
46  AJA_VIRTUAL bool GetStreamingApplication (ULWord & outAppType, int32_t & outProcessID);
47 
48  AJA_VIRTUAL bool WaitForInterrupt (const INTERRUPT_ENUMS type, const ULWord timeout = 50);
49  AJA_VIRTUAL bool GetInterruptCount (const INTERRUPT_ENUMS eInterrupt, ULWord & outCount);
50  AJA_VIRTUAL bool WaitForChangeEvent (UInt32 timeout = 0);
51  AJA_VIRTUAL bool DmaTransfer (const NTV2DMAEngine inDMAEngine,
52  const bool inIsRead,
53  const ULWord inFrameNumber,
54  ULWord * pFrameBuffer,
55  const ULWord inCardOffsetBytes,
56  const ULWord inByteCount,
57  const bool inSynchronous = true);
58 
59  AJA_VIRTUAL bool DmaTransfer (const NTV2DMAEngine inDMAEngine,
60  const bool inIsRead,
61  const ULWord inFrameNumber,
62  ULWord * pFrameBuffer,
63  const ULWord inCardOffsetBytes,
64  const ULWord inByteCount,
65  const ULWord inNumSegments,
66  const ULWord inSegmentHostPitch,
67  const ULWord inSegmentCardPitch,
68  const bool inSynchronous = true);
69 
70  AJA_VIRTUAL bool DmaTransfer (const NTV2DMAEngine inDMAEngine,
71  const NTV2Channel inDMAChannel,
72  const bool inIsTarget,
73  const ULWord inFrameNumber,
74  const ULWord inCardOffsetBytes,
75  const ULWord inByteCount,
76  const ULWord inNumSegments,
77  const ULWord inSegmentHostPitch,
78  const ULWord inSegmentCardPitch,
79  const PCHANNEL_P2P_STRUCT & inP2PData);
80 
81  AJA_VIRTUAL bool AutoCirculate (AUTOCIRCULATE_DATA & autoCircData);
82  AJA_VIRTUAL bool NTV2Message (NTV2_HEADER * pInMessage);
83  AJA_VIRTUAL bool ControlDriverDebugMessages (NTV2_DriverDebugMessageSet /*msgSet*/, bool /*enable*/) {return false;}
86 
87 #if !defined(NTV2_DEPRECATE_16_0)
88  AJA_VIRTUAL NTV2_DEPRECATED_f(bool GetStreamingApplication(ULWord * pAppType, int32_t * pPID)) {return pAppType && pPID ? GetStreamingApplication(*pAppType,*pPID) : false;}
89  AJA_VIRTUAL NTV2_DEPRECATED_f(bool SystemControl(void* dataPtr, SystemControlCode systemControlCode));
90  AJA_VIRTUAL NTV2_DEPRECATED_f(void Sleep(int)) {}
98  AJA_VIRTUAL NTV2_DEPRECATED_f(bool MapMemory(const MemoryType memType, void **memPtr));
99 #endif // !defined(NTV2_DEPRECATE_16_0)
100 
103 
104  AJA_VIRTUAL bool SystemStatus( void* dataPtr, SystemStatusCode systemStatusCode );
105  AJA_VIRTUAL bool KernelLog( void* dataPtr, UInt32 dataSize );
106  AJA_VIRTUAL bool ConfigureInterrupt( bool /*bEnable*/, INTERRUPT_ENUMS /*eInterruptType*/ ) {return true;}
107  AJA_VIRTUAL std::string GetConnectionType (void) const {return IsOpen() && !IsRemote() ? (mIsDEXT ? "DEXT" : "KEXT") : "";} // New in SDK 17.0
108 
109 #if !defined(NTV2_NULL_DEVICE)
110  protected:
111  AJA_VIRTUAL bool OpenLocalPhysical (const UWord inDeviceIndex);
112  AJA_VIRTUAL bool CloseLocalPhysical (void);
113 #endif // !defined(NTV2_NULL_DEVICE)
114 
115 private:
116  bool mIsDEXT; // Uses DEXT interface?
117 #if defined(USE_DEVICE_MAP)
118  AJA_VIRTUAL io_connect_t GetIOConnect (const bool inDoNotAllocate = false) const; // For internal use only
119 #else
120  AJA_VIRTUAL inline io_connect_t GetIOConnect (void) const {return mConnection;} // For internal use only
121  io_connect_t mConnection; // My io_connect_t
122 #endif
123 
124  // 64 bit thunking - only for structures that contain pointers
125  AJA_VIRTUAL void CopyTo_AUTOCIRCULATE_DATA_64 (AUTOCIRCULATE_DATA *p, AUTOCIRCULATE_DATA_64 *p64);
126  AJA_VIRTUAL void CopyTo_AUTOCIRCULATE_DATA (AUTOCIRCULATE_DATA_64 *p64, AUTOCIRCULATE_DATA *p);
127  AJA_VIRTUAL void CopyTo_AUTOCIRCULATE_TRANSFER_STRUCT_64 (AUTOCIRCULATE_TRANSFER_STRUCT *p, AUTOCIRCULATE_TRANSFER_STRUCT_64 *p64);
128  AJA_VIRTUAL void CopyTo_AUTOCIRCULATE_TASK_STRUCT_64 (AUTOCIRCULATE_TASK_STRUCT *p, AUTOCIRCULATE_TASK_STRUCT_64 *p64);
129  AJA_VIRTUAL void CopyTo_AUTOCIRCULATE_TRANSFER_STRUCT (AUTOCIRCULATE_TRANSFER_STRUCT_64 *p64, AUTOCIRCULATE_TRANSFER_STRUCT *p);
130 
131 }; // CNTV2MacDriverInterface
132 
133 #endif // NTV2MACDRIVERINTERFACE_H
CNTV2MacDriverInterface::MapRegisters
virtual bool MapRegisters(void)
Definition: ntv2macdriverinterface.cpp:616
INTERRUPT_ENUMS
enum _INTERRUPT_ENUMS_ INTERRUPT_ENUMS
CNTV2MacDriverInterface::GetAudioOutputMode
virtual bool GetAudioOutputMode(NTV2_GlobalAudioPlaybackMode *mode)
Definition: ntv2macdriverinterface.cpp:1462
CNTV2MacDriverInterface::KernelLog
virtual bool KernelLog(void *dataPtr, UInt32 dataSize)
Definition: ntv2macdriverinterface.cpp:970
NTV2_DriverDebugMessageSet
NTV2_DriverDebugMessageSet
Definition: ntv2enums.h:3743
CNTV2MacDriverInterface::~CNTV2MacDriverInterface
virtual ~CNTV2MacDriverInterface()
My destructor.
Definition: ntv2macdriverinterface.cpp:463
CNTV2MacDriverInterface::ReadRegister
virtual bool ReadRegister(const ULWord inRegNum, ULWord &outValue, const ULWord inMask=0xFFFFFFFF, const ULWord inShift=0)
Reads all or part of the 32-bit contents of a specific register (real or virtual) on the AJA device....
Definition: ntv2macdriverinterface.cpp:709
NTV2Channel
NTV2Channel
These enum values are mostly used to identify a specific Frame Store. They're also commonly used to i...
Definition: ntv2enums.h:1305
CNTV2MacDriverInterface::AutoCirculate
virtual bool AutoCirculate(AUTOCIRCULATE_DATA &autoCircData)
Sends an AutoCirculate command to the NTV2 driver.
Definition: ntv2macdriverinterface.cpp:1274
CNTV2MacDriverInterface::ReleaseStreamForApplication
virtual bool ReleaseStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Releases exclusive use of the AJA device for the given process, permitting other processes to acquire...
Definition: ntv2macdriverinterface.cpp:832
CNTV2MacDriverInterface::OpenLocalPhysical
virtual bool OpenLocalPhysical(const UWord inDeviceIndex)
Opens the local/physical device connection.
Definition: ntv2macdriverinterface.cpp:473
CNTV2MacDriverInterface::WaitForInterrupt
virtual bool WaitForInterrupt(const INTERRUPT_ENUMS type, const ULWord timeout=50)
Definition: ntv2macdriverinterface.cpp:1015
CNTV2MacDriverInterface::GetInterruptCount
virtual bool GetInterruptCount(const INTERRUPT_ENUMS eInterrupt, ULWord &outCount)
Answers with the number of interrupts of the given type processed by the driver.
Definition: ntv2macdriverinterface.cpp:1053
NTV2_GlobalAudioPlaybackMode
NTV2_GlobalAudioPlaybackMode
Definition: ntv2enums.h:2047
CNTV2MacDriverInterface::SystemStatus
virtual bool SystemStatus(void *dataPtr, SystemStatusCode systemStatusCode)
Definition: ntv2macdriverinterface.cpp:1250
NTV2DMAEngine
NTV2DMAEngine
Definition: ntv2enums.h:1801
MemoryType
MemoryType
Definition: ntv2macpublicinterface.h:79
ULWord
uint32_t ULWord
Definition: ajatypes.h:246
CNTV2MacDriverInterface::GetStreamingApplication
virtual bool GetStreamingApplication(ULWord &outAppType, int32_t &outProcessID)
Answers with the four-CC type and process ID of the application that currently "owns" the AJA device ...
Definition: ntv2macdriverinterface.cpp:944
AUTOCIRCULATE_TRANSFER_STRUCT
Definition: ntv2publicinterface.h:4542
CNTV2MacDriverInterface::MapXena2Flash
virtual bool MapXena2Flash(void)
Definition: ntv2macdriverinterface.cpp:637
CNTV2MacDriverInterface::GetConnectionType
virtual std::string GetConnectionType(void) const
Definition: ntv2macdriverinterface.h:107
AUTOCIRCULATE_DATA_64
Definition: ntv2publicinterface.h:4309
NTV2_HEADER
All new NTV2 structs start with this common header.
Definition: ntv2publicinterface.h:6899
UWord
uint16_t UWord
Definition: ajatypes.h:244
CNTV2MacDriverInterface::RestoreHardwareProcampRegisters
virtual bool RestoreHardwareProcampRegisters(void)
Definition: ntv2macdriverinterface.cpp:1229
SystemStatusCode
SystemStatusCode
Definition: ntv2publicinterface.h:4823
ntv2macpublicinterface.h
Declares MacOS-only enums used by the Mac driver and the SDK.
CNTV2MacDriverInterface::WaitForChangeEvent
virtual bool WaitForChangeEvent(UInt32 timeout=0)
Definition: ntv2macdriverinterface.cpp:1084
CNTV2MacDriverInterface::ControlDriverDebugMessages
virtual bool ControlDriverDebugMessages(NTV2_DriverDebugMessageSet, bool)
Definition: ntv2macdriverinterface.h:83
AJA_VIRTUAL
#define AJA_VIRTUAL
Definition: ajatypes.h:153
AUTOCIRCULATE_TRANSFER_STRUCT_64
Definition: ntv2publicinterface.h:4505
CNTV2MacDriverInterface::ConfigureInterrupt
virtual bool ConfigureInterrupt(bool, INTERRUPT_ENUMS)
Definition: ntv2macdriverinterface.h:106
CNTV2MacDriverInterface::MapMemory
virtual bool MapMemory(const MemoryType memType, void **memPtr)
Definition: ntv2macdriverinterface.cpp:658
CNTV2MacDriverInterface::SystemControl
virtual bool SystemControl(void *dataPtr, SystemControlCode systemControlCode)
Definition: ntv2macdriverinterface.cpp:677
CNTV2MacDriverInterface::UnmapXena2Flash
virtual bool UnmapXena2Flash(void)
Definition: ntv2macdriverinterface.cpp:649
NTV2_SHOULD_BE_DEPRECATED
#define NTV2_SHOULD_BE_DEPRECATED(__f__)
Definition: ajatypes.h:616
NTV2_DEPRECATED_f
#define NTV2_DEPRECATED_f(__f__)
Definition: ajatypes.h:646
CNTV2MacDriverInterface::MapFrameBuffers
virtual bool MapFrameBuffers(void)
Definition: ntv2macdriverinterface.cpp:593
false
#define false
Definition: ntv2devicefeatures.h:25
CNTV2MacDriverInterface::SetStreamingApplication
virtual bool SetStreamingApplication(const ULWord appType, const int32_t pid)
Sets the four-CC type and process ID of the application that should "own" the AJA device (i....
Definition: ntv2macdriverinterface.cpp:920
SystemControlCode
SystemControlCode
Definition: ntv2publicinterface.h:4869
CNTV2MacDriverInterface::NTV2Message
virtual bool NTV2Message(NTV2_HEADER *pInMessage)
Sends a message to the NTV2 driver (the new, improved, preferred way).
Definition: ntv2macdriverinterface.cpp:1418
CNTV2MacDriverInterface::AcquireStreamForApplicationWithReference
virtual bool AcquireStreamForApplicationWithReference(ULWord inApplicationType, int32_t inProcessID)
A reference-counted version of CNTV2DriverInterface::AcquireStreamForApplication useful for process g...
Definition: ntv2macdriverinterface.cpp:863
CNTV2MacDriverInterface::UnmapRegisters
virtual bool UnmapRegisters(void)
Definition: ntv2macdriverinterface.cpp:628
AUTOCIRCULATE_P2P_STRUCT
Definition: ntv2publicinterface.h:4626
CNTV2MacDriverInterface::AcquireStreamForApplication
virtual bool AcquireStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Reserves exclusive use of the AJA device for a given process, preventing other processes on the host ...
Definition: ntv2macdriverinterface.cpp:808
CNTV2MacDriverInterface
A Mac-specific implementation of CNTV2DriverInterface.
Definition: ntv2macdriverinterface.h:23
CNTV2MacDriverInterface::CNTV2MacDriverInterface
CNTV2MacDriverInterface()
My default constructor.
Definition: ntv2macdriverinterface.cpp:451
CNTV2MacDriverInterface::DmaTransfer
virtual bool DmaTransfer(const NTV2DMAEngine inDMAEngine, const bool inIsRead, const ULWord inFrameNumber, ULWord *pFrameBuffer, const ULWord inCardOffsetBytes, const ULWord inByteCount, const bool inSynchronous=(!(0)))
Transfers data between the AJA device and the host. This function will block and not return to the ca...
Definition: ntv2macdriverinterface.cpp:1113
CNTV2MacDriverInterface::UnmapFrameBuffers
virtual bool UnmapFrameBuffers(void)
Definition: ntv2macdriverinterface.cpp:606
CNTV2MacDriverInterface::SetAudioOutputMode
virtual bool SetAudioOutputMode(NTV2_GlobalAudioPlaybackMode mode)
Definition: ntv2macdriverinterface.cpp:1457
AUTOCIRCULATE_TASK_STRUCT
Definition: ntv2publicinterface.h:4724
ntv2publicinterface.h
Declares enums and structs used by all platform drivers and the SDK.
CNTV2MacDriverInterface::ReleaseStreamForApplicationWithReference
virtual bool ReleaseStreamForApplicationWithReference(ULWord inApplicationType, int32_t inProcessID)
A reference-counted version of CNTV2DriverInterface::ReleaseStreamForApplication useful for process g...
Definition: ntv2macdriverinterface.cpp:890
CNTV2DriverInterface
I'm the base class that undergirds the platform-specific derived classes (from which CNTV2Card is ult...
Definition: ntv2driverinterface.h:64
ntv2driverinterface.h
Declares the CNTV2DriverInterface base class.
CNTV2MacDriverInterface::WriteRegister
virtual bool WriteRegister(const ULWord inRegNum, const ULWord inValue, const ULWord inMask=0xFFFFFFFF, const ULWord inShift=0)
Updates or replaces all or part of the 32-bit contents of a specific register (real or virtual) on th...
Definition: ntv2macdriverinterface.cpp:754
CNTV2MacDriverInterface::GetPCISlotNumber
virtual ULWord GetPCISlotNumber(void) const
Definition: ntv2macdriverinterface.cpp:581
AUTOCIRCULATE_DATA
Definition: ntv2publicinterface.h:4338
AUTOCIRCULATE_TASK_STRUCT_64
Definition: ntv2publicinterface.h:4711
CNTV2MacDriverInterface::CloseLocalPhysical
virtual bool CloseLocalPhysical(void)
Releases host resources associated with the local/physical device connection.
Definition: ntv2macdriverinterface.cpp:557