Specify the width for the player overview image too and make sure the aspect ratio...
[Rockbox.git] / bootloader / mrobe500.c
blobd0b9c2b717cf069ee2d4f9f0e60e71eab51b01e4
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: $
10 * Copyright (C) 2007 by Karl Kurbjun
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include "inttypes.h"
21 #include "string.h"
22 #include "cpu.h"
23 #include "system.h"
24 #include "lcd.h"
25 #include "kernel.h"
26 #include "thread.h"
27 #include "ata.h"
28 #include "fat.h"
29 #include "disk.h"
30 #include "font.h"
31 #include "adc.h"
32 #include "backlight.h"
33 #include "backlight-target.h"
34 #include "button.h"
35 #include "panic.h"
36 #include "power.h"
37 #include "file.h"
38 #include "common.h"
39 #include "rbunicode.h"
40 #include "usb.h"
42 void main(void)
44 unsigned char* loadbuffer;
45 int buffer_size;
46 int rc;
47 int(*kernel_entry)(void);
49 power_init();
50 system_init();
51 kernel_init();
52 adc_init();
53 button_init();
54 backlight_init();
55 uartSetup();
56 lcd_init();
57 font_init();
58 // dm320_spi_init();
60 lcd_setfont(FONT_SYSFIXED);
62 /* Show debug messages if button is pressed */
63 // if(button_read_device())
64 verbose = true;
66 printf("Rockbox boot loader");
67 printf("Version %s", APPSVERSION);
69 usb_init();
71 #if 0
72 /* Enter USB mode without USB thread */
73 if(usb_detect())
75 const char msg[] = "Bootloader USB mode";
76 reset_screen();
77 lcd_putsxy( (LCD_WIDTH - (SYSFONT_WIDTH * strlen(msg))) / 2,
78 (LCD_HEIGHT - SYSFONT_HEIGHT) / 2, msg);
79 lcd_update();
81 ide_power_enable(true);
82 ata_enable(false);
83 sleep(HZ/20);
84 usb_enable(true);
86 while (usb_detect())
88 ata_spin(); /* Prevent the drive from spinning down */
89 sleep(HZ);
92 usb_enable(false);
94 reset_screen();
95 lcd_update();
97 #endif
99 printf("ATA");
100 int count = 0, i = 0, c = 0;
101 char data[64];
102 unsigned short out[] = {0x8000};
103 unsigned short in[2];
104 outw(inw(IO_GIO_DIR1)&~(1<<10), IO_GIO_DIR1); // set GIO26 to output
106 while(true)
108 if (button_read_device() == BUTTON_POWER)
110 printf("reset");
111 outw(1<<10, IO_GIO_BITSET1);
113 // dm320_spi_block_transfer(0, out, 16, 16, in, 0);
114 // printf("%x", in[0]);
117 #if 0
118 rc = ata_init();
119 if(rc)
121 reset_screen();
122 error(EATA, rc);
125 printf("disk");
126 disk_init();
128 printf("mount");
129 rc = disk_mount_all();
130 if (rc<=0)
132 error(EDISK,rc);
135 printf("Loading firmware");
137 loadbuffer = (unsigned char*) 0x00900000;
138 buffer_size = (unsigned char*)0x00100000 - loadbuffer;
140 rc = load_firmware(loadbuffer, BOOTFILE, buffer_size);
141 if(rc < 0)
142 error(EBOOTFILE, rc);
144 if (rc == EOK)
146 kernel_entry = (void*) loadbuffer;
147 rc = kernel_entry();
149 #endif