summaryrefslogtreecommitdiff
path: root/firmware/target/sh/archos/ata-target.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/sh/archos/ata-target.h')
-rwxr-xr-xfirmware/target/sh/archos/ata-target.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/firmware/target/sh/archos/ata-target.h b/firmware/target/sh/archos/ata-target.h
new file mode 100755
index 0000000000..ddffb34f5a
--- /dev/null
+++ b/firmware/target/sh/archos/ata-target.h
@@ -0,0 +1,80 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Jens Arnold
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#ifndef ATA_TARGET_H
20#define ATA_TARGET_H
21
22/* asm optimised read & write loops */
23#define ATA_OPTIMIZED_READING
24#define ATA_OPTIMIZED_WRITING
25#define ATA_ADDRESS_DETECT /* need address detection */
26
27#define SWAP_WORDS
28
29#define ATA_IOBASE 0x06100100
30#define ATA_DATA (*((volatile unsigned short*)0x06104100))
31#define ATA_CONTROL1 ((volatile unsigned char*)0x06200206)
32#define ATA_CONTROL2 ((volatile unsigned char*)0x06200306)
33#define ATA_CONTROL (*ata_control)
34
35#define ATA_ERROR (*((volatile unsigned char*)ATA_IOBASE + 1))
36#define ATA_NSECTOR (*((volatile unsigned char*)ATA_IOBASE + 2))
37#define ATA_SECTOR (*((volatile unsigned char*)ATA_IOBASE + 3))
38#define ATA_LCYL (*((volatile unsigned char*)ATA_IOBASE + 4))
39#define ATA_HCYL (*((volatile unsigned char*)ATA_IOBASE + 5))
40#define ATA_SELECT (*((volatile unsigned char*)ATA_IOBASE + 6))
41#define ATA_COMMAND (*((volatile unsigned char*)ATA_IOBASE + 7))
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
49#define ERROR_ABRT 0x04
50
51#define WRITE_PATTERN1 0xa5
52#define WRITE_PATTERN2 0x5a
53#define WRITE_PATTERN3 0xaa
54#define WRITE_PATTERN4 0x55
55
56#define READ_PATTERN1 0xa5
57#define READ_PATTERN2 0x5a
58#define READ_PATTERN3 0xaa
59#define READ_PATTERN4 0x55
60
61#define READ_PATTERN1_MASK 0xff
62#define READ_PATTERN2_MASK 0xff
63#define READ_PATTERN3_MASK 0xff
64#define READ_PATTERN4_MASK 0xff
65
66#define SET_REG(reg,val) reg = (val)
67#define SET_16BITREG(reg,val) reg = (val)
68
69extern volatile unsigned char* ata_control;
70extern int ata_io_address;
71
72void ata_reset(void);
73void ata_address_detect(void);
74void ata_enable(bool on);
75void ata_device_init(void);
76bool ata_is_coldstart(void);
77
78void copy_read_sectors(unsigned char* buf, int wordcount);
79void copy_write_sectors(const unsigned char* buf, int wordcount);
80#endif