From da1ca5177fd1606fe494939e120c5731b4bb5d3f Mon Sep 17 00:00:00 2001 From: Mark Arigo Date: Sat, 7 Mar 2009 04:41:37 +0000 Subject: Make Philips SA9200 build again git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20226 a1c6a512-1295-4272-9138-f99709370657 --- firmware/SOURCES | 9 ++-- firmware/export/config-sa9200.h | 10 ++++- .../target/arm/philips/sa9200/powermgmt-sa9200.c | 11 ----- .../target/arm/philips/sa9200/powermgmt-target.h | 48 ++++++++++++++++++++++ 4 files changed, 61 insertions(+), 17 deletions(-) create mode 100644 firmware/target/arm/philips/sa9200/powermgmt-target.h diff --git a/firmware/SOURCES b/firmware/SOURCES index 0b6bb155b0..1ee2979f22 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -534,16 +534,17 @@ target/arm/sandisk/audio-c200_e200.c #ifdef PHILIPS_SA9200 #ifndef SIMULATOR -target/arm/ata-sd-pp.c -target/arm/philips/sa9200/lcd-sa9200.c target/arm/adc-as3514.c target/arm/ascodec-pp.c -target/arm/philips/sa9200/backlight-sa9200.c +target/arm/ata-sd-pp.c +target/arm/i2s-pp.c +target/arm/powermgmt-ascodec.c target/arm/usb-fw-pp502x.c +target/arm/philips/sa9200/backlight-sa9200.c target/arm/philips/sa9200/button-sa9200.c +target/arm/philips/sa9200/lcd-sa9200.c target/arm/philips/sa9200/power-sa9200.c target/arm/philips/sa9200/powermgmt-sa9200.c -target/arm/i2s-pp.c #endif /* SIMULATOR */ #endif /* PHILIPS_SA9200 */ diff --git a/firmware/export/config-sa9200.h b/firmware/export/config-sa9200.h index 3008360414..cbe92bb99c 100755 --- a/firmware/export/config-sa9200.h +++ b/firmware/export/config-sa9200.h @@ -105,8 +105,14 @@ #define BATTERY_CAPACITY_INC 0 /* capacity increment */ #define BATTERY_TYPES_COUNT 1 /* only one type */ -/* Hardware controlled charging? FIXME */ -#define CONFIG_CHARGING CHARGING_SIMPLE +/* Charging implemented in a target-specific algorithm */ +#define CONFIG_CHARGING CHARGING_TARGET +#define HAVE_POWEROFF_WHILE_CHARGING + +/* define current usage levels (copied from the e200v1 )*/ +#define CURRENT_NORMAL 30 /* Toni's measurements in Nov 2008 */ +#define CURRENT_BACKLIGHT 40 /* Screen is about 20, blue LEDs are another 20, so 40 if both */ +#define CURRENT_RECORD 30 /* flash player, so this is just unboosted current*/ /* define this if the unit can be powered or charged via USB */ #define HAVE_USB_POWER diff --git a/firmware/target/arm/philips/sa9200/powermgmt-sa9200.c b/firmware/target/arm/philips/sa9200/powermgmt-sa9200.c index 43f37463f8..144ca37ebf 100644 --- a/firmware/target/arm/philips/sa9200/powermgmt-sa9200.c +++ b/firmware/target/arm/philips/sa9200/powermgmt-sa9200.c @@ -47,14 +47,3 @@ const unsigned short percent_to_volt_charge[11] = /* Sansa Li Ion 750mAH FIXME */ 3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160 }; - -/* ADC should read 0x3ff=5.12V */ -#define BATTERY_SCALE_FACTOR 5125 -/* full-scale ADC readout (2^10) in millivolt */ - -/* Returns battery voltage from ADC [millivolts] */ -unsigned int battery_adc_voltage(void) -{ - return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; -} - diff --git a/firmware/target/arm/philips/sa9200/powermgmt-target.h b/firmware/target/arm/philips/sa9200/powermgmt-target.h new file mode 100644 index 0000000000..4400cda5d1 --- /dev/null +++ b/firmware/target/arm/philips/sa9200/powermgmt-target.h @@ -0,0 +1,48 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 by Michael Sevakis + * Copyright (C) 2008 by Bertrik Sikken + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef POWERMGMT_TARGET_H +#define POWERMGMT_TARGET_H + +/* NOTE: these values are copied from the Sansa e200v1 */ + +/* PREFERRED - Check if topped-off and monitor voltage while plugged. */ +#define BATT_FULL_VOLTAGE 4160 +#define BATT_VAUTO_RECHARGE 4100 +#define BATT_CHG_V CHG_V_4_20V +#define BATT_CHG_I CHG_I_300MA +#define CHARGER_TOTAL_TIMER (4*3600*2) /* 4 hours enough? */ +/* On e200 ADC_RTCSUP seems to represent battery voltage better than + * ADC_BVDD during charging (ADC_BVDD is way too high) and appears the + * same in normal use. + */ +#define ADC_BATTERY ADC_RTCSUP + +void powermgmt_init_target(void); +void charging_algorithm_step(void); +void charging_algorithm_close(void); + +/* We want to be able to reset the averaging filter */ +#define HAVE_RESET_BATTERY_FILTER + +#define BATT_AVE_SAMPLES 32 + +#endif /* POWERMGMT_TARGET_H */ -- cgit v1.2.3