summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2004-12-16 22:29:01 +0000
committerJens Arnold <amiconn@rockbox.org>2004-12-16 22:29:01 +0000
commit127c363e87e9dd95fd5ab598660967b99ec1a400 (patch)
treeffc73da22870aa9c079bc96945b2b6e64a82dd91 /firmware/drivers
parent78acda25b37747f9a883ccf1ad14f7710f9a3374 (diff)
downloadrockbox-127c363e87e9dd95fd5ab598660967b99ec1a400.tar.gz
rockbox-127c363e87e9dd95fd5ab598660967b99ec1a400.zip
Unconditionally drive HD power control pin for player (doesn't hurt even for very old players). Slight optimization for recorders.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5487 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/power.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c
index d4e8b3315b..3522ad4232 100644
--- a/firmware/drivers/power.c
+++ b/firmware/drivers/power.c
@@ -119,30 +119,22 @@ void ide_power_enable(bool on)
119 if(on) 119 if(on)
120 { 120 {
121#ifdef ATA_POWER_PLAYERSTYLE 121#ifdef ATA_POWER_PLAYERSTYLE
122 if (is_new_player()) 122 or_b(0x10, &PBDRL);
123 {
124 or_b(0x10, &PBDRL);
125 touched = true;
126 }
127#else 123#else
128 or_b(0x20, &PADRL); 124 or_b(0x20, &PADRL);
129 touched = true;
130#endif 125#endif
126 touched = true;
131 } 127 }
132#endif 128#endif
133#ifdef HAVE_ATA_POWER_OFF 129#ifdef HAVE_ATA_POWER_OFF
134 if(!on) 130 if(!on)
135 { 131 {
136#ifdef ATA_POWER_PLAYERSTYLE 132#ifdef ATA_POWER_PLAYERSTYLE
137 if (is_new_player()) 133 and_b(~0x10, &PBDRL);
138 {
139 and_b(~0x10, &PBDRL);
140 touched = true;
141 }
142#else 134#else
143 and_b(~0x20, &PADRL); 135 and_b(~0x20, &PADRL);
144 touched = true;
145#endif 136#endif
137 touched = true;
146 } 138 }
147#endif 139#endif
148 140
@@ -166,20 +158,18 @@ bool ide_powered(void)
166{ 158{
167#if defined(NEEDS_ATA_POWER_ON) || defined(HAVE_ATA_POWER_OFF) 159#if defined(NEEDS_ATA_POWER_ON) || defined(HAVE_ATA_POWER_OFF)
168#ifdef ATA_POWER_PLAYERSTYLE 160#ifdef ATA_POWER_PLAYERSTYLE
169 if (is_new_player()) 161 /* This is not correct for very old players, since these are unable to
170 { 162 * control hd power. However, driving the pin doesn't hurt, because it
171 if ((PBCR2 & 0x0300) || !(PBIOR & 0x0010)) /* not configured for output */ 163 * is not connected anywhere */
172 return false; /* would be floating low, disk off */ 164 if ((PBCR2 & 0x0300) || !(PBIORL & 0x10)) /* not configured for output */
173 else 165 return false; /* would be floating low, disk off */
174 return (PBDR & 0x0010) != 0;
175 }
176 else 166 else
177 return true; /* old player: always on */ 167 return (PBDRL & 0x10) != 0;
178#else 168#else
179 if ((PACR2 & 0x0400) || !(PAIOR & 0x0020)) /* not configured for output */ 169 if ((PACR2 & 0x0400) || !(PAIORL & 0x20)) /* not configured for output */
180 return true; /* would be floating high, disk on */ 170 return true; /* would be floating high, disk on */
181 else 171 else
182 return (PADR & 0x0020) != 0; 172 return (PADRL & 0x20) != 0;
183#endif /* ATA_POWER_PLAYERSTYLE */ 173#endif /* ATA_POWER_PLAYERSTYLE */
184#else 174#else
185 return true; /* pretend always powered if not controlable */ 175 return true; /* pretend always powered if not controlable */