For DMA operation i have created a buffer of 300KB,
virtaddr = mmap(NULL, (300*1024), PROT_READ|PROT_WRITE|PROT_NOCACHE, MAP_PHYS|MAP_ANON,NOFD, 0);
and then converting this virtaddr to phyaddr by
mem_offset(virtAddr, NOFD, 1, phyAddr, 0);
after that to make use of that buffer for application I am converting physical to virtual addr by
virtaddr = mmap(NULL, 1, PROT_READ|PROT_WRITE, MAP_PHYS,NOFD, phyAddr);
Once the buffer allocated the buffer will be keep on filled and used in for DMA as well as application so the conversion operation also happen in loop which will continuously run. This physical to virtual conversion get fail after some 100 MB transfer of data using that buffer.
with perror() , it is showing “no enough memory” and memory fault is happening.
In linux to convert virt to phy addr or phy to virt no need to free the buffer. Is any similar kind of api available in QNX ??
Since the actual buffer will be in use continuously i don’t want to free the buffer. If I free the virt addr after application uses it, then it free the actual buffer memory too?
How to solve this problem??
Any help would be highly appreciated!!