diff options
author | Daniel Stenberg <daniel@haxx.se> | 2005-01-27 12:16:45 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2005-01-27 12:16:45 +0000 |
commit | 918918ebab7cd312fb6402bb45ba810194353145 (patch) | |
tree | 1d8810786dca01e1bcd4f3551d9c89a687db96e8 /firmware | |
parent | 70470f0e74ceadcf200b40d0552ddeafd9187579 (diff) | |
download | rockbox-918918ebab7cd312fb6402bb45ba810194353145.tar.gz rockbox-918918ebab7cd312fb6402bb45ba810194353145.zip |
introducing CONFIG_I2C for kind of I2C in use
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5675 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/i2c.c | 16 | ||||
-rw-r--r-- | firmware/export/config-gmini120.h | 2 | ||||
-rw-r--r-- | firmware/export/config-ondiofm.h | 3 | ||||
-rw-r--r-- | firmware/export/config-ondiosp.h | 2 | ||||
-rw-r--r-- | firmware/export/config.h | 5 |
5 files changed, 19 insertions, 9 deletions
diff --git a/firmware/drivers/i2c.c b/firmware/drivers/i2c.c index f5e8cb5240..ed12145da9 100644 --- a/firmware/drivers/i2c.c +++ b/firmware/drivers/i2c.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "system.h" | 24 | #include "system.h" |
25 | 25 | ||
26 | /* cute little functions, atomic read-modify-write */ | 26 | /* cute little functions, atomic read-modify-write */ |
27 | #ifdef HAVE_GMINI_I2C | 27 | #if CONFIG_I2C == I2C_GMINI |
28 | 28 | ||
29 | /* This is done like this in the Archos' firmware. | 29 | /* This is done like this in the Archos' firmware. |
30 | * However, the TCC370 has an integrated I2C | 30 | * However, the TCC370 has an integrated I2C |
@@ -43,7 +43,7 @@ | |||
43 | #define SCL_OUTPUT (P3CONH |= 0x01) | 43 | #define SCL_OUTPUT (P3CONH |= 0x01) |
44 | #define SCL (P3 & 0x10) | 44 | #define SCL (P3 & 0x10) |
45 | 45 | ||
46 | #else | 46 | #else /* non Gmini below */ |
47 | 47 | ||
48 | /* SDA is PB7 */ | 48 | /* SDA is PB7 */ |
49 | #define SDA_LO and_b(~0x80, &PBDRL) | 49 | #define SDA_LO and_b(~0x80, &PBDRL) |
@@ -52,7 +52,7 @@ | |||
52 | #define SDA_OUTPUT or_b(0x80, &PBIORL) | 52 | #define SDA_OUTPUT or_b(0x80, &PBIORL) |
53 | #define SDA (PBDR & 0x80) | 53 | #define SDA (PBDR & 0x80) |
54 | 54 | ||
55 | #ifdef HAVE_ONDIO_I2C | 55 | #if CONFIG_I2C == I2C_ONDIO |
56 | /* Ondio pinout, SCL moved to PB6 */ | 56 | /* Ondio pinout, SCL moved to PB6 */ |
57 | #define SCL_INPUT and_b(~0x40, &PBIORL) | 57 | #define SCL_INPUT and_b(~0x40, &PBIORL) |
58 | #define SCL_OUTPUT or_b(0x40, &PBIORL) | 58 | #define SCL_OUTPUT or_b(0x40, &PBIORL) |
@@ -67,7 +67,7 @@ | |||
67 | #define SCL_HI or_b(0x20, &PBDRH) | 67 | #define SCL_HI or_b(0x20, &PBDRH) |
68 | #define SCL (PBDR & 0x2000) | 68 | #define SCL (PBDR & 0x2000) |
69 | #endif | 69 | #endif |
70 | #endif | 70 | #endif /* ! I2C_GMINI */ |
71 | 71 | ||
72 | /* arbitrary delay loop */ | 72 | /* arbitrary delay loop */ |
73 | #define DELAY do { int _x; for(_x=0;_x<20;_x++);} while (0) | 73 | #define DELAY do { int _x; for(_x=0;_x<20;_x++);} while (0) |
@@ -106,14 +106,14 @@ void i2c_init(void) | |||
106 | { | 106 | { |
107 | int i; | 107 | int i; |
108 | 108 | ||
109 | #ifdef HAVE_GMINI_I2C | 109 | #if CONFIG_I2C == I2C_GMINI |
110 | SCL_INPUT; | 110 | SCL_INPUT; |
111 | SDA_INPUT; | 111 | SDA_INPUT; |
112 | #else | 112 | #else |
113 | #ifdef HAVE_ONDIO_I2C | 113 | #if CONFIG_I2C == I2C_ONDIO |
114 | /* make PB5, PB6 & PB7 general I/O */ | 114 | /* make PB5, PB6 & PB7 general I/O */ |
115 | PBCR2 &= ~0xfc00; /* includes PB5, see FIXME below */ | 115 | PBCR2 &= ~0xfc00; /* includes PB5, see FIXME below */ |
116 | #else | 116 | #else /* not Gmini, not Ondio */ |
117 | /* make PB5, PB7 & PB13 general I/O */ | 117 | /* make PB5, PB7 & PB13 general I/O */ |
118 | PBCR1 &= ~0x0c00; /* PB13 */ | 118 | PBCR1 &= ~0x0c00; /* PB13 */ |
119 | PBCR2 &= ~0xcc00; /* PB5 and PB7, see FIXME below */ | 119 | PBCR2 &= ~0xcc00; /* PB5 and PB7, see FIXME below */ |
@@ -124,7 +124,7 @@ void i2c_init(void) | |||
124 | /* for Recorders, it shuts off the charger, for FM/V2 it holds power */ | 124 | /* for Recorders, it shuts off the charger, for FM/V2 it holds power */ |
125 | or_b(0x20, &PBIORL); | 125 | or_b(0x20, &PBIORL); |
126 | or_b(0x20, &PBDRL); | 126 | or_b(0x20, &PBDRL); |
127 | #endif | 127 | #endif /* end of non-Gmini */ |
128 | 128 | ||
129 | SCL_OUTPUT; | 129 | SCL_OUTPUT; |
130 | SDA_OUTPUT; | 130 | SDA_OUTPUT; |
diff --git a/firmware/export/config-gmini120.h b/firmware/export/config-gmini120.h index 47dbb2c899..e5b69a0c1d 100644 --- a/firmware/export/config-gmini120.h +++ b/firmware/export/config-gmini120.h | |||
@@ -22,6 +22,8 @@ | |||
22 | /* Define this if you have a gmini 100 style LCD */ | 22 | /* Define this if you have a gmini 100 style LCD */ |
23 | #define CONFIG_LCD LCD_GMINI100 | 23 | #define CONFIG_LCD LCD_GMINI100 |
24 | 24 | ||
25 | #define CONFIG_I2C I2C_GMINI | ||
26 | |||
25 | /* Type of mobile power, FIXME: probably different, make new type */ | 27 | /* Type of mobile power, FIXME: probably different, make new type */ |
26 | #define CONFIG_BATTERY BATT_LIION2200 | 28 | #define CONFIG_BATTERY BATT_LIION2200 |
27 | #define BATTERY_SCALE_FACTOR 6465 | 29 | #define BATTERY_SCALE_FACTOR 6465 |
diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h index 9a3993c53f..7e72921a36 100644 --- a/firmware/export/config-ondiofm.h +++ b/firmware/export/config-ondiofm.h | |||
@@ -22,6 +22,9 @@ | |||
22 | /* Define this to the CPU frequency */ | 22 | /* Define this to the CPU frequency */ |
23 | #define CPU_FREQ 12000000 | 23 | #define CPU_FREQ 12000000 |
24 | 24 | ||
25 | /* Define this for different I2C pinout */ | ||
26 | #define CONFIG_I2C I2C_ONDIO | ||
27 | |||
25 | /* Type of mobile power */ | 28 | /* Type of mobile power */ |
26 | #define CONFIG_BATTERY BATT_3AAA_ALKALINE | 29 | #define CONFIG_BATTERY BATT_3AAA_ALKALINE |
27 | 30 | ||
diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h index 89a17420c5..1118c54a1e 100644 --- a/firmware/export/config-ondiosp.h +++ b/firmware/export/config-ondiosp.h | |||
@@ -50,7 +50,7 @@ | |||
50 | #define HAVE_DISPLAY_FLIPPED | 50 | #define HAVE_DISPLAY_FLIPPED |
51 | 51 | ||
52 | /* Define this for different I2C pinout */ | 52 | /* Define this for different I2C pinout */ |
53 | #define HAVE_ONDIO_I2C | 53 | #define CONFIG_I2C I2C_ONDIO |
54 | 54 | ||
55 | /* Define this for different ADC channel assignment */ | 55 | /* Define this for different ADC channel assignment */ |
56 | #define HAVE_ONDIO_ADC | 56 | #define HAVE_ONDIO_ADC |
diff --git a/firmware/export/config.h b/firmware/export/config.h index c6431298ef..6a1e896979 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -60,6 +60,11 @@ | |||
60 | #define BL_PA14_HI 2 /* Ondio, PA14 high active */ | 60 | #define BL_PA14_HI 2 /* Ondio, PA14 high active */ |
61 | #define BL_IRIVER 3 /* IRiver GPIO */ | 61 | #define BL_IRIVER 3 /* IRiver GPIO */ |
62 | 62 | ||
63 | /* CONFIG_I2C */ | ||
64 | #define I2C_PLAYREC 0 /* Archos Player/Recorder style */ | ||
65 | #define I2C_ONDIO 1 /* Ondio style */ | ||
66 | #define I2C_GMINI 2 /* Gmini style */ | ||
67 | |||
63 | /* now go and pick yours */ | 68 | /* now go and pick yours */ |
64 | #if defined(ARCHOS_PLAYER) | 69 | #if defined(ARCHOS_PLAYER) |
65 | #include "config-player.h" | 70 | #include "config-player.h" |