Skip to content

Commit e3c2812

Browse files
committed
Publish register_modify python interface
1 parent 140794c commit e3c2812

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/PythonInterface.cxx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ R"(Write a 32-bit value at given 32-bit aligned address
4040
index: 32-bit aligned address of the register
4141
value: 32-bit value to write to the register)";
4242

43+
/// Documentation for the register modify function
44+
auto sRegisterModifyDocString =
45+
R"(Modify the width# of bits value at given position of the 32-bit aligned address
46+
47+
Args:
48+
index: 32-bit aligned address of the register
49+
position: position to modify (0-31)
50+
width: number of bits to modify
51+
value: width bits value to write at position (masked to width if more))";
4352

4453
class BarChannel
4554
{
@@ -60,6 +69,11 @@ class BarChannel
6069
return mBarChannel->writeRegister(address / 4, value);
6170
}
6271

72+
void modify(uint32_t address, int position, int width, uint32_t value)
73+
{
74+
return mBarChannel->modifyRegister(address / 4, position, width, value);
75+
}
76+
6377
private:
6478
std::shared_ptr<AliceO2::roc::BarInterface> mBarChannel;
6579
};
@@ -73,6 +87,7 @@ BOOST_PYTHON_MODULE(libReadoutCard)
7387

7488
class_<BarChannel>("BarChannel", init<std::string, int>(sInitDocString))
7589
.def("register_read", &BarChannel::read, sRegisterReadDocString)
76-
.def("register_write", &BarChannel::write, sRegisterWriteDocString);
90+
.def("register_write", &BarChannel::write, sRegisterWriteDocString)
91+
.def("register_modify", &BarChannel::modify, sRegisterModifyDocString);
7792
}
7893

0 commit comments

Comments
 (0)