Last active
May 9, 2021 15:44
-
-
Save lhl2617/5d8624e039f924066888d186e7e87ad3 to your computer and use it in GitHub Desktop.
mtd-user.h ioctls with corresponding ioctl_linux functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Get basic MTD characteristics info (better to use sysfs) */ | |
// IoctlMemGetInfo | |
#define MEMGETINFO _IOR('M', 1, struct mtd_info_user) | |
/* Erase segment of MTD */ | |
// IoctlMemSetEraseInfo | |
#define MEMERASE _IOW('M', 2, struct erase_info_user) | |
/* Write out-of-band data from MTD */ | |
// IoctlMemReadOrWriteOOB | |
#define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf) | |
/* Read out-of-band data from MTD */ | |
// IoctlMemReadOrWriteOOB | |
#define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf) | |
/* Lock a chip (for MTD that supports it) */ | |
// IoctlMemSetEraseInfo | |
#define MEMLOCK _IOW('M', 5, struct erase_info_user) | |
/* Unlock a chip (for MTD that supports it) */ | |
// IoctlMemSetEraseInfo | |
#define MEMUNLOCK _IOW('M', 6, struct erase_info_user) | |
/* Get the number of different erase regions */ | |
// IoctlGetInt | |
#define MEMGETREGIONCOUNT _IOR('M', 7, int) | |
/* Get information about the erase region for a specific index */ | |
// IoctlMemGetRegionInfo | |
#define MEMGETREGIONINFO _IOWR('M', 8, struct region_info_user) | |
/* Get info about OOB modes (e.g., RAW, PLACE, AUTO) - legacy interface */ | |
// IoctlMemGetOOBSel | |
#define MEMGETOOBSEL _IOR('M', 10, struct nand_oobinfo) | |
/* Check if an eraseblock is bad */ | |
// IoctlMemGetOrSetBadBlock | |
#define MEMGETBADBLOCK _IOW('M', 11, __kernel_loff_t) | |
/* Mark an eraseblock as bad */ | |
// IoctlMemGetOrSetBadBlock | |
#define MEMSETBADBLOCK _IOW('M', 12, __kernel_loff_t) | |
/* Set OTP (One-Time Programmable) mode (factory vs. user) */ | |
// IoctlSetInt | |
#define OTPSELECT _IOR('M', 13, int) | |
/* Get number of OTP (One-Time Programmable) regions */ | |
// IoctlGetInt | |
#define OTPGETREGIONCOUNT _IOW('M', 14, int) | |
/* Get all OTP (One-Time Programmable) info about MTD */ | |
// IoctlOTPGetRegionInfo | |
#define OTPGETREGIONINFO _IOW('M', 15, struct otp_info) | |
/* Lock a given range of user data (must be in mode %MTD_FILE_MODE_OTP_USER) */ | |
// IoctlOTPLock | |
#define OTPLOCK _IOR('M', 16, struct otp_info) | |
/* Get ECC layout (deprecated) */ | |
// IoctlECCGetLayout | |
#define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout_user) | |
/* Get statistics about corrected/uncorrected errors */ | |
// IoctlECCGetStats | |
#define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats) | |
/* Set MTD mode on a per-file-descriptor basis (see "MTD file modes") */ | |
// IoctlRetInt | |
#define MTDFILEMODE _IO('M', 19) | |
/* Erase segment of MTD (supports 64-bit address) */ | |
// IoctlMemErase64 | |
#define MEMERASE64 _IOW('M', 20, struct erase_info_user64) | |
/* Write data to OOB (64-bit version) */ | |
// IoctlMemReadOrWriteOOB64 | |
#define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64) | |
/* Read data from OOB (64-bit version) */ | |
// IoctlMemReadOrWriteOOB64 | |
#define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64) | |
/* Check if chip is locked (for MTD that supports it) */ | |
// IoctlMemIsLocked | |
#define MEMISLOCKED _IOR('M', 23, struct erase_info_user) | |
/* | |
* Most generic write interface; can write in-band and/or out-of-band in various | |
* modes (see "struct mtd_write_req"). This ioctl is not supported for flashes | |
* without OOB, e.g., NOR flash. | |
*/ | |
// IoctlMemWrite | |
#define MEMWRITE _IOWR('M', 24, struct mtd_write_req) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment