How punny. Just one more whack-a-mole to get.
[kugel-rb.git] / firmware / export / ata.h
blob5be32da23111a0f8685ff48aef7a54f54c3d8473
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_MD2(int drive,) unsigned long start, int count, void* buf);
43 int ata_write_sectors(IF_MD2(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_MD2(int drive,) struct storage_info *info);
52 #endif
53 #ifdef HAVE_HOTSWAP
54 bool ata_removable(IF_MD_NONVOID(int drive));
55 bool ata_present(IF_MD_NONVOID(int drive));
56 #endif
59 #ifdef CONFIG_STORAGE_MULTI
60 int ata_num_drives(int first_drive);
61 #endif
64 long ata_last_disk_activity(void);
65 int ata_spinup_time(void); /* ticks */
67 #ifdef HAVE_ATA_DMA
68 /* Needed to allow updating while waiting for DMA to complete */
69 void ata_keep_active(void);
70 /* Returns current DMA mode */
71 int ata_get_dma_mode(void);
72 /* Set DMA mode for ATA interface */
73 void ata_dma_set_mode(unsigned char mode);
74 /* Sets up DMA transfer */
75 bool ata_dma_setup(void *addr, unsigned long bytes, bool write);
76 /* Waits for DMA transfer completion */
77 bool ata_dma_finish(void);
78 #endif /* HAVE_ATA_DMA */
80 #endif /* __ATA_H__ */