Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnoreWarnings committed Jun 4, 2024
1 parent c829ad1 commit 5b5091e
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions fpga/src/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,36 @@
int main() {
logging.setLevel(spdlog::level::trace);

const std::string config = "/home/root/codebase/node/etc/examples/nodes/miob.conf";
const std::string name = "zcu106";
auto card = fpga::setupFpgaCard(config, name);
std::string configFilePath = "/home/root/codebase/node/etc/fpga/miob/fpgas.json";
auto configDir = std::filesystem::path(configFilePath).parent_path();
std::vector<std::string> modules {"vfio"};
auto vfioContainer = std::make_shared<kernel::vfio::Container>(modules);

// Parse FPGA configuration
FILE* f = fopen(configFilePath.c_str(), "r");
if (!f)
throw RuntimeError("Cannot open config file: {}", configFilePath);

json_t* json = json_loadf(f, 0, nullptr);
if (!json) {
fclose(f);
throw RuntimeError("Cannot parse JSON config");
}

fclose(f);

json_t* fpgas = json_object_get(json, "fpgas");
if (fpgas == nullptr) {
exit(1);
}

json_t* fpga = json_object_get(fpgas, "zcu106");
if (fpga == nullptr) {
exit(1);
}

// Create all FPGA card instances using the corresponding plugin
auto card = PlatformCardFactory::make(fpga, "zcu106", vfioContainer, configDir);

auto axi_switch = std::dynamic_pointer_cast<fpga::ip::AxiStreamSwitch>(
card->lookupIp(fpga::Vlnv("xilinx.com:ip:axis_switch:")));
Expand Down

0 comments on commit 5b5091e

Please sign in to comment.