summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/iriver/h100/sw_i2c-h100.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/coldfire/iriver/h100/sw_i2c-h100.c')
-rw-r--r--firmware/target/coldfire/iriver/h100/sw_i2c-h100.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/firmware/target/coldfire/iriver/h100/sw_i2c-h100.c b/firmware/target/coldfire/iriver/h100/sw_i2c-h100.c
index 49db2b621d..3b2cdc4042 100644
--- a/firmware/target/coldfire/iriver/h100/sw_i2c-h100.c
+++ b/firmware/target/coldfire/iriver/h100/sw_i2c-h100.c
@@ -42,7 +42,17 @@
42#define SDA_HI and_l(~0x00002000, &GPIO1_ENABLE) 42#define SDA_HI and_l(~0x00002000, &GPIO1_ENABLE)
43 43
44/* delay loop to achieve 400kHz at 120MHz CPU frequency */ 44/* delay loop to achieve 400kHz at 120MHz CPU frequency */
45#define DELAY do { volatile int _x; for(_x=0;_x<22;_x++);} while(0) 45#define DELAY \
46 ({ \
47 int _x_; \
48 asm volatile ( \
49 "move.l #21, %[_x_] \r\n" \
50 "1: \r\n" \
51 "subq.l #1, %[_x_] \r\n" \
52 "bhi.b 1b \r\n" \
53 : [_x_]"=&d"(_x_) \
54 ); \
55 })
46 56
47void sw_i2c_init(void) 57void sw_i2c_init(void)
48{ 58{