如何在Linux内核驱动程序中读取64位寄存器
我想在Linux内核驱动程序中阅读64位寄存器的值 我尝试了以下代码,但我总是得到0。
reg_addr = ioremap(0xffe602000, 0x20000);
if (!reg_addr) {
printk(KERN_ALERT " ioremap failed \n");
}else{
printk(KERN_ALERT " ioremap success reg_addr[0x%X]\n", reg_addr);
}
IOREMAP在上述代码中取得了成功。
在IOREMAP之后,我呼叫如下:
unsigned long long val;
val = ioread64(reg_addr+0x300);
printk(KERN_ALERT " ### REG READ returning [%lx] ###\n",val);
上面使用Trace32检查的上述代码打印
### REG READ returning [0] ###
,寄存器的值不是0,寄存器的实际值为0x00000000E506A904
。
我想念什么吗?
内核版本:
4.19.33 #12 SMP ppc64 GNU/Linux
I want to read the value of a 64bit register in the Linux Kernel driver
I tried the below code, but I get 0 always.
reg_addr = ioremap(0xffe602000, 0x20000);
if (!reg_addr) {
printk(KERN_ALERT " ioremap failed \n");
}else{
printk(KERN_ALERT " ioremap success reg_addr[0x%X]\n", reg_addr);
}
the ioremap was successful in the above code.
after the ioremap, I call read as below:
unsigned long long val;
val = ioread64(reg_addr+0x300);
printk(KERN_ALERT " ### REG READ returning [%lx] ###\n",val);
the above code prints
### REG READ returning [0] ###
I checked using Trace32, the value of register is not 0, the real value of the register is 0x00000000e506a904
.
did I miss something?
kernel version:
4.19.33 #12 SMP ppc64 GNU/Linux
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论