Bob Liu wrote: > Hi, All > > I am reading musb_gadget's code these days and got this > problem about it. > > Function musb_g_tx() may send out zero packet. > but ifdefined CONFIG_USB_INVENTRA_DMA and mode0 is used, every time > musb_g_tx() will send out zero packet. > I think it's wrong, we should should out zero packet > only when (request->zero && request->length && request->length % musb_ep->packet_sz == 0) > whether use inventra dma or not. > > Thanks ! Hi Bob, Not 100% sure, but the non-Inventra DMA engines may send out the terminating short packet automatically. (at least, that's what the comments say). For the Inventra DMA, if we program DMA to move something like (n * max_packet + short_packet) bytes to the FIFO, then the DMA engine will automatically set the TXPKTRDY bits for each of the max_packet sized packets, but not for the short_packet. This fragment of code sets the TXPKTRDY bit for the short packet if Tx is used. The comment/prints are misleading - it's not only for sending out the ZLP. I'll try and cook up a patch to correct this. - Anand ��.n��������+%������w��{.n�����{���)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥