AJA NTV2 SDK  18.0.0.2717
NTV2 SDK 18.0.0.2717
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  AJA_VIRTUAL bool DmaTransfer (const NTV2DMAEngine inDMAEngine,
41  const bool inIsRead,
42  const ULWord inFrameNumber,
43  ULWord * pFrameBuffer,
44  const ULWord inCardOffsetBytes,
45  const ULWord inByteCount,
46  const bool inSynchronous = true);
47 
48  AJA_VIRTUAL bool DmaTransfer (const NTV2DMAEngine inDMAEngine,
49  const bool inIsRead,
50  const ULWord inFrameNumber,
51  ULWord * pFrameBuffer,
52  const ULWord inCardOffsetBytes,
53  const ULWord inByteCount,
54  const ULWord inNumSegments,
55  const ULWord inSegmentHostPitch,
56  const ULWord inSegmentCardPitch,
57  const bool inSynchronous = true);
58 
59  AJA_VIRTUAL bool DmaTransfer (const NTV2DMAEngine inDMAEngine,
60  const NTV2Channel inDMAChannel,
61  const bool inIsTarget,
62  const ULWord inFrameNumber,
63  const ULWord inCardOffsetBytes,
64  const ULWord inByteCount,
65  const ULWord inNumSegments,
66  const ULWord inSegmentHostPitch,
67  const ULWord inSegmentCardPitch,
68  const PCHANNEL_P2P_STRUCT & inP2PData);
69 
70  AJA_VIRTUAL bool ConfigureInterrupt (const bool bEnable, const INTERRUPT_ENUMS eInterruptType);
71  AJA_VIRTUAL bool ConfigureSubscription (const bool bSubscribe, const INTERRUPT_ENUMS eInterruptType, PULWord & hSubcription);
72  AJA_VIRTUAL bool GetInterruptCount (const INTERRUPT_ENUMS eInterrupt, ULWord & outCount);
73  AJA_VIRTUAL bool WaitForInterrupt (const INTERRUPT_ENUMS eInterruptType, const ULWord timeOutMs = 50);
74 
75  AJA_VIRTUAL bool AutoCirculate (AUTOCIRCULATE_DATA &autoCircData);
76  AJA_VIRTUAL bool NTV2Message (NTV2_HEADER * pInMessage);
77  AJA_VIRTUAL bool ControlDriverDebugMessages(NTV2_DriverDebugMessageSet msgSet, bool enable) {(void)msgSet; (void)enable; return false;}
78 
79  AJA_VIRTUAL bool SetAudioOutputMode (NTV2_GlobalAudioPlaybackMode mode);
80  AJA_VIRTUAL bool GetAudioOutputMode (NTV2_GlobalAudioPlaybackMode* mode);
81 
82  // Management of downloaded Xilinx bitfile
84  AJA_VIRTUAL bool DriverSetBitFileInformation (const BITFILE_INFO_STRUCT & inBitfileInfo);
85 
86  AJA_VIRTUAL bool RestoreHardwareProcampRegisters (void);
87 
88 #if !defined(NTV2_DEPRECATE_16_0)
89  AJA_VIRTUAL inline NTV2_SHOULD_BE_DEPRECATED(bool SetStrictTiming(ULWord strictTiming)) {(void)strictTiming; return false;}
90  AJA_VIRTUAL inline NTV2_SHOULD_BE_DEPRECATED(bool GetStrictTiming(ULWord* strictTiming)){(void)strictTiming; return false;}
91  AJA_VIRTUAL inline NTV2_SHOULD_BE_DEPRECATED(bool GetStreamingApplication(ULWord & outAppType, int32_t & outPID)) {return CNTV2DriverInterface::GetStreamingApplication(outAppType,outPID);}
92  AJA_VIRTUAL inline NTV2_SHOULD_BE_DEPRECATED(bool GetStreamingApplication(ULWord * pAppType, int32_t * pPID)) {return pAppType && pPID ? CNTV2DriverInterface::GetStreamingApplication(*pAppType,*pPID) : false;}
93  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool MapFrameBuffers(void));
94  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool UnmapFrameBuffers(void));
95  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool MapRegisters(void));
96  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool UnmapRegisters(void));
97  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool MapXena2Flash(void));
98  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool UnmapXena2Flash(void));
99  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool MapMemory(PVOID pvUserVa, ULWord ulNumBytes, bool bMap, ULWord* ulUser = NULL));
100  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool DmaUnlock(void));
101  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool CompleteMemoryForDMA(ULWord * pFrameBuffer));
102  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool PrepareMemoryForDMA(ULWord * pFrameBuffer, const ULWord ulNumBytes));
103 #endif // !defined(NTV2_DEPRECATE_16_0)
104 #if !defined(NTV2_DEPRECATE_17_6)
105  AJA_VIRTUAL inline bool NTV2_DEPRECATED_f(HevcSendMessage(HevcMessageHeader* pMsg)) {(void)pMsg; return false;}
106 #endif
107 
108 #if !defined(NTV2_NULL_DEVICE)
109  // PRIVATE INSTANCE METHODS
110  protected:
111  AJA_VIRTUAL bool OpenLocalPhysical (const UWord inDeviceIndex);
112  AJA_VIRTUAL bool CloseLocalPhysical (void);
113 #endif // !defined(NTV2_NULL_DEVICE)
114 
115  // MEMBER DATA
116  protected:
117  PSP_DEVICE_INTERFACE_DETAIL_DATA _pspDevIFaceDetailData;
118  SP_DEVINFO_DATA _spDevInfoData;
119  HDEVINFO _hDevInfoSet;
124 #if !defined(NTV2_DEPRECATE_16_0)
125  typedef std::vector<ULWord *> DMA_LOCKED_VEC;
126  DMA_LOCKED_VEC _vecDmaLocked; // OEM save locked memory addresses in vector
127 #endif // !defined(NTV2_DEPRECATE_16_0)
128 }; // CNTV2WinDriverInterface
129 
130 #endif // NTV2WINDRIVERINTERFACE_H
ajaexport.h
Defines the import/export macros for producing DLLs or LIBs.
HANDLE
short HANDLE
Definition: ajatypes.h:338
INTERRUPT_ENUMS
enum _INTERRUPT_ENUMS_ INTERRUPT_ENUMS
NTV2_DriverDebugMessageSet
NTV2_DriverDebugMessageSet
Definition: ntv2enums.h:3814
NTV2_VideoProcBitFile
@ NTV2_VideoProcBitFile
Definition: ntv2enums.h:3339
ntv2devicefeatures.h
Declares device capability functions.
NULL
#define NULL
Definition: ntv2caption608types.h:19
CNTV2WinDriverInterface::_previousAudioSelection
ULWord _previousAudioSelection
Definition: ntv2windriverinterface.h:123
NTV2Channel
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
Definition: ntv2enums.h:1353
CNTV2DriverInterface::WaitForInterrupt
virtual bool WaitForInterrupt(const INTERRUPT_ENUMS eInterrupt, const ULWord timeOutMs=68)
Definition: ntv2driverinterface.cpp:581
CNTV2DriverInterface::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: ntv2driverinterface.cpp:379
PULWord
uint32_t * PULWord
Definition: ajatypes.h:277
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:502
nlohmann::json_abiNLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON_v3_11_NLOHMANN_JSON_VERSION_PATCH::detail::void
j template void())
Definition: json.hpp:4893
ajatypes.h
Declares the most fundamental data types used by NTV2. Since Windows NT was the first principal devel...
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:438
CNTV2DriverInterface::ConfigureInterrupt
virtual bool ConfigureInterrupt(const bool bEnable, const INTERRUPT_ENUMS eInterruptType)
Definition: ntv2driverinterface.cpp:393
NTV2_GlobalAudioPlaybackMode
NTV2_GlobalAudioPlaybackMode
Definition: ntv2enums.h:2102
NTV2DMAEngine
NTV2DMAEngine
Definition: ntv2enums.h:1852
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:1187
ULWord
uint32_t ULWord
Definition: ajatypes.h:276
NTV2BitFileType
NTV2BitFileType
Definition: ntv2enums.h:3337
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:517
CNTV2WinDriverInterface::_hDevice
HANDLE _hDevice
Definition: ntv2windriverinterface.h:120
NTV2_HEADER
All new NTV2 structs start with this common header.
Definition: ntv2publicinterface.h:7196
UWord
uint16_t UWord
Definition: ajatypes.h:274
PVOID
void * PVOID
Definition: ajatypes.h:339
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:125
CNTV2WinDriverInterface::_hDevInfoSet
HDEVINFO _hDevInfoSet
Definition: ntv2windriverinterface.h:119
ntv2winpublicinterface.h
Defines & structs shared between user-space and Windows kernel driver.
AJA_VIRTUAL
#define AJA_VIRTUAL
Definition: ajatypes.h:183
hevcMessageHeader
Definition: ntv2publicinterface.h:10143
CNTV2WinDriverInterface::_pspDevIFaceDetailData
PSP_DEVICE_INTERFACE_DETAIL_DATA _pspDevIFaceDetailData
Definition: ntv2windriverinterface.h:117
CNTV2WinDriverInterface::_vecDmaLocked
DMA_LOCKED_VEC _vecDmaLocked
Definition: ntv2windriverinterface.h:126
NTV2_SHOULD_BE_DEPRECATED
#define NTV2_SHOULD_BE_DEPRECATED(__f__)
Definition: ajatypes.h:544
NTV2_DEPRECATED_f
#define NTV2_DEPRECATED_f(__f__)
Definition: ajatypes.h:577
false
#define false
Definition: ntv2devicefeatures.h:25
CNTV2DriverInterface::ConfigureSubscription
virtual bool ConfigureSubscription(const bool bSubscribe, const INTERRUPT_ENUMS inInterruptType, PULWord &outSubcriptionHdl)
Definition: ntv2driverinterface.cpp:399
CNTV2WinDriverInterface::_GUID_PROPSET
GUID _GUID_PROPSET
Definition: ntv2windriverinterface.h:121
AUTOCIRCULATE_P2P_STRUCT
Definition: ntv2publicinterface.h:4836
AJAExport
#define AJAExport
Definition: export.h:33
CNTV2WinDriverInterface::_previousAudioState
ULWord _previousAudioState
Definition: ntv2windriverinterface.h:122
CNTV2WinDriverInterface::ControlDriverDebugMessages
virtual bool ControlDriverDebugMessages(NTV2_DriverDebugMessageSet msgSet, bool enable)
Definition: ntv2windriverinterface.h:77
CNTV2WinDriverInterface::_spDevInfoData
SP_DEVINFO_DATA _spDevInfoData
Definition: ntv2windriverinterface.h:118
CNTV2DriverInterface::AutoCirculate
virtual bool AutoCirculate(AUTOCIRCULATE_DATA &pAutoCircData)
Sends an AutoCirculate command to the NTV2 driver.
Definition: ntv2driverinterface.cpp:594
CNTV2DriverInterface
I'm the base class that undergirds the platform-specific derived classes (from which CNTV2Card is ult...
Definition: ntv2driverinterface.h:60
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:267
CNTV2DriverInterface::NTV2Message
virtual bool NTV2Message(NTV2_HEADER *pInMessage)
Sends a message to the NTV2 driver (the new, improved, preferred way).
Definition: ntv2driverinterface.cpp:619
CNTV2DriverInterface::DriverGetBitFileInformation
virtual bool DriverGetBitFileInformation(BITFILE_INFO_STRUCT &outBitFileInfo, const NTV2BitFileType inBitFileType=NTV2_VideoProcBitFile)
Answers with the currently-installed bitfile information.
Definition: ntv2driverinterface.cpp:632
BITFILE_INFO_STRUCT
Definition: ntv2publicinterface.h:4982
AUTOCIRCULATE_DATA
Definition: ntv2publicinterface.h:4547
CNTV2DriverInterface::OpenLocalPhysical
virtual bool OpenLocalPhysical(const UWord inDeviceIndex)
Opens the local/physical device connection.
Definition: ntv2driverinterface.cpp:256