AJA NTV2 SDK  17.1.1.1245
NTV2 SDK 17.1.1.1245
ntv2macdriverinterface.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
9 #include "ntv2nubaccess.h"
10 #include "ntv2utils.h"
11 #include <time.h>
12 #include <syslog.h>
13 #include <iostream>
14 #include <sstream>
15 #include <string>
16 #include <map>
17 #include <iomanip>
18 #include "ntv2devicefeatures.h"
19 #include "ajabase/system/lock.h"
20 #include "ajabase/system/debug.h"
21 #include "ajabase/system/atomic.h"
23 
24 #if !defined (NTV2_NULL_DEVICE)
25  extern "C"
26  {
27  #include <mach/mach.h>
28  }
29 #endif // !defined (NTV2_NULL_DEVICE)
30 
31 using namespace std;
32 
33 
34 static const char * GetKernErrStr (const kern_return_t inError);
37 static const string sNTV2PCIKEXTClassName ("com_aja_iokit_ntv2"); // AJA NTV2 KEXT's IOService class name
38 static const string sNTV2PCIDEXTName ("AJANTV2"); // AJA NTV2 DEXT's IOService name
39 
40 
41 // MacDriverInterface-specific Logging Macros
42 
43 #define HEX2(__x__) xHEX0N(0xFF & uint8_t (__x__),2)
44 #define HEX4(__x__) xHEX0N(0xFFFF & uint16_t(__x__),4)
45 #define HEX8(__x__) xHEX0N(0xFFFFFFFF & uint32_t(__x__),8)
46 #define HEX16(__x__) xHEX0N(uint64_t(__x__),16)
47 #define KR(_kr_) "kernResult=" << HEX8(_kr_) << "(" << GetKernErrStr(_kr_) << ")"
48 #define INSTP(_p_) HEX0N(uint64_t(_p_),16)
49 
50 #define DIFAIL(__x__) AJA_sERROR (AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
51 #define DIWARN(__x__) AJA_sWARNING(AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
52 #define DINOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
53 #define DIINFO(__x__) AJA_sINFO (AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
54 #define DIDBG(__x__) AJA_sDEBUG (AJA_DebugUnit_DriverInterface, INSTP(this) << "::" << AJAFUNC << ": " << __x__)
55 
56 #define MDIFAIL(__x__) AJA_sERROR (AJA_DebugUnit_DriverInterface, AJAFUNC << ": " << __x__)
57 #define MDIWARN(__x__) AJA_sWARNING(AJA_DebugUnit_DriverInterface, AJAFUNC << ": " << __x__)
58 #define MDINOTE(__x__) AJA_sNOTICE (AJA_DebugUnit_DriverInterface, AJAFUNC << ": " << __x__)
59 #define MDIINFO(__x__) AJA_sINFO (AJA_DebugUnit_DriverInterface, AJAFUNC << ": " << __x__)
60 #define MDIDBG(__x__) AJA_sDEBUG (AJA_DebugUnit_DriverInterface, AJAFUNC << ": " << __x__)
61 
62 
63 #if !defined (NTV2_NULL_DEVICE)
64  // This section builds 'libajantv2.a' with the normal linkage to the IOKit...
65  #define OS_IOMasterPort(_x_,_y_) ::IOMasterPort ((_x_), (_y_))
66  #define OS_IOServiceOpen(_w_,_x_,_y_,_z_) ::IOServiceOpen((_w_), (_x_), (_y_), (_z_))
67  #define OS_IOServiceClose(_x_) ::IOServiceClose ((_x_))
68  #define OS_IOServiceMatching(_x_) ::IOServiceMatching ((_x_))
69  #define OS_IOServiceNameMatching(_x_) ::IOServiceNameMatching((_x_))
70  #define OS_IOServiceGetMatchingServices(_x_,_y_,_z_) ::IOServiceGetMatchingServices ((_x_), (_y_), (_z_))
71  #define OS_IOIteratorNext(_x_) ::IOIteratorNext ((_x_))
72  #define OS_IOObjectRelease(_x_) ::IOObjectRelease ((_x_))
73  #define OS_IORegistryEntryCreateCFProperty(_w_,_x_,_y_,_z_) ::IORegistryEntryCreateCFProperty ((_w_), (_x_), (_y_), (_z_))
74  #define OS_IOConnectCallMethod(_q_,_r_,_s_,_t_,_u_,_v_,_w_,_x_,_y_,_z_) ::IOConnectCallMethod ((_q_), (_r_), (_s_), (_t_), (_u_), (_v_), (_w_), (_x_), (_y_), (_z_))
75  #define OS_IOConnectCallScalarMethod(_u_,_v_,_w_,_x_,_y_,_z_) ::IOConnectCallScalarMethod ((_u_), (_v_), (_w_), (_x_), (_y_), (_z_))
76  #define OS_IOConnectCallStructMethod(_u_,_v_,_w_,_x_,_y_,_z_) ::IOConnectCallStructMethod ((_u_), (_v_), (_w_), (_x_), (_y_), (_z_))
77  #define OS_IOConnectMapMemory(_u_,_v_,_w_,_x_,_y_,_z_) ::IOConnectMapMemory ((_u_), (_v_), (_w_), (_x_), (_y_), (_z_))
78  #define OS_IOKitGetBusyState(_x_,_y_) ::IOKitGetBusyState ((_x_), (_y_))
79  #define OS_IOKitWaitQuiet(_x_,_y_) ::IOKitWaitQuiet ((_x_), (_y_))
80 #else // NTV2_NULL_DEVICE defined
81  // STUB FUNCTIONS TO REPLACE IOKIT CALLS
82  // Eliminates all linkage to IOKit.
83  static IOReturn OS_IOMasterPort (const mach_port_t inPort, mach_port_t * pOutPort)
84  { (void)inPort;
85  MDIWARN("NTV2_NULL_DEVICE -- will not connect to IOKit");
86  if (pOutPort)
87  *pOutPort = 1;
88  return KERN_SUCCESS;
89  }
90  static kern_return_t OS_IOServiceOpen (const io_service_t inSvc, const task_port_t inTask, const uint32_t inType, io_connect_t * pOutConn)
91  { (void)inSvc; (void)inTask; (void)inType;
92  if (pOutConn) *pOutConn = 0;
93  return KERN_SUCCESS;
94  }
95  static IOReturn OS_IOServiceClose (const io_connect_t inConnection)
96  { (void)inConnection;
97  return KERN_SUCCESS;
98  }
99  static CFMutableDictionaryRef OS_IOServiceMatching (const char * pInName)
100  { (void)pInName;
101  return AJA_NULL;
102  }
103  static IOReturn OS_IOServiceGetMatchingServices (const mach_port_t inPort, const CFDictionaryRef inMatch, io_iterator_t * pOutIter)
104  { (void)inPort; (void)inMatch;
105  if (pOutIter)
106  *pOutIter = 0;
107  return KERN_SUCCESS;
108  }
109  static io_object_t OS_IOIteratorNext (io_iterator_t inIter)
110  { (void)inIter;
111  return 0;
112  }
113  static IOReturn OS_IOObjectRelease (io_object_t inObj)
114  { (void)inObj;
115  return KERN_SUCCESS;
116  }
117  static CFTypeRef OS_IORegistryEntryCreateCFProperty (const io_registry_entry_t inEntry, const CFStringRef inKey, const CFAllocatorRef inAllocator, const IOOptionBits inOptions)
118  { (void)inEntry; (void)inKey; (void)inAllocator; (void)inOptions;
119  return AJA_NULL;
120  }
121  static IOReturn OS_IOConnectCallScalarMethod (const mach_port_t inConnect, const uint32_t inSelector, const uint64_t * pInput, const uint32_t inCount, uint64_t * pOutput, uint32_t * pOutCount)
122  { (void)inConnect; (void)inSelector; (void)pInput; (void)inCount;
123  if (pOutput) *pOutput = 0;
124  if (pOutCount) *pOutCount = 0;
125  return KERN_SUCCESS;
126  }
127  static kern_return_t OS_IOConnectCallMethod (const mach_port_t inConnect, const uint32_t inSelector, const uint64_t * pInput, uint32_t inputCnt, const void * pInStruct, const size_t inStructCnt, uint64_t * pOutput, uint32_t * pOutputCnt, void * pOutStruct, size_t * pOutStructCnt)
128  { (void)inConnect; (void)inSelector; (void)pInput; (void)inputCnt; (void)pInStruct; (void)inStructCnt; (void)pOutput; (void)pOutputCnt; (void)pOutStruct; (void)pOutStructCnt;
129  return KERN_SUCCESS;
130  }
131  static IOReturn OS_IOKitGetBusyState (const mach_port_t inPort, uint32_t * pOutState)
132  { (void)inPort;
133  if (pOutState)
134  *pOutState = 0;
135  return KERN_SUCCESS;
136  }
137  static IOReturn OS_IOKitWaitQuiet (const mach_port_t inPort, const mach_timespec_t * pInOutWait)
138  { (void)inPort; (void)pInOutWait;
139  return KERN_SUCCESS;
140  }
141  static IOReturn OS_IOConnectCallStructMethod (const io_connect_t inPort, const uint32_t inSelector, const void *inputStruct, size_t inputStructCnt, void *pOutStruct, size_t *pOutStructCnt)
142  { (void)inPort; (void)inSelector; (void)inputStruct; (void)inputStructCnt; (void)pOutStruct; (void)pOutStructCnt;
143  return KERN_SUCCESS;
144  }
145  static kern_return_t OS_IOConnectMapMemory (const io_connect_t inPort, const uint32_t inMemType, const task_port_t inTask, mach_vm_address_t * pAddr, mach_vm_size_t * pOutSize, const IOOptionBits inOpts)
146  { (void)inPort; (void)inMemType; (void)inTask; (void)pAddr; (void)pOutSize; (void)inOpts;
147  return KERN_SUCCESS;
148  }
149 #endif // NTV2_NULL_DEVICE defined
150 
151 //--------------------------------------------------------------------------------------------------------------------
152 // CNTV2MacDriverInterface
153 //
154 // Constructor
155 //--------------------------------------------------------------------------------------------------------------------
157 {
158  mIsDEXT = false;
159  mConnection = 0;
160 }
161 
162 
163 //--------------------------------------------------------------------------------------------------------------------
164 // ~CNTV2MacDriverInterface
165 //--------------------------------------------------------------------------------------------------------------------
167 {
168  if (IsOpen())
169  Close();
170 }
171 
172 #if !defined(NTV2_NULL_DEVICE)
173  //--------------------------------------------------------------------------------------------------------------------
174  // Open
175  //--------------------------------------------------------------------------------------------------------------------
177  {
178  // Make a new connection...
179  io_iterator_t ioIterator (0);
180  IOReturn error (kIOReturnSuccess);
181  io_object_t ioObject (0);
182  static const string kSvcNames[] = {sNTV2PCIDEXTName, sNTV2PCIKEXTClassName, ""}; // Try DEXT first, then KEXT
183 
184  for (size_t svcNdx(0); svcNdx < 2 && !mConnection; svcNdx++)
185  {
186  const string & svcName (kSvcNames[svcNdx]);
187  const char * pSvcName(svcName.c_str());
188  const bool tryKEXT (svcName.find("com_aja_iokit") != string::npos);
189 
190  // Create an iterator to search for our driver instances...
191  error = OS_IOServiceGetMatchingServices (kIOMasterPortDefault,
192  tryKEXT ? OS_IOServiceMatching(pSvcName) : OS_IOServiceNameMatching(pSvcName),
193  &ioIterator);
194  if (error != kIOReturnSuccess)
195  {DIWARN(KR(error) << ": No '" << svcName << "' driver"); continue;}
196 
197  // Find nth device -- and only use that one...
198  for (UWord ndx(inDeviceIndex); (ioObject = OS_IOIteratorNext(ioIterator)); OS_IOObjectRelease(ioObject))
199  if (ndx == 0)
200  break; // Found a match!
201  else
202  --ndx;
203 
204  if (ioIterator)
205  OS_IOObjectRelease(ioIterator);
206  if (!ioObject)
207  {
208  if (!inDeviceIndex) // Warn only if requesting first device, to show "no devices"
209  DIWARN("No '" << svcName << "' devices");
210  continue; // No service object
211  }
212 
213  // Found the device we want -- open it...
214  error = OS_IOServiceOpen (ioObject, ::mach_task_self(), 0, &mConnection);
215  OS_IOObjectRelease(ioObject);
216  if (error != kIOReturnSuccess)
217  {DIWARN(KR(error) << ": IOServiceOpen failed for '" << svcName << "' ndx=" << inDeviceIndex); continue;}
218 
219  mIsDEXT = !tryKEXT;
220  } // for each in kServiceNames
221 
222  _boardOpened = mConnection != 0;
223  if (IsOpen())
224  DIDBG((mIsDEXT ? "DEXT" : "KEXT") << " ndx=" << inDeviceIndex << " conn=" << HEX8(GetIOConnect()) << " opened");
225  else
226  {DIFAIL(INSTP(this) << ": No connection: ndx=" << inDeviceIndex); return false;}
227 
228  _boardNumber = inDeviceIndex;
230  {
231  DIFAIL("ReadRegister(kRegBoardID) failed: ndx=" << inDeviceIndex << " con=" << HEX8(GetIOConnect()) << " boardID=" << HEX8(_boardID));
232  Close();
233  return false;
234  }
235 
236  // Good to go...
237  DIDBG("Opened ndx=" << _boardNumber << " con=" << HEX8(GetIOConnect()) << " id=" << ::NTV2DeviceIDToString(_boardID));
238  return true;
239 
240  } // OpenLocalPhysical
241 
242 
244  {
245  NTV2_ASSERT(!IsRemote());
246  DIDBG("Closed " << (mIsDEXT ? "DEXT" : "KEXT") << " ndx=" << _boardNumber << " con=" << HEX8(GetIOConnect()) << " id=" << ::NTV2DeviceIDToString(_boardID));
247  _boardOpened = false;
248  _boardNumber = 0;
249  if (mConnection)
250  OS_IOServiceClose(mConnection);
251  mConnection = 0;
252  mIsDEXT = false;
253  return true;
254 
255  } // CloseLocalPhysical
256 #endif // !defined(NTV2_NULL_DEVICE)
257 
258 
259 #if !defined(NTV2_DEPRECATE_16_0)
260  //--------------------------------------------------------------------------------------------------------------------
261  // GetPCISlotNumber
262  //
263  // Returns my PCI slot number, if known; otherwise returns zero.
264  //--------------------------------------------------------------------------------------------------------------------
266  {
267  // TBD: Determine where in the IORegistry the io_connect_t is, then navigate up to the io_registry_entry
268  // for our driver that contains the "AJAPCISlot" property. Then proceed as before...
269  return 0; // FINISH THIS
270  } // GetPCISlotNumber
271 
272  //--------------------------------------------------------------------------------------------------------------------
273  // MapFrameBuffers
274  //
275  // Return a pointer and size of either the register map or frame buffer memory.
276  //--------------------------------------------------------------------------------------------------------------------
278  {
279  UByte *baseAddr;
280  if (!MapMemory (kFrameBufferMemory, reinterpret_cast<void**>(&baseAddr)))
281  {
282  _pFrameBaseAddress = AJA_NULL;
283  _pCh1FrameBaseAddress = _pCh2FrameBaseAddress = AJA_NULL; // DEPRECATE!
284  return false;
285  }
286  _pFrameBaseAddress = reinterpret_cast<ULWord*>(baseAddr);
287  return true;
288  }
289 
291  {
292  _pFrameBaseAddress = AJA_NULL;
293  _pCh1FrameBaseAddress = _pCh2FrameBaseAddress = AJA_NULL; // DEPRECATE!
294  return true;
295  }
296 
297  //--------------------------------------------------------------------------------------------------------------------
298  // MapRegisters
299  //--------------------------------------------------------------------------------------------------------------------
301  {
302  ULWord *baseAddr;
303  if (!MapMemory (kRegisterMemory, reinterpret_cast<void**>(&baseAddr)))
304  {
305  _pRegisterBaseAddress = AJA_NULL;
306  return false;
307  }
308  _pRegisterBaseAddress = reinterpret_cast<ULWord*>(baseAddr);
309  return true;
310  }
311 
313  {
314  _pRegisterBaseAddress = AJA_NULL;
315  return true;
316  }
317 
318  //--------------------------------------------------------------------------------------------------------------------
319  // Map / Unmap Xena2Flash
320  //--------------------------------------------------------------------------------------------------------------------
322  {
323  ULWord *baseAddr;
324  if (!MapMemory (kXena2FlashMemory, reinterpret_cast<void**>(&baseAddr)))
325  {
326  _pXena2FlashBaseAddress = AJA_NULL;
327  return false;
328  }
329  _pXena2FlashBaseAddress = reinterpret_cast<ULWord*>(baseAddr);
330  return true;
331  }
332 
334  {
335  _pXena2FlashBaseAddress = AJA_NULL;
336  return true;
337  }
338 
339  //--------------------------------------------------------------------------------------------------------------------
340  // MapMemory
341  //--------------------------------------------------------------------------------------------------------------------
342  bool CNTV2MacDriverInterface::MapMemory (const MemoryType memType, void **memPtr)
343  {
344 #ifndef __LP64__
345  return false;
346 #endif
347  if (GetIOConnect())
348  {
349  mach_vm_size_t size(0);
350  OS_IOConnectMapMemory ( GetIOConnect(), memType, mach_task_self(),
351  reinterpret_cast<mach_vm_address_t*>(memPtr),
352  &size, kIOMapDefaultCache | kIOMapAnywhere);
353  return size > 0;
354  }
355  return false;
356  }
357 
358  //--------------------------------------------------------------------------------------------------------------------
359  // SystemControl
360  //--------------------------------------------------------------------------------------------------------------------
362  {
363  kern_return_t kernResult = KERN_FAILURE;
364  uint64_t scalarI_64[2] = {uint64_t(dataPtr), controlCode};
365  uint32_t outputCount = 0;
366  if (controlCode != SCC_Test)
367  kernResult = KERN_INVALID_ARGUMENT;
368  else if (GetIOConnect())
369  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
370  kDriverSystemControl, // selector of the function to be called via the user client.
371  scalarI_64, // array of scalar (64-bit) input values.
372  2, // the number of scalar input values.
373  AJA_NULL, // array of scalar (64-bit) output values.
374  &outputCount); // pointer to the number of scalar output values.
375  if (kernResult == KERN_SUCCESS)
376  return true;
377  DIFAIL (KR(kernResult) << ", con=" << HEX8(GetIOConnect()));
378  return false;
379  }
380 #endif // !defined(NTV2_DEPRECATE_16_0)
381 
382 #pragma mark - New Driver Calls
383 
384 //--------------------------------------------------------------------------------------------------------------------
385 // ReadRegister
386 //
387 // Return the value of specified register after masking and shifting the value.
388 //--------------------------------------------------------------------------------------------------------------------
389 bool CNTV2MacDriverInterface::ReadRegister (const ULWord inRegNum, ULWord & outValue, const ULWord inMask, const ULWord inShift)
390 {
391  if (inShift >= 32)
392  {
393  DIFAIL("Shift " << DEC(inShift) << " > 31, reg=" << DEC(inRegNum) << " msk=" << xHEX0N(inMask,8));
394  return false;
395  }
396 #if defined (NTV2_NUB_CLIENT_SUPPORT)
397  if (IsRemote())
398  return CNTV2DriverInterface::ReadRegister(inRegNum, outValue, inMask, inShift);
399 #endif // defined (NTV2_NUB_CLIENT_SUPPORT)
400  kern_return_t kernResult(KERN_FAILURE);
401  uint64_t scalarI_64[3] = {inRegNum, inMask, inShift};
402  uint64_t scalarO_64 = outValue;
403  uint32_t outputCount = 1;
404  if (GetIOConnect())
405  {
407  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
408  kDriverReadRegister, // selector of the function to be called via the user client.
409  scalarI_64, // array of scalar (64-bit) input values.
410  mIsDEXT ? 3 : 2, // the number of scalar input values.
411  &scalarO_64, // array of scalar (64-bit) output values.
412  &outputCount); // pointer to the number of scalar output values.
414  }
415  outValue = uint32_t(scalarO_64);
416  if (kernResult == KERN_SUCCESS)
417  return true;
418  DIFAIL(KR(kernResult) << ": ndx=" << _boardNumber << ", con=" << HEX8(GetIOConnect())
419  << " -- reg=" << DEC(inRegNum) << ", mask=" << HEX8(inMask) << ", shift=" << HEX8(inShift));
420  return false;
421 }
422 
423 
424 //--------------------------------------------------------------------------------------------------------------------
425 // WriteRegister
426 //
427 // Set the specified register value taking into accout the bit mask.
428 // If the bit mask is not 0xFFFFFFFF (default) or 0, then this does a read-modify-write.
429 //--------------------------------------------------------------------------------------------------------------------
430 bool CNTV2MacDriverInterface::WriteRegister (const ULWord inRegNum, const ULWord inValue, const ULWord inMask, const ULWord inShift)
431 {
432  if (inShift >= 32)
433  {
434  DIFAIL("Shift " << DEC(inShift) << " > 31, reg=" << DEC(inRegNum) << " msk=" << xHEX0N(inMask,8));
435  return false;
436  }
437 #if defined(NTV2_WRITEREG_PROFILING) // Register Write Profiling
438  if (mRecordRegWrites)
439  {
440  AJAAutoLock autoLock(&mRegWritesLock);
441  mRegWrites.push_back(NTV2RegInfo(inRegNum, inValue, inMask, inShift));
442  if (mSkipRegWrites)
443  return true;
444  }
445 #endif // defined(NTV2_WRITEREG_PROFILING) // Register Write Profiling
446 #if defined(NTV2_NUB_CLIENT_SUPPORT)
447  if (IsRemote())
448  return CNTV2DriverInterface::WriteRegister(inRegNum, inValue, inMask, inShift);
449 #endif // defined (NTV2_NUB_CLIENT_SUPPORT)
450  kern_return_t kernResult(KERN_FAILURE);
451  uint64_t scalarI_64[4] = {inRegNum, inValue, inMask, inShift};
452  uint32_t outputCount = 0;
453  if (GetIOConnect())
454  {
456  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
457  kDriverWriteRegister, // selector of the function to be called via the user client.
458  scalarI_64, // array of scalar (64-bit) input values.
459  mIsDEXT ? 4 : 3, // the number of scalar input values.
460  AJA_NULL, // array of scalar (64-bit) output values.
461  &outputCount); // pointer to the number of scalar output values.
463  }
464  if (kernResult == KERN_SUCCESS)
465  return true;
466  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()) << " -- reg=" << inRegNum
467  << ", val=" << HEX8(inValue) << ", mask=" << HEX8(inMask) << ", shift=" << HEX8(inShift));
468  return false;
469 }
470 
471 
472 const uint32_t kAgentAppFcc (NTV2_FOURCC('A','j','a','A'));
473 //--------------------------------------------------------------------------------------------------------------------
474 // AcquireStreamForApplication
475 //
476 // Aquire board by by waiting for current board to release its resources
477 //
478 // Note: When quicktime is using the board, desktop output on the board is disabled
479 // by the driver.
480 //--------------------------------------------------------------------------------------------------------------------
482 {
483 #if defined(NTV2_NUB_CLIENT_SUPPORT)
484  if (IsRemote())
486 #endif // defined (NTV2_NUB_CLIENT_SUPPORT)
487  ULWord svcInitialized(0);
488  if (ReadRegister(kVRegServicesInitialized, svcInitialized))
489  if (!svcInitialized) // if services have never initialized the device
490  if (appType != kAgentAppFcc) // if not AJA Agent
491  DIWARN(::NTV2DeviceIDToString(GetDeviceID()) << "-" << DEC(GetIndexNumber())
492  << " uninitialized by AJAAgent, requesting app " << xHEX0N(appType,8) << ", pid=" << DEC(pid));
493 
494  kern_return_t kernResult = KERN_FAILURE;
495  uint64_t scalarI_64[2] = {uint64_t(appType), uint64_t(pid)};
496  uint32_t outputCount = 0;
497  if (GetIOConnect())
498  {
499  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
500  kDriverAcquireStreamForApplication, // selector of the function to be called via the user client.
501  scalarI_64, // array of scalar (64-bit) input values.
502  2, // the number of scalar input values.
503  AJA_NULL, // array of scalar (64-bit) output values.
504  &outputCount); // pointer to the number of scalar output values.
505  }
506  if (kernResult == KERN_SUCCESS)
507  return true;
508  DIFAIL(KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
509  return false;
510 }
511 
512 
513 //--------------------------------------------------------------------------------------------------------------------
514 // ReleaseStreamForApplication
515 //--------------------------------------------------------------------------------------------------------------------
517 {
518 #if defined(NTV2_NUB_CLIENT_SUPPORT)
519  if (IsRemote())
521 #endif // defined (NTV2_NUB_CLIENT_SUPPORT)
522  kern_return_t kernResult = KERN_FAILURE;
523  uint64_t scalarI_64[2] = {uint64_t(appType), uint64_t(pid)};
524  uint32_t outputCount = 0;
525  if (GetIOConnect())
526  {
527  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
528  kDriverReleaseStreamForApplication, // selector of the function to be called via the user client.
529  scalarI_64, // array of scalar (64-bit) input values.
530  2, // the number of scalar input values.
531  AJA_NULL, // array of scalar (64-bit) output values.
532  &outputCount); // pointer to the number of scalar output values.
533  }
534  if (kernResult == KERN_SUCCESS)
535  return true;
536  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
537  return false;
538 }
539 
540 
541 //--------------------------------------------------------------------------------------------------------------------
542 // AcquireStreamForApplicationWithReference
543 //
544 // Do a reference counted acquire
545 // Use this call ONLY with ReleaseStreamForApplicationWithReference
546 // Aquire board by by waiting for current board to release its resources
547 //
548 // Note: When quicktime is using the board, desktop output on the board is disabled
549 // by the driver.
550 //--------------------------------------------------------------------------------------------------------------------
552 {
553 #if defined(NTV2_NUB_CLIENT_SUPPORT)
554  if (IsRemote())
556 #endif // defined (NTV2_NUB_CLIENT_SUPPORT)
557  ULWord svcInitialized(0);
558  if (ReadRegister(kVRegServicesInitialized, svcInitialized))
559  if (!svcInitialized) // if services have never initialized the device
560  if (appType != kAgentAppFcc) // if not AJA Agent
561  DIWARN(::NTV2DeviceIDToString(GetDeviceID()) << "-" << DEC(GetIndexNumber())
562  << " uninitialized by AJAAgent, requesting app " << xHEX0N(appType,8) << ", pid=" << DEC(pid));
563 
564  kern_return_t kernResult = KERN_FAILURE;
565  uint64_t scalarI_64[2] = {uint64_t(appType), uint64_t(pid)};
566  uint32_t outputCount = 0;
567  if (GetIOConnect())
568  {
569  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
570  kDriverAcquireStreamForApplicationWithReference, // selector of the function to be called via the user client.
571  scalarI_64, // array of scalar (64-bit) input values.
572  2, // the number of scalar input values.
573  AJA_NULL, // array of scalar (64-bit) output values.
574  &outputCount); // pointer to the number of scalar output values.
575  }
576  if (kernResult == KERN_SUCCESS)
577  return true;
578  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
579  return false;
580 }
581 
582 
583 //--------------------------------------------------------------------------------------------------------------------
584 // ReleaseStreamForApplicationWithReference
585 //
586 // Do a reference counted release
587 // Use this call ONLY with AcquireStreamForApplicationWithReference
588 //--------------------------------------------------------------------------------------------------------------------
590 {
591 #if defined(NTV2_NUB_CLIENT_SUPPORT)
592  if (IsRemote())
594 #endif // defined (NTV2_NUB_CLIENT_SUPPORT)
595  kern_return_t kernResult = KERN_FAILURE;
596  uint64_t scalarI_64[2] = {uint64_t(appType), uint64_t(pid)};
597  uint32_t outputCount = 0;
598  if (GetIOConnect())
599  {
600  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
601  kDriverReleaseStreamForApplicationWithReference, // selector of the function to be called via the user client.
602  scalarI_64, // array of scalar (64-bit) input values.
603  2, // the number of scalar input values.
604  AJA_NULL, // array of scalar (64-bit) output values.
605  &outputCount); // pointer to the number of scalar output values.
606  }
607  if (kernResult == KERN_SUCCESS)
608  return true;
609  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
610  return false;
611 }
612 
613 
614 //--------------------------------------------------------------------------------------------------------------------
615 // Get/Set Streaming Application
616 //
617 // Forced aquisition of board for exclusive use by app
618 // Use with care - better to use AcquireStreamForApplication
619 //
620 // Note: When quicktime is using the board, desktop output on the board is disabled
621 // by the driver.
622 //--------------------------------------------------------------------------------------------------------------------
624 {
625 #if defined(NTV2_NUB_CLIENT_SUPPORT)
626  if (IsRemote())
627  return CNTV2DriverInterface::SetStreamingApplication (appType, pid);
628 #endif // defined (NTV2_NUB_CLIENT_SUPPORT)
629  kern_return_t kernResult = KERN_FAILURE;
630  uint64_t scalarI_64[2] = {uint64_t(appType), uint64_t(pid)};
631  uint32_t outputCount = 0;
632  if (GetIOConnect())
633  {
634  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
635  kDriverSetStreamForApplication, // selector of the function to be called via the user client.
636  scalarI_64, // array of scalar (64-bit) input values.
637  2, // the number of scalar input values.
638  AJA_NULL, // array of scalar (64-bit) output values.
639  &outputCount); // pointer to the number of scalar output values.
640  }
641  if (kernResult == KERN_SUCCESS)
642  return true;
643  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
644  return false;
645 }
646 
647 
648 //--------------------------------------------------------------------------------------------------------------------
649 // GetStreamingApplication
650 //--------------------------------------------------------------------------------------------------------------------
651 bool CNTV2MacDriverInterface::GetStreamingApplication (ULWord & outAppType, int32_t & outProcessID)
652 {
653 #if defined(NTV2_NUB_CLIENT_SUPPORT)
654  if (IsRemote())
655  return CNTV2DriverInterface::GetStreamingApplication (outAppType, outProcessID);
656 #endif // defined (NTV2_NUB_CLIENT_SUPPORT)
657  kern_return_t kernResult = KERN_FAILURE;
658  uint64_t scalarO_64[2] = {0, 0};
659  uint32_t outputCount(2);
660  if (GetIOConnect())
661  {
662  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
663  kDriverGetStreamForApplication, // selector of the function to be called via the user client.
664  AJA_NULL, // array of scalar (64-bit) input values.
665  0, // the number of scalar input values.
666  scalarO_64, // array of scalar (64-bit) output values.
667  &outputCount); // pointer to the number of scalar output values.
668  }
669  outAppType = ULWord(scalarO_64[0]);
670  outProcessID = int32_t(scalarO_64[1]);
671  if (kernResult == KERN_SUCCESS)
672  return true;
673  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
674  return false;
675 }
676 
677 
678 //--------------------------------------------------------------------------------------------------------------------
679 // KernelLog
680 //--------------------------------------------------------------------------------------------------------------------
681 bool CNTV2MacDriverInterface::KernelLog (void * dataPtr, UInt32 dataSize)
682 {
683  kern_return_t kernResult = KERN_FAILURE;
684  uint64_t scalarI_64[2] = {uint64_t(dataPtr), dataSize};
685  uint32_t outputCount = 0;
686  if (GetIOConnect())
687  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
688  kDriverKernelLog, // selector of the function to be called via the user client.
689  scalarI_64, // array of scalar (64-bit) input values.
690  2, // the number of scalar input values.
691  AJA_NULL, // array of scalar (64-bit) output values.
692  &outputCount); // pointer to the number of scalar output values.
693  if (kernResult == KERN_SUCCESS)
694  return true;
695  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
696  return false;
697 }
698 
699 
700 static const uint32_t sIntEnumToStatKeys[] = { AJA_DebugStat_WaitForInterruptOut1, // eOutput1 // 0
702  AJA_DebugStat_WaitForInterruptIn1, // eInput1 // 2
703  AJA_DebugStat_WaitForInterruptIn2, // eInput2 // 3
705  AJA_DebugStat_WaitForInterruptUartTx1, // eUart1Tx // 14
706  AJA_DebugStat_WaitForInterruptUartRx1, // eUart1Rx // 15
708  AJA_DebugStat_WaitForInterruptIn3, // eInput3 // 24
709  AJA_DebugStat_WaitForInterruptIn4, // eInput4 // 25
710  AJA_DebugStat_WaitForInterruptUartTx2, // eUartTx2 // 26
711  AJA_DebugStat_WaitForInterruptUartRx2, // eUartRx2 // 27
713  AJA_DebugStat_WaitForInterruptIn5, // eInput5 // 29
714  AJA_DebugStat_WaitForInterruptIn6, // eInput6 // 30
715  AJA_DebugStat_WaitForInterruptIn7, // eInput7 // 31
716  AJA_DebugStat_WaitForInterruptIn8, // eInput8 // 32
718 
719 //--------------------------------------------------------------------------------------------------------------------
720 // WaitForInterrupt
721 //
722 // Block the current thread until the specified interrupt occurs.
723 // Supply a timeout in milliseconds - if 0 (default), then never time out.
724 // Returns true if interrupt occurs, false if timeout.
725 //--------------------------------------------------------------------------------------------------------------------
727 {
728  if (IsRemote())
729  return CNTV2DriverInterface::WaitForInterrupt(type, timeout);
730  if (type == eChangeEvent)
731  return WaitForChangeEvent(timeout);
732 
733  kern_return_t kernResult = KERN_FAILURE;
734  uint64_t scalarI_64[2] = {type, timeout};
735  uint64_t scalarO_64 = 0;
736  uint32_t outputCount = 1;
737 
738  if (!NTV2_IS_VALID_INTERRUPT_ENUM(type))
739  kernResult = KERN_INVALID_VALUE;
740  else if (GetIOConnect())
741  {
743  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
744  kDriverWaitForInterrupt,// selector of the function to be called via the user client.
745  scalarI_64, // array of scalar (64-bit) input values.
746  2, // the number of scalar input values.
747  &scalarO_64, // array of scalar (64-bit) output values.
748  &outputCount); // pointer to the number of scalar output values.
750  }
751  UInt32 interruptOccurred = uint32_t(scalarO_64);
752  if (kernResult != KERN_SUCCESS)
753  {DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect())); return false;}
754  if (interruptOccurred)
755  BumpEventCount(type);
756  return interruptOccurred;
757 }
758 
759 //--------------------------------------------------------------------------------------------------------------------
760 // GetInterruptCount
761 //
762 // Returns the number of interrupts that have occured for the specified interrupt type.
763 //--------------------------------------------------------------------------------------------------------------------
765 {
766  kern_return_t kernResult = KERN_FAILURE;
767  uint64_t scalarI_64[1] = {eInterrupt};
768  uint64_t scalarO_64 = 0;
769  uint32_t outputCount = 1;
770  if (GetIOConnect())
771  {
773  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
774  kDriverGetInterruptCount, // selector of the function to be called via the user client.
775  scalarI_64, // array of scalar (64-bit) input values.
776  1, // the number of scalar input values.
777  &scalarO_64, // array of scalar (64-bit) output values.
778  &outputCount); // pointer to the number of scalar output values.
780  }
781  outCount = ULWord(scalarO_64);
782  if (kernResult == KERN_SUCCESS)
783  return true;
784  DIFAIL(KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
785  return false;
786 }
787 
788 //--------------------------------------------------------------------------------------------------------------------
789 // WaitForChangeEvent
790 //
791 // Block the current thread until a register changes.
792 // Supply a timeout in milliseconds - if 0 (default), then never time out.
793 // Returns true if change occurs, false if timeout.
794 //--------------------------------------------------------------------------------------------------------------------
796 {
797  kern_return_t kernResult = KERN_FAILURE;
798  uint64_t scalarI_64[1] = {timeout};
799  uint64_t scalarO_64 = 0;
800  uint32_t outputCount = 1;
801  if (GetIOConnect())
802  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
803  kDriverWaitForChangeEvent, // selector of the function to be called via the user client.
804  scalarI_64, // array of scalar (64-bit) input values.
805  1, // the number of scalar input values.
806  &scalarO_64, // array of scalar (64-bit) output values.
807  &outputCount); // pointer to the number of scalar output values.
808  if (kernResult != KERN_SUCCESS)
809  DIFAIL(KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
810  return bool(scalarO_64);
811 }
812 
813 
814 //--------------------------------------------------------------------------------------------------------------------
815 // DmaTransfer
816 //
817 // Start a memory transfer using the specified DMA engine.
818 // Optional - call PrepareDMAMemory on the dataPtr before the first use of memory block
819 // for DMA and CompleteDMAMemory when done. This will speed up the DMA by not requiring
820 // memory to be prepared for each DMA. Otherwise, it takes about 2 to 5 ms (sometimes
821 // much more) for the memory block to be prepared.
822 // This function will sleep (block) until the DMA finishes.
823 //--------------------------------------------------------------------------------------------------------------------
825  const bool inIsRead,
826  const ULWord inFrameNumber,
827  ULWord * pFrameBuffer,
828  const ULWord inOffsetBytes,
829  const ULWord inByteCount,
830  const bool inSynchronous)
831 {
832  if (IsRemote())
833  return CNTV2DriverInterface::DmaTransfer(inDMAEngine, inIsRead, inFrameNumber, pFrameBuffer,
834  inOffsetBytes, inByteCount, inSynchronous);
835  if (!IsOpen())
836  return false;
837  kern_return_t kernResult = KERN_FAILURE;
838  uint64_t scalarI_64[6] = {inDMAEngine, uint64_t(pFrameBuffer), inFrameNumber, inOffsetBytes, inByteCount, !inIsRead};
839  uint32_t outputCount = 0;
840  if (GetIOConnect())
841  {
843  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
844  kDriverDMATransfer, // selector of the function to be called via the user client.
845  scalarI_64, // array of scalar (64-bit) input values.
846  6, // the number of scalar input values.
847  AJA_NULL, // array of scalar (64-bit) output values.
848  &outputCount); // pointer to the number of scalar output values.
850  }
851  if (kernResult == KERN_SUCCESS)
852  return true;
853  DIFAIL(KR(kernResult) << ": con=" << HEX8(GetIOConnect()) << ", eng=" << inDMAEngine << ", frm=" << inFrameNumber
854  << ", off=" << HEX8(inOffsetBytes) << ", len=" << HEX8(inByteCount) << ", " << (inIsRead ? "R" : "W"));
855  return false;
856 }
857 
858 
859 //--------------------------------------------------------------------------------------------------------------------
860 // DmaTransfer
861 //
862 // Start a memory transfer using the specified DMA engine.
863 // Optional - call PrepareDMAMemory on the dataPtr before the first use of memory block
864 // for DMA and CompleteDMAMemory when done. This will speed up the DMA by not requiring
865 // memory to be prepared for each DMA. Otherwise, it takes about 2 to 5 ms (sometimes
866 // much more) for the memory block to be prepared.
867 // This function will sleep (block) until the DMA finishes.
868 //--------------------------------------------------------------------------------------------------------------------
870  const bool inIsRead,
871  const ULWord inFrameNumber,
872  ULWord * pFrameBuffer,
873  const ULWord inCardOffsetBytes,
874  const ULWord inByteCount,
875  const ULWord inNumSegments,
876  const ULWord inSegmentHostPitch,
877  const ULWord inSegmentCardPitch,
878  const bool inSynchronous)
879 {
880  if (IsRemote())
881  return CNTV2DriverInterface::DmaTransfer (inDMAEngine, inIsRead, inFrameNumber, pFrameBuffer, inCardOffsetBytes, inByteCount,
882  inNumSegments, inSegmentHostPitch, inSegmentCardPitch, inSynchronous);
883  if (!IsOpen())
884  return false;
885  kern_return_t kernResult = KERN_FAILURE;
886  size_t outputStructSize = 0;
887  const ULWord numSegments = inNumSegments ? inNumSegments : 1; // Prevent divide-by-zero exception: zero segment count == single segment
888 
889  DMA_TRANSFER_STRUCT_64 dmaTransfer64;
890  dmaTransfer64.dmaEngine = inDMAEngine;
891  dmaTransfer64.dmaFlags = 0;
892  dmaTransfer64.dmaHostBuffer = Pointer64(pFrameBuffer); // virtual address of host buffer
893  dmaTransfer64.dmaSize = inByteCount; // total number of bytes to DMA
894  dmaTransfer64.dmaCardFrameNumber = inFrameNumber; // card frame number
895  dmaTransfer64.dmaCardFrameOffset = inCardOffsetBytes; // offset (in bytes) into card frame to begin DMA
896  dmaTransfer64.dmaNumberOfSegments = numSegments; // number of segments of size videoBufferSize to DMA
897  dmaTransfer64.dmaSegmentSize = (inByteCount / numSegments); // size of each segment (if videoNumSegments > 1)
898  dmaTransfer64.dmaSegmentHostPitch = inSegmentHostPitch; // offset between the beginning of one host-memory segment and the next host-memory segment
899  dmaTransfer64.dmaSegmentCardPitch = inSegmentCardPitch; // offset between the beginning of one Kona-memory segment and the next Kona-memory segment
900  dmaTransfer64.dmaToCard = !inIsRead; // direction of DMA transfer
901 
902  if (GetIOConnect())
903  {
905  kernResult = OS_IOConnectCallStructMethod (GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
906  kDriverDMATransferEx, // selector of the function to be called via the user client.
907  &dmaTransfer64, // pointer to the input structure
908  sizeof(DMA_TRANSFER_STRUCT_64), // size of input structure
909  AJA_NULL, // pointer to the output structure
910  &outputStructSize); // size of output structure
912  }
913  if (kernResult == KERN_SUCCESS)
914  return true;
915  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
916  return false;
917 }
918 
919 
921  const NTV2Channel inDMAChannel,
922  const bool inIsTarget,
923  const ULWord inFrameNumber,
924  const ULWord inCardOffsetBytes,
925  const ULWord inByteCount,
926  const ULWord inNumSegments,
927  const ULWord inSegmentHostPitch,
928  const ULWord inSegmentCardPitch,
929  const PCHANNEL_P2P_STRUCT & inP2PData)
930 {
931  if (IsRemote())
932  return CNTV2DriverInterface::DmaTransfer (inDMAEngine, inDMAChannel, inIsTarget, inFrameNumber, inCardOffsetBytes, inByteCount,
933  inNumSegments, inSegmentHostPitch, inSegmentCardPitch, inP2PData);
934  return false;
935 }
936 
937 
938 //--------------------------------------------------------------------------------------------------------------------
939 // RestoreHardwareProcampRegisters
940 //--------------------------------------------------------------------------------------------------------------------
942 {
943  kern_return_t kernResult = KERN_FAILURE;
944  uint32_t outputCount = 0;
945  if (GetIOConnect())
946  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
947  kDriverRestoreProcAmpRegisters, // selector of the function to be called via the user client.
948  AJA_NULL, // array of scalar (64-bit) input values.
949  0, // the number of scalar input values.
950  AJA_NULL, // array of scalar (64-bit) output values.
951  &outputCount); // pointer to the number of scalar output values.
952  if (kernResult == KERN_SUCCESS)
953  return true;
954  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
955  return false;
956 }
957 
958 
959 //--------------------------------------------------------------------------------------------------------------------
960 // SystemStatus
961 //--------------------------------------------------------------------------------------------------------------------
963 {
964  kern_return_t kernResult = KERN_FAILURE;
965  uint64_t scalarI_64[2] = {uint64_t(dataPtr), statusCode};
966  uint32_t outputCount = 0;
967  if (GetIOConnect())
968  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
969  kDriverSystemStatus, // selector of the function to be called via the user client.
970  scalarI_64, // array of scalar (64-bit) input values.
971  2, // the number of scalar input values.
972  AJA_NULL, // array of scalar (64-bit) output values.
973  &outputCount); // pointer to the number of scalar output values.
974  if (statusCode != SSC_GetFirmwareProgress)
975  return false;
976  if (kernResult == KERN_SUCCESS)
977  return true;
978  MDIFAIL (KR(kernResult) << INSTP(this) << ", con=" << HEX8(GetIOConnect()));
979  return false;
980 }
981 
982 
983 //--------------------------------------------------------------------------------------------------------------------
984 // AutoCirculate
985 //--------------------------------------------------------------------------------------------------------------------
987 {
988  bool success = true;
989  if (IsRemote())
990  return CNTV2DriverInterface::AutoCirculate(autoCircData);
991 
992  kern_return_t kernResult = KERN_FAILURE;
993  io_connect_t conn(GetIOConnect());
994  if (!conn)
995  return false;
996 
997  switch (autoCircData.eCommand)
998  {
999  case eInitAutoCirc:
1000  case eStartAutoCirc:
1001  case eStopAutoCirc:
1002  case eAbortAutoCirc:
1003  case ePauseAutoCirc:
1004  case eFlushAutoCirculate:
1005  case ePrerollAutoCirculate:
1006  case eSetActiveFrame:
1007  case eStartAutoCircAtTime:
1008  {
1009  // Pass the autoCircData structure to the driver. The driver knows the implicit meanings of the
1010  // members of the structure based on the the command contained within it.
1011  size_t outputStructSize = 0;
1012  AUTOCIRCULATE_DATA_64 autoCircData64;
1013  CopyTo_AUTOCIRCULATE_DATA_64 (&autoCircData, &autoCircData64);
1014 
1016  kernResult = OS_IOConnectCallStructMethod ( conn, // an io_connect_t returned from IOServiceOpen().
1017  kDriverAutoCirculateControl, // selector of the function to be called via the user client.
1018  &autoCircData64, // pointer to the input structure
1019  sizeof(AUTOCIRCULATE_DATA_64), // size of input structure
1020  AJA_NULL, // pointer to the output structure
1021  &outputStructSize); // size of output structure
1023  break;
1024  } // eInit, eStart, eStop, eAbort, etc...
1025 
1026  case eGetAutoCirc:
1027  {
1028  uint64_t scalarI_64[1];
1029  uint32_t outputCount = 0;
1030  size_t outputStructSize = sizeof(AUTOCIRCULATE_STATUS_STRUCT);
1031  scalarI_64[0] = autoCircData.channelSpec;
1033  kernResult = OS_IOConnectCallMethod ( conn, // an io_connect_t returned from IOServiceOpen().
1034  kDriverAutoCirculateStatus, // selector of the function to be called via the user client.
1035  scalarI_64, // array of scalar (64-bit) input values.
1036  1, // the number of scalar input values.
1037  AJA_NULL, // pointer to the input structure
1038  0, // size of input structure
1039  AJA_NULL, // array of scalar (64-bit) output values.
1040  &outputCount, // the number of scalar output values.
1041  autoCircData.pvVal1, // pointer to the output structure
1042  &outputStructSize); // size of output structure
1044  break;
1045  } // eGetAutoCirc
1046 
1047  case eGetFrameStamp:
1048  case eGetFrameStampEx2:
1049  {
1050  // Make sure task structure does not get passed in with eGetFrameStamp call.
1051  if ( autoCircData.eCommand == eGetFrameStamp)
1052  autoCircData.pvVal2 = AJA_NULL;
1053 
1054  size_t outputStructSize = sizeof(AUTOCIRCULATE_DATA_64);
1055 
1056  // promote base data structure
1057  AUTOCIRCULATE_DATA_64 autoCircData64;
1058  CopyTo_AUTOCIRCULATE_DATA_64 (&autoCircData, &autoCircData64);
1059 
1061  kernResult = OS_IOConnectCallStructMethod ( conn, // an io_connect_t returned from IOServiceOpen().
1062  kDriverAutoCirculateFramestamp, // selector of the function to be called via the user client.
1063  &autoCircData64, // pointer to the input structure
1064  sizeof(AUTOCIRCULATE_DATA_64), // size of input structure
1065  &autoCircData64, // pointer to the output structure
1066  &outputStructSize); // size of output structure
1068  break;
1069  } // eGetFrameStamp, eGetFrameStampEx2
1070 
1074  {
1075  // Pass the autoCircData structure to the driver. The driver knows the implicit meanings of the
1076  // members of the structure based on the the command contained within it.
1077  // Make sure routing table and task structure does not get passed in with eTransferAutoCirculate call.
1078  if (autoCircData.eCommand == eTransferAutoCirculate)
1079  {
1080  autoCircData.pvVal3 = AJA_NULL;
1081  autoCircData.pvVal4 = AJA_NULL;
1082  }
1083 
1084  // Make sure task structure does not get passed in with eTransferAutoCirculateEx call.
1085  if (autoCircData.eCommand == eTransferAutoCirculateEx)
1086  autoCircData.pvVal4 = AJA_NULL;
1087 
1088  size_t outputStructSize = sizeof(AUTOCIRCULATE_TRANSFER_STATUS_STRUCT);
1089 
1090  // promote base data structure
1091  AUTOCIRCULATE_DATA_64 autoCircData64;
1092  CopyTo_AUTOCIRCULATE_DATA_64 (&autoCircData, &autoCircData64);
1093 
1094  // promote AUTOCIRCULATE_TRANSFER_STRUCT
1095  AUTOCIRCULATE_TRANSFER_STRUCT_64 autoCircTransfer64;
1096  CopyTo_AUTOCIRCULATE_TRANSFER_STRUCT_64 (reinterpret_cast<AUTOCIRCULATE_TRANSFER_STRUCT*>(autoCircData.pvVal1), &autoCircTransfer64);
1097  autoCircData64.pvVal1 = Pointer64(&autoCircTransfer64);
1098 
1099  AUTOCIRCULATE_TASK_STRUCT_64 autoCircTask64;
1100  if (autoCircData.pvVal4 != AJA_NULL)
1101  {
1102  CopyTo_AUTOCIRCULATE_TASK_STRUCT_64 (reinterpret_cast<AUTOCIRCULATE_TASK_STRUCT*>(autoCircData.pvVal4), &autoCircTask64);
1103  autoCircData64.pvVal4 = Pointer64(&autoCircTask64);
1104  }
1105 
1107  kernResult = OS_IOConnectCallStructMethod ( conn, // an io_connect_t returned from IOServiceOpen().
1108  kDriverAutoCirculateTransfer, // selector of the function to be called via the user client.
1109  &autoCircData64, // pointer to the input structure
1110  sizeof(AUTOCIRCULATE_DATA_64), // size of input structure
1111  autoCircData.pvVal2, // pointer to the output structure
1112  &outputStructSize); // size of output structure
1114  break;
1115  } // eTransferAutoCirculate, eTransferAutoCirculateEx, eTransferAutoCirculateEx2
1116 
1117  default:
1118  //DisplayNTV2Error("Unsupported AC command type in AutoCirculate()\n");
1119  kernResult = KERN_INVALID_ARGUMENT;
1120  break;
1121  } // switch
1122 
1123  success = (kernResult == KERN_SUCCESS);
1124  if (kernResult != KERN_SUCCESS && kernResult != kIOReturnOffline)
1125  MDIFAIL (KR(kernResult) << INSTP(this) << ", con=" << HEX8(conn) << ", eCmd=" << autoCircData.eCommand);
1126  return success;
1127 } // AutoCirculate
1128 
1129 
1131 {
1132  if (!pInOutMessage)
1133  return false;
1134  if (!pInOutMessage->IsValid())
1135  return false;
1136  if (!pInOutMessage->GetSizeInBytes())
1137  return false;
1138  if (IsRemote())
1139  return CNTV2DriverInterface::NTV2Message (pInOutMessage);
1140 
1141  // Force fOperation = 0 in SDK 16.3, to allow RPCs from 16.3 or later clients to work on servers running 16.2 or earlier drivers:
1142  ULWord* pU32 = reinterpret_cast<ULWord*>(pInOutMessage); pU32[6] = 0;
1143 
1144  kern_return_t kernResult (KERN_FAILURE);
1145  io_connect_t connection (GetIOConnect ());
1146  uint64_t scalarI_64 [2] = {uint64_t(pInOutMessage), pInOutMessage->GetSizeInBytes()};
1147  uint32_t numScalarOutputs(0);
1148  if (connection)
1149  {
1151  kernResult = OS_IOConnectCallScalarMethod ( connection, // an io_connect_t returned from IOServiceOpen
1152  kDriverNTV2Message, // selector of the function to be called via the user client
1153  scalarI_64, // array of scalar (64-bit) input values
1154  2, // the number of scalar input values
1155  AJA_NULL, // array of scalar (64-bit) output values
1156  &numScalarOutputs); // pointer (in: number of scalar output values capable of receiving; out: actual number of scalar output values)
1158  }
1159  if (kernResult != KERN_SUCCESS && kernResult != kIOReturnOffline)
1160  MDIFAIL (KR(kernResult) << INSTP(this) << ", con=" << HEX8(connection) << endl << *pInOutMessage);
1161  return kernResult == KERN_SUCCESS;
1162 
1163 } // NTV2Message
1164 
1165 
1166 
1167 #pragma mark Old Driver Calls
1168 
1170 {
1171  return WriteRegister(kVRegGlobalAudioPlaybackMode,mode);
1172 }
1173 
1175 {
1177 }
1178 
1179 
1180 //-------------------------------------------------------------------------------------------------------
1181 // CopyTo_AUTOCIRCULATE_DATA_64
1182 //-------------------------------------------------------------------------------------------------------
1183 void CNTV2MacDriverInterface::CopyTo_AUTOCIRCULATE_DATA_64 (AUTOCIRCULATE_DATA *p, AUTOCIRCULATE_DATA_64 *p64)
1184 {
1185  // note that p is native structure, either 64 or 32 bit
1186  p64->eCommand = p->eCommand;
1187  p64->channelSpec = p->channelSpec;
1188 
1189  p64->lVal1 = p->lVal1;
1190  p64->lVal2 = p->lVal2;
1191  p64->lVal3 = p->lVal3;
1192  p64->lVal4 = p->lVal4;
1193  p64->lVal5 = p->lVal5;
1194  p64->lVal6 = p->lVal6;
1195 
1196  p64->bVal1 = p->bVal1;
1197  p64->bVal2 = p->bVal2;
1198  p64->bVal3 = p->bVal3;
1199  p64->bVal4 = p->bVal4;
1200  p64->bVal5 = p->bVal5;
1201  p64->bVal6 = p->bVal6;
1202  p64->bVal7 = p->bVal7;
1203  p64->bVal8 = p->bVal8;
1204 
1205  p64->pvVal1 = Pointer64(p->pvVal1); // native to 64 bit
1206  p64->pvVal2 = Pointer64(p->pvVal2); // native to 64 bit
1207  p64->pvVal3 = Pointer64(p->pvVal3); // native to 64 bit
1208  p64->pvVal4 = Pointer64(p->pvVal4); // native to 64 bit
1209 }
1210 
1211 
1212 //-------------------------------------------------------------------------------------------------------
1213 // CopyTo_AUTOCIRCULATE_DATA
1214 //-------------------------------------------------------------------------------------------------------
1215 void CNTV2MacDriverInterface::CopyTo_AUTOCIRCULATE_DATA (AUTOCIRCULATE_DATA_64 *p64, AUTOCIRCULATE_DATA *p)
1216 {
1217  // note that p is native structure, either 64 or 32 bit
1218  p->eCommand = p64->eCommand;
1219  p->channelSpec = p64->channelSpec;
1220 
1221  p->lVal1 = p64->lVal1;
1222  p->lVal2 = p64->lVal2;
1223  p->lVal3 = p64->lVal3;
1224  p->lVal4 = p64->lVal4;
1225  p->lVal5 = p64->lVal5;
1226  p->lVal6 = p64->lVal6;
1227 
1228  p->bVal1 = p64->bVal1;
1229  p->bVal2 = p64->bVal2;
1230  p->bVal3 = p64->bVal3;
1231  p->bVal4 = p64->bVal4;
1232  p->bVal5 = p64->bVal5;
1233  p->bVal6 = p64->bVal6;
1234  p->bVal7 = p64->bVal7;
1235  p->bVal8 = p64->bVal8;
1236 
1237  p->pvVal1 = reinterpret_cast<void*>(p64->pvVal1); // 64 bit to native
1238  p->pvVal2 = reinterpret_cast<void*>(p64->pvVal2); // 64 bit to native
1239  p->pvVal3 = reinterpret_cast<void*>(p64->pvVal3); // 64 bit to native
1240  p->pvVal4 = reinterpret_cast<void*>(p64->pvVal4); // 64 bit to native
1241 }
1242 
1243 
1244 //-------------------------------------------------------------------------------------------------------
1245 // CopyTo_AUTOCIRCULATE_TRANSFER_STRUCT_64
1246 //-------------------------------------------------------------------------------------------------------
1247 void CNTV2MacDriverInterface::CopyTo_AUTOCIRCULATE_TRANSFER_STRUCT_64 (AUTOCIRCULATE_TRANSFER_STRUCT *p, AUTOCIRCULATE_TRANSFER_STRUCT_64 *p64)
1248 {
1249  // note that p is native structure, either 64 or 32 bit
1250  p64->channelSpec = p->channelSpec;
1251  p64->videoBuffer = Pointer64(p->videoBuffer); // native to 64 bit
1252  p64->videoBufferSize = p->videoBufferSize;
1253  p64->videoDmaOffset = p->videoDmaOffset;
1254  p64->audioBuffer = Pointer64(p->audioBuffer); // native to 64 bit
1255  p64->audioBufferSize = p->audioBufferSize;
1259 
1260  p64->rp188.DBB = p->rp188.DBB;
1261  p64->rp188.Low = p->rp188.Low;
1262  p64->rp188.High = p->rp188.High;
1263 
1264  p64->desiredFrame = p->desiredFrame;
1265  p64->hUser = p->hUser;
1266  p64->transferFlags = p->transferFlags;
1270 
1274 
1275  p64->vidProcInfo.mode = p->vidProcInfo.mode;
1282 
1287 
1291 
1293 
1294 #if 0
1295  printf("----------------------\n");
1296  printf("sizeof = %d\n", (int)sizeof(AUTOCIRCULATE_TRANSFER_STRUCT_64));
1297 
1298  uint8_t * ptr = (uint8_t *)p64;
1299  for (int i = 0; i < (int)sizeof(AUTOCIRCULATE_TRANSFER_STRUCT_64); i++)
1300  {
1301  if ((i % 4) == 0)
1302  printf("\n");
1303  printf("%x ", *ptr++);
1304  }
1305  printf("\n\n", *ptr++);
1306 
1307 #endif
1308 
1309  #if 0
1310  printf("----------------------\n");
1311  printf("sizeof = %d\n", (int)sizeof(AUTOCIRCULATE_TRANSFER_STRUCT_64));
1312 
1313  // note that p is native structure, either 64 or 32 bit
1314  printf("channelSpec %x\n", p64->channelSpec);
1315  printf("videoBuffer %lx\n",p64->videoBuffer);
1316  printf("videoBufferSize %x\n",p64->videoBufferSize);
1317  printf("videoDmaOffset %x\n",p64->videoDmaOffset);
1318  printf("audioBuffer %lx\n",p64->audioBuffer);
1319  printf("audioBufferSize %x\n",p64->audioBufferSize);
1320  printf("audioStartSample %x\n",p64->audioStartSample);
1321  printf("audioNumChannels %x\n",p64->audioNumChannels);
1322  printf("frameRepeatCount %x\n",p64->frameRepeatCount);
1323 
1324  printf("rp188.DBB %x\n",p64->rp188.DBB);
1325  printf("rp188.Low %x\n",p64->rp188.Low);
1326  printf("rp188.High %x\n",p64->rp188.High);
1327 
1328  printf("desiredFrame %x\n",p64->desiredFrame);
1329  printf("hUser %x\n",p64->hUser);
1330  printf("transferFlags %x\n",p64->transferFlags);
1331  printf("bDisableExtraAudioInfo %x\n",p64->bDisableExtraAudioInfo);
1332  printf("frameBufferFormat %x\n",p64->frameBufferFormat);
1333  printf("frameBufferOrientation %x\n",p64->frameBufferOrientation);
1334 
1335  printf("colorCorrectionInfo.mode %x\n",p64->colorCorrectionInfo.mode);
1336  printf("colorCorrectionInfo.saturationValue %x\n",p64->colorCorrectionInfo.saturationValue);
1337  printf("colorCorrectionInfo.ccLookupTables %x\n",p64->colorCorrectionInfo.ccLookupTables);
1338 
1339  printf("vidProcInfo.mode %x\n",p64->vidProcInfo.mode);
1340  printf("vidProcInfo.foregroundVideoCrosspoint %x\n",p64->vidProcInfo.foregroundVideoCrosspoint);
1341  printf("vidProcInfo.backgroundVideoCrosspoint %x\n",p64->vidProcInfo.backgroundVideoCrosspoint);
1342  printf("vidProcInfo.foregroundKeyCrosspoint %x\n",p64->vidProcInfo.foregroundKeyCrosspoint);
1343  printf("vidProcInfo.backgroundKeyCrosspoint %x\n",p64->vidProcInfo.backgroundKeyCrosspoint);
1344  printf("vidProcInfo.transitionCoefficient %x\n",p64->vidProcInfo.transitionCoefficient);
1345  printf("vidProcInfo.transitionSoftness %x\n",p64->vidProcInfo.transitionSoftness);
1346 
1347  printf("customAncInfo.Group1 %x\n",p64->customAncInfo.Group1);
1348  printf("customAncInfo.Group2 %x\n",p64->customAncInfo.Group2);
1349  printf("customAncInfo.Group3 %x\n",p64->customAncInfo.Group3);
1350  printf("customAncInfo.Group4 %x\n",p64->customAncInfo.Group4);
1351 
1352  printf("videoNumSegments %x\n",p64->videoNumSegments);
1353  printf("videoSegmentHostPitch %x\n",p64->videoSegmentHostPitch);
1354  printf("videoSegmentCardPitch %x\n",p64->videoSegmentCardPitch);
1355 
1356  printf("videoQuarterSizeExpand %x\n",p64->videoQuarterSizeExpand);
1357  #endif
1358 }
1359 
1360 
1361 //-------------------------------------------------------------------------------------------------------
1362 // CopyTo_AUTOCIRCULATE_TRANSFER_STRUCT
1363 //-------------------------------------------------------------------------------------------------------
1364 void CNTV2MacDriverInterface::CopyTo_AUTOCIRCULATE_TRANSFER_STRUCT (AUTOCIRCULATE_TRANSFER_STRUCT_64 *p64, AUTOCIRCULATE_TRANSFER_STRUCT *p)
1365 {
1366  // note that p is native structure, either 64 or 32 bit
1367  p->channelSpec = p64->channelSpec;
1368  p->videoBuffer = reinterpret_cast<ULWord*>(p64->videoBuffer); // 64 bit to native
1369  p->videoBufferSize = p64->videoBufferSize;
1370  p->videoDmaOffset = p64->videoDmaOffset;
1371  p->audioBuffer = reinterpret_cast<ULWord*>(p64->audioBuffer); // 64 bit to native
1372  p->audioBufferSize = p64->audioBufferSize;
1376 
1377  p->rp188.DBB = p64->rp188.DBB;
1378  p->rp188.Low = p64->rp188.Low;
1379  p->rp188.High = p64->rp188.High;
1380 
1381  p->desiredFrame = p64->desiredFrame;
1382  p->hUser = p64->hUser;
1383  p->transferFlags = p64->transferFlags;
1387 
1391 
1392  p->vidProcInfo.mode = p64->vidProcInfo.mode;
1399 
1404 
1408 
1410 }
1411 
1412 
1413 //-------------------------------------------------------------------------------------------------------
1414 // CopyTo_AUTOCIRCULATE_TASK_STRUCT_64
1415 //-------------------------------------------------------------------------------------------------------
1416 void CNTV2MacDriverInterface::CopyTo_AUTOCIRCULATE_TASK_STRUCT_64 (AUTOCIRCULATE_TASK_STRUCT *p, AUTOCIRCULATE_TASK_STRUCT_64 *p64)
1417 {
1418  p64->taskVersion = p->taskVersion;
1419  p64->taskSize = p->taskSize;
1420  p64->numTasks = p->numTasks;
1421  p64->maxTasks = p->maxTasks;
1422  p64->taskArray = Pointer64(p->taskArray);
1423  p64->reserved0 = p->reserved0;
1424  p64->reserved1 = p->reserved1;
1425  p64->reserved2 = p->reserved2;
1426  p64->reserved3 = p->reserved3;
1427 }
1428 
1429 
1430 static const char * GetKernErrStr (const kern_return_t inError)
1431 {
1432  switch (inError)
1433  {
1434  case kIOReturnError: return "general error";
1435  case kIOReturnNoMemory: return "can't allocate memory";
1436  case kIOReturnNoResources: return "resource shortage";
1437  case kIOReturnIPCError: return "error during IPC";
1438  case kIOReturnNoDevice: return "no such device";
1439  case kIOReturnNotPrivileged: return "privilege violation";
1440  case kIOReturnBadArgument: return "invalid argument";
1441  case kIOReturnLockedRead: return "device read locked";
1442  case kIOReturnLockedWrite: return "device write locked";
1443  case kIOReturnExclusiveAccess: return "exclusive access and device already open";
1444  case kIOReturnBadMessageID: return "sent/received messages had different msg_id";
1445  case kIOReturnUnsupported: return "unsupported function";
1446  case kIOReturnVMError: return "misc. VM failure";
1447  case kIOReturnInternalError: return "internal error";
1448  case kIOReturnIOError: return "General I/O error";
1449  case kIOReturnCannotLock: return "can't acquire lock";
1450  case kIOReturnNotOpen: return "device not open";
1451  case kIOReturnNotReadable: return "read not supported";
1452  case kIOReturnNotWritable: return "write not supported";
1453  case kIOReturnNotAligned: return "alignment error";
1454  case kIOReturnBadMedia: return "Media Error";
1455  case kIOReturnStillOpen: return "device(s) still open";
1456  case kIOReturnRLDError: return "rld failure";
1457  case kIOReturnDMAError: return "DMA failure";
1458  case kIOReturnBusy: return "Device Busy";
1459  case kIOReturnTimeout: return "I/O Timeout";
1460  case kIOReturnOffline: return "device offline";
1461  case kIOReturnNotReady: return "not ready";
1462  case kIOReturnNotAttached: return "device not attached";
1463  case kIOReturnNoChannels: return "no DMA channels left";
1464  case kIOReturnNoSpace: return "no space for data";
1465  case kIOReturnPortExists: return "port already exists";
1466  case kIOReturnCannotWire: return "can't wire down physical memory";
1467  case kIOReturnNoInterrupt: return "no interrupt attached";
1468  case kIOReturnNoFrames: return "no DMA frames enqueued";
1469  case kIOReturnMessageTooLarge: return "oversized msg received on interrupt port";
1470  case kIOReturnNotPermitted: return "not permitted";
1471  case kIOReturnNoPower: return "no power to device";
1472  case kIOReturnNoMedia: return "media not present";
1473  case kIOReturnUnformattedMedia: return "media not formatted";
1474  case kIOReturnUnsupportedMode: return "no such mode";
1475  case kIOReturnUnderrun: return "data underrun";
1476  case kIOReturnOverrun: return "data overrun";
1477  case kIOReturnDeviceError: return "the device is not working properly!";
1478  case kIOReturnNoCompletion: return "a completion routine is required";
1479  case kIOReturnAborted: return "operation aborted";
1480  case kIOReturnNoBandwidth: return "bus bandwidth would be exceeded";
1481  case kIOReturnNotResponding: return "device not responding";
1482  case kIOReturnIsoTooOld: return "isochronous I/O request for distant past!";
1483  case kIOReturnIsoTooNew: return "isochronous I/O request for distant future";
1484  case kIOReturnNotFound: return "data was not found";
1485  case MACH_SEND_INVALID_DEST: return "MACH_SEND_INVALID_DEST";
1486  case kNTV2DriverBadDMA: return "bad dma engine num";
1487  case kNTV2DriverDMABusy: return "dma engine busy, or none available";
1488  case kNTV2DriverParamErr: return "bad aja parameter (out of range)";
1489  case kNTV2DriverPgmXilinxErr: return "xilinx programming error";
1490  case kNTV2DriverNotReadyErr: return "xilinx not yet programmed";
1491  case kNTV2DriverPrepMemErr: return "error preparing memory (no room?)";
1492  case kNTV2DriverDMATooLarge: return "dma xfer too large, or out of range";
1493  case kNTV2DriverBadHeaderTag: return "bad NTV2 header";
1494  case kNTV2UnknownStructType: return "unknown NTV2 struct type";
1495  case kNTV2HeaderVersionErr: return "bad or unsupported NTV2 header version";
1496  case kNTV2DriverBadTrailerTag: return "bad NTV2 trailer";
1497  case kNTV2DriverMapperErr: return "failure while mapping NTV2 struct ptrs";
1498  case kNTV2DriverUnmapperErr: return "failure while unmapping NTV2 struct ptrs";
1499  default: return "";
1500  }
1501 } // GetKernErrStr
kNTV2DriverNotReadyErr
const IOReturn kNTV2DriverNotReadyErr
Definition: ntv2macpublicinterface.h:21
CNTV2MacDriverInterface::MapRegisters
virtual bool MapRegisters(void)
Definition: ntv2macdriverinterface.cpp:300
kDriverReleaseStreamForApplicationWithReference
@ kDriverReleaseStreamForApplicationWithReference
Definition: ntv2macpublicinterface.h:69
kNTV2DriverBadDMA
const IOReturn kNTV2DriverBadDMA
Definition: ntv2macpublicinterface.h:17
kNTV2DriverUnmapperErr
const IOReturn kNTV2DriverUnmapperErr
Definition: ntv2macpublicinterface.h:31
AJA_DebugStat_GetInterruptCount
@ AJA_DebugStat_GetInterruptCount
Definition: debugshare.h:240
AUTOCIRCULATE_TRANSFER_STRUCT_64::videoSegmentHostPitch
ULWord videoSegmentHostPitch
Definition: ntv2publicinterface.h:4567
AJA_DebugStat_DMATransferEx
@ AJA_DebugStat_DMATransferEx
Definition: debugshare.h:242
AUTOCIRCULATE_TRANSFER_STRUCT_64::videoNumSegments
ULWord videoNumSegments
Definition: ntv2publicinterface.h:4566
CNTV2DriverInterface::SetStreamingApplication
virtual bool SetStreamingApplication(const ULWord inAppType, const int32_t inProcessID)
Sets the four-CC type and process ID of the application that should "own" the AJA device (i....
Definition: ntv2driverinterface.cpp:1118
AUTOCIRCULATE_DATA_64::pvVal4
Pointer64 pvVal4
Definition: ntv2publicinterface.h:4364
AUTOCIRCULATE_DATA_64::lVal1
LWord lVal1
Definition: ntv2publicinterface.h:4345
kDriverSystemControl
@ kDriverSystemControl
Definition: ntv2macpublicinterface.h:65
AUTOCIRCULATE_TRANSFER_STRUCT::transferFlags
ULWord transferFlags
Definition: ntv2publicinterface.h:4587
MDIWARN
#define MDIWARN(__x__)
Definition: ntv2macdriverinterface.cpp:57
AUTOCIRCULATE_TRANSFER_STRUCT::videoSegmentHostPitch
ULWord videoSegmentHostPitch
Definition: ntv2publicinterface.h:4604
kDriverDMATransfer
@ kDriverDMATransfer
Definition: ntv2macpublicinterface.h:53
AUTOCIRCULATE_TRANSFER_STRUCT::audioStartSample
ULWord audioStartSample
Definition: ntv2publicinterface.h:4581
RP188_STRUCT::High
ULWord High
Definition: ntv2publicinterface.h:4086
AJADebug::StatTimerStop
static AJAStatus StatTimerStop(const uint32_t inKey)
Definition: debug.cpp:1155
AUTOCIRCULATE_DATA::channelSpec
NTV2Crosspoint channelSpec
Definition: ntv2publicinterface.h:4372
HEX8
#define HEX8(__x__)
Definition: ntv2macdriverinterface.cpp:45
DIWARN
#define DIWARN(__x__)
Definition: ntv2macdriverinterface.cpp:51
kNTV2HeaderVersionErr
const IOReturn kNTV2HeaderVersionErr
Definition: ntv2macpublicinterface.h:28
kRegBoardID
@ kRegBoardID
Definition: ntv2publicinterface.h:153
INTERRUPT_ENUMS
enum _INTERRUPT_ENUMS_ INTERRUPT_ENUMS
NTV2_FOURCC
#define NTV2_FOURCC(_a_, _b_, _c_, _d_)
Definition: ntv2publicinterface.h:5444
AUTOCIRCULATE_DATA_64::eCommand
AUTO_CIRC_COMMAND eCommand
Definition: ntv2publicinterface.h:4342
kDriverWaitForInterrupt
@ kDriverWaitForInterrupt
Definition: ntv2macpublicinterface.h:49
CNTV2MacDriverInterface::GetAudioOutputMode
virtual bool GetAudioOutputMode(NTV2_GlobalAudioPlaybackMode *mode)
Definition: ntv2macdriverinterface.cpp:1174
AUTOCIRCULATE_DATA::bVal2
BOOL_ bVal2
Definition: ntv2publicinterface.h:4382
CNTV2MacDriverInterface::KernelLog
virtual bool KernelLog(void *dataPtr, UInt32 dataSize)
Definition: ntv2macdriverinterface.cpp:681
GetKernErrStr
static const char * GetKernErrStr(const kern_return_t inError)
Definition: ntv2macdriverinterface.cpp:1430
ntv2devicefeatures.h
Declares device capability functions.
CNTV2MacDriverInterface::~CNTV2MacDriverInterface
virtual ~CNTV2MacDriverInterface()
My destructor.
Definition: ntv2macdriverinterface.cpp:166
CNTV2MacDriverInterface::ReadRegister
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....
Definition: ntv2macdriverinterface.cpp:389
CNTV2DriverInterface::AcquireStreamForApplication
virtual bool AcquireStreamForApplication(const ULWord inAppType, const int32_t inProcessID)
Reserves exclusive use of the AJA device for a given process, preventing other processes on the host ...
Definition: ntv2driverinterface.cpp:1071
AUTOCIRCULATE_TRANSFER_STRUCT_64::frameRepeatCount
ULWord frameRepeatCount
Definition: ntv2publicinterface.h:4546
kDriverAutoCirculateTransfer
@ kDriverAutoCirculateTransfer
Definition: ntv2macpublicinterface.h:61
AUTOCIRCULATE_TRANSFER_STRUCT::videoBuffer
ULWord * videoBuffer
Definition: ntv2publicinterface.h:4576
NTV2Channel
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
Definition: ntv2enums.h:1305
AJA_DebugStat_ReadRegister
@ AJA_DebugStat_ReadRegister
Definition: debugshare.h:224
AUTOCIRCULATE_TRANSFER_STRUCT::videoQuarterSizeExpand
NTV2QuarterSizeExpandMode videoQuarterSizeExpand
Definition: ntv2publicinterface.h:4606
AJA_DebugStat_NTV2Message
@ AJA_DebugStat_NTV2Message
Definition: debugshare.h:246
AJADebug::StatTimerStart
static AJAStatus StatTimerStart(const uint32_t inKey)
Definition: debug.cpp:1135
NTV2_ASSERT
#define NTV2_ASSERT(_expr_)
Definition: ajatypes.h:506
DMA_TRANSFER_STRUCT_64::dmaFlags
ULWord dmaFlags
Definition: ntv2publicinterface.h:4825
kDriverKernelLog
@ kDriverKernelLog
Definition: ntv2macpublicinterface.h:70
AJA_DebugStat_AutoCirculate
@ AJA_DebugStat_AutoCirculate
Definition: debugshare.h:244
AJA_DebugStat_WaitForInterruptOthers
@ AJA_DebugStat_WaitForInterruptOthers
Definition: debugshare.h:239
systemtime.h
Declares the AJATime class.
AUTOCIRCULATE_DATA_64::lVal5
LWord lVal5
Definition: ntv2publicinterface.h:4349
CNTV2DriverInterface::WaitForInterrupt
virtual bool WaitForInterrupt(const INTERRUPT_ENUMS eInterrupt, const ULWord timeOutMs=68)
Definition: ntv2driverinterface.cpp:546
kNTV2DriverParamErr
const IOReturn kNTV2DriverParamErr
Definition: ntv2macpublicinterface.h:19
AUTOCIRCULATE_TRANSFER_STRUCT::frameBufferOrientation
NTV2VideoFrameBufferOrientation frameBufferOrientation
Definition: ntv2publicinterface.h:4590
AJA_DebugStat_WaitForInterruptIn2
@ AJA_DebugStat_WaitForInterruptIn2
Definition: debugshare.h:227
sNTV2PCIDEXTName
static const string sNTV2PCIDEXTName("AJANTV2")
AUTOCIRCULATE_TRANSFER_STRUCT_64::videoDmaOffset
ULWord videoDmaOffset
Definition: ntv2publicinterface.h:4541
AUTOCIRCULATE_TASK_STRUCT_64::reserved3
ULWord reserved3
Definition: ntv2publicinterface.h:4752
ntv2macdriverinterface.h
Implements the MacOS-specific flavor of CNTV2DriverInterface.
AUTOCIRCULATE_TASK_STRUCT::reserved3
ULWord reserved3
Definition: ntv2publicinterface.h:4765
eStartAutoCircAtTime
@ eStartAutoCircAtTime
Definition: ntv2publicinterface.h:4254
AUTOCIRCULATE_DATA_64::pvVal2
Pointer64 pvVal2
Definition: ntv2publicinterface.h:4362
AUTOCIRCULATE_DATA::bVal3
BOOL_ bVal3
Definition: ntv2publicinterface.h:4383
AUTOCIRCULATE_TASK_STRUCT::taskVersion
ULWord taskVersion
Definition: ntv2publicinterface.h:4757
NTV2ColorCorrectionInfo_64::ccLookupTables
Pointer64 ccLookupTables
only used in 3way color correction mode.
Definition: ntv2publicinterface.h:4147
CNTV2MacDriverInterface::AutoCirculate
virtual bool AutoCirculate(AUTOCIRCULATE_DATA &autoCircData)
Sends an AutoCirculate command to the NTV2 driver.
Definition: ntv2macdriverinterface.cpp:986
CNTV2MacDriverInterface::ReleaseStreamForApplication
virtual bool ReleaseStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Releases exclusive use of the AJA device for the given process, permitting other processes to acquire...
Definition: ntv2macdriverinterface.cpp:516
AUTOCIRCULATE_TRANSFER_STRUCT::bDisableExtraAudioInfo
BOOL_ bDisableExtraAudioInfo
Definition: ntv2publicinterface.h:4588
AUTOCIRCULATE_TRANSFER_STRUCT::audioBufferSize
ULWord audioBufferSize
Definition: ntv2publicinterface.h:4580
AUTOCIRCULATE_TRANSFER_STRUCT_64::colorCorrectionInfo
NTV2ColorCorrectionInfo_64 colorCorrectionInfo
Definition: ntv2publicinterface.h:4554
AUTOCIRCULATE_TRANSFER_STRUCT::frameRepeatCount
ULWord frameRepeatCount
Definition: ntv2publicinterface.h:4583
AUTOCIRCULATE_TASK_STRUCT_64::taskArray
Pointer64 taskArray
Definition: ntv2publicinterface.h:4748
kNTV2DriverDMABusy
const IOReturn kNTV2DriverDMABusy
Definition: ntv2macpublicinterface.h:18
CNTV2MacDriverInterface::OpenLocalPhysical
virtual bool OpenLocalPhysical(const UWord inDeviceIndex)
Opens the local/physical device connection.
Definition: ntv2macdriverinterface.cpp:176
AUTOCIRCULATE_TASK_STRUCT::taskSize
ULWord taskSize
Definition: ntv2publicinterface.h:4758
kDriverSystemStatus
@ kDriverSystemStatus
Definition: ntv2macpublicinterface.h:66
CUSTOM_ANC_STRUCT::Group3
ULWord Group3
Definition: ntv2publicinterface.h:4231
CNTV2DriverInterface::ReleaseStreamForApplication
virtual bool ReleaseStreamForApplication(const ULWord inAppType, const int32_t inProcessID)
Releases exclusive use of the AJA device for the given process, permitting other processes to acquire...
Definition: ntv2driverinterface.cpp:1108
OS_IOKitGetBusyState
#define OS_IOKitGetBusyState(_x_, _y_)
Definition: ntv2macdriverinterface.cpp:78
CNTV2MacDriverInterface::WaitForInterrupt
virtual bool WaitForInterrupt(const INTERRUPT_ENUMS type, const ULWord timeout=50)
Definition: ntv2macdriverinterface.cpp:726
AUTOCIRCULATE_TRANSFER_STRUCT_64::videoBuffer
Pointer64 videoBuffer
Definition: ntv2publicinterface.h:4539
kVRegGlobalAudioPlaybackMode
@ kVRegGlobalAudioPlaybackMode
Definition: ntv2virtualregisters.h:34
CNTV2DriverInterface::WriteRegister
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...
Definition: ntv2driverinterface.cpp:467
AUTOCIRCULATE_TRANSFER_STRUCT::rp188
RP188_STRUCT rp188
Definition: ntv2publicinterface.h:4584
CNTV2MacDriverInterface::GetInterruptCount
virtual bool GetInterruptCount(const INTERRUPT_ENUMS eInterrupt, ULWord &outCount)
Answers with the number of interrupts of the given type processed by the driver.
Definition: ntv2macdriverinterface.cpp:764
nlohmann::json_abiNLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON_v3_11_NLOHMANN_JSON_VERSION_PATCH::detail::void
j template void())
Definition: json.hpp:4893
ePrerollAutoCirculate
@ ePrerollAutoCirculate
Definition: ntv2publicinterface.h:4251
NTV2_HEADER::IsValid
bool IsValid(void) const
Definition: ntv2publicinterface.h:6993
AUTOCIRCULATE_DATA::bVal6
BOOL_ bVal6
Definition: ntv2publicinterface.h:4386
OS_IOServiceClose
#define OS_IOServiceClose(_x_)
Definition: ntv2macdriverinterface.cpp:67
AJA_DebugStat_WaitForInterruptIn8
@ AJA_DebugStat_WaitForInterruptIn8
Definition: debugshare.h:233
kNTV2DriverBadHeaderTag
const IOReturn kNTV2DriverBadHeaderTag
Definition: ntv2macpublicinterface.h:26
NTV2_IS_VALID_INTERRUPT_ENUM
#define NTV2_IS_VALID_INTERRUPT_ENUM(__e__)
Definition: ntv2publicinterface.h:3794
AUTOCIRCULATE_TRANSFER_STRUCT::colorCorrectionInfo
NTV2ColorCorrectionInfo colorCorrectionInfo
Definition: ntv2publicinterface.h:4591
AUTOCIRCULATE_STATUS_STRUCT
struct AUTOCIRCULATE_STATUS_STRUCT AUTOCIRCULATE_STATUS_STRUCT
kDriverReadRegister
@ kDriverReadRegister
Definition: ntv2macpublicinterface.h:38
AUTOCIRCULATE_DATA::pvVal4
void * pvVal4
Definition: ntv2publicinterface.h:4393
OS_IORegistryEntryCreateCFProperty
#define OS_IORegistryEntryCreateCFProperty(_w_, _x_, _y_, _z_)
Definition: ntv2macdriverinterface.cpp:73
kDriverAutoCirculateStatus
@ kDriverAutoCirculateStatus
Definition: ntv2macpublicinterface.h:60
AUTOCIRCULATE_DATA::pvVal3
void * pvVal3
Definition: ntv2publicinterface.h:4392
CNTV2DriverInterface::AcquireStreamForApplicationWithReference
virtual bool AcquireStreamForApplicationWithReference(const ULWord inAppType, const int32_t inProcessID)
A reference-counted version of CNTV2DriverInterface::AcquireStreamForApplication useful for process g...
Definition: ntv2driverinterface.cpp:1009
CNTV2DriverInterface::ReadRegister
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....
Definition: ntv2driverinterface.cpp:403
kDriverReleaseStreamForApplication
@ kDriverReleaseStreamForApplication
Definition: ntv2macpublicinterface.h:43
AUTOCIRCULATE_DATA::lVal5
LWord lVal5
Definition: ntv2publicinterface.h:4378
AUTOCIRCULATE_TRANSFER_STRUCT::frameBufferFormat
NTV2FrameBufferFormat frameBufferFormat
Definition: ntv2publicinterface.h:4589
CNTV2DriverInterface::ReleaseStreamForApplicationWithReference
virtual bool ReleaseStreamForApplicationWithReference(const ULWord inAppType, const int32_t inProcessID)
A reference-counted version of CNTV2DriverInterface::ReleaseStreamForApplication useful for process g...
Definition: ntv2driverinterface.cpp:1052
AUTOCIRCULATE_DATA::lVal3
LWord lVal3
Definition: ntv2publicinterface.h:4376
NTV2_GlobalAudioPlaybackMode
NTV2_GlobalAudioPlaybackMode
Definition: ntv2enums.h:2051
AUTOCIRCULATE_DATA_64::pvVal1
Pointer64 pvVal1
Definition: ntv2publicinterface.h:4361
eAbortAutoCirc
@ eAbortAutoCirc
Definition: ntv2publicinterface.h:4253
CNTV2MacDriverInterface::SystemStatus
virtual bool SystemStatus(void *dataPtr, SystemStatusCode systemStatusCode)
Definition: ntv2macdriverinterface.cpp:962
eTransferAutoCirculate
@ eTransferAutoCirculate
Definition: ntv2publicinterface.h:4252
AUTOCIRCULATE_DATA_64::pvVal3
Pointer64 pvVal3
Definition: ntv2publicinterface.h:4363
kNTV2DriverMapperErr
const IOReturn kNTV2DriverMapperErr
Definition: ntv2macpublicinterface.h:30
NTV2DMAEngine
NTV2DMAEngine
Definition: ntv2enums.h:1801
AutoCircVidProcInfo::foregroundKeyCrosspoint
NTV2Crosspoint foregroundKeyCrosspoint
Definition: ntv2publicinterface.h:4211
MemoryType
MemoryType
Definition: ntv2macpublicinterface.h:80
eGetFrameStamp
@ eGetFrameStamp
Definition: ntv2publicinterface.h:4249
AUTOCIRCULATE_DATA::eCommand
AUTO_CIRC_COMMAND eCommand
Definition: ntv2publicinterface.h:4371
AUTOCIRCULATE_TRANSFER_STRUCT_64::rp188
RP188_STRUCT rp188
Definition: ntv2publicinterface.h:4547
AUTOCIRCULATE_TRANSFER_STRUCT_64::transferFlags
ULWord transferFlags
Definition: ntv2publicinterface.h:4550
AUTOCIRCULATE_DATA_64::bVal4
BOOL_ bVal4
Definition: ntv2publicinterface.h:4355
CNTV2DriverInterface::GetStreamingApplication
virtual bool GetStreamingApplication(ULWord &outAppType, int32_t &outProcessID)
Answers with the four-CC type and process ID of the application that currently "owns" the AJA device ...
Definition: ntv2driverinterface.cpp:1125
lock.h
Declares the AJALock class.
kAgentAppFcc
const uint32_t kAgentAppFcc(((((uint32_t)( 'A'))<< 24)|(((uint32_t)( 'j'))<< 16)|(((uint32_t)( 'a'))<< 8)|(((uint32_t)( 'A'))<< 0)))
AUTOCIRCULATE_TRANSFER_STRUCT::hUser
ULWord hUser
Definition: ntv2publicinterface.h:4586
OS_IOConnectCallStructMethod
#define OS_IOConnectCallStructMethod(_u_, _v_, _w_, _x_, _y_, _z_)
Definition: ntv2macdriverinterface.cpp:76
AUTOCIRCULATE_DATA_64::lVal3
LWord lVal3
Definition: ntv2publicinterface.h:4347
AUTOCIRCULATE_TASK_STRUCT_64::reserved2
ULWord reserved2
Definition: ntv2publicinterface.h:4751
ULWord
uint32_t ULWord
Definition: ajatypes.h:253
AUTOCIRCULATE_TRANSFER_STRUCT_64::channelSpec
NTV2Crosspoint channelSpec
Definition: ntv2publicinterface.h:4538
OS_IOServiceNameMatching
#define OS_IOServiceNameMatching(_x_)
Definition: ntv2macdriverinterface.cpp:69
AUTOCIRCULATE_TASK_STRUCT::reserved1
ULWord reserved1
Definition: ntv2publicinterface.h:4763
CNTV2DriverInterface::DmaTransfer
virtual bool DmaTransfer(const NTV2DMAEngine inDMAEngine, const bool inIsRead, const ULWord inFrameNumber, ULWord *pFrameBuffer, const ULWord inCardOffsetBytes, const ULWord inTotalByteCount, const bool inSynchronous=(!(0)))
Transfers data between the AJA device and the host. This function will block and not return to the ca...
Definition: ntv2driverinterface.cpp:482
AutoCircVidProcInfo::mode
AutoCircVidProcMode mode
Definition: ntv2publicinterface.h:4208
AJA_DebugStat_WaitForInterruptUartTx1
@ AJA_DebugStat_WaitForInterruptUartTx1
Definition: debugshare.h:236
AUTOCIRCULATE_DATA::lVal1
LWord lVal1
Definition: ntv2publicinterface.h:4374
Pointer64
uint64_t Pointer64
Definition: ajatypes.h:257
CNTV2MacDriverInterface::GetStreamingApplication
virtual bool GetStreamingApplication(ULWord &outAppType, int32_t &outProcessID)
Answers with the four-CC type and process ID of the application that currently "owns" the AJA device ...
Definition: ntv2macdriverinterface.cpp:651
AUTOCIRCULATE_TRANSFER_STRUCT
Definition: ntv2publicinterface.h:4573
AJA_DebugStat_AutoCirculateXfer
@ AJA_DebugStat_AutoCirculateXfer
Definition: debugshare.h:245
AUTOCIRCULATE_TRANSFER_STRUCT_64::hUser
ULWord hUser
Definition: ntv2publicinterface.h:4549
kRegisterMemory
@ kRegisterMemory
Definition: ntv2macpublicinterface.h:82
NTV2DeviceIDToString
std::string NTV2DeviceIDToString(const NTV2DeviceID inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:4673
CNTV2MacDriverInterface::MapXena2Flash
virtual bool MapXena2Flash(void)
Definition: ntv2macdriverinterface.cpp:321
KR
#define KR(_kr_)
Definition: ntv2macdriverinterface.cpp:47
eFlushAutoCirculate
@ eFlushAutoCirculate
Definition: ntv2publicinterface.h:4250
DMA_TRANSFER_STRUCT_64::dmaCardFrameNumber
ULWord dmaCardFrameNumber
Definition: ntv2publicinterface.h:4829
AJA_DebugStat_WaitForInterruptUartTx2
@ AJA_DebugStat_WaitForInterruptUartTx2
Definition: debugshare.h:238
eGetAutoCirc
@ eGetAutoCirc
Definition: ntv2publicinterface.h:4248
DMA_TRANSFER_STRUCT_64::dmaSegmentCardPitch
ULWord dmaSegmentCardPitch
Definition: ntv2publicinterface.h:4834
AUTOCIRCULATE_DATA::lVal2
LWord lVal2
Definition: ntv2publicinterface.h:4375
DMA_TRANSFER_STRUCT_64::dmaEngine
NTV2DMAEngine dmaEngine
Definition: ntv2publicinterface.h:4824
AUTOCIRCULATE_TASK_STRUCT::taskArray
AutoCircGenericTask * taskArray
Definition: ntv2publicinterface.h:4761
AUTOCIRCULATE_DATA_64
Definition: ntv2publicinterface.h:4340
OS_IOKitWaitQuiet
#define OS_IOKitWaitQuiet(_x_, _y_)
Definition: ntv2macdriverinterface.cpp:79
AUTOCIRCULATE_TRANSFER_STRUCT::audioBuffer
ULWord * audioBuffer
Definition: ntv2publicinterface.h:4579
NTV2_HEADER
All new NTV2 structs start with this common header.
Definition: ntv2publicinterface.h:6954
UWord
uint16_t UWord
Definition: ajatypes.h:251
CNTV2MacDriverInterface::RestoreHardwareProcampRegisters
virtual bool RestoreHardwareProcampRegisters(void)
Definition: ntv2macdriverinterface.cpp:941
AUTOCIRCULATE_TRANSFER_STRUCT_64::customAncInfo
CUSTOM_ANC_STRUCT customAncInfo
This field is obsolete. Do not use.
Definition: ntv2publicinterface.h:4556
AUTOCIRCULATE_TRANSFER_STRUCT::videoNumSegments
ULWord videoNumSegments
Definition: ntv2publicinterface.h:4603
AUTOCIRCULATE_DATA::bVal5
BOOL_ bVal5
Definition: ntv2publicinterface.h:4385
DIDBG
#define DIDBG(__x__)
Definition: ntv2macdriverinterface.cpp:54
kNTV2DriverBadTrailerTag
const IOReturn kNTV2DriverBadTrailerTag
Definition: ntv2macpublicinterface.h:29
SystemStatusCode
SystemStatusCode
Definition: ntv2publicinterface.h:4854
ntv2utils.h
Declares numerous NTV2 utility functions.
AUTOCIRCULATE_TRANSFER_STRUCT_64::vidProcInfo
AutoCircVidProcInfo vidProcInfo
Definition: ntv2publicinterface.h:4555
AUTOCIRCULATE_TASK_STRUCT_64::numTasks
ULWord numTasks
Definition: ntv2publicinterface.h:4746
OS_IOMasterPort
#define OS_IOMasterPort(_x_, _y_)
Definition: ntv2macdriverinterface.cpp:65
AUTOCIRCULATE_TASK_STRUCT_64::taskVersion
ULWord taskVersion
Definition: ntv2publicinterface.h:4744
CNTV2MacDriverInterface::WaitForChangeEvent
virtual bool WaitForChangeEvent(UInt32 timeout=0)
Definition: ntv2macdriverinterface.cpp:795
CUSTOM_ANC_STRUCT::Group4
ULWord Group4
Definition: ntv2publicinterface.h:4232
INSTP
#define INSTP(_p_)
Definition: ntv2macdriverinterface.cpp:48
eTransferAutoCirculateEx
@ eTransferAutoCirculateEx
Definition: ntv2publicinterface.h:4255
AUTOCIRCULATE_DATA::lVal4
LWord lVal4
Definition: ntv2publicinterface.h:4377
eStartAutoCirc
@ eStartAutoCirc
Definition: ntv2publicinterface.h:4245
AUTOCIRCULATE_DATA_64::channelSpec
NTV2Crosspoint channelSpec
Definition: ntv2publicinterface.h:4343
AUTOCIRCULATE_TRANSFER_STRUCT_64
Definition: ntv2publicinterface.h:4536
DMA_TRANSFER_STRUCT_64::dmaSegmentSize
ULWord dmaSegmentSize
Definition: ntv2publicinterface.h:4832
AUTOCIRCULATE_TRANSFER_STRUCT_64::audioBufferSize
ULWord audioBufferSize
Definition: ntv2publicinterface.h:4543
DMA_TRANSFER_STRUCT_64::dmaCardFrameOffset
ULWord dmaCardFrameOffset
Definition: ntv2publicinterface.h:4830
AUTOCIRCULATE_TRANSFER_STRUCT::vidProcInfo
AutoCircVidProcInfo vidProcInfo
Definition: ntv2publicinterface.h:4592
CNTV2MacDriverInterface::MapMemory
virtual bool MapMemory(const MemoryType memType, void **memPtr)
Definition: ntv2macdriverinterface.cpp:342
kDriverRestoreProcAmpRegisters
@ kDriverRestoreProcAmpRegisters
Definition: ntv2macpublicinterface.h:54
sNTV2PCIKEXTClassName
static const string sNTV2PCIKEXTClassName("com_aja_iokit_ntv2")
AUTOCIRCULATE_TASK_STRUCT::reserved0
ULWord reserved0
Definition: ntv2publicinterface.h:4762
AJALock
Definition: lock.h:30
NTV2RegInfo
struct NTV2RegInfo NTV2RegInfo
Everything needed to call CNTV2Card::ReadRegister or CNTV2Card::WriteRegister functions.
NTV2ColorCorrectionInfo_64::saturationValue
UWord_ saturationValue
Definition: ntv2publicinterface.h:4146
OS_IOObjectRelease
#define OS_IOObjectRelease(_x_)
Definition: ntv2macdriverinterface.cpp:72
AUTOCIRCULATE_TRANSFER_STRUCT_64::videoSegmentCardPitch
ULWord videoSegmentCardPitch
Definition: ntv2publicinterface.h:4568
AJA_DebugStat_WaitForInterruptUartRx2
@ AJA_DebugStat_WaitForInterruptUartRx2
Definition: debugshare.h:237
AJA_NULL
#define AJA_NULL
Definition: ajatypes.h:197
AUTOCIRCULATE_DATA::bVal1
BOOL_ bVal1
Definition: ntv2publicinterface.h:4381
kNTV2DriverPgmXilinxErr
const IOReturn kNTV2DriverPgmXilinxErr
Definition: ntv2macpublicinterface.h:20
AutoCircVidProcInfo::backgroundVideoCrosspoint
NTV2Crosspoint backgroundVideoCrosspoint
Definition: ntv2publicinterface.h:4210
AJAAutoLock
Definition: lock.h:91
AUTOCIRCULATE_TRANSFER_STRUCT::videoDmaOffset
ULWord videoDmaOffset
Definition: ntv2publicinterface.h:4578
DMA_TRANSFER_STRUCT_64::dmaHostBuffer
Pointer64 dmaHostBuffer
Definition: ntv2publicinterface.h:4827
CNTV2MacDriverInterface::SystemControl
virtual bool SystemControl(void *dataPtr, SystemControlCode systemControlCode)
Definition: ntv2macdriverinterface.cpp:361
NTV2ColorCorrectionInfo::ccLookupTables
ULWord * ccLookupTables
only used in 3way color correction mode.
Definition: ntv2publicinterface.h:4155
CNTV2MacDriverInterface::UnmapXena2Flash
virtual bool UnmapXena2Flash(void)
Definition: ntv2macdriverinterface.cpp:333
AJA_DebugStat_WaitForInterruptIn7
@ AJA_DebugStat_WaitForInterruptIn7
Definition: debugshare.h:232
AUTOCIRCULATE_DATA::lVal6
LWord lVal6
Definition: ntv2publicinterface.h:4379
AutoCircVidProcInfo::foregroundVideoCrosspoint
NTV2Crosspoint foregroundVideoCrosspoint
Definition: ntv2publicinterface.h:4209
AUTOCIRCULATE_DATA_64::lVal6
LWord lVal6
Definition: ntv2publicinterface.h:4350
AutoCircVidProcInfo::transitionCoefficient
Fixed_ transitionCoefficient
Definition: ntv2publicinterface.h:4213
AJA_DebugStat_WaitForInterruptIn6
@ AJA_DebugStat_WaitForInterruptIn6
Definition: debugshare.h:231
RP188_STRUCT::DBB
ULWord DBB
Definition: ntv2publicinterface.h:4084
kXena2FlashMemory
@ kXena2FlashMemory
Definition: ntv2macpublicinterface.h:84
AJA_DebugStat_WaitForInterruptUartRx1
@ AJA_DebugStat_WaitForInterruptUartRx1
Definition: debugshare.h:235
AUTOCIRCULATE_DATA_64::bVal5
BOOL_ bVal5
Definition: ntv2publicinterface.h:4356
AUTOCIRCULATE_TRANSFER_STRUCT_64::desiredFrame
LWord desiredFrame
Definition: ntv2publicinterface.h:4548
DEC
#define DEC(__x__)
Definition: ntv2publicinterface.h:5605
RP188_STRUCT::Low
ULWord Low
Definition: ntv2publicinterface.h:4085
AUTOCIRCULATE_TASK_STRUCT_64::maxTasks
ULWord maxTasks
Definition: ntv2publicinterface.h:4747
AUTOCIRCULATE_TRANSFER_STRUCT::customAncInfo
CUSTOM_ANC_STRUCT customAncInfo
This field is obsolete. Do not use.
Definition: ntv2publicinterface.h:4593
CNTV2MacDriverInterface::MapFrameBuffers
virtual bool MapFrameBuffers(void)
Definition: ntv2macdriverinterface.cpp:277
CUSTOM_ANC_STRUCT::Group1
ULWord Group1
Definition: ntv2publicinterface.h:4229
OS_IOServiceOpen
#define OS_IOServiceOpen(_w_, _x_, _y_, _z_)
Definition: ntv2macdriverinterface.cpp:66
UByte
uint8_t UByte
Definition: ajatypes.h:248
AUTOCIRCULATE_TRANSFER_STRUCT_64::audioBuffer
Pointer64 audioBuffer
Definition: ntv2publicinterface.h:4542
CNTV2MacDriverInterface::SetStreamingApplication
virtual bool SetStreamingApplication(const ULWord appType, const int32_t pid)
Sets the four-CC type and process ID of the application that should "own" the AJA device (i....
Definition: ntv2macdriverinterface.cpp:623
SystemControlCode
SystemControlCode
Definition: ntv2publicinterface.h:4900
CNTV2MacDriverInterface::NTV2Message
virtual bool NTV2Message(NTV2_HEADER *pInMessage)
Sends a message to the NTV2 driver (the new, improved, preferred way).
Definition: ntv2macdriverinterface.cpp:1130
AUTOCIRCULATE_TRANSFER_STRUCT::videoSegmentCardPitch
ULWord videoSegmentCardPitch
Definition: ntv2publicinterface.h:4605
kDriverAutoCirculateControl
@ kDriverAutoCirculateControl
Definition: ntv2macpublicinterface.h:59
AJA_DebugStat_WaitForInterruptOut1
@ AJA_DebugStat_WaitForInterruptOut1
Definition: debugshare.h:234
AUTOCIRCULATE_TRANSFER_STRUCT_64::frameBufferOrientation
NTV2VideoFrameBufferOrientation frameBufferOrientation
Definition: ntv2publicinterface.h:4553
SCC_Test
@ SCC_Test
Definition: ntv2publicinterface.h:4902
std
Definition: json.hpp:5362
AUTOCIRCULATE_TASK_STRUCT_64::reserved1
ULWord reserved1
Definition: ntv2publicinterface.h:4750
AUTOCIRCULATE_TRANSFER_STATUS_STRUCT
Definition: ntv2publicinterface.h:4522
DIFAIL
#define DIFAIL(__x__)
Definition: ntv2macdriverinterface.cpp:50
AUTOCIRCULATE_DATA_64::bVal8
BOOL_ bVal8
Definition: ntv2publicinterface.h:4359
ePauseAutoCirc
@ ePauseAutoCirc
Definition: ntv2publicinterface.h:4247
eInitAutoCirc
@ eInitAutoCirc
Definition: ntv2publicinterface.h:4244
CNTV2MacDriverInterface::AcquireStreamForApplicationWithReference
virtual bool AcquireStreamForApplicationWithReference(ULWord inApplicationType, int32_t inProcessID)
A reference-counted version of CNTV2DriverInterface::AcquireStreamForApplication useful for process g...
Definition: ntv2macdriverinterface.cpp:551
CNTV2MacDriverInterface::UnmapRegisters
virtual bool UnmapRegisters(void)
Definition: ntv2macdriverinterface.cpp:312
AUTOCIRCULATE_P2P_STRUCT
Definition: ntv2publicinterface.h:4657
DMA_TRANSFER_STRUCT_64
Definition: ntv2publicinterface.h:4823
DMA_TRANSFER_STRUCT_64::dmaNumberOfSegments
ULWord dmaNumberOfSegments
Definition: ntv2publicinterface.h:4831
NTV2ColorCorrectionInfo::mode
NTV2ColorCorrectionMode mode
Definition: ntv2publicinterface.h:4153
AUTOCIRCULATE_TRANSFER_STRUCT_64::videoBufferSize
ULWord videoBufferSize
Definition: ntv2publicinterface.h:4540
eStopAutoCirc
@ eStopAutoCirc
Definition: ntv2publicinterface.h:4246
AUTOCIRCULATE_DATA_64::bVal3
BOOL_ bVal3
Definition: ntv2publicinterface.h:4354
atomic.h
Declares the AJAAtomic class.
eGetFrameStampEx2
@ eGetFrameStampEx2
Definition: ntv2publicinterface.h:4257
CNTV2MacDriverInterface::AcquireStreamForApplication
virtual bool AcquireStreamForApplication(ULWord inApplicationType, int32_t inProcessID)
Reserves exclusive use of the AJA device for a given process, preventing other processes on the host ...
Definition: ntv2macdriverinterface.cpp:481
AUTOCIRCULATE_DATA_64::bVal1
BOOL_ bVal1
Definition: ntv2publicinterface.h:4352
OS_IOConnectMapMemory
#define OS_IOConnectMapMemory(_u_, _v_, _w_, _x_, _y_, _z_)
Definition: ntv2macdriverinterface.cpp:77
NTV2DeviceIDSet
std::set< NTV2DeviceID > NTV2DeviceIDSet
A set of NTV2DeviceIDs.
Definition: ntv2utils.h:1031
CNTV2MacDriverInterface::CNTV2MacDriverInterface
CNTV2MacDriverInterface()
My default constructor.
Definition: ntv2macdriverinterface.cpp:156
CNTV2MacDriverInterface::DmaTransfer
virtual bool DmaTransfer(const NTV2DMAEngine inDMAEngine, const bool inIsRead, const ULWord inFrameNumber, ULWord *pFrameBuffer, const ULWord inCardOffsetBytes, const ULWord inByteCount, const bool inSynchronous=(!(0)))
Transfers data between the AJA device and the host. This function will block and not return to the ca...
Definition: ntv2macdriverinterface.cpp:824
CNTV2MacDriverInterface::UnmapFrameBuffers
virtual bool UnmapFrameBuffers(void)
Definition: ntv2macdriverinterface.cpp:290
AJA_DebugStat_WriteRegister
@ AJA_DebugStat_WriteRegister
Definition: debugshare.h:225
AUTOCIRCULATE_TASK_STRUCT::reserved2
ULWord reserved2
Definition: ntv2publicinterface.h:4764
AUTOCIRCULATE_DATA::bVal4
BOOL_ bVal4
Definition: ntv2publicinterface.h:4384
CNTV2MacDriverInterface::SetAudioOutputMode
virtual bool SetAudioOutputMode(NTV2_GlobalAudioPlaybackMode mode)
Definition: ntv2macdriverinterface.cpp:1169
MDIFAIL
#define MDIFAIL(__x__)
Definition: ntv2macdriverinterface.cpp:56
AUTOCIRCULATE_TASK_STRUCT::numTasks
ULWord numTasks
Definition: ntv2publicinterface.h:4759
AUTOCIRCULATE_DATA_64::bVal2
BOOL_ bVal2
Definition: ntv2publicinterface.h:4353
AUTOCIRCULATE_TRANSFER_STRUCT_64::audioStartSample
ULWord audioStartSample
Definition: ntv2publicinterface.h:4544
eSetActiveFrame
@ eSetActiveFrame
Definition: ntv2publicinterface.h:4259
AutoCircVidProcInfo::backgroundKeyCrosspoint
NTV2Crosspoint backgroundKeyCrosspoint
Definition: ntv2publicinterface.h:4212
AUTOCIRCULATE_TRANSFER_STRUCT_64::audioNumChannels
ULWord audioNumChannels
Definition: ntv2publicinterface.h:4545
AutoCircVidProcInfo::transitionSoftness
Fixed_ transitionSoftness
Definition: ntv2publicinterface.h:4214
kVRegServicesInitialized
@ kVRegServicesInitialized
Definition: ntv2virtualregisters.h:316
AJA_DebugStat_DMATransfer
@ AJA_DebugStat_DMATransfer
Definition: debugshare.h:241
AUTOCIRCULATE_TASK_STRUCT_64::taskSize
ULWord taskSize
Definition: ntv2publicinterface.h:4745
AUTOCIRCULATE_DATA_64::lVal4
LWord lVal4
Definition: ntv2publicinterface.h:4348
AUTOCIRCULATE_TASK_STRUCT
Definition: ntv2publicinterface.h:4755
AUTOCIRCULATE_TRANSFER_STRUCT_64::bDisableExtraAudioInfo
BOOL_ bDisableExtraAudioInfo
Definition: ntv2publicinterface.h:4551
OS_IOServiceMatching
#define OS_IOServiceMatching(_x_)
Definition: ntv2macdriverinterface.cpp:68
AUTOCIRCULATE_DATA::bVal8
BOOL_ bVal8
Definition: ntv2publicinterface.h:4388
kDriverWaitForChangeEvent
@ kDriverWaitForChangeEvent
Definition: ntv2macpublicinterface.h:51
SSC_GetFirmwareProgress
@ SSC_GetFirmwareProgress
Definition: ntv2publicinterface.h:4856
DMA_TRANSFER_STRUCT_64::dmaSize
ULWord dmaSize
Definition: ntv2publicinterface.h:4828
CNTV2DriverInterface::AutoCirculate
virtual bool AutoCirculate(AUTOCIRCULATE_DATA &pAutoCircData)
Sends an AutoCirculate command to the NTV2 driver.
Definition: ntv2driverinterface.cpp:559
kDriverDMATransferEx
@ kDriverDMATransferEx
Definition: ntv2macpublicinterface.h:67
DMA_TRANSFER_STRUCT_64::dmaToCard
BOOL_ dmaToCard
Definition: ntv2publicinterface.h:4836
kDriverSetStreamForApplication
@ kDriverSetStreamForApplication
Definition: ntv2macpublicinterface.h:44
kDriverWriteRegister
@ kDriverWriteRegister
Definition: ntv2macpublicinterface.h:39
eTransferAutoCirculateEx2
@ eTransferAutoCirculateEx2
Definition: ntv2publicinterface.h:4256
kDriverGetInterruptCount
@ kDriverGetInterruptCount
Definition: ntv2macpublicinterface.h:50
DMA_TRANSFER_STRUCT_64::dmaSegmentHostPitch
ULWord dmaSegmentHostPitch
Definition: ntv2publicinterface.h:4833
AUTOCIRCULATE_TASK_STRUCT::maxTasks
ULWord maxTasks
Definition: ntv2publicinterface.h:4760
AUTOCIRCULATE_DATA::bVal7
BOOL_ bVal7
Definition: ntv2publicinterface.h:4387
CNTV2MacDriverInterface::ReleaseStreamForApplicationWithReference
virtual bool ReleaseStreamForApplicationWithReference(ULWord inApplicationType, int32_t inProcessID)
A reference-counted version of CNTV2DriverInterface::ReleaseStreamForApplication useful for process g...
Definition: ntv2macdriverinterface.cpp:589
xHEX0N
#define xHEX0N(__x__, __n__)
Definition: ntv2publicinterface.h:5604
AUTOCIRCULATE_TRANSFER_STRUCT::channelSpec
NTV2Crosspoint channelSpec
Definition: ntv2publicinterface.h:4575
AUTOCIRCULATE_DATA::pvVal1
void * pvVal1
Definition: ntv2publicinterface.h:4390
AUTOCIRCULATE_DATA_64::bVal6
BOOL_ bVal6
Definition: ntv2publicinterface.h:4357
NTV2ColorCorrectionInfo::saturationValue
UWord_ saturationValue
Definition: ntv2publicinterface.h:4154
kDriverGetStreamForApplication
@ kDriverGetStreamForApplication
Definition: ntv2macpublicinterface.h:45
AJA_DebugStat_WaitForInterruptIn1
@ AJA_DebugStat_WaitForInterruptIn1
Definition: debugshare.h:226
OS_IOIteratorNext
#define OS_IOIteratorNext(_x_)
Definition: ntv2macdriverinterface.cpp:71
OS_IOConnectCallScalarMethod
#define OS_IOConnectCallScalarMethod(_u_, _v_, _w_, _x_, _y_, _z_)
Definition: ntv2macdriverinterface.cpp:75
OS_IOConnectCallMethod
#define OS_IOConnectCallMethod(_q_, _r_, _s_, _t_, _u_, _v_, _w_, _x_, _y_, _z_)
Definition: ntv2macdriverinterface.cpp:74
AJA_DebugStat_WaitForInterruptIn3
@ AJA_DebugStat_WaitForInterruptIn3
Definition: debugshare.h:228
AUTOCIRCULATE_DATA::pvVal2
void * pvVal2
Definition: ntv2publicinterface.h:4391
CNTV2MacDriverInterface::WriteRegister
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...
Definition: ntv2macdriverinterface.cpp:430
CUSTOM_ANC_STRUCT::Group2
ULWord Group2
Definition: ntv2publicinterface.h:4230
AUTOCIRCULATE_TRANSFER_STRUCT::videoBufferSize
ULWord videoBufferSize
Definition: ntv2publicinterface.h:4577
CNTV2DriverInterface::NTV2Message
virtual bool NTV2Message(NTV2_HEADER *pInMessage)
Sends a message to the NTV2 driver (the new, improved, preferred way).
Definition: ntv2driverinterface.cpp:584
AUTOCIRCULATE_TRANSFER_STRUCT::audioNumChannels
ULWord audioNumChannels
Definition: ntv2publicinterface.h:4582
kDriverAutoCirculateFramestamp
@ kDriverAutoCirculateFramestamp
Definition: ntv2macpublicinterface.h:62
AJA_DebugStat_WaitForInterruptIn4
@ AJA_DebugStat_WaitForInterruptIn4
Definition: debugshare.h:229
AUTOCIRCULATE_DATA_64::lVal2
LWord lVal2
Definition: ntv2publicinterface.h:4346
OS_IOServiceGetMatchingServices
#define OS_IOServiceGetMatchingServices(_x_, _y_, _z_)
Definition: ntv2macdriverinterface.cpp:70
AUTOCIRCULATE_TRANSFER_STRUCT_64::videoQuarterSizeExpand
NTV2QuarterSizeExpandMode videoQuarterSizeExpand
Definition: ntv2publicinterface.h:4569
gLegalDeviceIDs
static NTV2DeviceIDSet gLegalDeviceIDs
Definition: ntv2macdriverinterface.cpp:36
AUTOCIRCULATE_TASK_STRUCT_64::reserved0
ULWord reserved0
Definition: ntv2publicinterface.h:4749
sIntEnumToStatKeys
static const uint32_t sIntEnumToStatKeys[]
Definition: ntv2macdriverinterface.cpp:700
kDriverNTV2Message
@ kDriverNTV2Message
Definition: ntv2macpublicinterface.h:72
AUTOCIRCULATE_TRANSFER_STRUCT_64::frameBufferFormat
NTV2FrameBufferFormat frameBufferFormat
Definition: ntv2publicinterface.h:4552
ntv2nubaccess.h
Declares NTV2 "nub" client functions.
kNTV2DriverPrepMemErr
const IOReturn kNTV2DriverPrepMemErr
Definition: ntv2macpublicinterface.h:22
NTV2ColorCorrectionInfo_64::mode
NTV2ColorCorrectionMode mode
Definition: ntv2publicinterface.h:4145
eChangeEvent
@ eChangeEvent
Definition: ntv2publicinterface.h:3755
gLegalDevIDsLock
static AJALock gLegalDevIDsLock
Definition: ntv2macdriverinterface.cpp:35
kNTV2DriverDMATooLarge
const IOReturn kNTV2DriverDMATooLarge
Definition: ntv2macpublicinterface.h:24
debug.h
Declares the AJADebug class.
CNTV2MacDriverInterface::GetPCISlotNumber
virtual ULWord GetPCISlotNumber(void) const
Definition: ntv2macdriverinterface.cpp:265
AUTOCIRCULATE_DATA
Definition: ntv2publicinterface.h:4369
AJA_DebugStat_WaitForInterruptIn5
@ AJA_DebugStat_WaitForInterruptIn5
Definition: debugshare.h:230
AUTOCIRCULATE_TRANSFER_STRUCT::desiredFrame
LWord desiredFrame
Definition: ntv2publicinterface.h:4585
kDriverAcquireStreamForApplicationWithReference
@ kDriverAcquireStreamForApplicationWithReference
Definition: ntv2macpublicinterface.h:68
AUTOCIRCULATE_DATA_64::bVal7
BOOL_ bVal7
Definition: ntv2publicinterface.h:4358
kNTV2UnknownStructType
const IOReturn kNTV2UnknownStructType
Definition: ntv2macpublicinterface.h:27
AUTOCIRCULATE_TASK_STRUCT_64
Definition: ntv2publicinterface.h:4742
CNTV2MacDriverInterface::CloseLocalPhysical
virtual bool CloseLocalPhysical(void)
Releases host resources associated with the local/physical device connection.
Definition: ntv2macdriverinterface.cpp:243
kDriverAcquireStreamForApplication
@ kDriverAcquireStreamForApplication
Definition: ntv2macpublicinterface.h:42
kFrameBufferMemory
@ kFrameBufferMemory
Definition: ntv2macpublicinterface.h:83