forked from len0rd/rockbox
Moved SH1 system code to target tree. * First shot at hwcompat cleanup.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13114 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b16137e10b
commit
8636e6949e
31 changed files with 36 additions and 559 deletions
|
@ -86,6 +86,7 @@
|
|||
#ifdef IAUDIO_X5
|
||||
#include "ds2411.h"
|
||||
#endif
|
||||
#include "hwcompat.h"
|
||||
|
||||
#ifndef SIMULATOR
|
||||
static bool dbg_list(char *title, int count, int selection_size,
|
||||
|
@ -405,8 +406,8 @@ static bool dbg_hw_info(void)
|
|||
{
|
||||
#if CONFIG_CPU == SH7034
|
||||
char buf[32];
|
||||
int bitmask = *(unsigned short*)0x20000fc;
|
||||
int rom_version = *(unsigned short*)0x20000fe;
|
||||
int bitmask = HW_MASK;
|
||||
int rom_version = ROM_VERSION;
|
||||
unsigned manu, id; /* flash IDs */
|
||||
bool got_id; /* flag if we managed to get the flash IDs */
|
||||
unsigned rom_crc = 0xffffffff; /* CRC32 of the boot ROM */
|
||||
|
@ -564,7 +565,7 @@ static bool dbg_hw_info(void)
|
|||
char buf[32];
|
||||
int button;
|
||||
int currval = 0;
|
||||
int rom_version = *(unsigned short*)0x20000fe;
|
||||
int rom_version = ROM_VERSION;
|
||||
unsigned manu, id; /* flash IDs */
|
||||
bool got_id; /* flag if we managed to get the flash IDs */
|
||||
unsigned rom_crc = 0xffffffff; /* CRC32 of the boot ROM */
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <stdlib.h>
|
||||
#include "config.h"
|
||||
|
||||
#include "hwcompat.h"
|
||||
#include "lcd.h"
|
||||
#include "font.h"
|
||||
#include "backlight.h"
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "icons.h"
|
||||
#include "font.h"
|
||||
#include "peakmeter.h"
|
||||
#include "hwcompat.h"
|
||||
#endif
|
||||
#include "lang.h"
|
||||
#include "language.h"
|
||||
|
|
|
@ -12,7 +12,6 @@ logf.c
|
|||
#ifdef RB_PROFILE
|
||||
profile.c
|
||||
#endif /* RB_PROFILE */
|
||||
hwcompat.c
|
||||
kernel.c
|
||||
rolo.c
|
||||
thread.c
|
||||
|
@ -238,6 +237,7 @@ target/sh/memcpy-sh.S
|
|||
target/sh/memmove-sh.S
|
||||
target/sh/memset-sh.S
|
||||
target/sh/strlen-sh.S
|
||||
target/sh/system-sh.c
|
||||
#endif /* SIMULATOR */
|
||||
|
||||
#elif defined(CPU_COLDFIRE)
|
||||
|
@ -316,6 +316,7 @@ drivers/i2c.c
|
|||
target/sh/archos/ata-archos.c
|
||||
target/sh/archos/ata-as-archos.S
|
||||
target/sh/archos/player/button-player.c
|
||||
target/sh/archos/player/hwcompat-player.c
|
||||
target/sh/archos/player/lcd-as-player.S
|
||||
target/sh/archos/player/lcd-player.c
|
||||
target/sh/archos/player/usb-player.c
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "usb.h"
|
||||
#include "power.h"
|
||||
#include "string.h"
|
||||
#include "hwcompat.h"
|
||||
#include "ata_idle_notify.h"
|
||||
#include "ata-target.h"
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "usb.h"
|
||||
#include "power.h"
|
||||
#include "string.h"
|
||||
#include "hwcompat.h"
|
||||
*/
|
||||
|
||||
#define SECTOR_SIZE (512)
|
||||
|
|
|
@ -1163,7 +1163,7 @@ int ata_init(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
new_mmc_circuit = ((read_hw_mask() & MMC_CLOCK_POLARITY) != 0);
|
||||
new_mmc_circuit = ((HW_MASK & MMC_CLOCK_POLARITY) != 0);
|
||||
ata_enable(true);
|
||||
|
||||
if ( !initialized )
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include "debug.h"
|
||||
#include "system.h"
|
||||
#include "font.h"
|
||||
#include "hwcompat.h"
|
||||
#include "rbunicode.h"
|
||||
#include "bidi.h"
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ void mas_reset(void)
|
|||
or_b(0x01, &PADRH);
|
||||
sleep(HZ/5);
|
||||
#elif (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
||||
if (read_hw_mask() & ATA_ADDRESS_200)
|
||||
if (HW_MASK & ATA_ADDRESS_200)
|
||||
{
|
||||
and_b(~0x01, &PADRH);
|
||||
sleep(HZ/100);
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "kernel.h"
|
||||
#include "system.h"
|
||||
#include "power.h"
|
||||
#include "hwcompat.h"
|
||||
#include "logf.h"
|
||||
#include "pcf50605.h"
|
||||
#include "pcf50606.h"
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
#include <stdbool.h>
|
||||
#include "config.h"
|
||||
|
||||
#if (CONFIG_CPU == SH7034) && !defined(SIMULATOR)
|
||||
|
||||
#define ROM_VERSION (*(short *)0x020000fe)
|
||||
|
||||
/* Bit mask values for HW compatibility */
|
||||
#define ATA_ADDRESS_200 0x0100
|
||||
#define USB_ACTIVE_HIGH 0x0100
|
||||
|
@ -30,11 +34,16 @@
|
|||
#define MMC_CLOCK_POLARITY 0x0400
|
||||
#define TUNER_MODEL 0x0800
|
||||
|
||||
int read_rom_version(void);
|
||||
int read_hw_mask(void);
|
||||
#ifdef ARCHOS_PLAYER
|
||||
#define HW_MASK 0
|
||||
#else /* Recorders, Ondios */
|
||||
#define HW_MASK (*(short *)0x020000fc)
|
||||
#endif
|
||||
|
||||
#endif /* (CONFIG_CPU == SH7034) && !SIMULATOR */
|
||||
|
||||
#ifdef ARCHOS_PLAYER
|
||||
bool is_new_player(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* HWCOMPAT_H */
|
||||
|
|
|
@ -196,110 +196,14 @@ enum {
|
|||
};
|
||||
|
||||
#ifndef SIMULATOR
|
||||
#ifdef CPU_COLDFIRE
|
||||
#include "system-target.h"
|
||||
#endif
|
||||
#endif
|
||||
#ifndef SIMULATOR
|
||||
#if CONFIG_CPU == S3C2440
|
||||
#if defined(CPU_COLDFIRE) || (CONFIG_CPU == S3C2440) || (CONFIG_CPU == SH7034)
|
||||
#include "system-target.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_CPU == SH7034
|
||||
#define or_b(mask, address) \
|
||||
asm \
|
||||
("or.b %0,@(r0,gbr)" \
|
||||
: \
|
||||
: /* %0 */ I_CONSTRAINT((char)(mask)), \
|
||||
/* %1 */ "z"(address-GBR))
|
||||
|
||||
#define and_b(mask, address) \
|
||||
asm \
|
||||
("and.b %0,@(r0,gbr)" \
|
||||
: \
|
||||
: /* %0 */ I_CONSTRAINT((char)(mask)), \
|
||||
/* %1 */ "z"(address-GBR))
|
||||
|
||||
#define xor_b(mask, address) \
|
||||
asm \
|
||||
("xor.b %0,@(r0,gbr)" \
|
||||
: \
|
||||
: /* %0 */ I_CONSTRAINT((char)(mask)), \
|
||||
/* %1 */ "z"(address-GBR))
|
||||
|
||||
|
||||
#endif /* CONFIG_CPU == SH7034 */
|
||||
|
||||
#ifndef SIMULATOR
|
||||
|
||||
/****************************************************************************
|
||||
* Interrupt level setting
|
||||
* The level is left shifted 4 bits
|
||||
****************************************************************************/
|
||||
#if CONFIG_CPU == SH7034
|
||||
#define HIGHEST_IRQ_LEVEL (15<<4)
|
||||
static inline int set_irq_level(int level)
|
||||
{
|
||||
int i;
|
||||
/* Read the old level and set the new one */
|
||||
asm volatile ("stc sr, %0" : "=r" (i));
|
||||
asm volatile ("ldc %0, sr" : : "r" (level));
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline uint16_t swap16(uint16_t value)
|
||||
/*
|
||||
result[15..8] = value[ 7..0];
|
||||
result[ 7..0] = value[15..8];
|
||||
*/
|
||||
{
|
||||
uint16_t result;
|
||||
asm volatile ("swap.b\t%1,%0" : "=r"(result) : "r"(value));
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline uint32_t SWAW32(uint32_t value)
|
||||
/*
|
||||
result[31..16] = value[15.. 0];
|
||||
result[15.. 0] = value[31..16];
|
||||
*/
|
||||
{
|
||||
uint32_t result;
|
||||
asm volatile ("swap.w\t%1,%0" : "=r"(result) : "r"(value));
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline uint32_t swap32(uint32_t value)
|
||||
/*
|
||||
result[31..24] = value[ 7.. 0];
|
||||
result[23..16] = value[15.. 8];
|
||||
result[15.. 8] = value[23..16];
|
||||
result[ 7.. 0] = value[31..24];
|
||||
*/
|
||||
{
|
||||
asm volatile ("swap.b\t%0,%0\n"
|
||||
"swap.w\t%0,%0\n"
|
||||
"swap.b\t%0,%0\n" : "+r"(value));
|
||||
return value;
|
||||
}
|
||||
|
||||
static inline uint32_t swap_odd_even32(uint32_t value)
|
||||
{
|
||||
/*
|
||||
result[31..24],[15.. 8] = value[23..16],[ 7.. 0]
|
||||
result[23..16],[ 7.. 0] = value[31..24],[15.. 8]
|
||||
*/
|
||||
asm volatile ("swap.b\t%0,%0\n"
|
||||
"swap.w\t%0,%0\n"
|
||||
"swap.b\t%0,%0\n"
|
||||
"swap.w\t%0,%0\n" : "+r"(value));
|
||||
return value;
|
||||
}
|
||||
|
||||
#define invalidate_icache()
|
||||
|
||||
#elif defined(CPU_ARM)
|
||||
#if defined(CPU_ARM)
|
||||
|
||||
/* TODO: Implement set_irq_level and check CPU frequencies */
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ static inline void tuner_init(void)
|
|||
{
|
||||
#ifndef SIMULATOR
|
||||
#if CONFIG_TUNER == (S1A0903X01 | TEA5767)
|
||||
if (read_hw_mask() & TUNER_MODEL)
|
||||
if (HW_MASK & TUNER_MODEL)
|
||||
{
|
||||
_radio_set = philips_set;
|
||||
_radio_get = philips_get;
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "mas.h"
|
||||
#include "dac.h"
|
||||
#include "system.h"
|
||||
#include "hwcompat.h"
|
||||
#endif
|
||||
|
||||
/* hacking into mpeg.c, recording is still there */
|
||||
|
|
|
@ -2911,7 +2911,7 @@ void audio_init(void)
|
|||
memset(trackdata, sizeof(trackdata), 0);
|
||||
|
||||
#if (CONFIG_CODEC == MAS3587F) && !defined(SIMULATOR)
|
||||
if(read_hw_mask() & PR_ACTIVE_HIGH)
|
||||
if (HW_MASK & PR_ACTIVE_HIGH)
|
||||
and_b(~0x08, &PADRH);
|
||||
else
|
||||
or_b(0x08, &PADRH);
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#endif
|
||||
#include "dac.h"
|
||||
#include "system.h"
|
||||
#include "hwcompat.h"
|
||||
#if CONFIG_CODEC == SWCODEC
|
||||
#include "pcm_playback.h"
|
||||
#endif
|
||||
|
|
|
@ -171,407 +171,7 @@ bool detect_original_firmware(void)
|
|||
return !(detect_flashed_ramimage() || detect_flashed_romimage());
|
||||
}
|
||||
|
||||
#if CONFIG_CPU == SH7034
|
||||
#include "led.h"
|
||||
#include "system.h"
|
||||
#include "rolo.h"
|
||||
|
||||
static const char* const irqname[] = {
|
||||
"", "", "", "", "IllInstr", "", "IllSltIn","","",
|
||||
"CPUAdrEr", "DMAAdrEr", "NMI", "UserBrk",
|
||||
"","","","","","","","","","","","","","","","","","","",
|
||||
"Trap32","Trap33","Trap34","Trap35","Trap36","Trap37","Trap38","Trap39",
|
||||
"Trap40","Trap41","Trap42","Trap43","Trap44","Trap45","Trap46","Trap47",
|
||||
"Trap48","Trap49","Trap50","Trap51","Trap52","Trap53","Trap54","Trap55",
|
||||
"Trap56","Trap57","Trap58","Trap59","Trap60","Trap61","Trap62","Trap63",
|
||||
"Irq0","Irq1","Irq2","Irq3","Irq4","Irq5","Irq6","Irq7",
|
||||
"Dma0","","Dma1","","Dma2","","Dma3","",
|
||||
"IMIA0","IMIB0","OVI0","", "IMIA1","IMIB1","OVI1","",
|
||||
"IMIA2","IMIB2","OVI2","", "IMIA3","IMIB3","OVI3","",
|
||||
"IMIA4","IMIB4","OVI4","",
|
||||
"Ser0Err","Ser0Rx","Ser0Tx","Ser0TE",
|
||||
"Ser1Err","Ser1Rx","Ser1Tx","Ser1TE",
|
||||
"ParityEr","A/D conv","","","Watchdog","DRAMRefr"
|
||||
};
|
||||
|
||||
#define RESERVE_INTERRUPT(number) "\t.long\t_UIE" #number "\n"
|
||||
#define DEFAULT_INTERRUPT(name, number) "\t.weak\t_" #name \
|
||||
"\n\t.set\t_" #name ",_UIE" #number \
|
||||
"\n\t.long\t_" #name "\n"
|
||||
|
||||
asm (
|
||||
|
||||
/* Vector table.
|
||||
* Handled in asm because gcc 4.x doesn't allow weak aliases to symbols
|
||||
* defined in an asm block -- silly.
|
||||
* Reset vectors (0..3) are handled in crt0.S */
|
||||
|
||||
".section\t.vectors,\"aw\",@progbits\n"
|
||||
DEFAULT_INTERRUPT (GII, 4)
|
||||
RESERVE_INTERRUPT ( 5)
|
||||
DEFAULT_INTERRUPT (ISI, 6)
|
||||
RESERVE_INTERRUPT ( 7)
|
||||
RESERVE_INTERRUPT ( 8)
|
||||
DEFAULT_INTERRUPT (CPUAE, 9)
|
||||
DEFAULT_INTERRUPT (DMAAE, 10)
|
||||
DEFAULT_INTERRUPT (NMI, 11)
|
||||
DEFAULT_INTERRUPT (UB, 12)
|
||||
RESERVE_INTERRUPT ( 13)
|
||||
RESERVE_INTERRUPT ( 14)
|
||||
RESERVE_INTERRUPT ( 15)
|
||||
RESERVE_INTERRUPT ( 16) /* TCB #0 */
|
||||
RESERVE_INTERRUPT ( 17) /* TCB #1 */
|
||||
RESERVE_INTERRUPT ( 18) /* TCB #2 */
|
||||
RESERVE_INTERRUPT ( 19) /* TCB #3 */
|
||||
RESERVE_INTERRUPT ( 20) /* TCB #4 */
|
||||
RESERVE_INTERRUPT ( 21) /* TCB #5 */
|
||||
RESERVE_INTERRUPT ( 22) /* TCB #6 */
|
||||
RESERVE_INTERRUPT ( 23) /* TCB #7 */
|
||||
RESERVE_INTERRUPT ( 24) /* TCB #8 */
|
||||
RESERVE_INTERRUPT ( 25) /* TCB #9 */
|
||||
RESERVE_INTERRUPT ( 26) /* TCB #10 */
|
||||
RESERVE_INTERRUPT ( 27) /* TCB #11 */
|
||||
RESERVE_INTERRUPT ( 28) /* TCB #12 */
|
||||
RESERVE_INTERRUPT ( 29) /* TCB #13 */
|
||||
RESERVE_INTERRUPT ( 30) /* TCB #14 */
|
||||
RESERVE_INTERRUPT ( 31) /* TCB #15 */
|
||||
DEFAULT_INTERRUPT (TRAPA32, 32)
|
||||
DEFAULT_INTERRUPT (TRAPA33, 33)
|
||||
DEFAULT_INTERRUPT (TRAPA34, 34)
|
||||
DEFAULT_INTERRUPT (TRAPA35, 35)
|
||||
DEFAULT_INTERRUPT (TRAPA36, 36)
|
||||
DEFAULT_INTERRUPT (TRAPA37, 37)
|
||||
DEFAULT_INTERRUPT (TRAPA38, 38)
|
||||
DEFAULT_INTERRUPT (TRAPA39, 39)
|
||||
DEFAULT_INTERRUPT (TRAPA40, 40)
|
||||
DEFAULT_INTERRUPT (TRAPA41, 41)
|
||||
DEFAULT_INTERRUPT (TRAPA42, 42)
|
||||
DEFAULT_INTERRUPT (TRAPA43, 43)
|
||||
DEFAULT_INTERRUPT (TRAPA44, 44)
|
||||
DEFAULT_INTERRUPT (TRAPA45, 45)
|
||||
DEFAULT_INTERRUPT (TRAPA46, 46)
|
||||
DEFAULT_INTERRUPT (TRAPA47, 47)
|
||||
DEFAULT_INTERRUPT (TRAPA48, 48)
|
||||
DEFAULT_INTERRUPT (TRAPA49, 49)
|
||||
DEFAULT_INTERRUPT (TRAPA50, 50)
|
||||
DEFAULT_INTERRUPT (TRAPA51, 51)
|
||||
DEFAULT_INTERRUPT (TRAPA52, 52)
|
||||
DEFAULT_INTERRUPT (TRAPA53, 53)
|
||||
DEFAULT_INTERRUPT (TRAPA54, 54)
|
||||
DEFAULT_INTERRUPT (TRAPA55, 55)
|
||||
DEFAULT_INTERRUPT (TRAPA56, 56)
|
||||
DEFAULT_INTERRUPT (TRAPA57, 57)
|
||||
DEFAULT_INTERRUPT (TRAPA58, 58)
|
||||
DEFAULT_INTERRUPT (TRAPA59, 59)
|
||||
DEFAULT_INTERRUPT (TRAPA60, 60)
|
||||
DEFAULT_INTERRUPT (TRAPA61, 61)
|
||||
DEFAULT_INTERRUPT (TRAPA62, 62)
|
||||
DEFAULT_INTERRUPT (TRAPA63, 63)
|
||||
DEFAULT_INTERRUPT (IRQ0, 64)
|
||||
DEFAULT_INTERRUPT (IRQ1, 65)
|
||||
DEFAULT_INTERRUPT (IRQ2, 66)
|
||||
DEFAULT_INTERRUPT (IRQ3, 67)
|
||||
DEFAULT_INTERRUPT (IRQ4, 68)
|
||||
DEFAULT_INTERRUPT (IRQ5, 69)
|
||||
DEFAULT_INTERRUPT (IRQ6, 70)
|
||||
DEFAULT_INTERRUPT (IRQ7, 71)
|
||||
DEFAULT_INTERRUPT (DEI0, 72)
|
||||
RESERVE_INTERRUPT ( 73)
|
||||
DEFAULT_INTERRUPT (DEI1, 74)
|
||||
RESERVE_INTERRUPT ( 75)
|
||||
DEFAULT_INTERRUPT (DEI2, 76)
|
||||
RESERVE_INTERRUPT ( 77)
|
||||
DEFAULT_INTERRUPT (DEI3, 78)
|
||||
RESERVE_INTERRUPT ( 79)
|
||||
DEFAULT_INTERRUPT (IMIA0, 80)
|
||||
DEFAULT_INTERRUPT (IMIB0, 81)
|
||||
DEFAULT_INTERRUPT (OVI0, 82)
|
||||
RESERVE_INTERRUPT ( 83)
|
||||
DEFAULT_INTERRUPT (IMIA1, 84)
|
||||
DEFAULT_INTERRUPT (IMIB1, 85)
|
||||
DEFAULT_INTERRUPT (OVI1, 86)
|
||||
RESERVE_INTERRUPT ( 87)
|
||||
DEFAULT_INTERRUPT (IMIA2, 88)
|
||||
DEFAULT_INTERRUPT (IMIB2, 89)
|
||||
DEFAULT_INTERRUPT (OVI2, 90)
|
||||
RESERVE_INTERRUPT ( 91)
|
||||
DEFAULT_INTERRUPT (IMIA3, 92)
|
||||
DEFAULT_INTERRUPT (IMIB3, 93)
|
||||
DEFAULT_INTERRUPT (OVI3, 94)
|
||||
RESERVE_INTERRUPT ( 95)
|
||||
DEFAULT_INTERRUPT (IMIA4, 96)
|
||||
DEFAULT_INTERRUPT (IMIB4, 97)
|
||||
DEFAULT_INTERRUPT (OVI4, 98)
|
||||
RESERVE_INTERRUPT ( 99)
|
||||
DEFAULT_INTERRUPT (REI0, 100)
|
||||
DEFAULT_INTERRUPT (RXI0, 101)
|
||||
DEFAULT_INTERRUPT (TXI0, 102)
|
||||
DEFAULT_INTERRUPT (TEI0, 103)
|
||||
DEFAULT_INTERRUPT (REI1, 104)
|
||||
DEFAULT_INTERRUPT (RXI1, 105)
|
||||
DEFAULT_INTERRUPT (TXI1, 106)
|
||||
DEFAULT_INTERRUPT (TEI1, 107)
|
||||
RESERVE_INTERRUPT ( 108)
|
||||
DEFAULT_INTERRUPT (ADITI, 109)
|
||||
|
||||
/* UIE# block.
|
||||
* Must go into the same section as the UIE() handler */
|
||||
|
||||
"\t.text\n"
|
||||
"_UIE4:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE5:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE6:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE7:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE8:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE9:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE10:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE11:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE12:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE13:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE14:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE15:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE16:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE17:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE18:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE19:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE20:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE21:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE22:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE23:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE24:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE25:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE26:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE27:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE28:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE29:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE30:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE31:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE32:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE33:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE34:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE35:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE36:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE37:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE38:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE39:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE40:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE41:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE42:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE43:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE44:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE45:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE46:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE47:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE48:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE49:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE50:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE51:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE52:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE53:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE54:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE55:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE56:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE57:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE58:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE59:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE60:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE61:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE62:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE63:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE64:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE65:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE66:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE67:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE68:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE69:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE70:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE71:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE72:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE73:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE74:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE75:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE76:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE77:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE78:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE79:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE80:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE81:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE82:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE83:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE84:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE85:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE86:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE87:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE88:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE89:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE90:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE91:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE92:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE93:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE94:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE95:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE96:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE97:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE98:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE99:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE100:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE101:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE102:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE103:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE104:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE105:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE106:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE107:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE108:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
"_UIE109:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\n"
|
||||
|
||||
);
|
||||
|
||||
extern void UIE4(void); /* needed for calculating the UIE number */
|
||||
|
||||
void UIE (unsigned int pc) __attribute__((section(".text")));
|
||||
void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */
|
||||
{
|
||||
#if CONFIG_LED == LED_REAL
|
||||
bool state = false;
|
||||
int i = 0;
|
||||
#endif
|
||||
unsigned int n;
|
||||
char str[32];
|
||||
|
||||
asm volatile ("sts\tpr,%0" : "=r"(n));
|
||||
|
||||
/* clear screen */
|
||||
lcd_clear_display ();
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
lcd_setfont(FONT_SYSFIXED);
|
||||
#endif
|
||||
/* output exception */
|
||||
n = (n - (unsigned)UIE4 + 12)>>2; /* get exception or interrupt number */
|
||||
snprintf(str,sizeof(str),"I%02x:%s",n,irqname[n]);
|
||||
lcd_puts(0,0,str);
|
||||
snprintf(str,sizeof(str),"at %08x",pc);
|
||||
lcd_puts(0,1,str);
|
||||
lcd_update ();
|
||||
|
||||
while (1)
|
||||
{
|
||||
#if CONFIG_LED == LED_REAL
|
||||
if (--i <= 0)
|
||||
{
|
||||
state = !state;
|
||||
led(state);
|
||||
i = 240000;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* try to restart firmware if ON is pressed */
|
||||
#if CONFIG_KEYPAD == PLAYER_PAD
|
||||
if (!(PADRL & 0x20))
|
||||
#elif CONFIG_KEYPAD == RECORDER_PAD
|
||||
#ifdef HAVE_FMADC
|
||||
if (!(PCDR & 0x0008))
|
||||
#else
|
||||
if (!(PBDRH & 0x01))
|
||||
#endif
|
||||
#elif CONFIG_KEYPAD == ONDIO_PAD
|
||||
if (!(PCDR & 0x0008))
|
||||
#endif
|
||||
{
|
||||
/* enable the watchguard timer, but don't service it */
|
||||
RSTCSR_W = 0x5a40; /* Reset enabled, power-on reset */
|
||||
TCSR_W = 0xa560; /* Watchdog timer mode, timer enabled, sysclk/2 */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void system_init(void)
|
||||
{
|
||||
/* Disable all interrupts */
|
||||
IPRA = 0;
|
||||
IPRB = 0;
|
||||
IPRC = 0;
|
||||
IPRD = 0;
|
||||
IPRE = 0;
|
||||
|
||||
/* NMI level low, falling edge on all interrupts */
|
||||
ICR = 0;
|
||||
|
||||
/* Enable burst and RAS down mode on DRAM */
|
||||
DCR |= 0x5000;
|
||||
|
||||
/* Activate Warp mode (simultaneous internal and external mem access) */
|
||||
BCR |= 0x2000;
|
||||
|
||||
/* Bus state controller initializations. These are only necessary when
|
||||
running from flash. */
|
||||
WCR1 = 0x40FD; /* Long wait states for CS6 (ATA), short for the rest. */
|
||||
WCR3 = 0x8000; /* WAIT is pulled up, 1 state inserted for CS6 */
|
||||
}
|
||||
|
||||
void system_reboot (void)
|
||||
{
|
||||
set_irq_level(HIGHEST_IRQ_LEVEL);
|
||||
|
||||
asm volatile ("ldc\t%0,vbr" : : "r"(0));
|
||||
|
||||
PACR2 |= 0x4000; /* for coldstart detection */
|
||||
IPRA = 0;
|
||||
IPRB = 0;
|
||||
IPRC = 0;
|
||||
IPRD = 0;
|
||||
IPRE = 0;
|
||||
ICR = 0;
|
||||
|
||||
asm volatile ("jmp @%0; mov.l @%1,r15" : :
|
||||
"r"(*(int*)0),"r"(4));
|
||||
}
|
||||
|
||||
/* Utilise the user break controller to catch invalid memory accesses. */
|
||||
int system_memory_guard(int newmode)
|
||||
{
|
||||
static const struct {
|
||||
unsigned long addr;
|
||||
unsigned long mask;
|
||||
unsigned short bbr;
|
||||
} modes[MAXMEMGUARD] = {
|
||||
/* catch nothing */
|
||||
{ 0x00000000, 0x00000000, 0x0000 },
|
||||
/* catch writes to area 02 (flash ROM) */
|
||||
{ 0x02000000, 0x00FFFFFF, 0x00F8 },
|
||||
/* catch all accesses to areas 00 (internal ROM) and 01 (free) */
|
||||
{ 0x00000000, 0x01FFFFFF, 0x00FC }
|
||||
};
|
||||
|
||||
int oldmode = MEMGUARD_NONE;
|
||||
int i;
|
||||
|
||||
/* figure out the old mode from what is in the UBC regs. If the register
|
||||
values don't match any mode, assume MEMGUARD_NONE */
|
||||
for (i = MEMGUARD_NONE; i < MAXMEMGUARD; i++)
|
||||
{
|
||||
if (BAR == modes[i].addr && BAMR == modes[i].mask &&
|
||||
BBR == modes[i].bbr)
|
||||
{
|
||||
oldmode = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (newmode == MEMGUARD_KEEP)
|
||||
newmode = oldmode;
|
||||
|
||||
BBR = 0; /* switch off everything first */
|
||||
|
||||
/* always set the UBC according to the mode, in case the old settings
|
||||
didn't match any valid mode */
|
||||
BAR = modes[newmode].addr;
|
||||
BAMR = modes[newmode].mask;
|
||||
BBR = modes[newmode].bbr;
|
||||
|
||||
return oldmode;
|
||||
}
|
||||
#elif defined(CPU_ARM)
|
||||
#if defined(CPU_ARM)
|
||||
|
||||
static const char* const uiename[] = {
|
||||
"Undefined instruction", "Prefetch abort", "Data abort"
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <stdbool.h>
|
||||
#include "kernel.h"
|
||||
#include "system.h"
|
||||
#include "hwcompat.h"
|
||||
#include "logf.h"
|
||||
#include "debug.h"
|
||||
#include "string.h"
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <stdbool.h>
|
||||
#include "kernel.h"
|
||||
#include "system.h"
|
||||
#include "hwcompat.h"
|
||||
#include "logf.h"
|
||||
#include "debug.h"
|
||||
#include "string.h"
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <stdbool.h>
|
||||
#include "kernel.h"
|
||||
#include "system.h"
|
||||
#include "hwcompat.h"
|
||||
#include "logf.h"
|
||||
#include "debug.h"
|
||||
#include "string.h"
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "kernel.h"
|
||||
#include "system.h"
|
||||
#include "power.h"
|
||||
#include "hwcompat.h"
|
||||
#include "logf.h"
|
||||
#include "pcf50605.h"
|
||||
#include "usb.h"
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "kernel.h"
|
||||
#include "system.h"
|
||||
#include "power.h"
|
||||
#include "hwcompat.h"
|
||||
#include "logf.h"
|
||||
#include "usb.h"
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "kernel.h"
|
||||
#include "system.h"
|
||||
#include "power.h"
|
||||
#include "hwcompat.h"
|
||||
#include "logf.h"
|
||||
#include "usb.h"
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "button.h"
|
||||
#include "sprintf.h"
|
||||
#include "string.h"
|
||||
#include "hwcompat.h"
|
||||
|
||||
void usb_init_device(void)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "kernel.h"
|
||||
#include "system.h"
|
||||
#include "power.h"
|
||||
#include "hwcompat.h"
|
||||
#include "logf.h"
|
||||
#include "usb.h"
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ void ata_device_init(void)
|
|||
or_b(0x02, &PADRH); /* release ATA reset */
|
||||
PACR2 &= 0xBFFF; /* GPIO function for PA7 (IDE enable) */
|
||||
|
||||
if (read_hw_mask() & ATA_ADDRESS_200)
|
||||
if (HW_MASK & ATA_ADDRESS_200)
|
||||
ata_control = ATA_CONTROL1;
|
||||
else
|
||||
ata_control = ATA_CONTROL2;
|
||||
|
|
|
@ -30,7 +30,7 @@ bool usb_detect(void)
|
|||
|
||||
void usb_enable(bool on)
|
||||
{
|
||||
if(read_hw_mask() & USB_ACTIVE_HIGH)
|
||||
if(HW_MASK & USB_ACTIVE_HIGH)
|
||||
on = !on;
|
||||
|
||||
if(on)
|
||||
|
|
|
@ -73,7 +73,7 @@ static int xoffset; /* needed for flip */
|
|||
|
||||
int lcd_default_contrast(void)
|
||||
{
|
||||
return (read_hw_mask() & LCD_CONTRAST_BIAS) ? 31 : 49;
|
||||
return (HW_MASK & LCD_CONTRAST_BIAS) ? 31 : 49;
|
||||
}
|
||||
|
||||
void lcd_set_contrast(int val)
|
||||
|
|
|
@ -35,14 +35,14 @@ void usb_enable(bool on)
|
|||
{
|
||||
mmc_enable_int_flash_clock(!mmc_detect());
|
||||
|
||||
if (!(read_hw_mask() & MMC_CLOCK_POLARITY))
|
||||
if (!(HW_MASK & MMC_CLOCK_POLARITY))
|
||||
and_b(~0x20, &PBDRH); /* old circuit needs SCK1 = low while on USB */
|
||||
or_b(0x20, &PADRL); /* enable USB */
|
||||
and_b(~0x08, &PADRL); /* assert card detect */
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(read_hw_mask() & MMC_CLOCK_POLARITY))
|
||||
if (!(HW_MASK & MMC_CLOCK_POLARITY))
|
||||
or_b(0x20, &PBDRH); /* reset SCK1 = high for old circuit */
|
||||
and_b(~0x20, &PADRL); /* disable USB */
|
||||
or_b(0x08, &PADRL); /* deassert card detect */
|
||||
|
|
|
@ -16,33 +16,11 @@
|
|||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "config.h"
|
||||
#include "debug.h"
|
||||
#include "hwcompat.h"
|
||||
|
||||
int read_rom_version(void)
|
||||
{
|
||||
int ver = *(short *)0x020000fe;
|
||||
|
||||
return ver;
|
||||
}
|
||||
|
||||
int read_hw_mask(void)
|
||||
{
|
||||
#ifdef ARCHOS_PLAYER
|
||||
int mask = 0; /* Fake value for simplicity */
|
||||
#else
|
||||
int mask = *(short *)0x020000fc;
|
||||
#endif
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
#ifdef ARCHOS_PLAYER
|
||||
bool is_new_player(void)
|
||||
{
|
||||
int ver = read_rom_version();
|
||||
|
||||
return (ver > 449) || (ver == 116);
|
||||
return (ROM_VERSION > 449) || (ROM_VERSION == 116);
|
||||
}
|
||||
#endif
|
|
@ -30,7 +30,7 @@ bool usb_detect(void)
|
|||
|
||||
void usb_enable(bool on)
|
||||
{
|
||||
if(read_hw_mask() & USB_ACTIVE_HIGH)
|
||||
if(HW_MASK & USB_ACTIVE_HIGH)
|
||||
on = !on;
|
||||
|
||||
if(on)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue