diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2007-06-27 03:11:49 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2007-06-27 03:11:49 +0000 |
commit | 070417d152c5c7ab8a8a16848671f56713467683 (patch) | |
tree | 7c17cf8438d880a21dd7e993161b68bf8c40ad32 /firmware/target/coldfire/iriver/h100 | |
parent | 1092268614ca6f6a63aa41152362861e7b7421a9 (diff) | |
download | rockbox-070417d152c5c7ab8a8a16848671f56713467683.tar.gz rockbox-070417d152c5c7ab8a8a16848671f56713467683.zip |
Forget all the nonsense with C delay loops. 'volatile' on the variable makes bloated code and a volatile, blank asm block inside may or may not be optimized out. Use asm delay loops instead for Coldfire. Radio i2c driver also needs NACK after reading last tuner byte. Get the volatile off the Ondio loops (not needed here now). Maybe this is straightened out now.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13725 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire/iriver/h100')
-rw-r--r-- | firmware/target/coldfire/iriver/h100/adc-h100.c | 12 | ||||
-rw-r--r-- | firmware/target/coldfire/iriver/h100/sw_i2c-h100.c | 12 |
2 files changed, 22 insertions, 2 deletions
diff --git a/firmware/target/coldfire/iriver/h100/adc-h100.c b/firmware/target/coldfire/iriver/h100/adc-h100.c index a20b1e8d30..fb5afce9f5 100644 --- a/firmware/target/coldfire/iriver/h100/adc-h100.c +++ b/firmware/target/coldfire/iriver/h100/adc-h100.c @@ -34,7 +34,17 @@ static unsigned char adcdata[NUM_ADC_CHANNELS]; #define DI_HI or_l(0x00200000, &GPIO_OUT) /* delay loop */ -#define DELAY do { int _x; for(_x=0;_x<10;_x++) asm volatile ("");} while (0) +#define DELAY \ + ({ \ + int _x_; \ + asm volatile ( \ + "move.l #9, %[_x_] \r\n" \ + "1: \r\n" \ + "subq.l #1, %[_x_] \r\n" \ + "bhi.b 1b \r\n" \ + : [_x_]"=&d"(_x_) \ + ); \ + }) unsigned short adc_scan(int channel) { 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) { |