LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   regarding ioremap() for accessing hardware (https://www.linuxquestions.org/questions/debian-26/regarding-ioremap-for-accessing-hardware-541792/)

ksrinivas 03-29-2007 10:42 PM

regarding ioremap() for accessing hardware
 
Hello Everybody,

I have one query regarding ioremap(). Once we do ioremap() to specific hardware base address, it will return a virtual address which is mapped to hardware address.

I am trying to write a small char device driver where it will do read/write/ioctl on a small hardware device.

I have written hardware register structure and then mapped the same using the ioremap()
ptr = ioremap(HW_ADDR, sizeof(RegisterStructure),Chardriver_name);

The funny thing happening is i can do a read and write using only the pointer (returned by ioremap()).


But when i am trying to write to registers using the structure which i have defined, it is not writing the same. i.e, ptr->RegStructure.Reg1

Does anybody know where the things are going wrong. Is there any other way to access hardware or anything missing after/before doing ioremap(). Please help me out.

Thanks & Regards
Srinivas


All times are GMT -5. The time now is 08:19 PM.