嵌入式linux下的io内存映射问题
#define HPI_PHYSICAL_BASEADDR 0x30000000
hpi_vbase = (int *) ioremap_nocache (HPI_PHYSICAL_BASEADDR, 0x1e);
u32 w,test;
u16 t1, t2;
t1 = (0xffff & (w >> 16));
t2 = (0xffff & w);
writew (t1, hpi_vbase + 0x04);
writew (t2, hpi_vbase + 0x06);
test=*(hpi_vbase + 0x04)
我在程序里写了上面的代码,向hpi_vbase + 0x04(高半字地址)和hpi_vbase + 0x06(低半字地址)写入w,
然后又在后面跟了个printk语句打印
printk("%d\n",test<<16|*(hpi_vbase + 0x06));
结果输出的值不是我想要写入的w,有大为大侠知道我的问题处在哪么?