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) reset_screen(); lcd_update(); } - +#if 0 int button=0, *address=0x0, count=0; while(true) { @@ -118,7 +118,7 @@ void main(void) else if (button==BUTTON_RC_REW) address-=0x1000; - // if ((inw(IO_GIO_BITSET0)&(1<<14)) == 0) + // if ((IO_GIO_BITSET0&(1<<14) == 0) { short x,y,z1,z2, reg; tsc2100_read_values(&x, &y, &z1, &z2); @@ -132,7 +132,7 @@ void main(void) line -= 6; } } - +#endif printf("ATA"); rc = ata_init(); 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 @@ #include "backlight-target.h" /* ARESET on C7C68300 and RESET on ATA interface (Active Low) */ -#define ATA_RESET_ENABLE return -#define ATA_RESET_DISABLE return +#define ATA_RESET_ENABLE (IO_GIO_BITCLR0 = 1 << 10) +#define ATA_RESET_DISABLE (IO_GIO_BITSET0 = 1 << 10) /* ATA_EN on C7C68300 */ -#define USB_ATA_ENABLE return -#define USB_ATA_DISABLE return +#define USB_ATA_ENABLE (IO_GIO_BITSET0 = 1 << 2) +#define USB_ATA_DISABLE (IO_GIO_BITCLR0 = 1 << 2) void ata_reset(void) { @@ -55,20 +55,17 @@ void ata_enable(bool on) bool ata_is_coldstart(void) { - return false; + return true; } void ata_device_init(void) { /* ATA reset */ ATA_RESET_DISABLE; /* Set the pin to disable an active low reset */ - - /* set GIO17 (ATA power) on and output */ - IO_GIO_BITCLR1=(1<<1); - IO_GIO_DIR1&=~(1<<1); + IO_GIO_DIR0&=~(1<<10); } -#if !defined(BOOTLOADER) +#if 0 void copy_read_sectors(unsigned char* buf, int wordcount) { __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 @@ * KIND, either express or implied. * ****************************************************************************/ - + #ifndef ATA_TARGET_H #define ATA_TARGET_H @@ -29,15 +29,18 @@ #endif #define ATA_IOBASE 0x50000000 -#define ATA_DATA (*((volatile unsigned short*)(ATA_IOBASE+0xa0))) -#define ATA_ERROR (*((volatile unsigned char*)(ATA_IOBASE + 0xa2))) -#define ATA_NSECTOR (*((volatile unsigned char*)(ATA_IOBASE + 0x24))) -#define ATA_SECTOR (*((volatile unsigned char*)(ATA_IOBASE + 0x26))) -#define ATA_LCYL (*((volatile unsigned char*)(ATA_IOBASE + 0x28))) -#define ATA_HCYL (*((volatile unsigned char*)(ATA_IOBASE + 0x2A))) -#define ATA_SELECT (*((volatile unsigned char*)(ATA_IOBASE + 0x2C))) -#define ATA_COMMAND (*((volatile unsigned char*)(ATA_IOBASE + 0x2E))) -#define ATA_CONTROL (*((volatile unsigned char*)(ATA_IOBASE + 0x9C))) +#define REGISTER_OFFSET 0x00400000 /* A21 = High */ +#define CONTROL_OFFSET 0x00800000 /* A22 = High */ +#define IDE_SHIFT 17 +#define ATA_DATA (*((volatile unsigned short*)(REGISTER_OFFSET + (0x00 << IDE_SHIFT)))) +#define ATA_ERROR (*((volatile unsigned char*)(REGISTER_OFFSET + (0x01 << IDE_SHIFT)))) +#define ATA_NSECTOR (*((volatile unsigned char*)(REGISTER_OFFSET + (0x02 << IDE_SHIFT)))) +#define ATA_SECTOR (*((volatile unsigned char*)(REGISTER_OFFSET + (0x03 << IDE_SHIFT)))) +#define ATA_LCYL (*((volatile unsigned char*)(REGISTER_OFFSET + (0x04 << IDE_SHIFT)))) +#define ATA_HCYL (*((volatile unsigned char*)(REGISTER_OFFSET + (0x05 << IDE_SHIFT)))) +#define ATA_SELECT (*((volatile unsigned char*)(REGISTER_OFFSET + (0x06 << IDE_SHIFT)))) +#define ATA_COMMAND (*((volatile unsigned char*)(REGISTER_OFFSET + (0x07 << IDE_SHIFT)))) +#define ATA_CONTROL (*((volatile unsigned char*)(CONTROL_OFFSET + (0x06 << IDE_SHIFT)))) #define STATUS_BSY 0x80 #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 @@ void power_init(void) { /* Initialize IDE power pin */ + /* set GIO17 (ATA power) on and output */ ide_power_enable(true); + IO_GIO_DIR1&=~(1<<1); /* Charger detect */ } @@ -49,14 +51,14 @@ bool charging_state(void) { void ide_power_enable(bool on) { if (on) - return; + IO_GIO_BITCLR1=(1<<1); else - return; + IO_GIO_BITSET1=(1<<1); } bool ide_powered(void) { - return true; + return !(IO_GIO_BITSET1&(1<<1)); } void power_off(void) @@ -64,8 +66,8 @@ void power_off(void) /* turn off backlight and wait for 1 second */ __backlight_off(); sleep(HZ); - /* set SLEEP bit to on in CLKCON to turn off */ -// CLKCON |=(1<<3); + /* Hard shutdown */ + IO_GIO_BITSET1|=1<<10; } #else /* SIMULATOR */