Patrick Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 1 | #include "pci_handler.hpp" |
| 2 | |
| 3 | #include <cstdint> |
Patrick Venture | a8a99ae | 2018-11-09 11:14:58 -0800 | [diff] [blame^] | 4 | #include <cstring> |
Patrick Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 5 | #include <vector> |
| 6 | |
| 7 | namespace blobs |
| 8 | { |
| 9 | |
| 10 | std::vector<std::uint8_t> PciDataHandler::copyFrom(std::uint32_t length) |
| 11 | { |
| 12 | /* TODO: implement this. */ |
| 13 | return {}; |
| 14 | } |
| 15 | |
Patrick Venture | 8c53533 | 2018-11-08 15:58:00 -0800 | [diff] [blame] | 16 | bool PciDataHandler::write(const std::vector<std::uint8_t>& configuration) |
| 17 | { |
| 18 | /* PCI handler doesn't require configuration write, only read. */ |
| 19 | return false; |
| 20 | } |
| 21 | |
| 22 | std::vector<std::uint8_t> PciDataHandler::read() |
| 23 | { |
| 24 | /* PCI handler does require returning a configuration from read. */ |
| 25 | struct PciConfigResponse reply; |
| 26 | reply.address = 0; |
| 27 | |
| 28 | std::vector<std::uint8_t> bytes; |
| 29 | bytes.resize(sizeof(reply)); |
Patrick Venture | a8a99ae | 2018-11-09 11:14:58 -0800 | [diff] [blame^] | 30 | std::memcpy(bytes.data(), &reply, sizeof(reply)); |
Patrick Venture | 8c53533 | 2018-11-08 15:58:00 -0800 | [diff] [blame] | 31 | |
| 32 | return bytes; |
| 33 | } |
| 34 | |
Patrick Venture | 1cde5f9 | 2018-11-07 08:26:47 -0800 | [diff] [blame] | 35 | } // namespace blobs |