Compare commits
1 Commits
jebbatime
...
fatfs-dyna
Author | SHA1 | Date |
---|---|---|
Paul Sokolovsky | e0508e2eeb |
|
@ -76,6 +76,7 @@ STATIC mp_obj_t pyb_mount(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *
|
||||||
mp_load_method_maybe(device, MP_QSTR_writeblocks, vfs->writeblocks);
|
mp_load_method_maybe(device, MP_QSTR_writeblocks, vfs->writeblocks);
|
||||||
mp_load_method_maybe(device, MP_QSTR_sync, vfs->sync);
|
mp_load_method_maybe(device, MP_QSTR_sync, vfs->sync);
|
||||||
mp_load_method(device, MP_QSTR_count, vfs->count);
|
mp_load_method(device, MP_QSTR_count, vfs->count);
|
||||||
|
mp_load_method_maybe(device, MP_QSTR_secsize, vfs->secsize);
|
||||||
|
|
||||||
// Read-only device indicated by writeblocks[0] == MP_OBJ_NULL.
|
// Read-only device indicated by writeblocks[0] == MP_OBJ_NULL.
|
||||||
// User can specify read-only device by:
|
// User can specify read-only device by:
|
||||||
|
|
|
@ -31,6 +31,7 @@ typedef struct _fs_user_mount_t {
|
||||||
mp_obj_t writeblocks[4];
|
mp_obj_t writeblocks[4];
|
||||||
mp_obj_t sync[2];
|
mp_obj_t sync[2];
|
||||||
mp_obj_t count[2];
|
mp_obj_t count[2];
|
||||||
|
mp_obj_t secsize[2];
|
||||||
FATFS fatfs;
|
FATFS fatfs;
|
||||||
} fs_user_mount_t;
|
} fs_user_mount_t;
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,11 @@
|
||||||
|
|
||||||
|
|
||||||
#define _MIN_SS 512
|
#define _MIN_SS 512
|
||||||
|
#ifdef MICROPY_FATFS_MAX_SS
|
||||||
|
#define _MAX_SS (MICROPY_FATFS_MAX_SS)
|
||||||
|
#else
|
||||||
#define _MAX_SS 512
|
#define _MAX_SS 512
|
||||||
|
#endif
|
||||||
/* These options configure the range of sector size to be supported. (512, 1024,
|
/* These options configure the range of sector size to be supported. (512, 1024,
|
||||||
/ 2048 or 4096) Always set both 512 for most systems, all type of memory cards and
|
/ 2048 or 4096) Always set both 512 for most systems, all type of memory cards and
|
||||||
/ harddisk. But a larger value may be required for on-board flash memory and some
|
/ harddisk. But a larger value may be required for on-board flash memory and some
|
||||||
|
|
|
@ -677,6 +677,7 @@ Q(readblocks)
|
||||||
Q(writeblocks)
|
Q(writeblocks)
|
||||||
Q(sync)
|
Q(sync)
|
||||||
Q(count)
|
Q(count)
|
||||||
|
Q(secsize)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MICROPY_PY_OS_DUPTERM
|
#if MICROPY_PY_OS_DUPTERM
|
||||||
|
|
|
@ -263,6 +263,16 @@ DRESULT disk_ioctl (
|
||||||
*((DWORD*)buff) = mp_obj_get_int(ret);
|
*((DWORD*)buff) = mp_obj_get_int(ret);
|
||||||
return RES_OK;
|
return RES_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case GET_SECTOR_SIZE: {
|
||||||
|
if (MP_STATE_PORT(fs_user_mount)->secsize[0] != MP_OBJ_NULL) {
|
||||||
|
mp_obj_t ret = mp_call_method_n_kw(0, 0, MP_STATE_PORT(fs_user_mount)->secsize);
|
||||||
|
*((DWORD*)buff) = mp_obj_get_int(ret);
|
||||||
|
return RES_OK;
|
||||||
|
}
|
||||||
|
*((DWORD*)buff) = 512;
|
||||||
|
return RES_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue