We have written a driver that works with traditional VxWorks tasks (i.e.
kernel-mode apps). Our driver does DMA transfers given a buffer pointer
and a length (in kernel address space).
We also have an API library (currently built as a kernel-mode
downloadable module) which is not much more than a thin layer on top of
the usual open, ioctl, read, write, close etc. calls. This library
exists so that despite differences between how various operating systems
do things, the same API works on all platforms that we support (Linux,
We would now like to make the driver compatible with both traditional
VxWorks tasks and RTPs (realtime processes). We have successfully built
the API library as a shared library for RTPs. So the remaining obstacles
to make the driver compatible with RTPs are are:
1. I don't know how to reliably tell, in the driver's open() handler, if
the caller is (a) a RTP task, or (b) a traditional VxWorks task. I think
the driver will need to know what kind of task has opened it in order to
do the right thing later, especially with regard to address translation.
It seems that taskInfoGet() might do it, but the Wind River docs don't
really mention anything about whether the returned information can be
used for that.
2. I don't know how to do the virtual -> kernel address translation
required for DMA transfers directly to/from an RTP application's
buffers. In every other OS, there's a mechanism for doing this. Is this
possible in VxWorks too?
Maybe we could have the RTP create a public shared memory object, but we
want to avoid this because we would have to introduce a bunch of new API
functions specifically for this purpose.
Also, we want our driver to be general purpose enough that it can DMA
to/from arbitrary buffers, whose allocation and creation may be under
control of some other layer of software in the RTP. So really we just
want to be able to take a (user-mode) pointer and length given to us by
the RTP app and use it for DMA, with the driver doing all the necessary
behind-the-scenes address translation, cache management etc.
There seem to be some virtual->physical address translation functions,
like vmTranslate(), but they take a parameter which is of type
VM_CONTEXT_ID. I don't know how to obtain that VM_CONTEXT_ID, or whether
it can even be obtained for a RTP and used to do what we want.
Any pointers as to how to proceed will be appreciated.