Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ pub struct Device {
pub cpu: Option<Cpu>,
pub peripherals: Vec<Peripheral>,
pub defaults: Defaults,
pub vendor: Option<String>,
pub vendor_id: Option<String>,
pub series: Option<String>,
pub version: Option<String>,
pub description: Option<String>,
pub license_text: Option<String>,
pub header_system_filename: Option<String>,
pub header_definitions_prefix: Option<String>,
pub address_unit_bits: u64,
pub width: u64,
// Reserve the right to add more fields to this struct
_extensible: (),
}
Expand All @@ -97,6 +107,16 @@ impl Device {
.map(Peripheral::parse)
.collect(),
defaults: Defaults::parse(tree),
vendor: tree.get_child_text("vendor"),
vendor_id: tree.get_child_text("vendorID"),
series: tree.get_child_text("series"),
version: tree.get_child_text("version"),
description: tree.get_child_text("description"),
license_text: tree.get_child_text("licenseText"),
header_system_filename: tree.get_child_text("headerSystemFilename"),
header_definitions_prefix: tree.get_child_text("headerDefinitionsPrefix"),
address_unit_bits: try!(tree.get_child_text("addressUnitBits").map(|x| x.parse::<u64>().unwrap())),
width: try!(tree.get_child_text("width").map(|x| x.parse::<u64>().unwrap())),
_extensible: (),
}
}
Expand Down