tags:

views:

391

answers:

1

When using VxWorks, we are trying to access a memory mapped I/O device from a Real-Time Process.
Since RTPs have memory protection, how can I access my I/O device from one?

+2  A: 

There are two methods you can use to access your I/O mapped device from an RTP.

I/O Subsystem (preferred)

You essentially create a small device driver. This driver can be integrated into the I/O Subsystem of VxWorks. Once integrated, the driver is available to the RTP by simply using standard I/O operations: open, close, read, write, ioctl.

Note that "creating a device driver" doesn't have to be complicated. It could be as simple as just defining a wrapper for the ioctl function. See ioLib for more details.

Map Memory Directly (not recommended)

You can create a shared memory region via the sdOpen call. When creating the shared memory, you can specify what the physical address should be. Specify the address to be your device's I/O mapped region, and you can access the device directly.

The problem is that a shared memory region is a public object that is available to any space, and poking directly at hardware goes against the philosophy behind RTPs.

Benoit