mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 10:07:38 -04:00
x1000: bootloader: Add button handlers for OF boot
The SPL soon won't be paying attention to buttons, so the bootloader should check them. Change-Id: I2048ca9fd19193f329bebecfefd986760c33fd68
This commit is contained in:
parent
cda8bd5437
commit
bd8cd58568
2 changed files with 31 additions and 10 deletions
|
@ -33,6 +33,16 @@
|
|||
#include "boot-x1000.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
static int read_btn(void)
|
||||
{
|
||||
#ifdef HAVE_BUTTON_DATA
|
||||
int bdata;
|
||||
return button_read_device(&bdata);
|
||||
#else
|
||||
return button_read_device();
|
||||
#endif
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
system_init();
|
||||
|
@ -65,17 +75,24 @@ void main(void)
|
|||
* let's not force them to hold down the recovery key. */
|
||||
bool recovery_mode = get_boot_flag(BOOT_FLAG_USB_BOOT);
|
||||
|
||||
#ifdef HAVE_BUTTON_DATA
|
||||
int bdata;
|
||||
if(button_read_device(&bdata) & BL_RECOVERY)
|
||||
#else
|
||||
if(button_read_device() & BL_RECOVERY)
|
||||
#endif
|
||||
recovery_mode = true;
|
||||
/* Normal boot - if it fails, we bail to the recovery menu */
|
||||
if(!recovery_mode) {
|
||||
int btn = read_btn();
|
||||
btn &= ~BUTTON_POWER; /* ignore power button */
|
||||
|
||||
/* If boot fails, it will return and continue on below */
|
||||
if(!recovery_mode)
|
||||
boot_rockbox();
|
||||
if(btn == BL_RECOVERY)
|
||||
recovery_mode = true;
|
||||
#if defined(OF_PLAYER_BTN)
|
||||
else if(btn == OF_PLAYER_BTN)
|
||||
boot_of_player();
|
||||
#endif
|
||||
#if defined(OF_RECOVERY_BTN)
|
||||
else if(btn == OF_RECOVERY_BTN)
|
||||
boot_of_recovery();
|
||||
#endif
|
||||
else
|
||||
boot_rockbox();
|
||||
}
|
||||
|
||||
/* This function does not return. */
|
||||
recovery_menu();
|
||||
|
|
|
@ -54,11 +54,13 @@ struct uimage_header;
|
|||
* bug may not affect the Q1. */
|
||||
# define OF_PLAYER_ARGS OF_RECOVERY_ARGS \
|
||||
" init=/linuxrc ubi.mtd=3 root=ubi0:rootfs ubi.mtd=4 rootfstype=ubifs rw"
|
||||
# define OF_PLAYER_BTN BUTTON_PLAY
|
||||
# define OF_RECOVERY_NAME "FiiO recovery"
|
||||
# define OF_RECOVERY_ADDR 0x420000
|
||||
# define OF_RECOVERY_LENGTH (5 * 1024 * 1024)
|
||||
# define OF_RECOVERY_ARGS \
|
||||
"mem=64M console=ttyS2"
|
||||
# define OF_RECOVERY_BTN (BUTTON_PLAY|BUTTON_VOL_UP)
|
||||
#elif defined(SHANLING_Q1)
|
||||
# define BL_RECOVERY BUTTON_NEXT
|
||||
# define BL_UP BUTTON_PREV
|
||||
|
@ -77,11 +79,13 @@ struct uimage_header;
|
|||
# define OF_PLAYER_LENGTH (8 * 1024 * 1024)
|
||||
# define OF_PLAYER_ARGS OF_RECOVERY_ARGS \
|
||||
" init=/linuxrc ubi.mtd=5 root=ubi0:rootfs ubi.mtd=6 rootfstype=ubifs rw"
|
||||
# define OF_PLAYER_BTN BUTTON_PREV
|
||||
# define OF_RECOVERY_NAME "Shanling recovery"
|
||||
# define OF_RECOVERY_ADDR 0x940000
|
||||
# define OF_RECOVERY_LENGTH (10 * 1024 * 1024)
|
||||
# define OF_RECOVERY_ARGS \
|
||||
"mem=64M@0x0 no_console_suspend console=ttyS2,115200n8 lpj=5009408 ip=off"
|
||||
# define OF_RECOVERY_BTN (BUTTON_PREV|BUTTON_NEXT)
|
||||
#elif defined(EROS_QN)
|
||||
# define BL_RECOVERY BUTTON_VOL_UP
|
||||
# define BL_UP BUTTON_SCROLL_BACK
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue