AJA NTV2 SDK  17.5.0.1242
NTV2 SDK 17.5.0.1242
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);
78  AJA_VIRTUAL bool ControlDriverDebugMessages(NTV2_DriverDebugMessageSet msgSet, bool enable) {(void)msgSet; (void)enable; return false;}
79 
80  AJA_VIRTUAL bool SetAudioOutputMode (NTV2_GlobalAudioPlaybackMode mode);
81  AJA_VIRTUAL bool GetAudioOutputMode (NTV2_GlobalAudioPlaybackMode* mode);
82 
83  // Management of downloaded Xilinx bitfile
85  AJA_VIRTUAL bool DriverSetBitFileInformation (const BITFILE_INFO_STRUCT & inBitfileInfo);
86 
87  AJA_VIRTUAL bool RestoreHardwareProcampRegisters (void);
88 
89 #if !defined(NTV2_DEPRECATE_16_0)
90  AJA_VIRTUAL inline NTV2_SHOULD_BE_DEPRECATED(bool SetStrictTiming(ULWord strictTiming)) {(void)strictTiming; return false;}
91  AJA_VIRTUAL inline NTV2_SHOULD_BE_DEPRECATED(bool GetStrictTiming(ULWord* strictTiming)){(void)strictTiming; return false;}
92  AJA_VIRTUAL inline NTV2_SHOULD_BE_DEPRECATED(bool GetStreamingApplication(ULWord & outAppType, int32_t & outPID)) {return CNTV2DriverInterface::GetStreamingApplication(outAppType,outPID);}
93  AJA_VIRTUAL inline NTV2_SHOULD_BE_DEPRECATED(bool GetStreamingApplication(ULWord * pAppType, int32_t * pPID)) {return pAppType && pPID ? CNTV2DriverInterface::GetStreamingApplication(*pAppType,*pPID) : false;}
94  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool MapFrameBuffers(void));
95  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool UnmapFrameBuffers(void));
96  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool MapRegisters(void));
97  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool UnmapRegisters(void));
98  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool MapXena2Flash(void));
99  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool UnmapXena2Flash(void));
100  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool MapMemory(PVOID pvUserVa, ULWord ulNumBytes, bool bMap, ULWord* ulUser = NULL));
101  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool DmaUnlock(void));
102  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool CompleteMemoryForDMA(ULWord * pFrameBuffer));
103  AJA_VIRTUAL NTV2_SHOULD_BE_DEPRECATED(bool PrepareMemoryForDMA(ULWord * pFrameBuffer, const ULWord ulNumBytes));
104 #endif // !defined(NTV2_DEPRECATE_16_0)
105 
106 #if !defined(NTV2_NULL_DEVICE)
107  // PRIVATE INSTANCE METHODS
108  protected:
109  AJA_VIRTUAL bool OpenLocalPhysical (const UWord inDeviceIndex);
110  AJA_VIRTUAL bool CloseLocalPhysical (void);
111 #endif // !defined(NTV2_NULL_DEVICE)
112 
113  // MEMBER DATA
114  protected:
115  PSP_DEVICE_INTERFACE_DETAIL_DATA _pspDevIFaceDetailData;
116  SP_DEVINFO_DATA _spDevInfoData;
117  HDEVINFO _hDevInfoSet;
122 #if !defined(NTV2_DEPRECATE_16_0)
123  typedef std::vector<ULWord *> DMA_LOCKED_VEC;
124  DMA_LOCKED_VEC _vecDmaLocked; // OEM save locked memory addresses in vector
125 #endif // !defined(NTV2_DEPRECATE_16_0)
126 }; // CNTV2WinDriverInterface
127 
128 #endif // NTV2WINDRIVERINTERFACE_H
ajaexport.h
Defines the import/export macros for producing DLLs or LIBs.
HANDLE
short HANDLE
Definition: ajatypes.h:317
INTERRUPT_ENUMS
enum _INTERRUPT_ENUMS_ INTERRUPT_ENUMS
NTV2_DriverDebugMessageSet
NTV2_DriverDebugMessageSet
Definition: ntv2enums.h:3782
NTV2_VideoProcBitFile
@ NTV2_VideoProcBitFile
Definition: ntv2enums.h:3307
ntv2devicefeatures.h
Declares device capability functions.
NULL
#define NULL
Definition: ntv2caption608types.h:19
CNTV2WinDriverInterface::_previousAudioSelection
ULWord _previousAudioSelection
Definition: ntv2windriverinterface.h:121
NTV2Channel
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
Definition: ntv2enums.h:1334
CNTV2DriverInterface::WaitForInterrupt
virtual bool WaitForInterrupt(const INTERRUPT_ENUMS eInterrupt, const ULWord timeOutMs=68)
Definition: ntv2driverinterface.cpp:572
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:366
PULWord
uint32_t * PULWord
Definition: ajatypes.h:256
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:493
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::HevcSendMessage
virtual bool HevcSendMessage(HevcMessageHeader *pMessage)
Sends an HEVC message to the NTV2 driver.
Definition: ntv2driverinterface.h:378
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:429
CNTV2DriverInterface::ConfigureInterrupt
virtual bool ConfigureInterrupt(const bool bEnable, const INTERRUPT_ENUMS eInterruptType)
Definition: ntv2driverinterface.cpp:380
NTV2_GlobalAudioPlaybackMode
NTV2_GlobalAudioPlaybackMode
Definition: ntv2enums.h:2081
NTV2DMAEngine
NTV2DMAEngine
Definition: ntv2enums.h:1831
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:1153
ULWord
uint32_t ULWord
Definition: ajatypes.h:255
NTV2BitFileType
NTV2BitFileType
Definition: ntv2enums.h:3305
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:508
CNTV2WinDriverInterface::_hDevice
HANDLE _hDevice
Definition: ntv2windriverinterface.h:118
NTV2_HEADER
All new NTV2 structs start with this common header.
Definition: ntv2publicinterface.h:6984
UWord
uint16_t UWord
Definition: ajatypes.h:253
PVOID
void * PVOID
Definition: ajatypes.h:318
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:123
CNTV2WinDriverInterface::_hDevInfoSet
HDEVINFO _hDevInfoSet
Definition: ntv2windriverinterface.h:117
ntv2winpublicinterface.h
Defines & structs shared between user-space and Windows kernel driver.
AJA_VIRTUAL
#define AJA_VIRTUAL
Definition: ajatypes.h:162
hevcMessageHeader
Definition: ntv2publicinterface.h:9794
CNTV2WinDriverInterface::_pspDevIFaceDetailData
PSP_DEVICE_INTERFACE_DETAIL_DATA _pspDevIFaceDetailData
Definition: ntv2windriverinterface.h:115
CNTV2WinDriverInterface::_vecDmaLocked
DMA_LOCKED_VEC _vecDmaLocked
Definition: ntv2windriverinterface.h:124
NTV2_SHOULD_BE_DEPRECATED
#define NTV2_SHOULD_BE_DEPRECATED(__f__)
Definition: ajatypes.h:523
false
#define false
Definition: ntv2devicefeatures.h:25
CNTV2DriverInterface::ConfigureSubscription
virtual bool ConfigureSubscription(const bool bSubscribe, const INTERRUPT_ENUMS inInterruptType, PULWord &outSubcriptionHdl)
Definition: ntv2driverinterface.cpp:386
CNTV2WinDriverInterface::_GUID_PROPSET
GUID _GUID_PROPSET
Definition: ntv2windriverinterface.h:119
AUTOCIRCULATE_P2P_STRUCT
Definition: ntv2publicinterface.h:4657
AJAExport
#define AJAExport
Definition: export.h:33
CNTV2WinDriverInterface::_previousAudioState
ULWord _previousAudioState
Definition: ntv2windriverinterface.h:120
CNTV2WinDriverInterface::ControlDriverDebugMessages
virtual bool ControlDriverDebugMessages(NTV2_DriverDebugMessageSet msgSet, bool enable)
Definition: ntv2windriverinterface.h:78
CNTV2WinDriverInterface::_spDevInfoData
SP_DEVINFO_DATA _spDevInfoData
Definition: ntv2windriverinterface.h:116
CNTV2DriverInterface::AutoCirculate
virtual bool AutoCirculate(AUTOCIRCULATE_DATA &pAutoCircData)
Sends an AutoCirculate command to the NTV2 driver.
Definition: ntv2driverinterface.cpp:585
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:258
CNTV2DriverInterface::NTV2Message
virtual bool NTV2Message(NTV2_HEADER *pInMessage)
Sends a message to the NTV2 driver (the new, improved, preferred way).
Definition: ntv2driverinterface.cpp:610
CNTV2DriverInterface::DriverGetBitFileInformation
virtual bool DriverGetBitFileInformation(BITFILE_INFO_STRUCT &outBitFileInfo, const NTV2BitFileType inBitFileType=NTV2_VideoProcBitFile)
Answers with the currently-installed bitfile information.
Definition: ntv2driverinterface.cpp:623
BITFILE_INFO_STRUCT
Definition: ntv2publicinterface.h:4803
AUTOCIRCULATE_DATA
Definition: ntv2publicinterface.h:4369
CNTV2DriverInterface::OpenLocalPhysical
virtual bool OpenLocalPhysical(const UWord inDeviceIndex)
Opens the local/physical device connection.
Definition: ntv2driverinterface.cpp:247