drivers/mtd: add MTD null driver support

- fix memory leak during RAM MTD initialization
- fix calculations for FILE MTD device with customized
  block and erase sizes

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko
2021-12-04 14:48:15 +02:00
committed by Xiang Xiao
parent 59786bf208
commit e71b66c792
7 changed files with 502 additions and 16 deletions
+16
View File
@@ -671,6 +671,22 @@ void filemtd_teardown(FAR struct mtd_dev_s *dev);
bool filemtd_isfilemtd(FAR struct mtd_dev_s *mtd);
/****************************************************************************
* Name: nullmtd_initialize
*
* Description:
* Create and initialize a MTD null device instance.
*
* Input Parameters:
* mtdlen - Total length of a size in bytes of the MTD null device
* sectsize - Sector size of the MTD null device
* erasesize - Erase block size of the MTD null device
*
****************************************************************************/
FAR struct mtd_dev_s *nullmtd_initialize(size_t mtdlen, int16_t sectsize,
int32_t erasesize);
#undef EXTERN
#ifdef __cplusplus
}