AJA NTV2 SDK  18.1.0.2439
NTV2 SDK 18.1.0.2439
ntv2driverinterface.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #include "ajatypes.h"
9 #include "ntv2enums.h"
10 #include "ntv2debug.h"
11 #include "ntv2driverinterface.h"
12 #include "ntv2devicefeatures.h"
13 #include "ntv2nubaccess.h"
14 #include "ntv2bitfile.h"
15 #include "ntv2utils.h"
16 #include "ntv2version.h"
17 #include "ntv2devicescanner.h" // for IsHexDigit, IsAlphaNumeric, etc.
18 #include "ajabase/system/debug.h"
19 #include "ajabase/system/atomic.h"
21 #include "ajabase/system/process.h"
22 #include "ajabase/common/common.h" // aja::join
23 #include <string.h>
24 #include <assert.h>
25 #include <iostream>
26 #include <sstream>
27 
28 using namespace std;
29 
30 #define INSTP(_p_) HEX0N(uint64_t(_p_),16)
31 #define DIFAIL(__x__) AJA_sERROR (AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
32 #define DIWARN(__x__) AJA_sWARNING(AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
33 #define DINOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
34 #define DIINFO(__x__) AJA_sINFO (AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
35 #define DIDBG(__x__) AJA_sDEBUG (AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
36 
37 #define ARFAIL(__x__) AJA_sERROR (AJA_DebugUnit_AcquireRelease, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
38 #define ARWARN(__x__) AJA_sWARNING(AJA_DebugUnit_AcquireRelease, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
39 #define ARNOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_AcquireRelease, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
40 #define ARINFO(__x__) AJA_sINFO (AJA_DebugUnit_AcquireRelease, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
41 #define ARDBG(__x__) AJA_sDEBUG (AJA_DebugUnit_AcquireRelease, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
42 
43 #define VDFAIL(__x__) AJA_sERROR (AJA_DebugUnit_VDev, AJAFUNC << ": " << __x__)
44 #define VDWARN(__x__) AJA_sWARNING(AJA_DebugUnit_VDev, AJAFUNC << ": " << __x__)
45 #define VDNOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_VDev, AJAFUNC << ": " << __x__)
46 #define VDINFO(__x__) AJA_sINFO (AJA_DebugUnit_VDev, AJAFUNC << ": " << __x__)
47 #define VDDBUG(__x__) AJA_sDEBUG (AJA_DebugUnit_VDev, AJAFUNC << ": " << __x__)
48 
49 #define RPFAIL(__x__) AJA_sERROR (AJA_DebugUnit_RPCClient, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
50 #define RPWARN(__x__) AJA_sWARNING(AJA_DebugUnit_RPCClient, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
51 #define RPNOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_RPCClient, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
52 #define RPINFO(__x__) AJA_sINFO (AJA_DebugUnit_RPCClient, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
53 #define RPDBG(__x__) AJA_sDEBUG (AJA_DebugUnit_RPCClient, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
54 
55 #define PLFAIL(__x__) AJA_sERROR (AJA_DebugUnit_Plugins, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
56 #define PLWARN(__x__) AJA_sWARNING(AJA_DebugUnit_Plugins, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
57 #define PLNOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_Plugins, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
58 #define PLINFO(__x__) AJA_sINFO (AJA_DebugUnit_Plugins, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
59 #define PLDBG(__x__) AJA_sDEBUG (AJA_DebugUnit_Plugins, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
60 
61 #if defined(AJA_LINUX)
62  #define KVRegAcquireRefCount kVRegAcquireLinuxReferenceCount
63  #define KVRegReleaseRefCount kVRegReleaseLinuxReferenceCount
64 #else
65  #define KVRegAcquireRefCount kVRegAcquireReferenceCount
66  #define KVRegReleaseRefCount kVRegReleaseReferenceCount
67 #endif
68 
69 // Stats
70 static uint32_t gConstructCount(0); // Number of constructor calls made
71 static uint32_t gDestructCount(0); // Number of destructor calls made
72 static uint32_t gOpenCount(0); // Number of successful Open calls made
73 static uint32_t gCloseCount(0); // Number of Close calls made
74 //#define _DEBUGSTATS_ // Define this to log construct/destruct & open/close tallies
75 #if defined(_DEBUGSTATS_)
76  #define DIDBGX(__x__) AJA_sDEBUG (AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
77 #else
78  #define DIDBGX(__x__)
79 #endif
80 
82 
84 {
85  NTV2StringList result;
86  result.push_back("ntv2nub"); result.push_back("ntv2"); result.push_back("ntv2local");
87  return result;
88 }
89 
90 static const ULWord RECURSION_LIMIT(16);
91 static ULWord gRecursionCheck(0); // THREAD UNSAFE!! NEEDS TO BE PER-THREAD (THREAD-LOCAL-STORAGE)!!!
92 static bool gSharedMode(false);
93 void CNTV2DriverInterface::SetShareMode (const bool inSharedMode) {gSharedMode = inSharedMode;}
95 static bool gOverlappedMode(false);
96 void CNTV2DriverInterface::SetOverlappedMode (const bool inOverlapMode) {gOverlappedMode = inOverlapMode;}
98 
99 
101 
103  : _boardNumber (0)
104  ,_boardID (DEVICE_ID_NOTFOUND)
105  ,_boardOpened (false)
106 #if defined(NTV2_WRITEREG_PROFILING)
107  ,mRecordRegWrites (false)
108  ,mSkipRegWrites (false)
109 #endif
110  ,_programStatus (0)
111  ,_pRPCAPI (AJA_NULL)
112  ,mEventCounts ()
113 #if defined(NTV2_WRITEREG_PROFILING)
114  ,mRegWrites ()
115  ,mRegWritesLock ()
116 #endif // NTV2_WRITEREG_PROFILING
117 #if !defined(NTV2_DEPRECATE_16_0)
118  ,_pFrameBaseAddress (AJA_NULL)
119  ,_pRegisterBaseAddress (AJA_NULL)
120  ,_pRegisterBaseAddressLength (0)
121  ,_pXena2FlashBaseAddress (AJA_NULL)
122  ,_pCh1FrameBaseAddress (AJA_NULL)
123  ,_pCh2FrameBaseAddress (AJA_NULL)
124 #endif // !defined(NTV2_DEPRECATE_16_0)
125 #if !defined(NTV2_DEPRECATE_17_2)
126  ,_ulNumFrameBuffers (0)
127  ,_ulFrameBufferSize (0)
128 #endif
129 #if !defined(NTV2_DEPRECATE_16_0)
130  ,_pciSlot (0) // DEPRECATE!
131 #endif // !defined(NTV2_DEPRECATE_16_0)
132 {
134  while (mEventCounts.size() < eNumInterruptTypes)
135  mEventCounts.push_back(0);
137  DIDBGX(DEC(gConstructCount) << " constructed, " << DEC(gDestructCount) << " destroyed");
138 } // constructor
139 
140 
142 {
144  if (_pRPCAPI)
145  delete _pRPCAPI;
146  _pRPCAPI = AJA_NULL;
147  DIDBGX(DEC(gConstructCount) << " constructed, " << DEC(gDestructCount) << " destroyed");
148 } // destructor
149 
150 CNTV2DriverInterface & CNTV2DriverInterface::operator = (const CNTV2DriverInterface & inRHS)
151 { (void) inRHS; NTV2_ASSERT(false && "Not assignable"); return *this;} // operator =
152 
154 { (void) inObjToCopy; NTV2_ASSERT(false && "Not copyable");} // copy constructor
155 
156 
157 // Open local physical device (via ajantv2 driver)
158 bool CNTV2DriverInterface::Open (const UWord inDeviceIndex)
159 {
160  if (IsOpen() && inDeviceIndex == GetIndexNumber())
161  return true; // Same local device requested, already open
162  Close();
163  if (inDeviceIndex >= MaxNumDevices())
164  {DIFAIL("Requested device index '" << DEC(inDeviceIndex) << "' at/past limit of '" << DEC(MaxNumDevices()) << "'"); return false;}
165  if (!OpenLocalPhysical(inDeviceIndex))
166  {
167  // Check for virtual device...
168  NTV2DeviceInfo info;
169  if (!CNTV2DeviceScanner::GetDeviceInfo (inDeviceIndex, info))
170  return false;
171  if (!Open(info.vdevUrl))
172  return false; // Open vdev urlSpec failed
173  setDeviceIndexNumber(UWord(info.deviceIndex)); // Patch _boardNumber
174  return true;
175  } // if OpenLocalPhysical failed
176 
177 #if !defined(NTV2_ALLOW_OPEN_UNSUPPORTED)
178  // Check if device is officially supported...
179  const NTV2DeviceIDSet legalDeviceIDs(::NTV2GetSupportedDevices());
180  if (legalDeviceIDs.find(_boardID) == legalDeviceIDs.end())
181  {
182  DIFAIL("Device ID " << xHEX0N(_boardID,8) << " (at device index " << inDeviceIndex << ") is not in list of supported devices");
183  Close();
184  return false;
185  }
186 #endif // NTV2_ALLOW_OPEN_UNSUPPORTED
187 
188  // Read driver version...
189  uint16_t drvrVersComps[4] = {0, 0, 0, 0};
190  ULWord driverVersionRaw (0);
191  if (!IsRemote() && !ReadRegister (kVRegDriverVersion, driverVersionRaw))
192  {DIFAIL("ReadRegister(kVRegDriverVersion) failed"); Close(); return false;}
193  drvrVersComps[0] = uint16_t(NTV2DriverVersionDecode_Major(driverVersionRaw)); // major
194  drvrVersComps[1] = uint16_t(NTV2DriverVersionDecode_Minor(driverVersionRaw)); // minor
195  drvrVersComps[2] = uint16_t(NTV2DriverVersionDecode_Point(driverVersionRaw)); // point
196  drvrVersComps[3] = uint16_t(NTV2DriverVersionDecode_Build(driverVersionRaw)); // build
197 
198  // Check driver version (local devices only)
199  NTV2_ASSERT(!IsRemote());
201  DIWARN ("Driver version v" << DEC(drvrVersComps[0]) << "." << DEC(drvrVersComps[1]) << "." << DEC(drvrVersComps[2]) << "."
202  << DEC(drvrVersComps[3]) << " ignored for client SDK v0.0.0.0 (dev mode), driverVersionRaw=" << xHEX0N(driverVersionRaw,8));
203  else if (drvrVersComps[0] == uint16_t(AJA_NTV2_SDK_VERSION_MAJOR))
204  DIDBG ("Driver v" << DEC(drvrVersComps[0]) << "." << DEC(drvrVersComps[1])
205  << "." << DEC(drvrVersComps[2]) << "." << DEC(drvrVersComps[3]) << " == client SDK v"
206  << DEC(uint16_t(AJA_NTV2_SDK_VERSION_MAJOR)) << "." << DEC(uint16_t(AJA_NTV2_SDK_VERSION_MINOR))
207  << "." << DEC(uint16_t(AJA_NTV2_SDK_VERSION_POINT)) << "." << DEC(uint16_t(AJA_NTV2_SDK_BUILD_NUMBER)));
208  else
209  DIWARN ("Driver v" << DEC(drvrVersComps[0]) << "." << DEC(drvrVersComps[1])
210  << "." << DEC(drvrVersComps[2]) << "." << DEC(drvrVersComps[3]) << " != client SDK v"
211  << DEC(uint16_t(AJA_NTV2_SDK_VERSION_MAJOR)) << "." << DEC(uint16_t(AJA_NTV2_SDK_VERSION_MINOR)) << "."
212  << DEC(uint16_t(AJA_NTV2_SDK_VERSION_POINT)) << "." << DEC(uint16_t(AJA_NTV2_SDK_BUILD_NUMBER))
213  << ", driverVersionRaw=" << xHEX0N(driverVersionRaw,8));
214 
215  FinishOpen();
217  DIDBGX(DEC(gOpenCount) << " opened, " << DEC(gCloseCount) << " closed");
218  return true;
219 }
220 
221 // Open remote or virtual device
222 bool CNTV2DriverInterface::Open (const string & inURLSpec)
223 {
224  Close();
226  const NTV2DeviceSpecParser specParser (inURLSpec);
227  if (specParser.HasErrors())
228  {PLFAIL("Bad device specification '" << inURLSpec << "': " << specParser.Error()); return false;}
229 
230  // URLSpecs can specify locally-attached devices...
231  if (specParser.IsLocalDevice())
232  { // Local device...
233  ++gRecursionCheck;
235  {VDFAIL("Failed: " << DEC(gRecursionCheck) << " '.vdev' bounces has exceeded limit: " << specParser.InfoString()); gRecursionCheck--; return false;}
237  VDWARN(DEC(gRecursionCheck) << " '.vdev' bounces near limit (" << DEC(RECURSION_LIMIT) << "): " << specParser.InfoString());
238 
239  NTV2DeviceInfo info;
240  bool infoOK(false);
241  if (specParser.HasResult(kConnectParamDevSerial))
242  infoOK = CNTV2DeviceScanner::GetDeviceInfoForSerial(specParser.DeviceSerial(), info);
243  else if (specParser.HasResult(kConnectParamDevModel))
244  infoOK = CNTV2DeviceScanner::GetDeviceInfoForModel(specParser.DeviceModel(), info);
245  else if (specParser.HasResult(kConnectParamDevID))
246  infoOK = CNTV2DeviceScanner::GetDeviceInfoForID(specParser.DeviceID(), info);
247  if (infoOK)
248  {
249  if (info.isVirtualDevice)
250  {
251  if (Open(info.vdevUrl))
252  setDeviceIndexNumber(UWord(info.deviceIndex)); // Patch _boardNumber
253  }
254  else
255  Open(info.deviceIndex);
256  }
257  else if (specParser.HasResult(kConnectParamDevIndex))
258  Open(specParser.DeviceIndex());
259  // else one of GetDeviceInfoForSerial, GetDeviceInfoForModel or GetDeviceInfoForID returned false -- not found
260  gRecursionCheck--; // decrement
261  if (!IsOpen())
262  {DIFAIL("Failed to open " << specParser.InfoString()); return false;}
263  } // if IsLocalDevice
264  else if (!OpenRemote(specParser)) // Open the remote/virtual device...
265  return false; // Failed to open remote/virtual device
266 
267  FinishOpen();
269  DIDBGX(DEC(gOpenCount) << " opens, " << DEC(gCloseCount) << " closes");
270  return true;
271 }
272 
274 {
275  if (IsOpen())
276  {
277  const bool closeOK(IsRemote() ? CloseRemote() : CloseLocalPhysical());
278  if (closeOK)
281  DIDBGX(DEC(gOpenCount) << " opens, " << DEC(gCloseCount) << " closes");
282  return closeOK;
283  }
284  return true;
285 
286 } // Close
287 
288 
290 {
291 #if defined(NTV2_NULL_DEVICE)
292  DIFAIL("SDK built with 'NTV2_NULL_DEVICE' defined -- cannot OpenLocalPhysical '" << DEC(inDeviceIndex) << "'");
293 #else // else defined(NTV2_NULL_DEVICE)
294  (void) inDeviceIndex;
295  NTV2_ASSERT(false && "Requires platform-specific implementation");
296 #endif // else NTV2_NULL_DEVICE defined
297  return false;
298 }
299 
301 {
302  NTV2_ASSERT(false && "Requires platform-specific implementation");
303  return false;
304 }
305 
306 #if defined(AJA_WINDOWS)
307  static bool winsock_inited = false;
308  static WSADATA wsaData;
309 
310  static void initWinsock(void)
311  {
312  int wret;
313  if (!winsock_inited)
314  wret = WSAStartup(MAKEWORD(2,2), &wsaData);
315  winsock_inited = true;
316  }
317 #endif // AJA_WINDOWS
318 
319 
321 {
322 #if defined(AJA_WINDOWS)
323  initWinsock();
324 #endif // defined(AJA_WINDOWS)
325  NTV2_ASSERT(!IsOpen()); // Must be closed!
327 
328 #if defined(NTV2_NUB_CLIENT_SUPPORT)
329  if (inParser.Failed())
330  {ostringstream errs; inParser.PrintErrors(errs); RPFAIL("Bad parser: " << errs.str()); return false;}
331  if (inParser.IsLocalDevice())
332  {RPFAIL("Parser infers local device: " << inParser.InfoString()); return false;}
333 
334  NTV2Dictionary connectParams(inParser.Results());
335  // This "connectParams" dictionary has keys/values that determine which plugin to load,
336  // and any other configuration parameters specified by the caller. This dictionary is
337  // modified during the call to "CreateClient" (below) by an NTV2PluginLoader that loads,
338  // interrogates and validates the plugin. Several new keys/values are added to it during
339  // this process that describe the plugin, its signature, and any query parameters it
340  // requires or accepts for further configuration.
341  RPDBG("Opening " << inParser.InfoString());
342  NTV2RPCAPI * pClient (nullptr);
343  try {
344  pClient = NTV2RPCClientAPI::CreateClient(connectParams);
345  } catch (std::bad_alloc &) {
346  pClient = nullptr;
347  RPFAIL("bad_alloc exception");
348  } catch (...) {
349  pClient = nullptr;
350  RPFAIL("exception");
351  }
352  if (!pClient)
353  {RPFAIL("Failed to instantiate plugin client: " << inParser.InfoString()); return false;}
354 
355  // At this point, the plugin's NTV2RPCAPI object exists, but may or may not be useable,
356  // depending on if "IsConnected". Before SDK 17.1, the plugin's NTV2Connect function
357  // was commonly called directly from its constructor. In SDK 17.1 and later, OpenRemote
358  // is responsible for calling NTV2Connect, to allow tools like NTV2Watcher to probe the
359  // plugin in stages via its client interface.
360  if (!pClient->IsConnected())
361  if (!pClient->NTV2Connect())
362  { RPFAIL("Failed to connect/open '" << inParser.DeviceSpec() << "'");
363  delete pClient;
364  CloseRemote();
365  return false;
366  }
367 
368  // NTV2 physical devices always have a hardware identity -- the NTV2DeviceID read from register 50.
369  // This plugin device is considered "open" if ReadRegister is successful, and returns a non-zero
370  // value that's also not DEVICE_ID_NOTFOUND. (Virtual/software devices that have no NTV2 hardware
371  // corollary should return DEVICE_ID_SOFTWARE.)
372  _pRPCAPI = pClient;
374  if (!IsRemote() || !IsOpen())
375  RPFAIL("Failed to open '" << inParser.DeviceSpec() << "'");
376  return IsRemote() && IsOpen(); // Fail if not remote nor open
377 #else // NTV2_NUB_CLIENT_SUPPORT
378  DIFAIL("SDK built without 'NTV2_NUB_CLIENT_SUPPORT' -- cannot OpenRemote '" << inParser.DeviceSpec() << "'");
379  return false;
380 #endif // NTV2_NUB_CLIENT_SUPPORT
381 } // OpenRemote
382 
383 
385 {
386  if (_pRPCAPI)
387  {
388  DIDBG("Closing remote: " << *_pRPCAPI);
389  if (_pRPCAPI->NTV2Disconnect())
390  DIINFO("Remote closed: " << *_pRPCAPI);
391  else
392  DIFAIL("Remote close (NTV2Disconnect) failed: " << *_pRPCAPI);
393  delete _pRPCAPI;
394  _pRPCAPI = AJA_NULL;
395  _boardOpened = false;
396  return true;
397  }
398  // Wasn't open
399  _boardOpened = false;
400  return false;
401 }
402 
403 
405 {
406  outCount = 0;
407  if (!NTV2_IS_VALID_INTERRUPT_ENUM(inInterrupt))
408  {DIFAIL("Cannot get event count for '" << NTV2CfgInterrupt::IntName(inInterrupt) << "' -- bad interrupt ID"); return false;}
409  outCount = mEventCounts.at(inInterrupt);
410  return true;
411 }
412 
414 {
415  if (!NTV2_IS_VALID_INTERRUPT_ENUM(inInterrupt))
416  {DIFAIL("Cannot set event count to " << inCount << " for interrupt '" << NTV2CfgInterrupt::IntName(inInterrupt) << "' -- bad interrupt ID"); return false;}
417  if (mEventCounts.at(inInterrupt) != inCount)
418  DIINFO("Interrupt '" << NTV2CfgInterrupt::IntName(inInterrupt) << "' event count changed from " << mEventCounts.at(inInterrupt) << " to " << inCount);
419  mEventCounts.at(inInterrupt) = inCount;
420  return true;
421 }
422 
424 {
425  outCount = 0;
426 #if defined(NTV2_NUB_CLIENT_SUPPORT)
427  if (IsRemote())
428  {
429  NTV2ConfigureInterrupt msg(this);
430  if (!_pRPCAPI->NTV2MessageRemote(msg.doGetCount(eInterrupt)))
431  return false;
432  outCount = msg.count();
433  return true;
434  }
435 #endif
436  DIFAIL("Not implemented, interruptID='" << NTV2CfgInterrupt::IntName(eInterrupt) << "'");
437  return false;
438 }
439 
440 bool CNTV2DriverInterface::ConfigureInterrupt (const bool bEnable, const INTERRUPT_ENUMS eInterruptType)
441 { (void) bEnable; (void) eInterruptType;
442  NTV2_ASSERT(false && "Needs subclass implementation");
443  return false;
444 }
445 
447 {
448  ULWord value(0);
449  if (IsOpen() && ReadRegister(kRegBoardID, value))
450  {
451  const NTV2DeviceID currentValue(NTV2DeviceID(value+0));
452  if (currentValue != _boardID)
453  DIWARN(xHEX0N(this,16) << ": NTV2DeviceID " << xHEX0N(value,8) << " (" << ::NTV2DeviceIDToString(currentValue)
454  << ") read from register " << kRegBoardID << " doesn't match _boardID " << xHEX0N(_boardID,8) << " ("
455  << ::NTV2DeviceIDToString(_boardID) << ")");
456  return currentValue;
457  }
458  return DEVICE_ID_NOTFOUND;
459 }
460 
461 
462 // Common remote card read register. Subclasses have overloaded function
463 // that does platform-specific read of register on local card.
464 bool CNTV2DriverInterface::ReadRegister (const ULWord inRegNum, ULWord & outValue, const ULWord inMask, const ULWord inShift)
465 {
466 #if defined(NTV2_NUB_CLIENT_SUPPORT)
467  if (IsRemote())
468  return _pRPCAPI->NTV2ReadRegisterRemote (inRegNum, outValue, inMask, inShift);
469 #else
470  (void) inRegNum; (void) outValue; (void) inMask; (void) inShift;
471 #endif
472  return false;
473 }
474 
476 {
477  if (!IsOpen())
478  return false; // Device not open!
479  if (inOutValues.empty())
480  return true; // Nothing to do!
481 
482  NTV2GetRegisters getRegsParams (inOutValues);
483  if (NTV2Message(reinterpret_cast<NTV2_HEADER*>(&getRegsParams)))
484  {
485  if (!getRegsParams.GetRegisterValues(inOutValues))
486  return false;
487  }
488  else // Non-atomic user-space workaround until GETREGS implemented in driver...
489  for (NTV2RegisterReadsIter iter(inOutValues.begin()); iter != inOutValues.end(); ++iter)
490  if (iter->registerNumber != kRegXenaxFlashDOUT) // Prevent firmware erase/program/verify failures
491  if (!ReadRegister (iter->registerNumber, iter->registerValue))
492  return false;
493  return true;
494 }
495 
496 #if !defined(NTV2_DEPRECATE_16_0)
497  // Common remote card read multiple registers. Subclasses have overloaded function
498  bool CNTV2DriverInterface::ReadRegisterMulti (const ULWord inNumRegs, ULWord * pOutWhichRegFailed, NTV2RegInfo pOutRegInfos[])
499  {
500  if (!pOutWhichRegFailed)
501  return false; // NULL pointer
502  *pOutWhichRegFailed = 0xFFFFFFFF;
503  if (!inNumRegs)
504  return false; // numRegs is zero
505 
506  // New in SDK 16.0: Use ReadRegs NTV2Message
507  NTV2RegReads regReads, result;
508  regReads.reserve(inNumRegs); result.reserve(inNumRegs);
509  for (size_t ndx(0); ndx < size_t(inNumRegs); ndx++)
510  regReads.push_back(pOutRegInfos[ndx]);
511  result = regReads;
512  bool retVal (ReadRegisters(result));
513  NTV2_ASSERT(result.size() <= regReads.size());
514  if (result.size() < regReads.size())
515  *pOutWhichRegFailed = result.empty() ? regReads.front().registerNumber : result.back().registerNumber;
516  return retVal;
517  }
518 
520  {
521  AJATime::Sleep(milliseconds);
522  return 0; // Beware, this function always returns zero, even if sleep was interrupted
523  }
524 #endif // !defined(NTV2_DEPRECATE_16_0)
525 
526 
527 // Common remote card write register. Subclasses overloaded this to do platform-specific register write.
528 bool CNTV2DriverInterface::WriteRegister (const ULWord inRegNum, const ULWord inValue, const ULWord inMask, const ULWord inShift)
529 {
530 #if defined(NTV2_WRITEREG_PROFILING)
531  // Recording is done in platform-specific WriteRegister
532 #endif // NTV2_WRITEREG_PROFILING
533 #if defined(NTV2_NUB_CLIENT_SUPPORT)
534  // If we get here, must be a non-physical device connection...
535  return IsRemote() ? _pRPCAPI->NTV2WriteRegisterRemote(inRegNum, inValue, inMask, inShift) : false;
536 #else
537  (void) inRegNum; (void) inValue; (void) inMask; (void) inShift;
538  return false;
539 #endif
540 }
541 
542 
544  const bool inIsRead,
545  const ULWord inFrameNumber,
546  ULWord * pFrameBuffer,
547  const ULWord inCardOffsetBytes,
548  const ULWord inTotalByteCount,
549  const bool inSynchronous)
550 {
551 #if defined(NTV2_NUB_CLIENT_SUPPORT)
553  NTV2Buffer buffer(pFrameBuffer, inTotalByteCount);
554  return _pRPCAPI->NTV2DMATransferRemote(inDMAEngine, inIsRead, inFrameNumber, buffer, inCardOffsetBytes,
555  0/*numSegs*/, 0/*hostPitch*/, 0/*cardPitch*/, inSynchronous);
556 #else
557  (void) inDMAEngine; (void) inIsRead; (void) inFrameNumber; (void) pFrameBuffer; (void) inCardOffsetBytes;
558  (void) inTotalByteCount; (void) inSynchronous;
559  return false;
560 #endif
561 }
562 
564  const bool inIsRead,
565  const ULWord inFrameNumber,
566  ULWord * pFrameBuffer,
567  const ULWord inCardOffsetBytes,
568  const ULWord inTotalByteCount,
569  const ULWord inNumSegments,
570  const ULWord inHostPitchPerSeg,
571  const ULWord inCardPitchPerSeg,
572  const bool inSynchronous)
573 {
574 #if defined(NTV2_NUB_CLIENT_SUPPORT)
576  NTV2Buffer buffer(pFrameBuffer, inTotalByteCount);
577  return _pRPCAPI->NTV2DMATransferRemote(inDMAEngine, inIsRead, inFrameNumber, buffer, inCardOffsetBytes,
578  inNumSegments, inHostPitchPerSeg, inCardPitchPerSeg, inSynchronous);
579 #else
580  (void) inDMAEngine; (void) inIsRead; (void) inFrameNumber; (void) pFrameBuffer; (void) inCardOffsetBytes;
581  (void) inTotalByteCount; (void) inNumSegments; (void) inHostPitchPerSeg; (void) inCardPitchPerSeg; (void) inSynchronous;
582  return false;
583 #endif
584 }
585 
587  const NTV2Channel inDMAChannel,
588  const bool inIsTarget,
589  const ULWord inFrameNumber,
590  const ULWord inCardOffsetBytes,
591  const ULWord inByteCount,
592  const ULWord inNumSegments,
593  const ULWord inSegmentHostPitch,
594  const ULWord inSegmentCardPitch,
595  const PCHANNEL_P2P_STRUCT & inP2PData)
596 { (void) inDMAEngine; (void) inDMAChannel; (void) inIsTarget; (void) inFrameNumber; (void) inCardOffsetBytes;
597  (void) inByteCount; (void) inNumSegments; (void) inSegmentHostPitch; (void) inSegmentCardPitch; (void) inP2PData;
598 #if defined(NTV2_NUB_CLIENT_SUPPORT)
600  // No NTV2DMATransferP2PRemote implementation yet
601 #endif
602  return false;
603 }
604 
605 // Common remote card waitforinterrupt. Subclasses have overloaded function
606 // that does platform-specific waitforinterrupt on local cards.
608 {
609 #if defined(NTV2_NUB_CLIENT_SUPPORT)
610  if (_pRPCAPI && _pRPCAPI->NTV2WaitForInterruptRemote(eInterrupt, timeOutMs))
611  {BumpEventCount(eInterrupt); return true;}
612  return false;
613 #else
614  (void) eInterrupt;
615  (void) timeOutMs;
616  return false;
617 #endif
618 }
619 
620 // Common remote card autocirculate. Subclasses have overloaded function
621 // that does platform-specific autocirculate on local cards.
623 {
624 #if defined(NTV2_NUB_CLIENT_SUPPORT)
625  if (IsRemote())
626  switch (autoCircData.eCommand)
627  {
628  case eStartAutoCirc:
629  case eAbortAutoCirc:
630  case ePauseAutoCirc:
631  case eFlushAutoCirculate:
632  case eGetAutoCirc:
633  case eStopAutoCirc:
634  case eInitAutoCirc:
635  case eSetActiveFrame:
636  return _pRPCAPI->NTV2AutoCirculateRemote(autoCircData);
637  default: // Others not handled
638  return false;
639  }
640  return false;
641 #else
642  (void) autoCircData;
643  return false;
644 #endif
645 }
646 
648 {
649 #if defined(NTV2_NUB_CLIENT_SUPPORT)
650  return _pRPCAPI ? _pRPCAPI->NTV2MessageRemote(pInMessage) : false;
651 #else
652  (void) pInMessage;
653  return false;
654 #endif
655 }
656 
657 
658 // Common remote card DriverGetBitFileInformation. Subclasses have overloaded function
659 // that does platform-specific function on local cards.
661 { (void)bitFileType;
662  ::memset(&bitFileInfo, 0, sizeof(bitFileInfo));
663  if (IsRemote())
664  return false;
666  return false;
667 
668  ParseFlashHeader(bitFileInfo);
669  bitFileInfo.bitFileType = 0;
670  switch (_boardID)
671  {
672  case DEVICE_ID_CORVID1: bitFileInfo.bitFileType = NTV2_BITFILE_CORVID1_MAIN; break;
673  case DEVICE_ID_CORVID22: bitFileInfo.bitFileType = NTV2_BITFILE_CORVID22_MAIN; break;
674  case DEVICE_ID_CORVID24: bitFileInfo.bitFileType = NTV2_BITFILE_CORVID24_MAIN; break;
675  case DEVICE_ID_CORVID3G: bitFileInfo.bitFileType = NTV2_BITFILE_CORVID3G_MAIN; break;
676  case DEVICE_ID_CORVID44: bitFileInfo.bitFileType = NTV2_BITFILE_CORVID44; break;
682  case DEVICE_ID_CORVID88: bitFileInfo.bitFileType = NTV2_BITFILE_CORVID88; break;
685  case DEVICE_ID_CORVIDHEVC: bitFileInfo.bitFileType = NTV2_BITFILE_CORVIDHEVC; break;
686  case DEVICE_ID_IO4K: bitFileInfo.bitFileType = NTV2_BITFILE_IO4K_MAIN; break;
687  case DEVICE_ID_IO4KPLUS: bitFileInfo.bitFileType = NTV2_BITFILE_IO4KPLUS_MAIN; break;
688  case DEVICE_ID_IO4KUFC: bitFileInfo.bitFileType = NTV2_BITFILE_IO4KUFC_MAIN; break;
690  case DEVICE_ID_IOIP_2022: bitFileInfo.bitFileType = NTV2_BITFILE_IOIP_2022; break;
691  case DEVICE_ID_IOIP_2110: bitFileInfo.bitFileType = NTV2_BITFILE_IOIP_2110; break;
693  case DEVICE_ID_IOXT: bitFileInfo.bitFileType = NTV2_BITFILE_IOXT_MAIN; break;
694  case DEVICE_ID_KONA1: bitFileInfo.bitFileType = NTV2_BITFILE_KONA1; break;
695  case DEVICE_ID_KONA3G: bitFileInfo.bitFileType = NTV2_BITFILE_KONA3G_MAIN; break;
696  case DEVICE_ID_KONA3GQUAD: bitFileInfo.bitFileType = NTV2_BITFILE_KONA3G_QUAD; break;
697  case DEVICE_ID_KONA4: bitFileInfo.bitFileType = NTV2_BITFILE_KONA4_MAIN; break;
698  case DEVICE_ID_KONA4UFC: bitFileInfo.bitFileType = NTV2_BITFILE_KONA4UFC_MAIN; break;
699  case DEVICE_ID_KONA5: bitFileInfo.bitFileType = NTV2_BITFILE_KONA5_MAIN; break;
702  case DEVICE_ID_KONA5_8K: bitFileInfo.bitFileType = NTV2_BITFILE_KONA5_8K_MAIN; break;
716  case DEVICE_ID_SOJI_OE1: bitFileInfo.bitFileType = NTV2_BITFILE_SOJI_OE1_MAIN; break;
717  case DEVICE_ID_SOJI_OE2: bitFileInfo.bitFileType = NTV2_BITFILE_SOJI_OE2_MAIN; break;
718  case DEVICE_ID_SOJI_OE3: bitFileInfo.bitFileType = NTV2_BITFILE_SOJI_OE3_MAIN; break;
719  case DEVICE_ID_SOJI_OE4: bitFileInfo.bitFileType = NTV2_BITFILE_SOJI_OE4_MAIN; break;
720  case DEVICE_ID_SOJI_OE5: bitFileInfo.bitFileType = NTV2_BITFILE_SOJI_OE5_MAIN; break;
721  case DEVICE_ID_SOJI_OE6: bitFileInfo.bitFileType = NTV2_BITFILE_SOJI_OE6_MAIN; break;
722  case DEVICE_ID_SOJI_OE7: bitFileInfo.bitFileType = NTV2_BITFILE_SOJI_OE7_MAIN; break;
726  case DEVICE_ID_KONAHDMI: bitFileInfo.bitFileType = NTV2_BITFILE_KONAHDMI; break;
732  case DEVICE_ID_KONAIP_25G: bitFileInfo.bitFileType = NTV2_BITFILE_KONAIP_25G; break;
737  case DEVICE_ID_KONALHI: bitFileInfo.bitFileType = NTV2_BITFILE_LHI_MAIN; break;
739  case DEVICE_ID_TTAP: bitFileInfo.bitFileType = NTV2_BITFILE_TTAP_MAIN; break;
740  case DEVICE_ID_TTAP_PRO: bitFileInfo.bitFileType = NTV2_BITFILE_TTAP_PRO_MAIN; break;
741  case DEVICE_ID_IOX3: bitFileInfo.bitFileType = NTV2_BITFILE_IOX3_MAIN; break;
742  case DEVICE_ID_KONAX: bitFileInfo.bitFileType = NTV2_BITFILE_KONAX; break;
743  case DEVICE_ID_KONAXM: bitFileInfo.bitFileType = NTV2_BITFILE_KONAXM; break;
744  case DEVICE_ID_KONAX_4CH: bitFileInfo.bitFileType = NTV2_BITFILE_KONAX_4CH; break;
745 
746  case DEVICE_ID_VKONA:
747  case DEVICE_ID_IP25_T:
748  case DEVICE_ID_IP25_R:
749  case DEVICE_ID_FS8:
750  case DEVICE_ID_SOFTWARE:
751  case DEVICE_ID_NOTFOUND: bitFileInfo.bitFileType = NTV2_BITFILE_TYPE_INVALID; break;
752  #if !defined (_DEBUG)
753  default: break;
754  #endif
755  }
756  bitFileInfo.checksum = 0;
757  bitFileInfo.structVersion = 0;
758  bitFileInfo.structSize = sizeof(BITFILE_INFO_STRUCT);
759  bitFileInfo.whichFPGA = eFPGAVideoProc;
760 
761  const string bitFileDesignNameString = string(bitFileInfo.designNameStr) + ".bit";
762  ::strncpy(bitFileInfo.designNameStr, bitFileDesignNameString.c_str(), sizeof(bitFileInfo.designNameStr)-1);
763  return true;
764 }
765 #if 0 // IoIP/KonaIP10G purge
766 bool CNTV2DriverInterface::GetPackageInformation (PACKAGE_INFO_STRUCT & packageInfo)
767 {
768  if (!IsDeviceReady(false) || !IsSupported(kDeviceCanDoIP))
769  return false; // cannot read flash
770 
771  string packInfo;
772  ULWord deviceID = ULWord(_boardID);
773  ReadRegister (kRegBoardID, deviceID);
774 
776  {
777  CNTV2AxiSpiFlash spiFlash(GetIndexNumber(), false);
778 
779  uint32_t offset = spiFlash.Offset(SPI_FLASH_SECTION_MCSINFO);
780  vector<uint8_t> mcsInfoData;
781  if (spiFlash.Read(offset, mcsInfoData, 256))
782  {
783  packInfo.assign(mcsInfoData.begin(), mcsInfoData.end());
784 
785  // remove any trailing nulls
786  size_t found = packInfo.find('\0');
787  if (found != string::npos)
788  {
789  packInfo.resize(found);
790  }
791  }
792  else
793  return false;
794  }
795  else
796  {
797  ULWord baseAddress = (16 * 1024 * 1024) - (3 * 256 * 1024);
798  const ULWord dwordSizeCount = 256/4;
799 
802  bool busy = true;
803  ULWord timeoutCount = 1000;
804  do
805  {
806  ULWord regValue;
808  if (regValue & BIT(8))
809  {
810  busy = true;
811  timeoutCount--;
812  }
813  else
814  busy = false;
815  } while (busy == true && timeoutCount > 0);
816  if (timeoutCount == 0)
817  return false;
818 
819  ULWord* bitFilePtr = new ULWord[dwordSizeCount];
820  for ( ULWord count = 0; count < dwordSizeCount; count++, baseAddress += 4 )
821  {
822  WriteRegister(kRegXenaxFlashAddress, baseAddress);
824  busy = true;
825  timeoutCount = 1000;
826  do
827  {
828  ULWord regValue;
830  if ( regValue & BIT(8))
831  {
832  busy = true;
833  timeoutCount--;
834  }
835  else
836  busy = false;
837  } while(busy == true && timeoutCount > 0);
838  if (timeoutCount == 0)
839  {
840  delete [] bitFilePtr;
841  return false;
842  }
843  ReadRegister(kRegXenaxFlashDOUT, bitFilePtr[count]);
844  }
845 
846  packInfo = reinterpret_cast<char*>(bitFilePtr);
847  delete [] bitFilePtr;
848  }
849 
850  istringstream iss(packInfo);
851  vector<string> results;
852  string token;
853  while (getline(iss,token, ' '))
854  results.push_back(token);
855 
856  if (results.size() < 8)
857  return false;
858 
859  packageInfo.date = results[1];
860  token = results[2];
861  token.erase(remove(token.begin(), token.end(), '\n'), token.end());
862  packageInfo.time = token;
863  packageInfo.buildNumber = results[4];
864  packageInfo.packageNumber = results[7];
865  return true;
866 }
867 #endif // IoIP/KonaIP10G purge
868 // Common remote card DriverGetBuildInformation. Subclasses have overloaded function
869 // that does platform-specific function on local cards.
871 {
872  ::memset(&buildInfo, 0, sizeof(buildInfo));
873  return false;
874 }
875 
876 bool CNTV2DriverInterface::BitstreamWrite (const NTV2Buffer & inBuffer, const bool inFragment, const bool inSwap)
877 {
878  NTV2Bitstream bsMsg (inBuffer,
880  (inFragment? BITSTREAM_FRAGMENT : 0) |
881  (inSwap? BITSTREAM_SWAP : 0));
882  ULWord counts(0);
884  ULWord attempts(counts >> 16), successes(counts & 0x0000FFFF);
885  attempts++;
886  const bool result (NTV2Message (reinterpret_cast<NTV2_HEADER*>(&bsMsg)));
887  if (result)
888  successes++;
889  counts = (attempts << 16) | successes;
891  return result;
892 }
893 
894 bool CNTV2DriverInterface::BitstreamReset (const bool inConfiguration, const bool inInterface)
895 {
896  NTV2Buffer inBuffer;
897  NTV2Bitstream bsMsg (inBuffer,
898  (inConfiguration? BITSTREAM_RESET_CONFIG : 0) |
899  (inInterface? BITSTREAM_RESET_MODULE : 0));
900  return NTV2Message(bsMsg);
901 }
902 
904 {
905  outRegValues.reserve(BITSTREAM_MCAP_DATA);
906  outRegValues.clear();
907 
908  NTV2Buffer inBuffer;
909  NTV2Bitstream bsMsg (inBuffer, BITSTREAM_READ_REGISTERS);
910  if (!NTV2Message(bsMsg))
911  return false;
912 
913  for (UWord ndx(0); ndx < BITSTREAM_MCAP_DATA; ndx++)
914  outRegValues.push_back(bsMsg.mRegisters[ndx]);
915 
916  return true;
917 }
918 
919 bool CNTV2DriverInterface::BitstreamLoad (const bool inSuspend, const bool inResume)
920 {
921  NTV2Buffer inBuffer;
922  NTV2Bitstream bsMsg (inBuffer,
923  (inSuspend? BITSTREAM_SUSPEND : 0) |
924  (inResume? BITSTREAM_RESUME : 0));
925  return NTV2Message(bsMsg);
926 }
927 
929  ULWord flags,
930  NTV2StreamChannel& status)
931 {
932  status.mChannel = inChannel;
933  status.mFlags = flags;
934 
935  return NTV2Message(status);
936 }
937 
939  NTV2Buffer& inBuffer,
940  ULWord64 bufferCookie,
941  ULWord flags,
942  NTV2StreamBuffer& status)
943 {
944  status.mChannel = inChannel;
945  status.mBuffer.Set (inBuffer.GetHostPointer(), inBuffer.GetByteCount());
946  status.mBufferCookie = bufferCookie;
947  status.mFlags = flags;
948 
949  return NTV2Message(status);
950 }
951 
953  NTV2Buffer& inBuffer,
954  ULWord dataSize,
955  ULWord flags,
956  ULWord delay,
957  ULWord timeout,
958  NTV2MailBuffer& status)
959 {
960  status.mChannel = inChannel;
961  status.mBuffer.Set (inBuffer.GetHostPointer(), inBuffer.GetByteCount());
962  status.mDataSize = dataSize;
963  status.mDelay = delay;
964  status.mTimeout = timeout;
965  status.mFlags = flags;
966 
967  return NTV2Message(status);
968 }
969 
970 // FinishOpen
971 // NOTE _boardID must be set before calling this routine.
973 {
974  // HACK! FinishOpen needs frame geometry to determine frame buffer size and number.
976  ULWord val1(0), val2(0);
980  NTV2PixelFormat pf(NTV2PixelFormat((val1 & 0x0F) | ((val2 & 0x1) << 4)));
981 #if !defined(NTV2_DEPRECATE_17_2)
984 #endif
985 
986  ULWord returnVal1 = false;
987  ULWord returnVal2 = false;
992 
993 #if !defined(NTV2_DEPRECATE_16_0)
1000 #endif // !defined(NTV2_DEPRECATE_16_0)
1001 
1002 } // FinishOpen
1003 
1004 
1006 {
1007  if (!IsDeviceReady(false))
1008  return false; // cannot read flash
1009 
1011  {
1012  uint32_t val;
1013  ReadRegister((0x100000 + 0x08) / 4, val);
1014  if (val != 0x01)
1015  return false; // cannot read flash
1016  }
1017 
1019  {
1022  bool busy = true;
1023  ULWord timeoutCount = 1000;
1024  do
1025  {
1026  ULWord regValue;
1028  if (regValue & BIT(8))
1029  {
1030  busy = true;
1031  timeoutCount--;
1032  }
1033  else
1034  busy = false;
1035  } while (busy && timeoutCount);
1036  if (!timeoutCount)
1037  return false;
1038  }
1039 
1040  // Allocate header buffer, read/fill from SPI-flash...
1041  static const ULWord dwordCount(256/4);
1042  NTV2Buffer bitFileHdrBuffer(dwordCount * sizeof(ULWord));
1043  if (!bitFileHdrBuffer)
1044  return false;
1045 
1046  ULWord* pULWord(bitFileHdrBuffer), baseAddress(0);
1047  for (ULWord count(0); count < dwordCount; count++, baseAddress += 4)
1048  if (!ReadFlashULWord(baseAddress, pULWord[count]))
1049  return false;
1050 
1051  CNTV2Bitfile fileInfo;
1052  std::string headerError;
1053 #if 0 // Fake out:
1054  if (_boardID == DEVICE_ID_TTAP_PRO) // Fake TTapPro -- load "flash" from on-disk bitfile:
1055  { fileInfo.Open("/Users/demo/dev-svn/firmware/T3_Tap/t_tap_pro.bit");
1056  headerError = fileInfo.GetLastError();
1057  } else
1058 #endif
1059  headerError = fileInfo.ParseHeaderFromBuffer(bitFileHdrBuffer);
1060  if (headerError.empty())
1061  {
1062  ::strncpy(bitFileInfo.dateStr, fileInfo.GetDate().c_str(), NTV2_BITFILE_DATETIME_STRINGLENGTH);
1063  ::strncpy(bitFileInfo.timeStr, fileInfo.GetTime().c_str(), NTV2_BITFILE_DATETIME_STRINGLENGTH);
1064  ::strncpy(bitFileInfo.designNameStr, fileInfo.GetDesignName().c_str(), NTV2_BITFILE_DESIGNNAME_STRINGLENGTH);
1065  ::strncpy(bitFileInfo.partNameStr, fileInfo.GetPartName().c_str(), NTV2_BITFILE_PARTNAME_STRINGLENGTH);
1066  bitFileInfo.numBytes = ULWord(fileInfo.GetProgramStreamLength());
1067  }
1068  return headerError.empty();
1069 } // ParseFlashHeader
1070 
1071 bool CNTV2DriverInterface::ReadFlashULWord (const ULWord inAddress, ULWord & outValue, const ULWord inRetryCount)
1072 {
1073  if (!WriteRegister(kRegXenaxFlashAddress, inAddress))
1074  return false;
1076  return false;
1077  bool busy(true);
1078  ULWord timeoutCount(inRetryCount);
1079  do
1080  {
1081  ULWord regValue(0);
1083  if (regValue & BIT(8))
1084  {
1085  busy = true;
1086  timeoutCount--;
1087  }
1088  else
1089  busy = false;
1090  } while (busy && timeoutCount);
1091  if (!timeoutCount)
1092  return false;
1093  return ReadRegister(kRegXenaxFlashDOUT, outValue);
1094 }
1095 
1097 {
1098  if (_boardNumber != num)
1099  {
1100  if (IsRemote()) // Log this only for remote/virtual devices
1101  VDNOTE(GetDescription() << ": patched device index from " << DEC(_boardNumber) << " to " << DEC(num));
1102  _boardNumber = num;
1103  }
1104  if (IsRemote()) // Remote/virtual device?
1105  if (_pRPCAPI->HasConnectParam(kQParamVDevIndex)) // .vdev-originated device?
1106  {
1107  // Special handling for .vdev devices to work with AJA ControlPanel and R2 services
1109  }
1110 }
1111 
1112 
1113 //--------------------------------------------------------------------------------------------------------------------
1114 // Application acquire and release stuff
1115 //--------------------------------------------------------------------------------------------------------------------
1116 const uint32_t kAgentAppFcc (NTV2_FOURCC('A','j','a','A'));
1117 
1118 
1119 bool CNTV2DriverInterface::AcquireStreamForApplicationWithReference (const ULWord inAppCode, const int32_t inAppPID)
1120 {
1121  ostringstream dev, appid, curid;
1122  uint32_t curCode(0), curPID(0), refCnt(0), curTaskMode(0), svcInitialized(0);
1124  dev << ::NTV2DeviceIDToString(GetDeviceID()) << "-" << DEC(GetIndexNumber());
1125  appid << "app " << NTV2_HEADER::FourCCToString(inAppCode) << " PID " << DEC(inAppPID);
1126  curid << "current app " << NTV2_HEADER::FourCCToString(curCode) << " PID " << DEC(curPID) << " tm=" << ::NTV2TaskModeToString(NTV2TaskMode(curTaskMode),true) << " refCnt=" << DEC(refCnt);
1127  if (ReadRegister(kVRegServicesInitialized, svcInitialized))
1128  if (!svcInitialized) // if services have never initialized the device
1129  if (inAppCode != kAgentAppFcc) // if not AJA Agent
1130  ARWARN(dev.str() << " never initialized by AJAAgent, acquiring " << appid.str());
1131 
1132 
1133  // Check if owner is deceased
1134  if (/*curPID &&*/ !AJAProcess::IsValid(curPID))
1135  {
1136  // Process doesn't exist, so release it
1137  ARINFO(dev.str() << ": will release deceased " << curid.str());
1138  ReleaseStreamForApplication (curCode, int32_t(curPID)); // ignore result, AJAAgent may have already done this
1139  // Re-sample current appCode, appPID, taskMode...
1141  curid.str(""); curid << "current app " << NTV2_HEADER::FourCCToString(curCode) << " PID " << DEC(curPID) << " tm=" << ::NTV2TaskModeToString(NTV2TaskMode(curTaskMode),true) << " refCnt=" << DEC(refCnt);
1142  }
1143 
1144  bool result(false);
1145  int count(0);
1146  for (count = 0; count < 20; count++)
1147  {
1148  if (!curPID)
1149  {
1150  // Nothing has the board
1151  ARDBG(dev.str() << ": try " << DEC(count) << ": no current app, will set app code for " << appid.str());
1152  if (!WriteRegister(kVRegApplicationCode, inAppCode)) // Set app code
1153  break; // fail
1154  // Just in case this is not zero
1155  result = WriteRegister(KVRegAcquireRefCount, 0); // Force to zero
1156  ARDBG(dev.str() << ": try " << DEC(count) << ": force refCnt to zero for " << appid.str() << (result ? " GOOD" : " FAILED"));
1157  result = WriteRegister(KVRegAcquireRefCount, 1); // Increment to 1
1158  ARDBG(dev.str() << ": try " << DEC(count) << ": increment refCnt for " << appid.str() << (result ? " GOOD" : " FAILED"));
1159  result = WriteRegister(kVRegApplicationPID, ULWord(inAppPID)); // Set PID
1160 // ARDBG(dev.str() << ": try " << DEC(count) << ": set PID for " << appid.str() << (result ? " GOOD" : " FAILED"));
1161  break;
1162  }
1163  else if (curCode == inAppCode && curPID == ULWord(inAppPID))
1164  { // Process already acquired, so bump the count
1165  ARDBG(dev.str() << ": try " << DEC(count) << ": " << appid.str() << " already acquired, will increment refCnt, " << curid.str());
1166  result = WriteRegister(KVRegAcquireRefCount, 1); // Increment
1167  break;
1168  }
1169  // Someone else has the board, so wait and try again
1170  AJATime::Sleep(50);
1172  curid.str(""); curid << "current app " << NTV2_HEADER::FourCCToString(curCode) << " PID " << DEC(curPID) << " tm=" << ::NTV2TaskModeToString(NTV2TaskMode(curTaskMode),true) << " refCnt=" << DEC(refCnt);
1173  } // try up to 20 times
1174  if (result)
1175  ARINFO(dev.str() << ": " << appid.str() << " acquired successfully");
1176  else
1177  ARFAIL(dev.str() << ": failed to acquire " << appid.str() << (count > 19 ? " (timed out)" : ""));
1178  return result;
1179 } // AcquireStreamForApplicationWithReference
1180 
1181 bool CNTV2DriverInterface::ReleaseStreamForApplicationWithReference (const ULWord inAppCode, const int32_t inAppPID)
1182 {
1183  ULWord curCode(0), curPID(0), refCnt(0), curTaskMode(0);
1185  bool result(false);
1186  ostringstream dev; dev << ::NTV2DeviceIDToString(GetDeviceID()) << "-" << DEC(GetIndexNumber());
1187  ostringstream appid; appid << "app " << NTV2_HEADER::FourCCToString(inAppCode) << " PID " << DEC(inAppPID);
1188  ostringstream tm; tm << "tm=" << ::NTV2TaskModeToString(NTV2TaskMode(curTaskMode),true);
1189  if (curCode == inAppCode && curPID == ULWord(inAppPID))
1190  {
1191  if (refCnt > 1)
1192  { ARDBG(dev.str() << ": will decrement refCnt " << DEC(refCnt) << " for " << appid.str() << ", " << tm.str());
1193  result = WriteRegister(KVRegReleaseRefCount, 1); // Driver will decrement register value ("1" is ignored)
1194  }
1195  else if (refCnt == 1)
1196  { ARDBG(dev.str() << ": will release " << appid.str() << " refCnt=" << DEC(refCnt) << ", " << tm.str());
1197  result = ReleaseStreamForApplication(inAppCode, inAppPID);
1198  }
1199  else
1200  { ARDBG(dev.str() << ": refCnt already 0 for " << appid.str() << ", " << tm.str());
1201  result = true;
1202  }
1203  if (result)
1204  ARINFO(dev.str() << ": " << appid.str() << " released successfully");
1205  else
1206  ARFAIL(dev.str() << ": failed to release " << appid.str() << " refCnt=" << DEC(refCnt) << ", " << tm.str());
1207  }
1208  else
1209  ARFAIL(dev.str() << ": " << appid.str() << " not current app " << NTV2_HEADER::FourCCToString(curCode) << " PID "
1210  << DEC(curPID) << ", refCnt=" << DEC(refCnt) << ", " << tm.str());
1211  return result;
1212 } // ReleaseStreamForApplicationWithReference
1213 
1214 bool CNTV2DriverInterface::AcquireStreamForApplication (const ULWord inAppCode, const int32_t inAppPID)
1215 {
1216  ostringstream dev; dev << ::NTV2DeviceIDToString(GetDeviceID()) << "-" << DEC(GetIndexNumber());
1217  ostringstream appid; appid << "app " << NTV2_HEADER::FourCCToString(inAppCode) << " PID " << DEC(inAppPID);
1218  ULWord svcInitialized(0);
1219  if (ReadRegister(kVRegServicesInitialized, svcInitialized))
1220  if (!svcInitialized) // if services have never initialized the device
1221  if (inAppCode != kAgentAppFcc) // if not AJA Agent
1222  ARWARN(dev.str() << " uninitialized by AJAAgent, requesting " << appid.str());
1223 
1224  // Loop for a while trying to acquire the board
1225  bool result(false);
1226  ULWord count(0), curCode(0), curPID(0), refCnt(0), curTaskMode(0);
1227  ostringstream curid;
1228  for (count = 0; count < 20; count++)
1229  {
1230  ARDBG(dev.str() << ": try " << DEC(count) << ": will set app code for " << appid.str());
1231  if (WriteRegister(kVRegApplicationCode, inAppCode))
1232  {
1233  result = WriteRegister(kVRegApplicationPID, ULWord(inAppPID));
1234  break;
1235  }
1236  AJATime::Sleep(50);
1237  } // try 20 times (about 1 sec)
1238 
1239  if (count > 19) // if timed out
1240  { // Get data about current owner
1242  curid << "current app " << NTV2_HEADER::FourCCToString(curCode) << " PID " << DEC(curPID) << " tm="
1243  << ::NTV2TaskModeToString(NTV2TaskMode(curTaskMode),true) << " refCnt=" << DEC(refCnt);
1244 
1245  // Check if owner is deceased
1246  if (/*curPID &&*/ !AJAProcess::IsValid(curPID))
1247  { // Process doesn't exist, so make the board our own
1248  ARINFO(dev.str() << ": will release deceased " << curid.str());
1249  ReleaseStreamForApplication (curCode, int32_t(curPID)); // ignore result, AJAAgent may have already done this
1250  for (count = 0; count < 20; count++)
1251  {
1252  ARDBG(dev.str() << ": try " << DEC(count) << ": will set app code for " << appid.str());
1253  if (WriteRegister(kVRegApplicationCode, inAppCode))
1254  {
1255  result = WriteRegister(kVRegApplicationPID, ULWord(inAppPID));
1256  break;
1257  }
1258  AJATime::Sleep(50);
1259  } // try 20 times (about 1 sec)
1260  }
1261  // Current owner is alive, so don't interfere
1262  } // if timed out
1264  curid.str("");
1265  curid << ", current app " << NTV2_HEADER::FourCCToString(curCode) << " PID " << DEC(curPID) << " tm="
1266  << ::NTV2TaskModeToString(NTV2TaskMode(curTaskMode),true) << " refCnt=" << DEC(refCnt);
1267  if (result)
1268  ARINFO(dev.str() << ": successfully acquired" << (count > 19 ? " after timeout" : "") << curid.str());
1269  else
1270  ARFAIL(dev.str() << ": failed to acquire " << appid.str() << (count > 19 ? " (timed out)" : "") << curid.str());
1271  return result;
1272 } // AcquireStreamForApplication
1273 
1274 bool CNTV2DriverInterface::ReleaseStreamForApplication (const ULWord inAppCode, const int32_t inAppPID)
1275 { // Don't care which appCode
1276  ULWord curCode(0), curPID(0), refCnt(0), curTaskMode(0);
1278  ostringstream dev; dev << ::NTV2DeviceIDToString(GetDeviceID()) << "-" << DEC(GetIndexNumber());
1279  ostringstream appid; appid << "app " << NTV2_HEADER::FourCCToString(inAppCode) << " PID " << DEC(inAppPID);
1280  ostringstream curid; curid << "current app " << NTV2_HEADER::FourCCToString(curCode) << " PID " << DEC(curPID) << " tm="
1281  << ::NTV2TaskModeToString(NTV2TaskMode(curTaskMode),true) << " refCnt=" << DEC(refCnt);
1282 
1283  if (!WriteRegister(kVRegReleaseApplication, ULWord(inAppPID)))
1284  { ARFAIL(dev.str() << ": WriteRegister kVRegReleaseApplication failed for " << appid.str() << ", " << curid.str());
1285  return false; // Fail
1286  }
1287 
1288  WriteRegister(KVRegAcquireRefCount, 0); // Force to zero, OK to ignore result
1290  curid.str(""); curid << "current app " << NTV2_HEADER::FourCCToString(curCode) << " PID " << DEC(curPID) << " tm="
1291  << ::NTV2TaskModeToString(NTV2TaskMode(curTaskMode),true) << " refCnt=" << DEC(refCnt);
1292  ARINFO(dev.str() << ": " << appid.str() << " released, " << curid.str());
1293  return true;
1294 } // ReleaseStreamForApplication
1295 
1296 bool CNTV2DriverInterface::SetStreamingApplication (const ULWord inAppCode, const int32_t inAppPID)
1297 {
1298  ULWord curCode(0), curPID(0), refCnt(0), curTaskMode(0); ostringstream dev, appid, curid, newid;
1300  dev << ::NTV2DeviceIDToString(GetDeviceID()) << "-" << DEC(GetIndexNumber());
1301  appid << "app " << NTV2_HEADER::FourCCToString(inAppCode) << " PID " << DEC(inAppPID);
1302  curid << "app " << NTV2_HEADER::FourCCToString(curCode) << " PID " << DEC(curPID) << " tm=" << ::NTV2TaskModeToString(NTV2TaskMode(curTaskMode),true) << " refCnt=" << DEC(refCnt);
1303 #if 1 // original implementation
1304  ARDBG(dev.str() << ": will WriteRegister kVRegForceApplicationCode & kVRegForceApplicationPID with " << appid.str() << ", current " << curid.str());
1305  bool result (WriteRegister(kVRegForceApplicationCode, inAppCode) && WriteRegister(kVRegForceApplicationPID, ULWord(inAppPID)));
1307  newid << "app " << NTV2_HEADER::FourCCToString(curCode) << " PID " << DEC(curPID) << " tm=" << ::NTV2TaskModeToString(NTV2TaskMode(curTaskMode),true) << " refCnt=" << DEC(refCnt);
1308  if (result)
1309  ARINFO(dev.str() << ": successfully force-set to " << appid.str() << ", former " << curid.str() << ", new " << newid.str());
1310  else
1311  ARFAIL(dev.str() << ": failed to force-set to " << appid.str() << ", former " << curid.str() << ", new " << newid.str());
1312  return result;
1313 #else // begin macOS driver implementation (adapted to use VRegs)
1314  // SPECIAL CASE: Adobe Plugins
1315  // Adobe plug-in (X-Machina / Greg) are using the OEM driver every frame task
1316  // If they are in control of the board (eg curCode == 'auto' && curPID == 0)
1317  // Then we assume they have enabled the OEM every frame task.
1318  // This code restore Kona every-frame task
1319  if (curCode == 'auto' && curPID == 0 && inAppCode != 'auto')
1321 
1322  // reset override state
1324 
1325  if (inAppCode)
1326  WriteRegister(kVRegApplicationCode, inAppCode); // always remember what our previous app was
1327 
1329 
1330  // support for reference counting
1331  if (inAppPID == 0)
1332  WriteRegister(KVRegAcquireRefCount, 0); // Force to zero, ignore any error result
1333 #endif // end macOS driver implementation (adapted to use VRegs)
1334 } // SetStreamingApplication
1335 
1336 bool CNTV2DriverInterface::GetStreamingApplication (ULWord & outAppType, int32_t & outProcessID)
1337 {
1338  outAppType = 0; outProcessID = 0;
1340 }
1341 
1343 {
1344  if (!IsRemote())
1345  return ""; // This implementation is intended for remote/plugin devices
1346  string desc(_pRPCAPI->Description());
1347  if (desc.empty())
1348  { // Plugin/remote device didn't provide description
1349  const NTV2Dictionary parms(ConnectParams());
1350  NTV2StringList strs;
1352  strs.push_back("\"" + parms.valueForKey(kNTV2PluginRegInfoKey_LongName) + "\"");
1353  else if (parms.hasKey(kNTV2PluginRegInfoKey_ShortName))
1354  strs.push_back(parms.valueForKey(kNTV2PluginRegInfoKey_ShortName));
1356  strs.push_back(parms.valueForKey(kNTV2PluginRegInfoKey_Description));
1357  else if (parms.hasKey(kNTV2PluginRegInfoKey_Copyright))
1358  strs.push_back(parms.valueForKey(kNTV2PluginRegInfoKey_Copyright));
1359  else if (parms.hasKey(kNTV2PluginRegInfoKey_Vendor))
1360  strs.push_back(parms.valueForKey(kNTV2PluginRegInfoKey_Vendor));
1361  if (!strs.empty())
1362  desc = aja::join(strs, ", ");
1363  }
1364  return desc;
1365 }
1366 
1368 {
1369  return IsRemote() ? _pRPCAPI->ConnectParams() : NTV2Dictionary();
1370 }
1371 
1372 // This function is used by the retail ControlPanel.
1373 // Read the current RP188 registers (which typically give you the timecode corresponding to the LAST frame).
1374 // NOTE: This is a hack to avoid making a "real" driver call! Since the RP188 data requires three ReadRegister()
1375 // calls, there is a chance that it can straddle a VBI, which could give bad results. To avoid this, we
1376 // read the 3 registers until we get two consecutive passes that give us the same data. (Someday it'd
1377 // be nice if the driver automatically read these as part of its VBI IRQ handler...
1379 { (void) inChannel;
1380  if (!pRP188Data)
1381  return false;
1382 
1383  RP188_STRUCT rp188;
1384  NTV2DeviceID boardID = DEVICE_ID_NOTFOUND;
1386  ULWord dbbReg(0), msReg(0), lsReg(0);
1387 
1390  bool bLTCPort = (source == kRP188SourceLTCPort);
1391 
1392  // values come from LTC port registers
1393  if (bLTCPort)
1394  {
1395  ULWord ltcPresent;
1397 
1398  // there is no equivalent DBB for LTC port - we synthesize it here
1399  rp188.DBB = (ltcPresent) ? 0xFE000000 | NEW_SELECT_RP188_RCVD : 0xFE000000;
1400 
1401  // LTC port registers
1402  dbbReg = 0; // don't care - does not exist
1403  msReg = kRegLTCAnalogBits0_31;
1404  lsReg = kRegLTCAnalogBits32_63;
1405  }
1406  else
1407  {
1408  // values come from RP188 registers
1409  NTV2Channel channel = NTV2_CHANNEL1;
1411 
1412  if (::NTV2DeviceGetNumVideoInputs(boardID) > 1)
1413  {
1415  channel = (inputSelect == NTV2_Input2Select) ? NTV2_CHANNEL2 : NTV2_CHANNEL1;
1416  }
1417  else
1418  channel = NTV2_CHANNEL1;
1419 
1420  // rp188 registers
1421  dbbReg = (channel == NTV2_CHANNEL1 ? kRegRP188InOut1DBB : kRegRP188InOut2DBB);
1422  //Check to see if TC is received
1423  uint32_t tcReceived = 0;
1424  ReadRegister(dbbReg, tcReceived, BIT(16), 16);
1425  if(tcReceived == 0)
1426  return false;//No TC recevied
1427 
1429  switch (rp188.DBB)//What do we have?
1430  {
1431  default:
1432  case 0x01:
1433  case 0x02:
1434  {
1435  //We have VITC - what do we want?
1436  if (pRP188Data->DBB == 0x01 || pRP188Data->DBB == 0x02)
1437  { // We want VITC
1440  }
1441  else
1442  { // We want Embedded LTC, so we should check one other place
1443  uint32_t ltcPresent = 0;
1444  ReadRegister(dbbReg, ltcPresent, BIT(18), 18);
1445  if (ltcPresent != 1)
1446  return false;
1447  //Read LTC registers
1450  }
1451  break;
1452  }
1453  case 0x00:
1454  //We have LTC - do we want it?
1455  if (pRP188Data->DBB != 0x00)
1456  return false;
1459  break;
1460  }
1461  //Re-Read the whole register just in case something is expecting other status values
1462  ReadRegister (dbbReg, rp188.DBB);
1463  }
1464  ReadRegister (msReg, rp188.Low );
1465  ReadRegister (lsReg, rp188.High);
1466 
1467  // register stability filter
1468  do
1469  {
1470  *pRP188Data = rp188; // struct copy to result
1471 
1472  // read again into local struct
1473  if (!bLTCPort)
1474  ReadRegister (dbbReg, rp188.DBB);
1475  ReadRegister (msReg, rp188.Low );
1476  ReadRegister (lsReg, rp188.High);
1477 
1478  // if the new read equals the previous read, consider it done
1479  if (rp188.DBB == pRP188Data->DBB &&
1480  rp188.Low == pRP188Data->Low &&
1481  rp188.High == pRP188Data->High)
1482  break;
1483  } while (true);
1484 
1485  return true;
1486 }
1487 
1489 {
1490  if (NTV2_IS_VALID_INTERRUPT_ENUM(eInterruptType))
1491  mEventCounts[eInterruptType] += 1;
1492 
1493 } // BumpEventCount
1494 
1495 
1496 bool CNTV2DriverInterface::IsDeviceReady (const bool checkValid)
1497 {
1498  if (IsRemote())
1499  {
1500  ULWord reg(0), val(0);
1502  return true; // failed to read VReg -- assume ready
1503  if (!reg)
1504  return true; // reg number is zero -- assume ready
1505  // A non-zero register number was returned (hope it's valid)
1506  if (!ReadRegister(reg, val))
1507  return true; // failed to read -- bad reg num? -- assume device ready
1508  // ReadRegister successful!
1509  return val; // zero means "not ready"; non-zero means "ready"
1510  }
1512  return true; // Non-IP devices always ready
1513 
1515  {
1516  if (!IsMBSystemReady())
1517  return false;
1518 
1519  if (checkValid && !IsMBSystemValid())
1520  return false;
1521  }
1522  else if (!IsLPSystemReady())
1523  return false;
1524  return true; // Ready!
1525 }
1526 
1528 {
1529  return true;
1530 }
1531 
1533 {
1534  return false;
1535 }
1536 
1538 {
1540  return false; // No local proc
1541 
1542  uint32_t val;
1544  if (val == 0x00)
1545  return false; // MB not ready
1546  return true;
1547 }
1548 
1549 #if defined(NTV2_WRITEREG_PROFILING) // Register Write Profiling
1551  {
1552  AJAAutoLock autoLock(&mRegWritesLock);
1553  outRegWrites = mRegWrites;
1554  return true;
1555  }
1556 
1557  bool CNTV2DriverInterface::StartRecordRegisterWrites (const bool inSkipActualWrites)
1558  {
1559  AJAAutoLock autoLock(&mRegWritesLock);
1560  if (mRecordRegWrites)
1561  return false; // Already recording
1562  mRegWrites.clear();
1563  mRecordRegWrites = true;
1564  mSkipRegWrites = inSkipActualWrites;
1565  return true;
1566  }
1567 
1569  { // Identical to Start, but don't clear mRegWrites nor change mSkipRegWrites
1570  AJAAutoLock autoLock(&mRegWritesLock);
1571  if (mRecordRegWrites)
1572  return false; // Already recording
1573  mRecordRegWrites = true;
1574  return true;
1575  }
1576 
1578  { // NB: This will return false if paused
1579  AJAAutoLock autoLock(&mRegWritesLock);
1580  return mRecordRegWrites;
1581  }
1582 
1584  {
1585  AJAAutoLock autoLock(&mRegWritesLock);
1586  mRecordRegWrites = mSkipRegWrites = false;
1587  return true;
1588  }
1589 
1591  { // Identical to Stop, but don't change mSkipRegWrites
1592  AJAAutoLock autoLock(&mRegWritesLock);
1593  if (!mRecordRegWrites)
1594  return false; // Already stopped/paused
1595  mRecordRegWrites = false;
1596  return true;
1597  }
1598 
1600  {
1601  AJAAutoLock autoLock(&mRegWritesLock);
1602  return ULWord(mRegWrites.size());
1603  }
1604 #endif // NTV2_WRITEREG_PROFILING
1605 
1606 
1608 {
1609  ULWordSet result;
1610  if (!IsOpen())
1611  return result;
1612 
1613  // Remote/virtual device gets first dibs on answering...
1614  if (IsRemote() && _pRPCAPI->NTV2GetSupportedRemote (inEnumsID, result))
1615  return result;
1616 
1617  const NTV2DeviceID devID(GetDeviceID());
1618  switch (inEnumsID)
1619  {
1620  case kNTV2EnumsID_DeviceID:
1621  { const NTV2DeviceIDSet devIDs(::NTV2GetSupportedDevices());
1622  for (NTV2DeviceIDSetConstIter it(devIDs.begin()); it != devIDs.end(); ++it)
1623  result.insert(ULWord(*it));
1624  break;
1625  }
1626  case kNTV2EnumsID_Standard:
1627  { NTV2StandardSet standards;
1628  ::NTV2DeviceGetSupportedStandards (devID, standards);
1629  for (NTV2StandardSetConstIter it(standards.begin()); it != standards.end(); ++it)
1630  result.insert(ULWord(*it));
1631  break;
1632  }
1636  for (NTV2FrameBufferFormatSetConstIter it(pfs.begin()); it != pfs.end(); ++it)
1637  result.insert(ULWord(*it));
1638  break;
1639  }
1641  { NTV2GeometrySet fgs;
1643  for (NTV2GeometrySetConstIter it(fgs.begin()); it != fgs.end(); ++it)
1644  result.insert(ULWord(*it));
1645  break;
1646  }
1648  { NTV2FrameRateSet frs;
1650  for (NTV2FrameRateSetConstIter it(frs.begin()); it != frs.end(); ++it)
1651  result.insert(ULWord(*it));
1652  break;
1653  }
1655  { // Needs implementation
1656  break;
1657  }
1659  { NTV2VideoFormatSet vfs;
1661  for (NTV2VideoFormatSetConstIter it(vfs.begin()); it != vfs.end(); ++it)
1662  result.insert(ULWord(*it));
1663  break;
1664  }
1665  case kNTV2EnumsID_Mode:
1666  { if (IsSupported(kDeviceCanDoPlayback)) result.insert(ULWord(NTV2_MODE_OUTPUT));
1667  if (IsSupported(kDeviceCanDoCapture)) result.insert(ULWord(NTV2_MODE_INPUT));
1668  break;
1669  }
1671  { NTV2InputSourceSet srcs;
1673  for (NTV2InputSourceSetConstIter it(srcs.begin()); it != srcs.end(); ++it)
1674  result.insert(ULWord(*it));
1675  break;
1676  }
1678  { NTV2OutputDestinations dsts;
1680  for (NTV2OutputDestinationsConstIter it(dsts.begin()); it != dsts.end(); ++it)
1681  result.insert(ULWord(*it));
1682  break;
1683  }
1684  case kNTV2EnumsID_Channel:
1685  { for (ULWord ch(0); ch < GetNumSupported(kDeviceGetNumFrameStores); ch++)
1686  result.insert(ch);
1687  break;
1688  }
1691  break;
1692  NTV2InputSourceSet inpSrcs;
1693  ::NTV2DeviceGetSupportedInputSources (devID, inpSrcs);
1694  for (NTV2InputSourceSetConstIter it(inpSrcs.begin()); it != inpSrcs.end(); ++it)
1695  { const NTV2ReferenceSource refSrc (::NTV2InputSourceToReferenceSource(*it));
1697  if (result.find(ULWord(refSrc)) == result.end())
1698  result.insert(ULWord(refSrc));
1699  }
1700  result.insert(ULWord(NTV2_REFERENCE_FREERUN)); // Always include Free-Run
1702  result.insert(ULWord(NTV2_REFERENCE_EXTERNAL)); // Has external reference
1703  break;
1704  }
1706  { result.insert(ULWord(NTV2_AUDIO_48K)); // All boards support 48KHz PCM
1707  if (IsSupported(kDeviceCanDoAudio96K)) result.insert(ULWord(NTV2_AUDIO_96K));
1709  break;
1710  }
1713  break;
1714  NTV2InputSourceSet inpSrcs;
1715  ::NTV2DeviceGetSupportedInputSources (devID, inpSrcs);
1716  for (NTV2InputSourceSetConstIter it(inpSrcs.begin()); it != inpSrcs.end(); ++it)
1717  { const NTV2AudioSource audSrc (::NTV2InputSourceToAudioSource(*it));
1718  if (NTV2_IS_VALID_AUDIO_SOURCE(audSrc))
1719  if (result.find(ULWord(audSrc)) == result.end())
1720  result.insert(ULWord(audSrc));
1721  }
1722  break;
1723  }
1724  case kNTV2EnumsID_WidgetID:
1725  { NTV2WidgetIDSet wgts;
1726  CNTV2SignalRouter::GetWidgetIDs (devID, wgts);
1727  for (NTV2WidgetIDSetConstIter it(wgts.begin()); it != wgts.end(); ++it)
1728  result.insert(ULWord(*it));
1729  break;
1730  }
1733  if (::NTV2DeviceCanDoConversionMode (devID, cm))
1734  result.insert(ULWord(cm));
1735  break;
1736  }
1739  if (::NTV2DeviceCanDoInputTCIndex (devID, ndx))
1740  result.insert(ULWord(ndx));
1741  break;
1742  }
1745  if (::NTV2DeviceCanDoOutputTCIndex (devID, ndx))
1746  result.insert(ULWord(ndx));
1747  break;
1748  }
1749  default: break;
1750  }
1751  return result;
1752 }
1753 
1754 bool CNTV2DriverInterface::GetBoolParam (const ULWord inParamID, ULWord & outValue)
1755 {
1756  // Remote/virtual device gets first dibs on answering...
1757  if (IsRemote() && _pRPCAPI->NTV2GetBoolParamRemote (inParamID, outValue))
1758  return true;
1759 
1760  // Is there a register/bit that can answer this query?
1761  const NTV2BoolParamID paramID (NTV2BoolParamID(inParamID+0));
1762  { NTV2RegInfo regInfo; bool invertSense(false);
1763  if (GetRegInfoForBoolParam (paramID, regInfo, invertSense))
1764  {
1765  if (!ReadRegister (regInfo.registerNumber, regInfo.registerValue, regInfo.registerMask, regInfo.registerShift))
1766  return false;
1767  if (invertSense)
1768  outValue = regInfo.registerValue ? 0 : 1;
1769  else
1770  outValue = regInfo.registerValue ? 1 : 0;
1771  return true;
1772  }
1773  }
1774  // Calculated bool param values probably should be deprecated...
1775  ULWord num(0), num2(0), num3(0), num4(0);
1776  switch (inParamID)
1777  {
1778  case kDeviceCanDoAESAudioIn: if (GetNumericParam(kDeviceGetNumAESAudioInputChannels, num)) {outValue = num > 0; return true;} break;
1779  case kDeviceCanDoAESAudioOut: if (GetNumericParam(kDeviceGetNumAESAudioOutputChannels, num)) {outValue = num > 0; return true;} break;
1780  case kDeviceCanDoAudio2Channels: if (GetNumericParam(kDeviceGetMaxAudioChannels, num)) {outValue = num >= 2; return true;} break; // Deprecate?
1781  case kDeviceCanDoAudio6Channels: if (GetNumericParam(kDeviceGetMaxAudioChannels, num)) {outValue = num >= 6; return true;} break; // Deprecate?
1782  case kDeviceCanDoAudio8Channels: if (GetNumericParam(kDeviceGetMaxAudioChannels, num)) {outValue = num >= 8; return true;} break; // Deprecate?
1787  {outValue = (num+num2+num3+num4) > 0; return true;}
1788  break;
1793  {outValue = (num+num2+num3+num4) > 0; return true;}
1794  break;
1798  {outValue = (num+num2+num3) > 0; return true;}
1799  break;
1800  case kDeviceCanDoColorCorrection: if (GetNumericParam(kDeviceGetNumLUTs, num)) {outValue = num > 0; return true;} break; // Deprecate?
1804  {outValue = (num+num2+num3) > 0; return true;}
1805  break;
1806  case kDeviceCanDoProgrammableCSC: if (GetNumericParam(kDeviceGetNumCSCs, num)) {outValue = num > 0; return true;} break;
1807  case kDeviceHasSPIv2: if (GetNumericParam(kDeviceGetSPIFlashVersion, num)) {outValue = num == 2; return true;} break;
1808  case kDeviceHasSPIv3: if (GetNumericParam(kDeviceGetSPIFlashVersion, num)) {outValue = num == 3; return true;} break;
1809  case kDeviceHasSPIv4: if (GetNumericParam(kDeviceGetSPIFlashVersion, num)) {outValue = num == 4; return true;} break;
1810  case kDeviceHasGenlockv2: if (GetNumericParam(kDeviceGetGenlockVersion, num)) {outValue = num == 2; return true;} break; // Deprecate
1811  case kDeviceHasGenlockv3: if (GetNumericParam(kDeviceGetGenlockVersion, num)) {outValue = num == 3; return true;} break; // Deprecate
1814  {outValue = (num || num2) // At least 1 HDMI in or out
1815  && (GetDeviceID() != DEVICE_ID_KONAHDMI) // Not a KonaHDMI
1816  && !IsSupported(kDeviceCanDoAudioMixer); // No audio mixer
1817  return true;}
1818  break;
1821  {outValue = num >= 3 && num <= 6; return true;}
1822  break;
1823  default: break;
1824  }
1825  return GetBoolParamWithDeviceID(paramID, outValue); // Call classic device features function
1826 } // GetBoolParam
1827 
1829 {
1830  outValue = 0;
1831  const NTV2DeviceID devID(GetDeviceID());
1832  switch (inParamID)
1833  {
1834  case kDeviceCanChangeEmbeddedAudioClock: outValue = ::NTV2DeviceCanChangeEmbeddedAudioClock(devID); break; // Deprecate?
1836  case kDeviceCanDisableUFC: outValue = ::NTV2DeviceCanDisableUFC(devID); break;
1837  case kDeviceCanDo2KVideo: outValue = ::NTV2DeviceCanDo2KVideo(devID); break;
1840  case kDeviceCanDo425Mux: outValue = ::NTV2DeviceCanDo425Mux(devID); break;
1841  case kDeviceCanDo4KVideo: outValue = ::NTV2DeviceCanDo4KVideo(devID); break;
1844  case kDeviceCanDoAnalogAudio: outValue = ::NTV2DeviceCanDoAnalogAudio(devID); break;
1845  case kDeviceCanDoAnalogVideoIn: outValue = ::NTV2DeviceCanDoAnalogVideoIn(devID); break;
1846  case kDeviceCanDoAnalogVideoOut: outValue = ::NTV2DeviceCanDoAnalogVideoOut(devID); break;
1847  case kDeviceCanDoAudio2Channels: outValue = GetNumSupported(kDeviceGetMaxAudioChannels) >= 2; break; // Deprecate?
1848  case kDeviceCanDoAudio6Channels: outValue = GetNumSupported(kDeviceGetMaxAudioChannels) >= 6; break; // Deprecate?
1849  case kDeviceCanDoAudio8Channels: outValue = GetNumSupported(kDeviceGetMaxAudioChannels) >= 8; break; // Deprecate?
1850  case kDeviceCanDoAudio96K: outValue = ::NTV2DeviceCanDoAudio96K(devID); break; // Deprecate?
1851  case kDeviceCanDoAudioDelay: outValue = ::NTV2DeviceCanDoAudioDelay(devID); break; // Deprecate?
1860  case kDeviceCanDoBreakoutBoard: outValue = ::NTV2DeviceCanDoBreakoutBoard(devID); break;
1861  case kDeviceCanDoBreakoutBox: outValue = ::NTV2DeviceCanDoBreakoutBox(devID); break;
1865  case kDeviceCanDoClockMonitor: outValue = ::NTV2DeviceCanDoClockMonitor(devID); break;
1866  case kDeviceCanDoColorCorrection: outValue = GetNumSupported(kDeviceGetNumLUTs) > 0; break; // Deprecate?
1867  case kDeviceCanDoCustomAnc: outValue = ::NTV2DeviceCanDoCustomAnc(devID); break; // Deprecate?
1868  case kDeviceCanDoDSKOpacity: outValue = ::NTV2DeviceCanDoDSKOpacity(devID); break; // Deprecate?
1869  case kDeviceCanDoDualLink: outValue = ::NTV2DeviceCanDoDualLink(devID); break; // Deprecate?
1870  case kDeviceCanDoDVCProHD: outValue = ::NTV2DeviceCanDoDVCProHD(devID); break; // Deprecate?
1871  case kDeviceCanDoEnhancedCSC: outValue = ::NTV2DeviceCanDoEnhancedCSC(devID); break; // Deprecate?
1872  case kDeviceCanDoFrameStore1Display: outValue = ::NTV2DeviceCanDoFrameStore1Display(devID); break; // Deprecate?
1873  case kDeviceCanDoGPIO: outValue = ::NTV2DeviceCanDoGPIO(devID); break;
1874  case kDeviceCanDoHDMIOutStereo: outValue = ::NTV2DeviceCanDoHDMIOutStereo(devID); break; // Deprecate?
1875  case kDeviceCanDoHDV: outValue = ::NTV2DeviceCanDoHDV(devID); break; // Deprecate?
1876  case kDeviceCanDoHDVideo: outValue = ::NTV2DeviceCanDoHDVideo(devID); break; // Deprecate?
1877  case kDeviceCanDoIsoConvert: outValue = ::NTV2DeviceCanDoIsoConvert(devID); break;
1878  case kDeviceCanDoLTC: outValue = ::NTV2DeviceCanDoLTC(devID); break;
1879  case kDeviceCanDoLTCInOnRefPort: outValue = ::NTV2DeviceCanDoLTCInOnRefPort(devID); break;
1880  case kDeviceCanDoMSI: outValue = ::NTV2DeviceCanDoMSI(devID); break;
1881  case kDeviceCanDoMultiFormat: outValue = ::NTV2DeviceCanDoMultiFormat(devID); break;
1882  case kDeviceCanDoPCMControl: outValue = ::NTV2DeviceCanDoPCMControl(devID); break;
1883  case kDeviceCanDoPCMDetection: outValue = ::NTV2DeviceCanDoPCMDetection(devID); break;
1884  case kDeviceCanDoPIO: outValue = ::NTV2DeviceCanDoPIO(devID); break; // Deprecate?
1888  case kDeviceCanDoProgrammableCSC: outValue = GetNumSupported(kDeviceGetNumCSCs) > 0; break;
1890  case kDeviceCanDoProRes: outValue = ::NTV2DeviceCanDoProRes(devID); break;
1891  case kDeviceCanDoQREZ: outValue = ::NTV2DeviceCanDoQREZ(devID); break;
1892  case kDeviceCanDoQuarterExpand: outValue = ::NTV2DeviceCanDoQuarterExpand(devID); break;
1893  case kDeviceCanDoRateConvert: outValue = ::NTV2DeviceCanDoRateConvert(devID); break; // Deprecate?
1894  case kDeviceCanDoRGBPlusAlphaOut: outValue = ::NTV2DeviceCanDoRGBPlusAlphaOut(devID); break; // Deprecate?
1895  case kDeviceCanDoRP188: outValue = ::NTV2DeviceCanDoRP188(devID); break; // Deprecate?
1896  case kDeviceCanDoSDVideo: outValue = ::NTV2DeviceCanDoSDVideo(devID); break; // Deprecate?
1897  case kDeviceCanDoSDIErrorChecks: outValue = ::NTV2DeviceCanDoSDIErrorChecks(devID); break;
1898  case kDeviceCanDoStackedAudio: outValue = ::NTV2DeviceCanDoStackedAudio(devID); break; // Deprecate?
1899  case kDeviceCanDoStereoIn: outValue = ::NTV2DeviceCanDoStereoIn(devID); break; // Deprecate?
1900  case kDeviceCanDoStereoOut: outValue = ::NTV2DeviceCanDoStereoOut(devID); break; // Deprecate?
1901  case kDeviceCanDoThunderbolt: outValue = ::NTV2DeviceCanDoThunderbolt(devID); break;
1902  case kDeviceCanDoVideoProcessing: outValue = ::NTV2DeviceCanDoVideoProcessing(devID); break;
1903  case kDeviceCanMeasureTemperature: outValue = ::NTV2DeviceCanMeasureTemperature(devID); break;
1904  case kDeviceCanReportFrameSize: outValue = ::NTV2DeviceCanReportFrameSize(devID); break;
1905  case kDeviceHasBiDirectionalSDI: outValue = ::NTV2DeviceHasBiDirectionalSDI(devID); break;
1906  case kDeviceHasBracketLED: outValue = ::NTV2DeviceHasBracketLED(devID); break;
1907  case kDeviceHasColorSpaceConverterOnChannel2: outValue = ::NTV2DeviceCanDoWidget(devID, NTV2_WgtCSC2); break; // Deprecate?
1908  case kDeviceHasIDSwitch: outValue = ::NTV2DeviceCanDoIDSwitch(devID); break;
1909  case kDeviceHasNTV4FrameStores: outValue = ::NTV2DeviceHasNTV4FrameStores(devID); break;
1910  case kDeviceHasNWL: outValue = ::NTV2DeviceHasNWL(devID); break;
1911  case kDeviceHasPCIeGen2: outValue = ::NTV2DeviceHasPCIeGen2(devID); break;
1912  case kDeviceHasRetailSupport: outValue = ::NTV2DeviceHasRetailSupport(devID); break;
1913  case kDeviceHasSDIRelays: outValue = ::NTV2DeviceHasSDIRelays(devID); break;
1914  case kDeviceHasSPIFlash: outValue = ::NTV2DeviceHasSPIFlash(devID); break; // Deprecate?
1915  case kDeviceHasSPIFlashSerial: outValue = ::NTV2DeviceHasSPIFlashSerial(devID); break; // Deprecate?
1916  case kDeviceHasSPIv2: outValue = GetNumSupported(kDeviceGetSPIFlashVersion) == 2; break;
1917  case kDeviceHasSPIv3: outValue = GetNumSupported(kDeviceGetSPIFlashVersion) == 3; break;
1918  case kDeviceHasSPIv4: outValue = GetNumSupported(kDeviceGetSPIFlashVersion) == 4; break;
1919  case kDeviceIs64Bit: outValue = ::NTV2DeviceIs64Bit(devID); break; // Deprecate?
1920  case kDeviceIsDirectAddressable: outValue = ::NTV2DeviceIsDirectAddressable(devID); break; // Deprecate?
1921  case kDeviceIsExternalToHost: outValue = ::NTV2DeviceIsExternalToHost(devID); break;
1922  case kDeviceIsLocalPhysical: outValue = !IsRemote(); break;
1923  case kDeviceIsSupported: outValue = ::NTV2DeviceIsSupported(devID); break;
1924  case kDeviceNeedsRoutingSetup: outValue = ::NTV2DeviceNeedsRoutingSetup(devID); break; // Deprecate?
1926  case kDeviceCanThermostat: outValue = ::NTV2DeviceCanThermostat(devID); break;
1927  case kDeviceHasHEVCM31: outValue = ::NTV2DeviceHasHEVCM31(devID); break;
1928  case kDeviceHasHEVCM30: outValue = ::NTV2DeviceHasHEVCM30(devID); break;
1929  case kDeviceCanDoVITC2: outValue = ::NTV2DeviceCanDoVITC2(devID); break;
1930  case kDeviceCanDoHDMIHDROut: outValue = ::NTV2DeviceCanDoHDMIHDROut(devID); break;
1931  case kDeviceCanDoJ2K: outValue = ::NTV2DeviceCanDoJ2K(devID); break;
1932  case kDeviceCanDo12gRouting: outValue = ::NTV2DeviceCanDo12gRouting(devID); break;
1933  case kDeviceCanDo12GSDI: outValue = ::NTV2DeviceCanDo12GSDI(devID); break;
1934  case kDeviceCanDo2110: outValue = ::NTV2DeviceCanDo2110(devID); break;
1935  case kDeviceCanDo8KVideo: outValue = ::NTV2DeviceCanDo8KVideo(devID); break;
1936  case kDeviceCanDoAudio192K: outValue = ::NTV2DeviceCanDoAudio192K(devID); break;
1937  case kDeviceCanDoHDMIAuxCapture: outValue = ::NTV2DeviceCanDoCustomAux(devID); break; // CanDoCustomAux == CanDoHDMIAuxCapture
1938  case kDeviceCanDoHDMIAuxPlayback: outValue = false; break; // No devices yet support aux playback
1939  case kDeviceCanDoFramePulseSelect: outValue = ::NTV2DeviceCanDoFramePulseSelect(devID); break;
1940  case kDeviceCanDoHDMIMultiView: outValue = ::NTV2DeviceCanDoHDMIMultiView(devID); break;
1941  case kDeviceCanDoHFRRGB: outValue = ::NTV2DeviceCanDoHFRRGB(devID); break;
1942  case kDeviceCanDoIP: outValue = ::NTV2DeviceCanDoIP(devID); break;
1943  case kDeviceCanDo25GIP: outValue = ::NTV2DeviceCanDo25GIP(devID); break;
1944  case kDeviceCanDoMultiLinkAudio: outValue = ::NTV2DeviceCanDoMultiLinkAudio(devID); break;
1945  case kDeviceCanDoWarmBootFPGA: outValue = ::NTV2DeviceCanDoWarmBootFPGA(devID); break;
1950  case kDeviceHasGenlockv2: outValue = GetNumSupported(kDeviceGetGenlockVersion) == 2; break; // Deprecate
1951  case kDeviceHasGenlockv3: outValue = GetNumSupported(kDeviceGetGenlockVersion) == 3; break; // Deprecate
1952  case kDeviceHasHeadphoneJack: outValue = ::NTV2DeviceHasHeadphoneJack(devID); break;
1953  case kDeviceHasLEDAudioMeters: outValue = ::NTV2DeviceHasLEDAudioMeters(devID); break;
1954  case kDeviceHasLPProductCode: outValue = ::NTV2DeviceHasLPProductCode(devID); break;
1955  case kDeviceHasRotaryEncoder: outValue = ::NTV2DeviceHasRotaryEncoder(devID); break;
1956  case kDeviceHasSPIv5: outValue = ::NTV2DeviceGetSPIFlashVersion(devID) == 5; break;
1957  case kDeviceHasXilinxDMA: outValue = ::NTV2DeviceHasXilinxDMA(devID); break;
1958  case kDeviceCanDoStreamingDMA: outValue = devID == DEVICE_ID_KONAXM; break;
1959  case kDeviceHasPWMFanControl: outValue = ::NTV2DeviceHasPWMFanControl(devID); break;
1961  || GetNumSupported(kDeviceGetNumHDMIVideoOutputs)) // At least 1 HDMI in/out
1962  && (GetDeviceID() != DEVICE_ID_KONAHDMI) // Not a KonaHDMI
1963  && (!IsSupported(kDeviceCanDoAudioMixer)); // No audio mixer
1964  break;
1967  case kDeviceCanDoVersalSysMon: outValue = ::NTV2DeviceCanDoVersalSysMon(devID); break;
1968 
1970  case kDeviceCanDoP2PReceive: { // K3G+P2P K3GQ+P2P K4Q K4UFC Crv44 Crv88
1971  static const ULWordSet sDevIDsXmit = {0xDB07, 0xDB08, 0xEB0B, 0xEB0C, 0xEB0E, 0xEB0D},
1972  sDevIDsRcv = {0xDB07, 0xDB08, 0xEB0C, 0xEB0E, 0xEB0D};
1973  const ULWordSet & devIDs (inParamID == kDeviceCanDoP2PTransmit ? sDevIDsXmit : sDevIDsRcv);
1974  ULWord pciDevID(0); if (!ReadRegister (kVRegPCIDeviceID, pciDevID)) return false;
1975  outValue = devIDs.find(pciDevID) != devIDs.end();
1976  return true;
1977  }
1978  case kDeviceCanDoFastBitfileSwitching: outValue = ( (devID == DEVICE_ID_KONA5) ||
1979  (devID == DEVICE_ID_KONA5_8KMK) ||
1980  (devID == DEVICE_ID_KONA5_8K) ||
1981  (devID == DEVICE_ID_KONA5_8K_MV_TX) ||
1982  (devID == DEVICE_ID_KONA5_2X4K) ||
1983  (devID == DEVICE_ID_KONA5_3DLUT) ||
1984  (devID == DEVICE_ID_CORVID44_2X4K) ||
1985  (devID == DEVICE_ID_CORVID44_8K) ||
1986  (devID == DEVICE_ID_CORVID44_8KMK) ||
1987  (devID == DEVICE_ID_CORVID44_GEN3) ||
1988  (devID == DEVICE_ID_CORVID44_PLNR)
1989  ) ? 1 : 0; break;
1990 
1993  default: return false; // Bad param
1994  } // switch on inParamID
1995  return true;
1996 } // GetBoolParamWithDeviceID
1997 
1998 bool CNTV2DriverInterface::GetRegInfoForBoolParam (const NTV2BoolParamID inParamID, NTV2RegInfo & outRegInfo, bool & outFlipSense)
1999 {
2000  outRegInfo.MakeInvalid();
2001  outFlipSense = false;
2002  switch (inParamID)
2003  {
2012 
2014  { ULWord canDoBOB(0);
2015  // kDeviceHasBreakoutBoard's sense is opposite of "BOBAbsent", so set outFlipSense 'true':
2017  if (GetBoolParam (kDeviceCanDoBreakoutBoard, canDoBOB) && canDoBOB)
2018  outFlipSense = true; // Non-BOB devices likely to return 0 from kRegBOBStatus, so only flip result on CanDoBOB devices
2019  break;
2020  }
2021  default: break;
2022  }
2023  return outRegInfo.IsValid();
2024 }
2025 
2026 
2027 bool CNTV2DriverInterface::GetNumericParam (const ULWord inParamID, ULWord & outVal)
2028 {
2029  outVal = 0;
2030 
2031  // Remote/virtual device gets first dibs on answering...
2032  if (IsRemote() && _pRPCAPI->NTV2GetNumericParamRemote (inParamID, outVal))
2033  return true;
2034 
2035  // Is there a register that can answer this query?
2036  const NTV2NumericParamID paramID (NTV2NumericParamID(inParamID+0));
2037  { NTV2RegInfo regInfo;
2038  if (GetRegInfoForNumericParam (paramID, regInfo))
2039  return ReadRegister (regInfo.registerNumber, outVal, regInfo.registerMask, regInfo.registerShift);
2040  }
2041  return GetNumericParamWithDeviceID (paramID, outVal); // Call classic device features function
2042 } // GetNumericParam
2043 
2044 bool CNTV2DriverInterface::GetNumericParamWithDeviceID (const ULWord paramID, ULWord & outVal) // STATIC
2045 {
2046  outVal = 0;
2047  const NTV2DeviceID devID(GetDeviceID());
2048  switch (paramID)
2049  {
2050  case kDeviceGetActiveMemorySize: outVal = ::NTV2DeviceGetActiveMemorySize(devID); break;
2051  case kDeviceGetDACVersion: outVal = ::NTV2DeviceGetDACVersion(devID); break;
2053  case kDeviceGetGenlockVersion: outVal = ULWord(::NTV2DeviceGetGenlockVersion(devID)); break;
2054  case kDeviceGetHDMIVersion: outVal = ::NTV2DeviceGetHDMIVersion(devID); break;
2055  case kDeviceGetLUTVersion: outVal = ::NTV2DeviceGetLUTVersion(devID); break;
2056  case kDeviceGetMaxAudioChannels: outVal = ::NTV2DeviceGetMaxAudioChannels(devID); break;
2058  case kDeviceGetMaxTransferCount: outVal = ::NTV2DeviceGetMaxTransferCount(devID); break;
2061  case kDeviceGetNum25GSFPs: outVal = ::NTV2DeviceGetNum25GSFPs(devID); break;
2069  case kDeviceGetNumAudioSystems: outVal = ::NTV2DeviceGetNumAudioSystems(devID); break;
2071  + (IsSupported(kDeviceCanDoAudioMixer) ? 1 : 0); break;
2073  case kDeviceGetNumCSCs: outVal = ::NTV2DeviceGetNumCSCs(devID); break;
2074  case kDeviceGetNumDMAEngines: outVal = ::NTV2DeviceGetNumDMAEngines(devID); break;
2078  case kDeviceGetNumFrameStores: outVal = ::NTV2DeviceGetNumFrameStores(devID); break;
2079  case kDeviceGetNumFrameSyncs: outVal = ::NTV2DeviceGetNumFrameSyncs(devID); break;
2085  case kDeviceGetNumLTCInputs: outVal = ::NTV2DeviceGetNumLTCInputs(devID); break;
2086  case kDeviceGetNumLTCOutputs: outVal = ::NTV2DeviceGetNumLTCOutputs(devID); break;
2087  case kDeviceGetNumLUTs: outVal = ::NTV2DeviceGetNumLUTs(devID); break;
2088  case kDeviceGetNumLUTBanks: outVal = ::NTV2DeviceGetNumLUTBanks(devID); break;
2089  case kDeviceGetNumMixers: outVal = ::NTV2DeviceGetNumMixers(devID); break;
2092  case kDeviceGetNumSerialPorts: outVal = ::NTV2DeviceGetNumSerialPorts(devID); break;
2093  case kDeviceGetNumTSIMuxers: { static const NTV2WidgetID s425MuxerIDs[] = {NTV2_Wgt425Mux1, NTV2_Wgt425Mux2,
2096  for (size_t ndx(0); ndx < sizeof(s425MuxerIDs)/sizeof(NTV2WidgetID); ndx++)
2097  if (wgtIDs.find(s425MuxerIDs[ndx]) != wgtIDs.end())
2098  outVal++;
2099  break;
2100  }
2101  case kDeviceGetNumUpConverters: outVal = ::NTV2DeviceGetNumUpConverters(devID); break;
2102  case kDeviceGetNumVideoChannels: outVal = ::NTV2DeviceGetNumVideoChannels(devID); break;
2103  case kDeviceGetNumVideoInputs: outVal = ::NTV2DeviceGetNumVideoInputs(devID); break;
2104  case kDeviceGetNumVideoOutputs: outVal = ::NTV2DeviceGetNumVideoOutputs(devID); break;
2105  case kDeviceGetPingLED: outVal = ::NTV2DeviceGetPingLED(devID); break;
2106  case kDeviceGetSPIFlashVersion: outVal = ::NTV2DeviceGetSPIFlashVersion(devID); break;
2108  + (IsSupported(kDeviceCanDoAudioMixer) ? 2 : 0); break;
2109  case kDeviceGetUFCVersion: outVal = ::NTV2DeviceGetUFCVersion(devID); break;
2110  default: return false; // Bad param
2111  }
2112  return true;
2113 } // GetNumericParamWithDeviceID
2114 
2115 
2117 {
2118  outRegInfo.MakeInvalid();
2119  switch (inParamID)
2120  {
2122  default: break;
2123  }
2124  return outRegInfo.IsValid();
2125 }
2126 
2127 
2129 { (void)msgSet; (void) enable;
2130  return false;
2131 }
UWord NTV2DeviceGetNum25GSFPs(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDoConversionMode(const NTV2DeviceID inDeviceID, const NTV2ConversionMode inConversionMode)
NTV2Channel mChannel
Stream channel.
UWord NTV2DeviceGetNumUpConverters(const NTV2DeviceID inDeviceID)
std::set< NTV2VideoFormat > NTV2VideoFormatSet
A set of distinct NTV2VideoFormat values.
#define NTV2_IS_VALID_NTV2ReferenceSource(__x__)
Definition: ntv2enums.h:1488
See Io XT.
Definition: ntv2enums.h:44
virtual bool GetNumericParam(const ULWord inParamID, ULWord &outValue)
Answers with the numeric value of the given parameter of interest.
virtual bool ControlDriverDebugMessages(NTV2_DriverDebugMessageSet msgSet, bool enable)
Everything needed to call CNTV2Card::ReadRegister or CNTV2Card::WriteRegister functions.
#define BITSTREAM_READ_REGISTERS
Used in NTV2Bitstream to get status registers.
bool NTV2DeviceCanDoLTC(const NTV2DeviceID inDeviceID)
NTV2StandardSet::const_iterator NTV2StandardSetConstIter
A handy const iterator for iterating over an NTV2StandardSet.
ULWord mFlags
Action flags.
The number of cross-converters on the device.
std::set< NTV2FrameBufferFormat > NTV2FrameBufferFormatSet
A set of distinct NTV2FrameBufferFormat values.
#define ARFAIL(__x__)
enum _NTV2NumericParamID NTV2NumericParamID
Used with CNTV2DriverInterface::GetNumericParam to determine device capabilities. ...
virtual std::string ParseHeaderFromBuffer(const uint8_t *inBitfileBuffer, const size_t inBufferSize)
Parse a bitfile header that&#39;s stored in a buffer.
virtual bool GetRegInfoForBoolParam(const NTV2BoolParamID inParamID, NTV2RegInfo &outRegInfo, bool &outFlipSense)
(Internal SDK use only) Answers with the NTV2RegInfo for the given parameter.
virtual bool AcquireStreamForApplicationWithReference(const ULWord inAppType, const int32_t inProcessID)
A reference-counted version of CNTV2DriverInterface::AcquireStreamForApplication useful for process g...
bool NTV2DeviceCanDoGPIO(const NTV2DeviceID inDeviceID)
virtual bool ResumeRecordRegisterWrites(void)
Resumes recording WriteRegister calls (after a prior call to PauseRecordRegisterWrites).
#define kNTV2PluginRegInfoKey_LongName
Plugin long name.
Definition: ntv2nubaccess.h:79
#define DIDBGX(__x__)
bool NTV2DeviceGetSupportedStandards(const NTV2DeviceID inDeviceID, NTV2StandardSet &outStandards)
Returns a set of distinct NTV2Standard values supported on the given device.
The number of input converter widgets on the device.
virtual bool IsSupported(const NTV2BoolParamID inParamID)
Identifies the NTV2ScanGeometry enumerated type.
The number of TSI muxers on the device. (New in SDK 17.0)
bool NTV2DeviceCanDoMultiLinkAudio(const NTV2DeviceID inDeviceID)
#define AJA_NTV2_SDK_BUILD_NUMBER
The SDK build number, an unsigned decimal integer.
Definition: ntv2version.h:16
True if device can handle 2Kx1556 (film) video.
#define kQParamVDevIndex
Device index number for .vdev virtual device.
Definition: ntv2nubaccess.h:46
NTV2OutputDestinations::const_iterator NTV2OutputDestinationsConstIter
A handy const iterator for iterating over an NTV2OutputDestinations.
True if device supports 3D video output over dual-stream SDI.
bool NTV2DeviceCanDoJ2K(const NTV2DeviceID inDeviceID)
#define kConnectParamDevSerial
Device with this serial number.
Definition: ntv2nubaccess.h:28
The version number of the device&#39;s genlock hardware/firmware. (New in SDK 17.6)
The number of SDI-embedded input audio channels supported by the device.
True if device DMA hardware supports MSI (Message Signaled Interrupts).
UWord NTV2DeviceGetNumLTCInputs(const NTV2DeviceID inDeviceID)
True if device has version 3 genlock hardware and/or firmware. (Deprecate – use kDeviceGetGenlockVer...
True if device has SPI flash hardware.
ULWord mRegisters[16]
Register data.
True if audio system(s) support 2 or more audio channels.
UWord NTV2DeviceGetNum4kQuarterSizeConverters(const NTV2DeviceID inDeviceID)
The number of analog video outputs on the device.
bool NTV2DeviceCanDoRP188(const NTV2DeviceID inDeviceID)
static bool DeviceSupported(NTV2DeviceID deviceId)
#define DIDBG(__x__)
UWord NTV2DeviceGetNumCrossConverters(const NTV2DeviceID inDeviceID)
std::set< NTV2FrameRate > NTV2FrameRateSet
A set of distinct NTV2FrameRate values. New in SDK 17.0.
True if device can do ISO conversion.
True if device has enhanced CSCs.
virtual bool ReadFlashULWord(const ULWord inAddress, ULWord &outValue, const ULWord inRetryCount=1000)
Specifies the device&#39;s internal clock.
Definition: ntv2enums.h:1464
UWord NTV2DeviceGetNumAnalogAudioOutputChannels(const NTV2DeviceID inDeviceID)
virtual bool NTV2GetNumericParamRemote(const ULWord inParamID, ULWord &outValue)
Declares the CNTV2DriverInterface base class.
ULWord registerMask
My register mask value to use in a ReadRegister or WriteRegister call.
The number of external reference video inputs on the device.
static bool GetDeviceInfoForModel(const std::string &inModelName, NTV2DeviceInfo &outDeviceInfo, const bool inRescan=(0))
NTV2DeviceIDSet NTV2GetSupportedDevices(const NTV2DeviceKinds inKinds=NTV2_DEVICEKIND_ALL)
Returns an NTV2DeviceIDSet of devices supported by the SDK.
Definition: ntv2utils.cpp:7397
bool NTV2DeviceCanDo25GIP(const NTV2DeviceID inDeviceID)
UWord NTV2DeviceGetNum2022ChannelsSFP1(const NTV2DeviceID inDeviceID)
True if the device supports SMPTE 425 mux control.
bool NTV2DeviceCanThermostat(const NTV2DeviceID inDeviceID)
virtual bool CloseRemote(void)
Releases host resources associated with the remote/special device connection.
static void SetShareMode(const bool inSharedMode)
Specifies if subsequent Open calls should open the device in shared mode or not.
virtual bool IsLPSystemReady(void)
See KONA IP.
Definition: ntv2enums.h:71
static uint32_t gConstructCount(0)
bool NTV2DeviceCanDoPCMControl(const NTV2DeviceID inDeviceID)
#define KVRegReleaseRefCount
bool NTV2DeviceCanDoDSKOpacity(const NTV2DeviceID inDeviceID)
See Io IP.
Definition: ntv2enums.h:41
The number of video channels supported on the device.
ULWord mFlags
Action flags.
See KONA 5.
Definition: ntv2enums.h:55
UWord _boardNumber
My device index number.
The number of mixer/keyer widgets on the device.
NTV2FrameBufferFormat
Identifies a particular video frame buffer pixel format. See Device Frame Buffer Formats for details...
Definition: ntv2enums.h:223
True if device can squeeze/stretch between 1920x1080/1280x1080 and 1280x720/960x720.
#define BIT(_x_)
Definition: ajatypes.h:496
True if device can do 3G level B to 3G level A conversion.
True if device supports an AJA breakout box.
NTV2TaskMode
Describes the task mode state. See also: NTV2 Device Sharing.
Identifies the NTV2DeviceID enumerated type.
The number of analog LTC outputs on the device.
The number of AES/EBU audio output channels on the device.
See KONA 5.
Definition: ntv2enums.h:63
#define BITSTREAM_SUSPEND
Used in peta to suspend board before bitstream load.
Declares the AJADebug class.
See KONA LHe Plus.
Definition: ntv2enums.h:78
std::string valueForKey(const std::string &inKey) const
const std::string & DeviceSpec(void) const
NTV2InputVideoSelect
Definition: ntv2enums.h:2301
True if HDMI in/out supports square-division (quad) raster conversion. (New in SDK 17...
UWord NTV2DeviceGetNumFrameSyncs(const NTV2DeviceID inDeviceID)
See KONA 5.
Definition: ntv2enums.h:56
std::set< NTV2InputSource > NTV2InputSourceSet
A set of distinct NTV2InputSource values.
See Corvid 88.
Definition: ntv2enums.h:32
#define NEW_SELECT_RP188_RCVD
virtual bool GetBoolParamWithDeviceID(const ULWord inParamID, ULWord &outValue)
(Internal SDK use only) Answers with the boolean value returned from the appropriate "ntv2devicefeatu...
ULWord NTV2DeviceGetActiveMemorySize(const NTV2DeviceID inDeviceID)
enum _NTV2EnumsID NTV2EnumsID
Identifies NTV2 enumerated types, used in CNTV2DriverInterface::GetSupportedItems.
True if device can warm-boot to load updated firmware.
virtual UWord GetIndexNumber(void) const
virtual bool IsDeviceReady(const bool inCheckValid=(0))
bool NTV2DeviceCanDoHDMIOutStereo(const NTV2DeviceID inDeviceID)
bool NTV2DeviceHasNTV4FrameStores(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDoAnalogAudio(const NTV2DeviceID inDeviceID)
#define kNTV2PluginRegInfoKey_Copyright
Plugin copyright notice.
Definition: ntv2nubaccess.h:81
True if device can display/output video from FrameStore 1.
The number of independent Audio Systems on the device.
bool NTV2DeviceHasLPProductCode(const NTV2DeviceID inDeviceID)
void setDeviceIndexNumber(const UWord num)
Identifies the NTV2AudioRate enumerated type.
#define kNTV2PluginRegInfoKey_Vendor
Plugin vendor (manufacturer) name.
Definition: ntv2nubaccess.h:75
virtual bool DriverGetBuildInformation(BUILD_INFO_STRUCT &outBuildInfo)
Answers with the driver&#39;s build information.
True if device has version 2 genlock hardware and/or firmware. (Deprecate – use kDeviceGetGenlockVer...
ULWord NTV2DeviceGetLUTVersion(const NTV2DeviceID inDeviceID)
#define NTV2_IS_VALID_INTERRUPT_ENUM(__e__)
bool Failed(void) const
See Corvid 24.
Definition: ntv2enums.h:24
UWord NTV2DeviceGetNumEmbeddedAudioOutputChannels(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDo425Mux(const NTV2DeviceID inDeviceID)
Identifies the NTV2OutputDest enumerated type.
enum _NTV2BoolParamID NTV2BoolParamID
Used with CNTV2DriverInterface::GetBoolParam to determine device capabilities.
bool NTV2DeviceCanDoMultiFormat(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDo12GSDI(const NTV2DeviceID inDeviceID)
True if device can report if its "fail-safe" firmware is loaded/running.
bool NTV2DeviceHasSPIFlash(const NTV2DeviceID inDeviceID)
True if device connects to the host with a cable.
#define DIFAIL(__x__)
bool NTV2DeviceCanDoEnhancedCSC(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDoStereoOut(const NTV2DeviceID inDeviceID)
ULWord GetByteCount(void) const
UWord NTV2DeviceGetNumDownConverters(const NTV2DeviceID inDeviceID)
#define kNTV2PluginRegInfoKey_ShortName
Plugin short name.
Definition: ntv2nubaccess.h:78
True if device can detect which audio channel pairs are not carrying PCM (Pulse Code Modulation) audi...
UWord NTV2DeviceGetNumSerialPorts(const NTV2DeviceID inDeviceID)
Configure interrupt (subscribe/unsubscribe, enable/disable, query subscribed interrupts, query enabled interrupts, etc.).
True if device reports genlock frequencies. (New in SDK 18.1)
virtual bool Close(void)
Closes me, releasing host resources that may have been allocated in a previous Open call...
static bool PatchDeviceInfo(const UWord inDevIndex, CNTV2DriverInterface &dev)
virtual bool ConfigureInterrupt(const bool bEnable, const INTERRUPT_ENUMS eInterruptType)
virtual void FinishOpen(void)
Initializes my member variables after a successful Open.
virtual bool GetBoolParam(const ULWord inParamID, ULWord &outValue)
Answers with the boolean value of the given parameter of interest.
int32_t LWord
Definition: ajatypes.h:235
One-stop shop for parsing device specifications. (New in SDK 16.3) I do very little in the way of val...
bool NTV2DeviceCanDoProRes(const NTV2DeviceID inDeviceID)
Declares the AJATime class.
See KONA IP25.
Definition: ntv2enums.h:75
True if device supports fast bitfile switching. (New in SDK 18.1)
True if device has an HEVC M31 encoder.
virtual bool IsRecordingRegisterWrites(void) const
virtual bool Open(const UWord inDeviceIndex)
Opens a local/physical AJA device so it can be monitored/controlled.
True if device has LED audio meters.
virtual bool NTV2GetSupportedRemote(const ULWord inEnumsID, ULWordSet &outSupported)
#define NTV2_FOURCC(_a_, _b_, _c_, _d_)
UWord NTV2DeviceGetNumCSCs(const NTV2DeviceID inDeviceID)
if(!(riid==IID_IUnknown) &&!(riid==IID_IClassFactory))
Definition: dllentry.cpp:196
The version number of the LUT(s) on the device.
Identifies the NTV2VideoFormat enumerated type.
See KONA 4 (Quad Mode).
Definition: ntv2enums.h:48
virtual bool HasConnectParam(const std::string &inParam) const
True if device has SFP connectors.
#define BITSTREAM_RESUME
Used in peta to resume board after bitstream load.
The "default" timecode (mostly used by the AJA "Retail" service and Control Panel) ...
Definition: ntv2enums.h:3959
#define VDFAIL(__x__)
static bool GetShareMode(void)
Identifies the NTV2Channel enumerated type.
True if device widget routing can be queried or changed.
True if device can do video processing.
void MakeInvalid(void)
Invalidates me, setting my register number, value, mask and shift values to 0xFFFFFFFF.
Identifies the NTV2InputSource enumerated type.
ULWord mDelay
Trial delay (us)
virtual bool ReleaseStreamForApplication(const ULWord inAppType, const int32_t inProcessID)
Releases exclusive use of the AJA device for the given process, permitting other processes to acquire...
True if the device can do RGB over 3G Level A.
Definition: json.hpp:5362
NTV2_DriverDebugMessageSet
Definition: ntv2enums.h:3835
See KONA 5.
Definition: ntv2enums.h:58
std::set< NTV2OutputDestination > NTV2OutputDestinations
A set of distinct NTV2OutputDestination values.
ULWord count(void) const
static void SetOverlappedMode(const bool inOverlapMode)
Specifies if the next Open call should try to open the device in overlapped mode or not...
static bool GetDeviceInfoForSerial(const std::string &inSerialNum, NTV2DeviceInfo &outDeviceInfo, const bool inRescan=(0))
The maximum number of 32-bit words that the DMA engine can move at a time on the device.
True if device can handle QRez.
#define false
UWord NTV2DeviceGetNumAnalogVideoInputs(const NTV2DeviceID inDeviceID)
const uint32_t kAgentAppFcc(((((uint32_t)( 'A'))<< 24)|(((uint32_t)( 'j'))<< 16)|(((uint32_t)( 'a'))<< 8)|(((uint32_t)( 'A'))<< 0)))
UWord NTV2DeviceGetGenlockVersion(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDoIsoConvert(const NTV2DeviceID inDeviceID)
See KONA 1.
Definition: ntv2enums.h:45
#define AJA_NTV2_SDK_VERSION_POINT
The SDK "point" release version, an unsigned decimal integer.
Definition: ntv2version.h:15
uint32_t ULWord
Definition: ajatypes.h:236
The number of DMA engines on the device.
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...
virtual bool StartRecordRegisterWrites(const bool inSkipActualWrites=(0))
Starts recording all WriteRegister calls.
See KONA 5.
Definition: ntv2enums.h:65
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They&#39;re also commonly use...
Definition: ntv2enums.h:1361
#define BITSTREAM_FRAGMENT
Used in NTV2Bitstream to indicate bitstream is a fragment.
virtual bool SetInterruptEventCount(const INTERRUPT_ENUMS inEventCode, const ULWord inCount)
Sets the interrupt event tally for the given interrupt type for this CNTV2Card/CNTV2DriverInterface i...
virtual NTV2Dictionary ConnectParams(void) const
True if Audio System(s) support an adjustable delay.
True if device supports an AJA breakout board. (New in SDK 17.0)
Declares NTV2 "nub" client functions.
virtual bool GetNumericParamWithDeviceID(const ULWord inParamID, ULWord &outValue)
(Internal SDK use only) Answers with the numeric value returned from the appropriate "ntv2devicefeatu...
bool NTV2DeviceCanDoMSI(const NTV2DeviceID inDeviceID)
True if device can directly transmit data to another PCIe device via peer-to-peer DMA...
See Io 4K Plus.
Definition: ntv2enums.h:37
static bool gSharedMode((0))
bool hasKey(const std::string &inKey) const
#define kConnectParamDevModel
First device of this model (e.g. &#39;kona4&#39;)
Definition: ntv2nubaccess.h:29
#define NTV2DriverVersionDecode_Major(__vers__)
NTV2FrameRateSet::const_iterator NTV2FrameRateSetConstIter
A handy const iterator for iterating over an NTV2FrameRateSet.
virtual bool BitstreamLoad(const bool inSuspend, const bool inResume)
std::set< NTV2Standard > NTV2StandardSet
A set of distinct NTV2Standard values.
See Corvid 44.
Definition: ntv2enums.h:26
True if device supports grouped audio system control.
#define NTV2DriverVersionDecode_Point(__vers__)
bool NTV2DeviceNeedsRoutingSetup(const NTV2DeviceID inDeviceID)
#define NTV2_ASSERT(_expr_)
Definition: ajatypes.h:489
The number of SDI video outputs on the device.
virtual bool NTV2DMATransferRemote(const NTV2DMAEngine inDMAEngine, const bool inIsRead, const ULWord inFrameNumber, NTV2Buffer &inOutBuffer, const ULWord inCardOffsetBytes, const ULWord inNumSegments, const ULWord inSegmentHostPitch, const ULWord inSegmentCardPitch, const bool inSynchronous)
#define kConnectParamDevID
First device having this ID (e.g. &#39;0x10518400&#39;)
Definition: ntv2nubaccess.h:30
Output (playout, display) mode, which reads from device SDRAM.
Definition: ntv2enums.h:1246
See KONA 3G (Quad Mode).
Definition: ntv2enums.h:47
True if device supports streaming DMA. (New in SDK 17.1)
bool NTV2DeviceSoftwareCanChangeFrameBufferSize(const NTV2DeviceID inDeviceID)
bool NTV2DeviceIs64Bit(const NTV2DeviceID inDeviceID)
bool IsLocalDevice(void) const
bool NTV2DeviceCanDoFrameStore1Display(const NTV2DeviceID inDeviceID)
NTV2GeometrySet::const_iterator NTV2GeometrySetConstIter
A handy const iterator for iterating over an NTV2GeometrySet.
NTV2FrameBufferFormat NTV2PixelFormat
An alias for NTV2FrameBufferFormat.
Definition: ntv2enums.h:264
virtual size_t GetProgramStreamLength(void) const
Definition: ntv2bitfile.h:210
NTV2ConfigInterrupt & doGetCount(const INTERRUPT_ENUMS id)
Get interruptID count.
virtual bool AcquireStreamForApplication(const ULWord inAppType, const int32_t inProcessID)
Reserves exclusive use of the AJA device for a given process, preventing other processes on the host ...
True if device has any audio output capability (SDI, HDMI or analog) (New in SDK 17.1)
The total number of audio systems on the device, including host audio and mixer audio systems...
bool NTV2DeviceHasSPIFlashSerial(const NTV2DeviceID inDeviceID)
virtual bool NTV2GetBoolParamRemote(const ULWord inParamID, ULWord &outValue)
virtual bool IsRemote(void) const
See KONA 5.
Definition: ntv2enums.h:66
bool NTV2DeviceCanReportFailSafeLoaded(const NTV2DeviceID inDeviceID)
bool NTV2DeviceHasBiDirectionalAnalogAudio(const NTV2DeviceID inDeviceID)
True if device is 64-bit addressable.
True if device can read LTC (Linear TimeCode) from its reference input.
See T-TAP.
Definition: ntv2enums.h:94
NTV2TCIndex
These enum values are indexes into the capture/playout AutoCirculate timecode arrays.
Definition: ntv2enums.h:3957
True if device can mark specific audio channel pairs as not carrying PCM (Pulse Code Modulation) audi...
Specifies the External Reference connector.
Definition: ntv2enums.h:1461
True if device SDI connectors are bi-directional.
bool GetRegisterValues(NTV2RegisterValueMap &outValues) const
Returns an NTV2RegisterValueMap built from my mOutGoodRegisters and mOutValues fields.
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 ...
Identifies the NTV2AudioSource enumerated type.
UWord NTV2DeviceGetNumHDMIVideoOutputs(const NTV2DeviceID inDeviceID)
I&#39;m the base class that undergirds the platform-specific derived classes (from which CNTV2Card is ult...
An object that can connect to, and operate remote or fake devices. I have three general API groups: ...
True if device has CSCs capable of splitting the key (alpha) and YCbCr (fill) from RGB frame buffers ...
The version number of the UFC on the device.
True if device has at least one programmable color space converter widget.
See KONA 5.
Definition: ntv2enums.h:62
True if device supports 3D video input over dual-stream SDI.
True if device supports Programmed I/O.
static ULWord gRecursionCheck(0)
bool NTV2DeviceCanDoInputTCIndex(const NTV2DeviceID inDeviceID, const NTV2TCIndex inTCIndex)
True if device SPIFlash ROM is bank-selected. (New in SDK 17.1)
virtual std::string GetDesignName(void) const
Definition: ntv2bitfile.h:139
The highest register number for the device.
Identifies the NTV2RefSource enumerated type.
ULWord registerValue
My register value to use in a ReadRegister or WriteRegister call.
Use kDeviceGetSPIVersion instead.
UWord NTV2DeviceGetNumInputConverters(const NTV2DeviceID inDeviceID)
static NTV2StringList GetLegalSchemeNames(void)
NTV2DeviceID
Identifies a specific AJA NTV2 device model number. The NTV2DeviceID is actually the PROM part number...
Definition: ntv2enums.h:20
virtual bool SetStreamingApplication(const ULWord inAppType, const int32_t inProcessID)
Forcibly sets the four-CC type and process ID of the application that should "own" the AJA device (i...
See KONA 5.
Definition: ntv2enums.h:57
ULWord registerNumber
My register number to use in a ReadRegister or WriteRegister call.
UWord NTV2DeviceGetNumLUTBanks(const NTV2DeviceID inDeviceID)
The highest bit number of the LED bits in the Global Control Register on the device.
bool NTV2DeviceCanDoDualLink(const NTV2DeviceID inDeviceID)
NTV2DeviceID _boardID
My cached device ID.
bool NTV2DeviceCanDoWidget(const NTV2DeviceID inDeviceID, const NTV2WidgetID inWidgetID)
Enumerations for controlling NTV2 devices.
virtual bool PauseRecordRegisterWrites(void)
Pauses recording WriteRegister calls.
void Set(const ULWord inRegNum, const ULWord inValue, const ULWord inMask=0xFFFFFFFF, const ULWord inShift=0)
Sets me from the given parameters.
The number of FrameStores on the device.
int16_t Word
Definition: ajatypes.h:233
virtual bool NTV2Disconnect(void)
Disconnects me from the remote/fake host, closing the connection.
See Io 4K (Quad Mode).
Definition: ntv2enums.h:36
True if device can handle quarter-sized frames (pixel-halving and line-halving during input...
virtual bool IsOpen(void) const
virtual bool OpenLocalPhysical(const UWord inDeviceIndex)
Opens the local/physical device connection.
True if device has bypass relays on its SDI connectors.
See KONA LHi.
Definition: ntv2enums.h:79
Invalid or "not found".
Definition: ntv2enums.h:101
bool _boardOpened
True if I&#39;m open and connected to the device.
#define AJA_NTV2_SDK_VERSION_MAJOR
The SDK major version number, an unsigned decimal integer.
Definition: ntv2version.h:13
See Corvid HB-R.
Definition: ntv2enums.h:34
NTV2DeviceIDSet::const_iterator NTV2DeviceIDSetConstIter
A convenient const iterator for NTV2DeviceIDSet.
Definition: ntv2utils.h:1100
bool NTV2DeviceCanDoHDV(const NTV2DeviceID inDeviceID)
#define RPDBG(__x__)
virtual const std::string & GetLastError(void) const
Definition: ntv2bitfile.h:149
NTV2ReferenceSource
These enum values identify a specific source for the device&#39;s (output) reference clock.
Definition: ntv2enums.h:1459
std::string NTV2TaskModeToString(const NTV2TaskMode inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6357
virtual bool ReadRegisters(NTV2RegisterReads &inOutValues)
Reads the register(s) specified by the given NTV2RegInfo sequence.
virtual void BumpEventCount(const INTERRUPT_ENUMS eInterruptType)
Atomically increments the event count tally for the given interrupt type.
NTV2VideoFormatSet::const_iterator NTV2VideoFormatSetConstIter
A handy const iterator for iterating over an NTV2VideoFormatSet.
UWord NTV2DeviceGetNumFrameStores(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDoAudio96K(const NTV2DeviceID inDeviceID)
virtual bool NTV2MessageRemote(NTV2_HEADER *pInMessage)
True if device can squeeze/stretch between 1920x1080 and 1440x1080.
virtual bool Open(const std::string &inBitfilePath)
Opens the bitfile at the given path, then parses its header.
True if device supports JPEG 2000 codec.
NTV2Channel mChannel
Stream channel.
NTV2DMAEngine
Definition: ntv2enums.h:1861
#define BITSTREAM_RESET_CONFIG
Used in NTV2Bitstream to reset config.
#define AJA_NULL
Definition: ajatypes.h:180
virtual const std::string & GetTime(void) const
Definition: ntv2bitfile.h:134
True if device has attached breakout board. (New in SDK 17.0)
True if device has LED(s) on the card bracket. (New in SDK 18.0)
bool NTV2DeviceCanDoHFRRGB(const NTV2DeviceID inDeviceID)
UWord NTV2DeviceGetDownConverterDelay(const NTV2DeviceID inDeviceID)
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...
True if device has any SDI, HDMI or analog video outputs.
The number of up-converters on the device.
See KONA 5.
Definition: ntv2enums.h:61
True if device has any audio input capability (SDI, HDMI or analog) (New in SDK 17.1)
See KONA 5.
Definition: ntv2enums.h:67
True if device has a headphone jack.
bool NTV2DeviceHasPWMFanControl(const NTV2DeviceID inDeviceID)
Declares the most fundamental data types used by NTV2. Since Windows NT was the first principal devel...
std::set< NTV2WidgetID > NTV2WidgetIDSet
A collection of distinct NTV2WidgetID values.
See Corvid 44 12G.
Definition: ntv2enums.h:31
virtual bool BitstreamReset(const bool inConfiguration, const bool inInterface)
std::vector< ULWord > NTV2ULWordVector
An ordered sequence of ULWords.
virtual bool CloseLocalPhysical(void)
Releases host resources associated with the local/physical device connection.
Defines for the NTV2 SDK version number, used by ajantv2/includes/ntv2enums.h. See the ajantv2/includ...
enum _INTERRUPT_ENUMS_ INTERRUPT_ENUMS
True if device has 25Gbps SFPs. (New in SDK 18.0)
static void Sleep(const int32_t inMilliseconds)
Suspends execution of the current thread for a given number of milliseconds.
Definition: systemtime.cpp:284
See KONA 5.
Definition: ntv2enums.h:54
bool NTV2DeviceIsSupported(const NTV2DeviceID inDeviceID)
True if device has at least one RS-422 serial port, and it (they) can be programmed (for baud rate...
bool IsValid(void) const
True if device has a pair of unbalanced RCA audio monitor output connectors.
Identifies the NTV2Standard enumerated type.
ULWord NTV2DeviceGetMaxTransferCount(const NTV2DeviceID inDeviceID)
True if device uses a "stacked" arrangement of its audio buffers.
else retVal
Definition: ntv2vcam.cpp:1100
std::set< ULWord > ULWordSet
A collection of unique ULWord (uint32_t) values.
#define DIWARN(__x__)
bool mRecordRegWrites
True if recording; otherwise false when not recording.
#define BITSTREAM_MCAP_DATA
MCAP data register.
virtual bool GetRegInfoForNumericParam(const NTV2NumericParamID inParamID, NTV2RegInfo &outRegInfo)
(Internal SDK use only) Answers with the NTV2RegInfo for the given parameter.
Software device that doesn&#39;t emulate one of the above devices.
Definition: ntv2enums.h:84
#define VDNOTE(__x__)
#define kNTV2PluginRegInfoKey_Description
Brief plugin description.
Definition: ntv2nubaccess.h:80
All new NTV2 structs start with this common header.
NTV2RegWrites NTV2RegisterReads
static std::string FourCCToString(const ULWord in4CC, const char nonPrintable='?')
AJALock mRegWritesLock
Guard mutex for mRegWrites.
ULWord registerShift
My register shift value to use in a ReadRegister or WriteRegister call.
UWord NTV2DeviceGetNumMixers(const NTV2DeviceID inDeviceID)
bool NTV2DeviceGetSupportedFrameRates(const NTV2DeviceID inDeviceID, NTV2FrameRateSet &outRates)
Returns a set of distinct NTV2FrameRate values supported on the given device.
bool NTV2DeviceCanDo3GLevelConversion(const NTV2DeviceID inDeviceID)
True if device has 12G SDI connectors.
std::set< NTV2FrameGeometry > NTV2GeometrySet
A set of distinct NTV2FrameGeometry values.
bool NTV2DeviceHasLEDAudioMeters(const NTV2DeviceID inDeviceID)
True if device is supported by AJA "retail" software (AJA ControlPanel & ControlRoom).
The maximum number of audio channels that a single Audio System can support on the device...
See KONA 5.
Definition: ntv2enums.h:59
bool NTV2DeviceCanDoThunderbolt(const NTV2DeviceID inDeviceID)
bool NTV2DeviceHasBiDirectionalSDI(const NTV2DeviceID inDeviceID)
static const ULWord RECURSION_LIMIT(16)
ULWord NTV2DeviceGetHDMIVersion(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDoStereoIn(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDoPCMDetection(const NTV2DeviceID inDeviceID)
static int32_t Increment(int32_t volatile *pTarget)
Definition: atomic.cpp:82
True if device can rasterize 4 HD signals into a single HDMI output.
virtual bool NTV2WaitForInterruptRemote(const INTERRUPT_ENUMS eInterrupt, const ULWord timeOutMs)
bool NTV2DeviceGetSupportedVideoFormats(const NTV2DeviceID inDeviceID, NTV2VideoFormatSet &outFormats)
Returns a set of distinct NTV2VideoFormat values supported on the given device.
bool NTV2DeviceCanDoClockMonitor(const NTV2DeviceID inDeviceID)
ULWord NTV2DeviceGetUFCVersion(const NTV2DeviceID inDeviceID)
UWord NTV2DeviceGetNumAnalogVideoOutputs(const NTV2DeviceID inDeviceID)
virtual bool ParseFlashHeader(BITFILE_INFO_STRUCT &outBitfileInfo)
ULWord NTV2DeviceGetPingLED(const NTV2DeviceID inDeviceID)
See KONA HDMI.
Definition: ntv2enums.h:68
bool NTV2DeviceHasPCIeGen2(const NTV2DeviceID inDeviceID)
True if device supports 2nd-generation PCIe.
True if audio system(s) support 6 or more audio channels.
virtual bool GetRecordedRegisterWrites(NTV2RegisterWrites &outRegWrites) const
Answers with the recorded register writes.
static NTV2RPCClientAPI * CreateClient(NTV2ConnectParams &inParams)
Instantiates a new NTV2RPCClientAPI instance using the given NTV2ConnectParams.
bool NTV2DeviceCanReportFrameSize(const NTV2DeviceID inDeviceID)
#define NTV2_WRITEREG_PROFILING
Definition: ajatypes.h:74
True if device is local-host-attached, and not remote, software or virtual (new in SDK 17...
virtual bool ReleaseStreamForApplicationWithReference(const ULWord inAppType, const int32_t inProcessID)
A reference-counted version of CNTV2DriverInterface::ReleaseStreamForApplication useful for process g...
Specifies channel or FrameStore 2 (or the 2nd item).
Definition: ntv2enums.h:1364
See Corvid 44 12G.
Definition: ntv2enums.h:27
virtual NTV2DeviceID GetDeviceID(void)
bool NTV2DeviceHasSDIRelays(const NTV2DeviceID inDeviceID)
Identifies the NTV2FrameGeometry enumerated type.
virtual bool ReadRegisterMulti(const ULWord numRegs, ULWord *pOutWhichRegFailed, NTV2RegInfo aRegs[])
uint64_t ULWord64
Definition: ajatypes.h:239
NTV2Buffer mBuffer
Virtual address of a mail buffer and its length.
NTV2Buffer mBuffer
Virtual address of a stream buffer and its length.
NTV2ConnectParams Results(void) const
See Io Express.
Definition: ntv2enums.h:39
True if device has GPIO interface. (New in SDK 18.0)
True if frame buffer sizes are not fixed.
bool NTV2DeviceCanDo2KVideo(const NTV2DeviceID inDeviceID)
The number of quarter-size 4K/UHD down-converters on the device.
#define ARWARN(__x__)
This is used by the CNTV2Card::ReadRegisters function.
Identifies the NTV2TCIndex enumerated type for output.
ULWord NTV2DeviceGetNumDMAEngines(const NTV2DeviceID inDeviceID)
True if device is direct addressable.
True if device has any SDI, HDMI or analog video inputs.
UWord NTV2DeviceGetNumVideoInputs(const NTV2DeviceID inDeviceID)
True if device has serial SPI flash hardware.
True if device has a local processor handling the product code. (New in SDK 18.1) ...
See KONA LHi.
Definition: ntv2enums.h:80
ULWord NTV2DeviceGetNumberFrameBuffers(NTV2DeviceID id, NTV2FrameGeometry fg, NTV2FrameBufferFormat fbf)
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...
NTV2BitFileType
Definition: ntv2enums.h:3354
True if device can report its frame size.
bool NTV2DeviceCanDisableUFC(const NTV2DeviceID inDeviceID)
The number of LUT banks on the device. (New in SDK 17.0)
bool NTV2DeviceCanDo4KVideo(const NTV2DeviceID inDeviceID)
Declares the CNTV2DeviceScanner class.
True if device has any AES audio output channels (New in SDK 17.1)
virtual bool NTV2ReadRegisterRemote(const ULWord regNum, ULWord &outRegValue, const ULWord regMask, const ULWord regShift)
bool NTV2DeviceCanReportRunningFirmwareDate(const NTV2DeviceID inDeviceID)
virtual std::string GetDescription(void) const
virtual bool NTV2Message(NTV2_HEADER *pInMessage)
Sends a message to the NTV2 driver (the new, improved, preferred way).
bool NTV2DeviceCanDoRateConvert(const NTV2DeviceID inDeviceID)
static bool GetOverlappedMode(void)
ULWord deviceIndex
Device index number – this will be phased out someday.
The number of HDMI video outputs on the device.
Use kDeviceGetSPIVersion instead.
bool NTV2DeviceGetSupportedPixelFormats(const NTV2DeviceID inDeviceID, NTV2PixelFormats &outFormats)
Returns a set of distinct NTV2FrameBufferFormat values supported on the given device.
#define BITSTREAM_SWAP
Used in NTV2Bitstream to byte swap bitstream data.
The number of SDI-embedded output audio channels supported by the device.
UWord NTV2DeviceGetNumAudioSystems(const NTV2DeviceID inDeviceID)
static uint32_t gCloseCount(0)
Declares the AJAProcess class.
This is used for bitstream maintainance. (New in SDK 16.0)
See KONA 5.
Definition: ntv2enums.h:50
Describes a user-space buffer on the host computer. I have an address and a length, plus some optional attributes (allocated by SDK?, page-aligned? etc.).
The number of frame sync widgets on the device.
virtual bool DriverGetBitFileInformation(BITFILE_INFO_STRUCT &outBitFileInfo, const NTV2BitFileType inBitFileType=NTV2_VideoProcBitFile)
defined(NTV2_DEPRECATE_17_2)
bool NTV2DeviceHasAudioMonitorRCAJacks(const NTV2DeviceID inDeviceID)
See KONA IP.
Definition: ntv2enums.h:72
Use kDeviceGetSPIVersion instead.
bool NTV2DeviceGetSupportedOutputDests(const NTV2DeviceID inDeviceID, NTV2OutputDestinations &outOutputDests, const NTV2IOKinds inKinds=NTV2_IOKINDS_ALL)
Returns a set of distinct NTV2OutputDest values supported on the given device.
True if device can handle SD (Standard Definition) video.
std::string NTV2DeviceIDToString(const NTV2DeviceID inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:4608
Declares the AJAAtomic class.
bool NTV2DeviceCanDoIDSwitch(const NTV2DeviceID inDeviceID)
virtual ~CNTV2DriverInterface()
My destructor.
NTV2InputSourceSet::const_iterator NTV2InputSourceSetConstIter
A handy const iterator for iterating over an NTV2InputSourceSet.
bool NTV2DeviceCanDoSDIErrorChecks(const NTV2DeviceID inDeviceID)
True if device mixer/keyer supports adjustable opacity.
#define BITSTREAM_WRITE
Used in NTV2Bitstream to write a bitstream.
ULWord mTimeout
Timeout (us)
#define KVRegAcquireRefCount
True if device has a crosspoint connection ROM (New in SDK 17.0)
True if device supports 10-bit RGB input/output over 2-wire SDI.
bool NTV2DeviceCanDo12gRouting(const NTV2DeviceID inDeviceID)
UWord NTV2DeviceGetNumEmbeddedAudioInputChannels(const NTV2DeviceID inDeviceID)
NTV2WidgetIDSet::const_iterator NTV2WidgetIDSetConstIter
An iterator for iterating over a read-only NTV2WidgetIDSet.
#define kConnectParamDevIndex
Device having this index number.
Definition: ntv2nubaccess.h:27
True if device frame buffer size can be changed.
bool NTV2DeviceIsDirectAddressable(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDoStackedAudio(const NTV2DeviceID inDeviceID)
static uint32_t gOpenCount(0)
virtual std::string Description(void) const
True if device can directly receive data from another PCIe device via peer-to-peer DMA...
The number of analog audio output channels on the device.
See KONA 5.
Definition: ntv2enums.h:64
True if Audio System(s) support a 192kHz sample rate.
Use kDeviceGetSPIVersion instead.
True if device has one or more analog video outputs.
#define DEC(__x__)
static bool GetDeviceInfo(const ULWord inDeviceIndexNumber, NTV2DeviceInfo &outDeviceInfo, const bool inRescan=(0))
virtual bool StreamBufferOps(const NTV2Channel inChannel, NTV2Buffer &inBuffer, ULWord64 bufferCookie, ULWord flags, NTV2StreamBuffer &status)
See Corvid 22.
Definition: ntv2enums.h:23
NTV2FrameGeometry
Identifies a particular video frame geometry.
Definition: ntv2enums.h:352
UWord NTV2DeviceGetNumOutputConverters(const NTV2DeviceID inDeviceID)
std::ostream & PrintErrors(std::ostream &oss) const
The number of analog LTC inputs on the device.
bool NTV2DeviceCanDoWarmBootFPGA(const NTV2DeviceID inDeviceID)
See Corvid HEVC.
Definition: ntv2enums.h:35
bool NTV2DeviceCanDoRGBPlusAlphaOut(const NTV2DeviceID inDeviceID)
The number of analog video inputs on the device.
The total number of audio systems on the device that can read/write audio buffer memory. Includes host audio system, if present. (New in SDK 17.0)
UWord NTV2DeviceGetNumLUTs(const NTV2DeviceID inDeviceID)
True if device supports 1080p RGB at more than 50Hz frame rates.
Declares numerous NTV2 utility functions.
True if device supports 12G routing crosspoints.
virtual Word SleepMs(const LWord msec)
bool NTV2DeviceHasRetailSupport(const NTV2DeviceID inDeviceID)
The version number of the DAC on the device.
bool Set(const void *pInUserPointer, const size_t inByteCount)
Sets (or resets) me from a client-supplied address and size.
CNTV2DriverInterface()
My default constructor.
True if device can rasterize 4 HD signals into a single HDMI output.
UWord NTV2DeviceGetNum2022ChannelsSFP2(const NTV2DeviceID inDeviceID)
ULWord NTV2DeviceGetMaxRegisterNumber(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDoHDVideo(const NTV2DeviceID inDeviceID)
virtual ULWord GetNumSupported(const NTV2NumericParamID inParamID)
virtual const std::string & GetDate(void) const
Definition: ntv2bitfile.h:129
virtual bool StreamChannelOps(const NTV2Channel inChannel, ULWord flags, NTV2StreamChannel &status)
static bool GetWidgetIDs(const NTV2DeviceID inDeviceID, NTV2WidgetIDSet &outWidgets)
Returns the widget IDs supported by the given device.
virtual bool GetInterruptCount(const INTERRUPT_ENUMS eInterrupt, ULWord &outCount)
Answers with the current total number of interrupts of the given type processed by the driver&#39;s inter...
True if device supports SMPTE ST2110.
True if device can perform SDI error checking.
virtual bool OpenRemote(const NTV2DeviceSpecParser &inSpec)
Peforms the housekeeping details of opening the remote/virtual device using the given specParser...
The number of output converter widgets on the device.
AUTO_CIRC_COMMAND eCommand
True if device has any analog inputs or outputs.
True if the device can handle 4K/UHD video.
bool NTV2DeviceCanDoAudioDelay(const NTV2DeviceID inDeviceID)
static bool gOverlappedMode((0))
The number of RS-422 serial ports on the device.
#define NTV2_BITFILE_PARTNAME_STRINGLENGTH
True if device has SDI ANC inserter/extractor firmware.
UWord NTV2DeviceGetNumHDMIAudioInputChannels(const NTV2DeviceID inDeviceID)
Declares the CNTV2Bitfile class.
ULWord mFlags
Action flags.
See Io X3.
Definition: ntv2enums.h:43
bool NTV2DeviceCanDoVideoProcessing(const NTV2DeviceID inDeviceID)
NTV2WidgetID
Definition: ntv2enums.h:2914
bool NTV2DeviceCanDo8KVideo(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanChangeEmbeddedAudioClock(const NTV2DeviceID inDeviceID)
uint16_t UWord
Definition: ajatypes.h:234
#define NTV2DriverVersionDecode_Build(__vers__)
True if device supports HDMI HDR output.
True if device can measure its FPGA die temperature.
1: Standard/Retail: device configured by AJA ControlPanel, service/daemon, and driver.
_EventCounts mEventCounts
My event tallies, one for each interrupt type. Note that these.
bool NTV2DeviceCanDoQuarterExpand(const NTV2DeviceID inDeviceID)
True if there&#39;s at least one UFC, and it can be disabled.
UWord NTV2DeviceGetNumLTCOutputs(const NTV2DeviceID inDeviceID)
Specifies channel or FrameStore 1 (or the first item).
Definition: ntv2enums.h:1363
True if device can report Mixer delay. (New in SDK 18.1)
True if device can report its running (and not necessarily installed) firmware date.
bool NTV2DeviceHasNWL(const NTV2DeviceID inDeviceID)
See Corvid 44 12G.
Definition: ntv2enums.h:29
True if device supports Versal Adaptive SoC System Monitor.
Calculate based on if NTV2_WgtCSC2 is present.
See Io IP.
Definition: ntv2enums.h:40
True if device is supported by this SDK.
bool NTV2DeviceHasHEVCM31(const NTV2DeviceID inDeviceID)
bool NTV2DeviceGetSupportedInputSources(const NTV2DeviceID inDeviceID, NTV2InputSourceSet &outInputSources, const NTV2IOKinds inKinds=NTV2_IOKINDS_ALL)
Returns a set of distinct NTV2InputSource values supported on the given device.
static bool GetDeviceInfoForID(const NTV2DeviceID inID, NTV2DeviceInfo &outDeviceInfo, const bool inRescan=(0))
bool NTV2DeviceCanDoRGBLevelAConversion(const NTV2DeviceID inDeviceID)
#define xHEX0N(__x__, __n__)
bool NTV2DeviceIsExternalToHost(const NTV2DeviceID inDeviceID)
A simple (not thread-safe) set of key/value pairs. (New in SDK 16.3)
The number of microphone inputs on the device.
The number of HDMI audio input channels on the device.
True if device supports frame pulse source independent of reference source.
bool NTV2DeviceCanDoSDVideo(const NTV2DeviceID inDeviceID)
virtual bool WaitForInterrupt(const INTERRUPT_ENUMS eInterrupt, const ULWord timeOutMs=68)
Efficiently waits for the next given interrupt to be signaled on the device.
See Io 4K (UFC Mode).
Definition: ntv2enums.h:38
virtual ULWordSet GetSupportedItems(const NTV2EnumsID inEnumsID)
The number of 2022 channels configured on SFP 2 on the device.
See Corvid, Corvid 3G.
Definition: ntv2enums.h:22
True if device has any LUTs.
bool NTV2DeviceHasRotaryEncoder(const NTV2DeviceID inDeviceID)
NTV2RegWritesIter NTV2RegisterReadsIter
True if device has HDMI AUX data extractor(s).
#define NTV2_IS_VALID_AUDIO_SOURCE(_x_)
Definition: ntv2enums.h:2025
bool NTV2DeviceCanDoAudio192K(const NTV2DeviceID inDeviceID)
True if device can read LTC (Linear TimeCode) from one of its inputs.
See KONA 5.
Definition: ntv2enums.h:51
#define NTV2DriverVersionDecode_Minor(__vers__)
The SPI-flash version on the device. (New in SDK 17.1)
True if device supports 3D/stereo HDMI video output.
See Corvid 88 (Gen3).
Definition: ntv2enums.h:33
NTV2AudioSource
This enum value determines/states where an audio system will obtain its audio samples.
Definition: ntv2enums.h:2010
The down-converter delay on the device.
True if device has a PWM-controlled cooling fan. (New in SDK 17.1)
bool NTV2DeviceHasHeadphoneJack(const NTV2DeviceID inDeviceID)
virtual const std::string & GetPartName(void) const
Definition: ntv2bitfile.h:144
bool NTV2DeviceCanDoHDMIHDROut(const NTV2DeviceID inDeviceID)
#define DIINFO(__x__)
#define BITSTREAM_RESET_MODULE
Used in NTV2Bitstream to reset module.
std::string vdevUrl
See Corvid 44 12G.
Definition: ntv2enums.h:28
Input (capture) mode, which writes into device SDRAM.
Definition: ntv2enums.h:1248
virtual bool StopRecordRegisterWrites(void)
Stops recording all WriteRegister calls.
bool NTV2DeviceGetSupportedGeometries(const NTV2DeviceID inDeviceID, NTV2GeometrySet &outGeometries)
Returns a set of distinct NTV2FrameGeometry values supported on the given device. ...
bool NTV2DeviceCanDoDVCProHD(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDoBreakoutBoard(const NTV2DeviceID inDeviceID)
virtual bool NTV2WriteRegisterRemote(const ULWord regNum, const ULWord regValue, const ULWord regMask, const ULWord regShift)
UWord NTV2DeviceGetNumVideoOutputs(const NTV2DeviceID inDeviceID)
True if device has NorthWest Logic DMA hardware.
ULWord NTV2DeviceGetFrameBufferSize(NTV2DeviceID id, NTV2FrameGeometry fg, NTV2FrameBufferFormat fbf)
RP188SourceFilterSelect
Private include file for all ajabase sources.
The version number of the HDMI chipset on the device.
virtual bool GetInterruptEventCount(const INTERRUPT_ENUMS inEventCode, ULWord &outCount)
Answers with the current number of interrupt events that this CNTV2Card/CNTV2DriverInterface instance...
bool NTV2DeviceCanDoCustomAnc(const NTV2DeviceID inDeviceID)
True if device audio systems can wait for VBI before starting. (New in SDK 17.0)
The number of LUT widgets on the device.
virtual bool IsMBSystemValid(void)
bool NTV2DeviceCanDoLTCInOnRefPort(const NTV2DeviceID inDeviceID)
The number of analog audio input channels on the device.
True if audio system(s) support 8 or more audio channels.
True if device has a microphone input connector.
virtual bool BitstreamWrite(const NTV2Buffer &inBuffer, const bool inFragment, const bool inSwap)
bool NTV2DeviceCanDoVITC2(const NTV2DeviceID inDeviceID)
UWord NTV2DeviceGetNumAESAudioOutputChannels(const NTV2DeviceID inDeviceID)
std::string join(const std::vector< std::string > &parts, const std::string &delim)
Definition: common.cpp:468
True if device can insert or extract RP-188/VITC2.
ULWord NTV2DeviceGetNumVideoChannels(const NTV2DeviceID inDeviceID)
UWord NTV2DeviceGetSPIFlashVersion(const NTV2DeviceID inDeviceID)
NTV2ConversionMode
Definition: ntv2enums.h:3720
std::set< NTV2DeviceID > NTV2DeviceIDSet
A set of NTV2DeviceIDs.
Definition: ntv2utils.h:1098
True if device has an HEVC M30 encoder/decoder.
void * GetHostPointer(void) const
See KONA X™.
Definition: ntv2enums.h:83
bool NTV2DeviceCanDoBreakoutBox(const NTV2DeviceID inDeviceID)
True if device has a firmware audio mixer.
Identifies the NTV2PixelFormat enumerated type.
NTV2AudioSource NTV2InputSourceToAudioSource(const NTV2InputSource inInputSource)
Definition: ntv2utils.cpp:4905
bool NTV2DeviceCanDoProgrammableRS422(const NTV2DeviceID inDeviceID)
virtual bool BitstreamStatus(NTV2ULWordVector &outRegValues)
Instances of me can parse a bitfile.
Definition: ntv2bitfile.h:86
Identifies the NTV2TCIndex enumerated type for input.
bool NTV2DeviceHasXilinxDMA(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDoOutputTCIndex(const NTV2DeviceID inDeviceID, const NTV2TCIndex inTCIndex)
See Corvid 44 (Gen3).
Definition: ntv2enums.h:30
bool NTV2DeviceCanDoIP(const NTV2DeviceID inDeviceID)
Identifies the NTV2Mode enumerated type.
static std::string IntName(const INTERRUPT_ENUMS id)
NTV2RegisterWrites mRegWrites
Stores WriteRegister data.
The number of 25Gbps SFPs on the device. (New in SDK 18.1)
UWord NTV2DeviceGetNumHDMIAudioOutputChannels(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDoAnalogVideoIn(const NTV2DeviceID inDeviceID)
std::vector< std::string > NTV2StringList
Identifies the NTV2ConversionMode enumerated type.
virtual bool IsMBSystemReady(void)
See KONA 3G (UFC Mode).
Definition: ntv2enums.h:46
bool NTV2DeviceCanDo2110(const NTV2DeviceID inDeviceID)
True if device connects to the host using a Thunderbolt cable.
True if device has a bi-directional analog audio connector.
bool NTV2DeviceHasHEVCM30(const NTV2DeviceID inDeviceID)
std::vector< NTV2RegInfo > NTV2RegisterWrites
bool NTV2DeviceCanDoVersalSysMon(const NTV2DeviceID inDeviceID)
#define ARINFO(__x__)
bool mSkipRegWrites
True if actual register writes are skipped while recording.
See KONA X™.
Definition: ntv2enums.h:81
virtual NTV2ConnectParams ConnectParams(void) const
NTV2RPCAPI * _pRPCAPI
Points to remote or software device interface; otherwise NULL for local physical device.
bool NTV2DeviceCanDoHDMIMultiView(const NTV2DeviceID inDeviceID)
The number of 2022 channels configured on SFP 1 on the device.
NTV2RegWrites NTV2RegReads
An ordered sequence of zero or more NTV2RegInfo structs intended for ReadRegister.
std::string InfoString(void) const
bool NTV2DeviceHasBracketLED(const NTV2DeviceID inDeviceID)
virtual bool ReadRP188Registers(const NTV2Channel inChannel, RP188_STRUCT *pRP188Data)
See KONA 4 (UFC Mode).
Definition: ntv2enums.h:49
True if device has a rotary encoder volume control.
bool NTV2DeviceCanChangeFrameBufferSize(const NTV2DeviceID inDeviceID)
NTV2Channel mChannel
Mail buffer channel.
UWord NTV2DeviceGetMaxAudioChannels(const NTV2DeviceID inDeviceID)
virtual bool NTV2AutoCirculateRemote(AUTOCIRCULATE_DATA &autoCircData)
UWord NTV2DeviceGetNumHDMIVideoInputs(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDoAnalogVideoOut(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanMeasureTemperature(const NTV2DeviceID inDeviceID)
The number of colorspace converter widgets on the device.
Identifies the NTV2AudioWidgetID enumerated type.
UWord NTV2DeviceGetNumReferenceVideoInputs(const NTV2DeviceID inDeviceID)
#define NTV2_BITFILE_DESIGNNAME_STRINGLENGTH
True if device supports custom HANC packet insertion. (New in SDK 17.1)
UWord NTV2DeviceGetDACVersion(const NTV2DeviceID inDeviceID)
True if device can insert and/or extract RP-188/VITC.
True if device supports 8K video formats.
Identifies the NTV2FrameRate enumerated type.
UWord NTV2DeviceGetNumAnalogAudioInputChannels(const NTV2DeviceID inDeviceID)
True if device has NTV4 FrameStores. (New in SDK 17.0)
bool NTV2DeviceCanDoFramePulseSelect(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDoQREZ(const NTV2DeviceID inDeviceID)
virtual bool AutoCirculate(AUTOCIRCULATE_DATA &pAutoCircData)
Sends an AutoCirculate command to the NTV2 driver.
virtual bool MailBufferOps(const NTV2Channel inChannel, NTV2Buffer &inBuffer, ULWord dataSize, ULWord flags, ULWord delay, ULWord timeout, NTV2MailBuffer &status)
The number of HDMI audio output channels on the device.
ULWord mDataSize
Size of data in the buffer.
The number of SDI video inputs on the device.
True if device fan can be thermostatically controlled.
#define AJA_NTV2_SDK_VERSION_MINOR
The SDK minor version number, an unsigned decimal integer.
Definition: ntv2version.h:14
static UWord MaxNumDevices(void)
True if device can can accommodate Apple ProRes-compressed video in its frame buffers.
ULWord64 mBufferCookie
Buffer User cookie.
True if device can handle HD (High Definition) video.
Declares device capability functions.
True if device has HDMI AUX data inserter(s).
bool NTV2DeviceCanDoCustomAux(const NTV2DeviceID inDeviceID)
Packed driver version – use NTV2DriverVersionEncode, NTV2DriverVersionDecode* macros to encode/decod...
#define RPFAIL(__x__)
The size, in bytes, of the device&#39;s active RAM available for video and audio.
The number of AES/EBU audio input channels on the device.
bool NTV2DeviceCanDoPIO(const NTV2DeviceID inDeviceID)
See KONA 5.
Definition: ntv2enums.h:52
See T-TAP Pro.
Definition: ntv2enums.h:95
static bool IsValid(uint64_t pid)
Definition: process.cpp:41
#define ARDBG(__x__)
True if device has Xilinx DMA hardware.
See KONA IP25.
Definition: ntv2enums.h:74
The number of down-converters on the device.
NTV2ReferenceSource NTV2InputSourceToReferenceSource(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2ReferenceSource value.
Definition: ntv2utils.cpp:5027
True if Audio System(s) support a 96kHz sample rate.
#define PLFAIL(__x__)
virtual ULWord GetNumRecordedRegisterWrites(void) const
True if device has any AES audio inputs or outputs.
#define VDWARN(__x__)
See KONA XM™.
Definition: ntv2enums.h:82
True if device has one or more analog video inputs.
See Corvid, Corvid 3G.
Definition: ntv2enums.h:25
True if device can do frame rate conversion.
True if device has a mechanical identification switch. (New in SDK 17.1)
The number of HDMI video inputs on the device.
#define NTV2_BITFILE_DATETIME_STRINGLENGTH
See KONA 5.
Definition: ntv2enums.h:60
NTV2FrameBufferFormatSet::const_iterator NTV2FrameBufferFormatSetConstIter
A handy const iterator for iterating over an NTV2FrameBufferFormatSet.
True if device can simultaneously handle different video formats on more than one SDI input or output...
UWord NTV2DeviceGetNumAESAudioInputChannels(const NTV2DeviceID inDeviceID)
static uint32_t gDestructCount(0)