MultiDrive – free backup, clone & wipe disk utility from Atola Technology

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: ATA Terminal
PostPosted: January 12th, 2010, 18:28 
Offline

Joined: November 11th, 2007, 22:44
Posts: 168
I have started writing my own ATA terminal software, I am trying to figure out an interesting issue.
I am returning each "block" of data as a 16 bit integer. When sending EC through the status register, the data returned has the bytes swapped. Command 20 returns data in order. Is there something I missed regarding the byte order? I tried returning as a single byte and the same thing happens. Any ideas?
Shawn
Attachment:
Correct.jpg
Correct.jpg [ 226.1 KiB | Viewed 13698 times ]

Attachment:
Switched.jpg
Switched.jpg [ 231.78 KiB | Viewed 13698 times ]

Attachment:
Code Block.jpg
Code Block.jpg [ 28.78 KiB | Viewed 13698 times ]


PS.
I have no intention of giving the software out. Some of the regulars maybe. I have learned from this project, that if you don't have the discipline to build this yourself you can only do more harm than good.


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 12th, 2010, 18:52 
Offline

Joined: October 3rd, 2005, 0:40
Posts: 4753
Location: Hungary
Hi,

Command 0xEC is supposed to work like that. This is normal. Just check ATA specs.

pepe

_________________
Adatmentés - Data recovery


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 12th, 2010, 18:56 
Offline

Joined: November 11th, 2007, 22:44
Posts: 168
That is what got me this far, I must have missed it. Are there others that you know of that work the same way?


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 12th, 2010, 19:17 
Offline

Joined: October 3rd, 2005, 0:40
Posts: 4753
Location: Hungary
I don't remember other ones.
But in this one only the ASCII fields are byte swapped too.

pepe

_________________
Adatmentés - Data recovery


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 12th, 2010, 19:32 
Offline

Joined: August 12th, 2008, 13:11
Posts: 3235
Location: USA
Nice project

_________________
You don't have to backup all of your files, just the ones you want to keep.


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 12th, 2010, 19:45 
Offline

Joined: November 11th, 2007, 22:44
Posts: 168
Thanks DRC! I have been wanting to write an event driven logging class with exports and reporting for a while. I needed an ATA terminal for study, so I went for it. Quite fun actually. I am working on a few more MDI child forms. One for copy and jump on error, one for smart, one for partition tables, and one for graphing delay by sector.

Pepe, after going back and reading I did catch it. I was trying to figure out if I should have a switch to perform the swap after the data is read(if there was more than one) or if I should just process 0xEC differently.

Shawn


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 12th, 2010, 19:48 
Offline

Joined: November 11th, 2007, 22:44
Posts: 168
Oh, I forgot the number one reason for the project! Easy drive access through managed code. Pointers be gone!


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 12th, 2010, 20:04 
Offline
User avatar

Joined: September 29th, 2005, 12:02
Posts: 3577
Location: Chicago
Couple hints for you
You can try read and write data by dwords not just words
It will be faster
Most of the controllers and modern drives support this feature
But use it as an option, so it can be changed through user interface

Also it is good to have some kind of commands store, so you can load commands from this store and you don't need to type them again and again

Don't forget LBA48 support for sending commands and reading registers back

Good luck

_________________
SAN, NAS, RAID, Server, and HDD Data Recovery.


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 12th, 2010, 20:23 
Offline

Joined: November 11th, 2007, 22:44
Posts: 168
DWords, From the spec I though I was stuck with words. I will make the change now. I have been debating the cammands store going more of a macro route. Haven't made that decision yet. Your HDDScan app and the bit about the Cypress USB controller is what is driving this.


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 12th, 2010, 20:31 
Offline

Joined: November 11th, 2007, 22:44
Posts: 168
Anyone care to elaborate on the Hi/Mid/Low cylinder registers? With LBA addressing how can I calculate these values?
Shawn


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 12th, 2010, 20:32 
Offline

Joined: November 11th, 2007, 22:44
Posts: 168
Doomer, it appears that Identify will only return words. Controller limitation?


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 12th, 2010, 20:38 
Offline

Joined: October 3rd, 2005, 0:40
Posts: 4753
Location: Hungary
Quote:
Anyone care to elaborate on the Hi/Mid/Low cylinder registers? With LBA addressing how can I calculate these values?


U don't need them.
At least drives over some hundred megs will support LBA.
It is very rare that you need CHS addressing these days.
When u need it, just check ATA specs.

pepe

_________________
Adatmentés - Data recovery


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 12th, 2010, 20:42 
Offline

Joined: November 11th, 2007, 22:44
Posts: 168
So how are the LBA addresses entered through the H/M/L registers?


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 12th, 2010, 20:51 
Offline

Joined: November 11th, 2007, 22:44
Posts: 168
Attachment:
Regs.PNG
Regs.PNG [ 20.76 KiB | Viewed 13656 times ]

So the first byte of the lba goes in low, second in mid, last in high?


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 12th, 2010, 21:02 
Offline

Joined: October 3rd, 2005, 0:40
Posts: 4753
Location: Hungary
L <- LBA bits 0-7
M <- LBA bits 8-15
H <- LBA bits 16-23
Device reg lower nibble <-LBA bits 24-27

this is for 28bit LBA addressing.
But please, really, read that ATA spec, it will teach you a bunch of things.

pepe

_________________
Adatmentés - Data recovery


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 12th, 2010, 21:10 
Offline

Joined: November 11th, 2007, 22:44
Posts: 168
Pepe, I am reading trust me. I am just trying to apply as I read to further grasp the concepts.


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 12th, 2010, 23:22 
Offline

Joined: November 11th, 2007, 22:44
Posts: 168
Still trucking, put in the 48 bit support for the LBA registers. Now working on the DWORD read/write support. Thanks for everything guys!
Attachment:
lba48.jpg
lba48.jpg [ 265.38 KiB | Viewed 13642 times ]


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 13th, 2010, 0:05 
Offline
User avatar

Joined: September 29th, 2005, 12:02
Posts: 3577
Location: Chicago
1x1 and 1x2 are LBA48 related too

_________________
SAN, NAS, RAID, Server, and HDD Data Recovery.


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 13th, 2010, 0:31 
Offline

Joined: November 11th, 2007, 22:44
Posts: 168
they are in my struct, just haven't used them yet so the textboxes aren't there. When using LBA values, x6 should should always have bit 6 set correct?


Top
 Profile  
 
 Post subject: Re: ATA Terminal
PostPosted: January 13th, 2010, 1:02 
Offline
User avatar

Joined: September 29th, 2005, 12:02
Posts: 3577
Location: Chicago
Almost correct

_________________
SAN, NAS, RAID, Server, and HDD Data Recovery.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 71 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group