From a23eefc6dc5f45498116f69125f6e12f53a81130 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 7 Jul 2011 17:43:55 +0200 Subject: 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 --- firmware/src/os/pcd_enumerate.c | 49 +---------------------------------------- 1 file changed, 1 insertion(+), 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; -- cgit v1.2.3