mmap_device_memory problem

I found the code:

volatile uint32_t *regbase;
regbase = mmap_device_memory(NULL, info.BaseAddressSize[0],
PROT_READ|PROT_WRITE|PROT_NOCACHE, 0, info.CpuBaseAddress[0]);
regbase[1] = 0x00000000;

in “Talking to hardware under QNX Neutrino” developer article series.

This gives the compilation error:

ANSI c++ forbids implicit conversion from ‘void*’ in assignment


Changing regbase to be:

void * regbase;

removes this error but now I get:

ANSI c++ forbids using pointer of type ‘void*’ in arithmetic

The PCI card I am communicating with definately allows memory mapping
and regbase != MAP_FAILED. Any help would be appreciated.

\

Paul.

“Paul Jones” <paul.jones@bnc.ox.ac.uk> wrote in message
news:9f8er5$d1v$1@inn.qnx.com

I found the code:

volatile uint32_t *regbase;
regbase = mmap_device_memory(NULL, info.BaseAddressSize[0],
PROT_READ|PROT_WRITE|PROT_NOCACHE, 0, info.CpuBaseAddress[0]);
regbase[1] = 0x00000000;

in “Talking to hardware under QNX Neutrino” developer article series.

This gives the compilation error:

ANSI c++ forbids implicit conversion from ‘void*’ in assignment

Try regbase = (uint32_t *) mmap_devic…

Changing regbase to be:

void * regbase;

removes this error but now I get:

ANSI c++ forbids using pointer of type ‘void*’ in arithmetic

That probably comes from the regbase[1] = 0x0000…

Since it’s a void pointer regbase[1] doesn’t make sense.

The PCI card I am communicating with definately allows memory mapping
and regbase != MAP_FAILED.

That’s only C++ syntac error you’re having, nothing to do with memory
mapping capability.

Any help would be appreciated.

\

Paul.
\

Thanks Mario that’s fixed it.

Paul.