summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorlaforge <laforge@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2006-10-04 17:56:57 +0000
committerlaforge <laforge@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2006-10-04 17:56:57 +0000
commitd1dd3611ea59cf0c61d66d124a85709573cb7f61 (patch)
treeaa790487cbc82fddea41420d017814a0314e3602 /firmware
parenta2f768dd5faf13e770a454cda623eda068115394 (diff)
v0.4 of the readers uses a different pin for the USB pullup
git-svn-id: https://svn.openpcd.org:2342/trunk@261 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'firmware')
-rw-r--r--firmware/src/dfu/dfu.c2
-rw-r--r--firmware/src/openpcd.h2
-rw-r--r--firmware/src/os/dbgu.c4
-rw-r--r--firmware/src/os/pcd_enumerate.c18
-rw-r--r--firmware/src/os/pcd_enumerate.h3
5 files changed, 25 insertions, 4 deletions
diff --git a/firmware/src/dfu/dfu.c b/firmware/src/dfu/dfu.c
index 97e4a72..dc97624 100644
--- a/firmware/src/dfu/dfu.c
+++ b/firmware/src/dfu/dfu.c
@@ -79,6 +79,7 @@ static void __dfufunc udp_init(void)
/* Enable UDP PullUp (USB_DP_PUP) : enable & Clear of the
* corresponding PIO Set in PIO mode and Configure in Output */
AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, OPENPCD_PIO_UDP_PUP);
+ AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, OPENPCD_PIO_UDP_PUPv4);
}
/* Send Data through the control endpoint */
@@ -887,6 +888,7 @@ void __dfufunc dfu_main(void)
/* Clear for set the Pull up resistor */
AT91F_PIO_SetOutput(AT91C_BASE_PIOA, OPENPCD_PIO_UDP_PUP);
+ AT91F_PIO_ClearOutput(AT91C_BASE_PIOA, OPENPCD_PIO_UDP_PUPv4);
flash_init();
diff --git a/firmware/src/openpcd.h b/firmware/src/openpcd.h
index f17b16e..f84f121 100644
--- a/firmware/src/openpcd.h
+++ b/firmware/src/openpcd.h
@@ -19,6 +19,7 @@
#if defined(PCD)
#define OPENPCD_PIO_UDP_CNX AT91C_PIO_PA15
#define OPENPCD_PIO_UDP_PUP AT91C_PIO_PA22
+#define OPENPCD_PIO_UDP_PUPv4 AT91C_PIO_PA16
#define OPENPCD_PIO_LED1 AT91C_PIO_PA25
#define OPENPCD_PIO_LED2 AT91C_PIO_PA26
#define PIO_BOOTLDR AT91C_PIO_PA27
@@ -35,6 +36,7 @@
#endif
#endif
+
#define OPENPCD_IRQ_RC632 AT91C_ID_IRQ1
/* PIO A mapping for OpenPCD v0.2
diff --git a/firmware/src/os/dbgu.c b/firmware/src/os/dbgu.c
index a3a5941..e71b62e 100644
--- a/firmware/src/os/dbgu.c
+++ b/firmware/src/os/dbgu.c
@@ -85,10 +85,10 @@ static void DBGU_irq_handler(u_int32_t sr)
case '0': //* info
AT91F_DBGU_Frame("Clear Pull up\n\r");
// Set
- AT91F_PIO_ClearOutput(AT91C_BASE_PIOA, OPENPCD_PIO_UDP_PUP);
+ udp_pullup_on();
break;
case '1': //* info
- AT91F_PIO_SetOutput(AT91C_BASE_PIOA, OPENPCD_PIO_UDP_PUP);
+ udp_pullup_off();
AT91F_DBGU_Printk("Set Pull up\n\r");
// Reset Application
Send_reset();
diff --git a/firmware/src/os/pcd_enumerate.c b/firmware/src/os/pcd_enumerate.c
index 24b2874..f201a32 100644
--- a/firmware/src/os/pcd_enumerate.c
+++ b/firmware/src/os/pcd_enumerate.c
@@ -487,6 +487,18 @@ out:
AT91F_AIC_ClearIt(AT91C_BASE_AIC, AT91C_ID_UDP);
}
+void udp_pullup_on(void)
+{
+ AT91F_PIO_SetOutput(AT91C_BASE_PIOA, OPENPCD_PIO_UDP_PUP);
+ AT91F_PIO_ClearOutput(AT91C_BASE_PIOA, OPENPCD_PIO_UDP_PUPv4);
+}
+
+void udp_pullup_off(void)
+{
+ AT91F_PIO_ClearOutput(AT91C_BASE_PIOA, OPENPCD_PIO_UDP_PUP);
+ AT91F_PIO_SetOutput(AT91C_BASE_PIOA, OPENPCD_PIO_UDP_PUPv4);
+}
+
/* Open USB Device Port */
void udp_open(void)
{
@@ -508,16 +520,18 @@ void udp_open(void)
/* Set the Pull up resistor */
AT91F_PIO_SetOutput(AT91C_BASE_PIOA, OPENPCD_PIO_UDP_PUP);
+ AT91F_PIO_ClearOutput(AT91C_BASE_PIOA, OPENPCD_PIO_UDP_PUPv4);
+ udp_pullup_on();
}
void udp_reset(void)
{
volatile int i;
- AT91F_PIO_ClearOutput(AT91C_BASE_PIOA, OPENPCD_PIO_UDP_PUP);
+ udp_pullup_off();
for (i = 0; i < 0xffff; i++)
;
- AT91F_PIO_SetOutput(AT91C_BASE_PIOA, OPENPCD_PIO_UDP_PUP);
+ udp_pullup_on();
}
#ifdef DEBUG_UDP_EP0
diff --git a/firmware/src/os/pcd_enumerate.h b/firmware/src/os/pcd_enumerate.h
index b2af3a1..ae15dc0 100644
--- a/firmware/src/os/pcd_enumerate.h
+++ b/firmware/src/os/pcd_enumerate.h
@@ -21,6 +21,9 @@ extern int udp_refill_ep(int ep);
extern void udp_unthrottle(void);
extern void udp_reset(void);
+extern void udp_pullup_off(void);
+extern void udp_pullup_on(void);
+
struct ep_ctx {
atomic_t pkts_in_transit;
struct {
personal git repositories of Harald Welte. Your mileage may vary