Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion libraries/USBHost/src/Usb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ uint32_t USBHost::ctrlReq(uint32_t addr, uint32_t ep, uint8_t bmReqType, uint8_t
if (rcode)
{
TRACE_USBHOST(printf("/!\\ USBHost::ctrlReq : EP0 allocation error: %lu\r\n", rcode);)
//USBTRACE2("\n\rUSBHost::ctrlReq : EP0 allocation error: ", rcode");
//USBTRACE2("\n\rUSBHost::ctrlReq : EP0 allocation error: ", rcode");
return rcode;
}

Expand Down Expand Up @@ -263,6 +263,7 @@ uint32_t USBHost::InTransfer(EpInfo *pep, uint32_t nak_limit, uint8_t *nbytesptr
continue;
}
if(rcode) {
uhd_freeze_pipe(pep->epAddr);
//printf(">>>>>>>> Problem! dispatchPkt %2.2x\r\n", rcode);
return(rcode);// break; //should be 0, indicating ACK. Else return error code.
}
Expand Down Expand Up @@ -305,6 +306,7 @@ uint32_t USBHost::InTransfer(EpInfo *pep, uint32_t nak_limit, uint8_t *nbytesptr
break;
} // if
} //while( 1 )
uhd_freeze_pipe(pep->epAddr);
return ( rcode);
}

Expand Down Expand Up @@ -422,6 +424,16 @@ uint32_t USBHost::dispatchPkt(uint32_t token, uint32_t epAddr, uint32_t nak_limi
return 0;
}

//case hrNAK:
if((USB->HOST.HostPipe[epAddr].PINTFLAG.reg & USB_HOST_PINTFLAG_TRFAIL) ) {
USB->HOST.HostPipe[epAddr].PINTFLAG.reg = USB_HOST_PINTFLAG_TRFAIL;
nak_count++;
if(nak_limit && (nak_count == nak_limit)) {
rcode = USB_ERRORFLOW;
return (rcode);
}
}

//case hrNAK:
if( (usb_pipe_table[epAddr].HostDescBank[0].STATUS_BK.reg & USB_ERRORFLOW ) ) {
nak_count++;
Expand Down