AJA NTV2 SDK  18.1.0.2439
NTV2 SDK 18.1.0.2439
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, 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  bool status(false);
1521 
1522  status = ReadRegister (gChannelToGlobalControlRegNum[inSrc], standard, kRegMaskStandard, kRegShiftStandard);
1523  status &= ReadRegister (gChannelToGlobalControlRegNum[inSrc], rate1, kRegMaskFrameRate, kRegShiftFrameRate);
1524  status &= ReadRegister (gChannelToGlobalControlRegNum[inSrc], rate2, kRegMaskFrameRateHiBit, kRegShiftFrameRateHiBit);
1525  status &= ReadRegister (gChannelToSmpte372RegisterNum[inSrc], s372, gChannelToSmpte372Masks[inSrc], gChannelToSmpte372Shifts[inSrc]);
1526  status &= ReadRegister (gChannelToGlobalControlRegNum[inSrc], geometry, kRegMaskGeometry, kRegShiftGeometry);
1527  status &= ReadRegister (kVRegVideoFormatCh1 + inSrc, format);
1528  if (!status) return false;
1529 
1530  for (int channel = inFirst; channel <= inLast; channel++)
1531  {
1532  status = WriteRegister (gChannelToGlobalControlRegNum[channel], standard, kRegMaskStandard, kRegShiftStandard);
1533  status &= WriteRegister (gChannelToGlobalControlRegNum[channel], rate1, kRegMaskFrameRate, kRegShiftFrameRate);
1534  status &= WriteRegister (gChannelToGlobalControlRegNum[channel], rate2, kRegMaskFrameRateHiBit, kRegShiftFrameRateHiBit);
1535  status &= WriteRegister (gChannelToSmpte372RegisterNum[channel], s372, gChannelToSmpte372Masks[channel], gChannelToSmpte372Shifts[channel]);
1536  status &= WriteRegister (gChannelToGlobalControlRegNum[channel], geometry, kRegMaskGeometry, kRegShiftGeometry);
1537  status &= WriteRegister (ULWord(kVRegVideoFormatCh1 + channel), format);
1538  if (!status) return false;
1539  }
1540 
1541  return true;
1542 }
1543 
1544 // Method: SetReference
1545 // Input: NTV2Reference
1546 // Output: NONE
1547 bool CNTV2Card::SetReference (const NTV2ReferenceSource inRefSource, const bool inKeepFramePulseSelect)
1548 {
1549  if (IsSupported(kDeviceCanDoLTCInOnRefPort) && inRefSource == NTV2_REFERENCE_EXTERNAL)
1550  SetLTCInputEnable(false);
1551 
1552  if (IsSupported(kDeviceCanDoFramePulseSelect) && !inKeepFramePulseSelect)
1553  EnableFramePulseReference(false); //Reset this for backwards compatibility
1554 
1555  //this looks slightly unusual but really
1556  //it is a 4 bit counter in 2 different registers
1557  ULWord refControl1 = ULWord(inRefSource), refControl2 = 0, ptpControl = 0;
1558  switch (inRefSource)
1559  {
1560  case NTV2_REFERENCE_INPUT5: refControl1 = 0; refControl2 = 1; break;
1561  case NTV2_REFERENCE_INPUT6: refControl1 = 1; refControl2 = 1; break;
1562  case NTV2_REFERENCE_INPUT7: refControl1 = 2; refControl2 = 1; break;
1563  case NTV2_REFERENCE_INPUT8: refControl1 = 3; refControl2 = 1; break;
1564  case NTV2_REFERENCE_SFP1_PCR: refControl1 = 4; refControl2 = 1; break;
1565  case NTV2_REFERENCE_SFP1_PTP: refControl1 = 4; refControl2 = 1; ptpControl = 1; break;
1566  case NTV2_REFERENCE_SFP2_PCR: refControl1 = 5; refControl2 = 1; break;
1567  case NTV2_REFERENCE_SFP2_PTP: refControl1 = 5; refControl2 = 1; ptpControl = 1; break;
1568  case NTV2_REFERENCE_HDMI_INPUT2: refControl1 = 4; refControl2 = 0; break;
1569  case NTV2_REFERENCE_HDMI_INPUT3: refControl1 = 6; refControl2 = 0; break;
1570  case NTV2_REFERENCE_HDMI_INPUT4: refControl1 = 7; refControl2 = 0; break;
1571  default: break;
1572  }
1573 
1574  if (IsSupported(kDeviceCanDoIP))
1576 
1577  if (GetNumSupported(kDeviceGetNumVideoChannels) > 4 || (IsSupported(kDeviceCanDoIP) || IsSupported(kDeviceCanDo25GIP)) )
1578  WriteRegister (kRegGlobalControl2, refControl2, kRegMaskRefSource2, kRegShiftRefSource2);
1579 
1580  return WriteRegister (kRegGlobalControl, refControl1, kRegMaskRefSource, kRegShiftRefSource);
1581 }
1582 
1583 // Method: GetReference
1584 // Input: NTV2Reference
1585 // Output: NONE
1587 {
1588  ULWord refControl2(0), ptpControl(0);
1590 
1591  if ((GetNumSupported(kDeviceGetNumVideoChannels) > 4 || IsSupported(kDeviceCanDoIP)) && !IsSupported(kDeviceCanDo25GIP))
1592  {
1593  ReadRegister (kRegGlobalControl2, refControl2, kRegMaskRefSource2, kRegShiftRefSource2);
1594  if (refControl2)
1595  switch (outValue)
1596  {
1597  case 0: outValue = NTV2_REFERENCE_INPUT5; break;
1598  case 1: outValue = NTV2_REFERENCE_INPUT6; break;
1599  case 2: outValue = NTV2_REFERENCE_INPUT7; break;
1600  case 3: outValue = NTV2_REFERENCE_INPUT8; break;
1601 
1602  case 4: if (IsSupported(kDeviceCanDoIP))
1604  outValue = ptpControl == 0 ? NTV2_REFERENCE_SFP1_PCR : NTV2_REFERENCE_SFP1_PTP;
1605  break;
1606 
1607  case 5: if (IsSupported(kDeviceCanDoIP))
1609  outValue = ptpControl == 0 ? NTV2_REFERENCE_SFP2_PCR : NTV2_REFERENCE_SFP2_PTP;
1610  break;
1611 
1612  default: break;
1613  }
1614  }
1615 
1616  if (IsSupported(kDeviceCanDo25GIP))
1617  {
1618  result = ReadRegister(kRegLPPTPSFPStatus, ptpControl);
1619  switch (ptpControl)
1620  {
1621  default:
1622  case 0:
1623  outValue = NTV2_REFERENCE_FREERUN;
1624  break;
1625  case 1:
1626  outValue = NTV2_REFERENCE_SFP1_PTP;
1627  break;
1628  case 2:
1629  outValue = NTV2_REFERENCE_SFP2_PTP;
1630  break;
1631  }
1632  }
1633 
1634  if (_boardID == DEVICE_ID_KONAHDMI)
1635  switch (outValue)
1636  {
1637  case 5: outValue = NTV2_REFERENCE_HDMI_INPUT1; break;
1638  case 4: outValue = NTV2_REFERENCE_HDMI_INPUT2; break;
1639  case 6: outValue = NTV2_REFERENCE_HDMI_INPUT3; break;
1640  case 7: outValue = NTV2_REFERENCE_HDMI_INPUT4; break;
1641  default: break;
1642  }
1643 
1644  return result;
1645 }
1646 
1648 {
1649  if (!IsSupported(kDeviceCanDoFramePulseSelect))
1650  return false;
1651 
1652  return WriteRegister (kRegGlobalControl3, enable ? 1 : 0, kRegMaskFramePulseEnable, kRegShiftFramePulseEnable);
1653 }
1654 
1655 
1657 {
1658  if (!IsSupported(kDeviceCanDoFramePulseSelect))
1659  return false;
1660 
1661  ULWord returnValue(0);
1662  bool status = ReadRegister(kRegGlobalControl3, returnValue, kRegMaskFramePulseEnable, kRegShiftFramePulseEnable);
1663  outValue = returnValue == 0 ? false : true;
1664  return status;
1665 }
1666 
1668 {
1669  if (!IsSupported(kDeviceCanDoFramePulseSelect))
1670  return false;
1672 }
1673 
1675 {
1676  ULWord refControl1(0);
1677  if (!IsSupported(kDeviceCanDoFramePulseSelect))
1678  return false;
1679 
1680  bool result (ReadRegister (kRegGlobalControl3, refControl1, kRegMaskFramePulseRefSelect, kRegShiftFramePulseRefSelect));
1681  outValue = NTV2ReferenceSource(refControl1);
1682  return result;
1683 }
1684 
1685 // Method: SetMode
1686 // Input: NTV2Channel, NTV2Mode
1687 // Output: NONE
1688 bool CNTV2Card::SetMode (const NTV2Channel inChannel, const NTV2Mode inValue, const bool inIsRetail)
1689 { (void) inIsRetail;
1690  if (IsMultiRasterWidgetChannel(inChannel))
1691  return inValue == NTV2_MODE_INPUT;
1692  if (IS_CHANNEL_INVALID(inChannel))
1693  return false;
1694  return WriteRegister (gChannelToControlRegNum[inChannel], inValue, kRegMaskMode, kRegShiftMode);
1695 }
1696 
1697 bool CNTV2Card::SetMode (const NTV2ChannelSet & inChannels, const NTV2Mode inMode)
1698 {
1699  size_t errors(0);
1700  for (NTV2ChannelSetConstIter it(inChannels.begin()); it != inChannels.end(); ++it)
1701  if (!SetMode(*it, inMode))
1702  errors++;
1703  return !errors;
1704 }
1705 
1706 bool CNTV2Card::GetMode (const NTV2Channel inChannel, NTV2Mode & outValue)
1707 {
1708  if (IsMultiRasterWidgetChannel(inChannel))
1709  {outValue = NTV2_MODE_INPUT; return true;}
1710  if (IS_CHANNEL_INVALID(inChannel))
1711  return false;
1713 }
1714 
1715 bool CNTV2Card::GetFrameInfo (const NTV2Channel inChannel, NTV2FrameGeometry & outGeometry, NTV2FrameBufferFormat & outFBF)
1716 {
1717  bool status = GetFrameGeometry(outGeometry); // WHY ISN'T inChannel PASSED TO GetFrameGeometry?!?!?!
1718  if ( !status )
1719  return status; // TODO: fix me
1720 
1721  status = GetFrameBufferFormat(inChannel, outFBF);
1722  if ( !status )
1723  return status; // TODO: fix me
1724 
1725  return status;
1726 }
1727 
1728 bool CNTV2Card::IsBufferSizeChangeRequired(NTV2Channel channel, NTV2FrameGeometry currentGeometry, NTV2FrameGeometry newGeometry,
1729  NTV2FrameBufferFormat format)
1730 {
1731  (void) channel;
1732  ULWord currentFrameBufferSize = ::NTV2DeviceGetFrameBufferSize(_boardID,currentGeometry,format);
1733  ULWord requestedFrameBufferSize = ::NTV2DeviceGetFrameBufferSize(_boardID,newGeometry,format);
1734  bool changeBufferSize = IsSupported(kDeviceCanChangeFrameBufferSize) && (currentFrameBufferSize != requestedFrameBufferSize);
1735 
1736  // If software has decreed a frame buffer size, don't try to change it
1737  if (IsBufferSizeSetBySW())
1738  changeBufferSize = false;
1739 
1740  return changeBufferSize;
1741 }
1742 
1743 bool CNTV2Card::IsBufferSizeChangeRequired(NTV2Channel channel, NTV2FrameGeometry geometry,
1744  NTV2FrameBufferFormat currentFormat, NTV2FrameBufferFormat newFormat)
1745 {
1746  (void)channel;
1747 
1748  ULWord currentFrameBufferSize = ::NTV2DeviceGetFrameBufferSize(_boardID,geometry,currentFormat);
1749  ULWord requestedFrameBufferSize = ::NTV2DeviceGetFrameBufferSize(_boardID,geometry,newFormat);
1750  bool changeBufferSize = IsSupported(kDeviceCanChangeFrameBufferSize) && (currentFrameBufferSize != requestedFrameBufferSize);
1751 
1752  // If software has decreed a frame buffer size, don't try to change it
1753  if (IsBufferSizeSetBySW())
1754  changeBufferSize = false;
1755 
1756  return changeBufferSize;
1757 }
1758 
1760 {
1762  return false;
1763 
1764  ULWord swControl(0);
1765  if (!ReadRegister(kRegCh1Control, swControl, kRegMaskFrameSizeSetBySW, kRegShiftFrameSizeSetBySW))
1766  return false;
1767 
1768  return swControl != 0;
1769 }
1770 
1771 #if !defined(NTV2_DEPRECATE_17_2)
1772 bool CNTV2Card::GetFBSizeAndCountFromHW (ULWord & outSize, ULWord & outCount)
1773 {
1774  if (!IsBufferSizeSetBySW())
1775  return false;
1776 
1777  ULWord ch1Control(0), multiplier(0), sizeMultiplier(0);
1778  if (!ReadRegister(kRegCh1Control, ch1Control))
1779  return false;
1780 
1781  ch1Control &= BIT_20 | BIT_21;
1782  switch (ch1Control)
1783  {
1784  default:
1785  case 0: multiplier = 4; // 2MB frame buffers
1786  sizeMultiplier = 2;
1787  break;
1788 
1789  case BIT_20: multiplier = 2; // 4MB
1790  sizeMultiplier = 4;
1791  break;
1792 
1793  case BIT_21: multiplier = 1; // 8MB
1794  sizeMultiplier = 8;
1795  break;
1796 
1797  case BIT_20 | BIT_21: multiplier = 0; // 16MB
1798  sizeMultiplier = 16;
1799  break;
1800  }
1801 
1802  outSize = sizeMultiplier * 1024 * 1024;
1803  outCount = multiplier ? multiplier * DeviceGetNumberFrameBuffers() : DeviceGetNumberFrameBuffers() / 2;
1804 
1806  GetFrameGeometry(geometry);
1807  if (geometry == NTV2_FG_4x1920x1080 || geometry == NTV2_FG_4x2048x1080)
1808  {
1809  outSize *= 4;
1810  outCount /= 4;
1811  }
1812  if (geometry == NTV2_FG_4x3840x2160 || geometry == NTV2_FG_4x4096x2160)
1813  {
1814  outSize *= 16;
1815  outCount /= 16;
1816  }
1817  return true;
1818 }
1819 #endif
1820 
1821 bool CNTV2Card::GetLargestFrameBufferFormatInUse(NTV2FrameBufferFormat & outFBF)
1822 {
1823  NTV2FrameBufferFormat ch1format;
1825 
1826  if ( !GetFrameBufferFormat(NTV2_CHANNEL1, ch1format) )
1827  return false;
1828 
1829  if ( !GetFrameBufferFormat(NTV2_CHANNEL2, ch2format) &&
1830  GetNumSupported(kDeviceGetNumVideoChannels) > 1)
1831  return false;
1832 
1833  NTV2FrameGeometry geometry;
1834  if (!GetFrameGeometry(geometry))
1835  return false;
1836 
1837  ULWord ch1FrameBufferSize = ::NTV2DeviceGetFrameBufferSize(_boardID,geometry,ch1format);
1838  ULWord ch2FrameBufferSize = ::NTV2DeviceGetFrameBufferSize(_boardID,geometry,ch2format);
1839  if ( ch1FrameBufferSize >= ch2FrameBufferSize )
1840  outFBF = ch1format;
1841  else
1842  outFBF = ch2format;
1843  return true;
1844 }
1845 
1846 bool CNTV2Card::IsMultiFormatActive (void)
1847 {
1848  if (!IsSupported(kDeviceCanDoMultiFormat))
1849  return false;
1850 
1851  bool isEnabled = false;
1852  if (!GetMultiFormatMode (isEnabled))
1853  return false;
1854 
1855  return isEnabled;
1856 }
1857 
1859 {
1860  outConnections.clear();
1861  if (!IsSupported(kDeviceHasXptConnectROM))
1862  return false;
1863 
1864  NTV2RegReads ROMregs;
1866  && ReadRegisters(ROMregs)
1867  && CNTV2SignalRouter::GetPossibleConnections(ROMregs, outConnections);
1868 }
1869 
1871 {
1872  outInputs.clear();
1873  const ULWordSet widgetIDs (GetSupportedItems(kNTV2EnumsID_WidgetID));
1874 
1875  for (ULWordSetConstIter iter(widgetIDs.begin()); iter != widgetIDs.end (); ++iter)
1876  {
1877  const NTV2WidgetID wgtID(NTV2WidgetID(*iter + 0));
1878  NTV2InputXptIDSet inputs;
1879  CNTV2SignalRouter::GetWidgetInputs (wgtID, inputs);
1880  for (NTV2InputXptIDSetConstIter it(inputs.begin()); it != inputs.end(); ++it)
1881  {
1883  if (!IsSupported(kDeviceCanDo425Mux))
1884  if (!IsSupported(kDeviceCanDo8KVideo))
1885  if (::NTV2InputCrosspointIDToString(*it, false).find("DS2") != string::npos) // is DS2 input?
1886  continue; // do not include FrameStore DS2 inputs for IP25G
1887  outInputs.insert(*it);
1888  }
1889  }
1890  return true;
1891 }
1892 
1894 {
1895  outOutputs.clear();
1896  const ULWordSet widgetIDs (GetSupportedItems(kNTV2EnumsID_WidgetID));
1897 
1898  for (ULWordSetConstIter iter(widgetIDs.begin()); iter != widgetIDs.end (); ++iter)
1899  {
1900  const NTV2WidgetID wgtID(NTV2WidgetID(*iter + 0));
1901  NTV2OutputXptIDSet outputs;
1902  CNTV2SignalRouter::GetWidgetOutputs (wgtID, outputs);
1903  for (NTV2OutputXptIDSetConstIter it(outputs.begin()); it != outputs.end(); ++it)
1904  {
1906  if (!IsSupported(kDeviceCanDo425Mux))
1907  if (!IsSupported(kDeviceCanDo8KVideo))
1908  if (::NTV2OutputCrosspointIDToString(*it, false).find("DS2") != string::npos) // is DS2 output?
1909  continue; // do not include FrameStore DS2 outputs for IP25G
1910  outOutputs.insert(*it);
1911  }
1912  }
1913  return true;
1914 }
1915 
1917 
1918 // Method: SetFrameBufferFormat
1919 // Input: NTV2Channel, NTV2FrameBufferFormat
1920 // Output: NONE
1921 bool CNTV2Card::SetFrameBufferFormat (NTV2Channel inChannel, NTV2FrameBufferFormat inNewFormat, bool inIsRetailMode,
1922  NTV2HDRXferChars inXferChars, NTV2HDRColorimetry inColorimetry, NTV2HDRLuminance inLuminance)
1923 { (void) inIsRetailMode;
1924 
1925  if (IsMultiRasterWidgetChannel(inChannel))
1926  return inNewFormat == NTV2_FBF_8BIT_YCBCR;
1927  if (IS_CHANNEL_INVALID(inChannel))
1928  return false;
1929 
1930  const ULWord regNum (gChannelToControlRegNum[inChannel]);
1931  const ULWord loValue (inNewFormat & 0x0f);
1932  const ULWord hiValue ((inNewFormat & 0x10) >> 4);
1933  NTV2FrameGeometry currentGeometry (NTV2_FG_INVALID);
1934  NTV2FrameBufferFormat currentFormat (NTV2_FBF_INVALID); // save for call to IsBufferSizeChangeRequired below
1935  bool status = GetFrameInfo(inChannel, currentGeometry, currentFormat);
1936  if (!status)
1937  return status;
1938 
1939  // Set channel control register FBF bits 1,2,3,4,6...
1940  status = WriteRegister (regNum, loValue, kRegMaskFrameFormat, kRegShiftFrameFormat)
1941  && WriteRegister (regNum, hiValue, kRegMaskFrameFormatHiBit, kRegShiftFrameFormatHiBit);
1942 
1943 #if !defined(NTV2_DEPRECATE_17_2)
1944  // If software set the frame buffer size, read the values from hardware
1945  if ( !GetFBSizeAndCountFromHW(_ulFrameBufferSize, _ulNumFrameBuffers) &&
1946  IsBufferSizeChangeRequired(inChannel, currentGeometry, currentFormat, inNewFormat) )
1947  {
1948  _ulFrameBufferSize = ::NTV2DeviceGetFrameBufferSize(_boardID,currentGeometry, inNewFormat);
1949  _ulNumFrameBuffers = ::NTV2DeviceGetNumberFrameBuffers(_boardID,currentGeometry, inNewFormat);
1950  }
1951 #endif
1952 
1953  if (status)
1954  {if (inNewFormat != currentFormat)
1955  CVIDINFO("'" << GetDisplayName() << "': Channel " << DEC(UWord(inChannel)+1) << " FBF changed from "
1956  << ::NTV2FrameBufferFormatToString(currentFormat) << " to " << ::NTV2FrameBufferFormatToString(inNewFormat));}
1957  else
1958  CVIDFAIL("'" << GetDisplayName() << "': Failed to change channel " << DEC(UWord(inChannel)+1) << " FBF from "
1959  << ::NTV2FrameBufferFormatToString(currentFormat) << " to " << ::NTV2FrameBufferFormatToString(inNewFormat));
1960 
1961  SetVPIDTransferCharacteristics(inXferChars, inChannel);
1962  SetVPIDColorimetry(inColorimetry, inChannel);
1963  SetVPIDLuminance(inLuminance, inChannel);
1964  return status;
1965 }
1966 
1968  const NTV2FrameBufferFormat inNewFormat,
1969  const bool inIsAJARetail,
1970  const NTV2HDRXferChars inXferChars,
1971  const NTV2HDRColorimetry inColorimetry,
1972  const NTV2HDRLuminance inLuminance)
1973 {
1974  UWord failures(0);
1975  for (NTV2ChannelSetConstIter it(inFrameStores.begin()); it != inFrameStores.end(); ++it)
1976  if (!SetFrameBufferFormat (*it, inNewFormat, inIsAJARetail, inXferChars, inColorimetry, inLuminance))
1977  failures++;
1978  return failures == 0;
1979 }
1980 
1981 // Method: GetFrameBufferFormat
1982 // Input: NTV2Channel
1983 // Output: NTV2FrameBufferFormat
1985 {
1986  if (IsMultiRasterWidgetChannel(inChannel))
1987  {outValue = NTV2_FBF_8BIT_YCBCR; return true;}
1988  if (IS_CHANNEL_INVALID (inChannel))
1989  return false;
1990 
1991  ULWord returnVal1, returnVal2;
1992  bool result1 = ReadRegister (gChannelToControlRegNum[inChannel], returnVal1, kRegMaskFrameFormat, kRegShiftFrameFormat);
1993  bool result2 = ReadRegister (gChannelToControlRegNum[inChannel], returnVal2, kRegMaskFrameFormatHiBit, kRegShiftFrameFormatHiBit);
1994 
1995  outValue = NTV2FrameBufferFormat((returnVal1 & 0x0f) | ((returnVal2 & 0x1) << 4));
1996  return result1 && result2;
1997 }
1998 
1999 // Method: SetFrameBufferQuarterSizeMode
2000 // Input: NTV2Channel, NTV2K2QuarterSizeExpandMode
2001 // Output: NONE
2003 {
2004  if (IS_CHANNEL_INVALID (channel))
2005  return false;
2006  return WriteRegister (gChannelToControlRegNum [channel], value, kRegMaskQuarterSizeMode, kRegShiftQuarterSizeMode);
2007 }
2008 
2009 // Method: GetFrameBufferQuarterSizeMode
2010 // Input: NTV2Channel
2011 // Output: NTV2K2QuarterSizeExpandMode
2013 {
2014  if (IS_CHANNEL_INVALID (inChannel))
2015  return false;
2017 }
2018 
2019 // Method: SetFrameBufferQuality - currently used for ProRes compressed buffers
2020 // Input: NTV2Channel, NTV2K2FrameBufferQuality
2021 // Output: NONE
2023 {
2024  if (IS_CHANNEL_INVALID (channel))
2025  return false;
2026  // note buffer quality is split between bit 17 (lo), 25-26 (hi)
2027  ULWord loValue = quality & 0x1;
2028  ULWord hiValue = (quality >> 1) & 0x3;
2029  return WriteRegister (gChannelToControlRegNum [channel], loValue, kRegMaskQuality, kRegShiftQuality) &&
2030  WriteRegister (gChannelToControlRegNum [channel], hiValue, kRegMaskQuality2, kRegShiftQuality2);
2031 }
2032 
2033 // Method: GetFrameBufferQuality - currently used for ProRes compressed buffers
2034 // Input: NTV2Channel
2035 // Output: NTV2K2FrameBufferQuality
2037 {
2038  if (IS_CHANNEL_INVALID (inChannel))
2039  return false;
2040  outQuality = NTV2_FBQualityInvalid;
2041  // note buffer quality is split between bit 17 (lo), 25-26 (hi)
2042  ULWord loValue(0), hiValue(0);
2043  if (ReadRegister (gChannelToControlRegNum [inChannel], loValue, kRegMaskQuality, kRegShiftQuality) &&
2044  ReadRegister (gChannelToControlRegNum [inChannel], hiValue, kRegMaskQuality2, kRegShiftQuality2))
2045  {
2046  outQuality = NTV2FrameBufferQuality(loValue + ((hiValue & 0x3) << 1));
2047  return true;
2048  }
2049  return false;
2050 }
2051 
2052 
2053 // Method: SetEncodeAsPSF - currently used for ProRes compressed buffers
2054 // Input: NTV2Channel, NTV2K2FrameBufferQuality
2055 // Output: NONE
2057 {
2058  if (IS_CHANNEL_INVALID (channel))
2059  return false;
2060  return WriteRegister (gChannelToControlRegNum [channel], value, kRegMaskEncodeAsPSF, kRegShiftEncodeAsPSF);
2061 }
2062 
2063 // Method: GetEncodeAsPSF - currently used for ProRes compressed buffers
2064 // Input: NTV2Channel
2065 // Output: NTV2K2FrameBufferQuality
2067 {
2068  if (IS_CHANNEL_INVALID (inChannel))
2069  return false;
2071 }
2072 
2073 // Method: SetFrameBufferOrientation
2074 // Input: NTV2Channel, NTV2VideoFrameBufferOrientation
2075 // Output: NONE
2077 {
2078  if (IsMultiRasterWidgetChannel(inChannel))
2079  return inValue == NTV2_FRAMEBUFFER_ORIENTATION_NORMAL;
2080  if (IS_CHANNEL_INVALID(inChannel))
2081  return false;
2082  return WriteRegister (gChannelToControlRegNum[inChannel], inValue, kRegMaskFrameOrientation, kRegShiftFrameOrientation);
2083 }
2084 
2085 // Method: GetFrameBufferOrientation
2086 // Input: NTV2Channel
2087 // Output: NTV2VideoFrameBufferOrientation
2089 {
2090  if (IsMultiRasterWidgetChannel(inChannel))
2091  {outValue = NTV2_FRAMEBUFFER_ORIENTATION_NORMAL; return true;}
2092  if (IS_CHANNEL_INVALID (inChannel))
2093  return false;
2095 }
2096 
2097 
2099 {
2100  ULWord swCanChgFBSize(0);
2101  if (!GetBoolParam(kDeviceSoftwareCanChangeFrameBufferSize, swCanChgFBSize) || !swCanChgFBSize)
2102  return false;
2103 
2104  ULWord reg1Contents(0);
2105  if (!ReadRegister(kRegCh1Control, reg1Contents))
2106  return false;
2107 
2108  reg1Contents |= kRegMaskFrameSizeSetBySW;
2109  reg1Contents &= ~kK2RegMaskFrameSize;
2110  reg1Contents |= ULWord(inSize) << kK2RegShiftFrameSize;
2111  if (!WriteRegister(kRegCh1Control, reg1Contents))
2112  return false;
2113 #if !defined(NTV2_DEPRECATE_17_2)
2114  return GetFBSizeAndCountFromHW(_ulFrameBufferSize, _ulNumFrameBuffers);
2115 #else//NTV2_DEPRECATE_17_2
2116  return true;
2117 #endif//defined(NTV2_DEPRECATE_17_2)
2118 }
2119 
2120 // Method: SetFrameBufferSize
2121 // Input: NTV2Channel, NTV2K2Framesize
2122 // Output: NONE
2123 bool CNTV2Card::SetFrameBufferSize (const NTV2Channel inChannel, const NTV2Framesize inValue)
2124 {
2125  if (IS_CHANNEL_INVALID(inChannel))
2126  return false;
2127 #if defined (NTV2_ALLOW_2MB_FRAMES)
2128  ULWord supports2m (0);
2130  if(supports2m == 1)
2131  {
2132  ULWord value2M (0);
2133  switch(inValue)
2134  {
2135  case NTV2_FRAMESIZE_2MB: value2M = 1; break;
2136  case NTV2_FRAMESIZE_4MB: value2M = 2; break;
2137  case NTV2_FRAMESIZE_6MB: value2M = 3; break;
2138  case NTV2_FRAMESIZE_8MB: value2M = 4; break;
2139  case NTV2_FRAMESIZE_10MB: value2M = 5; break;
2140  case NTV2_FRAMESIZE_12MB: value2M = 6; break;
2141  case NTV2_FRAMESIZE_14MB: value2M = 7; break;
2142  case NTV2_FRAMESIZE_16MB: value2M = 8; break;
2143  case NTV2_FRAMESIZE_18MB: value2M = 9; break;
2144  case NTV2_FRAMESIZE_20MB: value2M = 10; break;
2145  case NTV2_FRAMESIZE_22MB: value2M = 11; break;
2146  case NTV2_FRAMESIZE_24MB: value2M = 12; break;
2147  case NTV2_FRAMESIZE_26MB: value2M = 13; break;
2148  case NTV2_FRAMESIZE_28MB: value2M = 14; break;
2149  case NTV2_FRAMESIZE_30MB: value2M = 15; break;
2150  case NTV2_FRAMESIZE_32MB: value2M = 16; break;
2151  default: return false;
2152  }
2153  return WriteRegister(gChannelTo2MFrame [NTV2_CHANNEL1], value2M, kRegMask2MFrameSize, kRegShift2MFrameSupport);
2154  }
2155  else
2156 #endif // defined (NTV2_ALLOW_2MB_FRAMES)
2157  if (inValue == NTV2_FRAMESIZE_2MB || inValue == NTV2_FRAMESIZE_4MB || inValue == NTV2_FRAMESIZE_8MB || inValue == NTV2_FRAMESIZE_16MB)
2159  return false;
2160 }
2161 
2162 // Method: GetK2FrameBufferSize
2163 // Input: NTV2Channel
2164 // Output: NTV2K2Framesize
2165 bool CNTV2Card::GetFrameBufferSize (const NTV2Channel inChannel, NTV2Framesize & outValue)
2166 {
2167  outValue = NTV2_FRAMESIZE_INVALID;
2168  if (!NTV2_IS_VALID_CHANNEL (inChannel))
2169  return false;
2170 #if defined (NTV2_ALLOW_2MB_FRAMES)
2171  ULWord supports2m (0);
2173  if(supports2m == 1)
2174  {
2175  ULWord frameSize (0);
2176  ReadRegister(gChannelTo2MFrame[inChannel], &frameSize, kRegMask2MFrameSize, kRegShift2MFrameSize);
2177  if (frameSize)
2178  {
2179  switch (frameSize)
2180  {
2181  case 1: outValue = NTV2_FRAMESIZE_2MB; break;
2182  case 2: outValue = NTV2_FRAMESIZE_4MB; break;
2183  case 3: outValue = NTV2_FRAMESIZE_6MB; break;
2184  case 4: outValue = NTV2_FRAMESIZE_8MB; break;
2185  case 5: outValue = NTV2_FRAMESIZE_10MB; break;
2186  case 6: outValue = NTV2_FRAMESIZE_12MB; break;
2187  case 7: outValue = NTV2_FRAMESIZE_14MB; break;
2188  case 8: outValue = NTV2_FRAMESIZE_16MB; break;
2189  case 9: outValue = NTV2_FRAMESIZE_18MB; break;
2190  case 10: outValue = NTV2_FRAMESIZE_20MB; break;
2191  case 11: outValue = NTV2_FRAMESIZE_22MB; break;
2192  case 12: outValue = NTV2_FRAMESIZE_24MB; break;
2193  case 13: outValue = NTV2_FRAMESIZE_26MB; break;
2194  case 14: outValue = NTV2_FRAMESIZE_28MB; break;
2195  case 15: outValue = NTV2_FRAMESIZE_30MB; break;
2196  case 16: outValue = NTV2_FRAMESIZE_32MB; break;
2197  default: return false;
2198  }
2199  NTV2_ASSERT (NTV2_IS_8MB_OR_16MB_FRAMESIZE(outValue));
2200  return true;
2201  }
2202  }
2203 #endif // defined (NTV2_ALLOW_2MB_FRAMES)
2205 }
2206 
2207 
2209 {
2210  if (IsMultiRasterWidgetChannel(inChannel))
2211  return SetMultiRasterBypassEnable(false);
2212  return NTV2_IS_VALID_CHANNEL(inChannel)
2213  && WriteRegister (gChannelToControlRegNum [inChannel], ULWord (true), kRegMaskChannelDisable, kRegShiftChannelDisable);
2214 
2215 } // DisableChannel
2216 
2217 
2219 { UWord failures(0);
2220  for (NTV2ChannelSetConstIter it(inChannels.begin()); it != inChannels.end(); ++it)
2221  if (!DisableChannel(*it))
2222  failures++;
2223  return !failures;
2224 
2225 } // DisableChannels
2226 
2227 
2229 {
2230  if (IsMultiRasterWidgetChannel(inChannel))
2231  return SetMultiRasterBypassEnable(true);
2232  return NTV2_IS_VALID_CHANNEL(inChannel)
2233  && WriteRegister (gChannelToControlRegNum[inChannel], ULWord(false), kRegMaskChannelDisable, kRegShiftChannelDisable);
2234 
2235 } // EnableChannel
2236 
2237 
2238 bool CNTV2Card::EnableChannels (const NTV2ChannelSet & inChannels, const bool inDisableOthers)
2239 { UWord failures(0);
2240  for (NTV2Channel chan(NTV2_CHANNEL1); chan < NTV2Channel(GetNumSupported(kDeviceGetNumFrameStores)); chan = NTV2Channel(chan+1))
2241  if (inChannels.find(chan) != inChannels.end())
2242  {
2243  if (!EnableChannel(chan))
2244  failures++;
2245  }
2246  else if (inDisableOthers)
2247  DisableChannel(chan);
2248  return !failures;
2249 
2250 } // EnableChannels
2251 
2252 
2253 bool CNTV2Card::IsChannelEnabled (const NTV2Channel inChannel, bool & outEnabled)
2254 {
2255  bool disabled (false);
2256  if (IsMultiRasterWidgetChannel(inChannel))
2257  return GetMultiRasterBypassEnable(outEnabled);
2258  if (IS_CHANNEL_INVALID(inChannel))
2259  return false;
2261  return false;
2262  outEnabled = disabled ? false : true;
2263  return true;
2264 } // IsChannelEnabled
2265 
2266 
2268 {
2269  UWord failures(0);
2270  bool enabled(false);
2271  outChannels.clear();
2272  for (NTV2Channel ch(NTV2_CHANNEL1); ch < NTV2Channel(GetNumSupported(kDeviceGetNumFrameStores)); ch = NTV2Channel(ch+1))
2273  if (!IsChannelEnabled (ch, enabled))
2274  failures++;
2275  else if (enabled)
2276  outChannels.insert(ch);
2277  return !failures;
2278 }
2279 
2280 
2282 {
2283  UWord failures(0);
2284  bool enabled(false);
2285  outChannels.clear();
2286  for (NTV2Channel ch(NTV2_CHANNEL1); ch < NTV2Channel(GetNumSupported(kDeviceGetNumFrameStores)); ch = NTV2Channel(ch+1))
2287  if (!IsChannelEnabled (ch, enabled))
2288  failures++;
2289  else if (!enabled)
2290  outChannels.insert(ch);
2291  return !failures;
2292 }
2293 
2294 #if !defined(NTV2_DEPRECATE_16_2)
2295  bool CNTV2Card::SetPCIAccessFrame (const NTV2Channel inChannel, const ULWord inValue, const bool inWaitForVBI)
2296  {
2297  if (IS_CHANNEL_INVALID(inChannel))
2298  return false;
2299  const bool result (WriteRegister (gChannelToPCIAccessFrameRegNum[inChannel], inValue));
2300  if (inWaitForVBI)
2301  WaitForOutputVerticalInterrupt (inChannel);
2302  return result;
2303  }
2304 
2305  bool CNTV2Card::GetPCIAccessFrame (const NTV2Channel inChannel, ULWord & outValue)
2306  {
2307  return !IS_CHANNEL_INVALID(inChannel)
2308  && ReadRegister (gChannelToPCIAccessFrameRegNum[inChannel], outValue);
2309  }
2310 
2312  {
2313  ULWord nextFrm(0), outFrm(0);
2314  return !IS_CHANNEL_INVALID(inCh)
2315  && ReadRegister(gChannelToPCIAccessFrameRegNum[inCh], nextFrm) // GetPCIAccessFrame(inCh, nextFrm)
2316  && GetOutputFrame(inCh, outFrm)
2317  && SetOutputFrame(inCh, nextFrm)
2318  && WriteRegister(gChannelToPCIAccessFrameRegNum[inCh], outFrm) && WaitForOutputVerticalInterrupt(inCh); // SetPCIAccessFrame(inCh, outFrm);
2319  }
2320 #endif // !defined (NTV2_DEPRECATE_16_2)
2321 
2322 bool CNTV2Card::SetOutputFrame (const NTV2Channel inChannel, const ULWord value)
2323 {
2324  if (IsMultiRasterWidgetChannel(inChannel))
2325  return false;
2326  if (IS_CHANNEL_INVALID(inChannel))
2327  return false;
2328  return WriteRegister (gChannelToOutputFrameRegNum [inChannel], value);
2329 }
2330 
2331 bool CNTV2Card::GetOutputFrame (const NTV2Channel inChannel, ULWord & outValue)
2332 {
2333  if (IsMultiRasterWidgetChannel(inChannel))
2334  {outValue = 0; return false;}
2335  if (IS_CHANNEL_INVALID(inChannel))
2336  return false;
2337  return ReadRegister (gChannelToOutputFrameRegNum [inChannel], outValue);
2338 }
2339 
2340 bool CNTV2Card::SetInputFrame (const NTV2Channel inChannel, const ULWord value)
2341 {
2342  if (IsMultiRasterWidgetChannel(inChannel))
2343  return WriteRegister(kRegMROutControl, value, kRegMaskMRFrameLocation, kRegShiftMRFrameLocation);
2344  if (IS_CHANNEL_INVALID(inChannel))
2345  return false;
2346  return WriteRegister (gChannelToInputFrameRegNum [inChannel], value);
2347 }
2348 
2349 bool CNTV2Card::GetInputFrame (const NTV2Channel inChannel, ULWord & outValue)
2350 {
2351  if (IsMultiRasterWidgetChannel(inChannel))
2352  return ReadRegister(kRegMROutControl, outValue, kRegMaskMRFrameLocation, kRegShiftMRFrameLocation);
2353  if (IS_CHANNEL_INVALID(inChannel))
2354  return false;
2355  return ReadRegister (gChannelToInputFrameRegNum[inChannel], outValue);
2356 }
2357 
2358 bool CNTV2Card::ReadLineCount (ULWord & outValue, const NTV2Channel inChannel)
2359 {
2360  outValue = 0;
2361  return inChannel == NTV2_CHANNEL1 && ReadRegister (kRegLineCount, outValue);
2362 }
2363 
2364 // Determine if Xilinx programmed
2365 // Input: NONE
2366 // Output: ULWord or equivalent(i.e. ULWord).
2368 {
2369  ULWord programFlashValue(0);
2370  return ReadRegister (kRegFlashProgramReg, programFlashValue) && ((programFlashValue & BIT(9)) == BIT(9));
2371 }
2372 
2374 {
2375  ULWord totalSize = 0;
2376  ULWord totalProgress = 0;
2377  ULWord state = kProgramStateFinished;
2378  ReadRegister(kVRegFlashSize, totalSize);
2379  ReadRegister(kVRegFlashStatus, totalProgress);
2380  ReadRegister(kVRegFlashState, state);
2381  statusStruct->programTotalSize = totalSize;
2382  statusStruct->programProgress = totalProgress;
2383  statusStruct->programState = ProgramState(state);
2384  return true;
2385 }
2386 
2387 #if !defined(NTV2_DEPRECATE_18_1)
2388  bool CNTV2Card::ProgramMainFlash (const string & inFileName, const bool bInForceUpdate, const bool bInQuiet)
2389  {
2390  CNTV2KonaFlashProgram devFlasher(*this);
2391  if (bInQuiet)
2392  devFlasher.SetQuietMode();
2393  ostringstream msgs;
2394  string progResults;
2395  const bool ok(devFlasher.SetBitFile(inFileName, msgs, MAIN_FLASHBLOCK));
2396 #if 0 // IP10G purge
2397  if (bInForceUpdate)
2398  devFlasher.SetMBReset();
2399 #endif
2400  if (ok)
2401  progResults = devFlasher.Program(false);
2402  else
2403  {AJA_sERROR(AJA_DebugUnit_UserGeneric, INSTP(this) << "::" << AJAFUNC << ": " << msgs.str()); return false;}
2404  if (!progResults.empty())
2405  AJA_sERROR(AJA_DebugUnit_UserGeneric, INSTP(this) << "::" << AJAFUNC << ": " << progResults);
2406  return progResults.empty();
2407  }
2408 #endif
2409 
2411 {
2412  outRevision = 0;
2413  if (!IsOpen())
2414  return false; // Not open
2415  if (!IsSupported(kDeviceCanDoIP))
2416  return false; // No MicroBlaze
2417  return false; // IP10G purge // ReadRegister(kRegSarekPackageVersion + SAREK_REGS, outRevision);
2418 }
2419 
2421 {
2422  outRevision = 0;
2423  if (!IsOpen())
2424  return false;
2425 
2426  uint32_t regValue (0);
2427  if (!ReadRegister (kRegDMAControl, regValue))
2428  return false;
2429 
2430  outRevision = uint16_t((regValue & 0x0000FF00) >> 8);
2431  return true;
2432 }
2433 
2434 bool CNTV2Card::GetRunningFirmwareDate (UWord & outYear, UWord & outMonth, UWord & outDay)
2435 {
2436  outYear = outMonth = outDay = 0;
2437  if (!IsSupported(kDeviceCanReportRunningFirmwareDate))
2438  return false;
2439 
2440  uint32_t regValue (0);
2441  if (!ReadRegister(kRegBitfileDate, regValue))
2442  return false;
2443 
2444  const UWord yearBCD ((regValue & 0xFFFF0000) >> 16); // Year number in BCD
2445  const UWord monthBCD ((regValue & 0x0000FF00) >> 8); // Month number in BCD
2446  const UWord dayBCD (regValue & 0x000000FF); // Day number in BCD
2447 
2448  outYear = ((yearBCD & 0xF000) >> 12) * 1000
2449  + ((yearBCD & 0x0F00) >> 8) * 100
2450  + ((yearBCD & 0x00F0) >> 4) * 10
2451  + (yearBCD & 0x000F);
2452 
2453  outMonth = ((monthBCD & 0x00F0) >> 4) * 10 + (monthBCD & 0x000F);
2454 
2455  outDay = ((dayBCD & 0x00F0) >> 4) * 10 + (dayBCD & 0x000F);
2456 
2457  return outYear > 2010
2458  && outMonth > 0 && outMonth < 13
2459  && outDay > 0 && outDay < 32; // If the date's valid, then it's supported; otherwise, it ain't
2460 }
2461 
2462 
2463 bool CNTV2Card::GetRunningFirmwareTime (UWord & outHours, UWord & outMinutes, UWord & outSeconds)
2464 {
2465  outHours = outMinutes = outSeconds = 0;
2466  if (!IsSupported(kDeviceCanReportRunningFirmwareDate))
2467  return false;
2468 
2469  uint32_t regValue (0);
2470  if (!ReadRegister(kRegBitfileTime, regValue))
2471  return false;
2472 
2473  const UWord hoursBCD ((regValue & 0x00FF0000) >> 16); // Hours number in BCD
2474  const UWord minutesBCD ((regValue & 0x0000FF00) >> 8); // Minutes number in BCD
2475  const UWord secondsBCD (regValue & 0x000000FF); // Seconds number in BCD
2476 
2477  outHours = ((hoursBCD & 0x00F0) >> 4) * 10 + (hoursBCD & 0x000F);
2478 
2479  outMinutes = ((minutesBCD & 0x00F0) >> 4) * 10 + (minutesBCD & 0x000F);
2480 
2481  outSeconds = ((secondsBCD & 0x00F0) >> 4) * 10 + (secondsBCD & 0x000F);
2482 
2483  return outHours < 24 && outMinutes < 60 && outSeconds < 60; // If the time's valid, then it's supported; otherwise, it ain't
2484 }
2485 
2486 
2487 bool CNTV2Card::GetRunningFirmwareDate (std::string & outDate, std::string & outTime)
2488 {
2489  outDate = outTime = string();
2490  UWord yr(0), mo(0), dy(0), hr(0), mn(0), sec(0);
2491  if (!GetRunningFirmwareDate (yr, mo, dy))
2492  return false;
2493  if (!GetRunningFirmwareTime (hr, mn, sec))
2494  return false;
2495 
2496  ostringstream date, time;
2497  date << DEC0N(yr,4) << "/" << DEC0N(mo,2) << "/" << DEC0N(dy,2);
2498  time << DEC0N(hr,2) << ":" << DEC0N(mn,2) << ":" << DEC0N(sec,2);
2499 
2500  outDate = date.str();
2501  outTime = time.str();
2502  return true;
2503 }
2504 
2505 
2507 {
2508  outUserID = 0;
2509  if (!IsOpen())
2510  return false;
2511 
2512  ULWord regValue (0);
2513  if (!ReadRegister (kRegFirmwareUserID, regValue))
2514  return false;
2515 
2516  outUserID = regValue;
2517  return true;
2518 }
2519 
2520 
2522 
2524 {
2525  bool ret;
2526  if (IS_CHANNEL_INVALID(inFrameStore))
2527  return false;
2528  if (IsMultiFormatActive())
2529  return WriteRegister (gChannelToGlobalControlRegNum[inFrameStore], value, kRegMaskRegClocking, kRegShiftRegClocking);
2530  if (IsSupported(kDeviceCanDoMultiFormat))
2531  {
2532  for (NTV2Channel chan(NTV2_CHANNEL1); chan < NTV2Channel(GetNumSupported(kDeviceGetNumFrameStores)); chan = NTV2Channel(chan+1))
2533  {
2534  ret = WriteRegister (gChannelToGlobalControlRegNum[chan], value, kRegMaskRegClocking, kRegShiftRegClocking);
2535  if (!ret)
2536  return false;
2537  }
2538  return true;
2539  }
2541 }
2542 
2543 
2545 {
2546  if (IS_CHANNEL_INVALID (inFrameStore))
2547  return false;
2548  ULWord value(0);
2549  if (!ReadRegister(gChannelToGlobalControlRegNum[IsMultiFormatActive() ? inFrameStore : NTV2_CHANNEL1],
2551  return false;
2552  outValue = NTV2RegisterWriteMode(value);
2553  return true;
2554 }
2555 
2556 
2558 // RP188 methods
2560 
2561 bool CNTV2Card::SetRP188Mode (const NTV2Channel inChannel, const NTV2_RP188Mode inValue)
2562 {
2563  if (IS_CHANNEL_INVALID (inChannel))
2564  return false;
2565  return WriteRegister (gChannelToRP188ModeGCRegisterNum [inChannel], inValue, gChannelToRP188ModeMasks [inChannel], gChannelToRP188ModeShifts [inChannel]);
2566 }
2567 
2568 
2569 bool CNTV2Card::GetRP188Mode (const NTV2Channel inChannel, NTV2_RP188Mode & outMode)
2570 {
2571  if (IS_CHANNEL_INVALID (inChannel))
2572  return false;
2573  const bool result (CNTV2DriverInterface::ReadRegister (gChannelToRP188ModeGCRegisterNum[inChannel], outMode, gChannelToRP188ModeMasks[inChannel], gChannelToRP188ModeShifts[inChannel]));
2574  if (!result)
2575  outMode = NTV2_RP188_INVALID;
2576  return result;
2577 }
2578 
2579 
2580 bool CNTV2Card::GetRP188Data (const NTV2Channel inChannel, NTV2_RP188 & outRP188Data)
2581 {
2582  outRP188Data = NTV2_RP188();
2583  if (IS_CHANNEL_INVALID (inChannel))
2584  return false;
2585  return ReadRegister (gChlToRP188DBBRegNum[inChannel], outRP188Data.fDBB, kRegMaskRP188DBB, kRegShiftRP188DBB)
2586  && ReadRegister (gChlToRP188Bits031RegNum[inChannel], outRP188Data.fLo)
2587  && ReadRegister (gChlToRP188Bits3263RegNum[inChannel], outRP188Data.fHi);
2588 }
2589 
2590 
2591 bool CNTV2Card::SetRP188Data (const NTV2Channel inChannel, const NTV2_RP188 & inRP188Data)
2592 {
2593  if (IS_CHANNEL_INVALID (inChannel))
2594  return false;
2595  if (!inRP188Data.IsValid())
2596  return false;
2597  return WriteRegister (gChlToRP188DBBRegNum[inChannel], inRP188Data.fDBB, kRegMaskRP188DBB, kRegShiftRP188DBB)
2598  && WriteRegister (gChlToRP188Bits031RegNum[inChannel], inRP188Data.fLo)
2599  && WriteRegister (gChlToRP188Bits3263RegNum[inChannel], inRP188Data.fHi);
2600 }
2601 
2602 
2603 bool CNTV2Card::SetRP188SourceFilter (const NTV2Channel inChannel, UWord inValue)
2604 {
2605  if (IS_CHANNEL_INVALID (inChannel))
2606  return false;
2607  return WriteRegister (gChlToRP188DBBRegNum[inChannel], ULWord(inValue), kRegMaskRP188SourceSelect, kRegShiftRP188Source);
2608 }
2609 
2610 
2611 bool CNTV2Card::GetRP188SourceFilter (const NTV2Channel inChannel, UWord & outValue)
2612 {
2613  if (IS_CHANNEL_INVALID (inChannel))
2614  return false;
2616 }
2617 
2618 
2619 bool CNTV2Card::IsRP188BypassEnabled (const NTV2Channel inChannel, bool & outIsBypassEnabled)
2620 {
2621  if (IS_CHANNEL_INVALID (inChannel))
2622  return false;
2623  // Bit 23 of the RP188 DBB register will be set if output timecode will be grabbed directly from an input (bypass source)...
2624  ULWord regValue (0);
2625  bool result (NTV2_IS_VALID_CHANNEL(inChannel) && ReadRegister(gChlToRP188DBBRegNum[inChannel], regValue));
2626  if (result)
2627  outIsBypassEnabled = regValue & BIT(23);
2628  return result;
2629 }
2630 
2631 
2633 {
2634  if (IS_CHANNEL_INVALID (inChannel))
2635  return false;
2636  // Clear bit 23 of my output destination's RP188 DBB register...
2637  return NTV2_IS_VALID_CHANNEL (inChannel) && WriteRegister (gChlToRP188DBBRegNum[inChannel], 0, BIT(23), 23);
2638 }
2639 
2640 
2642 {
2643  if (IS_CHANNEL_INVALID (inChannel))
2644  return false;
2645  // Set bit 23 of my output destination's RP188 DBB register...
2646  return NTV2_IS_VALID_CHANNEL (inChannel) && WriteRegister (gChlToRP188DBBRegNum [inChannel], 1, BIT(23), 23);
2647 }
2648 
2649 static const ULWord gSDIOutToRP188Input[] = { 0, 2, 1, 3, 0, 2, 1, 3, 0 };
2650 
2651 bool CNTV2Card::SetRP188BypassSource (const NTV2Channel inSDIOutput, const UWord inSDIInput)
2652 {
2653  if (IS_CHANNEL_INVALID(inSDIOutput))
2654  return false;
2655  if (IS_CHANNEL_INVALID(NTV2Channel(inSDIInput)))
2656  return false;
2657  return WriteRegister(gChlToRP188DBBRegNum[inSDIOutput], gSDIOutToRP188Input[inSDIInput], BIT(21)|BIT(22), 21);
2658 }
2659 
2660 bool CNTV2Card::GetRP188BypassSource (const NTV2Channel inSDIOutput, UWord & outSDIInput)
2661 {
2662  if (IS_CHANNEL_INVALID(inSDIOutput))
2663  return false;
2664  ULWord val(0);
2665  if (!ReadRegister(gChlToRP188DBBRegNum[inSDIOutput], val, BIT(21)|BIT(22), 21))
2666  return false;
2667  switch(val)
2668  {
2669  case 0: outSDIInput = inSDIOutput < NTV2_CHANNEL5 ? 0 : 4; break;
2670  case 2: outSDIInput = inSDIOutput < NTV2_CHANNEL5 ? 1 : 5; break;
2671  case 1: outSDIInput = inSDIOutput < NTV2_CHANNEL5 ? 2 : 6; break;
2672  case 3: outSDIInput = inSDIOutput < NTV2_CHANNEL5 ? 3 : 7; break;
2673  default: return false;
2674  }
2675  return true;
2676 }
2677 
2678 
2680 {
2681  if (!NTV2_IS_VALID_VIDEOLIMITING(inValue))
2682  return false;
2683  CVIDINFO("'" << GetDisplayName() << "' set to " << ::NTV2VideoLimitingToString(inValue));
2684  return WriteRegister (kRegVidProc1Control, inValue, kRegMaskVidProcLimiting, kRegShiftVidProcLimiting);
2685 }
2686 
2688 {
2690 }
2691 
2692 
2693 //SetEnableVANCData
2694 // Call SetVideoFormat with the desired video format BEFORE you call this function!
2695 bool CNTV2Card::SetEnableVANCData (const bool inVANCenable, const bool inTallerVANC, const NTV2Channel inChannel)
2696 {
2697  return SetVANCMode (NTV2VANCModeFromBools(inVANCenable, inTallerVANC), IsMultiFormatActive() ? inChannel : NTV2_CHANNEL1);
2698 }
2699 
2700 bool CNTV2Card::SetVANCMode (const NTV2ChannelSet & inChannels, const NTV2VANCMode inVancMode)
2701 {
2702  size_t errors(0);
2703  for (NTV2ChannelSetConstIter it(inChannels.begin()); it != inChannels.end(); ++it)
2704  if (!SetVANCMode (inVancMode, *it))
2705  errors++;
2706  return !errors;
2707 }
2708 
2709 
2710 bool CNTV2Card::SetVANCMode (const NTV2VANCMode inVancMode, const NTV2Channel inChannel)
2711 {
2712  const NTV2Channel ch (IsMultiFormatActive() ? inChannel : NTV2_CHANNEL1);
2713  if (IsMultiRasterWidgetChannel(ch))
2714  return inVancMode == NTV2_VANCMODE_OFF;
2715  if (IS_CHANNEL_INVALID(ch))
2716  return false;
2717  if (!NTV2_IS_VALID_VANCMODE(inVancMode))
2718  return false;
2719 
2722  GetStandard(st, ch);
2723  GetFrameGeometry(fg, ch);
2724  switch (st)
2725  {
2726  case NTV2_STANDARD_1080:
2727  case NTV2_STANDARD_1080p:
2728  if (fg == NTV2_FG_1920x1112 || fg == NTV2_FG_1920x1114 || fg == NTV2_FG_1920x1080)
2730  else if (NTV2_IS_QUAD_FRAME_GEOMETRY(fg)) // 4K
2731  ; // do nothing for now
2732  else if (NTV2_IS_2K_1080_FRAME_GEOMETRY(fg)) // 2Kx1080
2734  break;
2735 
2736  case NTV2_STANDARD_720:
2738  if (NTV2_IS_VANCMODE_TALLER(inVancMode))
2739  CVIDWARN("'taller' mode requested for 720p -- using 'tall' geometry instead");
2740  break;
2741 
2742  case NTV2_STANDARD_525:
2744  break;
2745 
2746  case NTV2_STANDARD_625:
2748  break;
2749 
2750  case NTV2_STANDARD_2K:
2752  if (NTV2_IS_VANCMODE_TALLER(inVancMode))
2753  CVIDWARN("'taller' mode requested for 2K standard '" << ::NTV2StandardToString(st) << "' -- using 'tall' instead");
2754  break;
2755 
2759  break;
2760 
2763  case NTV2_STANDARD_3840HFR:
2764  case NTV2_STANDARD_4096HFR:
2765  case NTV2_STANDARD_7680:
2766  case NTV2_STANDARD_8192:
2767  case NTV2_STANDARD_3840i:
2768  case NTV2_STANDARD_4096i:
2769  if (NTV2_IS_VANCMODE_ON(inVancMode))
2770  CVIDWARN("'tall' or 'taller' mode requested for '" << ::NTV2StandardToString(st) << "' -- using non-VANC geometry instead");
2771  break;
2772  #if defined(_DEBUG)
2773  case NTV2_STANDARD_INVALID: return false;
2774  #else
2775  default: return false;
2776  #endif // _DEBUG
2777  }
2778  SetFrameGeometry (fg, false/*ajaRetail*/, ch);
2779  CVIDINFO("'" << GetDisplayName() << "' Ch" << DEC(ch+1) << ": set to " << ::NTV2VANCModeToString(inVancMode) << " for " << ::NTV2StandardToString(st) << " and " << ::NTV2FrameGeometryToString(fg));
2780 
2781  // Only muck with limiting if not the xena2k board. Xena2k only turns off limiting in VANC area. Active video uses vidproccontrol setting...
2782  if (!::NTV2DeviceNeedsRoutingSetup(GetDeviceID()))
2783  SetVideoLimiting (NTV2_IS_VANCMODE_ON(inVancMode) ? NTV2_VIDEOLIMITING_OFF : NTV2_VIDEOLIMITING_LEGALSDI);
2784 
2785  return true;
2786 }
2787 
2788 
2789 //SetEnableVANCData - extended params
2790 bool CNTV2Card::SetEnableVANCData (const bool inVANCenabled, const bool inTallerVANC, const NTV2Standard inStandard, const NTV2FrameGeometry inFrameGeometry, const NTV2Channel inChannel)
2791 { (void) inStandard; (void) inFrameGeometry;
2792  if (inTallerVANC && !inVANCenabled)
2793  return false; // conflicting VANC params
2794  return SetVANCMode (NTV2VANCModeFromBools (inVANCenabled, inTallerVANC), inChannel);
2795 }
2796 
2797 
2798 bool CNTV2Card::GetVANCMode (NTV2VANCMode & outVancMode, const NTV2Channel inChannel)
2799 {
2800  bool isTall (false);
2801  bool isTaller (false);
2802  const NTV2Channel channel (IsMultiFormatActive() ? inChannel : NTV2_CHANNEL1);
2804  NTV2FrameGeometry frameGeometry (NTV2_FG_INVALID);
2805 
2806  if (IsMultiRasterWidgetChannel(channel))
2807  {outVancMode = NTV2_VANCMODE_OFF; return true;}
2808 
2809  outVancMode = NTV2_VANCMODE_INVALID;
2810  if (IS_CHANNEL_INVALID (channel))
2811  return false;
2812 
2813  GetStandard (standard, channel);
2814  GetFrameGeometry (frameGeometry, channel);
2815 
2816  switch (standard)
2817  {
2818  case NTV2_STANDARD_1080:
2819  case NTV2_STANDARD_1080p:
2820  case NTV2_STANDARD_2Kx1080p: // ** MrBill ** IS THIS CORRECT?
2821  case NTV2_STANDARD_2Kx1080i: // ** MrBill ** IS THIS CORRECT?
2822  if ( frameGeometry == NTV2_FG_1920x1112 || frameGeometry == NTV2_FG_2048x1112 ||
2823  frameGeometry == NTV2_FG_1920x1114 || frameGeometry == NTV2_FG_2048x1114)
2824  isTall = true;
2825  if ( frameGeometry == NTV2_FG_1920x1114 || frameGeometry == NTV2_FG_2048x1114)
2826  isTaller = true;
2827  break;
2828  case NTV2_STANDARD_720:
2829  if ( frameGeometry == NTV2_FG_1280x740)
2830  isTall = true;
2831  break;
2832  case NTV2_STANDARD_525:
2833  if ( frameGeometry == NTV2_FG_720x508 ||
2834  frameGeometry == NTV2_FG_720x514)
2835  isTall = true;
2836  if ( frameGeometry == NTV2_FG_720x514 )
2837  isTaller = true;
2838  break;
2839  case NTV2_STANDARD_625:
2840  if ( frameGeometry == NTV2_FG_720x598 ||
2841  frameGeometry == NTV2_FG_720x612)
2842  isTall = true;
2843  if ( frameGeometry == NTV2_FG_720x612 )
2844  isTaller = true;
2845  break;
2846  case NTV2_STANDARD_2K:
2847  if ( frameGeometry == NTV2_FG_2048x1588)
2848  isTall = true;
2849  break;
2852  case NTV2_STANDARD_3840HFR:
2853  case NTV2_STANDARD_4096HFR:
2854  case NTV2_STANDARD_7680:
2855  case NTV2_STANDARD_8192:
2856  case NTV2_STANDARD_3840i:
2857  case NTV2_STANDARD_4096i:
2858  break;
2859  #if defined (_DEBUG)
2860  case NTV2_NUM_STANDARDS: return false;
2861  #else
2862  default: return false;
2863  #endif
2864  }
2865  outVancMode = NTV2VANCModeFromBools (isTall, isTaller);
2866  return true;
2867 }
2868 
2869 
2871 {
2872  if (IsMultiRasterWidgetChannel(inChannel))
2873  return inValue == NTV2_VANCDATA_NORMAL;
2874  if (IS_CHANNEL_INVALID (inChannel))
2875  return false;
2876  CVIDINFO("'" << GetDisplayName() << "' Ch" << DEC(inChannel+1) << ": Vanc data shift " << (inValue ? "enabled" : "disabled"));
2877  return WriteRegister (gChannelToControlRegNum [inChannel], inValue, kRegMaskVidProcVANCShift, kRegShiftVidProcVANCShift);
2878 }
2879 
2880 
2882 {
2883  size_t errors(0);
2884  for (NTV2ChannelSetConstIter it(inChannels.begin()); it != inChannels.end(); ++it)
2885  if (!SetVANCShiftMode(*it, inMode))
2886  errors++;
2887  return !errors;
2888 }
2889 
2890 
2892 {
2893  if (IsMultiRasterWidgetChannel(inChannel))
2894  {outValue = NTV2_VANCDATA_NORMAL; return true;}
2895  if (IS_CHANNEL_INVALID (inChannel))
2896  return false;
2898 }
2899 
2900 
2901 bool CNTV2Card::SetPulldownMode (NTV2Channel inChannel, bool inValue)
2902 {
2903  if (IS_CHANNEL_INVALID (inChannel))
2904  return false;
2906 }
2907 
2908 
2909 bool CNTV2Card::GetPulldownMode (NTV2Channel inChannel, bool & outValue)
2910 {
2911  ULWord value(0);
2912  if (IS_CHANNEL_INVALID (inChannel))
2913  return false;
2915  {
2916  outValue = value ? true : false;
2917  return true;
2918  }
2919  return false;
2920 }
2921 
2922 
2923 bool CNTV2Card::SetMixerVancOutputFromForeground (const UWord inWhichMixer, const bool inFromForegroundSource)
2924 {
2925  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
2926  return false;
2927  CVIDINFO("'" << GetDisplayName() << "' Mixer" << DEC(inWhichMixer+1) << ": Vanc from " << (inFromForegroundSource ? "FG" : "BG"));
2928  return WriteRegister (gIndexToVidProcControlRegNum[inWhichMixer], inFromForegroundSource ? 1 : 0, kRegMaskVidProcVancSource, kRegShiftVidProcVancSource);
2929 }
2930 
2931 
2932 bool CNTV2Card::GetMixerVancOutputFromForeground (const UWord inWhichMixer, bool & outIsFromForegroundSource)
2933 {
2934  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
2935  return false;
2936 
2937  ULWord value (0);
2938  bool result (ReadRegister (gIndexToVidProcControlRegNum[inWhichMixer], value, kRegMaskVidProcVancSource, kRegShiftVidProcVancSource));
2939  if (result)
2940  outIsFromForegroundSource = value ? true : false;
2941  return result;
2942 }
2943 
2944 bool CNTV2Card::SetMixerFGInputControl (const UWord inWhichMixer, const NTV2MixerKeyerInputControl inInputControl)
2945 {
2946  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
2947  return false;
2948  CVIDINFO("'" << GetDisplayName() << "' Mixer" << DEC(inWhichMixer+1) << ": FG input ctrl=" << ::NTV2MixerInputControlToString(inInputControl));
2950 }
2951 
2952 
2953 bool CNTV2Card::GetMixerFGInputControl (const UWord inWhichMixer, NTV2MixerKeyerInputControl & outInputControl)
2954 {
2955  outInputControl = NTV2MIXERINPUTCONTROL_INVALID;
2956  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
2957  return false;
2958 
2959  ULWord value (0);
2961  if (result)
2962  outInputControl = static_cast <NTV2MixerKeyerInputControl> (value);
2963  return result;
2964 }
2965 
2966 
2967 bool CNTV2Card::SetMixerBGInputControl (const UWord inWhichMixer, const NTV2MixerKeyerInputControl inInputControl)
2968 {
2969  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
2970  return false;
2971  CVIDINFO("'" << GetDisplayName() << "' Mixer" << DEC(inWhichMixer+1) << ": BG input ctrl=" << ::NTV2MixerInputControlToString(inInputControl));
2973 }
2974 
2975 
2976 bool CNTV2Card::GetMixerBGInputControl (const UWord inWhichMixer, NTV2MixerKeyerInputControl & outInputControl)
2977 {
2978  outInputControl = NTV2MIXERINPUTCONTROL_INVALID;
2979  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
2980  return false;
2981 
2982  ULWord value (0);
2984  if (result)
2985  outInputControl = static_cast <NTV2MixerKeyerInputControl> (value);
2986  return result;
2987 }
2988 
2989 
2990 bool CNTV2Card::SetMixerMode (const UWord inWhichMixer, const NTV2MixerKeyerMode inMode)
2991 {
2992  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
2993  return false;
2994  CVIDINFO("'" << GetDisplayName() << "' Mixer" << DEC(inWhichMixer+1) << ": mode=" << ::NTV2MixerKeyerModeToString(inMode));
2995  return WriteRegister (gIndexToVidProcControlRegNum[inWhichMixer], inMode, kK2RegMaskXena2VidProcMode, kK2RegShiftXena2VidProcMode);
2996 }
2997 
2998 
2999 bool CNTV2Card::GetMixerMode (const UWord inWhichMixer, NTV2MixerKeyerMode & outMode)
3000 {
3001  outMode = NTV2MIXERMODE_INVALID;
3002 
3003  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3004  return false;
3005 
3006  ULWord value (0);
3007  bool result (ReadRegister (gIndexToVidProcControlRegNum[inWhichMixer], value, kK2RegMaskXena2VidProcMode, kK2RegShiftXena2VidProcMode));
3008  if (result)
3009  outMode = static_cast <NTV2MixerKeyerMode> (value);
3010  return result;
3011 }
3012 
3013 
3014 bool CNTV2Card::SetMixerCoefficient (const UWord inWhichMixer, const ULWord inMixCoefficient)
3015 {
3016  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3017  return false;
3018  CVIDINFO("'" << GetDisplayName() << "' Mixer" << DEC(inWhichMixer+1) << ": mixCoeff=" << xHEX0N(inMixCoefficient,8));
3019  return WriteRegister (gIndexToVidProcMixCoeffRegNum[inWhichMixer], inMixCoefficient);
3020 }
3021 
3022 
3023 bool CNTV2Card::GetMixerCoefficient (const UWord inWhichMixer, ULWord & outMixCoefficient)
3024 {
3025  outMixCoefficient = 0;
3026  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3027  return false;
3028  return ReadRegister (gIndexToVidProcMixCoeffRegNum[inWhichMixer], outMixCoefficient);
3029 }
3030 
3031 
3032 bool CNTV2Card::GetMixerSyncStatus (const UWord inWhichMixer, bool & outIsSyncOK)
3033 {
3034  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3035  return false;
3036 
3037  bool syncFail (false);
3039  return false;
3040  outIsSyncOK = syncFail ? false : true;
3041  return true;
3042 }
3043 
3044 bool CNTV2Card::GetMixerFGMatteEnabled (const UWord inWhichMixer, bool & outIsEnabled)
3045 {
3046  outIsEnabled = false;
3047  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3048  return false;
3050 }
3051 
3052 bool CNTV2Card::SetMixerFGMatteEnabled (const UWord inWhichMixer, const bool inIsEnabled)
3053 {
3054  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3055  return false;
3056  return WriteRegister (gIndexToVidProcControlRegNum[inWhichMixer], inIsEnabled?1:0, kRegMaskVidProcFGMatteEnable, kRegShiftVidProcFGMatteEnable);
3057 }
3058 
3059 bool CNTV2Card::GetMixerBGMatteEnabled (const UWord inWhichMixer, bool & outIsEnabled)
3060 {
3061  outIsEnabled = false;
3062  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3063  return false;
3065 }
3066 
3067 bool CNTV2Card::SetMixerBGMatteEnabled (const UWord inWhichMixer, const bool inIsEnabled)
3068 {
3069  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3070  return false;
3071  return WriteRegister (gIndexToVidProcControlRegNum[inWhichMixer], inIsEnabled?1:0, kRegMaskVidProcBGMatteEnable, kRegShiftVidProcBGMatteEnable);
3072 }
3073 
3074 static const ULWord gMatteColorRegs[] = { kRegFlatMatteValue /*13*/, kRegFlatMatte2Value /*249*/, kRegFlatMatte3Value /*487*/, kRegFlatMatte4Value /*490*/, 0, 0, 0, 0};
3075 
3076 bool CNTV2Card::GetMixerMatteColor (const UWord inWhichMixer, YCbCr10BitPixel & outYCbCrValue)
3077 {
3078  ULWord packedValue (0);
3079  outYCbCrValue.cb = outYCbCrValue.y = outYCbCrValue.cr = 0;
3080  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3081  return false;
3082  if (!ReadRegister(gMatteColorRegs[inWhichMixer], packedValue))
3083  return false;
3084 
3085  outYCbCrValue.cb = packedValue & 0x03FF;
3086  outYCbCrValue.y = ((packedValue >> 10) & 0x03FF) + 0x0040;
3087  outYCbCrValue.cr = (packedValue >> 20) & 0x03FF;
3088  return true;
3089 }
3090 
3091 bool CNTV2Card::SetMixerMatteColor (const UWord inWhichMixer, const YCbCr10BitPixel inYCbCrValue)
3092 {
3093  YCbCr10BitPixel ycbcrPixel (inYCbCrValue);
3094  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3095  return false;
3096 
3097  if (ycbcrPixel.y < 0x40)
3098  ycbcrPixel.y = 0x0; // clip y
3099  else
3100  ycbcrPixel.y -= 0x40;
3101  ycbcrPixel.y &= 0x3FF;
3102  ycbcrPixel.cb &= 0x3FF;
3103  ycbcrPixel.cr &= 0x3FF;
3104 
3105  // Pack three 10-bit values into ULWord...
3106  const ULWord packedValue (ULWord(ycbcrPixel.cb) | (ULWord(ycbcrPixel.y) << 10) | (ULWord(ycbcrPixel.cr) << 20));
3107  CVIDINFO("'" << GetDisplayName() << "' Mixer" << DEC(inWhichMixer+1) << ": set to YCbCr=" << DEC(ycbcrPixel.y)
3108  << "|" << DEC(ycbcrPixel.cb) << "|" << DEC(ycbcrPixel.cr) << ":" << HEXN(ycbcrPixel.y,3) << "|"
3109  << HEXN(ycbcrPixel.cb,3) << "|" << HEXN(ycbcrPixel.cr,3) << ", write " << xHEX0N(packedValue,8)
3110  << " into reg " << DEC(gMatteColorRegs[inWhichMixer]));
3111 
3112  // Write it...
3113  return WriteRegister(gMatteColorRegs[inWhichMixer], packedValue);
3114 }
3115 
3116 bool CNTV2Card::MixerHasRGBModeSupport (const UWord inWhichMixer, bool & outIsSupported)
3117 {
3118  outIsSupported = false;
3119  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3120  return false;
3122 }
3123 
3124 bool CNTV2Card::SetMixerRGBRange (const UWord inWhichMixer, const NTV2MixerRGBRange inRGBRange)
3125 {
3126  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3127  return false;
3128  return !WriteRegister (gIndexToVidProcControlRegNum[inWhichMixer], inRGBRange, kRegMaskVidProcRGBRange, kRegShiftVidProcRGBRange);
3129 }
3130 
3131 bool CNTV2Card::GetMixerRGBRange (const UWord inWhichMixer, NTV2MixerRGBRange & outRGBRange)
3132 {
3133  if (ULWord(inWhichMixer) >= GetNumSupported(kDeviceGetNumMixers))
3134  return false;
3136 }
3137 
3138 
3140 // Mapping methods
3142 
3143 #if !defined(NTV2_DEPRECATE_16_0)
3144  // Method: GetBaseAddress
3145  // Input: NTV2Channel channel
3146  // Output: bool status and modifies ULWord **pBaseAddress
3147  bool CNTV2Card::GetBaseAddress (NTV2Channel channel, ULWord **pBaseAddress)
3148  {
3149  if (IS_CHANNEL_INVALID(channel))
3150  return false;
3151  ULWord ulFrame(0);
3152  if (!ReadRegister(gChannelToPCIAccessFrameRegNum[channel], ulFrame)) // GetPCIAccessFrame(channel, ulFrame);
3153  return false;
3154  if (ulFrame > GetNumFrameBuffers())
3155  ulFrame = 0;
3156 
3157  if (::NTV2DeviceIsDirectAddressable(GetDeviceID()))
3158  {
3159  if (!_pFrameBaseAddress)
3160  if (!MapFrameBuffers())
3161  return false;
3162  *pBaseAddress = _pFrameBaseAddress + ((ulFrame * _ulFrameBufferSize) / sizeof(ULWord));
3163  }
3164  else // must be an _MM board
3165  {
3166  if (!_pCh1FrameBaseAddress)
3167  if (!MapFrameBuffers())
3168  return false;
3169  *pBaseAddress = (channel == NTV2_CHANNEL1) ? _pCh1FrameBaseAddress : _pCh2FrameBaseAddress; // DEPRECATE!
3170  }
3171  return true;
3172  }
3173 
3174  // Method: GetBaseAddress
3175  // Input: None
3176  // Output: bool status and modifies ULWord *pBaseAddress
3177  bool CNTV2Card::GetBaseAddress (ULWord **pBaseAddress)
3178  {
3179  if (!_pFrameBaseAddress)
3180  if (!MapFrameBuffers())
3181  return false;
3182  *pBaseAddress = _pFrameBaseAddress;
3183  return true;
3184  }
3185 
3186  // Method: GetRegisterBaseAddress
3187  // Input: ULWord regNumber
3188  // Output: bool status and modifies ULWord **pBaseAddress
3189  bool CNTV2Card::GetRegisterBaseAddress (ULWord regNumber, ULWord **pBaseAddress)
3190  {
3191  if (!_pRegisterBaseAddress)
3192  if (!MapRegisters())
3193  return false;
3194  #ifdef MSWindows
3195  if ((regNumber*4) >= _pRegisterBaseAddressLength)
3196  return false;
3197  #endif // MSWindows
3198  *pBaseAddress = _pRegisterBaseAddress + regNumber;
3199  return true;
3200  }
3201 
3202  // Method: GetXena2FlashBaseAddress
3203  // Output: bool status and modifies ULWord **pXena2FlashAddress
3204  bool CNTV2Card::GetXena2FlashBaseAddress (ULWord **pXena2FlashAddress)
3205  {
3206  if (!_pXena2FlashBaseAddress)
3207  if (!MapXena2Flash())
3208  return false;
3209  *pXena2FlashAddress = _pXena2FlashBaseAddress;
3210  return true;
3211  }
3212 #endif // !defined(NTV2_DEPRECATE_16_0)
3213 
3214 bool CNTV2Card::SetDualLinkOutputEnable (const bool enable)
3215 {
3216  return WriteRegister (kRegGlobalControl, enable ? 1 : 0, kRegMaskDualLinkOutEnable, kRegShiftDualLinKOutput);
3217 }
3218 
3219 bool CNTV2Card::GetDualLinkOutputEnable (bool & outIsEnabled)
3220 {
3221  outIsEnabled = false;
3223 }
3224 
3225 
3226 bool CNTV2Card::SetDualLinkInputEnable (const bool enable)
3227 {
3228  return WriteRegister (kRegGlobalControl, enable ? 1 : 0, kRegMaskDualLinkInEnable, kRegShiftDualLinkInput);
3229 }
3230 
3231 
3232 bool CNTV2Card::GetDualLinkInputEnable (bool & outIsEnabled)
3233 {
3234  outIsEnabled = false;
3236 }
3237 
3238 
3240 
3241 bool CNTV2Card::SetDitherFor8BitInputs (const NTV2Channel inChannel, const ULWord inDither)
3242 {
3243  if (IS_CHANNEL_INVALID(inChannel))
3244  return false;
3245  return WriteRegister (gChannelToControlRegNum[inChannel], inDither, kRegMaskDitherOn8BitInput, kRegShiftDitherOn8BitInput);
3246 }
3247 
3248 bool CNTV2Card::GetDitherFor8BitInputs (const NTV2Channel inChannel, ULWord & outDither)
3249 {
3250  if (IS_CHANNEL_INVALID(inChannel))
3251  return false;
3252  return ReadRegister(gChannelToControlRegNum[inChannel], outDither, kRegMaskDitherOn8BitInput, kRegShiftDitherOn8BitInput);
3253 }
3254 
3256 
3257 bool CNTV2Card::SetForce64(ULWord force64) {return WriteRegister (kRegDMAControl, force64, kRegMaskForce64, kRegShiftForce64);}
3258 bool CNTV2Card::GetForce64(ULWord* force64) {return force64 ? ReadRegister (kRegDMAControl, *force64, kRegMaskForce64, kRegShiftForce64) : false;}
3259 bool CNTV2Card::Get64BitAutodetect(ULWord* autodetect64) {return autodetect64 ? ReadRegister (kRegDMAControl, *autodetect64, kRegMaskAutodetect64, kRegShiftAutodetect64) : false;}
3260 
3262 // Kona2/Xena2/ related methods
3263 
3264 // kK2RegAnalogOutControl
3269 
3270 bool CNTV2Card::SetSDIOutputStandard (const UWord inOutputSpigot, const NTV2Standard inValue)
3271 {
3272  if (IS_OUTPUT_SPIGOT_INVALID(inOutputSpigot))
3273  return false;
3274 
3275  NTV2Standard standard(inValue);
3276  bool is2Kx1080(false);
3277  switch(inValue)
3278  {
3280  standard = NTV2_STANDARD_1080p;
3281  is2Kx1080 = true;
3282  break;
3284  standard = NTV2_STANDARD_1080;
3285  is2Kx1080 = true;
3286  break;
3288  standard = NTV2_STANDARD_1080p;
3289  is2Kx1080 = false;
3290  break;
3291  case NTV2_STANDARD_3840HFR:
3292  standard = NTV2_STANDARD_1080p;
3293  is2Kx1080 = false;
3294  break;
3295  case NTV2_STANDARD_3840i:
3296  standard = NTV2_STANDARD_1080;
3297  is2Kx1080 = false;
3298  break;
3300  standard = NTV2_STANDARD_1080p;
3301  is2Kx1080 = true;
3302  break;
3303  case NTV2_STANDARD_4096HFR:
3304  standard = NTV2_STANDARD_1080p;
3305  is2Kx1080 = true;
3306  break;
3307  case NTV2_STANDARD_4096i:
3308  standard = NTV2_STANDARD_1080;
3309  is2Kx1080 = true;
3310  break;
3311  default:
3312  break;
3313  }
3314 
3315  return WriteRegister (gChannelToSDIOutControlRegNum[inOutputSpigot], standard, kK2RegMaskSDIOutStandard, kK2RegShiftSDIOutStandard)
3316  && SetSDIOut2Kx1080Enable(NTV2Channel(inOutputSpigot), is2Kx1080);
3317 }
3318 
3319 bool CNTV2Card::SetSDIOutputStandard (const NTV2ChannelSet & inSDIOutputs, const NTV2Standard inValue)
3320 {
3321  size_t errors(0);
3322  for (NTV2ChannelSetConstIter it(inSDIOutputs.begin()); it != inSDIOutputs.end(); ++it)
3323  if (!SetSDIOutputStandard(*it, inValue))
3324  errors++;
3325  return !errors;
3326 }
3327 
3328 bool CNTV2Card::GetSDIOutputStandard (const UWord inOutputSpigot, NTV2Standard & outValue)
3329 {
3330  if (IS_OUTPUT_SPIGOT_INVALID(inOutputSpigot))
3331  return false;
3332  bool is2kx1080(false);
3333  bool is6G(false);
3334  bool is12G(false);
3337  && GetSDIOut2Kx1080Enable(NTV2Channel(inOutputSpigot), is2kx1080)
3338  && GetSDIOut6GEnable(NTV2Channel(inOutputSpigot), is6G)
3339  && GetSDIOut12GEnable(NTV2Channel(inOutputSpigot), is12G));
3340  outValue = newStd;
3341  switch (newStd)
3342  {
3343  case NTV2_STANDARD_1080:
3344  if (is2kx1080)
3345  outValue = NTV2_STANDARD_2Kx1080i;
3346  if (is6G || is12G)
3347  outValue = is2kx1080 ? NTV2_STANDARD_4096i : NTV2_STANDARD_3840i;
3348  break;
3349  case NTV2_STANDARD_1080p:
3350  if (is2kx1080)
3351  outValue = NTV2_STANDARD_2Kx1080p;
3352  if (is6G || is12G)
3353  outValue = is2kx1080 ? NTV2_STANDARD_4096x2160p : NTV2_STANDARD_3840x2160p;
3354  break;
3355  default:
3356  break;
3357  }
3358  return result;
3359 }
3360 
3361 bool CNTV2Card::WriteOutputTimingControl (const ULWord inValue, const UWord inOutputSpigot)
3362 {
3363  if (IS_OUTPUT_SPIGOT_INVALID(inOutputSpigot))
3364  return false;
3365  if (IsMultiFormatActive())
3366  return WriteRegister (gChannelToOutputTimingCtrlRegNum[inOutputSpigot], inValue);
3367  else if (IsSupported(kDeviceCanDoMultiFormat))
3368  {
3369  // Write all of the timing registers for UniFormat mode...
3370  switch (GetNumSupported(kDeviceGetNumVideoChannels))
3371  {
3372  case 8:
3373  WriteRegister (gChannelToOutputTimingCtrlRegNum[NTV2_CHANNEL8], inValue);
3374  WriteRegister (gChannelToOutputTimingCtrlRegNum[NTV2_CHANNEL7], inValue);
3375  WriteRegister (gChannelToOutputTimingCtrlRegNum[NTV2_CHANNEL6], inValue);
3376  WriteRegister (gChannelToOutputTimingCtrlRegNum[NTV2_CHANNEL5], inValue);
3377  AJA_FALL_THRU;
3378  case 4:
3379  WriteRegister (gChannelToOutputTimingCtrlRegNum[NTV2_CHANNEL4], inValue);
3380  WriteRegister (gChannelToOutputTimingCtrlRegNum[NTV2_CHANNEL3], inValue);
3381  AJA_FALL_THRU;
3382  case 2:
3383  WriteRegister (gChannelToOutputTimingCtrlRegNum[NTV2_CHANNEL2], inValue);
3384  AJA_FALL_THRU;
3385  default:
3386  return WriteRegister (gChannelToOutputTimingCtrlRegNum [NTV2_CHANNEL1], inValue);
3387  }
3388  }
3389  else
3390  return WriteRegister (gChannelToOutputTimingCtrlRegNum [NTV2_CHANNEL1], inValue);
3391 }
3392 
3393 
3394 bool CNTV2Card::ReadOutputTimingControl (ULWord & outValue, const UWord inOutputSpigot)
3395 {
3396  if (IS_OUTPUT_SPIGOT_INVALID (inOutputSpigot))
3397  return false;
3398  return ReadRegister (gChannelToOutputTimingCtrlRegNum[IsMultiFormatActive() ? inOutputSpigot : UWord(NTV2_CHANNEL1)], outValue);
3399 }
3400 
3401 // SDI1 HTiming
3403 bool CNTV2Card::GetSDI1OutHTiming(ULWord* pValue) {return pValue ? ReadRegister(kRegSDIOut1Control, *pValue, kK2RegMaskOutHTiming, kK2RegShiftOutHTiming) : false;}
3404 
3405 // SDI2 HTiming
3407 bool CNTV2Card::GetSDI2OutHTiming(ULWord* pValue) {return pValue ? ReadRegister(kRegSDIOut2Control, *pValue, kK2RegMaskOutHTiming, kK2RegShiftOutHTiming) : false;}
3408 
3410 {
3411  return WriteRegister(kVRegSecondaryFormatSelect, format);
3412 }
3413 
3415 {
3417 }
3418 
3419 
3420 #if !defined(R2_DEPRECATE)
3421 
3423 {
3424  return WriteRegister(kVRegInputSelect, input);
3425 }
3426 
3428 {
3429  return CNTV2DriverInterface::ReadRegister(kVRegInputSelect, outInputSelect);
3430 }
3431 
3432 #endif // R2_DEPRECATE
3433 
3434 
3435 NTV2VideoFormat CNTV2Card::GetInputVideoFormat (NTV2InputSource inSource, const bool inIsProgressivePicture)
3436 {
3437  switch (inSource)
3438  {
3439  case NTV2_INPUTSOURCE_SDI1: return GetSDIInputVideoFormat (NTV2_CHANNEL1, inIsProgressivePicture);
3440  case NTV2_INPUTSOURCE_SDI2: return GetSDIInputVideoFormat (NTV2_CHANNEL2, inIsProgressivePicture);
3441  case NTV2_INPUTSOURCE_SDI3: return GetSDIInputVideoFormat (NTV2_CHANNEL3, inIsProgressivePicture);
3442  case NTV2_INPUTSOURCE_SDI4: return GetSDIInputVideoFormat (NTV2_CHANNEL4, inIsProgressivePicture);
3443  case NTV2_INPUTSOURCE_SDI5: return GetSDIInputVideoFormat (NTV2_CHANNEL5, inIsProgressivePicture);
3444  case NTV2_INPUTSOURCE_SDI6: return GetSDIInputVideoFormat (NTV2_CHANNEL6, inIsProgressivePicture);
3445  case NTV2_INPUTSOURCE_SDI7: return GetSDIInputVideoFormat (NTV2_CHANNEL7, inIsProgressivePicture);
3446  case NTV2_INPUTSOURCE_SDI8: return GetSDIInputVideoFormat (NTV2_CHANNEL8, inIsProgressivePicture);
3447  case NTV2_INPUTSOURCE_HDMI1: return GetHDMIInputVideoFormat (NTV2_CHANNEL1);
3448  case NTV2_INPUTSOURCE_HDMI2: return GetHDMIInputVideoFormat (NTV2_CHANNEL2);
3449  case NTV2_INPUTSOURCE_HDMI3: return GetHDMIInputVideoFormat (NTV2_CHANNEL3);
3450  case NTV2_INPUTSOURCE_HDMI4: return GetHDMIInputVideoFormat (NTV2_CHANNEL4);
3451  case NTV2_INPUTSOURCE_ANALOG1: return GetAnalogInputVideoFormat ();
3452  default: return NTV2_FORMAT_UNKNOWN;
3453  }
3454 }
3455 
3456 NTV2VideoFormat CNTV2Card::GetSDIInputVideoFormat (NTV2Channel inChannel, bool inIsProgressivePicture)
3457 {
3458  ULWord vpidDS1(0), vpidDS2(0);
3459  CNTV2VPID inputVPID;
3460  if (IS_CHANNEL_INVALID(inChannel))
3461  return NTV2_FORMAT_UNKNOWN;
3462 
3463  bool isValidVPID (GetVPIDValidA(inChannel));
3464  if (isValidVPID)
3465  {
3466  ReadSDIInVPID(inChannel, vpidDS1, vpidDS2);
3467  inputVPID.SetVPID(vpidDS1);
3468  isValidVPID = inputVPID.IsValid();
3469  }
3470 
3471  NTV2FrameRate inputRate(GetSDIInputRate(inChannel));
3472  NTV2FrameGeometry inputGeometry(GetSDIInputGeometry(inChannel));
3473  bool isProgressiveTrans (isValidVPID ? inputVPID.GetProgressiveTransport() : GetSDIInputIsProgressive(inChannel));
3474  bool isProgressivePic (isValidVPID ? inputVPID.GetProgressivePicture() : inIsProgressivePicture);
3475  bool isInput3G (false);
3476 
3477  // A valid VPID fully describes the format on its own -- prefer it, and return
3478  // before the relatively expensive widget-capability lookup below. Some devices
3479  // (e.g. Corvid 88) publish VPID but leave the legacy per-input rate and geometry
3480  // fields of kRegInputStatus/kRegInputStatus2/kRegInput56Status/kRegInput78Status
3481  // at zero, so gating on the frame rate alone would discard a perfectly good VPID.
3482  if (isValidVPID)
3483  {
3484  const NTV2VideoFormat vpidFormat (inputVPID.GetVideoFormat());
3485  if (vpidFormat != NTV2_FORMAT_UNKNOWN)
3486  return vpidFormat;
3487  }
3488  if (inputRate == NTV2_FRAMERATE_INVALID)
3489  return NTV2_FORMAT_UNKNOWN;
3490 
3491  const ULWordSet wgtIDs (GetSupportedItems(kNTV2EnumsID_WidgetID));
3492  const bool canDo292In (wgtIDs.find(CNTV2SignalRouter::WidgetIDFromTypeAndChannel(NTV2WidgetType_SDIIn, inChannel)) != wgtIDs.end());
3493  const bool canDo3GIn (wgtIDs.find(CNTV2SignalRouter::WidgetIDFromTypeAndChannel(NTV2WidgetType_SDIIn3G, inChannel)) != wgtIDs.end());
3494  const bool canDo12GIn (wgtIDs.find(CNTV2SignalRouter::WidgetIDFromTypeAndChannel(NTV2WidgetType_SDIIn12G, inChannel)) != wgtIDs.end());
3495 
3496  if (canDo3GIn || canDo12GIn)
3497  {
3498  GetSDIInput3GPresent(isInput3G, inChannel);
3499  NTV2VideoFormat format = isValidVPID ? inputVPID.GetVideoFormat() : GetNTV2VideoFormat(inputRate, inputGeometry, isProgressiveTrans, isInput3G, isProgressivePic);
3500  if (isValidVPID && format == NTV2_FORMAT_UNKNOWN)
3501  {
3502  // Something might be incorrect in VPID
3503  isProgressiveTrans = GetSDIInputIsProgressive(inChannel);
3504  isProgressivePic = inIsProgressivePicture;
3505  format = GetNTV2VideoFormat(inputRate, inputGeometry, isProgressiveTrans, isInput3G, isProgressivePic);
3506  }
3507  if (canDo12GIn && format != NTV2_FORMAT_UNKNOWN && !isValidVPID)
3508  {
3509  bool is6G(false), is12G(false);
3510  GetSDIInput6GPresent(is6G, inChannel);
3511  GetSDIInput12GPresent(is12G, inChannel);
3512  if (is6G || is12G)
3513  {
3514  format = GetQuadSizedVideoFormat(format, !IsSupported(kDeviceCanDo12gRouting) ? true : false);
3515  }
3516  if (inputVPID.IsStandardMultiLink4320())
3517  {
3518  format = GetQuadSizedVideoFormat(format, true);
3519  }
3520  }
3521  return format;
3522  }
3523 
3524  if (canDo292In)
3525  {
3526  if (_boardID == DEVICE_ID_KONALHI || _boardID == DEVICE_ID_KONALHIDVI)
3527  {
3528  GetSDIInput3GPresent(isInput3G, NTV2_CHANNEL1);
3529  }
3530  return GetNTV2VideoFormat(inputRate, inputGeometry, isProgressiveTrans, isInput3G, isProgressivePic);
3531  }
3532 
3533  return NTV2_FORMAT_UNKNOWN;
3534 }
3535 
3536 
3538 {
3540  ULWord status;
3541  if (GetHDMIInputStatus(status, inChannel))
3542  {
3543  if ( (status & kRegMaskInputStatusLock) != 0 )
3544  {
3545  ULWord hdmiVersion = GetNumSupported(kDeviceGetHDMIVersion);
3546  if(hdmiVersion == 1)
3547  {
3548  ULWord standard = ((status & kRegMaskInputStatusStd) >> kRegShiftInputStatusStd);
3549  if(standard == 0x5) // NTV2_STANDARD_2K (2048x1556psf) in HDMI is really SXGA!!
3550  {
3551  // We return 1080p60 for SXGA format
3552  return NTV2_FORMAT_1080p_6000_A;
3553  }
3554  else
3555  {
3556  format = GetNTV2VideoFormat (NTV2FrameRate((status & kRegMaskInputStatusFPS) >> kRegShiftInputStatusFPS),
3558  false, // 3G
3559  0, // input geometry
3560  false); // progressive picture
3561  }
3562  }
3563  else if(hdmiVersion > 1)
3564  {
3565  bool squareDivision = hdmiVersion == 5 ? false : true;
3568  UByte inputGeometry = 0;
3569  if (hdmiStandard == NTV2_STANDARD_2Kx1080i || hdmiStandard == NTV2_STANDARD_2Kx1080p)
3570  inputGeometry = 8;
3571  format = GetNTV2VideoFormat (hdmiRate, hdmiStandard, false, inputGeometry, false, squareDivision);
3572  }
3573  }
3574  }
3575  return format;
3576 }
3577 
3579 {
3581  ULWord status;
3582  if (ReadRegister(kRegAnalogInputStatus, status))
3583  {
3584  if ( (status & kRegMaskInputStatusLock) != 0 )
3585  format = GetNTV2VideoFormat ( NTV2FrameRate((status & kRegMaskInputStatusFPS) >> kRegShiftInputStatusFPS),
3587  false, // 3G
3588  0, // input geometry
3589  false); // progressive picture
3590  }
3591  return format;
3592 }
3593 
3595 {
3597  ULWord analogDetect(0);
3598  // Use a single (atomic) read... so we don't return a bogus value if the register is changing while we're in here!
3599  if (ReadRegister(kRegAnalogInputStatus, analogDetect))
3600  {
3601  const ULWord locked ((analogDetect & kRegMaskAnalogCompositeLocked) >> kRegShiftAnalogCompositeLocked);
3602  if (locked)
3603  {
3605  // Validate NTSC/PAL reading with Frame Rate Family
3606  const ULWord integerRate ((analogDetect & kRegMaskAnalogInputIntegerRate) >> kRegShiftAnalogInputIntegerRate);
3607  if (Pal)
3608  {
3609  if (integerRate)
3610  format = NTV2_FORMAT_625_5000;
3611  else
3612  format = NTV2_FORMAT_UNKNOWN; // illegal combination - 625/59.94
3613  }
3614  else
3615  {
3616  if (integerRate)
3617  format = NTV2_FORMAT_UNKNOWN; // illegal combination - 525/60
3618  else
3619  format = NTV2_FORMAT_525_5994;
3620  }
3621  }
3622  }
3623  return format;
3624 }
3625 
3626 
3628 {
3629  ULWord status(0);
3630  if (!ReadRegister(kRegInputStatus, status))
3631  return NTV2_FORMAT_UNKNOWN;
3632  return GetNTV2VideoFormat (NTV2FrameRate((status >> 16) & 0xF), // frame rate
3633  ((status >> 20) & 0x7), // input scan geometry
3634  (status & BIT_23) ? true : false, // progressive transport
3635  false, // 3G
3636  false); // progressive picture
3637 }
3638 
3640 {
3641  if (IS_CHANNEL_INVALID (channel))
3642  return NTV2_FRAMERATE_INVALID;
3643 
3644  ULWord rateLow (0), rateHigh (0);
3645  NTV2FrameRate currentRate (NTV2_FRAMERATE_INVALID);
3646  if (!ReadRegister(gChannelToSDIInputStatusRegNum[channel], rateLow,
3648  return NTV2_FRAMERATE_INVALID;
3649  if (!ReadRegister(gChannelToSDIInputStatusRegNum[channel], rateHigh,
3651  return NTV2_FRAMERATE_INVALID;
3652  currentRate = NTV2FrameRate(((rateHigh << 3) & BIT_3) | rateLow);
3653  return NTV2_IS_VALID_NTV2FrameRate(currentRate) ? currentRate : NTV2_FRAMERATE_INVALID;
3654 } // GetSDIInputRate
3655 
3657 {
3658  if (IS_CHANNEL_INVALID (channel))
3659  return NTV2_FG_INVALID;
3660 
3661  ULWord geometryLow (0), geometryHigh (0);
3662  NTV2FrameGeometry currentGeometry (NTV2_FG_INVALID);
3663  if (!ReadRegister(gChannelToSDIInputStatusRegNum[channel], geometryLow,
3665  return NTV2_FG_INVALID;
3666  if (!ReadRegister(gChannelToSDIInputStatusRegNum[channel], geometryHigh,
3668  return NTV2_FG_INVALID;
3669  currentGeometry = NTV2FrameGeometry(((geometryHigh << 3) & BIT_3) | geometryLow);
3670  return NTV2_IS_VALID_NTV2FrameGeometry(currentGeometry) ? currentGeometry : NTV2_FG_INVALID;
3671 } // GetSDIInputGeometry
3672 
3674 {
3675  if (IS_CHANNEL_INVALID (channel))
3676  return false;
3677 
3678  ULWord isProgressive = 0;
3679  ReadRegister(gChannelToSDIInputStatusRegNum[channel], isProgressive, gChannelToSDIInputProgressiveMask[channel], gChannelToSDIInputProgressiveShift[channel]);
3680  return isProgressive ? true : false;
3681 } // GetSDIInputIsProgressive
3682 
3683 bool CNTV2Card::GetSDIInput3GPresent (bool & outValue, const NTV2Channel channel)
3684 {
3685  if (IS_CHANNEL_INVALID (channel))
3686  return false;
3687 
3688  ULWord value (0);
3689  bool result (ReadRegister(gChannelToSDIInput3GStatusRegNum[channel], value, gChannelToSDIIn3GModeMask[channel], gChannelToSDIIn3GModeShift[channel]));
3690  outValue = static_cast <bool> (value);
3691  return result;
3692 
3693 } // GetSDIInput3GPresent
3694 
3695 bool CNTV2Card::GetSDIInput3GbPresent (bool & outValue, const NTV2Channel channel)
3696 {
3697  if (IS_CHANNEL_INVALID (channel))
3698  return false;
3699 
3700  ULWord value (0);
3701  bool result (ReadRegister(gChannelToSDIInput3GStatusRegNum[channel], value, gChannelToSDIIn3GbModeMask[channel], gChannelToSDIIn3GbModeShift[channel]));
3702  outValue = static_cast <bool> (value);
3703  return result;
3704 
3705 } // GetSDIInput3GPresent
3706 
3707 bool CNTV2Card::GetSDIInput6GPresent (bool & outValue, const NTV2Channel channel)
3708 {
3709  if (IS_CHANNEL_INVALID (channel))
3710  return false;
3711 
3712  ULWord value (0);
3713  bool result (ReadRegister (gChannelToSDIInput3GStatusRegNum[channel], value, gChannelToSDIIn6GModeMask[channel], gChannelToSDIIn6GModeShift[channel]));
3714  outValue = static_cast <bool> (value);
3715  return result;
3716 
3717 } // GetSDIInput3GPresent
3718 
3719 bool CNTV2Card::GetSDIInput12GPresent (bool & outValue, const NTV2Channel channel)
3720 {
3721  if (IS_CHANNEL_INVALID (channel))
3722  return false;
3723 
3724  ULWord value (0);
3725  bool result (ReadRegister(gChannelToSDIInput3GStatusRegNum[channel], value, gChannelToSDIIn12GModeMask[channel], gChannelToSDIIn12GModeShift[channel]));
3726  outValue = static_cast <bool> (value);
3727  return result;
3728 
3729 } // GetSDIInput3GPresent
3730 
3731 
3732 bool CNTV2Card::SetLTCInputEnable (bool inEnable)
3733 {
3734  if (GetDeviceID() == DEVICE_ID_CORVID24)
3735  inEnable = !inEnable; // Oops, Corvid24's LTCOnRefInSelect bit sense was flipped
3738 }
3739 
3740 bool CNTV2Card::GetLTCInputEnable (bool & outIsEnabled)
3741 {
3743  return false;
3744  if (GetDeviceID() == DEVICE_ID_CORVID24)
3745  outIsEnabled = !outIsEnabled; // Oops, Corvid24's LTCOnRefInSelect bit sense was flipped
3746  return true;
3747 }
3748 
3749 bool CNTV2Card::GetLTCInputPresent (bool & outIsPresent, const UWord inLTCInputNdx)
3750 {
3751  if (ULWord(inLTCInputNdx) >= GetNumSupported(kDeviceGetNumLTCInputs))
3752  return false; // No such LTC input
3753  if (inLTCInputNdx) // LTCIn2
3755  else // LTCIn1
3756  {
3758  if(outIsPresent)
3759  return true;
3761  }
3762 }
3763 
3764 #if !defined(NTV2_DEPRECATE_16_3)
3765  bool CNTV2Card::SetLTCEmbeddedOutEnable (const bool inEnable)
3766  {
3768  }
3769 
3770  bool CNTV2Card::GetLTCEmbeddedOutEnable (bool & outEnabled)
3771  {
3773  }
3774 #endif // !defined(NTV2_DEPRECATE_16_3)
3775 
3776 bool CNTV2Card::ReadAnalogLTCInput (const UWord inLTCInput, RP188_STRUCT & outRP188Data)
3777 {
3778  NTV2_RP188 result;
3779  if (!ReadAnalogLTCInput(inLTCInput, result))
3780  return false;
3781  outRP188Data = result;
3782  return true;
3783 }
3784 
3785 
3786 bool CNTV2Card::ReadAnalogLTCInput (const UWord inLTCInput, NTV2_RP188 & outRP188Data)
3787 {
3788  outRP188Data.Set();
3789  if (ULWord(inLTCInput) >= GetNumSupported(kDeviceGetNumLTCInputs))
3790  return false;
3791 
3792  const ULWord regLo (inLTCInput ? kRegLTC2AnalogBits0_31 : kRegLTCAnalogBits0_31 );
3793  const ULWord regHi (inLTCInput ? kRegLTC2AnalogBits32_63 : kRegLTCAnalogBits32_63);
3794  outRP188Data.fDBB = 0;
3795  return ReadRegister(regLo, outRP188Data.fLo) && ReadRegister(regHi, outRP188Data.fHi);
3796 }
3797 
3798 
3799 bool CNTV2Card::GetAnalogLTCInClockChannel (const UWord inLTCInput, NTV2Channel & outChannel)
3800 {
3801  if (ULWord(inLTCInput) >= GetNumSupported(kDeviceGetNumLTCInputs))
3802  return false;
3803 
3804  ULWord value(0);
3805  if (!ReadRegister (kRegLTCStatusControl, value, 0x7, inLTCInput ? 9 : 1)) // Bits 1|2|3 for LTCIn1, bits 9|10|11 for LTCIn2
3806  return false;
3807  outChannel = NTV2Channel(value + 1);
3808  return true;
3809 }
3810 
3811 
3812 bool CNTV2Card::SetAnalogLTCInClockChannel (const UWord inLTCInput, const NTV2Channel inChannel)
3813 {
3814  if (ULWord(inLTCInput) >= GetNumSupported(kDeviceGetNumLTCInputs))
3815  return false;
3816  if (IS_CHANNEL_INVALID(inChannel))
3817  return false;
3818  return WriteRegister (kRegLTCStatusControl, inChannel - 1, 0x7, inLTCInput ? 9 : 1); // Bits 1|2|3 for LTCIn1, bits 9|10|11 for LTCIn2
3819 }
3820 
3821 
3822 bool CNTV2Card::WriteAnalogLTCOutput (const UWord inLTCOutput, const RP188_STRUCT & inRP188Data)
3823 {
3824  const NTV2_RP188 rp188data(inRP188Data);
3825  return WriteAnalogLTCOutput (inLTCOutput, rp188data);
3826 }
3827 
3828 
3829 bool CNTV2Card::WriteAnalogLTCOutput (const UWord inLTCOutput, const NTV2_RP188 & inRP188Data)
3830 {
3831  if (ULWord(inLTCOutput) >= GetNumSupported(kDeviceGetNumLTCOutputs))
3832  return false;
3833 
3834  return WriteRegister (inLTCOutput == 0 ? kRegLTCAnalogBits0_31 : kRegLTC2AnalogBits0_31, inRP188Data.fLo)
3835  && WriteRegister (inLTCOutput == 0 ? kRegLTCAnalogBits32_63 : kRegLTC2AnalogBits32_63, inRP188Data.fHi);
3836 }
3837 
3838 
3839 bool CNTV2Card::GetAnalogLTCOutClockChannel (const UWord inLTCOutput, NTV2Channel & outChannel)
3840 {
3841  if (ULWord(inLTCOutput) >= GetNumSupported(kDeviceGetNumLTCOutputs))
3842  return false;
3843 
3844  ULWord value(0);
3845  bool isMultiFormat(false);
3846  if (!GetMultiFormatMode(isMultiFormat))
3847  return false;
3848  if (!isMultiFormat)
3849  return false;
3850  if (!ReadRegister(kRegLTCStatusControl, value, 0x7, inLTCOutput ? 20 : 16)) // Bits 16|17|18 for LTCOut1, bits 20|21|22 for LTCOut2
3851  return false;
3852  outChannel = NTV2Channel(value + 1);
3853  return true;
3854 }
3855 
3856 
3857 bool CNTV2Card::SetAnalogLTCOutClockChannel (const UWord inLTCOutput, const NTV2Channel inChannel)
3858 {
3859  if (ULWord(inLTCOutput) >= GetNumSupported(kDeviceGetNumLTCOutputs))
3860  return false;
3861  if (IS_CHANNEL_INVALID (inChannel))
3862  return false;
3863  bool isMultiFormat(false);
3864  if (!GetMultiFormatMode(isMultiFormat))
3865  return false;
3866  if (!isMultiFormat)
3867  return false;
3868  return WriteRegister (kRegLTCStatusControl, inChannel - 1, 0x7, inLTCOutput ? 20 : 16); // Bits 16|17|18 for LTCOut1, bits 20|21|22 for LTCOut2
3869 }
3870 
3871 
3876 
3877 bool CNTV2Card::SetSDITransmitEnable (const NTV2Channel inChannel, const bool inEnable)
3878 {
3879  if (IS_CHANNEL_INVALID(inChannel))
3880  return false; // bad channel
3881  if (!IsSupported(kDeviceHasBiDirectionalSDI))
3882  return true; // no bidirectional SDI, OK
3883  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumVideoOutputs))
3884  return false; // no such SDI connector
3885  const ULWord mask(sSDIXmitEnableMasks[inChannel]), shift(sSDIXmitEnableShifts[inChannel]);
3886  return WriteRegister(kRegSDITransmitControl, ULWord(inEnable), mask, shift);
3887 }
3888 
3889 bool CNTV2Card::SetSDITransmitEnable (const NTV2ChannelSet & inSDIConnectors, const bool inEnable)
3890 {
3891  UWord failures(0);
3892  for (NTV2ChannelSetConstIter it(inSDIConnectors.begin()); it != inSDIConnectors.end(); ++it)
3893  if (!SetSDITransmitEnable(*it, inEnable))
3894  failures++;
3895  return !failures;
3896 }
3897 
3898 bool CNTV2Card::GetSDITransmitEnable (const NTV2Channel inChannel, bool & outIsEnabled)
3899 {
3900  if (IS_CHANNEL_INVALID(inChannel))
3901  return false; // invalid channel
3902  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumVideoOutputs))
3903  return false; // no such SDI connector
3904  if (!IsSupported(kDeviceHasBiDirectionalSDI))
3905  {outIsEnabled = true; return true;} // no bidirectional SDI, enabled, OK
3906  const ULWord mask(sSDIXmitEnableMasks[inChannel]), shift(sSDIXmitEnableShifts[inChannel]);
3907  return CNTV2DriverInterface::ReadRegister (kRegSDITransmitControl, outIsEnabled, mask, shift);
3908 }
3909 
3911 {
3912  outXmitSDIs.clear();
3913  const bool biDirectionalSDI (IsSupported(kDeviceHasBiDirectionalSDI));
3914  const NTV2Channel maxCh(NTV2Channel(GetNumSupported(kDeviceGetNumVideoOutputs)));
3915  bool isXmit(false);
3916  for (NTV2Channel ch(NTV2_CHANNEL1); ch < maxCh; ch = NTV2Channel(ch+1))
3917  if (!biDirectionalSDI || (GetSDITransmitEnable(ch, isXmit) && isXmit))
3918  outXmitSDIs.insert(ch);
3919  return true;
3920 }
3921 
3922 
3923 bool CNTV2Card::SetSDIOut2Kx1080Enable (NTV2Channel inChannel, const bool inIsEnabled)
3924 {
3925  if (IS_CHANNEL_INVALID (inChannel))
3926  return false;
3927  return WriteRegister (gChannelToSDIOutControlRegNum[inChannel], inIsEnabled, kK2RegMaskSDI1Out_2Kx1080Mode, kK2RegShiftSDI1Out_2Kx1080Mode);
3928 }
3929 
3930 bool CNTV2Card::GetSDIOut2Kx1080Enable(NTV2Channel inChannel, bool & outIsEnabled)
3931 {
3932  if (IS_CHANNEL_INVALID (inChannel))
3933  return false;
3935 }
3936 
3937 bool CNTV2Card::SetSDIOut3GEnable (const NTV2Channel inChannel, const bool inEnable)
3938 {
3939  if (IS_CHANNEL_INVALID(inChannel))
3940  return false;
3941  return WriteRegister (gChannelToSDIOutControlRegNum[inChannel], inEnable, kLHIRegMaskSDIOut3GbpsMode, kLHIRegShiftSDIOut3GbpsMode);
3942 }
3943 
3944 bool CNTV2Card::GetSDIOut3GEnable (const NTV2Channel inChannel, bool & outIsEnabled)
3945 {
3946  if (IS_CHANNEL_INVALID(inChannel))
3947  return false;
3949 }
3950 
3951 
3952 bool CNTV2Card::SetSDIOut3GbEnable (const NTV2Channel inChannel, const bool inEnable)
3953 {
3954  if (IS_CHANNEL_INVALID(inChannel))
3955  return false;
3957 }
3958 
3959 bool CNTV2Card::GetSDIOut3GbEnable (const NTV2Channel inChannel, bool & outIsEnabled)
3960 {
3961  if (IS_CHANNEL_INVALID(inChannel))
3962  return false;
3964 }
3965 
3966 bool CNTV2Card::SetSDIOut6GEnable (const NTV2Channel inChannel, const bool inEnable)
3967 {
3968  if (IS_CHANNEL_INVALID(inChannel))
3969  return false;
3970  const NTV2Channel channel (IsSupported(kDeviceCanDo12gRouting) ? inChannel : NTV2_CHANNEL3);
3971  if (inEnable)
3973  return WriteRegister(gChannelToSDIOutControlRegNum[channel], inEnable, kRegMaskSDIOut6GbpsMode, kRegShiftSDIOut6GbpsMode);
3974 }
3975 
3976 bool CNTV2Card::GetSDIOut6GEnable (const NTV2Channel inChannel, bool & outIsEnabled)
3977 {
3978  if (IS_CHANNEL_INVALID(inChannel))
3979  return false;
3980  bool is6G(false), is12G(false);
3981  NTV2Channel channel (IsSupported(kDeviceCanDo12gRouting) ? inChannel : NTV2_CHANNEL3);
3984  if (is6G && !is12G)
3985  outIsEnabled = true;
3986  else
3987  outIsEnabled = false;
3988  return result;
3989 }
3990 
3991 bool CNTV2Card::SetSDIOut12GEnable (const NTV2Channel inChannel, const bool inEnable)
3992 {
3993  if (IS_CHANNEL_INVALID(inChannel))
3994  return false;
3995  NTV2Channel channel (IsSupported(kDeviceCanDo12gRouting) ? inChannel : NTV2_CHANNEL3);
3996  if (inEnable)
3998  return WriteRegister(gChannelToSDIOutControlRegNum[channel], inEnable, kRegMaskSDIOut12GbpsMode, kRegShiftSDIOut12GbpsMode);
3999 }
4000 
4001 bool CNTV2Card::GetSDIOut12GEnable(const NTV2Channel inChannel, bool & outIsEnabled)
4002 {
4003  if (IS_CHANNEL_INVALID(inChannel))
4004  return false;
4005  NTV2Channel channel (IsSupported(kDeviceCanDo12gRouting) ? inChannel : NTV2_CHANNEL3);
4007 }
4008 
4009 
4010 bool CNTV2Card::GetSDIOutputAudioSystem (const NTV2Channel inChannel, NTV2AudioSystem & outAudioSystem)
4011 {
4012  outAudioSystem = NTV2_AUDIOSYSTEM_INVALID;
4013  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumVideoOutputs))
4014  return false; // illegal channel
4015 
4016  ULWord readVal;
4017  const ULWord regNum (gChannelToSDIOutControlRegNum[inChannel]);
4018  if (!ReadRegister (regNum, readVal, kK2RegMaskSDIOutDS1AudioSelect, kK2RegShiftSDIOutDS1AudioSelect))
4019  return false;
4020 
4021  readVal <<= kK2RegShiftSDIOutDS1AudioSelect;
4022  ULWord b2 = (readVal & kK2RegMaskSDIOutDS1Audio_Bit2) ? 1 : 0;
4023  ULWord b1 = (readVal & kK2RegMaskSDIOutDS1Audio_Bit1) ? 1 : 0;
4024  ULWord b0 = (readVal & kK2RegMaskSDIOutDS1Audio_Bit0) ? 1 : 0;
4025 
4026  outAudioSystem = NTV2AudioSystem(b2 * 4 + b1 * 2 + b0);
4027  return true;
4028 
4029 } // GetSDIOutputAudioSystem
4030 
4031 
4032 bool CNTV2Card::SetSDIOutputAudioSystem (const NTV2Channel inChannel, const NTV2AudioSystem inAudioSystem)
4033 {
4034 
4035  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumVideoOutputs))
4036  return false; // Invalid channel
4037  if (ULWord(inAudioSystem) >= GetNumSupported(kDeviceGetTotalNumAudioSystems))
4038  return false; // Invalid audio system
4039 
4040  // shift each bit from it's position in inAudioSystem to it's position in the register
4041  // bit 18 (MSB), bit 28, bit 30 (LSB)
4042  ULWord b2 = (inAudioSystem << 16) & kK2RegMaskSDIOutDS1Audio_Bit2;
4043  ULWord b1 = (inAudioSystem << 27) & kK2RegMaskSDIOutDS1Audio_Bit1;
4044  ULWord b0 = (inAudioSystem << 30) & kK2RegMaskSDIOutDS1Audio_Bit0;
4045 
4046  return WriteRegister (gChannelToSDIOutControlRegNum [inChannel], (b2 | b1 | b0) >> kK2RegShiftSDIOutDS1AudioSelect ,
4048 
4049 } // SetSDIOutputAudioSystem
4050 
4051 
4052 bool CNTV2Card::SetSDIOutputAudioSystem (const NTV2ChannelSet & inSDIOutputs, const NTV2AudioSystem inAudioSystem, const bool inDS2)
4053 {
4054  size_t numFailures(0);
4055  for (NTV2ChannelSet::const_iterator it(inSDIOutputs.begin()); it != inSDIOutputs.end(); ++it)
4056  if (!(inDS2 ? SetSDIOutputDS2AudioSystem(*it, inAudioSystem) : SetSDIOutputAudioSystem(*it, inAudioSystem)))
4057  numFailures++;
4058  return numFailures == 0;
4059 }
4060 
4061 
4063 {
4064  outAudioSystem = NTV2_AUDIOSYSTEM_INVALID;
4065  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumVideoOutputs))
4066  return false; // illegal channel
4067 
4068  ULWord readVal;
4069  const ULWord regNum (gChannelToSDIOutControlRegNum[inChannel]);
4070  if (!ReadRegister (regNum, readVal, kK2RegMaskSDIOutDS2AudioSelect, kK2RegShiftSDIOutDS2AudioSelect))
4071  return false;
4072 
4073  readVal <<= kK2RegShiftSDIOutDS2AudioSelect;
4074  ULWord b2 = (readVal & kK2RegMaskSDIOutDS2Audio_Bit2) ? 1 : 0;
4075  ULWord b1 = (readVal & kK2RegMaskSDIOutDS2Audio_Bit1) ? 1 : 0;
4076  ULWord b0 = (readVal & kK2RegMaskSDIOutDS2Audio_Bit0) ? 1 : 0;
4077 
4078  outAudioSystem = NTV2AudioSystem(b2 * 4 + b1 * 2 + b0);
4079  return true;
4080 
4081 } // GetSDIOutputDS2AudioSystem
4082 
4083 
4084 bool CNTV2Card::SetSDIOutputDS2AudioSystem (const NTV2Channel inChannel, const NTV2AudioSystem inAudioSystem)
4085 {
4086  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumVideoOutputs))
4087  return false; // Invalid channel
4088  if (ULWord(inAudioSystem) >= GetNumSupported(kDeviceGetTotalNumAudioSystems))
4089  return false; // Invalid audio system
4090 
4091  // shift each bit from it's position in inAudioSystem to it's position in the register
4092  // bit 19 (MSB), bit 29, bit 31 (LSB)
4093  ULWord b2 = (inAudioSystem << 17) & kK2RegMaskSDIOutDS2Audio_Bit2;
4094  ULWord b1 = (inAudioSystem << 28) & kK2RegMaskSDIOutDS2Audio_Bit1;
4095  ULWord b0 = (inAudioSystem << 31) & kK2RegMaskSDIOutDS2Audio_Bit0;
4096 
4097  return WriteRegister (gChannelToSDIOutControlRegNum [inChannel], (b2 | b1 | b0) >> kK2RegShiftSDIOutDS2AudioSelect ,
4099 
4100 } // SetSDIOutputDS2AudioSystem
4101 
4102 
4103 // SDI bypass relay control
4104 static bool WriteWatchdogControlBit (CNTV2Card & card, const ULWord inValue, const ULWord inMask, const ULWord inShift)
4105 {
4106  if (!card.KickSDIWatchdog())
4107  return false;
4108  return card.WriteRegister (kRegSDIWatchdogControlStatus, inValue, inMask, inShift);
4109 }
4110 
4111 
4113 {
4114  if (!IsSupported(kDeviceHasSDIRelays))
4115  return false;
4116  // Write 0x01234567 into Kick2 register to begin watchdog reset, then in < 30 msec,
4117  // write 0xA5A55A5A into Kick1 register to complete the reset...
4118  const bool status (WriteRegister(kRegSDIWatchdogKick2, 0x01234567));
4119  return status && WriteRegister(kRegSDIWatchdogKick1, 0xA5A55A5A);
4120 }
4121 
4123 {
4124  outValue = NTV2_RELAY_STATE_INVALID;
4125  if (!IsSupported(kDeviceHasSDIRelays))
4126  return false;
4127  ULWord statusBit(0);
4129  return false;
4130  outValue = statusBit ? NTV2_THROUGH_DEVICE : NTV2_DEVICE_BYPASSED;
4131  return true;
4132 }
4133 
4134 bool CNTV2Card::GetSDIRelayPosition (NTV2RelayState & outValue, const UWord inIndex0)
4135 {
4136  ULWord statusBit(0);
4137  outValue = NTV2_RELAY_STATE_INVALID;
4138  if (!IsSupported(kDeviceHasSDIRelays))
4139  return false;
4140  if (inIndex0 > 1)
4141  return false;
4142  if (!ReadRegister (kRegSDIWatchdogControlStatus, statusBit,
4145  return false;
4146  outValue = statusBit ? NTV2_THROUGH_DEVICE : NTV2_DEVICE_BYPASSED;
4147  return true;
4148 }
4149 
4151 {
4152  ULWord statusBit(0);
4153  outValue = NTV2_RELAY_STATE_INVALID;
4154  if (!IsSupported(kDeviceHasSDIRelays))
4155  return false;
4156  if (inIndex0 > 1)
4157  return false;
4158  if (!ReadRegister (kRegSDIWatchdogControlStatus, statusBit,
4161  return false;
4162  outValue = statusBit ? NTV2_THROUGH_DEVICE : NTV2_DEVICE_BYPASSED;
4163  return true;
4164 }
4165 
4166 bool CNTV2Card::SetSDIRelayManualControl (const NTV2RelayState inValue, const UWord inIndex0)
4167 {
4168  const ULWord statusBit ((inValue == NTV2_THROUGH_DEVICE) ? 1 : 0);
4169  if (!IsSupported(kDeviceHasSDIRelays))
4170  return false;
4171  if (inIndex0 > 1)
4172  return false;
4173  return WriteWatchdogControlBit (*this, statusBit,
4176 }
4177 
4178 bool CNTV2Card::GetSDIWatchdogEnable (bool & outValue, const UWord inIndex0)
4179 {
4180  ULWord statusBit(0);
4181  outValue = false;
4182  if (!IsSupported(kDeviceHasSDIRelays))
4183  return false;
4184  if (inIndex0 > 1)
4185  return false;
4186  if (!ReadRegister (kRegSDIWatchdogControlStatus, statusBit,
4189  return false;
4190  outValue = statusBit ? true : false;
4191  return true;
4192 }
4193 
4194 bool CNTV2Card::SetSDIWatchdogEnable (const bool inValue, const UWord inIndex0)
4195 {
4196  const ULWord statusBit ((inValue == NTV2_THROUGH_DEVICE) ? 1 : 0);
4197  if (!IsSupported(kDeviceHasSDIRelays))
4198  return false;
4199  if (inIndex0 > 1)
4200  return false;
4201  return WriteWatchdogControlBit (*this, statusBit,
4204 }
4205 
4207 {
4208  outValue = 0;
4209  if (!IsSupported(kDeviceHasSDIRelays))
4210  return false;
4211  return ReadRegister (kRegSDIWatchdogTimeout, outValue);
4212 }
4213 
4215 {
4216  return KickSDIWatchdog() && WriteRegister (kRegSDIWatchdogTimeout, inValue);
4217 }
4218 
4220 {
4221  return WriteRegister(kRegDC1, enable, kRegMask4KDCRGBMode, kRegShift4KDCRGBMode);
4222 }
4223 
4224 bool CNTV2Card::GetEnable4KDCRGBMode(bool & outIsEnabled)
4225 {
4226  ULWord tempVal (0);
4227  const bool retVal (ReadRegister (kRegDC1, tempVal, kRegMask4KDCRGBMode, kRegShift4KDCRGBMode));
4228  outIsEnabled = static_cast <bool> (tempVal);
4229  return retVal;
4230 }
4231 
4233 {
4234  return WriteRegister(kRegDC1, enable, kRegMask4KDCYCC444Mode, kRegShift4KDCYCC444Mode);
4235 }
4236 
4237 bool CNTV2Card::GetEnable4KDCYCC444Mode(bool & outIsEnabled)
4238 {
4239  ULWord tempVal (0);
4240  const bool retVal (ReadRegister (kRegDC1, tempVal, kRegMask4KDCYCC444Mode, kRegShift4KDCYCC444Mode));
4241  outIsEnabled = static_cast <bool> (tempVal);
4242  return retVal;
4243 }
4244 
4246 {
4247  return WriteRegister(kRegDC1, enable, kRegMask4KDCPSFInMode, kRegShift4KDCPSFInMode);
4248 }
4249 
4250 bool CNTV2Card::GetEnable4KDCPSFInMode(bool & outIsEnabled)
4251 {
4252  ULWord tempVal (0);
4253  const bool retVal (ReadRegister (kRegDC1, tempVal, kRegMask4KDCPSFInMode, kRegShift4KDCPSFInMode));
4254  outIsEnabled = static_cast <bool> (tempVal);
4255  return retVal;
4256 }
4257 
4259 {
4260  return WriteRegister(kRegDC1, enable, kRegMask4KDCPSFOutMode, kRegShift4KDCPSFOutMode);
4261 }
4262 
4263 bool CNTV2Card::GetEnable4KPSFOutMode(bool & outIsEnabled)
4264 {
4265  ULWord tempVal (0);
4266  const bool retVal (ReadRegister (kRegDC1, tempVal, kRegMask4KDCPSFOutMode, kRegShift4KDCPSFOutMode));
4267  outIsEnabled = static_cast <bool> (tempVal);
4268  return retVal;
4269 }
4270 
4271 
4273 {
4274  if (!IsSupported(kDeviceCanDoSDIErrorChecks))
4275  return 0;
4276  if (IS_CHANNEL_INVALID(inChannel))
4277  return 0;
4278  ULWord value(0);
4280  return value ? true : false;
4281 }
4282 
4283 bool CNTV2Card::GetSDILock (const NTV2Channel inChannel)
4284 {
4285  if (!IsSupported(kDeviceCanDoSDIErrorChecks))
4286  return 0;
4287  if (IS_CHANNEL_INVALID(inChannel))
4288  return 0;
4289  ULWord value(0);
4290  ReadRegister(gChannelToRXSDIStatusRegs[inChannel], value, kRegMaskSDIInLocked, kRegShiftSDIInLocked);
4291  return value ? true : false;
4292 }
4293 
4295 {
4296  if (!IsSupported(kDeviceCanDoSDIErrorChecks))
4297  return 0;
4298  if (IS_CHANNEL_INVALID(inChannel))
4299  return 0;
4300  ULWord value(0);
4302  return value;
4303 }
4304 
4306 {
4307  if (!IsSupported(kDeviceCanDoSDIErrorChecks))
4308  return 0;
4309  if (IS_CHANNEL_INVALID(inChannel))
4310  return 0;
4311  ULWord value(0);
4313  return value;
4314 }
4315 
4317 {
4318  if (!IsSupported(kDeviceCanDoSDIErrorChecks))
4319  return 0;
4320  if (IS_CHANNEL_INVALID(inChannel))
4321  return 0;
4322  ULWord value(0);
4324  return value;
4325 }
4326 
4327 bool CNTV2Card::SetSDIInLevelBtoLevelAConversion (const UWord inInputSpigot, const bool inEnable)
4328 {
4329  if (!IsSupported(kDeviceCanDo3GLevelConversion))
4330  return false;
4331  if (IS_INPUT_SPIGOT_INVALID (inInputSpigot))
4332  return false;
4333 
4334  ULWord regNum, mask, shift;
4335  switch (inInputSpigot)
4336  {
4345  default: return false;
4346  }
4347  return WriteRegister(regNum, inEnable, mask, shift);
4348 }
4349 
4350 bool CNTV2Card::SetSDIInLevelBtoLevelAConversion (const NTV2ChannelSet & inSDIInputs, const bool inEnable)
4351 {
4352  size_t errors(0);
4353  for (NTV2ChannelSetConstIter it(inSDIInputs.begin()); it != inSDIInputs.end(); ++it)
4354  if (!SetSDIInLevelBtoLevelAConversion(*it, inEnable))
4355  errors++;
4356  return !errors;
4357 }
4358 
4359 bool CNTV2Card::GetSDIInLevelBtoLevelAConversion (const UWord inInputSpigot, bool & outEnabled)
4360 {
4361  if (!IsSupported(kDeviceCanDo3GLevelConversion))
4362  return false;
4363  if (IS_INPUT_SPIGOT_INVALID (inInputSpigot))
4364  return false;
4365 
4366  ULWord regNum, mask, shift;
4367  switch (inInputSpigot)
4368  {
4377  default: return false;
4378  }
4379  return CNTV2DriverInterface::ReadRegister (regNum, outEnabled, mask, shift);
4380 }
4381 
4382 bool CNTV2Card::SetSDIOutLevelAtoLevelBConversion (const UWord inOutputSpigot, const bool inEnable)
4383 {
4384  if (!IsSupported(kDeviceCanDo3GLevelConversion))
4385  return false;
4386  if (IS_OUTPUT_SPIGOT_INVALID(inOutputSpigot))
4387  return false;
4388 
4389  return WriteRegister(gChannelToSDIOutControlRegNum[inOutputSpigot], inEnable, kRegMaskSDIOutLevelAtoLevelB, kRegShiftSDIOutLevelAtoLevelB);
4390 }
4391 
4392 bool CNTV2Card::SetSDIOutLevelAtoLevelBConversion (const NTV2ChannelSet & inSDIOutputs, const bool inEnable)
4393 {
4394  size_t errors(0);
4395  for (NTV2ChannelSetConstIter it(inSDIOutputs.begin()); it != inSDIOutputs.end(); ++it)
4396  if (!SetSDIOutLevelAtoLevelBConversion(*it, inEnable))
4397  errors++;
4398  return !errors;
4399 }
4400 
4401 bool CNTV2Card::GetSDIOutLevelAtoLevelBConversion (const UWord inOutputSpigot, bool & outEnable)
4402 {
4403  if (!IsSupported(kDeviceCanDo3GLevelConversion))
4404  return false;
4405  if (IS_OUTPUT_SPIGOT_INVALID (inOutputSpigot))
4406  return false;
4407 
4408  ULWord tempVal (0);
4409  const bool retVal (ReadRegister (gChannelToSDIOutControlRegNum[inOutputSpigot], tempVal, kRegMaskSDIOutLevelAtoLevelB, kRegShiftSDIOutLevelAtoLevelB));
4410  outEnable = static_cast <bool> (tempVal);
4411  return retVal;
4412 }
4413 
4414 bool CNTV2Card::SetSDIOutRGBLevelAConversion(const UWord inOutputSpigot, const bool inEnable)
4415 {
4416  if (!IsSupported(kDeviceCanDoRGBLevelAConversion))
4417  return false;
4418  if (IS_OUTPUT_SPIGOT_INVALID (inOutputSpigot))
4419  return false;
4420 
4421  return WriteRegister(gChannelToSDIOutControlRegNum[inOutputSpigot], inEnable, kRegMaskRGBLevelA, kRegShiftRGBLevelA);
4422 }
4423 
4424 bool CNTV2Card::SetSDIOutRGBLevelAConversion (const NTV2ChannelSet & inSDIOutputs, const bool inEnable)
4425 {
4426  size_t errors(0);
4427  for (NTV2ChannelSetConstIter it(inSDIOutputs.begin()); it != inSDIOutputs.end(); ++it)
4428  if (!SetSDIOutRGBLevelAConversion(*it, inEnable))
4429  errors++;
4430  return !errors;
4431 }
4432 
4433 bool CNTV2Card::GetSDIOutRGBLevelAConversion(const UWord inOutputSpigot, bool & outEnable)
4434 {
4435  if (!IsSupported(kDeviceCanDoRGBLevelAConversion))
4436  return false;
4437  if (IS_OUTPUT_SPIGOT_INVALID (inOutputSpigot))
4438  return false;
4439 
4440  ULWord tempVal(0);
4441  const bool retVal(ReadRegister(gChannelToSDIOutControlRegNum[inOutputSpigot], tempVal, kRegMaskRGBLevelA, kRegShiftRGBLevelA));
4442  outEnable = static_cast <bool> (tempVal);
4443  return retVal;
4444 }
4445 
4446 bool CNTV2Card::SetMultiFormatMode (const bool inEnable)
4447 {
4448  if (!IsSupported(kDeviceCanDoMultiFormat))
4449  return false;
4450 
4451  return WriteRegister (kRegGlobalControl2, inEnable ? 1 : 0, kRegMaskIndependentMode, kRegShiftIndependentMode);
4452 }
4453 
4454 bool CNTV2Card::GetMultiFormatMode (bool & outEnabled)
4455 {
4456  return IsSupported(kDeviceCanDoMultiFormat)
4458  : false;
4459 }
4460 
4461 bool CNTV2Card::SetRS422Parity (const NTV2Channel inChannel, const NTV2_RS422_PARITY inParity)
4462 {
4463  if (!IsSupported(kDeviceCanDoProgrammableRS422))
4464  return false; // Non-programmable RS422
4465  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumSerialPorts))
4466  return false;
4467  if (inParity == NTV2_RS422_NO_PARITY)
4468  {
4470  }
4471  else
4472  {
4473  ULWord tempVal (0);
4474  if (!ReadRegister (gChannelToRS422ControlRegNum[inChannel], tempVal))
4475  return false;
4476 
4477  tempVal &= ~kRegMaskRS422ParityDisable;
4478  switch (inParity)
4479  {
4480  case NTV2_RS422_ODD_PARITY: tempVal &= ~kRegMaskRS422ParitySense; break;
4481  case NTV2_RS422_EVEN_PARITY: tempVal |= kRegMaskRS422ParitySense; break;
4482 
4484  default: return false;
4485  }
4486 
4487  return WriteRegister (gChannelToRS422ControlRegNum [inChannel], tempVal);
4488  }
4489 }
4490 
4491 bool CNTV2Card::GetRS422Parity (const NTV2Channel inChannel, NTV2_RS422_PARITY & outParity)
4492 {
4493  outParity = NTV2_RS422_PARITY_INVALID;
4494  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumSerialPorts))
4495  return false;
4496 
4497  ULWord tempVal (0);
4498  if (IsSupported(kDeviceCanDoProgrammableRS422)) // Read register only if programmable RS422
4499  if (!ReadRegister (gChannelToRS422ControlRegNum[inChannel], tempVal))
4500  return false;
4501 
4502  if (tempVal & kRegMaskRS422ParityDisable)
4503  outParity = NTV2_RS422_NO_PARITY;
4504  else if (tempVal & kRegMaskRS422ParitySense)
4505  outParity = NTV2_RS422_EVEN_PARITY;
4506  else
4507  outParity = NTV2_RS422_ODD_PARITY; // Default
4508 
4509  return true;
4510 }
4511 
4512 bool CNTV2Card::SetRS422BaudRate (const NTV2Channel inChannel, const NTV2_RS422_BAUD_RATE inBaudRate)
4513 {
4514  if (!IsSupported(kDeviceCanDoProgrammableRS422))
4515  return false; // Non-programmable RS422
4516  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumSerialPorts))
4517  return false; // No such serial port
4518 
4519  ULWord tempVal (0);
4520  switch (inBaudRate)
4521  {
4522  case NTV2_RS422_BAUD_RATE_38400: tempVal = 0; break;
4523  case NTV2_RS422_BAUD_RATE_19200: tempVal = 1; break;
4524  case NTV2_RS422_BAUD_RATE_9600: tempVal = 2; break;
4526  #if !defined(_DEBUG)
4527  default:
4528  #endif
4529  return false;
4530  }
4531  return WriteRegister (gChannelToRS422ControlRegNum [inChannel], tempVal, kRegMaskRS422BaudRate, kRegShiftRS422BaudRate);
4532 }
4533 
4534 bool CNTV2Card::GetRS422BaudRate (const NTV2Channel inChannel, NTV2_RS422_BAUD_RATE & outBaudRate)
4535 {
4536  outBaudRate = NTV2_RS422_BAUD_RATE_INVALID;
4537  if (ULWord(inChannel) >= GetNumSupported(kDeviceGetNumSerialPorts))
4538  return false; // No such serial port
4539 
4540  ULWord tempVal (0); // Default to 38400
4541  if (IsSupported(kDeviceCanDoProgrammableRS422)) // Read register only if programmable RS422
4542  if (!ReadRegister (gChannelToRS422ControlRegNum[inChannel], tempVal, kRegMaskRS422BaudRate, kRegShiftRS422BaudRate))
4543  return false; // ReadRegister failed
4544 
4545  switch (tempVal)
4546  {
4547  case 0: outBaudRate = NTV2_RS422_BAUD_RATE_38400; break;
4548  case 1: outBaudRate = NTV2_RS422_BAUD_RATE_19200; break;
4549  case 2: outBaudRate = NTV2_RS422_BAUD_RATE_9600; break;
4550  default: return false;
4551  }
4552  return true;
4553 }
4554 
4556 {
4557  ULWord val = 0;
4558  ReadRegister(kVRegMailBoxAcquire, val);
4559  return val;
4560 }
4561 
4563 {
4564  ULWord val = 0;
4565  ReadRegister(kVRegMailBoxRelease, val);
4566  return val;
4567 }
4568 
4570 {
4571  ULWord val = 0;
4572  ReadRegister(kVRegMailBoxAbort, val);
4573  return val;
4574 }
4575 
4576 bool CNTV2Card::GetDieTemperature (double & outTemp, const NTV2DieTempScale inTempScale)
4577 {
4578  outTemp = 0.0;
4579 
4580  // Read the temperature...
4581  ULWord rawRegValue (0);
4582  if (!ReadRegister (kRegSysmonVccIntDieTemp, rawRegValue))
4583  return false;
4584 
4585  double celsius (0);
4586  if (IsSupported(kDeviceCanDoVersalSysMon))
4587  {
4588  UWord dieTempRaw (rawRegValue & 0x0000FFFF);
4589  celsius = double (dieTempRaw) / 128.0;
4590  }
4591  else
4592  {
4593  UWord dieTempRaw ((rawRegValue & 0x0000FFFF) >> 6);
4594  celsius = (double (dieTempRaw) * 503.975 / 1024.0 - 273.15);
4595  }
4596  switch (inTempScale)
4597  {
4598  case NTV2DieTempScale_Celsius: outTemp = celsius; break;
4599  case NTV2DieTempScale_Fahrenheit: outTemp = celsius * 9.0 / 5.0 + 32.0; break;
4600  case NTV2DieTempScale_Kelvin: outTemp = celsius + 273.15; break;
4601  case NTV2DieTempScale_Rankine: outTemp = (celsius + 273.15) * 9.0 / 5.0; break;
4602  default: return false;
4603  }
4604  return true;
4605 }
4606 
4607 bool CNTV2Card::GetDieVoltage (double & outVoltage)
4608 {
4609  outVoltage = 0.0;
4610 
4611  // Read the Vcc voltage...
4612  ULWord rawRegValue (0);
4613  if (!ReadRegister (kRegSysmonVccIntDieTemp, rawRegValue))
4614  return false;
4615 
4616  const UWord coreVoltageRaw ((rawRegValue>>22) & 0x00003FF);
4617  const double coreVoltageFloat (double(coreVoltageRaw)/ 1024.0 * 3.0);
4618  outVoltage = coreVoltageFloat;
4619  return true;
4620 }
4621 
4622 #if defined(READREGMULTICHANGE)
4623  bool CNTV2Card::ReadRegisters (const NTV2RegNumSet & inRegisters, NTV2RegisterValueMap & outValues)
4624  {
4625  outValues.clear ();
4626  if (!IsOpen())
4627  return false; // Device not open!
4628  if (inRegisters.empty())
4629  return false; // Nothing to do!
4630 
4631  NTV2GetRegisters getRegsParams (inRegisters);
4632  if (NTV2Message(getRegsParams))
4633  {
4634  if (!getRegsParams.GetRegisterValues(outValues))
4635  return false;
4636  }
4637  else // Non-atomic user-space workaround until GETREGS implemented in driver...
4638  for (NTV2RegNumSetConstIter iter(inRegisters.begin()); iter != inRegisters.end(); ++iter)
4639  {
4640  ULWord tempVal (0);
4641  if (*iter != kRegXenaxFlashDOUT) // Prevent firmware erase/program/verify failures
4642  if (ReadRegister (*iter, tempVal))
4643  outValues[*iter] = tempVal;
4644  }
4645  return outValues.size() == inRegisters.size();
4646  }
4647 #endif // !defined(READREGMULTICHANGE)
4648 
4649 
4651 {
4652  if (!_boardOpened)
4653  return false; // Device not open!
4654  if (inRegWrites.empty())
4655  return true; // Nothing to do!
4656 
4657  bool result(false);
4658  NTV2SetRegisters setRegsParams(inRegWrites);
4659  //cerr << "## DEBUG: CNTV2Card::WriteRegisters: setRegsParams: " << setRegsParams << endl;
4660  result = NTV2Message(setRegsParams);
4661  if (!result)
4662  {
4663  // Non-atomic user-space workaround until SETREGS implemented in driver...
4664  const NTV2RegInfo * pRegInfos = setRegsParams.mInRegInfos;
4665  UWord * pBadNdxs = setRegsParams.mOutBadRegIndexes;
4666  for (ULWord ndx(0); ndx < setRegsParams.mInNumRegisters; ndx++)
4667  if (!WriteRegister(pRegInfos[ndx].registerNumber, pRegInfos[ndx].registerValue, pRegInfos[ndx].registerMask, pRegInfos[ndx].registerShift))
4668  pBadNdxs[setRegsParams.mOutNumFailures++] = UWord(ndx);
4669  result = true;
4670  }
4671  if (result && setRegsParams.mInNumRegisters && setRegsParams.mOutNumFailures)
4672  result = false; // fail if any writes failed
4673  if (!result) CVIDFAIL("Failed: setRegsParams: " << setRegsParams);
4674  return result;
4675 }
4676 
4677 bool CNTV2Card::BankSelectWriteRegister (const NTV2RegInfo & inBankSelect, const NTV2RegInfo & inRegInfo)
4678 {
4679  NTV2BankSelGetSetRegs bankSelGetSetMsg (inBankSelect, inRegInfo, true);
4680  //cerr << "## DEBUG: CNTV2Card::BankSelectWriteRegister: " << bankSelGetSetMsg << endl;
4681  if (!NTV2Message(bankSelGetSetMsg))
4682  // Fall back to doing 2 ops & hope nobody else clobbers the bank select register...
4683  return WriteRegister(inBankSelect.registerNumber, inBankSelect.registerValue, inBankSelect.registerMask, inBankSelect.registerShift)
4684  && WriteRegister(inRegInfo.registerNumber, inRegInfo.registerValue, inRegInfo.registerMask, inRegInfo.registerShift);
4685  return true;
4686 }
4687 
4688 bool CNTV2Card::BankSelectReadRegister (const NTV2RegInfo & inBankSelect, NTV2RegInfo & inOutRegInfo)
4689 {
4690  NTV2BankSelGetSetRegs bankSelGetSetMsg (inBankSelect, inOutRegInfo);
4691  //cerr << "## DEBUG: CNTV2Card::BankSelectReadRegister: " << bankSelGetSetMsg << endl;
4692  if (!NTV2Message(bankSelGetSetMsg))
4693  // Fall back to doing 2 ops & hope nobody else clobbers the bank select register...
4694  return WriteRegister(inBankSelect.registerNumber, inBankSelect.registerValue, inBankSelect.registerMask, inBankSelect.registerShift)
4695  && ReadRegister(inOutRegInfo.registerNumber, inOutRegInfo.registerValue, inOutRegInfo.registerMask, inOutRegInfo.registerShift);
4696  if (bankSelGetSetMsg.mInRegInfos)
4697  inOutRegInfo = bankSelGetSetMsg.GetRegInfo();
4698  return true;
4699 }
4700 
4701 bool CNTV2Card::WriteVirtualData (const ULWord inTag, const void* inVirtualData, const ULWord inVirtualDataSize)
4702 {
4703  NTV2VirtualData virtualDataMsg (inTag, inVirtualData, inVirtualDataSize, true);
4704  //cerr << "## DEBUG: CNTV2Card::WriteVirtualData: " << virtualDataMsg << endl;
4705  return NTV2Message(virtualDataMsg);
4706 }
4707 
4708 bool CNTV2Card::ReadVirtualData (const ULWord inTag, void* outVirtualData, const ULWord inVirtualDataSize)
4709 {
4710  NTV2VirtualData virtualDataMsg (inTag, outVirtualData, inVirtualDataSize, false);
4711  //cerr << "## DEBUG: CNTV2Card::ReadVirtualData: " << virtualDataMsg << endl;
4712  return NTV2Message(virtualDataMsg);
4713 }
4714 
4716 {
4717  outStats.Clear ();
4718  if (!_boardOpened)
4719  return false; // Device not open!
4720  if (!IsSupported(kDeviceCanDoSDIErrorChecks))
4721  return false; // Device doesn't support it!
4722  if (!NTV2Message(outStats))
4723  {
4724  const ULWord numSDIInputs(GetNumSupported(kDeviceGetNumVideoInputs));
4725  NTV2RegisterReads sdiStatRegInfos;
4726  for (size_t sdi(0); sdi < numSDIInputs; sdi++)
4727  for (ULWord reg(0); reg < 6; reg++)
4728  sdiStatRegInfos.push_back(NTV2RegInfo(reg + gChannelToRXSDIStatusRegs[sdi]));
4729  sdiStatRegInfos.push_back(NTV2RegInfo(kRegRXSDIFreeRunningClockLow));
4730  sdiStatRegInfos.push_back(NTV2RegInfo(kRegRXSDIFreeRunningClockHigh));
4731  // Read the registers all at once...
4732  if (!ReadRegisters(sdiStatRegInfos))
4733  return false;
4734  // Stuff the results into outStats...
4735  for (size_t sdi(0); sdi < numSDIInputs; sdi++)
4736  {
4737  NTV2SDIInputStatus & outStat(outStats[sdi]);
4738  size_t ndx(sdi*6 + 0); // Start at kRegRXSDINStatus register
4739  NTV2_ASSERT(ndx < sdiStatRegInfos.size());
4740  NTV2RegInfo & regInfo(sdiStatRegInfos.at(ndx));
4741  NTV2_ASSERT(regInfo.registerNumber == gChannelToRXSDIStatusRegs[sdi]);
4742  outStat.mUnlockTally = regInfo.registerValue & kRegMaskSDIInUnlockCount;
4743  outStat.mLocked = regInfo.registerValue & kRegMaskSDIInLocked ? true : false;
4744  outStat.mFrameTRSError = regInfo.registerValue & kRegMaskSDIInTRSError ? true : false;
4745  outStat.mVPIDValidA = regInfo.registerValue & kRegMaskSDIInVpidValidA ? true : false;
4746  outStat.mVPIDValidB = regInfo.registerValue & kRegMaskSDIInVpidValidB ? true : false;
4747  regInfo = sdiStatRegInfos.at(ndx+1); // kRegRXSDINCRCErrorCount
4748  outStat.mCRCTallyA = regInfo.registerValue & kRegMaskSDIInCRCErrorCountA;
4749  outStat.mCRCTallyB = (regInfo.registerValue & kRegMaskSDIInCRCErrorCountB) >> kRegShiftSDIInCRCErrorCountB;
4750  // kRegRXSDINFrameCountHigh kRegRXSDINFrameCountLow
4751  //outStat.mFrameTally = (ULWord64(sdiStatRegInfos.at(ndx+2).registerValue) << 32) | ULWord64(sdiStatRegInfos.at(ndx+1).registerValue);
4752  // kRegRXSDINFrameRefCountHigh kRegRXSDINFrameRefCountLow
4753  outStat.mFrameRefClockCount = (ULWord64(sdiStatRegInfos.at(ndx+5).registerValue) << 32) | ULWord64(sdiStatRegInfos.at(ndx+4).registerValue);
4754  // kRegRXSDIFreeRunningClockHigh kRegRXSDIFreeRunningClockLow
4755  outStat.mGlobalClockCount = (ULWord64(sdiStatRegInfos.at(8*6+1).registerValue) << 32) | ULWord64(sdiStatRegInfos.at(8*6+0).registerValue);
4756  } // for each SDI input
4757  }
4758  return true;
4759 }
4760 
4761 bool CNTV2Card::SetMultiRasterBypassEnable (const bool inEnable)
4762 {
4763  return HasMultiRasterWidget() && WriteRegister(kRegMROutControl, inEnable, kRegMaskMRBypass, kRegShiftMRBypass);
4764 }
4765 
4767 {
4768  if (!HasMultiRasterWidget())
4769  return false;
4770  NTV2ULWordVector regs; regs.push_back(0); regs.push_back(0); regs.push_back(0); regs.push_back(0);
4771  if (!ReadRegister(kRegMRQ1Control, regs.at(0))
4772  || !ReadRegister(kRegMRQ2Control, regs.at(1))
4773  || !ReadRegister(kRegMRQ3Control, regs.at(2))
4774  || !ReadRegister(kRegMRQ4Control, regs.at(3)))
4775  return false;
4776  // Any enabled quadrant means the 4K frame is being written by the hardware
4777  outEnabled = (regs.at(0) & kRegMaskMREnable)
4778  || (regs.at(1) & kRegMaskMREnable)
4779  || (regs.at(2) & kRegMaskMREnable)
4780  || (regs.at(3) & kRegMaskMREnable);
4781 // CNTV2DriverInterface::ReadRegister(kRegMROutControl, outEnabled, kRegMaskMRBypass, kRegShiftMRBypass);
4782  return true;
4783 }
4784 
4786 {
4787  return HasMultiRasterWidget() && inChannel == NTV2Channel(GetNumSupported(kDeviceGetNumVideoChannels));
4788 }
4789 
4790 
4792 
4793 #ifdef MSWindows
4794 #pragma warning(default: 4800)
4795 #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 has SFP connectors.
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 has 25Gbps SFPs. (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)