|
1 | 1 | /* FPGA IP component. |
2 | 2 | * |
3 | 3 | * Author: Steffen Vogel <post@steffenvogel.de> |
4 | | - * SPDX-FileCopyrightText: 2017 Institute for Automation of Complex Power Systems, RWTH Aachen University |
5 | | - * SPDX-License-Identifier: Apache-2.0 |
| 4 | + * SPDX-FileCopyrightText: 2017 Institute for Automation of Complex Power |
| 5 | + * Systems, RWTH Aachen University SPDX-License-Identifier: Apache-2.0 |
6 | 6 | */ |
7 | 7 |
|
8 | 8 | #include <memory> |
9 | 9 | #include <string> |
10 | 10 | #include <utility> |
11 | 11 |
|
| 12 | +#include <vector> |
12 | 13 | #include <villas/exceptions.hpp> |
13 | 14 | #include <villas/log.hpp> |
14 | 15 | #include <villas/memory.hpp> |
15 | 16 | #include <villas/utils.hpp> |
16 | 17 |
|
17 | 18 | #include <villas/fpga/card.hpp> |
| 19 | +#include <villas/fpga/platform_card.hpp> |
18 | 20 | #include <villas/fpga/utils.hpp> |
19 | 21 | #include <villas/fpga/vlnv.hpp> |
20 | 22 |
|
21 | 23 | #include <villas/fpga/core.hpp> |
22 | 24 | #include <villas/fpga/ips/intc.hpp> |
23 | 25 | #include <villas/fpga/ips/pcie.hpp> |
| 26 | +#include <villas/fpga/ips/platform_intc.hpp> |
24 | 27 | #include <villas/fpga/ips/switch.hpp> |
25 | 28 |
|
26 | 29 | using namespace villas::fpga; |
@@ -169,6 +172,35 @@ std::list<std::shared_ptr<Core>> CoreFactory::make(Card *card, |
169 | 172 | logger->debug("IRQ: {} -> {}:{}", irqName, irqControllerName, num); |
170 | 173 | ip->irqs[irqName] = {num, intc, ""}; |
171 | 174 | } |
| 175 | + } else if (!json_is_object(json_irqs) && |
| 176 | + ip->getInstanceName().find("axi_dma_") != std::string::npos) { |
| 177 | + logger->warn("Dma json does not contain an interrupt Controller. A " |
| 178 | + "Platform Interrupt controller will be added"); |
| 179 | + |
| 180 | + // auto devices = dynamic_cast<PlatformCard*>(ip->card)->devices; |
| 181 | + // std::string nameToFind = "dma"; |
| 182 | + // auto it = std::find_if(devices.begin(), devices.end(), [&](const |
| 183 | + // villas::kernel::vfio::Device& device) { |
| 184 | + // return device.get_name() == nameToFind; |
| 185 | + // }); |
| 186 | + |
| 187 | + std::vector<const char *> intc_names = {"mm2s_introut", "s2mm_introut"}; |
| 188 | + |
| 189 | + int num = 0; |
| 190 | + for (auto name : intc_names) |
| 191 | + { |
| 192 | + auto intc = new PlatformInterruptController(); |
| 193 | + intc->id = id; |
| 194 | + intc->logger = villas::logging.get(id.getName()); |
| 195 | + |
| 196 | + const char *irqName = name; |
| 197 | + std::string irqControllerName = "PlatformInterruptController"; |
| 198 | + |
| 199 | + logger->debug("IRQ: {} -> {}:{}", irqName, irqControllerName, num); |
| 200 | + ip->irqs[irqName] = {num, intc, ""}; |
| 201 | + |
| 202 | + num++; |
| 203 | + } |
172 | 204 | } |
173 | 205 |
|
174 | 206 | json_t *json_memory_view = json_object_get(json_ip, "memory-view"); |
|
0 commit comments