sangee...@gmail.com wrote:
>
>Please could you suggest a way to read and write into memory location with
>offset say 0x04 from BAR 0 base location. I used ioremap and wrote into
>gBaseVirt (virtual address) using memcpy (to write into bar0 base
>address). My read and write functions in driver part are as follows:
Once you have a mapped address, it's just a pointer, like any other C
pointer. You treat it like memory. For example, to write a 32-bit value
to BAR 0 + 4, you could do:
unsigned long * ptr = (unsigned long *)gBaseVirt;
gBaseVirt[1] = 0x12345678;
"memcpy" also works. It seems a bit wasteful for writing 4 bytes at a
time, but it certainly works.
--
Tim Roberts,
ti...@probo.com
Providenza & Boekelheide, Inc.