QNX RTOS v4 Knowledge Base
  
QNX RTOS v4 Knowledge Base
  
    
      | 
          
            | Title | Direct Memory Access (DMA) Programming |  
            | Ref. No. | QNX.000009412 |  
            | Category(ies) | Development |  
            | Issue | We are using QNX4 and Watcom 10.6, and we need to access a specific memory location for a video card utility that we are developing.  We have no problems with port access functions using -T1 but the function requires us to write to a memory mapped IO location. 
 Any suggestions?
 
 
 |  
            | Solution | First, you should read through /etc/readme/technotes/shmem.txt. This contains a useful overview and some examples of using the shared memory routines that will be used to map in card memory.
 
 The basic sequence is:
 --
 int fd;
 volatile char *ptr;
 
 fd=shm_open("/dev/shmem/Physical",O_RDWR,0);
 ptr =  mmap(0,size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, linear_address);
 --
 Then, you can just treat ptr like a normal pointer to allocated memory, except that it may be changed asynchronously.
 |  |