Re: Fwd: mmap /dev/mem in python

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

 



On Tue, 20 Oct 2009, Brett Graham wrote:

> --minimal python example--
> open("/dev/mem", O_RDWR|O_SYNC|O_LARGEFILE) = 3
> fstat64(3, {st_mode=S_IFCHR|0640, st_rdev=makedev(1, 1), ...}) = 0
> dup(3)                                  = 4
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0x48088) = 0x40020000
> --- SIGBUS (Bus error) @ 0 (0) ---
> +++ killed by SIGBUS +++
> Process 1633 detached

Your script:

>> m = mmap.mmap(f, mmap.PAGESIZE, mmap.MAP_SHARED, mmap.PROT_WRITE |
>> mmap.PROT_READ, offset=addr & ~MAP_MASK)
>> m.seek(addr & MAP_MASK)

So the mmap() is working fine, based on the output above...

>> c = m.read_byte()

... but the above line is going to fail.  GPTIMER registers need 16- 
or 32-bit accesses[1].


- Paul

1. OMAP34xx TRM 16.3.2:

"CAUTION 
The GP timer registers are limited to 32-bit and 16-bit data accesses; 
8-bit access is not allowed and can corrupt the register content."


--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux