From 2b77b4fdd50f8ff150181f973767afa9dd4b7b22 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Thu, 28 Nov 2002 22:46:19 +0000 Subject: Added option to enable/disable disk poweroff (for diagnostic purposes) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2888 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/ata.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'firmware/drivers/ata.c') diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 8ca3b75adb..216bf180bf 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -411,6 +411,14 @@ void ata_spindown(int seconds) sleep_timeout = seconds * HZ; } +void ata_poweroff(bool enable) +{ + if (enable) + poweroff_timeout = 2*HZ; + else + poweroff_timeout = 0; +} + bool ata_disk_is_active(void) { return !sleeping; @@ -487,8 +495,13 @@ static void ata_thread(void) queue_wait(&ata_queue, &ev); switch ( ev.id ) { case SYS_USB_CONNECTED: - if (poweroff) + if (poweroff) { + mutex_lock(&ata_mtx); + led(true); ata_power_on(); + led(false); + mutex_unlock(&ata_mtx); + } /* Tell the USB thread that we are safe */ DEBUGF("ata_thread got SYS_USB_CONNECTED\n"); -- cgit v1.2.3