Discard data loaded in BULK-IN buffer AN2131

Version 1
    Question: During a multiple-packet BULK-IN data transfer, the Host wants to cancel the transfer. Is there a way to discard the data packet already been loaded into the BULK-IN buffer? The problem is that the INxBC has been loaded with count of bytes in the INxBuf, but the Host stops issuing IN-Tokens until the cancellation completes. If that data packet is not cleared, the Host will read it as obsolete/incorrect data after the cancel. According to the TRM, it looks like the BUSY bits in INxCS is cleared by the EZ-USB core. Is there a way/procedure to reset the BUSY bits in INxCS in the program?



    If the pipe is not to be disturbed then, the Host application will need to "Flush" the IN buffer until it NAKs. Therefore, if the Host application tells the firmware to clear the buffer, the Host will need to perform INs until NAKs are received prior to the firmware placing a new set of packets into the buffer.

    However, if a USB Reset has occurred or and alternate interface is selected, the endpoint can be cleared of its previously armed packet by writing a '1' to the INxCS INxBSY bit to clear the bit. If the endpoint is paired, then each endpoint in the pair must have its busy bit cleared. Additionally, if an application specific set of commands can be used, then vendor requests and acknowledges may be programmed to allow the firmware to perform the reset sequence.