blob: 4df7bb736baaa6bd5932a14688f78e1472956975 [file] [log] [blame]
Patrick Venture1cde5f92018-11-07 08:26:47 -08001#pragma once
2
3#include "data_handler.hpp"
4
5#include <cstdint>
6#include <vector>
7
8namespace blobs
9{
10
Patrick Venture8c535332018-11-08 15:58:00 -080011/** P2A configuration response. */
12struct PciConfigResponse
13{
14 std::uint32_t address;
15} __attribute__((packed));
16
17/**
18 * Data handler for reading and writing data via the P2A bridge.
19 */
Patrick Venture1cde5f92018-11-07 08:26:47 -080020class PciDataHandler : public DataInterface
21{
Patrick Venture1cde5f92018-11-07 08:26:47 -080022 public:
Patrick Ventureb0c84d02018-11-09 12:00:31 -080023 explicit PciDataHandler(std::uint32_t regionAddress) :
24 regionAddress(regionAddress){};
Patrick Venture1cde5f92018-11-07 08:26:47 -080025
Patrick Venture0d2a8132018-11-09 11:34:21 -080026 bool open() override;
Patrick Venture0fbabf22018-11-09 11:54:12 -080027 bool close() override;
Patrick Venture1cde5f92018-11-07 08:26:47 -080028 std::vector<std::uint8_t> copyFrom(std::uint32_t length) override;
Patrick Venture74304642019-01-17 09:31:04 -080029 bool writeMeta(const std::vector<std::uint8_t>& configuration) override;
30 std::vector<std::uint8_t> readMeta() override;
Patrick Ventureb0c84d02018-11-09 12:00:31 -080031
32 private:
33 std::uint32_t regionAddress;
Patrick Venture1cde5f92018-11-07 08:26:47 -080034};
35
36} // namespace blobs