summaryrefslogtreecommitdiff
path: root/firmware/target/arm/iriver/h10/ata-target.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/iriver/h10/ata-target.h')
-rw-r--r--firmware/target/arm/iriver/h10/ata-target.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/firmware/target/arm/iriver/h10/ata-target.h b/firmware/target/arm/iriver/h10/ata-target.h
new file mode 100644
index 0000000000..a93af79015
--- /dev/null
+++ b/firmware/target/arm/iriver/h10/ata-target.h
@@ -0,0 +1,72 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Barry Wardell
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20/* ATA stuff was taken from the iPod code */
21
22/* Plain C read & write loops */
23#define PREFER_C_READING
24#define PREFER_C_WRITING
25
26#if (CONFIG_CPU == PP5002)
27#define ATA_IOBASE 0xc00031e0
28#define ATA_CONTROL (*((volatile unsigned char*)(0xc00033f8)))
29#elif (CONFIG_CPU == PP5020)
30#define ATA_IOBASE 0xc30001e0
31#define ATA_CONTROL (*((volatile unsigned char*)(0xc30003f8)))
32#endif
33
34#define ATA_DATA (*((volatile unsigned short*)(ATA_IOBASE)))
35#define ATA_ERROR (*((volatile unsigned char*)(ATA_IOBASE + 0x04)))
36#define ATA_NSECTOR (*((volatile unsigned char*)(ATA_IOBASE + 0x08)))
37#define ATA_SECTOR (*((volatile unsigned char*)(ATA_IOBASE + 0x0c)))
38#define ATA_LCYL (*((volatile unsigned char*)(ATA_IOBASE + 0x10)))
39#define ATA_HCYL (*((volatile unsigned char*)(ATA_IOBASE + 0x14)))
40#define ATA_SELECT (*((volatile unsigned char*)(ATA_IOBASE + 0x18)))
41#define ATA_COMMAND (*((volatile unsigned char*)(ATA_IOBASE + 0x1c)))
42
43#define STATUS_BSY 0x80
44#define STATUS_RDY 0x40
45#define STATUS_DF 0x20
46#define STATUS_DRQ 0x08
47#define STATUS_ERR 0x01
48#define ERROR_ABRT 0x04
49
50#define WRITE_PATTERN1 0xa5
51#define WRITE_PATTERN2 0x5a
52#define WRITE_PATTERN3 0xaa
53#define WRITE_PATTERN4 0x55
54
55#define READ_PATTERN1 0xa5
56#define READ_PATTERN2 0x5a
57#define READ_PATTERN3 0xaa
58#define READ_PATTERN4 0x55
59
60#define READ_PATTERN1_MASK 0xff
61#define READ_PATTERN2_MASK 0xff
62#define READ_PATTERN3_MASK 0xff
63#define READ_PATTERN4_MASK 0xff
64
65#define SET_REG(reg,val) reg = (val)
66#define SET_16BITREG(reg,val) reg = (val)
67
68
69void ata_reset(void);
70void ata_enable(bool on);
71bool ata_is_coldstart(void);
72void ata_device_init(void);