Fix advanced EQ menu
[maemo-rb.git] / firmware / export / ata-driver.h
blob7c69322bfb0ca6ca0a1ecde26900403aecb9f6b4
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2011 by Boris Gjenero
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 ****************************************************************************/
22 #ifndef __ATA_DRIVER_H__
23 #define __ATA_DRIVER_H__
25 #include "config.h" /* for HAVE_ATA_DMA */
26 #include "ata-target.h" /* for other target-specific defines */
28 /* Returns true if the interface hasn't been initialised yet */
29 bool ata_is_coldstart(void) STORAGE_INIT_ATTR;
30 /* Initializes the interface */
31 void ata_device_init(void) STORAGE_INIT_ATTR;
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.*/
35 void ata_enable(bool on);
36 /* ATA hard reset: pulse the RESET pin */
37 #ifdef HAVE_ATA_POWER_OFF
38 void ata_reset(void);
39 #else
40 void ata_reset(void) STORAGE_INIT_ATTR;
41 #endif
43 /* Optional optimized target-specific PIO transfer */
44 #ifdef ATA_OPTIMIZED_READING
45 void copy_read_sectors(unsigned char* buf, int wordcount);
46 #endif
47 #ifdef ATA_OPTIMIZED_WRITING
48 void copy_write_sectors(const unsigned char* buf, int wordcount);
49 #endif
51 /* Optional target-specific waiting */
52 #ifdef ATA_TARGET_POLLING
53 int ata_wait_for_bsy(void);
54 int ata_wait_for_rdy(void);
55 #endif
57 /* Optional setting of controller timings for PIO mode */
58 #ifdef ATA_SET_PIO_TIMING
59 void ata_set_pio_timings(int mode);
60 #endif
62 #ifdef HAVE_ATA_DMA
63 /* Used to update last disk activity time while waiting for DMA */
64 void ata_keep_active(void);
65 /* Set DMA mode for ATA interface */
66 void ata_dma_set_mode(unsigned char mode);
67 /* Sets up DMA transfer */
68 bool ata_dma_setup(void *addr, unsigned long bytes, bool write);
69 /* Waits for DMA transfer completion */
70 bool ata_dma_finish(void);
71 #endif /* HAVE_ATA_DMA */
73 #endif /* __ATA_DRIVER_H__ */