port programming

Hi all!

I have got a very big problem.

It’s not too easy.

I can use my parallel port with this simple code:

#include <stdio.h>
#include <stdint.h> /* for uintptr_t /
#include <hw/inout.h> /
for in*() and out*() functions /
#include <sys/neutrino.h> /
for ThreadCtl() /
#include <sys/mman.h> /
for mmap_device_io() */

/* ______________________________________________________________________ */

int main()
int privity_err;
uintptr_t handle;

/* Give this thread root permissions to access the hardware */
privity_err = ThreadCtl( _NTO_TCTL_IO, NULL );
if ( privity_err == -1 ) {fprintf( stderr, “can’t get root perm\n”);}

handle = mmap_device_io(1, 0x378 ); //1 byte long register, the address of paralell port

out8( handle, 0xFF ); // a simple write to the port


It’s working correctly.

And my question is this:

How can I controll the
IDE0 (address 1f0 - 1f7)
IDE1 (address 3f0 - 3f7)

If I use (for example) the address 3f0

handle = mmap_device_io(1, 0x3f0 );

It doesn’t work. I tried but didn’t do anything.

Can somebody help me?

Thanks Thomas.

What do you mean by it doesn’t work. Fooling around with the floppy and ide controler is not a very good ideal mainly if the floppy and ide driver are running at the same time.

What do you mean by it doesn’t work.

It’s mean I used a digital multimeter, to measure the voltages on the IDE port’s pins, and it didn’t changed.

floppy and ide driver are running at the same time

yes but the system don’t use the IDE1 port (the winchester and the CD is on the IDE0).
Can it make some problem?
Or shutdown the driver? (but in this case i can’t use my system :frowning: )

Any idea?

I’m no expert on IDE but I believe this is more like a bus then say a parallel port. Hence when you write something it only last a fraction of a second, just like to a memory bus. Too fast for a multimeter to catch.

Just to be on the safe side make sure the QNX IDE driver doesn’t use the secondary controller.

Yes it’s righ it is a bus.
Have you got any idea how can I know is it working or not?

Get an oscilloscope, access the port as fast as possible and check the chip select pin.

Thanks I’ll try this.
If it’s working I’ll write here the details.

What does working mean? Hook up a drive and if the driver will access it, it works. Don’t count on using the EIDE bus as some kind of digital I/O port like you can do with some of the Parallel Port lines. You can just poke the ports and read the status register to see if things seem sane.

I don’t think people really care. It’s the first time in 20 years that I hear about someone wanting to take controle if the AT interface directly. That being said I guess someone could write some sort of device to connect to this but I thing it would be easier to design a PCI board :wink:

Is that an offer Mario? You’ll design the board, I’ll write the driver? But what will it do? ;-).

Nah not an offer ;-) However this thing got me thinking about the possibility of have some sort of custom design hanging on the SATA/PATA interface. I still believe it would be easier to design a PCI board but you never know.

You might want to think a bit about where the ATA interface came from. The original IBM AT hard drive had a serious bit of hardware on the controller, which was connected to the drive via two cables. I think the drives were pretty dumb, and the controller had the smarts to control the disk and head movements. When the IDE interface came along, the hardware on the CPU side diminished considerably, and the controller smarts went into the drive itself. This caused a lot of problems early on if you wanted to put a master and a slave on the cable, but from different drive manufacturers, I think because only the master electronics really did anything.

The point I’m getting around to is that I think to a large degree the IDE cable is an extension of the original IBM PC 16 bit bus. I’m sure that the transmission properties have been much improved from the early days, but in the end I think it is still the same basic bus. So I doubt it was be very useful unless it was for a very similar purpose.