summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2008-04-30 09:23:12 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2008-04-30 09:23:12 +0000
commit327f845adf7a0d831a235f370ef2eb1636abaab6 (patch)
treef89a6f847af69f65c644bbae4da10d7a383d2cdc
parentbce419d89062e842b65353f942cb6624d861a2aa (diff)
downloadrockbox-327f845adf7a0d831a235f370ef2eb1636abaab6.tar.gz
rockbox-327f845adf7a0d831a235f370ef2eb1636abaab6.zip
remove the 2nd last evil use of ata_disk_is_active() in apps/
the last abuse is in battery bench git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17292 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/playlist.c33
-rw-r--r--firmware/export/ata.h4
2 files changed, 24 insertions, 13 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 756680c336..c3072ddfd2 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -70,6 +70,7 @@
70#include <string.h> 70#include <string.h>
71#include <ctype.h> 71#include <ctype.h>
72#include "playlist.h" 72#include "playlist.h"
73#include "ata_idle_notify.h"
73#include "file.h" 74#include "file.h"
74#include "action.h" 75#include "action.h"
75#include "dir.h" 76#include "dir.h"
@@ -1255,6 +1256,23 @@ static int compare(const void* p1, const void* p2)
1255 * without affecting playlist load up performance. This thread also flushes 1256 * without affecting playlist load up performance. This thread also flushes
1256 * any pending control commands when the disk spins up. 1257 * any pending control commands when the disk spins up.
1257 */ 1258 */
1259static bool playlist_flush_callback(void)
1260{
1261 struct playlist_info *playlist;
1262 playlist = &current_playlist;
1263 if (playlist->control_fd >= 0)
1264 {
1265 if (playlist->num_cached > 0)
1266 {
1267 mutex_lock(&playlist->control_mutex);
1268 flush_cached_control(playlist);
1269 mutex_unlock(&playlist->control_mutex);
1270 }
1271 sync_control(playlist, true);
1272 }
1273 return true;
1274}
1275
1258static void playlist_thread(void) 1276static void playlist_thread(void)
1259{ 1277{
1260 struct queue_event ev; 1278 struct queue_event ev;
@@ -1288,21 +1306,10 @@ static void playlist_thread(void)
1288 timeout or 5s, whichever is less */ 1306 timeout or 5s, whichever is less */
1289 case SYS_TIMEOUT: 1307 case SYS_TIMEOUT:
1290 playlist = &current_playlist; 1308 playlist = &current_playlist;
1291 1309 if (playlist->control_fd >= 0)
1292 if (playlist->control_fd >= 0
1293# ifndef SIMULATOR
1294 && ata_disk_is_active()
1295# endif
1296 )
1297 { 1310 {
1298 if (playlist->num_cached > 0) 1311 if (playlist->num_cached > 0)
1299 { 1312 register_ata_idle_func(playlist_flush_callback);
1300 mutex_lock(&playlist->control_mutex);
1301 flush_cached_control(playlist);
1302 mutex_unlock(&playlist->control_mutex);
1303 }
1304
1305 sync_control(playlist, true);
1306 } 1313 }
1307 1314
1308 if (!dirty_pointers) 1315 if (!dirty_pointers)
diff --git a/firmware/export/ata.h b/firmware/export/ata.h
index d3323308e8..35538f6354 100644
--- a/firmware/export/ata.h
+++ b/firmware/export/ata.h
@@ -40,6 +40,10 @@ extern void ata_enable(bool on);
40extern void ata_spindown(int seconds); 40extern void ata_spindown(int seconds);
41extern void ata_sleep(void); 41extern void ata_sleep(void);
42extern void ata_sleepnow(void); 42extern void ata_sleepnow(void);
43/* NOTE: DO NOT use this to poll for disk activity.
44 If you are waiting for the disk to become active before
45 doing something use ata_idle_notify.h
46 */
43extern bool ata_disk_is_active(void); 47extern bool ata_disk_is_active(void);
44extern int ata_hard_reset(void); 48extern int ata_hard_reset(void);
45extern int ata_soft_reset(void); 49extern int ata_soft_reset(void);