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