Hi
ReadReqEP() sets up the DMA descriptors in preparation for transferring data from memory to the USB controller. Then it primes the endpoint.
ReadEP() only returns the total bytes transferred once the DMA operation is complete. It does nothing with the data buffer pointer passed in.
NAKs are the throttling mechanism on a USB bus. If the CPU is slower at generating data that the USB is at shipping it out then NAKs provide a convenient and legal way to tell the host to wait for more data to arrive.
The best way to call these functions is:
Call ReadReqEP() once to get the stream started
Call ReadEP() following the receipt of an IN completion, then call ReadReqEP() to get the next transfer started.
Call ReadReqEP() any time a NAK is received.
Thanks,
Jun Zhang