7 #include <boost/function.hpp>
20 uint64_t _ioctlPhysicalSlot;
21 uint64_t _ioctlDriverVersion;
23 std::string _deviceNodeName;
27 boost::function<void(uint8_t bar, uint32_t address, int32_t* data,
size_t size)> _readDMAFunction;
35 boost::function<void(uint8_t bar, uint32_t address, int32_t
const* data,
size_t sizeInBytes)> _writeFunction;
37 boost::function<void(uint8_t bar, uint32_t address, int32_t* data,
size_t sizeInBytes)> _readFunction;
39 void readDMAViaIoctl(uint8_t bar, uint32_t address, int32_t* data,
size_t sizeInBytes);
40 void readDMAViaStruct(uint8_t bar, uint32_t address, int32_t* data,
size_t sizeInBytes);
42 std::string createErrorStringWithErrnoText(std::string
const& startText);
43 void determineDriverAndConfigureIoctl();
44 void writeInternal(uint8_t bar, uint32_t address, int32_t
const* data);
45 void writeWithStruct(uint8_t bar, uint32_t address, int32_t
const* data,
size_t sizeInBytes);
47 void directWrite(uint8_t bar, uint32_t address, int32_t
const* data,
size_t sizeInBytes);
49 void readInternal(uint8_t bar, uint32_t address, int32_t* data);
50 void readWithStruct(uint8_t bar, uint32_t address, int32_t* data,
size_t sizeInBytes);
52 void directRead(uint8_t bar, uint32_t address, int32_t* data,
size_t sizeInBytes);
54 size_t minimumTransferAlignment([[maybe_unused]] uint64_t bar)
const override {
return 4; }
56 bool checkConnection()
const;
61 explicit PcieBackend(std::string deviceNodeName,
const std::string& mapFileName =
"");
67 void read(uint8_t bar, uint32_t address, int32_t* data,
size_t sizeInBytes)
override;
68 void write(uint8_t bar, uint32_t address, int32_t
const* data,
size_t sizeInBytes)
override;
75 std::string address, std::map<std::string, std::string> parameters);