Daniel Hsu | a3902c8 | 2025-08-14 11:15:17 +0800 | [diff] [blame^] | 1 | #include "lattice_base_cpld.hpp" |
| 2 | |
| 3 | namespace phosphor::software::cpld |
| 4 | { |
| 5 | |
| 6 | class LatticeXO5CPLD : public LatticeBaseCPLD |
| 7 | { |
| 8 | public: |
| 9 | LatticeXO5CPLD(sdbusplus::async::context& ctx, const uint16_t bus, |
| 10 | const uint8_t address, const std::string& chip, |
| 11 | const std::string& target, const bool debugMode) : |
| 12 | LatticeBaseCPLD(ctx, bus, address, chip, target, debugMode) |
| 13 | {} |
| 14 | ~LatticeXO5CPLD() override = default; |
| 15 | LatticeXO5CPLD(const LatticeXO5CPLD&) = delete; |
| 16 | LatticeXO5CPLD& operator=(const LatticeXO5CPLD&) = delete; |
| 17 | LatticeXO5CPLD(LatticeXO5CPLD&&) noexcept = delete; |
| 18 | LatticeXO5CPLD& operator=(LatticeXO5CPLD&&) noexcept = delete; |
| 19 | |
| 20 | protected: |
| 21 | sdbusplus::async::task<bool> prepareUpdate(const uint8_t* image, |
| 22 | size_t imageSize) override; |
| 23 | sdbusplus::async::task<bool> doUpdate() override; |
| 24 | sdbusplus::async::task<bool> finishUpdate() override; |
| 25 | sdbusplus::async::task<bool> readUserCode(uint32_t& userCode) override; |
| 26 | |
| 27 | private: |
| 28 | sdbusplus::async::task<bool> waitUntilReady( |
| 29 | std::chrono::milliseconds timeout); |
| 30 | sdbusplus::async::task<bool> eraseCfg(); |
| 31 | sdbusplus::async::task<bool> programCfg(); |
| 32 | sdbusplus::async::task<bool> programPage(uint8_t block, uint8_t page, |
| 33 | const std::vector<uint8_t>& data); |
| 34 | sdbusplus::async::task<bool> verifyCfg(); |
| 35 | sdbusplus::async::task<bool> readPage(uint8_t block, uint8_t page, |
| 36 | std::vector<uint8_t>& data); |
| 37 | }; |
| 38 | |
| 39 | } // namespace phosphor::software::cpld |