From e7db72538abad2098498fa84eee5abb111016cde Mon Sep 17 00:00:00 2001 From: aleph Date: Mon, 9 May 2011 10:56:26 +0000 Subject: [PATCH] mt29f nand: export formatting function and, if DEBUG active, function to create fake bad blocks. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4882 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cpu/cortex-m3/drv/mt29f_sam3.c | 15 ++++++++------- bertos/drv/mt29f.h | 7 ++++++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/bertos/cpu/cortex-m3/drv/mt29f_sam3.c b/bertos/cpu/cortex-m3/drv/mt29f_sam3.c index 30afed07..a8a3dcb5 100644 --- a/bertos/cpu/cortex-m3/drv/mt29f_sam3.c +++ b/bertos/cpu/cortex-m3/drv/mt29f_sam3.c @@ -624,14 +624,13 @@ static void initBlockMap(Mt29f *chip) } -#ifdef _DEBUG - -/* +/** * Reset bad blocks map and erase all blocks. - * DON'T USE on production chips: this function will try to erase - * factory marked bad blocks too. + * + * \note DON'T USE on production chips: this function will try to erase + * factory marked bad blocks too. */ -static void mt29f_wipe(Mt29f *chip) +void mt29f_format(Mt29f *chip) { int b; @@ -644,10 +643,12 @@ static void mt29f_wipe(Mt29f *chip) chip->remap_start = MT29F_NUM_USER_BLOCKS; } +#ifdef _DEBUG + /* * Create some bad blocks, erasing them and writing the bad block mark. */ -static void mt29f_ruinSomeBlocks(Mt29f *chip) +void mt29f_ruinSomeBlocks(Mt29f *chip) { int bads[] = { 7, 99, 555, 1003, 1004, 1432 }; unsigned i; diff --git a/bertos/drv/mt29f.h b/bertos/drv/mt29f.h index 6904a703..e2517994 100644 --- a/bertos/drv/mt29f.h +++ b/bertos/drv/mt29f.h @@ -95,9 +95,14 @@ struct Heap; bool mt29f_init(Mt29f *chip, struct Heap *heap, unsigned chip_select); bool mt29f_initUnbuffered(Mt29f *chip, struct Heap *heap, unsigned chip_select); -// Private functions: use at your own risk, could change in any moment +// NAND specific functions bool mt29f_getDevId(Mt29f *chip, uint8_t dev_id[5]); int mt29f_blockErase(Mt29f *chip, uint16_t block); +void mt29f_format(Mt29f *chip); + +#ifdef _DEBUG +void mt29f_ruinSomeBlocks(Mt29f *chip); +#endif #endif /* DRV_MT29F_H */ -- 2.25.1