AJA NTV2 SDK  18.1.0.2505
NTV2 SDK 18.1.0.2505
ntv2register.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #include "ntv2card.h"
9 #include "ntv2devicefeatures.h"
10 #include "ntv2utils.h"
11 #include "ntv2konaflashprogram.h"
12 #include "ntv2konaflashprogram.h"
13 #include "ntv2vpid.h"
14 #include "ajabase/system/debug.h"
16 #include <math.h>
17 #include <assert.h>
18 #if defined (MSWindows)
19  #pragma warning(disable: 4800)
20 #endif
21 
22 #define HEX16(__x__) "0x" << hex << setw(16) << setfill('0') << uint64_t(__x__) << dec
23 #define INSTP(_p_) HEX16(uint64_t(_p_))
24 #define CVIDFAIL(__x__) AJA_sERROR (AJA_DebugUnit_VideoGeneric, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
25 #define CVIDWARN(__x__) AJA_sWARNING(AJA_DebugUnit_VideoGeneric, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
26 #define CVIDNOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_VideoGeneric, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
27 #define CVIDINFO(__x__) AJA_sINFO (AJA_DebugUnit_VideoGeneric, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
28 #define CVIDDBG(__x__) AJA_sDEBUG (AJA_DebugUnit_VideoGeneric, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
29 
30 using namespace std;
31 
32 // Indexes into array
33 #define NOMINAL_H 0
34 #define MIN_H 1
35 #define MAX_H 2
36 #define NOMINAL_V 3
37 #define MIN_V 4
38 #define MAX_V 5
39 
40 
41 // Timing constants for K2 and KLS boards
42 #define K2_NOMINAL_H 0x1000
43 #define K2_MIN_H (K2_NOMINAL_H-0x800)
44 #define K2_MAX_H (K2_NOMINAL_H+0x800)
45 #define K2_NOMINAL_V 0x0800
46 #define K2_MIN_V (K2_NOMINAL_V-0x400)
47 #define K2_MAX_V (K2_NOMINAL_V+0x400)
48 
49 #define KLS_NOMINAL_525_H 0x0640
50 #define KLS_MIN_525_H 0x0000
51 #define KLS_MAX_525_H 0x06B3
52 #define KLS_NOMINAL_525_V 0x010A
53 #define KLS_MIN_525_V 0x0001
54 #define KLS_MAX_525_V 0x020D
55 
56 #define KLS_NOMINAL_625_H 0x0638
57 #define KLS_MIN_625_H 0x0000
58 #define KLS_MAX_625_H 0x06BF
59 #define KLS_NOMINAL_625_V 0x0139
60 #define KLS_MIN_625_V 0x0001
61 #define KLS_MAX_625_V 0x0271
62 
63 
64 // These static tables eliminate a lot of switch statements.
65 // CAUTION: These are predicated on NTV2Channel being ordinal (NTV2_CHANNEL1==0, NTV2_CHANNEL2==1, etc.)
68 
71 
74 
77 
80 #if !defined(NTV2_DEPRECATE_16_2)
83 #endif // !defined(NTV2_DEPRECATE_16_2)
85 
88 
91 
94 
97 
99 
101 
102 #if defined (NTV2_ALLOW_2MB_FRAMES)
105 #endif // defined (NTV2_ALLOW_2MB_FRAMES)
106 
119 
121 
123 
132 
137 
140 
143 
146 
149 
158 
167 
172 
173 #define ARFAIL(__x__) AJA_sERROR (AJA_DebugUnit_AcquireRelease, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
174 #define ARWARN(__x__) AJA_sWARNING(AJA_DebugUnit_AcquireRelease, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
175 #define ARNOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_AcquireRelease, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
176 #define ARINFO(__x__) AJA_sINFO (AJA_DebugUnit_AcquireRelease, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
177 #define ARDBG(__x__) AJA_sDEBUG (AJA_DebugUnit_AcquireRelease, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
178 
179 // Method: SetEveryFrameServices
180 // Input: NTV2TaskMode
181 // Output: NONE
183 {
184  if (!NTV2_IS_VALID_TASK_MODE(inMode))
185  {ARFAIL(GetDescription() << ": invalid task mode " << DEC(inMode)); return false;}
186  NTV2TaskMode oldMode(NTV2_TASK_MODE_INVALID), newMode(oldMode);
187  GetTaskMode(oldMode);
188  if (inMode == oldMode)
189  {ARDBG(GetDescription() << ": task mode '" << ::NTV2TaskModeToString(oldMode,true) << "' unchanged"); return true;}
190  ARDBG(GetDescription() << ": about to change task mode from '" << ::NTV2TaskModeToString(oldMode,true) << "' to '" << ::NTV2TaskModeToString(inMode,true) << "'");
191  const bool result (WriteRegister(kVRegEveryFrameTaskFilter, ULWord(inMode)));
192  GetTaskMode(newMode);
193  if (result && newMode != inMode)
194  ARWARN(GetDescription() << ": task mode now '" << ::NTV2TaskModeToString(newMode,true) << "' after being set to '" << ::NTV2TaskModeToString(inMode,true) << "'");
195  if (result && newMode == inMode)
196  ARINFO(GetDescription() << ": task mode changed from '" << ::NTV2TaskModeToString(oldMode,true) << "' to '" << ::NTV2TaskModeToString(newMode,true) << "'");
197  if (!result)
198  ARFAIL(GetDescription() << ": failed to change task mode from '" << ::NTV2TaskModeToString(oldMode,true) << "' to '" << ::NTV2TaskModeToString(inMode,true) << "'");
199  return result;
200 }
201 
203 {
204  return driverInterface().ReadRegister(kVRegEveryFrameTaskFilter, outMode);
205 }
206 
207 #if !defined(NTV2_DEPRECATE_16_3)
209  {
210  return WriteRegister(kVRegDefaultVideoOutMode, mode);
211  }
212 
214  {
215  return ReadRegister (kVRegDefaultVideoOutMode, outMode);
216  }
217 #endif // !defined(NTV2_DEPRECATE_16_3)
218 
219 // Method: WriteGlobalControlBits
220 // When pGlobalControl is NULL, this behaves exactly like a normal masked WriteRegister call. When
221 // non-NULL, the write is accumulated into *pGlobalControl instead of hitting hardware, so a run of
222 // calls that target the same global control register collapse into a single deferred value; a call
223 // that targets a *different* register first flushes whatever was pending. Callers must invoke
224 // FlushGlobalControlWrite() once they're done batching to commit the final accumulated value.
225 // The accumulator is owned by the caller (see SetVideoFormat), not CNTV2Card member state, so
226 // concurrent callers batching on the same card instance don't race with each other.
227 bool CNTV2Card::WriteGlobalControlBits (const ULWord regNum, const ULWord value, const ULWord mask, const ULWord shift, GlobalControlRegWrite * pGlobalControl)
228 {
229  if (!pGlobalControl)
230  return WriteRegister (regNum, value, mask, shift);
231 
232  if (pGlobalControl->isValid && pGlobalControl->regNum != regNum)
233  FlushGlobalControlWrite (pGlobalControl); // switching registers -- commit whatever was pending first
234 
235  if (!pGlobalControl->isValid)
236  {
237  if (!ReadRegister (regNum, pGlobalControl->regValue))
238  return false;
239  pGlobalControl->regNum = regNum;
240  pGlobalControl->isValid = true;
241  }
242  pGlobalControl->regValue = (pGlobalControl->regValue & ~mask) | ((value << shift) & mask);
243  return true;
244 }
245 
246 // Method: FlushGlobalControlWrite
248 {
249  if (!pGlobalControl || !pGlobalControl->isValid)
250  return true;
251  const bool ok (WriteRegister (pGlobalControl->regNum, pGlobalControl->regValue));
252  pGlobalControl->isValid = false;
253  return ok;
254 }
255 
256 // Method: SetVideoFormat
257 // Input: NTV2VideoFormat
258 // Output: NONE
259 bool CNTV2Card::SetVideoFormat (const NTV2VideoFormat value, const bool inIsRetail, const bool keepVancSettings, const NTV2Channel inChannel)
260 { AJA_UNUSED(keepVancSettings)
261  bool ajaRetail(inIsRetail);
262 #ifdef MSWindows
263  NTV2TaskMode mode;
264  GetTaskMode(mode);
265  if(mode == NTV2_STANDARD_TASKS)
266  ajaRetail = true;
267 #endif
268  const NTV2Channel channel(IsMultiFormatActive() ? inChannel : NTV2_CHANNEL1);
269  int hOffset(0), vOffset(0);
270 
271  if (ajaRetail)
272  { // Get the current H and V timing offsets
273  GetVideoHOffset(hOffset);
274  GetVideoVOffset(vOffset);
275  }
276 
277  if (NTV2_IS_TSI_FORMAT(value))
278  { const ULWordSet itms (GetSupportedItems(kNTV2EnumsID_VideoFormat));
279  if (itms.find(ULWord(value)) == itms.end())
280  return false;
281  }
282 
283  NTV2Standard inStandard = GetNTV2StandardFromVideoFormat(value);
284  if(inStandard == NTV2_STANDARD_2Kx1080p && NTV2_IS_PSF_VIDEO_FORMAT(value))
285  {
286  inStandard = NTV2_STANDARD_2Kx1080i;
287  }
288  else if(inStandard == NTV2_STANDARD_3840x2160p && NTV2_IS_PSF_VIDEO_FORMAT(value))
289  {
290  inStandard = NTV2_STANDARD_3840i;
291  }
292  else if(inStandard == NTV2_STANDARD_4096x2160p && NTV2_IS_PSF_VIDEO_FORMAT(value))
293  {
294  inStandard = NTV2_STANDARD_4096i;
295  }
296  NTV2FrameRate inFrameRate = GetNTV2FrameRateFromVideoFormat(value);
298  bool squares;
299 
300  // Set the standard, frame geometry, frame rate and SMPTE 372 dual-link option for this video format
301  // all at once -- these fields share the global control register(s), and committing them one at a
302  // time (as SetStandard/SetFrameGeometry/SetFrameRate/SetSmpte372 normally do) can transiently park
303  // the register in a combination that doesn't correspond to any valid format. globalControl is a
304  // stack-local accumulator (not CNTV2Card member state), so this is safe under concurrent calls.
305  GlobalControlRegWrite globalControl;
306  SetStandard(inStandard, channel, &globalControl);
307  SetFrameGeometry(inFrameGeometry, ajaRetail, channel, &globalControl);
308  SetFrameRate(inFrameRate, channel, &globalControl);
309  SetSmpte372(NTV2_IS_3Gb_FORMAT(value), channel, &globalControl);
310  FlushGlobalControlWrite(&globalControl);
311 
312  // set virtual video format
313  WriteRegister (kVRegVideoFormatCh1 + channel, value);
314 
315  //This will handle 4k formats
316  if (NTV2_IS_QUAD_FRAME_FORMAT(value))
317  {
318  SetQuadQuadFrameEnable(false, channel);
319  Get4kSquaresEnable(squares, channel);
320  if (squares)
321  {
322  Set4kSquaresEnable(true, channel);
323  }
324  else
325  {
326  SetQuadFrameEnable(true, channel);
327  }
328  }
329  else if (NTV2_IS_QUAD_QUAD_FORMAT(value))
330  {
331  GetQuadQuadSquaresEnable(squares, channel);
332  if (squares)
333  {
334  SetQuadQuadSquaresEnable(true, channel);
335  }
336  else
337  {
338  SetQuadQuadFrameEnable(true, channel);
339  }
340  }
341  else
342  {
343  // Non-quad format
344  SetQuadFrameEnable(false, channel);
345  SetQuadQuadFrameEnable(false, channel);
346  if (!IsMultiFormatActive())
347  {
348  CopyVideoFormat(channel, NTV2_CHANNEL1, NTV2Channel(GetNumSupported(kDeviceGetNumFrameStores) - 1));//NTV2_CHANNEL8);
349  }
350  }
351 
352  // Set Progressive Picture State
353  SetProgressivePicture(IsProgressivePicture(value));
354 
355  if (ajaRetail)
356  {
357  // Set the H and V timing (note: this will also set the nominal value for this given format)
358  SetVideoHOffset(hOffset);
359  SetVideoVOffset(vOffset);
360  }
361  else
362  {
363  // All other cards
364  WriteOutputTimingControl(K2_NOMINAL_H | (K2_NOMINAL_V<<16), channel);
365  }
366 
367  if (IsSupported(kDeviceCanDoMultiFormat) && !IsMultiFormatActive())
368  {
369  // Copy channel 1 register write mode to all channels in single format mode
370  NTV2RegisterWriteMode writeMode;
371  GetRegisterWriteMode(writeMode);
372  SetRegisterWriteMode(writeMode);
373  }
374 
375  return true;
376 }
377 
378 bool CNTV2Card::SetVideoFormat (const NTV2ChannelSet & inFrameStores, const NTV2VideoFormat inVideoFormat, bool inIsAJARetail)
379 {
380  size_t errors(0);
381  for (NTV2ChannelSetConstIter it(inFrameStores.begin()); it != inFrameStores.end(); ++it)
382  if (!SetVideoFormat(inVideoFormat, inIsAJARetail, false, *it))
383  errors++;
384  return errors == 0;
385 }
386 
387 // Method: GetVideoFormat
388 // Input: NONE
389 // Output: NTV2VideoFormat
391 {
392  if (!IsMultiFormatActive () && !IsMultiRasterWidgetChannel(inChannel))
393  inChannel = NTV2_CHANNEL1;
394 
395  NTV2Standard standard;
396  GetStandard (standard, inChannel);
397 
398  NTV2FrameGeometry frameGeometry;
399  GetFrameGeometry (frameGeometry, inChannel);
400 
401  NTV2FrameRate frameRate;
402  GetFrameRate (frameRate, inChannel);
403 
404  ULWord smpte372Enabled;
405  GetSmpte372 (smpte372Enabled, inChannel);
406 
407  ULWord progressivePicture;
408  GetProgressivePicture (progressivePicture);
409 
410  bool isSquares = false;
411  if (NTV2_IS_QUAD_FRAME_GEOMETRY(frameGeometry))
412  {
413  if (!IsSupported(kDeviceCanDo12gRouting))
414  isSquares = true;
415  else
416  Get4kSquaresEnable(isSquares, inChannel);
417  }
418 
419  return ::NTV2DeviceGetVideoFormatFromState_Ex2 (&outValue, frameRate, frameGeometry, standard, smpte372Enabled, progressivePicture, isSquares);
420 }
421 
422 // -------------------------------------------- BEGIN BLOCK
423 // GetNTV2VideoFormat functions
424 // These static functions don't work correctly, and are subject to deprecation. They remain here only by our fiat.
425 
426 NTV2VideoFormat CNTV2Card::GetNTV2VideoFormat(NTV2FrameRate frameRate, UByte inputGeometry, bool progressiveTransport, bool isThreeG, bool progressivePicture)
427 {
428  NTV2Standard standard = GetNTV2StandardFromScanGeometry(inputGeometry, progressiveTransport);
429  return GetNTV2VideoFormat(frameRate, standard, isThreeG, inputGeometry, progressivePicture);
430 }
431 
432 NTV2VideoFormat CNTV2Card::GetNTV2VideoFormat (NTV2FrameRate frameRate, NTV2Standard standard, bool isThreeG, UByte inputGeometry, bool progressivePicture, bool isSquareDivision)
433 {
434  NTV2VideoFormat videoFormat = NTV2_FORMAT_UNKNOWN;
435 
436  switch (standard)
437  {
438  case NTV2_STANDARD_525:
439  switch (frameRate)
440  {
441  case NTV2_FRAMERATE_2997: videoFormat = progressivePicture ? NTV2_FORMAT_525psf_2997 : NTV2_FORMAT_525_5994; break;
442  case NTV2_FRAMERATE_2400: videoFormat = NTV2_FORMAT_525_2400; break;
443  case NTV2_FRAMERATE_2398: videoFormat = NTV2_FORMAT_525_2398; break;
444  default: break;
445  }
446  break;
447 
448  case NTV2_STANDARD_625:
449  if (frameRate == NTV2_FRAMERATE_2500)
450  videoFormat = progressivePicture ? NTV2_FORMAT_625psf_2500 : NTV2_FORMAT_625_5000;
451  break;
452 
453  case NTV2_STANDARD_720:
454  switch (frameRate)
455  {
456  case NTV2_FRAMERATE_6000: videoFormat = NTV2_FORMAT_720p_6000; break;
457  case NTV2_FRAMERATE_5994: videoFormat = NTV2_FORMAT_720p_5994; break;
458  case NTV2_FRAMERATE_5000: videoFormat = NTV2_FORMAT_720p_5000; break;
459  case NTV2_FRAMERATE_2398: videoFormat = NTV2_FORMAT_720p_2398; break;
460  default: break;
461  }
462  break;
463 
464  case NTV2_STANDARD_1080:
466  switch (frameRate)
467  {
468  case NTV2_FRAMERATE_3000:
469  if (isThreeG && progressivePicture)
470  videoFormat = NTV2_FORMAT_1080p_6000_B;
471  else
472  videoFormat = progressivePicture ? NTV2_FORMAT_1080psf_3000_2 : NTV2_FORMAT_1080i_6000;
473  break;
474  case NTV2_FRAMERATE_2997:
475  if (isThreeG && progressivePicture)
476  videoFormat = NTV2_FORMAT_1080p_5994_B;
477  else
478  videoFormat = progressivePicture ? NTV2_FORMAT_1080psf_2997_2 : NTV2_FORMAT_1080i_5994;
479  break;
480  case NTV2_FRAMERATE_2500:
481  if (isThreeG && progressivePicture)
482  {
483  if (inputGeometry == 8)
484  videoFormat = NTV2_FORMAT_1080psf_2K_2500;
485  else
486  videoFormat = NTV2_FORMAT_1080p_5000_B;
487  }
488  else if (inputGeometry == 8)
489  videoFormat = NTV2_FORMAT_1080psf_2K_2500;
490  else
491  videoFormat = progressivePicture ? NTV2_FORMAT_1080psf_2500_2 : NTV2_FORMAT_1080i_5000;
492  break;
493  case NTV2_FRAMERATE_2400:
494  if (isThreeG)
495  {
496  videoFormat = inputGeometry == 8 ? NTV2_FORMAT_1080p_2K_4800_B : NTV2_FORMAT_UNKNOWN;
497  }
498  else
499  {
500  videoFormat = inputGeometry == 8 ? NTV2_FORMAT_1080psf_2K_2400 : NTV2_FORMAT_1080psf_2400;
501  }
502  break;
503  case NTV2_FRAMERATE_2398:
504  if (isThreeG)
505  {
506  videoFormat = inputGeometry == 8 ? NTV2_FORMAT_1080p_2K_4795_B : NTV2_FORMAT_UNKNOWN;
507  }
508  else
509  {
510  videoFormat = inputGeometry == 8 ? NTV2_FORMAT_1080psf_2K_2398 : NTV2_FORMAT_1080psf_2398;
511  }
512  break;
513  default: break; // Unsupported
514  }
515  break;
516 
517  case NTV2_STANDARD_1080p:
519  switch (frameRate)
520  {
521  case NTV2_FRAMERATE_12000: videoFormat = NTV2_FORMAT_4x2048x1080p_12000; break; // There's no single quadrant raster defined for 120 Hz raw
522  case NTV2_FRAMERATE_11988: videoFormat = NTV2_FORMAT_4x2048x1080p_11988; break; // There's no single quadrant raster defined for 119.88 Hz raw
523  case NTV2_FRAMERATE_6000: videoFormat = inputGeometry == 8 ? NTV2_FORMAT_1080p_2K_6000_A : NTV2_FORMAT_1080p_6000_A; break;
524  case NTV2_FRAMERATE_5994: videoFormat = inputGeometry == 8 ? NTV2_FORMAT_1080p_2K_5994_A : NTV2_FORMAT_1080p_5994_A; break;
525  case NTV2_FRAMERATE_4800: videoFormat = NTV2_FORMAT_1080p_2K_4800_A; break; // There's no 1920 raster defined at 48 Hz
526  case NTV2_FRAMERATE_4795: videoFormat = NTV2_FORMAT_1080p_2K_4795_A; break; // There's no 1920 raster defined at 47.95 Hz
527  case NTV2_FRAMERATE_5000: videoFormat = inputGeometry == 8 ? NTV2_FORMAT_1080p_2K_5000_A : NTV2_FORMAT_1080p_5000_A; break;
528  case NTV2_FRAMERATE_3000: videoFormat = inputGeometry == 8 ? NTV2_FORMAT_1080p_2K_3000 : NTV2_FORMAT_1080p_3000; break;
529  case NTV2_FRAMERATE_2997: videoFormat = inputGeometry == 8 ? NTV2_FORMAT_1080p_2K_2997 : NTV2_FORMAT_1080p_2997; break;
530  case NTV2_FRAMERATE_2500: videoFormat = inputGeometry == 8 ? NTV2_FORMAT_1080p_2K_2500 : NTV2_FORMAT_1080p_2500; break;
531  case NTV2_FRAMERATE_2400: videoFormat = inputGeometry == 8 ? NTV2_FORMAT_1080p_2K_2400 : NTV2_FORMAT_1080p_2400; break;
532  case NTV2_FRAMERATE_2398: videoFormat = inputGeometry == 8 ? NTV2_FORMAT_1080p_2K_2398 : NTV2_FORMAT_1080p_2398; break;
533  default: break; // Unsupported
534  }
535  break;
536 
537  case NTV2_STANDARD_2K: // 2kx1556
538  switch (frameRate)
539  {
540  case NTV2_FRAMERATE_1500: videoFormat = NTV2_FORMAT_2K_1500; break;
541  case NTV2_FRAMERATE_1498: videoFormat = NTV2_FORMAT_2K_1498; break;
542  case NTV2_FRAMERATE_2400: videoFormat = NTV2_FORMAT_2K_2400; break;
543  case NTV2_FRAMERATE_2398: videoFormat = NTV2_FORMAT_2K_2398; break;
544  case NTV2_FRAMERATE_2500: videoFormat = NTV2_FORMAT_2K_2500; break;
545  default: break; // Unsupported
546  }
547  break;
548 
549  case NTV2_STANDARD_3840HFR: videoFormat = NTV2_FORMAT_UNKNOWN; break;
550 
552  switch (frameRate)
553  {
554  case NTV2_FRAMERATE_2398: videoFormat = isSquareDivision ? NTV2_FORMAT_4x1920x1080p_2398 : NTV2_FORMAT_3840x2160p_2398; break;
555  case NTV2_FRAMERATE_2400: videoFormat = isSquareDivision ? NTV2_FORMAT_4x1920x1080p_2400 : NTV2_FORMAT_3840x2160p_2400; break;
556  case NTV2_FRAMERATE_2500: videoFormat = isSquareDivision ? NTV2_FORMAT_4x1920x1080p_2500 : NTV2_FORMAT_3840x2160p_2500; break;
557  case NTV2_FRAMERATE_2997: videoFormat = isSquareDivision ? NTV2_FORMAT_4x1920x1080p_2997 : NTV2_FORMAT_3840x2160p_2997; break;
558  case NTV2_FRAMERATE_3000: videoFormat = isSquareDivision ? NTV2_FORMAT_4x1920x1080p_3000 : NTV2_FORMAT_3840x2160p_3000; break;
559  case NTV2_FRAMERATE_5000: videoFormat = isSquareDivision ? NTV2_FORMAT_4x1920x1080p_5000 : NTV2_FORMAT_3840x2160p_5000; break;
560  case NTV2_FRAMERATE_5994: videoFormat = isSquareDivision ? NTV2_FORMAT_4x1920x1080p_5994 : NTV2_FORMAT_3840x2160p_5994; break;
561  case NTV2_FRAMERATE_6000: videoFormat = isSquareDivision ? NTV2_FORMAT_4x1920x1080p_6000 : NTV2_FORMAT_3840x2160p_6000; break;
562  default: videoFormat = NTV2_FORMAT_UNKNOWN; break;
563  }
564  break;
565 
566  case NTV2_STANDARD_3840i:
567  switch (frameRate)
568  {
569  case NTV2_FRAMERATE_2398: videoFormat = isSquareDivision ? NTV2_FORMAT_4x1920x1080psf_2398 : NTV2_FORMAT_3840x2160psf_2398; break;
570  case NTV2_FRAMERATE_2400: videoFormat = isSquareDivision ? NTV2_FORMAT_4x1920x1080psf_2400 : NTV2_FORMAT_3840x2160psf_2400; break;
571  case NTV2_FRAMERATE_2500: videoFormat = isSquareDivision ? NTV2_FORMAT_4x1920x1080psf_2500 : NTV2_FORMAT_3840x2160psf_2500; break;
572  case NTV2_FRAMERATE_2997: videoFormat = isSquareDivision ? NTV2_FORMAT_4x1920x1080psf_2997 : NTV2_FORMAT_3840x2160psf_2997; break;
573  case NTV2_FRAMERATE_3000: videoFormat = isSquareDivision ? NTV2_FORMAT_4x1920x1080psf_3000 : NTV2_FORMAT_3840x2160psf_3000; break;
574  default: videoFormat = NTV2_FORMAT_UNKNOWN; break;
575  }
576  break;
577 
578  case NTV2_STANDARD_4096HFR: videoFormat = NTV2_FORMAT_UNKNOWN; break;
579 
581  switch (frameRate)
582  {
583  case NTV2_FRAMERATE_2398: videoFormat = isSquareDivision ? NTV2_FORMAT_4x2048x1080p_2398 : NTV2_FORMAT_4096x2160p_2398; break;
584  case NTV2_FRAMERATE_2400: videoFormat = isSquareDivision ? NTV2_FORMAT_4x2048x1080p_2400 : NTV2_FORMAT_4096x2160p_2400; break;
585  case NTV2_FRAMERATE_2500: videoFormat = isSquareDivision ? NTV2_FORMAT_4x2048x1080p_2500 : NTV2_FORMAT_4096x2160p_2500; break;
586  case NTV2_FRAMERATE_2997: videoFormat = isSquareDivision ? NTV2_FORMAT_4x2048x1080p_2997 : NTV2_FORMAT_4096x2160p_2997; break;
587  case NTV2_FRAMERATE_3000: videoFormat = isSquareDivision ? NTV2_FORMAT_4x2048x1080p_3000 : NTV2_FORMAT_4096x2160p_3000; break;
588  case NTV2_FRAMERATE_4795: videoFormat = isSquareDivision ? NTV2_FORMAT_4x2048x1080p_4795 : NTV2_FORMAT_4096x2160p_4795; break;
589  case NTV2_FRAMERATE_4800: videoFormat = isSquareDivision ? NTV2_FORMAT_4x2048x1080p_4800 : NTV2_FORMAT_4096x2160p_4800; break;
590  case NTV2_FRAMERATE_5000: videoFormat = isSquareDivision ? NTV2_FORMAT_4x2048x1080p_5000 : NTV2_FORMAT_4096x2160p_5000; break;
591  case NTV2_FRAMERATE_5994: videoFormat = isSquareDivision ? NTV2_FORMAT_4x2048x1080p_5994 : NTV2_FORMAT_4096x2160p_5994; break;
592  case NTV2_FRAMERATE_6000: videoFormat = isSquareDivision ? NTV2_FORMAT_4x2048x1080p_6000 : NTV2_FORMAT_4096x2160p_6000; break;
593  default: videoFormat = NTV2_FORMAT_UNKNOWN; break;
594  }
595  break;
596 
597  case NTV2_STANDARD_4096i:
598  switch (frameRate)
599  {
600  case NTV2_FRAMERATE_2398: videoFormat = isSquareDivision ? NTV2_FORMAT_4x2048x1080psf_2398 : NTV2_FORMAT_4096x2160psf_2398; break;
601  case NTV2_FRAMERATE_2400: videoFormat = isSquareDivision ? NTV2_FORMAT_4x2048x1080psf_2400 : NTV2_FORMAT_4096x2160psf_2400; break;
602  case NTV2_FRAMERATE_2500: videoFormat = isSquareDivision ? NTV2_FORMAT_4x2048x1080psf_2500 : NTV2_FORMAT_4096x2160psf_2500; break;
603  case NTV2_FRAMERATE_2997: videoFormat = isSquareDivision ? NTV2_FORMAT_4x2048x1080psf_2997 : NTV2_FORMAT_4096x2160psf_2997; break;
604  case NTV2_FRAMERATE_3000: videoFormat = isSquareDivision ? NTV2_FORMAT_4x2048x1080psf_3000 : NTV2_FORMAT_4096x2160psf_3000; break;
605  default: videoFormat = NTV2_FORMAT_UNKNOWN; break;
606  }
607  break;
608 
609  case NTV2_STANDARD_7680:
610  switch(frameRate)
611  {
612  case NTV2_FRAMERATE_2398: videoFormat = NTV2_FORMAT_4x3840x2160p_2398; break;
613  case NTV2_FRAMERATE_2400: videoFormat = NTV2_FORMAT_4x3840x2160p_2400; break;
614  case NTV2_FRAMERATE_2500: videoFormat = NTV2_FORMAT_4x3840x2160p_2500; break;
615  case NTV2_FRAMERATE_2997: videoFormat = NTV2_FORMAT_4x3840x2160p_2997; break;
616  case NTV2_FRAMERATE_3000: videoFormat = NTV2_FORMAT_4x3840x2160p_3000; break;
617  case NTV2_FRAMERATE_5000: videoFormat = NTV2_FORMAT_4x3840x2160p_5000; break;
618  case NTV2_FRAMERATE_5994: videoFormat = NTV2_FORMAT_4x3840x2160p_5994; break;
619  case NTV2_FRAMERATE_6000: videoFormat = NTV2_FORMAT_4x3840x2160p_6000; break;
620  default: videoFormat = NTV2_FORMAT_UNKNOWN;
621  }
622  break;
623 
624  case NTV2_STANDARD_8192:
625  switch(frameRate)
626  {
627  case NTV2_FRAMERATE_2398: videoFormat = NTV2_FORMAT_4x4096x2160p_2398; break;
628  case NTV2_FRAMERATE_2400: videoFormat = NTV2_FORMAT_4x4096x2160p_2400; break;
629  case NTV2_FRAMERATE_2500: videoFormat = NTV2_FORMAT_4x4096x2160p_2500; break;
630  case NTV2_FRAMERATE_2997: videoFormat = NTV2_FORMAT_4x4096x2160p_2997; break;
631  case NTV2_FRAMERATE_3000: videoFormat = NTV2_FORMAT_4x4096x2160p_3000; break;
632  case NTV2_FRAMERATE_4795: videoFormat = NTV2_FORMAT_4x4096x2160p_4795; break;
633  case NTV2_FRAMERATE_4800: videoFormat = NTV2_FORMAT_4x4096x2160p_4800; break;
634  case NTV2_FRAMERATE_5000: videoFormat = NTV2_FORMAT_4x4096x2160p_5000; break;
635  case NTV2_FRAMERATE_5994: videoFormat = NTV2_FORMAT_4x4096x2160p_5994; break;
636  case NTV2_FRAMERATE_6000: videoFormat = NTV2_FORMAT_4x4096x2160p_6000; break;
637  default: videoFormat = NTV2_FORMAT_UNKNOWN;
638  }
639  break;
640 
642  videoFormat = NTV2_FORMAT_UNKNOWN;
643  break;
644  }
645 
646  return videoFormat;
647 
648 } // GetNTV2VideoFormat
649 
650 // -------------------------------------------- END BLOCK
651 
652 bool CNTV2Card::GetNominalMinMaxHV (int & outNominalH, int & outMinH, int & outMaxH, int & outNominalV, int & outMinV, int & outMaxV)
653 {
654  NTV2VideoFormat videoFormat;
655  // Get current video format to find nominal value
656  if (GetVideoFormat(videoFormat))
657  {
658  // Kona2 has static nominal H value for all formats
659  outNominalH = K2_NOMINAL_H;
660  outMinH = K2_MIN_H;
661  outMaxH = K2_MAX_H;
662 
663  outNominalV = K2_NOMINAL_V;
664  outMinV = K2_MIN_V;
665  outMaxV = K2_MAX_V;
666  return true;
667  }
668  return false;
669 }
670 
671 bool CNTV2Card::SetVideoHOffset (int hOffset, const UWord inOutputSpigot)
672 {
673  int nominalH(0), minH(0), maxH(0), nominalV(0), minV(0), maxV(0), count(0);
674  ULWord timingValue(0), lineCount(0), lineCount2(0);
675  NTV2DeviceID boardID(GetDeviceID());
676 
677  // Get the nominal values for H and V
678  if (!GetNominalMinMaxHV(nominalH, minH, maxH, nominalV, minV, maxV))
679  return false;
680 
681  // Apply offset to nominal value (K2 you increment the timing by adding the timing value)
682  if (::NTV2DeviceNeedsRoutingSetup(boardID))
683  nominalH = nominalH + hOffset;
684  else
685  nominalH = nominalH - hOffset;
686 
687  // Clamp this value so that it doesn't exceed max, min
688  if (nominalH > maxH)
689  nominalH = maxH;
690  else if (nominalH < minH)
691  nominalH = minH;
692 
693  if (!ReadOutputTimingControl(timingValue, inOutputSpigot))
694  return false;
695 
696  // Handle special cases where we increment or decrement the timing by one
697  // Some hardware LS/LH cannot handle this and inorder to do 1 pixel timing moves
698  // we need to move by 3 then subtract 2, or subtract 3 then add 2 depending on
699  // direction. Also we need to wait at least one horizontal line between the values
700  // we set.
701 
702  if (LWord((timingValue & 0x0000FFFF)) == nominalH)
703  return true; // Nothing to change
704  if (((LWord((timingValue & 0x0000FFFF)) + 1) == nominalH) )
705  {
706  // Add 3 to the timing value. Note that nominalH is already advanced by one so
707  // we just need to add 2.
708  timingValue &= 0xFFFF0000;
709  timingValue |= ULWord(nominalH + 2);
710  WriteOutputTimingControl(timingValue, inOutputSpigot);
711 
712  // Wait a scanline
714 
715  // Now move timing back by 2.
716  timingValue -= 2;
717  }
718  else if ( ((LWord((timingValue & 0x0000FFFF)) -1) == nominalH ) )
719  {
720  // Subtract 3 from the timing value. Note that nominalH is already decremented by one so
721  // we just need to subtract 2.
722  timingValue &= 0xFFFF0000;
723  timingValue |= ULWord(nominalH - 2);
724  WriteOutputTimingControl(timingValue, inOutputSpigot);
725 
726  // Wait a scanline
728 
729  // Now move timing forward by 2.
730  timingValue += 2;
731  }
732  else
733  {
734  // Setting arbitrary value so we don't need to do the +3-2 or -3+2 trick and
735  // we can just set the new value
736  timingValue &= 0xFFFF0000;
737  timingValue |= ULWord(nominalH);
738  }
739  return WriteOutputTimingControl(timingValue, inOutputSpigot);
740 } // SetVideoHOffset
741 
742 
743 bool CNTV2Card::GetVideoHOffset (int & outHOffset, const UWord inOutputSpigot)
744 {
745  int nominalH(0), minH(0), maxH(0), nominalV(0), minV(0), maxV(0);
746 
747  // Get the nominal values for H and V...
748  if (!GetNominalMinMaxHV(nominalH, minH, maxH, nominalV, minV, maxV))
749  return false;
750 
751  ULWord timingValue(0);
752  if (!ReadOutputTimingControl(timingValue, inOutputSpigot))
753  return false;
754  timingValue &= 0xFFFF; // lower 16 bits has H timing value -- 0x1000 is nominal
755 
756  // Get offset from nominal value (K2 you increment the timing by adding the timing value)
757  if (::NTV2DeviceNeedsRoutingSetup(GetDeviceID()))
758  outHOffset = int(timingValue) - nominalH;
759  else
760  outHOffset = nominalH - int(timingValue);
761  return true;
762 }
763 
764 bool CNTV2Card::SetVideoVOffset (int vOffset, const UWord inOutputSpigot)
765 {
766  int nominalH(0), minH(0), maxH(0), nominalV(0), minV(0), maxV(0);
767 
768  // Get the nominal values for H and V
769  if (!GetNominalMinMaxHV(nominalH, minH, maxH, nominalV, minV, maxV))
770  return false;
771 
772  // Apply offset to nominal value (K2 you increment the timing by adding the timing value)
773  if (::NTV2DeviceNeedsRoutingSetup(GetDeviceID()))
774  nominalV = nominalV + vOffset;
775  else
776  nominalV = nominalV - vOffset;
777 
778  // Clamp this value so that it doesn't exceed max, min
779  if (nominalV > maxV)
780  nominalV = maxV;
781  else if (nominalV < minV)
782  nominalV = minV;
783 
784  ULWord timingValue(0);
785  if (!ReadOutputTimingControl(timingValue, inOutputSpigot))
786  return false;
787  timingValue &= 0x0000FFFF; // Clear V value, keep H value
788  return WriteOutputTimingControl(timingValue | ULWord(nominalV << 16), inOutputSpigot); // Change only the V value
789 }
790 
791 bool CNTV2Card::GetVideoVOffset (int & outVOffset, const UWord inOutputSpigot)
792 {
793  int nominalH(0), minH(0), maxH(0), nominalV(0), minV(0), maxV(0);
794 
795  // Get the nominal values for H and V
796  if (!GetNominalMinMaxHV(nominalH, minH, maxH, nominalV, minV, maxV))
797  return false;
798 
799  ULWord timingValue(0);
800  if (!ReadOutputTimingControl(timingValue, inOutputSpigot))
801  return false;
802  timingValue = (timingValue >> 16);
803 
804  // Get offset from nominal value (K2 you increment the timing by adding the timing value)
805  if (::NTV2DeviceNeedsRoutingSetup(GetDeviceID()))
806  outVOffset = int(timingValue) - nominalV;
807  else
808  outVOffset = nominalV - int(timingValue);
809  return true;
810 }
811 
812 #if !defined(NTV2_DEPRECATE_16_2)
813  bool CNTV2Card::GetNumberActiveLines (ULWord & outNumActiveLines)
814  {
815  outNumActiveLines = 0;
816  NTV2Standard st; NTV2VANCMode vm;
817  if (!GetStandard(st) || !GetVANCMode(vm))
818  return false;
819  const NTV2FormatDescriptor fd(st, NTV2_FBF_10BIT_YCBCR, vm);
820  return fd.GetRasterHeight();
821  }
822 
823  bool CNTV2Card::GetActiveFrameDimensions (NTV2FrameDimensions & outFrameDimensions, const NTV2Channel inChannel)
824  {
826  outFrameDimensions.Reset();
827  if (IsXilinxProgrammed() && GetStandard(st, inChannel) && GetVANCMode(vm, inChannel))
828  { const NTV2FormatDescriptor fd (st, NTV2_FBF_10BIT_YCBCR, vm);
829  outFrameDimensions.Set (fd.GetRasterWidth(), fd.GetRasterHeight());
830  }
831  return outFrameDimensions.IsValid();
832  }
833 
834 
836  {
838  if (!IsXilinxProgrammed() || !GetStandard(st, inChannel) || !GetVANCMode(vm, inChannel))
839  return result;
840  const NTV2FormatDescriptor fd (st, NTV2_FBF_10BIT_YCBCR, vm);
841  return result.Set (fd.GetRasterWidth(), fd.GetRasterHeight());
842  }
843 #endif // defined(NTV2_DEPRECATE_16_2)
844 
845 // Method: SetStandard
846 // Input: NTV2Standard
847 // Output: NONE
849 {
850  return SetStandard (value, inChannel, NULL);
851 }
852 
853 bool CNTV2Card::SetStandard (NTV2Standard value, NTV2Channel inChannel, GlobalControlRegWrite * pGlobalControl)
854 {
855  if (IsMultiRasterWidgetChannel(inChannel))
856  return WriteRegister (kRegMROutControl, value, kRegMaskStandard, kRegShiftStandard);
857  if (!IsMultiFormatActive())
858  inChannel = NTV2_CHANNEL1;
859 
860  NTV2Standard newStandard (value);
861  if (NTV2_IS_QUAD_QUAD_STANDARD(newStandard))
862  newStandard = GetQuarterSizedStandard(newStandard);
863  if (NTV2_IS_QUAD_STANDARD(newStandard))
864  newStandard = GetQuarterSizedStandard(newStandard);
865  if (NTV2_IS_2K1080_STANDARD(newStandard))
867 
868  return WriteGlobalControlBits (gChannelToGlobalControlRegNum[inChannel], newStandard, kRegMaskStandard, kRegShiftStandard, pGlobalControl);
869 }
870 
871 // Method: GetStandard
872 // Input: NONE
873 // Output: NTV2Standard
874 bool CNTV2Card::GetStandard (NTV2Standard & outValue, NTV2Channel inChannel)
875 {
876  if (IsMultiRasterWidgetChannel(inChannel))
878  if (!IsMultiFormatActive())
879  inChannel = NTV2_CHANNEL1;
881  if (status && IsSupported(kDeviceCanDo4KVideo))// || IsSupported(kDeviceCanDo425Mux)))
882  {
883  bool quadFrameEnabled(false);
884  status = GetQuadFrameEnable(quadFrameEnabled, inChannel);
885  if (status && quadFrameEnabled)
886  outValue = Get4xSizedStandard(outValue);
887  if( status && IsSupported(kDeviceCanDo8KVideo))
888  {
889  bool quadQuadFrameEnabled(false);
890  status = GetQuadQuadFrameEnable(quadQuadFrameEnabled);
891  if(status && quadQuadFrameEnabled)
892  outValue = Get4xSizedStandard(outValue);
893  }
894  }
895  return status;
896 }
897 
898 // Method: IsProgressiveStandard
899 // Input: NONE
900 // Output: bool
901 bool CNTV2Card::IsProgressiveStandard (bool & outIsProgressive, NTV2Channel inChannel)
902 {
903  ULWord smpte372Enabled (0);
905  outIsProgressive = false;
906 
907  if (!IsMultiFormatActive())
908  inChannel = NTV2_CHANNEL1;
909 
910  if (GetStandard (standard, inChannel) && GetSmpte372 (smpte372Enabled, inChannel))
911  {
912  if (standard == NTV2_STANDARD_720 || standard == NTV2_STANDARD_1080p || smpte372Enabled)
913  outIsProgressive = true;
914  return true;
915  }
916  return false;
917 }
918 
919 // Method: IsSDStandard
920 // Input: NONE
921 // Output: bool
922 bool CNTV2Card::IsSDStandard (bool & outIsStandardDef, NTV2Channel inChannel)
923 {
925  outIsStandardDef = false;
926 
927  if (!IsMultiFormatActive())
928  inChannel = NTV2_CHANNEL1;
929 
930  if (GetStandard (standard, inChannel))
931  {
932  if (standard == NTV2_STANDARD_525 || standard == NTV2_STANDARD_625)
933  outIsStandardDef = true; // SD standard
934  return true;
935  }
936  return false;
937 }
938 
939 
940 // Method: SetFrameGeometry
941 // Input: NTV2FrameGeometry
942 // Output: NONE
943 bool CNTV2Card::SetFrameGeometry (NTV2FrameGeometry value, bool ajaRetail, NTV2Channel channel)
944 {
945  return SetFrameGeometry (value, ajaRetail, channel, NULL);
946 }
947 
948 bool CNTV2Card::SetFrameGeometry (NTV2FrameGeometry value, bool ajaRetail, NTV2Channel channel, GlobalControlRegWrite * pGlobalControl)
949 {
950 #ifdef MSWindows
951  NTV2TaskMode mode;
952  GetTaskMode(mode);
953  if(mode == NTV2_STANDARD_TASKS)
954  ajaRetail = true;
955 #else
956  (void) ajaRetail;
957 #endif
958  if (IsMultiRasterWidgetChannel(channel))
959  return false;
960  if (!IsMultiFormatActive())
961  channel = NTV2_CHANNEL1;
962  else if (IS_CHANNEL_INVALID(channel))
963  return false;
964 
965  const ULWord regNum (gChannelToGlobalControlRegNum [channel]);
966  const NTV2FrameGeometry newGeometry (value);
968 
969  // This is the geometry of a single FB widget. Note this is the same as newGeometry unless it is a 4K format
970  NTV2FrameGeometry newFrameStoreGeometry = newGeometry;
971  NTV2FrameGeometry oldGeometry;
972  bool status = GetFrameGeometry(oldGeometry, channel);
973  if ( !status )
974  return status;
975 
976  status = GetLargestFrameBufferFormatInUse(format);
977  if ( !status )
978  return status;
979 
980  // If quad frame geometry, each of 4 frame buffers geometry is one quarter of full size
981  if (IsSupported(kDeviceCanDo4KVideo))
982  {
983  newFrameStoreGeometry = newGeometry;
984  if (NTV2_IS_QUAD_QUAD_FRAME_GEOMETRY(newFrameStoreGeometry))
985  {
986  newFrameStoreGeometry = GetQuarterSizedGeometry(newFrameStoreGeometry);
987  }
988  if (NTV2_IS_QUAD_FRAME_GEOMETRY(newFrameStoreGeometry))
989  {
990  newFrameStoreGeometry = GetQuarterSizedGeometry(newFrameStoreGeometry);
991  }
992  }
993 
994  ULWord oldFrameBufferSize = ::NTV2DeviceGetFrameBufferSize(_boardID, oldGeometry, format);
995  ULWord newFrameBufferSize = ::NTV2DeviceGetFrameBufferSize(_boardID, newGeometry, format);
996  bool changeBufferSize = IsSupported(kDeviceCanChangeFrameBufferSize) && (oldFrameBufferSize != newFrameBufferSize);
997 
998  status = WriteGlobalControlBits (regNum, newFrameStoreGeometry, kRegMaskGeometry, kRegShiftGeometry, pGlobalControl);
999 #if !defined(NTV2_DEPRECATE_17_2)
1000  // If software set the frame buffer size, read the values from hardware
1001  if ( GetFBSizeAndCountFromHW(_ulFrameBufferSize, _ulNumFrameBuffers) )
1002  {
1003  changeBufferSize = false;
1004  }
1005 
1006  // Unfortunately, on boards that support 2k, the
1007  // numframebuffers and framebuffersize might need to
1008  // change.
1009  if ( changeBufferSize )
1010  {
1011  _ulFrameBufferSize = newFrameBufferSize;
1012  _ulNumFrameBuffers = ::NTV2DeviceGetNumberFrameBuffers(_boardID, newGeometry, format);
1013  }
1014 #endif
1015  return status;
1016 }
1017 
1018 // Method: GetFrameGeometry
1019 // Input: NONE
1020 // Output: NTV2FrameGeometry
1022 {
1023  outValue = NTV2_FG_INVALID;
1024  if (IsMultiRasterWidgetChannel(inChannel))
1025  { // TBD: Determine if multiraster is UHD or 4K:
1026  outValue = 1 ? NTV2_FG_4x1920x1080 : NTV2_FG_4x2048x1080;
1027  return true;
1028  }
1029  if (!IsMultiFormatActive())
1030  inChannel = NTV2_CHANNEL1;
1031  else if (IS_CHANNEL_INVALID(inChannel))
1032  return false;
1033 
1035  // special case for quad-frame (4 frame buffer) geometry
1036  if (status && (IsSupported(kDeviceCanDo4KVideo) || IsSupported(kDeviceCanDo425Mux)))
1037  {
1038  bool quadFrameEnabled(false);
1039  status = GetQuadFrameEnable(quadFrameEnabled, inChannel);
1040  if (status && quadFrameEnabled)
1041  outValue = Get4xSizedGeometry(outValue);
1042  if (status && IsSupported(kDeviceCanDo8KVideo))
1043  {
1044  bool quadQuadFrameEnabled(false);
1045  status = GetQuadQuadFrameEnable(quadQuadFrameEnabled);
1046  if (status && quadQuadFrameEnabled)
1047  outValue = Get4xSizedGeometry(outValue);
1048  }
1049  }
1050  return status;
1051 }
1052 
1053 // Method: SetFramerate
1054 // Input: NTV2FrameRate
1055 // Output: NONE
1057 {
1058  GlobalControlRegWrite globalControl;
1059  SetFrameRate (value, inChannel, &globalControl);
1060  return FlushGlobalControlWrite(&globalControl);
1061 }
1062 
1064 {
1065  const ULWord loValue (value & 0x7);
1066  const ULWord hiValue ((value & 0x8) >> 3);
1067 
1068  if (IsMultiRasterWidgetChannel(inChannel))
1069  return false;
1070  if (!IsMultiFormatActive ())
1071  inChannel = NTV2_CHANNEL1;
1072 
1073  return WriteGlobalControlBits (gChannelToGlobalControlRegNum[inChannel], loValue, kRegMaskFrameRate, kRegShiftFrameRate, pGlobalControl) &&
1074  WriteGlobalControlBits (gChannelToGlobalControlRegNum[inChannel], hiValue, kRegMaskFrameRateHiBit, kRegShiftFrameRateHiBit, pGlobalControl);
1075 }
1076 
1077 // Method: GetFrameRate
1078 // Input: NONE
1079 // Output: NTV2FrameRate
1081 {
1082  ULWord returnVal1 (0), returnVal2 (0);
1083  outValue = NTV2_FRAMERATE_UNKNOWN;
1084  if (IsMultiRasterWidgetChannel(inChannel))
1085  return CNTV2DriverInterface::ReadRegister(kRegMROutControl, outValue, /*mask*/0x00000070, /*shift*/4);
1086  if (!IsMultiFormatActive())
1087  inChannel = NTV2_CHANNEL1;
1088  else if (IS_CHANNEL_INVALID(inChannel))
1089  return false;
1090 
1091  if (ReadRegister (gChannelToGlobalControlRegNum[inChannel], returnVal1, kRegMaskFrameRate, kRegShiftFrameRate) &&
1092  ReadRegister (gChannelToGlobalControlRegNum[inChannel], returnVal2, kRegMaskFrameRateHiBit, kRegShiftFrameRateHiBit))
1093  {
1094  outValue = NTV2FrameRate((returnVal1 & 0x7) | ((returnVal2 & 0x1) << 3));
1095  return true;
1096  }
1097  return false;
1098 }
1099 
1100 // Method: SetSmpte372
1101 bool CNTV2Card::SetSmpte372 (ULWord inValue, NTV2Channel inChannel)
1102 {
1103  return SetSmpte372 (inValue, inChannel, NULL);
1104 }
1105 
1106 bool CNTV2Card::SetSmpte372 (ULWord inValue, NTV2Channel inChannel, GlobalControlRegWrite * pGlobalControl)
1107 {
1108  // Set true (1) to put card in SMPTE 372 dual-link mode (used for 1080p60, 1080p5994, 1080p50)
1109  // Set false (0) to disable this mode
1110  if (IsMultiRasterWidgetChannel(inChannel))
1111  return inValue == 0;
1112  if (!IsMultiFormatActive())
1113  inChannel = NTV2_CHANNEL1;
1114 
1115  return WriteGlobalControlBits (gChannelToSmpte372RegisterNum [inChannel], inValue, gChannelToSmpte372Masks [inChannel], gChannelToSmpte372Shifts [inChannel], pGlobalControl);
1116 }
1117 
1118 // Method: GetSmpte372
1119 bool CNTV2Card::GetSmpte372 (ULWord & outValue, NTV2Channel inChannel)
1120 {
1121  // Return true (1) if card in SMPTE 372 dual-link mode (used for 1080p60, 1080p5994, 1080p50)
1122  // Return false (0) if this mode is disabled
1123  if (IsMultiRasterWidgetChannel(inChannel))
1124  {outValue = 0; return true;}
1125  if (!IsMultiFormatActive())
1126  inChannel = NTV2_CHANNEL1;
1127 
1128  return ReadRegister (gChannelToSmpte372RegisterNum[inChannel], outValue, gChannelToSmpte372Masks[inChannel], gChannelToSmpte372Shifts[inChannel]);
1129 }
1130 
1131 // Method: SetProgressivePicture
1132 // Input: bool -- Set true (1) to put card video format into progressive mode (used for 1080psf25 vs 1080i50, etc);
1133 // Set false (0) to disable this mode
1134 // Output: NONE
1136 {
1137  return WriteRegister (kVRegProgressivePicture, value);
1138 }
1139 
1140 // Method: GetProgressivePicture
1141 // Input: NONE
1142 // Output: bool -- Return true (1) if card video format is progressive (used for 1080psf25 vs 1080i50, etc);
1143 // Return false (0) if this mode is disabled
1145 {
1146  ULWord returnVal (0);
1147  bool result1 (ReadRegister (kVRegProgressivePicture, returnVal));
1148  outValue = result1 ? returnVal : 0;
1149  return result1;
1150 }
1151 
1152 // Method: SetQuadFrameEnable
1153 // Input: bool
1154 // Output: NONE
1155 bool CNTV2Card::SetQuadFrameEnable (const bool inEnable, const NTV2Channel inChannel)
1156 {
1157  if (!IsSupported(kDeviceCanDo4KVideo))
1158  return false;
1159  if (IsMultiRasterWidgetChannel(inChannel))
1160  return inEnable == true;
1161  bool ok(NTV2_IS_VALID_CHANNEL(inChannel));
1162 
1163  // Set true (1) to enable a Quad Frame Geometry
1164  // Set false (0) to disable this mode
1165  if (inEnable)
1166  {
1167  if (IsSupported(kDeviceCanDo12gRouting))
1168  {
1169  if (ok) ok = SetTsiFrameEnable(true, inChannel);
1170  }
1171  else if (IsSupported(kDeviceCanDo425Mux))
1172  {
1173  if(ok) ok = SetTsiFrameEnable(true, inChannel);
1174  }
1175  else
1176  {
1177  if(ok) ok = Set4kSquaresEnable(true, inChannel);
1178  }
1179  }
1180  else
1181  {
1182  SetTsiFrameEnable(false, inChannel);
1183  Set4kSquaresEnable(false, inChannel);
1184  }
1185  return ok;
1186 }
1187 
1188 bool CNTV2Card::SetQuadQuadFrameEnable (const bool inEnable, const NTV2Channel inChannel)
1189 {
1190  if (!IsSupported(kDeviceCanDo8KVideo))
1191  return false;
1192  if (IsMultiRasterWidgetChannel(inChannel))
1193  return false;
1194  bool ok(NTV2_IS_VALID_CHANNEL(inChannel));
1195  if (inEnable)
1196  {
1197  if (!IsMultiFormatActive())
1198  {
1199  if(ok) ok = SetQuadFrameEnable(true, NTV2_CHANNEL1);
1200  if(ok) ok = SetQuadFrameEnable(true, NTV2_CHANNEL2);
1201  if(ok) ok = SetQuadFrameEnable(true, NTV2_CHANNEL3);
1202  if(ok) ok = SetQuadFrameEnable(true, NTV2_CHANNEL4);
1203  }
1204  else if (inChannel < NTV2_CHANNEL3)
1205  {
1206  if(ok) ok = SetQuadFrameEnable(true, NTV2_CHANNEL1);
1207  if(ok) ok = SetQuadFrameEnable(true, NTV2_CHANNEL2);
1208  }
1209  else if (inChannel < NTV2_CHANNEL5)
1210  {
1211  if(ok) ok = SetQuadFrameEnable(true, NTV2_CHANNEL3);
1212  if(ok) ok = SetQuadFrameEnable(true, NTV2_CHANNEL4);
1213  }
1214  }
1215  else
1216  {
1217  if(ok) ok = SetQuadQuadSquaresEnable(false, inChannel);
1218  }
1219 
1220  if (!IsMultiFormatActive())
1221  {
1222  WriteRegister(kRegGlobalControl3, ULWord(inEnable ? 1 : 0), kRegMaskQuadQuadMode, kRegShiftQuadQuadMode);
1223  WriteRegister(kRegGlobalControl3, ULWord(inEnable ? 1 : 0), kRegMaskQuadQuadMode2, kRegShiftQuadQuadMode2);
1224  }
1225  else
1226  {
1227  if (ok) ok = WriteRegister(kRegGlobalControl3, ULWord(inEnable ? 1 : 0), (inChannel < NTV2_CHANNEL3) ? kRegMaskQuadQuadMode : kRegMaskQuadQuadMode2, (inChannel < NTV2_CHANNEL3) ? kRegShiftQuadQuadMode : kRegShiftQuadQuadMode2);
1228  }
1229  if (inEnable)
1230  {
1231  if (inChannel < NTV2_CHANNEL3)
1232  {
1233  if (ok) ok = CopyVideoFormat(inChannel, NTV2_CHANNEL1, NTV2_CHANNEL2);
1234  }
1235  else
1236  {
1237  if (ok) ok = CopyVideoFormat(inChannel, NTV2_CHANNEL3, NTV2_CHANNEL4);
1238  }
1239  }
1240  return ok;
1241 }
1242 
1243 bool CNTV2Card::SetQuadQuadSquaresEnable (const bool inValue, const NTV2Channel inChannel)
1244 {
1245  (void)inChannel;
1246  bool ok(IsSupported(kDeviceCanDo8KVideo));
1247  if (inValue)
1248  {
1249  if (ok) ok = SetQuadFrameEnable(true, NTV2_CHANNEL1);
1250  if (ok) ok = SetQuadFrameEnable(true, NTV2_CHANNEL2);
1251  if(ok) ok = SetQuadFrameEnable(true, NTV2_CHANNEL3);
1252  if(ok) ok = SetQuadFrameEnable(true, NTV2_CHANNEL4);
1253  if(ok) ok = SetQuadQuadFrameEnable(true, NTV2_CHANNEL1);
1254  if(ok) ok = SetQuadQuadFrameEnable(true, NTV2_CHANNEL3);
1255  }
1256  if(ok) ok = WriteRegister(kRegGlobalControl3, ULWord(inValue ? 1 : 0), kRegMaskQuadQuadSquaresMode, kRegShiftQuadQuadSquaresMode);
1257  return ok;
1258 }
1259 
1260 bool CNTV2Card::GetQuadQuadSquaresEnable (bool & outValue, const NTV2Channel inChannel)
1261 {
1262  (void)inChannel;
1263  if (!IsSupported(kDeviceCanDo8KVideo))
1264  return false;
1265 
1267 }
1268 
1269 // Method: GetQuadFrameEnable
1270 // Input: NONE
1271 // Output: bool
1272 bool CNTV2Card::GetQuadFrameEnable (bool & outValue, const NTV2Channel inChannel)
1273 {
1274  // Return true (1) Quad Frame Geometry is enabled
1275  // Return false (0) if this mode is disabled
1276  bool quadEnabled (0);
1277  bool status2 (true);
1278  bool s425Enabled (false);
1279  bool status1 = Get4kSquaresEnable (quadEnabled, inChannel);
1280  if (IsSupported(kDeviceCanDo425Mux) || IsSupported(kDeviceCanDo12gRouting))
1281  status2 = GetTsiFrameEnable (s425Enabled, inChannel);
1282 
1283  outValue = (status1 & status2) ? ((quadEnabled | s425Enabled) ? true : false) : false;
1284  return status1;
1285 }
1286 
1287 bool CNTV2Card::GetQuadQuadFrameEnable (bool & outValue, const NTV2Channel inChannel)
1288 {
1289  (void) inChannel; // Channel ignored for now
1290  outValue = false;
1291  if (IsSupported(kDeviceCanDo8KVideo))
1292  {
1293  if (inChannel < NTV2_CHANNEL3)
1295  else
1297  }
1298  return true;
1299 }
1300 
1301 bool CNTV2Card::Set4kSquaresEnable (const bool inEnable, NTV2Channel inChannel)
1302 {
1303  bool status = true;
1304 
1305  if (!IsSupported(kDeviceCanDo4KVideo))
1306  return false;
1307  if (IsMultiRasterWidgetChannel(inChannel))
1308  return inEnable == true;
1309  if (!NTV2_IS_VALID_CHANNEL(inChannel))
1310  return false;
1311 
1312  if (inEnable)
1313  {
1314  // enable quad frame, disable 425
1315  if (!IsMultiFormatActive())
1316  status = WriteRegister(kRegGlobalControl2, 1, kRegMaskQuadMode, kRegShiftQuadMode) &&
1318  WriteRegister(kRegGlobalControl2, 0, kRegMask425FB12, kRegShift425FB12) &&
1319  WriteRegister(kRegGlobalControl2, 0, kRegMask425FB34, kRegShift425FB34) &&
1320  WriteRegister(kRegGlobalControl2, 0, kRegMask425FB56, kRegShift425FB56) &&
1321  WriteRegister(kRegGlobalControl2, 0, kRegMask425FB78, kRegShift425FB78) &&
1326  CopyVideoFormat(inChannel, NTV2_CHANNEL1, NTV2_CHANNEL8);
1327  else if (inChannel < NTV2_CHANNEL5)
1328  status = WriteRegister (kRegGlobalControl2, 1, kRegMaskQuadMode, kRegShiftQuadMode) &&
1329  WriteRegister(kRegGlobalControl2, 0, kRegMask425FB12, kRegShift425FB12) &&
1330  WriteRegister(kRegGlobalControl2, 0, kRegMask425FB34, kRegShift425FB34) &&
1331  CopyVideoFormat(inChannel, NTV2_CHANNEL1, NTV2_CHANNEL4);
1332  else
1333  status = WriteRegister(kRegGlobalControl2, 1, kRegMaskQuadMode2, kRegShiftQuadMode2) &&
1334  WriteRegister(kRegGlobalControl2, 0, kRegMask425FB56, kRegShift425FB56) &&
1335  WriteRegister(kRegGlobalControl2, 0, kRegMask425FB78, kRegShift425FB78) &&
1336  CopyVideoFormat(inChannel, NTV2_CHANNEL5, NTV2_CHANNEL8);
1337  }
1338  else
1339  {
1340  if (!IsMultiFormatActive())
1341  status = WriteRegister(kRegGlobalControl2, 0, kRegMaskQuadMode, kRegShiftQuadMode) &&
1343  else if (inChannel < NTV2_CHANNEL5)
1344  status = WriteRegister(kRegGlobalControl2, 0, kRegMaskQuadMode, kRegShiftQuadMode);
1345  else
1346  status = WriteRegister(kRegGlobalControl2, 0, kRegMaskQuadMode2, kRegShiftQuadMode2);
1347  }
1348 
1349  return status;
1350 }
1351 
1352 bool CNTV2Card::Get4kSquaresEnable (bool & outIsEnabled, const NTV2Channel inChannel)
1353 {
1354  outIsEnabled = false;
1355  if (IsMultiRasterWidgetChannel(inChannel))
1356  {outIsEnabled = true; return true;}
1357  if (!NTV2_IS_VALID_CHANNEL(inChannel))
1358  return false;
1359  ULWord squaresEnabled (0);
1360  bool status = true;
1361 
1362  if (inChannel < NTV2_CHANNEL5)
1363  status = ReadRegister (kRegGlobalControl2, squaresEnabled, kRegMaskQuadMode, kRegShiftQuadMode);
1364  else
1365  status = ReadRegister(kRegGlobalControl2, squaresEnabled, kRegMaskQuadMode2, kRegShiftQuadMode2);
1366 
1367  outIsEnabled = (squaresEnabled ? true : false);
1368  return status;
1369 }
1370 
1371 // Method: SetTsiFrameEnable
1372 // Input: bool
1373 // Output: NONE
1374 bool CNTV2Card::SetTsiFrameEnable (const bool enable, const NTV2Channel inChannel)
1375 {
1376  bool status = true;
1377 
1378  if (!IsSupported(kDeviceCanDo425Mux) && !IsSupported(kDeviceCanDo12gRouting))
1379  return false;
1380  if (IsMultiRasterWidgetChannel(inChannel))
1381  return enable == true;
1382  if (!NTV2_IS_VALID_CHANNEL(inChannel))
1383  return false;
1384 
1385  if (enable)
1386  {
1387  if (IsSupported(kDeviceCanDo12gRouting))
1388  {
1389  status = WriteRegister(kRegGlobalControl2, 0, kRegMaskQuadMode, kRegShiftQuadMode) &&
1391  WriteRegister(kRegGlobalControl2, 0, kRegMask425FB12, kRegShift425FB12) &&
1392  WriteRegister(kRegGlobalControl2, 0, kRegMask425FB34, kRegShift425FB34) &&
1393  WriteRegister(kRegGlobalControl2, 0, kRegMask425FB56, kRegShift425FB56) &&
1395  if (!status)
1396  return false;
1397 
1398  if (!IsMultiFormatActive())
1399  status = WriteRegister(kRegGlobalControl, 1, kRegMaskQuadTsiEnable, kRegShiftQuadTsiEnable) &&
1403  CopyVideoFormat(inChannel, NTV2_CHANNEL1, NTV2_CHANNEL8);
1404  else
1405  status = WriteRegister(gChannelToGlobalControlRegNum[inChannel], 1, kRegMaskQuadTsiEnable, kRegShiftQuadTsiEnable);
1406  }
1407  // enable 425 mode, disable squares
1408  else if (!IsMultiFormatActive())
1409  status = WriteRegister(kRegGlobalControl2, 0, kRegMaskQuadMode, kRegShiftQuadMode) &&
1411  WriteRegister(kRegGlobalControl2, 1, kRegMask425FB12, kRegShift425FB12) &&
1412  WriteRegister(kRegGlobalControl2, 1, kRegMask425FB34, kRegShift425FB34) &&
1413  WriteRegister(kRegGlobalControl2, 1, kRegMask425FB56, kRegShift425FB56) &&
1414  WriteRegister(kRegGlobalControl2, 1, kRegMask425FB78, kRegShift425FB78) &&
1415  CopyVideoFormat(inChannel, NTV2_CHANNEL1, NTV2_CHANNEL8);
1416  else if (inChannel < NTV2_CHANNEL3)
1417  status = WriteRegister(kRegGlobalControl2, 1, kRegMask425FB12, kRegShift425FB12) &&
1419  CopyVideoFormat(inChannel, NTV2_CHANNEL1, NTV2_CHANNEL2);
1420  else if (inChannel < NTV2_CHANNEL5)
1421  status = WriteRegister(kRegGlobalControl2, 1, kRegMask425FB34, kRegShift425FB34) &&
1423  CopyVideoFormat(inChannel, NTV2_CHANNEL3, NTV2_CHANNEL4);
1424  else if (inChannel < NTV2_CHANNEL7)
1425  status = WriteRegister(kRegGlobalControl2, 1, kRegMask425FB56, kRegShift425FB56) &&
1427  CopyVideoFormat(inChannel, NTV2_CHANNEL5, NTV2_CHANNEL6);
1428  else
1429  status = WriteRegister(kRegGlobalControl2, 1, kRegMask425FB78, kRegShift425FB78) &&
1431  CopyVideoFormat(inChannel, NTV2_CHANNEL7, NTV2_CHANNEL8);
1432  }
1433  else
1434  {
1435  if (IsSupported(kDeviceCanDo12gRouting))
1436  {
1437  if (!IsMultiFormatActive())
1438  status = WriteRegister(kRegGlobalControl, 0, kRegMaskQuadTsiEnable, kRegShiftQuadTsiEnable) &&
1442  else
1443  status = WriteRegister(gChannelToGlobalControlRegNum[inChannel], 0, kRegMaskQuadTsiEnable, kRegShiftQuadTsiEnable);
1444  }
1445  // disable 425 mode, enable squares
1446  else if (!IsMultiFormatActive())
1447  status = WriteRegister(kRegGlobalControl2, 0, kRegMask425FB12, kRegShift425FB12) &&
1448  WriteRegister(kRegGlobalControl2, 0, kRegMask425FB34, kRegShift425FB34) &&
1449  WriteRegister(kRegGlobalControl2, 0, kRegMask425FB56, kRegShift425FB56) &&
1451  else if (inChannel < NTV2_CHANNEL3)
1452  status = WriteRegister(kRegGlobalControl2, 0, kRegMask425FB12, kRegShift425FB12);
1453  else if (inChannel < NTV2_CHANNEL5)
1454  status = WriteRegister(kRegGlobalControl2, 0, kRegMask425FB34, kRegShift425FB34);
1455  else if (inChannel < NTV2_CHANNEL7)
1456  status = WriteRegister(kRegGlobalControl2, 0, kRegMask425FB56, kRegShift425FB56);
1457  else
1458  status = WriteRegister(kRegGlobalControl2, 0, kRegMask425FB78, kRegShift425FB78);
1459  }
1460 
1461  return status;
1462 }
1463 
1464 // Method: GetTsiFrameEnable
1465 // Input: NONE
1466 // Output: bool
1467 bool CNTV2Card::GetTsiFrameEnable (bool & outIsEnabled, const NTV2Channel inChannel)
1468 {
1469  outIsEnabled = false;
1470  if (!IsSupported(kDeviceCanDo425Mux) && !IsSupported(kDeviceCanDo12gRouting))
1471  return false;
1472  if (IsMultiRasterWidgetChannel(inChannel))
1473  {outIsEnabled = true; return true;}
1474  if (!NTV2_IS_VALID_CHANNEL(inChannel))
1475  return false;
1476  // Return true (1) Quad Frame Geometry is enabled
1477  // Return false (0) if this mode is disabled
1478  bool returnVal(false), readOkay(false);
1479 
1480  if (IsSupported(kDeviceCanDo12gRouting))
1481  {
1482  readOkay = GetQuadQuadFrameEnable(returnVal, inChannel);
1483  if (!returnVal)
1485  }
1486  else
1487  {
1488  if (inChannel < NTV2_CHANNEL3)
1490  else if (inChannel < NTV2_CHANNEL5)
1492  else if (inChannel < NTV2_CHANNEL7)
1494  else
1496  }
1497 
1498  outIsEnabled = readOkay ? returnVal : 0;
1499  return readOkay;
1500 }
1501 
1502 bool CNTV2Card::GetTsiMuxSyncFail (bool & outSyncFailed, const NTV2Channel inWhichTsiMux)
1503 {
1504  ULWord value(0);
1505  outSyncFailed = false;
1506  if (!IsSupported(kDeviceCanDo425Mux))
1507  return false;
1508  if (!NTV2_IS_VALID_CHANNEL(inWhichTsiMux))
1509  return false;
1511  return false;
1512  if (value & (1<<inWhichTsiMux))
1513  outSyncFailed = true;
1514  return true;
1515 }
1516 
1517 bool CNTV2Card::CopyVideoFormat(const NTV2Channel inSrc, const NTV2Channel inFirst, const NTV2Channel inLast)
1518 {
1519  ULWord standard(0), rate1(0), rate2(0), s372(0), geometry(0), format(0);
1520  if (inFirst > inLast)
1521  return false; // first must be <= last
1522  if (inSrc >= NTV2_MAX_NUM_CHANNELS)
1523  return false; // past channel 8, prevent bad access from [inSrc]
1524  if (inLast >= NTV2_MAX_NUM_CHANNELS)
1525  return false; // past channel 8, prevent bad access from [channel]
1526  bool status(false);
1527 
1528  status = ReadRegister (gChannelToGlobalControlRegNum[inSrc], standard, kRegMaskStandard, kRegShiftStandard);
1529  status &= ReadRegister (gChannelToGlobalControlRegNum[inSrc], rate1, kRegMaskFrameRate, kRegShiftFrameRate);
1530  status &= ReadRegister (gChannelToGlobalControlRegNum[inSrc], rate2, kRegMaskFrameRateHiBit, kRegShiftFrameRateHiBit);
1531  status &= ReadRegister (gChannelToSmpte372RegisterNum[inSrc], s372, gChannelToSmpte372Masks[inSrc], gChannelToSmpte372Shifts[inSrc]);
1532  status &= ReadRegister (gChannelToGlobalControlRegNum[inSrc], geometry, kRegMaskGeometry, kRegShiftGeometry);
1533  status &= ReadRegister (kVRegVideoFormatCh1 + inSrc, format);
1534  if (!status) return false;
1535 
1536  for (int channel = inFirst; channel <= inLast; channel++)
1537  {
1538  status = WriteRegister (gChannelToGlobalControlRegNum[channel], standard, kRegMaskStandard, kRegShiftStandard);
1539  status &= WriteRegister (gChannelToGlobalControlRegNum[channel], rate1, kRegMaskFrameRate, kRegShiftFrameRate);
1540  status &= WriteRegister (gChannelToGlobalControlRegNum[channel], rate2, kRegMaskFrameRateHiBit, kRegShiftFrameRateHiBit);
1541  status &= WriteRegister (gChannelToSmpte372RegisterNum[channel], s372, gChannelToSmpte372Masks[channel], gChannelToSmpte372Shifts[channel]);
1542  status &= WriteRegister (gChannelToGlobalControlRegNum[channel], geometry, kRegMaskGeometry, kRegShiftGeometry);
1543  status &= WriteRegister (ULWord(kVRegVideoFormatCh1 + channel), format);
1544  if (!status) return false;
1545  }
1546 
1547  return true;
1548 }
1549 
1550 // Method: SetReference
1551 // Input: NTV2Reference
1552 // Output: NONE
1553 bool CNTV2Card::SetReference (const NTV2ReferenceSource inRefSource, const bool inKeepFramePulseSelect)
1554 {
1555  if (IsSupported(kDeviceCanDoLTCInOnRefPort) && inRefSource == NTV2_REFERENCE_EXTERNAL)
1556  SetLTCInputEnable(false);
1557 
1558  if (IsSupported(kDeviceCanDoFramePulseSelect) && !inKeepFramePulseSelect)
1559  EnableFramePulseReference(false); //Reset this for backwards compatibility
1560 
1561  //this looks slightly unusual but really
1562  //it is a 4 bit counter in 2 different registers
1563  ULWord refControl1 = ULWord(inRefSource), refControl2 = 0, ptpControl = 0;
1564  switch (inRefSource)
1565  {
1566  case NTV2_REFERENCE_INPUT5: refControl1 = 0; refControl2 = 1; break;
1567  case NTV2_REFERENCE_INPUT6: refControl1 = 1; refControl2 = 1; break;
1568  case NTV2_REFERENCE_INPUT7: refControl1 = 2; refControl2 = 1; break;
1569  case NTV2_REFERENCE_INPUT8: refControl1 = 3; refControl2 = 1; break;
1570  case NTV2_REFERENCE_SFP1_PCR: refControl1 = 4; refControl2 = 1; break;
1571  case NTV2_REFERENCE_SFP1_PTP: refControl1 = 4; refControl2 = 1; ptpControl = 1; break;
1572  case NTV2_REFERENCE_SFP2_PCR: refControl1 = 5; refControl2 = 1; break;
1573  case NTV2_REFERENCE_SFP2_PTP: refControl1 = 5; refControl2 = 1; ptpControl = 1; break;
1574  case NTV2_REFERENCE_HDMI_INPUT2: refControl1 = 4; refControl2 = 0; break;
1575  case NTV2_REFERENCE_HDMI_INPUT3: refControl1 = 6; refControl2 = 0; break;
1576  case NTV2_REFERENCE_HDMI_INPUT4: refControl1 = 7; refControl2 = 0; break;
1577  default: break;
1578  }
1579 
1580  if (IsSupported(kDeviceCanDoIP))
1582 
1583  if (GetNumSupported(kDeviceGetNumVideoChannels) > 4 || (IsSupported(kDeviceCanDoIP) || IsSupported(kDeviceCanDo25GIP)) )
1584  WriteRegister (kRegGlobalControl2, refControl2, kRegMaskRefSource2, kRegShiftRefSource2);
1585 
1586  return WriteRegister (kRegGlobalControl, refControl1, kRegMaskRefSource, kRegShiftRefSource);
1587 }
1588 
1589 // Method: GetReference
1590 // Input: NTV2Reference
1591 // Output: NONE
1593 {
1594  ULWord refControl2(0), ptpControl(0);
1596 
1597  if ((GetNumSupported(kDeviceGetNumVideoChannels) > 4 || IsSupported(kDeviceCanDoIP)) && !IsSupported(kDeviceCanDo25GIP))
1598  {
1599  ReadRegister (kRegGlobalControl2, refControl2, kRegMaskRefSource2, kRegShiftRefSource2);
1600  if (refControl2)
1601  switch (outValue)
1602  {
1603  case 0: outValue = NTV2_REFERENCE_INPUT5; break;
1604  case 1: outValue = NTV2_REFERENCE_INPUT6; break;
1605  case 2: outValue = NTV2_REFERENCE_INPUT7; break;
1606  case 3: outValue = NTV2_REFERENCE_INPUT8; break;
1607 
1608  case 4: if (IsSupported(kDeviceCanDoIP))
1610  outValue = ptpControl == 0 ? NTV2_REFERENCE_SFP1_PCR : NTV2_REFERENCE_SFP1_PTP;
1611  break;
1612 
1613  case 5: if (IsSupported(kDeviceCanDoIP))
1615  outValue = ptpControl == 0 ? NTV2_REFERENCE_SFP2_PCR : NTV2_REFERENCE_SFP2_PTP;
1616  break;
1617 
1618  default: break;
1619  }
1620  }
1621 
1622  if (IsSupported(kDeviceCanDo25GIP))
1623  {
1624  result = ReadRegister(kRegLPPTPSFPStatus, ptpControl);
1625  switch (ptpControl)
1626  {
1627  default:
1628  case 0:
1629  outValue = NTV2_REFERENCE_FREERUN;
1630  break;
1631  case 1:
1632  outValue = NTV2_REFERENCE_SFP1_PTP;
1633  break;
1634  case 2:
1635  outValue = NTV2_REFERENCE_SFP2_PTP;
1636  break;
1637  }
1638  }
1639 
1640  if (_boardID == DEVICE_ID_KONAHDMI)
1641  switch (outValue)
1642  {
1643  case 5: outValue = NTV2_REFERENCE_HDMI_INPUT1; break;
1644  case 4: outValue = NTV2_REFERENCE_HDMI_INPUT2; break;
1645  case 6: outValue = NTV2_REFERENCE_HDMI_INPUT3; break;
1646  case 7: outValue = NTV2_REFERENCE_HDMI_INPUT4; break;
1647  default: break;
1648  }
1649 
1650  return result;
1651 }
1652 
1654 {
1655  if (!IsSupported(kDeviceCanDoFramePulseSelect))
1656  return false;
1657 
1658  return WriteRegister (kRegGlobalControl3, enable ? 1 : 0, kRegMaskFramePulseEnable, kRegShiftFramePulseEnable);
1659 }
1660 
1661 
1663 {
1664  if (!IsSupported(kDeviceCanDoFramePulseSelect))
1665  return false;
1666 
1667  ULWord returnValue(0);
1668  bool status = ReadRegister(kRegGlobalControl3, returnValue, kRegMaskFramePulseEnable, kRegShiftFramePulseEnable);
1669  outValue = returnValue == 0 ? false : true;
1670  return status;
1671 }
1672 
1674 {
1675  if (!IsSupported(kDeviceCanDoFramePulseSelect))
1676  return false;
1678 }
1679 
1681 {
1682  ULWord refControl1(0);
1683  if (!IsSupported(kDeviceCanDoFramePulseSelect))
1684  return false;
1685 
1686  bool result (ReadRegister (kRegGlobalControl3, refControl1, kRegMaskFramePulseRefSelect, kRegShiftFramePulseRefSelect));
1687  outValue = NTV2ReferenceSource(refControl1);
1688  return result;
1689 }
1690 
1691 // Method: SetMode
1692 // Input: NTV2Channel, NTV2Mode
1693 // Output: NONE
1694 bool CNTV2Card::SetMode (const NTV2Channel inChannel, const NTV2Mode inValue, const bool inIsRetail)
1695 { (void) inIsRetail;
1696  if (IsMultiRasterWidgetChannel(inChannel))
1697  return inValue == NTV2_MODE_INPUT;
1698  if (IS_CHANNEL_INVALID(inChannel))
1699  return false;
1700  return WriteRegister (gChannelToControlRegNum[inChannel], inValue, kRegMaskMode, kRegShiftMode);
1701 }
1702 
1703 bool CNTV2Card::SetMode (const NTV2ChannelSet & inChannels, const NTV2Mode inMode)
1704 {
1705  size_t errors(0);
1706  for (NTV2ChannelSetConstIter it(inChannels.begin()); it != inChannels.end(); ++it)
1707  if (!SetMode(*it, inMode))
1708  errors++;
1709  return !errors;
1710 }
1711 
1712 bool CNTV2Card::GetMode (const NTV2Channel inChannel, NTV2Mode & outValue)
1713 {
1714  if (IsMultiRasterWidgetChannel(inChannel))
1715  {outValue = NTV2_MODE_INPUT; return true;}
1716  if (IS_CHANNEL_INVALID(inChannel))
1717  return false;
1719 }
1720 
1721 bool CNTV2Card::GetFrameInfo (const NTV2Channel inChannel, NTV2FrameGeometry & outGeometry, NTV2FrameBufferFormat & outFBF)
1722 {
1723  bool status = GetFrameGeometry(outGeometry); // WHY ISN'T inChannel PASSED TO GetFrameGeometry?!?!?!
1724  if ( !status )
1725  return status; // TODO: fix me
1726 
1727  status = GetFrameBufferFormat(inChannel, outFBF);
1728  if ( !status )
1729  return status; // TODO: fix me
1730 
1731  return status;
1732 }
1733 
1734 bool CNTV2Card::IsBufferSizeChangeRequired(NTV2Channel channel, NTV2FrameGeometry currentGeometry, NTV2FrameGeometry newGeometry,
1735  NTV2FrameBufferFormat format)
1736 {
1737  (void) channel;
1738  ULWord currentFrameBufferSize = ::NTV2DeviceGetFrameBufferSize(_boardID,currentGeometry,format);
1739  ULWord requestedFrameBufferSize = ::NTV2DeviceGetFrameBufferSize(_boardID,newGeometry,format);
1740  bool changeBufferSize = IsSupported(kDeviceCanChangeFrameBufferSize) && (currentFrameBufferSize != requestedFrameBufferSize);
1741 
1742  // If software has decreed a frame buffer size, don't try to change it
1743  if (IsBufferSizeSetBySW())
1744  changeBufferSize = false;
1745 
1746  return changeBufferSize;
1747 }
1748 
1749 bool CNTV2Card::IsBufferSizeChangeRequired(NTV2Channel channel, NTV2FrameGeometry geometry,
1750  NTV2FrameBufferFormat currentFormat, NTV2FrameBufferFormat newFormat)
1751 {
1752  (void)channel;
1753 
1754  ULWord currentFrameBufferSize = ::NTV2DeviceGetFrameBufferSize(_boardID,geometry,currentFormat);
1755  ULWord requestedFrameBufferSize = ::NTV2DeviceGetFrameBufferSize(_boardID,geometry,newFormat);
1756  bool changeBufferSize = IsSupported(kDeviceCanChangeFrameBufferSize) && (currentFrameBufferSize != requestedFrameBufferSize);
1757 
1758  // If software has decreed a frame buffer size, don't try to change it
1759  if (IsBufferSizeSetBySW())
1760  changeBufferSize = false;
1761 
1762  return changeBufferSize;
1763 }
1764 
1766 {
1768  return false;
1769 
1770  ULWord swControl(0);
1771  if (!ReadRegister(kRegCh1Control, swControl, kRegMaskFrameSizeSetBySW, kRegShiftFrameSizeSetBySW))
1772  return false;
1773 
1774  return swControl != 0;
1775 }
1776 
1777 #if !defined(NTV2_DEPRECATE_17_2)
1778 bool CNTV2Card::GetFBSizeAndCountFromHW (ULWord & outSize, ULWord & outCount)
1779 {
1780  if (!IsBufferSizeSetBySW())
1781  return false;
1782 
1783  ULWord ch1Control(0), multiplier(0), sizeMultiplier(0);
1784  if (!ReadRegister(kRegCh1Control, ch1Control))
1785  return false;
1786 
1787  ch1Control &= BIT_20 | BIT_21;
1788  switch (ch1Control)
1789  {
1790  default:
1791  case 0: multiplier = 4; // 2MB frame buffers
1792  sizeMultiplier = 2;
1793  break;
1794 
1795  case BIT_20: multiplier = 2; // 4MB
1796  sizeMultiplier = 4;
1797  break;
1798 
1799  case BIT_21: multiplier = 1; // 8MB
1800  sizeMultiplier = 8;
1801  break;
1802 
1803  case BIT_20 | BIT_21: multiplier = 0; // 16MB
1804  sizeMultiplier = 16;
1805  break;
1806  }
1807 
1808  outSize = sizeMultiplier * 1024 * 1024;
1809  outCount = multiplier ? multiplier * DeviceGetNumberFrameBuffers() : DeviceGetNumberFrameBuffers() / 2;
1810 
1812  GetFrameGeometry(geometry);
1813  if (geometry == NTV2_FG_4x1920x1080 || geometry == NTV2_FG_4x2048x1080)
1814  {
1815  outSize *= 4;
1816  outCount /= 4;
1817  }
1818  if (geometry == NTV2_FG_4x3840x2160 || geometry == NTV2_FG_4x4096x2160)
1819  {
1820  outSize *= 16;
1821  outCount /= 16;
1822  }
1823  return true;
1824 }
1825 #endif
1826 
1827 bool CNTV2Card::GetLargestFrameBufferFormatInUse(NTV2FrameBufferFormat & outFBF)
1828 {
1829  NTV2FrameBufferFormat ch1format;
1831 
1832  if ( !GetFrameBufferFormat(NTV2_CHANNEL1, ch1format) )
1833  return false;
1834 
1835  if ( !GetFrameBufferFormat(NTV2_CHANNEL2, ch2format) &&
1836  GetNumSupported(kDeviceGetNumVideoChannels) > 1)
1837  return false;
1838 
1839  NTV2FrameGeometry geometry;
1840  if (!GetFrameGeometry(geometry))
1841  return false;
1842 
1843  ULWord ch1FrameBufferSize = ::NTV2DeviceGetFrameBufferSize(_boardID,geometry,ch1format);
1844  ULWord ch2FrameBufferSize = ::NTV2DeviceGetFrameBufferSize(_boardID,geometry,ch2format);
1845  if ( ch1FrameBufferSize >= ch2FrameBufferSize )
1846  outFBF = ch1format;
1847  else
1848  outFBF = ch2format;
1849  return true;
1850 }
1851 
1852 bool CNTV2Card::IsMultiFormatActive (void)
1853 {
1854  if (!IsSupported(kDeviceCanDoMultiFormat))
1855  return false;
1856 
1857  bool isEnabled = false;
1858  if (!GetMultiFormatMode (isEnabled))
1859  return false;
1860 
1861  return isEnabled;
1862 }
1863 
1865 {
1866  outConnections.clear();
1867  if (!IsSupported(kDeviceHasXptConnectROM))
1868  return false;
1869 
1870  NTV2RegReads ROMregs;
1872  && ReadRegisters(ROMregs)
1873  && CNTV2SignalRouter::GetPossibleConnections(ROMregs, outConnections);
1874 }
1875 
1877 {
1878  outInputs.clear();
1879  const ULWordSet widgetIDs (GetSupportedItems(kNTV2EnumsID_WidgetID));
1880 
1881  for (ULWordSetConstIter iter(widgetIDs.begin()); iter != widgetIDs.end (); ++iter)
1882  {
1883  const NTV2WidgetID wgtID(NTV2WidgetID(*iter + 0));
1884  NTV2InputXptIDSet inputs;
1885  CNTV2SignalRouter::GetWidgetInputs (wgtID, inputs);
1886  for (NTV2InputXptIDSetConstIter it(inputs.begin()); it != inputs.end(); ++it)
1887  {
1889  if (!IsSupported(kDeviceCanDo425Mux))
1890  if (!IsSupported(kDeviceCanDo8KVideo))
1891  if (::NTV2InputCrosspointIDToString(*it, false).find("DS2") != string::npos) // is DS2 input?
1892  continue; // do not include FrameStore DS2 inputs for IP25G
1893  outInputs.insert(*it);
1894  }
1895  }
1896  return true;
1897 }
1898 
1900 {
1901  outOutputs.clear();
1902  const ULWordSet widgetIDs (GetSupportedItems(kNTV2EnumsID_WidgetID));
1903 
1904  for (ULWordSetConstIter iter(widgetIDs.begin()); iter != widgetIDs.end (); ++iter)
1905  {
1906  const NTV2WidgetID wgtID(NTV2WidgetID(*iter + 0));
1907  NTV2OutputXptIDSet outputs;
1908  CNTV2SignalRouter::GetWidgetOutputs (wgtID, outputs);
1909  for (NTV2OutputXptIDSetConstIter it(outputs.begin()); it != outputs.end(); ++it)
1910  {
1912  if (!IsSupported(kDeviceCanDo425Mux))
1913  if (!IsSupported(kDeviceCanDo8KVideo))
1914  if (::NTV2OutputCrosspointIDToString(*it, false).find("DS2") != string::npos) // is DS2 output?
1915  continue; // do not include FrameStore DS2 outputs for IP25G
1916  outOutputs.insert(*it);
1917  }
1918  }
1919  return true;
1920 }
1921 
1923 
1924 // Method: SetFrameBufferFormat
1925 // Input: NTV2Channel, NTV2FrameBufferFormat
1926 // Output: NONE
1927 bool CNTV2Card::SetFrameBufferFormat (NTV2Channel inChannel, NTV2FrameBufferFormat inNewFormat, bool inIsRetailMode,
1928  NTV2HDRXferChars inXferChars, NTV2HDRColorimetry inColorimetry, NTV2HDRLuminance inLuminance)
1929 { (void) inIsRetailMode;
1930 
1931  if (IsMultiRasterWidgetChannel(inChannel))
1932  return inNewFormat == NTV2_FBF_8BIT_YCBCR;
1933  if (IS_CHANNEL_INVALID(inChannel))
1934  return false;
1935 
1936  const ULWord regNum (gChannelToControlRegNum[inChannel]);
1937  const ULWord loValue (inNewFormat & 0x0f);
1938  const ULWord hiValue ((inNewFormat & 0x10) >> 4);
1939  NTV2FrameGeometry currentGeometry (NTV2_FG_INVALID);
1940  NTV2FrameBufferFormat currentFormat (NTV2_FBF_INVALID); // save for call to IsBufferSizeChangeRequired below
1941  bool status = GetFrameInfo(inChannel, currentGeometry, currentFormat);
1942  if (!status)
1943  return status;
1944 
1945  // Set channel control register FBF bits 1,2,3,4,6...
1946  status = WriteRegister (regNum, loValue, kRegMaskFrameFormat, kRegShiftFrameFormat)
1947  && WriteRegister (regNum, hiValue, kRegMaskFrameFormatHiBit, kRegShiftFrameFormatHiBit);
1948 
1949 #if !defined(NTV2_DEPRECATE_17_2)
1950  // If software set the frame buffer size, read the values from hardware
1951  if ( !GetFBSizeAndCountFromHW(_ulFrameBufferSize, _ulNumFrameBuffers) &&
1952  IsBufferSizeChangeRequired(inChannel, currentGeometry, currentFormat, inNewFormat) )
1953  {
1954  _ulFrameBufferSize = ::NTV2DeviceGetFrameBufferSize(_boardID,currentGeometry, inNewFormat);
1955  _ulNumFrameBuffers = ::NTV2DeviceGetNumberFrameBuffers(_boardID,currentGeometry, inNewFormat);
1956  }
1957 #endif
1958 
1959  if (status)
1960  {if (inNewFormat != currentFormat)
1961  CVIDINFO("'" << GetDisplayName() << "': Channel " << DEC(UWord(inChannel)+1) << " FBF changed from "
1962  << ::NTV2FrameBufferFormatToString(currentFormat) << " to " << ::NTV2FrameBufferFormatToString(inNewFormat));}
1963  else
1964  CVIDFAIL("'" << GetDisplayName() << "': Failed to change channel " << DEC(UWord(inChannel)+1) << " FBF from "
1965  << ::NTV2FrameBufferFormatToString(currentFormat) << " to " << ::NTV2FrameBufferFormatToString(inNewFormat));
1966 
1967  SetVPIDTransferCharacteristics(inXferChars, inChannel);
1968  SetVPIDColorimetry(inColorimetry, inChannel);
1969  SetVPIDLuminance(inLuminance, inChannel);
1970  return status;
1971 }
1972 
1974  const NTV2FrameBufferFormat inNewFormat,
1975  const bool inIsAJARetail,
1976  const NTV2HDRXferChars inXferChars,
1977  const NTV2HDRColorimetry inColorimetry,
1978  const NTV2HDRLuminance inLuminance)
1979 {
1980  UWord failures(0);
1981  for (NTV2ChannelSetConstIter it(inFrameStores.begin()); it != inFrameStores.end(); ++it)
1982  if (!SetFrameBufferFormat (*it, inNewFormat, inIsAJARetail, inXferChars, inColorimetry, inLuminance))
1983  failures++;
1984  return failures == 0;
1985 }
1986 
1987 // Method: GetFrameBufferFormat
1988 // Input: NTV2Channel
1989 // Output: NTV2FrameBufferFormat
1991 {
1992  if (IsMultiRasterWidgetChannel(inChannel))
1993  {outValue = NTV2_FBF_8BIT_YCBCR; return true;}
1994  if (IS_CHANNEL_INVALID (inChannel))
1995  return false;
1996 
1997  ULWord returnVal1, returnVal2;
1998  bool result1 = ReadRegister (gChannelToControlRegNum[inChannel], returnVal1, kRegMaskFrameFormat, kRegShiftFrameFormat);
1999  bool result2 = ReadRegister (gChannelToControlRegNum[inChannel], returnVal2, kRegMaskFrameFormatHiBit, kRegShiftFrameFormatHiBit);
2000 
2001  outValue = NTV2FrameBufferFormat((returnVal1 & 0x0f) | ((returnVal2 & 0x1) << 4));
2002  return result1 && result2;
2003 }
2004 
2005 // Method: SetFrameBufferQuarterSizeMode
2006 // Input: NTV2Channel, NTV2K2QuarterSizeExpandMode
2007 // Output: NONE
2009 {
2010  if (IS_CHANNEL_INVALID (channel))
2011  return false;
2012  return WriteRegister (gChannelToControlRegNum [channel], value, kRegMaskQuarterSizeMode, kRegShiftQuarterSizeMode);
2013 }
2014 
2015 // Method: GetFrameBufferQuarterSizeMode
2016 // Input: NTV2Channel
2017 // Output: NTV2K2QuarterSizeExpandMode
2019 {
2020  if (IS_CHANNEL_INVALID (inChannel))
2021  return false;
2023 }
2024 
2025 // Method: SetFrameBufferQuality - currently used for ProRes compressed buffers
2026 // Input: NTV2Channel, NTV2K2FrameBufferQuality
2027 // Output: NONE
2029 {
2030  if (IS_CHANNEL_INVALID (channel))
2031  return false;
2032  // note buffer quality is split between bit 17 (lo), 25-26 (hi)
2033  ULWord loValue = quality & 0x1;
2034  ULWord hiValue = (quality >> 1) & 0x3;
2035  return WriteRegister (gChannelToControlRegNum [channel], loValue, kRegMaskQuality, kRegShiftQuality) &&
2036  WriteRegister (gChannelToControlRegNum [channel], hiValue, kRegMaskQuality2, kRegShiftQuality2);
2037 }
2038 
2039 // Method: GetFrameBufferQuality - currently used for ProRes compressed buffers
2040 // Input: NTV2Channel
2041 // Output: NTV2K2FrameBufferQuality
2043 {
2044  if (IS_CHANNEL_INVALID (inChannel))
2045  return false;
2046  outQuality = NTV2_FBQualityInvalid;
2047  // note buffer quality is split between bit 17 (lo), 25-26 (hi)
2048  ULWord loValue(0), hiValue(0);
2049  if (ReadRegister (gChannelToControlRegNum [inChannel], loValue, kRegMaskQuality, kRegShiftQuality) &&
2050  ReadRegister (gChannelToControlRegNum [inChannel], hiValue, kRegMaskQuality2, kRegShiftQuality2))
2051  {
2052  outQuality = NTV2FrameBufferQuality(loValue + ((hiValue & 0x3) << 1));
2053  return true;
2054  }
2055  return false;
2056 }
2057 
2058 
2059 // Method: SetEncodeAsPSF - currently used for ProRes compressed buffers
2060 // Input: NTV2Channel, NTV2K2FrameBufferQuality
2061 // Output: NONE
2063 {
2064  if (IS_CHANNEL_INVALID (channel))
2065  return false;
2066  return WriteRegister (gChannelToControlRegNum [channel], value, kRegMaskEncodeAsPSF, kRegShiftEncodeAsPSF);
2067 }
2068 
2069 // Method: GetEncodeAsPSF - currently used for ProRes compressed buffers
2070 // Input: NTV2Channel
2071 // Output: NTV2K2FrameBufferQuality
2073 {
2074  if (IS_CHANNEL_INVALID (inChannel))
2075  return false;
2077 }
2078 
2079 // Method: SetFrameBufferOrientation
2080 // Input: NTV2Channel, NTV2VideoFrameBufferOrientation
2081 // Output: NONE
2083 {
2084  if (IsMultiRasterWidgetChannel(inChannel))
2085  return inValue == NTV2_FRAMEBUFFER_ORIENTATION_NORMAL;
2086  if (IS_CHANNEL_INVALID(inChannel))
2087  return false;
2088  return WriteRegister (gChannelToControlRegNum[inChannel], inValue, kRegMaskFrameOrientation, kRegShiftFrameOrientation);
2089 }
2090 
2091 // Method: GetFrameBufferOrientation
2092 // Input: NTV2Channel
2093 // Output: NTV2VideoFrameBufferOrientation
2095 {
2096  if (IsMultiRasterWidgetChannel(inChannel))
2097  {outValue = NTV2_FRAMEBUFFER_ORIENTATION_NORMAL; return true;}
2098  if (IS_CHANNEL_INVALID (inChannel))
2099  return false;
2101 }
2102 
2103 
2105 {
2106  ULWord swCanChgFBSize(0);
2107  if (!GetBoolParam(kDeviceSoftwareCanChangeFrameBufferSize, swCanChgFBSize) || !swCanChgFBSize)
2108  return false;
2109 
2110  ULWord reg1Contents(0);
2111  if (!ReadRegister(kRegCh1Control, reg1Contents))
2112  return false;
2113 
2114  reg1Contents |= kRegMaskFrameSizeSetBySW;
2115  reg1Contents &= ~kK2RegMaskFrameSize;
2116  reg1Contents |= ULWord(inSize) << kK2RegShiftFrameSize;
2117  if (!WriteRegister(kRegCh1Control, reg1Contents))
2118  return false;
2119 #if !defined(NTV2_DEPRECATE_17_2)
2120  return GetFBSizeAndCountFromHW(_ulFrameBufferSize, _ulNumFrameBuffers);
2121 #else//NTV2_DEPRECATE_17_2
2122  return true;
2123 #endif//defined(NTV2_DEPRECATE_17_2)
2124 }
2125 
2126 // Method: SetFrameBufferSize
2127 // Input: NTV2Channel, NTV2K2Framesize
2128 // Output: NONE
2129 bool CNTV2Card::SetFrameBufferSize (const NTV2Channel inChannel, const NTV2Framesize inValue)
2130 {
2131  if (IS_CHANNEL_INVALID(inChannel))
2132  return false;
2133 #if defined (NTV2_ALLOW_2MB_FRAMES)
2134  ULWord supports2m (0);
2136  if(supports2m == 1)
2137  {
2138  ULWord value2M (0);
2139  switch(inValue)
2140  {
2141  case NTV2_FRAMESIZE_2MB: value2M = 1; break;
2142  case NTV2_FRAMESIZE_4MB: value2M = 2; break;
2143  case NTV2_FRAMESIZE_6MB: value2M = 3; break;
2144  case NTV2_FRAMESIZE_8MB: value2M = 4; break;
2145  case NTV2_FRAMESIZE_10MB: value2M = 5; break;
2146  case NTV2_FRAMESIZE_12MB: value2M = 6; break;
2147  case NTV2_FRAMESIZE_14MB: value2M = 7; break;
2148  case NTV2_FRAMESIZE_16MB: value2M = 8; break;
2149  case NTV2_FRAMESIZE_18MB: value2M = 9; break;
2150  case NTV2_FRAMESIZE_20MB: value2M = 10; break;
2151  case NTV2_FRAMESIZE_22MB: value2M = 11; break;
2152  case NTV2_FRAMESIZE_24MB: value2M = 12; break;
2153  case NTV2_FRAMESIZE_26MB: value2M = 13; break;
2154  case NTV2_FRAMESIZE_28MB: value2M = 14; break;
2155  case NTV2_FRAMESIZE_30MB: value2M = 15; break;
2156  case NTV2_FRAMESIZE_32MB: value2M = 16; break;
2157  default: return false;
2158  }
2159  return WriteRegister(gChannelTo2MFrame [NTV2_CHANNEL1], value2M, kRegMask2MFrameSize, kRegShift2MFrameSupport);
2160  }
2161  else
2162 #endif // defined (NTV2_ALLOW_2MB_FRAMES)
2163  if (inValue == NTV2_FRAMESIZE_2MB || inValue == NTV2_FRAMESIZE_4MB || inValue == NTV2_FRAMESIZE_8MB || inValue == NTV2_FRAMESIZE_16MB)
2165  return false;
2166 }
2167 
2168 // Method: GetK2FrameBufferSize
2169 // Input: NTV2Channel
2170 // Output: NTV2K2Framesize
2171 bool CNTV2Card::GetFrameBufferSize (const NTV2Channel inChannel, NTV2Framesize & outValue)
2172 {
2173  outValue = NTV2_FRAMESIZE_INVALID;
2174  if (!NTV2_IS_VALID_CHANNEL (inChannel))
2175  return false;
2176 #if defined (NTV2_ALLOW_2MB_FRAMES)
2177  ULWord supports2m (0);
2179  if(supports2m == 1)
2180  {
2181  ULWord frameSize (0);
2182  ReadRegister(gChannelTo2MFrame[inChannel], &frameSize, kRegMask2MFrameSize, kRegShift2MFrameSize);
2183  if (frameSize)
2184  {
2185  switch (frameSize)
2186  {
2187  case 1: outValue = NTV2_FRAMESIZE_2MB; break;
2188  case 2: outValue = NTV2_FRAMESIZE_4MB; break;
2189  case 3: outValue = NTV2_FRAMESIZE_6MB; break;
2190  case 4: outValue = NTV2_FRAMESIZE_8MB; break;
2191  case 5: outValue = NTV2_FRAMESIZE_10MB; break;
2192  case 6: outValue = NTV2_FRAMESIZE_12MB; break;
2193  case 7: outValue = NTV2_FRAMESIZE_14MB; break;
2194  case 8: outValue = NTV2_FRAMESIZE_16MB; break;
2195  case 9: outValue = NTV2_FRAMESIZE_18MB; break;
2196  case 10: outValue = NTV2_FRAMESIZE_20MB; break;
2197  case 11: outValue = NTV2_FRAMESIZE_22MB; break;
2198  case 12: outValue = NTV2_FRAMESIZE_24MB; break;
2199  case 13: outValue = NTV2_FRAMESIZE_26MB; break;
2200  case 14: outValue = NTV2_FRAMESIZE_28MB; break;
2201  case 15: outValue = NTV2_FRAMESIZE_30MB; break;
2202  case 16: outValue = NTV2_FRAMESIZE_32MB; break;
2203  default: return false;
2204  }
2205  NTV2_ASSERT (NTV2_IS_8MB_OR_16MB_FRAMESIZE(outValue));
2206  return true;
2207  }
2208  }
2209 #endif // defined (NTV2_ALLOW_2MB_FRAMES)
2211 }
2212 
2213 
2215 {
2216  if (IsMultiRasterWidgetChannel(inChannel))
2217  return SetMultiRasterBypassEnable(false);
2218  return NTV2_IS_VALID_CHANNEL(inChannel)
2219  && WriteRegister (gChannelToControlRegNum [inChannel], ULWord (true), kRegMaskChannelDisable, kRegShiftChannelDisable);
2220 
2221 } // DisableChannel
2222 
2223 
2225 { UWord failures(0);
2226  for (NTV2ChannelSetConstIter it(inChannels.begin()); it != inChannels.end(); ++it)
2227  if (!DisableChannel(*it))
2228  failures++;
2229  return !failures;
2230 
2231 } // DisableChannels
2232 
2233 
2235 {
2236  if (IsMultiRasterWidgetChannel(inChannel))
2237  return SetMultiRasterBypassEnable(true);
2238  return NTV2_IS_VALID_CHANNEL(inChannel)
2239  && WriteRegister (gChannelToControlRegNum[inChannel], ULWord(false), kRegMaskChannelDisable, kRegShiftChannelDisable);
2240 
2241 } // EnableChannel
2242 
2243 
2244 bool CNTV2Card::EnableChannels (const NTV2ChannelSet & inChannels, const bool inDisableOthers)
2245 { UWord failures(0);
2246  for (NTV2Channel chan(NTV2_CHANNEL1); chan < NTV2Channel(GetNumSupported(kDeviceGetNumFrameStores)); chan = NTV2Channel(chan+1))
2247  if (inChannels.find(chan) != inChannels.end())
2248  {
2249  if (!EnableChannel(chan))
2250  failures++;
2251  }
2252  else if (inDisableOthers)
2253  DisableChannel(chan);
2254  return !failures;
2255 
2256 } // EnableChannels
2257 
2258 
2259 bool CNTV2Card::IsChannelEnabled (const NTV2Channel inChannel, bool & outEnabled)
2260 {
2261  bool disabled (false);
2262  if (IsMultiRasterWidgetChannel(inChannel))
2263  return GetMultiRasterBypassEnable(outEnabled);
2264  if (IS_CHANNEL_INVALID(inChannel))
2265  return false;
2267  return false;
2268  outEnabled = disabled ? false : true;
2269  return true;
2270 } // IsChannelEnabled
2271 
2272 
2274 {
2275  UWord failures(0);
2276  bool enabled(false);
2277  outChannels.clear();
2278  for (NTV2Channel ch(NTV2_CHANNEL1); ch < NTV2Channel(GetNumSupported(kDeviceGetNumFrameStores)); ch = NTV2Channel(ch+1))
2279  if (!IsChannelEnabled (ch, enabled))
2280  failures++;
2281  else if (enabled)
2282  outChannels.insert(ch);
2283  return !failures;
2284 }
2285 
2286 
2288 {
2289  UWord failures(0);
2290  bool enabled(false);
2291  outChannels.clear();
2292  for (NTV2Channel ch(NTV2_CHANNEL1); ch < NTV2Channel(GetNumSupported(kDeviceGetNumFrameStores)); ch = NTV2Channel(ch+1))
2293  if (!IsChannelEnabled (ch, enabled))
2294  failures++;
2295  else if (!enabled)
2296  outChannels.insert(ch);
2297  return !failures;
2298 }
2299 
2300 #if !defined(NTV2_DEPRECATE_16_2)
2301  bool CNTV2Card::SetPCIAccessFrame (const NTV2Channel inChannel, const ULWord inValue, const bool inWaitForVBI)
2302  {
2303  if (IS_CHANNEL_INVALID(inChannel))
2304  return false;
2305  const bool result (WriteRegister (gChannelToPCIAccessFrameRegNum[inChannel], inValue));
2306  if (inWaitForVBI)
2307  WaitForOutputVerticalInterrupt (inChannel);
2308  return result;
2309  }
2310 
2311  bool CNTV2Card::GetPCIAccessFrame (const NTV2Channel inChannel, ULWord & outValue)
2312  {
2313  return !IS_CHANNEL_INVALID(inChannel)
2314  && ReadRegister (gChannelToPCIAccessFrameRegNum[inChannel], outValue);
2315  }
2316 
2318  {
2319  ULWord nextFrm(0), outFrm(0);
2320  return !IS_CHANNEL_INVALID(inCh)
2321  && ReadRegister(gChannelToPCIAccessFrameRegNum[inCh], nextFrm) // GetPCIAccessFrame(inCh, nextFrm)
2322  && GetOutputFrame(inCh, outFrm)
2323  && SetOutputFrame(inCh, nextFrm)
2324  && WriteRegister(gChannelToPCIAccessFrameRegNum[inCh], outFrm) && WaitForOutputVerticalInterrupt(inCh); // SetPCIAccessFrame(inCh, outFrm);
2325  }
2326 #endif // !defined (NTV2_DEPRECATE_16_2)
2327 
2328 bool CNTV2Card::SetOutputFrame (const NTV2Channel inChannel, const ULWord value)
2329 {
2330  if (IsMultiRasterWidgetChannel(inChannel))
2331  return false;
2332  if (IS_CHANNEL_INVALID(inChannel))
2333  return false;
2334  return WriteRegister (gChannelToOutputFrameRegNum [inChannel], value);
2335 }
2336 
2337 bool CNTV2Card::GetOutputFrame (const NTV2Channel inChannel, ULWord & outValue)
2338 {
2339  if (IsMultiRasterWidgetChannel(inChannel))
2340  {outValue = 0; return false;}
2341  if (IS_CHANNEL_INVALID(inChannel))
2342  return false;
2343  return ReadRegister (gChannelToOutputFrameRegNum [inChannel], outValue);
2344 }
2345 
2346 bool CNTV2Card::SetInputFrame (const NTV2Channel inChannel, const ULWord value)
2347 {
2348  if (IsMultiRasterWidgetChannel(inChannel))
2349  return WriteRegister(kRegMROutControl, value, kRegMaskMRFrameLocation, kRegShiftMRFrameLocation);
2350  if (IS_CHANNEL_INVALID(inChannel))
2351  return false;
2352  return WriteRegister (gChannelToInputFrameRegNum [inChannel], value);
2353 }
2354 
2355 bool CNTV2Card::GetInputFrame (const NTV2Channel inChannel, ULWord & outValue)
2356 {
2357  if (IsMultiRasterWidgetChannel(inChannel))
2358  return ReadRegister(kRegMROutControl, outValue, kRegMaskMRFrameLocation, kRegShiftMRFrameLocation);
2359  if (IS_CHANNEL_INVALID(inChannel))
2360  return false;
2361  return ReadRegister (gChannelToInputFrameRegNum[inChannel], outValue);
2362 }
2363 
2364 bool CNTV2Card::ReadLineCount (ULWord & outValue, const NTV2Channel inChannel)
2365 {
2366  outValue = 0;
2367  return inChannel == NTV2_CHANNEL1 && ReadRegister (kRegLineCount, outValue);
2368 }
2369 
2370 // Determine if Xilinx programmed
2371 // Input: NONE
2372 // Output: ULWord or equivalent(i.e. ULWord).
2374 {
2375  ULWord programFlashValue(0);
2376  return ReadRegister (kRegFlashProgramReg, programFlashValue) && ((programFlashValue & BIT(9)) == BIT(9));
2377 }
2378 
2380 {
2381  ULWord totalSize = 0;
2382  ULWord totalProgress = 0;
2383  ULWord state = kProgramStateFinished;
2384  ReadRegister(kVRegFlashSize, totalSize);
2385  ReadRegister(kVRegFlashStatus, totalProgress);
2386  ReadRegister(kVRegFlashState, state);
2387  statusStruct->programTotalSize = totalSize;
2388  statusStruct->programProgress = totalProgress;
2389  statusStruct->programState = ProgramState(state);
2390  return true;
2391 }
2392 
2393 #if !defined(NTV2_DEPRECATE_18_1)
2394  bool CNTV2Card::ProgramMainFlash (const string & inFileName, const bool bInForceUpdate, const bool bInQuiet)
2395  {
2396  CNTV2KonaFlashProgram devFlasher(*this);
2397  if (bInQuiet)
2398  devFlasher.SetQuietMode();
2399  ostringstream msgs;
2400  string progResults;
2401  const bool ok(devFlasher.SetBitFile(inFileName, msgs, MAIN_FLASHBLOCK));
2402 #if 0 // IP10G purge
2403  if (bInForceUpdate)
2404  devFlasher.SetMBReset();
2405 #endif
2406  if (ok)
2407  progResults = devFlasher.Program(false);
2408  else
2409  {AJA_sERROR(AJA_DebugUnit_UserGeneric, INSTP(this) << "::" << AJAFUNC << ": " << msgs.str()); return false;}
2410  if (!progResults.empty())
2411  AJA_sERROR(AJA_DebugUnit_UserGeneric, INSTP(this) << "::" << AJAFUNC << ": " << progResults);
2412  return progResults.empty();
2413  }
2414 #endif
2415 
2417 {
2418  outRevision = 0;
2419  if (!IsOpen())
2420  return false; // Not open
2421  if (!IsSupported(kDeviceCanDoIP))
2422  return false; // No MicroBlaze
2423  return false; // IP10G purge // ReadRegister(kRegSarekPackageVersion + SAREK_REGS, outRevision);
2424 }
2425 
2427 {
2428  outRevision = 0;
2429  if (!IsOpen())
2430  return false;
2431 
2432  uint32_t regValue (0);
2433  if (!ReadRegister (kRegDMAControl, regValue))
2434  return false;
2435 
2436  outRevision = uint16_t((regValue & 0x0000FF00) >> 8);
2437  return true;
2438 }
2439 
2440 bool CNTV2Card::GetRunningFirmwareDate (UWord & outYear, UWord & outMonth, UWord & outDay)
2441 {
2442  outYear = outMonth = outDay = 0;
2443  if (!IsSupported(kDeviceCanReportRunningFirmwareDate))
2444  return false;
2445 
2446  uint32_t regValue (0);
2447  if (!ReadRegister(kRegBitfileDate, regValue))
2448  return false;
2449 
2450  const UWord yearBCD ((regValue & 0xFFFF0000) >> 16); // Year number in BCD
2451  const UWord monthBCD ((regValue & 0x0000FF00) >> 8); // Month number in BCD
2452  const UWord dayBCD (regValue & 0x000000FF); // Day number in BCD
2453 
2454  outYear = ((yearBCD & 0xF000) >> 12) * 1000
2455  + ((yearBCD & 0x0F00) >> 8) * 100
2456  + ((yearBCD & 0x00F0) >> 4) * 10
2457  + (yearBCD & 0x000F);
2458 
2459  outMonth = ((monthBCD & 0x00F0) >> 4) * 10 + (monthBCD & 0x000F);
2460 
2461  outDay = ((dayBCD & 0x00F0) >> 4) * 10 + (dayBCD & 0x000F);
2462 
2463  return outYear > 2010
2464  && outMonth > 0 && outMonth < 13
2465  && outDay > 0 && outDay < 32; // If the date's valid, then it's supported; otherwise, it ain't
2466 }
2467 
2468 
2469 bool CNTV2Card::GetRunningFirmwareTime (UWord & outHours, UWord & outMinutes, UWord & outSeconds)
2470 {
2471  outHours = outMinutes = outSeconds = 0;
2472  if (!IsSupported(kDeviceCanReportRunningFirmwareDate))
2473  return false;
2474 
2475  uint32_t regValue (0);
2476  if (!ReadRegister(kRegBitfileTime, regValue))
2477  return false;
2478 
2479  const UWord hoursBCD ((regValue & 0x00FF0000) >> 16); // Hours number in BCD
2480  const UWord minutesBCD ((regValue & 0x0000FF00) >> 8); // Minutes number in BCD
2481  const UWord secondsBCD (regValue & 0x000000FF); // Seconds number in BCD
2482 
2483  outHours = ((hoursBCD & 0x00F0) >> 4) * 10 + (hoursBCD & 0x000F);
2484 
2485  outMinutes = ((minutesBCD & 0x00F0) >> 4) * 10 + (minutesBCD & 0x000F);
2486 
2487  outSeconds = ((secondsBCD & 0x00F0) >> 4) * 10 + (secondsBCD & 0x000F);
2488 
2489  return outHours < 24 && outMinutes < 60 && outSeconds < 60; // If the time's valid, then it's supported; otherwise, it ain't
2490 }
2491 
2492 
2493 bool CNTV2Card::GetRunningFirmwareDate (std::string & outDate, std::string & outTime)
2494 {
2495  outDate = outTime = string();
2496  UWord yr(0), mo(0), dy(0), hr(0), mn(0), sec(0);
2497  if (!GetRunningFirmwareDate (yr, mo, dy))
2498  return false;
2499  if (!GetRunningFirmwareTime (hr, mn, sec))
2500  return false;
2501 
2502  ostringstream date, time;
2503  date << DEC0N(yr,4) << "/" << DEC0N(mo,2) << "/" << DEC0N(dy,2);
2504  time << DEC0N(hr,2) << ":" << DEC0N(mn,2) << ":" << DEC0N(sec,2);
2505 
2506  outDate = date.str();
2507  outTime = time.str();
2508  return true;
2509 }
2510 
2511 
2513 {
2514  outUserID = 0;
2515  if (!IsOpen())
2516  return false;
2517 
2518  ULWord regValue (0);
2519  if (!ReadRegister (kRegFirmwareUserID, regValue))
2520  return false;
2521 
2522  outUserID = regValue;
2523  return true;
2524 }
2525 
2526 
2528 
2530 {
2531  bool ret;
2532  if (IS_CHANNEL_INVALID(inFrameStore))
2533  return false;
2534  if (IsMultiFormatActive())
2535  return WriteRegister (gChannelToGlobalControlRegNum[inFrameStore], value, kRegMaskRegClocking, kRegShiftRegClocking);
2536  if (IsSupported(kDeviceCanDoMultiFormat))
2537  {
2538  for (NTV2Channel chan(NTV2_CHANNEL1); chan < NTV2Channel(GetNumSupported(kDeviceGetNumFrameStores)); chan = NTV2Channel(chan+1))
2539  {
2540  ret = WriteRegister (gChannelToGlobalControlRegNum[chan], value, kRegMaskRegClocking, kRegShiftRegClocking);
2541  if (!ret)
2542  return false;
2543  }
2544  return true;
2545  }
2547 }
2548 
2549 
2551 {
2552  if (IS_CHANNEL_INVALID (inFrameStore))
2553  return false;
2554  ULWord value(0);
2555  if (!ReadRegister(gChannelToGlobalControlRegNum[IsMultiFormatActive() ? inFrameStore : NTV2_CHANNEL1],
2557  return false;
2558  outValue = NTV2RegisterWriteMode(value);
2559  return true;
2560 }
2561 
2562 
2564 // RP188 methods
2566 
2567 bool CNTV2Card::SetRP188Mode (const NTV2Channel inChannel, const NTV2_RP188Mode inValue)
2568 {
2569  if (IS_CHANNEL_INVALID (inChannel))
2570  return false;
2571  return WriteRegister (gChannelToRP188ModeGCRegisterNum [inChannel], inValue, gChannelToRP188ModeMasks [inChannel], gChannelToRP188ModeShifts [inChannel]);
2572 }
2573 
2574 
2575 bool CNTV2Card::GetRP188Mode (const NTV2Channel inChannel, NTV2_RP188Mode & outMode)
2576 {
2577  if (IS_CHANNEL_INVALID (inChannel))
2578  return false;
2579  const bool result (CNTV2DriverInterface::ReadRegister (gChannelToRP188ModeGCRegisterNum[inChannel], outMode, gChannelToRP188ModeMasks[inChannel], gChannelToRP188ModeShifts[inChannel]));
2580  if (!result)
2581  outMode = NTV2_RP188_INVALID;
2582  return result;
2583 }
2584 
2585 
2586 bool CNTV2Card::GetRP188Data (const NTV2Channel inChannel, NTV2_RP188 & outRP188Data)
2587 {
2588  outRP188Data = NTV2_RP188();
2589  if (IS_CHANNEL_INVALID (inChannel))
2590  return false;
2591  return ReadRegister (gChlToRP188DBBRegNum[inChannel], outRP188Data.fDBB, kRegMaskRP188DBB, kRegShiftRP188DBB)
2592  && ReadRegister (gChlToRP188Bits031RegNum[inChannel], outRP188Data.fLo)
2593  && ReadRegister (gChlToRP188Bits3263RegNum[inChannel], outRP188Data.fHi);
2594 }
2595 
2596 
2597 bool CNTV2Card::SetRP188Data (const NTV2Channel inChannel, const NTV2_RP188 & inRP188Data)
2598 {
2599  if (IS_CHANNEL_INVALID (inChannel))
2600  return false;
2601  if (!inRP188Data.IsValid())
2602  return false;
2603  return WriteRegister (gChlToRP188DBBRegNum[inChannel], inRP188Data.fDBB, kRegMaskRP188DBB, kRegShiftRP188DBB)
2604  && WriteRegister (gChlToRP188Bits031RegNum[inChannel], inRP188Data.fLo)
2605  && WriteRegister (gChlToRP188Bits3263RegNum[inChannel], inRP188Data.fHi);
2606 }
2607 
2608 
2609 bool CNTV2Card::SetRP188SourceFilter (const NTV2Channel inChannel, UWord inValue)
2610 {
2611  if (IS_CHANNEL_INVALID (inChannel))
2612  return false;
2613  return WriteRegister (gChlToRP188DBBRegNum[inChannel], ULWord(inValue), kRegMaskRP188SourceSelect, kRegShiftRP188Source);
2614 }
2615 
2616 
2617 bool CNTV2Card::GetRP188SourceFilter (const NTV2Channel inChannel, UWord & outValue)
2618 {
2619  if (IS_CHANNEL_INVALID (inChannel))
2620  return false;
2622 }
2623 
2624 
2625 bool CNTV2Card::IsRP188BypassEnabled (const NTV2Channel inChannel, bool & outIsBypassEnabled)
2626 {
2627  if (IS_CHANNEL_INVALID (inChannel))
2628  return false;
2629  // Bit 23 of the RP188 DBB register will be set if output timecode will be grabbed directly from an input (bypass source)...
2630  ULWord regValue (0);
2631  bool result (NTV2_IS_VALID_CHANNEL(inChannel) && ReadRegister(gChlToRP188DBBRegNum[inChannel], regValue));
2632  if (result)
2633  outIsBypassEnabled = regValue & BIT(23);
2634  return result;
2635 }
2636 
2637 
2639 {
2640  if (IS_CHANNEL_INVALID (inChannel))
2641  return false;
2642  // Clear bit 23 of my output destination's RP188 DBB register...
2643  return NTV2_IS_VALID_CHANNEL (inChannel) && WriteRegister (gChlToRP188DBBRegNum[inChannel], 0, BIT(23), 23);
2644 }
2645 
2646 
2648 {
2649  if (IS_CHANNEL_INVALID (inChannel))
2650  return false;
2651  // Set bit 23 of my output destination's RP188 DBB register...
2652  return NTV2_IS_VALID_CHANNEL (inChannel) && WriteRegister (gChlToRP188DBBRegNum [inChannel], 1, BIT(23), 23);
2653 }
2654 
2655 static const ULWord gSDIOutToRP188Input[] = { 0, 2, 1, 3, 0, 2, 1, 3, 0 };
2656 
2657 bool CNTV2Card::SetRP188BypassSource (const NTV2Channel inSDIOutput, const UWord inSDIInput)
2658 {
2659  if (IS_CHANNEL_INVALID(inSDIOutput))
2660  return false;
2661  if (IS_CHANNEL_INVALID(NTV2Channel(inSDIInput)))
2662  return false;
2663  return WriteRegister(gChlToRP188DBBRegNum[inSDIOutput], gSDIOutToRP188Input[inSDIInput], BIT(21)|BIT(22), 21);
2664 }
2665 
2666 bool CNTV2Card::GetRP188BypassSource (const NTV2Channel inSDIOutput, UWord & outSDIInput)
2667 {
2668  if (IS_CHANNEL_INVALID(inSDIOutput))
2669  return false;
2670  ULWord val(0);
2671  if (!ReadRegister(gChlToRP188DBBRegNum[inSDIOutput], val, BIT(21)|BIT(22), 21))
2672  return false;
2673  switch(val)
2674  {
2675  case 0: outSDIInput = inSDIOutput < NTV2_CHANNEL5 ? 0 : 4; break;
2676  case 2: outSDIInput = inSDIOutput < NTV2_CHANNEL5 ? 1 : 5; break;
2677  case 1: outSDIInput = inSDIOutput < NTV2_CHANNEL5 ? 2 : 6; break;
2678  case 3: outSDIInput = inSDIOutput < NTV2_CHANNEL5 ? 3 : 7; break;
2679  default: return false;
2680  }
2681  return true;
2682 }
2683 
2684 
2686 {
2687  if (!NTV2_IS_VALID_VIDEOLIMITING(inValue))
2688  return false;
2689  CVIDINFO("'" << GetDisplayName() << "' set to " << ::NTV2VideoLimitingToString(inValue));
2690  return WriteRegister (kRegVidProc1Control, inValue, kRegMaskVidProcLimiting, kRegShiftVidProcLimiting);
2691 }
2692 
2694 {
2696 }
2697 
2698 
2699 //SetEnableVANCData
2700 // Call SetVideoFormat with the desired video format BEFORE you call this function!
2701 bool CNTV2Card::SetEnableVANCData (const bool inVANCenable, const bool inTallerVANC, const NTV2Channel inChannel)
2702 {
2703  return SetVANCMode (NTV2VANCModeFromBools(inVANCenable, inTallerVANC), IsMultiFormatActive() ? inChannel : NTV2_CHANNEL1);
2704 }
2705 
2706 bool CNTV2Card::SetVANCMode (const NTV2ChannelSet & inChannels, const NTV2VANCMode inVancMode)
2707 {
2708  size_t errors(0);
2709  for (NTV2ChannelSetConstIter it(inChannels.begin()); it != inChannels.end(); ++it)
2710  if (!SetVANCMode (inVancMode, *it))
2711  errors++;
2712  return !errors;
2713 }
2714 
2715 
2716 bool CNTV2Card::SetVANCMode (const NTV2VANCMode inVancMode, const NTV2Channel inChannel)
2717 {
2718  const NTV2Channel ch (IsMultiFormatActive() ? inChannel : NTV2_CHANNEL1);
2719  if (IsMultiRasterWidgetChannel(ch))
2720  return inVancMode == NTV2_VANCMODE_OFF;
2721  if (IS_CHANNEL_INVALID(ch))
2722  return false;
2723  if (!NTV2_IS_VALID_VANCMODE(inVancMode))
2724  return false;
2725 
2728  GetStandard(st, ch);
2729  GetFrameGeometry(fg, ch);
2730  switch (st)
2731  {
2732  case NTV2_STANDARD_1080:
2733  case NTV2_STANDARD_1080p:
2734  if (fg == NTV2_FG_1920x1112 || fg == NTV2_FG_1920x1114 || fg == NTV2_FG_1920x1080)
2736  else if (NTV2_IS_QUAD_FRAME_GEOMETRY(fg)) // 4K
2737  ; // do nothing for now
2738  else if (NTV2_IS_2K_1080_FRAME_GEOMETRY(fg)) // 2Kx1080
2740  break;
2741 
2742  case NTV2_STANDARD_720:
2744  if (NTV2_IS_VANCMODE_TALLER(inVancMode))
2745  CVIDWARN("'taller' mode requested for 720p -- using 'tall' geometry instead");
2746  break;
2747 
2748  case NTV2_STANDARD_525:
2750  break;
2751 
2752  case NTV2_STANDARD_625:
2754  break;
2755 
2756  case NTV2_STANDARD_2K:
2758  if (NTV2_IS_VANCMODE_TALLER(inVancMode))
2759  CVIDWARN("'taller' mode requested for 2K standard '" << ::NTV2StandardToString(st) << "' -- using 'tall' instead");
2760  break;
2761 
2765  break;
2766 
2769  case NTV2_STANDARD_3840HFR:
2770  case NTV2_STANDARD_4096HFR:
2771  case NTV2_STANDARD_7680:
2772  case NTV2_STANDARD_8192:
2773  case NTV2_STANDARD_3840i:
2774  case NTV2_STANDARD_4096i:
2775  if (NTV2_IS_VANCMODE_ON(inVancMode))
2776  CVIDWARN("'tall' or 'taller' mode requested for '" << ::NTV2StandardToString(st) << "' -- using non-VANC geometry instead");
2777  break;
2778  #if defined(_DEBUG)
2779  case NTV2_STANDARD_INVALID: return false;
2780  #else
2781  default: return false;
2782  #endif // _DEBUG
2783  }
2784  SetFrameGeometry (fg, false/*ajaRetail*/, ch);
2785  CVIDINFO("'" << GetDisplayName() << "' Ch" << DEC(ch+1) << ": set to " << ::NTV2VANCModeToString(inVancMode) << " for " << ::NTV2StandardToString(st) << " and " << ::NTV2FrameGeometryToString(fg));
2786 
2787  // Only muck with limiting if not the xena2k board. Xena2k only turns off limiting in VANC area. Active video uses vidproccontrol setting...
2788  if (!::NTV2DeviceNeedsRoutingSetup(GetDeviceID()))
2789  SetVideoLimiting (NTV2_IS_VANCMODE_ON(inVancMode) ? NTV2_VIDEOLIMITING_OFF : NTV2_VIDEOLIMITING_LEGALSDI);
2790 
2791  return true;
2792 }
2793 
2794 
2795 //SetEnableVANCData - extended params
2796 bool CNTV2Card::SetEnableVANCData (const bool inVANCenabled, const bool inTallerVANC, const NTV2Standard inStandard, const NTV2FrameGeometry inFrameGeometry, const NTV2Channel inChannel)
2797 { (void) inStandard; (void) inFrameGeometry;
2798  if (inTallerVANC && !inVANCenabled)
2799  return false; // conflicting VANC params
2800  return SetVANCMode (NTV2VANCModeFromBools (inVANCenabled, inTallerVANC), inChannel);
2801 }
2802 
2803 
2804 bool CNTV2Card::GetVANCMode (NTV2VANCMode & outVancMode, const NTV2Channel inChannel)
2805 {
2806  bool isTall (false);
2807  bool isTaller (false);
2808  const NTV2Channel channel (IsMultiFormatActive() ? inChannel : NTV2_CHANNEL1);
2810  NTV2FrameGeometry frameGeometry (NTV2_FG_INVALID);
2811 
2812  if (IsMultiRasterWidgetChannel(channel))
2813  {outVancMode = NTV2_VANCMODE_OFF; return true;}
2814 
2815  outVancMode = NTV2_VANCMODE_INVALID;
2816  if (IS_CHANNEL_INVALID (channel))
2817  return false;
2818 
2819  GetStandard (standard, channel);
2820  GetFrameGeometry (frameGeometry, channel);
2821 
2822  switch (standard)
2823  {
2824  case NTV2_STANDARD_1080:
2825  case NTV2_STANDARD_1080p:
2826  case NTV2_STANDARD_2Kx1080p: // ** MrBill ** IS THIS CORRECT?
2827  case NTV2_STANDARD_2Kx1080i: // ** MrBill ** IS THIS CORRECT?
2828  if ( frameGeometry == NTV2_FG_1920x1112 || frameGeometry == NTV2_FG_2048x1112 ||
2829  frameGeometry == NTV2_FG_1920x1114 || frameGeometry == NTV2_FG_2048x1114)
2830  isTall = true;
2831  if ( frameGeometry == NTV2_FG_1920x1114 || frameGeometry == NTV2_FG_2048x1114)
2832  isTaller = true;
2833  break;
2834  case NTV2_STANDARD_720:
2835  if ( frameGeometry == NTV2_FG_1280x740)
2836  isTall = true;
2837  break;
2838  case NTV2_STANDARD_525:
2839  if ( frameGeometry == NTV2_FG_720x508 ||
2840  frameGeometry == NTV2_FG_720x514)
2841  isTall = true;
2842  if ( frameGeometry == NTV2_FG_720x514 )
2843  isTaller = true;
2844  break;
2845  case NTV2_STANDARD_625:
2846  if ( frameGeometry == NTV2_FG_720x598 ||
2847  frameGeometry == NTV2_FG_720x612)
2848  isTall = true;
2849  if ( frameGeometry == NTV2_FG_720x612 )
2850  isTaller = true;
2851  break;
2852  case NTV2_STANDARD_2K:
2853  if ( frameGeometry == NTV2_FG_2048x1588)
2854  isTall = true;
2855  break;
2858  case NTV2_STANDARD_3840HFR:
2859  case NTV2_STANDARD_4096HFR:
2860  case NTV2_STANDARD_7680:
2861  case NTV2_STANDARD_8192:
2862  case NTV2_STANDARD_3840i:
2863  case NTV2_STANDARD_4096i:
2864  break;
2865  #if defined (_DEBUG)
2866  case NTV2_NUM_STANDARDS: return false;
2867  #else
2868  default: return false;
2869  #endif
2870  }
2871  outVancMode = NTV2VANCModeFromBools (isTall, isTaller);
2872  return true;
2873 }
2874 
2875 
2877 {
2878  if (IsMultiRasterWidgetChannel(inChannel))
2879  return inValue == NTV2_VANCDATA_NORMAL;
2880  if (IS_CHANNEL_INVALID (inChannel))
2881  return false;
2882  CVIDINFO("'" << GetDisplayName() << "' Ch" << DEC(inChannel+1) << ": Vanc data shift " << (inValue ? "enabled" : "disabled"));
2883  return WriteRegister (gChannelToControlRegNum [inChannel], inValue, kRegMaskVidProcVANCShift, kRegShiftVidProcVANCShift);
2884 }
2885 
2886 
2888 {
2889  size_t errors(0);
2890  for (NTV2ChannelSetConstIter it(inChannels.begin()); it != inChannels.end(); ++it)
2891  if (!SetVANCShiftMode(*it, inMode))
2892  errors++;
2893  return !errors;
2894 }
2895 
2896 
2898 {
2899  if (IsMultiRasterWidgetChannel(inChannel))
2900  {outValue = NTV2_VANCDATA_NORMAL; return true;}
2901  if (IS_CHANNEL_INVALID (inChannel))
2902  return false;
2904 }
2905 
2906 
2907 bool CNTV2Card::SetPulldownMode (NTV2Channel inChannel, bool inValue)
2908 {
2909  if (IS_CHANNEL_INVALID (inChannel))
2910  return false;
2912 }
2913 
2914 
2915 bool CNTV2Card::GetPulldownMode (NTV2Channel inChannel, bool & outValue)
2916 {
2917  ULWord value(0);
2918  if (IS_CHANNEL_INVALID (inChannel))
2919  return false;
2921  {
2922  outValue = value ? true : false;
2923  return true;
2924  }
2925  return false;
2926 }
2927 
2928 
2929 bool CNTV2Card::SetMixerVancOutputFromForeground (const UWord inWhichMixer, const bool inFromForegroundSource)
2930 {
2931  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
2932  return false;
2933  CVIDINFO("'" << GetDisplayName() << "' Mixer" << DEC(inWhichMixer+1) << ": Vanc from " << (inFromForegroundSource ? "FG" : "BG"));
2934  return WriteRegister (gIndexToVidProcControlRegNum[inWhichMixer], inFromForegroundSource ? 1 : 0, kRegMaskVidProcVancSource, kRegShiftVidProcVancSource);
2935 }
2936 
2937 
2938 bool CNTV2Card::GetMixerVancOutputFromForeground (const UWord inWhichMixer, bool & outIsFromForegroundSource)
2939 {
2940  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
2941  return false;
2942 
2943  ULWord value (0);
2944  bool result (ReadRegister (gIndexToVidProcControlRegNum[inWhichMixer], value, kRegMaskVidProcVancSource, kRegShiftVidProcVancSource));
2945  if (result)
2946  outIsFromForegroundSource = value ? true : false;
2947  return result;
2948 }
2949 
2950 bool CNTV2Card::SetMixerFGInputControl (const UWord inWhichMixer, const NTV2MixerKeyerInputControl inInputControl)
2951 {
2952  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
2953  return false;
2954  CVIDINFO("'" << GetDisplayName() << "' Mixer" << DEC(inWhichMixer+1) << ": FG input ctrl=" << ::NTV2MixerInputControlToString(inInputControl));
2956 }
2957 
2958 
2959 bool CNTV2Card::GetMixerFGInputControl (const UWord inWhichMixer, NTV2MixerKeyerInputControl & outInputControl)
2960 {
2961  outInputControl = NTV2MIXERINPUTCONTROL_INVALID;
2962  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
2963  return false;
2964 
2965  ULWord value (0);
2967  if (result)
2968  outInputControl = static_cast <NTV2MixerKeyerInputControl> (value);
2969  return result;
2970 }
2971 
2972 
2973 bool CNTV2Card::SetMixerBGInputControl (const UWord inWhichMixer, const NTV2MixerKeyerInputControl inInputControl)
2974 {
2975  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
2976  return false;
2977  CVIDINFO("'" << GetDisplayName() << "' Mixer" << DEC(inWhichMixer+1) << ": BG input ctrl=" << ::NTV2MixerInputControlToString(inInputControl));
2979 }
2980 
2981 
2982 bool CNTV2Card::GetMixerBGInputControl (const UWord inWhichMixer, NTV2MixerKeyerInputControl & outInputControl)
2983 {
2984  outInputControl = NTV2MIXERINPUTCONTROL_INVALID;
2985  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
2986  return false;
2987 
2988  ULWord value (0);
2990  if (result)
2991  outInputControl = static_cast <NTV2MixerKeyerInputControl> (value);
2992  return result;
2993 }
2994 
2995 
2996 bool CNTV2Card::SetMixerMode (const UWord inWhichMixer, const NTV2MixerKeyerMode inMode)
2997 {
2998  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
2999  return false;
3000  CVIDINFO("'" << GetDisplayName() << "' Mixer" << DEC(inWhichMixer+1) << ": mode=" << ::NTV2MixerKeyerModeToString(inMode));
3001  return WriteRegister (gIndexToVidProcControlRegNum[inWhichMixer], inMode, kK2RegMaskXena2VidProcMode, kK2RegShiftXena2VidProcMode);
3002 }
3003 
3004 
3005 bool CNTV2Card::GetMixerMode (const UWord inWhichMixer, NTV2MixerKeyerMode & outMode)
3006 {
3007  outMode = NTV2MIXERMODE_INVALID;
3008 
3009  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3010  return false;
3011 
3012  ULWord value (0);
3013  bool result (ReadRegister (gIndexToVidProcControlRegNum[inWhichMixer], value, kK2RegMaskXena2VidProcMode, kK2RegShiftXena2VidProcMode));
3014  if (result)
3015  outMode = static_cast <NTV2MixerKeyerMode> (value);
3016  return result;
3017 }
3018 
3019 
3020 bool CNTV2Card::SetMixerCoefficient (const UWord inWhichMixer, const ULWord inMixCoefficient)
3021 {
3022  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3023  return false;
3024  CVIDINFO("'" << GetDisplayName() << "' Mixer" << DEC(inWhichMixer+1) << ": mixCoeff=" << xHEX0N(inMixCoefficient,8));
3025  return WriteRegister (gIndexToVidProcMixCoeffRegNum[inWhichMixer], inMixCoefficient);
3026 }
3027 
3028 
3029 bool CNTV2Card::GetMixerCoefficient (const UWord inWhichMixer, ULWord & outMixCoefficient)
3030 {
3031  outMixCoefficient = 0;
3032  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3033  return false;
3034  return ReadRegister (gIndexToVidProcMixCoeffRegNum[inWhichMixer], outMixCoefficient);
3035 }
3036 
3037 
3038 bool CNTV2Card::GetMixerSyncStatus (const UWord inWhichMixer, bool & outIsSyncOK)
3039 {
3040  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3041  return false;
3042 
3043  bool syncFail (false);
3045  return false;
3046  outIsSyncOK = syncFail ? false : true;
3047  return true;
3048 }
3049 
3050 bool CNTV2Card::GetMixerFGMatteEnabled (const UWord inWhichMixer, bool & outIsEnabled)
3051 {
3052  outIsEnabled = false;
3053  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3054  return false;
3056 }
3057 
3058 bool CNTV2Card::SetMixerFGMatteEnabled (const UWord inWhichMixer, const bool inIsEnabled)
3059 {
3060  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3061  return false;
3062  return WriteRegister (gIndexToVidProcControlRegNum[inWhichMixer], inIsEnabled?1:0, kRegMaskVidProcFGMatteEnable, kRegShiftVidProcFGMatteEnable);
3063 }
3064 
3065 bool CNTV2Card::GetMixerBGMatteEnabled (const UWord inWhichMixer, bool & outIsEnabled)
3066 {
3067  outIsEnabled = false;
3068  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3069  return false;
3071 }
3072 
3073 bool CNTV2Card::SetMixerBGMatteEnabled (const UWord inWhichMixer, const bool inIsEnabled)
3074 {
3075  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3076  return false;
3077  return WriteRegister (gIndexToVidProcControlRegNum[inWhichMixer], inIsEnabled?1:0, kRegMaskVidProcBGMatteEnable, kRegShiftVidProcBGMatteEnable);
3078 }
3079 
3080 static const ULWord gMatteColorRegs[] = { kRegFlatMatteValue /*13*/, kRegFlatMatte2Value /*249*/, kRegFlatMatte3Value /*487*/, kRegFlatMatte4Value /*490*/, 0, 0, 0, 0};
3081 
3082 bool CNTV2Card::GetMixerMatteColor (const UWord inWhichMixer, YCbCr10BitPixel & outYCbCrValue)
3083 {
3084  ULWord packedValue (0);
3085  outYCbCrValue.cb = outYCbCrValue.y = outYCbCrValue.cr = 0;
3086  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3087  return false;
3088  if (!ReadRegister(gMatteColorRegs[inWhichMixer], packedValue))
3089  return false;
3090 
3091  outYCbCrValue.cb = packedValue & 0x03FF;
3092  outYCbCrValue.y = ((packedValue >> 10) & 0x03FF) + 0x0040;
3093  outYCbCrValue.cr = (packedValue >> 20) & 0x03FF;
3094  return true;
3095 }
3096 
3097 bool CNTV2Card::SetMixerMatteColor (const UWord inWhichMixer, const YCbCr10BitPixel inYCbCrValue)
3098 {
3099  YCbCr10BitPixel ycbcrPixel (inYCbCrValue);
3100  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3101  return false;
3102 
3103  if (ycbcrPixel.y < 0x40)
3104  ycbcrPixel.y = 0x0; // clip y
3105  else
3106  ycbcrPixel.y -= 0x40;
3107  ycbcrPixel.y &= 0x3FF;
3108  ycbcrPixel.cb &= 0x3FF;
3109  ycbcrPixel.cr &= 0x3FF;
3110 
3111  // Pack three 10-bit values into ULWord...
3112  const ULWord packedValue (ULWord(ycbcrPixel.cb) | (ULWord(ycbcrPixel.y) << 10) | (ULWord(ycbcrPixel.cr) << 20));
3113  CVIDINFO("'" << GetDisplayName() << "' Mixer" << DEC(inWhichMixer+1) << ": set to YCbCr=" << DEC(ycbcrPixel.y)
3114  << "|" << DEC(ycbcrPixel.cb) << "|" << DEC(ycbcrPixel.cr) << ":" << HEXN(ycbcrPixel.y,3) << "|"
3115  << HEXN(ycbcrPixel.cb,3) << "|" << HEXN(ycbcrPixel.cr,3) << ", write " << xHEX0N(packedValue,8)
3116  << " into reg " << DEC(gMatteColorRegs[inWhichMixer]));
3117 
3118  // Write it...
3119  return WriteRegister(gMatteColorRegs[inWhichMixer], packedValue);
3120 }
3121 
3122 bool CNTV2Card::MixerHasRGBModeSupport (const UWord inWhichMixer, bool & outIsSupported)
3123 {
3124  outIsSupported = false;
3125  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3126  return false;
3128 }
3129 
3130 bool CNTV2Card::SetMixerRGBRange (const UWord inWhichMixer, const NTV2MixerRGBRange inRGBRange)
3131 {
3132  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3133  return false;
3134  return !WriteRegister (gIndexToVidProcControlRegNum[inWhichMixer], inRGBRange, kRegMaskVidProcRGBRange, kRegShiftVidProcRGBRange);
3135 }
3136 
3137 bool CNTV2Card::GetMixerRGBRange (const UWord inWhichMixer, NTV2MixerRGBRange & outRGBRange)
3138 {
3139  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3140  return false;
3142 }
3143 
3144 
3146 // Mapping methods
3148 
3149 #if !defined(NTV2_DEPRECATE_16_0)
3150  // Method: GetBaseAddress
3151  // Input: NTV2Channel channel
3152  // Output: bool status and modifies ULWord **pBaseAddress
3153  bool CNTV2Card::GetBaseAddress (NTV2Channel channel, ULWord **pBaseAddress)
3154  {
3155  if (IS_CHANNEL_INVALID(channel))
3156  return false;
3157  ULWord ulFrame(0);
3158  if (!ReadRegister(gChannelToPCIAccessFrameRegNum[channel], ulFrame)) // GetPCIAccessFrame(channel, ulFrame);
3159  return false;
3160  if (ulFrame > GetNumFrameBuffers())
3161  ulFrame = 0;
3162 
3163  if (::NTV2DeviceIsDirectAddressable(GetDeviceID()))
3164  {
3165  if (!_pFrameBaseAddress)
3166  if (!MapFrameBuffers())
3167  return false;
3168  *pBaseAddress = _pFrameBaseAddress + ((ulFrame * _ulFrameBufferSize) / sizeof(ULWord));
3169  }
3170  else // must be an _MM board
3171  {
3172  if (!_pCh1FrameBaseAddress)
3173  if (!MapFrameBuffers())
3174  return false;
3175  *pBaseAddress = (channel == NTV2_CHANNEL1) ? _pCh1FrameBaseAddress : _pCh2FrameBaseAddress; // DEPRECATE!
3176  }
3177  return true;
3178  }
3179 
3180  // Method: GetBaseAddress
3181  // Input: None
3182  // Output: bool status and modifies ULWord *pBaseAddress
3183  bool CNTV2Card::GetBaseAddress (ULWord **pBaseAddress)
3184  {
3185  if (!_pFrameBaseAddress)
3186  if (!MapFrameBuffers())
3187  return false;
3188  *pBaseAddress = _pFrameBaseAddress;
3189  return true;
3190  }
3191 
3192  // Method: GetRegisterBaseAddress
3193  // Input: ULWord regNumber
3194  // Output: bool status and modifies ULWord **pBaseAddress
3195  bool CNTV2Card::GetRegisterBaseAddress (ULWord regNumber, ULWord **pBaseAddress)
3196  {
3197  if (!_pRegisterBaseAddress)
3198  if (!MapRegisters())
3199  return false;
3200  #ifdef MSWindows
3201  if ((regNumber*4) >= _pRegisterBaseAddressLength)
3202  return false;
3203  #endif // MSWindows
3204  *pBaseAddress = _pRegisterBaseAddress + regNumber;
3205  return true;
3206  }
3207 
3208  // Method: GetXena2FlashBaseAddress
3209  // Output: bool status and modifies ULWord **pXena2FlashAddress
3210  bool CNTV2Card::GetXena2FlashBaseAddress (ULWord **pXena2FlashAddress)
3211  {
3212  if (!_pXena2FlashBaseAddress)
3213  if (!MapXena2Flash())
3214  return false;
3215  *pXena2FlashAddress = _pXena2FlashBaseAddress;
3216  return true;
3217  }
3218 #endif // !defined(NTV2_DEPRECATE_16_0)
3219 
3220 bool CNTV2Card::SetDualLinkOutputEnable (const bool enable)
3221 {
3222  return WriteRegister (kRegGlobalControl, enable ? 1 : 0, kRegMaskDualLinkOutEnable, kRegShiftDualLinKOutput);
3223 }
3224 
3225 bool CNTV2Card::GetDualLinkOutputEnable (bool & outIsEnabled)
3226 {
3227  outIsEnabled = false;
3229 }
3230 
3231 
3232 bool CNTV2Card::SetDualLinkInputEnable (const bool enable)
3233 {
3234  return WriteRegister (kRegGlobalControl, enable ? 1 : 0, kRegMaskDualLinkInEnable, kRegShiftDualLinkInput);
3235 }
3236 
3237 
3238 bool CNTV2Card::GetDualLinkInputEnable (bool & outIsEnabled)
3239 {
3240  outIsEnabled = false;
3242 }
3243 
3244 
3246 
3247 bool CNTV2Card::SetDitherFor8BitInputs (const NTV2Channel inChannel, const ULWord inDither)
3248 {
3249  if (IS_CHANNEL_INVALID(inChannel))
3250  return false;
3251  return WriteRegister (gChannelToControlRegNum[inChannel], inDither, kRegMaskDitherOn8BitInput, kRegShiftDitherOn8BitInput);
3252 }
3253 
3254 bool CNTV2Card::GetDitherFor8BitInputs (const NTV2Channel inChannel, ULWord & outDither)
3255 {
3256  if (IS_CHANNEL_INVALID(inChannel))
3257  return false;
3258  return ReadRegister(gChannelToControlRegNum[inChannel], outDither, kRegMaskDitherOn8BitInput, kRegShiftDitherOn8BitInput);
3259 }
3260 
3262 
3263 bool CNTV2Card::SetForce64(ULWord force64) {return WriteRegister (kRegDMAControl, force64, kRegMaskForce64, kRegShiftForce64);}
3264 bool CNTV2Card::GetForce64(ULWord* force64) {return force64 ? ReadRegister (kRegDMAControl, *force64, kRegMaskForce64, kRegShiftForce64) : false;}
3265 bool CNTV2Card::Get64BitAutodetect(ULWord* autodetect64) {return autodetect64 ? ReadRegister (kRegDMAControl, *autodetect64, kRegMaskAutodetect64, kRegShiftAutodetect64) : false;}
3266 
3268 // Kona2/Xena2/ related methods
3269 
3270 // kK2RegAnalogOutControl
3275 
3276 bool CNTV2Card::SetSDIOutputStandard (const UWord inOutputSpigot, const NTV2Standard inValue)
3277 {
3278  if (IS_OUTPUT_SPIGOT_INVALID(inOutputSpigot))
3279  return false;
3280 
3281  NTV2Standard standard(inValue);
3282  bool is2Kx1080(false);
3283  switch(inValue)
3284  {
3286  standard = NTV2_STANDARD_1080p;
3287  is2Kx1080 = true;
3288  break;
3290  standard = NTV2_STANDARD_1080;
3291  is2Kx1080 = true;
3292  break;
3294  standard = NTV2_STANDARD_1080p;
3295  is2Kx1080 = false;
3296  break;
3297  case NTV2_STANDARD_3840HFR:
3298  standard = NTV2_STANDARD_1080p;
3299  is2Kx1080 = false;
3300  break;
3301  case NTV2_STANDARD_3840i:
3302  standard = NTV2_STANDARD_1080;
3303  is2Kx1080 = false;
3304  break;
3306  standard = NTV2_STANDARD_1080p;
3307  is2Kx1080 = true;
3308  break;
3309  case NTV2_STANDARD_4096HFR:
3310  standard = NTV2_STANDARD_1080p;
3311  is2Kx1080 = true;
3312  break;
3313  case NTV2_STANDARD_4096i:
3314  standard = NTV2_STANDARD_1080;
3315  is2Kx1080 = true;
3316  break;
3317  default:
3318  break;
3319  }
3320 
3321  return WriteRegister (gChannelToSDIOutControlRegNum[inOutputSpigot], standard, kK2RegMaskSDIOutStandard, kK2RegShiftSDIOutStandard)
3322  && SetSDIOut2Kx1080Enable(NTV2Channel(inOutputSpigot), is2Kx1080);
3323 }
3324 
3325 bool CNTV2Card::SetSDIOutputStandard (const NTV2ChannelSet & inSDIOutputs, const NTV2Standard inValue)
3326 {
3327  size_t errors(0);
3328  for (NTV2ChannelSetConstIter it(inSDIOutputs.begin()); it != inSDIOutputs.end(); ++it)
3329  if (!SetSDIOutputStandard(*it, inValue))
3330  errors++;
3331  return !errors;
3332 }
3333 
3334 bool CNTV2Card::GetSDIOutputStandard (const UWord inOutputSpigot, NTV2Standard & outValue)
3335 {
3336  if (IS_OUTPUT_SPIGOT_INVALID(inOutputSpigot))
3337  return false;
3338  bool is2kx1080(false);
3339  bool is6G(false);
3340  bool is12G(false);
3343  && GetSDIOut2Kx1080Enable(NTV2Channel(inOutputSpigot), is2kx1080)
3344  && GetSDIOut6GEnable(NTV2Channel(inOutputSpigot), is6G)
3345  && GetSDIOut12GEnable(NTV2Channel(inOutputSpigot), is12G));
3346  outValue = newStd;
3347  switch (newStd)
3348  {
3349  case NTV2_STANDARD_1080:
3350  if (is2kx1080)
3351  outValue = NTV2_STANDARD_2Kx1080i;
3352  if (is6G || is12G)
3353  outValue = is2kx1080 ? NTV2_STANDARD_4096i : NTV2_STANDARD_3840i;
3354  break;
3355  case NTV2_STANDARD_1080p:
3356  if (is2kx1080)
3357  outValue = NTV2_STANDARD_2Kx1080p;
3358  if (is6G || is12G)
3359  outValue = is2kx1080 ? NTV2_STANDARD_4096x2160p : NTV2_STANDARD_3840x2160p;
3360  break;
3361  default:
3362  break;
3363  }
3364  return result;
3365 }
3366 
3367 bool CNTV2Card::WriteOutputTimingControl (const ULWord inValue, const UWord inOutputSpigot)
3368 {
3369  if (IS_OUTPUT_SPIGOT_INVALID(inOutputSpigot))
3370  return false;
3371  if (IsMultiFormatActive())
3372  return WriteRegister (gChannelToOutputTimingCtrlRegNum[inOutputSpigot], inValue);
3373  else if (IsSupported(kDeviceCanDoMultiFormat))
3374  {
3375  // Write all of the timing registers for UniFormat mode...
3376  switch (GetNumSupported(kDeviceGetNumVideoChannels))
3377  {
3378  case 8:
3379  WriteRegister (gChannelToOutputTimingCtrlRegNum[NTV2_CHANNEL8], inValue);
3380  WriteRegister (gChannelToOutputTimingCtrlRegNum[NTV2_CHANNEL7], inValue);
3381  WriteRegister (gChannelToOutputTimingCtrlRegNum[NTV2_CHANNEL6], inValue);
3382  WriteRegister (gChannelToOutputTimingCtrlRegNum[NTV2_CHANNEL5], inValue);
3383  AJA_FALL_THRU;
3384  case 4:
3385  WriteRegister (gChannelToOutputTimingCtrlRegNum[NTV2_CHANNEL4], inValue);
3386  WriteRegister (gChannelToOutputTimingCtrlRegNum[NTV2_CHANNEL3], inValue);
3387  AJA_FALL_THRU;
3388  case 2:
3389  WriteRegister (gChannelToOutputTimingCtrlRegNum[NTV2_CHANNEL2], inValue);
3390  AJA_FALL_THRU;
3391  default:
3392  return WriteRegister (gChannelToOutputTimingCtrlRegNum [NTV2_CHANNEL1], inValue);
3393  }
3394  }
3395  else
3396  return WriteRegister (gChannelToOutputTimingCtrlRegNum [NTV2_CHANNEL1], inValue);
3397 }
3398 
3399 
3400 bool CNTV2Card::ReadOutputTimingControl (ULWord & outValue, const UWord inOutputSpigot)
3401 {
3402  if (IS_OUTPUT_SPIGOT_INVALID (inOutputSpigot))
3403  return false;
3404  return ReadRegister (gChannelToOutputTimingCtrlRegNum[IsMultiFormatActive() ? inOutputSpigot : UWord(NTV2_CHANNEL1)], outValue);
3405 }
3406 
3407 // SDI1 HTiming
3409 bool CNTV2Card::GetSDI1OutHTiming(ULWord* pValue) {return pValue ? ReadRegister(kRegSDIOut1Control, *pValue, kK2RegMaskOutHTiming, kK2RegShiftOutHTiming) : false;}
3410 
3411 // SDI2 HTiming
3413 bool CNTV2Card::GetSDI2OutHTiming(ULWord* pValue) {return pValue ? ReadRegister(kRegSDIOut2Control, *pValue, kK2RegMaskOutHTiming, kK2RegShiftOutHTiming) : false;}
3414 
3416 {
3417  return WriteRegister(kVRegSecondaryFormatSelect, format);
3418 }
3419 
3421 {
3423 }
3424 
3425 
3426 #if !defined(R2_DEPRECATE)
3427 
3429 {
3430  return WriteRegister(kVRegInputSelect, input);
3431 }
3432 
3434 {
3435  return CNTV2DriverInterface::ReadRegister(kVRegInputSelect, outInputSelect);
3436 }
3437 
3438 #endif // R2_DEPRECATE
3439 
3440 
3441 NTV2VideoFormat CNTV2Card::GetInputVideoFormat (NTV2InputSource inSource, const bool inIsProgressivePicture)
3442 {
3443  switch (inSource)
3444  {
3445  case NTV2_INPUTSOURCE_SDI1: return GetSDIInputVideoFormat (NTV2_CHANNEL1, inIsProgressivePicture);
3446  case NTV2_INPUTSOURCE_SDI2: return GetSDIInputVideoFormat (NTV2_CHANNEL2, inIsProgressivePicture);
3447  case NTV2_INPUTSOURCE_SDI3: return GetSDIInputVideoFormat (NTV2_CHANNEL3, inIsProgressivePicture);
3448  case NTV2_INPUTSOURCE_SDI4: return GetSDIInputVideoFormat (NTV2_CHANNEL4, inIsProgressivePicture);
3449  case NTV2_INPUTSOURCE_SDI5: return GetSDIInputVideoFormat (NTV2_CHANNEL5, inIsProgressivePicture);
3450  case NTV2_INPUTSOURCE_SDI6: return GetSDIInputVideoFormat (NTV2_CHANNEL6, inIsProgressivePicture);
3451  case NTV2_INPUTSOURCE_SDI7: return GetSDIInputVideoFormat (NTV2_CHANNEL7, inIsProgressivePicture);
3452  case NTV2_INPUTSOURCE_SDI8: return GetSDIInputVideoFormat (NTV2_CHANNEL8, inIsProgressivePicture);
3453  case NTV2_INPUTSOURCE_HDMI1: return GetHDMIInputVideoFormat (NTV2_CHANNEL1);
3454  case NTV2_INPUTSOURCE_HDMI2: return GetHDMIInputVideoFormat (NTV2_CHANNEL2);
3455  case NTV2_INPUTSOURCE_HDMI3: return GetHDMIInputVideoFormat (NTV2_CHANNEL3);
3456  case NTV2_INPUTSOURCE_HDMI4: return GetHDMIInputVideoFormat (NTV2_CHANNEL4);
3457  case NTV2_INPUTSOURCE_ANALOG1: return GetAnalogInputVideoFormat ();
3458  default: return NTV2_FORMAT_UNKNOWN;
3459  }
3460 }
3461 
3462 NTV2VideoFormat CNTV2Card::GetSDIInputVideoFormat (NTV2Channel inChannel, bool inIsProgressivePicture)
3463 {
3464  ULWord vpidDS1(0), vpidDS2(0);
3465  CNTV2VPID inputVPID;
3466  if (IS_CHANNEL_INVALID(inChannel))
3467  return NTV2_FORMAT_UNKNOWN;
3468 
3469  bool isValidVPID (GetVPIDValidA(inChannel));
3470  if (isValidVPID)
3471  {
3472  ReadSDIInVPID(inChannel, vpidDS1, vpidDS2);
3473  inputVPID.SetVPID(vpidDS1);
3474  isValidVPID = inputVPID.IsValid();
3475  }
3476 
3477  NTV2FrameRate inputRate(GetSDIInputRate(inChannel));
3478  NTV2FrameGeometry inputGeometry(GetSDIInputGeometry(inChannel));
3479  bool isProgressiveTrans (isValidVPID ? inputVPID.GetProgressiveTransport() : GetSDIInputIsProgressive(inChannel));
3480  bool isProgressivePic (isValidVPID ? inputVPID.GetProgressivePicture() : inIsProgressivePicture);
3481  bool isInput3G (false);
3482 
3483  // A valid VPID fully describes the format on its own -- prefer it, and return
3484  // before the relatively expensive widget-capability lookup below. Some devices
3485  // (e.g. Corvid 88) publish VPID but leave the legacy per-input rate and geometry
3486  // fields of kRegInputStatus/kRegInputStatus2/kRegInput56Status/kRegInput78Status
3487  // at zero, so gating on the frame rate alone would discard a perfectly good VPID.
3488  if (isValidVPID)
3489  {
3490  const NTV2VideoFormat vpidFormat (inputVPID.GetVideoFormat());
3491  if (vpidFormat != NTV2_FORMAT_UNKNOWN)
3492  return vpidFormat;
3493  }
3494  if (inputRate == NTV2_FRAMERATE_INVALID)
3495  return NTV2_FORMAT_UNKNOWN;
3496 
3497  const ULWordSet wgtIDs (GetSupportedItems(kNTV2EnumsID_WidgetID));
3498  const bool canDo292In (wgtIDs.find(CNTV2SignalRouter::WidgetIDFromTypeAndChannel(NTV2WidgetType_SDIIn, inChannel)) != wgtIDs.end());
3499  const bool canDo3GIn (wgtIDs.find(CNTV2SignalRouter::WidgetIDFromTypeAndChannel(NTV2WidgetType_SDIIn3G, inChannel)) != wgtIDs.end());
3500  const bool canDo12GIn (wgtIDs.find(CNTV2SignalRouter::WidgetIDFromTypeAndChannel(NTV2WidgetType_SDIIn12G, inChannel)) != wgtIDs.end());
3501 
3502  if (canDo3GIn || canDo12GIn)
3503  {
3504  GetSDIInput3GPresent(isInput3G, inChannel);
3505  NTV2VideoFormat format = isValidVPID ? inputVPID.GetVideoFormat() : GetNTV2VideoFormat(inputRate, inputGeometry, isProgressiveTrans, isInput3G, isProgressivePic);
3506  if (isValidVPID && format == NTV2_FORMAT_UNKNOWN)
3507  {
3508  // Something might be incorrect in VPID
3509  isProgressiveTrans = GetSDIInputIsProgressive(inChannel);
3510  isProgressivePic = inIsProgressivePicture;
3511  format = GetNTV2VideoFormat(inputRate, inputGeometry, isProgressiveTrans, isInput3G, isProgressivePic);
3512  }
3513  if (canDo12GIn && format != NTV2_FORMAT_UNKNOWN && !isValidVPID)
3514  {
3515  bool is6G(false), is12G(false);
3516  GetSDIInput6GPresent(is6G, inChannel);
3517  GetSDIInput12GPresent(is12G, inChannel);
3518  if (is6G || is12G)
3519  {
3520  format = GetQuadSizedVideoFormat(format, !IsSupported(kDeviceCanDo12gRouting) ? true : false);
3521  }
3522  if (inputVPID.IsStandardMultiLink4320())
3523  {
3524  format = GetQuadSizedVideoFormat(format, true);
3525  }
3526  }
3527  return format;
3528  }
3529 
3530  if (canDo292In)
3531  {
3532  if (_boardID == DEVICE_ID_KONALHI || _boardID == DEVICE_ID_KONALHIDVI)
3533  {
3534  GetSDIInput3GPresent(isInput3G, NTV2_CHANNEL1);
3535  }
3536  return GetNTV2VideoFormat(inputRate, inputGeometry, isProgressiveTrans, isInput3G, isProgressivePic);
3537  }
3538 
3539  return NTV2_FORMAT_UNKNOWN;
3540 }
3541 
3542 
3544 {
3546  ULWord status;
3547  if (GetHDMIInputStatus(status, inChannel))
3548  {
3549  if ( (status & kRegMaskInputStatusLock) != 0 )
3550  {
3551  ULWord hdmiVersion = GetNumSupported(kDeviceGetHDMIVersion);
3552  if(hdmiVersion == 1)
3553  {
3554  ULWord standard = ((status & kRegMaskInputStatusStd) >> kRegShiftInputStatusStd);
3555  if(standard == 0x5) // NTV2_STANDARD_2K (2048x1556psf) in HDMI is really SXGA!!
3556  {
3557  // We return 1080p60 for SXGA format
3558  return NTV2_FORMAT_1080p_6000_A;
3559  }
3560  else
3561  {
3562  format = GetNTV2VideoFormat (NTV2FrameRate((status & kRegMaskInputStatusFPS) >> kRegShiftInputStatusFPS),
3564  false, // 3G
3565  0, // input geometry
3566  false); // progressive picture
3567  }
3568  }
3569  else if(hdmiVersion > 1)
3570  {
3571  bool squareDivision = hdmiVersion == 5 ? false : true;
3574  UByte inputGeometry = 0;
3575  if (hdmiStandard == NTV2_STANDARD_2Kx1080i || hdmiStandard == NTV2_STANDARD_2Kx1080p)
3576  inputGeometry = 8;
3577  format = GetNTV2VideoFormat (hdmiRate, hdmiStandard, false, inputGeometry, false, squareDivision);
3578  }
3579  }
3580  }
3581  return format;
3582 }
3583 
3585 {
3587  ULWord status;
3588  if (ReadRegister(kRegAnalogInputStatus, status))
3589  {
3590  if ( (status & kRegMaskInputStatusLock) != 0 )
3591  format = GetNTV2VideoFormat ( NTV2FrameRate((status & kRegMaskInputStatusFPS) >> kRegShiftInputStatusFPS),
3593  false, // 3G
3594  0, // input geometry
3595  false); // progressive picture
3596  }
3597  return format;
3598 }
3599 
3601 {
3603  ULWord analogDetect(0);
3604  // Use a single (atomic) read... so we don't return a bogus value if the register is changing while we're in here!
3605  if (ReadRegister(kRegAnalogInputStatus, analogDetect))
3606  {
3607  const ULWord locked ((analogDetect & kRegMaskAnalogCompositeLocked) >> kRegShiftAnalogCompositeLocked);
3608  if (locked)
3609  {
3611  // Validate NTSC/PAL reading with Frame Rate Family
3612  const ULWord integerRate ((analogDetect & kRegMaskAnalogInputIntegerRate) >> kRegShiftAnalogInputIntegerRate);
3613  if (Pal)
3614  {
3615  if (integerRate)
3616  format = NTV2_FORMAT_625_5000;
3617  else
3618  format = NTV2_FORMAT_UNKNOWN; // illegal combination - 625/59.94
3619  }
3620  else
3621  {
3622  if (integerRate)
3623  format = NTV2_FORMAT_UNKNOWN; // illegal combination - 525/60
3624  else
3625  format = NTV2_FORMAT_525_5994;
3626  }
3627  }
3628  }
3629  return format;
3630 }
3631 
3632 
3634 {
3635  ULWord status(0);
3636  if (!ReadRegister(kRegInputStatus, status))
3637  return NTV2_FORMAT_UNKNOWN;
3638  return GetNTV2VideoFormat (NTV2FrameRate((status >> 16) & 0xF), // frame rate
3639  ((status >> 20) & 0x7), // input scan geometry
3640  (status & BIT_23) ? true : false, // progressive transport
3641  false, // 3G
3642  false); // progressive picture
3643 }
3644 
3646 {
3647  if (IS_CHANNEL_INVALID (channel))
3648  return NTV2_FRAMERATE_INVALID;
3649 
3650  ULWord rateLow (0), rateHigh (0);
3651  NTV2FrameRate currentRate (NTV2_FRAMERATE_INVALID);
3652  if (!ReadRegister(gChannelToSDIInputStatusRegNum[channel], rateLow,
3654  return NTV2_FRAMERATE_INVALID;
3655  if (!ReadRegister(gChannelToSDIInputStatusRegNum[channel], rateHigh,
3657  return NTV2_FRAMERATE_INVALID;
3658  currentRate = NTV2FrameRate(((rateHigh << 3) & BIT_3) | rateLow);
3659  return NTV2_IS_VALID_NTV2FrameRate(currentRate) ? currentRate : NTV2_FRAMERATE_INVALID;
3660 } // GetSDIInputRate
3661 
3663 {
3664  if (IS_CHANNEL_INVALID (channel))
3665  return NTV2_FG_INVALID;
3666 
3667  ULWord geometryLow (0), geometryHigh (0);
3668  NTV2FrameGeometry currentGeometry (NTV2_FG_INVALID);
3669  if (!ReadRegister(gChannelToSDIInputStatusRegNum[channel], geometryLow,
3671  return NTV2_FG_INVALID;
3672  if (!ReadRegister(gChannelToSDIInputStatusRegNum[channel], geometryHigh,
3674  return NTV2_FG_INVALID;
3675  currentGeometry = NTV2FrameGeometry(((geometryHigh << 3) & BIT_3) | geometryLow);
3676  return NTV2_IS_VALID_NTV2FrameGeometry(currentGeometry) ? currentGeometry : NTV2_FG_INVALID;
3677 } // GetSDIInputGeometry
3678 
3680 {
3681  if (IS_CHANNEL_INVALID (channel))
3682  return false;
3683 
3684  ULWord isProgressive = 0;
3685  ReadRegister(gChannelToSDIInputStatusRegNum[channel], isProgressive, gChannelToSDIInputProgressiveMask[channel], gChannelToSDIInputProgressiveShift[channel]);
3686  return isProgressive ? true : false;
3687 } // GetSDIInputIsProgressive
3688 
3689 bool CNTV2Card::GetSDIInput3GPresent (bool & outValue, const NTV2Channel channel)
3690 {
3691  if (IS_CHANNEL_INVALID (channel))
3692  return false;
3693 
3694  ULWord value (0);
3695  bool result (ReadRegister(gChannelToSDIInput3GStatusRegNum[channel], value, gChannelToSDIIn3GModeMask[channel], gChannelToSDIIn3GModeShift[channel]));
3696  outValue = static_cast <bool> (value);
3697  return result;
3698 
3699 } // GetSDIInput3GPresent
3700 
3701 bool CNTV2Card::GetSDIInput3GbPresent (bool & outValue, const NTV2Channel channel)
3702 {
3703  if (IS_CHANNEL_INVALID (channel))
3704  return false;
3705 
3706  ULWord value (0);
3707  bool result (ReadRegister(gChannelToSDIInput3GStatusRegNum[channel], value, gChannelToSDIIn3GbModeMask[channel], gChannelToSDIIn3GbModeShift[channel]));
3708  outValue = static_cast <bool> (value);
3709  return result;
3710 
3711 } // GetSDIInput3GPresent
3712 
3713 bool CNTV2Card::GetSDIInput6GPresent (bool & outValue, const NTV2Channel channel)
3714 {
3715  if (IS_CHANNEL_INVALID (channel))
3716  return false;
3717 
3718  ULWord value (0);
3719  bool result (ReadRegister (gChannelToSDIInput3GStatusRegNum[channel], value, gChannelToSDIIn6GModeMask[channel], gChannelToSDIIn6GModeShift[channel]));
3720  outValue = static_cast <bool> (value);
3721  return result;
3722 
3723 } // GetSDIInput3GPresent
3724 
3725 bool CNTV2Card::GetSDIInput12GPresent (bool & outValue, const NTV2Channel channel)
3726 {
3727  if (IS_CHANNEL_INVALID (channel))
3728  return false;
3729 
3730  ULWord value (0);
3731  bool result (ReadRegister(gChannelToSDIInput3GStatusRegNum[channel], value, gChannelToSDIIn12GModeMask[channel], gChannelToSDIIn12GModeShift[channel]));
3732  outValue = static_cast <bool> (value);
3733  return result;
3734 
3735 } // GetSDIInput3GPresent
3736 
3737 
3738 bool CNTV2Card::SetLTCInputEnable (bool inEnable)
3739 {
3740  if (GetDeviceID() == DEVICE_ID_CORVID24)
3741  inEnable = !inEnable; // Oops, Corvid24's LTCOnRefInSelect bit sense was flipped
3744 }
3745 
3746 bool CNTV2Card::GetLTCInputEnable (bool & outIsEnabled)
3747 {
3749  return false;
3750  if (GetDeviceID() == DEVICE_ID_CORVID24)
3751  outIsEnabled = !outIsEnabled; // Oops, Corvid24's LTCOnRefInSelect bit sense was flipped
3752  return true;
3753 }
3754 
3755 bool CNTV2Card::GetLTCInputPresent (bool & outIsPresent, const UWord inLTCInputNdx)
3756 {
3757  if (ULWord(inLTCInputNdx) >= GetNumSupported(kDeviceGetNumLTCInputs))
3758  return false; // No such LTC input
3759  if (inLTCInputNdx) // LTCIn2
3761  else // LTCIn1
3762  {
3764  if(outIsPresent)
3765  return true;
3767  }
3768 }
3769 
3770 #if !defined(NTV2_DEPRECATE_16_3)
3771  bool CNTV2Card::SetLTCEmbeddedOutEnable (const bool inEnable)
3772  {
3774  }
3775 
3776  bool CNTV2Card::GetLTCEmbeddedOutEnable (bool & outEnabled)
3777  {
3779  }
3780 #endif // !defined(NTV2_DEPRECATE_16_3)
3781 
3782 bool CNTV2Card::ReadAnalogLTCInput (const UWord inLTCInput, RP188_STRUCT & outRP188Data)
3783 {
3784  NTV2_RP188 result;
3785  if (!ReadAnalogLTCInput(inLTCInput, result))
3786  return false;
3787  outRP188Data = result;
3788  return true;
3789 }
3790 
3791 
3792 bool CNTV2Card::ReadAnalogLTCInput (const UWord inLTCInput, NTV2_RP188 & outRP188Data)
3793 {
3794  outRP188Data.Set();
3795  if (ULWord(inLTCInput) >= GetNumSupported(kDeviceGetNumLTCInputs))
3796  return false;
3797 
3798  const ULWord regLo (inLTCInput ? kRegLTC2AnalogBits0_31 : kRegLTCAnalogBits0_31 );
3799  const ULWord regHi (inLTCInput ? kRegLTC2AnalogBits32_63 : kRegLTCAnalogBits32_63);
3800  outRP188Data.fDBB = 0;
3801  return ReadRegister(regLo, outRP188Data.fLo) && ReadRegister(regHi, outRP188Data.fHi);
3802 }
3803 
3804 
3805 bool CNTV2Card::GetAnalogLTCInClockChannel (const UWord inLTCInput, NTV2Channel & outChannel)
3806 {
3807  if (ULWord(inLTCInput) >= GetNumSupported(kDeviceGetNumLTCInputs))
3808  return false;
3809 
3810  ULWord value(0);
3811  if (!ReadRegister (kRegLTCStatusControl, value, 0x7, inLTCInput ? 9 : 1)) // Bits 1|2|3 for LTCIn1, bits 9|10|11 for LTCIn2
3812  return false;
3813  outChannel = NTV2Channel(value + 1);
3814  return true;
3815 }
3816 
3817 
3818 bool CNTV2Card::SetAnalogLTCInClockChannel (const UWord inLTCInput, const NTV2Channel inChannel)
3819 {
3820  if (ULWord(inLTCInput) >= GetNumSupported(kDeviceGetNumLTCInputs))
3821  return false;
3822  if (IS_CHANNEL_INVALID(inChannel))
3823  return false;
3824  return WriteRegister (kRegLTCStatusControl, inChannel - 1, 0x7, inLTCInput ? 9 : 1); // Bits 1|2|3 for LTCIn1, bits 9|10|11 for LTCIn2
3825 }
3826 
3827 
3828 bool CNTV2Card::WriteAnalogLTCOutput (const UWord inLTCOutput, const RP188_STRUCT & inRP188Data)
3829 {
3830  const NTV2_RP188 rp188data(inRP188Data);
3831  return WriteAnalogLTCOutput (inLTCOutput, rp188data);
3832 }
3833 
3834 
3835 bool CNTV2Card::WriteAnalogLTCOutput (const UWord inLTCOutput, const NTV2_RP188 & inRP188Data)
3836 {
3837  if (ULWord(inLTCOutput) >= GetNumSupported(kDeviceGetNumLTCOutputs))
3838  return false;
3839 
3840  return WriteRegister (inLTCOutput == 0 ? kRegLTCAnalogBits0_31 : kRegLTC2AnalogBits0_31, inRP188Data.fLo)
3841  && WriteRegister (inLTCOutput == 0 ? kRegLTCAnalogBits32_63 : kRegLTC2AnalogBits32_63, inRP188Data.fHi);
3842 }
3843 
3844 
3845 bool CNTV2Card::GetAnalogLTCOutClockChannel (const UWord inLTCOutput, NTV2Channel & outChannel)
3846 {
3847  if (ULWord(inLTCOutput) >= GetNumSupported(kDeviceGetNumLTCOutputs))
3848  return false;
3849 
3850  ULWord value(0);
3851  bool isMultiFormat(false);
3852  if (!GetMultiFormatMode(isMultiFormat))
3853  return false;
3854  if (!isMultiFormat)
3855  return false;
3856  if (!ReadRegister(kRegLTCStatusControl, value, 0x7, inLTCOutput ? 20 : 16)) // Bits 16|17|18 for LTCOut1, bits 20|21|22 for LTCOut2
3857  return false;
3858  outChannel = NTV2Channel(value + 1);
3859  return true;
3860 }
3861 
3862 
3863 bool CNTV2Card::SetAnalogLTCOutClockChannel (const UWord inLTCOutput, const NTV2Channel inChannel)
3864 {
3865  if (ULWord(inLTCOutput) >= GetNumSupported(kDeviceGetNumLTCOutputs))
3866  return false;
3867  if (IS_CHANNEL_INVALID (inChannel))
3868  return false;
3869  bool isMultiFormat(false);
3870  if (!GetMultiFormatMode(isMultiFormat))
3871  return false;
3872  if (!isMultiFormat)
3873  return false;
3874  return WriteRegister (kRegLTCStatusControl, inChannel - 1, 0x7, inLTCOutput ? 20 : 16); // Bits 16|17|18 for LTCOut1, bits 20|21|22 for LTCOut2
3875 }
3876 
3877 
3882 
3883 bool CNTV2Card::SetSDITransmitEnable (const NTV2Channel inChannel, const bool inEnable)
3884 {
3885  if (IS_CHANNEL_INVALID(inChannel))
3886  return false; // bad channel
3887  if (!IsSupported(kDeviceHasBiDirectionalSDI))
3888  return true; // no bidirectional SDI, OK
3889  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumVideoOutputs))
3890  return false; // no such SDI connector
3891  const ULWord mask(sSDIXmitEnableMasks[inChannel]), shift(sSDIXmitEnableShifts[inChannel]);
3892  return WriteRegister(kRegSDITransmitControl, ULWord(inEnable), mask, shift);
3893 }
3894 
3895 bool CNTV2Card::SetSDITransmitEnable (const NTV2ChannelSet & inSDIConnectors, const bool inEnable)
3896 {
3897  UWord failures(0);
3898  for (NTV2ChannelSetConstIter it(inSDIConnectors.begin()); it != inSDIConnectors.end(); ++it)
3899  if (!SetSDITransmitEnable(*it, inEnable))
3900  failures++;
3901  return !failures;
3902 }
3903 
3904 bool CNTV2Card::GetSDITransmitEnable (const NTV2Channel inChannel, bool & outIsEnabled)
3905 {
3906  if (IS_CHANNEL_INVALID(inChannel))
3907  return false; // invalid channel
3908  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumVideoOutputs))
3909  return false; // no such SDI connector
3910  if (!IsSupported(kDeviceHasBiDirectionalSDI))
3911  {outIsEnabled = true; return true;} // no bidirectional SDI, enabled, OK
3912  const ULWord mask(sSDIXmitEnableMasks[inChannel]), shift(sSDIXmitEnableShifts[inChannel]);
3913  return CNTV2DriverInterface::ReadRegister (kRegSDITransmitControl, outIsEnabled, mask, shift);
3914 }
3915 
3917 {
3918  outXmitSDIs.clear();
3919  const bool biDirectionalSDI (IsSupported(kDeviceHasBiDirectionalSDI));
3920  const NTV2Channel maxCh(NTV2Channel(GetNumSupported(kDeviceGetNumVideoOutputs)));
3921  bool isXmit(false);
3922  for (NTV2Channel ch(NTV2_CHANNEL1); ch < maxCh; ch = NTV2Channel(ch+1))
3923  if (!biDirectionalSDI || (GetSDITransmitEnable(ch, isXmit) && isXmit))
3924  outXmitSDIs.insert(ch);
3925  return true;
3926 }
3927 
3928 
3929 bool CNTV2Card::SetSDIOut2Kx1080Enable (NTV2Channel inChannel, const bool inIsEnabled)
3930 {
3931  if (IS_CHANNEL_INVALID (inChannel))
3932  return false;
3933  return WriteRegister (gChannelToSDIOutControlRegNum[inChannel], inIsEnabled, kK2RegMaskSDI1Out_2Kx1080Mode, kK2RegShiftSDI1Out_2Kx1080Mode);
3934 }
3935 
3936 bool CNTV2Card::GetSDIOut2Kx1080Enable(NTV2Channel inChannel, bool & outIsEnabled)
3937 {
3938  if (IS_CHANNEL_INVALID (inChannel))
3939  return false;
3941 }
3942 
3943 bool CNTV2Card::SetSDIOut3GEnable (const NTV2Channel inChannel, const bool inEnable)
3944 {
3945  if (IS_CHANNEL_INVALID(inChannel))
3946  return false;
3947  return WriteRegister (gChannelToSDIOutControlRegNum[inChannel], inEnable, kLHIRegMaskSDIOut3GbpsMode, kLHIRegShiftSDIOut3GbpsMode);
3948 }
3949 
3950 bool CNTV2Card::GetSDIOut3GEnable (const NTV2Channel inChannel, bool & outIsEnabled)
3951 {
3952  if (IS_CHANNEL_INVALID(inChannel))
3953  return false;
3955 }
3956 
3957 
3958 bool CNTV2Card::SetSDIOut3GbEnable (const NTV2Channel inChannel, const bool inEnable)
3959 {
3960  if (IS_CHANNEL_INVALID(inChannel))
3961  return false;
3963 }
3964 
3965 bool CNTV2Card::GetSDIOut3GbEnable (const NTV2Channel inChannel, bool & outIsEnabled)
3966 {
3967  if (IS_CHANNEL_INVALID(inChannel))
3968  return false;
3970 }
3971 
3972 bool CNTV2Card::SetSDIOut6GEnable (const NTV2Channel inChannel, const bool inEnable)
3973 {
3974  if (IS_CHANNEL_INVALID(inChannel))
3975  return false;
3976  const NTV2Channel channel (IsSupported(kDeviceCanDo12gRouting) ? inChannel : NTV2_CHANNEL3);
3977  if (inEnable)
3979  return WriteRegister(gChannelToSDIOutControlRegNum[channel], inEnable, kRegMaskSDIOut6GbpsMode, kRegShiftSDIOut6GbpsMode);
3980 }
3981 
3982 bool CNTV2Card::GetSDIOut6GEnable (const NTV2Channel inChannel, bool & outIsEnabled)
3983 {
3984  if (IS_CHANNEL_INVALID(inChannel))
3985  return false;
3986  bool is6G(false), is12G(false);
3987  NTV2Channel channel (IsSupported(kDeviceCanDo12gRouting) ? inChannel : NTV2_CHANNEL3);
3990  if (is6G && !is12G)
3991  outIsEnabled = true;
3992  else
3993  outIsEnabled = false;
3994  return result;
3995 }
3996 
3997 bool CNTV2Card::SetSDIOut12GEnable (const NTV2Channel inChannel, const bool inEnable)
3998 {
3999  if (IS_CHANNEL_INVALID(inChannel))
4000  return false;
4001  NTV2Channel channel (IsSupported(kDeviceCanDo12gRouting) ? inChannel : NTV2_CHANNEL3);
4002  if (inEnable)
4004  return WriteRegister(gChannelToSDIOutControlRegNum[channel], inEnable, kRegMaskSDIOut12GbpsMode, kRegShiftSDIOut12GbpsMode);
4005 }
4006 
4007 bool CNTV2Card::GetSDIOut12GEnable(const NTV2Channel inChannel, bool & outIsEnabled)
4008 {
4009  if (IS_CHANNEL_INVALID(inChannel))
4010  return false;
4011  NTV2Channel channel (IsSupported(kDeviceCanDo12gRouting) ? inChannel : NTV2_CHANNEL3);
4013 }
4014 
4015 
4016 bool CNTV2Card::GetSDIOutputAudioSystem (const NTV2Channel inChannel, NTV2AudioSystem & outAudioSystem)
4017 {
4018  outAudioSystem = NTV2_AUDIOSYSTEM_INVALID;
4019  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumVideoOutputs))
4020  return false; // illegal channel
4021 
4022  ULWord readVal;
4023  const ULWord regNum (gChannelToSDIOutControlRegNum[inChannel]);
4024  if (!ReadRegister (regNum, readVal, kK2RegMaskSDIOutDS1AudioSelect, kK2RegShiftSDIOutDS1AudioSelect))
4025  return false;
4026 
4027  readVal <<= kK2RegShiftSDIOutDS1AudioSelect;
4028  ULWord b2 = (readVal & kK2RegMaskSDIOutDS1Audio_Bit2) ? 1 : 0;
4029  ULWord b1 = (readVal & kK2RegMaskSDIOutDS1Audio_Bit1) ? 1 : 0;
4030  ULWord b0 = (readVal & kK2RegMaskSDIOutDS1Audio_Bit0) ? 1 : 0;
4031 
4032  outAudioSystem = NTV2AudioSystem(b2 * 4 + b1 * 2 + b0);
4033  return true;
4034 
4035 } // GetSDIOutputAudioSystem
4036 
4037 
4038 bool CNTV2Card::SetSDIOutputAudioSystem (const NTV2Channel inChannel, const NTV2AudioSystem inAudioSystem)
4039 {
4040 
4041  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumVideoOutputs))
4042  return false; // Invalid channel
4043  if (ULWord(inAudioSystem) >= GetNumSupported(kDeviceGetTotalNumAudioSystems))
4044  return false; // Invalid audio system
4045 
4046  // shift each bit from it's position in inAudioSystem to it's position in the register
4047  // bit 18 (MSB), bit 28, bit 30 (LSB)
4048  ULWord b2 = (inAudioSystem << 16) & kK2RegMaskSDIOutDS1Audio_Bit2;
4049  ULWord b1 = (inAudioSystem << 27) & kK2RegMaskSDIOutDS1Audio_Bit1;
4050  ULWord b0 = (inAudioSystem << 30) & kK2RegMaskSDIOutDS1Audio_Bit0;
4051 
4052  return WriteRegister (gChannelToSDIOutControlRegNum [inChannel], (b2 | b1 | b0) >> kK2RegShiftSDIOutDS1AudioSelect ,
4054 
4055 } // SetSDIOutputAudioSystem
4056 
4057 
4058 bool CNTV2Card::SetSDIOutputAudioSystem (const NTV2ChannelSet & inSDIOutputs, const NTV2AudioSystem inAudioSystem, const bool inDS2)
4059 {
4060  size_t numFailures(0);
4061  for (NTV2ChannelSet::const_iterator it(inSDIOutputs.begin()); it != inSDIOutputs.end(); ++it)
4062  if (!(inDS2 ? SetSDIOutputDS2AudioSystem(*it, inAudioSystem) : SetSDIOutputAudioSystem(*it, inAudioSystem)))
4063  numFailures++;
4064  return numFailures == 0;
4065 }
4066 
4067 
4069 {
4070  outAudioSystem = NTV2_AUDIOSYSTEM_INVALID;
4071  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumVideoOutputs))
4072  return false; // illegal channel
4073 
4074  ULWord readVal;
4075  const ULWord regNum (gChannelToSDIOutControlRegNum[inChannel]);
4076  if (!ReadRegister (regNum, readVal, kK2RegMaskSDIOutDS2AudioSelect, kK2RegShiftSDIOutDS2AudioSelect))
4077  return false;
4078 
4079  readVal <<= kK2RegShiftSDIOutDS2AudioSelect;
4080  ULWord b2 = (readVal & kK2RegMaskSDIOutDS2Audio_Bit2) ? 1 : 0;
4081  ULWord b1 = (readVal & kK2RegMaskSDIOutDS2Audio_Bit1) ? 1 : 0;
4082  ULWord b0 = (readVal & kK2RegMaskSDIOutDS2Audio_Bit0) ? 1 : 0;
4083 
4084  outAudioSystem = NTV2AudioSystem(b2 * 4 + b1 * 2 + b0);
4085  return true;
4086 
4087 } // GetSDIOutputDS2AudioSystem
4088 
4089 
4090 bool CNTV2Card::SetSDIOutputDS2AudioSystem (const NTV2Channel inChannel, const NTV2AudioSystem inAudioSystem)
4091 {
4092  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumVideoOutputs))
4093  return false; // Invalid channel
4094  if (ULWord(inAudioSystem) >= GetNumSupported(kDeviceGetTotalNumAudioSystems))
4095  return false; // Invalid audio system
4096 
4097  // shift each bit from it's position in inAudioSystem to it's position in the register
4098  // bit 19 (MSB), bit 29, bit 31 (LSB)
4099  ULWord b2 = (inAudioSystem << 17) & kK2RegMaskSDIOutDS2Audio_Bit2;
4100  ULWord b1 = (inAudioSystem << 28) & kK2RegMaskSDIOutDS2Audio_Bit1;
4101  ULWord b0 = (inAudioSystem << 31) & kK2RegMaskSDIOutDS2Audio_Bit0;
4102 
4103  return WriteRegister (gChannelToSDIOutControlRegNum [inChannel], (b2 | b1 | b0) >> kK2RegShiftSDIOutDS2AudioSelect ,
4105 
4106 } // SetSDIOutputDS2AudioSystem
4107 
4108 
4109 // SDI bypass relay control
4110 static bool WriteWatchdogControlBit (CNTV2Card & card, const ULWord inValue, const ULWord inMask, const ULWord inShift)
4111 {
4112  if (!card.KickSDIWatchdog())
4113  return false;
4114  return card.WriteRegister (kRegSDIWatchdogControlStatus, inValue, inMask, inShift);
4115 }
4116 
4117 
4119 {
4120  if (!IsSupported(kDeviceHasSDIRelays))
4121  return false;
4122  // Write 0x01234567 into Kick2 register to begin watchdog reset, then in < 30 msec,
4123  // write 0xA5A55A5A into Kick1 register to complete the reset...
4124  const bool status (WriteRegister(kRegSDIWatchdogKick2, 0x01234567));
4125  return status && WriteRegister(kRegSDIWatchdogKick1, 0xA5A55A5A);
4126 }
4127 
4129 {
4130  outValue = NTV2_RELAY_STATE_INVALID;
4131  if (!IsSupported(kDeviceHasSDIRelays))
4132  return false;
4133  ULWord statusBit(0);
4135  return false;
4136  outValue = statusBit ? NTV2_THROUGH_DEVICE : NTV2_DEVICE_BYPASSED;
4137  return true;
4138 }
4139 
4140 bool CNTV2Card::GetSDIRelayPosition (NTV2RelayState & outValue, const UWord inIndex0)
4141 {
4142  ULWord statusBit(0);
4143  outValue = NTV2_RELAY_STATE_INVALID;
4144  if (!IsSupported(kDeviceHasSDIRelays))
4145  return false;
4146  if (inIndex0 > 1)
4147  return false;
4148  if (!ReadRegister (kRegSDIWatchdogControlStatus, statusBit,
4151  return false;
4152  outValue = statusBit ? NTV2_THROUGH_DEVICE : NTV2_DEVICE_BYPASSED;
4153  return true;
4154 }
4155 
4157 {
4158  ULWord statusBit(0);
4159  outValue = NTV2_RELAY_STATE_INVALID;
4160  if (!IsSupported(kDeviceHasSDIRelays))
4161  return false;
4162  if (inIndex0 > 1)
4163  return false;
4164  if (!ReadRegister (kRegSDIWatchdogControlStatus, statusBit,
4167  return false;
4168  outValue = statusBit ? NTV2_THROUGH_DEVICE : NTV2_DEVICE_BYPASSED;
4169  return true;
4170 }
4171 
4172 bool CNTV2Card::SetSDIRelayManualControl (const NTV2RelayState inValue, const UWord inIndex0)
4173 {
4174  const ULWord statusBit ((inValue == NTV2_THROUGH_DEVICE) ? 1 : 0);
4175  if (!IsSupported(kDeviceHasSDIRelays))
4176  return false;
4177  if (inIndex0 > 1)
4178  return false;
4179  return WriteWatchdogControlBit (*this, statusBit,
4182 }
4183 
4184 bool CNTV2Card::GetSDIWatchdogEnable (bool & outValue, const UWord inIndex0)
4185 {
4186  ULWord statusBit(0);
4187  outValue = false;
4188  if (!IsSupported(kDeviceHasSDIRelays))
4189  return false;
4190  if (inIndex0 > 1)
4191  return false;
4192  if (!ReadRegister (kRegSDIWatchdogControlStatus, statusBit,
4195  return false;
4196  outValue = statusBit ? true : false;
4197  return true;
4198 }
4199 
4200 bool CNTV2Card::SetSDIWatchdogEnable (const bool inValue, const UWord inIndex0)
4201 {
4202  const ULWord statusBit ((inValue == NTV2_THROUGH_DEVICE) ? 1 : 0);
4203  if (!IsSupported(kDeviceHasSDIRelays))
4204  return false;
4205  if (inIndex0 > 1)
4206  return false;
4207  return WriteWatchdogControlBit (*this, statusBit,
4210 }
4211 
4213 {
4214  outValue = 0;
4215  if (!IsSupported(kDeviceHasSDIRelays))
4216  return false;
4217  return ReadRegister (kRegSDIWatchdogTimeout, outValue);
4218 }
4219 
4221 {
4222  return KickSDIWatchdog() && WriteRegister (kRegSDIWatchdogTimeout, inValue);
4223 }
4224 
4226 {
4227  return WriteRegister(kRegDC1, enable, kRegMask4KDCRGBMode, kRegShift4KDCRGBMode);
4228 }
4229 
4230 bool CNTV2Card::GetEnable4KDCRGBMode(bool & outIsEnabled)
4231 {
4232  ULWord tempVal (0);
4233  const bool retVal (ReadRegister (kRegDC1, tempVal, kRegMask4KDCRGBMode, kRegShift4KDCRGBMode));
4234  outIsEnabled = static_cast <bool> (tempVal);
4235  return retVal;
4236 }
4237 
4239 {
4240  return WriteRegister(kRegDC1, enable, kRegMask4KDCYCC444Mode, kRegShift4KDCYCC444Mode);
4241 }
4242 
4243 bool CNTV2Card::GetEnable4KDCYCC444Mode(bool & outIsEnabled)
4244 {
4245  ULWord tempVal (0);
4246  const bool retVal (ReadRegister (kRegDC1, tempVal, kRegMask4KDCYCC444Mode, kRegShift4KDCYCC444Mode));
4247  outIsEnabled = static_cast <bool> (tempVal);
4248  return retVal;
4249 }
4250 
4252 {
4253  return WriteRegister(kRegDC1, enable, kRegMask4KDCPSFInMode, kRegShift4KDCPSFInMode);
4254 }
4255 
4256 bool CNTV2Card::GetEnable4KDCPSFInMode(bool & outIsEnabled)
4257 {
4258  ULWord tempVal (0);
4259  const bool retVal (ReadRegister (kRegDC1, tempVal, kRegMask4KDCPSFInMode, kRegShift4KDCPSFInMode));
4260  outIsEnabled = static_cast <bool> (tempVal);
4261  return retVal;
4262 }
4263 
4265 {
4266  return WriteRegister(kRegDC1, enable, kRegMask4KDCPSFOutMode, kRegShift4KDCPSFOutMode);
4267 }
4268 
4269 bool CNTV2Card::GetEnable4KPSFOutMode(bool & outIsEnabled)
4270 {
4271  ULWord tempVal (0);
4272  const bool retVal (ReadRegister (kRegDC1, tempVal, kRegMask4KDCPSFOutMode, kRegShift4KDCPSFOutMode));
4273  outIsEnabled = static_cast <bool> (tempVal);
4274  return retVal;
4275 }
4276 
4277 
4279 {
4280  if (!IsSupported(kDeviceCanDoSDIErrorChecks))
4281  return 0;
4282  if (IS_CHANNEL_INVALID(inChannel))
4283  return 0;
4284  ULWord value(0);
4286  return value ? true : false;
4287 }
4288 
4289 bool CNTV2Card::GetSDILock (const NTV2Channel inChannel)
4290 {
4291  if (!IsSupported(kDeviceCanDoSDIErrorChecks))
4292  return 0;
4293  if (IS_CHANNEL_INVALID(inChannel))
4294  return 0;
4295  ULWord value(0);
4296  ReadRegister(gChannelToRXSDIStatusRegs[inChannel], value, kRegMaskSDIInLocked, kRegShiftSDIInLocked);
4297  return value ? true : false;
4298 }
4299 
4301 {
4302  if (!IsSupported(kDeviceCanDoSDIErrorChecks))
4303  return 0;
4304  if (IS_CHANNEL_INVALID(inChannel))
4305  return 0;
4306  ULWord value(0);
4308  return value;
4309 }
4310 
4312 {
4313  if (!IsSupported(kDeviceCanDoSDIErrorChecks))
4314  return 0;
4315  if (IS_CHANNEL_INVALID(inChannel))
4316  return 0;
4317  ULWord value(0);
4319  return value;
4320 }
4321 
4323 {
4324  if (!IsSupported(kDeviceCanDoSDIErrorChecks))
4325  return 0;
4326  if (IS_CHANNEL_INVALID(inChannel))
4327  return 0;
4328  ULWord value(0);
4330  return value;
4331 }
4332 
4333 bool CNTV2Card::SetSDIInLevelBtoLevelAConversion (const UWord inInputSpigot, const bool inEnable)
4334 {
4335  if (!IsSupported(kDeviceCanDo3GLevelConversion))
4336  return false;
4337  if (IS_INPUT_SPIGOT_INVALID (inInputSpigot))
4338  return false;
4339 
4340  ULWord regNum, mask, shift;
4341  switch (inInputSpigot)
4342  {
4351  default: return false;
4352  }
4353  return WriteRegister(regNum, inEnable, mask, shift);
4354 }
4355 
4356 bool CNTV2Card::SetSDIInLevelBtoLevelAConversion (const NTV2ChannelSet & inSDIInputs, const bool inEnable)
4357 {
4358  size_t errors(0);
4359  for (NTV2ChannelSetConstIter it(inSDIInputs.begin()); it != inSDIInputs.end(); ++it)
4360  if (!SetSDIInLevelBtoLevelAConversion(*it, inEnable))
4361  errors++;
4362  return !errors;
4363 }
4364 
4365 bool CNTV2Card::GetSDIInLevelBtoLevelAConversion (const UWord inInputSpigot, bool & outEnabled)
4366 {
4367  if (!IsSupported(kDeviceCanDo3GLevelConversion))
4368  return false;
4369  if (IS_INPUT_SPIGOT_INVALID (inInputSpigot))
4370  return false;
4371 
4372  ULWord regNum, mask, shift;
4373  switch (inInputSpigot)
4374  {
4383  default: return false;
4384  }
4385  return CNTV2DriverInterface::ReadRegister (regNum, outEnabled, mask, shift);
4386 }
4387 
4388 bool CNTV2Card::SetSDIOutLevelAtoLevelBConversion (const UWord inOutputSpigot, const bool inEnable)
4389 {
4390  if (!IsSupported(kDeviceCanDo3GLevelConversion))
4391  return false;
4392  if (IS_OUTPUT_SPIGOT_INVALID(inOutputSpigot))
4393  return false;
4394 
4395  return WriteRegister(gChannelToSDIOutControlRegNum[inOutputSpigot], inEnable, kRegMaskSDIOutLevelAtoLevelB, kRegShiftSDIOutLevelAtoLevelB);
4396 }
4397 
4398 bool CNTV2Card::SetSDIOutLevelAtoLevelBConversion (const NTV2ChannelSet & inSDIOutputs, const bool inEnable)
4399 {
4400  size_t errors(0);
4401  for (NTV2ChannelSetConstIter it(inSDIOutputs.begin()); it != inSDIOutputs.end(); ++it)
4402  if (!SetSDIOutLevelAtoLevelBConversion(*it, inEnable))
4403  errors++;
4404  return !errors;
4405 }
4406 
4407 bool CNTV2Card::GetSDIOutLevelAtoLevelBConversion (const UWord inOutputSpigot, bool & outEnable)
4408 {
4409  if (!IsSupported(kDeviceCanDo3GLevelConversion))
4410  return false;
4411  if (IS_OUTPUT_SPIGOT_INVALID (inOutputSpigot))
4412  return false;
4413 
4414  ULWord tempVal (0);
4415  const bool retVal (ReadRegister (gChannelToSDIOutControlRegNum[inOutputSpigot], tempVal, kRegMaskSDIOutLevelAtoLevelB, kRegShiftSDIOutLevelAtoLevelB));
4416  outEnable = static_cast <bool> (tempVal);
4417  return retVal;
4418 }
4419 
4420 bool CNTV2Card::SetSDIOutRGBLevelAConversion(const UWord inOutputSpigot, const bool inEnable)
4421 {
4422  if (!IsSupported(kDeviceCanDoRGBLevelAConversion))
4423  return false;
4424  if (IS_OUTPUT_SPIGOT_INVALID (inOutputSpigot))
4425  return false;
4426 
4427  return WriteRegister(gChannelToSDIOutControlRegNum[inOutputSpigot], inEnable, kRegMaskRGBLevelA, kRegShiftRGBLevelA);
4428 }
4429 
4430 bool CNTV2Card::SetSDIOutRGBLevelAConversion (const NTV2ChannelSet & inSDIOutputs, const bool inEnable)
4431 {
4432  size_t errors(0);
4433  for (NTV2ChannelSetConstIter it(inSDIOutputs.begin()); it != inSDIOutputs.end(); ++it)
4434  if (!SetSDIOutRGBLevelAConversion(*it, inEnable))
4435  errors++;
4436  return !errors;
4437 }
4438 
4439 bool CNTV2Card::GetSDIOutRGBLevelAConversion(const UWord inOutputSpigot, bool & outEnable)
4440 {
4441  if (!IsSupported(kDeviceCanDoRGBLevelAConversion))
4442  return false;
4443  if (IS_OUTPUT_SPIGOT_INVALID (inOutputSpigot))
4444  return false;
4445 
4446  ULWord tempVal(0);
4447  const bool retVal(ReadRegister(gChannelToSDIOutControlRegNum[inOutputSpigot], tempVal, kRegMaskRGBLevelA, kRegShiftRGBLevelA));
4448  outEnable = static_cast <bool> (tempVal);
4449  return retVal;
4450 }
4451 
4452 bool CNTV2Card::SetMultiFormatMode (const bool inEnable)
4453 {
4454  if (!IsSupported(kDeviceCanDoMultiFormat))
4455  return false;
4456 
4457  return WriteRegister (kRegGlobalControl2, inEnable ? 1 : 0, kRegMaskIndependentMode, kRegShiftIndependentMode);
4458 }
4459 
4460 bool CNTV2Card::GetMultiFormatMode (bool & outEnabled)
4461 {
4462  return IsSupported(kDeviceCanDoMultiFormat)
4464  : false;
4465 }
4466 
4467 bool CNTV2Card::SetRS422Parity (const NTV2Channel inChannel, const NTV2_RS422_PARITY inParity)
4468 {
4469  if (!IsSupported(kDeviceCanDoProgrammableRS422))
4470  return false; // Non-programmable RS422
4471  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumSerialPorts))
4472  return false;
4473  if (inParity == NTV2_RS422_NO_PARITY)
4474  {
4476  }
4477  else
4478  {
4479  ULWord tempVal (0);
4480  if (!ReadRegister (gChannelToRS422ControlRegNum[inChannel], tempVal))
4481  return false;
4482 
4483  tempVal &= ~kRegMaskRS422ParityDisable;
4484  switch (inParity)
4485  {
4486  case NTV2_RS422_ODD_PARITY: tempVal &= ~kRegMaskRS422ParitySense; break;
4487  case NTV2_RS422_EVEN_PARITY: tempVal |= kRegMaskRS422ParitySense; break;
4488 
4490  default: return false;
4491  }
4492 
4493  return WriteRegister (gChannelToRS422ControlRegNum [inChannel], tempVal);
4494  }
4495 }
4496 
4497 bool CNTV2Card::GetRS422Parity (const NTV2Channel inChannel, NTV2_RS422_PARITY & outParity)
4498 {
4499  outParity = NTV2_RS422_PARITY_INVALID;
4500  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumSerialPorts))
4501  return false;
4502 
4503  ULWord tempVal (0);
4504  if (IsSupported(kDeviceCanDoProgrammableRS422)) // Read register only if programmable RS422
4505  if (!ReadRegister (gChannelToRS422ControlRegNum[inChannel], tempVal))
4506  return false;
4507 
4508  if (tempVal & kRegMaskRS422ParityDisable)
4509  outParity = NTV2_RS422_NO_PARITY;
4510  else if (tempVal & kRegMaskRS422ParitySense)
4511  outParity = NTV2_RS422_EVEN_PARITY;
4512  else
4513  outParity = NTV2_RS422_ODD_PARITY; // Default
4514 
4515  return true;
4516 }
4517 
4518 bool CNTV2Card::SetRS422BaudRate (const NTV2Channel inChannel, const NTV2_RS422_BAUD_RATE inBaudRate)
4519 {
4520  if (!IsSupported(kDeviceCanDoProgrammableRS422))
4521  return false; // Non-programmable RS422
4522  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumSerialPorts))
4523  return false; // No such serial port
4524 
4525  ULWord tempVal (0);
4526  switch (inBaudRate)
4527  {
4528  case NTV2_RS422_BAUD_RATE_38400: tempVal = 0; break;
4529  case NTV2_RS422_BAUD_RATE_19200: tempVal = 1; break;
4530  case NTV2_RS422_BAUD_RATE_9600: tempVal = 2; break;
4532  #if !defined(_DEBUG)
4533  default:
4534  #endif
4535  return false;
4536  }
4537  return WriteRegister (gChannelToRS422ControlRegNum [inChannel], tempVal, kRegMaskRS422BaudRate, kRegShiftRS422BaudRate);
4538 }
4539 
4540 bool CNTV2Card::GetRS422BaudRate (const NTV2Channel inChannel, NTV2_RS422_BAUD_RATE & outBaudRate)
4541 {
4542  outBaudRate = NTV2_RS422_BAUD_RATE_INVALID;
4543  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumSerialPorts))
4544  return false; // No such serial port
4545 
4546  ULWord tempVal (0); // Default to 38400
4547  if (IsSupported(kDeviceCanDoProgrammableRS422)) // Read register only if programmable RS422
4548  if (!ReadRegister (gChannelToRS422ControlRegNum[inChannel], tempVal, kRegMaskRS422BaudRate, kRegShiftRS422BaudRate))
4549  return false; // ReadRegister failed
4550 
4551  switch (tempVal)
4552  {
4553  case 0: outBaudRate = NTV2_RS422_BAUD_RATE_38400; break;
4554  case 1: outBaudRate = NTV2_RS422_BAUD_RATE_19200; break;
4555  case 2: outBaudRate = NTV2_RS422_BAUD_RATE_9600; break;
4556  default: return false;
4557  }
4558  return true;
4559 }
4560 
4562 {
4563  ULWord val = 0;
4564  ReadRegister(kVRegMailBoxAcquire, val);
4565  return val;
4566 }
4567 
4569 {
4570  ULWord val = 0;
4571  ReadRegister(kVRegMailBoxRelease, val);
4572  return val;
4573 }
4574 
4576 {
4577  ULWord val = 0;
4578  ReadRegister(kVRegMailBoxAbort, val);
4579  return val;
4580 }
4581 
4582 bool CNTV2Card::GetDieTemperature (double & outTemp, const NTV2DieTempScale inTempScale)
4583 {
4584  outTemp = 0.0;
4585 
4586  // Read the temperature...
4587  ULWord rawRegValue (0);
4588  if (!ReadRegister (kRegSysmonVccIntDieTemp, rawRegValue))
4589  return false;
4590 
4591  double celsius (0);
4592  if (IsSupported(kDeviceCanDoVersalSysMon))
4593  {
4594  UWord dieTempRaw (rawRegValue & 0x0000FFFF);
4595  celsius = double (dieTempRaw) / 128.0;
4596  }
4597  else
4598  {
4599  UWord dieTempRaw ((rawRegValue & 0x0000FFFF) >> 6);
4600  celsius = (double (dieTempRaw) * 503.975 / 1024.0 - 273.15);
4601  }
4602  switch (inTempScale)
4603  {
4604  case NTV2DieTempScale_Celsius: outTemp = celsius; break;
4605  case NTV2DieTempScale_Fahrenheit: outTemp = celsius * 9.0 / 5.0 + 32.0; break;
4606  case NTV2DieTempScale_Kelvin: outTemp = celsius + 273.15; break;
4607  case NTV2DieTempScale_Rankine: outTemp = (celsius + 273.15) * 9.0 / 5.0; break;
4608  default: return false;
4609  }
4610  return true;
4611 }
4612 
4613 bool CNTV2Card::GetDieVoltage (double & outVoltage)
4614 {
4615  outVoltage = 0.0;
4616 
4617  // Read the Vcc voltage...
4618  ULWord rawRegValue (0);
4619  if (!ReadRegister (kRegSysmonVccIntDieTemp, rawRegValue))
4620  return false;
4621 
4622  const UWord coreVoltageRaw ((rawRegValue>>22) & 0x00003FF);
4623  const double coreVoltageFloat (double(coreVoltageRaw)/ 1024.0 * 3.0);
4624  outVoltage = coreVoltageFloat;
4625  return true;
4626 }
4627 
4628 #if defined(READREGMULTICHANGE)
4629  bool CNTV2Card::ReadRegisters (const NTV2RegNumSet & inRegisters, NTV2RegisterValueMap & outValues)
4630  {
4631  outValues.clear ();
4632  if (!IsOpen())
4633  return false; // Device not open!
4634  if (inRegisters.empty())
4635  return false; // Nothing to do!
4636 
4637  NTV2GetRegisters getRegsParams (inRegisters);
4638  if (NTV2Message(getRegsParams))
4639  {
4640  if (!getRegsParams.GetRegisterValues(outValues))
4641  return false;
4642  }
4643  else // Non-atomic user-space workaround until GETREGS implemented in driver...
4644  for (NTV2RegNumSetConstIter iter(inRegisters.begin()); iter != inRegisters.end(); ++iter)
4645  {
4646  ULWord tempVal (0);
4647  if (*iter != kRegXenaxFlashDOUT) // Prevent firmware erase/program/verify failures
4648  if (ReadRegister (*iter, tempVal))
4649  outValues[*iter] = tempVal;
4650  }
4651  return outValues.size() == inRegisters.size();
4652  }
4653 #endif // !defined(READREGMULTICHANGE)
4654 
4655 
4657 {
4658  if (!_boardOpened)
4659  return false; // Device not open!
4660  if (inRegWrites.empty())
4661  return true; // Nothing to do!
4662 
4663  bool result(false);
4664  NTV2SetRegisters setRegsParams(inRegWrites);
4665  //cerr << "## DEBUG: CNTV2Card::WriteRegisters: setRegsParams: " << setRegsParams << endl;
4666  result = NTV2Message(setRegsParams);
4667  if (!result)
4668  {
4669  // Non-atomic user-space workaround until SETREGS implemented in driver...
4670  const NTV2RegInfo * pRegInfos = setRegsParams.mInRegInfos;
4671  UWord * pBadNdxs = setRegsParams.mOutBadRegIndexes;
4672  for (ULWord ndx(0); ndx < setRegsParams.mInNumRegisters; ndx++)
4673  if (!WriteRegister(pRegInfos[ndx].registerNumber, pRegInfos[ndx].registerValue, pRegInfos[ndx].registerMask, pRegInfos[ndx].registerShift))
4674  pBadNdxs[setRegsParams.mOutNumFailures++] = UWord(ndx);
4675  result = true;
4676  }
4677  if (result && setRegsParams.mInNumRegisters && setRegsParams.mOutNumFailures)
4678  result = false; // fail if any writes failed
4679  if (!result) CVIDFAIL("Failed: setRegsParams: " << setRegsParams);
4680  return result;
4681 }
4682 
4683 bool CNTV2Card::BankSelectWriteRegister (const NTV2RegInfo & inBankSelect, const NTV2RegInfo & inRegInfo)
4684 {
4685  NTV2BankSelGetSetRegs bankSelGetSetMsg (inBankSelect, inRegInfo, true);
4686  //cerr << "## DEBUG: CNTV2Card::BankSelectWriteRegister: " << bankSelGetSetMsg << endl;
4687  if (!NTV2Message(bankSelGetSetMsg))
4688  // Fall back to doing 2 ops & hope nobody else clobbers the bank select register...
4689  return WriteRegister(inBankSelect.registerNumber, inBankSelect.registerValue, inBankSelect.registerMask, inBankSelect.registerShift)
4690  && WriteRegister(inRegInfo.registerNumber, inRegInfo.registerValue, inRegInfo.registerMask, inRegInfo.registerShift);
4691  return true;
4692 }
4693 
4694 bool CNTV2Card::BankSelectReadRegister (const NTV2RegInfo & inBankSelect, NTV2RegInfo & inOutRegInfo)
4695 {
4696  NTV2BankSelGetSetRegs bankSelGetSetMsg (inBankSelect, inOutRegInfo);
4697  //cerr << "## DEBUG: CNTV2Card::BankSelectReadRegister: " << bankSelGetSetMsg << endl;
4698  if (!NTV2Message(bankSelGetSetMsg))
4699  // Fall back to doing 2 ops & hope nobody else clobbers the bank select register...
4700  return WriteRegister(inBankSelect.registerNumber, inBankSelect.registerValue, inBankSelect.registerMask, inBankSelect.registerShift)
4701  && ReadRegister(inOutRegInfo.registerNumber, inOutRegInfo.registerValue, inOutRegInfo.registerMask, inOutRegInfo.registerShift);
4702  if (bankSelGetSetMsg.mInRegInfos)
4703  inOutRegInfo = bankSelGetSetMsg.GetRegInfo();
4704  return true;
4705 }
4706 
4707 bool CNTV2Card::WriteVirtualData (const ULWord inTag, const void* inVirtualData, const ULWord inVirtualDataSize)
4708 {
4709  NTV2VirtualData virtualDataMsg (inTag, inVirtualData, inVirtualDataSize, true);
4710  //cerr << "## DEBUG: CNTV2Card::WriteVirtualData: " << virtualDataMsg << endl;
4711  return NTV2Message(virtualDataMsg);
4712 }
4713 
4714 bool CNTV2Card::ReadVirtualData (const ULWord inTag, void* outVirtualData, const ULWord inVirtualDataSize)
4715 {
4716  NTV2VirtualData virtualDataMsg (inTag, outVirtualData, inVirtualDataSize, false);
4717  //cerr << "## DEBUG: CNTV2Card::ReadVirtualData: " << virtualDataMsg << endl;
4718  return NTV2Message(virtualDataMsg);
4719 }
4720 
4722 {
4723  outStats.Clear ();
4724  if (!_boardOpened)
4725  return false; // Device not open!
4726  if (!IsSupported(kDeviceCanDoSDIErrorChecks))
4727  return false; // Device doesn't support it!
4728  if (!NTV2Message(outStats))
4729  {
4730  const ULWord numSDIInputs(GetNumSupported(kDeviceGetNumVideoInputs));
4731  NTV2RegisterReads sdiStatRegInfos;
4732  for (size_t sdi(0); sdi < numSDIInputs; sdi++)
4733  for (ULWord reg(0); reg < 6; reg++)
4734  sdiStatRegInfos.push_back(NTV2RegInfo(reg + gChannelToRXSDIStatusRegs[sdi]));
4735  sdiStatRegInfos.push_back(NTV2RegInfo(kRegRXSDIFreeRunningClockLow));
4736  sdiStatRegInfos.push_back(NTV2RegInfo(kRegRXSDIFreeRunningClockHigh));
4737  // Read the registers all at once...
4738  if (!ReadRegisters(sdiStatRegInfos))
4739  return false;
4740  // Stuff the results into outStats...
4741  for (size_t sdi(0); sdi < numSDIInputs; sdi++)
4742  {
4743  NTV2SDIInputStatus & outStat(outStats[sdi]);
4744  size_t ndx(sdi*6 + 0); // Start at kRegRXSDINStatus register
4745  NTV2_ASSERT(ndx < sdiStatRegInfos.size());
4746  NTV2RegInfo & regInfo(sdiStatRegInfos.at(ndx));
4747  NTV2_ASSERT(regInfo.registerNumber == gChannelToRXSDIStatusRegs[sdi]);
4748  outStat.mUnlockTally = regInfo.registerValue & kRegMaskSDIInUnlockCount;
4749  outStat.mLocked = regInfo.registerValue & kRegMaskSDIInLocked ? true : false;
4750  outStat.mFrameTRSError = regInfo.registerValue & kRegMaskSDIInTRSError ? true : false;
4751  outStat.mVPIDValidA = regInfo.registerValue & kRegMaskSDIInVpidValidA ? true : false;
4752  outStat.mVPIDValidB = regInfo.registerValue & kRegMaskSDIInVpidValidB ? true : false;
4753  regInfo = sdiStatRegInfos.at(ndx+1); // kRegRXSDINCRCErrorCount
4754  outStat.mCRCTallyA = regInfo.registerValue & kRegMaskSDIInCRCErrorCountA;
4755  outStat.mCRCTallyB = (regInfo.registerValue & kRegMaskSDIInCRCErrorCountB) >> kRegShiftSDIInCRCErrorCountB;
4756  // kRegRXSDINFrameCountHigh kRegRXSDINFrameCountLow
4757  //outStat.mFrameTally = (ULWord64(sdiStatRegInfos.at(ndx+2).registerValue) << 32) | ULWord64(sdiStatRegInfos.at(ndx+1).registerValue);
4758  // kRegRXSDINFrameRefCountHigh kRegRXSDINFrameRefCountLow
4759  outStat.mFrameRefClockCount = (ULWord64(sdiStatRegInfos.at(ndx+5).registerValue) << 32) | ULWord64(sdiStatRegInfos.at(ndx+4).registerValue);
4760  // kRegRXSDIFreeRunningClockHigh kRegRXSDIFreeRunningClockLow
4761  outStat.mGlobalClockCount = (ULWord64(sdiStatRegInfos.at(8*6+1).registerValue) << 32) | ULWord64(sdiStatRegInfos.at(8*6+0).registerValue);
4762  } // for each SDI input
4763  }
4764  return true;
4765 }
4766 
4767 bool CNTV2Card::SetMultiRasterBypassEnable (const bool inEnable)
4768 {
4769  return HasMultiRasterWidget() && WriteRegister(kRegMROutControl, inEnable, kRegMaskMRBypass, kRegShiftMRBypass);
4770 }
4771 
4773 {
4774  if (!HasMultiRasterWidget())
4775  return false;
4776  NTV2ULWordVector regs; regs.push_back(0); regs.push_back(0); regs.push_back(0); regs.push_back(0);
4777  if (!ReadRegister(kRegMRQ1Control, regs.at(0))
4778  || !ReadRegister(kRegMRQ2Control, regs.at(1))
4779  || !ReadRegister(kRegMRQ3Control, regs.at(2))
4780  || !ReadRegister(kRegMRQ4Control, regs.at(3)))
4781  return false;
4782  // Any enabled quadrant means the 4K frame is being written by the hardware
4783  outEnabled = (regs.at(0) & kRegMaskMREnable)
4784  || (regs.at(1) & kRegMaskMREnable)
4785  || (regs.at(2) & kRegMaskMREnable)
4786  || (regs.at(3) & kRegMaskMREnable);
4787 // CNTV2DriverInterface::ReadRegister(kRegMROutControl, outEnabled, kRegMaskMRBypass, kRegShiftMRBypass);
4788  return true;
4789 }
4790 
4792 {
4793  return HasMultiRasterWidget() && inChannel == NTV2Channel(GetNumSupported(kDeviceGetNumVideoChannels));
4794 }
4795 
4796 
4798 
4799 #ifdef MSWindows
4800 #pragma warning(default: 4800)
4801 #endif
Fractional rate of 15,000 frames per 1,001 seconds.
Definition: ntv2enums.h:433
static const ULWord gChannelToSDIInputProgressiveShift[]
#define NTV2_IS_VANCMODE_TALLER(__v__)
Definition: ntv2enums.h:3813
virtual bool GetForce64(ULWord *force64)
Everything needed to call CNTV2Card::ReadRegister or CNTV2Card::WriteRegister functions.
virtual NTV2VideoFormat GetSDIInputVideoFormat(NTV2Channel inChannel, bool inIsProgressive=(0))
Returns the video format of the signal that is present on the given SDI input source.
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:3630
static const ULWord gChannelToSDIIn6GModeMask[]
virtual bool SetFrameBufferSize(const NTV2Framesize inSize)
Sets the device&#39;s intrinsic frame buffer size.
#define K2_MIN_V
virtual bool SetMixerBGMatteEnabled(const UWord inWhichMixer, const bool inIsEnabled)
Answers if the given mixer/keyer&#39;s background matte is enabled or not.
std::string NTV2FrameGeometryToString(const NTV2FrameGeometry inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:6982
static const ULWord gChannelToInputFrameRegNum[]
virtual bool SetTaskMode(const NTV2TaskMode inMode)
Sets the device&#39;s task mode.
virtual bool GetVideoHOffset(int &outHOffset, const UWord inOutputSpigot=0)
Answers with the current horizontal timing offset, in pixels, for the given SDI output connector...
bool IsValid(void) const
Identifies the 4th HDMI video input.
Definition: ntv2enums.h:1272
static const ULWord sSDIXmitEnableShifts[]
NTV2VideoDACMode
Definition: ntv2enums.h:2147
#define NTV2_IS_VALID_TASK_MODE(__m__)
Identifies the 5th SDI video input.
Definition: ntv2enums.h:1277
virtual bool GetSDITransmitEnable(const NTV2Channel inChannel, bool &outEnabled)
Answers whether or not the specified SDI connector is currently acting as a transmitter (i...
static const ULWord gChannelToSDIIn12GModeShift[]
UWord mCRCTallyA
The number of lines having a CRC error was detected in the "B" stream of the SDI link since this tall...
NTV2AudioSystem
Used to identify an Audio System on an NTV2 device. See Audio System Operation for more information...
Definition: ntv2enums.h:3901
virtual bool SetSDIWatchdogEnable(const bool inEnable, const UWord inIndex0)
Sets the connector pair relays to be under watchdog timer control or manual control.
NTV2InputXptIDSet::const_iterator NTV2InputXptIDSetConstIter
A const iterator for iterating over an NTV2InputXptIDSet.
virtual bool GetRegisterBaseAddress(ULWord regNumber, ULWord **pRegAddress)
virtual bool GetFrameBufferOrientation(const NTV2Channel inChannel, NTV2FBOrientation &outValue)
Answers with the current frame buffer orientation for the given NTV2Channel.
virtual bool GetSDIOut2Kx1080Enable(const NTV2Channel inChannel, bool &outIsEnabled)
virtual bool AcquireMailBoxLock(void)
virtual bool SetStandard(NTV2Standard inValue, NTV2Channel inChannel=NTV2_CHANNEL1)
For devices that support it (see NTV2DeviceCanDoSDIErrorChecks ), this struct reports SDI input error...
virtual bool GetMultiFormatMode(bool &outIsEnabled)
Answers if the device is operating in multiple-format per channel (independent channel) mode or not...
Specifies the SDI In 6 connector.
Definition: ntv2enums.h:1470
virtual bool SetEncodeAsPSF(NTV2Channel inChannel, NTV2EncodeAsPSF inValue)
Identifies SMPTE HD 1080p.
Definition: ntv2enums.h:175
virtual bool GetVideoFormat(NTV2VideoFormat &outValue, NTV2Channel inChannel=NTV2_CHANNEL1)
virtual bool BankSelectReadRegister(const NTV2RegInfo &inBankSelect, NTV2RegInfo &inOutRegInfo)
Reads the given set of registers from the bank specified in position 0.
virtual bool GetMixerFGMatteEnabled(const UWord inWhichMixer, bool &outIsEnabled)
Answers if the given mixer/keyer&#39;s foreground matte is enabled or not.
#define NTV2VANCModeFromBools(_tall_, _taller_)
Definition: ntv2enums.h:3816
Specifies the device&#39;s internal clock.
Definition: ntv2enums.h:1464
virtual bool SetReference(const NTV2ReferenceSource inRefSource, const bool inKeepFramePulseSelect=(0))
Sets the device&#39;s clock reference source. See Video Output Clocking & Synchronization for more inform...
virtual bool GetDieTemperature(double &outTemp, const NTV2DieTempScale inTempScale=NTV2DieTempScale_Celsius)
Reads the current die temperature of the device.
virtual bool GetAnalogOutHTiming(ULWord &outValue)
ULWord registerMask
My register mask value to use in a ReadRegister or WriteRegister call.
This identifies the invalid (unspecified, uninitialized) VANC mode.
Definition: ntv2enums.h:3808
#define CVIDFAIL(__x__)
virtual bool GetSDIInput3GPresent(bool &outValue, const NTV2Channel channel)
static const ULWord gIndexToVidProcControlRegNum[]
True if the device supports SMPTE 425 mux control.
Odd parity – this is the power-up default.
Definition: ntv2enums.h:4171
static bool GetPossibleConnections(const NTV2RegReads &inROMRegisters, NTV2PossibleConnections &outConnections)
Answers with the implemented crosspoint connections as obtained from the given ROM registers...
virtual bool GetQuadQuadSquaresEnable(bool &outValue, const NTV2Channel inChannel=NTV2_CHANNEL1)
Returns the device&#39;s current "quad-quad-squares" frame mode, whether it&#39;s enabled or not...
NTV2FrameGeometry GetQuarterSizedGeometry(const NTV2FrameGeometry inGeometry)
Definition: ntv2utils.cpp:2315
virtual bool ReadLineCount(ULWord &outValue, const NTV2Channel inChannel=NTV2_CHANNEL1)
Answers with the line offset into the frame currently being read (NTV2_MODE_DISPLAY) or written (NTV2...
virtual bool SetPCIAccessFrame(const NTV2Channel inChannel, const ULWord inValue, const bool inWaitForVBI=(!(0)))
Identifies the 2nd HDMI video input.
Definition: ntv2enums.h:1270
#define DEC0N(__x__, __n__)
#define NTV2_IS_2K1080_STANDARD(__s__)
Definition: ntv2enums.h:213
The number of video channels supported on the device.
1920x1080, for 1080i and 1080p, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:363
I interrogate and control an AJA video/audio capture/playout device.
Definition: ntv2card.h:28
The number of mixer/keyer widgets on the device.
static const ULWord gChannelToSmpte372Shifts[]
NTV2FrameBufferFormat
Identifies a particular video frame buffer pixel format. See Device Frame Buffer Formats for details...
Definition: ntv2enums.h:223
virtual bool SetMixerMode(const UWord inWhichMixer, const NTV2MixerKeyerMode inMode)
Sets the mode for the given mixer/keyer.
#define BIT(_x_)
Definition: ajatypes.h:496
static const ULWord gChannelToSDIIn3GbModeMask[]
static const ULWord gChannelToSDIInputRateHighMask[]
True if device can do 3G level B to 3G level A conversion.
NTV2ChannelSet::const_iterator NTV2ChannelSetConstIter
A handy const iterator into an NTV2ChannelSet.
NTV2TaskMode
Describes the task mode state. See also: NTV2 Device Sharing.
virtual bool GetAllWidgetInputs(NTV2InputXptIDSet &outInputs)
Returns all my widget input crosspoints.
virtual bool SetVideoFormat(const NTV2VideoFormat inVideoFormat, const bool inIsAJARetail=(!(0)), const bool inKeepVancSettings=(0), const NTV2Channel inChannel=NTV2_CHANNEL1)
Configures the AJA device to handle a specific video format.
The number of analog LTC outputs on the device.
virtual bool Set4kSquaresEnable(const bool inIsEnabled, const NTV2Channel inChannel)
Enables or disables SMPTE 425 "2K quadrants" mode for the given FrameStore bank on the device...
virtual bool SetSDIOut6GEnable(const NTV2Channel inChannel, const bool inEnable)
Specifies the HDMI In 1 connector.
Definition: ntv2enums.h:1466
virtual bool SetDualLinkOutputEnable(const bool inIsEnabled)
Declares the AJADebug class.
virtual bool SetFrameGeometry(NTV2FrameGeometry inGeometry, bool inIsRetail=(!(0)), NTV2Channel inChannel=NTV2_CHANNEL1)
Sets the frame geometry of the given channel.
NTV2_RP188Mode
Definition: ntv2enums.h:2100
NTV2InputVideoSelect
Definition: ntv2enums.h:2301
720x576, for PAL 625i, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:362
See 10-Bit YCbCr Format.
Definition: ntv2enums.h:226
virtual bool SetRP188Mode(const NTV2Channel inChannel, const NTV2_RP188Mode inMode)
Sets the current RP188 mode – NTV2_RP188_INPUT or NTV2_RP188_OUTPUT – for the given channel...
virtual bool GetPossibleConnections(NTV2PossibleConnections &outConnections)
Answers with the implemented crosspoint connections (if known).
Declares the CNTV2VPID class. See SMPTE 352 standard for details.
1280x720, for 720p, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:356
#define AJAFUNC
Definition: ajatypes.h:306
static const ULWord gMatteColorRegs[]
virtual bool SetMixerMatteColor(const UWord inWhichMixer, const YCbCr10BitPixel inYCbCrValue)
Sets the matte color to use for the given mixer/keyer.
bool mVPIDValidA
If true, at least one valid SMPTE 352 packet was received on Link A over the last 4 VBI periods...
virtual bool SetProgressivePicture(ULWord value)
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
virtual bool DisableChannel(const NTV2Channel inChannel)
Disables the given FrameStore.
static const ULWord gSDIOutToRP188Input[]
enum NTV2VPIDLuminance NTV2HDRLuminance
Identifies the 1st HDMI video input.
Definition: ntv2enums.h:1269
Fractional rate of 120,000 frames per 1,001 seconds.
Definition: ntv2enums.h:431
virtual bool Enable4KDCYCC444Mode(bool inEnable)
Sets 4K Down Convert YCC 444 mode.
enum NTV2VideoFrameBufferOrientation NTV2FBOrientation
virtual bool GetMixerMode(const UWord inWhichMixer, NTV2MixerKeyerMode &outMode)
Returns the current operating mode of the given mixer/keyer.
See Corvid 24.
Definition: ntv2enums.h:24
virtual bool SetDualLinkInputEnable(const bool inIsEnabled)
ULWord64 mFrameRefClockCount
This count is incremented on each 148.xx reference clock, and latched at EAV for each frame...
virtual bool GetRunningFirmwareRevision(UWord &outRevision)
Reports the revision number of the currently-running firmware.
Identifies SMPTE SD 525i.
Definition: ntv2enums.h:173
enum NTV2VPIDColorimetry NTV2HDRColorimetry
virtual bool IsMultiRasterWidgetChannel(const NTV2Channel inChannel)
Identifies 4K psf.
Definition: ntv2enums.h:186
virtual bool SetFrameBufferQuality(NTV2Channel inChannel, NTV2FrameBufferQuality inValue)
virtual bool SetSmpte372(ULWord inValue, NTV2Channel inChannel=NTV2_CHANNEL1)
Enables or disables the device&#39;s SMPTE-372 (dual-link) mode (used for older 3G-levelB-capable devices...
virtual NTV2FrameGeometry GetSDIInputGeometry(const NTV2Channel channel)
bool IsValid(void) const
Answers true if I&#39;m valid, or false if I&#39;m not valid.
#define K2_MIN_H
#define NTV2_IS_QUAD_QUAD_FRAME_GEOMETRY(geom)
Definition: ntv2enums.h:386
virtual bool GetOutputFrame(const NTV2Channel inChannel, ULWord &outValue)
Answers with the current output frame number for the given FrameStore (expressed as an NTV2Channel)...
virtual bool GetMixerSyncStatus(const UWord inWhichMixer, bool &outIsSyncOK)
Returns the current sync state of the given mixer/keyer.
virtual bool ReleaseMailBoxLock(void)
virtual bool WriteGlobalControlBits(const ULWord regNum, const ULWord value, const ULWord mask, const ULWord shift, GlobalControlRegWrite *pGlobalControl)
Identifies high frame-rate UHD.
Definition: ntv2enums.h:181
std::map< ULWord, ULWord > NTV2RegisterValueMap
A mapping of distinct NTV2RegisterNumbers to their corresponding ULWord values.
static bool isEnabled(CNTV2Card &device, const NTV2Channel inChannel)
virtual bool IsProgressiveStandard(bool &outIsProgressive, NTV2Channel inChannel=NTV2_CHANNEL1)
ULWordSetConstIter NTV2RegNumSetConstIter
A const iterator that iterates over a set of distinct NTV2RegisterNumbers.
int32_t LWord
Definition: ajatypes.h:235
virtual bool GetSDIOut12GEnable(const NTV2Channel inChannel, bool &outIsEnabled)
virtual bool GetRP188SourceFilter(const NTV2Channel inSDIInput, UWord &outFilterValue)
Returns the current RP188 filter setting for the given SDI input.
#define K2_MAX_H
Declares the AJATime class.
virtual bool GetSDIInput3GbPresent(bool &outValue, const NTV2Channel channel)
static const ULWord gChannelToRS422ControlRegNum[]
virtual bool GetMixerBGInputControl(const UWord inWhichMixer, NTV2MixerKeyerInputControl &outInputControl)
Returns the current background input control value for the given mixer/keyer.
virtual bool GetTransmitSDIs(NTV2ChannelSet &outXmitSDIs)
Answers with the transmitting/output SDI connectors.
virtual bool GetDieVoltage(double &outVoltage)
Reads the current "Vcc" voltage of the device.
virtual bool GetRunningFirmwareUserID(ULWord &outUserID)
Reports the UserID number of the currently-running firmware.
Identifies the NTV2VideoFormat enumerated type.
virtual bool GetVANCShiftMode(NTV2Channel inChannel, NTV2VANCDataShiftMode &outValue)
Retrieves the current "VANC Shift Mode" feature for the given channel.
virtual bool GetProgressivePicture(void) const
Definition: ntv2vpid.cpp:346
virtual bool SetMixerBGInputControl(const UWord inWhichMixer, const NTV2MixerKeyerInputControl inInputControl)
Sets the background input control value for the given mixer/keyer.
virtual bool GetSDIOutputStandard(const UWord inOutputSpigot, NTV2Standard &outValue)
Answers with the current video standard of the given SDI output spigot.
True if device supports 10Gbps IP (mutually exclusive with kDeviceCanDo25GIP).
static bool GetWidgetOutputs(const NTV2WidgetID inWidgetID, NTV2OutputXptIDSet &outOutputs)
Returns the output crosspoints known to be "owned" by the given widget.
Identifies 8K.
Definition: ntv2enums.h:184
virtual bool GetRegisterWriteMode(NTV2RegisterWriteMode &outValue, const NTV2Channel inFrameStore=NTV2_CHANNEL1)
Answers with the FrameStore&#39;s current NTV2RegisterWriteMode setting, which determines when CNTV2Card:...
bool mVPIDValidB
If true, at least one valid SMPTE 352 packet was received on Link B over the last 4 VBI periods...
virtual bool GetEnable4KPSFOutMode(bool &outIsEnabled)
virtual bool SetRP188BypassSource(const NTV2Channel inSDIOutput, const UWord inSDIInput)
For the given SDI output that&#39;s in RP188 bypass mode (E-E), specifies the SDI input to be used as a t...
NTV2Standard GetNTV2StandardFromScanGeometry(const UByte inScanGeometry, const bool inIsProgressiveTransport)
Definition: ntv2utils.cpp:1903
NTV2FrameSize & Reset(void)
Input & output directly connected.
Definition: ntv2enums.h:3944
2048x1080, for 2Kx1080p, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:368
True if the device can do RGB over 3G Level A.
Definition: json.hpp:5362
virtual bool GetActiveFrameDimensions(NTV2FrameDimensions &outFrameDimensions, const NTV2Channel inChannel=NTV2_CHANNEL1)
NTV2RelayState
This enumerated data type identifies the two possible states of the bypass relays. See CNTV2Card::GetSDIRelayPosition, CNTV2Card::GetSDIRelayManualControl, CNTV2Card::GetSDIWatchdogStatus, etc.
Definition: ntv2enums.h:3942
Fractional rate of 60,000 frames per 1,001 seconds.
Definition: ntv2enums.h:421
virtual ULWord GetFrameBufferSize(void) const
virtual bool FlipFlopPage(const NTV2Channel inChannel)
#define false
uint32_t ULWord
Definition: ajatypes.h:236
virtual bool GetEnabledChannels(NTV2ChannelSet &outChannels)
Answers with the set of channels that are currently enabled.
virtual bool SetFrameBufferFormat(NTV2Channel inChannel, NTV2FrameBufferFormat inNewFormat, bool inIsAJARetail=(!(0)), NTV2HDRXferChars inXferChars=NTV2_VPID_TC_SDR_TV, NTV2HDRColorimetry inColorimetry=NTV2_VPID_Color_Rec709, NTV2HDRLuminance inLuminance=NTV2_VPID_Luminance_YCbCr)
Sets the frame buffer format for the given FrameStore on the AJA device.
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They&#39;re also commonly use...
Definition: ntv2enums.h:1361
NTV2OutputXptIDSet::const_iterator NTV2OutputXptIDSetConstIter
A const iterator for iterating over an NTV2OutputXptIDSet.
virtual bool SetAnalogLTCOutClockChannel(const UWord inLTCOutput, const NTV2Channel inChannel)
Sets the (SDI) output channel that is to provide the clock reference to be used by the given analog L...
virtual bool SetSDI1OutHTiming(ULWord value)
Identifies the 8th SDI video input.
Definition: ntv2enums.h:1280
virtual bool GetSDIWatchdogEnable(bool &outIsEnabled, const UWord inIndex0)
Answers true if the given connector pair relays are under watchdog timer control, or false if they&#39;re...
virtual bool GetSDI1OutHTiming(ULWord *value)
virtual bool GetEnable4KDCYCC444Mode(bool &outIsEnabled)
virtual bool SetSDI2OutHTiming(ULWord value)
virtual bool SetMultiFormatMode(const bool inEnable)
Enables or disables multi-format (per channel) device operation. If enabled, each device channel can ...
static NTV2VideoFormat GetNTV2VideoFormat(NTV2FrameRate frameRate, UByte inputGeometry, bool progressiveTransport, bool isThreeG, bool progressivePicture=(0))
virtual bool GetSDIInput12GPresent(bool &outValue, const NTV2Channel channel)
3840x2160, for UHD, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:371
virtual bool GetLTCEmbeddedOutEnable(bool &outValue)
Identifies the 2nd SDI video input.
Definition: ntv2enums.h:1274
virtual bool MixerHasRGBModeSupport(const UWord inWhichMixer, bool &outIsSupported)
Answers if the given mixer/keyer&#39;s has RGB mode support.
virtual bool SetVideoHOffset(const int inHOffset, const UWord inOutputSpigot=0)
Adjusts the horizontal timing offset, in pixels, for the given SDI output connector.
bool IsProgressivePicture(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5395
virtual bool EnableRP188Bypass(const NTV2Channel inSDIOutput)
Configures the SDI output&#39;s embedder to embed SMPTE 12M timecode obtained from an SDI input...
bool NTV2DeviceNeedsRoutingSetup(const NTV2DeviceID inDeviceID)
virtual bool WriteOutputTimingControl(const ULWord inValue, const UWord inOutputSpigot=0)
Adjusts the output timing for the given SDI output connector.
virtual bool Enable4KDCPSFInMode(bool inEnable)
Sets 4K Down Convert PSF in mode.
#define NTV2_ASSERT(_expr_)
Definition: ajatypes.h:489
The number of SDI video outputs on the device.
virtual bool GetRS422Parity(const NTV2Channel inSerialPort, NTV2_RS422_PARITY &outParity)
Answers with the current parity control for the specified RS422 serial port.
Identifies SMPTE HD 2K1080psf.
Definition: ntv2enums.h:178
38400 baud – this is the power-up default
Definition: ntv2enums.h:4185
virtual bool GetRunningFirmwarePackageRevision(ULWord &outRevision)
Reports the revision number of the currently-running firmware package. KonaIP style boards have a pac...
Represents an unknown or invalid frame rate.
Definition: ntv2enums.h:418
virtual bool GetRP188Data(const NTV2Channel inSDIInput, NTV2_RP188 &outRP188Data)
Reads the raw RP188 data from the DBB/Low/Hi registers for the given SDI input. On newer devices with...
bool NTV2DeviceSoftwareCanChangeFrameBufferSize(const NTV2DeviceID inDeviceID)
ULWordSet::const_iterator ULWordSetConstIter
#define NTV2_IS_QUAD_STANDARD(__s__)
Definition: ntv2enums.h:212
static const ULWord gChlToRP188DBBRegNum[]
This struct replaces the old RP188_STRUCT.
virtual NTV2VideoFormat GetHDMIInputVideoFormat(NTV2Channel inHDMIInput=NTV2_CHANNEL1)
50 frames per second
Definition: ntv2enums.h:427
The total number of audio systems on the device, including host audio and mixer audio systems...
static const ULWord gChannelToPCIAccessFrameRegNum[]
static bool WriteWatchdogControlBit(CNTV2Card &card, const ULWord inValue, const ULWord inMask, const ULWord inShift)
virtual bool GetInputVideoSelect(NTV2InputVideoSelect &outInputSelect)
Identifies SMPTE HD 720p.
Definition: ntv2enums.h:172
static const ULWord gIndexToVidProcMixCoeffRegNum[]
True if device can read LTC (Linear TimeCode) from its reference input.
std::string NTV2MixerInputControlToString(const NTV2MixerKeyerInputControl inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6536
2048x1556, for 2Kx1556psf film format, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:366
virtual bool SetQuadFrameEnable(const bool inValue, const NTV2Channel inChannel=NTV2_CHANNEL1)
Enables or disables quad-frame mode on the device.
virtual bool GetTaskMode(NTV2TaskMode &outMode)
Retrieves the device&#39;s current task mode.
Specifies the External Reference connector.
Definition: ntv2enums.h:1461
True if device SDI connectors are bi-directional.
static const ULWord gChannelToRXSDICRCErrorCountRegs[]
Fractional rate of 48,000 frames per 1,001 seconds.
Definition: ntv2enums.h:429
__out HRESULT & hr
Definition: pstream.cpp:145
virtual bool GetTsiMuxSyncFail(bool &outSyncFailed, const NTV2Channel inWhichTsiMux)
Answers if the SMPTE 425 two-sample-interleave mux/demux input sync has failed or not...
virtual bool SetSDIOut3GEnable(const NTV2Channel inChannel, const bool inEnable)
virtual bool KickSDIWatchdog(void)
Restarts the countdown timer to prevent the watchdog timer from timing out.
30 frames per second
Definition: ntv2enums.h:422
static const ULWord gChannelToSDIInputRateMask[]
virtual bool GetSDIRelayManualControl(NTV2RelayState &outValue, const UWord inIndex0)
Answers if the bypass relays between connectors 1 and 2 would be in bypass or would route signals thr...
static const ULWord gChannelToOutputTimingCtrlRegNum[]
bool SetBitFile(const std::string &inBitfileName, std::ostream &outMsgs, const FlashBlockID blockNumber=AUTO_FLASHBLOCK)
ULWord mInNumRegisters
The number of NTV2RegInfo&#39;s to be set.
std::string Program(bool fullVerify=(0))
NTV2FrameRate
Identifies a particular video frame rate.
Definition: ntv2enums.h:416
7680x4320, for UHD2, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:375
virtual bool SetLTCInputEnable(const bool inEnable)
Enables or disables the ability for the device to read analog LTC on the reference input connector...
virtual bool GetXena2FlashBaseAddress(ULWord **pXena2FlashAddress)
std::string NTV2StandardToString(const NTV2Standard inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:6914
virtual bool SetOutputFrame(const NTV2Channel inChannel, const ULWord inValue)
Sets the output frame index number for the given FrameStore. This identifies which frame in device SD...
std::string NTV2InputCrosspointIDToString(const NTV2InputCrosspointID inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:5818
#define true
virtual bool GetEncodeAsPSF(NTV2Channel inChannel, NTV2EncodeAsPSF &outValue)
2048x1080, NTV2_VANCMODE_TALLER
Definition: ntv2enums.h:360
virtual bool EnableChannels(const NTV2ChannelSet &inChannels, const bool inDisableOthers=(0))
Enables the given FrameStore(s).
NTV2Standard
Identifies a particular video standard.
Definition: ntv2enums.h:169
virtual bool GetSDILock(const NTV2Channel inChannel)
ULWord registerValue
My register value to use in a ReadRegister or WriteRegister call.
NTV2DeviceID
Identifies a specific AJA NTV2 device model number. The NTV2DeviceID is actually the PROM part number...
Definition: ntv2enums.h:20
Specifies the HDMI In 3 connector.
Definition: ntv2enums.h:1478
ULWord registerNumber
My register number to use in a ReadRegister or WriteRegister call.
virtual bool GetVideoVOffset(int &outVOffset, const UWord inOutputSpigot=0)
Answers with the current vertical timing offset, in lines, for the given SDI output connector...
virtual bool SetMode(const NTV2Channel inChannel, const NTV2Mode inNewValue, const bool inIsRetail=(!(0)))
Determines if a given FrameStore on the AJA device will be used to capture or playout video...
enum NTV2VPIDTransferCharacteristics NTV2HDRXferChars
virtual bool GetSecondaryVideoFormat(NTV2VideoFormat &outFormat)
Identifies UHD2.
Definition: ntv2enums.h:183
NTV2Standard GetQuarterSizedStandard(const NTV2Standard inGeometry)
Definition: ntv2utils.cpp:2340
virtual bool SetRP188Data(const NTV2Channel inSDIOutput, const NTV2_RP188 &inRP188Data)
Writes the raw RP188 data into the DBB/Low/Hi registers for the given SDI output. These values are la...
This is used to perform virtual data reads or writes.
virtual bool IsXilinxProgrammed(void)
static const ULWord gChannelToOutputFrameRegNum[]
The number of FrameStores on the device.
virtual bool WriteRegisters(const NTV2RegisterWrites &inRegWrites)
Writes the given sequence of NTV2RegInfo&#39;s.
virtual bool GetSDIOutputAudioSystem(const NTV2Channel inSDIOutputConnector, NTV2AudioSystem &outAudioSystem)
Answers with the device&#39;s NTV2AudioSystem that is currently providing audio for the given SDI output&#39;...
static const ULWord gChannelToSDIInputGeometryMask[]
1920x1080, for 1080i and 1080p, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:354
NTV2_RS422_PARITY
These enum values identify RS-422 serial port parity configuration.
Definition: ntv2enums.h:4168
virtual bool GetQuadFrameEnable(bool &outValue, const NTV2Channel inChannel=NTV2_CHANNEL1)
Returns the device&#39;s current quad-frame mode, whether it&#39;s enabled or not.
virtual bool SetFramePulseReference(const NTV2ReferenceSource inRefSource)
Sets the device&#39;s frame pulse reference source. See Video Output Clocking & Synchronization for more ...
#define NTV2_IS_QUAD_QUAD_STANDARD(__s__)
Definition: ntv2enums.h:216
virtual bool GetDefaultVideoOutMode(ULWord &outMode)
ULWord GetRasterHeight(const bool inVisibleOnly=false) const
virtual bool GetEnableFramePulseReference(bool &outEnabled)
Answers whether or not the device&#39;s current frame pulse reference source is enabled. See Video Output Clocking & Synchronization for more information.
True if device has bypass relays on its SDI connectors.
See KONA LHi.
Definition: ntv2enums.h:79
static const ULWord gChannelToSDIOutControlRegNum[]
static const ULWord gChannelToGlobalControlRegNum[]
virtual bool SetSDITransmitEnable(const NTV2Channel inChannel, const bool inEnable)
Sets the specified bidirectional SDI connector to act as an input or an output.
NTV2ReferenceSource
These enum values identify a specific source for the device&#39;s (output) reference clock.
Definition: ntv2enums.h:1459
std::string NTV2TaskModeToString(const NTV2TaskMode inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6357
virtual bool ReadRegisters(NTV2RegisterReads &inOutValues)
Reads the register(s) specified by the given NTV2RegInfo sequence.
virtual bool FlushGlobalControlWrite(GlobalControlRegWrite *pGlobalControl)
UWord mCRCTallyB
The number of lines having a CRC error was detected in the "A" stream of the SDI link since this tall...
virtual bool SetRP188SourceFilter(const NTV2Channel inSDIInput, const UWord inFilterValue)
Sets the RP188 DBB filter for the given SDI input.
#define INSTP(_p_)
Identifies Ultra-High-Definition (UHD) psf.
Definition: ntv2enums.h:185
1280x720, for 720p, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:364
virtual bool SetRS422Parity(const NTV2Channel inSerialPort, const NTV2_RS422_PARITY inParity)
Sets the parity control on the specified RS422 serial port.
virtual bool GetVANCMode(NTV2VANCMode &outVancMode, const NTV2Channel inChannel=NTV2_CHANNEL1)
Retrieves the current VANC mode for the given FrameStore.
#define NTV2_IS_2K_1080_FRAME_GEOMETRY(geom)
Definition: ntv2enums.h:392
virtual bool ReadAnalogLTCInput(const UWord inLTCInput, RP188_STRUCT &outRP188Data)
Reads the current contents of the device&#39;s analog LTC input registers.
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...
static const ULWord gChannelToRP188ModeShifts[]
Identifies the 3rd SDI video input.
Definition: ntv2enums.h:1275
static const ULWord gChannelToSDIIn3GModeMask[]
virtual bool SetSDIOut2Kx1080Enable(const NTV2Channel inChannel, const bool inIsEnabled)
#define K2_NOMINAL_H
#define K2_NOMINAL_V
ULWord64 mGlobalClockCount
This count is incremented on each 148.xx reference clock.
virtual NTV2VideoFormat GetInputVideoFormat(const NTV2InputSource inVideoSource=NTV2_INPUTSOURCE_SDI1, const bool inIsProgressive=(0))
Returns the video format of the signal that is present on the given input source. ...
std::vector< ULWord > NTV2ULWordVector
An ordered sequence of ULWords.
Disables normal FrameBuffer Y/C value read limiting (NOT RECOMMENDED).
Definition: ntv2enums.h:3787
Describes a video frame for a given video standard or format and pixel format, including the total nu...
True if device supports 25Gbps IP. (New in SDK 18.0)
bool mFrameTRSError
If true, SAV/EAV was missing, or the SDI framer had to realign, or "RX Locked" went inactive...
virtual NTV2VideoFormat GetAnalogInputVideoFormat(void)
Returns the video format of the signal that is present on the device&#39;s analog video input...
static const ULWord gChlToRP188Bits031RegNum[]
True if device has at least one RS-422 serial port, and it (they) can be programmed (for baud rate...
Specifies the SDI In 8 connector.
Definition: ntv2enums.h:1472
static const ULWord gChannelToControlRegNum[]
virtual bool GetSDITRSError(const NTV2Channel inChannel)
else retVal
Definition: ntv2vcam.cpp:1100
NTV2QuarterSizeExpandMode
Definition: ntv2enums.h:2491
NTV2RegisterNumberSet NTV2RegNumSet
A set of distinct NTV2RegisterNumbers.
This is used to atomically perform bank-selected register reads or writes.
static const ULWord gChannelToSDIInputRateShift[]
std::set< ULWord > ULWordSet
A collection of unique ULWord (uint32_t) values.
virtual bool SetSecondaryVideoFormat(NTV2VideoFormat inFormat)
virtual bool GetSDIOutLevelAtoLevelBConversion(const UWord inOutputSpigot, bool &outIsEnabled)
Answers with the device&#39;s current 3G level A to 3G level B conversion setting for the given SDI outpu...
NTV2MixerKeyerInputControl
These enum values identify the Mixer/Keyer foreground and background input control values...
Definition: ntv2enums.h:1781
std::string NTV2VANCModeToString(const NTV2VANCMode inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6509
virtual bool Enable4KDCRGBMode(bool inEnable)
Sets 4K Down Convert RGB mode.
#define NTV2_IS_PSF_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:1020
NTV2RegWrites NTV2RegisterReads
ULWord registerShift
My register shift value to use in a ReadRegister or WriteRegister call.
virtual bool GetInputFrame(const NTV2Channel inChannel, ULWord &outValue)
Answers with the current input frame index number for the given FrameStore. This identifies which par...
virtual bool SetSDIOutputAudioSystem(const NTV2Channel inSDIOutputConnector, const NTV2AudioSystem inAudioSystem)
Sets the device&#39;s NTV2AudioSystem that will provide audio for the given SDI output&#39;s audio embedder...
NTV2Buffer mInRegInfos
NTV2RegInfo array of registers be read/written. The SDK owns this memory.
virtual bool GetMixerVancOutputFromForeground(const UWord inWhichMixer, bool &outIsFromForegroundSource)
Answers whether or not the VANC source for the given mixer/keyer is currently the foreground video...
#define NTV2_IS_3Gb_FORMAT(__f__)
Definition: ntv2enums.h:979
virtual bool GetMixerFGInputControl(const UWord inWhichMixer, NTV2MixerKeyerInputControl &outInputControl)
Returns the current foreground input control value for the given mixer/keyer.
virtual bool GetSDIOutputDS2AudioSystem(const NTV2Channel inSDIOutputConnector, NTV2AudioSystem &outAudioSystem)
Answers with the device&#39;s Audio System that is currently providing audio for the given SDI output&#39;s a...
static const ULWord gChannelToSDIIn6GModeShift[]
virtual bool GetDisabledChannels(NTV2ChannelSet &outChannels)
Answers with the set of channels that are currently disabled.
virtual bool SetVANCShiftMode(NTV2Channel inChannel, NTV2VANCDataShiftMode inMode)
Enables or disables the "VANC Shift Mode" feature for the given channel.
virtual bool GetProgressivePicture(ULWord &outValue)
virtual bool SetMixerCoefficient(const UWord inWhichMixer, const ULWord inMixCoefficient)
Sets the current mix coefficient of the given mixer/keyer.
virtual bool GetAnalogLTCOutClockChannel(const UWord inLTCOutput, NTV2Channel &outChannel)
Answers with the (SDI) output channel that&#39;s providing the clock reference being used by the given de...
#define CVIDINFO(__x__)
virtual bool SetTsiFrameEnable(const bool inIsEnabled, const NTV2Channel inChannel)
Enables or disables SMPTE 425 two-sample interleave (Tsi) frame mode on the device.
virtual bool GetNumberActiveLines(ULWord &outNumActiveLines)
Specifies channel or FrameStore 8 (or the 8th item).
Definition: ntv2enums.h:1370
See KONA HDMI.
Definition: ntv2enums.h:68
Identifies SMPTE HD 2K1080p.
Definition: ntv2enums.h:177
Specifies the PTP source on SFP 1.
Definition: ntv2enums.h:1473
#define HEXN(__x__, __n__)
static const ULWord gChannelToSDIIn3GModeShift[]
#define AJA_UNUSED(_x_)
Definition: types.h:426
virtual NTV2VideoFormat GetReferenceVideoFormat(void)
Returns the video format of the signal that is present on the device&#39;s reference input.
virtual bool GetAnalogLTCInClockChannel(const UWord inLTCInput, NTV2Channel &outChannel)
Answers with the (SDI) input channel that&#39;s providing the clock reference being used by the given dev...
#define BIT_20
Definition: ajatypes.h:525
Specifies channel or FrameStore 2 (or the 2nd item).
Definition: ntv2enums.h:1364
virtual bool AbortMailBoxLock(void)
uint64_t ULWord64
Definition: ajatypes.h:239
Specifies the PCR source on SFP 1.
Definition: ntv2enums.h:1474
#define K2_MAX_V
True if frame buffer sizes are not fixed.
virtual bool GetQuadQuadFrameEnable(bool &outValue, const NTV2Channel inChannel=NTV2_CHANNEL1)
Returns the device&#39;s current "quad-quad" frame mode, whether it&#39;s enabled or not. ...
uint8_t UByte
Definition: ajatypes.h:231
virtual bool GetEnable4KDCPSFInMode(bool &outIsEnabled)
This is used by the CNTV2Card::ReadRegisters function.
static NTV2WidgetID WidgetIDFromTypeAndChannel(const NTV2WidgetType inWidgetType, const NTV2Channel inChannel)
static const ULWord gChlToRP188Bits3263RegNum[]
Specifies the HDMI In 2 connector.
Definition: ntv2enums.h:1477
1920x1080, NTV2_VANCMODE_TALLER
Definition: ntv2enums.h:359
720x486, for NTSC 525i, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:361
virtual bool SetDefaultVideoOutMode(ULWord mode)
virtual ULWord GetCRCErrorCountA(const NTV2Channel inChannel)
virtual bool GetRunningFirmwareTime(UWord &outHours, UWord &outMinutes, UWord &outSeconds)
Reports the (local Pacific) build time of the currently-running firmware.
#define ARFAIL(__x__)
See KONA LHi.
Definition: ntv2enums.h:80
virtual bool SetRegisterWriteMode(const NTV2RegisterWriteMode inValue, const NTV2Channel inFrameStore=NTV2_CHANNEL1)
Sets the FrameStore&#39;s NTV2RegisterWriteMode, which determines when CNTV2Card::SetInputFrame or CNTV2C...
ULWord NTV2DeviceGetNumberFrameBuffers(NTV2DeviceID id, NTV2FrameGeometry fg, NTV2FrameBufferFormat fbf)
static void SleepInMicroseconds(const int32_t inMicroseconds)
Suspends execution of the current thread for a given number of microseconds.
Definition: systemtime.cpp:304
virtual bool SetMultiRasterBypassEnable(const bool inEnable)
#define NTV2_IS_VANCMODE_ON(__v__)
Definition: ntv2enums.h:3814
virtual bool GetDualLinkInputEnable(bool &outIsEnabled)
virtual bool GetSDIInput6GPresent(bool &outValue, const NTV2Channel channel)
virtual ULWord GetCRCErrorCountB(const NTV2Channel inChannel)
static const ULWord gChannelToSDIInputStatusRegNum[]
4096x2160, for 4K, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:373
virtual bool GetSDIOut3GbEnable(const NTV2Channel inChannel, bool &outIsEnabled)
Identifies the 4th SDI video input.
Definition: ntv2enums.h:1276
NTV2Framesize
Kona2/Xena2 specific enums.
Definition: ntv2enums.h:2121
Specifies the PCR source on SFP 2.
Definition: ntv2enums.h:1476
virtual bool GetPulldownMode(NTV2Channel inChannel, bool &outValue)
virtual bool GetMixerBGMatteEnabled(const UWord inWhichMixer, bool &outIsEnabled)
Answers if the given mixer/keyer&#39;s background matte is enabled or not.
virtual bool GetFramePulseReference(NTV2ReferenceSource &outRefSource)
Answers with the device&#39;s current frame pulse reference source.
NTV2FrameGeometry Get4xSizedGeometry(const NTV2FrameGeometry inGeometry)
Definition: ntv2utils.cpp:2328
virtual bool GetProgramStatus(SSC_GET_FIRMWARE_PROGRESS_STRUCT *statusStruct)
8192x4320, for 8K, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:377
virtual bool GetMixerRGBRange(const UWord inWhichMixer, NTV2MixerRGBRange &outRGBRange)
Answers with the given mixer/keyer&#39;s current RGB Range.
static const ULWord gChannelToSDIInput3GStatusRegNum[]
#define NTV2_IS_VALID_CHANNEL(__x__)
Definition: ntv2enums.h:1375
static const ULWord gChannelToSDIInputRateHighShift[]
virtual bool SetMixerVancOutputFromForeground(const UWord inWhichMixer, const bool inFromForegroundSource=(!(0)))
Sets the VANC source for the given mixer/keyer to the foreground video (or not). See the SDI Ancillar...
#define AJA_sERROR(_index_, _expr_)
Definition: debug.h:176
virtual bool GetVideoDACMode(NTV2VideoDACMode &outValue)
Identifies SMPTE HD 1080i or 1080psf.
Definition: ntv2enums.h:171
Identifies Ultra-High-Definition (UHD)
Definition: ntv2enums.h:179
NTV2Mode
Used to identify the mode of a widget_framestore, or the direction of an AutoCirculate stream: either...
Definition: ntv2enums.h:1243
virtual bool SetVideoLimiting(const NTV2VideoLimiting inValue)
Sets the device&#39;s video range limiting mode.
Fractional rate of 30,000 frames per 1,001 seconds.
Definition: ntv2enums.h:423
Identifies the "Legal SDI" mode (Ymax=0x3AC, Cmax=0x3C0)
Definition: ntv2enums.h:3786
virtual bool GetEnable4KDCRGBMode(bool &outIsEnabled)
NTV2InputSource
Identifies a specific video input source.
Definition: ntv2enums.h:1266
Identifies SMPTE SD 625i.
Definition: ntv2enums.h:174
#define ARINFO(__x__)
virtual bool GetDitherFor8BitInputs(const NTV2Channel inChannel, ULWord &outDither)
virtual bool SetVideoVOffset(const int inVOffset, const UWord inOutputSpigot=0)
Adjusts the vertical timing offset, in lines, for the given SDI output connector. ...
#define BIT_21
Definition: ajatypes.h:526
Identifies the 6th SDI video input.
Definition: ntv2enums.h:1278
virtual NTV2FrameRate GetSDIInputRate(const NTV2Channel channel)
True if device has a crosspoint connection ROM (New in SDK 17.0)
virtual bool EnableFramePulseReference(const bool inEnable)
Enables the device&#39;s frame pulse reference select.
NTV2FrameBufferQuality
Definition: ntv2enums.h:2502
virtual bool GetProgressiveTransport(void) const
Definition: ntv2vpid.cpp:332
2048x1080, for 2Kx1080p, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:365
Invalid/uninitialized.
Definition: ntv2enums.h:1802
True if device frame buffer size can be changed.
virtual bool SetForce64(ULWord force64)
Identifies 4K.
Definition: ntv2enums.h:180
bool NTV2DeviceIsDirectAddressable(const NTV2DeviceID inDeviceID)
#define AJA_FALL_THRU
Definition: ajatypes.h:200
virtual bool GetMultiRasterBypassEnable(bool &outEnabled)
void Clear(void)
Resets the struct to its initialized state.
virtual bool GetFrameBufferFormat(NTV2Channel inChannel, NTV2FrameBufferFormat &outValue)
Returns the current frame buffer format for the given FrameStore on the AJA device.
#define DEC(__x__)
NTV2FrameGeometry
Identifies a particular video frame geometry.
Definition: ntv2enums.h:352
720x576, for PAL 625i, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:358
virtual bool SetMixerFGInputControl(const UWord inWhichMixer, const NTV2MixerKeyerInputControl inInputControl)
Sets the foreground input control value for the given mixer/keyer.
virtual NTV2VideoFormat GetAnalogCompositeInputVideoFormat(void)
Returns the video format of the signal that is present on the device&#39;s composite video input...
std::set< NTV2Channel > NTV2ChannelSet
A set of distinct NTV2Channel values.
virtual bool SetVideoDACMode(NTV2VideoDACMode inValue)
virtual bool ProgramMainFlash(const std::string &filePath, const bool forceUpdate=(0), const bool quiet=(0))
The number of analog LTC inputs on the device.
virtual bool Get64BitAutodetect(ULWord *autodetect64)
60 frames per second
Definition: ntv2enums.h:419
virtual bool GetDualLinkOutputEnable(bool &outIsEnabled)
15 frames per second
Definition: ntv2enums.h:432
void Set(const ULWord inDBB=0xFFFFFFFF, const ULWord inLow=0xFFFFFFFF, const ULWord inHigh=0xFFFFFFFF)
Sets my fields from the given DBB, low and high ULWord components.
virtual bool GetRP188Mode(const NTV2Channel inChannel, NTV2_RP188Mode &outMode)
Returns the current RP188 mode – NTV2_RP188_INPUT or NTV2_RP188_OUTPUT – for the given channel...
#define NTV2_IS_QUAD_FRAME_FORMAT(__f__)
Definition: ntv2enums.h:816
Identifies the 7th SDI video input.
Definition: ntv2enums.h:1279
virtual bool GetFrameGeometry(NTV2FrameGeometry &outValue, NTV2Channel inChannel=NTV2_CHANNEL1)
Declares numerous NTV2 utility functions.
virtual bool SetSDIWatchdogTimeout(const ULWord inValue)
Specifies the amount of time that must elapse before the watchdog timer times out.
static const ULWord sSDIXmitEnableMasks[]
virtual CNTV2VPID & SetVPID(const ULWord inData)
Definition: ntv2vpid.h:71
virtual bool GetReference(NTV2ReferenceSource &outRefSource)
Answers with the device&#39;s current clock reference source.
NTV2Buffer mOutBadRegIndexes
Array of UWords containing index numbers of the register writes that failed. The SDK owns this memory...
NTV2Standard Get4xSizedStandard(const NTV2Standard inGeometry, const bool bIs4k=false)
Definition: ntv2utils.cpp:2357
True if device supports 12G routing crosspoints.
bool NTV2DeviceGetVideoFormatFromState_Ex2(NTV2VideoFormat *pOutValue, const NTV2FrameRate inFrameRate, const NTV2FrameGeometry inFrameGeometry, const NTV2Standard inStandard, const ULWord inIsSMPTE372Enabled, const bool inIsProgressivePicture, const bool inIsSquareDivision)
virtual bool DisableChannels(const NTV2ChannelSet &inChannels)
Disables the given FrameStore(s).
Describes the horizontal and vertical size dimensions of a raster, bitmap, frame or image...
static const ULWord gChannelToRP188ModeGCRegisterNum[]
Specifies the SDI In 7 connector.
Definition: ntv2enums.h:1471
std::set< NTV2InputXptID > NTV2InputXptIDSet
A collection of distinct NTV2InputXptID values.
virtual bool SetSDIOutRGBLevelAConversion(const UWord inOutputSpigot, const bool inEnable)
Enables or disables an RGB-over-3G-level-A conversion at the SDI output widget (assuming the AJA devi...
virtual bool WriteVirtualData(const ULWord inTag, const void *inVirtualData, const ULWord inVirtualDataSize)
Writes the block of virtual data.
True if device can perform SDI error checking.
NTV2RegInfo GetRegInfo(const UWord inIndex0=0) const
virtual bool SetAnalogLTCInClockChannel(const UWord inLTCInput, const NTV2Channel inChannel)
Sets the (SDI) input channel that is to provide the clock reference to be used by the given analog LT...
True if the device can handle 4K/UHD video.
Specifies the PTP source on SFP 2.
Definition: ntv2enums.h:1475
The number of RS-422 serial ports on the device.
#define NTV2_IS_QUAD_QUAD_FORMAT(__f__)
Definition: ntv2enums.h:823
virtual bool SetSDIOutLevelAtoLevelBConversion(const UWord inOutputSpigot, const bool inEnable)
Enables or disables 3G level A to 3G level B conversion at the SDI output widget (assuming the AJA de...
720x486, for NTSC 525i and 525p60, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:357
#define NTV2_IS_VANCMODE_TALL(__v__)
Definition: ntv2enums.h:3812
virtual bool WriteAnalogLTCOutput(const UWord inLTCOutput, const RP188_STRUCT &inRP188Data)
Writes the given timecode to the specified analog LTC output register.
ULWord mUnlockTally
The number of times "RX Locked" went inactive since this tally was last reset.
NTV2WidgetID
Definition: ntv2enums.h:2914
static bool MakeRouteROMRegisters(NTV2RegReads &outROMRegisters)
Prepares an initialized, zeroed NTV2RegReads that&#39;s prepared to read all ROM registers from a device...
Identifies high frame-rate 4K.
Definition: ntv2enums.h:182
static const ULWord gChannelToSDIIn12GModeMask[]
NTV2EncodeAsPSF
Definition: ntv2enums.h:2517
uint16_t UWord
Definition: ajatypes.h:234
virtual bool GetSDIInLevelBtoLevelAConversion(const UWord inInputSpigot, bool &outIsEnabled)
Answers with the device&#39;s current 3G level B to 3G level A conversion setting for the given SDI input...
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...
ULWord GetRasterWidth(void) const
virtual bool SetInputVideoSelect(NTV2InputVideoSelect inInputSelect)
virtual bool SetQuadQuadFrameEnable(const bool inValue, const NTV2Channel inChannel=NTV2_CHANNEL1)
Enables or disables "quad-quad" 8K frame mode on the device.
1: Standard/Retail: device configured by AJA ControlPanel, service/daemon, and driver.
#define NTV2_IS_QUAD_FRAME_GEOMETRY(geom)
Definition: ntv2enums.h:389
virtual bool SetLTCEmbeddedOutEnable(const bool inNewValue)
virtual bool GetMixerMatteColor(const UWord inWhichMixer, YCbCr10BitPixel &outYCbCrValue)
Answers with the given mixer/keyer&#39;s current matte color value being used.
Specifies channel or FrameStore 1 (or the first item).
Definition: ntv2enums.h:1363
120 frames per second
Definition: ntv2enums.h:430
True if device can report its running (and not necessarily installed) firmware date.
virtual bool ReadOutputTimingControl(ULWord &outValue, const UWord inOutputSpigot=0)
Returns the current output timing control value for the given SDI output connector.
NTV2VideoLimiting
These enum values identify the available SDI video output limiting modes.
Definition: ntv2enums.h:3784
True if device supports Versal Adaptive SoC System Monitor.
static const ULWord gChannelToRXSDIStatusRegs[]
virtual bool SetAnalogOutHTiming(ULWord inValue)
virtual bool SetInputFrame(const NTV2Channel inChannel, const ULWord inValue)
Sets the input frame index number for the given FrameStore. This identifies which frame in device SDR...
#define ARDBG(__x__)
#define NTV2_IS_TSI_FORMAT(__f__)
Definition: ntv2enums.h:1196
#define xHEX0N(__x__, __n__)
virtual bool SetEnableVANCData(const bool inVANCenabled, const bool inTallerVANC, const NTV2Standard inStandard, const NTV2FrameGeometry inGeometry, const NTV2Channel inChannel=NTV2_CHANNEL1)
NTV2VANCMode
These enum values identify the available VANC modes.
Definition: ntv2enums.h:3803
virtual bool SetSDIInLevelBtoLevelAConversion(const NTV2ChannelSet &inSDIInputs, const bool inEnable)
Enables or disables 3G level B to 3G level A conversion at the SDI input(s).
True if device supports frame pulse source independent of reference source.
25 frames per second
Definition: ntv2enums.h:424
virtual bool GetSDIInputIsProgressive(const NTV2Channel channel)
virtual bool SetDitherFor8BitInputs(const NTV2Channel inChannel, const ULWord inDither)
A convenience class that simplifies encoding or decoding the 4-byte VPID payload that can be read or ...
Definition: ntv2vpid.h:23
virtual bool Enable4KPSFOutMode(bool inEnable)
Sets 4K Down Convert PSF out Mode.
virtual bool GetFrameRate(NTV2FrameRate &outValue, NTV2Channel inChannel=NTV2_CHANNEL1)
Returns the AJA device&#39;s currently configured frame rate via its "value" parameter.
Identifies the 3rd HDMI video input.
Definition: ntv2enums.h:1271
std::string NTV2FrameBufferFormatToString(const NTV2FrameBufferFormat inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:6940
NTV2RegisterWriteMode
These values are used to determine when certain register writes actually take effect. See CNTV2Card::SetRegisterWriteMode or Field/Frame Interrupts.
Definition: ntv2enums.h:1684
virtual bool IsStandardMultiLink4320(void) const
Definition: ntv2vpid.cpp:266
virtual bool IsChannelEnabled(const NTV2Channel inChannel, bool &outEnabled)
Answers whether or not the given FrameStore is enabled.
std::string NTV2MixerKeyerModeToString(const NTV2MixerKeyerMode inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6522
virtual bool SetPulldownMode(NTV2Channel inChannel, bool inValue)
Declares the CNTV2KonaFlashProgram class.
virtual bool GetSDIWatchdogTimeout(ULWord &outValue)
Answers with the amount of time that must elapse before the watchdog timer times out.
Declares the CNTV2Card class.
virtual bool GetSDI2OutHTiming(ULWord *value)
virtual bool IsSDStandard(bool &outIsStandardDef, NTV2Channel inChannel=NTV2_CHANNEL1)
Specifies channel or FrameStore 4 (or the 4th item).
Definition: ntv2enums.h:1366
NTV2VANCDataShiftMode
Definition: ntv2enums.h:3819
Input (capture) mode, which writes into device SDRAM.
Definition: ntv2enums.h:1248
virtual bool Get4kSquaresEnable(bool &outIsEnabled, const NTV2Channel inChannel)
Answers whether the FrameStore bank&#39;s current SMPTE 425 "4K squares" (i.e., "2K quadrants") mode is e...
static const ULWord gChannelToSDIInputProgressiveMask[]
#define BIT_3
Definition: ajatypes.h:508
std::multimap< NTV2InputXptID, NTV2OutputXptID > NTV2PossibleConnections
A map of zero or more one-to-many possible NTV2InputXptID to NTV2OutputXptID connections.
Specifies channel or FrameStore 5 (or the 5th item).
Definition: ntv2enums.h:1367
ULWord NTV2DeviceGetFrameBufferSize(NTV2DeviceID id, NTV2FrameGeometry fg, NTV2FrameBufferFormat fbf)
Identifies the first analog video input.
Definition: ntv2enums.h:1268
The version number of the HDMI chipset on the device.
NTV2Standard GetNTV2StandardFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:2375
virtual bool GetLTCInputPresent(bool &outIsPresent, const UWord inLTCInputNdx=0)
Answers whether or not a valid analog LTC signal is being applied to the device&#39;s analog LTC input co...
virtual bool BankSelectWriteRegister(const NTV2RegInfo &inBankSelect, const NTV2RegInfo &inRegInfo)
Writes the given set of registers to the bank specified at position 0.
virtual bool SetSDIOutputDS2AudioSystem(const NTV2Channel inSDIOutputConnector, const NTV2AudioSystem inAudioSystem)
Sets the Audio System that will supply audio for the given SDI output&#39;s audio embedder for Data Strea...
#define ARWARN(__x__)
NTV2FrameSize & Set(const ULWord w, const ULWord h)
virtual bool GetSDIRelayPosition(NTV2RelayState &outValue, const UWord inIndex0)
Answers if the bypass relays between connectors 1/2 or 3/4 are currently in bypass or routing the sig...
Specifies the HDMI In 4 connector.
Definition: ntv2enums.h:1479
static const ULWord gChannelToSDIInputGeometryShift[]
NTV2MixerRGBRange
Definition: ntv2enums.h:2279
virtual bool SetQuadQuadSquaresEnable(const bool inValue, const NTV2Channel inChannel=NTV2_CHANNEL1)
Enables or disables quad-quad-frame (8K) squares mode on the device.
ULWord fLo
| BG 4 | Secs10 | BG 3 | Secs 1 | BG 2 | Frms10 | BG 1 | Frms 1 |
virtual bool GetFrameBufferQuality(NTV2Channel inChannel, NTV2FrameBufferQuality &outValue)
std::string NTV2OutputCrosspointIDToString(const NTV2OutputCrosspointID inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:5961
virtual bool GetNominalMinMaxHV(int &outNominalH, int &outMinH, int &outMaxH, int &outNominalV, int &outMinV, int &outMaxV)
virtual bool SetFrameBufferQuarterSizeMode(NTV2Channel inChannel, NTV2QuarterSizeExpandMode inValue)
#define BIT_23
Definition: ajatypes.h:528
std::string NTV2VideoLimitingToString(const NTV2VideoLimiting inValue, const bool inCompactDisplay=false)
Definition: ntv2utils.cpp:6549
virtual bool DisableRP188Bypass(const NTV2Channel inSDIOutput)
Configures the SDI output&#39;s embedder to embed SMPTE 12M timecode specified in calls to CNTV2Card::Set...
This is used by the CNTV2Card::ReadSDIStatistics function.
2048x1556, for 2Kx1556psf film format, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:367
static const ULWord gChannelToRP188ModeMasks[]
Specifies channel or FrameStore 6 (or the 6th item).
Definition: ntv2enums.h:1368
static const ULWord gChannelToSDIInputGeometryHighMask[]
#define NTV2_IS_VALID_VIDEOLIMITING(__v__)
Definition: ntv2enums.h:3793
#define NTV2_IS_VALID_VANCMODE(__v__)
Definition: ntv2enums.h:3811
virtual bool IsBufferSizeSetBySW(void)
defined(NTV2_DEPRECATE_17_2)
virtual bool GetFrameBufferQuarterSizeMode(NTV2Channel inChannel, NTV2QuarterSizeExpandMode &outValue)
48 frames per second
Definition: ntv2enums.h:428
std::vector< NTV2RegInfo > NTV2RegisterWrites
Specifies channel or FrameStore 7 (or the 7th item).
Definition: ntv2enums.h:1369
virtual bool SetRS422BaudRate(const NTV2Channel inSerialPort, const NTV2_RS422_BAUD_RATE inBaudRate)
Sets the baud rate of the specified RS422 serial port.
virtual NTV2VideoFormat GetVideoFormat(void) const
Definition: ntv2vpid.cpp:674
NTV2_RS422_BAUD_RATE
These enum values identify RS-422 serial port baud rate configuration.
Definition: ntv2enums.h:4183
virtual bool GetLTCInputEnable(bool &outIsEnabled)
Answers true if the device is currently configured to read analog LTC from the reference input connec...
NTV2RegWrites NTV2RegReads
An ordered sequence of zero or more NTV2RegInfo structs intended for ReadRegister.
virtual ULWord GetSDIUnlockCount(const NTV2Channel inChannel)
24 frames per second
Definition: ntv2enums.h:425
720x576, for PAL 625i, NTV2_VANCMODE_TALLER
Definition: ntv2enums.h:370
virtual bool SetSDIOutputStandard(const UWord inOutputSpigot, const NTV2Standard inValue)
Sets the SDI output spigot&#39;s video standard.
static NTV2WidgetType WidgetIDToType(const NTV2WidgetID inWidgetID)
virtual bool GetTsiFrameEnable(bool &outIsEnabled, const NTV2Channel inChannel)
Returns the current SMPTE 425 two-sample-interleave frame mode on the device, whether it&#39;s enabled or...
Identifies the 1st SDI video input.
Definition: ntv2enums.h:1273
virtual bool GetSDIWatchdogStatus(NTV2RelayState &outValue)
Answers if the watchdog timer would put the SDI relays into NTV2_DEVICE_BYPASSED or NTV2_THROUGH_DEVI...
virtual bool GetAllWidgetOutputs(NTV2OutputXptIDSet &outOutputs)
Returns all my widget output crosspoints.
bool mLocked
If true, a valid SDI transport was detected in the received data stream. If false, at least 15 consecutive lines in the received stream had TRS errors.
Identifies the NTV2AudioWidgetID enumerated type.
virtual bool SetFrameRate(NTV2FrameRate inNewValue, NTV2Channel inChannel=NTV2_CHANNEL1)
Sets the AJA device&#39;s frame rate.
NTV2Buffer mInRegInfos
Read-only array of NTV2RegInfo structs to be set. The SDK owns this memory.
static const ULWord gChannelToSDIIn3GbModeShift[]
virtual bool GetStandard(NTV2Standard &outValue, NTV2Channel inChannel=NTV2_CHANNEL1)
virtual bool SetVANCMode(const NTV2VANCMode inVancMode, const NTV2Channel inChannel=NTV2_CHANNEL1)
Sets the VANC mode for the given FrameStore.
virtual bool SetSDIOut12GEnable(const NTV2Channel inChannel, const bool inEnable)
True if device supports 8K video formats.
#define NTV2_IS_PROGRESSIVE_STANDARD(__s__)
Definition: ntv2enums.h:193
virtual bool SetSDIRelayManualControl(const NTV2RelayState inValue, const UWord inIndex0)
Sets the state of the given connector pair relays to NTV2_DEVICE_BYPASSED (or NTV2_THROUGH_DEVICE if ...
#define NTV2_IS_VALID_NTV2FrameGeometry(__s__)
Definition: ntv2enums.h:384
Specifies the SDI In 5 connector.
Definition: ntv2enums.h:1469
virtual bool GetVideoLimiting(NTV2VideoLimiting &outValue)
Answers with the current video range limiting mode for the device.
ULWord mOutNumFailures
The number of registers unsuccessfully written.
std::set< NTV2OutputXptID > NTV2OutputXptIDSet
A collection of distinct NTV2OutputXptID values.
virtual bool SetMixerFGMatteEnabled(const UWord inWhichMixer, const bool inIsEnabled)
Answers if the given mixer/keyer&#39;s foreground matte is enabled or not.
static bool GetWidgetInputs(const NTV2WidgetID inWidgetID, NTV2InputXptIDSet &outInputs)
Returns the input crosspoints known to be "owned" by the given widget.
ULWord fHi
| BG 8 | Hrs 10 | BG 7 | Hrs 1 | BG 6 | Mins10 | BG 5 | Mins 1 |
virtual bool IsValid(void) const
Definition: ntv2vpid.h:56
NTV2VideoFormat GetQuadSizedVideoFormat(const NTV2VideoFormat inVideoFormat, const bool isSquareDivision=true)
Definition: ntv2utils.cpp:2129
The number of SDI video inputs on the device.
virtual bool SetMixerRGBRange(const UWord inWhichMixer, const NTV2MixerRGBRange inRGBRange)
Sets the RGB range for the given mixer/keyer.
virtual bool GetSDIOut3GEnable(const NTV2Channel inChannel, bool &outIsEnabled)
virtual bool ReadVirtualData(const ULWord inTag, void *outVirtualData, const ULWord inVirtualDataSize)
Reads the block of virtual data for a specific tag.
static const ULWord gChannelToSmpte372Masks[]
static const ULWord gChannelToSmpte372RegisterNum[]
Declares device capability functions.
virtual bool IsRP188BypassEnabled(const NTV2Channel inSDIOutput, bool &outIsBypassEnabled)
Answers if the SDI output&#39;s RP-188 bypass mode is enabled or not.
#define NTV2_IS_VALID_NTV2FrameRate(__r__)
Definition: ntv2enums.h:448
NTV2MixerKeyerMode
These enum values identify the mixer mode.
Definition: ntv2enums.h:1796
This identifies the mode in which there are no VANC lines in the frame buffer.
Definition: ntv2enums.h:3805
virtual bool GetRunningFirmwareDate(UWord &outYear, UWord &outMonth, UWord &outDay)
Reports the (local Pacific) build date of the currently-running firmware.
virtual bool GetRS422BaudRate(const NTV2Channel inSerialPort, NTV2_RS422_BAUD_RATE &outBaudRate)
Answers with the current baud rate of the specified RS422 serial port.
virtual bool GetPCIAccessFrame(const NTV2Channel inChannel, ULWord &outValue)
720x486, for NTSC 525i and 525p60, NTV2_VANCMODE_TALLER
Definition: ntv2enums.h:369
Fractional rate of 24,000 frames per 1,001 seconds.
Definition: ntv2enums.h:426
This is used by the CNTV2Card::WriteRegisters function.
#define NULL
Definition: ntv2vpid.cpp:18
Specifies channel or FrameStore 3 (or the 3rd item).
Definition: ntv2enums.h:1365
virtual bool ReadSDIStatistics(NTV2SDIInStatistics &outStats)
For devices that support it (see the NTV2DeviceCanDoSDIErrorChecks function in "ntv2devicefeatures.h"), this function fetches the SDI statistics for all SDI input spigots.
Input & output routed through device.
Definition: ntv2enums.h:3945
virtual bool GetMixerCoefficient(const UWord inWhichMixer, ULWord &outMixCoefficient)
Returns the current mix coefficient the given mixer/keyer.
virtual bool GetMode(const NTV2Channel inChannel, NTV2Mode &outValue)
Answers with the current NTV2Mode of the given FrameStore on the AJA device.
virtual bool GetSDIOut6GEnable(const NTV2Channel inChannel, bool &outIsEnabled)
virtual bool GetSDIOutRGBLevelAConversion(const UWord inOutputSpigot, bool &outIsEnabled)
Answers with the device&#39;s current RGB-over-3G-level-A conversion at the given SDI output spigot (assu...
static const ULWord gChannelToSDIInputGeometryHighShift[]
virtual bool GetRP188BypassSource(const NTV2Channel inSDIOutput, UWord &outSDIInput)
For the given SDI output that&#39;s in RP188 bypass mode (E-E), answers with the SDI input that&#39;s current...
virtual bool GetBaseAddress(NTV2Channel channel, ULWord **pBaseAddress)
See 8-Bit YCbCr Format.
Definition: ntv2enums.h:227
virtual bool GetSmpte372(ULWord &outValue, NTV2Channel inChannel=NTV2_CHANNEL1)
Returns the device&#39;s current SMPTE-372 (dual-link) mode, whether it&#39;s enabled or not.
virtual bool SetFrameBufferOrientation(const NTV2Channel inChannel, const NTV2FBOrientation inValue)
Sets the frame buffer orientation for the given NTV2Channel.
#define CVIDWARN(__x__)
NTV2FrameGeometry GetNTV2FrameGeometryFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:2644
True if device can simultaneously handle different video formats on more than one SDI input or output...
NTV2DieTempScale
Definition: ntv2enums.h:4216
virtual bool EnableChannel(const NTV2Channel inChannel)
Enables the given FrameStore.
virtual bool SetSDIOut3GbEnable(const NTV2Channel inChannel, const bool inEnable)