Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Jul 2007 20:25:20 -0400
From:      "Xiaofan Chen" <xiaofanc@gmail.com>
To:        "Hans Petter Selasky" <hselasky@c2i.net>
Cc:        freebsd-usb@freebsd.org
Subject:   Re: libusb usb_interrupt_read hangs under FreeBSD
Message-ID:  <a276da400707071725x2b2b8ab3ife6c5459d06042bd@mail.gmail.com>
In-Reply-To: <200707051724.30175.hselasky@c2i.net>
References:  <a276da400704030427g6fcfdc37u43bdf0fd1cd69ea8@mail.gmail.com> <a276da400704040434y6451900eg95e3cd2f35cae593@mail.gmail.com> <a276da400707041005k636319bax582c018c46da00ef@mail.gmail.com> <200707051724.30175.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 7/5/07, Hans Petter Selasky <hselasky@c2i.net> wrote:
> > > > The chip does not handle a clear-stall request on the control pipe to
> > > > clear-stall on the interrupt pipe. The result is that the interrupt
> > > > pipe stops, or at least all buffers are cleared.
> > > >

The following is part of the usb firmware from Micrcohip.

Somehow it masks EP0 in the handler to SET & CLEAR FEATURES
requesrs. Is this the problem?

    if((SetupPkt.bFeature == ENDPOINT_HALT)&&
       (SetupPkt.Recipient == RCPT_EP)&&
       (SetupPkt.EPNum != 0))


/******************************************************************************
 * Function:        void USBStdFeatureReqHandler(void)
 *
 * PreCondition:    None
 *
 * Input:           None
 *
 * Output:          None
 *
 * Side Effects:    None
 *
 * Overview:        This routine handles the standard SET & CLEAR FEATURES
 *                  requests
 *
 * Note:            None
 *****************************************************************************/
void USBStdFeatureReqHandler(void)
{
    if((SetupPkt.bFeature == DEVICE_REMOTE_WAKEUP)&&
       (SetupPkt.Recipient == RCPT_DEV))
    {
        ctrl_trf_session_owner = MUID_USB9;
        if(SetupPkt.bRequest == SET_FEATURE)
            usb_stat.RemoteWakeup = 1;
        else
            usb_stat.RemoteWakeup = 0;
    }//end if

    if((SetupPkt.bFeature == ENDPOINT_HALT)&&
       (SetupPkt.Recipient == RCPT_EP)&&
       (SetupPkt.EPNum != 0))
    {
        ctrl_trf_session_owner = MUID_USB9;
        /* Must do address calculation here */
        pDst.bRam = (byte*)&ep0Bo+(SetupPkt.EPNum*8)+(SetupPkt.EPDir*4);

        if(SetupPkt.bRequest == SET_FEATURE)
            *pDst.bRam = _USIE|_BSTALL;
        else
        {
            if(SetupPkt.EPDir == 1) // IN
                *pDst.bRam = _UCPU;
            else
                *pDst.bRam = _USIE|_DAT0|_DTSEN;
        }//end if
    }//end if
}//end USBStdFeatureReqHandler

Regards,
Xiaofan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a276da400707071725x2b2b8ab3ife6c5459d06042bd>