diff options
Diffstat (limited to 'firmware/target/hosted/android/kernel-android.c')
-rw-r--r-- | firmware/target/hosted/android/kernel-android.c | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/firmware/target/hosted/android/kernel-android.c b/firmware/target/hosted/android/kernel-android.c deleted file mode 100644 index e3522418fe..0000000000 --- a/firmware/target/hosted/android/kernel-android.c +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (c) 2010 Thomas Martitz | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | |||
23 | #include <time.h> | ||
24 | #include <signal.h> | ||
25 | #include <errno.h> | ||
26 | #include <unistd.h> | ||
27 | #include <pthread.h> | ||
28 | #include "config.h" | ||
29 | #include "system.h" | ||
30 | #include "button.h" | ||
31 | #include "audio.h" | ||
32 | #include "panic.h" | ||
33 | |||
34 | |||
35 | static pthread_cond_t wfi_cond = PTHREAD_COND_INITIALIZER; | ||
36 | static pthread_mutex_t wfi_mtx = PTHREAD_MUTEX_INITIALIZER; | ||
37 | /* | ||
38 | * call tick tasks and wake the scheduler up */ | ||
39 | void timer_signal(union sigval arg) | ||
40 | { | ||
41 | (void)arg; | ||
42 | call_tick_tasks(); | ||
43 | interrupt(); | ||
44 | } | ||
45 | |||
46 | /* | ||
47 | * wait on the sem which the signal handler posts to save cpu time (aka sleep) | ||
48 | * | ||
49 | * other mechanisms could use them as well */ | ||
50 | void wait_for_interrupt(void) | ||
51 | { | ||
52 | pthread_cond_wait(&wfi_cond, &wfi_mtx); | ||
53 | } | ||
54 | |||
55 | /* | ||
56 | * Wakeup the kernel, if sleeping (shall not be called from a signal handler) */ | ||
57 | void interrupt(void) | ||
58 | { | ||
59 | pthread_cond_signal(&wfi_cond); | ||
60 | } | ||
61 | |||
62 | /* | ||
63 | * setup a hrtimer to send a signal to our process every tick | ||
64 | * | ||
65 | * WARNING: JNI calls are not permitted from tick tasks, as the | ||
66 | * underlying thread is not attached to the Java VM | ||
67 | * | ||
68 | * Can be possibly be attached if it really needs to be. but let's | ||
69 | * keep this leightweight */ | ||
70 | void tick_start(unsigned int interval_in_ms) | ||
71 | { | ||
72 | int ret = 0; | ||
73 | timer_t timerid; | ||
74 | struct itimerspec ts; | ||
75 | sigevent_t sigev; | ||
76 | |||
77 | /* initializing in the declaration causes some weird warnings */ | ||
78 | memset(&sigev, 0, sizeof(sigevent_t)); | ||
79 | sigev.sigev_notify = SIGEV_THREAD, | ||
80 | sigev.sigev_notify_function = timer_signal, | ||
81 | |||
82 | ts.it_value.tv_sec = ts.it_interval.tv_sec = 0; | ||
83 | ts.it_value.tv_nsec = ts.it_interval.tv_nsec = interval_in_ms*1000*1000; | ||
84 | |||
85 | /* add the timer */ | ||
86 | ret |= timer_create(CLOCK_REALTIME, &sigev, &timerid); | ||
87 | ret |= timer_settime(timerid, 0, &ts, NULL); | ||
88 | |||
89 | /* Grab the mutex already now and leave it to this thread. We don't | ||
90 | * care about race conditions when signaling the condition (because | ||
91 | * they are not critical), but a mutex is necessary due to the API */ | ||
92 | pthread_mutex_lock(&wfi_mtx); | ||
93 | |||
94 | if (ret != 0) | ||
95 | panicf("%s(): %s\n", __func__, strerror(errno)); | ||
96 | } | ||
97 | |||
98 | |||
99 | bool timer_register(int reg_prio, void (*unregister_callback)(void), | ||
100 | long cycles, void (*timer_callback)(void)) | ||
101 | { | ||
102 | (void)reg_prio; | ||
103 | (void)unregister_callback; | ||
104 | (void)cycles; | ||
105 | (void)timer_callback; | ||
106 | return false; | ||
107 | } | ||
108 | |||
109 | bool timer_set_period(long cycles) | ||
110 | { | ||
111 | (void)cycles; | ||
112 | return false; | ||
113 | } | ||
114 | |||
115 | void timer_unregister(void) | ||
116 | { | ||
117 | } | ||