use crate::domain::chip::*;
use crate::domain::types::*;
pub const MANUFACTURER_ID: u8 = 0xC8;
pub const MANUFACTURER_NAME: &str = "ESMT";
pub fn get_chips() -> Vec<ChipSpec> {
vec![
nand_chip("F50L512M41A", [0xC8, 0x20, 0x00], 0, 2048, 64, 128, 64),
nand_chip("F50L1G41A0", [0xC8, 0x21, 0x00], 1, 2048, 64, 128, 128),
nand_chip("F50L1G41LB", [0xC8, 0x01, 0x00], 1, 2048, 64, 128, 128),
nand_chip("F50D1G41LB", [0xC8, 0x11, 0x00], 1, 2048, 128, 128, 128),
nand_chip("F50L2G41LB", [0xC8, 0x0A, 0x00], 2, 2048, 64, 128, 256),
]
}
fn nand_chip(
name: &str,
jedec_id: [u8; 3],
capacity_gbit: u32,
page_size: u32,
oob_size: u32,
block_size_kb: u32,
capacity_mb: u32,
) -> ChipSpec {
let capacity = if capacity_gbit > 0 {
Capacity::gigabits(capacity_gbit)
} else {
Capacity::megabytes(capacity_mb)
};
ChipSpec {
name: name.to_string(),
manufacturer: MANUFACTURER_NAME.to_string(),
jedec_id: JedecId::new(jedec_id),
flash_type: FlashType::Nand,
capacity,
layout: ChipLayout {
page_size,
block_size: block_size_kb * 1024,
oob_size: Some(oob_size),
is_dataflash: false,
},
capabilities: ChipCapabilities {
supports_ecc_control: true,
supports_dual_spi: true,
..Default::default()
},
otp: None,
}
}