1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006 Jonathan Gordon
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
19 #ifndef __ATACALLBACK_H__
20 #define __ATACALLBACK_H__
25 NOTE
: ata_idle_nofity usage notes
..
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
37 #define USING_ATA_CALLBACK !defined(SIMULATOR) \
38 && !defined(HAVE_FLASH_DISK)
40 #define MAX_ATA_CALLBACKS 5
41 typedef bool (*ata_idle_notify
)(void);
43 extern bool register_ata_idle_func(ata_idle_notify function
);
44 #if USING_ATA_CALLBACK
45 extern void ata_idle_notify_init(void);
46 extern void unregister_ata_idle_func(ata_idle_notify function
, bool run
);
47 extern bool call_ata_idle_notifys(bool force
);
49 #define unregister_ata_idle_func(f,r)
50 #define call_ata_idle_notifys(f)
51 #define ata_idle_notify_init(s)
54 #endif /* __ATACALLBACK_H__ */