2018-12-04 07:14 PM
I need to do conversion between CHS addressing to LBA using the following formula:
LBA = (( C x HPC ) + H ) x SPT + S - 1
where,
but I just don't know where and how to get those from a uSD card? Is there any way to get them using the MMC/SDIO HAL library or FATFS?
Solved! Go to Solution.
2018-12-05 01:31 PM
What are you doing that needs CHS addressing? Pretending to be an old IDE adapter?
For an LBA device just multiply out by maximal head and sector counts.
2018-12-05 01:52 PM
I'm working on a SCSI Disk (target).
2018-12-06 03:36 PM
@Community member
Clive,
You're right, and I might not need it after all. But if you don't mind me asking, back in the day when you were working on a SCSI project, how you were handling the addressing of storage device (probably a hard drive) in commands like Read Capacity(10) , Read/write, Format Unit? Also when you need to provide parameters for disk geometry, like those you find on format page, how you would specify them?
You know, I started this project almost two years ago. At the time, I had thousands of questions and I had to spend months reading tons of material about SCSI, as well as, the SPC I'm using, until I became well-founded in the subject. Now, all I need to get done is to adopt the functions needed to format/read/write the medium.
Any input is highly appreciated!
2018-12-06 04:07 PM
SCSI and SASI before that always used BLOCK addresses. You could often program the geometry into the controller and it would store the configuration and bad block lists onto a maintenance cylinder, ie -1
I think the constraints you are labouring under are a result of register sizes used by the PC BIOS INT13 parameter.
The concept of cylinder, heads and records/sectors died a long while ago, storage media isn't that uniform, you can store far more data on the outer tracks than the inner ones.
I've worked with HD, TAPE, CD, DVD, etc and in more recent years with SD cards, NAND and eMMC devices.
READ/GET CAPACITY just tells you the number and size of blocks. FORMAT would lay down header and sector data on the blank media, which would otherwise be randomly magnetized.
2018-12-06 04:31 PM
I think the constraints you are labouring under are a result of register sizes used by the PC BIOS INT13 parameter.
But what the PC BIOS had to do about it and what was the INT13 parameter?
2018-12-07 11:48 AM
@Community member
Turns out it's not needed for read/write accesses. It's only needed for format mode page.
2018-12-07 11:54 AM
@Community member
By the way, the target-mode device I'm working on is not intended for vintage computers, so I'm sorry if I made you understand that because I needed to get CHS values. Anyways, thank you always for your excellent backup over here!
2018-12-07 11:01 PM
Well, for some reason non of the following returns a correct value: SDCardInfo.CardCapacity and SDCardInfo.CardBlockSize
Any idea?