This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

USB DMA: how many bytes are received?

Hi,

I've written a small programm using usb bulktransfer with dma support for the LPC17xx processor. My starting point was the USB-HID example from Keil.

I'm able to tx pkts to the host device and I also get the notification from the dma if the LPC processor received a usb pkt. So far so good: Do you know if there's an option or register where the dma will let me know how many bytes are received?

#define CDC_DEP_OUT 0x02


void USB_EndPoint2 (unsigned int event)
{
  unsigned int status=0;
  unsigned int num, nxt;
  USB_DMA_DESCRIPTOR DD, *pDD;

  /* End of Transfer */
  if(event == USB_EVT_OUT_DMA_EOT)
  {     /* End of Transfer */

    if (USB_DMA_BufAdr(CDC_DEP_OUT) != ((unsigned int)DataBuf + DataInBuf))
    { /* Data Available */

      status = USB_DMA_Status(CDC_DEP_OUT);
      num = EPAdr(CDC_DEP_OUT);
      nxt = UDCA[num];
      pDD = (USB_DMA_DESCRIPTOR *)nxt;

      /* update index to the next dma data buffer */
      DataBuf += DMA_BUF_SIZEOF;
      if(DataBuf == DMA_EP_BUF_SIZE)
         DataBuf = 0;

    }
  }
}

I thought that the USB_DMA_DESCRIPTOR will contain some additional information about the usb-dma-transfer from the host to my LPC usb device controller. Unfortunatley I couldn't found anything helpful in this struct.

best regards
Lars

0