mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 22:20:01 +08:00
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:
@@ -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
@@ -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 */
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user