Tried fixing up the ATA PIO driver (polled)
This commit is contained in:
parent
2408bb85cd
commit
81e223fc8a
2 changed files with 10 additions and 3 deletions
|
@ -54,7 +54,7 @@ namespace MTGosHAL {
|
|||
auto BlockDevice::getDriveCnt() -> uint8_t {return numDevices;}
|
||||
auto BlockDevice::getDriveNumByName(const char * name) -> uint8_t {
|
||||
if(strlen(name)!=5)
|
||||
return -1; //Format is ATA[0-3][sl] (regex)
|
||||
return -1; //Format is ATA[0-3][sm] (regex)
|
||||
if((name[0]!=name[2])||(name[2]!='A'))
|
||||
return -1;
|
||||
if(name[1]!='T')
|
||||
|
@ -62,7 +62,7 @@ namespace MTGosHAL {
|
|||
uint8_t drivenum=name[3]-0x30;
|
||||
if(drivenum>3)
|
||||
return -1;
|
||||
if((name[4]!='s')&&(name[4]!='l'))
|
||||
if((name[4]!='s')&&(name[4]!='m'))
|
||||
return -1;
|
||||
drivenum<<=1;
|
||||
drivenum+=(name[4]=='s')?1:0;
|
||||
|
@ -84,6 +84,9 @@ namespace MTGosHAL {
|
|||
outb(ataports[drv>>1]+LBAmid, (uint8_t)(sectorNum>>8));
|
||||
outb(ataports[drv>>1]+LBAhi, (uint8_t)(sectorNum>>16));
|
||||
outb(ataports[drv>>1]+CMD, 0x24);
|
||||
inb(ataports[drv>>1]+CMD);
|
||||
inb(ataports[drv>>1]+CMD);
|
||||
inb(ataports[drv>>1]+CMD);
|
||||
while(inb(ataports[drv>>1]+CMD)&0x80);
|
||||
uint16_t *bufw=(uint16_t *)buf;
|
||||
for(int i=0;i<256;i++)
|
||||
|
|
|
@ -40,7 +40,11 @@ namespace MTGosHAL {
|
|||
idt.setEntry(48, (void *)((uint32_t)&intr_stub_0+768), SEG_KERNEL, IDT_TRAP_GATE | IDT_SEG_32_BIT | IDT_RING_0 | IDT_USED);
|
||||
idt.setEntry(8, (void *)((uint32_t)&intr_stub_0+128), SEG_DBL_FAULT, IDT_TASK_GATE | IDT_SEG_32_BIT | IDT_RING_0 | IDT_USED);
|
||||
idt.apply();
|
||||
sti();
|
||||
char sec[513];
|
||||
sec[512]='\0';
|
||||
disk.readSector(disk.getDriveNumByName("ATA0m"),1,(uint8_t *)sec);
|
||||
out << sec;
|
||||
//sti();
|
||||
::main();
|
||||
for(;;);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue