mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00
ips: fix some formatting issues
This commit is contained in:
parent
dfb2a967d8
commit
49db359851
2 changed files with 27 additions and 21 deletions
|
@ -60,12 +60,12 @@ PCIeCardFactory::make(json_t *json, std::shared_ptr<kernel::pci::DeviceList> pci
|
|||
int polling = 0;
|
||||
|
||||
int ret = json_unpack(json_card, "{ s: o, s?: i, s?: b, s?: s, s?: s, s?: b }",
|
||||
"ips", &json_ips,
|
||||
"affinity", &affinity,
|
||||
"do_reset", &do_reset,
|
||||
"slot", &pci_slot,
|
||||
"id", &pci_id,
|
||||
"polling", &polling);
|
||||
"ips", &json_ips,
|
||||
"affinity", &affinity,
|
||||
"do_reset", &do_reset,
|
||||
"slot", &pci_slot,
|
||||
"id", &pci_id,
|
||||
"polling", &polling);
|
||||
|
||||
if (ret != 0) {
|
||||
logger->warn("Cannot parse JSON config");
|
||||
|
|
|
@ -46,6 +46,11 @@ bool Dma::init()
|
|||
coalesce = 1;
|
||||
delay = 0;
|
||||
|
||||
if (!configSet) {
|
||||
logger->error("DMA configuration not set");
|
||||
throw RuntimeError("DMA configuration not set");
|
||||
}
|
||||
|
||||
// If there is a scatter-gather interface, then this instance has it
|
||||
// hasSG = busMasterInterfaces.count(sgInterface) == 1;
|
||||
if (hasScatterGather())
|
||||
|
@ -599,7 +604,7 @@ DmaFactory::configureJson(Core& ip, json_t* json)
|
|||
|
||||
auto &dma = dynamic_cast<Dma&>(ip);
|
||||
json_t* json_params = json_object_get(json, "parameters");
|
||||
if (!json_is_object(json_params))
|
||||
if (!json_is_object(json_params))
|
||||
return false;
|
||||
|
||||
// Sensible default configuration
|
||||
|
@ -619,25 +624,26 @@ DmaFactory::configureJson(Core& ip, json_t* json)
|
|||
dma.xConfig.AddrWidth = 32;
|
||||
dma.xConfig.SgLengthWidth = 14;
|
||||
|
||||
int ret = json_unpack(json_params,
|
||||
int ret = json_unpack(json_params,
|
||||
"{ s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i }",
|
||||
"c_sg_include_stscntrl_strm", &dma.xConfig.HasStsCntrlStrm,
|
||||
"c_include_mm2s", &dma.xConfig.HasMm2S,
|
||||
"c_include_mm2s_dre", &dma.xConfig.HasMm2SDRE,
|
||||
"c_m_axi_mm2s_data_width", &dma.xConfig.Mm2SDataWidth,
|
||||
"c_include_s2mm", &dma.xConfig.HasS2Mm,
|
||||
"c_include_s2mm_dre", &dma.xConfig.HasS2MmDRE,
|
||||
"c_m_axi_s2mm_data_width", &dma.xConfig.S2MmDataWidth,
|
||||
"c_include_sg", &dma.xConfig.HasSg,
|
||||
"c_num_mm2s_channels", &dma.xConfig.Mm2sNumChannels,
|
||||
"c_num_s2mm_channels", &dma.xConfig.S2MmNumChannels,
|
||||
"c_micro_dma", &dma.xConfig.MicroDmaMode,
|
||||
"c_addr_width", &dma.xConfig.AddrWidth,
|
||||
"c_sg_length_width", &dma.xConfig.SgLengthWidth
|
||||
"c_include_mm2s", &dma.xConfig.HasMm2S,
|
||||
"c_include_mm2s_dre", &dma.xConfig.HasMm2SDRE,
|
||||
"c_m_axi_mm2s_data_width", &dma.xConfig.Mm2SDataWidth,
|
||||
"c_include_s2mm", &dma.xConfig.HasS2Mm,
|
||||
"c_include_s2mm_dre", &dma.xConfig.HasS2MmDRE,
|
||||
"c_m_axi_s2mm_data_width", &dma.xConfig.S2MmDataWidth,
|
||||
"c_include_sg", &dma.xConfig.HasSg,
|
||||
"c_num_mm2s_channels", &dma.xConfig.Mm2sNumChannels,
|
||||
"c_num_s2mm_channels", &dma.xConfig.S2MmNumChannels,
|
||||
"c_micro_dma", &dma.xConfig.MicroDmaMode,
|
||||
"c_addr_width", &dma.xConfig.AddrWidth,
|
||||
"c_sg_length_width", &dma.xConfig.SgLengthWidth
|
||||
);
|
||||
if (ret != 0) {
|
||||
logger->error("Failed to parse DMA configuration");
|
||||
return false;
|
||||
}
|
||||
dma.configSet = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue