MCPcopy Index your code
hub / github.com/FrameworkComputer/framework-system / erase_ec_flash

Method erase_ec_flash

framework_lib/src/chromium_ec/mod.rs:1100–1132  ·  view source on GitHub ↗
(
        &self,
        offset: u32,
        size: u32,
        dry_run: bool,
        chunk_size: u32,
    )

Source from the content-addressed store, hash-verified

1098 }
1099
1100 fn erase_ec_flash(
1101 &self,
1102 offset: u32,
1103 size: u32,
1104 dry_run: bool,
1105 chunk_size: u32,
1106 ) -> EcResult<()> {
1107 // Erasing a big section takes too long sometimes and the linux kernel driver times out, so
1108 // split it up into chunks.
1109 let mut cur_offset = offset;
1110
1111 while cur_offset < offset + size {
1112 let rem_size = offset + size - cur_offset;
1113 let cur_size = if rem_size < chunk_size {
1114 rem_size
1115 } else {
1116 chunk_size
1117 };
1118 debug!(
1119 "EcRequestFlashErase (0x{:05X}, 0x{:05X})",
1120 cur_offset, cur_size
1121 );
1122 if !dry_run {
1123 EcRequestFlashErase {
1124 offset: cur_offset,
1125 size: cur_size,
1126 }
1127 .send_command(self)?;
1128 }
1129 cur_offset += chunk_size;
1130 }
1131 Ok(())
1132 }
1133
1134 pub fn flash_notify(&self, flag: MecFlashNotify) -> EcResult<()> {
1135 let _data = EcRequestFlashNotify { flags: flag as u8 }.send_command(self)?;

Callers 1

reflashMethod · 0.80

Calls 1

send_commandMethod · 0.45

Tested by

no test coverage detected