I am working on USB driver for Windows CE 6 on x86 platform.
I am facing an issue in USB driver initialization if the USB is plugged in during system init.
Normally I plugin the USB after the system is up and the USB driver reads bulk endpoints max packet size as 512 bytes and the driver gets initialized successfully. Debug output: (in successful initialization case)
+USBD:OpenPipe, EP: 0x81, MaxPkt: 512, Type: Bulk -USBD:OpenPipe success, hPipe = D19A9000 +USBD:OpenPipe, EP: 0x82, MaxPkt: 512, Type: Bulk -USBD:OpenPipe success, hPipe = D19A98C0 +USBD:OpenPipe, EP: 0x83, MaxPkt: 512, Type: Bulk -USBD:OpenPipe success, hPipe = D19A1480 +USBD:OpenPipe, EP: 0x84, MaxPkt: 64, Type: Interrupt -USBD:OpenPipe success, hPipe = D19A1F60 +USBD:OpenPipe, EP: 0x1, MaxPkt: 512, Type: Bulk -USBD:OpenPipe success, hPipe = D19A5680 +USBD:OpenPipe, EP: 0x2, MaxPkt: 512, Type: Bulk -USBD:OpenPipe success, hPipe = D19A5D20 +USBD:OpenPipe, EP: 0x3, MaxPkt: 512, Type: Bulk -USBD:OpenPipe success, hPipe = D19A6500 +USBD:OpenPipe, EP: 0x4, MaxPkt: 512, Type: Bulk -USBD:OpenPipe success, hPipe = D19A74E0 +USBD:OpenPipe, EP: 0x5, MaxPkt: 512, Type: Bulk -USBD:OpenPipe success, hPipe = D19A7940
But the problem is when the USB is plugged in during system initialization , the USB driver reading bulk endpoints max packet size as 64 bytes(also there are some no memory available prints) and it is failing in initialization. Debug output: (failed initialization case)
+USBD:OpenPipe, EP: 0x81, MaxPkt: 64, Type: Bulk -USBD:OpenPipe success, hPipe = D051A200 +USBD:OpenPipe, EP: 0x82, MaxPkt: 64, Type: Bulk -USBD:OpenPipe success, hPipe = D051AB00 +USBD:OpenPipe, EP: 0x83, MaxPkt: 64, Type: Bulk -USBD:OpenPipe success, hPipe = D05120E0 +USBD:OpenPipe, EP: 0x84, MaxPkt: 64, Type: Interrupt -USBD:OpenPipe success, hPipe = D051B3C0 +USBD:OpenPipe, EP: 0x1, MaxPkt: 64, Type: Bulk -USBD:OpenPipe success, hPipe = D051BD80 +USBD:OpenPipe, EP: 0x2, MaxPkt: 64, Type: Bulk -USBD:OpenPipe success, hPipe = D051C1C0 +USBD:OpenPipe, EP: 0x3, MaxPkt: 64, Type: Bulk -USBD:OpenPipe success, hPipe = D051C600 +USBD:OpenPipe, EP: 0x4, MaxPkt: 64, Type: Bulk -USBD:OpenPipe success, hPipe = D051CA40 +USBD:OpenPipe, EP: 0x5, MaxPkt: 64, Type: Bulk -USBD:OpenPipe success, hPipe = D051CE80 CPhysMem AllocateMemory : No memory available CPipe(Bulk)::IssueTransfer - no memory for TD buffer
And I see all USB transfers are failing.
CQueuedPipe(Bulk)::CheckForDoneTransfers - failure on TD 0xd06759a0, address = 1, endpoint = 2, errorCounter = 0, status field = 0x22 CQueuedPipe(Control)::CheckForDoneTransfers - failure on TD 0xd067f600, address = 1, endpoint = 0, errorCounter = 0, status field = 0
Can any one help me on this issue, why it is reading different length for bulk endpoints during system init?