On Mon, Mar 17, 2008 at 12:02:12PM +0800, vichy wrote: > I try to modify the content of ehci registers directly by mmap, but I have > some trouble about it. Changing registers from a device managed by a driver is very dangerous. In the best case nothing happens, worst case you may see massive filesystem corruption. > I see the driver use writel to change the whole register rather than byte by > byte. > So I cast the return type of mmap as unsigned long*, but the content will be > got wrong by using this pointer and not even mention to change the value by > it. > > I attach 2 versions of my get-memory, memget and memget_dword, and memget > seems output the right value in ehci registers. > I also attach the printing result for your reference. Google for "devmem2.c", it already does what you want and does it the correct way. > BTW, does there already exist some callback function in usb-driver which can > let me change the register directly or someone knows where I can get such > tool from net? Why would you want to change device registers from userspace in the first place? Could you explain whay you're trying to achieve (i.e.: the ultimate goal, not the step you're trying to take right now), maybe we can help to solve it another way. Erik -- Erik Mouw -- mouw@xxxxxxxxxxxx
Attachment:
signature.asc
Description: Digital signature