summaryrefslogtreecommitdiff
path: root/bootloader/ondavx747.c
diff options
context:
space:
mode:
Diffstat (limited to 'bootloader/ondavx747.c')
-rwxr-xr-xbootloader/ondavx747.c125
1 files changed, 125 insertions, 0 deletions
diff --git a/bootloader/ondavx747.c b/bootloader/ondavx747.c
new file mode 100755
index 0000000000..46e81cacad
--- /dev/null
+++ b/bootloader/ondavx747.c
@@ -0,0 +1,125 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Maurus Cuelenaere
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#include <stdio.h>
23#include <stdarg.h>
24#include <string.h>
25#include "config.h"
26#include "jz4740.h"
27#include "backlight.h"
28#include "font.h"
29#include "lcd.h"
30#include "system.h"
31#include "mips.h"
32#include "button.h"
33
34int _line = 1;
35char _printfbuf[256];
36
37/* This is all rather hacky, but it works... */
38void _printf(const char *format, ...)
39{
40 int len;
41 unsigned char *ptr;
42 va_list ap;
43 va_start(ap, format);
44
45 ptr = _printfbuf;
46 len = vsnprintf(ptr, sizeof(_printfbuf), format, ap);
47 va_end(ap);
48
49 int i;
50 for(i=0; i<1; i++)
51 {
52 lcd_puts(0, _line++, ptr);
53 lcd_update();
54 }
55 if(_line >= LCD_HEIGHT/SYSFONT_HEIGHT)
56 _line = 1;
57}
58
59void audiotest(void)
60{
61 __i2s_internal_codec();
62 __aic_enable();
63 __aic_reset();
64 __aic_select_i2s();
65 __aic_enable_loopback();
66}
67
68static void jz_store_icache(void)
69{
70 unsigned long start;
71 unsigned long end;
72
73 start = KSEG0BASE;
74 end = start + CFG_ICACHE_SIZE;
75 while(start < end)
76 {
77 cache_unroll(start, 8);
78 start += CFG_CACHELINE_SIZE;
79 }
80}
81
82int main(void)
83{
84 cli();
85
86 write_c0_status(0x10000400);
87
88 memcpy((void *)A_K0BASE, (void *)0x80E00080, 0x20);
89 memcpy((void *)(A_K0BASE + 0x180), (void *)0x80E00080, 0x20);
90 memcpy((void *)(A_K0BASE + 0x200), (void *)0x80E00080, 0x20);
91
92 jz_flush_dcache();
93 jz_store_icache();
94
95 sti();
96
97 kernel_init();
98 lcd_init();
99 font_init();
100 lcd_setfont(FONT_SYSFIXED);
101 button_init();
102
103 backlight_init();
104
105 /* To make the Windows say "ding-dong".. */
106 REG8(USB_REG_POWER) &= ~USB_POWER_SOFTCONN;
107
108 int touch;
109 lcd_clear_display();
110 _printf("Rockbox bootloader v0.000001");
111 while(1)
112 {
113 if(button_read_device(&touch) & BUTTON_VOL_DOWN)
114 _printf("BUTTON_VOL_DOWN");
115 if(button_read_device(&touch) & BUTTON_MENU)
116 _printf("BUTTON_MENU");
117 if(button_read_device(&touch) & BUTTON_VOL_UP)
118 _printf("BUTTON_VOL_UP");
119 if(button_read_device(&touch) & BUTTON_POWER)
120 _printf("BUTTON_POWER");
121 _printf("X: %d Y: %d", touch>>16, touch&0xFFFF);
122 }
123
124 return 0;
125}