forked from len0rd/rockbox
Telechips I2C: Scale the busy-wait delay based on FREQ, reducing wasted CPU cycles when unboosted (eg. when reading from the D2 touchscreen).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19293 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
8da8159f74
commit
e70096ea5c
1 changed files with 7 additions and 2 deletions
|
|
@ -24,8 +24,13 @@
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
#include "i2c-target.h"
|
#include "i2c-target.h"
|
||||||
|
|
||||||
/* arbitrary delay loop */
|
/* Delay loop based on CPU frequency (FREQ>>22 is 7..45 for 32MHz..192MHz) */
|
||||||
#define DELAY do { int _x; for(_x=0;_x<40;_x++);} while (0)
|
static inline void delay_loop(void)
|
||||||
|
{
|
||||||
|
unsigned long x;
|
||||||
|
for (x = (unsigned)(FREQ>>22); x; x--);
|
||||||
|
}
|
||||||
|
#define DELAY delay_loop()
|
||||||
|
|
||||||
static struct mutex i2c_mtx;
|
static struct mutex i2c_mtx;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue