1414
1515#include "kernel_defines.h"
1616
17- #define ENABLE_DEBUG (0 )
17+ #define ENABLE_DEBUG (1 )
1818#include <debug.h>
1919
2020static int spiffs_err_to_errno (s32_t err );
@@ -26,7 +26,12 @@ static int32_t _dev_read(struct spiffs_t *fs, u32_t addr, u32_t size, u8_t *dst)
2626
2727 //DEBUG("spiffs: read: from addr 0x%" PRIx32 " size 0x%" PRIx32 "\n", addr, size);
2828
29- return mtd_read (dev , dst , addr , size );
29+ if (mtd_read (dev , dst , addr , size ) > 0 ) {
30+ return 0 ;
31+ }
32+ else {
33+ return - EIO ;
34+ }
3035}
3136
3237static int32_t _dev_write (struct spiffs_t * fs , u32_t addr , u32_t size , u8_t * src )
@@ -35,7 +40,12 @@ static int32_t _dev_write(struct spiffs_t *fs, u32_t addr, u32_t size, u8_t *src
3540
3641 DEBUG ("spiffs: write: from addr 0x%" PRIx32 " size 0x%" PRIx32 "\n" , addr , size );
3742
38- return mtd_write (dev , src , addr , size );
43+ if (mtd_write (dev , src , addr , size ) > 0 ) {
44+ return 0 ;
45+ }
46+ else {
47+ return - EIO ;
48+ }
3949}
4050
4151static int32_t _dev_erase (struct spiffs_t * fs , u32_t addr , u32_t size )
0 commit comments