AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
ntv2windriverinterface.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
7 #ifndef NTV2WINDRIVERINTERFACE_H
8 #define NTV2WINDRIVERINTERFACE_H
9 
10 #include "ajaexport.h"
11 #include "ajatypes.h"
12 #include <assert.h>
13 #include <stdio.h>
14 #include <string.h>
15 #include <tchar.h>
16 #include <ks.h>
17 #include <ksmedia.h>
18 #include <Setupapi.h>
19 #include <cfgmgr32.h>
20 #include "psapi.h"
21 
22 #include "ntv2driverinterface.h"
23 #include "ntv2winpublicinterface.h"
24 #include "ntv2devicefeatures.h"
25 #include <vector>
26 
27 
32 {
33  public:
35  virtual ~CNTV2WinDriverInterface();
36 
37  public:
38  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 #if !defined(NTV2_DEPRECATE_14_3)
41  AJA_VIRTUAL inline NTV2_DEPRECATED_f(bool ReadRegister (const ULWord inRegNum, ULWord * pOutValue, const ULWord inRegMask = 0xFFFFFFFF, const ULWord inRegShift = 0x0))
42  {return pOutValue && ReadRegister(inRegNum, *pOutValue, inRegMask, inRegShift);}
43 #endif // NTV2_DEPRECATE_14_3
44  AJA_VIRTUAL bool DmaTransfer (const NTV2DMAEngine inDMAEngine,
45  const bool inIsRead,
46  const ULWord inFrameNumber,
47  ULWord * pFrameBuffer,
48  const ULWord inCardOffsetBytes,
49  const ULWord inByteCount,
50  const bool inSynchronous = true);
51 
52  AJA_VIRTUAL bool DmaTransfer (const NTV2DMAEngine inDMAEngine,
53  const bool inIsRead,
54  const ULWord inFrameNumber,
55  ULWord * pFrameBuffer,
56  const ULWord inCardOffsetBytes,
57  const ULWord inByteCount,
58  const ULWord inNumSegments,
59  const ULWord inSegmentHostPitch,
60  const ULWord inSegmentCardPitch,
61  const bool inSynchronous = true);
62 
63  AJA_VIRTUAL bool DmaTransfer (const NTV2DMAEngine inDMAEngine,
64  const NTV2Channel inDMAChannel,
65  const bool inIsTarget,
66  const ULWord inFrameNumber,
67  const ULWord inCardOffsetBytes,
68  const ULWord inByteCount,
69  const ULWord inNumSegments,
70  const ULWord inSegmentHostPitch,
71  const ULWord inSegmentCardPitch,
72  const PCHANNEL_P2P_STRUCT & inP2PData);
73 
74  AJA_VIRTUAL bool ConfigureInterrupt (const bool bEnable, const INTERRUPT_ENUMS eInterruptType);
75  AJA_VIRTUAL bool ConfigureSubscription (const bool bSubscribe, const INTERRUPT_ENUMS eInterruptType, PULWord & hSubcription);
76  AJA_VIRTUAL bool GetInterruptCount (const INTERRUPT_ENUMS eInterrupt, ULWord & outCount);
77  AJA_VIRTUAL bool WaitForInterrupt (const INTERRUPT_ENUMS eInterruptType, const ULWord timeOutMs = 50);
78 
79  AJA_VIRTUAL bool AutoCirculate (AUTOCIRCULATE_DATA &autoCircData);
80  AJA_VIRTUAL bool NTV2Message (NTV2_HEADER * pInMessage);
82  AJA_VIRTUAL bool ControlDriverDebugMessages(NTV2_DriverDebugMessageSet msgSet, bool enable) {(void)msgSet; (void)enable; return false;}
83 
84 #if !defined(NTV2_DEPRECATE_13_0)
85  AJA_VIRTUAL NTV2_DEPRECATED_f(bool SetRelativeVideoPlaybackDelay (ULWord frmDelay)) {(void)frmDelay; return false;}
86  AJA_VIRTUAL NTV2_DEPRECATED_f(bool GetRelativeVideoPlaybackDelay (ULWord* frmDelay)) {(void)frmDelay; return false;}
87  AJA_VIRTUAL NTV2_DEPRECATED_f(bool SetAudioPlaybackPinDelay (ULWord msDelay)) {(void)msDelay; return false;}
88  AJA_VIRTUAL NTV2_DEPRECATED_f(bool GetAudioPlaybackPinDelay (ULWord* msDelay)) {(void)msDelay; return false;}
89  AJA_VIRTUAL NTV2_DEPRECATED_f(bool SetAudioRecordPinDelay (ULWord msDelay)) {(void)msDelay; return false;}
90  AJA_VIRTUAL NTV2_DEPRECATED_f(bool GetAudioRecordPinDelay (ULWord* msDelay)) {(void)msDelay; return false;}
91 #endif // !defined(NTV2_DEPRECATE_13_0)
92  AJA_VIRTUAL bool SetAudioOutputMode (NTV2_GlobalAudioPlaybackMode mode);
93  AJA_VIRTUAL bool GetAudioOutputMode (NTV2_GlobalAudioPlaybackMode* mode);
94 
95  // Management of downloaded Xilinx bitfile
97  AJA_VIRTUAL bool DriverSetBitFileInformation (const BITFILE_INFO_STRUCT & inBitfileInfo);
98 
100 
101 #if !defined(NTV2_DEPRECATE_16_0)
102  AJA_VIRTUAL inline NTV2_SHOULD_BE_DEPRECATED(bool SetStrictTiming(ULWord strictTiming)) {(void)strictTiming; return false;}
103  AJA_VIRTUAL inline NTV2_SHOULD_BE_DEPRECATED(bool GetStrictTiming(ULWord* strictTiming)){(void)strictTiming; return false;}
104  AJA_VIRTUAL inline NTV2_SHOULD_BE_DEPRECATED(bool GetStreamingApplication(ULWord & outAppType, int32_t & outPID)) {return CNTV2DriverInterface::GetStreamingApplication(outAppType,outPID);}
105  AJA_VIRTUAL inline NTV2_SHOULD_BE_DEPRECATED(bool GetStreamingApplication(ULWord * pAppType, int32_t * pPID)) {return pAppType && pPID ? CNTV2DriverInterface::GetStreamingApplication(*pAppType,*pPID) : false;}
106  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool MapFrameBuffers(void));
107  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool UnmapFrameBuffers(void));
108  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool MapRegisters(void));
109  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool UnmapRegisters(void));
110  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool MapXena2Flash(void));
111  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool UnmapXena2Flash(void));
112  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool MapMemory(PVOID pvUserVa, ULWord ulNumBytes, bool bMap, ULWord* ulUser = NULL));
113  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool DmaUnlock(void));
114  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool CompleteMemoryForDMA(ULWord * pFrameBuffer));
115  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool PrepareMemoryForDMA(ULWord * pFrameBuffer, const ULWord ulNumBytes));
116 #endif // !defined(NTV2_DEPRECATE_16_0)
117 
118 #if !defined(NTV2_NULL_DEVICE)
119  // PRIVATE INSTANCE METHODS
120  protected:
121  AJA_VIRTUAL bool OpenLocalPhysical (const UWord inDeviceIndex);
122  AJA_VIRTUAL bool CloseLocalPhysical (void);
123 #endif // !defined(NTV2_NULL_DEVICE)
124 
125  // MEMBER DATA
126  protected:
127  PSP_DEVICE_INTERFACE_DETAIL_DATA _pspDevIFaceDetailData;
128  SP_DEVINFO_DATA _spDevInfoData;
129  HDEVINFO _hDevInfoSet;
134 #if !defined(NTV2_DEPRECATE_16_0)
135  typedef std::vector<ULWord *> DMA_LOCKED_VEC;
136  DMA_LOCKED_VEC _vecDmaLocked; // OEM save locked memory addresses in vector
137 #endif // !defined(NTV2_DEPRECATE_16_0)
138 }; // CNTV2WinDriverInterface
139 
140 #endif // NTV2WINDRIVERINTERFACE_H
ajaexport.h
Defines the import/export macros for producing DLLs or LIBs.
HANDLE
short HANDLE
Definition: ajatypes.h:304
INTERRUPT_ENUMS
enum _INTERRUPT_ENUMS_ INTERRUPT_ENUMS
NTV2_DriverDebugMessageSet
NTV2_DriverDebugMessageSet
Definition: ntv2enums.h:3743
NTV2_VideoProcBitFile
@ NTV2_VideoProcBitFile
Definition: ntv2enums.h:3271
ntv2devicefeatures.h
Declares device capability functions.
NULL
#define NULL
Definition: ntv2caption608types.h:19
CNTV2WinDriverInterface::_previousAudioSelection
ULWord _previousAudioSelection
Definition: ntv2windriverinterface.h:133
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
CNTV2DriverInterface::WaitForInterrupt
virtual bool WaitForInterrupt(const INTERRUPT_ENUMS eInterrupt, const ULWord timeOutMs=68)
Definition: ntv2driverinterface.cpp:536
CNTV2DriverInterface::GetInterruptCount
virtual bool GetInterruptCount(const INTERRUPT_ENUMS eInterrupt, ULWord &outCount)=0
Answers with the number of interrupts of the given type processed by the driver.
Definition: ntv2driverinterface.cpp:330
PULWord
uint32_t * PULWord
Definition: ajatypes.h:247
CNTV2DriverInterface::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: ntv2driverinterface.cpp:457
ajatypes.h
Declares the most fundamental data types used by NTV2. Since Windows NT was the first principal devel...
CNTV2DriverInterface::HevcSendMessage
virtual bool HevcSendMessage(HevcMessageHeader *pMessage)
Sends an HEVC message to the NTV2 driver.
Definition: ntv2driverinterface.h:382
CNTV2DriverInterface::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: ntv2driverinterface.cpp:393
NTV2_GlobalAudioPlaybackMode
NTV2_GlobalAudioPlaybackMode
Definition: ntv2enums.h:2047
NTV2DMAEngine
NTV2DMAEngine
Definition: ntv2enums.h:1801
CNTV2DriverInterface::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: ntv2driverinterface.cpp:1097
ULWord
uint32_t ULWord
Definition: ajatypes.h:246
NTV2BitFileType
NTV2BitFileType
Definition: ntv2enums.h:3269
CNTV2DriverInterface::DmaTransfer
virtual bool DmaTransfer(const NTV2DMAEngine inDMAEngine, const bool inIsRead, const ULWord inFrameNumber, ULWord *pFrameBuffer, const ULWord inCardOffsetBytes, const ULWord inTotalByteCount, const bool inSynchronous=(!(0)))
Transfers data between the AJA device and the host. This function will block and not return to the ca...
Definition: ntv2driverinterface.cpp:472
CNTV2WinDriverInterface::_hDevice
HANDLE _hDevice
Definition: ntv2windriverinterface.h:130
NTV2_HEADER
All new NTV2 structs start with this common header.
Definition: ntv2publicinterface.h:6899
UWord
uint16_t UWord
Definition: ajatypes.h:244
PVOID
void * PVOID
Definition: ajatypes.h:305
CNTV2WinDriverInterface
Physical device implementations of CNTV2DriverInterface methods through AJA Windows driver.
Definition: ntv2windriverinterface.h:31
CNTV2WinDriverInterface::DMA_LOCKED_VEC
std::vector< ULWord * > DMA_LOCKED_VEC
Definition: ntv2windriverinterface.h:135
CNTV2WinDriverInterface::_hDevInfoSet
HDEVINFO _hDevInfoSet
Definition: ntv2windriverinterface.h:129
ntv2winpublicinterface.h
Defines & structs shared between user-space and Windows kernel driver.
AJA_VIRTUAL
#define AJA_VIRTUAL
Definition: ajatypes.h:153
hevcMessageHeader
Definition: ntv2publicinterface.h:9761
CNTV2DriverInterface::ConfigureInterrupt
virtual bool ConfigureInterrupt(const bool bEnable, const INTERRUPT_ENUMS eInterruptType)=0
Definition: ntv2driverinterface.cpp:344
CNTV2WinDriverInterface::_pspDevIFaceDetailData
PSP_DEVICE_INTERFACE_DETAIL_DATA _pspDevIFaceDetailData
Definition: ntv2windriverinterface.h:127
CNTV2WinDriverInterface::_vecDmaLocked
DMA_LOCKED_VEC _vecDmaLocked
Definition: ntv2windriverinterface.h:136
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
false
#define false
Definition: ntv2devicefeatures.h:25
CNTV2DriverInterface::ConfigureSubscription
virtual bool ConfigureSubscription(const bool bSubscribe, const INTERRUPT_ENUMS inInterruptType, PULWord &outSubcriptionHdl)
Definition: ntv2driverinterface.cpp:350
CNTV2WinDriverInterface::_GUID_PROPSET
GUID _GUID_PROPSET
Definition: ntv2windriverinterface.h:131
AUTOCIRCULATE_P2P_STRUCT
Definition: ntv2publicinterface.h:4626
AJAExport
#define AJAExport
Definition: export.h:33
CNTV2WinDriverInterface::_previousAudioState
ULWord _previousAudioState
Definition: ntv2windriverinterface.h:132
CNTV2WinDriverInterface::ControlDriverDebugMessages
virtual bool ControlDriverDebugMessages(NTV2_DriverDebugMessageSet msgSet, bool enable)
Definition: ntv2windriverinterface.h:82
CNTV2WinDriverInterface::_spDevInfoData
SP_DEVINFO_DATA _spDevInfoData
Definition: ntv2windriverinterface.h:128
CNTV2DriverInterface::AutoCirculate
virtual bool AutoCirculate(AUTOCIRCULATE_DATA &pAutoCircData)
Sends an AutoCirculate command to the NTV2 driver.
Definition: ntv2driverinterface.cpp:549
CNTV2DriverInterface::RestoreHardwareProcampRegisters
virtual bool RestoreHardwareProcampRegisters()=0
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.
CNTV2DriverInterface::CloseLocalPhysical
virtual bool CloseLocalPhysical(void)
Releases host resources associated with the local/physical device connection.
Definition: ntv2driverinterface.cpp:227
CNTV2DriverInterface::NTV2Message
virtual bool NTV2Message(NTV2_HEADER *pInMessage)
Sends a message to the NTV2 driver (the new, improved, preferred way).
Definition: ntv2driverinterface.cpp:573
CNTV2DriverInterface::DriverGetBitFileInformation
virtual bool DriverGetBitFileInformation(BITFILE_INFO_STRUCT &outBitFileInfo, const NTV2BitFileType inBitFileType=NTV2_VideoProcBitFile)
Answers with the currently-installed bitfile information.
Definition: ntv2driverinterface.cpp:586
BITFILE_INFO_STRUCT
Definition: ntv2publicinterface.h:4772
AUTOCIRCULATE_DATA
Definition: ntv2publicinterface.h:4338
CNTV2DriverInterface::OpenLocalPhysical
virtual bool OpenLocalPhysical(const UWord inDeviceIndex)
Opens the local/physical device connection.
Definition: ntv2driverinterface.cpp:216