AJA NTV2 SDK  18.1.0.2149
NTV2 SDK 18.1.0.2149
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 "ntv2registersmb.h" // for SAREK_REGS
16 #include "ntv2spiinterface.h"
17 #include "ntv2utils.h"
18 #include "ntv2version.h"
19 #include "ntv2devicescanner.h" // for IsHexDigit, IsAlphaNumeric, etc.
20 #include "ajabase/system/debug.h"
21 #include "ajabase/system/atomic.h"
23 #include "ajabase/system/process.h"
24 #include "ajabase/common/common.h" // aja::join
25 #include <string.h>
26 #include <assert.h>
27 #include <iostream>
28 #include <sstream>
29 #include <algorithm>
30 #include <map>
31 
32 using namespace std;
33 
34 #define INSTP(_p_) HEX0N(uint64_t(_p_),16)
35 #define DIFAIL(__x__) AJA_sERROR (AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
36 #define DIWARN(__x__) AJA_sWARNING(AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
37 #define DINOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
38 #define DIINFO(__x__) AJA_sINFO (AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
39 #define DIDBG(__x__) AJA_sDEBUG (AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
40 
41 // Stats
42 static uint32_t gConstructCount(0); // Number of constructor calls made
43 static uint32_t gDestructCount(0); // Number of destructor calls made
44 static uint32_t gOpenCount(0); // Number of successful Open calls made
45 static uint32_t gCloseCount(0); // Number of Close calls made
46 //#define _DEBUGSTATS_ // Define this to log above construct/destruct & open/close tallies
47 #if defined(_DEBUGSTATS_)
48  #define DIDBGX(__x__) AJA_sDEBUG (AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
49 #else
50  #define DIDBGX(__x__)
51 #endif
52 
54 
56 {
57  NTV2StringList result;
58  result.push_back("ntv2nub"); result.push_back("ntv2"); result.push_back("ntv2local");
59  return result;
60 }
61 
62 static bool gSharedMode(false);
63 void CNTV2DriverInterface::SetShareMode (const bool inSharedMode) {gSharedMode = inSharedMode;}
65 static bool gOverlappedMode(false);
66 void CNTV2DriverInterface::SetOverlappedMode (const bool inOverlapMode) {gOverlappedMode = inOverlapMode;}
68 
69 
71 
73  : _boardNumber (0)
74  ,_boardID (DEVICE_ID_NOTFOUND)
75  ,_boardOpened (false)
77  ,mRecordRegWrites (false)
78  ,mSkipRegWrites (false)
79 #endif
80  ,_programStatus (0)
81  ,_pRPCAPI (AJA_NULL)
82  ,mInterruptEventHandles ()
83  ,mEventCounts ()
85  ,mRegWrites ()
86  ,mRegWritesLock ()
87 #endif // NTV2_WRITEREG_PROFILING
88 #if !defined(NTV2_DEPRECATE_16_0)
89  ,_pFrameBaseAddress (AJA_NULL)
90  ,_pRegisterBaseAddress (AJA_NULL)
91  ,_pRegisterBaseAddressLength (0)
92  ,_pXena2FlashBaseAddress (AJA_NULL)
93  ,_pCh1FrameBaseAddress (AJA_NULL)
94  ,_pCh2FrameBaseAddress (AJA_NULL)
95 #endif // !defined(NTV2_DEPRECATE_16_0)
96 #if !defined(NTV2_DEPRECATE_17_2)
97  ,_ulNumFrameBuffers (0)
98  ,_ulFrameBufferSize (0)
99 #endif
100 #if !defined(NTV2_DEPRECATE_16_0)
101  ,_pciSlot (0) // DEPRECATE!
102 #endif // !defined(NTV2_DEPRECATE_16_0)
103 {
106  mInterruptEventHandles.push_back(AJA_NULL);
107 
109  while (mEventCounts.size() < eNumInterruptTypes)
110  mEventCounts.push_back(0);
112  DIDBGX(DEC(gConstructCount) << " constructed, " << DEC(gDestructCount) << " destroyed");
113 } // constructor
114 
115 
117 {
119  if (_pRPCAPI)
120  delete _pRPCAPI;
121  _pRPCAPI = AJA_NULL;
122  DIDBGX(DEC(gConstructCount) << " constructed, " << DEC(gDestructCount) << " destroyed");
123 } // destructor
124 
125 CNTV2DriverInterface & CNTV2DriverInterface::operator = (const CNTV2DriverInterface & inRHS)
126 { (void) inRHS; NTV2_ASSERT(false && "Not assignable"); return *this;} // operator =
127 
129 { (void) inObjToCopy; NTV2_ASSERT(false && "Not copyable");} // copy constructor
130 
131 
132 // Open local physical device (via ajantv2 driver)
133 bool CNTV2DriverInterface::Open (const UWord inDeviceIndex)
134 {
135  if (IsOpen() && inDeviceIndex == GetIndexNumber())
136  return true; // Same local device requested, already open
137  Close();
138  if (inDeviceIndex >= MaxNumDevices())
139  {DIFAIL("Requested device index '" << DEC(inDeviceIndex) << "' at/past limit of '" << DEC(MaxNumDevices()) << "'"); return false;}
140  if (!OpenLocalPhysical(inDeviceIndex))
141  {
142  // Check for virtual device...
143  static ULWord sRecursionCheck(0), RECURSION_LIMIT(32);
144  NTV2DeviceInfo info;
145  if (!CNTV2DeviceScanner::GetDeviceInfo (inDeviceIndex, info))
146  return false;
147  sRecursionCheck++; // increment
148  if (sRecursionCheck > RECURSION_LIMIT)
149  {DIFAIL("Failed: " << DEC(RECURSION_LIMIT) << " '.vdev' bounces -- limit exceeded"); return false;}
150  if (!Open(info.vdevUrl))
151  {sRecursionCheck--; return false;} // Open vdev urlSpec failed
152  setDeviceIndexNumber(UWord(info.deviceIndex)); // Patch _boardNumber
153  sRecursionCheck--; // decrement
154  return true;
155  } // if OpenLocalPhysical failed
156 
157 #if !defined(NTV2_ALLOW_OPEN_UNSUPPORTED)
158  // Check if device is officially supported...
159  const NTV2DeviceIDSet legalDeviceIDs(::NTV2GetSupportedDevices());
160  if (legalDeviceIDs.find(_boardID) == legalDeviceIDs.end())
161  {
162  DIFAIL("Device ID " << xHEX0N(_boardID,8) << " (at device index " << inDeviceIndex << ") is not in list of supported devices");
163  Close();
164  return false;
165  }
166 #endif // NTV2_ALLOW_OPEN_UNSUPPORTED
167 
168  // Read driver version...
169  uint16_t drvrVersComps[4] = {0, 0, 0, 0};
170  ULWord driverVersionRaw (0);
171  if (!IsRemote() && !ReadRegister (kVRegDriverVersion, driverVersionRaw))
172  {DIFAIL("ReadRegister(kVRegDriverVersion) failed"); Close(); return false;}
173  drvrVersComps[0] = uint16_t(NTV2DriverVersionDecode_Major(driverVersionRaw)); // major
174  drvrVersComps[1] = uint16_t(NTV2DriverVersionDecode_Minor(driverVersionRaw)); // minor
175  drvrVersComps[2] = uint16_t(NTV2DriverVersionDecode_Point(driverVersionRaw)); // point
176  drvrVersComps[3] = uint16_t(NTV2DriverVersionDecode_Build(driverVersionRaw)); // build
177 
178  // Check driver version (local devices only)
179  NTV2_ASSERT(!IsRemote());
181  DIWARN ("Driver version v" << DEC(drvrVersComps[0]) << "." << DEC(drvrVersComps[1]) << "." << DEC(drvrVersComps[2]) << "."
182  << DEC(drvrVersComps[3]) << " ignored for client SDK v0.0.0.0 (dev mode), driverVersionRaw=" << xHEX0N(driverVersionRaw,8));
183  else if (drvrVersComps[0] == uint16_t(AJA_NTV2_SDK_VERSION_MAJOR))
184  DIDBG ("Driver v" << DEC(drvrVersComps[0]) << "." << DEC(drvrVersComps[1])
185  << "." << DEC(drvrVersComps[2]) << "." << DEC(drvrVersComps[3]) << " == client SDK v"
186  << DEC(uint16_t(AJA_NTV2_SDK_VERSION_MAJOR)) << "." << DEC(uint16_t(AJA_NTV2_SDK_VERSION_MINOR))
187  << "." << DEC(uint16_t(AJA_NTV2_SDK_VERSION_POINT)) << "." << DEC(uint16_t(AJA_NTV2_SDK_BUILD_NUMBER)));
188  else
189  DIWARN ("Driver v" << DEC(drvrVersComps[0]) << "." << DEC(drvrVersComps[1])
190  << "." << DEC(drvrVersComps[2]) << "." << DEC(drvrVersComps[3]) << " != client SDK v"
191  << DEC(uint16_t(AJA_NTV2_SDK_VERSION_MAJOR)) << "." << DEC(uint16_t(AJA_NTV2_SDK_VERSION_MINOR)) << "."
192  << DEC(uint16_t(AJA_NTV2_SDK_VERSION_POINT)) << "." << DEC(uint16_t(AJA_NTV2_SDK_BUILD_NUMBER))
193  << ", driverVersionRaw=" << xHEX0N(driverVersionRaw,8));
194 
195  FinishOpen();
197  DIDBGX(DEC(gOpenCount) << " opened, " << DEC(gCloseCount) << " closed");
198  return true;
199 }
200 
201 // Open remote or virtual device
202 bool CNTV2DriverInterface::Open (const string & inURLSpec)
203 {
204  Close();
206  const NTV2DeviceSpecParser specParser (inURLSpec);
207  if (specParser.HasErrors())
208  {DIFAIL("Bad device specification '" << inURLSpec << "': " << specParser.Error()); return false;}
209 
210  // URLSpecs can specify locally-attached devices...
211  if (specParser.IsLocalDevice())
212  { // Local device...
213  CNTV2Card card;
214  if (specParser.HasResult(kConnectParamDevSerial))
215  { if (CNTV2DeviceScanner::GetDeviceWithSerial(specParser.DeviceSerial(), card))
216  Open(card.GetIndexNumber());
217  }
218  else if (specParser.HasResult(kConnectParamDevModel))
219  { if (CNTV2DeviceScanner::GetFirstDeviceWithName(specParser.DeviceModel(), card))
220  Open(card.GetIndexNumber());
221  }
222  else if (specParser.HasResult(kConnectParamDevID))
223  { if (CNTV2DeviceScanner::GetFirstDeviceWithID(specParser.DeviceID(), card))
224  Open(card.GetIndexNumber());
225  }
226  else if (specParser.HasResult(kConnectParamDevIndex))
227  Open(specParser.DeviceIndex());
228  if (!IsOpen())
229  {DIFAIL("Failed to open " << specParser.InfoString()); return false;}
230  return true;
231  }
232 
233  // Open the remote/virtual device...
234  if (!OpenRemote(specParser))
235  return false; // Failed to open
236 
237  FinishOpen();
239  DIDBGX(DEC(gOpenCount) << " opens, " << DEC(gCloseCount) << " closes");
240  return true;
241 }
242 
244 {
245  if (IsOpen())
246  {
247  // Unsubscribe all...
248  for (INTERRUPT_ENUMS eInt(eVerticalInterrupt); eInt < eNumInterruptTypes; eInt = INTERRUPT_ENUMS(eInt+1))
249  ConfigureSubscription (false, eInt, mInterruptEventHandles[eInt]);
250 
251  const bool closeOK(IsRemote() ? CloseRemote() : CloseLocalPhysical());
252  if (closeOK)
255  DIDBGX(DEC(gOpenCount) << " opens, " << DEC(gCloseCount) << " closes");
256  return closeOK;
257  }
258  return true;
259 
260 } // Close
261 
262 
264 {
265 #if defined(NTV2_NULL_DEVICE)
266  DIFAIL("SDK built with 'NTV2_NULL_DEVICE' defined -- cannot OpenLocalPhysical '" << DEC(inDeviceIndex) << "'");
267 #else // else defined(NTV2_NULL_DEVICE)
268  (void) inDeviceIndex;
269  NTV2_ASSERT(false && "Requires platform-specific implementation");
270 #endif // else NTV2_NULL_DEVICE defined
271  return false;
272 }
273 
275 {
276  NTV2_ASSERT(false && "Requires platform-specific implementation");
277  return false;
278 }
279 
280 #if defined(AJA_WINDOWS)
281  static bool winsock_inited = false;
282  static WSADATA wsaData;
283 
284  static void initWinsock(void)
285  {
286  int wret;
287  if (!winsock_inited)
288  wret = WSAStartup(MAKEWORD(2,2), &wsaData);
289  winsock_inited = true;
290  }
291 #endif // AJA_WINDOWS
292 
293 
295 {
296 #if defined(AJA_WINDOWS)
297  initWinsock();
298 #endif // defined(AJA_WINDOWS)
299  NTV2_ASSERT(!IsOpen()); // Must be closed!
301 
302 #if defined(NTV2_NUB_CLIENT_SUPPORT)
303  if (inParser.Failed())
304  {ostringstream errs; inParser.PrintErrors(errs); DIFAIL("Bad parser: " << errs.str()); return false;}
305  if (inParser.IsLocalDevice())
306  {DIFAIL("Parser infers local device: " << inParser.InfoString()); return false;}
307 
308  NTV2Dictionary connectParams(inParser.Results());
309  // This "connectParams" dictionary has keys/values that determine which plugin to load,
310  // and any other configuration parameters specified by the caller. This dictionary is
311  // modified during the call to "CreateClient" (below) by an NTV2PluginLoader that loads,
312  // interrogates and validates the plugin. Several new keys/values are added to it during
313  // this process that describe the plugin, its signature, and any query parameters it
314  // requires or accepts for further configuration.
315  DIDBG("Opening " << inParser.InfoString());
316  NTV2RPCAPI * pClient (nullptr);
317  try {
318  pClient = NTV2RPCClientAPI::CreateClient(connectParams);
319  } catch (std::bad_alloc &) {
320  pClient = nullptr;
321  DIFAIL("bad_alloc exception");
322  } catch (...) {
323  pClient = nullptr;
324  DIFAIL("exception");
325  }
326  if (!pClient)
327  return false; // Failed to instantiate plugin client
328 
329  // At this point, the plugin's NTV2RPCAPI object exists, but may or may not be useable,
330  // depending on if it's "IsConnected". Before SDK 17.1, the plugin's NTV2Connect function
331  // was commonly called directly from its constructor. After SDK 17.1.0, OpenRemote is
332  // responsible for calling NTV2Connect, to allow tools like NTV2Watcher to probe the
333  // plugin in stages via its client interface.
334  if (!pClient->IsConnected())
335  if (!pClient->NTV2Connect())
336  { DIFAIL("Failed to connect/open '" << inParser.DeviceSpec() << "'");
337  delete pClient;
338  CloseRemote();
339  return false;
340  }
341 
342  // NTV2 physical devices always have a hardware identity -- the NTV2DeviceID read from register 50.
343  // This plugin device is considered "open" if ReadRegister is successful, and returns a non-zero
344  // value that's also not DEVICE_ID_NOTFOUND. (Virtual/software devices that have no NTV2 hardware
345  // corollary should return DEVICE_ID_SOFTWARE.)
346  _pRPCAPI = pClient;
348  if (!IsRemote() || !IsOpen())
349  DIFAIL("Failed to open '" << inParser.DeviceSpec() << "'");
350  return IsRemote() && IsOpen(); // Fail if not remote nor open
351 #else // NTV2_NUB_CLIENT_SUPPORT
352  DIFAIL("SDK built without 'NTV2_NUB_CLIENT_SUPPORT' -- cannot OpenRemote '" << inParser.DeviceSpec() << "'");
353  return false;
354 #endif // NTV2_NUB_CLIENT_SUPPORT
355 } // OpenRemote
356 
357 
359 {
360  if (_pRPCAPI)
361  {
362  DIDBG("Closing remote: " << *_pRPCAPI);
363  if (_pRPCAPI->NTV2Disconnect())
364  DIINFO("Remote closed: " << *_pRPCAPI);
365  else
366  DIFAIL("Remote close (NTV2Disconnect) failed: " << *_pRPCAPI);
367  delete _pRPCAPI;
368  _pRPCAPI = AJA_NULL;
369  _boardOpened = false;
370  return true;
371  }
372  // Wasn't open
373  _boardOpened = false;
374  return false;
375 }
376 
377 
379 {
380  outCount = 0;
381  if (!NTV2_IS_VALID_INTERRUPT_ENUM(inInterrupt))
382  return false;
383  outCount = mEventCounts.at(inInterrupt);
384  return true;
385 }
386 
388 {
389  if (!NTV2_IS_VALID_INTERRUPT_ENUM(inInterrupt))
390  return false;
391  mEventCounts.at(inInterrupt) = inCount;
392  return true;
393 }
394 
396 { (void) eInterrupt;
397  outCount = 0;
398  NTV2_ASSERT(false && "Needs subclass implementation");
399  return false;
400 }
401 
403 {
404  if (!NTV2_IS_VALID_INTERRUPT_ENUM(eInterruptType))
405  return HANDLE(0);
406  return HANDLE(uint64_t(mInterruptEventHandles.at(eInterruptType)));
407 }
408 
409 bool CNTV2DriverInterface::ConfigureInterrupt (const bool bEnable, const INTERRUPT_ENUMS eInterruptType)
410 { (void) bEnable; (void) eInterruptType;
411  NTV2_ASSERT(false && "Needs subclass implementation");
412  return false;
413 }
414 
415 bool CNTV2DriverInterface::ConfigureSubscription (const bool bSubscribe, const INTERRUPT_ENUMS eInterruptType, PULWord & outSubscriptionHdl)
416 {
417  if (!NTV2_IS_VALID_INTERRUPT_ENUM(eInterruptType))
418  return false;
419  outSubscriptionHdl = mInterruptEventHandles.at(eInterruptType);
420  if (bSubscribe)
421  { // If subscribing,
422  mEventCounts [eInterruptType] = 0; // clear this interrupt's event counter
423  DIDBG("Subscribing '" << ::NTV2InterruptEnumString(eInterruptType) << "' (" << UWord(eInterruptType)
424  << "), event counter reset");
425  }
426  else
427  {
428  DIDBGX("Unsubscribing '" << ::NTV2InterruptEnumString(eInterruptType) << "' (" << UWord(eInterruptType) << "), "
429  << mEventCounts[eInterruptType] << " event(s) received");
430  }
431  return true;
432 
433 } // ConfigureSubscription
434 
435 
437 {
438  ULWord value(0);
439  if (IsOpen() && ReadRegister(kRegBoardID, value))
440  {
441  const NTV2DeviceID currentValue(NTV2DeviceID(value+0));
442  if (currentValue != _boardID)
443  DIWARN(xHEX0N(this,16) << ": NTV2DeviceID " << xHEX0N(value,8) << " (" << ::NTV2DeviceIDToString(currentValue)
444  << ") read from register " << kRegBoardID << " doesn't match _boardID " << xHEX0N(_boardID,8) << " ("
445  << ::NTV2DeviceIDToString(_boardID) << ")");
446  return currentValue;
447  }
448  return DEVICE_ID_NOTFOUND;
449 }
450 
451 
452 // Common remote card read register. Subclasses have overloaded function
453 // that does platform-specific read of register on local card.
454 bool CNTV2DriverInterface::ReadRegister (const ULWord inRegNum, ULWord & outValue, const ULWord inMask, const ULWord inShift)
455 {
456 #if defined(NTV2_NUB_CLIENT_SUPPORT)
457  if (IsRemote())
458  return _pRPCAPI->NTV2ReadRegisterRemote (inRegNum, outValue, inMask, inShift);
459 #else
460  (void) inRegNum; (void) outValue; (void) inMask; (void) inShift;
461 #endif
462  return false;
463 }
464 
466 {
467  if (!IsOpen())
468  return false; // Device not open!
469  if (inOutValues.empty())
470  return true; // Nothing to do!
471 
472  NTV2GetRegisters getRegsParams (inOutValues);
473  if (NTV2Message(reinterpret_cast<NTV2_HEADER*>(&getRegsParams)))
474  {
475  if (!getRegsParams.GetRegisterValues(inOutValues))
476  return false;
477  }
478  else // Non-atomic user-space workaround until GETREGS implemented in driver...
479  for (NTV2RegisterReadsIter iter(inOutValues.begin()); iter != inOutValues.end(); ++iter)
480  if (iter->registerNumber != kRegXenaxFlashDOUT) // Prevent firmware erase/program/verify failures
481  if (!ReadRegister (iter->registerNumber, iter->registerValue))
482  return false;
483  return true;
484 }
485 
486 #if !defined(NTV2_DEPRECATE_16_0)
487  // Common remote card read multiple registers. Subclasses have overloaded function
488  bool CNTV2DriverInterface::ReadRegisterMulti (const ULWord inNumRegs, ULWord * pOutWhichRegFailed, NTV2RegInfo pOutRegInfos[])
489  {
490  if (!pOutWhichRegFailed)
491  return false; // NULL pointer
492  *pOutWhichRegFailed = 0xFFFFFFFF;
493  if (!inNumRegs)
494  return false; // numRegs is zero
495 
496  // New in SDK 16.0: Use ReadRegs NTV2Message
497  NTV2RegReads regReads, result;
498  regReads.reserve(inNumRegs); result.reserve(inNumRegs);
499  for (size_t ndx(0); ndx < size_t(inNumRegs); ndx++)
500  regReads.push_back(pOutRegInfos[ndx]);
501  result = regReads;
502  bool retVal (ReadRegisters(result));
503  NTV2_ASSERT(result.size() <= regReads.size());
504  if (result.size() < regReads.size())
505  *pOutWhichRegFailed = result.empty() ? regReads.front().registerNumber : result.back().registerNumber;
506  return retVal;
507  }
508 
510  {
511  AJATime::Sleep(milliseconds);
512  return 0; // Beware, this function always returns zero, even if sleep was interrupted
513  }
514 #endif // !defined(NTV2_DEPRECATE_16_0)
515 
516 
517 // Common remote card write register. Subclasses overloaded this to do platform-specific register write.
518 bool CNTV2DriverInterface::WriteRegister (const ULWord inRegNum, const ULWord inValue, const ULWord inMask, const ULWord inShift)
519 {
520 #if defined(NTV2_WRITEREG_PROFILING)
521  // Recording is done in platform-specific WriteRegister
522 #endif // NTV2_WRITEREG_PROFILING
523 #if defined(NTV2_NUB_CLIENT_SUPPORT)
524  // If we get here, must be a non-physical device connection...
525  return IsRemote() ? _pRPCAPI->NTV2WriteRegisterRemote(inRegNum, inValue, inMask, inShift) : false;
526 #else
527  (void) inRegNum; (void) inValue; (void) inMask; (void) inShift;
528  return false;
529 #endif
530 }
531 
532 
534  const bool inIsRead,
535  const ULWord inFrameNumber,
536  ULWord * pFrameBuffer,
537  const ULWord inCardOffsetBytes,
538  const ULWord inTotalByteCount,
539  const bool inSynchronous)
540 {
541 #if defined(NTV2_NUB_CLIENT_SUPPORT)
543  NTV2Buffer buffer(pFrameBuffer, inTotalByteCount);
544  return _pRPCAPI->NTV2DMATransferRemote(inDMAEngine, inIsRead, inFrameNumber, buffer, inCardOffsetBytes,
545  0/*numSegs*/, 0/*hostPitch*/, 0/*cardPitch*/, inSynchronous);
546 #else
547  (void) inDMAEngine; (void) inIsRead; (void) inFrameNumber; (void) pFrameBuffer; (void) inCardOffsetBytes;
548  (void) inTotalByteCount; (void) inSynchronous;
549  return false;
550 #endif
551 }
552 
554  const bool inIsRead,
555  const ULWord inFrameNumber,
556  ULWord * pFrameBuffer,
557  const ULWord inCardOffsetBytes,
558  const ULWord inTotalByteCount,
559  const ULWord inNumSegments,
560  const ULWord inHostPitchPerSeg,
561  const ULWord inCardPitchPerSeg,
562  const bool inSynchronous)
563 {
564 #if defined(NTV2_NUB_CLIENT_SUPPORT)
566  NTV2Buffer buffer(pFrameBuffer, inTotalByteCount);
567  return _pRPCAPI->NTV2DMATransferRemote(inDMAEngine, inIsRead, inFrameNumber, buffer, inCardOffsetBytes,
568  inNumSegments, inHostPitchPerSeg, inCardPitchPerSeg, inSynchronous);
569 #else
570  (void) inDMAEngine; (void) inIsRead; (void) inFrameNumber; (void) pFrameBuffer; (void) inCardOffsetBytes;
571  (void) inTotalByteCount; (void) inNumSegments; (void) inHostPitchPerSeg; (void) inCardPitchPerSeg; (void) inSynchronous;
572  return false;
573 #endif
574 }
575 
577  const NTV2Channel inDMAChannel,
578  const bool inIsTarget,
579  const ULWord inFrameNumber,
580  const ULWord inCardOffsetBytes,
581  const ULWord inByteCount,
582  const ULWord inNumSegments,
583  const ULWord inSegmentHostPitch,
584  const ULWord inSegmentCardPitch,
585  const PCHANNEL_P2P_STRUCT & inP2PData)
586 { (void) inDMAEngine; (void) inDMAChannel; (void) inIsTarget; (void) inFrameNumber; (void) inCardOffsetBytes;
587  (void) inByteCount; (void) inNumSegments; (void) inSegmentHostPitch; (void) inSegmentCardPitch; (void) inP2PData;
588 #if defined(NTV2_NUB_CLIENT_SUPPORT)
590  // No NTV2DMATransferP2PRemote implementation yet
591 #endif
592  return false;
593 }
594 
595 // Common remote card waitforinterrupt. Subclasses have overloaded function
596 // that does platform-specific waitforinterrupt on local cards.
598 {
599 #if defined(NTV2_NUB_CLIENT_SUPPORT)
600  return _pRPCAPI ? _pRPCAPI->NTV2WaitForInterruptRemote(eInterrupt, timeOutMs) : false;
601 #else
602  (void) eInterrupt;
603  (void) timeOutMs;
604  return false;
605 #endif
606 }
607 
608 // Common remote card autocirculate. Subclasses have overloaded function
609 // that does platform-specific autocirculate on local cards.
611 {
612 #if defined(NTV2_NUB_CLIENT_SUPPORT)
613  if (IsRemote())
614  switch (autoCircData.eCommand)
615  {
616  case eStartAutoCirc:
617  case eAbortAutoCirc:
618  case ePauseAutoCirc:
619  case eFlushAutoCirculate:
620  case eGetAutoCirc:
621  case eStopAutoCirc:
622  case eInitAutoCirc:
623  case eSetActiveFrame:
624  return _pRPCAPI->NTV2AutoCirculateRemote(autoCircData);
625  default: // Others not handled
626  return false;
627  }
628  return false;
629 #else
630  (void) autoCircData;
631  return false;
632 #endif
633 }
634 
636 {
637 #if defined(NTV2_NUB_CLIENT_SUPPORT)
638  return _pRPCAPI ? _pRPCAPI->NTV2MessageRemote(pInMessage) : false;
639 #else
640  (void) pInMessage;
641  return false;
642 #endif
643 }
644 
645 
646 // Common remote card DriverGetBitFileInformation. Subclasses have overloaded function
647 // that does platform-specific function on local cards.
649 { (void)bitFileType;
650  ::memset(&bitFileInfo, 0, sizeof(bitFileInfo));
651  if (IsRemote())
652  return false;
654  return false;
655 
656  ParseFlashHeader(bitFileInfo);
657  bitFileInfo.bitFileType = 0;
658  switch (_boardID)
659  {
660  case DEVICE_ID_CORVID1: bitFileInfo.bitFileType = NTV2_BITFILE_CORVID1_MAIN; break;
661  case DEVICE_ID_CORVID22: bitFileInfo.bitFileType = NTV2_BITFILE_CORVID22_MAIN; break;
662  case DEVICE_ID_CORVID24: bitFileInfo.bitFileType = NTV2_BITFILE_CORVID24_MAIN; break;
663  case DEVICE_ID_CORVID3G: bitFileInfo.bitFileType = NTV2_BITFILE_CORVID3G_MAIN; break;
664  case DEVICE_ID_CORVID44: bitFileInfo.bitFileType = NTV2_BITFILE_CORVID44; break;
670  case DEVICE_ID_CORVID88: bitFileInfo.bitFileType = NTV2_BITFILE_CORVID88; break;
673  case DEVICE_ID_CORVIDHEVC: bitFileInfo.bitFileType = NTV2_BITFILE_CORVIDHEVC; break;
674  case DEVICE_ID_IO4K: bitFileInfo.bitFileType = NTV2_BITFILE_IO4K_MAIN; break;
675  case DEVICE_ID_IO4KPLUS: bitFileInfo.bitFileType = NTV2_BITFILE_IO4KPLUS_MAIN; break;
676  case DEVICE_ID_IO4KUFC: bitFileInfo.bitFileType = NTV2_BITFILE_IO4KUFC_MAIN; break;
678  case DEVICE_ID_IOIP_2022: bitFileInfo.bitFileType = NTV2_BITFILE_IOIP_2022; break;
679  case DEVICE_ID_IOIP_2110: bitFileInfo.bitFileType = NTV2_BITFILE_IOIP_2110; break;
681  case DEVICE_ID_IOXT: bitFileInfo.bitFileType = NTV2_BITFILE_IOXT_MAIN; break;
682  case DEVICE_ID_KONA1: bitFileInfo.bitFileType = NTV2_BITFILE_KONA1; break;
683  case DEVICE_ID_KONA3G: bitFileInfo.bitFileType = NTV2_BITFILE_KONA3G_MAIN; break;
684  case DEVICE_ID_KONA3GQUAD: bitFileInfo.bitFileType = NTV2_BITFILE_KONA3G_QUAD; break;
685  case DEVICE_ID_KONA4: bitFileInfo.bitFileType = NTV2_BITFILE_KONA4_MAIN; break;
686  case DEVICE_ID_KONA4UFC: bitFileInfo.bitFileType = NTV2_BITFILE_KONA4UFC_MAIN; break;
687  case DEVICE_ID_KONA5: bitFileInfo.bitFileType = NTV2_BITFILE_KONA5_MAIN; break;
690  case DEVICE_ID_KONA5_8K: bitFileInfo.bitFileType = NTV2_BITFILE_KONA5_8K_MAIN; break;
704  case DEVICE_ID_SOJI_OE1: bitFileInfo.bitFileType = NTV2_BITFILE_SOJI_OE1_MAIN; break;
705  case DEVICE_ID_SOJI_OE2: bitFileInfo.bitFileType = NTV2_BITFILE_SOJI_OE2_MAIN; break;
706  case DEVICE_ID_SOJI_OE3: bitFileInfo.bitFileType = NTV2_BITFILE_SOJI_OE3_MAIN; break;
707  case DEVICE_ID_SOJI_OE4: bitFileInfo.bitFileType = NTV2_BITFILE_SOJI_OE4_MAIN; break;
708  case DEVICE_ID_SOJI_OE5: bitFileInfo.bitFileType = NTV2_BITFILE_SOJI_OE5_MAIN; break;
709  case DEVICE_ID_SOJI_OE6: bitFileInfo.bitFileType = NTV2_BITFILE_SOJI_OE6_MAIN; break;
710  case DEVICE_ID_SOJI_OE7: bitFileInfo.bitFileType = NTV2_BITFILE_SOJI_OE7_MAIN; break;
714  case DEVICE_ID_KONAHDMI: bitFileInfo.bitFileType = NTV2_BITFILE_KONAHDMI; break;
720  case DEVICE_ID_KONAIP_25G: bitFileInfo.bitFileType = NTV2_BITFILE_KONAIP_25G; break;
724  case DEVICE_ID_KONALHI: bitFileInfo.bitFileType = NTV2_BITFILE_LHI_MAIN; break;
726  case DEVICE_ID_TTAP: bitFileInfo.bitFileType = NTV2_BITFILE_TTAP_MAIN; break;
727  case DEVICE_ID_TTAP_PRO: bitFileInfo.bitFileType = NTV2_BITFILE_TTAP_PRO_MAIN; break;
728  case DEVICE_ID_IOX3: bitFileInfo.bitFileType = NTV2_BITFILE_IOX3_MAIN; break;
729  case DEVICE_ID_KONAX: bitFileInfo.bitFileType = NTV2_BITFILE_KONAX; break;
730  case DEVICE_ID_KONAXM: bitFileInfo.bitFileType = NTV2_BITFILE_KONAXM; break;
731  case DEVICE_ID_KONAX_4CH: bitFileInfo.bitFileType = NTV2_BITFILE_KONAX_4CH; break;
732 
733  case DEVICE_ID_VKONA:
734  case DEVICE_ID_IP25_T:
735  case DEVICE_ID_IP25_R:
736  case DEVICE_ID_FS8:
737  case DEVICE_ID_SOFTWARE:
738  case DEVICE_ID_NOTFOUND: bitFileInfo.bitFileType = NTV2_BITFILE_TYPE_INVALID; break;
739  #if !defined (_DEBUG)
740  default: break;
741  #endif
742  }
743  bitFileInfo.checksum = 0;
744  bitFileInfo.structVersion = 0;
745  bitFileInfo.structSize = sizeof(BITFILE_INFO_STRUCT);
746  bitFileInfo.whichFPGA = eFPGAVideoProc;
747 
748  const string bitFileDesignNameString = string(bitFileInfo.designNameStr) + ".bit";
749  ::strncpy(bitFileInfo.designNameStr, bitFileDesignNameString.c_str(), sizeof(bitFileInfo.designNameStr)-1);
750  return true;
751 }
752 
754 {
755  if (!IsDeviceReady(false) || !IsSupported(kDeviceCanDoIP))
756  return false; // cannot read flash
757 
758  string packInfo;
759  ULWord deviceID = ULWord(_boardID);
760  ReadRegister (kRegBoardID, deviceID);
761 
763  {
764  CNTV2AxiSpiFlash spiFlash(GetIndexNumber(), false);
765 
766  uint32_t offset = spiFlash.Offset(SPI_FLASH_SECTION_MCSINFO);
767  vector<uint8_t> mcsInfoData;
768  if (spiFlash.Read(offset, mcsInfoData, 256))
769  {
770  packInfo.assign(mcsInfoData.begin(), mcsInfoData.end());
771 
772  // remove any trailing nulls
773  size_t found = packInfo.find('\0');
774  if (found != string::npos)
775  {
776  packInfo.resize(found);
777  }
778  }
779  else
780  return false;
781  }
782  else
783  {
784  ULWord baseAddress = (16 * 1024 * 1024) - (3 * 256 * 1024);
785  const ULWord dwordSizeCount = 256/4;
786 
789  bool busy = true;
790  ULWord timeoutCount = 1000;
791  do
792  {
793  ULWord regValue;
795  if (regValue & BIT(8))
796  {
797  busy = true;
798  timeoutCount--;
799  }
800  else
801  busy = false;
802  } while (busy == true && timeoutCount > 0);
803  if (timeoutCount == 0)
804  return false;
805 
806  ULWord* bitFilePtr = new ULWord[dwordSizeCount];
807  for ( ULWord count = 0; count < dwordSizeCount; count++, baseAddress += 4 )
808  {
809  WriteRegister(kRegXenaxFlashAddress, baseAddress);
811  busy = true;
812  timeoutCount = 1000;
813  do
814  {
815  ULWord regValue;
817  if ( regValue & BIT(8))
818  {
819  busy = true;
820  timeoutCount--;
821  }
822  else
823  busy = false;
824  } while(busy == true && timeoutCount > 0);
825  if (timeoutCount == 0)
826  {
827  delete [] bitFilePtr;
828  return false;
829  }
830  ReadRegister(kRegXenaxFlashDOUT, bitFilePtr[count]);
831  }
832 
833  packInfo = reinterpret_cast<char*>(bitFilePtr);
834  delete [] bitFilePtr;
835  }
836 
837  istringstream iss(packInfo);
838  vector<string> results;
839  string token;
840  while (getline(iss,token, ' '))
841  results.push_back(token);
842 
843  if (results.size() < 8)
844  return false;
845 
846  packageInfo.date = results[1];
847  token = results[2];
848  token.erase(remove(token.begin(), token.end(), '\n'), token.end());
849  packageInfo.time = token;
850  packageInfo.buildNumber = results[4];
851  packageInfo.packageNumber = results[7];
852  return true;
853 }
854 
855 // Common remote card DriverGetBuildInformation. Subclasses have overloaded function
856 // that does platform-specific function on local cards.
858 {
859  ::memset(&buildInfo, 0, sizeof(buildInfo));
860  return false;
861 }
862 
863 bool CNTV2DriverInterface::BitstreamWrite (const NTV2Buffer & inBuffer, const bool inFragment, const bool inSwap)
864 {
865  NTV2Bitstream bsMsg (inBuffer,
867  (inFragment? BITSTREAM_FRAGMENT : 0) |
868  (inSwap? BITSTREAM_SWAP : 0));
869  ULWord counts(0);
871  ULWord attempts(counts >> 16), successes(counts & 0x0000FFFF);
872  attempts++;
873  const bool result (NTV2Message (reinterpret_cast<NTV2_HEADER*>(&bsMsg)));
874  if (result)
875  successes++;
876  counts = (attempts << 16) | successes;
878  return result;
879 }
880 
881 bool CNTV2DriverInterface::BitstreamReset (const bool inConfiguration, const bool inInterface)
882 {
883  NTV2Buffer inBuffer;
884  NTV2Bitstream bsMsg (inBuffer,
885  (inConfiguration? BITSTREAM_RESET_CONFIG : 0) |
886  (inInterface? BITSTREAM_RESET_MODULE : 0));
887  return NTV2Message(bsMsg);
888 }
889 
891 {
892  outRegValues.reserve(BITSTREAM_MCAP_DATA);
893  outRegValues.clear();
894 
895  NTV2Buffer inBuffer;
896  NTV2Bitstream bsMsg (inBuffer, BITSTREAM_READ_REGISTERS);
897  if (!NTV2Message(bsMsg))
898  return false;
899 
900  for (UWord ndx(0); ndx < BITSTREAM_MCAP_DATA; ndx++)
901  outRegValues.push_back(bsMsg.mRegisters[ndx]);
902 
903  return true;
904 }
905 
906 bool CNTV2DriverInterface::BitstreamLoad (const bool inSuspend, const bool inResume)
907 {
908  NTV2Buffer inBuffer;
909  NTV2Bitstream bsMsg (inBuffer,
910  (inSuspend? BITSTREAM_SUSPEND : 0) |
911  (inResume? BITSTREAM_RESUME : 0));
912  return NTV2Message(bsMsg);
913 }
914 
916  ULWord flags,
917  NTV2StreamChannel& status)
918 {
919  status.mChannel = inChannel;
920  status.mFlags = flags;
921 
922  return NTV2Message(status);
923 }
924 
926  NTV2Buffer& inBuffer,
927  ULWord64 bufferCookie,
928  ULWord flags,
929  NTV2StreamBuffer& status)
930 {
931  status.mChannel = inChannel;
932  status.mBuffer.Set (inBuffer.GetHostPointer(), inBuffer.GetByteCount());
933  status.mBufferCookie = bufferCookie;
934  status.mFlags = flags;
935 
936  return NTV2Message(status);
937 }
938 
940  NTV2Buffer& inBuffer,
941  ULWord dataSize,
942  ULWord flags,
943  ULWord delay,
944  ULWord timeout,
945  NTV2MailBuffer& status)
946 {
947  status.mChannel = inChannel;
948  status.mBuffer.Set (inBuffer.GetHostPointer(), inBuffer.GetByteCount());
949  status.mDataSize = dataSize;
950  status.mDelay = delay;
951  status.mTimeout = timeout;
952  status.mFlags = flags;
953 
954  return NTV2Message(status);
955 }
956 
957 // FinishOpen
958 // NOTE _boardID must be set before calling this routine.
960 {
961  // HACK! FinishOpen needs frame geometry to determine frame buffer size and number.
963  ULWord val1(0), val2(0);
967  NTV2PixelFormat pf(NTV2PixelFormat((val1 & 0x0F) | ((val2 & 0x1) << 4)));
968 #if !defined(NTV2_DEPRECATE_17_2)
971 #endif
972 
973  ULWord returnVal1 = false;
974  ULWord returnVal2 = false;
979 
980 #if !defined(NTV2_DEPRECATE_16_0)
987 #endif // !defined(NTV2_DEPRECATE_16_0)
988 
989 } // FinishOpen
990 
991 
993 {
994  if (!IsDeviceReady(false))
995  return false; // cannot read flash
996 
998  {
999  uint32_t val;
1000  ReadRegister((0x100000 + 0x08) / 4, val);
1001  if (val != 0x01)
1002  return false; // cannot read flash
1003  }
1004 
1006  {
1009  bool busy = true;
1010  ULWord timeoutCount = 1000;
1011  do
1012  {
1013  ULWord regValue;
1015  if (regValue & BIT(8))
1016  {
1017  busy = true;
1018  timeoutCount--;
1019  }
1020  else
1021  busy = false;
1022  } while (busy && timeoutCount);
1023  if (!timeoutCount)
1024  return false;
1025  }
1026 
1027  // Allocate header buffer, read/fill from SPI-flash...
1028  static const ULWord dwordCount(256/4);
1029  NTV2Buffer bitFileHdrBuffer(dwordCount * sizeof(ULWord));
1030  if (!bitFileHdrBuffer)
1031  return false;
1032 
1033  ULWord* pULWord(bitFileHdrBuffer), baseAddress(0);
1034  for (ULWord count(0); count < dwordCount; count++, baseAddress += 4)
1035  if (!ReadFlashULWord(baseAddress, pULWord[count]))
1036  return false;
1037 
1038  CNTV2Bitfile fileInfo;
1039  std::string headerError;
1040 #if 0 // Fake out:
1041  if (_boardID == DEVICE_ID_TTAP_PRO) // Fake TTapPro -- load "flash" from on-disk bitfile:
1042  { fileInfo.Open("/Users/demo/dev-svn/firmware/T3_Tap/t_tap_pro.bit");
1043  headerError = fileInfo.GetLastError();
1044  } else
1045 #endif
1046  headerError = fileInfo.ParseHeaderFromBuffer(bitFileHdrBuffer);
1047  if (headerError.empty())
1048  {
1049  ::strncpy(bitFileInfo.dateStr, fileInfo.GetDate().c_str(), NTV2_BITFILE_DATETIME_STRINGLENGTH);
1050  ::strncpy(bitFileInfo.timeStr, fileInfo.GetTime().c_str(), NTV2_BITFILE_DATETIME_STRINGLENGTH);
1051  ::strncpy(bitFileInfo.designNameStr, fileInfo.GetDesignName().c_str(), NTV2_BITFILE_DESIGNNAME_STRINGLENGTH);
1052  ::strncpy(bitFileInfo.partNameStr, fileInfo.GetPartName().c_str(), NTV2_BITFILE_PARTNAME_STRINGLENGTH);
1053  bitFileInfo.numBytes = ULWord(fileInfo.GetProgramStreamLength());
1054  }
1055  return headerError.empty();
1056 } // ParseFlashHeader
1057 
1058 bool CNTV2DriverInterface::ReadFlashULWord (const ULWord inAddress, ULWord & outValue, const ULWord inRetryCount)
1059 {
1060  if (!WriteRegister(kRegXenaxFlashAddress, inAddress))
1061  return false;
1063  return false;
1064  bool busy(true);
1065  ULWord timeoutCount(inRetryCount);
1066  do
1067  {
1068  ULWord regValue(0);
1070  if (regValue & BIT(8))
1071  {
1072  busy = true;
1073  timeoutCount--;
1074  }
1075  else
1076  busy = false;
1077  } while (busy && timeoutCount);
1078  if (!timeoutCount)
1079  return false;
1080  return ReadRegister(kRegXenaxFlashDOUT, outValue);
1081 }
1082 
1084 {
1085  _boardNumber = num;
1086 }
1087 
1088 
1089 //--------------------------------------------------------------------------------------------------------------------
1090 // Application acquire and release stuff
1091 //--------------------------------------------------------------------------------------------------------------------
1092 const uint32_t kAgentAppFcc (NTV2_FOURCC('A','j','a','A'));
1093 
1094 
1095 bool CNTV2DriverInterface::AcquireStreamForApplicationWithReference (const ULWord inAppCode, const int32_t inProcessID)
1096 {
1097  ULWord svcInitialized(0);
1098  if (ReadRegister(kVRegServicesInitialized, svcInitialized))
1099  if (!svcInitialized) // if services have never initialized the device
1100  if (inAppCode != kAgentAppFcc) // if not AJA Agent
1102  << " uninitialized by AJAAgent, requesting app " << xHEX0N(inAppCode,8) << ", pid=" << DEC(inProcessID));
1103 
1104  ULWord currentCode(0), currentPID(0);
1105  if (!ReadRegister(kVRegApplicationCode, currentCode) || !ReadRegister(kVRegApplicationPID, currentPID))
1106  return false;
1107 
1108  // Check if owner is deceased
1109  if (!AJAProcess::IsValid(currentPID))
1110  {
1111  // Process doesn't exist, so make the board our own
1112  ReleaseStreamForApplication (currentCode, int32_t(currentPID));
1113  }
1114 
1115  if (!ReadRegister(kVRegApplicationCode, currentCode) || !ReadRegister(kVRegApplicationPID, currentPID))
1116  return false;
1117 
1118  for (int count(0); count < 20; count++)
1119  {
1120  if (!currentPID)
1121  {
1122  // Nothing has the board
1123  if (!WriteRegister(kVRegApplicationCode, inAppCode))
1124  return false;
1125  // Just in case this is not zero
1128  return WriteRegister(kVRegApplicationPID, ULWord(inProcessID));
1129  }
1130  else if (currentCode == inAppCode && currentPID == ULWord(inProcessID))
1131  return WriteRegister(kVRegAcquireLinuxReferenceCount, 1); // Process already acquired, so bump the count
1132  // Someone else has the board, so wait and try again
1133  AJATime::Sleep(50);
1134  }
1135  return false;
1136 }
1137 
1138 bool CNTV2DriverInterface::ReleaseStreamForApplicationWithReference (const ULWord inAppCode, const int32_t inProcessID)
1139 {
1140  ULWord currentCode(0), currentPID(0), currentCount(0);
1141  if (!ReadRegister(kVRegApplicationCode, currentCode)
1142  || !ReadRegister(kVRegApplicationPID, currentPID)
1143  || !ReadRegister(kVRegAcquireLinuxReferenceCount, currentCount))
1144  return false;
1145 
1146  if (currentCode == inAppCode && currentPID == ULWord(inProcessID))
1147  {
1148  if (currentCount > 1)
1150  if (currentCount == 1)
1151  return ReleaseStreamForApplication(inAppCode, inProcessID);
1152  return true;
1153  }
1154  return false;
1155 }
1156 
1157 bool CNTV2DriverInterface::AcquireStreamForApplication (const ULWord inAppCode, const int32_t inProcessID)
1158 {
1159  ULWord svcInitialized(0);
1160  if (ReadRegister(kVRegServicesInitialized, svcInitialized))
1161  if (!svcInitialized) // if services have never initialized the device
1162  if (inAppCode != kAgentAppFcc) // if not AJA Agent
1164  << " uninitialized by AJAAgent, requesting app " << xHEX0N(inAppCode,8) << ", pid=" << DEC(inProcessID));
1165 
1166  // Loop for a while trying to acquire the board
1167  for (int count(0); count < 20; count++)
1168  {
1169  if (WriteRegister(kVRegApplicationCode, inAppCode))
1170  return WriteRegister(kVRegApplicationPID, ULWord(inProcessID));
1171  AJATime::Sleep(50);
1172  }
1173 
1174  // Get data about current owner
1175  ULWord currentCode(0), currentPID(0);
1176  if (!ReadRegister(kVRegApplicationCode, currentCode) || !ReadRegister(kVRegApplicationPID, currentPID))
1177  return false;
1178 
1179  // Check if owner is deceased
1180  if (!AJAProcess::IsValid(currentPID))
1181  { // Process doesn't exist, so make the board our own
1182  ReleaseStreamForApplication (currentCode, int32_t(currentPID));
1183  for (int count(0); count < 20; count++)
1184  {
1185  if (WriteRegister(kVRegApplicationCode, inAppCode))
1186  return WriteRegister(kVRegApplicationPID, ULWord(inProcessID));
1187  AJATime::Sleep(50);
1188  }
1189  }
1190  // Current owner is alive, so don't interfere
1191  return false;
1192 }
1193 
1194 bool CNTV2DriverInterface::ReleaseStreamForApplication (const ULWord inAppCode, const int32_t inProcessID)
1195 { (void)inAppCode; // Don't care which appCode
1196  if (WriteRegister(kVRegReleaseApplication, ULWord(inProcessID)))
1197  {
1199  return true; // We don't care if the above call failed
1200  }
1201  return false;
1202 }
1203 
1204 bool CNTV2DriverInterface::SetStreamingApplication (const ULWord inAppCode, const int32_t inProcessID)
1205 {
1206  if (!WriteRegister(kVRegForceApplicationCode, inAppCode))
1207  return false;
1208  return WriteRegister(kVRegForceApplicationPID, ULWord(inProcessID));
1209 }
1210 
1211 bool CNTV2DriverInterface::GetStreamingApplication (ULWord & outAppType, int32_t & outProcessID)
1212 {
1213  if (!ReadRegister(kVRegApplicationCode, outAppType))
1214  return false;
1216 }
1217 
1219 {
1220  if (!IsRemote())
1221  return ""; // This implementation is intended for remote/plugin devices
1222  string desc(_pRPCAPI->Description());
1223  if (desc.empty())
1224  { // Plugin/remote device didn't provide description
1225  const NTV2Dictionary parms(ConnectParams());
1226  NTV2StringList strs;
1228  strs.push_back("\"" + parms.valueForKey(kNTV2PluginRegInfoKey_LongName) + "\"");
1229  else if (parms.hasKey(kNTV2PluginRegInfoKey_ShortName))
1230  strs.push_back(parms.valueForKey(kNTV2PluginRegInfoKey_ShortName));
1232  strs.push_back(parms.valueForKey(kNTV2PluginRegInfoKey_Description));
1233  else if (parms.hasKey(kNTV2PluginRegInfoKey_Copyright))
1234  strs.push_back(parms.valueForKey(kNTV2PluginRegInfoKey_Copyright));
1235  else if (parms.hasKey(kNTV2PluginRegInfoKey_Vendor))
1236  strs.push_back(parms.valueForKey(kNTV2PluginRegInfoKey_Vendor));
1237  if (!strs.empty())
1238  desc = aja::join(strs, ", ");
1239  }
1240  return desc;
1241 }
1242 
1244 {
1245  return IsRemote() ? _pRPCAPI->ConnectParams() : NTV2Dictionary();
1246 }
1247 
1248 // This function is used by the retail ControlPanel.
1249 // Read the current RP188 registers (which typically give you the timecode corresponding to the LAST frame).
1250 // NOTE: This is a hack to avoid making a "real" driver call! Since the RP188 data requires three ReadRegister()
1251 // calls, there is a chance that it can straddle a VBI, which could give bad results. To avoid this, we
1252 // read the 3 registers until we get two consecutive passes that give us the same data. (Someday it'd
1253 // be nice if the driver automatically read these as part of its VBI IRQ handler...
1255 { (void) inChannel;
1256  if (!pRP188Data)
1257  return false;
1258 
1259  RP188_STRUCT rp188;
1260  NTV2DeviceID boardID = DEVICE_ID_NOTFOUND;
1262  ULWord dbbReg(0), msReg(0), lsReg(0);
1263 
1266  bool bLTCPort = (source == kRP188SourceLTCPort);
1267 
1268  // values come from LTC port registers
1269  if (bLTCPort)
1270  {
1271  ULWord ltcPresent;
1273 
1274  // there is no equivalent DBB for LTC port - we synthesize it here
1275  rp188.DBB = (ltcPresent) ? 0xFE000000 | NEW_SELECT_RP188_RCVD : 0xFE000000;
1276 
1277  // LTC port registers
1278  dbbReg = 0; // don't care - does not exist
1279  msReg = kRegLTCAnalogBits0_31;
1280  lsReg = kRegLTCAnalogBits32_63;
1281  }
1282  else
1283  {
1284  // values come from RP188 registers
1285  NTV2Channel channel = NTV2_CHANNEL1;
1287 
1288  if (::NTV2DeviceGetNumVideoInputs(boardID) > 1)
1289  {
1291  channel = (inputSelect == NTV2_Input2Select) ? NTV2_CHANNEL2 : NTV2_CHANNEL1;
1292  }
1293  else
1294  channel = NTV2_CHANNEL1;
1295 
1296  // rp188 registers
1297  dbbReg = (channel == NTV2_CHANNEL1 ? kRegRP188InOut1DBB : kRegRP188InOut2DBB);
1298  //Check to see if TC is received
1299  uint32_t tcReceived = 0;
1300  ReadRegister(dbbReg, tcReceived, BIT(16), 16);
1301  if(tcReceived == 0)
1302  return false;//No TC recevied
1303 
1305  switch (rp188.DBB)//What do we have?
1306  {
1307  default:
1308  case 0x01:
1309  case 0x02:
1310  {
1311  //We have VITC - what do we want?
1312  if (pRP188Data->DBB == 0x01 || pRP188Data->DBB == 0x02)
1313  { // We want VITC
1316  }
1317  else
1318  { // We want Embedded LTC, so we should check one other place
1319  uint32_t ltcPresent = 0;
1320  ReadRegister(dbbReg, ltcPresent, BIT(18), 18);
1321  if (ltcPresent != 1)
1322  return false;
1323  //Read LTC registers
1326  }
1327  break;
1328  }
1329  case 0x00:
1330  //We have LTC - do we want it?
1331  if (pRP188Data->DBB != 0x00)
1332  return false;
1335  break;
1336  }
1337  //Re-Read the whole register just in case something is expecting other status values
1338  ReadRegister (dbbReg, rp188.DBB);
1339  }
1340  ReadRegister (msReg, rp188.Low );
1341  ReadRegister (lsReg, rp188.High);
1342 
1343  // register stability filter
1344  do
1345  {
1346  *pRP188Data = rp188; // struct copy to result
1347 
1348  // read again into local struct
1349  if (!bLTCPort)
1350  ReadRegister (dbbReg, rp188.DBB);
1351  ReadRegister (msReg, rp188.Low );
1352  ReadRegister (lsReg, rp188.High);
1353 
1354  // if the new read equals the previous read, consider it done
1355  if (rp188.DBB == pRP188Data->DBB &&
1356  rp188.Low == pRP188Data->Low &&
1357  rp188.High == pRP188Data->High)
1358  break;
1359  } while (true);
1360 
1361  return true;
1362 }
1363 
1365 {
1366  if (NTV2_IS_VALID_INTERRUPT_ENUM(eInterruptType))
1367  mEventCounts[eInterruptType] += 1;
1368 
1369 } // BumpEventCount
1370 
1371 
1372 bool CNTV2DriverInterface::IsDeviceReady (const bool checkValid)
1373 {
1374  if (IsRemote())
1375  {
1376  ULWord reg(0), val(0);
1378  return true; // failed to read VReg -- assume ready
1379  if (!reg)
1380  return true; // reg number is zero -- assume ready
1381  // A non-zero register number was returned (hope it's valid)
1382  if (!ReadRegister(reg, val))
1383  return true; // failed to read -- bad reg num? -- assume device ready
1384  // ReadRegister successful!
1385  return val; // zero means "not ready"; non-zero means "ready"
1386  }
1388  return true; // Non-IP devices always ready
1389 
1391  {
1392  if (!IsMBSystemReady())
1393  return false;
1394 
1395  if (checkValid && !IsMBSystemValid())
1396  return false;
1397  }
1398  else if (!IsLPSystemReady())
1399  return false;
1400  return true; // Ready!
1401 }
1402 
1404 {
1406  {
1407  uint32_t val;
1409  return val == SAREK_IF_VERSION;
1410  }
1411  return true;
1412 }
1413 
1415 {
1417  return false; // No microblaze
1418 
1419  uint32_t val;
1421  if (val != 0x01)
1422  return false; // MB not ready
1423 
1424  // Not enough to read MB State, we need to make sure MB is running
1426  return (val < 2) ? false : true;
1427 }
1428 
1430 {
1432  return false; // No local proc
1433 
1434  uint32_t val;
1436  if (val == 0x00)
1437  return false; // MB not ready
1438  return true;
1439 }
1440 
1441 #if defined(NTV2_WRITEREG_PROFILING) // Register Write Profiling
1443  {
1444  AJAAutoLock autoLock(&mRegWritesLock);
1445  outRegWrites = mRegWrites;
1446  return true;
1447  }
1448 
1449  bool CNTV2DriverInterface::StartRecordRegisterWrites (const bool inSkipActualWrites)
1450  {
1451  AJAAutoLock autoLock(&mRegWritesLock);
1452  if (mRecordRegWrites)
1453  return false; // Already recording
1454  mRegWrites.clear();
1455  mRecordRegWrites = true;
1456  mSkipRegWrites = inSkipActualWrites;
1457  return true;
1458  }
1459 
1461  { // Identical to Start, but don't clear mRegWrites nor change mSkipRegWrites
1462  AJAAutoLock autoLock(&mRegWritesLock);
1463  if (mRecordRegWrites)
1464  return false; // Already recording
1465  mRecordRegWrites = true;
1466  return true;
1467  }
1468 
1470  { // NB: This will return false if paused
1471  AJAAutoLock autoLock(&mRegWritesLock);
1472  return mRecordRegWrites;
1473  }
1474 
1476  {
1477  AJAAutoLock autoLock(&mRegWritesLock);
1478  mRecordRegWrites = mSkipRegWrites = false;
1479  return true;
1480  }
1481 
1483  { // Identical to Stop, but don't change mSkipRegWrites
1484  AJAAutoLock autoLock(&mRegWritesLock);
1485  if (!mRecordRegWrites)
1486  return false; // Already stopped/paused
1487  mRecordRegWrites = false;
1488  return true;
1489  }
1490 
1492  {
1493  AJAAutoLock autoLock(&mRegWritesLock);
1494  return ULWord(mRegWrites.size());
1495  }
1496 #endif // NTV2_WRITEREG_PROFILING
1497 
1498 
1500 {
1501  ULWordSet result;
1502  if (!IsOpen())
1503  return result;
1504 
1505  // Remote/virtual device gets first dibs on answering...
1506  if (IsRemote() && _pRPCAPI->NTV2GetSupportedRemote (inEnumsID, result))
1507  return result;
1508 
1509  const NTV2DeviceID devID(GetDeviceID());
1510  switch (inEnumsID)
1511  {
1512  case kNTV2EnumsID_DeviceID:
1513  { const NTV2DeviceIDSet devIDs(::NTV2GetSupportedDevices());
1514  for (NTV2DeviceIDSetConstIter it(devIDs.begin()); it != devIDs.end(); ++it)
1515  result.insert(ULWord(*it));
1516  break;
1517  }
1518  case kNTV2EnumsID_Standard:
1519  { NTV2StandardSet standards;
1520  ::NTV2DeviceGetSupportedStandards (devID, standards);
1521  for (NTV2StandardSetConstIter it(standards.begin()); it != standards.end(); ++it)
1522  result.insert(ULWord(*it));
1523  break;
1524  }
1528  for (NTV2FrameBufferFormatSetConstIter it(pfs.begin()); it != pfs.end(); ++it)
1529  result.insert(ULWord(*it));
1530  break;
1531  }
1533  { NTV2GeometrySet fgs;
1535  for (NTV2GeometrySetConstIter it(fgs.begin()); it != fgs.end(); ++it)
1536  result.insert(ULWord(*it));
1537  break;
1538  }
1540  { NTV2FrameRateSet frs;
1542  for (NTV2FrameRateSetConstIter it(frs.begin()); it != frs.end(); ++it)
1543  result.insert(ULWord(*it));
1544  break;
1545  }
1547  { // Needs implementation
1548  break;
1549  }
1551  { NTV2VideoFormatSet vfs;
1553  for (NTV2VideoFormatSetConstIter it(vfs.begin()); it != vfs.end(); ++it)
1554  result.insert(ULWord(*it));
1555  break;
1556  }
1557  case kNTV2EnumsID_Mode:
1558  { if (IsSupported(kDeviceCanDoPlayback)) result.insert(ULWord(NTV2_MODE_OUTPUT));
1559  if (IsSupported(kDeviceCanDoCapture)) result.insert(ULWord(NTV2_MODE_INPUT));
1560  break;
1561  }
1563  { NTV2InputSourceSet srcs;
1565  for (NTV2InputSourceSetConstIter it(srcs.begin()); it != srcs.end(); ++it)
1566  result.insert(ULWord(*it));
1567  break;
1568  }
1570  { NTV2OutputDestinations dsts;
1572  for (NTV2OutputDestinationsConstIter it(dsts.begin()); it != dsts.end(); ++it)
1573  result.insert(ULWord(*it));
1574  break;
1575  }
1576  case kNTV2EnumsID_Channel:
1577  { for (ULWord ch(0); ch < GetNumSupported(kDeviceGetNumFrameStores); ch++)
1578  result.insert(ch);
1579  break;
1580  }
1583  break;
1584  NTV2InputSourceSet inpSrcs;
1585  ::NTV2DeviceGetSupportedInputSources (devID, inpSrcs);
1586  for (NTV2InputSourceSetConstIter it(inpSrcs.begin()); it != inpSrcs.end(); ++it)
1587  { const NTV2ReferenceSource refSrc (::NTV2InputSourceToReferenceSource(*it));
1589  if (result.find(ULWord(refSrc)) == result.end())
1590  result.insert(ULWord(refSrc));
1591  }
1592  result.insert(ULWord(NTV2_REFERENCE_FREERUN)); // Always include Free-Run
1594  result.insert(ULWord(NTV2_REFERENCE_EXTERNAL)); // Has external reference
1595  break;
1596  }
1598  { result.insert(ULWord(NTV2_AUDIO_48K)); // All boards support 48KHz PCM
1599  if (IsSupported(kDeviceCanDoAudio96K)) result.insert(ULWord(NTV2_AUDIO_96K));
1601  break;
1602  }
1605  break;
1606  NTV2InputSourceSet inpSrcs;
1607  ::NTV2DeviceGetSupportedInputSources (devID, inpSrcs);
1608  for (NTV2InputSourceSetConstIter it(inpSrcs.begin()); it != inpSrcs.end(); ++it)
1609  { const NTV2AudioSource audSrc (::NTV2InputSourceToAudioSource(*it));
1610  if (NTV2_IS_VALID_AUDIO_SOURCE(audSrc))
1611  if (result.find(ULWord(audSrc)) == result.end())
1612  result.insert(ULWord(audSrc));
1613  }
1614  break;
1615  }
1616  case kNTV2EnumsID_WidgetID:
1617  { NTV2WidgetIDSet wgts;
1618  CNTV2SignalRouter::GetWidgetIDs (devID, wgts);
1619  for (NTV2WidgetIDSetConstIter it(wgts.begin()); it != wgts.end(); ++it)
1620  result.insert(ULWord(*it));
1621  break;
1622  }
1625  if (::NTV2DeviceCanDoConversionMode (devID, cm))
1626  result.insert(ULWord(cm));
1627  break;
1628  }
1631  if (::NTV2DeviceCanDoInputTCIndex (devID, ndx))
1632  result.insert(ULWord(ndx));
1633  break;
1634  }
1637  if (::NTV2DeviceCanDoOutputTCIndex (devID, ndx))
1638  result.insert(ULWord(ndx));
1639  break;
1640  }
1641  default: break;
1642  }
1643  return result;
1644 }
1645 
1646 bool CNTV2DriverInterface::GetBoolParam (const ULWord inParamID, ULWord & outValue)
1647 {
1648  // Remote/virtual device gets first dibs on answering...
1649  if (IsRemote() && _pRPCAPI->NTV2GetBoolParamRemote (inParamID, outValue))
1650  return true;
1651 
1652  // Is there a register/bit that will answer this query?
1653  const NTV2BoolParamID paramID (NTV2BoolParamID(inParamID+0));
1654  { NTV2RegInfo regInfo; bool invertSense(false);
1655  if (GetRegInfoForBoolParam (paramID, regInfo, invertSense))
1656  {
1657  if (!ReadRegister (regInfo.registerNumber, regInfo.registerValue, regInfo.registerMask, regInfo.registerShift))
1658  return false;
1659  if (invertSense)
1660  outValue = regInfo.registerValue ? 0 : 1;
1661  else
1662  outValue = regInfo.registerValue ? 1 : 0;
1663  return true;
1664  }
1665  }
1666 
1667  // Call classic device features function...
1668  const NTV2DeviceID devID (GetDeviceID());
1669  switch (inParamID)
1670  {
1671  case kDeviceCanChangeEmbeddedAudioClock: outValue = ::NTV2DeviceCanChangeEmbeddedAudioClock(devID); break; // Deprecate?
1673  case kDeviceCanDisableUFC: outValue = ::NTV2DeviceCanDisableUFC(devID); break;
1674  case kDeviceCanDo2KVideo: outValue = ::NTV2DeviceCanDo2KVideo(devID); break;
1677  case kDeviceCanDo425Mux: outValue = ::NTV2DeviceCanDo425Mux(devID); break;
1678  case kDeviceCanDo4KVideo: outValue = ::NTV2DeviceCanDo4KVideo(devID); break;
1681  case kDeviceCanDoAnalogAudio: outValue = ::NTV2DeviceCanDoAnalogAudio(devID); break;
1682  case kDeviceCanDoAnalogVideoIn: outValue = ::NTV2DeviceCanDoAnalogVideoIn(devID); break;
1683  case kDeviceCanDoAnalogVideoOut: outValue = ::NTV2DeviceCanDoAnalogVideoOut(devID); break;
1684  case kDeviceCanDoAudio2Channels: outValue = GetNumSupported(kDeviceGetMaxAudioChannels) >= 2; break; // Deprecate?
1685  case kDeviceCanDoAudio6Channels: outValue = GetNumSupported(kDeviceGetMaxAudioChannels) >= 6; break; // Deprecate?
1686  case kDeviceCanDoAudio8Channels: outValue = GetNumSupported(kDeviceGetMaxAudioChannels) >= 8; break; // Deprecate?
1687  case kDeviceCanDoAudio96K: outValue = ::NTV2DeviceCanDoAudio96K(devID); break; // Deprecate?
1688  case kDeviceCanDoAudioDelay: outValue = ::NTV2DeviceCanDoAudioDelay(devID); break; // Deprecate?
1697  case kDeviceCanDoBreakoutBoard: outValue = ::NTV2DeviceCanDoBreakoutBoard(devID); break;
1698  case kDeviceCanDoBreakoutBox: outValue = ::NTV2DeviceCanDoBreakoutBox(devID); break;
1702  case kDeviceCanDoColorCorrection: outValue = GetNumSupported(kDeviceGetNumLUTs) > 0; break; // Deprecate?
1703  case kDeviceCanDoCustomAnc: outValue = ::NTV2DeviceCanDoCustomAnc(devID); break; // Deprecate?
1704  case kDeviceCanDoDSKOpacity: outValue = ::NTV2DeviceCanDoDSKOpacity(devID); break; // Deprecate?
1705  case kDeviceCanDoDualLink: outValue = ::NTV2DeviceCanDoDualLink(devID); break; // Deprecate?
1706  case kDeviceCanDoDVCProHD: outValue = ::NTV2DeviceCanDoDVCProHD(devID); break; // Deprecate?
1707  case kDeviceCanDoEnhancedCSC: outValue = ::NTV2DeviceCanDoEnhancedCSC(devID); break; // Deprecate?
1708  case kDeviceCanDoFrameStore1Display: outValue = ::NTV2DeviceCanDoFrameStore1Display(devID); break; // Deprecate?
1709  case kDeviceCanDoGPIO: outValue = ::NTV2DeviceCanDoGPIO(devID); break;
1710  case kDeviceCanDoHDMIOutStereo: outValue = ::NTV2DeviceCanDoHDMIOutStereo(devID); break; // Deprecate?
1711  case kDeviceCanDoHDV: outValue = ::NTV2DeviceCanDoHDV(devID); break; // Deprecate?
1712  case kDeviceCanDoHDVideo: outValue = ::NTV2DeviceCanDoHDVideo(devID); break; // Deprecate?
1713  case kDeviceCanDoIsoConvert: outValue = ::NTV2DeviceCanDoIsoConvert(devID); break;
1714  case kDeviceCanDoLTC: outValue = ::NTV2DeviceCanDoLTC(devID); break;
1715  case kDeviceCanDoLTCInOnRefPort: outValue = ::NTV2DeviceCanDoLTCInOnRefPort(devID); break;
1716  case kDeviceCanDoMSI: outValue = ::NTV2DeviceCanDoMSI(devID); break;
1717  case kDeviceCanDoMultiFormat: outValue = ::NTV2DeviceCanDoMultiFormat(devID); break;
1718  case kDeviceCanDoPCMControl: outValue = ::NTV2DeviceCanDoPCMControl(devID); break;
1719  case kDeviceCanDoPCMDetection: outValue = ::NTV2DeviceCanDoPCMDetection(devID); break;
1720  case kDeviceCanDoPIO: outValue = ::NTV2DeviceCanDoPIO(devID); break; // Deprecate?
1724  case kDeviceCanDoProgrammableCSC: outValue = GetNumSupported(kDeviceGetNumCSCs) > 0; break;
1726  case kDeviceCanDoProRes: outValue = ::NTV2DeviceCanDoProRes(devID); break;
1727  case kDeviceCanDoQREZ: outValue = ::NTV2DeviceCanDoQREZ(devID); break;
1728  case kDeviceCanDoQuarterExpand: outValue = ::NTV2DeviceCanDoQuarterExpand(devID); break;
1729  case kDeviceCanDoRateConvert: outValue = ::NTV2DeviceCanDoRateConvert(devID); break; // Deprecate?
1730  case kDeviceCanDoRGBPlusAlphaOut: outValue = ::NTV2DeviceCanDoRGBPlusAlphaOut(devID); break; // Deprecate?
1731  case kDeviceCanDoRP188: outValue = ::NTV2DeviceCanDoRP188(devID); break; // Deprecate?
1732  case kDeviceCanDoSDVideo: outValue = ::NTV2DeviceCanDoSDVideo(devID); break; // Deprecate?
1733  case kDeviceCanDoSDIErrorChecks: outValue = ::NTV2DeviceCanDoSDIErrorChecks(devID); break;
1734  case kDeviceCanDoStackedAudio: outValue = ::NTV2DeviceCanDoStackedAudio(devID); break; // Deprecate?
1735  case kDeviceCanDoStereoIn: outValue = ::NTV2DeviceCanDoStereoIn(devID); break; // Deprecate?
1736  case kDeviceCanDoStereoOut: outValue = ::NTV2DeviceCanDoStereoOut(devID); break; // Deprecate?
1737  case kDeviceCanDoThunderbolt: outValue = ::NTV2DeviceCanDoThunderbolt(devID); break;
1738  case kDeviceCanDoVideoProcessing: outValue = ::NTV2DeviceCanDoVideoProcessing(devID); break;
1739  case kDeviceCanMeasureTemperature: outValue = ::NTV2DeviceCanMeasureTemperature(devID); break;
1740  case kDeviceCanReportFrameSize: outValue = ::NTV2DeviceCanReportFrameSize(devID); break;
1741  case kDeviceHasBiDirectionalSDI: outValue = ::NTV2DeviceHasBiDirectionalSDI(devID); break;
1742  case kDeviceHasBracketLED: outValue = ::NTV2DeviceHasBracketLED(devID); break;
1743  case kDeviceHasColorSpaceConverterOnChannel2: outValue = ::NTV2DeviceCanDoWidget(devID, NTV2_WgtCSC2); break; // Deprecate?
1744  case kDeviceHasIDSwitch: outValue = ::NTV2DeviceCanDoIDSwitch(devID); break;
1745  case kDeviceHasNTV4FrameStores: outValue = ::NTV2DeviceHasNTV4FrameStores(devID); break;
1746  case kDeviceHasNWL: outValue = ::NTV2DeviceHasNWL(devID); break;
1747  case kDeviceHasPCIeGen2: outValue = ::NTV2DeviceHasPCIeGen2(devID); break;
1748  case kDeviceHasRetailSupport: outValue = ::NTV2DeviceHasRetailSupport(devID); break;
1749  case kDeviceHasSDIRelays: outValue = ::NTV2DeviceHasSDIRelays(devID); break;
1750  case kDeviceHasSPIFlash: outValue = ::NTV2DeviceHasSPIFlash(devID); break; // Deprecate?
1751  case kDeviceHasSPIFlashSerial: outValue = ::NTV2DeviceHasSPIFlashSerial(devID); break; // Deprecate?
1752  case kDeviceHasSPIv2: outValue = GetNumSupported(kDeviceGetSPIFlashVersion) == 2; break;
1753  case kDeviceHasSPIv3: outValue = GetNumSupported(kDeviceGetSPIFlashVersion) == 3; break;
1754  case kDeviceHasSPIv4: outValue = GetNumSupported(kDeviceGetSPIFlashVersion) == 4; break;
1755  case kDeviceIs64Bit: outValue = ::NTV2DeviceIs64Bit(devID); break; // Deprecate?
1756  case kDeviceIsDirectAddressable: outValue = ::NTV2DeviceIsDirectAddressable(devID); break; // Deprecate?
1757  case kDeviceIsExternalToHost: outValue = ::NTV2DeviceIsExternalToHost(devID); break;
1758  case kDeviceIsLocalPhysical: outValue = !IsRemote(); break;
1759  case kDeviceIsSupported: outValue = ::NTV2DeviceIsSupported(devID); break;
1760  case kDeviceNeedsRoutingSetup: outValue = ::NTV2DeviceNeedsRoutingSetup(devID); break; // Deprecate?
1762  case kDeviceCanThermostat: outValue = ::NTV2DeviceCanThermostat(devID); break;
1763  case kDeviceHasHEVCM31: outValue = ::NTV2DeviceHasHEVCM31(devID); break;
1764  case kDeviceHasHEVCM30: outValue = ::NTV2DeviceHasHEVCM30(devID); break;
1765  case kDeviceCanDoVITC2: outValue = ::NTV2DeviceCanDoVITC2(devID); break;
1766  case kDeviceCanDoHDMIHDROut: outValue = ::NTV2DeviceCanDoHDMIHDROut(devID); break;
1767  case kDeviceCanDoJ2K: outValue = ::NTV2DeviceCanDoJ2K(devID); break;
1768 
1769  case kDeviceCanDo12gRouting: outValue = ::NTV2DeviceCanDo12gRouting(devID); break;
1770  case kDeviceCanDo12GSDI: outValue = ::NTV2DeviceCanDo12GSDI(devID); break;
1771  case kDeviceCanDo2110: outValue = ::NTV2DeviceCanDo2110(devID); break;
1772  case kDeviceCanDo8KVideo: outValue = ::NTV2DeviceCanDo8KVideo(devID); break;
1773  case kDeviceCanDoAudio192K: outValue = ::NTV2DeviceCanDoAudio192K(devID); break;
1774  case kDeviceCanDoHDMIAuxCapture: outValue = ::NTV2DeviceCanDoCustomAux(devID); break;
1775  case kDeviceCanDoHDMIAuxPlayback: outValue = false && ::NTV2DeviceCanDoCustomAux(devID); break; // SDK 17.1 HDMI AUX is Capture-Only
1776  case kDeviceCanDoFramePulseSelect: outValue = ::NTV2DeviceCanDoFramePulseSelect(devID); break;
1777  case kDeviceCanDoHDMIMultiView: outValue = ::NTV2DeviceCanDoHDMIMultiView(devID); break;
1778  case kDeviceCanDoHFRRGB: outValue = ::NTV2DeviceCanDoHFRRGB(devID); break;
1779  case kDeviceCanDoIP: outValue = ::NTV2DeviceCanDoIP(devID); break;
1780  case kDeviceCanDo25GIP: outValue = ::NTV2DeviceCanDo25GIP(devID); break;
1781  case kDeviceCanDoMultiLinkAudio: outValue = ::NTV2DeviceCanDoMultiLinkAudio(devID); break;
1782  case kDeviceCanDoWarmBootFPGA: outValue = ::NTV2DeviceCanDoWarmBootFPGA(devID); break;
1787  case kDeviceHasGenlockv2: outValue = GetNumSupported(kDeviceGetGenlockVersion) == 2; break; // Deprecate
1788  case kDeviceHasGenlockv3: outValue = GetNumSupported(kDeviceGetGenlockVersion) == 3; break; // Deprecate
1789  case kDeviceHasHeadphoneJack: outValue = ::NTV2DeviceHasHeadphoneJack(devID); break;
1790  case kDeviceHasLEDAudioMeters: outValue = ::NTV2DeviceHasLEDAudioMeters(devID); break;
1791  case kDeviceHasRotaryEncoder: outValue = ::NTV2DeviceHasRotaryEncoder(devID); break;
1792  case kDeviceHasSPIv5: outValue = ::NTV2DeviceGetSPIFlashVersion(devID) == 5; break;
1793  case kDeviceHasXilinxDMA: outValue = ::NTV2DeviceHasXilinxDMA(devID); break;
1794  case kDeviceCanDoStreamingDMA: outValue = GetDeviceID() == DEVICE_ID_KONAXM; break;
1795  case kDeviceHasPWMFanControl: outValue = ::NTV2DeviceHasPWMFanControl(devID); break;
1797  || GetNumSupported(kDeviceGetNumHDMIVideoOutputs)) // At least 1 HDMI in/out
1798  && (GetDeviceID() != DEVICE_ID_KONAHDMI) // Not a KonaHDMI
1799  && (!IsSupported(kDeviceCanDoAudioMixer)); // No audio mixer
1800  break;
1803  case kDeviceCanDoVersalSysMon: outValue = ::NTV2DeviceCanDoVersalSysMon(devID); break;
1806  default: return false; // Bad param
1807  }
1808  return true; // Successfully used old ::NTV2DeviceCanDo function
1809 
1810 } // GetBoolParam
1811 
1812 
1813 bool CNTV2DriverInterface::GetNumericParam (const ULWord inParamID, ULWord & outVal)
1814 {
1815  outVal = 0;
1816 
1817  // Remote/virtual device gets first dibs on answering...
1818  if (IsRemote() && _pRPCAPI->NTV2GetNumericParamRemote (inParamID, outVal))
1819  return true;
1820 
1821  // Is there a register that will answer this query?
1822  const NTV2NumericParamID paramID (NTV2NumericParamID(inParamID+0));
1823  { NTV2RegInfo regInfo;
1824  if (GetRegInfoForNumericParam (paramID, regInfo))
1825  return ReadRegister (regInfo.registerNumber, outVal, regInfo.registerMask, regInfo.registerShift);
1826  }
1827 
1828  // Call classic device features function...
1829  const NTV2DeviceID devID (GetDeviceID());
1830  switch (paramID)
1831  {
1832  case kDeviceGetActiveMemorySize: outVal = ::NTV2DeviceGetActiveMemorySize (devID); break;
1833  case kDeviceGetDACVersion: outVal = ::NTV2DeviceGetDACVersion (devID); break;
1835  case kDeviceGetGenlockVersion: outVal = ULWord(::NTV2DeviceGetGenlockVersion (devID)); break;
1836  case kDeviceGetHDMIVersion: outVal = ::NTV2DeviceGetHDMIVersion (devID); break;
1837  case kDeviceGetLUTVersion: outVal = ::NTV2DeviceGetLUTVersion (devID); break;
1838  case kDeviceGetMaxAudioChannels: outVal = ::NTV2DeviceGetMaxAudioChannels (devID); break;
1839  case kDeviceGetMaxRegisterNumber: outVal = ::NTV2DeviceGetMaxRegisterNumber (devID); break;
1840  case kDeviceGetMaxTransferCount: outVal = ::NTV2DeviceGetMaxTransferCount (devID); break;
1850  case kDeviceGetNumAudioSystems: outVal = ::NTV2DeviceGetNumAudioSystems (devID); break;
1852  + (IsSupported(kDeviceCanDoAudioMixer) ? 1 : 0); break;
1854  case kDeviceGetNumCSCs: outVal = ::NTV2DeviceGetNumCSCs (devID); break;
1855  case kDeviceGetNumDMAEngines: outVal = ::NTV2DeviceGetNumDMAEngines (devID); break;
1856  case kDeviceGetNumDownConverters: outVal = ::NTV2DeviceGetNumDownConverters (devID); break;
1859  case kDeviceGetNumFrameStores: outVal = ::NTV2DeviceGetNumFrameStores (devID); break;
1860  case kDeviceGetNumFrameSyncs: outVal = ::NTV2DeviceGetNumFrameSyncs (devID); break;
1866  case kDeviceGetNumLTCInputs: outVal = ::NTV2DeviceGetNumLTCInputs (devID); break;
1867  case kDeviceGetNumLTCOutputs: outVal = ::NTV2DeviceGetNumLTCOutputs (devID); break;
1868  case kDeviceGetNumLUTs: outVal = ::NTV2DeviceGetNumLUTs (devID); break;
1869  case kDeviceGetNumMixers: outVal = ::NTV2DeviceGetNumMixers (devID); break;
1872  case kDeviceGetNumSerialPorts: outVal = ::NTV2DeviceGetNumSerialPorts (devID); break;
1873  case kDeviceGetNumTSIMuxers: { static const NTV2WidgetID s425MuxerIDs[] = {NTV2_Wgt425Mux1, NTV2_Wgt425Mux2,
1876  for (size_t ndx(0); ndx < sizeof(s425MuxerIDs)/sizeof(NTV2WidgetID); ndx++)
1877  if (wgtIDs.find(s425MuxerIDs[ndx]) != wgtIDs.end())
1878  outVal++;
1879  break;
1880  }
1881  case kDeviceGetNumUpConverters: outVal = ::NTV2DeviceGetNumUpConverters (devID); break;
1882  case kDeviceGetNumVideoChannels: outVal = ::NTV2DeviceGetNumVideoChannels (devID); break;
1883  case kDeviceGetNumVideoInputs: outVal = ::NTV2DeviceGetNumVideoInputs (devID); break;
1884  case kDeviceGetNumVideoOutputs: outVal = ::NTV2DeviceGetNumVideoOutputs (devID); break;
1885  case kDeviceGetPingLED: outVal = ::NTV2DeviceGetPingLED (devID); break;
1886  case kDeviceGetSPIFlashVersion: outVal = ::NTV2DeviceGetSPIFlashVersion (devID); break;
1888  + (IsSupported(kDeviceCanDoAudioMixer) ? 2 : 0); break;
1889  case kDeviceGetUFCVersion: outVal = ::NTV2DeviceGetUFCVersion (devID); break;
1890  default: return false; // Bad param
1891  }
1892  return true; // Successfully used old ::NTV2DeviceGetNum function
1893 
1894 } // GetNumericParam
1895 
1896 
1897 bool CNTV2DriverInterface::GetRegInfoForBoolParam (const NTV2BoolParamID inParamID, NTV2RegInfo & outRegInfo, bool & outFlipSense)
1898 {
1899  outRegInfo.MakeInvalid();
1900  outFlipSense = false;
1901  switch (inParamID)
1902  {
1911 
1912  // kDeviceHasBreakoutBoard's sense is opposite of "BOBAbsent", so set outFlipSense 'true':
1913  case kDeviceHasBreakoutBoard: outRegInfo.Set(kRegBOBStatus, 0, kRegMaskBOBAbsent, kRegShiftBOBAbsent); outFlipSense = true; break;
1914 
1915  default: break;
1916  }
1917  return outRegInfo.IsValid();
1918 }
1919 
1920 
1922 {
1923  outRegInfo.MakeInvalid();
1924  switch (inParamID)
1925  {
1927  default: break;
1928  }
1929  return outRegInfo.IsValid();
1930 }
1931 
1932 
1934 { (void)msgSet; (void) enable;
1935  return false;
1936 }
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:1486
See Io XT.
Definition: ntv2enums.h:44
virtual bool GetNumericParam(const ULWord inParamID, ULWord &outValue)
Defines the KonaIP/IoIP registers.
virtual bool ControlDriverDebugMessages(NTV2_DriverDebugMessageSet msgSet, bool enable)
Everything needed to call CNTV2Card::ReadRegister or CNTV2Card::WriteRegister functions.
const char * NTV2InterruptEnumString(const unsigned inInterruptEnum)
Definition: ntv2debug.cpp:1179
#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.
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)
Answers with the NTV2RegInfo of the register associated with the given boolean (i.e., "Can Do") device feature.
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:77
#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.
static bool GetFirstDeviceWithID(const NTV2DeviceID inDeviceID, CNTV2Card &outDevice)
Rescans the host, and returns an open CNTV2Card instance for the first AJA device found on the host t...
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:1462
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.
NTV2DeviceIDSet NTV2GetSupportedDevices(const NTV2DeviceKinds inKinds=NTV2_DEVICEKIND_ALL)
Returns an NTV2DeviceIDSet of devices supported by the SDK.
Definition: ntv2utils.cpp:7733
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)
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
I interrogate and control an AJA video/audio capture/playout device.
Definition: ntv2card.h:28
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:221
True if device can squeeze/stretch between 1920x1080/1280x1080 and 1280x720/960x720.
#define BIT(_x_)
Definition: ajatypes.h:596
True if device can do 3G level B to 3G level A conversion.
True if device supports an AJA breakout box.
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.
uint32_t * PULWord
Definition: ajatypes.h:237
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:77
std::string valueForKey(const std::string &inKey) const
const std::string & DeviceSpec(void) const
NTV2InputVideoSelect
Definition: ntv2enums.h:2299
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
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)
size_t GetByteCount(void) const
bool NTV2DeviceHasNTV4FrameStores(const NTV2DeviceID inDeviceID)
bool NTV2DeviceCanDoAnalogAudio(const NTV2DeviceID inDeviceID)
#define kNTV2PluginRegInfoKey_Copyright
Plugin copyright notice.
Definition: ntv2nubaccess.h:79
True if device can display/output video from FrameStore 1.
The number of independent Audio Systems on the device.
void setDeviceIndexNumber(const UWord num)
Identifies the NTV2AudioRate enumerated type.
#define kNTV2PluginRegInfoKey_Vendor
Plugin vendor (manufacturer) name.
Definition: ntv2nubaccess.h:73
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)
UWord NTV2DeviceGetNumDownConverters(const NTV2DeviceID inDeviceID)
#define kNTV2PluginRegInfoKey_ShortName
Plugin short name.
Definition: ntv2nubaccess.h:76
True if device can detect which audio channel pairs are not carrying PCM (Pulse Code Modulation) audi...
UWord NTV2DeviceGetNumSerialPorts(const NTV2DeviceID inDeviceID)
virtual bool Close(void)
Closes me, releasing host resources that may have been allocated in a previous Open call...
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)
#define SAREK_REGS
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.
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
Declares the CNTV2SpiFlash and CNTV2AxiSpiFlash classes.
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:3956
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:3832
See KONA 5.
Definition: ntv2enums.h:58
std::set< NTV2OutputDestination > NTV2OutputDestinations
A set of distinct NTV2OutputDestination values.
static void SetOverlappedMode(const bool inOverlapMode)
Specifies if the next Open call should try to open the device in overlapped mode or not...
virtual uint32_t Offset(SpiFlashSection sectionID=SPI_FLASH_SECTION_TOTAL)
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 kRegSarekMBUptime
#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:1359
#define BITSTREAM_FRAGMENT
Used in NTV2Bitstream to indicate bitstream is a fragment.
virtual bool SetInterruptEventCount(const INTERRUPT_ENUMS inEventCode, const ULWord inCount)
Resets my interrupt event tally for the given interrupt type. (This is my count of the number of succ...
virtual NTV2Dictionary ConnectParams(void) const
short HANDLE
Definition: ajatypes.h:298
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.
bool NTV2DeviceCanDoMSI(const NTV2DeviceID inDeviceID)
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:1244
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:262
virtual size_t GetProgramStreamLength(void) const
Definition: ntv2bitfile.h:210
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:93
NTV2TCIndex
These enum values are indexes into the capture/playout AutoCirculate timecode arrays.
Definition: ntv2enums.h:3954
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:1459
True if device SDI connectors are bi-directional.
static bool GetFirstDeviceWithName(const std::string &inNameSubString, CNTV2Card &outDevice)
Rescans the host, and returns an open CNTV2Card instance for the first AJA device whose device identi...
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.
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)
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.
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:78
Invalid or "not found".
Definition: ntv2enums.h:100
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:1046
bool NTV2DeviceCanDoHDV(const NTV2DeviceID inDeviceID)
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:1457
#define kRegSarekIfVersion
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.
static bool GetDeviceWithSerial(const std::string &inSerialNumber, CNTV2Card &outDevice)
Rescans the host, and returns an open CNTV2Card instance for the first AJA device whose serial number...
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:1859
#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)
Answers with the NTV2RegInfo of the register associated with the given numeric (i.e., "Get Num") device feature.
Software device that doesn&#39;t emulate one of the above devices.
Definition: ntv2enums.h:83
#define kNTV2PluginRegInfoKey_Description
Brief plugin description.
Definition: ntv2nubaccess.h:78
#define kRegSarekMBState
All new NTV2 structs start with this common header.
NTV2RegWrites NTV2RegisterReads
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.
_EventHandles mInterruptEventHandles
For subscribing to each possible event, one for each interrupt type.
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)
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.
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.
virtual bool GetPackageInformation(PACKAGE_INFO_STRUCT &outPkgInfo)
Answers with the IP device&#39;s package information.
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:1362
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.
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.
See KONA LHi.
Definition: ntv2enums.h:79
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:3352
True if device can report its frame size.
bool NTV2DeviceCanDisableUFC(const NTV2DeviceID inDeviceID)
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)
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
The number of analog audio output channels on the device.
See KONA 5.
Definition: ntv2enums.h:64
virtual bool Read(const uint32_t address, std::vector< uint8_t > &data, uint32_t maxBytes=1)
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:350
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 number of interrupts of the given type processed by the driver.
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:2912
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.
_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:1361
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.
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)
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:2023
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:2008
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:1246
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)
virtual bool ConfigureSubscription(const bool bSubscribe, const INTERRUPT_ENUMS inInterruptType, PULWord &outSubcriptionHdl)
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 number of interrupt events that I successfully waited for.
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:3717
std::set< NTV2DeviceID > NTV2DeviceIDSet
A set of NTV2DeviceIDs.
Definition: ntv2utils.h:1044
True if device has an HEVC M30 encoder/decoder.
void * GetHostPointer(void) const
See KONA X™.
Definition: ntv2enums.h:82
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:4903
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.
NTV2RegisterWrites mRegWrites
Stores WriteRegister data.
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)
bool mSkipRegWrites
True if actual register writes are skipped while recording.
See KONA X™.
Definition: ntv2enums.h:80
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 SAREK_IF_VERSION
#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...
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:94
static bool IsValid(uint64_t pid)
Definition: process.cpp:41
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:5025
True if Audio System(s) support a 96kHz sample rate.
virtual ULWord GetNumRecordedRegisterWrites(void) const
True if device has any AES audio inputs or outputs.
See KONA XM™.
Definition: ntv2enums.h:81
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.
virtual HANDLE GetInterruptEvent(const INTERRUPT_ENUMS eInterruptType)
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)