forked from M-Labs/zynq-rs
libboard_zynq::flash: keep spi_en=1 over multiple manual transfers
This commit is contained in:
parent
668e3e32ba
commit
53eebce39c
|
@ -340,6 +340,11 @@ impl Flash<()> {
|
||||||
.lq_mode(false)
|
.lq_mode(false)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
self.regs.enable.write(
|
||||||
|
regs::Enable::zeroed()
|
||||||
|
.spi_en(true)
|
||||||
|
);
|
||||||
|
|
||||||
self.transition()
|
self.transition()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,6 +370,8 @@ impl Flash<LinearAddressing> {
|
||||||
|
|
||||||
impl Flash<Manual> {
|
impl Flash<Manual> {
|
||||||
pub fn stop(self) -> Flash<()> {
|
pub fn stop(self) -> Flash<()> {
|
||||||
|
self.regs.enable.modify(|_, w| w.spi_en(false));
|
||||||
|
|
||||||
self.transition()
|
self.transition()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,6 @@ pub struct Transfer<'a, Args: Iterator<Item = W>, W: Into<SpiWord>> {
|
||||||
impl<'a, Args: Iterator<Item = W>, W: Into<SpiWord>> Transfer<'a, Args, W> {
|
impl<'a, Args: Iterator<Item = W>, W: Into<SpiWord>> Transfer<'a, Args, W> {
|
||||||
pub fn new(flash: &'a mut Flash<Manual>, args: Args, len: usize) -> Self {
|
pub fn new(flash: &'a mut Flash<Manual>, args: Args, len: usize) -> Self {
|
||||||
flash.regs.config.modify(|_, w| w.pcs(false));
|
flash.regs.config.modify(|_, w| w.pcs(false));
|
||||||
flash.regs.enable.write(
|
|
||||||
regs::Enable::zeroed()
|
|
||||||
.spi_en(true)
|
|
||||||
);
|
|
||||||
|
|
||||||
let mut xfer = Transfer {
|
let mut xfer = Transfer {
|
||||||
flash,
|
flash,
|
||||||
|
@ -97,11 +93,7 @@ impl<'a, Args: Iterator<Item = W>, W: Into<SpiWord>> Drop for Transfer<'a, Args,
|
||||||
self.read();
|
self.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop
|
|
||||||
self.flash.regs.enable.write(
|
|
||||||
regs::Enable::zeroed()
|
|
||||||
.spi_en(false)
|
|
||||||
);
|
|
||||||
self.flash.regs.config.modify(|_, w| w
|
self.flash.regs.config.modify(|_, w| w
|
||||||
.pcs(true)
|
.pcs(true)
|
||||||
.man_start_com(false)
|
.man_start_com(false)
|
||||||
|
|
Loading…
Reference in New Issue