1.1 --- a/pkg/devices/lib/cpm/include/cpm-common.h Tue Oct 24 17:15:40 2023 +0200
1.2 +++ b/pkg/devices/lib/cpm/include/cpm-common.h Tue Oct 24 17:18:36 2023 +0200
1.3 @@ -67,6 +67,7 @@
1.4 uint32_t mask;
1.5 uint8_t bit;
1.6 bool defined;
1.7 + uint32_t _asserted = 0, _deasserted = 0;
1.8
1.9 public:
1.10 explicit Field()
1.11 @@ -74,14 +75,22 @@
1.12 {
1.13 }
1.14
1.15 - explicit Field(uint32_t reg, uint32_t mask, uint32_t bit)
1.16 + explicit Field(uint32_t reg, uint32_t mask, uint32_t bit,
1.17 + bool inverted = false)
1.18 : reg(reg), mask(mask), bit(bit), defined(true)
1.19 {
1.20 + if (inverted)
1.21 + _deasserted = mask;
1.22 + else
1.23 + _asserted = mask;
1.24 }
1.25
1.26 uint32_t get_field(Cpm_regs ®s);
1.27 void set_field(Cpm_regs ®s, uint32_t value);
1.28
1.29 + uint32_t get_asserted() { return _asserted; }
1.30 + uint32_t get_deasserted() { return _deasserted; }
1.31 +
1.32 bool is_defined() { return defined; }
1.33 uint32_t get_limit() { return mask; }
1.34