AJA NTV2 SDK  18.0.0.2717
NTV2 SDK 18.0.0.2717
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  #if defined(NTV2_MACOS_SANDBOX)
183  static const string kSvcNames[] = {sNTV2PCIDEXTName, ""}; // DEXT only, no KEXT
184  static const size_t kNumSvcNames = 1;
185  #else
186  static const string kSvcNames[] = {sNTV2PCIDEXTName, sNTV2PCIKEXTClassName, ""}; // Try DEXT first, then KEXT
187  static const size_t kNumSvcNames = 2;
188  #endif
189 
190  for (size_t svcNdx(0); svcNdx < kNumSvcNames && !mConnection; svcNdx++)
191  {
192  const string & svcName (kSvcNames[svcNdx]);
193  const char * pSvcName(svcName.c_str());
194  #if !defined(NTV2_MACOS_SANDBOX)
195  const bool tryKEXT (svcName.find("com_aja_iokit") != string::npos);
196  #endif
197 
198  // Create an iterator to search for our driver instances...
199  error = OS_IOServiceGetMatchingServices (kIOMasterPortDefault,
200  #if defined(NTV2_MACOS_SANDBOX)
201  OS_IOServiceNameMatching(pSvcName),
202  #else
203  tryKEXT ? OS_IOServiceMatching(pSvcName) : OS_IOServiceNameMatching(pSvcName),
204  #endif
205  &ioIterator);
206  if (error != kIOReturnSuccess)
207  {DIWARN(KR(error) << ": No '" << svcName << "' driver"); continue;}
208 
209  // Find nth device -- and only use that one...
210  for (UWord ndx(inDeviceIndex); (ioObject = OS_IOIteratorNext(ioIterator)); OS_IOObjectRelease(ioObject))
211  if (ndx == 0)
212  break; // Found a match!
213  else
214  --ndx;
215 
216  if (ioIterator)
217  OS_IOObjectRelease(ioIterator);
218  if (!ioObject)
219  {
220  if (!inDeviceIndex) // Warn only if requesting first device, to show "no devices"
221  DIWARN("No '" << svcName << "' devices");
222  continue; // No service object
223  }
224 
225  // Found the device we want -- open it...
226  error = OS_IOServiceOpen (ioObject, ::mach_task_self(), 0, &mConnection);
227  OS_IOObjectRelease(ioObject);
228  if (error != kIOReturnSuccess)
229  {DIWARN(KR(error) << ": IOServiceOpen failed for '" << svcName << "' ndx=" << inDeviceIndex); continue;}
230 
231  #if defined(NTV2_MACOS_SANDBOX)
232  mIsDEXT = true;
233  #else
234  mIsDEXT = !tryKEXT;
235  #endif
236  } // for each in kServiceNames
237 
238  _boardOpened = mConnection != 0;
239  if (IsOpen())
240  DIDBG((mIsDEXT ? "DEXT" : "KEXT") << " ndx=" << inDeviceIndex << " conn=" << HEX8(GetIOConnect()) << " opened");
241  else
242  {DIFAIL(INSTP(this) << ": No connection: ndx=" << inDeviceIndex); return false;}
243 
244  setDeviceIndexNumber (inDeviceIndex);
246  {
247  DIFAIL("ReadRegister(kRegBoardID) failed: ndx=" << inDeviceIndex << " con=" << HEX8(GetIOConnect()) << " boardID=" << HEX8(_boardID));
248  Close();
249  return false;
250  }
251 
252  // Good to go...
253  DIDBG("Opened ndx=" << GetIndexNumber() << " con=" << HEX8(GetIOConnect()) << " id=" << ::NTV2DeviceIDToString(_boardID));
254  return true;
255 
256  } // OpenLocalPhysical
257 
258 
260  {
261  NTV2_ASSERT(!IsRemote());
262  DIDBG("Closed " << (mIsDEXT ? "DEXT" : "KEXT") << " ndx=" << GetIndexNumber() << " con=" << HEX8(GetIOConnect()) << " id=" << ::NTV2DeviceIDToString(_boardID));
263  _boardOpened = false;
264 // leave as-is _boardNumber = 0;
265  if (mConnection)
266  OS_IOServiceClose(mConnection);
267  mConnection = 0;
268  mIsDEXT = false;
269  return true;
270 
271  } // CloseLocalPhysical
272 #endif // !defined(NTV2_NULL_DEVICE)
273 
274 
275 #if !defined(NTV2_DEPRECATE_16_0)
276  //--------------------------------------------------------------------------------------------------------------------
277  // GetPCISlotNumber
278  //
279  // Returns my PCI slot number, if known; otherwise returns zero.
280  //--------------------------------------------------------------------------------------------------------------------
282  {
283  // TBD: Determine where in the IORegistry the io_connect_t is, then navigate up to the io_registry_entry
284  // for our driver that contains the "AJAPCISlot" property. Then proceed as before...
285  return 0; // FINISH THIS
286  } // GetPCISlotNumber
287 
288  //--------------------------------------------------------------------------------------------------------------------
289  // MapFrameBuffers
290  //
291  // Return a pointer and size of either the register map or frame buffer memory.
292  //--------------------------------------------------------------------------------------------------------------------
294  {
295  UByte *baseAddr;
296  if (!MapMemory (kFrameBufferMemory, reinterpret_cast<void**>(&baseAddr)))
297  {
298  _pFrameBaseAddress = AJA_NULL;
299  _pCh1FrameBaseAddress = _pCh2FrameBaseAddress = AJA_NULL; // DEPRECATE!
300  return false;
301  }
302  _pFrameBaseAddress = reinterpret_cast<ULWord*>(baseAddr);
303  return true;
304  }
305 
307  {
308  _pFrameBaseAddress = AJA_NULL;
309  _pCh1FrameBaseAddress = _pCh2FrameBaseAddress = AJA_NULL; // DEPRECATE!
310  return true;
311  }
312 
313  //--------------------------------------------------------------------------------------------------------------------
314  // MapRegisters
315  //--------------------------------------------------------------------------------------------------------------------
317  {
318  ULWord *baseAddr;
319  if (!MapMemory (kRegisterMemory, reinterpret_cast<void**>(&baseAddr)))
320  {
321  _pRegisterBaseAddress = AJA_NULL;
322  return false;
323  }
324  _pRegisterBaseAddress = reinterpret_cast<ULWord*>(baseAddr);
325  return true;
326  }
327 
329  {
330  _pRegisterBaseAddress = AJA_NULL;
331  return true;
332  }
333 
334  //--------------------------------------------------------------------------------------------------------------------
335  // Map / Unmap Xena2Flash
336  //--------------------------------------------------------------------------------------------------------------------
338  {
339  ULWord *baseAddr;
340  if (!MapMemory (kXena2FlashMemory, reinterpret_cast<void**>(&baseAddr)))
341  {
342  _pXena2FlashBaseAddress = AJA_NULL;
343  return false;
344  }
345  _pXena2FlashBaseAddress = reinterpret_cast<ULWord*>(baseAddr);
346  return true;
347  }
348 
350  {
351  _pXena2FlashBaseAddress = AJA_NULL;
352  return true;
353  }
354 
355  //--------------------------------------------------------------------------------------------------------------------
356  // MapMemory
357  //--------------------------------------------------------------------------------------------------------------------
358  bool CNTV2MacDriverInterface::MapMemory (const MemoryType memType, void **memPtr)
359  {
360 #ifndef __LP64__
361  return false;
362 #endif
363  if (GetIOConnect())
364  {
365  mach_vm_size_t size(0);
366  OS_IOConnectMapMemory ( GetIOConnect(), memType, mach_task_self(),
367  reinterpret_cast<mach_vm_address_t*>(memPtr),
368  &size, kIOMapDefaultCache | kIOMapAnywhere);
369  return size > 0;
370  }
371  return false;
372  }
373 
374  //--------------------------------------------------------------------------------------------------------------------
375  // SystemControl
376  //--------------------------------------------------------------------------------------------------------------------
378  {
379  kern_return_t kernResult = KERN_FAILURE;
380  uint64_t scalarI_64[2] = {uint64_t(dataPtr), controlCode};
381  uint32_t outputCount = 0;
382  if (controlCode != SCC_Test)
383  kernResult = KERN_INVALID_ARGUMENT;
384  else if (GetIOConnect())
385  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
386  kDriverSystemControl, // selector of the function to be called via the user client.
387  scalarI_64, // array of scalar (64-bit) input values.
388  2, // the number of scalar input values.
389  AJA_NULL, // array of scalar (64-bit) output values.
390  &outputCount); // pointer to the number of scalar output values.
391  if (kernResult == KERN_SUCCESS)
392  return true;
393  DIFAIL (KR(kernResult) << ", con=" << HEX8(GetIOConnect()));
394  return false;
395  }
396 #endif // !defined(NTV2_DEPRECATE_16_0)
397 
398 #pragma mark - New Driver Calls
399 
400 //--------------------------------------------------------------------------------------------------------------------
401 // ReadRegister
402 //
403 // Return the value of specified register after masking and shifting the value.
404 //--------------------------------------------------------------------------------------------------------------------
405 bool CNTV2MacDriverInterface::ReadRegister (const ULWord inRegNum, ULWord & outValue, const ULWord inMask, const ULWord inShift)
406 {
407  if (inShift >= 32)
408  {
409  DIFAIL("Shift " << DEC(inShift) << " > 31, reg=" << DEC(inRegNum) << " msk=" << xHEX0N(inMask,8));
410  return false;
411  }
412 #if defined (NTV2_NUB_CLIENT_SUPPORT)
413  if (IsRemote())
414  return CNTV2DriverInterface::ReadRegister(inRegNum, outValue, inMask, inShift);
415 #endif // defined (NTV2_NUB_CLIENT_SUPPORT)
416  kern_return_t kernResult(KERN_FAILURE);
417  uint64_t scalarI_64[3] = {inRegNum, inMask, inShift};
418  uint64_t scalarO_64 = outValue;
419  uint32_t outputCount = 1;
420  if (GetIOConnect())
421  {
423  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
424  kDriverReadRegister, // selector of the function to be called via the user client.
425  scalarI_64, // array of scalar (64-bit) input values.
426  mIsDEXT ? 3 : 2, // the number of scalar input values.
427  &scalarO_64, // array of scalar (64-bit) output values.
428  &outputCount); // pointer to the number of scalar output values.
430  }
431  if (kernResult != KERN_SUCCESS)
432  {
433  DIFAIL(KR(kernResult) << ": ndx=" << GetIndexNumber() << ", con=" << HEX8(GetIOConnect())
434  << " -- reg=" << DEC(inRegNum) << ", mask=" << HEX8(inMask) << ", shift=" << HEX8(inShift));
435  return false;
436  }
437  outValue = uint32_t(scalarO_64);
438 #if defined(NTV2_PRETEND_DEVICE)
439  if (inRegNum == kRegBoardID && outValue == NTV2_PRETEND_DEVICE_FROM)
440  outValue = ULWord(NTV2_PRETEND_DEVICE_TO);
441 // else if (inRegNum == kRegReserved83 || inRegNum == kRegLPRJ45IP)
442 // outValue = 0x0A03FAD9; // Local IPv4 10.3.250.217
443 #endif // NTV2_PRETEND_DEVICE
444  return true;
445 }
446 
447 
448 //--------------------------------------------------------------------------------------------------------------------
449 // WriteRegister
450 //
451 // Set the specified register value taking into accout the bit mask.
452 // If the bit mask is not 0xFFFFFFFF (default) or 0, then this does a read-modify-write.
453 //--------------------------------------------------------------------------------------------------------------------
454 bool CNTV2MacDriverInterface::WriteRegister (const ULWord inRegNum, const ULWord inValue, const ULWord inMask, const ULWord inShift)
455 {
456  if (inShift >= 32)
457  {
458  DIFAIL("Shift " << DEC(inShift) << " > 31, reg=" << DEC(inRegNum) << " msk=" << xHEX0N(inMask,8));
459  return false;
460  }
461 #if defined(NTV2_WRITEREG_PROFILING) // Register Write Profiling
462  if (mRecordRegWrites)
463  {
464  AJAAutoLock autoLock(&mRegWritesLock);
465  mRegWrites.push_back(NTV2RegInfo(inRegNum, inValue, inMask, inShift));
466  if (mSkipRegWrites)
467  return true;
468  }
469 #endif // defined(NTV2_WRITEREG_PROFILING) // Register Write Profiling
470 #if defined(NTV2_NUB_CLIENT_SUPPORT)
471  if (IsRemote())
472  return CNTV2DriverInterface::WriteRegister(inRegNum, inValue, inMask, inShift);
473 #endif // defined (NTV2_NUB_CLIENT_SUPPORT)
474  kern_return_t kernResult(KERN_FAILURE);
475  uint64_t scalarI_64[4] = {inRegNum, inValue, inMask, inShift};
476  uint32_t outputCount = 0;
477  if (GetIOConnect())
478  {
480  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
481  kDriverWriteRegister, // selector of the function to be called via the user client.
482  scalarI_64, // array of scalar (64-bit) input values.
483  mIsDEXT ? 4 : 3, // the number of scalar input values.
484  AJA_NULL, // array of scalar (64-bit) output values.
485  &outputCount); // pointer to the number of scalar output values.
487  }
488  if (kernResult == KERN_SUCCESS)
489  return true;
490  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()) << " -- reg=" << inRegNum
491  << ", val=" << HEX8(inValue) << ", mask=" << HEX8(inMask) << ", shift=" << HEX8(inShift));
492  return false;
493 }
494 
495 
496 const uint32_t kAgentAppFcc (NTV2_FOURCC('A','j','a','A'));
497 //--------------------------------------------------------------------------------------------------------------------
498 // AcquireStreamForApplication
499 //
500 // Aquire board by by waiting for current board to release its resources
501 //
502 // Note: When quicktime is using the board, desktop output on the board is disabled
503 // by the driver.
504 //--------------------------------------------------------------------------------------------------------------------
506 {
507 #if defined(NTV2_NUB_CLIENT_SUPPORT)
508  if (IsRemote())
510 #endif // defined (NTV2_NUB_CLIENT_SUPPORT)
511  ULWord svcInitialized(0);
512  if (ReadRegister(kVRegServicesInitialized, svcInitialized))
513  if (!svcInitialized) // if services have never initialized the device
514  if (appType != kAgentAppFcc) // if not AJA Agent
515  DIWARN(::NTV2DeviceIDToString(GetDeviceID()) << "-" << DEC(GetIndexNumber())
516  << " uninitialized by AJAAgent, requesting app " << xHEX0N(appType,8) << ", pid=" << DEC(pid));
517 
518  kern_return_t kernResult = KERN_FAILURE;
519  uint64_t scalarI_64[2] = {uint64_t(appType), uint64_t(pid)};
520  uint32_t outputCount = 0;
521  if (GetIOConnect())
522  {
523  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
524  kDriverAcquireStreamForApplication, // selector of the function to be called via the user client.
525  scalarI_64, // array of scalar (64-bit) input values.
526  2, // the number of scalar input values.
527  AJA_NULL, // array of scalar (64-bit) output values.
528  &outputCount); // pointer to the number of scalar output values.
529  }
530  if (kernResult == KERN_SUCCESS)
531  return true;
532  DIFAIL(KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
533  return false;
534 }
535 
536 
537 //--------------------------------------------------------------------------------------------------------------------
538 // ReleaseStreamForApplication
539 //--------------------------------------------------------------------------------------------------------------------
541 {
542 #if defined(NTV2_NUB_CLIENT_SUPPORT)
543  if (IsRemote())
545 #endif // defined (NTV2_NUB_CLIENT_SUPPORT)
546  kern_return_t kernResult = KERN_FAILURE;
547  uint64_t scalarI_64[2] = {uint64_t(appType), uint64_t(pid)};
548  uint32_t outputCount = 0;
549  if (GetIOConnect())
550  {
551  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
552  kDriverReleaseStreamForApplication, // selector of the function to be called via the user client.
553  scalarI_64, // array of scalar (64-bit) input values.
554  2, // the number of scalar input values.
555  AJA_NULL, // array of scalar (64-bit) output values.
556  &outputCount); // pointer to the number of scalar output values.
557  }
558  if (kernResult == KERN_SUCCESS)
559  return true;
560  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
561  return false;
562 }
563 
564 
565 //--------------------------------------------------------------------------------------------------------------------
566 // AcquireStreamForApplicationWithReference
567 //
568 // Do a reference counted acquire
569 // Use this call ONLY with ReleaseStreamForApplicationWithReference
570 // Aquire board by by waiting for current board to release its resources
571 //
572 // Note: When quicktime is using the board, desktop output on the board is disabled
573 // by the driver.
574 //--------------------------------------------------------------------------------------------------------------------
576 {
577 #if defined(NTV2_NUB_CLIENT_SUPPORT)
578  if (IsRemote())
580 #endif // defined (NTV2_NUB_CLIENT_SUPPORT)
581  ULWord svcInitialized(0);
582  if (ReadRegister(kVRegServicesInitialized, svcInitialized))
583  if (!svcInitialized) // if services have never initialized the device
584  if (appType != kAgentAppFcc) // if not AJA Agent
585  DIWARN(::NTV2DeviceIDToString(GetDeviceID()) << "-" << DEC(GetIndexNumber())
586  << " uninitialized by AJAAgent, requesting app " << xHEX0N(appType,8) << ", pid=" << DEC(pid));
587 
588  kern_return_t kernResult = KERN_FAILURE;
589  uint64_t scalarI_64[2] = {uint64_t(appType), uint64_t(pid)};
590  uint32_t outputCount = 0;
591  if (GetIOConnect())
592  {
593  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
594  kDriverAcquireStreamForApplicationWithReference, // selector of the function to be called via the user client.
595  scalarI_64, // array of scalar (64-bit) input values.
596  2, // the number of scalar input values.
597  AJA_NULL, // array of scalar (64-bit) output values.
598  &outputCount); // pointer to the number of scalar output values.
599  }
600  if (kernResult == KERN_SUCCESS)
601  return true;
602  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
603  return false;
604 }
605 
606 
607 //--------------------------------------------------------------------------------------------------------------------
608 // ReleaseStreamForApplicationWithReference
609 //
610 // Do a reference counted release
611 // Use this call ONLY with AcquireStreamForApplicationWithReference
612 //--------------------------------------------------------------------------------------------------------------------
614 {
615 #if defined(NTV2_NUB_CLIENT_SUPPORT)
616  if (IsRemote())
618 #endif // defined (NTV2_NUB_CLIENT_SUPPORT)
619  kern_return_t kernResult = KERN_FAILURE;
620  uint64_t scalarI_64[2] = {uint64_t(appType), uint64_t(pid)};
621  uint32_t outputCount = 0;
622  if (GetIOConnect())
623  {
624  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
625  kDriverReleaseStreamForApplicationWithReference, // selector of the function to be called via the user client.
626  scalarI_64, // array of scalar (64-bit) input values.
627  2, // the number of scalar input values.
628  AJA_NULL, // array of scalar (64-bit) output values.
629  &outputCount); // pointer to the number of scalar output values.
630  }
631  if (kernResult == KERN_SUCCESS)
632  return true;
633  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
634  return false;
635 }
636 
637 
638 //--------------------------------------------------------------------------------------------------------------------
639 // Get/Set Streaming Application
640 //
641 // Forced aquisition of board for exclusive use by app
642 // Use with care - better to use AcquireStreamForApplication
643 //
644 // Note: When quicktime is using the board, desktop output on the board is disabled
645 // by the driver.
646 //--------------------------------------------------------------------------------------------------------------------
648 {
649 #if defined(NTV2_NUB_CLIENT_SUPPORT)
650  if (IsRemote())
651  return CNTV2DriverInterface::SetStreamingApplication (appType, pid);
652 #endif // defined (NTV2_NUB_CLIENT_SUPPORT)
653  kern_return_t kernResult = KERN_FAILURE;
654  uint64_t scalarI_64[2] = {uint64_t(appType), uint64_t(pid)};
655  uint32_t outputCount = 0;
656  if (GetIOConnect())
657  {
658  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
659  kDriverSetStreamForApplication, // selector of the function to be called via the user client.
660  scalarI_64, // array of scalar (64-bit) input values.
661  2, // the number of scalar input values.
662  AJA_NULL, // array of scalar (64-bit) output values.
663  &outputCount); // pointer to the number of scalar output values.
664  }
665  if (kernResult == KERN_SUCCESS)
666  return true;
667  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
668  return false;
669 }
670 
671 
672 //--------------------------------------------------------------------------------------------------------------------
673 // GetStreamingApplication
674 //--------------------------------------------------------------------------------------------------------------------
675 bool CNTV2MacDriverInterface::GetStreamingApplication (ULWord & outAppType, int32_t & outProcessID)
676 {
677 #if defined(NTV2_NUB_CLIENT_SUPPORT)
678  if (IsRemote())
679  return CNTV2DriverInterface::GetStreamingApplication (outAppType, outProcessID);
680 #endif // defined (NTV2_NUB_CLIENT_SUPPORT)
681  kern_return_t kernResult = KERN_FAILURE;
682  uint64_t scalarO_64[2] = {0, 0};
683  uint32_t outputCount(2);
684  if (GetIOConnect())
685  {
686  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
687  kDriverGetStreamForApplication, // selector of the function to be called via the user client.
688  AJA_NULL, // array of scalar (64-bit) input values.
689  0, // the number of scalar input values.
690  scalarO_64, // array of scalar (64-bit) output values.
691  &outputCount); // pointer to the number of scalar output values.
692  }
693  outAppType = ULWord(scalarO_64[0]);
694  outProcessID = int32_t(scalarO_64[1]);
695  if (kernResult == KERN_SUCCESS)
696  return true;
697  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
698  return false;
699 }
700 
701 
702 //--------------------------------------------------------------------------------------------------------------------
703 // KernelLog
704 //--------------------------------------------------------------------------------------------------------------------
705 bool CNTV2MacDriverInterface::KernelLog (void * dataPtr, UInt32 dataSize)
706 {
707  kern_return_t kernResult = KERN_FAILURE;
708  uint64_t scalarI_64[2] = {uint64_t(dataPtr), dataSize};
709  uint32_t outputCount = 0;
710  if (GetIOConnect())
711  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
712  kDriverKernelLog, // selector of the function to be called via the user client.
713  scalarI_64, // array of scalar (64-bit) input values.
714  2, // the number of scalar input values.
715  AJA_NULL, // array of scalar (64-bit) output values.
716  &outputCount); // pointer to the number of scalar output values.
717  if (kernResult == KERN_SUCCESS)
718  return true;
719  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
720  return false;
721 }
722 
723 
724 static const uint32_t sIntEnumToStatKeys[] = { AJA_DebugStat_WaitForInterruptOut1, // eOutput1 // 0
726  AJA_DebugStat_WaitForInterruptIn1, // eInput1 // 2
727  AJA_DebugStat_WaitForInterruptIn2, // eInput2 // 3
729  AJA_DebugStat_WaitForInterruptUartTx1, // eUart1Tx // 14
730  AJA_DebugStat_WaitForInterruptUartRx1, // eUart1Rx // 15
732  AJA_DebugStat_WaitForInterruptIn3, // eInput3 // 24
733  AJA_DebugStat_WaitForInterruptIn4, // eInput4 // 25
734  AJA_DebugStat_WaitForInterruptUartTx2, // eUartTx2 // 26
735  AJA_DebugStat_WaitForInterruptUartRx2, // eUartRx2 // 27
737  AJA_DebugStat_WaitForInterruptIn5, // eInput5 // 29
738  AJA_DebugStat_WaitForInterruptIn6, // eInput6 // 30
739  AJA_DebugStat_WaitForInterruptIn7, // eInput7 // 31
740  AJA_DebugStat_WaitForInterruptIn8, // eInput8 // 32
742 
743 //--------------------------------------------------------------------------------------------------------------------
744 // WaitForInterrupt
745 //
746 // Block the current thread until the specified interrupt occurs.
747 // Supply a timeout in milliseconds - if 0 (default), then never time out.
748 // Returns true if interrupt occurs, false if timeout.
749 //--------------------------------------------------------------------------------------------------------------------
751 {
752  if (IsRemote())
753  return CNTV2DriverInterface::WaitForInterrupt(type, timeout);
754  if (type == eChangeEvent)
755  return WaitForChangeEvent(timeout);
756 
757  kern_return_t kernResult = KERN_FAILURE;
758  uint64_t scalarI_64[2] = {type, timeout};
759  uint64_t scalarO_64 = 0;
760  uint32_t outputCount = 1;
761 
762  if (!NTV2_IS_VALID_INTERRUPT_ENUM(type))
763  kernResult = KERN_INVALID_VALUE;
764  else if (GetIOConnect())
765  {
767  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
768  kDriverWaitForInterrupt,// selector of the function to be called via the user client.
769  scalarI_64, // array of scalar (64-bit) input values.
770  2, // the number of scalar input values.
771  &scalarO_64, // array of scalar (64-bit) output values.
772  &outputCount); // pointer to the number of scalar output values.
774  }
775  UInt32 interruptOccurred = uint32_t(scalarO_64);
776  if (kernResult != KERN_SUCCESS)
777  {DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect())); return false;}
778  if (interruptOccurred)
779  BumpEventCount(type);
780  return interruptOccurred;
781 }
782 
783 //--------------------------------------------------------------------------------------------------------------------
784 // GetInterruptCount
785 //
786 // Returns the number of interrupts that have occured for the specified interrupt type.
787 //--------------------------------------------------------------------------------------------------------------------
789 {
790  kern_return_t kernResult = KERN_FAILURE;
791  uint64_t scalarI_64[1] = {eInterrupt};
792  uint64_t scalarO_64 = 0;
793  uint32_t outputCount = 1;
794  if (GetIOConnect())
795  {
797  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
798  kDriverGetInterruptCount, // selector of the function to be called via the user client.
799  scalarI_64, // array of scalar (64-bit) input values.
800  1, // the number of scalar input values.
801  &scalarO_64, // array of scalar (64-bit) output values.
802  &outputCount); // pointer to the number of scalar output values.
804  }
805  outCount = ULWord(scalarO_64);
806  if (kernResult == KERN_SUCCESS)
807  return true;
808  DIFAIL(KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
809  return false;
810 }
811 
812 //--------------------------------------------------------------------------------------------------------------------
813 // WaitForChangeEvent
814 //
815 // Block the current thread until a register changes.
816 // Supply a timeout in milliseconds - if 0 (default), then never time out.
817 // Returns true if change occurs, false if timeout.
818 //--------------------------------------------------------------------------------------------------------------------
820 {
821  kern_return_t kernResult = KERN_FAILURE;
822  uint64_t scalarI_64[1] = {timeout};
823  uint64_t scalarO_64 = 0;
824  uint32_t outputCount = 1;
825  if (GetIOConnect())
826  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
827  kDriverWaitForChangeEvent, // selector of the function to be called via the user client.
828  scalarI_64, // array of scalar (64-bit) input values.
829  1, // the number of scalar input values.
830  &scalarO_64, // array of scalar (64-bit) output values.
831  &outputCount); // pointer to the number of scalar output values.
832  if (kernResult != KERN_SUCCESS)
833  DIFAIL(KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
834  return bool(scalarO_64);
835 }
836 
837 
838 //--------------------------------------------------------------------------------------------------------------------
839 // DmaTransfer
840 //
841 // Start a memory transfer using the specified DMA engine.
842 // Optional - call PrepareDMAMemory on the dataPtr before the first use of memory block
843 // for DMA and CompleteDMAMemory when done. This will speed up the DMA by not requiring
844 // memory to be prepared for each DMA. Otherwise, it takes about 2 to 5 ms (sometimes
845 // much more) for the memory block to be prepared.
846 // This function will sleep (block) until the DMA finishes.
847 //--------------------------------------------------------------------------------------------------------------------
849  const bool inIsRead,
850  const ULWord inFrameNumber,
851  ULWord * pFrameBuffer,
852  const ULWord inOffsetBytes,
853  const ULWord inByteCount,
854  const bool inSynchronous)
855 {
856  if (IsRemote())
857  return CNTV2DriverInterface::DmaTransfer(inDMAEngine, inIsRead, inFrameNumber, pFrameBuffer,
858  inOffsetBytes, inByteCount, inSynchronous);
859  if (!IsOpen())
860  return false;
861  kern_return_t kernResult = KERN_FAILURE;
862  uint64_t scalarI_64[6] = {inDMAEngine, uint64_t(pFrameBuffer), inFrameNumber, inOffsetBytes, inByteCount, !inIsRead};
863  uint32_t outputCount = 0;
864  if (GetIOConnect())
865  {
867  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
868  kDriverDMATransfer, // selector of the function to be called via the user client.
869  scalarI_64, // array of scalar (64-bit) input values.
870  6, // the number of scalar input values.
871  AJA_NULL, // array of scalar (64-bit) output values.
872  &outputCount); // pointer to the number of scalar output values.
874  }
875  if (kernResult == KERN_SUCCESS)
876  return true;
877  DIFAIL(KR(kernResult) << ": con=" << HEX8(GetIOConnect()) << ", eng=" << inDMAEngine << ", frm=" << inFrameNumber
878  << ", off=" << HEX8(inOffsetBytes) << ", len=" << HEX8(inByteCount) << ", " << (inIsRead ? "R" : "W"));
879  return false;
880 }
881 
882 
883 //--------------------------------------------------------------------------------------------------------------------
884 // DmaTransfer
885 //
886 // Start a memory transfer using the specified DMA engine.
887 // Optional - call PrepareDMAMemory on the dataPtr before the first use of memory block
888 // for DMA and CompleteDMAMemory when done. This will speed up the DMA by not requiring
889 // memory to be prepared for each DMA. Otherwise, it takes about 2 to 5 ms (sometimes
890 // much more) for the memory block to be prepared.
891 // This function will sleep (block) until the DMA finishes.
892 //--------------------------------------------------------------------------------------------------------------------
894  const bool inIsRead,
895  const ULWord inFrameNumber,
896  ULWord * pFrameBuffer,
897  const ULWord inCardOffsetBytes,
898  const ULWord inByteCount,
899  const ULWord inNumSegments,
900  const ULWord inSegmentHostPitch,
901  const ULWord inSegmentCardPitch,
902  const bool inSynchronous)
903 {
904  if (IsRemote())
905  return CNTV2DriverInterface::DmaTransfer (inDMAEngine, inIsRead, inFrameNumber, pFrameBuffer, inCardOffsetBytes, inByteCount,
906  inNumSegments, inSegmentHostPitch, inSegmentCardPitch, inSynchronous);
907  if (!IsOpen())
908  return false;
909  kern_return_t kernResult = KERN_FAILURE;
910  size_t outputStructSize = 0;
911  const ULWord numSegments = inNumSegments ? inNumSegments : 1; // Prevent divide-by-zero exception: zero segment count == single segment
912 
913  DMA_TRANSFER_STRUCT_64 dmaTransfer64;
914  dmaTransfer64.dmaEngine = inDMAEngine;
915  dmaTransfer64.dmaFlags = 0;
916  dmaTransfer64.dmaHostBuffer = Pointer64(pFrameBuffer); // virtual address of host buffer
917  dmaTransfer64.dmaSize = inByteCount; // total number of bytes to DMA
918  dmaTransfer64.dmaCardFrameNumber = inFrameNumber; // card frame number
919  dmaTransfer64.dmaCardFrameOffset = inCardOffsetBytes; // offset (in bytes) into card frame to begin DMA
920  dmaTransfer64.dmaNumberOfSegments = numSegments; // number of segments of size videoBufferSize to DMA
921  dmaTransfer64.dmaSegmentSize = (inByteCount / numSegments); // size of each segment (if videoNumSegments > 1)
922  dmaTransfer64.dmaSegmentHostPitch = inSegmentHostPitch; // offset between the beginning of one host-memory segment and the next host-memory segment
923  dmaTransfer64.dmaSegmentCardPitch = inSegmentCardPitch; // offset between the beginning of one Kona-memory segment and the next Kona-memory segment
924  dmaTransfer64.dmaToCard = !inIsRead; // direction of DMA transfer
925 
926  if (GetIOConnect())
927  {
929  kernResult = OS_IOConnectCallStructMethod (GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
930  kDriverDMATransferEx, // selector of the function to be called via the user client.
931  &dmaTransfer64, // pointer to the input structure
932  sizeof(DMA_TRANSFER_STRUCT_64), // size of input structure
933  AJA_NULL, // pointer to the output structure
934  &outputStructSize); // size of output structure
936  }
937  if (kernResult == KERN_SUCCESS)
938  return true;
939  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
940  return false;
941 }
942 
943 
945  const NTV2Channel inDMAChannel,
946  const bool inIsTarget,
947  const ULWord inFrameNumber,
948  const ULWord inCardOffsetBytes,
949  const ULWord inByteCount,
950  const ULWord inNumSegments,
951  const ULWord inSegmentHostPitch,
952  const ULWord inSegmentCardPitch,
953  const PCHANNEL_P2P_STRUCT & inP2PData)
954 {
955  if (IsRemote())
956  return CNTV2DriverInterface::DmaTransfer (inDMAEngine, inDMAChannel, inIsTarget, inFrameNumber, inCardOffsetBytes, inByteCount,
957  inNumSegments, inSegmentHostPitch, inSegmentCardPitch, inP2PData);
958  return false;
959 }
960 
961 #if 0
962 //--------------------------------------------------------------------------------------------------------------------
963 // RestoreHardwareProcampRegisters
964 //--------------------------------------------------------------------------------------------------------------------
965 bool CNTV2MacDriverInterface::RestoreHardwareProcampRegisters (void)
966 {
967  kern_return_t kernResult = KERN_FAILURE;
968  uint32_t outputCount = 0;
969  if (GetIOConnect())
970  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
971  kDriverRestoreProcAmpRegisters, // selector of the function to be called via the user client.
972  AJA_NULL, // array of scalar (64-bit) input values.
973  0, // the number of scalar input values.
974  AJA_NULL, // array of scalar (64-bit) output values.
975  &outputCount); // pointer to the number of scalar output values.
976  if (kernResult == KERN_SUCCESS)
977  return true;
978  DIFAIL (KR(kernResult) << ": con=" << HEX8(GetIOConnect()));
979  return false;
980 }
981 
982 #endif
983 
984 #if 0
985 //--------------------------------------------------------------------------------------------------------------------
986 // SystemStatus
987 //--------------------------------------------------------------------------------------------------------------------
988 bool CNTV2MacDriverInterface::SystemStatus ( void* dataPtr, SystemStatusCode statusCode)
989 {
990  kern_return_t kernResult = KERN_FAILURE;
991  uint64_t scalarI_64[2] = {uint64_t(dataPtr), statusCode};
992  uint32_t outputCount = 0;
993  if (GetIOConnect())
994  kernResult = OS_IOConnectCallScalarMethod ( GetIOConnect(), // an io_connect_t returned from IOServiceOpen().
995  kDriverSystemStatus, // selector of the function to be called via the user client.
996  scalarI_64, // array of scalar (64-bit) input values.
997  2, // the number of scalar input values.
998  AJA_NULL, // array of scalar (64-bit) output values.
999  &outputCount); // pointer to the number of scalar output values.
1000  if (statusCode != SSC_GetFirmwareProgress)
1001  return false;
1002  if (kernResult == KERN_SUCCESS)
1003  return true;
1004  MDIFAIL (KR(kernResult) << INSTP(this) << ", con=" << HEX8(GetIOConnect()));
1005  return false;
1006 }
1007 #endif
1008 
1009 
1010 //--------------------------------------------------------------------------------------------------------------------
1011 // AutoCirculate
1012 //--------------------------------------------------------------------------------------------------------------------
1014 {
1015  bool success = true;
1016  if (IsRemote())
1017  return CNTV2DriverInterface::AutoCirculate(autoCircData);
1018 
1019  kern_return_t kernResult = KERN_FAILURE;
1020  io_connect_t conn(GetIOConnect());
1021  if (!conn)
1022  return false;
1023 
1024  switch (autoCircData.eCommand)
1025  {
1026  case eInitAutoCirc:
1027  case eStartAutoCirc:
1028  case eStopAutoCirc:
1029  case eAbortAutoCirc:
1030  case ePauseAutoCirc:
1031  case eFlushAutoCirculate:
1032  case ePrerollAutoCirculate:
1033  case eSetActiveFrame:
1034  case eStartAutoCircAtTime:
1035  {
1036  // Pass the autoCircData structure to the driver. The driver knows the implicit meanings of the
1037  // members of the structure based on the the command contained within it.
1038  size_t outputStructSize = 0;
1039  AUTOCIRCULATE_DATA_64 autoCircData64;
1040  CopyTo_AUTOCIRCULATE_DATA_64 (&autoCircData, &autoCircData64);
1041 
1043  kernResult = OS_IOConnectCallStructMethod ( conn, // an io_connect_t returned from IOServiceOpen().
1044  kDriverAutoCirculateControl, // selector of the function to be called via the user client.
1045  &autoCircData64, // pointer to the input structure
1046  sizeof(AUTOCIRCULATE_DATA_64), // size of input structure
1047  AJA_NULL, // pointer to the output structure
1048  &outputStructSize); // size of output structure
1050  break;
1051  } // eInit, eStart, eStop, eAbort, etc...
1052 #if 0
1053  case eGetAutoCirc:
1054  {
1055  uint64_t scalarI_64[1];
1056  uint32_t outputCount = 0;
1057  size_t outputStructSize = sizeof(AUTOCIRCULATE_STATUS_STRUCT);
1058  scalarI_64[0] = autoCircData.channelSpec;
1060  kernResult = OS_IOConnectCallMethod ( conn, // an io_connect_t returned from IOServiceOpen().
1061  kDriverAutoCirculateStatus, // selector of the function to be called via the user client.
1062  scalarI_64, // array of scalar (64-bit) input values.
1063  1, // the number of scalar input values.
1064  AJA_NULL, // pointer to the input structure
1065  0, // size of input structure
1066  AJA_NULL, // array of scalar (64-bit) output values.
1067  &outputCount, // the number of scalar output values.
1068  autoCircData.pvVal1, // pointer to the output structure
1069  &outputStructSize); // size of output structure
1071  break;
1072  } // eGetAutoCirc
1073 
1074  case eGetFrameStamp:
1075  case eGetFrameStampEx2:
1076  {
1077  // Make sure task structure does not get passed in with eGetFrameStamp call.
1078  if ( autoCircData.eCommand == eGetFrameStamp)
1079  autoCircData.pvVal2 = AJA_NULL;
1080 
1081  size_t outputStructSize = sizeof(AUTOCIRCULATE_DATA_64);
1082 
1083  // promote base data structure
1084  AUTOCIRCULATE_DATA_64 autoCircData64;
1085  CopyTo_AUTOCIRCULATE_DATA_64 (&autoCircData, &autoCircData64);
1086 
1088  kernResult = OS_IOConnectCallStructMethod ( conn, // an io_connect_t returned from IOServiceOpen().
1089  kDriverAutoCirculateFramestamp, // selector of the function to be called via the user client.
1090  &autoCircData64, // pointer to the input structure
1091  sizeof(AUTOCIRCULATE_DATA_64), // size of input structure
1092  &autoCircData64, // pointer to the output structure
1093  &outputStructSize); // size of output structure
1095  break;
1096  } // eGetFrameStamp, eGetFrameStampEx2
1097 
1101  {
1102  // Pass the autoCircData structure to the driver. The driver knows the implicit meanings of the
1103  // members of the structure based on the the command contained within it.
1104  // Make sure routing table and task structure does not get passed in with eTransferAutoCirculate call.
1105  if (autoCircData.eCommand == eTransferAutoCirculate)
1106  {
1107  autoCircData.pvVal3 = AJA_NULL;
1108  autoCircData.pvVal4 = AJA_NULL;
1109  }
1110 
1111  // Make sure task structure does not get passed in with eTransferAutoCirculateEx call.
1112  if (autoCircData.eCommand == eTransferAutoCirculateEx)
1113  autoCircData.pvVal4 = AJA_NULL;
1114 
1115  size_t outputStructSize = sizeof(AUTOCIRCULATE_TRANSFER_STATUS_STRUCT);
1116 
1117  // promote base data structure
1118  AUTOCIRCULATE_DATA_64 autoCircData64;
1119  CopyTo_AUTOCIRCULATE_DATA_64 (&autoCircData, &autoCircData64);
1120 
1121  // promote AUTOCIRCULATE_TRANSFER_STRUCT
1122  AUTOCIRCULATE_TRANSFER_STRUCT_64 autoCircTransfer64;
1123  CopyTo_AUTOCIRCULATE_TRANSFER_STRUCT_64 (reinterpret_cast<AUTOCIRCULATE_TRANSFER_STRUCT*>(autoCircData.pvVal1), &autoCircTransfer64);
1124  autoCircData64.pvVal1 = Pointer64(&autoCircTransfer64);
1125 
1126  AUTOCIRCULATE_TASK_STRUCT_64 autoCircTask64;
1127  if (autoCircData.pvVal4 != AJA_NULL)
1128  {
1129  CopyTo_AUTOCIRCULATE_TASK_STRUCT_64 (reinterpret_cast<AUTOCIRCULATE_TASK_STRUCT*>(autoCircData.pvVal4), &autoCircTask64);
1130  autoCircData64.pvVal4 = Pointer64(&autoCircTask64);
1131  }
1132 
1134  kernResult = OS_IOConnectCallStructMethod ( conn, // an io_connect_t returned from IOServiceOpen().
1135  kDriverAutoCirculateTransfer, // selector of the function to be called via the user client.
1136  &autoCircData64, // pointer to the input structure
1137  sizeof(AUTOCIRCULATE_DATA_64), // size of input structure
1138  autoCircData.pvVal2, // pointer to the output structure
1139  &outputStructSize); // size of output structure
1141  break;
1142  } // eTransferAutoCirculate, eTransferAutoCirculateEx, eTransferAutoCirculateEx2
1143 #endif
1144 
1145  default:
1146  //DisplayNTV2Error("Unsupported AC command type in AutoCirculate()\n");
1147  kernResult = KERN_INVALID_ARGUMENT;
1148  break;
1149  } // switch
1150 
1151  success = (kernResult == KERN_SUCCESS);
1152  if (kernResult != KERN_SUCCESS && kernResult != kIOReturnOffline)
1153  MDIFAIL (KR(kernResult) << INSTP(this) << ", con=" << HEX8(conn) << ", eCmd=" << autoCircData.eCommand);
1154  return success;
1155 } // AutoCirculate
1156 
1157 
1159 {
1160  if (!pInOutMessage)
1161  return false;
1162  if (!pInOutMessage->IsValid())
1163  return false;
1164  if (!pInOutMessage->GetSizeInBytes())
1165  return false;
1166  if (IsRemote())
1167  return CNTV2DriverInterface::NTV2Message (pInOutMessage);
1168 
1169  // 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:
1170  ULWord* pU32 = reinterpret_cast<ULWord*>(pInOutMessage); pU32[6] = 0;
1171 
1172  kern_return_t kernResult (KERN_FAILURE);
1173  io_connect_t connection (GetIOConnect ());
1174  uint64_t scalarI_64 [2] = {uint64_t(pInOutMessage), pInOutMessage->GetSizeInBytes()};
1175  uint32_t numScalarOutputs(0);
1176  if (connection)
1177  {
1179  kernResult = OS_IOConnectCallScalarMethod ( connection, // an io_connect_t returned from IOServiceOpen
1180  kDriverNTV2Message, // selector of the function to be called via the user client
1181  scalarI_64, // array of scalar (64-bit) input values
1182  2, // the number of scalar input values
1183  AJA_NULL, // array of scalar (64-bit) output values
1184  &numScalarOutputs); // pointer (in: number of scalar output values capable of receiving; out: actual number of scalar output values)
1186  }
1187  if (kernResult != KERN_SUCCESS && kernResult != kIOReturnOffline)
1188  MDIFAIL (KR(kernResult) << INSTP(this) << ", con=" << HEX8(connection) << endl << *pInOutMessage);
1189  return kernResult == KERN_SUCCESS;
1190 
1191 } // NTV2Message
1192 
1193 
1194 
1195 #pragma mark Old Driver Calls
1196 
1198 {
1199  return WriteRegister(kVRegGlobalAudioPlaybackMode,mode);
1200 }
1201 
1203 {
1205 }
1206 
1207 
1208 //-------------------------------------------------------------------------------------------------------
1209 // CopyTo_AUTOCIRCULATE_DATA_64
1210 //-------------------------------------------------------------------------------------------------------
1211 void CNTV2MacDriverInterface::CopyTo_AUTOCIRCULATE_DATA_64 (AUTOCIRCULATE_DATA *p, AUTOCIRCULATE_DATA_64 *p64)
1212 {
1213  // note that p is native structure, either 64 or 32 bit
1214  p64->eCommand = p->eCommand;
1215  p64->channelSpec = p->channelSpec;
1216 
1217  p64->lVal1 = p->lVal1;
1218  p64->lVal2 = p->lVal2;
1219  p64->lVal3 = p->lVal3;
1220  p64->lVal4 = p->lVal4;
1221  p64->lVal5 = p->lVal5;
1222  p64->lVal6 = p->lVal6;
1223 
1224  p64->bVal1 = p->bVal1;
1225  p64->bVal2 = p->bVal2;
1226  p64->bVal3 = p->bVal3;
1227  p64->bVal4 = p->bVal4;
1228  p64->bVal5 = p->bVal5;
1229  p64->bVal6 = p->bVal6;
1230  p64->bVal7 = p->bVal7;
1231  p64->bVal8 = p->bVal8;
1232 
1233  p64->pvVal1 = Pointer64(p->pvVal1); // native to 64 bit
1234  p64->pvVal2 = Pointer64(p->pvVal2); // native to 64 bit
1235  p64->pvVal3 = Pointer64(p->pvVal3); // native to 64 bit
1236  p64->pvVal4 = Pointer64(p->pvVal4); // native to 64 bit
1237 }
1238 
1239 
1240 //-------------------------------------------------------------------------------------------------------
1241 // CopyTo_AUTOCIRCULATE_DATA
1242 //-------------------------------------------------------------------------------------------------------
1243 void CNTV2MacDriverInterface::CopyTo_AUTOCIRCULATE_DATA (AUTOCIRCULATE_DATA_64 *p64, AUTOCIRCULATE_DATA *p)
1244 {
1245  // note that p is native structure, either 64 or 32 bit
1246  p->eCommand = p64->eCommand;
1247  p->channelSpec = p64->channelSpec;
1248 
1249  p->lVal1 = p64->lVal1;
1250  p->lVal2 = p64->lVal2;
1251  p->lVal3 = p64->lVal3;
1252  p->lVal4 = p64->lVal4;
1253  p->lVal5 = p64->lVal5;
1254  p->lVal6 = p64->lVal6;
1255 
1256  p->bVal1 = p64->bVal1;
1257  p->bVal2 = p64->bVal2;
1258  p->bVal3 = p64->bVal3;
1259  p->bVal4 = p64->bVal4;
1260  p->bVal5 = p64->bVal5;
1261  p->bVal6 = p64->bVal6;
1262  p->bVal7 = p64->bVal7;
1263  p->bVal8 = p64->bVal8;
1264 
1265  p->pvVal1 = reinterpret_cast<void*>(p64->pvVal1); // 64 bit to native
1266  p->pvVal2 = reinterpret_cast<void*>(p64->pvVal2); // 64 bit to native
1267  p->pvVal3 = reinterpret_cast<void*>(p64->pvVal3); // 64 bit to native
1268  p->pvVal4 = reinterpret_cast<void*>(p64->pvVal4); // 64 bit to native
1269 }
1270 
1271 
1272 //-------------------------------------------------------------------------------------------------------
1273 // CopyTo_AUTOCIRCULATE_TRANSFER_STRUCT_64
1274 //-------------------------------------------------------------------------------------------------------
1275 void CNTV2MacDriverInterface::CopyTo_AUTOCIRCULATE_TRANSFER_STRUCT_64 (AUTOCIRCULATE_TRANSFER_STRUCT *p, AUTOCIRCULATE_TRANSFER_STRUCT_64 *p64)
1276 {
1277  // note that p is native structure, either 64 or 32 bit
1278  p64->channelSpec = p->channelSpec;
1279  p64->videoBuffer = Pointer64(p->videoBuffer); // native to 64 bit
1280  p64->videoBufferSize = p->videoBufferSize;
1281  p64->videoDmaOffset = p->videoDmaOffset;
1282  p64->audioBuffer = Pointer64(p->audioBuffer); // native to 64 bit
1283  p64->audioBufferSize = p->audioBufferSize;
1287 
1288  p64->rp188.DBB = p->rp188.DBB;
1289  p64->rp188.Low = p->rp188.Low;
1290  p64->rp188.High = p->rp188.High;
1291 
1292  p64->desiredFrame = p->desiredFrame;
1293  p64->hUser = p->hUser;
1294  p64->transferFlags = p->transferFlags;
1298 
1302 
1303  p64->vidProcInfo.mode = p->vidProcInfo.mode;
1310 
1315 
1319 
1321 
1322 #if 0
1323  printf("----------------------\n");
1324  printf("sizeof = %d\n", (int)sizeof(AUTOCIRCULATE_TRANSFER_STRUCT_64));
1325 
1326  uint8_t * ptr = (uint8_t *)p64;
1327  for (int i = 0; i < (int)sizeof(AUTOCIRCULATE_TRANSFER_STRUCT_64); i++)
1328  {
1329  if ((i % 4) == 0)
1330  printf("\n");
1331  printf("%x ", *ptr++);
1332  }
1333  printf("\n\n", *ptr++);
1334 
1335 #endif
1336 
1337  #if 0
1338  printf("----------------------\n");
1339  printf("sizeof = %d\n", (int)sizeof(AUTOCIRCULATE_TRANSFER_STRUCT_64));
1340 
1341  // note that p is native structure, either 64 or 32 bit
1342  printf("channelSpec %x\n", p64->channelSpec);
1343  printf("videoBuffer %lx\n",p64->videoBuffer);
1344  printf("videoBufferSize %x\n",p64->videoBufferSize);
1345  printf("videoDmaOffset %x\n",p64->videoDmaOffset);
1346  printf("audioBuffer %lx\n",p64->audioBuffer);
1347  printf("audioBufferSize %x\n",p64->audioBufferSize);
1348  printf("audioStartSample %x\n",p64->audioStartSample);
1349  printf("audioNumChannels %x\n",p64->audioNumChannels);
1350  printf("frameRepeatCount %x\n",p64->frameRepeatCount);
1351 
1352  printf("rp188.DBB %x\n",p64->rp188.DBB);
1353  printf("rp188.Low %x\n",p64->rp188.Low);
1354  printf("rp188.High %x\n",p64->rp188.High);
1355 
1356  printf("desiredFrame %x\n",p64->desiredFrame);
1357  printf("hUser %x\n",p64->hUser);
1358  printf("transferFlags %x\n",p64->transferFlags);
1359  printf("bDisableExtraAudioInfo %x\n",p64->bDisableExtraAudioInfo);
1360  printf("frameBufferFormat %x\n",p64->frameBufferFormat);
1361  printf("frameBufferOrientation %x\n",p64->frameBufferOrientation);
1362 
1363  printf("colorCorrectionInfo.mode %x\n",p64->colorCorrectionInfo.mode);
1364  printf("colorCorrectionInfo.saturationValue %x\n",p64->colorCorrectionInfo.saturationValue);
1365  printf("colorCorrectionInfo.ccLookupTables %x\n",p64->colorCorrectionInfo.ccLookupTables);
1366 
1367  printf("vidProcInfo.mode %x\n",p64->vidProcInfo.mode);
1368  printf("vidProcInfo.foregroundVideoCrosspoint %x\n",p64->vidProcInfo.foregroundVideoCrosspoint);
1369  printf("vidProcInfo.backgroundVideoCrosspoint %x\n",p64->vidProcInfo.backgroundVideoCrosspoint);
1370  printf("vidProcInfo.foregroundKeyCrosspoint %x\n",p64->vidProcInfo.foregroundKeyCrosspoint);
1371  printf("vidProcInfo.backgroundKeyCrosspoint %x\n",p64->vidProcInfo.backgroundKeyCrosspoint);
1372  printf("vidProcInfo.transitionCoefficient %x\n",p64->vidProcInfo.transitionCoefficient);
1373  printf("vidProcInfo.transitionSoftness %x\n",p64->vidProcInfo.transitionSoftness);
1374 
1375  printf("customAncInfo.Group1 %x\n",p64->customAncInfo.Group1);
1376  printf("customAncInfo.Group2 %x\n",p64->customAncInfo.Group2);
1377  printf("customAncInfo.Group3 %x\n",p64->customAncInfo.Group3);
1378  printf("customAncInfo.Group4 %x\n",p64->customAncInfo.Group4);
1379 
1380  printf("videoNumSegments %x\n",p64->videoNumSegments);
1381  printf("videoSegmentHostPitch %x\n",p64->videoSegmentHostPitch);
1382  printf("videoSegmentCardPitch %x\n",p64->videoSegmentCardPitch);
1383 
1384  printf("videoQuarterSizeExpand %x\n",p64->videoQuarterSizeExpand);
1385  #endif
1386 }
1387 
1388 
1389 //-------------------------------------------------------------------------------------------------------
1390 // CopyTo_AUTOCIRCULATE_TRANSFER_STRUCT
1391 //-------------------------------------------------------------------------------------------------------
1392 void CNTV2MacDriverInterface::CopyTo_AUTOCIRCULATE_TRANSFER_STRUCT (AUTOCIRCULATE_TRANSFER_STRUCT_64 *p64, AUTOCIRCULATE_TRANSFER_STRUCT *p)
1393 {
1394  // note that p is native structure, either 64 or 32 bit
1395  p->channelSpec = p64->channelSpec;
1396  p->videoBuffer = reinterpret_cast<ULWord*>(p64->videoBuffer); // 64 bit to native
1397  p->videoBufferSize = p64->videoBufferSize;
1398  p->videoDmaOffset = p64->videoDmaOffset;
1399  p->audioBuffer = reinterpret_cast<ULWord*>(p64->audioBuffer); // 64 bit to native
1400  p->audioBufferSize = p64->audioBufferSize;
1404 
1405  p->rp188.DBB = p64->rp188.DBB;
1406  p->rp188.Low = p64->rp188.Low;
1407  p->rp188.High = p64->rp188.High;
1408 
1409  p->desiredFrame = p64->desiredFrame;
1410  p->hUser = p64->hUser;
1411  p->transferFlags = p64->transferFlags;
1415 
1419 
1420  p->vidProcInfo.mode = p64->vidProcInfo.mode;
1427 
1432 
1436 
1438 }
1439 
1440 
1441 //-------------------------------------------------------------------------------------------------------
1442 // CopyTo_AUTOCIRCULATE_TASK_STRUCT_64
1443 //-------------------------------------------------------------------------------------------------------
1444 void CNTV2MacDriverInterface::CopyTo_AUTOCIRCULATE_TASK_STRUCT_64 (AUTOCIRCULATE_TASK_STRUCT *p, AUTOCIRCULATE_TASK_STRUCT_64 *p64)
1445 {
1446  p64->taskVersion = p->taskVersion;
1447  p64->taskSize = p->taskSize;
1448  p64->numTasks = p->numTasks;
1449  p64->maxTasks = p->maxTasks;
1450  p64->taskArray = Pointer64(p->taskArray);
1451  p64->reserved0 = p->reserved0;
1452  p64->reserved1 = p->reserved1;
1453  p64->reserved2 = p->reserved2;
1454  p64->reserved3 = p->reserved3;
1455 }
1456 
1457 
1458 static const char * GetKernErrStr (const kern_return_t inError)
1459 {
1460  switch (inError)
1461  {
1462  case kIOReturnError: return "general error";
1463  case kIOReturnNoMemory: return "can't allocate memory";
1464  case kIOReturnNoResources: return "resource shortage";
1465  case kIOReturnIPCError: return "error during IPC";
1466  case kIOReturnNoDevice: return "no such device";
1467  case kIOReturnNotPrivileged: return "privilege violation";
1468  case kIOReturnBadArgument: return "invalid argument";
1469  case kIOReturnLockedRead: return "device read locked";
1470  case kIOReturnLockedWrite: return "device write locked";
1471  case kIOReturnExclusiveAccess: return "exclusive access and device already open";
1472  case kIOReturnBadMessageID: return "sent/received messages had different msg_id";
1473  case kIOReturnUnsupported: return "unsupported function";
1474  case kIOReturnVMError: return "misc. VM failure";
1475  case kIOReturnInternalError: return "internal error";
1476  case kIOReturnIOError: return "General I/O error";
1477  case kIOReturnCannotLock: return "can't acquire lock";
1478  case kIOReturnNotOpen: return "device not open";
1479  case kIOReturnNotReadable: return "read not supported";
1480  case kIOReturnNotWritable: return "write not supported";
1481  case kIOReturnNotAligned: return "alignment error";
1482  case kIOReturnBadMedia: return "Media Error";
1483  case kIOReturnStillOpen: return "device(s) still open";
1484  case kIOReturnRLDError: return "rld failure";
1485  case kIOReturnDMAError: return "DMA failure";
1486  case kIOReturnBusy: return "Device Busy";
1487  case kIOReturnTimeout: return "I/O Timeout";
1488  case kIOReturnOffline: return "device offline";
1489  case kIOReturnNotReady: return "not ready";
1490  case kIOReturnNotAttached: return "device not attached";
1491  case kIOReturnNoChannels: return "no DMA channels left";
1492  case kIOReturnNoSpace: return "no space for data";
1493  case kIOReturnPortExists: return "port already exists";
1494  case kIOReturnCannotWire: return "can't wire down physical memory";
1495  case kIOReturnNoInterrupt: return "no interrupt attached";
1496  case kIOReturnNoFrames: return "no DMA frames enqueued";
1497  case kIOReturnMessageTooLarge: return "oversized msg received on interrupt port";
1498  case kIOReturnNotPermitted: return "not permitted";
1499  case kIOReturnNoPower: return "no power to device";
1500  case kIOReturnNoMedia: return "media not present";
1501  case kIOReturnUnformattedMedia: return "media not formatted";
1502  case kIOReturnUnsupportedMode: return "no such mode";
1503  case kIOReturnUnderrun: return "data underrun";
1504  case kIOReturnOverrun: return "data overrun";
1505  case kIOReturnDeviceError: return "the device is not working properly!";
1506  case kIOReturnNoCompletion: return "a completion routine is required";
1507  case kIOReturnAborted: return "operation aborted";
1508  case kIOReturnNoBandwidth: return "bus bandwidth would be exceeded";
1509  case kIOReturnNotResponding: return "device not responding";
1510  case kIOReturnIsoTooOld: return "isochronous I/O request for distant past!";
1511  case kIOReturnIsoTooNew: return "isochronous I/O request for distant future";
1512  case kIOReturnNotFound: return "data was not found";
1513  case MACH_SEND_INVALID_DEST: return "MACH_SEND_INVALID_DEST";
1514  case kNTV2DriverBadDMA: return "bad dma engine num";
1515  case kNTV2DriverDMABusy: return "dma engine busy, or none available";
1516  case kNTV2DriverParamErr: return "bad aja parameter (out of range)";
1517  case kNTV2DriverPgmXilinxErr: return "xilinx programming error";
1518  case kNTV2DriverNotReadyErr: return "xilinx not yet programmed";
1519  case kNTV2DriverPrepMemErr: return "error preparing memory (no room?)";
1520  case kNTV2DriverDMATooLarge: return "dma xfer too large, or out of range";
1521  case kNTV2DriverBadHeaderTag: return "bad NTV2 header";
1522  case kNTV2UnknownStructType: return "unknown NTV2 struct type";
1523  case kNTV2HeaderVersionErr: return "bad or unsupported NTV2 header version";
1524  case kNTV2DriverBadTrailerTag: return "bad NTV2 trailer";
1525  case kNTV2DriverMapperErr: return "failure while mapping NTV2 struct ptrs";
1526  case kNTV2DriverUnmapperErr: return "failure while unmapping NTV2 struct ptrs";
1527  default: return "";
1528  }
1529 } // GetKernErrStr
kNTV2DriverNotReadyErr
const IOReturn kNTV2DriverNotReadyErr
Definition: ntv2macpublicinterface.h:21
CNTV2MacDriverInterface::MapRegisters
virtual bool MapRegisters(void)
Definition: ntv2macdriverinterface.cpp:316
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:4746
AJA_DebugStat_DMATransferEx
@ AJA_DebugStat_DMATransferEx
Definition: debugshare.h:242
AUTOCIRCULATE_TRANSFER_STRUCT_64::videoNumSegments
ULWord videoNumSegments
Definition: ntv2publicinterface.h:4745
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:1180
AUTOCIRCULATE_DATA_64::pvVal4
Pointer64 pvVal4
Definition: ntv2publicinterface.h:4542
AUTOCIRCULATE_DATA_64::lVal1
LWord lVal1
Definition: ntv2publicinterface.h:4523
kDriverSystemControl
@ kDriverSystemControl
Definition: ntv2macpublicinterface.h:65
AUTOCIRCULATE_TRANSFER_STRUCT::transferFlags
ULWord transferFlags
Definition: ntv2publicinterface.h:4766
MDIWARN
#define MDIWARN(__x__)
Definition: ntv2macdriverinterface.cpp:57
AUTOCIRCULATE_TRANSFER_STRUCT::videoSegmentHostPitch
ULWord videoSegmentHostPitch
Definition: ntv2publicinterface.h:4783
kDriverDMATransfer
@ kDriverDMATransfer
Definition: ntv2macpublicinterface.h:53
AUTOCIRCULATE_TRANSFER_STRUCT::audioStartSample
ULWord audioStartSample
Definition: ntv2publicinterface.h:4760
RP188_STRUCT::High
ULWord High
Definition: ntv2publicinterface.h:4213
AJADebug::StatTimerStop
static AJAStatus StatTimerStop(const uint32_t inKey)
Definition: debug.cpp:1155
AUTOCIRCULATE_DATA::channelSpec
NTV2Crosspoint channelSpec
Definition: ntv2publicinterface.h:4550
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:171
INTERRUPT_ENUMS
enum _INTERRUPT_ENUMS_ INTERRUPT_ENUMS
NTV2_FOURCC
#define NTV2_FOURCC(_a_, _b_, _c_, _d_)
Definition: ntv2publicinterface.h:5623
AUTOCIRCULATE_DATA_64::eCommand
AUTO_CIRC_COMMAND eCommand
Definition: ntv2publicinterface.h:4520
kDriverWaitForInterrupt
@ kDriverWaitForInterrupt
Definition: ntv2macpublicinterface.h:49
CNTV2MacDriverInterface::GetAudioOutputMode
virtual bool GetAudioOutputMode(NTV2_GlobalAudioPlaybackMode *mode)
Definition: ntv2macdriverinterface.cpp:1202
AUTOCIRCULATE_DATA::bVal2
BOOL_ bVal2
Definition: ntv2publicinterface.h:4560
CNTV2MacDriverInterface::KernelLog
virtual bool KernelLog(void *dataPtr, UInt32 dataSize)
Definition: ntv2macdriverinterface.cpp:705
GetKernErrStr
static const char * GetKernErrStr(const kern_return_t inError)
Definition: ntv2macdriverinterface.cpp:1458
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:405
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:1133
AUTOCIRCULATE_TRANSFER_STRUCT_64::frameRepeatCount
ULWord frameRepeatCount
Definition: ntv2publicinterface.h:4725
kDriverAutoCirculateTransfer
@ kDriverAutoCirculateTransfer
Definition: ntv2macpublicinterface.h:61
AUTOCIRCULATE_TRANSFER_STRUCT::videoBuffer
ULWord * videoBuffer
Definition: ntv2publicinterface.h:4755
NTV2Channel
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
Definition: ntv2enums.h:1353
AJA_DebugStat_ReadRegister
@ AJA_DebugStat_ReadRegister
Definition: debugshare.h:224
AUTOCIRCULATE_TRANSFER_STRUCT::videoQuarterSizeExpand
NTV2QuarterSizeExpandMode videoQuarterSizeExpand
Definition: ntv2publicinterface.h:4785
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:529
DMA_TRANSFER_STRUCT_64::dmaFlags
ULWord dmaFlags
Definition: ntv2publicinterface.h:5004
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:4527
CNTV2DriverInterface::WaitForInterrupt
virtual bool WaitForInterrupt(const INTERRUPT_ENUMS eInterrupt, const ULWord timeOutMs=68)
Definition: ntv2driverinterface.cpp:581
kNTV2DriverParamErr
const IOReturn kNTV2DriverParamErr
Definition: ntv2macpublicinterface.h:19
AUTOCIRCULATE_TRANSFER_STRUCT::frameBufferOrientation
NTV2VideoFrameBufferOrientation frameBufferOrientation
Definition: ntv2publicinterface.h:4769
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:4720
AUTOCIRCULATE_TASK_STRUCT_64::reserved3
ULWord reserved3
Definition: ntv2publicinterface.h:4931
ntv2macdriverinterface.h
Implements the MacOS-specific flavor of CNTV2DriverInterface.
AUTOCIRCULATE_TASK_STRUCT::reserved3
ULWord reserved3
Definition: ntv2publicinterface.h:4944
eStartAutoCircAtTime
@ eStartAutoCircAtTime
Definition: ntv2publicinterface.h:4428
AUTOCIRCULATE_DATA_64::pvVal2
Pointer64 pvVal2
Definition: ntv2publicinterface.h:4540
AUTOCIRCULATE_DATA::bVal3
BOOL_ bVal3
Definition: ntv2publicinterface.h:4561
AUTOCIRCULATE_TASK_STRUCT::taskVersion
ULWord taskVersion
Definition: ntv2publicinterface.h:4936
NTV2ColorCorrectionInfo_64::ccLookupTables
Pointer64 ccLookupTables
only used in 3way color correction mode.
Definition: ntv2publicinterface.h:4274
CNTV2MacDriverInterface::AutoCirculate
virtual bool AutoCirculate(AUTOCIRCULATE_DATA &autoCircData)
Sends an AutoCirculate command to the NTV2 driver.
Definition: ntv2macdriverinterface.cpp:1013
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:540
AUTOCIRCULATE_TRANSFER_STRUCT::bDisableExtraAudioInfo
BOOL_ bDisableExtraAudioInfo
Definition: ntv2publicinterface.h:4767
AUTOCIRCULATE_TRANSFER_STRUCT::audioBufferSize
ULWord audioBufferSize
Definition: ntv2publicinterface.h:4759
AUTOCIRCULATE_TRANSFER_STRUCT_64::colorCorrectionInfo
NTV2ColorCorrectionInfo_64 colorCorrectionInfo
Definition: ntv2publicinterface.h:4733
AUTOCIRCULATE_TRANSFER_STRUCT::frameRepeatCount
ULWord frameRepeatCount
Definition: ntv2publicinterface.h:4762
AUTOCIRCULATE_TASK_STRUCT_64::taskArray
Pointer64 taskArray
Definition: ntv2publicinterface.h:4927
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:4937
kDriverSystemStatus
@ kDriverSystemStatus
Definition: ntv2macpublicinterface.h:66
CUSTOM_ANC_STRUCT::Group3
ULWord Group3
Definition: ntv2publicinterface.h:4405
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:1170
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:750
AUTOCIRCULATE_TRANSFER_STRUCT_64::videoBuffer
Pointer64 videoBuffer
Definition: ntv2publicinterface.h:4718
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:502
AUTOCIRCULATE_TRANSFER_STRUCT::rp188
RP188_STRUCT rp188
Definition: ntv2publicinterface.h:4763
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:788
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:4425
NTV2_HEADER::IsValid
bool IsValid(void) const
Definition: ntv2publicinterface.h:7236
AUTOCIRCULATE_DATA::bVal6
BOOL_ bVal6
Definition: ntv2publicinterface.h:4564
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:3878
AUTOCIRCULATE_TRANSFER_STRUCT::colorCorrectionInfo
NTV2ColorCorrectionInfo colorCorrectionInfo
Definition: ntv2publicinterface.h:4770
AUTOCIRCULATE_STATUS_STRUCT
struct AUTOCIRCULATE_STATUS_STRUCT AUTOCIRCULATE_STATUS_STRUCT
kDriverReadRegister
@ kDriverReadRegister
Definition: ntv2macpublicinterface.h:38
AUTOCIRCULATE_DATA::pvVal4
void * pvVal4
Definition: ntv2publicinterface.h:4571
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:4570
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:1071
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:438
kDriverReleaseStreamForApplication
@ kDriverReleaseStreamForApplication
Definition: ntv2macpublicinterface.h:43
AUTOCIRCULATE_DATA::lVal5
LWord lVal5
Definition: ntv2publicinterface.h:4556
AUTOCIRCULATE_TRANSFER_STRUCT::frameBufferFormat
NTV2FrameBufferFormat frameBufferFormat
Definition: ntv2publicinterface.h:4768
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:1114
AUTOCIRCULATE_DATA::lVal3
LWord lVal3
Definition: ntv2publicinterface.h:4554
NTV2_GlobalAudioPlaybackMode
NTV2_GlobalAudioPlaybackMode
Definition: ntv2enums.h:2102
AUTOCIRCULATE_DATA_64::pvVal1
Pointer64 pvVal1
Definition: ntv2publicinterface.h:4539
eAbortAutoCirc
@ eAbortAutoCirc
Definition: ntv2publicinterface.h:4427
eTransferAutoCirculate
@ eTransferAutoCirculate
Definition: ntv2publicinterface.h:4426
AUTOCIRCULATE_DATA_64::pvVal3
Pointer64 pvVal3
Definition: ntv2publicinterface.h:4541
kNTV2DriverMapperErr
const IOReturn kNTV2DriverMapperErr
Definition: ntv2macpublicinterface.h:30
NTV2DMAEngine
NTV2DMAEngine
Definition: ntv2enums.h:1852
AutoCircVidProcInfo::foregroundKeyCrosspoint
NTV2Crosspoint foregroundKeyCrosspoint
Definition: ntv2publicinterface.h:4385
MemoryType
MemoryType
Definition: ntv2macpublicinterface.h:80
eGetFrameStamp
@ eGetFrameStamp
Definition: ntv2publicinterface.h:4423
AUTOCIRCULATE_DATA::eCommand
AUTO_CIRC_COMMAND eCommand
Definition: ntv2publicinterface.h:4549
AUTOCIRCULATE_TRANSFER_STRUCT_64::rp188
RP188_STRUCT rp188
Definition: ntv2publicinterface.h:4726
AUTOCIRCULATE_TRANSFER_STRUCT_64::transferFlags
ULWord transferFlags
Definition: ntv2publicinterface.h:4729
AUTOCIRCULATE_DATA_64::bVal4
BOOL_ bVal4
Definition: ntv2publicinterface.h:4533
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:1187
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:4765
OS_IOConnectCallStructMethod
#define OS_IOConnectCallStructMethod(_u_, _v_, _w_, _x_, _y_, _z_)
Definition: ntv2macdriverinterface.cpp:76
AUTOCIRCULATE_DATA_64::lVal3
LWord lVal3
Definition: ntv2publicinterface.h:4525
AUTOCIRCULATE_TASK_STRUCT_64::reserved2
ULWord reserved2
Definition: ntv2publicinterface.h:4930
ULWord
uint32_t ULWord
Definition: ajatypes.h:276
AUTOCIRCULATE_TRANSFER_STRUCT_64::channelSpec
NTV2Crosspoint channelSpec
Definition: ntv2publicinterface.h:4717
OS_IOServiceNameMatching
#define OS_IOServiceNameMatching(_x_)
Definition: ntv2macdriverinterface.cpp:69
AUTOCIRCULATE_TASK_STRUCT::reserved1
ULWord reserved1
Definition: ntv2publicinterface.h:4942
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:517
AutoCircVidProcInfo::mode
AutoCircVidProcMode mode
Definition: ntv2publicinterface.h:4382
AJA_DebugStat_WaitForInterruptUartTx1
@ AJA_DebugStat_WaitForInterruptUartTx1
Definition: debugshare.h:236
AUTOCIRCULATE_DATA::lVal1
LWord lVal1
Definition: ntv2publicinterface.h:4552
Pointer64
uint64_t Pointer64
Definition: ajatypes.h:280
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:675
AUTOCIRCULATE_TRANSFER_STRUCT
Definition: ntv2publicinterface.h:4752
AJA_DebugStat_AutoCirculateXfer
@ AJA_DebugStat_AutoCirculateXfer
Definition: debugshare.h:245
AUTOCIRCULATE_TRANSFER_STRUCT_64::hUser
ULWord hUser
Definition: ntv2publicinterface.h:4728
kRegisterMemory
@ kRegisterMemory
Definition: ntv2macpublicinterface.h:82
NTV2DeviceIDToString
std::string NTV2DeviceIDToString(const NTV2DeviceID inValue, const bool inForRetailDisplay=false)
Definition: ntv2utils.cpp:4608
CNTV2MacDriverInterface::MapXena2Flash
virtual bool MapXena2Flash(void)
Definition: ntv2macdriverinterface.cpp:337
KR
#define KR(_kr_)
Definition: ntv2macdriverinterface.cpp:47
eFlushAutoCirculate
@ eFlushAutoCirculate
Definition: ntv2publicinterface.h:4424
DMA_TRANSFER_STRUCT_64::dmaCardFrameNumber
ULWord dmaCardFrameNumber
Definition: ntv2publicinterface.h:5008
AJA_DebugStat_WaitForInterruptUartTx2
@ AJA_DebugStat_WaitForInterruptUartTx2
Definition: debugshare.h:238
eGetAutoCirc
@ eGetAutoCirc
Definition: ntv2publicinterface.h:4422
DMA_TRANSFER_STRUCT_64::dmaSegmentCardPitch
ULWord dmaSegmentCardPitch
Definition: ntv2publicinterface.h:5013
AUTOCIRCULATE_DATA::lVal2
LWord lVal2
Definition: ntv2publicinterface.h:4553
DMA_TRANSFER_STRUCT_64::dmaEngine
NTV2DMAEngine dmaEngine
Definition: ntv2publicinterface.h:5003
AUTOCIRCULATE_TASK_STRUCT::taskArray
AutoCircGenericTask * taskArray
Definition: ntv2publicinterface.h:4940
AUTOCIRCULATE_DATA_64
Definition: ntv2publicinterface.h:4518
OS_IOKitWaitQuiet
#define OS_IOKitWaitQuiet(_x_, _y_)
Definition: ntv2macdriverinterface.cpp:79
AUTOCIRCULATE_TRANSFER_STRUCT::audioBuffer
ULWord * audioBuffer
Definition: ntv2publicinterface.h:4758
NTV2_HEADER
All new NTV2 structs start with this common header.
Definition: ntv2publicinterface.h:7196
UWord
uint16_t UWord
Definition: ajatypes.h:274
AUTOCIRCULATE_TRANSFER_STRUCT_64::customAncInfo
CUSTOM_ANC_STRUCT customAncInfo
This field is obsolete. Do not use.
Definition: ntv2publicinterface.h:4735
AUTOCIRCULATE_TRANSFER_STRUCT::videoNumSegments
ULWord videoNumSegments
Definition: ntv2publicinterface.h:4782
AUTOCIRCULATE_DATA::bVal5
BOOL_ bVal5
Definition: ntv2publicinterface.h:4563
DIDBG
#define DIDBG(__x__)
Definition: ntv2macdriverinterface.cpp:54
kNTV2DriverBadTrailerTag
const IOReturn kNTV2DriverBadTrailerTag
Definition: ntv2macpublicinterface.h:29
SystemStatusCode
SystemStatusCode
Definition: ntv2publicinterface.h:5033
ntv2utils.h
Declares numerous NTV2 utility functions.
AUTOCIRCULATE_TRANSFER_STRUCT_64::vidProcInfo
AutoCircVidProcInfo vidProcInfo
Definition: ntv2publicinterface.h:4734
AUTOCIRCULATE_TASK_STRUCT_64::numTasks
ULWord numTasks
Definition: ntv2publicinterface.h:4925
OS_IOMasterPort
#define OS_IOMasterPort(_x_, _y_)
Definition: ntv2macdriverinterface.cpp:65
AUTOCIRCULATE_TASK_STRUCT_64::taskVersion
ULWord taskVersion
Definition: ntv2publicinterface.h:4923
CNTV2MacDriverInterface::WaitForChangeEvent
virtual bool WaitForChangeEvent(UInt32 timeout=0)
Definition: ntv2macdriverinterface.cpp:819
CUSTOM_ANC_STRUCT::Group4
ULWord Group4
Definition: ntv2publicinterface.h:4406
INSTP
#define INSTP(_p_)
Definition: ntv2macdriverinterface.cpp:48
eTransferAutoCirculateEx
@ eTransferAutoCirculateEx
Definition: ntv2publicinterface.h:4429
AUTOCIRCULATE_DATA::lVal4
LWord lVal4
Definition: ntv2publicinterface.h:4555
eStartAutoCirc
@ eStartAutoCirc
Definition: ntv2publicinterface.h:4419
AUTOCIRCULATE_DATA_64::channelSpec
NTV2Crosspoint channelSpec
Definition: ntv2publicinterface.h:4521
AUTOCIRCULATE_TRANSFER_STRUCT_64
Definition: ntv2publicinterface.h:4715
DMA_TRANSFER_STRUCT_64::dmaSegmentSize
ULWord dmaSegmentSize
Definition: ntv2publicinterface.h:5011
AUTOCIRCULATE_TRANSFER_STRUCT_64::audioBufferSize
ULWord audioBufferSize
Definition: ntv2publicinterface.h:4722
DMA_TRANSFER_STRUCT_64::dmaCardFrameOffset
ULWord dmaCardFrameOffset
Definition: ntv2publicinterface.h:5009
AUTOCIRCULATE_TRANSFER_STRUCT::vidProcInfo
AutoCircVidProcInfo vidProcInfo
Definition: ntv2publicinterface.h:4771
CNTV2MacDriverInterface::MapMemory
virtual bool MapMemory(const MemoryType memType, void **memPtr)
Definition: ntv2macdriverinterface.cpp:358
kDriverRestoreProcAmpRegisters
@ kDriverRestoreProcAmpRegisters
Definition: ntv2macpublicinterface.h:54
sNTV2PCIKEXTClassName
static const string sNTV2PCIKEXTClassName("com_aja_iokit_ntv2")
AUTOCIRCULATE_TASK_STRUCT::reserved0
ULWord reserved0
Definition: ntv2publicinterface.h:4941
AJALock
Definition: lock.h:28
NTV2ColorCorrectionInfo_64::saturationValue
UWord_ saturationValue
Definition: ntv2publicinterface.h:4273
OS_IOObjectRelease
#define OS_IOObjectRelease(_x_)
Definition: ntv2macdriverinterface.cpp:72
AUTOCIRCULATE_TRANSFER_STRUCT_64::videoSegmentCardPitch
ULWord videoSegmentCardPitch
Definition: ntv2publicinterface.h:4747
AJA_DebugStat_WaitForInterruptUartRx2
@ AJA_DebugStat_WaitForInterruptUartRx2
Definition: debugshare.h:237
AJA_NULL
#define AJA_NULL
Definition: ajatypes.h:220
AUTOCIRCULATE_DATA::bVal1
BOOL_ bVal1
Definition: ntv2publicinterface.h:4559
kNTV2DriverPgmXilinxErr
const IOReturn kNTV2DriverPgmXilinxErr
Definition: ntv2macpublicinterface.h:20
AutoCircVidProcInfo::backgroundVideoCrosspoint
NTV2Crosspoint backgroundVideoCrosspoint
Definition: ntv2publicinterface.h:4384
AJAAutoLock
Definition: lock.h:89
AUTOCIRCULATE_TRANSFER_STRUCT::videoDmaOffset
ULWord videoDmaOffset
Definition: ntv2publicinterface.h:4757
DMA_TRANSFER_STRUCT_64::dmaHostBuffer
Pointer64 dmaHostBuffer
Definition: ntv2publicinterface.h:5006
CNTV2MacDriverInterface::SystemControl
virtual bool SystemControl(void *dataPtr, SystemControlCode systemControlCode)
Definition: ntv2macdriverinterface.cpp:377
NTV2ColorCorrectionInfo::ccLookupTables
ULWord * ccLookupTables
only used in 3way color correction mode.
Definition: ntv2publicinterface.h:4282
CNTV2MacDriverInterface::UnmapXena2Flash
virtual bool UnmapXena2Flash(void)
Definition: ntv2macdriverinterface.cpp:349
AJA_DebugStat_WaitForInterruptIn7
@ AJA_DebugStat_WaitForInterruptIn7
Definition: debugshare.h:232
AUTOCIRCULATE_DATA::lVal6
LWord lVal6
Definition: ntv2publicinterface.h:4557
AutoCircVidProcInfo::foregroundVideoCrosspoint
NTV2Crosspoint foregroundVideoCrosspoint
Definition: ntv2publicinterface.h:4383
AUTOCIRCULATE_DATA_64::lVal6
LWord lVal6
Definition: ntv2publicinterface.h:4528
AutoCircVidProcInfo::transitionCoefficient
Fixed_ transitionCoefficient
Definition: ntv2publicinterface.h:4387
AJA_DebugStat_WaitForInterruptIn6
@ AJA_DebugStat_WaitForInterruptIn6
Definition: debugshare.h:231
RP188_STRUCT::DBB
ULWord DBB
Definition: ntv2publicinterface.h:4211
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:4534
AUTOCIRCULATE_TRANSFER_STRUCT_64::desiredFrame
LWord desiredFrame
Definition: ntv2publicinterface.h:4727
DEC
#define DEC(__x__)
Definition: ntv2publicinterface.h:5769
RP188_STRUCT::Low
ULWord Low
Definition: ntv2publicinterface.h:4212
AUTOCIRCULATE_TASK_STRUCT_64::maxTasks
ULWord maxTasks
Definition: ntv2publicinterface.h:4926
AUTOCIRCULATE_TRANSFER_STRUCT::customAncInfo
CUSTOM_ANC_STRUCT customAncInfo
This field is obsolete. Do not use.
Definition: ntv2publicinterface.h:4772
CNTV2MacDriverInterface::MapFrameBuffers
virtual bool MapFrameBuffers(void)
Definition: ntv2macdriverinterface.cpp:293
CUSTOM_ANC_STRUCT::Group1
ULWord Group1
Definition: ntv2publicinterface.h:4403
NTV2RegInfo
Everything needed to call CNTV2Card::ReadRegister or CNTV2Card::WriteRegister functions.
Definition: ntv2publicinterface.h:4046
OS_IOServiceOpen
#define OS_IOServiceOpen(_w_, _x_, _y_, _z_)
Definition: ntv2macdriverinterface.cpp:66
UByte
uint8_t UByte
Definition: ajatypes.h:271
AUTOCIRCULATE_TRANSFER_STRUCT_64::audioBuffer
Pointer64 audioBuffer
Definition: ntv2publicinterface.h:4721
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:647
SystemControlCode
SystemControlCode
Definition: ntv2publicinterface.h:5079
CNTV2MacDriverInterface::NTV2Message
virtual bool NTV2Message(NTV2_HEADER *pInMessage)
Sends a message to the NTV2 driver (the new, improved, preferred way).
Definition: ntv2macdriverinterface.cpp:1158
AUTOCIRCULATE_TRANSFER_STRUCT::videoSegmentCardPitch
ULWord videoSegmentCardPitch
Definition: ntv2publicinterface.h:4784
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:4732
SCC_Test
@ SCC_Test
Definition: ntv2publicinterface.h:5081
std
Definition: json.hpp:5362
AUTOCIRCULATE_TASK_STRUCT_64::reserved1
ULWord reserved1
Definition: ntv2publicinterface.h:4929
AUTOCIRCULATE_TRANSFER_STATUS_STRUCT
Definition: ntv2publicinterface.h:4701
DIFAIL
#define DIFAIL(__x__)
Definition: ntv2macdriverinterface.cpp:50
AUTOCIRCULATE_DATA_64::bVal8
BOOL_ bVal8
Definition: ntv2publicinterface.h:4537
ePauseAutoCirc
@ ePauseAutoCirc
Definition: ntv2publicinterface.h:4421
eInitAutoCirc
@ eInitAutoCirc
Definition: ntv2publicinterface.h:4418
CNTV2MacDriverInterface::AcquireStreamForApplicationWithReference
virtual bool AcquireStreamForApplicationWithReference(ULWord inApplicationType, int32_t inProcessID)
A reference-counted version of CNTV2DriverInterface::AcquireStreamForApplication useful for process g...
Definition: ntv2macdriverinterface.cpp:575
CNTV2MacDriverInterface::UnmapRegisters
virtual bool UnmapRegisters(void)
Definition: ntv2macdriverinterface.cpp:328
AUTOCIRCULATE_P2P_STRUCT
Definition: ntv2publicinterface.h:4836
DMA_TRANSFER_STRUCT_64
Definition: ntv2publicinterface.h:5002
DMA_TRANSFER_STRUCT_64::dmaNumberOfSegments
ULWord dmaNumberOfSegments
Definition: ntv2publicinterface.h:5010
NTV2ColorCorrectionInfo::mode
NTV2ColorCorrectionMode mode
Definition: ntv2publicinterface.h:4280
AUTOCIRCULATE_TRANSFER_STRUCT_64::videoBufferSize
ULWord videoBufferSize
Definition: ntv2publicinterface.h:4719
eStopAutoCirc
@ eStopAutoCirc
Definition: ntv2publicinterface.h:4420
AUTOCIRCULATE_DATA_64::bVal3
BOOL_ bVal3
Definition: ntv2publicinterface.h:4532
atomic.h
Declares the AJAAtomic class.
eGetFrameStampEx2
@ eGetFrameStampEx2
Definition: ntv2publicinterface.h:4431
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:505
AUTOCIRCULATE_DATA_64::bVal1
BOOL_ bVal1
Definition: ntv2publicinterface.h:4530
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:1044
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:848
CNTV2MacDriverInterface::UnmapFrameBuffers
virtual bool UnmapFrameBuffers(void)
Definition: ntv2macdriverinterface.cpp:306
AJA_DebugStat_WriteRegister
@ AJA_DebugStat_WriteRegister
Definition: debugshare.h:225
AUTOCIRCULATE_TASK_STRUCT::reserved2
ULWord reserved2
Definition: ntv2publicinterface.h:4943
AUTOCIRCULATE_DATA::bVal4
BOOL_ bVal4
Definition: ntv2publicinterface.h:4562
CNTV2MacDriverInterface::SetAudioOutputMode
virtual bool SetAudioOutputMode(NTV2_GlobalAudioPlaybackMode mode)
Definition: ntv2macdriverinterface.cpp:1197
MDIFAIL
#define MDIFAIL(__x__)
Definition: ntv2macdriverinterface.cpp:56
AUTOCIRCULATE_TASK_STRUCT::numTasks
ULWord numTasks
Definition: ntv2publicinterface.h:4938
AUTOCIRCULATE_DATA_64::bVal2
BOOL_ bVal2
Definition: ntv2publicinterface.h:4531
AUTOCIRCULATE_TRANSFER_STRUCT_64::audioStartSample
ULWord audioStartSample
Definition: ntv2publicinterface.h:4723
eSetActiveFrame
@ eSetActiveFrame
Definition: ntv2publicinterface.h:4433
AutoCircVidProcInfo::backgroundKeyCrosspoint
NTV2Crosspoint backgroundKeyCrosspoint
Definition: ntv2publicinterface.h:4386
AUTOCIRCULATE_TRANSFER_STRUCT_64::audioNumChannels
ULWord audioNumChannels
Definition: ntv2publicinterface.h:4724
AutoCircVidProcInfo::transitionSoftness
Fixed_ transitionSoftness
Definition: ntv2publicinterface.h:4388
kVRegServicesInitialized
@ kVRegServicesInitialized
Definition: ntv2virtualregisters.h:317
AJA_DebugStat_DMATransfer
@ AJA_DebugStat_DMATransfer
Definition: debugshare.h:241
AUTOCIRCULATE_TASK_STRUCT_64::taskSize
ULWord taskSize
Definition: ntv2publicinterface.h:4924
AUTOCIRCULATE_DATA_64::lVal4
LWord lVal4
Definition: ntv2publicinterface.h:4526
AUTOCIRCULATE_TASK_STRUCT
Definition: ntv2publicinterface.h:4934
AUTOCIRCULATE_TRANSFER_STRUCT_64::bDisableExtraAudioInfo
BOOL_ bDisableExtraAudioInfo
Definition: ntv2publicinterface.h:4730
OS_IOServiceMatching
#define OS_IOServiceMatching(_x_)
Definition: ntv2macdriverinterface.cpp:68
AUTOCIRCULATE_DATA::bVal8
BOOL_ bVal8
Definition: ntv2publicinterface.h:4566
kDriverWaitForChangeEvent
@ kDriverWaitForChangeEvent
Definition: ntv2macpublicinterface.h:51
SSC_GetFirmwareProgress
@ SSC_GetFirmwareProgress
Definition: ntv2publicinterface.h:5035
DMA_TRANSFER_STRUCT_64::dmaSize
ULWord dmaSize
Definition: ntv2publicinterface.h:5007
CNTV2DriverInterface::AutoCirculate
virtual bool AutoCirculate(AUTOCIRCULATE_DATA &pAutoCircData)
Sends an AutoCirculate command to the NTV2 driver.
Definition: ntv2driverinterface.cpp:594
kDriverDMATransferEx
@ kDriverDMATransferEx
Definition: ntv2macpublicinterface.h:67
DMA_TRANSFER_STRUCT_64::dmaToCard
BOOL_ dmaToCard
Definition: ntv2publicinterface.h:5015
kDriverSetStreamForApplication
@ kDriverSetStreamForApplication
Definition: ntv2macpublicinterface.h:44
kDriverWriteRegister
@ kDriverWriteRegister
Definition: ntv2macpublicinterface.h:39
eTransferAutoCirculateEx2
@ eTransferAutoCirculateEx2
Definition: ntv2publicinterface.h:4430
kDriverGetInterruptCount
@ kDriverGetInterruptCount
Definition: ntv2macpublicinterface.h:50
DMA_TRANSFER_STRUCT_64::dmaSegmentHostPitch
ULWord dmaSegmentHostPitch
Definition: ntv2publicinterface.h:5012
AUTOCIRCULATE_TASK_STRUCT::maxTasks
ULWord maxTasks
Definition: ntv2publicinterface.h:4939
AUTOCIRCULATE_DATA::bVal7
BOOL_ bVal7
Definition: ntv2publicinterface.h:4565
CNTV2MacDriverInterface::ReleaseStreamForApplicationWithReference
virtual bool ReleaseStreamForApplicationWithReference(ULWord inApplicationType, int32_t inProcessID)
A reference-counted version of CNTV2DriverInterface::ReleaseStreamForApplication useful for process g...
Definition: ntv2macdriverinterface.cpp:613
xHEX0N
#define xHEX0N(__x__, __n__)
Definition: ntv2publicinterface.h:5768
AUTOCIRCULATE_TRANSFER_STRUCT::channelSpec
NTV2Crosspoint channelSpec
Definition: ntv2publicinterface.h:4754
AUTOCIRCULATE_DATA::pvVal1
void * pvVal1
Definition: ntv2publicinterface.h:4568
AUTOCIRCULATE_DATA_64::bVal6
BOOL_ bVal6
Definition: ntv2publicinterface.h:4535
NTV2ColorCorrectionInfo::saturationValue
UWord_ saturationValue
Definition: ntv2publicinterface.h:4281
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:4569
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:454
CUSTOM_ANC_STRUCT::Group2
ULWord Group2
Definition: ntv2publicinterface.h:4404
AUTOCIRCULATE_TRANSFER_STRUCT::videoBufferSize
ULWord videoBufferSize
Definition: ntv2publicinterface.h:4756
CNTV2DriverInterface::NTV2Message
virtual bool NTV2Message(NTV2_HEADER *pInMessage)
Sends a message to the NTV2 driver (the new, improved, preferred way).
Definition: ntv2driverinterface.cpp:619
AUTOCIRCULATE_TRANSFER_STRUCT::audioNumChannels
ULWord audioNumChannels
Definition: ntv2publicinterface.h:4761
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:4524
OS_IOServiceGetMatchingServices
#define OS_IOServiceGetMatchingServices(_x_, _y_, _z_)
Definition: ntv2macdriverinterface.cpp:70
AUTOCIRCULATE_TRANSFER_STRUCT_64::videoQuarterSizeExpand
NTV2QuarterSizeExpandMode videoQuarterSizeExpand
Definition: ntv2publicinterface.h:4748
gLegalDeviceIDs
static NTV2DeviceIDSet gLegalDeviceIDs
Definition: ntv2macdriverinterface.cpp:36
AUTOCIRCULATE_TASK_STRUCT_64::reserved0
ULWord reserved0
Definition: ntv2publicinterface.h:4928
sIntEnumToStatKeys
static const uint32_t sIntEnumToStatKeys[]
Definition: ntv2macdriverinterface.cpp:724
kDriverNTV2Message
@ kDriverNTV2Message
Definition: ntv2macpublicinterface.h:72
AUTOCIRCULATE_TRANSFER_STRUCT_64::frameBufferFormat
NTV2FrameBufferFormat frameBufferFormat
Definition: ntv2publicinterface.h:4731
ntv2nubaccess.h
Declares NTV2 "nub" client functions.
kNTV2DriverPrepMemErr
const IOReturn kNTV2DriverPrepMemErr
Definition: ntv2macpublicinterface.h:22
NTV2ColorCorrectionInfo_64::mode
NTV2ColorCorrectionMode mode
Definition: ntv2publicinterface.h:4272
eChangeEvent
@ eChangeEvent
Definition: ntv2publicinterface.h:3839
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:281
AUTOCIRCULATE_DATA
Definition: ntv2publicinterface.h:4547
AJA_DebugStat_WaitForInterruptIn5
@ AJA_DebugStat_WaitForInterruptIn5
Definition: debugshare.h:230
AUTOCIRCULATE_TRANSFER_STRUCT::desiredFrame
LWord desiredFrame
Definition: ntv2publicinterface.h:4764
kDriverAcquireStreamForApplicationWithReference
@ kDriverAcquireStreamForApplicationWithReference
Definition: ntv2macpublicinterface.h:68
AUTOCIRCULATE_DATA_64::bVal7
BOOL_ bVal7
Definition: ntv2publicinterface.h:4536
kNTV2UnknownStructType
const IOReturn kNTV2UnknownStructType
Definition: ntv2macpublicinterface.h:27
AUTOCIRCULATE_TASK_STRUCT_64
Definition: ntv2publicinterface.h:4921
CNTV2MacDriverInterface::CloseLocalPhysical
virtual bool CloseLocalPhysical(void)
Releases host resources associated with the local/physical device connection.
Definition: ntv2macdriverinterface.cpp:259
kDriverAcquireStreamForApplication
@ kDriverAcquireStreamForApplication
Definition: ntv2macpublicinterface.h:42
kFrameBufferMemory
@ kFrameBufferMemory
Definition: ntv2macpublicinterface.h:83