summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/ata.c27
-rw-r--r--firmware/export/ata.h1
-rw-r--r--firmware/usb.c1
3 files changed, 29 insertions, 0 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index ec99bf799e..b4151d0352 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -503,6 +503,33 @@ static int ata_perform_sleep(void)
503 return ret; 503 return ret;
504} 504}
505 505
506int ata_standby(int time)
507{
508 int ret = 0;
509
510 mutex_lock(&ata_mtx);
511
512 ATA_SELECT = ata_device;
513
514 if(!wait_for_rdy()) {
515 DEBUGF("ata_standby() - not RDY\n");
516 mutex_unlock(&ata_mtx);
517 return -1;
518 }
519
520 ATA_NSECTOR = ((time + 5) / 5) & 0xff; /* Round up to nearest 5 secs */
521 ATA_COMMAND = CMD_STANDBY;
522
523 if (!wait_for_rdy())
524 {
525 DEBUGF("ata_standby() - CMD failed\n");
526 ret = -2;
527 }
528
529 mutex_unlock(&ata_mtx);
530 return ret;
531}
532
506int ata_sleep(void) 533int ata_sleep(void)
507{ 534{
508 queue_post(&ata_queue, Q_SLEEP, NULL); 535 queue_post(&ata_queue, Q_SLEEP, NULL);
diff --git a/firmware/export/ata.h b/firmware/export/ata.h
index 7a1fb4a952..213d3e5b8b 100644
--- a/firmware/export/ata.h
+++ b/firmware/export/ata.h
@@ -36,6 +36,7 @@ extern void ata_enable(bool on);
36extern void ata_spindown(int seconds); 36extern void ata_spindown(int seconds);
37extern void ata_poweroff(bool enable); 37extern void ata_poweroff(bool enable);
38extern int ata_sleep(void); 38extern int ata_sleep(void);
39extern int ata_standby(int time);
39extern bool ata_disk_is_active(void); 40extern bool ata_disk_is_active(void);
40extern int ata_hard_reset(void); 41extern int ata_hard_reset(void);
41extern int ata_soft_reset(void); 42extern int ata_soft_reset(void);
diff --git a/firmware/usb.c b/firmware/usb.c
index fcc06c2f6e..1efecb8705 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -86,6 +86,7 @@ static void usb_slave_mode(bool on)
86 DEBUGF("Entering USB slave mode\n"); 86 DEBUGF("Entering USB slave mode\n");
87 ata_soft_reset(); 87 ata_soft_reset();
88 ata_init(); 88 ata_init();
89 ata_standby(15);
89 ata_enable(false); 90 ata_enable(false);
90 usb_enable(true); 91 usb_enable(true);
91 } 92 }