diff options
author | Marcoen Hirschberg <marcoen@gmail.com> | 2006-12-29 02:49:12 +0000 |
---|---|---|
committer | Marcoen Hirschberg <marcoen@gmail.com> | 2006-12-29 02:49:12 +0000 |
commit | 295367686ec9855c4d90f68a6003e819fef8e7ab (patch) | |
tree | b4077ffb8d2283bf199ad12a90322be77040c2fd /firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.c | |
parent | 995a804defda23233ccbdd859023f4ba3ecba0bf (diff) | |
download | rockbox-295367686ec9855c4d90f68a6003e819fef8e7ab.tar.gz rockbox-295367686ec9855c4d90f68a6003e819fef8e7ab.zip |
merge a big part of the unofficial gigabeat cvs back. Includes working bootloader and rockbox with audio.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11850 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.c')
-rw-r--r-- | firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.c | 23 |
1 files changed, 13 insertions, 10 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 b0554a8260..39718a4ec6 100644 --- a/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.c +++ b/firmware/target/arm/gigabeat/meg-fx/sc606-meg-fx.c | |||
@@ -24,10 +24,11 @@ | |||
24 | 24 | ||
25 | #define SCL_SDA_HI GPHDAT |= (3 << 9) | 25 | #define SCL_SDA_HI GPHDAT |= (3 << 9) |
26 | 26 | ||
27 | /* arbitrary delay loop */ | 27 | /* The SC606 can clock at 400KHz: 2.5uS period -> 1.25uS half period */ |
28 | #define DELAY do { int _x; for(_x=0;_x<2000;_x++);} while (0) | 28 | /* At 300Mhz - if loop takes 6 cycles @ 3.3nS each -> 1.25uS / 20nS -> 63 */ |
29 | #define DELAY do { volatile int _x; for(_x=0;_x<63;_x++);} while (0) | ||
29 | 30 | ||
30 | void sc606_i2c_start(void) | 31 | static void sc606_i2c_start(void) |
31 | { | 32 | { |
32 | SCL_SDA_HI; | 33 | SCL_SDA_HI; |
33 | DELAY; | 34 | DELAY; |
@@ -36,7 +37,7 @@ void sc606_i2c_start(void) | |||
36 | SCL_LO; | 37 | SCL_LO; |
37 | } | 38 | } |
38 | 39 | ||
39 | void sc606_i2c_restart(void) | 40 | static void sc606_i2c_restart(void) |
40 | { | 41 | { |
41 | SCL_SDA_HI; | 42 | SCL_SDA_HI; |
42 | DELAY; | 43 | DELAY; |
@@ -45,7 +46,7 @@ void sc606_i2c_restart(void) | |||
45 | SCL_LO; | 46 | SCL_LO; |
46 | } | 47 | } |
47 | 48 | ||
48 | void sc606_i2c_stop(void) | 49 | static void sc606_i2c_stop(void) |
49 | { | 50 | { |
50 | SDA_LO; | 51 | SDA_LO; |
51 | DELAY; | 52 | DELAY; |
@@ -55,7 +56,7 @@ void sc606_i2c_stop(void) | |||
55 | DELAY; | 56 | DELAY; |
56 | } | 57 | } |
57 | 58 | ||
58 | void sc606_i2c_ack(void) | 59 | static void sc606_i2c_ack(void) |
59 | { | 60 | { |
60 | 61 | ||
61 | SDA_LO; | 62 | SDA_LO; |
@@ -64,11 +65,11 @@ void sc606_i2c_ack(void) | |||
64 | SCL_LO; | 65 | SCL_LO; |
65 | } | 66 | } |
66 | 67 | ||
67 | int sc606_i2c_getack(void) | 68 | static int sc606_i2c_getack(void) |
68 | { | 69 | { |
69 | int ret = 0; | 70 | int ret = 0; |
70 | 71 | ||
71 | /* Don't need a delay since this follows a data bit with a delay on the end */ | 72 | /* Don't need a delay since follows a data bit with a delay on the end */ |
72 | SDA_INPUT; /* And set to input */ | 73 | SDA_INPUT; /* And set to input */ |
73 | SCL_HI; | 74 | SCL_HI; |
74 | DELAY; | 75 | DELAY; |
@@ -83,7 +84,7 @@ int sc606_i2c_getack(void) | |||
83 | return ret; | 84 | return ret; |
84 | } | 85 | } |
85 | 86 | ||
86 | int sc606_i2c_outb(unsigned char byte) | 87 | static int sc606_i2c_outb(unsigned char byte) |
87 | { | 88 | { |
88 | int i; | 89 | int i; |
89 | 90 | ||
@@ -106,7 +107,7 @@ int sc606_i2c_outb(unsigned char byte) | |||
106 | return sc606_i2c_getack(); | 107 | return sc606_i2c_getack(); |
107 | } | 108 | } |
108 | 109 | ||
109 | unsigned char sc606_i2c_inb(void) | 110 | static unsigned char sc606_i2c_inb(void) |
110 | { | 111 | { |
111 | int i; | 112 | int i; |
112 | unsigned char byte = 0; | 113 | unsigned char byte = 0; |
@@ -128,6 +129,8 @@ unsigned char sc606_i2c_inb(void) | |||
128 | return byte; | 129 | return byte; |
129 | } | 130 | } |
130 | 131 | ||
132 | |||
133 | |||
131 | int sc606_write(unsigned char reg, unsigned char data) | 134 | int sc606_write(unsigned char reg, unsigned char data) |
132 | { | 135 | { |
133 | int x = 0; | 136 | int x = 0; |