Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | 0088759 | 2018-12-11 10:57:06 -0800 | [diff] [blame] | 3 | #include "blob_interface.hpp" |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 4 | #include "interface.hpp" |
Patrick Venture | 69a9e19 | 2019-01-17 16:02:33 -0800 | [diff] [blame] | 5 | #include "internal/sys.hpp" |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 6 | |
Patrick Venture | 8e1b233 | 2019-01-17 15:22:45 -0800 | [diff] [blame] | 7 | #include <cstdint> |
| 8 | |
Patrick Venture | 9b534f0 | 2018-12-13 16:10:02 -0800 | [diff] [blame] | 9 | namespace host_tool |
| 10 | { |
| 11 | |
Patrick Venture | 8e1b233 | 2019-01-17 15:22:45 -0800 | [diff] [blame] | 12 | struct LpcRegion |
| 13 | { |
| 14 | /* Host LPC address at which the chunk is to be mapped. */ |
| 15 | std::uint32_t address; |
| 16 | /* Size of the chunk to be mapped. */ |
| 17 | std::uint32_t length; |
Patrick Venture | 578dfc5 | 2019-01-18 09:46:52 -0800 | [diff] [blame] | 18 | } __attribute__((packed)); |
Patrick Venture | 8e1b233 | 2019-01-17 15:22:45 -0800 | [diff] [blame] | 19 | |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 20 | class LpcDataHandler : public DataInterface |
| 21 | { |
| 22 | public: |
Patrick Venture | 69a9e19 | 2019-01-17 16:02:33 -0800 | [diff] [blame] | 23 | LpcDataHandler(BlobInterface* blob, |
| 24 | const internal::Sys* sys = &internal::sys_impl) : |
| 25 | blob(blob), |
| 26 | sys(sys){}; |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 27 | |
| 28 | bool sendContents(const std::string& input, std::uint16_t session) override; |
Patrick Venture | 8a55dcb | 2018-12-12 21:12:58 -0800 | [diff] [blame] | 29 | blobs::FirmwareBlobHandler::UpdateFlags supportedType() const override |
| 30 | { |
Patrick Venture | 55c5374 | 2019-01-17 15:54:09 -0800 | [diff] [blame] | 31 | return blobs::FirmwareBlobHandler::UpdateFlags::lpc; |
Patrick Venture | 8a55dcb | 2018-12-12 21:12:58 -0800 | [diff] [blame] | 32 | } |
Patrick Venture | 0088759 | 2018-12-11 10:57:06 -0800 | [diff] [blame] | 33 | |
| 34 | private: |
| 35 | BlobInterface* blob; |
Patrick Venture | 69a9e19 | 2019-01-17 16:02:33 -0800 | [diff] [blame] | 36 | const internal::Sys* sys; |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 37 | }; |
Patrick Venture | 9b534f0 | 2018-12-13 16:10:02 -0800 | [diff] [blame] | 38 | |
| 39 | } // namespace host_tool |