first step at building the main binary
[kugel-rb.git] / bootloader / application.c
blob25ce9f46a5ed2fcb09e7df5f06eb9d312f6df7d2
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 ****************************************************************************/
22 /* Include Standard files */
23 #include <jni.h>
24 #include <system.h>
25 #include <inttypes.h>
26 #include "config.h"
27 #include "kernel.h"
28 #include "lcd.h"
29 #include "font.h"
30 #include "version.h"
31 #include "sysfont.h"
32 #include "backlight.h"
33 #include "button-target.h"
34 #include "common.h"
35 #include "storage.h"
36 #include "disk.h"
37 #include "panic.h"
38 #include "power.h"
39 extern int show_logo();
41 JNIEXPORT void JNICALL Java_com_example_rbboot_RockboxBootloader_main
42 (JNIEnv *, jobject);
44 void test_tick(void)
47 LOG("%s(): %ld", __func__, current_tick);
51 static long test_stack[1<<10];
52 static char test_thread_name[] = "test";
53 void test_thread(void)
55 while(1)
57 LOG("%s()", __func__);
58 sleep(33);
62 static long test_stack2[1<<10];
63 static char test_thread_name2[] = "test2";
64 void test_thread2(void)
66 while(1)
68 LOG("%s()", __func__);
69 sleep(20);
73 int main(void)
75 int delay = 1<<20;
76 long tick;
77 LOG("Hello Rockbox!");
78 system_init();
79 kernel_init();
81 lcd_init();
82 button_init_device();
83 lcd_setfont(FONT_SYSFIXED);
84 printf("hello");
85 tick_add_task(test_tick);
87 lcd_clear_display();
88 show_logo();
89 create_thread(test_thread, test_stack, sizeof(test_stack), 0, test_thread_name, PRIORITY_USER_INTERFACE);
90 create_thread(test_thread2, test_stack2, sizeof(test_stack2), 0, test_thread_name2, PRIORITY_USER_INTERFACE);
91 int i = 10;
92 do {
93 int data;
94 LOG("before yield()");
95 tick = current_tick;
96 button_read_device(&data);
97 printf("hello tick %d:%d", data>>16, data&0xffff);
98 sleep(33);
99 LOG("after yield()");
100 } while(i-- > 0);
102 sleep(1);
103 return 0;
105 int touch_data;
106 if(button_read_device(&touch_data) & BUTTON_MENU)
107 verbose = true;
109 printf("Rockbox boot loader");
110 printf("Version " RBVERSION);
112 while (delay-- > 0); /* avoid warning */