| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
// structure involved in data transfers.
typedef struct
{
unsigned long deviceIndex; //the index required by GetDeviceInfo
unsigned long iBufferSz; //The command Sz
unsigned long oBufferSz; //the expected output Buffer size
_IOCTL_COMMAND IOCmd;
} _COMMAND_EXCHANGE, *P_COMMAND_EXCHANGE;
//////////////////////
// IOUSerClient
IOReturn myDriverUserClient::_CommonAPICmd(_COMMAND_EXCHANGE* inpkt,
_COMMAND_EXCHANGE* outpkt)
{
P_CMD_HEAD pCmd = NULL;
// take a pointer to memory descriptor
IOMemoryDescriptor *memDescOut = NULL;
IOMemoryMap* memMap = NULL;
// Allocate the memory descriptor needed
memDescOut = IOMemoryDescriptor::withAddress(
(vm_address_t)inpkt->IOCmd.pApiCmd,
inputSize,
kIODirectionOut,
stask);
if ( memDescOut == NULL )
{
return kIOReturnNoResources;
}
// Map the buffer into the kernel memory
memMap = memDescOut->map(kernel_task, kIOMapAnywhere, kIOMapAnywhere,0, inputSize);
//check mapping
if(memMap == NULL){
memDescOut->release();
return kIOReturnNoResources;
}
pCmd = (P_CMD_HEAD)memMap->getVirtualAddress();
if( (pCmd == NULL) || (pRsp == NULL))
{
memDescOut->release();
return kIOReturnNoResources;
}
memMap->unmap();
memMap->release();
if(memDescOut)
memDescOut->release();
break;
}
return status;
_______________________________________________ Do not post admin requests to the list. They will be ignored. Usb mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/usb/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.