From 918918ebab7cd312fb6402bb45ba810194353145 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 27 Jan 2005 12:16:45 +0000 Subject: introducing CONFIG_I2C for kind of I2C in use git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5675 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/i2c.c | 16 ++++++++-------- firmware/export/config-gmini120.h | 2 ++ firmware/export/config-ondiofm.h | 3 +++ firmware/export/config-ondiosp.h | 2 +- firmware/export/config.h | 5 +++++ 5 files changed, 19 insertions(+), 9 deletions(-) (limited to 'firmware') 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 @@ #include "system.h" /* cute little functions, atomic read-modify-write */ -#ifdef HAVE_GMINI_I2C +#if CONFIG_I2C == I2C_GMINI /* This is done like this in the Archos' firmware. * However, the TCC370 has an integrated I2C @@ -43,7 +43,7 @@ #define SCL_OUTPUT (P3CONH |= 0x01) #define SCL (P3 & 0x10) -#else +#else /* non Gmini below */ /* SDA is PB7 */ #define SDA_LO and_b(~0x80, &PBDRL) @@ -52,7 +52,7 @@ #define SDA_OUTPUT or_b(0x80, &PBIORL) #define SDA (PBDR & 0x80) -#ifdef HAVE_ONDIO_I2C +#if CONFIG_I2C == I2C_ONDIO /* Ondio pinout, SCL moved to PB6 */ #define SCL_INPUT and_b(~0x40, &PBIORL) #define SCL_OUTPUT or_b(0x40, &PBIORL) @@ -67,7 +67,7 @@ #define SCL_HI or_b(0x20, &PBDRH) #define SCL (PBDR & 0x2000) #endif -#endif +#endif /* ! I2C_GMINI */ /* arbitrary delay loop */ #define DELAY do { int _x; for(_x=0;_x<20;_x++);} while (0) @@ -106,14 +106,14 @@ void i2c_init(void) { int i; -#ifdef HAVE_GMINI_I2C +#if CONFIG_I2C == I2C_GMINI SCL_INPUT; SDA_INPUT; #else -#ifdef HAVE_ONDIO_I2C +#if CONFIG_I2C == I2C_ONDIO /* make PB5, PB6 & PB7 general I/O */ PBCR2 &= ~0xfc00; /* includes PB5, see FIXME below */ -#else +#else /* not Gmini, not Ondio */ /* make PB5, PB7 & PB13 general I/O */ PBCR1 &= ~0x0c00; /* PB13 */ PBCR2 &= ~0xcc00; /* PB5 and PB7, see FIXME below */ @@ -124,7 +124,7 @@ void i2c_init(void) /* for Recorders, it shuts off the charger, for FM/V2 it holds power */ or_b(0x20, &PBIORL); or_b(0x20, &PBDRL); -#endif +#endif /* end of non-Gmini */ SCL_OUTPUT; 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 @@ /* Define this if you have a gmini 100 style LCD */ #define CONFIG_LCD LCD_GMINI100 +#define CONFIG_I2C I2C_GMINI + /* Type of mobile power, FIXME: probably different, make new type */ #define CONFIG_BATTERY BATT_LIION2200 #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 @@ /* Define this to the CPU frequency */ #define CPU_FREQ 12000000 +/* Define this for different I2C pinout */ +#define CONFIG_I2C I2C_ONDIO + /* Type of mobile power */ #define CONFIG_BATTERY BATT_3AAA_ALKALINE 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 @@ #define HAVE_DISPLAY_FLIPPED /* Define this for different I2C pinout */ -#define HAVE_ONDIO_I2C +#define CONFIG_I2C I2C_ONDIO /* Define this for different ADC channel assignment */ #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 @@ #define BL_PA14_HI 2 /* Ondio, PA14 high active */ #define BL_IRIVER 3 /* IRiver GPIO */ +/* CONFIG_I2C */ +#define I2C_PLAYREC 0 /* Archos Player/Recorder style */ +#define I2C_ONDIO 1 /* Ondio style */ +#define I2C_GMINI 2 /* Gmini style */ + /* now go and pick yours */ #if defined(ARCHOS_PLAYER) #include "config-player.h" -- cgit v1.2.3