diff options
author | Karl Kurbjun <kkurbjun@gmail.com> | 2007-09-25 01:44:57 +0000 |
---|---|---|
committer | Karl Kurbjun <kkurbjun@gmail.com> | 2007-09-25 01:44:57 +0000 |
commit | 968ba0a277d2437f109b8b1dde66dacfc5ee2126 (patch) | |
tree | 8e57a44709f01102a227e240b7476d02eabe9c6a | |
parent | 7255bdbb6ad04a5e79cef0e4f68a5e339683fd21 (diff) | |
download | rockbox-968ba0a277d2437f109b8b1dde66dacfc5ee2126.tar.gz rockbox-968ba0a277d2437f109b8b1dde66dacfc5ee2126.zip |
More ATA work (that doesn't work)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14848 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-x | bootloader/mrobe500.c | 6 | ||||
-rw-r--r-- | firmware/target/arm/olympus/mrobe-500/ata-mr500.c | 17 | ||||
-rw-r--r-- | firmware/target/arm/olympus/mrobe-500/ata-target.h | 23 | ||||
-rw-r--r-- | firmware/target/arm/olympus/mrobe-500/power-mr500.c | 12 |
4 files changed, 30 insertions, 28 deletions
diff --git a/bootloader/mrobe500.c b/bootloader/mrobe500.c index 57df653f10..86415cb560 100755 --- a/bootloader/mrobe500.c +++ b/bootloader/mrobe500.c | |||
@@ -99,7 +99,7 @@ void main(void) | |||
99 | reset_screen(); | 99 | reset_screen(); |
100 | lcd_update(); | 100 | lcd_update(); |
101 | } | 101 | } |
102 | 102 | #if 0 | |
103 | int button=0, *address=0x0, count=0; | 103 | int button=0, *address=0x0, count=0; |
104 | while(true) | 104 | while(true) |
105 | { | 105 | { |
@@ -118,7 +118,7 @@ void main(void) | |||
118 | else if (button==BUTTON_RC_REW) | 118 | else if (button==BUTTON_RC_REW) |
119 | address-=0x1000; | 119 | address-=0x1000; |
120 | 120 | ||
121 | // if ((inw(IO_GIO_BITSET0)&(1<<14)) == 0) | 121 | // if ((IO_GIO_BITSET0&(1<<14) == 0) |
122 | { | 122 | { |
123 | short x,y,z1,z2, reg; | 123 | short x,y,z1,z2, reg; |
124 | tsc2100_read_values(&x, &y, &z1, &z2); | 124 | tsc2100_read_values(&x, &y, &z1, &z2); |
@@ -132,7 +132,7 @@ void main(void) | |||
132 | line -= 6; | 132 | line -= 6; |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | #endif | |
136 | printf("ATA"); | 136 | printf("ATA"); |
137 | rc = ata_init(); | 137 | rc = ata_init(); |
138 | if(rc) | 138 | if(rc) |
diff --git a/firmware/target/arm/olympus/mrobe-500/ata-mr500.c b/firmware/target/arm/olympus/mrobe-500/ata-mr500.c index d860240134..47a8c61a45 100644 --- a/firmware/target/arm/olympus/mrobe-500/ata-mr500.c +++ b/firmware/target/arm/olympus/mrobe-500/ata-mr500.c | |||
@@ -29,12 +29,12 @@ | |||
29 | #include "backlight-target.h" | 29 | #include "backlight-target.h" |
30 | 30 | ||
31 | /* ARESET on C7C68300 and RESET on ATA interface (Active Low) */ | 31 | /* ARESET on C7C68300 and RESET on ATA interface (Active Low) */ |
32 | #define ATA_RESET_ENABLE return | 32 | #define ATA_RESET_ENABLE (IO_GIO_BITCLR0 = 1 << 10) |
33 | #define ATA_RESET_DISABLE return | 33 | #define ATA_RESET_DISABLE (IO_GIO_BITSET0 = 1 << 10) |
34 | 34 | ||
35 | /* ATA_EN on C7C68300 */ | 35 | /* ATA_EN on C7C68300 */ |
36 | #define USB_ATA_ENABLE return | 36 | #define USB_ATA_ENABLE (IO_GIO_BITSET0 = 1 << 2) |
37 | #define USB_ATA_DISABLE return | 37 | #define USB_ATA_DISABLE (IO_GIO_BITCLR0 = 1 << 2) |
38 | 38 | ||
39 | void ata_reset(void) | 39 | void ata_reset(void) |
40 | { | 40 | { |
@@ -55,20 +55,17 @@ void ata_enable(bool on) | |||
55 | 55 | ||
56 | bool ata_is_coldstart(void) | 56 | bool ata_is_coldstart(void) |
57 | { | 57 | { |
58 | return false; | 58 | return true; |
59 | } | 59 | } |
60 | 60 | ||
61 | void ata_device_init(void) | 61 | void ata_device_init(void) |
62 | { | 62 | { |
63 | /* ATA reset */ | 63 | /* ATA reset */ |
64 | ATA_RESET_DISABLE; /* Set the pin to disable an active low reset */ | 64 | ATA_RESET_DISABLE; /* Set the pin to disable an active low reset */ |
65 | 65 | IO_GIO_DIR0&=~(1<<10); | |
66 | /* set GIO17 (ATA power) on and output */ | ||
67 | IO_GIO_BITCLR1=(1<<1); | ||
68 | IO_GIO_DIR1&=~(1<<1); | ||
69 | } | 66 | } |
70 | 67 | ||
71 | #if !defined(BOOTLOADER) | 68 | #if 0 |
72 | void copy_read_sectors(unsigned char* buf, int wordcount) | 69 | void copy_read_sectors(unsigned char* buf, int wordcount) |
73 | { | 70 | { |
74 | __buttonlight_trigger(); | 71 | __buttonlight_trigger(); |
diff --git a/firmware/target/arm/olympus/mrobe-500/ata-target.h b/firmware/target/arm/olympus/mrobe-500/ata-target.h index f6b1a23b72..8b7dadf5e9 100644 --- a/firmware/target/arm/olympus/mrobe-500/ata-target.h +++ b/firmware/target/arm/olympus/mrobe-500/ata-target.h | |||
@@ -16,7 +16,7 @@ | |||
16 | * KIND, either express or implied. | 16 | * KIND, either express or implied. |
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | #ifndef ATA_TARGET_H | 20 | #ifndef ATA_TARGET_H |
21 | #define ATA_TARGET_H | 21 | #define ATA_TARGET_H |
22 | 22 | ||
@@ -29,15 +29,18 @@ | |||
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #define ATA_IOBASE 0x50000000 | 31 | #define ATA_IOBASE 0x50000000 |
32 | #define ATA_DATA (*((volatile unsigned short*)(ATA_IOBASE+0xa0))) | 32 | #define REGISTER_OFFSET 0x00400000 /* A21 = High */ |
33 | #define ATA_ERROR (*((volatile unsigned char*)(ATA_IOBASE + 0xa2))) | 33 | #define CONTROL_OFFSET 0x00800000 /* A22 = High */ |
34 | #define ATA_NSECTOR (*((volatile unsigned char*)(ATA_IOBASE + 0x24))) | 34 | #define IDE_SHIFT 17 |
35 | #define ATA_SECTOR (*((volatile unsigned char*)(ATA_IOBASE + 0x26))) | 35 | #define ATA_DATA (*((volatile unsigned short*)(REGISTER_OFFSET + (0x00 << IDE_SHIFT)))) |
36 | #define ATA_LCYL (*((volatile unsigned char*)(ATA_IOBASE + 0x28))) | 36 | #define ATA_ERROR (*((volatile unsigned char*)(REGISTER_OFFSET + (0x01 << IDE_SHIFT)))) |
37 | #define ATA_HCYL (*((volatile unsigned char*)(ATA_IOBASE + 0x2A))) | 37 | #define ATA_NSECTOR (*((volatile unsigned char*)(REGISTER_OFFSET + (0x02 << IDE_SHIFT)))) |
38 | #define ATA_SELECT (*((volatile unsigned char*)(ATA_IOBASE + 0x2C))) | 38 | #define ATA_SECTOR (*((volatile unsigned char*)(REGISTER_OFFSET + (0x03 << IDE_SHIFT)))) |
39 | #define ATA_COMMAND (*((volatile unsigned char*)(ATA_IOBASE + 0x2E))) | 39 | #define ATA_LCYL (*((volatile unsigned char*)(REGISTER_OFFSET + (0x04 << IDE_SHIFT)))) |
40 | #define ATA_CONTROL (*((volatile unsigned char*)(ATA_IOBASE + 0x9C))) | 40 | #define ATA_HCYL (*((volatile unsigned char*)(REGISTER_OFFSET + (0x05 << IDE_SHIFT)))) |
41 | #define ATA_SELECT (*((volatile unsigned char*)(REGISTER_OFFSET + (0x06 << IDE_SHIFT)))) | ||
42 | #define ATA_COMMAND (*((volatile unsigned char*)(REGISTER_OFFSET + (0x07 << IDE_SHIFT)))) | ||
43 | #define ATA_CONTROL (*((volatile unsigned char*)(CONTROL_OFFSET + (0x06 << IDE_SHIFT)))) | ||
41 | 44 | ||
42 | #define STATUS_BSY 0x80 | 45 | #define STATUS_BSY 0x80 |
43 | #define STATUS_RDY 0x40 | 46 | #define STATUS_RDY 0x40 |
diff --git a/firmware/target/arm/olympus/mrobe-500/power-mr500.c b/firmware/target/arm/olympus/mrobe-500/power-mr500.c index 074f5b233a..3a6dad77f4 100644 --- a/firmware/target/arm/olympus/mrobe-500/power-mr500.c +++ b/firmware/target/arm/olympus/mrobe-500/power-mr500.c | |||
@@ -32,7 +32,9 @@ | |||
32 | void power_init(void) | 32 | void power_init(void) |
33 | { | 33 | { |
34 | /* Initialize IDE power pin */ | 34 | /* Initialize IDE power pin */ |
35 | /* set GIO17 (ATA power) on and output */ | ||
35 | ide_power_enable(true); | 36 | ide_power_enable(true); |
37 | IO_GIO_DIR1&=~(1<<1); | ||
36 | /* Charger detect */ | 38 | /* Charger detect */ |
37 | } | 39 | } |
38 | 40 | ||
@@ -49,14 +51,14 @@ bool charging_state(void) { | |||
49 | void ide_power_enable(bool on) | 51 | void ide_power_enable(bool on) |
50 | { | 52 | { |
51 | if (on) | 53 | if (on) |
52 | return; | 54 | IO_GIO_BITCLR1=(1<<1); |
53 | else | 55 | else |
54 | return; | 56 | IO_GIO_BITSET1=(1<<1); |
55 | } | 57 | } |
56 | 58 | ||
57 | bool ide_powered(void) | 59 | bool ide_powered(void) |
58 | { | 60 | { |
59 | return true; | 61 | return !(IO_GIO_BITSET1&(1<<1)); |
60 | } | 62 | } |
61 | 63 | ||
62 | void power_off(void) | 64 | void power_off(void) |
@@ -64,8 +66,8 @@ void power_off(void) | |||
64 | /* turn off backlight and wait for 1 second */ | 66 | /* turn off backlight and wait for 1 second */ |
65 | __backlight_off(); | 67 | __backlight_off(); |
66 | sleep(HZ); | 68 | sleep(HZ); |
67 | /* set SLEEP bit to on in CLKCON to turn off */ | 69 | /* Hard shutdown */ |
68 | // CLKCON |=(1<<3); | 70 | IO_GIO_BITSET1|=1<<10; |
69 | } | 71 | } |
70 | 72 | ||
71 | #else /* SIMULATOR */ | 73 | #else /* SIMULATOR */ |