1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006 Jonathan Gordon
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef __ATACALLBACK_H__
22 #define __ATACALLBACK_H__
29 NOTE: storage_idle_notify usage notes..
31 1) The callbacks are called in the ata thread, not main/your thread.
32 2) Asynchronous callbacks (like the buffer refill) should be avoided.
33 If you must use an async callback, remember to check storage_is_active() before
34 accessing the disk, and do not call any functions between that check and the
35 disk access which may cause a yield (lcd_update() does this!).
36 3) Do not call any yielding functions in the callback.
37 4) Do not call storage_sleep in the callbacks.
43 DISK_EVENT_SPINUP
= (EVENT_CLASS_DISK
|1),
46 #define USING_STORAGE_CALLBACK !defined(SIMULATOR) \
47 && ! ((CONFIG_STORAGE & STORAGE_NAND) \
48 && (CONFIG_NAND & NAND_IFP7XX)) \
49 && !defined(BOOTLOADER)
51 typedef bool (*storage_idle_notify
)(void);
53 extern void register_storage_idle_func(storage_idle_notify function
);
54 #if USING_STORAGE_CALLBACK
55 extern void unregister_storage_idle_func(storage_idle_notify function
, bool run
);
56 extern bool call_storage_idle_notifys(bool force
);
58 #define unregister_storage_idle_func(f,r)
59 #define call_storage_idle_notifys(f)
60 #define storage_idle_notify_init(s)
63 #endif /* __ATACALLBACK_H__ */