Better ATA I/O detection

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1065 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2002-06-18 12:53:02 +00:00
parent 1a17d356f2
commit a422b8381b

View file

@ -23,6 +23,7 @@
#include "sh7034.h" #include "sh7034.h"
#include "system.h" #include "system.h"
#include "debug.h" #include "debug.h"
#include "panic.h"
#define SECTOR_SIZE 512 #define SECTOR_SIZE 512
#define ATA_DATA (*((volatile unsigned short*)0x06104100)) #define ATA_DATA (*((volatile unsigned short*)0x06104100))
@ -328,7 +329,8 @@ static int master_slave_detect(void)
static int io_address_detect(void) static int io_address_detect(void)
{ {
unsigned char tmp = ATA_STATUS; unsigned char tmp = ATA_STATUS & 0xf9; /* Mask the IDX and CORR bits */
unsigned char tmp2;
unsigned char dummy; unsigned char dummy;
/* We compare the STATUS register with the ALT_STATUS register, which /* We compare the STATUS register with the ALT_STATUS register, which
@ -340,8 +342,9 @@ static int io_address_detect(void)
to the ATA controller. We read a register that we know exists to make to the ATA controller. We read a register that we know exists to make
sure that the data on the bus isn't identical to the STATUS register sure that the data on the bus isn't identical to the STATUS register
contents. */ contents. */
ATA_SECTOR = 0;
dummy = ATA_SECTOR; dummy = ATA_SECTOR;
if(tmp == *ATA_CONTROL2) if(tmp == (*ATA_CONTROL2) & 0xf9)
{ {
DEBUGF("CONTROL is at 0x306\n"); DEBUGF("CONTROL is at 0x306\n");
ata_control = ATA_CONTROL2; ata_control = ATA_CONTROL2;