forked from xuos/xiuos
fix third_party_usb/usbhost data format bugs
This commit is contained in:
@@ -40,6 +40,12 @@ Modification:
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef ARCH_CPU_64BIT
|
||||
typedef uint64 x_usb_format;
|
||||
#else
|
||||
typedef uint32 x_usb_format;
|
||||
#endif
|
||||
|
||||
#define USB_MAX_DEVICE 0x20
|
||||
#define USB_MAX_INTERFACE 0x08
|
||||
#define USB_HUB_PORT_NUM 0x04
|
||||
|
||||
@@ -491,14 +491,14 @@ x_err_t UsbhClearFeature(UinstPointer device, int endpoint, int feature)
|
||||
x_err_t UsbhGetInterfaceDescriptor(UcfgDescPointer CfgDesc, int num,
|
||||
UintfDescPointer* IntfDesc)
|
||||
{
|
||||
uint32 ptr, depth = 0;
|
||||
x_usb_format ptr, depth = 0;
|
||||
UdescPointer desc;
|
||||
|
||||
|
||||
NULL_PARAM_CHECK(CfgDesc);
|
||||
|
||||
ptr = (uint32)CfgDesc + CfgDesc->bLength;
|
||||
while(ptr < (uint32)CfgDesc + CfgDesc->wTotalLength)
|
||||
ptr = (x_usb_format)CfgDesc + CfgDesc->bLength;
|
||||
while(ptr < (x_usb_format)CfgDesc + CfgDesc->wTotalLength)
|
||||
{
|
||||
if(depth++ > 0x20)
|
||||
{
|
||||
@@ -517,7 +517,7 @@ x_err_t UsbhGetInterfaceDescriptor(UcfgDescPointer CfgDesc, int num,
|
||||
return EOK;
|
||||
}
|
||||
}
|
||||
ptr = (uint32)desc + desc->bLength;
|
||||
ptr = (x_usb_format)desc + desc->bLength;
|
||||
}
|
||||
|
||||
KPrintf("usb_get_interface_descriptor %d failed\n", num);
|
||||
@@ -538,7 +538,7 @@ x_err_t UsbhGetEndpointDescriptor(UintfDescPointer IntfDesc, int num,
|
||||
UepDescPointer* EpDesc)
|
||||
{
|
||||
int count = 0, depth = 0;
|
||||
uint32 ptr;
|
||||
x_usb_format ptr;
|
||||
UdescPointer desc;
|
||||
|
||||
|
||||
@@ -546,7 +546,7 @@ x_err_t UsbhGetEndpointDescriptor(UintfDescPointer IntfDesc, int num,
|
||||
CHECK(num < IntfDesc->bNumEndpoints);
|
||||
*EpDesc = NONE;
|
||||
|
||||
ptr = (uint32)IntfDesc + IntfDesc->bLength;
|
||||
ptr = (x_usb_format)IntfDesc + IntfDesc->bLength;
|
||||
while(count < IntfDesc->bNumEndpoints)
|
||||
{
|
||||
if(depth++ > 0x20)
|
||||
@@ -567,7 +567,7 @@ x_err_t UsbhGetEndpointDescriptor(UintfDescPointer IntfDesc, int num,
|
||||
}
|
||||
else count++;
|
||||
}
|
||||
ptr = (uint32)desc + desc->bLength;
|
||||
ptr = (x_usb_format)desc + desc->bLength;
|
||||
}
|
||||
|
||||
KPrintf("usb_get_endpoint_descriptor %d failed\n", num);
|
||||
|
||||
@@ -43,13 +43,13 @@ static x_err_t RootHubCtrl(struct uhcd *hcd, uint16 port, uint8 cmd, void *args)
|
||||
switch(cmd)
|
||||
{
|
||||
case RH_GET_PORT_STATUS:
|
||||
(*(uint32 *)args) = hcd->roothub->PortStatus[port-1];
|
||||
(*(x_usb_format *)args) = hcd->roothub->PortStatus[port-1];
|
||||
break;
|
||||
case RH_SET_PORT_STATUS:
|
||||
hcd->roothub->PortStatus[port-1] = (*(uint32 *)args);
|
||||
hcd->roothub->PortStatus[port-1] = (*(x_usb_format *)args);
|
||||
break;
|
||||
case RH_CLEAR_PORT_FEATURE:
|
||||
switch(((uint32)args))
|
||||
switch(((x_usb_format)args))
|
||||
{
|
||||
case PORT_FEAT_C_CONNECTION:
|
||||
hcd->roothub->PortStatus[port-1] &= ~PORT_CCSC;
|
||||
@@ -69,7 +69,7 @@ static x_err_t RootHubCtrl(struct uhcd *hcd, uint16 port, uint8 cmd, void *args)
|
||||
}
|
||||
break;
|
||||
case RH_SET_PORT_FEATURE:
|
||||
switch((uint32)args)
|
||||
switch((x_usb_format)args)
|
||||
{
|
||||
case PORT_FEAT_CONNECTION:
|
||||
hcd->roothub->PortStatus[port-1] |= PORT_CCSC;
|
||||
@@ -222,7 +222,7 @@ x_err_t UsbhHubClearPortFeature(UhubPointer hub, uint16 port, uint16 feature)
|
||||
if(hub->IsRoothub)
|
||||
{
|
||||
RootHubCtrl(hub->hcd, port, RH_CLEAR_PORT_FEATURE,
|
||||
(void*)(uint32)feature);
|
||||
(void*)(x_usb_format)feature);
|
||||
return EOK;
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ x_err_t UsbhHubSetPortFeature(UhubPointer hub, uint16 port,
|
||||
if(hub->IsRoothub)
|
||||
{
|
||||
RootHubCtrl(hub->hcd, port, RH_SET_PORT_FEATURE,
|
||||
(void*)(uint32)feature);
|
||||
(void*)(x_usb_format)feature);
|
||||
return EOK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user