diff options
| author | Steve Gotthardt <gotthardt@rockbox.org> | 2007-01-04 09:26:32 +0000 |
|---|---|---|
| committer | Steve Gotthardt <gotthardt@rockbox.org> | 2007-01-04 09:26:32 +0000 |
| commit | 26496ce72fae7f5243f6fb2bd81a87528a256995 (patch) | |
| tree | 890cf541c02b790d35b98a5c740530ac000690c2 | |
| parent | e4e42707febffebff730228b05551727420dcdb6 (diff) | |
| download | rockbox-26496ce72fae7f5243f6fb2bd81a87528a256995.zip rockbox-26496ce72fae7f5243f6fb2bd81a87528a256995.tar.gz rockbox-26496ce72fae7f5243f6fb2bd81a87528a256995.tar.bz2 rockbox-26496ce72fae7f5243f6fb2bd81a87528a256995.tar.xz | |
Optimized the timing for the delay and changed the startup delay.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11896 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.c index 39718a4..9e9fcb3 100644 --- a/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.c +++ b/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.c @@ -25,8 +25,8 @@ #define SCL_SDA_HI GPHDAT |= (3 << 9) /* The SC606 can clock at 400KHz: 2.5uS period -> 1.25uS half period */ -/* At 300Mhz - if loop takes 6 cycles @ 3.3nS each -> 1.25uS / 20nS -> 63 */ -#define DELAY do { volatile int _x; for(_x=0;_x<63;_x++);} while (0) +/* At 300Mhz - if loop takes 10 cycles @ 3.3nS each -> 1.25uS / 30nS -> 40 */ +#define DELAY do { volatile int _x; for(_x=0;_x<40;_x++);} while (0) static void sc606_i2c_start(void) { @@ -164,6 +164,8 @@ int sc606_read(unsigned char reg, unsigned char* data) void sc606_init(void) { + volatile int i; + /* Set GPB2 (EN) to 1 */ GPBCON = (GPBCON & ~(3<<4)) | 1<<4; @@ -172,11 +174,10 @@ void sc606_init(void) /* OFF GPBDAT &= ~(1 << 2); */ /* About 400us - needs 350us */ - DELAY; - DELAY; - DELAY; - DELAY; - DELAY; + for (i = 200; i; i--) + { + DELAY; + } /* Set GPH9 (SDA) and GPH10 (SCL) to 1 */ GPHUP &= ~(3<<9); |