Fix red: broken tools/addtargetdir.pl
[kugel-rb.git] / firmware / export / ata.h
blobb5e39de3aaef14b53899f93e7428016bbbb39a8e
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Alan Korr
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 __ATA_H__
22 #define __ATA_H__
24 #include <stdbool.h>
25 #include "config.h" /* for HAVE_MULTIVOLUME or not */
26 #include "mv.h" /* for IF_MV() and friends */
28 struct storage_info;
30 void ata_enable(bool on);
31 void ata_spindown(int seconds);
32 void ata_sleep(void);
33 void ata_sleepnow(void);
34 /* NOTE: DO NOT use this to poll for disk activity.
35 If you are waiting for the disk to become active before
36 doing something use ata_idle_notify.h
38 bool ata_disk_is_active(void);
39 int ata_soft_reset(void);
40 int ata_init(void);
41 void ata_close(void);
42 int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf);
43 int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf);
44 void ata_spin(void);
45 #if (CONFIG_LED == LED_REAL)
46 void ata_set_led_enabled(bool enabled);
47 #endif
48 unsigned short* ata_get_identify(void);
50 #ifdef STORAGE_GET_INFO
51 void ata_get_info(IF_MV2(int drive,) struct storage_info *info);
52 #endif
53 #ifdef HAVE_HOTSWAP
54 bool ata_removable(IF_MV_NONVOID(int drive));
55 bool ata_present(IF_MV_NONVOID(int drive));
56 #endif
60 long ata_last_disk_activity(void);
61 int ata_spinup_time(void); /* ticks */
63 #ifdef HAVE_ATA_DMA
64 /* Needed to allow updating while waiting for DMA to complete */
65 void ata_keep_active(void);
66 /* Returns current DMA mode */
67 int ata_get_dma_mode(void);
68 /* Set DMA mode for ATA interface */
69 void ata_dma_set_mode(unsigned char mode);
70 /* Sets up DMA transfer */
71 bool ata_dma_setup(void *addr, unsigned long bytes, bool write);
72 /* Waits for DMA transfer completion */
73 bool ata_dma_finish(void);
74 #endif /* HAVE_ATA_DMA */
76 #endif /* __ATA_H__ */