Use write and read for BitRangeValues

This commit is contained in:
Jaby 2023-01-15 20:21:48 +01:00
parent 09328f8347
commit bde5656f38
6 changed files with 11 additions and 7 deletions

View File

@ -33,6 +33,10 @@ namespace JabyEngine {
T value;
size_t begin;
size_t length;
constexpr BitRangeValue() = default;
constexpr BitRangeValue(T value, size_t begin, size_t length) : value(value), begin(begin), length(length) {
}
};
template<typename T>
@ -47,7 +51,7 @@ namespace JabyEngine {
}
constexpr BitRangeValue<T> with(T value) const {
return {value, this->begin, this->length};
return BitRangeValue(value, this->begin, this->length);
}
constexpr BitRangeValue<T> max() const {

View File

@ -43,7 +43,7 @@ namespace JabyEngine {
}
static void ack(VolatileBitMapPOD<InterruptFlag>& port) {
port.write_range_value(InterruptFlag::InterruptTypValue.max());
port.write(InterruptFlag::InterruptTypValue.max());
}
};

View File

@ -31,7 +31,7 @@ namespace JabyEngine {
return T{this->pod.read()};
}
constexpr Raw read_range_value(const BitRange<Raw>& range) const {
constexpr Raw read(const BitRange<Raw>& range) const {
return VolatileBitMapPOD<T>::read().get_value(range);
}
@ -43,7 +43,7 @@ namespace JabyEngine {
this->pod.write(static_cast<Raw>(value));
}
constexpr void write_range_value(const BitRangeValue<Raw>& value) {
constexpr void write(const BitRangeValue<Raw>& value) {
VolatileBitMapPOD<T>::write(T{T::with(value)});
}
};

View File

@ -66,7 +66,7 @@ namespace JabyEngine {
~HighResTime() = delete;
static TimeStamp get_time_stamp() {
return TimeStamp(HighResTime::global_counter_10ms, Timer_IO::Counter2.value.read_range_value(Timer_IO::CounterValue::Value));
return TimeStamp(HighResTime::global_counter_10ms, Timer_IO::Counter2.value.read(Timer_IO::CounterValue::Value));
}
};
#endif //JABYENGINE_USE_HIGH_PERCISION_TIMER

View File

@ -95,7 +95,7 @@ namespace JabyEngine {
}
static void set_src(uintptr_t adr) {
DMA_IO::GPU.adr.write_range_value(DMA_IO::MADR::MemoryAdr.with(static_cast<uint32_t>(adr)));
DMA_IO::GPU.adr.write(DMA_IO::MADR::MemoryAdr.with(static_cast<uint32_t>(adr)));
}
static void set_dst(const PositionU16& position, const SizeU16& size) {

View File

@ -26,7 +26,7 @@
__syscall_SysEnqIntRP(Timer2Irq, &IRQCallback);
__syscall_ExitCriticalSection();
Counter2.target.write_range_value(CounterTarget::CounterTargetValue.with(HighResTime::TicksFor10ms));
Counter2.target.write(CounterTarget::CounterTargetValue.with(HighResTime::TicksFor10ms));
Counter2.mode.write({Mode});
Interrupt::enable_irq(Interrupt::Timer2);