Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

USB driver little big endian conversion problem

184 views
Skip to first unread message

julin

unread,
Jun 15, 2004, 6:44:57 AM6/15/04
to
Dear all,
I have an endian problem about USB1.1 driver.
My hardware platform is PPC, so the CPU is
working on big endian mode. But the USB is
defined to be little endian.
So I got the wrong data type(bcdUsb, vendor id,
product id....). These data should be swap
high byte and low byte.

Is there any easy way to porting the
USB driver on PPC platform?
I mean something like
#if _BYTE_ORDER == _BIG_ENDIAN

Susanne

unread,
Jun 15, 2004, 2:24:52 PM6/15/04
to

Hi Julin,

Please could you be more explicit ?

Is the host controller a component of the PPC ?
Or it is external through a PCI bus, or other ?
Do you have an USB OHCI or UHCI controller ?

What kind of PPC CPU are you using ?

Patrick

Patrick Deiber

unread,
Jun 15, 2004, 2:36:59 PM6/15/04
to
Susanne wrote:

If your PPC platform is based on a MPC5200 you may download the BSP for
the Lite5200 board from Windsurf (or ask support).

This BSP should contain the required changes to get the USB 1.1 stack
running.

julin

unread,
Jun 15, 2004, 9:29:16 PM6/15/04
to
Susanne <patrick...@arcor.de> wrote in message news:<40cf3...@news.arcor-ip.de>...

Dear Patrick,

My platform is MPC8220i Alaska board,
and windriver do not have this board's BSP now.
But Motorola already support me the BSP for vxWorks O/S.
My CPU is MPC8220i(G2 core inside), and it has external PCI bus.
I plug in one PCI-USB card into the PCI slot,
and enable the OHCI controller,
so my firmware is working on USB 1.1 host.
I think there is no problem about hardware connection.
And the PCI interrupt work fine.

I can get the device descriptor from the USB device.


But the USB is defined to be little endian.

And I have check the following usb_device_descr data structure,
pUSB_DEVICE_DESCR->bcdUsb,
pUSB_DEVICE_DESCR->vendor,
pUSB_DEVICE_DESCR->product,
pUSB_DEVICE_DESCR->bcdDevice,
I found the UINT16 high/low byte data should be swap.
The UINT8 data all OK.

typedef struct usb_device_descr
{
UINT8 length; /* bLength */
UINT8 descriptorType; /* bDescriptorType */
UINT16 bcdUsb; /* bcdUSB - USB release in BCD */
UINT8 deviceClass; /* bDeviceClass */
UINT8 deviceSubClass; /* bDeviceSubClass */
UINT8 deviceProtocol; /* bDeviceProtocol */
UINT8 maxPacketSize0; /* bMaxPacketSize0 */
UINT16 vendor; /* idVendor */
UINT16 product; /* idProduct */
UINT16 bcdDevice; /* bcdDevice - dev release in BCD */
UINT8 manufacturerIndex; /* iManufacturer */
UINT8 productIndex; /* iProduct */
UINT8 serialNumberIndex; /* iSerialNumber */
UINT8 numConfigurations; /* bNumConfigurations */
} WRS_PACK_ALIGN(4) USB_DEVICE_DESCR, *pUSB_DEVICE_DESCR;

Currently I already know where is the problem.
But how can I solve this problem more easy?

Best Regards,
Julin

Susanne

unread,
Jun 16, 2004, 2:56:57 PM6/16/04
to

By changing the appropriate OHCI HCD driver (usbHcdOchciLib.c) and/or
the usbPciStub.c of the BSP you should be able to get the stack working.

Check also if there is not a double swapping with the BSP, the
sysPciInLong() / sysPciOutLong() (probably at sysALib.s) perform already
the swapping on the PCI bus (little Endian).

If you try to change the upper layer you will increase the complexity of
the integration.


Regards,
Patrick

0 new messages