summaryrefslogtreecommitdiff
path: root/flash/bootloader/bootloader.c
diff options
context:
space:
mode:
Diffstat (limited to 'flash/bootloader/bootloader.c')
-rw-r--r--flash/bootloader/bootloader.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/flash/bootloader/bootloader.c b/flash/bootloader/bootloader.c
index a6fe91d283..e5bab34abd 100644
--- a/flash/bootloader/bootloader.c
+++ b/flash/bootloader/bootloader.c
@@ -122,9 +122,10 @@ void PlatformInit(void)
122 122
123#if defined PLATFORM_PLAYER 123#if defined PLATFORM_PLAYER
124 BRR1 = 0x0019; // 14400 Baud for monitor 124 BRR1 = 0x0019; // 14400 Baud for monitor
125 if (FW_VERSION > 451) // "new" Player? 125 PACR2 &= 0xFFFC; // GPIO for PA0 (charger detection, input by default)
126 { 126 if (FW_VERSION > 451 && (PADRL & 0x01))
127 PBDR &= ~0x10; // set PB4 to 0 to power-up the harddisk early 127 { // "new" Player and charger not plugged?
128 PBDR |= 0x10; // set PB4 to 1 to power-up the harddisk early
128 PBIOR |= 0x10; // make PB4 an output 129 PBIOR |= 0x10; // make PB4 an output
129 } 130 }
130#elif defined PLATFORM_RECORDER 131#elif defined PLATFORM_RECORDER
@@ -255,7 +256,7 @@ void DecompressStart(tImage* pImage)
255 pImage->pExecute(); 256 pImage->pExecute();
256} 257}
257 258
258 259#ifdef USE_ADC
259int ReadADC(int channel) 260int ReadADC(int channel)
260{ 261{
261 // after channel 3, the ports wrap and get re-used 262 // after channel 3, the ports wrap and get re-used
@@ -267,12 +268,14 @@ int ReadADC(int channel)
267 268
268 return (timeout == 0) ? -1 : *pResult>>6; 269 return (timeout == 0) ? -1 : *pResult>>6;
269} 270}
271#endif
270 272
271 273
272// This function is platform-dependent, 274// This function is platform-dependent,
273// until I figure out how to distinguish at runtime. 275// until I figure out how to distinguish at runtime.
274int ButtonPressed(void) // return 1,2,3 for F1,F2,F3, 0 if none pressed 276int ButtonPressed(void) // return 1,2,3 for F1,F2,F3, 0 if none pressed
275{ 277{
278#ifdef USE_ADC
276 int value = ReadADC(CHANNEL); 279 int value = ReadADC(CHANNEL);
277 280
278 if (value >= F1_LOWER && value <= F1_UPPER) // in range 281 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
281 return 2; 284 return 2;
282 else if (value >= F3_LOWER && value <= F3_UPPER) // in range 285 else if (value >= F3_LOWER && value <= F3_UPPER) // in range
283 return 3; 286 return 3;
287#else
288 int value = PCDR;
289
290 if (!(value & F1_MASK))
291 return 1;
292 else if (!(value & F2_MASK))
293 return 2;
294 else if (!(value & F3_MASK))
295 return 3;
296#endif
284 297
285 return 0; 298 return 0;
286} 299}