forked from len0rd/rockbox
Adjustments for player bootloader: (1) Correct HD power pin polarity. (2) Only power on HD if not started by charger insertion. (3) Changed button read to use port C instead of ADC. This allows for 3 buttons as on the other platforms.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5442 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0044a04c22
commit
b8b94f171a
2 changed files with 32 additions and 13 deletions
|
|
@ -122,9 +122,10 @@ void PlatformInit(void)
|
||||||
|
|
||||||
#if defined PLATFORM_PLAYER
|
#if defined PLATFORM_PLAYER
|
||||||
BRR1 = 0x0019; // 14400 Baud for monitor
|
BRR1 = 0x0019; // 14400 Baud for monitor
|
||||||
if (FW_VERSION > 451) // "new" Player?
|
PACR2 &= 0xFFFC; // GPIO for PA0 (charger detection, input by default)
|
||||||
{
|
if (FW_VERSION > 451 && (PADRL & 0x01))
|
||||||
PBDR &= ~0x10; // set PB4 to 0 to power-up the harddisk early
|
{ // "new" Player and charger not plugged?
|
||||||
|
PBDR |= 0x10; // set PB4 to 1 to power-up the harddisk early
|
||||||
PBIOR |= 0x10; // make PB4 an output
|
PBIOR |= 0x10; // make PB4 an output
|
||||||
}
|
}
|
||||||
#elif defined PLATFORM_RECORDER
|
#elif defined PLATFORM_RECORDER
|
||||||
|
|
@ -255,7 +256,7 @@ void DecompressStart(tImage* pImage)
|
||||||
pImage->pExecute();
|
pImage->pExecute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_ADC
|
||||||
int ReadADC(int channel)
|
int ReadADC(int channel)
|
||||||
{
|
{
|
||||||
// after channel 3, the ports wrap and get re-used
|
// after channel 3, the ports wrap and get re-used
|
||||||
|
|
@ -267,12 +268,14 @@ int ReadADC(int channel)
|
||||||
|
|
||||||
return (timeout == 0) ? -1 : *pResult>>6;
|
return (timeout == 0) ? -1 : *pResult>>6;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// This function is platform-dependent,
|
// This function is platform-dependent,
|
||||||
// until I figure out how to distinguish at runtime.
|
// until I figure out how to distinguish at runtime.
|
||||||
int ButtonPressed(void) // return 1,2,3 for F1,F2,F3, 0 if none pressed
|
int ButtonPressed(void) // return 1,2,3 for F1,F2,F3, 0 if none pressed
|
||||||
{
|
{
|
||||||
|
#ifdef USE_ADC
|
||||||
int value = ReadADC(CHANNEL);
|
int value = ReadADC(CHANNEL);
|
||||||
|
|
||||||
if (value >= F1_LOWER && value <= F1_UPPER) // in range
|
if (value >= F1_LOWER && value <= F1_UPPER) // in range
|
||||||
|
|
@ -281,6 +284,16 @@ int ButtonPressed(void) // return 1,2,3 for F1,F2,F3, 0 if none pressed
|
||||||
return 2;
|
return 2;
|
||||||
else if (value >= F3_LOWER && value <= F3_UPPER) // in range
|
else if (value >= F3_LOWER && value <= F3_UPPER) // in range
|
||||||
return 3;
|
return 3;
|
||||||
|
#else
|
||||||
|
int value = PCDR;
|
||||||
|
|
||||||
|
if (!(value & F1_MASK))
|
||||||
|
return 1;
|
||||||
|
else if (!(value & F2_MASK))
|
||||||
|
return 2;
|
||||||
|
else if (!(value & F3_MASK))
|
||||||
|
return 3;
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,12 @@ typedef struct
|
||||||
|
|
||||||
// resolve platform dependency of F1 button check
|
// resolve platform dependency of F1 button check
|
||||||
#if defined PLATFORM_PLAYER
|
#if defined PLATFORM_PLAYER
|
||||||
#define CHANNEL 1
|
#define F1_MASK 0x0001 // Player has no F1 button, so we use "-"
|
||||||
#define F1_LOWER 0 // this is the "Menu" key
|
#define F2_MASK 0x0008 // Player has no F2 button, so we use "Play"
|
||||||
#define F1_UPPER 384
|
#define F3_MASK 0x0004 // Player has no F3 button, so we use "+"
|
||||||
#define F2_LOWER 1024 // not present
|
|
||||||
#define F2_UPPER 1024
|
|
||||||
#define F3_LOWER 1024
|
|
||||||
#define F3_UPPER 1024
|
|
||||||
#elif defined PLATFORM_RECORDER
|
#elif defined PLATFORM_RECORDER
|
||||||
|
#define USE_ADC
|
||||||
#define CHANNEL 4
|
#define CHANNEL 4
|
||||||
#define F1_LOWER 250
|
#define F1_LOWER 250
|
||||||
#define F1_UPPER 499
|
#define F1_UPPER 499
|
||||||
|
|
@ -49,7 +47,9 @@ typedef struct
|
||||||
#define F2_UPPER 699
|
#define F2_UPPER 699
|
||||||
#define F3_LOWER 900
|
#define F3_LOWER 900
|
||||||
#define F3_UPPER 1023
|
#define F3_UPPER 1023
|
||||||
|
|
||||||
#elif defined PLATFORM_FM
|
#elif defined PLATFORM_FM
|
||||||
|
#define USE_ADC
|
||||||
#define CHANNEL 4
|
#define CHANNEL 4
|
||||||
#define F1_LOWER 150
|
#define F1_LOWER 150
|
||||||
#define F1_UPPER 384
|
#define F1_UPPER 384
|
||||||
|
|
@ -57,18 +57,22 @@ typedef struct
|
||||||
#define F2_UPPER 544
|
#define F2_UPPER 544
|
||||||
#define F3_LOWER 700
|
#define F3_LOWER 700
|
||||||
#define F3_UPPER 1023
|
#define F3_UPPER 1023
|
||||||
|
|
||||||
#elif defined PLATFORM_ONDIO
|
#elif defined PLATFORM_ONDIO
|
||||||
|
#define USE_ADC
|
||||||
#define CHANNEL 4
|
#define CHANNEL 4
|
||||||
#define F1_LOWER 0x2EF // Ondio has no F1 button,
|
#define F1_LOWER 0x2EF // Ondio has no F1 button,
|
||||||
#define F1_UPPER 0x3FF // so we use "Right".
|
#define F1_UPPER 0x3FF // so we use "Left".
|
||||||
#define F2_LOWER 0x19D // Ondio has no F2 button,
|
#define F2_LOWER 0x19D // Ondio has no F2 button,
|
||||||
#define F2_UPPER 0x245 // so we use "Up".
|
#define F2_UPPER 0x245 // so we use "Up".
|
||||||
#define F3_LOWER 0x246 // Ondio has no F3 button,
|
#define F3_LOWER 0x246 // Ondio has no F3 button,
|
||||||
#define F3_UPPER 0x2EE // so we use "Left".
|
#define F3_UPPER 0x2EE // so we use "Right".
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error ("No platform given!")
|
#error ("No platform given!")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define FLASH_BASE 0x02000000 // start of the flash memory
|
#define FLASH_BASE 0x02000000 // start of the flash memory
|
||||||
#define FW_VERSION *(unsigned short*)(FLASH_BASE + 0xFE) // firmware version
|
#define FW_VERSION *(unsigned short*)(FLASH_BASE + 0xFE) // firmware version
|
||||||
|
|
||||||
|
|
@ -80,7 +84,9 @@ void PlatformInit(void);
|
||||||
void DramInit(void);
|
void DramInit(void);
|
||||||
int ucl_nrv2e_decompress_8(const UINT8 *src, UINT8 *dst, UINT32* dst_len);
|
int ucl_nrv2e_decompress_8(const UINT8 *src, UINT8 *dst, UINT32* dst_len);
|
||||||
void DecompressStart(tImage* pImage);
|
void DecompressStart(tImage* pImage);
|
||||||
|
#ifdef USE_ADC
|
||||||
int ReadADC(int channel);
|
int ReadADC(int channel);
|
||||||
|
#endif
|
||||||
int ButtonPressed(void);
|
int ButtonPressed(void);
|
||||||
tImage* GetStartImage(int nPreferred);
|
tImage* GetStartImage(int nPreferred);
|
||||||
// test functions
|
// test functions
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue