Howto switch PIO mode for ATA device

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
razer
Posts: 6
Joined: Sat Dec 15, 2012 9:46 am

Howto switch PIO mode for ATA device

Post by razer »

How can I switch the PIO mode aof an ATA device from PIO0 to PIO4?

Thanks, Regards razer
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: Howto switch PIO mode for ATA device

Post by Gigasoft »

Send command EFh (set features) with feature=3 (set transfer mode) and count=12 (PIO mode 4).
razer
Posts: 6
Joined: Sat Dec 15, 2012 9:46 am

Re: Howto switch PIO mode for ATA device

Post by razer »

Thanks for your reply.
I tried to implement this using following code:

Code: Select all

  // Set PIO 4 mode
  outbp (port + 1, 0x03);   // Select feature 3 (set transfer mode)
  outbp (port + 2, 0x0C);   // Transfer mode = PIO 4
  outbp (port + 6, 0xA0);  // Master drive
  outbp (port + 7, 0xEF);   // Set features command
  uint8 status = inbp(port + 7);
I have some question since it doesn't seem to work.
Is this configuration right?
What's the expected status code? (The drive always returns 0x50 for it)

Regardless of the transfer mode setting, I don't see any speedup. Maybe the drive doesn't understand the commands?

Robert
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: Howto switch PIO mode for ATA device

Post by Gigasoft »

You can check if the drive supports PIO mode 4 in the result of the IDENTIFY DEVICE commmand, where bit 1 of word 64 will be set if it does. You also have to configure the host controller to use the selected timing. The way to do this depends on the controller.
Post Reply