questoin about change registers by mmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear all:
I try to modify the content of ehci registers directly by mmap, but I have
some trouble about it.
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.

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?

Thanks for your help,
vichy

Attachment: memget.c
Description: Binary data

[root@Linux LinUtil.old]# ./memget_dword ec103000 0 40
Map 0X1000000 bytes at offset 0X0 from "/dev/mem" to 0XB6F5D000
EC103000:00000000 : 01000020
EC103000:00000004 : 00000000
EC103000:00000008 : 00010001
EC103000:0000000C : 00000000
EC103000:00000010 : 00000000
EC103000:00000014 : 00000000
EC103000:00000018 : 00000000
EC103000:0000001C : 00003000
EC103000:00000020 : 00013002
EC103000:00000024 : 00000000
EC103000:00000028 : 00000000
EC103000:0000002C : 00000000
EC103000:00000030 : 00000000
EC103000:00000034 : 00000000
EC103000:00000038 : 00000000
EC103000:0000003C : 00000000
[root@Linux LinUtil.old]# ./memget ec103000 0 40
Map 0X40 bytes at offset 0X00000000 from "/dev/mem" to 0XB6F74000
EC103000:00000000 : 01000020
EC103000:00000004 : 00103308
EC103000:00000008 : 00007070
EC103000:0000000C : 00000000
EC103000:00000010 : 00000000
EC103000:00000014 : 00000000
EC103000:00000018 : 00000000
EC103000:0000001C : 00000000
EC103000:00000020 : 00010001
EC103000:00000024 : 0000000C
EC103000:00000028 : 00000000
EC103000:0000002C : 000028E5
EC103000:00000030 : 00000000
EC103000:00000034 : 1C3A3000
EC103000:00000038 : 111D7000
EC103000:0000003C : 00000000
[root@Linux LinUtil.old]#

Attachment: memget_dword.c
Description: Binary data


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux