3535#define FSUSER_NATIVE (0x0001) // readblocks[2]/writeblocks[2] contain native func
3636#define FSUSER_FREE_OBJ (0x0002) // fs_user_mount_t obj should be freed on umount
3737#define FSUSER_HAVE_IOCTL (0x0004) // new protocol with ioctl
38+ #define FSUSER_NO_FILESYSTEM (0x0008) // the block device has no filesystem on it
3839// Device is writable over USB and read-only to MicroPython.
39- #define FSUSER_USB_WRITABLE (0x0008 )
40+ #define FSUSER_USB_WRITABLE (0x0010 )
4041
4142typedef struct _fs_user_mount_t {
4243 mp_obj_base_t base ;
@@ -54,12 +55,28 @@ typedef struct _fs_user_mount_t {
5455 FATFS fatfs ;
5556} fs_user_mount_t ;
5657
58+ typedef struct _pyb_file_obj_t {
59+ mp_obj_base_t base ;
60+ FIL fp ;
61+ } pyb_file_obj_t ;
62+
63+
64+ // These should be general types (mpy TOOD says so). In micropython, these are defined in
65+ // mpconfigport.h.
66+ #define mp_type_fileio mp_type_vfs_fat_fileio
67+ #define mp_type_textio mp_type_vfs_fat_textio
68+
69+ extern const mp_obj_type_t mp_type_fileio ;
70+ extern const mp_obj_type_t mp_type_textio ;
71+
5772extern const byte fresult_to_errno_table [20 ];
5873extern const mp_obj_type_t mp_fat_vfs_type ;
74+ extern const mp_obj_type_t mp_type_vfs_fat_fileio ;
75+ extern const mp_obj_type_t mp_type_vfs_fat_textio ;
76+
77+ mp_import_stat_t fat_vfs_import_stat (void * vfs , const char * path );
5978
60- mp_import_stat_t fat_vfs_import_stat (struct _fs_user_mount_t * vfs , const char * path );
61- mp_obj_t fatfs_builtin_open_self (mp_obj_t self_in , mp_obj_t path , mp_obj_t mode );
62- MP_DECLARE_CONST_FUN_OBJ_KW (mp_builtin_open_obj );
79+ MP_DECLARE_CONST_FUN_OBJ_3 (fat_vfs_open_obj );
6380
6481mp_obj_t fat_vfs_ilistdir2 (struct _fs_user_mount_t * vfs , const char * path , bool is_str_type );
6582
0 commit comments