mmap_device_memory... I have a problem

Hello,

I have a 6032E series PCI card from national instrument.

I would like to interface it on QNX but I can’t do it.

When I use the command “pci –v” i have :

Class          = Unknown (Unknown)
Vendor ID      = 1093h, National Instruments 
Device ID      = 2a60h, PCI-6023E 
PCI index      = 0h
Class Codes    = ff0000h
Revision ID    = 0h
Bus number     = 0
Device number  = 11
Function num   = 0
Status Reg     = 280h
Command Reg    = 117h
Header type    = 0h Single-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 20h
Cache Line Size= 8h un-cacheable
PCI Mem Address = ffbee000h 32bit length 4096 enabled
PCI Mem Address = ffbed000h 32bit length 4096 enabled
Max Lat        = 0ns
Min Gnt        = 0ns
PCI Int Pin    = INT A
Interrupt line = 5

Then I can see we have 2 memory addresses (ffbee000h et ffbed000h).

I have seen in the help menu of QNX. There is the command mmap_device_memory.

I mapped my card like that :

I attach the card with the command pci_device_attach (here, there are no problem)

mem0=malloc(info.BaseAddressSize[0]);

mem0=(unsigned char *)mmap_device_memory((caddr_t)mem0,info.BaseAddressSize[0],PROT_READ|PROT_WRITE|PROT_NOCACHE, 0,info.CpuBaseAddress[0]);

Then I use "mem0" to access my register (this should be correct because it's the code of the constructor)

according to me i can’t access my register card because the mapping doesn’t work.

Can you help me ?

thanks

There is no need to call malloc() here because you are trying to access physical memory on the card (malloc will give you memory from the heap).

If you still can’t access the card, try using BaseAddressSize[1]