diff options
author | Harald Welte <laforge@gnumonks.org> | 2011-07-07 17:43:55 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-07-07 17:57:01 +0200 |
commit | dd88fde8d2b78243c01871cabca37c9e46ebd03d (patch) | |
tree | f3184ebc7c4fd1119ae3749261b34254817775ef /firmware/src/os/pcd_enumerate.c | |
parent | 8cc090e310545f7858558f74116f707318daf682 (diff) |
USB driver: use the DFU-provided function to send EP0 data
There is no point in replicating the functionality that already
exists in the DFU section of the flash
Diffstat (limited to 'firmware/src/os/pcd_enumerate.c')
-rw-r--r-- | firmware/src/os/pcd_enumerate.c | 49 |
1 files changed, 1 insertions, 48 deletions
diff --git a/firmware/src/os/pcd_enumerate.c b/firmware/src/os/pcd_enumerate.c index b4392c0..a195267 100644 --- a/firmware/src/os/pcd_enumerate.c +++ b/firmware/src/os/pcd_enumerate.c @@ -78,7 +78,7 @@ #ifdef CONFIG_DFU static const struct dfuapi *dfu = DFU_API_LOCATION; #define udp_init dfu->udp_init -//#define udp_ep0_send_data dfu->ep0_send_data +#define udp_ep0_send_data dfu->ep0_send_data #define udp_ep0_send_zlp dfu->ep0_send_zlp #define udp_ep0_send_stall dfu->ep0_send_stall #else @@ -107,53 +107,6 @@ static const struct epstate epstate[] = { .state_pending = RCTX_STATE_UDP_EP3_PENDING }, }; -/* Send Data through the control endpoint */ -static void udp_ep0_send_data(const char *pData, u_int32_t length) -{ - AT91PS_UDP pUdp = AT91C_BASE_UDP; - u_int32_t cpt = 0; - AT91_REG csr; - - DEBUGE("send_data: %u bytes ", length); - - do { - cpt = MIN(length, 8); - length -= cpt; - - DEBUGE("fifo_fill "); - while (cpt--) - pUdp->UDP_FDR[0] = *pData++; - - if (pUdp->UDP_CSR[0] & AT91C_UDP_TXCOMP) { - DEBUGE("wait_txcomp_clear "); - pUdp->UDP_CSR[0] &= ~(AT91C_UDP_TXCOMP); - while (pUdp->UDP_CSR[0] & AT91C_UDP_TXCOMP) ; - } - - DEBUGE("set_txpktrdy "); - pUdp->UDP_CSR[0] |= AT91C_UDP_TXPKTRDY; - DEBUGE("wait_txcomp "); - do { - csr = pUdp->UDP_CSR[0]; - - /* Data IN stage has been stopped by a status OUT */ - if (csr & AT91C_UDP_RX_DATA_BK0) { - pUdp->UDP_CSR[0] &= ~(AT91C_UDP_RX_DATA_BK0); - DEBUGE("stopped by status out "); - return; - } - } while (!(csr & AT91C_UDP_TXCOMP)); - - } while (length); - - DEBUGE("clear_txcomp "); - if (pUdp->UDP_CSR[0] & AT91C_UDP_TXCOMP) { - pUdp->UDP_CSR[0] &= ~(AT91C_UDP_TXCOMP); - while (pUdp->UDP_CSR[0] & AT91C_UDP_TXCOMP) ; - } - DEBUGE("done "); -} - static void reset_ep(unsigned int ep) { AT91PS_UDP pUDP = upcd.pUdp; |