1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use super::chip::Chip;
use super::flash_algorithm::RawFlashAlgorithm;
use crate::config::target::TargetParseError;
use jep106::JEP106Code;
use std::collections::HashMap;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ChipFamily {
pub name: String,
pub manufacturer: Option<JEP106Code>,
pub variants: Vec<Chip>,
pub flash_algorithms: HashMap<String, RawFlashAlgorithm>,
pub core: String,
}
impl ChipFamily {
pub fn from_yaml_reader<R: std::io::Read>(
definition_reader: R,
) -> Result<Self, TargetParseError> {
serde_yaml::from_reader(definition_reader)
}
pub fn variants(&self) -> &Vec<Chip> {
&self.variants
}
pub fn algorithms(&self) -> &HashMap<String, RawFlashAlgorithm> {
&self.flash_algorithms
}
}