Recover from OUT-NAK

This commit is contained in:
Yuuichi Akagawa 2021-03-26 14:43:31 +09:00
parent a321ad36ab
commit 82df4b990e

View file

@ -388,6 +388,11 @@ uint8_t USB::OutTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t nbytes, uint8
data_p += bytes_tosend; data_p += bytes_tosend;
}//while( bytes_left... }//while( bytes_left...
breakout: breakout:
/* If rcode(=rHRSL) is non-zero, untransmitted data remains in the SNDFIFO. */
if(rcode != 0) {
//Switch the FIFO containing the OUT data back under microcontroller control and reset pointer.
regWr(rSNDBC, 0);
}
pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 1 : 0; //bmSNDTOG1 : bmSNDTOG0; //update toggle pep->bmSndToggle = (regRd(rHRSL) & bmSNDTOGRD) ? 1 : 0; //bmSNDTOG1 : bmSNDTOG0; //update toggle
return ( rcode); //should be 0 in all cases return ( rcode); //should be 0 in all cases