Skip to content

Commit 3242cf2

Browse files
committed
stmhal/usbd_msc_storage: Use storage functions instead of disk ones.
1 parent 4565d42 commit 3242cf2

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

stmhal/usbd_msc_storage.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include "usbd_msc_storage.h"
3838

3939
#include "py/misc.h"
40-
#include "lib/fatfs/diskio.h"
4140
#include "storage.h"
4241
#include "sdcard.h"
4342

@@ -121,7 +120,7 @@ int8_t FLASH_STORAGE_StartStopUnit(uint8_t lun, uint8_t started) {
121120

122121
int8_t FLASH_STORAGE_PreventAllowMediumRemoval(uint8_t lun, uint8_t param) {
123122
// sync the flash so that the cache is cleared and the device can be unplugged/turned off
124-
disk_ioctl(0, CTRL_SYNC, NULL);
123+
storage_flush();
125124
return 0;
126125
}
127126

@@ -134,7 +133,7 @@ int8_t FLASH_STORAGE_PreventAllowMediumRemoval(uint8_t lun, uint8_t param) {
134133
* @retval Status
135134
*/
136135
int8_t FLASH_STORAGE_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len) {
137-
disk_read(0, buf, blk_addr, blk_len);
136+
storage_read_blocks(buf, blk_addr, blk_len);
138137
/*
139138
for (int i = 0; i < blk_len; i++) {
140139
if (!storage_read_block(buf + i * FLASH_BLOCK_SIZE, blk_addr + i)) {
@@ -154,7 +153,7 @@ int8_t FLASH_STORAGE_Read(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t
154153
* @retval Status
155154
*/
156155
int8_t FLASH_STORAGE_Write (uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len) {
157-
disk_write(0, buf, blk_addr, blk_len);
156+
storage_write_blocks(buf, blk_addr, blk_len);
158157
/*
159158
for (int i = 0; i < blk_len; i++) {
160159
if (!storage_write_block(buf + i * FLASH_BLOCK_SIZE, blk_addr + i)) {

0 commit comments

Comments
 (0)