mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
Convert PortalPlayer iRivers to use USB-mode enabled bootloader. The H10 5/6GB already has a pre-boot USB mode (so it's a little redundant there) but building them the same way is simpler.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29067 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
62207228f7
commit
bcc0f88372
7 changed files with 39 additions and 91 deletions
|
|
@ -698,6 +698,9 @@ Lyre prototype 1 */
|
||||||
#define HAVE_PRIORITY_SCHEDULING
|
#define HAVE_PRIORITY_SCHEDULING
|
||||||
#define USB_STATUS_BY_EVENT
|
#define USB_STATUS_BY_EVENT
|
||||||
#define USB_DETECT_BY_DRV
|
#define USB_DETECT_BY_DRV
|
||||||
|
#if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_ARC
|
||||||
|
#define INCLUDE_TIMEOUT_API
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else /* !BOOTLOADER */
|
#else /* !BOOTLOADER */
|
||||||
|
|
@ -721,9 +724,7 @@ Lyre prototype 1 */
|
||||||
#if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_ARC
|
#if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_ARC
|
||||||
#define USB_STATUS_BY_EVENT
|
#define USB_STATUS_BY_EVENT
|
||||||
#define USB_DETECT_BY_DRV
|
#define USB_DETECT_BY_DRV
|
||||||
#if CONFIG_CPU != IMX31L
|
|
||||||
#define INCLUDE_TIMEOUT_API
|
#define INCLUDE_TIMEOUT_API
|
||||||
#endif
|
|
||||||
#endif /* HAVE_USBSTACK && USBOTG_ARC */
|
#endif /* HAVE_USBSTACK && USBOTG_ARC */
|
||||||
|
|
||||||
#if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_AS3525
|
#if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_AS3525
|
||||||
|
|
@ -912,22 +913,17 @@ Lyre prototype 1 */
|
||||||
|
|
||||||
#ifdef HAVE_HEADPHONE_DETECTION
|
#ifdef HAVE_HEADPHONE_DETECTION
|
||||||
/* Timeout objects required if headphone detection is enabled */
|
/* Timeout objects required if headphone detection is enabled */
|
||||||
#ifndef INCLUDE_TIMEOUT_API
|
|
||||||
#define INCLUDE_TIMEOUT_API
|
#define INCLUDE_TIMEOUT_API
|
||||||
#endif
|
|
||||||
#endif /* HAVE_HEADPHONE_DETECTION */
|
#endif /* HAVE_HEADPHONE_DETECTION */
|
||||||
|
|
||||||
#ifdef HAVE_TOUCHSCREEN
|
#ifdef HAVE_TOUCHSCREEN
|
||||||
/* Timeout objects required for kinetic list scrolling */
|
/* Timeout objects required for kinetic list scrolling */
|
||||||
#undef INCLUDE_TIMEOUT_API
|
|
||||||
#define INCLUDE_TIMEOUT_API
|
#define INCLUDE_TIMEOUT_API
|
||||||
#endif /* HAVE_TOUCHSCREEN */
|
#endif /* HAVE_TOUCHSCREEN */
|
||||||
|
|
||||||
#if defined(HAVE_USB_CHARGING_ENABLE) && defined(HAVE_USBSTACK)
|
#if defined(HAVE_USB_CHARGING_ENABLE) && defined(HAVE_USBSTACK)
|
||||||
/* USB charging support in the USB stack requires timeout objects */
|
/* USB charging support in the USB stack requires timeout objects */
|
||||||
#ifndef INCLUDE_TIMEOUT_API
|
|
||||||
#define INCLUDE_TIMEOUT_API
|
#define INCLUDE_TIMEOUT_API
|
||||||
#endif
|
|
||||||
#endif /* HAVE_USB_CHARGING_ENABLE && HAVE_USBSTACK */
|
#endif /* HAVE_USB_CHARGING_ENABLE && HAVE_USBSTACK */
|
||||||
|
|
||||||
#if defined(HAVE_USBSTACK) || (CONFIG_STORAGE & STORAGE_NAND)
|
#if defined(HAVE_USBSTACK) || (CONFIG_STORAGE & STORAGE_NAND)
|
||||||
|
|
|
||||||
|
|
@ -178,6 +178,9 @@
|
||||||
#define USB_VENDOR_ID 0x0B70
|
#define USB_VENDOR_ID 0x0B70
|
||||||
#define USB_PRODUCT_ID 0x00BA
|
#define USB_PRODUCT_ID 0x00BA
|
||||||
#define HAVE_USB_HID_MOUSE
|
#define HAVE_USB_HID_MOUSE
|
||||||
|
#ifdef BOOTLOADER
|
||||||
|
#define HAVE_BOOTLOADER_USB_MODE
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define this if you have adjustable CPU frequency */
|
/* Define this if you have adjustable CPU frequency */
|
||||||
#define HAVE_ADJUSTABLE_CPU_FREQ
|
#define HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,9 @@
|
||||||
#define USB_VENDOR_ID 0x0B70
|
#define USB_VENDOR_ID 0x0B70
|
||||||
#define USB_PRODUCT_ID 0x00BA
|
#define USB_PRODUCT_ID 0x00BA
|
||||||
#define HAVE_USB_HID_MOUSE
|
#define HAVE_USB_HID_MOUSE
|
||||||
|
#ifdef BOOTLOADER
|
||||||
|
#define HAVE_BOOTLOADER_USB_MODE
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define this if you have adjustable CPU frequency */
|
/* Define this if you have adjustable CPU frequency */
|
||||||
#define HAVE_ADJUSTABLE_CPU_FREQ
|
#define HAVE_ADJUSTABLE_CPU_FREQ
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ bool ata_dma_setup(void *addr, unsigned long bytes, bool write) {
|
||||||
IDE_DMA_CONTROL |= 2;
|
IDE_DMA_CONTROL |= 2;
|
||||||
IDE_DMA_LENGTH = bytes - 4;
|
IDE_DMA_LENGTH = bytes - 4;
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#if !defined(BOOTLOADER) || defined (HAVE_BOOTLOADER_USB_MODE)
|
||||||
if ((unsigned long)addr < DRAM_START)
|
if ((unsigned long)addr < DRAM_START)
|
||||||
/* Rockbox remaps DRAM to start at 0 */
|
/* Rockbox remaps DRAM to start at 0 */
|
||||||
IDE_DMA_ADDR = (unsigned long)addr + DRAM_START;
|
IDE_DMA_ADDR = (unsigned long)addr + DRAM_START;
|
||||||
|
|
|
||||||
|
|
@ -1,64 +1,2 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "../boot-pp502x-bl-usb.lds"
|
||||||
ENTRY(start)
|
|
||||||
OUTPUT_FORMAT(elf32-littlearm)
|
|
||||||
OUTPUT_ARCH(arm)
|
|
||||||
STARTUP(target/arm/crt0-pp-bl.o)
|
|
||||||
|
|
||||||
#define DRAMSIZE (MEMORYSIZE * 0x100000)
|
|
||||||
|
|
||||||
#define DRAMORIG 0x10000000
|
|
||||||
#define IRAMORIG 0x40000000
|
|
||||||
#define IRAMSIZE 0x18000
|
|
||||||
#define FLASHORIG 0x001f0000
|
|
||||||
#define FLASHSIZE 2M
|
|
||||||
|
|
||||||
MEMORY
|
|
||||||
{
|
|
||||||
DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
|
|
||||||
IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTIONS
|
|
||||||
{
|
|
||||||
. = IRAMORIG;
|
|
||||||
|
|
||||||
.text : {
|
|
||||||
*(.init.text)
|
|
||||||
*(.text*)
|
|
||||||
*(.glue_7)
|
|
||||||
*(.glue_7t)
|
|
||||||
} > IRAM
|
|
||||||
|
|
||||||
.data : {
|
|
||||||
*(.icode)
|
|
||||||
*(.irodata)
|
|
||||||
*(.idata)
|
|
||||||
*(.data*)
|
|
||||||
*(.ncdata*)
|
|
||||||
*(.rodata*)
|
|
||||||
_dataend = . ;
|
|
||||||
} > IRAM
|
|
||||||
|
|
||||||
.stack (NOLOAD) : {
|
|
||||||
*(.stack)
|
|
||||||
_stackbegin = .;
|
|
||||||
stackbegin = .;
|
|
||||||
. += 0x2000;
|
|
||||||
_stackend = .;
|
|
||||||
stackend = .;
|
|
||||||
} > IRAM
|
|
||||||
|
|
||||||
/* The bss section is too large for IRAM - we just move it 16MB into the
|
|
||||||
DRAM */
|
|
||||||
|
|
||||||
. = DRAMORIG;
|
|
||||||
.bss . + (16*1024*1024) (NOLOAD) : {
|
|
||||||
_edata = .;
|
|
||||||
*(.bss*);
|
|
||||||
*(.ibss);
|
|
||||||
*(COMMON)
|
|
||||||
*(.ncbss*);
|
|
||||||
_end = .;
|
|
||||||
} > DRAM
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,10 @@
|
||||||
#ifndef USB_TARGET_H
|
#ifndef USB_TARGET_H
|
||||||
#define USB_TARGET_H
|
#define USB_TARGET_H
|
||||||
|
|
||||||
|
#ifdef HAVE_BOOTLOADER_USB_MODE
|
||||||
|
#define USB_DRIVER_CLOSE
|
||||||
|
#endif
|
||||||
|
|
||||||
bool usb_init_device(void);
|
bool usb_init_device(void);
|
||||||
void usb_pin_init(void); /* Init the GPIO input only */
|
void usb_pin_init(void); /* Init the GPIO input only */
|
||||||
bool usb_plugged(void); /* Returns instantaneous state - always */
|
bool usb_plugged(void); /* Returns instantaneous state - always */
|
||||||
|
|
|
||||||
|
|
@ -260,12 +260,11 @@ static void init_cache(void)
|
||||||
CACHE_CTL |= CACHE_CTL_INIT | CACHE_CTL_ENABLE | CACHE_CTL_RUN;
|
CACHE_CTL |= CACHE_CTL_INIT | CACHE_CTL_ENABLE | CACHE_CTL_RUN;
|
||||||
nop; nop; nop; nop;
|
nop; nop; nop; nop;
|
||||||
}
|
}
|
||||||
#endif /* BOOTLOADER || HAVE_BOOTLOADER_USB_MODE*/
|
#endif /* BOOTLOADER || HAVE_BOOTLOADER_USB_MODE */
|
||||||
|
|
||||||
/* We need this for Sansas since we boost the cpu in their bootloader */
|
/* We need this for Sansas since we boost the cpu in their bootloader */
|
||||||
#if !defined(BOOTLOADER) || defined(HAVE_BOOTLOADER_USB_MODE) || \
|
#if !defined(BOOTLOADER) || (defined(SANSA_E200) || defined(SANSA_C200) || \
|
||||||
defined(SANSA_E200) || defined(SANSA_C200) || \
|
defined(PHILIPS_SA9200))
|
||||||
defined(PHILIPS_SA9200)
|
|
||||||
void scale_suspend_core(bool suspend) ICODE_ATTR;
|
void scale_suspend_core(bool suspend) ICODE_ATTR;
|
||||||
void scale_suspend_core(bool suspend)
|
void scale_suspend_core(bool suspend)
|
||||||
{
|
{
|
||||||
|
|
@ -409,12 +408,11 @@ static void pp_set_cpu_frequency(long frequency)
|
||||||
corelock_unlock(&cpufreq_cl);
|
corelock_unlock(&cpufreq_cl);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* !BOOTLOADER || HAVE_BOOTLOADER_USB_MODE ||
|
#endif /* !BOOTLOADER || (SANSA_E200 || SANSA_C200 || PHILIPS_SA9200) */
|
||||||
SANSA_E200 || SANSA_C200 || PHILIPS_SA9200 */
|
|
||||||
|
|
||||||
|
#ifndef BOOTLOADER
|
||||||
void system_init(void)
|
void system_init(void)
|
||||||
{
|
{
|
||||||
#ifndef BOOTLOADER
|
|
||||||
if (CURRENT_CORE == CPU)
|
if (CURRENT_CORE == CPU)
|
||||||
{
|
{
|
||||||
#if defined (IRIVER_H10) || defined(IRIVER_H10_5GB) || defined(IPOD_COLOR)
|
#if defined (IRIVER_H10) || defined(IRIVER_H10_5GB) || defined(IPOD_COLOR)
|
||||||
|
|
@ -538,10 +536,13 @@ void system_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
init_cache();
|
init_cache();
|
||||||
|
}
|
||||||
|
|
||||||
#else /* !BOOTLOADER */
|
#else /* BOOTLOADER */
|
||||||
|
|
||||||
|
void system_init(void)
|
||||||
|
{
|
||||||
/* Only the CPU gets here in the bootloader */
|
/* Only the CPU gets here in the bootloader */
|
||||||
|
|
||||||
#ifdef HAVE_BOOTLOADER_USB_MODE
|
#ifdef HAVE_BOOTLOADER_USB_MODE
|
||||||
disable_all_interrupts();
|
disable_all_interrupts();
|
||||||
init_cache();
|
init_cache();
|
||||||
|
|
@ -550,14 +551,24 @@ void system_init(void)
|
||||||
#endif /* HAVE_BOOTLOADER_USB_MODE */
|
#endif /* HAVE_BOOTLOADER_USB_MODE */
|
||||||
|
|
||||||
#if defined(SANSA_C200) || defined(SANSA_E200) || defined(PHILIPS_SA9200)
|
#if defined(SANSA_C200) || defined(SANSA_E200) || defined(PHILIPS_SA9200)
|
||||||
pp_set_cpu_frequency(CPUFREQ_MAX);
|
pp_set_cpu_frequency(CPUFREQ_MAX);
|
||||||
#endif
|
#endif
|
||||||
/* Else the frequency shot get changed upon USB connect -
|
/* Else the frequency should get changed upon USB connect -
|
||||||
* decide per-target */
|
* decide per-target */
|
||||||
|
|
||||||
#endif /* BOOTLOADER */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_BOOTLOADER_USB_MODE
|
||||||
|
void system_prepare_fw_start(void)
|
||||||
|
{
|
||||||
|
disable_interrupt(IRQ_FIQ_STATUS);
|
||||||
|
tick_stop();
|
||||||
|
disable_all_interrupts();
|
||||||
|
/* Some OF's disable this themselves, others do not and will hang. */
|
||||||
|
CACHE_CTL &= ~CACHE_CTL_VECT_REMAP;
|
||||||
|
}
|
||||||
|
#endif /* HAVE_BOOTLOADER_USB_MODE */
|
||||||
|
#endif /* !BOOTLOADER */
|
||||||
|
|
||||||
void ICODE_ATTR system_reboot(void)
|
void ICODE_ATTR system_reboot(void)
|
||||||
{
|
{
|
||||||
disable_interrupt(IRQ_FIQ_STATUS);
|
disable_interrupt(IRQ_FIQ_STATUS);
|
||||||
|
|
@ -597,10 +608,3 @@ int system_memory_guard(int newmode)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_BOOTLOADER_USB_MODE
|
|
||||||
void system_prepare_fw_start(void)
|
|
||||||
{
|
|
||||||
tick_stop();
|
|
||||||
disable_all_interrupts();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue