diff options
Diffstat (limited to 'firmware/target/coldfire/iriver/h100/sw_i2c-h100.c')
-rw-r--r-- | firmware/target/coldfire/iriver/h100/sw_i2c-h100.c | 12 |
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 @@ #define SDA_HI and_l(~0x00002000, &GPIO1_ENABLE) /* delay loop to achieve 400kHz at 120MHz CPU frequency */ -#define DELAY do { volatile int _x; for(_x=0;_x<22;_x++);} while(0) +#define DELAY \ + ({ \ + int _x_; \ + asm volatile ( \ + "move.l #21, %[_x_] \r\n" \ + "1: \r\n" \ + "subq.l #1, %[_x_] \r\n" \ + "bhi.b 1b \r\n" \ + : [_x_]"=&d"(_x_) \ + ); \ + }) void sw_i2c_init(void) { |