Updated our source code header to explicitly mention that we are GPL v2 or
[Rockbox.git] / firmware / export / ata_idle_notify.h
blobeb2c899b107e02d0b691233ccf30016d665f83f7
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
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__
25 #include <stdbool.h>
26 #include "events.h"
28 #if 0
29 NOTE: ata_idle_nofity usage notes..
31 1) the callbacks are called in the ata thread, not main/your thread.
32 2) Asyncronous callbacks (like the buffer refill) should be avoided.
33 If you must use an async callback, remember to check ata_is_active() before
34 accessing the disk, and nonot 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 cany yielding functions in the callback
37 4) Do not call ata_sleep in the callbacks
38 5) Dont Panic!
39 #endif
41 enum {
42 DISK_EVENT_SPINUP = (EVENT_CLASS_DISK|1),
45 #define USING_ATA_CALLBACK !defined(SIMULATOR) \
46 && !defined(HAVE_FLASH_DISK)
48 typedef bool (*ata_idle_notify)(void);
50 extern void register_ata_idle_func(ata_idle_notify function);
51 #if USING_ATA_CALLBACK
52 extern void unregister_ata_idle_func(ata_idle_notify function, bool run);
53 extern bool call_ata_idle_notifys(bool force);
54 #else
55 #define unregister_ata_idle_func(f,r)
56 #define call_ata_idle_notifys(f)
57 #define ata_idle_notify_init(s)
58 #endif
60 #endif /* __ATACALLBACK_H__ */