I have been unable to get any setup/control packets from USB as of yet. The only return value I see from USB_GetSetupPacket is XUD_RES_RST. Is it obvious what I am missing? Please let me know if more information is helpful. I currently only have endpoint 0 defined. I have not gotten different results if I add more endpoints.
Below is my very simple program, build with "-g -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DUSB_TILE=tile[1]."
Thanks in advance for any help!
Best,
Bryant
Code: Select all
int main ( void )
{
chan xudOutChans[Num_USBEndpointsOut];
chan xudInChans[Num_USBEndpointsIn];
par
{
on USB_TILE: xud(xudOutChans, Num_USBEndpointsOut,
xudInChans, Num_USBEndpointsIn,
null,
XUD_SPEED_FS, XUD_PWR_SELF);
on USB_TILE: USBControlEndpoint(xudOutChans[USBEndpointsOut_Control], xudInChans[USBEndpointsIn_Control]);
}
return 0;
}
#define USB_HIST_SIZE 32
int usbReqHist[USB_HIST_SIZE] = {77};
int usbReqHistIt = 0;
int usbResets = 0;
void USBControlEndpoint(chanend outChan, chanend inChan)
{
XUD_Result_t xudRes;
XUD_ep outXUD = XUD_InitEp(outChan, XUD_EPTYPE_CTL | XUD_STATUS_ENABLE);
XUD_ep inXUD = XUD_InitEp(inChan, XUD_EPTYPE_CTL | XUD_STATUS_ENABLE);
USB_SetupPacket_t setupPkt;
XUD_BusSpeed_t usbSpeed = XUD_SPEED_HS;
while (1)
{
xudRes = USB_GetSetupPacket(outXUD, inXUD, setupPkt);
if (XUD_RES_RST == xudRes)
{
usbSpeed = XUD_ResetEndpoint(outXUD, inXUD);
++usbResets;
}
else
{
if (XUD_RES_OKAY == xudRes)
{
if (usbReqHistIt < USB_HIST_SIZE)
{
usbReqHist[usbReqHistIt] = setupPkt.bRequest;
++usbReqHistIt;
}
}
}
} // while (1)
return;
}