mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
rust/hw/char/pl011: Extract DR write logic into separate function
- Split `write()` DR case into `write_data_register()` Signed-off-by: Rakesh Jeyasingh <rakeshjb010@gmail.com> Link: https://lore.kernel.org/r/20250407181327.171563-3-rakeshjb010@gmail.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
efc5603292
commit
6d8c6dee3a
1 changed files with 8 additions and 6 deletions
|
@ -221,12 +221,7 @@ impl PL011Registers {
|
||||||
// eprintln!("write offset {offset} value {value}");
|
// eprintln!("write offset {offset} value {value}");
|
||||||
use RegisterOffset::*;
|
use RegisterOffset::*;
|
||||||
match offset {
|
match offset {
|
||||||
DR => {
|
DR => return self.write_data_register(value),
|
||||||
// interrupts always checked
|
|
||||||
let _ = self.loopback_tx(value.into());
|
|
||||||
self.int_level |= Interrupt::TX.0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
RSR => {
|
RSR => {
|
||||||
self.receive_status_error_clear = 0.into();
|
self.receive_status_error_clear = 0.into();
|
||||||
}
|
}
|
||||||
|
@ -307,6 +302,13 @@ impl PL011Registers {
|
||||||
u32::from(c)
|
u32::from(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn write_data_register(&mut self, value: u32) -> bool {
|
||||||
|
// interrupts always checked
|
||||||
|
let _ = self.loopback_tx(value.into());
|
||||||
|
self.int_level |= Interrupt::TX.0;
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
fn loopback_tx(&mut self, value: registers::Data) -> bool {
|
fn loopback_tx(&mut self, value: registers::Data) -> bool {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue