gempir

Apple C++

Sep 30th, 2017
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. bool IODMAEventSource::init(
  2.     OSObject *inOwner,
  3.     IOService *inProvider,
  4.     Action inCompletion,
  5.     Action inNotification,
  6.     UInt32 inDMAIndex
  7. ) {
  8.     IOReturn result;
  9.  
  10.     if (!super::init(inOwner)) {
  11.         return false;
  12.     }
  13.  
  14.     if (inProvider == 0) {
  15.         return false;
  16.     }
  17.  
  18.     dmaProvider = inProvider;
  19.     dmaIndex = 0xFFFFFFFF;
  20.     dmaCompletionAction = inCompletion;
  21.     dmaNotificationAction = inNotification;
  22.  
  23.     dmaController = IODMAController::getController(dmaProvider, inDMAIndex);
  24.     if (dmaController == 0) {
  25.         return false;
  26.     }
  27.     dmaController->retain();
  28.  
  29.     result = dmaController->initDMAChannel(dmaProvider, this, &dmaIndex, inDMAIndex);
  30.     if (result != kIOReturnSuccess) {
  31.         return false;
  32.     }
  33.  
  34.     queue_init(&dmaCommandsCompleted);
  35.     dmaCommandsCompletedLock = IOSimpleLockAlloc();
  36.  
  37.     return true;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment