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)
|
||||
);
|
||||
|
||||
self.regs.enable.write(
|
||||
regs::Enable::zeroed()
|
||||
.spi_en(true)
|
||||
);
|
||||
|
||||
self.transition()
|
||||
}
|
||||
}
|
||||
|
@ -365,6 +370,8 @@ impl Flash<LinearAddressing> {
|
|||
|
||||
impl Flash<Manual> {
|
||||
pub fn stop(self) -> Flash<()> {
|
||||
self.regs.enable.modify(|_, w| w.spi_en(false));
|
||||
|
||||
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> {
|
||||
pub fn new(flash: &'a mut Flash<Manual>, args: Args, len: usize) -> Self {
|
||||
flash.regs.config.modify(|_, w| w.pcs(false));
|
||||
flash.regs.enable.write(
|
||||
regs::Enable::zeroed()
|
||||
.spi_en(true)
|
||||
);
|
||||
|
||||
let mut xfer = Transfer {
|
||||
flash,
|
||||
|
@ -97,11 +93,7 @@ impl<'a, Args: Iterator<Item = W>, W: Into<SpiWord>> Drop for Transfer<'a, Args,
|
|||
self.read();
|
||||
}
|
||||
|
||||
// Stop
|
||||
self.flash.regs.enable.write(
|
||||
regs::Enable::zeroed()
|
||||
.spi_en(false)
|
||||
);
|
||||
|
||||
self.flash.regs.config.modify(|_, w| w
|
||||
.pcs(true)
|
||||
.man_start_com(false)
|
||||
|
|
Loading…
Reference in New Issue