MCPcopy Create free account
hub / github.com/FrameworkComputer/framework-system / transfer_read

Function transfer_read

framework_lib/src/chromium_ec/portio.rs:37–62  ·  view source on GitHub ↗

Generic transfer read function

(port: u16, address: u16, size: u16)

Source from the content-addressed store, hash-verified

35
36/// Generic transfer read function
37fn transfer_read(port: u16, address: u16, size: u16) -> Vec<u8> {
38 if has_mec() {
39 return portio_mec::transfer_read(address, size);
40 }
41
42 if log_enabled!(Level::Trace) {
43 println!(
44 "transfer_read(port={:#X}, address={:#X}, size={:#X})",
45 port, address, size
46 );
47 }
48
49 // Allocate buffer to hold result
50 let mut buffer = vec![0_u8; size.into()];
51
52 for i in 0..size {
53 buffer[i as usize] = Pio::<u8>::new(port + address + i).read();
54 }
55
56 if log_enabled!(Level::Trace) {
57 println!(" Read bytes:");
58 util::print_multiline_buffer(&buffer, (port + address) as usize)
59 }
60
61 buffer
62}
63
64#[derive(PartialEq)]
65#[allow(dead_code)]

Callers 3

initFunction · 0.70
send_commandFunction · 0.70
read_memoryFunction · 0.70

Calls 3

has_mecFunction · 0.85
print_multiline_bufferFunction · 0.85
readMethod · 0.80

Tested by

no test coverage detected