I made a routine to eject the cd.
@Bochs: At first time the cd is ejecting properly. Then it doesn't ejects.
@VMWare: The CD is not at all ejected.
@Real Hardware: The CD is not ejected for the first time. Then it always ejects properly.
Why is this weirdness? Is this becoz of poor coding or improper configuration or anything else.
One thing i forgot to say. Everytime the IRQ fires properly in all the three cases.
In VMware how could i see the configurations like ioaddr1 & 2 as in case of Bochs.
config
------
ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata1-master: type=cdrom, path=F:, status=inserted
A weird ATAPI problem
Re:A weird ATAPI problem
Maybe you're trying to send a command to the device when
it doesn't feel like listening?
Before sending the packet, try checking the status register for the busy flag to be off, and for the device ready flag to be on. (0x177).
Here's the only code example on the net of ATA/ATAPI that I can actually understand. Scroll down to the ATAPI example, which happens to be an eject command.
http://www.geocities.com/SiliconValley/2072/atapi.htm
it doesn't feel like listening?
Before sending the packet, try checking the status register for the busy flag to be off, and for the device ready flag to be on. (0x177).
Here's the only code example on the net of ATA/ATAPI that I can actually understand. Scroll down to the ATAPI example, which happens to be an eject command.
http://www.geocities.com/SiliconValley/2072/atapi.htm
Re:A weird ATAPI problem
I have about 20 test pc, and my atapi driver works on all of them, but one pc, you need to press the keyboard two times to get the cd to open, the first time it does not work, but them it works find after the second press and it only does that on that pc, on the first press of a reboot.
So its down to the CD on the pc, you will find it works fine on another pc.
I would not worry about it.
So its down to the CD on the pc, you will find it works fine on another pc.
I would not worry about it.
Re:A weird ATAPI problem
@Exabyte : I used the same document. It's quite easy to understand. Is there anything i missed?
@Dex4u : 20 test pc. hmm!
@Dex4u : 20 test pc. hmm!
Code: Select all
mov eax,2
mov ebx,20
mul ebx
mov ebx,hda
add ebx,eax
call HDD_wait_ready
mov al,0x0
mov dx,[ebx]
add dx,06
or eax,[ebx+8]
out dx,al
call HDD_wait_ready
mov dx,[ebx+4]
mov al,1000b
out dx,al
mov dx,[ebx]
add dx,0x07
mov al,0xA0
out dx,al
mov ecx,0xFFFF
.waitloop:
loopnz .waitloop
call HDD_ready_DRQ
xor edx,edx
mov ecx,5
mov esi,CD_COMMAND_PACKET
cld
.next_command:
mov dx,[ebx]
mov ax,[esi]
out dx,ax
add esi,2
dec ecx
jnz .next_command
mov dx,[ebx]
mov ax,[esi]
out dx,ax
call HDD_wait_ready