@@ -9,11 +9,11 @@ pub trait ReadNorFlash {
99 const READ_SIZE : usize ;
1010
1111 /// Read a slice of data from the storage peripheral, starting the read
12- /// operation at the given address, and reading `bytes.len()` bytes.
12+ /// operation at the given address offset , and reading `bytes.len()` bytes.
1313 ///
1414 /// This should throw an error in case `bytes.len()` will be larger than
1515 /// the peripheral end address.
16- fn try_read ( & mut self , address : u32 , bytes : & mut [ u8 ] ) -> Result < ( ) , Self :: Error > ;
16+ fn try_read ( & mut self , offset : u32 , bytes : & mut [ u8 ] ) -> Result < ( ) , Self :: Error > ;
1717
1818 /// The capacity of the peripheral in bytes.
1919 fn capacity ( & self ) -> usize ;
@@ -41,8 +41,8 @@ pub trait NorFlash: ReadNorFlash {
4141 /// If power is lost during write, the contents of the written words are undefined.
4242 /// The rest of the page is guaranteed to be unchanged.
4343 /// It is not allowed to write to the same word twice.
44- /// `address ` and `bytes.len()` must both be multiples of `write_size()` and properly aligned.
45- fn try_write ( & mut self , address : u32 , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > ;
44+ /// `offset ` and `bytes.len()` must both be multiples of `write_size()` and properly aligned.
45+ fn try_write ( & mut self , offset : u32 , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > ;
4646}
4747
4848/// Marker trait for NorFlash relaxing the restrictions on `write`.
@@ -115,9 +115,9 @@ where
115115{
116116 type Error = S :: Error ;
117117
118- fn try_read ( & mut self , address : u32 , bytes : & mut [ u8 ] ) -> Result < ( ) , Self :: Error > {
118+ fn try_read ( & mut self , offset : u32 , bytes : & mut [ u8 ] ) -> Result < ( ) , Self :: Error > {
119119 // Nothing special to be done for reads
120- self . storage . try_read ( address , bytes)
120+ self . storage . try_read ( offset , bytes)
121121 }
122122
123123 fn capacity ( & self ) -> usize {
@@ -129,15 +129,15 @@ impl<'a, S> Storage for RmwNorFlashStorage<'a, S>
129129where
130130 S : NorFlash ,
131131{
132- fn try_write ( & mut self , address : u32 , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > {
132+ fn try_write ( & mut self , offset : u32 , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > {
133133 // Perform read/modify/write operations on the byte slice.
134134 let last_page = ( self . storage . capacity ( ) / S :: ERASE_SIZE ) - 1 ;
135135
136136 // `data` is the part of `bytes` contained within `page`,
137137 // and `addr` in the address offset of `page` + any offset into the page as requested by `address`
138138 for ( data, page, addr) in ( 0 ..last_page as u32 )
139139 . map ( move |i| Page :: new ( i, S :: ERASE_SIZE ) )
140- . overlaps ( bytes, address )
140+ . overlaps ( bytes, offset )
141141 {
142142 let offset_into_page = addr. saturating_sub ( page. start ) as usize ;
143143
@@ -188,9 +188,9 @@ where
188188{
189189 type Error = S :: Error ;
190190
191- fn try_read ( & mut self , address : u32 , bytes : & mut [ u8 ] ) -> Result < ( ) , Self :: Error > {
191+ fn try_read ( & mut self , offset : u32 , bytes : & mut [ u8 ] ) -> Result < ( ) , Self :: Error > {
192192 // Nothing special to be done for reads
193- self . storage . try_read ( address , bytes)
193+ self . storage . try_read ( offset , bytes)
194194 }
195195
196196 fn capacity ( & self ) -> usize {
@@ -202,15 +202,15 @@ impl<'a, S> Storage for RmwMultiwriteNorFlashStorage<'a, S>
202202where
203203 S : MultiwriteNorFlash ,
204204{
205- fn try_write ( & mut self , address : u32 , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > {
205+ fn try_write ( & mut self , offset : u32 , bytes : & [ u8 ] ) -> Result < ( ) , Self :: Error > {
206206 // Perform read/modify/write operations on the byte slice.
207207 let last_page = ( self . storage . capacity ( ) / S :: ERASE_SIZE ) - 1 ;
208208
209209 // `data` is the part of `bytes` contained within `page`,
210210 // and `addr` in the address offset of `page` + any offset into the page as requested by `address`
211211 for ( data, page, addr) in ( 0 ..last_page as u32 )
212212 . map ( move |i| Page :: new ( i, S :: ERASE_SIZE ) )
213- . overlaps ( bytes, address )
213+ . overlaps ( bytes, offset )
214214 {
215215 let offset_into_page = addr. saturating_sub ( page. start ) as usize ;
216216
0 commit comments