Re: usb client suspend resume on pxa270
- From: "Voidcoder" <voidcoder@xxxxxxxxx>
- Date: Wed, 22 Feb 2006 10:18:53 -0800
This bug was originally discovered by Martin Malik
and discussed a few times in this NG an year ago.
"Voidcoder" <voidcoder@xxxxxxxxx> wrote in message news:ekxfD14NGHA.3864@xxxxxxxxxxxxxxxxxxxxxxx
First of all, not clear why you are looking
for the resume inside the Power OFF handling?
if (bOff)
{
...
}
The second thing is that the following code will
not resume the UDC state cause config is not
preserved during the suspend state.
UDCCR udccr;
udccr.ulValue = 0;
udccr.bit.UDE = 1 ;
WriteControlRegister(udccr.ulValue);
You must completely reconfigure endpoints,
for instance you can call ReInit().
Note the original BulUsbDevice::ReInit()
method has a serious bug causing the endpoint
configuration to not apply.
for (DWORD dwIndex=0; dwIndex<MAX_ENDPOINT_NUMBER; dwIndex++)
BulEndpoint *pEndpoint = ObjectIndex(dwIndex);
if (pEndpoint!=NULL) {
pEndpoint->ReInit();
pEndpoint->DeRef();
}
If you look carefully through the code, you can see that
pEndpoint->ReInit() will be never executed.
The code must be changed to:
for (DWORD dwIndex=0; dwIndex<MAX_ENDPOINT_NUMBER; dwIndex++)
{
BulEndpoint *pEndpoint = ObjectIndex(dwIndex);
if (pEndpoint!=NULL) {
pEndpoint->ReInit();
pEndpoint->DeRef();
}
}
"stonely" <stonely@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:00E4021D-AA36-47B2-BFEF-1B0012E3333E@xxxxxxxxxxxxxxxx
Dear David,
This is to with reference to your post on WINCE platform builder newsgroup.
As we are also facing the same problem (usb client suspend resume), we
appreciate if you could help.
We tried the procedures stated in the post, however it is not working.
Below is our changes made:
void BulUsbDevice::PowerMgr(BOOL bOff)
{
Lock();
if (bOff)
{
// Disable Device to simulate remove from bus.
UDCCR udccr;
udccr.ulValue = 0;
udccr.bit.UDE = 0 ;
WriteControlRegister(udccr.ulValue);
if(m_fResumeOccurred)
{
m_fForceResume = FALSE;
ReInit();
#ifndef ENABLE_SERIAL_AUTO_CONNECTION
if((m_fIsCableAttached != IsCableAttached()) ||
(m_fResumeOccurred == TRUE))
{
RETAILMSG(1,(TEXT("---->
BulUsbDevice::CableAttached \r\n")));
m_fIsCableAttached = FALSE;
SetEvent(m_hISTEvent);
}
else
{
RETAILMSG(1,(TEXT("---->
BulUsbDevice::CableDetached \r\n")));
m_fResumeOccurred = FALSE;
}
#else
CablePowerOn();
#endif
//CablePowerOff(); }
}
}
else
{
UDCCR udccr;
udccr.ulValue = 0;
udccr.bit.UDE = 1 ;
WriteControlRegister(udccr.ulValue);
}
Unlock();
}
Kindly help to go through the above codes and guide us in resolving this bug.
Thanks and regards
stonely
"David Liao (MS)" wrote:
In platform code (not CSP), you have to pull up D+ during Start() and pow
down D+ during End(). Did you implement that? You can find example on
platform\mainstoneII\src\drivers\usbfn
Reinit should be called in BulUsbDevice::PowerMgr. Instead,
BulUsbDevice::PowerMgr should set a flag and signal IST by
SetInterruptEvent.
Inside IST (BulUsbDevice::ThreadRun()), change following line.
if (m_fIsCableAttached != IsCableAttached()) {
...
to
if (m_fIsCableAttached != IsCableAttached() || m_fResumed ) {
m_fResumed = FALSE;
...
I hope this will help you.
David Liao
"piero" <piero@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7CB09DD6-1555-40CF-9EE4-CC663A7ABCEF@xxxxxxxxxxxxxxxx
Mainstone PXA270 WinCE5.0
I'm trying to resume usb serial function after suspend.
I have done these modifications:
1) correct bul_usbfn.cpp BulUsbDevice::ReInit() with inserting parenthesis
in for cycle (to correct Reinit skipping)
2) correct BulUsbDevice::PowerDown in order to call always PowerMgr
function
3) call Reinit in BulUsbDevice::PowerMgr function in case of Powerup
But it still does not work. I have no more ideas.
Any help ?
Thanks
Piero
.
- Follow-Ups:
- Re: usb client suspend resume on pxa270
- From: stonely
- Re: usb client suspend resume on pxa270
- References:
- Re: usb client suspend resume on pxa270
- From: stonely
- Re: usb client suspend resume on pxa270
- From: Voidcoder
- Re: usb client suspend resume on pxa270
- Prev by Date: Re: .nb0 and .abx files
- Next by Date: Re: How to remove the backlight applet in the Display control pane
- Previous by thread: Re: usb client suspend resume on pxa270
- Next by thread: Re: usb client suspend resume on pxa270
- Index(es):
Relevant Pages
|