First Port IO driver on neutrino

Hi everyone,

I try to write my first QNX neutrino device driver. I use the free
version of neutrino.

I know the base address of my device is 0xd000. This address is given
to me by the PCI configuration space of the device.

Now I want to write to a register of the device.

#define MCSR_RESET 0x0F000000
main()
{

BaseAddr = 0xd000;
MCSR = 0x3c;
out32((BaseAddr + MCSR), MCSR_RESET);
}

I got a “segmentation fault” on my out32 statement. This is odd
because I
was able to write to this address with Linux and Windows 2000. From
my reading and understanding of the Rob Krten book, the above program
should allow me to write to a physical address. Could soneone guide
me to the right direction? Is there a sample on read/write to IO
address space?

I have one more question.
QNX drivers run as processes in User Space and each process has its
own virtual memory adress. When a process needs to write to a
physical adress, how the Process Manager knows the address that the
process is written to
is a physical adress?

Thanks in advance

“Phong Ho” <peter_ho98@yahoo.com> wrote in message
news:6530a40c.0210131637.49715c30@posting.google.com

Hi everyone,

I try to write my first QNX neutrino device driver. I use the free
version of neutrino.

I know the base address of my device is 0xd000. This address is given
to me by the PCI configuration space of the device.

Now I want to write to a register of the device.

#define MCSR_RESET 0x0F000000
main()
{

BaseAddr = 0xd000;
MCSR = 0x3c;
out32((BaseAddr + MCSR), MCSR_RESET);
}

I got a “segmentation fault” on my out32 statement. This is odd
because I
was able to write to this address with Linux and Windows 2000. From
my reading and understanding of the Rob Krten book, the above program
should allow me to write to a physical address. Could soneone guide
me to the right direction? Is there a sample on read/write to IO
address space?

Read documention on ThreadCtl() and make sure you run as root.


I have one more question.
QNX drivers run as processes in User Space and each process has its
own virtual memory adress. When a process needs to write to a
physical adress, how the Process Manager knows the address that the
process is written to is a physical adress?

To get access to physical address range you need to map the physical memory
into you process space with a call to mmap(). mmap will return a virtual
pointer to physical memory you specified.


Thanks in advance