mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
pci: use PCI_BASE_ADDRESS_N macro
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
parent
2bdeec249d
commit
6646308d14
1 changed files with 4 additions and 2 deletions
|
@ -21,6 +21,8 @@
|
|||
|
||||
using namespace villas::kernel::pci;
|
||||
|
||||
#define PCI_BASE_ADDRESS_N(n) (PCI_BASE_ADDRESS_0 + sizeof(uint32_t) * (n))
|
||||
|
||||
DeviceList::DeviceList()
|
||||
{
|
||||
struct dirent *e;
|
||||
|
@ -408,7 +410,7 @@ uint32_t Device::readBar(unsigned barNum) const
|
|||
uint32_t addr;
|
||||
auto file = openSysFs("config", std::ios_base::in);
|
||||
|
||||
file.seekg(PCI_BASE_ADDRESS_0 + sizeof(uint32_t) * barNum);
|
||||
file.seekg(PCI_BASE_ADDRESS_N(barNum));
|
||||
file.read(reinterpret_cast<char *>(&addr), sizeof(addr));
|
||||
|
||||
return addr;
|
||||
|
@ -418,7 +420,7 @@ void Device::writeBar(uint32_t addr, unsigned barNum)
|
|||
{
|
||||
auto file = openSysFs("config", std::ios_base::out);
|
||||
|
||||
file.seekp(PCI_BASE_ADDRESS_0 + sizeof(uint32_t) * barNum);
|
||||
file.seekp(PCI_BASE_ADDRESS_N(barNum));
|
||||
file.write(reinterpret_cast<char *>(&addr), sizeof(addr));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue