mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
Use ping-pong mode from the start of usb_write()
Before: 708608,708608,707584,707584,708608->708198.4 bytes/s After: 722944,733184,732160,731136,733184->730521.6 bytes/s Added some note for ping-pong mode and non ping-pong mode
This commit is contained in:
parent
96dc4be112
commit
a0af1fa085
1 changed files with 5 additions and 3 deletions
|
@ -777,7 +777,7 @@ int usb_write(const uint8_t *data, const size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
UDP_SET_EP_FLAGS(AT91C_EP_IN, AT91C_UDP_TXPKTRDY);
|
UDP_SET_EP_FLAGS(AT91C_EP_IN, AT91C_UDP_TXPKTRDY);
|
||||||
while (pUdp->UDP_CSR[AT91C_EP_IN] & AT91C_UDP_TXPKTRDY) {};
|
while (!(pUdp->UDP_CSR[AT91C_EP_IN] & AT91C_UDP_TXPKTRDY)) {};
|
||||||
|
|
||||||
while (length) {
|
while (length) {
|
||||||
// Send next chunk
|
// Send next chunk
|
||||||
|
@ -810,9 +810,9 @@ int usb_write(const uint8_t *data, const size_t len) {
|
||||||
|
|
||||||
|
|
||||||
if (len % AT91C_EP_IN_SIZE == 0) {
|
if (len % AT91C_EP_IN_SIZE == 0) {
|
||||||
|
// like AT91F_USB_SendZlp(), in non ping-pong mode
|
||||||
UDP_SET_EP_FLAGS(AT91C_EP_IN, AT91C_UDP_TXPKTRDY);
|
UDP_SET_EP_FLAGS(AT91C_EP_IN, AT91C_UDP_TXPKTRDY);
|
||||||
while (!(pUdp->UDP_CSR[AT91C_EP_IN] & AT91C_UDP_TXPKTRDY)) {};
|
while (!(pUdp->UDP_CSR[AT91C_EP_IN] & AT91C_UDP_TXCOMP)) {};
|
||||||
|
|
||||||
UDP_CLEAR_EP_FLAGS(AT91C_EP_IN, AT91C_UDP_TXCOMP);
|
UDP_CLEAR_EP_FLAGS(AT91C_EP_IN, AT91C_UDP_TXCOMP);
|
||||||
while (pUdp->UDP_CSR[AT91C_EP_IN] & AT91C_UDP_TXCOMP) {};
|
while (pUdp->UDP_CSR[AT91C_EP_IN] & AT91C_UDP_TXCOMP) {};
|
||||||
|
@ -869,6 +869,8 @@ void AT91F_USB_SendData(AT91PS_UDP pudp, const char *pData, uint32_t length) {
|
||||||
//*----------------------------------------------------------------------------
|
//*----------------------------------------------------------------------------
|
||||||
void AT91F_USB_SendZlp(AT91PS_UDP pudp) {
|
void AT91F_USB_SendZlp(AT91PS_UDP pudp) {
|
||||||
UDP_SET_EP_FLAGS(AT91C_EP_CONTROL, AT91C_UDP_TXPKTRDY);
|
UDP_SET_EP_FLAGS(AT91C_EP_CONTROL, AT91C_UDP_TXPKTRDY);
|
||||||
|
// for non ping-pong operation, wait until the FIFO is released
|
||||||
|
// the flag for FIFO released is AT91C_UDP_TXCOMP rather than AT91C_UDP_TXPKTRDY
|
||||||
while (!(pudp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_TXCOMP)) {};
|
while (!(pudp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_TXCOMP)) {};
|
||||||
UDP_CLEAR_EP_FLAGS(AT91C_EP_CONTROL, AT91C_UDP_TXCOMP);
|
UDP_CLEAR_EP_FLAGS(AT91C_EP_CONTROL, AT91C_UDP_TXCOMP);
|
||||||
while (pudp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_TXCOMP) {};
|
while (pudp->UDP_CSR[AT91C_EP_CONTROL] & AT91C_UDP_TXCOMP) {};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue