diff options
| author | Dan Halbert <halbert@halwitz.org> | 2018-07-13 22:51:10 -0400 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2018-07-13 22:51:10 -0400 |
| commit | e2e01efa84d2ed46d004edf48076e4701accc176 (patch) | |
| tree | 8c877ce226b6404b117990db92c9cfc93950df60 /extmod/vfs_fat.h | |
| parent | 0d27f4d9a66dcb47b545e715d1833094b0c7b484 (diff) | |
compiles and runs; hangs on import storage;storage.VfsFat.<tab>
Diffstat (limited to 'extmod/vfs_fat.h')
| -rw-r--r-- | extmod/vfs_fat.h | 25 |
1 files changed, 21 insertions, 4 deletions
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); |
