mirror of
https://github.com/Polprzewodnikowy/SummerCart64.git
synced 2024-11-24 14:46:53 +01:00
[SC64][SW] Added USB speed test
This commit is contained in:
parent
631f140c48
commit
912f356650
@ -890,6 +890,15 @@ fn handle_firmware_command(
|
||||
fn handle_test_command(connection: Connection) -> Result<(), sc64::Error> {
|
||||
let mut sc64 = init_sc64(connection, false)?;
|
||||
|
||||
println!("{}: USB", "[SC64 Tests]".bold());
|
||||
|
||||
print!(" Performing USB speed test... ");
|
||||
stdout().flush().unwrap();
|
||||
|
||||
let (read_speed, write_speed) = sc64.test_usb_speed()?;
|
||||
|
||||
println!("Read speed: {read_speed:.2} MiB/s, Write speed: {write_speed:.2} MiB/s");
|
||||
|
||||
println!("{}: SDRAM (pattern)", "[SC64 Tests]".bold());
|
||||
|
||||
let sdram_pattern_tests = [
|
||||
|
@ -752,6 +752,22 @@ impl SC64 {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn test_usb_speed(&mut self) -> Result<(f64, f64), Error> {
|
||||
const TEST_ADDRESS: u32 = SDRAM_ADDRESS;
|
||||
const TEST_LENGTH: usize = SDRAM_LENGTH;
|
||||
const MIB_DIVIDER: f64 = 1024.0 * 1024.0;
|
||||
|
||||
let read_time = std::time::Instant::now();
|
||||
let data = self.command_memory_read(TEST_ADDRESS, TEST_LENGTH)?;
|
||||
let read_speed = (TEST_LENGTH as f64 / MIB_DIVIDER) / read_time.elapsed().as_secs_f64();
|
||||
|
||||
let write_time = std::time::Instant::now();
|
||||
self.command_memory_write(TEST_ADDRESS, &data)?;
|
||||
let write_speed = (TEST_LENGTH as f64 / MIB_DIVIDER) / write_time.elapsed().as_secs_f64();
|
||||
|
||||
Ok((read_speed, write_speed))
|
||||
}
|
||||
|
||||
pub fn test_sdram_pattern(
|
||||
&mut self,
|
||||
pattern: MemoryTestPattern,
|
||||
|
Loading…
Reference in New Issue
Block a user