diff options
Diffstat (limited to 'firmware/target/coldfire/iaudio/m3/power-m3.c')
-rw-r--r-- | firmware/target/coldfire/iaudio/m3/power-m3.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/firmware/target/coldfire/iaudio/m3/power-m3.c b/firmware/target/coldfire/iaudio/m3/power-m3.c new file mode 100644 index 0000000000..624e3b44a5 --- /dev/null +++ b/firmware/target/coldfire/iaudio/m3/power-m3.c | |||
@@ -0,0 +1,71 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Jens Arnold | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "config.h" | ||
21 | #include "cpu.h" | ||
22 | #include <stdbool.h> | ||
23 | #include "kernel.h" | ||
24 | #include "system.h" | ||
25 | #include "power.h" | ||
26 | |||
27 | #ifndef SIMULATOR | ||
28 | |||
29 | void power_init(void) | ||
30 | { | ||
31 | /* Set KEEPACT */ | ||
32 | or_l(0x00040000, &GPIO_OUT); | ||
33 | or_l(0x00040000, &GPIO_ENABLE); | ||
34 | or_l(0x00040000, &GPIO_FUNCTION); | ||
35 | |||
36 | /* Charger detect */ | ||
37 | and_l(~0x00000020, &GPIO1_ENABLE); | ||
38 | or_l(0x00000020, &GPIO1_FUNCTION); | ||
39 | } | ||
40 | |||
41 | bool charger_inserted(void) | ||
42 | { | ||
43 | return (GPIO1_READ & 0x00000020) == 0; | ||
44 | } | ||
45 | |||
46 | void ide_power_enable(bool on) | ||
47 | { | ||
48 | if (on) | ||
49 | { | ||
50 | or_l(0x00800000, &GPIO_OUT); | ||
51 | } | ||
52 | else | ||
53 | { | ||
54 | and_l(~0x00800000, &GPIO_OUT); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | bool ide_powered(void) | ||
59 | { | ||
60 | return false; | ||
61 | } | ||
62 | |||
63 | void power_off(void) | ||
64 | { | ||
65 | lcd_poweroff(); | ||
66 | set_irq_level(DISABLE_INTERRUPTS); | ||
67 | and_l(~0x00040000, &GPIO_OUT); /* Set KEEPACT low */ | ||
68 | asm("halt"); | ||
69 | } | ||
70 | |||
71 | #endif /* SIMULATOR */ | ||