diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/ata.c | 9 | ||||
-rw-r--r-- | firmware/drivers/power.c | 33 | ||||
-rw-r--r-- | firmware/export/config-player.h | 7 |
3 files changed, 40 insertions, 9 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 40d3da2f98..60b6a87488 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c | |||
@@ -1131,15 +1131,6 @@ int ata_init(void) | |||
1131 | or_b(0x02, &PAIORH); /* output for ATA reset */ | 1131 | or_b(0x02, &PAIORH); /* output for ATA reset */ |
1132 | or_b(0x02, &PADRH); /* release ATA reset */ | 1132 | or_b(0x02, &PADRH); /* release ATA reset */ |
1133 | PACR2 &= 0xBFFF; /* GPIO function for PA7 (IDE enable) */ | 1133 | PACR2 &= 0xBFFF; /* GPIO function for PA7 (IDE enable) */ |
1134 | |||
1135 | #ifdef HAVE_LCD_CHARCELLS | ||
1136 | if (read_rom_version() > 451) /* new player: power on the HD */ | ||
1137 | { | ||
1138 | PBCR2 &= ~0x0300; /* Set PB4 (IDE power) to GPIO */ | ||
1139 | or_b(0x10, &PBDRL); /* ... high */ | ||
1140 | or_b(0x10, &PBIORL); /* ... and output */ | ||
1141 | } | ||
1142 | #endif | ||
1143 | #elif defined HAVE_SCF5249 | 1134 | #elif defined HAVE_SCF5249 |
1144 | #endif | 1135 | #endif |
1145 | 1136 | ||
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c index 3a69b37953..0ef79c8561 100644 --- a/firmware/drivers/power.c +++ b/firmware/drivers/power.c | |||
@@ -117,15 +117,31 @@ void ide_power_enable(bool on) | |||
117 | #ifdef NEEDS_ATA_POWER_ON | 117 | #ifdef NEEDS_ATA_POWER_ON |
118 | if(on) | 118 | if(on) |
119 | { | 119 | { |
120 | #ifdef ATA_POWER_PLAYERSTYLE | ||
121 | if (read_rom_version() > 451) /* new players only */ | ||
122 | { | ||
123 | or_b(0x10, &PBDRL); | ||
124 | touched = true; | ||
125 | } | ||
126 | #else | ||
120 | or_b(0x20, &PADRL); | 127 | or_b(0x20, &PADRL); |
121 | touched = true; | 128 | touched = true; |
129 | #endif | ||
122 | } | 130 | } |
123 | #endif | 131 | #endif |
124 | #ifdef HAVE_ATA_POWER_OFF | 132 | #ifdef HAVE_ATA_POWER_OFF |
125 | if(!on) | 133 | if(!on) |
126 | { | 134 | { |
135 | #ifdef ATA_POWER_PLAYERSTYLE | ||
136 | if (read_rom_version() > 451) /* new players only */ | ||
137 | { | ||
138 | and_b(~0x10, &PBDRL); | ||
139 | touched = true; | ||
140 | } | ||
141 | #else | ||
127 | and_b(~0x20, &PADRL); | 142 | and_b(~0x20, &PADRL); |
128 | touched = true; | 143 | touched = true; |
144 | #endif | ||
129 | } | 145 | } |
130 | #endif | 146 | #endif |
131 | 147 | ||
@@ -133,8 +149,13 @@ void ide_power_enable(bool on) | |||
133 | of other bits on same port, while input and floating high */ | 149 | of other bits on same port, while input and floating high */ |
134 | if (touched) | 150 | if (touched) |
135 | { | 151 | { |
152 | #ifdef ATA_POWER_PLAYERSTYLE | ||
153 | or_b(0x10, &PBIORL); /* PB4 is an output */ | ||
154 | PBCR2 &= ~0x0300; /* GPIO for PB4 */ | ||
155 | #else | ||
136 | or_b(0x20, &PAIORL); /* PA5 is an output */ | 156 | or_b(0x20, &PAIORL); /* PA5 is an output */ |
137 | PACR2 &= 0xFBFF; /* GPIO for PA5 */ | 157 | PACR2 &= 0xFBFF; /* GPIO for PA5 */ |
158 | #endif | ||
138 | } | 159 | } |
139 | } | 160 | } |
140 | #endif /* !HAVE_MMC */ | 161 | #endif /* !HAVE_MMC */ |
@@ -143,10 +164,22 @@ void ide_power_enable(bool on) | |||
143 | bool ide_powered(void) | 164 | bool ide_powered(void) |
144 | { | 165 | { |
145 | #if defined(NEEDS_ATA_POWER_ON) || defined(HAVE_ATA_POWER_OFF) | 166 | #if defined(NEEDS_ATA_POWER_ON) || defined(HAVE_ATA_POWER_OFF) |
167 | #ifdef ATA_POWER_PLAYERSTYLE | ||
168 | if (read_rom_version() > 451) /* new players only */ | ||
169 | { | ||
170 | if ((PBCR2 & 0x0300) || !(PBIOR & 0x0010)) /* not configured for output */ | ||
171 | return false; /* would be floating low, disk off */ | ||
172 | else | ||
173 | return (PBDR & 0x0010) != 0; | ||
174 | } | ||
175 | else | ||
176 | return true; /* old player: always on */ | ||
177 | #else | ||
146 | if ((PACR2 & 0x0400) || !(PAIOR & 0x0020)) /* not configured for output */ | 178 | if ((PACR2 & 0x0400) || !(PAIOR & 0x0020)) /* not configured for output */ |
147 | return true; /* would be floating high, disk on */ | 179 | return true; /* would be floating high, disk on */ |
148 | else | 180 | else |
149 | return (PADR & 0x0020) != 0; | 181 | return (PADR & 0x0020) != 0; |
182 | #endif /* ATA_POWER_PLAYERSTYLE */ | ||
150 | #else | 183 | #else |
151 | return true; /* pretend always powered if not controlable */ | 184 | return true; /* pretend always powered if not controlable */ |
152 | #endif | 185 | #endif |
diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h index 0b75f6eefa..5a8f080669 100644 --- a/firmware/export/config-player.h +++ b/firmware/export/config-player.h | |||
@@ -19,6 +19,13 @@ | |||
19 | /* Define this if you have a DAC3550A */ | 19 | /* Define this if you have a DAC3550A */ |
20 | #define HAVE_DAC3550A | 20 | #define HAVE_DAC3550A |
21 | 21 | ||
22 | /* Define this if you need to power on ATA */ | ||
23 | #define NEEDS_ATA_POWER_ON | ||
24 | |||
25 | /* Define this if you control ata power player style | ||
26 | (with PB4, new player only) */ | ||
27 | #define ATA_POWER_PLAYERSTYLE | ||
28 | |||
22 | /* Define this to the CPU frequency */ | 29 | /* Define this to the CPU frequency */ |
23 | #define CPU_FREQ 12000000 /* cycle time ~83.3ns */ | 30 | #define CPU_FREQ 12000000 /* cycle time ~83.3ns */ |
24 | 31 | ||