Skip navigation.
Home
The QNX Community Portal

View topic - port programming

port programming

Isn't the name clear?

port programming

Postby tomasz987 » Wed Oct 15, 2008 2:41 am

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.
tomasz987
New Member
 
Posts: 6
Joined: Tue Oct 14, 2008 12:50 am

RE: port programming

Postby mario » Wed Oct 15, 2008 3:05 am

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.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

answer

Postby tomasz987 » Wed Oct 15, 2008 3:17 am

>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 :( )

Any idea?
tomasz987
New Member
 
Posts: 6
Joined: Tue Oct 14, 2008 12:50 am

RE: answer

Postby mario » Wed Oct 15, 2008 4:03 am

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.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Re: RE: answer

Postby tomasz987 » Wed Oct 15, 2008 11:00 am

mario wrote: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?
tomasz987
New Member
 
Posts: 6
Joined: Tue Oct 14, 2008 12:50 am

RE: Re: RE: answer

Postby mario » Wed Oct 15, 2008 11:54 am

Get an oscilloscope, access the port as fast as possible and check the chip select pin.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Re: RE: Re: RE: answer

Postby tomasz987 » Wed Oct 15, 2008 12:22 pm

mario wrote: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.
tomasz987
New Member
 
Posts: 6
Joined: Tue Oct 14, 2008 12:50 am

RE: Re: RE: Re: RE: answer

Postby maschoen » Wed Oct 15, 2008 4:16 pm

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.
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm

Re: RE: Re: RE: answer

Postby mario » Wed Oct 15, 2008 4:20 pm

tomasz987 wrote:
mario wrote: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.


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 ;-)
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

RE: Re: RE: Re: RE: answer

Postby maschoen » Wed Oct 15, 2008 4:33 pm

Is that an offer Mario? You'll design the board, I'll write the driver? But what will it do? ;-).
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm

RE: Re: RE: Re: RE: answer

Postby mario » Thu Oct 16, 2008 1:24 am

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.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

RE: Re: RE: Re: RE: answer

Postby maschoen » Sat Oct 18, 2008 6:08 am

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.
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm


Return to GUI Programming

Who is online

Users browsing this forum: No registered users and 2 guests