mtd: Enable retrieval of MTD partition information
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
This commit is contained in:
parent
6f5d02fb91
commit
cddd9c9c38
@ -414,6 +414,25 @@ static int part_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MTDIOC_PARTINFO:
|
||||||
|
{
|
||||||
|
FAR struct partition_info_s *info =
|
||||||
|
(FAR struct partition_info_s *)arg;
|
||||||
|
if (info != NULL)
|
||||||
|
{
|
||||||
|
info->magic = 0;
|
||||||
|
info->numsectors = priv->neraseblocks * priv->blkpererase;
|
||||||
|
info->sectorsize = priv->blocksize;
|
||||||
|
info->startsector = priv->firstblock;
|
||||||
|
info->endsector = priv->firstblock + info->numsectors;
|
||||||
|
|
||||||
|
strncpy(info->parent, priv->parent->name, NAME_MAX);
|
||||||
|
|
||||||
|
ret = OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case MTDIOC_XIPBASE:
|
case MTDIOC_XIPBASE:
|
||||||
{
|
{
|
||||||
FAR void **ppv = (FAR void**)arg;
|
FAR void **ppv = (FAR void**)arg;
|
||||||
|
@ -74,6 +74,12 @@
|
|||||||
#define MTDIOC_ERASESTATE _MTDIOC(0x000a) /* IN: Pointer to uint8_t
|
#define MTDIOC_ERASESTATE _MTDIOC(0x000a) /* IN: Pointer to uint8_t
|
||||||
* OUT: Byte value that represents the
|
* OUT: Byte value that represents the
|
||||||
* erased state of the MTD cell */
|
* erased state of the MTD cell */
|
||||||
|
#define MTDIOC_PARTINFO _MTDIOC(0x000b) /* IN: Pointer to writable struct
|
||||||
|
* partition_info_s in which to
|
||||||
|
* receive partition information data
|
||||||
|
* OUT: Partition information structure
|
||||||
|
* populated with data from the MTD
|
||||||
|
* partition */
|
||||||
|
|
||||||
/* Macros to hide implementation */
|
/* Macros to hide implementation */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user