Page 1 of 1
Ata/Atapi driver
Posted: Mon Feb 16, 2004 12:50 pm
by ASHLEY4
Hi
Has anyone got any idea's what could be coursing some problems in my Atapi driver???.
The driver detects all hard drives and cd drives on the system stores the address, All this works fine there is a comand packet proc that works fine, But the code that is giving me some problems is comand 43h(read toc), i am useing this to read the number and address's ect, of track's on a audio cd.(just as a starter for more complex stuff)
Now this is the problem, i have got this to work on all my computer's 10 in all with 1 or 2 querks .
On one of the pc's if you call the proc whilst it is reading the cd it will reboot , On another pc when i press a key that test the proc nothing happens on the first press (i have it print a string when called) then press it a second time the proc works but the light stay's on, on the base(processor light), as if the proceser is busy this does not go off untill you press and call it again when the light goes out, But the proc does not compleat and it carrys on like this.(so i have to press it twice to make it work).
These are some of the things that i have tryed,
1, reading the status reg at the end of the proc , this couses the I letter to be printed (which in my os means invalid instruction).
2, i have tryed stopping the irq, this does not work.
3, calling a proc at the end of this proc,(command 00h) this make's the light flash and make's it go out so it cures the problem, But i am not happy , i need to know what is the course of the problem.
The rest work fine they are a mixture of cd's and dvd's drives, the main problem is the reboot.
I would be very graitful for any help, that you can give me.
ASHLEY4. :'(
Re:Ata/Atapi driver
Posted: Mon Feb 16, 2004 1:47 pm
by Pype.Clicker
okay, let's go through the sanity check first:
1. is your interrupt handler working fine for keyboard only (just to make sure stubs are in place)
2. does it work fine for another slave device (the PS2 mouse, for instance). It may be just an error programming the PIC mask that makes you receive no interrupt.
3. did you properly enabled the interrupt on the ATA controller ? (IEN bit is bit #1 in Device Control register and it should be cleared to allow interrupts to be reported).
4. How does your code behave in the Bochs ?
Reading the status word should *not* trigger an invalid opcode ... i suggest you disassemble the faulty code and look at what could be wrong.
What about focusing on the ATA only as a first step (ignoring CD drives) ? ...
Re:Ata/Atapi driver
Posted: Mon Feb 16, 2004 4:28 pm
by ASHLEY4
Thanks for the reply,
I may of not explained myself properly, when i press the letter S this then sends the read toc proc, if this is compleated it write's " toc" on the screen, if it bails out because of, time out ect,
it does not print "toc".
All the proc have been fully tested and they work fine apart from this one machine when i press it once the proc works But the prosseser light stay's on, On the base, press the "S" again and it cancells the light But does not print the string (so i have to press it twice or the light will stay on like you are in a loop).
The problem with the reboot i have solved it was because i did not check bit 6 DRDY in the status reg before trying to call the read toc command , this does not effect those that cache the toc .
Thanks again
ASHLEY4.
Re:Ata/Atapi driver
Posted: Tue Feb 17, 2004 2:09 am
by Pype.Clicker
i'm still confused by your 'prosseser' (processor?) light ... are you just talking about the CDROM led ?
btw, did you made sure the controller was supporting the command you're issuing (this should be in the 'identify device' information, iirc)
Re:Ata/Atapi driver
Posted: Tue Feb 17, 2004 7:43 am
by ASHLEY4
Hi
Thanks for the fast response. the light is the one on the pc base (not the one on the cd)it flashers on and off and stays on when the pc is under high load.
ASHLEY4.
Re:Ata/Atapi driver
Posted: Tue Feb 17, 2004 8:07 am
by Pype.Clicker
hum. Actually, this is likely to be the HDD led (i.e. it is switched on by the ATA controller everytime it 'works' on a disk and switched off when the request is completed).
The fact it stays on probably means that you have not acknowledged something on the controller (it still waits for you to clear a control bit or read some status word or something ...)
Does the other commands work fine with that 'faulty' machine (for instance can you read its disk if you've ever tried ?) I see two possible causes:
-that very CDROM or ATA controller are not standard-compliant. You should inspect the content of the Identify sector and check it support the standard revision you're basing your driver on
- at some point, you're not strictly respecting the ATAPI docs, and the other controllers didn't really care (because they're not 100% compliant but a bit more 'permissive') but *this* very machine is one you cannot f00l.
Re:Ata/Atapi driver
Posted: Tue Feb 17, 2004 12:02 pm
by ASHLEY4
Hi
I agree with your idear,its like the command has not ended and is wating for status reg to be red,or some thing.
But iv done that and it still does it.
The command works and i can read the toc.
Come to think about it the drive (a dvd) would be mist on my drive detection proc,when i first made it,I had to loop it longer to get it to detec that drive.
I will let you no if i find whats wrong.
Thanks again
ASHLEY4.
Re:Ata/Atapi driver
Posted: Wed Feb 18, 2004 7:09 pm
by ASHLEY4
Thanks Pype. Clicker
You was right, becarse i had put only 12bytes to transfer in one of reg, when there was more, it wanted reading ever 12 bytes.( i thought the 12bytes were for the command packet number) :-[ .
So like you sad it did need reading & reading & readig.
Now it works fine on all my pc.
Thanks again.
ASHLEY4.
Re:Ata/Atapi driver
Posted: Thu Feb 19, 2004 6:01 am
by Pype.Clicker
if you have sources released, i'd be happy to give it a look
i only implemented ATA support so far ...
btw, ever considered becoming a member ?
Re:Ata/Atapi driver
Posted: Thu Feb 19, 2004 9:48 am
by ASHLEY4
Hi,
Give me a few days to tidy up the code(when i can not find what's wrong in my code,i do a lot of chopping and deselecting, so i have to tidy up and add comments) , and i will send the code and anyone is welcome to try it and use it or to laugh at it if the case may be ;D.
Just a small note on my OS.
It is a 32bit pmode OS and has no protection (eg: all ring 0).
It is designed not as a desktop OS, but more for doing persific jobs ,eg: running games, stand alone mp3 player, controling electronic progects.
As such it is designed to boot from a CD, load all files in to memory and jump to a menu ect .
The design of the OS is moduler at compile time not at run time, so when you compile it, if you want VESA you include it, if you only need command line then you would not include the VESA ect.
It is going to be all written in ASM (fasm).
So far i have got these working, it goes to protective mode, the A20 , GDT, IDT, PIC,ISR, time/date, VESA2,vesa fonts, Keyboard driver, and some functions like print, hex, and a ATAPI driver (half finnished).
This at the moment loads from the boot loader by Alex Fru's "bootprog".
And yes i will join.
Regards ASHLEY4.
Re:Ata/Atapi driver
Posted: Thu Feb 19, 2004 3:08 pm
by Pype.Clicker
hehe ... targetting Xbox ?