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
122121int8_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 */
136135int8_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 */
156155int8_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