@@ -9,11 +9,11 @@ pub trait ReadNorFlash {
9
9
const READ_SIZE : usize ;
10
10
11
11
/// 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.
13
13
///
14
14
/// This should throw an error in case `bytes.len()` will be larger than
15
15
/// 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 > ;
17
17
18
18
/// The capacity of the peripheral in bytes.
19
19
fn capacity ( & self ) -> usize ;
@@ -41,8 +41,8 @@ pub trait NorFlash: ReadNorFlash {
41
41
/// If power is lost during write, the contents of the written words are undefined.
42
42
/// The rest of the page is guaranteed to be unchanged.
43
43
/// 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 > ;
46
46
}
47
47
48
48
/// Marker trait for NorFlash relaxing the restrictions on `write`.
@@ -115,9 +115,9 @@ where
115
115
{
116
116
type Error = S :: Error ;
117
117
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 > {
119
119
// Nothing special to be done for reads
120
- self . storage . try_read ( address , bytes)
120
+ self . storage . try_read ( offset , bytes)
121
121
}
122
122
123
123
fn capacity ( & self ) -> usize {
@@ -129,15 +129,15 @@ impl<'a, S> Storage for RmwNorFlashStorage<'a, S>
129
129
where
130
130
S : NorFlash ,
131
131
{
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 > {
133
133
// Perform read/modify/write operations on the byte slice.
134
134
let last_page = ( self . storage . capacity ( ) / S :: ERASE_SIZE ) - 1 ;
135
135
136
136
// `data` is the part of `bytes` contained within `page`,
137
137
// and `addr` in the address offset of `page` + any offset into the page as requested by `address`
138
138
for ( data, page, addr) in ( 0 ..last_page as u32 )
139
139
. map ( move |i| Page :: new ( i, S :: ERASE_SIZE ) )
140
- . overlaps ( bytes, address )
140
+ . overlaps ( bytes, offset )
141
141
{
142
142
let offset_into_page = addr. saturating_sub ( page. start ) as usize ;
143
143
@@ -188,9 +188,9 @@ where
188
188
{
189
189
type Error = S :: Error ;
190
190
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 > {
192
192
// Nothing special to be done for reads
193
- self . storage . try_read ( address , bytes)
193
+ self . storage . try_read ( offset , bytes)
194
194
}
195
195
196
196
fn capacity ( & self ) -> usize {
@@ -202,15 +202,15 @@ impl<'a, S> Storage for RmwMultiwriteNorFlashStorage<'a, S>
202
202
where
203
203
S : MultiwriteNorFlash ,
204
204
{
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 > {
206
206
// Perform read/modify/write operations on the byte slice.
207
207
let last_page = ( self . storage . capacity ( ) / S :: ERASE_SIZE ) - 1 ;
208
208
209
209
// `data` is the part of `bytes` contained within `page`,
210
210
// and `addr` in the address offset of `page` + any offset into the page as requested by `address`
211
211
for ( data, page, addr) in ( 0 ..last_page as u32 )
212
212
. map ( move |i| Page :: new ( i, S :: ERASE_SIZE ) )
213
- . overlaps ( bytes, address )
213
+ . overlaps ( bytes, offset )
214
214
{
215
215
let offset_into_page = addr. saturating_sub ( page. start ) as usize ;
216
216
0 commit comments