Patrick Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "data_handler.hpp" |
| 4 | |
| 5 | #include <cstdint> |
| 6 | #include <vector> |
| 7 | |
| 8 | namespace blobs |
| 9 | { |
| 10 | |
Patrick Venture | 8c53533 | 2018-11-08 15:58:00 -0800 | [diff] [blame] | 11 | /** P2A configuration response. */ |
| 12 | struct 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 Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 20 | class PciDataHandler : public DataInterface |
| 21 | { |
Patrick Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 22 | public: |
Patrick Venture | b0c84d0 | 2018-11-09 12:00:31 -0800 | [diff] [blame^] | 23 | explicit PciDataHandler(std::uint32_t regionAddress) : |
| 24 | regionAddress(regionAddress){}; |
Patrick Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 25 | |
Patrick Venture | 0d2a813 | 2018-11-09 11:34:21 -0800 | [diff] [blame] | 26 | bool open() override; |
Patrick Venture | 0fbabf2 | 2018-11-09 11:54:12 -0800 | [diff] [blame] | 27 | bool close() override; |
Patrick Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 28 | std::vector<std::uint8_t> copyFrom(std::uint32_t length) override; |
Patrick Venture | 8c53533 | 2018-11-08 15:58:00 -0800 | [diff] [blame] | 29 | bool write(const std::vector<std::uint8_t>& configuration) override; |
| 30 | std::vector<std::uint8_t> read() override; |
Patrick Venture | b0c84d0 | 2018-11-09 12:00:31 -0800 | [diff] [blame^] | 31 | |
| 32 | private: |
| 33 | std::uint32_t regionAddress; |
Patrick Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | } // namespace blobs |