@@ -91,22 +91,22 @@ static int flash_b91_erase(const struct device *dev, off_t offset, size_t len)
91
91
/* check for 64K erase possibility, then check for 32K and so on.. */
92
92
if ((page_nums >= BLOCK_64K_PAGES ) && ((offset % BLOCK_64K_SIZE ) == 0 )) {
93
93
/* erase 64K block */
94
- flash_erase_64kblock (offset );
94
+ flash_erase_64kblock (CONFIG_FLASH_BASE_ADDRESS + offset );
95
95
page_nums -= BLOCK_64K_PAGES ;
96
96
offset += BLOCK_64K_SIZE ;
97
97
} else if ((page_nums >= BLOCK_32K_PAGES ) && ((offset % BLOCK_32K_SIZE ) == 0 )) {
98
98
/* erase 32K block */
99
- flash_erase_32kblock (offset );
99
+ flash_erase_32kblock (CONFIG_FLASH_BASE_ADDRESS + offset );
100
100
page_nums -= BLOCK_32K_PAGES ;
101
101
offset += BLOCK_32K_SIZE ;
102
102
} else if ((page_nums >= SECTOR_PAGES ) && ((offset % SECTOR_SIZE ) == 0 )) {
103
103
/* erase sector */
104
- flash_erase_sector (offset );
104
+ flash_erase_sector (CONFIG_FLASH_BASE_ADDRESS + offset );
105
105
page_nums -= SECTOR_PAGES ;
106
106
offset += SECTOR_SIZE ;
107
107
} else {
108
108
/* erase page */
109
- flash_erase_page (offset );
109
+ flash_erase_page (CONFIG_FLASH_BASE_ADDRESS + offset );
110
110
page_nums -- ;
111
111
offset += PAGE_SIZE ;
112
112
}
@@ -158,7 +158,7 @@ static int flash_b91_write(const struct device *dev, off_t offset,
158
158
}
159
159
160
160
/* write flash */
161
- flash_write_page (offset , len , (unsigned char * )data );
161
+ flash_write_page (CONFIG_FLASH_BASE_ADDRESS + offset , len , (unsigned char * )data );
162
162
163
163
/* if ram memory is allocated for flash writing it should be free */
164
164
if (buf != NULL ) {
@@ -188,7 +188,7 @@ static int flash_b91_read(const struct device *dev, off_t offset,
188
188
}
189
189
190
190
/* read flash */
191
- flash_read_page (offset , len , (unsigned char * )data );
191
+ flash_read_page (CONFIG_FLASH_BASE_ADDRESS + offset , len , (unsigned char * )data );
192
192
193
193
return 0 ;
194
194
}
0 commit comments