From e2e01efa84d2ed46d004edf48076e4701accc176 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 13 Jul 2018 22:51:10 -0400 Subject: compiles and runs; hangs on import storage;storage.VfsFat. --- extmod/vfs_fat.h | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'extmod/vfs_fat.h') diff --git a/extmod/vfs_fat.h b/extmod/vfs_fat.h index 273ddc84e..3f46c278f 100644 --- a/extmod/vfs_fat.h +++ b/extmod/vfs_fat.h @@ -35,8 +35,9 @@ #define FSUSER_NATIVE (0x0001) // readblocks[2]/writeblocks[2] contain native func #define FSUSER_FREE_OBJ (0x0002) // fs_user_mount_t obj should be freed on umount #define FSUSER_HAVE_IOCTL (0x0004) // new protocol with ioctl +#define FSUSER_NO_FILESYSTEM (0x0008) // the block device has no filesystem on it // Device is writable over USB and read-only to MicroPython. -#define FSUSER_USB_WRITABLE (0x0008) +#define FSUSER_USB_WRITABLE (0x0010) typedef struct _fs_user_mount_t { mp_obj_base_t base; @@ -54,12 +55,28 @@ typedef struct _fs_user_mount_t { FATFS fatfs; } fs_user_mount_t; +typedef struct _pyb_file_obj_t { + mp_obj_base_t base; + FIL fp; +} pyb_file_obj_t; + + +// These should be general types (mpy TOOD says so). In micropython, these are defined in +// mpconfigport.h. +#define mp_type_fileio mp_type_vfs_fat_fileio +#define mp_type_textio mp_type_vfs_fat_textio + +extern const mp_obj_type_t mp_type_fileio; +extern const mp_obj_type_t mp_type_textio; + extern const byte fresult_to_errno_table[20]; extern const mp_obj_type_t mp_fat_vfs_type; +extern const mp_obj_type_t mp_type_vfs_fat_fileio; +extern const mp_obj_type_t mp_type_vfs_fat_textio; + +mp_import_stat_t fat_vfs_import_stat(void *vfs, const char *path); -mp_import_stat_t fat_vfs_import_stat(struct _fs_user_mount_t *vfs, const char *path); -mp_obj_t fatfs_builtin_open_self(mp_obj_t self_in, mp_obj_t path, mp_obj_t mode); -MP_DECLARE_CONST_FUN_OBJ_KW(mp_builtin_open_obj); +MP_DECLARE_CONST_FUN_OBJ_3(fat_vfs_open_obj); mp_obj_t fat_vfs_ilistdir2(struct _fs_user_mount_t *vfs, const char *path, bool is_str_type); -- cgit v1.2.3