Page 1 of 1
Can a Compact Flash card be controlled by ATA PIO code?
Posted: Sun Mar 07, 2021 1:28 pm
by quadrant
Can I control a compact flash card with the
ATA PIO mode code described in the OSDev Wiki? I.e. treat it as a hard disk.
These lines on
Wikipedia make me think it's possible...
The interface operates, depending on the state of a mode pin on power-up, as either a 16-bit PC Card (0x7FF address limit) or as an IDE (PATA) interface...
CompactFlash IDE mode defines an interface that is smaller than, but electrically identical to, the ATA interface. The CF device contains an ATA controller and appears to the host device as if it were a hard disk.
Also, these lines on
Wikipedia...
Compact Flash in its IDE mode is essentially a miniaturized ATA interface, intended for use on devices that use flash memory storage. No interfacing chips or circuitry are required, other than to directly adapt the smaller CF socket onto the larger ATA connector. (Although most CF cards only support IDE mode up to PIO4, making them much slower in IDE mode than their CF capable speed).
Re: Can a Compact Flash card be controlled by ATA PIO code?
Posted: Sun Mar 07, 2021 2:21 pm
by Octocontrabass
Only if it's attached to an IDE controller. If it isn't, you'll need a driver for whatever host bus adapter it's attached to.
Re: Can a Compact Flash card be controlled by ATA PIO code?
Posted: Sun Mar 07, 2021 3:20 pm
by quadrant
Ah ok.
And to confirm, by IDE controller, do you mean something like:
Basically something that physically connects the card to the address/databus of the computer? With some simple circuitry (no specialized ICs) to handle bus interfacing.
Re: Can a Compact Flash card be controlled by ATA PIO code?
Posted: Sun Mar 07, 2021 4:08 pm
by Octocontrabass
No, I mean something that provides the same software-level interface as the
IBM Fixed Disk and Diskette Drive Adapter or the
PCI IDE Controller. It doesn't make a difference to your driver if the CF card is attached to a SATA port as long as the software interface matches what your driver expects.
The devices you've linked provide a different software interface, so you would need to modify the driver to work with them. (If you want the same software interface without any complex circuitry, look for a 16-bit ISA card.)
Re: Can a Compact Flash card be controlled by ATA PIO code?
Posted: Sun Mar 07, 2021 7:25 pm
by quadrant
Oh, I see! Thank you for the links.
So there's a specification called "PCI IDE Controller Specification", that an "IDE controller" must implement to be compliant. And this "IDE controller" does not reside inside the IDE disk (ex. inside a hard disk, floppy drive, or compact flash), but it is instead on separate external circuitry.
By not residing on the disk, this allows the disk to be controlled by whatever code you want. I.e., if you don't want to use this specification, you can roll your own solution. For example this code (
one,
two) to control the compact flash in the
RC2014 example?
Re: Can a Compact Flash card be controlled by ATA PIO code?
Posted: Sun Mar 07, 2021 9:53 pm
by quadrant
I've seen a couple of homebrew computers that manage to use a compact flash for storage (including the
RC2014 and
Magic-1), and they did not need to have a spec-compliant controller card. How is this possible?
Re: Can a Compact Flash card be controlled by ATA PIO code?
Posted: Mon Mar 08, 2021 1:11 am
by Octocontrabass
quadrant wrote:So there's a specification called "PCI IDE Controller Specification", that an "IDE controller" must implement to be compliant. And this "IDE controller" does not reside inside the IDE disk (ex. inside a hard disk, floppy drive, or compact flash), but it is instead on separate external circuitry.
Correct. If the IDE controller is not compliant, your driver won't work with it.
quadrant wrote:By not residing on the disk, this allows the disk to be controlled by whatever code you want. I.e., if you don't want to use this specification, you can roll your own solution. For example this code (
one,
two) to control the compact flash in the
RC2014 example?
For specialty devices like this, the hardware is usually designed according to what will be cheap instead of trying to follow a particular software interface. The RC2014 hardware is pretty similar to a standard PIO-only IDE controller, so the driver code is also pretty similar.
quadrant wrote:I've seen a couple of homebrew computers that manage to use a compact flash for storage (including the
RC2014 and
Magic-1), and they did not need to have a spec-compliant controller card. How is this possible?
The IDE spec defines how software talks to the controller, not how the controller talks to the drive. The homebrew controller cards mostly talk to the drive the same way a standard IDE controller does.