blob: bec61d837fb9f9b7e9117f921dc09137136d624c [file] [log] [blame]
Daniel Hsub602aad2025-08-14 10:44:38 +08001#include "cpld/cpld_interface.hpp"
2#include "cpld/lattice/lattice_base_cpld.hpp"
3
4namespace phosphor::software::cpld
5{
6
7class 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