1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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 ****************************************************************************/
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
)
41 void Java_org_rockbox_RockboxTimer_timerTask(JNIEnv
*env
, jobject
this)
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", "Lorg/rockbox/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
, (jlong
)interval_in_ms
);
57 bool timer_register(int reg_prio
, void (*unregister_callback
)(void),
58 long cycles
, void (*timer_callback
)(void))
63 bool timer_set_period(long cycles
)
68 void timer_unregister(void)