IOUSBControllerV2.cpp [plain text]
#include <IOKit/usb/IOUSBController.h>
#include <IOKit/usb/IOUSBControllerV2.h>
#include <IOKit/usb/IOUSBLog.h>
#define super IOUSBController
OSDefineMetaClass( IOUSBControllerV2, IOUSBController )
OSDefineAbstractStructors(IOUSBControllerV2, IOUSBController)
IOReturn IOUSBControllerV2::OpenPipe(USBDeviceAddress address, UInt8 speed,
Endpoint *endpoint)
{
return _commandGate->runAction(DoCreateEP, (void *)(UInt32)address,
(void *)(UInt32)speed, endpoint);
}
IOReturn
IOUSBControllerV2::DoCreateEP(OSObject *owner,
void *arg0, void *arg1,
void *arg2, void *arg3)
{
IOUSBControllerV2 *me = (IOUSBControllerV2 *)owner;
UInt8 address = (UInt8)(UInt32)arg0;
UInt8 speed = (UInt8)(UInt32)arg1;
Endpoint *endpoint = (Endpoint *)arg2;
IOReturn err;
USBLog(5,"%s[%p]::DoCreateEP, high speed ancestor hub:%d, port:%d", me->getName(), me, me->_highSpeedHub[address], me->_highSpeedPort[address]);
switch (endpoint->transferType)
{
case kUSBInterrupt:
err = me->UIMCreateInterruptEndpoint(address,
endpoint->number,
endpoint->direction,
speed,
endpoint->maxPacketSize,
endpoint->interval,
me->_highSpeedHub[address],
me->_highSpeedPort[address]);
break;
case kUSBBulk:
err = me->UIMCreateBulkEndpoint(address,
endpoint->number,
endpoint->direction,
speed,
endpoint->maxPacketSize,
me->_highSpeedHub[address],
me->_highSpeedPort[address]);
break;
case kUSBControl:
err = me->UIMCreateControlEndpoint(address,
endpoint->number,
endpoint->maxPacketSize,
speed,
me->_highSpeedHub[address],
me->_highSpeedPort[address]);
break;
case kUSBIsoc:
err = me->UIMCreateIsochEndpoint(address,
endpoint->number,
endpoint->maxPacketSize,
endpoint->direction,
me->_highSpeedHub[address],
me->_highSpeedPort[address]);
break;
default:
err = kIOReturnBadArgument;
break;
}
return (err);
}
IOReturn
IOUSBControllerV2::CreateDevice( IOUSBDevice *newDevice,
USBDeviceAddress deviceAddress,
UInt8 maxPacketSize,
UInt8 speed,
UInt32 powerAvailable,
USBDeviceAddress hub,
int port)
{
USBLog(5,"%s[%p]::CreateDevice, new method called with hub:%d, port:%d", getName(), this, hub, port);
if(speed != kUSBDeviceSpeedHigh)
{
if(_highSpeedHub[hub] == 0) {
_highSpeedHub[deviceAddress] = hub;
_highSpeedPort[deviceAddress] = port;
}
else
{
_highSpeedHub[deviceAddress] = _highSpeedHub[hub];
_highSpeedPort[deviceAddress] = _highSpeedPort[hub];
}
}
else
{
_highSpeedHub[deviceAddress] = 0;
_highSpeedPort[deviceAddress] = 0;
}
USBLog(5,"%s[%p]::CreateDevice, high speed ancestor hub:%d, port:%d",getName(), this, _highSpeedHub[deviceAddress], _highSpeedPort[deviceAddress]);
return (super::CreateDevice(newDevice, deviceAddress, maxPacketSize, speed, powerAvailable));
}
IOReturn
IOUSBControllerV2::ConfigureDeviceZero(UInt8 maxPacketSize, UInt8 speed, USBDeviceAddress hub, int port)
{
USBLog(5,"%s[%p]::ConfigureDeviceZero, new method called with hub:%d, port:%d", getName(), this, hub, port);
if(speed != kUSBDeviceSpeedHigh)
{
if(_highSpeedHub[hub] == 0) {
_highSpeedHub[0] = hub;
_highSpeedPort[0] = port;
}
else
{
_highSpeedHub[0] = _highSpeedHub[hub];
_highSpeedPort[0] = _highSpeedPort[hub];
}
}
else
{
_highSpeedHub[0] = 0;
_highSpeedPort[0] = 0;
}
USBLog(5, "%s[%p]::CreateDevice, high speed ancestor hub:%d, port:%d", getName(), this, _highSpeedHub[0], _highSpeedPort[0]);
return (super::ConfigureDeviceZero(maxPacketSize, speed));
}
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 0);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 1);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 2);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 3);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 4);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 5);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 6);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 7);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 8);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 9);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 10);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 11);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 12);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 13);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 14);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 15);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 16);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 17);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 18);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 19);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 20);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 21);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 22);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 23);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 24);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 25);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 26);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 27);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 28);
OSMetaClassDefineReservedUnused(IOUSBControllerV2, 29);