diff options
Diffstat (limited to 'firmware/target/arm/gigabeat/meg-fx/ata-target.h')
-rw-r--r-- | firmware/target/arm/gigabeat/meg-fx/ata-target.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/firmware/target/arm/gigabeat/meg-fx/ata-target.h b/firmware/target/arm/gigabeat/meg-fx/ata-target.h new file mode 100644 index 0000000000..95b66ab1bd --- /dev/null +++ b/firmware/target/arm/gigabeat/meg-fx/ata-target.h | |||
@@ -0,0 +1,66 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Linus Nielsen Feltzing | ||
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 | /* Plain C read & write loops */ | ||
23 | #define PREFER_C_READING | ||
24 | #define PREFER_C_WRITING | ||
25 | |||
26 | #define ATA_IOBASE 0x18000000 | ||
27 | #define ATA_DATA (*((volatile unsigned short*)(ATA_IOBASE))) | ||
28 | #define ATA_ERROR (*((volatile unsigned char*)(ATA_IOBASE + 0x02))) | ||
29 | #define ATA_NSECTOR (*((volatile unsigned char*)(ATA_IOBASE + 0x04))) | ||
30 | #define ATA_SECTOR (*((volatile unsigned char*)(ATA_IOBASE + 0x06))) | ||
31 | #define ATA_LCYL (*((volatile unsigned char*)(ATA_IOBASE + 0x08))) | ||
32 | #define ATA_HCYL (*((volatile unsigned char*)(ATA_IOBASE + 0x0A))) | ||
33 | #define ATA_SELECT (*((volatile unsigned char*)(ATA_IOBASE + 0x0C))) | ||
34 | #define ATA_COMMAND (*((volatile unsigned char*)(ATA_IOBASE + 0x0E))) | ||
35 | #define ATA_CONTROL (*((volatile unsigned char*)(0x20000000 + 0x1C))) | ||
36 | |||
37 | #define STATUS_BSY 0x80 | ||
38 | #define STATUS_RDY 0x40 | ||
39 | #define STATUS_DF 0x20 | ||
40 | #define STATUS_DRQ 0x08 | ||
41 | #define STATUS_ERR 0x01 | ||
42 | #define ERROR_ABRT 0x04 | ||
43 | |||
44 | #define WRITE_PATTERN1 0xa5 | ||
45 | #define WRITE_PATTERN2 0x5a | ||
46 | #define WRITE_PATTERN3 0xaa | ||
47 | #define WRITE_PATTERN4 0x55 | ||
48 | |||
49 | #define READ_PATTERN1 0xa5 | ||
50 | #define READ_PATTERN2 0x5a | ||
51 | #define READ_PATTERN3 0xaa | ||
52 | #define READ_PATTERN4 0x55 | ||
53 | |||
54 | #define READ_PATTERN1_MASK 0xff | ||
55 | #define READ_PATTERN2_MASK 0xff | ||
56 | #define READ_PATTERN3_MASK 0xff | ||
57 | #define READ_PATTERN4_MASK 0xff | ||
58 | |||
59 | #define SET_REG(reg,val) reg = (val) | ||
60 | #define SET_16BITREG(reg,val) reg = (val) | ||
61 | |||
62 | void ata_reset(void); | ||
63 | void ata_device_init(void); | ||
64 | bool ata_is_coldstart(void); | ||
65 | |||
66 | #endif | ||