add some boot screen and scanning debug output
This commit is contained in:
parent
c099d9bae1
commit
47e0462368
12
src/boot.c
12
src/boot.c
|
@ -168,6 +168,7 @@ bool is_bootable(enum boot_src_e device, boot_record_p * boot_record) {
|
|||
|
||||
switch(device) {
|
||||
case BOOT_SRC_RAM:
|
||||
DEBUG("Scanning boot source BOOT_SRC_RAM");
|
||||
top_ram = (uint32_t)mem_get_ramtop();
|
||||
for (uint32_t address = 0; address < top_ram; address += boot_record_alignment) {
|
||||
record = (boot_record_p)address;
|
||||
|
@ -180,6 +181,7 @@ bool is_bootable(enum boot_src_e device, boot_record_p * boot_record) {
|
|||
break;
|
||||
|
||||
case BOOT_SRC_ROM:
|
||||
DEBUG("Scanning boot source BOOT_SRC_ROM");
|
||||
record = (boot_record_p)boot_rom_location;
|
||||
if (is_valid_boot_record(record)) {
|
||||
*boot_record = record;
|
||||
|
@ -188,6 +190,7 @@ bool is_bootable(enum boot_src_e device, boot_record_p * boot_record) {
|
|||
break;
|
||||
|
||||
case BOOT_SRC_CARTRIDGE:
|
||||
DEBUG("Scanning boot source BOOT_SRC_CARTRIDGE");
|
||||
record = (boot_record_p)boot_cart_location;
|
||||
if (is_valid_boot_record(record)) {
|
||||
*boot_record = record;
|
||||
|
@ -196,18 +199,21 @@ bool is_bootable(enum boot_src_e device, boot_record_p * boot_record) {
|
|||
break;
|
||||
|
||||
case BOOT_SRC_SD0:
|
||||
DEBUG("Scanning boot source BOOT_SRC_SD0");
|
||||
if ((fsys_stat("/sd0/fnxboot.pgx", &file_info) >= 0) || (fsys_stat("/sd0/fnxboot.pgz", &file_info) >= 0)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case BOOT_SRC_SD1:
|
||||
DEBUG("Scanning boot source BOOT_SRC_SD1");
|
||||
if ((fsys_stat("/sd1/fnxboot.pgx", &file_info) >= 0) || (fsys_stat("/sd1/fnxboot.pgz", &file_info) >= 0)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG1("Unknown boot source type to scan %d, skipping", device);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -435,6 +441,8 @@ static short sc_to_function(unsigned short scancode) {
|
|||
*
|
||||
*/
|
||||
void boot_screen() {
|
||||
INFO("Starting boot screen");
|
||||
|
||||
enum boot_src_e boot_source = BOOT_SRC_NONE;
|
||||
boot_record_p boot_record[MAX_BOOT_SRC];
|
||||
short boot_position = 0;
|
||||
|
@ -520,6 +528,7 @@ void boot_screen() {
|
|||
bootable[position] = false;
|
||||
boot_icon(position, boot_chain[position]);
|
||||
if (is_bootable(boot_chain[position], &boot_record[position])) {
|
||||
DEBUG1("Determined that boot source %d is bootable", position);
|
||||
boot_icon_highlight(position);
|
||||
bootable[position] = true;
|
||||
bootable_count++;
|
||||
|
@ -550,6 +559,7 @@ void boot_screen() {
|
|||
}
|
||||
}
|
||||
}
|
||||
DEBUG("Finished scanning boot sources");
|
||||
|
||||
// List out all the selectable boot sources
|
||||
if (bootable_count > 1) {
|
||||
|
@ -579,11 +589,13 @@ void boot_screen() {
|
|||
short selected = sc_to_function(scancode);
|
||||
|
||||
if (selected == 0x20) {
|
||||
INFO("Booting from default ...");
|
||||
printf("Booting from default ...\n");
|
||||
// SPACE was pressed... just boot the default
|
||||
boot_from(boot_source, boot_record[0]);
|
||||
|
||||
} else if (selected > 0) {
|
||||
INFO1("Booting from device %d", selected);
|
||||
printf("Booting from %d ...\n", selected);
|
||||
if (bootable[selected - 1]) {
|
||||
boot_position = selected - 1;
|
||||
|
|
Loading…
Reference in a new issue