fn add_irq_vectors(doc: &Element, peripherals: &mut Element) {

    // find interrupt controller peripheral "INT" in svd treee
    let mut intctrl: Option<&mut Element> = None;
    for p in peripherals.children.iter_mut() {
        if p.name == "peripheral" {
            let name = p.get_child("name").unwrap();
            if let Some(name_text) = &name.text {
                if name_text == "INT" {
                    intctrl = Some(p);
                    break;
                }
            }
        }
    }
    let ref mut intctrl = if let Some(ic) = intctrl {
        ic
    }else{
        panic!("Cannot find Interrupt Controller Element");
    };

    // add IRQ vector numbers
    let intlist = doc.get_child("InterruptList").unwrap();
    for irq in intlist.children.iter() {
        if irq.name == "Interrupt" {
            let cname = irq.attributes["cname"].as_str();
            let vect = irq.attributes["irq"].as_str();
            let mut int_elem = Element::new("interrupt");
            add_elem_with_text(&mut int_elem, "name", cname);
            add_elem_with_text(&mut int_elem, "value", vect);
            intctrl.children.push(int_elem);
        }
    }
}
// Add IRQ vectors to interrupt controller peripheral. Should normally be added
// to the individual peripheral who trigger the respective IRQs but the relation
// peripheral - irq vector is not coded into the PIC file
Add IRQ vectors to interrupt controller peripheral. Should normally be added
to the individual peripheral who trigger the respective IRQs but the relation
peripheral - irq vector is not coded into the PIC file
Add IRQ vectors to interrupt controller peripheral . Should normally be added to the individual peripheral who trigger the respective IRQs but the relation peripheral - irq vector is not coded into the PIC file
fn add_irq_vectors(doc: &Element, peripherals: &mut Element) {
    // find interrupt controller peripheral "INT" in svd treee
    let mut intctrl: Option<&mut Element> = None;
    for p in peripherals.children.iter_mut() {
        if p.name == "peripheral" {
            let name = p.get_child("name").unwrap();
            if let Some(name_text) = &name.text {
                if name_text == "INT" {
                    intctrl = Some(p);
                    break;
                }
            }
        }
    }
    let ref mut intctrl = if let Some(ic) = intctrl {
        ic
    }else{
        panic!("Cannot find Interrupt Controller Element");
    };
    // add IRQ vector numbers
    let intlist = doc.get_child("InterruptList").unwrap();
    for irq in intlist.children.iter() {
        if irq.name == "Interrupt" {
            let cname = irq.attributes["cname"].as_str();
            let vect = irq.attributes["irq"].as_str();
            let mut int_elem = Element::new("interrupt");
            add_elem_with_text(&mut int_elem, "name", cname);
            add_elem_with_text(&mut int_elem, "value", vect);
            intctrl.children.push(int_elem);
        }
    }
}
fn add_irq_vectors ( doc : & Element , peripherals : & mut Element ) { // find interrupt controller peripheral "INT" in svd treee let mut intctrl : Option < & mut Element > = None ; for p in peripherals . children . iter_mut ( ) { if p . name == " " { let name = p . get_child ( " " ) . unwrap ( ) ; if let Some ( name_text ) = & name . text { if name_text == " " { intctrl = Some ( p ) ; break ; } } } } let ref mut intctrl = if let Some ( ic ) = intctrl { ic } else { panic ! ( " " ) ; } ; // add IRQ vector numbers let intlist = doc . get_child ( " " ) . unwrap ( ) ; for irq in intlist . children . iter ( ) { if irq . name == " " { let cname = irq . attributes [ " " ] . as_str ( ) ; let vect = irq . attributes [ " " ] . as_str ( ) ; let mut int_elem = Element :: new ( " " ) ; add_elem_with_text ( & mut int_elem , " " , cname ) ; add_elem_with_text ( & mut int_elem , " " , vect ) ; intctrl . children . push ( int_elem ) ; } } }
Add IRQ vectors to interrupt controller peripheral.
Add IRQ vectors to interrupt controller peripheral .
doc
&Element
peripherals
&mut Element
doc
&Element
peripherals
&mut Element