diff options
-rw-r--r-- | firmware/SOURCES | 4 | ||||
-rw-r--r-- | firmware/drivers/i2c-coldfire.c (renamed from firmware/drivers/i2c-h100.c) | 34 | ||||
-rw-r--r-- | firmware/export/config-h100.h | 3 | ||||
-rw-r--r-- | firmware/export/config-h120.h | 3 | ||||
-rw-r--r-- | firmware/export/config-h300.h | 3 | ||||
-rw-r--r-- | firmware/export/config-iaudiox5.h | 5 | ||||
-rw-r--r-- | firmware/export/config.h | 3 | ||||
-rw-r--r-- | firmware/export/i2c-coldfire.h (renamed from firmware/export/i2c-h100.h) | 6 |
8 files changed, 32 insertions, 29 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index 06b4ce0765..937bb0bfb6 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -79,8 +79,8 @@ drivers/fmradio_i2c.c | |||
79 | tuner_philips.c | 79 | tuner_philips.c |
80 | #endif | 80 | #endif |
81 | #endif | 81 | #endif |
82 | #if CONFIG_I2C == I2C_H100 | 82 | #if CONFIG_I2C == I2C_COLDFIRE |
83 | drivers/i2c-h100.c | 83 | drivers/i2c-coldfire.c |
84 | #else | 84 | #else |
85 | drivers/i2c.c | 85 | drivers/i2c.c |
86 | #endif | 86 | #endif |
diff --git a/firmware/drivers/i2c-h100.c b/firmware/drivers/i2c-coldfire.c index c50cd7ed0a..5b4f4a1830 100644 --- a/firmware/drivers/i2c-h100.c +++ b/firmware/drivers/i2c-coldfire.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "kernel.h" | 21 | #include "kernel.h" |
22 | #include "debug.h" | 22 | #include "debug.h" |
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "i2c-h100.h" | 24 | #include "i2c-coldfire.h" |
25 | 25 | ||
26 | #define I2C_DEVICE_1 ((volatile unsigned char *)&MADR) | 26 | #define I2C_DEVICE_1 ((volatile unsigned char *)&MADR) |
27 | #define I2C_DEVICE_2 ((volatile unsigned char *)&MADR2) | 27 | #define I2C_DEVICE_2 ((volatile unsigned char *)&MADR2) |
@@ -37,6 +37,7 @@ static volatile unsigned char *i2c_get_addr(int device); | |||
37 | 37 | ||
38 | void i2c_init(void) | 38 | void i2c_init(void) |
39 | { | 39 | { |
40 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) | ||
40 | /* Audio Codec */ | 41 | /* Audio Codec */ |
41 | MADR = 0x6c; /* iRiver firmware uses this addr */ | 42 | MADR = 0x6c; /* iRiver firmware uses this addr */ |
42 | MBDR = 0; /* iRiver firmware does this */ | 43 | MBDR = 0; /* iRiver firmware does this */ |
@@ -48,22 +49,21 @@ void i2c_init(void) | |||
48 | MBDR2 = 0; | 49 | MBDR2 = 0; |
49 | MBCR2 = IEN; | 50 | MBCR2 = IEN; |
50 | #endif | 51 | #endif |
52 | |||
53 | #endif | ||
51 | } | 54 | } |
52 | 55 | ||
53 | void i2c_close(void) | 56 | void i2c_close(void) |
54 | { | 57 | { |
55 | MBCR = 0; | 58 | MBCR = 0; |
56 | |||
57 | #if 0 | ||
58 | MBCR2 = 0; | 59 | MBCR2 = 0; |
59 | #endif | ||
60 | } | 60 | } |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Writes bytes to the selected device. | 63 | * Writes bytes to the selected device. |
64 | * | 64 | * |
65 | * Use device=1 for bus 1 at 0x40000280 (Audio Codec) | 65 | * Use device=1 for bus 1 at 0x40000280 |
66 | * Use device=2 for bus 2 at 0x80000440 (Tuner ?) | 66 | * Use device=2 for bus 2 at 0x80000440 |
67 | * | 67 | * |
68 | * Returns number of bytes successfully send or -1 if START failed | 68 | * Returns number of bytes successfully send or -1 if START failed |
69 | */ | 69 | */ |
@@ -106,33 +106,33 @@ int i2c_write_byte(int device, unsigned char data) | |||
106 | /* Wait for bus busy */ | 106 | /* Wait for bus busy */ |
107 | while (!(regs[O_MBSR] & IBB) && count < MAX_LOOP) | 107 | while (!(regs[O_MBSR] & IBB) && count < MAX_LOOP) |
108 | { | 108 | { |
109 | yield(); | 109 | yield(); |
110 | count++; | 110 | count++; |
111 | } | 111 | } |
112 | 112 | ||
113 | if (count >= MAX_LOOP) | 113 | if (count >= MAX_LOOP) |
114 | return -1; | 114 | return -1; |
115 | 115 | ||
116 | count = 0; | 116 | count = 0; |
117 | 117 | ||
118 | /* Wait for interrupt flag */ | 118 | /* Wait for interrupt flag */ |
119 | while (!(regs[O_MBSR] & IFF) && count < MAX_LOOP) | 119 | while (!(regs[O_MBSR] & IFF) && count < MAX_LOOP) |
120 | { | 120 | { |
121 | yield(); | 121 | yield(); |
122 | count++; | 122 | count++; |
123 | } | 123 | } |
124 | 124 | ||
125 | if (count >= MAX_LOOP) | 125 | if (count >= MAX_LOOP) |
126 | return -2; | 126 | return -2; |
127 | 127 | ||
128 | regs[O_MBSR] &= ~IFF; /* Clear interrupt flag */ | 128 | regs[O_MBSR] &= ~IFF; /* Clear interrupt flag */ |
129 | 129 | ||
130 | if (!(regs[O_MBSR] & ICF)) /* Check that transfer is complete */ | 130 | if (!(regs[O_MBSR] & ICF)) /* Check that transfer is complete */ |
131 | return -3; | 131 | return -3; |
132 | 132 | ||
133 | if (regs[O_MBSR] & RXAK) /* Check that the byte has been ACKed */ | 133 | if (regs[O_MBSR] & RXAK) /* Check that the byte has been ACKed */ |
134 | return -4; | 134 | return -4; |
135 | 135 | ||
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
138 | 138 | ||
@@ -142,14 +142,14 @@ int i2c_gen_start(int device) | |||
142 | { | 142 | { |
143 | volatile unsigned char *regs = i2c_get_addr(device); | 143 | volatile unsigned char *regs = i2c_get_addr(device); |
144 | long count = 0; | 144 | long count = 0; |
145 | 145 | ||
146 | /* Wait for bus to become free */ | 146 | /* Wait for bus to become free */ |
147 | while ((regs[O_MBSR] & IBB) && (count < MAX_LOOP)) | 147 | while ((regs[O_MBSR] & IBB) && (count < MAX_LOOP)) |
148 | { | 148 | { |
149 | yield(); | 149 | yield(); |
150 | count++; | 150 | count++; |
151 | } | 151 | } |
152 | 152 | ||
153 | if (count >= MAX_LOOP) | 153 | if (count >= MAX_LOOP) |
154 | return -1; | 154 | return -1; |
155 | 155 | ||
@@ -169,6 +169,6 @@ volatile unsigned char *i2c_get_addr(int device) | |||
169 | { | 169 | { |
170 | if (device == 1) | 170 | if (device == 1) |
171 | return I2C_DEVICE_1; | 171 | return I2C_DEVICE_1; |
172 | 172 | ||
173 | return I2C_DEVICE_2; | 173 | return I2C_DEVICE_2; |
174 | } | 174 | } |
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index e33b985509..6bd94a2f95 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h | |||
@@ -52,7 +52,8 @@ | |||
52 | /* Define this if you have a Motorola SCF5249 */ | 52 | /* Define this if you have a Motorola SCF5249 */ |
53 | #define CONFIG_CPU MCF5249 | 53 | #define CONFIG_CPU MCF5249 |
54 | 54 | ||
55 | #define CONFIG_I2C I2C_H100 | 55 | /* Define this if you want to use coldfire's i2c interface */ |
56 | #define CONFIG_I2C I2C_COLDFIRE | ||
56 | 57 | ||
57 | #define HAVE_UDA1380 | 58 | #define HAVE_UDA1380 |
58 | 59 | ||
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index 9b93eae070..2ddf821533 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h | |||
@@ -48,7 +48,8 @@ | |||
48 | /* Define this if you have a Motorola SCF5249 */ | 48 | /* Define this if you have a Motorola SCF5249 */ |
49 | #define CONFIG_CPU MCF5249 | 49 | #define CONFIG_CPU MCF5249 |
50 | 50 | ||
51 | #define CONFIG_I2C I2C_H100 | 51 | /* Define this if you want to use coldfire's i2c interface */ |
52 | #define CONFIG_I2C I2C_COLDFIRE | ||
52 | 53 | ||
53 | #define HAVE_UDA1380 | 54 | #define HAVE_UDA1380 |
54 | 55 | ||
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index be6511cb2f..251b6912b3 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h | |||
@@ -44,7 +44,8 @@ | |||
44 | /* Define this if you have a Motorola SCF5249 */ | 44 | /* Define this if you have a Motorola SCF5249 */ |
45 | #define CONFIG_CPU MCF5249 | 45 | #define CONFIG_CPU MCF5249 |
46 | 46 | ||
47 | #define CONFIG_I2C I2C_H100 | 47 | /* Define this if you want to use coldfire's i2c interface */ |
48 | #define CONFIG_I2C I2C_COLDFIRE | ||
48 | 49 | ||
49 | #define HAVE_UDA1380 | 50 | #define HAVE_UDA1380 |
50 | 51 | ||
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index 7cdc861435..e2a170af66 100644 --- a/firmware/export/config-iaudiox5.h +++ b/firmware/export/config-iaudiox5.h | |||
@@ -42,10 +42,11 @@ | |||
42 | 42 | ||
43 | #ifndef SIMULATOR | 43 | #ifndef SIMULATOR |
44 | 44 | ||
45 | /* Define this if you have a Motorola SCF5249 */ | 45 | /* Define this if you have a Motorola SCF5250 */ |
46 | #define CONFIG_CPU MCF5250 | 46 | #define CONFIG_CPU MCF5250 |
47 | 47 | ||
48 | #define CONFIG_I2C I2C_IAUDIO | 48 | /* Define this if you want to use coldfire's i2c interface */ |
49 | #define CONFIG_I2C I2C_COLDFIRE | ||
49 | 50 | ||
50 | #define HAVE_TLV320 | 51 | #define HAVE_TLV320 |
51 | 52 | ||
diff --git a/firmware/export/config.h b/firmware/export/config.h index 6b77f0dfc1..16e235d1ba 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -81,8 +81,7 @@ | |||
81 | #define I2C_PLAYREC 0 /* Archos Player/Recorder style */ | 81 | #define I2C_PLAYREC 0 /* Archos Player/Recorder style */ |
82 | #define I2C_ONDIO 1 /* Ondio style */ | 82 | #define I2C_ONDIO 1 /* Ondio style */ |
83 | #define I2C_GMINI 2 /* Gmini style */ | 83 | #define I2C_GMINI 2 /* Gmini style */ |
84 | #define I2C_H100 3 /* iRiver h100 style */ | 84 | #define I2C_COLDFIRE 3 /* Coldfire style */ |
85 | #define I2C_IAUDIO 4 /* iAuido style */ | ||
86 | 85 | ||
87 | /* CONFIG_LED */ | 86 | /* CONFIG_LED */ |
88 | #define LED_REAL 1 /* SW controlled LED (Archos recorders, player, Gmini) */ | 87 | #define LED_REAL 1 /* SW controlled LED (Archos recorders, player, Gmini) */ |
diff --git a/firmware/export/i2c-h100.h b/firmware/export/i2c-coldfire.h index 5647b502db..d4a5781116 100644 --- a/firmware/export/i2c-h100.h +++ b/firmware/export/i2c-coldfire.h | |||
@@ -18,13 +18,13 @@ | |||
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | /* | 20 | /* |
21 | * Driver for MCF5249's I2C interface | 21 | * Driver for MCF52xx's I2C interface |
22 | * 2005-02-17 hubble@mochine.com | 22 | * 2005-02-17 hubble@mochine.com |
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #ifndef _I2C_H100_H | 26 | #ifndef _I2C_COLDFIRE_H |
27 | #define _I2C_H100_H | 27 | #define _I2C_COLDFIRE_H |
28 | 28 | ||
29 | void i2c_init(void); | 29 | void i2c_init(void); |
30 | int i2c_write(int device, unsigned char *buf, int count); | 30 | int i2c_write(int device, unsigned char *buf, int count); |