Daniel Hsu | b602aad | 2025-08-14 10:44:38 +0800 | [diff] [blame^] | 1 | #include "cpld/cpld_interface.hpp" |
| 2 | #include "cpld/lattice/lattice_base_cpld.hpp" |
| 3 | |
| 4 | namespace phosphor::software::cpld |
| 5 | { |
| 6 | |
| 7 | class LatticeCPLDFactory : public CPLDInterface |
| 8 | { |
| 9 | public: |
| 10 | LatticeCPLDFactory(sdbusplus::async::context& ctx, |
| 11 | const std::string& chipName, latticeChip chipEnum, |
| 12 | uint16_t bus, uint8_t address) : |
| 13 | CPLDInterface(ctx, chipName, bus, address), chipEnum(chipEnum) |
| 14 | {} |
| 15 | |
| 16 | sdbusplus::async::task<bool> updateFirmware( |
| 17 | bool force, const uint8_t* image, size_t imageSize, |
| 18 | std::function<bool(int)> progress) final; |
| 19 | |
| 20 | sdbusplus::async::task<bool> getVersion(std::string& version) final; |
| 21 | |
| 22 | private: |
| 23 | std::unique_ptr<LatticeBaseCPLD> getLatticeCPLD(); |
| 24 | latticeChip chipEnum; |
| 25 | }; |
| 26 | |
| 27 | } // namespace phosphor::software::cpld |