summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2011-05-03 17:17:23 +0000
committerRafaël Carré <rafael.carre@gmail.com>2011-05-03 17:17:23 +0000
commitbefabb2bab2736667d681c192bf4cb51b3aca032 (patch)
tree8e6996ed8d6850d03848af03f3eddf1ff9e7a3c3
parent8fa0e13c9f4a4dfe9f1bb4c4d90f6fd257c92223 (diff)
AMSv2 USB: Write usb_delay() in assembly
Ensure no changes when we use different versions of gcc (USB used to panic with gcc 4.6.0) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29818 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/as3525/usb-drv-as3525v2.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/firmware/target/arm/as3525/usb-drv-as3525v2.c b/firmware/target/arm/as3525/usb-drv-as3525v2.c
index 24548f30c5..35b50d21cf 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525v2.c
+++ b/firmware/target/arm/as3525/usb-drv-as3525v2.c
@@ -101,12 +101,14 @@ void usb_attach(void)
static inline void usb_delay(void)
{
- int i = 0;
- while(i < 0x300)
- {
- asm volatile("nop");
- i++;
- }
+ register int i = 0;
+ asm volatile(
+ "1: nop \n"
+ " add %0, %0, #1 \n"
+ " cmp %0, #0x300 \n"
+ " bne 1b \n"
+ : "+r"(i)
+ );
}
static void as3525v2_connect(void)