New submission from Kevin Smith:
I am using the mmap module on Linux with python 2.7.6 to access memory-mapped
IO. The device that I am accessing implements a hardware FIFO that holds
16-bit values and pops an entry when the MSB of the entry is read. I am trying
to use the mmap module to do an 8-bit read of the LSB then an 8-bit read of the
MSB, which should pop the value. However, I am finding that the LSB read is
sometimes popping the value before I read the MSB.
I am mapping the memory like this:
self.fd = os.open ("/dev/mem", os.O_RDWR | os.O_SYNC)
self.mempage = mmap.mmap (self.fd, mmap_size, mmap.MAP_SHARED,
mmap.PROT_READ | mmap.PROT_WRITE, offset = pc104_base)
Then trying to read a value like this:
val = self.mempage[pos]
The LSB of the hardware device is a lower address than the MSB. The read of
the LSB seems to sometimes overlap into a read of the MSB, which causes the
following read of the MSB to be incorrect, as the value has already been
popped. Sometimes the reads of the MSB are correct; I am not sure why this
behavior is not consistent across all reads.
The reads for this device need to be 8-bit, as the bus the device is connected
to only supports 8-bit reads.
I think that a single-byte access of the memory mapping should only access a
single byte in the underlying memory region.
----------
components: Extension Modules
messages: 220877
nosy: FazJaxton
priority: normal
severity: normal
status: open
title: mmap read of single byte accesses more that just that byte
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue21797>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com