read and write in device memory

hi!, everyone

i’m porting device driver for vxwork and linux to QNX

i have the follwing problem:

after map the device memory

in linux use the function:

#define os_read_register_le8(x) (readb((os_uint8*) (x)))
#define os_read_register_le16(x) (readw((os_uint16*) (x)))
#define os_read_register_le32(x) (readl((os_uint32*) (x)))

#define os_write_register_le8(x, y) { writeb(y, x); wmb(); }
#define os_write_register_le16(x, y) { writew(y, x); wmb(); }
#define os_write_register_le32(x, y) { writel(y, x); wmb(); }

for read the mapped memory.

in vxWork make this:

#define os_read_register_le8(x) (os_le8_to_cpu(((volatile os_uint8)x)))
#define os_read_register_le16(x) (os_le16_to_cpu(((volatile os_uint16)x)))
#define os_read_register_le32(x) (os_le32_to_cpu(((volatile os_uint32)x)))

#define os_write_register_le8(x, y) { (((volatile os_uint8)x))=y;EIEIO;}
#define os_write_register_le16(x, y) { ( (volatile os_uint16) x)=os_cpu_to_le16( (os_uint16) y);EIEIO;}
#define os_write_register_le32(x, y) { ( (volatile os_uint32) x)=os_cpu_to_le32( (os_uint32) y);EIEIO; os_dbgprint(1,(“os_write…\n”) ); }

where:
x <— addres.
y <— value.

os_cpu_to_le3(y) <—return swab y
os_le16_to_cpu(x) read in the addr x and swab the value

#ifndef EIEIO
#define EIEIO asm(“eieio”)
#endif

now why in linux use wmb() and vxWork use EIEIO ?
or what is the function equivalent on qnx?

I read and write with this function

//read
static os_uint32 myread(os_uint32 x)
{
uint32_t ret;
ret = UNALIGNED_RET32( (uint32_t *)x );
ret = ENDIAN_RET32(ret );
printf(" os_read_le at %x ret %x \n", x, ret );

return ret;
}

//write
UNALIGNED_PUT32( (uint32_t*)x , ENDIAN_RET32( (uint32_t) y ));

but it does not do that would have to do !!

help me!

not more problems with this!!!