@@ -148,7 +148,7 @@ impl ServerImpl {
148148 sleep : Option < u64 > ,
149149 ) -> Result < ( ) , AuxFlashError > {
150150 loop {
151- let status = self . read_status ( ) ?;
151+ let status = self . read_qspi_status ( ) ?;
152152 if status & 1 == 0 {
153153 // ooh we're done
154154 break ;
@@ -162,7 +162,7 @@ impl ServerImpl {
162162
163163 fn set_and_check_write_enable ( & self ) -> Result < ( ) , AuxFlashError > {
164164 self . qspi . write_enable ( ) . map_err ( qspi_to_auxflash) ?;
165- let status = self . read_status ( ) ?;
165+ let status = self . read_qspi_status ( ) ?;
166166
167167 if status & 0b10 == 0 {
168168 // oh oh
@@ -239,6 +239,11 @@ impl ServerImpl {
239239 }
240240 }
241241
242+ /// Reads the Status register.
243+ fn read_qspi_status ( & self ) -> Result < u8 , AuxFlashError > {
244+ self . qspi . read_status ( ) . map_err ( qspi_to_auxflash)
245+ }
246+
242247 /// Reads from flash storage starting at `address` and continuing for
243248 /// `data.len()` bytes, depositing the bytes into `data`.
244249 fn read_qspi_memory (
@@ -282,7 +287,7 @@ impl ServerImpl {
282287 data : & [ u8 ] ,
283288 ) -> Result < ( ) , AuxFlashError > {
284289 self . qspi
285- . page_program ( address as u32 , & buf [ ..amount ] )
290+ . page_program ( address as u32 , data )
286291 . map_err ( qspi_to_auxflash)
287292 }
288293}
@@ -301,7 +306,7 @@ impl idl::InOrderAuxFlashImpl for ServerImpl {
301306 & mut self ,
302307 _: & RecvMessage ,
303308 ) -> Result < u8 , RequestError < AuxFlashError > > {
304- Ok ( self . qspi . read_status ( ) . map_err ( qspi_to_auxflash ) ?)
309+ Ok ( self . read_qspi_status ( ) ?)
305310 }
306311
307312 fn slot_count (
@@ -343,7 +348,7 @@ impl idl::InOrderAuxFlashImpl for ServerImpl {
343348 let mut addr = mem_start;
344349 while addr < mem_end {
345350 self . set_and_check_write_enable ( ) ?;
346- self . qspi_sector_erase ( write_addr ) ?;
351+ self . qspi_sector_erase ( addr ) ?;
347352 addr += SECTOR_SIZE_BYTES ;
348353 self . poll_for_write_complete ( Some ( 1 ) ) ?;
349354 }
@@ -368,7 +373,7 @@ impl idl::InOrderAuxFlashImpl for ServerImpl {
368373 }
369374
370375 self . set_and_check_write_enable ( ) ?;
371- self . qspi_sector_erase ( write_addr ) ?;
376+ self . qspi_sector_erase ( addr ) ?;
372377 self . poll_for_write_complete ( Some ( 1 ) ) ?;
373378 Ok ( ( ) )
374379 }
0 commit comments