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

Function read_versions

framework_lib/src/ccgx/binary.rs:172–184  ·  view source on GitHub ↗

Parse all PD information, given a binary file (buffer)

(file_buffer: &[u8], ccgx: SiliconId)

Source from the content-addressed store, hash-verified

170
171/// Parse all PD information, given a binary file (buffer)
172pub fn read_versions(file_buffer: &[u8], ccgx: SiliconId) -> Option<PdFirmwareFile> {
173 let (flash_row_size, f1_metadata_row, fw2_metadata_row) = match ccgx {
174 SiliconId::Ccg3 => (SMALL_ROW, 0x03FF, 0x03FE),
175 SiliconId::Ccg5 => (LARGE_ROW, FW1_METADATA_ROW, FW2_METADATA_ROW_CCG5),
176 SiliconId::Ccg6Adl => (SMALL_ROW, FW1_METADATA_ROW, FW2_METADATA_ROW_CCG6),
177 SiliconId::Ccg6 => (SMALL_ROW, FW1_METADATA_ROW, FW2_METADATA_ROW_CCG6),
178 SiliconId::Ccg8 => (LARGE_ROW, FW1_METADATA_ROW_CCG8, FW2_METADATA_ROW_CCG8),
179 };
180 let backup_fw = read_version(file_buffer, flash_row_size, f1_metadata_row, ccgx)?;
181 let main_fw = read_version(file_buffer, flash_row_size, fw2_metadata_row, ccgx)?;
182
183 Some(PdFirmwareFile { backup_fw, main_fw })
184}
185
186/// Pretty print information about PD firmware
187pub fn print_fw(fw: &PdFirmware) {

Callers 10

can_parse_ccg3_binaryFunction · 0.85
can_parse_ccg5_binaryFunction · 0.85
can_parse_ccg8_binaryFunction · 0.85
flash_firmwareFunction · 0.85
analyze_ccgx_pd_fwFunction · 0.85

Calls 1

read_versionFunction · 0.85

Tested by 8

can_parse_ccg3_binaryFunction · 0.68
can_parse_ccg5_binaryFunction · 0.68
can_parse_ccg8_binaryFunction · 0.68