本文整理汇总了C++中IOService::getDeviceMemoryWithIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ IOService::getDeviceMemoryWithIndex方法的具体用法?C++ IOService::getDeviceMemoryWithIndex怎么用?C++ IOService::getDeviceMemoryWithIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOService
的用法示例。
在下文中一共展示了IOService::getDeviceMemoryWithIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getResources
IOReturn ARMIODevice::getResources( void )
{
IOService *macIO = this;
if (getDeviceMemory() != 0) return kIOReturnSuccess;
while (macIO && ((macIO = macIO->getProvider()) != 0))
if (strcmp("arm-io", macIO->getName()) == 0) break;
if (macIO == 0) return kIOReturnError;
IODTResolveAddressing(this, "reg", macIO->getDeviceMemoryWithIndex(0));
return kIOReturnSuccess;
}
示例2: start
/******************************************************************************
* CodecCommander::start - start kernel extension and init PM
******************************************************************************/
bool CodecCommander::start(IOService *provider)
{
DEBUG_LOG("CodecCommander: cc: commander version 2.1.1 starting\n");
if(!provider || !super::start( provider ))
{
DEBUG_LOG("CodecCommander: cc: error loading kext\n");
return false;
}
// notify about extra feature requests
if (generatePop && checkInfinite) {
DEBUG_LOG("CodecCommander: cc: stream requested, will *pop* upon wake or fugue-wake\n");
}
if (checkInfinite) {
DEBUG_LOG("CodecCommander: cc: infinite workloop requested, will start now!\n");
}
if (generatePop && !checkInfinite) {
DEBUG_LOG("CodecCommander: cc: stream requested, will *pop* upon wake\n");
}
// start virtual keyboard device
_keyboardDevice = new CCHIDKeyboardDevice;
if ( !_keyboardDevice ||
!_keyboardDevice->init() ||
!_keyboardDevice->attach(this) )
{
_keyboardDevice->release();
DEBUG_LOG("CodecCommander: hi: unable to create keyboard device\n");
}
else
{
DEBUG_LOG("CodecCommander: hi: keyboard device created\n");
_keyboardDevice->registerService();
}
// determine HDEF ACPI device path in IORegistry
IORegistryEntry *hdaDeviceEntry = IORegistryEntry::fromPath(hdaDevicePath);
if (hdaDeviceEntry != NULL) {
IOService *service = OSDynamicCast(IOService, hdaDeviceEntry);
// get address field from IODeviceMemory
if (service != NULL && service->getDeviceMemoryCount() != 0) {
ioregEntry = service->getDeviceMemoryWithIndex(0);
}
hdaDeviceEntry->release();
}
else {
DEBUG_LOG("CodecCommander: %s is unreachable\n",hdaDevicePath);
return false;
}
// init power state management & set state as PowerOn
PMinit();
registerPowerDriver(this, powerStateArray, kPowerStateCount);
provider->joinPMtree(this);
// setup workloop and timer
fWorkLoop = IOWorkLoop::workLoop();
fTimer = IOTimerEventSource::timerEventSource(this,
OSMemberFunctionCast(IOTimerEventSource::Action, this,
&CodecCommander::onTimerAction));
if (!fWorkLoop || !fTimer)
stop(provider);;
if (fWorkLoop->addEventSource(fTimer) != kIOReturnSuccess)
stop(provider);
this->registerService(0);
return true;
}