mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-10 21:55:10 -05:00
Add hwstub support for portal player (manufacturer mode)
It is very similar to how e200tool from MrH works but uses the framework of hwstub which is makes it completely trivial since we already have the USB driver written. Change-Id: I61cdc245d3f828c2682bcd6ecfed5a1cc0094139
This commit is contained in:
parent
399acc0387
commit
ccfa51835e
7 changed files with 209 additions and 0 deletions
|
|
@ -95,6 +95,7 @@ struct hwstub_stmp_desc_t
|
||||||
#define HWSTUB_TARGET_UNK ('U' | 'N' << 8 | 'K' << 16 | ' ' << 24)
|
#define HWSTUB_TARGET_UNK ('U' | 'N' << 8 | 'K' << 16 | ' ' << 24)
|
||||||
#define HWSTUB_TARGET_STMP ('S' | 'T' << 8 | 'M' << 16 | 'P' << 24)
|
#define HWSTUB_TARGET_STMP ('S' | 'T' << 8 | 'M' << 16 | 'P' << 24)
|
||||||
#define HWSTUB_TARGET_RK27 ('R' | 'K' << 8 | '2' << 16 | '7' << 24)
|
#define HWSTUB_TARGET_RK27 ('R' | 'K' << 8 | '2' << 16 | '7' << 24)
|
||||||
|
#define HWSTUB_TARGET_PP ('P' | 'P' << 8 | ' ' << 16 | ' ' << 24)
|
||||||
|
|
||||||
struct hwstub_target_desc_t
|
struct hwstub_target_desc_t
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,8 @@ usb_drv_arc.c
|
||||||
rk27xx/crt0.S
|
rk27xx/crt0.S
|
||||||
rk27xx/usb_drv_rk27xx.c
|
rk27xx/usb_drv_rk27xx.c
|
||||||
rk27xx/target.c
|
rk27xx/target.c
|
||||||
|
#elif defined(CONFIG_PP)
|
||||||
|
pp/crt0.S
|
||||||
|
pp/target.c
|
||||||
|
usb_drv_arc.c
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
14
utils/hwstub/stub/pp/Makefile
Normal file
14
utils/hwstub/stub/pp/Makefile
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
#
|
||||||
|
# common
|
||||||
|
#
|
||||||
|
CC=arm-elf-eabi-gcc
|
||||||
|
LD=arm-elf-eabi-gcc
|
||||||
|
AS=arm-elf-eabi-gcc
|
||||||
|
OC=arm-elf-eabi-objcopy
|
||||||
|
DEFINES=
|
||||||
|
INCLUDES=-I$(CURDIR)
|
||||||
|
GCCOPTS=-mcpu=arm926ej-s
|
||||||
|
BUILD_DIR=$(CURDIR)/build/
|
||||||
|
ROOT_DIR=$(CURDIR)/..
|
||||||
|
|
||||||
|
include ../hwstub.make
|
||||||
42
utils/hwstub/stub/pp/crt0.S
Normal file
42
utils/hwstub/stub/pp/crt0.S
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
.section .text,"ax",%progbits
|
||||||
|
.code 32
|
||||||
|
.align 0x04
|
||||||
|
.global start
|
||||||
|
start:
|
||||||
|
sub r7, pc, #8 /* Copy running address */
|
||||||
|
msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */
|
||||||
|
/* The stub could be located at a virtual address so killing the MMU at
|
||||||
|
* this point would be mere suicide. We assume that the remap location
|
||||||
|
* is identically mapped and kill the MMU after the copy */
|
||||||
|
|
||||||
|
/* Relocate to right address */
|
||||||
|
mov r2, r7
|
||||||
|
ldr r3, =_copystart
|
||||||
|
ldr r4, =_copyend
|
||||||
|
1:
|
||||||
|
cmp r4, r3
|
||||||
|
ldrhi r5, [r2], #4
|
||||||
|
strhi r5, [r3], #4
|
||||||
|
bhi 1b
|
||||||
|
mov r2, #0
|
||||||
|
mcr p15, 0, r2, c7, c5, 0 @ Invalidate ICache
|
||||||
|
/* Jump to real location */
|
||||||
|
ldr pc, =remap
|
||||||
|
remap:
|
||||||
|
/* Disable MMU, disable caching and buffering;
|
||||||
|
* use low exception range address */
|
||||||
|
mrc p15, 0, r0, c1, c0, 0
|
||||||
|
ldr r1, =0x3005
|
||||||
|
bic r0, r1
|
||||||
|
mcr p15, 0, r0, c1, c0, 0
|
||||||
|
/* clear bss */
|
||||||
|
ldr r2, =bss_start
|
||||||
|
ldr r3, =bss_end
|
||||||
|
mov r4, #0
|
||||||
|
1:
|
||||||
|
cmp r3, r2
|
||||||
|
strhi r4, [r2], #4
|
||||||
|
bhi 1b
|
||||||
|
/* jump to C code */
|
||||||
|
ldr sp, =oc_stackend
|
||||||
|
b main
|
||||||
73
utils/hwstub/stub/pp/hwstub.lds
Normal file
73
utils/hwstub/stub/pp/hwstub.lds
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 by Amaury Pouly
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
ENTRY(start)
|
||||||
|
OUTPUT_FORMAT(elf32-littlearm)
|
||||||
|
OUTPUT_ARCH(arm)
|
||||||
|
STARTUP(pp/crt0.o)
|
||||||
|
|
||||||
|
#define IRAM_END_ADDR (IRAM_ORIG + IRAM_SIZE)
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
OCRAM : ORIGIN = IRAM_ORIG, LENGTH = IRAM_SIZE
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.octext :
|
||||||
|
{
|
||||||
|
_copystart = .;
|
||||||
|
oc_codestart = .;
|
||||||
|
*(.text*)
|
||||||
|
*(.icode*)
|
||||||
|
*(.data*)
|
||||||
|
*(.rodata*)
|
||||||
|
_copyend = .;
|
||||||
|
} > OCRAM
|
||||||
|
|
||||||
|
.bss (NOLOAD) :
|
||||||
|
{
|
||||||
|
bss_start = .;
|
||||||
|
*(.bss)
|
||||||
|
bss_end = .;
|
||||||
|
} > OCRAM
|
||||||
|
|
||||||
|
.stack (NOLOAD) :
|
||||||
|
{
|
||||||
|
oc_codeend = .;
|
||||||
|
oc_stackstart = .;
|
||||||
|
. += STACK_SIZE;
|
||||||
|
oc_stackend = .;
|
||||||
|
oc_bufferstart = .;
|
||||||
|
} > OCRAM
|
||||||
|
|
||||||
|
.ocend IRAM_END_ADDR (NOLOAD) :
|
||||||
|
{
|
||||||
|
oc_bufferend = .;
|
||||||
|
} > OCRAM
|
||||||
|
|
||||||
|
/DISCARD/ :
|
||||||
|
{
|
||||||
|
*(.eh_frame)
|
||||||
|
}
|
||||||
|
}
|
||||||
9
utils/hwstub/stub/pp/target-config.h
Normal file
9
utils/hwstub/stub/pp/target-config.h
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
#define CONFIG_PP
|
||||||
|
#define IRAM_ORIG 0x40000000
|
||||||
|
#define IRAM_SIZE 0x20000
|
||||||
|
#define DRAM_ORIG 0x10f00000
|
||||||
|
#define DRAM_SIZE (MEMORYSIZE * 0x100000)
|
||||||
|
#define CPU_ARM
|
||||||
|
#define ARM_ARCH 5
|
||||||
|
#define USB_BASE 0xc5000000
|
||||||
|
#define USB_NUM_ENDPOINTS 2
|
||||||
66
utils/hwstub/stub/pp/target.c
Normal file
66
utils/hwstub/stub/pp/target.c
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 by Amaury Pouly
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#include "stddef.h"
|
||||||
|
#include "target.h"
|
||||||
|
#include "system.h"
|
||||||
|
#include "logf.h"
|
||||||
|
#include "memory.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Global
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* FIXME wrong for PP500x */
|
||||||
|
#define USEC_TIMER (*(volatile unsigned long *)(0x60005010))
|
||||||
|
|
||||||
|
struct hwstub_target_desc_t __attribute__((aligned(2))) target_descriptor =
|
||||||
|
{
|
||||||
|
sizeof(struct hwstub_target_desc_t),
|
||||||
|
HWSTUB_DT_TARGET,
|
||||||
|
HWSTUB_TARGET_PP,
|
||||||
|
"PP500x / PP502x / PP610x"
|
||||||
|
};
|
||||||
|
|
||||||
|
void target_init(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void target_get_desc(int desc, void **buffer)
|
||||||
|
{
|
||||||
|
*buffer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void target_get_config_desc(void *buffer, int *size)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void target_udelay(int us)
|
||||||
|
{
|
||||||
|
uint32_t end = USEC_TIMER + us;
|
||||||
|
while(USEC_TIMER <= end);
|
||||||
|
}
|
||||||
|
|
||||||
|
void target_mdelay(int ms)
|
||||||
|
{
|
||||||
|
return target_udelay(ms * 1000);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue