diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-05-07 22:29:35 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-05-07 22:29:35 +0000 |
commit | c42a1a05bbd623e434d34d72aa320188a723675d (patch) | |
tree | 401d969500f5dfd9fdd7135a6a2cc17ccd21c008 | |
parent | f34ce792ec48984721016137cb254ed2dc06411c (diff) | |
download | rockbox-c42a1a05bbd623e434d34d72aa320188a723675d.tar.gz rockbox-c42a1a05bbd623e434d34d72aa320188a723675d.zip |
Moved unrelated stuff from i2c the driver to appropriate places. Minor optimisation in i2c driver.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6419 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/drivers/i2c.c | 24 | ||||
-rw-r--r-- | firmware/drivers/mas.c | 6 | ||||
-rw-r--r-- | firmware/drivers/power.c | 6 |
3 files changed, 19 insertions, 17 deletions
diff --git a/firmware/drivers/i2c.c b/firmware/drivers/i2c.c index ed12145da9..71cb9cf8b0 100644 --- a/firmware/drivers/i2c.c +++ b/firmware/drivers/i2c.c | |||
@@ -50,7 +50,7 @@ | |||
50 | #define SDA_HI or_b(0x80, &PBDRL) | 50 | #define SDA_HI or_b(0x80, &PBDRL) |
51 | #define SDA_INPUT and_b(~0x80, &PBIORL) | 51 | #define SDA_INPUT and_b(~0x80, &PBIORL) |
52 | #define SDA_OUTPUT or_b(0x80, &PBIORL) | 52 | #define SDA_OUTPUT or_b(0x80, &PBIORL) |
53 | #define SDA (PBDR & 0x80) | 53 | #define SDA (PBDRL & 0x80) |
54 | 54 | ||
55 | #if CONFIG_I2C == I2C_ONDIO | 55 | #if CONFIG_I2C == I2C_ONDIO |
56 | /* Ondio pinout, SCL moved to PB6 */ | 56 | /* Ondio pinout, SCL moved to PB6 */ |
@@ -58,14 +58,14 @@ | |||
58 | #define SCL_OUTPUT or_b(0x40, &PBIORL) | 58 | #define SCL_OUTPUT or_b(0x40, &PBIORL) |
59 | #define SCL_LO and_b(~0x40, &PBDRL) | 59 | #define SCL_LO and_b(~0x40, &PBDRL) |
60 | #define SCL_HI or_b(0x40, &PBDRL) | 60 | #define SCL_HI or_b(0x40, &PBDRL) |
61 | #define SCL (PBDR & 0x0040) | 61 | #define SCL (PBDRL & 0x40) |
62 | #else | 62 | #else |
63 | /* "classic" pinout, SCL is PB13 */ | 63 | /* "classic" pinout, SCL is PB13 */ |
64 | #define SCL_INPUT and_b(~0x20, &PBIORH) | 64 | #define SCL_INPUT and_b(~0x20, &PBIORH) |
65 | #define SCL_OUTPUT or_b(0x20, &PBIORH) | 65 | #define SCL_OUTPUT or_b(0x20, &PBIORH) |
66 | #define SCL_LO and_b(~0x20, &PBDRH) | 66 | #define SCL_LO and_b(~0x20, &PBDRH) |
67 | #define SCL_HI or_b(0x20, &PBDRH) | 67 | #define SCL_HI or_b(0x20, &PBDRH) |
68 | #define SCL (PBDR & 0x2000) | 68 | #define SCL (PBDRH & 0x20) |
69 | #endif | 69 | #endif |
70 | #endif /* ! I2C_GMINI */ | 70 | #endif /* ! I2C_GMINI */ |
71 | 71 | ||
@@ -109,22 +109,14 @@ void i2c_init(void) | |||
109 | #if CONFIG_I2C == I2C_GMINI | 109 | #if CONFIG_I2C == I2C_GMINI |
110 | SCL_INPUT; | 110 | SCL_INPUT; |
111 | SDA_INPUT; | 111 | SDA_INPUT; |
112 | #else | 112 | #elif CONFIG_I2C == I2C_ONDIO |
113 | #if CONFIG_I2C == I2C_ONDIO | 113 | /* make PB6 & PB7 general I/O */ |
114 | /* make PB5, PB6 & PB7 general I/O */ | 114 | PBCR2 &= ~0xf000; |
115 | PBCR2 &= ~0xfc00; /* includes PB5, see FIXME below */ | ||
116 | #else /* not Gmini, not Ondio */ | 115 | #else /* not Gmini, not Ondio */ |
117 | /* make PB5, PB7 & PB13 general I/O */ | 116 | /* make PB7 & PB13 general I/O */ |
118 | PBCR1 &= ~0x0c00; /* PB13 */ | 117 | PBCR1 &= ~0x0c00; /* PB13 */ |
119 | PBCR2 &= ~0xcc00; /* PB5 and PB7, see FIXME below */ | 118 | PBCR2 &= ~0xc000; /* PB7 */ |
120 | #endif | 119 | #endif |
121 | |||
122 | /* PB5 is "MAS enable" (no I2C signal!). make it output and high */ | ||
123 | /* FIXME: this is true only for Players, and should go into mas.c */ | ||
124 | /* for Recorders, it shuts off the charger, for FM/V2 it holds power */ | ||
125 | or_b(0x20, &PBIORL); | ||
126 | or_b(0x20, &PBDRL); | ||
127 | #endif /* end of non-Gmini */ | ||
128 | 120 | ||
129 | SCL_OUTPUT; | 121 | SCL_OUTPUT; |
130 | SDA_OUTPUT; | 122 | SDA_OUTPUT; |
diff --git a/firmware/drivers/mas.c b/firmware/drivers/mas.c index 891ceff18d..7c8b55c422 100644 --- a/firmware/drivers/mas.c +++ b/firmware/drivers/mas.c | |||
@@ -271,11 +271,15 @@ void mas_reset(void) | |||
271 | or_b(0x01, &PAIORH); | 271 | or_b(0x01, &PAIORH); |
272 | 272 | ||
273 | #if CONFIG_HWCODEC == MAS3507D | 273 | #if CONFIG_HWCODEC == MAS3507D |
274 | /* PB5 is "MAS enable". make it GPIO output and high */ | ||
275 | PBCR2 &= ~0x0c00; | ||
276 | or_b(0x20, &PBIORL); | ||
277 | or_b(0x20, &PBDRL); | ||
278 | |||
274 | and_b(~0x01, &PADRH); | 279 | and_b(~0x01, &PADRH); |
275 | sleep(HZ/100); | 280 | sleep(HZ/100); |
276 | or_b(0x01, &PADRH); | 281 | or_b(0x01, &PADRH); |
277 | sleep(HZ/5); | 282 | sleep(HZ/5); |
278 | |||
279 | #elif (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F) | 283 | #elif (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F) |
280 | if(old_recorder) | 284 | if(old_recorder) |
281 | { | 285 | { |
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c index de62c7aa96..2d6c1c815c 100644 --- a/firmware/drivers/power.c +++ b/firmware/drivers/power.c | |||
@@ -74,7 +74,13 @@ void power_init(void) | |||
74 | spdif_power_enable(false); | 74 | spdif_power_enable(false); |
75 | #endif | 75 | #endif |
76 | #else | 76 | #else |
77 | #ifdef HAVE_POWEROFF_ON_PB5 | ||
78 | PBCR2 &= ~0x0c00; /* GPIO for PB5 */ | ||
79 | or_b(0x20, &PBIORL); | ||
80 | or_b(0x20, &PBDRL); /* hold power */ | ||
81 | #endif | ||
77 | #ifdef HAVE_CHARGE_CTRL | 82 | #ifdef HAVE_CHARGE_CTRL |
83 | PBCR2 &= ~0x0c00; /* GPIO for PB5 */ | ||
78 | or_b(0x20, &PBIORL); /* Set charging control bit to output */ | 84 | or_b(0x20, &PBIORL); /* Set charging control bit to output */ |
79 | charger_enable(false); /* Default to charger OFF */ | 85 | charger_enable(false); /* Default to charger OFF */ |
80 | #endif | 86 | #endif |