Move MTD ioctls commands from include/nuttx/fs/fs.h to include/nuttx/mtd/mtd.h. Add commands to protect and unprotect memory

This commit is contained in:
Gregory Nutt 2015-08-29 10:54:38 -06:00
parent 883c6a7cea
commit bfc3c98e12
3 changed files with 39 additions and 20 deletions

2
arch

@ -1 +1 @@
Subproject commit e6fdf9eb6a1e288e90a12eb3ee70a393ea30bec3
Subproject commit a26ed33fa4c164564b45b4f0905887fcf553f425

View File

@ -217,25 +217,6 @@
#define _MTDIOCVALID(c) (_IOC_TYPE(c)==_MTDIOCBASE)
#define _MTDIOC(nr) _IOC(_MTDIOCBASE,nr)
#define MTDIOC_GEOMETRY _MTDIOC(0x0001) /* IN: Pointer to write-able struct
* mtd_geometry_s in which to receive
* receive geometry data (see mtd.h)
* OUT: Geometry structure is populated
* with data for the MTD */
#define MTDIOC_XIPBASE _MTDIOC(0x0002) /* IN: Pointer to pointer to void in
* which to received the XIP base.
* OUT: If media is directly accessible,
* return (void*) base address
* of device memory */
#define MTDIOC_BULKERASE _MTDIOC(0x0003) /* IN: None
* OUT: None */
#define MTDIOC_SETSPEED _MTDIOC(0x0004) /* IN: New bus speed in Hz
* OUT: None */
#define MTDIOC_EXTENDED _MTDIOC(0x0005) /* IN: unsigned long
* 0=Use normal memory region
* 1=Use alternate/extended memory
* OUT: None */
/* NuttX ARP driver ioctl definitions (see netinet/arp.h) *******************/
#define _ARPIOCVALID(c) (_IOC_TYPE(c)==_ARPIOCBASE)

View File

@ -49,6 +49,34 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Ioctl commands */
#define MTDIOC_GEOMETRY _MTDIOC(0x0001) /* IN: Pointer to write-able struct
* mtd_geometry_s in which to receive
* receive geometry data (see mtd.h)
* OUT: Geometry structure is populated
* with data for the MTD */
#define MTDIOC_XIPBASE _MTDIOC(0x0002) /* IN: Pointer to pointer to void in
* which to received the XIP base.
* OUT: If media is directly accessible,
* return (void*) base address
* of device memory */
#define MTDIOC_BULKERASE _MTDIOC(0x0003) /* IN: None
* OUT: None */
#define MTDIOC_PROTECT _MTDIOC(0x0004) /* IN: Pointer to read-able struct
* mtd_protects_s that provides
* the region to protect.
* OUT: None */
#define MTDIOC_UNPROTECT _MTDIOC(0x0005) /* IN: Pointer to read-able struct
* mtd_protects_s that provides
* the region to un-protect.
* OUT: None */
#define MTDIOC_SETSPEED _MTDIOC(0x0006) /* IN: New bus speed in Hz
* OUT: None */
#define MTDIOC_EXTENDED _MTDIOC(0x0007) /* IN: unsigned long
* 0=Use normal memory region
* 1=Use alternate/extended memory
* OUT: None */
/* Macros to hide implementation */
@ -90,6 +118,16 @@ struct mtd_geometry_s
uint32_t neraseblocks; /* Number of erase blocks */
};
/* This structure describes a range of sectors to be protected or
* unprotected.
*/
struct mtd_protect_s
{
off_t startblock; /* First block to be [un-]protected */
size_t nblocks; /* Number of blocks to [un-]protect */
};
/* The following defines the information for writing bytes to a sector
* that are not a full page write (bytewrite).
*/