/// Ensures internal consistency of the memory maps is maintained. Rules like banks
/// staying contiguous, single boot banks, etc are enforced here. This is called
/// after the GUI drives any modification of the memory map, as the invariants can't
/// be easily upheld by the types alone, and having this additional step makes writing
/// the GUI code a lot simpler.
Ensures internal consistency of the memory maps is maintained. Rules like banks
staying contiguous, single boot banks, etc are enforced here. This is called
after the GUI drives any modification of the memory map, as the invariants can't
be easily upheld by the types alone, and having this additional step makes writing
the GUI code a lot simpler.
Ensures internal consistency of the memory maps is maintained . Rules like banks staying contiguous single boot banks etc are enforced here . This is called after the GUI drives any modification of the memory map as the invariants can ' t be easily upheld by the types alone and having this additional step makes writing the GUI code a lot simpler .
pub fn normalize(
    internal_memory_map: &mut InternalMemoryMap,
    external_memory_map: &mut ExternalMemoryMap,
    internal_flash: &memory::FlashChip,
    external_flash: &mut Option<memory::FlashChip>,
    golden_index: &mut Option<usize>,
    port: &Port,
) {
    enforce_bootable_bank_not_golden(golden_index, internal_memory_map);
    enforce_internal_banks_follow_bootloader(internal_memory_map, internal_flash);
    enforce_internal_banks_are_contiguous(internal_memory_map);
    enforce_internal_bank_ranges_are_maintained(internal_memory_map, internal_flash);
    if let Some(chip) = external_flash {
        if memory::external_flash(port).any(|c| c.name == chip.name) {
            enforce_external_banks_are_contiguous(external_memory_map, chip);
        } else {
            *external_flash = None;
        }
    } else {
        external_memory_map.banks.clear();
    }
}
pub fn normalize ( internal_memory_map : & mut InternalMemoryMap , external_memory_map : & mut ExternalMemoryMap , internal_flash : & memory :: FlashChip , external_flash : & mut Option < memory :: FlashChip > , golden_index : & mut Option < usize > , port : & Port , ) { enforce_bootable_bank_not_golden ( golden_index , internal_memory_map ) ; enforce_internal_banks_follow_bootloader ( internal_memory_map , internal_flash ) ; enforce_internal_banks_are_contiguous ( internal_memory_map ) ; enforce_internal_bank_ranges_are_maintained ( internal_memory_map , internal_flash ) ; if let Some ( chip ) = external_flash { if memory :: external_flash ( port ) . any ( | c | c . name == chip . name ) { enforce_external_banks_are_contiguous ( external_memory_map , chip ) ; } else { * external_flash = None ; } } else { external_memory_map . banks . clear ( ) ; } }
Ensures internal consistency of the memory maps is maintained.
Ensures internal consistency of the memory maps is maintained .
internal_memory_map
&mut InternalMemoryMap
external_memory_map
&mut ExternalMemoryMap
internal_flash
&memory::FlashChip
external_flash
&mut Option<memory::FlashChip>
golden_index
&mut Option<usize>
port
&Port