summaryrefslogtreecommitdiff
path: root/firmware/ata_idle_notify.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2006-11-08 01:55:26 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2006-11-08 01:55:26 +0000
commitf184152c0501a80e95ad871927d766fdee50281b (patch)
treeecfa4b6cdf24065b32467d6d7274a2659c3ec9b0 /firmware/ata_idle_notify.c
parent5dd07759248fec1407f6b3d4d1fb177554e45a13 (diff)
downloadrockbox-f184152c0501a80e95ad871927d766fdee50281b.tar.gz
rockbox-f184152c0501a80e95ad871927d766fdee50281b.zip
* changes to ata.c - idle callbacks are called after 2 sec of real idle,
and shutdown and usb (it makes sense here). ata_sleep doesnt get broken by callbacks. * allow ata_sleep() at the end of buffering again * config block uses ata_idle instead of delayed sector when saving * remove delayed sector code from ata_mmc.c (idle callbacks are not yet implemented for ata_mmc.c tho) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11461 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/ata_idle_notify.c')
-rw-r--r--firmware/ata_idle_notify.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/firmware/ata_idle_notify.c b/firmware/ata_idle_notify.c
index a0a56e958b..c51c3800ce 100644
--- a/firmware/ata_idle_notify.c
+++ b/firmware/ata_idle_notify.c
@@ -18,8 +18,10 @@
18 ****************************************************************************/ 18 ****************************************************************************/
19#include <stdbool.h> 19#include <stdbool.h>
20#include "system.h" 20#include "system.h"
21#include "ata.h"
21#include "ata_idle_notify.h" 22#include "ata_idle_notify.h"
22#include "logf.h" 23#include "logf.h"
24#include "string.h"
23 25
24#if USING_ATA_CALLBACK 26#if USING_ATA_CALLBACK
25static ata_idle_notify ata_idle_notify_funcs[MAX_ATA_CALLBACKS]; 27static ata_idle_notify ata_idle_notify_funcs[MAX_ATA_CALLBACKS];
@@ -52,7 +54,7 @@ bool register_ata_idle_func(ata_idle_notify function)
52} 54}
53 55
54#if USING_ATA_CALLBACK 56#if USING_ATA_CALLBACK
55void unregister_ata_idle_func(ata_idle_notify func) 57void unregister_ata_idle_func(ata_idle_notify func, bool run)
56{ 58{
57 int i; 59 int i;
58 for (i=0; i<MAX_ATA_CALLBACKS; i++) 60 for (i=0; i<MAX_ATA_CALLBACKS; i++)
@@ -61,12 +63,13 @@ void unregister_ata_idle_func(ata_idle_notify func)
61 { 63 {
62 ata_idle_notify_funcs[i] = NULL; 64 ata_idle_notify_funcs[i] = NULL;
63 ata_callback_count--; 65 ata_callback_count--;
66 if (run) func();
64 } 67 }
65 } 68 }
66 return; 69 return;
67} 70}
68 71
69bool call_ata_idle_notifys(void) 72bool call_ata_idle_notifys(bool sleep_after)
70{ 73{
71 int i; 74 int i;
72 ata_idle_notify function; 75 ata_idle_notify function;
@@ -82,15 +85,14 @@ bool call_ata_idle_notifys(void)
82 function(); 85 function();
83 } 86 }
84 } 87 }
88 if (sleep_after)
89 ata_sleep();
85 return true; 90 return true;
86} 91}
87 92
88void ata_idle_notify_init(void) 93void ata_idle_notify_init(void)
89{ 94{
90 int i; 95 ata_callback_count = 0;
91 for (i=0; i<MAX_ATA_CALLBACKS; i++) 96 memset(ata_idle_notify_funcs, 0, sizeof(ata_idle_notify_funcs));
92 {
93 ata_idle_notify_funcs[i] = NULL;
94 }
95} 97}
96#endif 98#endif