diff options
-rw-r--r-- | flash/bootloader/bootloader.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/flash/bootloader/bootloader.c b/flash/bootloader/bootloader.c index 370ac5bee5..d5ce509cce 100644 --- a/flash/bootloader/bootloader.c +++ b/flash/bootloader/bootloader.c | |||
@@ -122,12 +122,24 @@ void PlatformInit(void) | |||
122 | #endif | 122 | #endif |
123 | 123 | ||
124 | #if defined PLATFORM_PLAYER | 124 | #if defined PLATFORM_PLAYER |
125 | BRR1 = 0x19; /* 14400 Baud for monitor */ | 125 | BRR1 = 0x19; /* 14400 Baud for monitor */ |
126 | PACR2 &= 0xFFFC; /* GPIO for PA0 (charger detection, input by default) */ | 126 | PBDRL |= 0x10; /* set PB4 to 1 to power the hd early (and prepare for |
127 | if (FW_VERSION > 451 && (PADRL & 0x01)) | 127 | * probing in case the charger is connected) */ |
128 | { /* "new" Player and charger not plugged? */ | 128 | PBIORL |= 0x10; /* make PB4 an output */ |
129 | PBDR |= 0x0010; /* set PB4 to 1 to power-up the harddisk early */ | 129 | PACR2 &= 0xFFFC; /* GPIO for PA0 (charger detection, input by default) */ |
130 | PBIOR |= 0x0010; /* make PB4 an output */ | 130 | if (!(PADRL & 0x01)) /* charger plugged? */ |
131 | { /* we need to probe whether the box is able to control hd power */ | ||
132 | int i; | ||
133 | |||
134 | PBIORL &= ~0x10; /* set PB4 to input */ | ||
135 | /* wait whether it goes low, max. ~1 ms */ | ||
136 | for (i = 0; (PBDRL & 0x10) && i < 1000; i++); | ||
137 | |||
138 | if (~(PBDRL & 0x10)) /* pulled low -> power controllable */ | ||
139 | PBDRL &= 0x10; /* set PB4 low */ | ||
140 | else /* still floating high -> not controllable */ | ||
141 | PBDRL |= 0x10; /* set PB4 high */ | ||
142 | PBIORL |= 0x10; /* ..and output again */ | ||
131 | } | 143 | } |
132 | #elif defined PLATFORM_RECORDER | 144 | #elif defined PLATFORM_RECORDER |
133 | BRR1 = 0x02; /* 115200 Baud for monitor */ | 145 | BRR1 = 0x02; /* 115200 Baud for monitor */ |