diff options
Diffstat (limited to 'firmware/target/hosted/samsungypr/ypr1/system-ypr1.c')
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr1/system-ypr1.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/firmware/target/hosted/samsungypr/ypr1/system-ypr1.c b/firmware/target/hosted/samsungypr/ypr1/system-ypr1.c new file mode 100644 index 0000000000..d0cbddc55a --- /dev/null +++ b/firmware/target/hosted/samsungypr/ypr1/system-ypr1.c | |||
@@ -0,0 +1,67 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2013 Lorenzo Miori | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version 2 | ||
14 | * of the License, or (at your option) any later version. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #include <stdlib.h> | ||
22 | #include <string.h> | ||
23 | #include <inttypes.h> | ||
24 | #include "system.h" | ||
25 | #include "panic.h" | ||
26 | #include "debug.h" | ||
27 | |||
28 | #include "gpio-target.h" | ||
29 | #include "pmu-ypr1.h" | ||
30 | #include "ioctl-ypr1.h" | ||
31 | #include "audiohw.h" | ||
32 | #include "button-target.h" | ||
33 | |||
34 | void power_off(void) | ||
35 | { | ||
36 | /* Something that we need to do before exit on our platform */ | ||
37 | pmu_close(); | ||
38 | max17040_close(); | ||
39 | button_close_device(); | ||
40 | gpio_close(); | ||
41 | exit(EXIT_SUCCESS); | ||
42 | } | ||
43 | |||
44 | uintptr_t *stackbegin; | ||
45 | uintptr_t *stackend; | ||
46 | void system_init(void) | ||
47 | { | ||
48 | int *s; | ||
49 | /* fake stack, OS manages size (and growth) */ | ||
50 | stackbegin = stackend = (uintptr_t*)&s; | ||
51 | |||
52 | /* Here begins our platform specific initilization for various things */ | ||
53 | audiohw_init(); | ||
54 | gpio_init(); | ||
55 | max17040_init(); | ||
56 | pmu_init(); | ||
57 | } | ||
58 | |||
59 | void system_reboot(void) | ||
60 | { | ||
61 | power_off(); | ||
62 | } | ||
63 | |||
64 | void system_exception_wait(void) | ||
65 | { | ||
66 | system_reboot(); | ||
67 | } | ||