mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
debug for QE mode entry/exit
This commit is contained in:
parent
3e19e7bfd0
commit
6fba742cad
2 changed files with 17 additions and 2 deletions
|
|
@ -110,6 +110,7 @@ debug-print-uart = ["debug-print"]
|
||||||
debug-countermeasures = []
|
debug-countermeasures = []
|
||||||
debug-wfi = []
|
debug-wfi = []
|
||||||
security = ["sigcheck"]
|
security = ["sigcheck"]
|
||||||
|
qe-debug = []
|
||||||
|
|
||||||
udma-stress-test = [
|
udma-stress-test = [
|
||||||
] # For RTL simulation testing - aggravates a key corner case
|
] # For RTL simulation testing - aggravates a key corner case
|
||||||
|
|
|
||||||
|
|
@ -1013,6 +1013,8 @@ impl Spim {
|
||||||
/// we try to auto-ID the parts and configure them to behave as much like the Macronix defaults.
|
/// we try to auto-ID the parts and configure them to behave as much like the Macronix defaults.
|
||||||
pub fn identify_flash_reset_qpi(&mut self) -> u32 {
|
pub fn identify_flash_reset_qpi(&mut self) -> u32 {
|
||||||
let mut id = self.mem_read_id_flash();
|
let mut id = self.mem_read_id_flash();
|
||||||
|
#[cfg(feature = "qe-debug")]
|
||||||
|
crate::println!("ifrq id {:x}", id);
|
||||||
if !bao1x_api::SPI_FLASH_IDS.contains(&(id & 0xFF_FF_FF)) {
|
if !bao1x_api::SPI_FLASH_IDS.contains(&(id & 0xFF_FF_FF)) {
|
||||||
for command_set in ALL_COMMAND_SETS {
|
for command_set in ALL_COMMAND_SETS {
|
||||||
self.mode = SpimMode::Quad;
|
self.mode = SpimMode::Quad;
|
||||||
|
|
@ -1448,6 +1450,8 @@ impl Spim {
|
||||||
self.mem_read_id_flash();
|
self.mem_read_id_flash();
|
||||||
}
|
}
|
||||||
let sr = self.flash_read_status_register();
|
let sr = self.flash_read_status_register();
|
||||||
|
#[cfg(feature = "qe-debug")]
|
||||||
|
crate::println!("sr: {:x}", sr);
|
||||||
let qe_set = match self.command_set {
|
let qe_set = match self.command_set {
|
||||||
Some(CommandSet::Macronix) => 0b0100_0000 & sr != 0,
|
Some(CommandSet::Macronix) => 0b0100_0000 & sr != 0,
|
||||||
Some(CommandSet::Xtx) | Some(CommandSet::Zetta) | Some(CommandSet::Puya) => {
|
Some(CommandSet::Xtx) | Some(CommandSet::Zetta) | Some(CommandSet::Puya) => {
|
||||||
|
|
@ -1459,18 +1463,28 @@ impl Spim {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if qe_set {
|
if qe_set {
|
||||||
|
#[cfg(feature = "qe-debug")]
|
||||||
|
crate::println!("qe is set");
|
||||||
// nothing to do, it's already set
|
// nothing to do, it's already set
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "qe-debug")]
|
||||||
|
crate::println!("setting qe");
|
||||||
match self.command_set.unwrap() {
|
match self.command_set.unwrap() {
|
||||||
CommandSet::Macronix => {
|
CommandSet::Macronix => {
|
||||||
self.mem_write_status_register(0b0100_0000 | (sr & 0xFF) as u8, ((sr & 0xFF00) >> 8) as u8);
|
self.mem_write_status_register(0b0100_0000 | (sr & 0xFF) as u8, ((sr & 0xFF00) >> 8) as u8);
|
||||||
}
|
}
|
||||||
CommandSet::Xtx | CommandSet::Zetta | CommandSet::Puya => {
|
CommandSet::Xtx | CommandSet::Zetta => {
|
||||||
|
self.mem_param_set(true, 0x31, &[((sr & 0xFF00 >> 8) as u8) | 0b0000_0010]);
|
||||||
|
}
|
||||||
|
CommandSet::Puya => {
|
||||||
self.mem_param_set(true, 0x31, &[((sr & 0xFF00 >> 8) as u8) | 0b0000_0010]);
|
self.mem_param_set(true, 0x31, &[((sr & 0xFF00 >> 8) as u8) | 0b0000_0010]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "qe-debug")]
|
||||||
|
let sr = self.flash_read_status_register();
|
||||||
|
#[cfg(feature = "qe-debug")]
|
||||||
|
crate::println!("sr: {:x}", sr);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn flash_wren(&mut self) {
|
fn flash_wren(&mut self) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue