diff options
Diffstat (limited to 'firmware/export/ata_idle_notify.h')
-rw-r--r-- | firmware/export/ata_idle_notify.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/firmware/export/ata_idle_notify.h b/firmware/export/ata_idle_notify.h index f5f2a25fd9..491a612bdd 100644 --- a/firmware/export/ata_idle_notify.h +++ b/firmware/export/ata_idle_notify.h | |||
@@ -20,22 +20,36 @@ | |||
20 | #define __ATACALLBACK_H__ | 20 | #define __ATACALLBACK_H__ |
21 | 21 | ||
22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
23 | |||
24 | #if 0 | ||
25 | NOTE: ata_idle_nofity usage notes.. | ||
26 | |||
27 | 1) the callbacks are called in the ata thread, not main/your thread. | ||
28 | 2) Asyncronous callbacks (like the buffer refill) should be avoided. | ||
29 | If you must use an async callback, remember to check ata_is_active() before | ||
30 | accessing the disk, and nonot call any functions between that check and the | ||
31 | disk access which may cause a yield (lcd_update() does this!) | ||
32 | 3) Do not call cany yielding functions in the callback | ||
33 | 4) Do not call ata_sleep in the callbacks | ||
34 | 5) Dont Panic! | ||
35 | #endif | ||
36 | |||
23 | #define USING_ATA_CALLBACK !defined(SIMULATOR) \ | 37 | #define USING_ATA_CALLBACK !defined(SIMULATOR) \ |
24 | && !defined(HAVE_FLASH_DISK) \ | 38 | && !defined(HAVE_FLASH_DISK) \ |
25 | && !defined(HAVE_MMC) | 39 | && !defined(HAVE_MMC) |
26 | 40 | ||
27 | #define MAX_ATA_CALLBACKS 5 | 41 | #define MAX_ATA_CALLBACKS 5 |
28 | typedef bool (*ata_idle_notify)(void); | 42 | typedef bool (*ata_idle_notify)(void); |
29 | 43 | ||
30 | extern bool register_ata_idle_func(ata_idle_notify function); | 44 | extern bool register_ata_idle_func(ata_idle_notify function); |
31 | #if USING_ATA_CALLBACK | 45 | #if USING_ATA_CALLBACK |
32 | extern void ata_idle_notify_init(void); | 46 | extern void ata_idle_notify_init(void); |
33 | extern void unregister_ata_idle_func(ata_idle_notify function); | 47 | extern void unregister_ata_idle_func(ata_idle_notify function, bool run); |
34 | extern bool call_ata_idle_notifys(void); | 48 | extern bool call_ata_idle_notifys(bool sleep_after); |
35 | #else | 49 | #else |
36 | #define unregister_ata_idle_func(f) | 50 | #define unregister_ata_idle_func(f,r) |
37 | #define call_ata_idle_notifys() | 51 | #define call_ata_idle_notifys() |
38 | #define ata_idle_notify_init() | 52 | #define ata_idle_notify_init(s) |
39 | #endif | 53 | #endif |
40 | 54 | ||
41 | #endif /* __ATACALLBACK_H__ */ | 55 | #endif /* __ATACALLBACK_H__ */ |