diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-08-14 22:06:23 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-08-14 22:06:23 +0000 |
commit | 8a177345ce7b96a00f1f14387412c2dfacfeaf34 (patch) | |
tree | fbb8dfa828cf578d535e3d77deebf077b24d2970 /firmware/target/sh/archos/ondio | |
parent | 360d951271659af590103dd81efb8166f5b226a2 (diff) | |
download | rockbox-8a177345ce7b96a00f1f14387412c2dfacfeaf34.tar.gz rockbox-8a177345ce7b96a00f1f14387412c2dfacfeaf34.zip |
Moved archos power handling into target tree. * Tuner power handling cleaned up a bit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14345 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/sh/archos/ondio')
-rw-r--r-- | firmware/target/sh/archos/ondio/power-ondio.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/firmware/target/sh/archos/ondio/power-ondio.c b/firmware/target/sh/archos/ondio/power-ondio.c new file mode 100644 index 0000000000..cedc3d10b9 --- /dev/null +++ b/firmware/target/sh/archos/ondio/power-ondio.c @@ -0,0 +1,78 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2002 by Linus Nielsen Feltzing + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include "config.h" +#include "cpu.h" +#include <stdbool.h> +#include "adc.h" +#include "kernel.h" +#include "system.h" +#include "power.h" +#include "usb.h" +#include "backlight-target.h" + +#if CONFIG_TUNER + +static bool powered = false; + +bool tuner_power(bool status) +{ + bool old_status = powered; + + powered = status; + if (status) + { + and_b(~0x04, &PADRL); /* drive PA2 low for tuner enable */ + sleep(1); /* let the voltage settle */ + } + else + or_b(0x04, &PADRL); /* drive PA2 high for tuner disable */ + return old_status; +} + +#endif /* #if CONFIG_TUNER */ + +void power_init(void) +{ + PBCR2 &= ~0x0c00; /* GPIO for PB5 */ + or_b(0x20, &PBIORL); + or_b(0x20, &PBDRL); /* hold power */ +#ifndef HAVE_BACKLIGHT + /* Disable backlight on backlight-modded Ondios when running + * a standard build (always on otherwise). */ + PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */ + and_b(~0x40, &PADRH); /* drive it low */ + or_b(0x40, &PAIORH); /* ..and output */ +#endif + PACR2 &= ~0x0030; /* GPIO for PA2 */ + or_b(0x04, &PADRL); /* drive PA2 high for tuner disable */ + or_b(0x04, &PAIORL); /* output for PA2 */ +} + +void power_off(void) +{ + set_irq_level(HIGHEST_IRQ_LEVEL); +#ifdef HAVE_BACKLIGHT + /* Switch off the light on backlight-modded Ondios */ + __backlight_off(); +#endif + and_b(~0x20, &PBDRL); + or_b(0x20, &PBIORL); + while(1) + yield(); +} |