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