DMA porting

Hi everybody,
i am new to QNX and i do not know much about many things. so please
forgive me i am asking u trivial questions. my advisor has entrusted me with
the task of porting some software written in QNX4 to QNX Neutrino.
i am porting DmaBuffer class (an utility class to be used in control
applications), which handles DMA services like allocating memory, obtaining
its physical and virtual address etc., from QNX4 to QNX Neutrino. It uses
functions like qnx_segment_*() . The related segment info data structures
are in sys/seginfo.h which is not there in Neutrino. could you please
suggest ways of porting this? also please let me know whether _PMF_DMA_HIGH,
_PMF_DMA_SAFE flags r used in QNX neutrino and if so where r they defined?
Any suggestions regarding how to handle DMA in
the Neutrino architecture will be greatly appreciated.
thanking you.
k.t.

Trayambaka Nath Karra <tkarra@ces.clemson.edu> wrote:

Hi everybody,
i am new to QNX and i do not know much about many things. so please
forgive me i am asking u trivial questions. my advisor has entrusted me with
the task of porting some software written in QNX4 to QNX Neutrino.
i am porting DmaBuffer class (an utility class to be used in control
applications), which handles DMA services like allocating memory, obtaining
its physical and virtual address etc., from QNX4 to QNX Neutrino. It uses
functions like qnx_segment_*() . The related segment info data structures
are in sys/seginfo.h which is not there in Neutrino. could you please
suggest ways of porting this? also please let me know whether _PMF_DMA_HIGH,
_PMF_DMA_SAFE flags r used in QNX neutrino and if so where r they defined?
Any suggestions regarding how to handle DMA in
the Neutrino architecture will be greatly appreciated.
thanking you.
k.t.

Yes there are equivalents – look under mmap() for information.

From the docs for mmap():

/* Allocate a physically contiguous buffer */
addr = mmap( 0,
262144,
PROT_READ|PROT_WRITE|PROT_NOCACHE,
MAP_PHYS|MAP_ANON,
NOFD,
0 );


Under Neutrino, DMA_HIGH is default, there is flag to make it under 16M
range.

Look at mem_offset() to get the physical address.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.