summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/android
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted/android')
-rw-r--r--firmware/target/hosted/android/kernel-android.c117
-rw-r--r--firmware/target/hosted/android/system-target.h11
2 files changed, 2 insertions, 126 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
35static pthread_cond_t wfi_cond = PTHREAD_COND_INITIALIZER;
36static pthread_mutex_t wfi_mtx = PTHREAD_MUTEX_INITIALIZER;
37/*
38 * call tick tasks and wake the scheduler up */
39void 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 */
50void 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) */
57void 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 */
70void 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
99bool 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
109bool timer_set_period(long cycles)
110{
111 (void)cycles;
112 return false;
113}
114
115void timer_unregister(void)
116{
117}
diff --git a/firmware/target/hosted/android/system-target.h b/firmware/target/hosted/android/system-target.h
index 12610de42f..aba7e6d6c0 100644
--- a/firmware/target/hosted/android/system-target.h
+++ b/firmware/target/hosted/android/system-target.h
@@ -18,22 +18,16 @@
18 * KIND, either express or implied. 18 * KIND, either express or implied.
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21
21#ifndef __SYSTEM_TARGET_H__ 22#ifndef __SYSTEM_TARGET_H__
22#define __SYSTEM_TARGET_H__ 23#define __SYSTEM_TARGET_H__
23 24
24#define disable_irq() 25#include "kernel-unix.h"
25#define enable_irq()
26#define disable_irq_save() 0
27#define restore_irq(level) (void)level
28 26
29static inline void commit_dcache(void) {} 27static inline void commit_dcache(void) {}
30static inline void commit_discard_dcache(void) {} 28static inline void commit_discard_dcache(void) {}
31static inline void commit_discard_idcache(void) {} 29static inline void commit_discard_idcache(void) {}
32 30
33void power_off(void);
34void wait_for_interrupt(void);
35void interrupt(void);
36
37 /* don't pull in jni.h for every user of this file, it should be only needed 31 /* don't pull in jni.h for every user of this file, it should be only needed
38 * within the target tree (if at all) 32 * within the target tree (if at all)
39 * define this before #including system.h or system-target.h */ 33 * define this before #including system.h or system-target.h */
@@ -47,4 +41,3 @@ extern JNIEnv* getJavaEnvironment(void);
47#endif /* __SYSTEM_TARGET_H__ */ 41#endif /* __SYSTEM_TARGET_H__ */
48 42
49#define NEED_GENERIC_BYTESWAPS 43#define NEED_GENERIC_BYTESWAPS
50