Preliminary tick task timer driver
[kugel-rb.git] / firmware / target / hosted / android / kernel-android.c
blob528017e993c1b8c2321765e4ace10d01a552da4d
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (c) 2010 Thomas Martitz
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
23 #include <jni.h>
24 #include "config.h"
25 #include "system.h"
27 extern JNIEnv *env_ptr;
28 extern jclass RbBl_class;
29 extern jobject RbBl_instance;
31 static jclass RockboxTimer_class;
32 static jobject RockboxTimer_instance;
34 int set_irq_level(int level)
36 (void)level;
37 return 0;
41 void Java_com_example_rbboot_RockboxTimer_timerTask(JNIEnv *env, jobject this)
43 call_tick_tasks();
46 void tick_start(unsigned int interval_in_ms)
48 LOG("%s(): scheduled for %d", __func__, interval_in_ms);
49 jfieldID id = (*env_ptr)->GetFieldID(env_ptr, RbBl_class, "tim", "Lcom/example/rbboot/RockboxTimer;");
50 RockboxTimer_instance = (*env_ptr)->GetObjectField(env_ptr, RbBl_instance, id);
51 RockboxTimer_class = (*env_ptr)->GetObjectClass(env_ptr, RockboxTimer_instance);
53 jmethodID java_tick_start = (*env_ptr)->GetMethodID(env_ptr, RockboxTimer_class, "java_tick_start", "(J)V");
54 (*env_ptr)->CallVoidMethod(env_ptr, RockboxTimer_instance, java_tick_start, (long)interval_in_ms);