summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/ata_idle_notify.c8
-rw-r--r--firmware/events.c4
-rw-r--r--firmware/export/ata_idle_notify.h6
-rw-r--r--firmware/export/events.h4
4 files changed, 10 insertions, 12 deletions
diff --git a/firmware/ata_idle_notify.c b/firmware/ata_idle_notify.c
index 99b1d4d786..35d192bee0 100644
--- a/firmware/ata_idle_notify.c
+++ b/firmware/ata_idle_notify.c
@@ -25,12 +25,12 @@
25#include "kernel.h" 25#include "kernel.h"
26#include "string.h" 26#include "string.h"
27 27
28void register_storage_idle_func(storage_idle_notify function) 28void register_storage_idle_func(void (*function)(void *data))
29{ 29{
30#if USING_STORAGE_CALLBACK 30#if USING_STORAGE_CALLBACK
31 add_event(DISK_EVENT_SPINUP, true, function); 31 add_event(DISK_EVENT_SPINUP, true, function);
32#else 32#else
33 function(); /* just call the function now */ 33 function(NULL); /* just call the function now */
34/* this _may_ cause problems later if the calling function 34/* this _may_ cause problems later if the calling function
35 sets a variable expecting the callback to unset it, because 35 sets a variable expecting the callback to unset it, because
36 the callback will be run before this function exits, so before the var is set */ 36 the callback will be run before this function exits, so before the var is set */
@@ -38,12 +38,12 @@ void register_storage_idle_func(storage_idle_notify function)
38} 38}
39 39
40#if USING_STORAGE_CALLBACK 40#if USING_STORAGE_CALLBACK
41void unregister_storage_idle_func(storage_idle_notify func, bool run) 41void unregister_storage_idle_func(void (*func)(void *data), bool run)
42{ 42{
43 remove_event(DISK_EVENT_SPINUP, func); 43 remove_event(DISK_EVENT_SPINUP, func);
44 44
45 if (run) 45 if (run)
46 func(); 46 func(NULL);
47} 47}
48 48
49bool call_storage_idle_notifys(bool force) 49bool call_storage_idle_notifys(bool force)
diff --git a/firmware/events.c b/firmware/events.c
index 951214377e..dca612bc7b 100644
--- a/firmware/events.c
+++ b/firmware/events.c
@@ -33,7 +33,7 @@ struct sysevent {
33 33
34static struct sysevent events[MAX_SYS_EVENTS]; 34static struct sysevent events[MAX_SYS_EVENTS];
35 35
36bool add_event(unsigned short id, bool oneshot, void (*handler)) 36bool add_event(unsigned short id, bool oneshot, void (*handler)(void *data))
37{ 37{
38 int i; 38 int i;
39 39
@@ -60,7 +60,7 @@ bool add_event(unsigned short id, bool oneshot, void (*handler))
60 return false; 60 return false;
61} 61}
62 62
63void remove_event(unsigned short id, void (*handler)) 63void remove_event(unsigned short id, void (*handler)(void *data))
64{ 64{
65 int i; 65 int i;
66 66
diff --git a/firmware/export/ata_idle_notify.h b/firmware/export/ata_idle_notify.h
index 18f1648e00..348165f1d1 100644
--- a/firmware/export/ata_idle_notify.h
+++ b/firmware/export/ata_idle_notify.h
@@ -48,11 +48,9 @@ enum {
48 && (CONFIG_NAND == NAND_IFP7XX)) \ 48 && (CONFIG_NAND == NAND_IFP7XX)) \
49 && !defined(BOOTLOADER) 49 && !defined(BOOTLOADER)
50 50
51typedef bool (*storage_idle_notify)(void); 51extern void register_storage_idle_func(void (*function)(void *data));
52
53extern void register_storage_idle_func(storage_idle_notify function);
54#if USING_STORAGE_CALLBACK 52#if USING_STORAGE_CALLBACK
55extern void unregister_storage_idle_func(storage_idle_notify function, bool run); 53extern void unregister_storage_idle_func(void (*function)(void *data), bool run);
56extern bool call_storage_idle_notifys(bool force); 54extern bool call_storage_idle_notifys(bool force);
57#else 55#else
58#define unregister_storage_idle_func(f,r) 56#define unregister_storage_idle_func(f,r)
diff --git a/firmware/export/events.h b/firmware/export/events.h
index cad0fad895..694566a43e 100644
--- a/firmware/export/events.h
+++ b/firmware/export/events.h
@@ -38,8 +38,8 @@
38#define EVENT_CLASS_BUFFERING 0x0400 38#define EVENT_CLASS_BUFFERING 0x0400
39#define EVENT_CLASS_GUI 0x0800 39#define EVENT_CLASS_GUI 0x0800
40 40
41bool add_event(unsigned short id, bool oneshot, void (*handler)); 41bool add_event(unsigned short id, bool oneshot, void (*handler)(void *data));
42void remove_event(unsigned short id, void (*handler)); 42void remove_event(unsigned short id, void (*handler)(void *data));
43void send_event(unsigned short id, void *data); 43void send_event(unsigned short id, void *data);
44 44
45#endif 45#endif