summaryrefslogtreecommitdiffstats
path: root/firmware/target/sh
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-12-03 19:54:25 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-12-03 19:54:25 +0000
commit58eb784a5d1f0ac800e656d5dfa3a1bff8fb2657 (patch)
tree084c7b7c5d374fbfef2f8cddb3673a3b2a26a7df /firmware/target/sh
parent0d0cc039f88ced4f6db5c4468b19913f52cd08c8 (diff)
downloadrockbox-58eb784a5d1f0ac800e656d5dfa3a1bff8fb2657.tar.gz
rockbox-58eb784a5d1f0ac800e656d5dfa3a1bff8fb2657.tar.bz2
rockbox-58eb784a5d1f0ac800e656d5dfa3a1bff8fb2657.zip
Straighten out some powermanagement stuff. Give target complete control over how power inputs are sensed. Clean SIMULATOR stuff out of target files. Get rid of USB charging option on targets that don't support it or don't implement it yet. Menu string remains to avoid language incompatibility but should be removed on next cleanup for targets not using it (notice in english.lang). global_settings becomes incompatible for some builds and so plugin API version is incremented.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19315 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/sh')
-rw-r--r--firmware/target/sh/archos/fm_v2/power-fm_v2.c15
-rw-r--r--firmware/target/sh/archos/player/power-player.c5
-rw-r--r--firmware/target/sh/archos/recorder/power-recorder.c5
3 files changed, 18 insertions, 7 deletions
diff --git a/firmware/target/sh/archos/fm_v2/power-fm_v2.c b/firmware/target/sh/archos/fm_v2/power-fm_v2.c
index 32b5c95da9..24bccf6eb2 100644
--- a/firmware/target/sh/archos/fm_v2/power-fm_v2.c
+++ b/firmware/target/sh/archos/fm_v2/power-fm_v2.c
@@ -28,7 +28,6 @@
#include "usb.h"
#if CONFIG_TUNER
-
bool tuner_power(bool status)
{
(void)status;
@@ -44,10 +43,20 @@ void power_init(void)
or_b(0x20, &PBDRL); /* hold power */
}
-bool charger_inserted(void)
+unsigned int power_input_status(void)
{
+ unsigned int status = POWER_INPUT_NONE;
+
/* FM or V2 can also charge from the USB port */
- return (adc_read(ADC_CHARGE_REGULATOR) < 0x1FF);
+ if (adc_read(ADC_CHARGE_REGULATOR) < 0x1FF)
+ status = POWER_INPUT_MAIN_CHARGER;
+
+#ifdef HAVE_USB_POWER
+ if (usb_detect() == USB_INSERTED)
+ status |= POWER_INPUT_USB_CHARGER;
+#endif
+
+ return status;
}
/* Returns true if the unit is charging the batteries. */
diff --git a/firmware/target/sh/archos/player/power-player.c b/firmware/target/sh/archos/player/power-player.c
index 59b87f69a5..857ba25e50 100644
--- a/firmware/target/sh/archos/player/power-player.c
+++ b/firmware/target/sh/archos/player/power-player.c
@@ -31,10 +31,11 @@ void power_init(void)
{
}
-bool charger_inserted(void)
+unsigned int power_input_status(void)
{
/* Player */
- return (PADR & 1) == 0;
+ return ((PADR & 1) == 0) ?
+ POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE;
}
void ide_power_enable(bool on)
diff --git a/firmware/target/sh/archos/recorder/power-recorder.c b/firmware/target/sh/archos/recorder/power-recorder.c
index b0a7ad1786..d90c029890 100644
--- a/firmware/target/sh/archos/recorder/power-recorder.c
+++ b/firmware/target/sh/archos/recorder/power-recorder.c
@@ -36,10 +36,11 @@ void power_init(void)
charger_enable(false); /* Default to charger OFF */
}
-bool charger_inserted(void)
+unsigned int power_input_status(void)
{
/* Recorder */
- return adc_read(ADC_EXT_POWER) > 0x100;
+ return (adc_read(ADC_EXT_POWER) > 0x100) ?
+ POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE;
}
void charger_enable(bool on)