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