summaryrefslogtreecommitdiff
path: root/firmware/export/ata-driver.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export/ata-driver.h')
-rw-r--r--firmware/export/ata-driver.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/firmware/export/ata-driver.h b/firmware/export/ata-driver.h
new file mode 100644
index 0000000000..8711b2145f
--- /dev/null
+++ b/firmware/export/ata-driver.h
@@ -0,0 +1,69 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 by Boris Gjenero
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef __ATA_DRIVER_H__
23#define __ATA_DRIVER_H__
24
25#include "config.h" /* for HAVE_ATA_DMA */
26#include "ata-target.h" /* for other target-specific defines */
27
28 /* Returns true if the interface hasn't been initialised yet */
29bool ata_is_coldstart(void);
30/* Initializes the interface */
31void ata_device_init(void);
32/* ata_enable(true) is used after ata_device_init() to enable the interface
33 * ata_enable(false) is used to disable the interface so
34 * an ATA to USB bridge chip can use it instead.*/
35void ata_enable(bool on);
36/* ATA hard reset: pulse the RESET pin */
37void ata_reset(void);
38
39/* Optional optimized target-specific PIO transfer */
40#ifdef ATA_OPTIMIZED_READING
41void copy_read_sectors(unsigned char* buf, int wordcount);
42#endif
43#ifdef ATA_OPTIMIZED_WRITING
44void copy_write_sectors(const unsigned char* buf, int wordcount);
45#endif
46
47/* Optional target-specific waiting */
48#ifdef ATA_TARGET_POLLING
49int ata_wait_for_bsy(void);
50int ata_wait_for_rdy(void);
51#endif
52
53/* Optional setting of controller timings for PIO mode */
54#ifdef ATA_SET_PIO_TIMING
55void ata_set_pio_timings(int mode);
56#endif
57
58#ifdef HAVE_ATA_DMA
59/* Used to update last disk activity time while waiting for DMA */
60void ata_keep_active(void);
61/* Set DMA mode for ATA interface */
62void ata_dma_set_mode(unsigned char mode);
63/* Sets up DMA transfer */
64bool ata_dma_setup(void *addr, unsigned long bytes, bool write);
65/* Waits for DMA transfer completion */
66bool ata_dma_finish(void);
67#endif /* HAVE_ATA_DMA */
68
69#endif /* __ATA_DRIVER_H__ */