summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorBoris Gjenero <dreamlayers@rockbox.org>2011-12-08 21:23:53 +0000
committerBoris Gjenero <dreamlayers@rockbox.org>2011-12-08 21:23:53 +0000
commite4dbcc414b4b91ceb6b5e80a4ad49e4270fee096 (patch)
tree3165e08718b10840ac466821664852be8ba6d784 /firmware
parentd09818d745835653c2f7ff24547101c0833800d4 (diff)
downloadrockbox-e4dbcc414b4b91ceb6b5e80a4ad49e4270fee096.tar.gz
rockbox-e4dbcc414b4b91ceb6b5e80a4ad49e4270fee096.tar.bz2
rockbox-e4dbcc414b4b91ceb6b5e80a4ad49e4270fee096.zip
FS#12418 - Merge prototypes from ata-target.h files into new file ata-driver.h. After this change:
- ata.h is for users of ata.c - ata-driver.h is for functions implemented by target-specific code and used by ata.c - ata-target.h is for target-specific defines git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31182 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/ata.c6
-rw-r--r--firmware/export/ata-driver.h69
-rw-r--r--firmware/export/ata.h8
-rw-r--r--firmware/target/arm/archos/av300/ata-av300.c2
-rw-r--r--firmware/target/arm/archos/av300/ata-target.h8
-rw-r--r--firmware/target/arm/ata-pp5002.c3
-rw-r--r--firmware/target/arm/ata-pp5020.c3
-rw-r--r--firmware/target/arm/ata-target.h17
-rw-r--r--firmware/target/arm/imx31/ata-imx31.c3
-rw-r--r--firmware/target/arm/imx31/ata-target.h8
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c3
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/ata-target.h4
-rw-r--r--firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c2
-rw-r--r--firmware/target/arm/tms320dm320/creative-zvm/ata-target.h6
-rw-r--r--firmware/target/arm/tms320dm320/creative-zvm/dma-creativezvm.c2
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/ata-mr500.c3
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/ata-target.h5
-rw-r--r--firmware/target/coldfire/ata-target.h6
-rw-r--r--firmware/target/coldfire/iaudio/ata-iaudio.c2
-rw-r--r--firmware/target/coldfire/iaudio/m3/ata-m3.c2
-rw-r--r--firmware/target/coldfire/iriver/ata-iriver.c2
-rw-r--r--firmware/target/coldfire/mpio/ata-mpio.c2
-rw-r--r--firmware/target/coldfire/mpio/ata-target.h6
-rw-r--r--firmware/target/sh/archos/ata-archos.c2
-rw-r--r--firmware/target/sh/archos/ata-target.h6
25 files changed, 98 insertions, 82 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 309a155eb6..f567a4bb8a 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -32,7 +32,7 @@
#include "power.h"
#include "string.h"
#include "ata_idle_notify.h"
-#include "ata-target.h"
+#include "ata-driver.h"
#include "ata-defines.h"
#include "storage.h"
@@ -240,8 +240,6 @@ STATICIRAM ICODE_ATTR int wait_for_rdy(void)
return 0; /* timeout */
}
#else
-extern int ata_wait_for_bsy(void);
-extern int ata_wait_for_rdy(void);
#define wait_for_bsy ata_wait_for_bsy
#define wait_for_rdy ata_wait_for_rdy
#endif
@@ -1265,7 +1263,7 @@ static int set_features(void)
}
}
-#ifdef ATA_SET_DEVICE_FEATURES
+#ifdef ATA_SET_PIO_TIMING
ata_set_pio_timings(pio_mode);
#endif
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 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2011 by Boris Gjenero
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#ifndef __ATA_DRIVER_H__
+#define __ATA_DRIVER_H__
+
+#include "config.h" /* for HAVE_ATA_DMA */
+#include "ata-target.h" /* for other target-specific defines */
+
+ /* Returns true if the interface hasn't been initialised yet */
+bool ata_is_coldstart(void);
+/* Initializes the interface */
+void ata_device_init(void);
+/* ata_enable(true) is used after ata_device_init() to enable the interface
+ * ata_enable(false) is used to disable the interface so
+ * an ATA to USB bridge chip can use it instead.*/
+void ata_enable(bool on);
+/* ATA hard reset: pulse the RESET pin */
+void ata_reset(void);
+
+/* Optional optimized target-specific PIO transfer */
+#ifdef ATA_OPTIMIZED_READING
+void copy_read_sectors(unsigned char* buf, int wordcount);
+#endif
+#ifdef ATA_OPTIMIZED_WRITING
+void copy_write_sectors(const unsigned char* buf, int wordcount);
+#endif
+
+/* Optional target-specific waiting */
+#ifdef ATA_TARGET_POLLING
+int ata_wait_for_bsy(void);
+int ata_wait_for_rdy(void);
+#endif
+
+/* Optional setting of controller timings for PIO mode */
+#ifdef ATA_SET_PIO_TIMING
+void ata_set_pio_timings(int mode);
+#endif
+
+#ifdef HAVE_ATA_DMA
+/* Used to update last disk activity time while waiting for DMA */
+void ata_keep_active(void);
+/* Set DMA mode for ATA interface */
+void ata_dma_set_mode(unsigned char mode);
+/* Sets up DMA transfer */
+bool ata_dma_setup(void *addr, unsigned long bytes, bool write);
+/* Waits for DMA transfer completion */
+bool ata_dma_finish(void);
+#endif /* HAVE_ATA_DMA */
+
+#endif /* __ATA_DRIVER_H__ */
diff --git a/firmware/export/ata.h b/firmware/export/ata.h
index a3537812e5..41a2fd5c9f 100644
--- a/firmware/export/ata.h
+++ b/firmware/export/ata.h
@@ -65,16 +65,8 @@ long ata_last_disk_activity(void);
int ata_spinup_time(void); /* ticks */
#ifdef HAVE_ATA_DMA
-/* Needed to allow updating while waiting for DMA to complete */
-void ata_keep_active(void);
/* Returns current DMA mode */
int ata_get_dma_mode(void);
-/* Set DMA mode for ATA interface */
-void ata_dma_set_mode(unsigned char mode);
-/* Sets up DMA transfer */
-bool ata_dma_setup(void *addr, unsigned long bytes, bool write);
-/* Waits for DMA transfer completion */
-bool ata_dma_finish(void);
#endif /* HAVE_ATA_DMA */
#endif /* __ATA_H__ */
diff --git a/firmware/target/arm/archos/av300/ata-av300.c b/firmware/target/arm/archos/av300/ata-av300.c
index 08bee15fe6..e8623e5f16 100644
--- a/firmware/target/arm/archos/av300/ata-av300.c
+++ b/firmware/target/arm/archos/av300/ata-av300.c
@@ -30,7 +30,7 @@
#include <stdbool.h>
#include "system.h"
-#include "ata-target.h"
+#include "ata-driver.h"
void ata_reset()
{
diff --git a/firmware/target/arm/archos/av300/ata-target.h b/firmware/target/arm/archos/av300/ata-target.h
index bc3a19a6b4..5732f17045 100644
--- a/firmware/target/arm/archos/av300/ata-target.h
+++ b/firmware/target/arm/archos/av300/ata-target.h
@@ -19,6 +19,9 @@
*
****************************************************************************/
+#ifndef ATA_TARGET_H
+#define ATA_TARGET_H
+
/* Plain C read & write loops */
#define ATA_IOBASE 0x02400000
@@ -33,7 +36,4 @@
#define ATA_CONTROL (*((volatile unsigned char*)(ATA_IOBASE + 0x340)))
#define ATA_COMMAND (*((volatile unsigned char*)(ATA_IOBASE + 0x380)))
-void ata_reset(void);
-void ata_enable(bool on);
-bool ata_is_coldstart(void);
-void ata_device_init(void);
+#endif /* ATA_TARGET_H */
diff --git a/firmware/target/arm/ata-pp5002.c b/firmware/target/arm/ata-pp5002.c
index 2c4bb3b3bc..5ab0e9ddc7 100644
--- a/firmware/target/arm/ata-pp5002.c
+++ b/firmware/target/arm/ata-pp5002.c
@@ -23,8 +23,7 @@
#include <stdbool.h>
#include "system.h"
-#include "ata.h"
-#include "ata-target.h"
+#include "ata-driver.h"
void ata_reset()
{
diff --git a/firmware/target/arm/ata-pp5020.c b/firmware/target/arm/ata-pp5020.c
index 0eb64351f2..50e6e27c98 100644
--- a/firmware/target/arm/ata-pp5020.c
+++ b/firmware/target/arm/ata-pp5020.c
@@ -23,8 +23,7 @@
#include <stdbool.h>
#include "system.h"
-#include "ata.h"
-#include "ata-target.h"
+#include "ata-driver.h"
void ata_reset()
{
diff --git a/firmware/target/arm/ata-target.h b/firmware/target/arm/ata-target.h
index 779ebed070..616c451579 100644
--- a/firmware/target/arm/ata-target.h
+++ b/firmware/target/arm/ata-target.h
@@ -19,6 +19,11 @@
*
****************************************************************************/
+#ifndef ATA_TARGET_H
+#define ATA_TARGET_H
+
+#include "config.h"
+
#ifdef CPU_PP
#ifdef HAVE_BOOTLOADER_USB_MODE
@@ -49,17 +54,11 @@
/* asm optimized reading and writing */
#define ATA_OPTIMIZED_READING
#define ATA_OPTIMIZED_WRITING
-void copy_read_sectors(unsigned char* buf, int wordcount);
-void copy_write_sectors(const unsigned char* buf, int wordcount);
#endif /* CONFIG_CPU */
#endif
-void ata_reset(void);
-bool ata_is_coldstart(void);
-void ata_device_init(void);
-
#ifdef HAVE_ATA_DMA
/* IDE DMA controller registers */
@@ -88,8 +87,6 @@ void ata_device_init(void);
#define ATA_MAX_UDMA 1
#endif
-void ata_dma_set_mode(unsigned char mode);
-bool ata_dma_setup(void *addr, unsigned long bytes, bool write);
-bool ata_dma_finish(void);
-
#endif /* HAVE_ATA_DMA */
+
+#endif /* ATA_TARGET_H */
diff --git a/firmware/target/arm/imx31/ata-imx31.c b/firmware/target/arm/imx31/ata-imx31.c
index 8a40c924ff..80539b9c9d 100644
--- a/firmware/target/arm/imx31/ata-imx31.c
+++ b/firmware/target/arm/imx31/ata-imx31.c
@@ -25,9 +25,8 @@
#include "system.h"
#include "power.h"
#include "panic.h"
-#include "ata.h"
+#include "ata-driver.h"
#include "ata-defines.h"
-#include "ata-target.h"
#include "ccm-imx31.h"
#ifdef HAVE_ATA_DMA
#include "sdma-imx31.h"
diff --git a/firmware/target/arm/imx31/ata-target.h b/firmware/target/arm/imx31/ata-target.h
index 24141c6aa7..6893e83198 100644
--- a/firmware/target/arm/imx31/ata-target.h
+++ b/firmware/target/arm/imx31/ata-target.h
@@ -21,6 +21,8 @@
#ifndef ATA_TARGET_H
#define ATA_TARGET_H
+#include "config.h"
+
#ifdef BOOTLOADER
#define ATA_DRIVER_CLOSE
#endif
@@ -46,12 +48,8 @@
#define ATA_COMMAND ATA_DRIVE_COMMAND
#define ATA_CONTROL ATA_DRIVE_CONTROL
-void ata_reset(void);
-void ata_device_init(void);
-bool ata_is_coldstart(void);
-#define ATA_SET_DEVICE_FEATURES
-void ata_set_pio_timings(int mode);
+#define ATA_SET_PIO_TIMING
#define ATA_TARGET_POLLING
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c
index 8cd0260fe4..89b00bbd1d 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c
@@ -26,8 +26,7 @@
#include "power.h"
#include "panic.h"
#include "pcf50606.h"
-#include "ata.h"
-#include "ata-target.h"
+#include "ata-driver.h"
#include "backlight-target.h"
/* ARESET on C7C68300 and RESET on ATA interface (Active Low) */
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/ata-target.h b/firmware/target/arm/s3c2440/gigabeat-fx/ata-target.h
index 95cbaa11cf..7ca7d77c4f 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/ata-target.h
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/ata-target.h
@@ -30,7 +30,6 @@
#define PREFER_C_WRITING
#if !defined(BOOTLOADER)
#define ATA_OPTIMIZED_READING
-void copy_read_sectors(unsigned char* buf, int wordcount);
#endif
#define ATA_IOBASE 0x18000000
@@ -44,8 +43,5 @@ void copy_read_sectors(unsigned char* buf, int wordcount);
#define ATA_COMMAND (*((volatile unsigned char*)(ATA_IOBASE + 0x0E)))
#define ATA_CONTROL (*((volatile unsigned char*)(0x20000000 + 0x1C)))
-void ata_reset(void);
-void ata_device_init(void);
-bool ata_is_coldstart(void);
#endif
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c
index ad10502f2d..4ff39e2a9e 100644
--- a/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c
+++ b/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c
@@ -26,7 +26,7 @@
#include "system.h"
#include "power.h"
#include "panic.h"
-#include "ata-target.h"
+#include "ata-driver.h"
#include "dm320.h"
#include "ata.h"
#include "string.h"
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/ata-target.h b/firmware/target/arm/tms320dm320/creative-zvm/ata-target.h
index 1a1648983d..5b66d192a5 100644
--- a/firmware/target/arm/tms320dm320/creative-zvm/ata-target.h
+++ b/firmware/target/arm/tms320dm320/creative-zvm/ata-target.h
@@ -32,8 +32,6 @@
#define copy_read_sectors dma_ata_read
#define copy_write_sectors dma_ata_write
*/
-void copy_read_sectors(const unsigned char* buf, int wordcount);
-void copy_write_sectors(const unsigned char* buf, int wordcount);
/* Nasty hack, but Creative is nasty... */
#define ata_read_sectors _ata_read_sectors
@@ -53,10 +51,6 @@ extern int _ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
#define ATA_COMMAND (*((volatile unsigned char*)(ATA_IOBASE+0xE)))
#define ATA_CONTROL (*((volatile unsigned char*)(ATA_IOBASE+0x800C)))
-void ata_reset(void);
-void ata_device_init(void);
-bool ata_is_coldstart(void);
-void ide_power_enable(bool on);
#ifdef BOOTLOADER
int load_minifs_file(char* filename, unsigned char* location);
#endif
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/dma-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/dma-creativezvm.c
index 6a74ff5e57..418a28ff09 100644
--- a/firmware/target/arm/tms320dm320/creative-zvm/dma-creativezvm.c
+++ b/firmware/target/arm/tms320dm320/creative-zvm/dma-creativezvm.c
@@ -26,7 +26,7 @@
#include "dma-target.h"
#include "dm320.h"
#include "ata.h"
-#include "ata-target.h"
+#include "ata-driver.h"
#include "ata-defines.h"
#include <stdbool.h>
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/ata-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/ata-mr500.c
index 59f8464d76..1abe0843b3 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/ata-mr500.c
+++ b/firmware/target/arm/tms320dm320/mrobe-500/ata-mr500.c
@@ -27,8 +27,7 @@
#include "power.h"
#include "panic.h"
#include "pcf50606.h"
-#include "ata.h"
-#include "ata-target.h"
+#include "ata-driver.h"
#include "backlight-target.h"
/* ARESET on C7C68300 and RESET on ATA interface (Active Low) */
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/ata-target.h b/firmware/target/arm/tms320dm320/mrobe-500/ata-target.h
index ca75876259..564ff3031f 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/ata-target.h
+++ b/firmware/target/arm/tms320dm320/mrobe-500/ata-target.h
@@ -31,8 +31,6 @@
#define ATA_OPTIMIZED_READING
#define ATA_OPTIMIZED_WRITING
-void copy_read_sectors(const unsigned char* buf, int wordcount);
-void copy_write_sectors(const unsigned char* buf, int wordcount);
#endif
#define ATA_IOBASE 0x50000000
@@ -49,8 +47,5 @@ void copy_write_sectors(const unsigned char* buf, int wordcount);
#define ATA_COMMAND (*((volatile unsigned char*)(REGISTER_OFFSET + (0x07 << IDE_SHIFT))))
#define ATA_CONTROL (*((volatile unsigned char*)(CONTROL_OFFSET + (0x06 << IDE_SHIFT))))
-void ata_reset(void);
-void ata_device_init(void);
-bool ata_is_coldstart(void);
#endif
diff --git a/firmware/target/coldfire/ata-target.h b/firmware/target/coldfire/ata-target.h
index 1a223e1eae..405dbcafe5 100644
--- a/firmware/target/coldfire/ata-target.h
+++ b/firmware/target/coldfire/ata-target.h
@@ -42,11 +42,5 @@
#define ATA_IN8(reg) ((reg) >> 8)
#define ATA_IN16(reg) (swap16(reg))
-void ata_reset(void);
-void ata_enable(bool on);
-void ata_device_init(void);
-bool ata_is_coldstart(void);
-void copy_read_sectors(unsigned char* buf, int wordcount);
-void copy_write_sectors(const unsigned char* buf, int wordcount);
#endif
diff --git a/firmware/target/coldfire/iaudio/ata-iaudio.c b/firmware/target/coldfire/iaudio/ata-iaudio.c
index 4a70456ed2..91b6c87093 100644
--- a/firmware/target/coldfire/iaudio/ata-iaudio.c
+++ b/firmware/target/coldfire/iaudio/ata-iaudio.c
@@ -25,7 +25,7 @@
#include "system.h"
#include "power.h"
#include "pcf50606.h"
-#include "ata-target.h"
+#include "ata-driver.h"
void ata_reset(void)
{
diff --git a/firmware/target/coldfire/iaudio/m3/ata-m3.c b/firmware/target/coldfire/iaudio/m3/ata-m3.c
index d82ca5a857..b3630798cf 100644
--- a/firmware/target/coldfire/iaudio/m3/ata-m3.c
+++ b/firmware/target/coldfire/iaudio/m3/ata-m3.c
@@ -25,7 +25,7 @@
#include "kernel.h"
#include "system.h"
#include "power.h"
-#include "ata-target.h"
+#include "ata-driver.h"
void ata_reset(void)
{
diff --git a/firmware/target/coldfire/iriver/ata-iriver.c b/firmware/target/coldfire/iriver/ata-iriver.c
index d16943172c..1b8f475c4c 100644
--- a/firmware/target/coldfire/iriver/ata-iriver.c
+++ b/firmware/target/coldfire/iriver/ata-iriver.c
@@ -25,7 +25,7 @@
#include "system.h"
#include "power.h"
#include "pcf50606.h"
-#include "ata-target.h"
+#include "ata-driver.h"
void ata_reset(void)
{
diff --git a/firmware/target/coldfire/mpio/ata-mpio.c b/firmware/target/coldfire/mpio/ata-mpio.c
index cf4276b5a0..af082640bf 100644
--- a/firmware/target/coldfire/mpio/ata-mpio.c
+++ b/firmware/target/coldfire/mpio/ata-mpio.c
@@ -25,7 +25,7 @@
#include "kernel.h"
#include "system.h"
#include "power.h"
-#include "ata-target.h"
+#include "ata-driver.h"
void ata_reset(void)
{
diff --git a/firmware/target/coldfire/mpio/ata-target.h b/firmware/target/coldfire/mpio/ata-target.h
index b2c8f15417..095a7fc1bd 100644
--- a/firmware/target/coldfire/mpio/ata-target.h
+++ b/firmware/target/coldfire/mpio/ata-target.h
@@ -36,11 +36,5 @@
#define ATA_SELECT (*((volatile unsigned short*)(ATA_IOBASE + 0x2c)))
#define ATA_COMMAND (*((volatile unsigned short*)(ATA_IOBASE + 0x2e)))
-void ata_reset(void);
-void ata_enable(bool on);
-void ata_device_init(void);
-bool ata_is_coldstart(void);
-void copy_read_sectors(unsigned char* buf, int wordcount);
-void copy_write_sectors(const unsigned char* buf, int wordcount);
#endif
diff --git a/firmware/target/sh/archos/ata-archos.c b/firmware/target/sh/archos/ata-archos.c
index 6b58481b8b..2046d3b33f 100644
--- a/firmware/target/sh/archos/ata-archos.c
+++ b/firmware/target/sh/archos/ata-archos.c
@@ -24,7 +24,7 @@
#include <stdbool.h>
#include "kernel.h"
#include "system.h"
-#include "ata-target.h"
+#include "ata-driver.h"
#include "hwcompat.h"
#define ATA_CONTROL1 ((volatile unsigned char*)0x06200206)
diff --git a/firmware/target/sh/archos/ata-target.h b/firmware/target/sh/archos/ata-target.h
index fb343f4df4..dc55cdd5d5 100644
--- a/firmware/target/sh/archos/ata-target.h
+++ b/firmware/target/sh/archos/ata-target.h
@@ -41,11 +41,5 @@
extern volatile unsigned char* ata_control;
-void ata_reset(void);
-void ata_enable(bool on);
-void ata_device_init(void);
-bool ata_is_coldstart(void);
-void copy_read_sectors(unsigned char* buf, int wordcount);
-void copy_write_sectors(const unsigned char* buf, int wordcount);
#endif