Alexander Hansen | 1ba6e1c | 2024-11-26 11:16:44 +0100 | [diff] [blame^] | 1 | #include "bios-spi/spi_device.hpp" |
| 2 | #include "spi_device_code_updater.hpp" |
| 3 | |
| 4 | #include <phosphor-logging/lg2.hpp> |
| 5 | #include <sdbusplus/asio/connection.hpp> |
| 6 | #include <sdbusplus/asio/object_server.hpp> |
| 7 | #include <sdbusplus/async.hpp> |
| 8 | #include <sdbusplus/server.hpp> |
| 9 | #include <xyz/openbmc_project/Association/Definitions/server.hpp> |
| 10 | #include <xyz/openbmc_project/Software/Update/server.hpp> |
| 11 | |
| 12 | #include <iostream> |
| 13 | #include <memory> |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | sdbusplus::async::context ctx; |
| 18 | |
| 19 | try |
| 20 | { |
| 21 | SPIDeviceCodeUpdater spidcu(ctx, true, false); |
| 22 | uint32_t vendorIANA = 0x0000a015; |
| 23 | std::string compatible = "com.testvendor.testcomponent"; |
| 24 | SPIDeviceCodeUpdater* cu = &spidcu; |
| 25 | std::vector<std::string> gpioNames; |
| 26 | std::vector<uint8_t> gpioValues; |
| 27 | |
| 28 | DeviceConfig config(vendorIANA, compatible, "SPIFlash", "HostSPI"); |
| 29 | |
| 30 | auto sd = std::make_unique<SPIDevice>( |
| 31 | ctx, "1e630000.spi", true, true, gpioNames, gpioValues, config, cu, |
| 32 | true, true, false); |
| 33 | |
| 34 | spidcu.devices.insert(std::move(sd)); |
| 35 | } |
| 36 | catch (std::exception& e) |
| 37 | { |
| 38 | std::cerr << e.what() << std::endl; |
| 39 | return 1; |
| 40 | } |
| 41 | |
| 42 | return 0; |
| 43 | } |