forked from len0rd/rockbox
Make the Telechips bootloader slightly less messy, kill some warnings and allow entry to the bootloader debug screen via the D2's hold switch.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16879 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
edf6d90ca4
commit
3b46671a40
1 changed files with 88 additions and 77 deletions
|
@ -35,6 +35,7 @@
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
#include "adc.h"
|
#include "adc.h"
|
||||||
#include "adc-target.h"
|
#include "adc-target.h"
|
||||||
|
#include "backlight.h"
|
||||||
#include "backlight-target.h"
|
#include "backlight-target.h"
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
|
@ -52,67 +53,13 @@ extern int line;
|
||||||
|
|
||||||
#define MAX_LOAD_SIZE (8*1024*1024) /* Arbitrary, but plenty. */
|
#define MAX_LOAD_SIZE (8*1024*1024) /* Arbitrary, but plenty. */
|
||||||
|
|
||||||
void* main(void)
|
void show_debug_screen(void)
|
||||||
{
|
{
|
||||||
int button;
|
int button;
|
||||||
int power_count = 0;
|
int power_count = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
bool do_power_off = false;
|
bool do_power_off = false;
|
||||||
|
|
||||||
#if defined(COWON_D2) && defined(TCCBOOT)
|
|
||||||
int rc;
|
|
||||||
unsigned char* loadbuffer = (unsigned char*)LOAD_ADDRESS;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
power_init();
|
|
||||||
system_init();
|
|
||||||
lcd_init();
|
|
||||||
|
|
||||||
adc_init();
|
|
||||||
button_init();
|
|
||||||
backlight_init();
|
|
||||||
|
|
||||||
font_init();
|
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
|
||||||
|
|
||||||
_backlight_on();
|
|
||||||
|
|
||||||
/* Only load the firmware if TCCBOOT is defined - this ensures SDRAM_START is
|
|
||||||
available for loading the firmware. Otherwise display the debug screen. */
|
|
||||||
#if defined(COWON_D2) && defined(TCCBOOT)
|
|
||||||
printf("Rockbox boot loader");
|
|
||||||
printf("Version %s", version);
|
|
||||||
|
|
||||||
printf("ATA");
|
|
||||||
rc = ata_init();
|
|
||||||
if(rc)
|
|
||||||
{
|
|
||||||
reset_screen();
|
|
||||||
error(EATA, rc);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("mount");
|
|
||||||
rc = disk_mount_all();
|
|
||||||
if (rc<=0)
|
|
||||||
{
|
|
||||||
error(EDISK,rc);
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = load_firmware(loadbuffer, BOOTFILE, MAX_LOAD_SIZE);
|
|
||||||
|
|
||||||
if (rc < 0)
|
|
||||||
{
|
|
||||||
error(EBOOTFILE,rc);
|
|
||||||
}
|
|
||||||
else if (rc == EOK)
|
|
||||||
{
|
|
||||||
int(*kernel_entry)(void);
|
|
||||||
|
|
||||||
kernel_entry = (void*) loadbuffer;
|
|
||||||
rc = kernel_entry();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
while(!do_power_off) {
|
while(!do_power_off) {
|
||||||
line = 0;
|
line = 0;
|
||||||
printf("Hello World!");
|
printf("Hello World!");
|
||||||
|
@ -186,8 +133,72 @@ void* main(void)
|
||||||
power_off();
|
power_off();
|
||||||
|
|
||||||
printf("(NOT) POWERED OFF");
|
printf("(NOT) POWERED OFF");
|
||||||
|
while (true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void* main(void)
|
||||||
|
{
|
||||||
|
#if defined(COWON_D2) && defined(TCCBOOT)
|
||||||
|
int rc;
|
||||||
|
unsigned char* loadbuffer = (unsigned char*)LOAD_ADDRESS;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
power_init();
|
||||||
|
system_init();
|
||||||
|
lcd_init();
|
||||||
|
|
||||||
|
adc_init();
|
||||||
|
button_init();
|
||||||
|
backlight_init();
|
||||||
|
|
||||||
|
font_init();
|
||||||
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
|
|
||||||
|
_backlight_on();
|
||||||
|
|
||||||
|
/* Only load the firmware if TCCBOOT is defined - this ensures SDRAM_START is
|
||||||
|
available for loading the firmware. Otherwise display the debug screen. */
|
||||||
|
#if defined(COWON_D2) && defined(TCCBOOT)
|
||||||
|
printf("Rockbox boot loader");
|
||||||
|
printf("Version %s", version);
|
||||||
|
|
||||||
|
printf("ATA");
|
||||||
|
rc = ata_init();
|
||||||
|
if(rc)
|
||||||
|
{
|
||||||
|
reset_screen();
|
||||||
|
error(EATA, rc);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("mount");
|
||||||
|
rc = disk_mount_all();
|
||||||
|
if (rc<=0)
|
||||||
|
{
|
||||||
|
error(EDISK,rc);
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = load_firmware(loadbuffer, BOOTFILE, MAX_LOAD_SIZE);
|
||||||
|
|
||||||
|
if (rc < 0)
|
||||||
|
{
|
||||||
|
error(EBOOTFILE,rc);
|
||||||
|
}
|
||||||
|
else if (rc == EOK)
|
||||||
|
{
|
||||||
|
int(*kernel_entry)(void);
|
||||||
|
|
||||||
|
/* wait for button release to allow debug statememts to be read */
|
||||||
|
while (button_read_device()) {};
|
||||||
|
|
||||||
|
kernel_entry = (void*) loadbuffer;
|
||||||
|
|
||||||
|
/* allow entry to the debug screen if hold is on */
|
||||||
|
if (!button_hold()) rc = kernel_entry();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
show_debug_screen();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue