summaryrefslogtreecommitdiff
path: root/firmware/drivers/i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/i2c.c')
-rw-r--r--firmware/drivers/i2c.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/firmware/drivers/i2c.c b/firmware/drivers/i2c.c
index 2b439c23ad..83ac21fae8 100644
--- a/firmware/drivers/i2c.c
+++ b/firmware/drivers/i2c.c
@@ -24,26 +24,6 @@
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#if CONFIG_I2C == I2C_GMINI
28
29/* This is done like this in the Archos' firmware.
30 * However, the TCC370 has an integrated I2C
31 * controller (bound to the same lines). It should be
32 * possible to use it and thus save some space in flash.
33 */
34#define SDA_LO (P3 &= ~0x20)
35#define SDA_HI (P3 |= 0x20)
36#define SDA_INPUT (P3CONH &= ~0x0C)
37#define SDA_OUTPUT (P3CONH |= 0x04)
38#define SDA (P3 & 0x20)
39
40#define SCL_LO (P3 &= ~0x10)
41#define SCL_HI (P3 |= 0x10)
42#define SCL_INPUT (P3CONH &= ~0x03)
43#define SCL_OUTPUT (P3CONH |= 0x01)
44#define SCL (P3 & 0x10)
45
46#else /* non Gmini below */
47 27
48/* SDA is PB7 */ 28/* SDA is PB7 */
49#define SDA_LO and_b(~0x80, &PBDRL) 29#define SDA_LO and_b(~0x80, &PBDRL)
@@ -67,7 +47,6 @@
67#define SCL_HI or_b(0x20, &PBDRH) 47#define SCL_HI or_b(0x20, &PBDRH)
68#define SCL (PBDRH & 0x20) 48#define SCL (PBDRH & 0x20)
69#endif 49#endif
70#endif /* ! I2C_GMINI */
71 50
72/* arbitrary delay loop */ 51/* arbitrary delay loop */
73#define DELAY do { int _x; for(_x=0;_x<20;_x++);} while (0) 52#define DELAY do { int _x; for(_x=0;_x<20;_x++);} while (0)
@@ -106,13 +85,10 @@ void i2c_init(void)
106{ 85{
107 int i; 86 int i;
108 87
109#if CONFIG_I2C == I2C_GMINI 88#if CONFIG_I2C == I2C_ONDIO
110 SCL_INPUT;
111 SDA_INPUT;
112#elif CONFIG_I2C == I2C_ONDIO
113 /* make PB6 & PB7 general I/O */ 89 /* make PB6 & PB7 general I/O */
114 PBCR2 &= ~0xf000; 90 PBCR2 &= ~0xf000;
115#else /* not Gmini, not Ondio */ 91#else /* not Ondio */
116 /* make PB7 & PB13 general I/O */ 92 /* make PB7 & PB13 general I/O */
117 PBCR1 &= ~0x0c00; /* PB13 */ 93 PBCR1 &= ~0x0c00; /* PB13 */
118 PBCR2 &= ~0xc000; /* PB7 */ 94 PBCR2 &= ~0xc000; /* PB7 */