Skip to content

Commit d177a81

Browse files
committed
feat: add write_bulk() API
1 parent 2928fc3 commit d177a81

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

inc/udmaio/HwAccessor.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ class HwAccessor : public Logger, private boost::noncopyable {
6969
return {};
7070
}
7171

72+
virtual void write_bulk(uint32_t offs, std::vector<uint8_t> data) {}
73+
7274
/**
7375
* @brief Read register from UIO interface
7476
*
@@ -237,6 +239,11 @@ class HwAccessorMmap : public HwAccessor {
237239
return result;
238240
}
239241

242+
virtual void write_bulk(uint32_t offs, std::vector<uint8_t> data) final override {
243+
auto dst = _mem_ptr<uint8_t>(offs);
244+
memcpy(const_cast<uint8_t*>(dst), &data[0], std::size(data));
245+
}
246+
240247
public:
241248
UioRegion get_phys_region() const final override {
242249
const size_t access_offs =

inc/udmaio/UioIf.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ class UioIf : private boost::noncopyable {
7979
return _hw->read_bulk(offs, size);
8080
}
8181

82+
void write_bulk(uint32_t offs, std::vector<uint8_t> data) {
83+
return _hw->write_bulk(offs, data);
84+
}
85+
8286
template <typename C>
8387
C _rd_reg(uint32_t offs) const {
8488
return _hw->template _rd_reg<C>(offs);

0 commit comments

Comments
 (0)