summaryrefslogtreecommitdiff
path: root/firmware/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2011-07-07 17:43:55 +0200
committerHarald Welte <laforge@gnumonks.org>2011-07-07 17:43:55 +0200
commita23eefc6dc5f45498116f69125f6e12f53a81130 (patch)
tree2a465aeefd3a476715fac2d4fd12eb99d1300613 /firmware/src
parentfe88b83e80df8be0351ff38ee6a77b855b0cd0a9 (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')
-rw-r--r--firmware/src/os/pcd_enumerate.c49
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;
personal git repositories of Harald Welte. Your mileage may vary