AJA NTV2 SDK  18.0.0.2122
NTV2 SDK 18.0.0.2122
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 OPEN_UNSUPPORTED_DEVICES // Define to open device, even if it's not support (see NTV2GetSupportedDevices)
17 
18 
23 {
27  public:
31 
36  AJA_VIRTUAL bool WriteRegister (const ULWord inRegNum, const ULWord inValue, const ULWord inMask = 0xFFFFFFFF, const ULWord inShift = 0);
38  AJA_VIRTUAL bool ReadRegister (const ULWord inRegNum, ULWord & outValue, const ULWord inMask = 0xFFFFFFFF, const ULWord inShift = 0);
39 
40  AJA_VIRTUAL bool AcquireStreamForApplication (ULWord inApplicationType, int32_t inProcessID);
41  AJA_VIRTUAL bool ReleaseStreamForApplication (ULWord inApplicationType, int32_t inProcessID);
42  AJA_VIRTUAL bool AcquireStreamForApplicationWithReference (ULWord inApplicationType, int32_t inProcessID);
43  AJA_VIRTUAL bool ReleaseStreamForApplicationWithReference (ULWord inApplicationType, int32_t inProcessID);
44  AJA_VIRTUAL bool SetStreamingApplication (const ULWord appType, const int32_t pid);
45  AJA_VIRTUAL bool GetStreamingApplication (ULWord & outAppType, int32_t & outProcessID);
46 
47  AJA_VIRTUAL bool WaitForInterrupt (const INTERRUPT_ENUMS type, const ULWord timeout = 50);
48  AJA_VIRTUAL bool GetInterruptCount (const INTERRUPT_ENUMS eInterrupt, ULWord & outCount);
49  AJA_VIRTUAL bool WaitForChangeEvent (UInt32 timeout = 0);
50  AJA_VIRTUAL bool DmaTransfer (const NTV2DMAEngine inDMAEngine,
51  const bool inIsRead,
52  const ULWord inFrameNumber,
53  ULWord * pFrameBuffer,
54  const ULWord inCardOffsetBytes,
55  const ULWord inByteCount,
56  const bool inSynchronous = true);
57 
58  AJA_VIRTUAL bool DmaTransfer (const NTV2DMAEngine inDMAEngine,
59  const bool inIsRead,
60  const ULWord inFrameNumber,
61  ULWord * pFrameBuffer,
62  const ULWord inCardOffsetBytes,
63  const ULWord inByteCount,
64  const ULWord inNumSegments,
65  const ULWord inSegmentHostPitch,
66  const ULWord inSegmentCardPitch,
67  const bool inSynchronous = true);
68 
69  AJA_VIRTUAL bool DmaTransfer (const NTV2DMAEngine inDMAEngine,
70  const NTV2Channel inDMAChannel,
71  const bool inIsTarget,
72  const ULWord inFrameNumber,
73  const ULWord inCardOffsetBytes,
74  const ULWord inByteCount,
75  const ULWord inNumSegments,
76  const ULWord inSegmentHostPitch,
77  const ULWord inSegmentCardPitch,
78  const PCHANNEL_P2P_STRUCT & inP2PData);
79 
80  AJA_VIRTUAL bool AutoCirculate (AUTOCIRCULATE_DATA & autoCircData);
81  AJA_VIRTUAL bool NTV2Message (NTV2_HEADER * pInMessage);
82  AJA_VIRTUAL bool ControlDriverDebugMessages (NTV2_DriverDebugMessageSet /*msgSet*/, bool /*enable*/) {return false;}
83  //AJA_VIRTUAL bool RestoreHardwareProcampRegisters (void);
85 
86 #if !defined(NTV2_DEPRECATE_16_0)
87  AJA_VIRTUAL NTV2_DEPRECATED_16_0(bool GetStreamingApplication(ULWord * pAppType, int32_t * pPID)) {return pAppType && pPID ? GetStreamingApplication(*pAppType,*pPID) : false;}
88  AJA_VIRTUAL NTV2_DEPRECATED_16_0(bool SystemControl(void* dataPtr, SystemControlCode systemControlCode));
97  AJA_VIRTUAL NTV2_DEPRECATED_16_0(bool MapMemory(const MemoryType memType, void **memPtr));
98 #endif // !defined(NTV2_DEPRECATE_16_0)
99 
102 
103  //AJA_VIRTUAL bool SystemStatus( void* dataPtr, SystemStatusCode systemStatusCode );
104  AJA_VIRTUAL bool KernelLog( void* dataPtr, UInt32 dataSize );
105  AJA_VIRTUAL bool ConfigureInterrupt( bool /*bEnable*/, INTERRUPT_ENUMS /*eInterruptType*/ ) {return true;}
106  AJA_VIRTUAL std::string GetConnectionType (void) const {return IsOpen() && !IsRemote() ? (mIsDEXT ? "DEXT" : "KEXT") : "";} // New in SDK 17.0
107 
108 #if !defined(NTV2_NULL_DEVICE)
109  protected:
110  AJA_VIRTUAL bool OpenLocalPhysical (const UWord inDeviceIndex);
111  AJA_VIRTUAL bool CloseLocalPhysical (void);
112 #endif // !defined(NTV2_NULL_DEVICE)
113 
114 private:
115  bool mIsDEXT; // Uses DEXT interface?
116  AJA_VIRTUAL inline io_connect_t GetIOConnect (void) const {return mConnection;} // For internal use only
117  io_connect_t mConnection; // My io_connect_t
118 
119  // 64 bit thunking - only for structures that contain pointers
120  AJA_VIRTUAL void CopyTo_AUTOCIRCULATE_DATA_64 (AUTOCIRCULATE_DATA *p, AUTOCIRCULATE_DATA_64 *p64);
121  AJA_VIRTUAL void CopyTo_AUTOCIRCULATE_DATA (AUTOCIRCULATE_DATA_64 *p64, AUTOCIRCULATE_DATA *p);
122  AJA_VIRTUAL void CopyTo_AUTOCIRCULATE_TRANSFER_STRUCT_64 (AUTOCIRCULATE_TRANSFER_STRUCT *p, AUTOCIRCULATE_TRANSFER_STRUCT_64 *p64);
123  AJA_VIRTUAL void CopyTo_AUTOCIRCULATE_TASK_STRUCT_64 (AUTOCIRCULATE_TASK_STRUCT *p, AUTOCIRCULATE_TASK_STRUCT_64 *p64);
124  AJA_VIRTUAL void CopyTo_AUTOCIRCULATE_TRANSFER_STRUCT (AUTOCIRCULATE_TRANSFER_STRUCT_64 *p64, AUTOCIRCULATE_TRANSFER_STRUCT *p);
125 
126 }; // CNTV2MacDriverInterface
127 
128 #endif // NTV2MACDRIVERINTERFACE_H
virtual bool ReleaseStreamForApplicationWithReference(ULWord inApplicationType, int32_t inProcessID)
A reference-counted version of CNTV2DriverInterface::ReleaseStreamForApplication useful for process g...
virtual bool ReleaseStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Releases exclusive use of the AJA device for the given process, permitting other processes to acquire...
Declares the CNTV2DriverInterface base class.
Declares MacOS-only enums used by the Mac driver and the SDK.
virtual bool GetAudioOutputMode(NTV2_GlobalAudioPlaybackMode *mode)
virtual ULWord GetPCISlotNumber(void) const
CNTV2MacDriverInterface()
My default constructor.
virtual std::string GetConnectionType(void) const
NTV2_DriverDebugMessageSet
Definition: ntv2enums.h:3829
uint32_t ULWord
Definition: ajatypes.h:223
virtual ~CNTV2MacDriverInterface()
My destructor.
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
Definition: ntv2enums.h:1357
virtual bool SetAudioOutputMode(NTV2_GlobalAudioPlaybackMode mode)
virtual bool IsRemote(void) const
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...
virtual bool WaitForChangeEvent(UInt32 timeout=0)
I'm the base class that undergirds the platform-specific derived classes (from which CNTV2Card is ult...
virtual bool CloseLocalPhysical(void)
Releases host resources associated with the local/physical device connection.
virtual bool IsOpen(void) const
virtual bool MapMemory(const MemoryType memType, void **memPtr)
virtual bool GetStreamingApplication(ULWord *pAppType, int32_t *pPID)
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 ...
#define AJA_VIRTUAL
Definition: ajatypes.h:130
NTV2DMAEngine
Definition: ntv2enums.h:1856
enum _INTERRUPT_ENUMS_ INTERRUPT_ENUMS
virtual bool ControlDriverDebugMessages(NTV2_DriverDebugMessageSet, bool)
All new NTV2 structs start with this common header.
virtual bool AcquireStreamForApplicationWithReference(ULWord inApplicationType, int32_t inProcessID)
A reference-counted version of CNTV2DriverInterface::AcquireStreamForApplication useful for process g...
virtual bool GetInterruptCount(const INTERRUPT_ENUMS eInterrupt, ULWord &outCount)
Answers with the number of interrupts of the given type processed by the driver.
NTV2_GlobalAudioPlaybackMode
Definition: ntv2enums.h:2106
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...
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...
virtual bool NTV2Message(NTV2_HEADER *pInMessage)
Sends a message to the NTV2 driver (the new, improved, preferred way).
virtual bool KernelLog(void *dataPtr, UInt32 dataSize)
SystemControlCode
uint16_t UWord
Definition: ajatypes.h:221
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...
virtual bool OpenLocalPhysical(const UWord inDeviceIndex)
Opens the local/physical device connection.
virtual bool AutoCirculate(AUTOCIRCULATE_DATA &autoCircData)
Sends an AutoCirculate command to the NTV2 driver.
virtual bool WaitForInterrupt(const INTERRUPT_ENUMS type, const ULWord timeout=50)
#define NTV2_DEPRECATED_16_0(__f__)
Definition: ajatypes.h:529
virtual bool ConfigureInterrupt(bool, INTERRUPT_ENUMS)
virtual bool SystemControl(void *dataPtr, SystemControlCode systemControlCode)
A Mac-specific implementation of CNTV2DriverInterface.
Declares enums and structs used by all platform drivers and the SDK.
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 ...
virtual bool UnmapFrameBuffers(void)