-
Notifications
You must be signed in to change notification settings - Fork 0
PY_DOCUM
Pavel A edited this page Nov 21, 2016
·
3 revisions
This is a pure Python implementation of accessing physical memory of a device thru /sys/bus/pci. It does not call libdevmem (the C library) - but uses standard Python library modules: mmap, ctypes and others.
The memory can be accessed by 32-bit, 16-bit and 8-bit units.
The device is located by PCI vendor and device ID.
Root access is required.
There are two Python modules: one deals with finding a PCI device and its BARS, the other module maps selected BAR (or config. space) and provides memory access functions.
Instead of finding the device by PCI ID and mapping the BARs, you can make a variant of the first module, that uses a fixed physical address and maps part of the /dev/mem file.