drivers/mtd/mtd/mtd_procfs/c and include/nuttx/mtd/mtd.h: Add an interface to un-regiser an MTD procfs entry.

drivers/mtd/filemtd.c:  New new MTD conversion layer that will convert a regular file (or driver file) to an MTD device.  This is useful for testing on the simulation using the hostfs.

From Ken Petit
This commit is contained in:
Ken Pettit
2015-11-25 14:46:28 -06:00
committed by Gregory Nutt
parent 9d1404e06d
commit d4a58af380
4 changed files with 665 additions and 1 deletions
+7 -1
View File
@@ -11152,4 +11152,10 @@
* drivers/lcd/ili9432.c: Fixed errors in orientation. Portrait,
RPortrait, and RLandscript should work correly now. They were
displayed mirrored. From Marco Krahl (2015-11-25).
* drivers/mtd/mtd/mtd_procfs/c and include/nuttx/mtd/mtd.h: Add an
interface to un-regiser an MTD procfs entry. From Ken Petit
(2015-11-25).
* drivers/mtd/filemtd.c: New new MTD conversion layer that will
convert a regular file (or driver file) to an MTD device. This is
useful for testing on the simulation using the hostfs. From Ken
Petit (2015-11-25).
File diff suppressed because it is too large Load Diff
+41
View File
@@ -363,4 +363,45 @@ int mtd_register(FAR struct mtd_dev_s *mtd, FAR const char *name)
return OK;
}
/****************************************************************************
* Name: mtd_unregister
*
* Description:
* Un-Registers an MTD device with the procfs file system.
*
* In an embedded system, this all is really unnecessary, but is provided
* in the procfs system simply for information purposes (if desired).
*
****************************************************************************/
int mtd_unregister(FAR struct mtd_dev_s *mtd)
{
FAR struct mtd_dev_s *plast;
/* Remove the MTD from the list of registered devices */
if (g_pfirstmtd == mtd)
{
g_pfirstmtd = mtd->pnext;
}
else
{
/* Remove from middle of list */
plast = g_pfirstmtd;
while (plast->pnext != mtd)
{
/* Skip to next entry as long as there is one */
plast = plast->pnext;
}
/* Now remove at this location */
plast->pnext = mtd->pnext;
}
return OK;
}
#endif /* !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_PROCFS */
+27
View File
@@ -524,6 +524,18 @@ FAR struct mtd_dev_s *s25fl1_initialize(FAR struct qspi_dev_s *qspi,
FAR struct mtd_dev_s *up_flashinitialize(void);
/****************************************************************************
* Name: up_flashinitialize
*
* Description:
* Create a file backed MTD device.
*
****************************************************************************/
FAR struct mtd_dev_s *filemtd_initialize(FAR const char *path, size_t offset);
void filemtd_teardown(FAR struct mtd_dev_s* mtd);
/****************************************************************************
* Name: mtd_register
*
@@ -541,6 +553,21 @@ FAR struct mtd_dev_s *up_flashinitialize(void);
int mtd_register(FAR struct mtd_dev_s *mtd, FAR const char *name);
#endif
/****************************************************************************
* Name: mtd_unregister
*
* Description:
* Un-registers an MTD device with the procfs file system.
*
* In an embedded system, this all is really unnecessary, but is provided
* in the procfs system simply for information purposes (if desired).
*
****************************************************************************/
#ifdef CONFIG_MTD_REGISTRATION
int mtd_unregister(FAR struct mtd_dev_s *mtd);
#endif
#undef EXTERN
#ifdef __cplusplus
}