Skip to content

Commit

Permalink
fix: python binding for new API
Browse files Browse the repository at this point in the history
  • Loading branch information
patrislav1 committed May 29, 2024
1 parent 025cfae commit ae38935
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pyudmaio/src/DataHandlerPython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ DataHandlerPython::DataHandlerPython(std::shared_ptr<UioAxiDmaIf> dma_ptr,
, _mem_ptr(mem_ptr) {}

void DataHandlerPython::start(int nr_pkts, size_t pkt_size, bool init_only) {
_desc_ptr->init_buffers(*_mem_ptr, nr_pkts, pkt_size);
_desc_ptr->init_buffers(_mem_ptr, nr_pkts, pkt_size);

uintptr_t first_desc = _desc_ptr->get_first_desc_addr();
_dma_ptr->start(first_desc);
Expand Down Expand Up @@ -56,12 +56,9 @@ py::array_t<uint8_t> DataHandlerPython::numpy_read_nb() {
throw std::runtime_error("DMA has experienced an error");
}

std::vector<UioRegion> full_bufs = _desc_ptr->get_full_buffers();
auto vec = new std::vector<uint8_t>();
auto full_bufs = _desc_ptr->get_full_buffers();
auto vec = new std::vector<uint8_t>(_desc_ptr->read_buffers(full_bufs));

for (auto& buf : full_bufs) {
_mem_ptr->append_from_buf(buf, *vec);
}
// Callback for Python garbage collector
py::capsule gc_callback(vec, [](void* f) {
auto ptr = reinterpret_cast<std::vector<uint8_t>*>(f);
Expand Down

0 comments on commit ae38935

Please sign in to comment.