|
52 | 52 | #define MP_BLOCKDEV_IOCTL_BLOCK_SIZE (5)
|
53 | 53 | #define MP_BLOCKDEV_IOCTL_BLOCK_ERASE (6)
|
54 | 54 |
|
| 55 | +// Constants for vfs.rom_ioctl() function. |
| 56 | +#define MP_VFS_ROM_IOCTL_GET_NUMBER_OF_SEGMENTS (1) // rom_ioctl(1) |
| 57 | +#define MP_VFS_ROM_IOCTL_GET_SEGMENT (2) // rom_ioctl(2, <id>) |
| 58 | +#define MP_VFS_ROM_IOCTL_WRITE_PREPARE (3) // rom_ioctl(3, <id>, <len>) |
| 59 | +#define MP_VFS_ROM_IOCTL_WRITE (4) // rom_ioctl(4, <id>, <offset>, <buf>) |
| 60 | +#define MP_VFS_ROM_IOCTL_WRITE_COMPLETE (5) // rom_ioctl(5, <id>) |
| 61 | + |
55 | 62 | // At the moment the VFS protocol just has import_stat, but could be extended to other methods
|
56 | 63 | typedef struct _mp_vfs_proto_t {
|
57 | 64 | mp_import_stat_t (*import_stat)(void *self, const char *path);
|
@@ -122,4 +129,12 @@ MP_DECLARE_CONST_FUN_OBJ_1(mp_vfs_rmdir_obj);
|
122 | 129 | MP_DECLARE_CONST_FUN_OBJ_1(mp_vfs_stat_obj);
|
123 | 130 | MP_DECLARE_CONST_FUN_OBJ_1(mp_vfs_statvfs_obj);
|
124 | 131 |
|
| 132 | +#if MICROPY_VFS_ROM_IOCTL |
| 133 | +// When MICROPY_VFS_ROM_IOCTL is enabled a port must define the following function. |
| 134 | +// This is a generic interface to allow querying and modifying the user-accessible, |
| 135 | +// read-only memory area of a device, if it is configured with such an area. |
| 136 | +// Supported ioctl commands are given by MP_VFS_ROM_IOCTL_xxx. |
| 137 | +mp_obj_t mp_vfs_rom_ioctl(size_t n_args, const mp_obj_t *args); |
| 138 | +#endif |
| 139 | + |
125 | 140 | #endif // MICROPY_INCLUDED_EXTMOD_VFS_H
|
0 commit comments