当前位置: 技术问答>linux和unix
嵌入式linux下的io内存映射问题
来源: 互联网 发布时间:2016-05-24
本文导语: #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 +...
#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("%dn",test
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("%dn",test