summaryrefslogtreecommitdiffstats
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.tar.bz2
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 @@
****************************************************************************/
#include <stdbool.h>
#include "system.h"
+#include "ata.h"
#include "ata_idle_notify.h"
#include "logf.h"
+#include "string.h"
#if USING_ATA_CALLBACK
static ata_idle_notify ata_idle_notify_funcs[MAX_ATA_CALLBACKS];
@@ -52,7 +54,7 @@ bool register_ata_idle_func(ata_idle_notify function)
}
#if USING_ATA_CALLBACK
-void unregister_ata_idle_func(ata_idle_notify func)
+void unregister_ata_idle_func(ata_idle_notify func, bool run)
{
int i;
for (i=0; i<MAX_ATA_CALLBACKS; i++)
@@ -61,12 +63,13 @@ void unregister_ata_idle_func(ata_idle_notify func)
{
ata_idle_notify_funcs[i] = NULL;
ata_callback_count--;
+ if (run) func();
}
}
return;
}
-bool call_ata_idle_notifys(void)
+bool call_ata_idle_notifys(bool sleep_after)
{
int i;
ata_idle_notify function;
@@ -82,15 +85,14 @@ bool call_ata_idle_notifys(void)
function();
}
}
+ if (sleep_after)
+ ata_sleep();
return true;
}
void ata_idle_notify_init(void)
{
- int i;
- for (i=0; i<MAX_ATA_CALLBACKS; i++)
- {
- ata_idle_notify_funcs[i] = NULL;
- }
+ ata_callback_count = 0;
+ memset(ata_idle_notify_funcs, 0, sizeof(ata_idle_notify_funcs));
}
#endif