Re-write the Telechips I2C delay routine in assembler to stop the compiler optimising it away. Tested with EABI and non-EABI compilers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26872 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
ff8e76e9e5
commit
6c94ce590d
1 changed files with 4 additions and 3 deletions
|
@ -27,9 +27,10 @@
|
||||||
/* Delay loop based on CPU frequency (FREQ>>22 is 7..45 for 32MHz..192MHz) */
|
/* Delay loop based on CPU frequency (FREQ>>22 is 7..45 for 32MHz..192MHz) */
|
||||||
static inline void delay_loop(void)
|
static inline void delay_loop(void)
|
||||||
{
|
{
|
||||||
unsigned long x;
|
asm volatile (" mov %[freq], %[freq], asr#22 \n\t"
|
||||||
for (x = (unsigned)(FREQ>>22); x; x--)
|
"1: subs %[freq], %[freq], #1 \n\t"
|
||||||
asm volatile("nop");
|
" bne 1b"
|
||||||
|
: : [freq] "r" (cpu_frequency) : "memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DELAY delay_loop()
|
#define DELAY delay_loop()
|
||||||
|
|
Loading…
Reference in a new issue