From aaa8443af95aa03b225cea935ff49691ec94d0f9 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 21 Jan 2003 19:37:29 +0000 Subject: Based on Ludovic Lange excellent work, I've modified things to increase likeliness that this works on an FM Recorder. Reports please! git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3143 a1c6a512-1295-4272-9138-f99709370657 --- firmware/config-fmrecorder.h | 6 ++++++ firmware/config-player.h | 10 ++++++++++ firmware/config-recorder.h | 6 ++++++ firmware/drivers/adc.h | 6 ------ firmware/drivers/i2c.c | 4 ++-- firmware/drivers/mas.h | 2 +- firmware/drivers/power.c | 4 ++-- 7 files changed, 27 insertions(+), 11 deletions(-) (limited to 'firmware') diff --git a/firmware/config-fmrecorder.h b/firmware/config-fmrecorder.h index 3fdb27dfb9..584b1d5d54 100644 --- a/firmware/config-fmrecorder.h +++ b/firmware/config-fmrecorder.h @@ -24,3 +24,9 @@ /* Define this to the CPU frequency */ #define CPU_FREQ 11059200 + +/* Battery scale factor (?) */ +#define BATTERY_SCALE_FACTOR 6465 + +/* Define this if you control power on PBDR (instead of PADR) */ +#define HAVE_POWEROFF_ON_PBDR diff --git a/firmware/config-player.h b/firmware/config-player.h index f07a41aacc..8b4efcc7b4 100644 --- a/firmware/config-player.h +++ b/firmware/config-player.h @@ -12,3 +12,13 @@ /* Define this to the CPU frequency */ #define CPU_FREQ 12000000 /* cycle time ~83.3ns */ + +/* Battery scale factor (?) */ +#define BATTERY_SCALE_FACTOR 6546 + +/* Define this if you must discharge the data line by driving it low + and then set it to input to see if it stays low or goes high */ +#define HAVE_I2C_LOW_FIRST + +/* Define this if you control power on PADR (instead of PBDR) */ +#define HAVE_POWEROFF_ON_PADR diff --git a/firmware/config-recorder.h b/firmware/config-recorder.h index 2a38cff7d2..7f7c5e2683 100644 --- a/firmware/config-recorder.h +++ b/firmware/config-recorder.h @@ -21,3 +21,9 @@ /* Define this to the CPU frequency */ #define CPU_FREQ 11059200 + +/* Battery scale factor (?) */ +#define BATTERY_SCALE_FACTOR 6465 + +/* Define this if you control power on PBDR (instead of PADR) */ +#define HAVE_POWEROFF_ON_PBDR diff --git a/firmware/drivers/adc.h b/firmware/drivers/adc.h index 9c90cb08a7..f04ab4466d 100644 --- a/firmware/drivers/adc.h +++ b/firmware/drivers/adc.h @@ -38,12 +38,6 @@ #define ADC_UNREG_POWER 6 /* Battery voltage with a better scaling */ #define ADC_EXT_POWER 7 /* The external power voltage, V=X*0.0148 */ -#ifdef ARCHOS_RECORDER -#define BATTERY_SCALE_FACTOR 6465 -#else -#define BATTERY_SCALE_FACTOR 6546 -#endif - #define EXT_SCALE_FACTOR 14800 unsigned short adc_read(int channel); diff --git a/firmware/drivers/i2c.c b/firmware/drivers/i2c.c index ccd11e01de..97d7a511e1 100644 --- a/firmware/drivers/i2c.c +++ b/firmware/drivers/i2c.c @@ -124,7 +124,7 @@ int i2c_getack(void) low until it is ready. We need to poll the clock line until it goes high before we read the ack. */ -#ifndef ARCHOS_RECORDER +#ifdef HAVE_I2C_LOW_FIRST SDA_LO; /* First, discharge the data line */ #endif SDA_INPUT; /* And set to input */ @@ -167,7 +167,7 @@ unsigned char i2c_inb(int ack) /* clock in each bit, MSB first */ for ( i=0x80; i; i>>=1 ) { -#ifndef ARCHOS_RECORDER +#ifdef HAVE_I2C_LOW_FIRST /* Tricky business. Here we discharge the data line by driving it low and then set it to input to see if it stays low or goes high */ SDA_LO; /* First, discharge the data line */ diff --git a/firmware/drivers/mas.h b/firmware/drivers/mas.h index fec0c36ed7..573b9b6b37 100644 --- a/firmware/drivers/mas.h +++ b/firmware/drivers/mas.h @@ -27,7 +27,7 @@ /* MAS I2C defs */ -#ifdef ARCHOS_RECORDER +#ifdef HAVE_MAS3587F #define MAS_ADR 0x3c #define MAS_DEV_WRITE (MAS_ADR | 0x00) #define MAS_DEV_READ (MAS_ADR | 0x01) diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c index bb0ec80942..4d8b1cabb8 100644 --- a/firmware/drivers/power.c +++ b/firmware/drivers/power.c @@ -59,7 +59,7 @@ void charger_enable(bool on) void ide_power_enable(bool on) { -#ifdef ARCHOS_RECORDER +#ifdef HAVE_ATA_POWER_OFF if(on) PADR |= 0x20; else @@ -72,7 +72,7 @@ void ide_power_enable(bool on) void power_off(void) { set_irq_level(15); -#ifdef ARCHOS_RECORDER +#ifdef HAVE_POWEROFF_ON_PBDR PBDR &= ~PBDR_BTN_OFF; PBIOR |= PBDR_BTN_OFF; #else -- cgit v1.2.3