From 295367686ec9855c4d90f68a6003e819fef8e7ab Mon Sep 17 00:00:00 2001 From: Marcoen Hirschberg Date: Fri, 29 Dec 2006 02:49:12 +0000 Subject: merge a big part of the unofficial gigabeat cvs back. Includes working bootloader and rockbox with audio. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11850 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/gigabeat/meg-fx/power-meg-fx.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'firmware/target/arm/gigabeat/meg-fx/power-meg-fx.c') diff --git a/firmware/target/arm/gigabeat/meg-fx/power-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/power-meg-fx.c index 688b44eaa6..eb2ffb5238 100644 --- a/firmware/target/arm/gigabeat/meg-fx/power-meg-fx.c +++ b/firmware/target/arm/gigabeat/meg-fx/power-meg-fx.c @@ -23,6 +23,8 @@ #include "system.h" #include "power.h" #include "pcf50606.h" +#include "backlight.h" +#include "backlight-target.h" #ifndef SIMULATOR @@ -33,21 +35,34 @@ void power_init(void) bool charger_inserted(void) { - return !(GPFDAT & (1 << 4)); + return (GPFDAT & (1 << 4)) ? false : true; +} + +/* Returns true if the unit is charging the batteries. */ +bool charging_state(void) { + return (GPGDAT & (1 << 8)) ? false : true; } void ide_power_enable(bool on) { - (void)on; + if (on) + GPGDAT |= (1 << 11); + else + GPGDAT &= ~(1 << 11); } bool ide_powered(void) { - return true; + return (GPGDAT & (1 << 11)) != 0; } void power_off(void) { + /* turn off backlight and wait for 1 second */ + __backlight_off(); + sleep(HZ/2); + /* set SLEEP bit to on in CLKCON to turn off */ + CLKCON |=(1<<3); } #else /* SIMULATOR */ -- cgit v1.2.3