diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2011-12-06 14:01:55 +0000 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2011-12-06 14:01:55 +0000 |
commit | f41fb2b6b66aab395591cabdadbeb1a97c8ec59b (patch) | |
tree | 81ee1b1f031740164eada47cdddc81e0457e61a4 /c/src/lib/libbsp/arm/lpc32xx/include/nand-mlc.h | |
parent | 2011-12-06 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff) | |
download | rtems-f41fb2b6b66aab395591cabdadbeb1a97c8ec59b.tar.bz2 |
2011-12-06 Sebastian Huber <sebastian.huber@embedded-brains.de>
* misc/system-clocks.c: New file.
* Makefile.am: Reflect change from above.
* include/nand-mlc.h: Fixed lpc32xx_mlc_is_bad_page().
* make/custom/lpc32xx.inc, make/custom/lpc32xx_mzx_stage_1.cfg: Flags
for EABI tool chain.
* configure.ac, include/bsp.h, include/lpc32xx.h, misc/emc.c,
misc/i2c.c, rtc/rtc-config.c, startup/bspstarthooks.c: Avoid compile
time ARM_CLK and HCLK.
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libbsp/arm/lpc32xx/include/nand-mlc.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/c/src/lib/libbsp/arm/lpc32xx/include/nand-mlc.h b/c/src/lib/libbsp/arm/lpc32xx/include/nand-mlc.h index 61d035bb94..cc91a7956b 100644 --- a/c/src/lib/libbsp/arm/lpc32xx/include/nand-mlc.h +++ b/c/src/lib/libbsp/arm/lpc32xx/include/nand-mlc.h @@ -392,10 +392,25 @@ rtems_status_code lpc32xx_mlc_read_blocks( uint32_t page_buffer_1 [MLC_LARGE_DATA_WORD_COUNT] ); +/** + * @brief Checks if the page spare area indicates to a bad page. + * + * If the first (byte offset 0) or sixth (byte offset 5) byte of the spare area + * has a value other than 0xff, then it returns @true (the page is bad), else + * it returns @a false (the page is not bad). + * + * Samsung uses the sixth byte to indicate a bad page. Mircon uses the first + * and sixth byte to indicate a bad page. + * + * This functions works only for small page flashes. + */ static inline bool lpc32xx_mlc_is_bad_page(const uint32_t *spare) { - uint32_t valid_block_mask = 0xff00; - return (spare [1] & valid_block_mask) != valid_block_mask; + uint32_t first_byte_mask = 0x000000ff; + uint32_t sixth_byte_mask = 0x0000ff00; + + return (spare [0] & first_byte_mask) != first_byte_mask + || (spare [1] & sixth_byte_mask) != sixth_byte_mask; } /** @} */ |