Link to home
Create AccountLog in
Avatar of nedfine
nedfineFlag for India

asked on

Write data to HDD sectors using write DMA command (0xCA)

I am trying to write data to hdd sectors usig write DMA command. (0xCA)
The command gets executed successfully without any error, but the data is not getting written to the sectors. I am using DJGPP compiler and I am executing the code in dos mode only.
After executing the program, sectors are filled with some garbage values.  How do i pass the data buffer to this method?
Avatar of DanRollins
DanRollins
Flag of United States of America image

Please tell me more about the "DMA command" that you are using,
Avatar of nedfine

ASKER

Thanks for the response.

I am using the ATA Command to write data to sectors using DMA access. Write DMA (0xCA).
For this we have to pass some parameters to the Base port address of IDE controller.like 0xIF0 and 0x170.. This parameter inputs contains sector address where we need to write the data. and command (0xCA) sector count etc.
I am able to execute the command successfully. But I dont know where and how I need to keep the data buffer so that while executing the ATA command it will take the data from that memory location.
Now what has  happened is that after executing the command (0xCA), it is writing some other data  to the hard disk sectors.
So I want to know where and how I can keep my buffer so that the command can refer that buffer to fill the sectors.
 
You can see more details about this ATA command in ATA/ATAPI standard 6.0 .
 
Thanks,
Ned
ASKER CERTIFIED SOLUTION
Avatar of DanRollins
DanRollins
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer