| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#define super IOUserClient
OSDefineMetaClassAndStructors(MyDriver_drv_user, IOUserClient)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
extern IODeviceMemory *physicalMem;
IOReturn MyDriver_drv_user::clientMemoryForType(UInt32 type, IOOptionBits * options, IOMemoryDescriptor ** memory)
{
physicalMem->map( fTask, kIOMapAnywhere, kIOMapAnywhere, 0, 0); if(!physicalMem) return -1;
physicalMem->retain();
*memory = physicalMem;
return kIOReturnSuccess;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#define super IOService
OSDefineMetaClassAndStructors(MyDriver_drv, IOService)
IOMemoryMap * fRegisterMap = NULL;
IODeviceMemory *physicalMem = NULL;
IOPCIDevice * fPCIDevice = NULL;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MyDriver_drv::start(IOService * provider)
{
if (!super::start(provider))
return false;
fPCIDevice = (IOPCIDevice *) provider;
if(!fPCIDevice)
return false;
fPCIDevice->setMemoryEnable( true );
fPCIDevice->setIOEnable( true );
fRegisterMap = fPCIDevice->mapDeviceMemoryWithRegister(kIOPCIConfigBaseAddress2);
if(fRegisterMap)
{
physicalMem = IODeviceMemory::withRange(fRegisterMap->getPhysicalAddress(),fRegisterMap->getLength());
physicalMem->initWithPhysicalAddress(fRegisterMap->getPhysicalAddress(),fRegisterMap->getLength(), kIODirectionOutIn));
}
registerService();
return true;
}
Please let me know the fault with above piece of code and if possible, let me know the link of any sample application (if at all it exists)
Thanks and Regards,
Rohit Dhamija
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-drivers mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-drivers/email@hidden This email sent to email@hidden
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.