<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2011-07-01)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-07-01 Stephan Hoffmann <sho@reLinux.de>
Sebastian Huber <sebastian.huber@embedded-brains.de>
* misc/nand-mlc-erase-block-safe.c: New file
* Makefile.am: Reflect change from above.
* misc/nand-mlc-write-blocks.c: Use lpc32xx_mlc_erase_block_safe_3().
* include/nand-mlc.h: Bad block handling.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc32xx/ChangeLog.diff?r1=text&tr1=1.33&r2=text&tr2=1.34&diff_format=h">M</a></td><td width='1%'>1.34</td><td width='100%'>c/src/lib/libbsp/arm/lpc32xx/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc32xx/Makefile.am.diff?r1=text&tr1=1.13&r2=text&tr2=1.14&diff_format=h">M</a></td><td width='1%'>1.14</td><td width='100%'>c/src/lib/libbsp/arm/lpc32xx/Makefile.am</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc32xx/include/nand-mlc.h.diff?r1=text&tr1=1.3&r2=text&tr2=1.4&diff_format=h">M</a></td><td width='1%'>1.4</td><td width='100%'>c/src/lib/libbsp/arm/lpc32xx/include/nand-mlc.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc32xx/misc/nand-mlc-erase-block-safe.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">c/src/lib/libbsp/arm/lpc32xx/misc/nand-mlc-erase-block-safe.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc32xx/misc/nand-mlc-write-blocks.c.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>c/src/lib/libbsp/arm/lpc32xx/misc/nand-mlc-write-blocks.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc32xx/ChangeLog:1.33 rtems/c/src/lib/libbsp/arm/lpc32xx/ChangeLog:1.34
--- rtems/c/src/lib/libbsp/arm/lpc32xx/ChangeLog:1.33 Sun Jun 19 05:34:09 2011
+++ rtems/c/src/lib/libbsp/arm/lpc32xx/ChangeLog Fri Jul 1 08:05:06 2011
</font><font color='#997700'>@@ -1,3 +1,11 @@
</font><font color='#000088'>+2011-07-01 Stephan Hoffmann <sho@reLinux.de>
+ Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * misc/nand-mlc-erase-block-safe.c: New file
+ * Makefile.am: Reflect change from above.
+ * misc/nand-mlc-write-blocks.c: Use lpc32xx_mlc_erase_block_safe_3().
+ * include/nand-mlc.h: Bad block handling.
+
</font> 2011-06-19 Ralf Corsépius <ralf.corsepius@rtems.org>
* Makefile.am: Fix broken path to cache_.h.
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc32xx/Makefile.am:1.13 rtems/c/src/lib/libbsp/arm/lpc32xx/Makefile.am:1.14
--- rtems/c/src/lib/libbsp/arm/lpc32xx/Makefile.am:1.13 Sun Jun 19 05:34:09 2011
+++ rtems/c/src/lib/libbsp/arm/lpc32xx/Makefile.am Fri Jul 1 08:05:06 2011
</font><font color='#997700'>@@ -125,6 +125,7 @@
</font> misc/nand-mlc.c \
misc/nand-mlc-read-blocks.c \
misc/nand-mlc-write-blocks.c \
<font color='#000088'>+ misc/nand-mlc-erase-block-safe.c \
</font> misc/restart.c \
misc/boot.c \
misc/emc.c \
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc32xx/include/nand-mlc.h:1.3 rtems/c/src/lib/libbsp/arm/lpc32xx/include/nand-mlc.h:1.4
--- rtems/c/src/lib/libbsp/arm/lpc32xx/include/nand-mlc.h:1.3 Mon Mar 28 04:00:00 2011
+++ rtems/c/src/lib/libbsp/arm/lpc32xx/include/nand-mlc.h Fri Jul 1 08:05:06 2011
</font><font color='#997700'>@@ -7,12 +7,15 @@
</font> */
/*
<font color='#880000'>- * Copyright (c) 2010
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
</font><font color='#000088'>+ * Copyright (c) 2010-2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * Copyright (c) 2011 Stephan Hoffmann <sho@reLinux.de>
</font> *
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
<font color='#997700'>@@ -166,6 +169,19 @@
</font> #define MLC_BAD_BLOCK_MASK ((uint32_t) 0xff00)
/**
<font color='#000088'>+ * @brief Bad block mark.
+ *<span style="background-color: #FF0000"> </span>
+ * We define our own bad block mark to be able to recognize the blocks that
+ * have been marked bad during operation later.
+ */
+#define MLC_BAD_BLOCK_MARK ((uint32_t) 0xbadb)
+
+/**
+ * @brief The bytes 4 and 5 are reserved for bad block handling.
+ */
+#define MLC_RESERVED ((uint32_t) 0xffff)
+
+/**
</font> * @name NAND Status Register
*
* @{
<font color='#997700'>@@ -253,6 +269,32 @@
</font> rtems_status_code lpc32xx_mlc_erase_block(uint32_t block_index);
/**
<font color='#000088'>+ * @brief Erases the block with index @a block_index.
+ *
+ * In case of an erase error all pages and the spare areas of this block are
+ * programmed with zero values. This will mark the first and second page as
+ * bad.
+ *
+ * @retval RTEMS_SUCCESSFUL Successful operation.
+ * @retval RTEMS_INCORRECT_STATE The first or second page of this block is bad.
+ * @retval RTEMS_INVALID_ID Invalid @a block_index value.
+ * @retval RTEMS_IO_ERROR Erase error.
+ */
+rtems_status_code lpc32xx_mlc_erase_block_safe(uint32_t block_index);
+
+/**
+ * @brief Erases the block with index @a block_index.
+ *
+ * Variant of lpc32xx_mlc_erase_block_safe() with more parameters for
+ * efficiency reasons.
+ */
+rtems_status_code lpc32xx_mlc_erase_block_safe_3(
+ uint32_t block_index,
+ uint32_t first_page_of_block,
+ uint32_t pages_per_block
+);
+
+/**
</font> * @brief Writes the page with index @a page_index.
*
* 32-bit writes will be performed.
<font color='#997700'>@@ -278,7 +320,7 @@
</font> *
* @retval RTEMS_SUCCESSFUL Successful operation.
* @retval RTEMS_INVALID_ID Invalid @a block_begin or @a block_end value.
<font color='#880000'>- * @retval RTEMS_IO_ERROR To many bad blocks or source area to big.
</font><font color='#000088'>+ * @retval RTEMS_IO_ERROR Too many bad blocks or source area too big.
</font> */
rtems_status_code lpc32xx_mlc_write_blocks(
uint32_t block_begin,
<font color='#997700'>@@ -328,6 +370,16 @@
</font> return (spare [1] & MLC_BAD_BLOCK_MASK) != MLC_BAD_BLOCK_MASK;
}
<font color='#000088'>+static inline void lpc32xx_mlc_set_bad_page(uint32_t *spare)
+{
+ spare [1] = MLC_BAD_BLOCK_MARK;
+}
+
+static inline void lpc32xx_mlc_set_reserved(uint32_t *spare)
+{
+ spare [1] = MLC_RESERVED;
+}
+
</font> /** @} */
#ifdef __cplusplus
<font color='#006600'>diff -u /dev/null rtems/c/src/lib/libbsp/arm/lpc32xx/misc/nand-mlc-erase-block-safe.c:1.1
--- /dev/null Fri Jul 1 08:10:59 2011
+++ rtems/c/src/lib/libbsp/arm/lpc32xx/misc/nand-mlc-erase-block-safe.c Fri Jul 1 08:05:06 2011
</font><font color='#997700'>@@ -0,0 +1,94 @@
</font><font color='#000088'>+/**
+ * @file
+ *
+ * @ingroup lpc32xx_nand_mlc
+ *
+ * @brief lpc32xx_mlc_erase_block_safe() and lpc32xx_mlc_erase_block_safe_3()
+ * implementation.
+ */
+
+/*
+ * Copyright (c) 2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#include <bsp/nand-mlc.h>
+
+#include <string.h>
+
+#include <bsp.h>
+
+static void zero_block(uint32_t first_page_of_block, uint32_t pages_per_block)
+{
+ uint32_t page = 0;
+
+ for (page = 0; page < pages_per_block; ++page) {
+ lpc32xx_mlc_write_page_with_ecc(
+ first_page_of_block + page,
+ lpc32xx_magic_zero_begin,
+ lpc32xx_magic_zero_begin
+ );
+ }
+}
+
+static bool is_bad_page(
+ uint32_t first_page_of_block,
+ uint32_t page
+)
+{
+ uint32_t spare [MLC_LARGE_SPARE_WORD_COUNT];
+
+ memset(spare, 0, MLC_LARGE_SPARE_SIZE);
+ lpc32xx_mlc_read_page(
+ first_page_of_block + page,
+ lpc32xx_magic_zero_begin,
+ spare
+ );
+ return lpc32xx_mlc_is_bad_page(spare);
+}
+
+rtems_status_code lpc32xx_mlc_erase_block_safe_3(
+ uint32_t block_index,
+ uint32_t first_page_of_block,
+ uint32_t pages_per_block
+)
+{
+ rtems_status_code sc = RTEMS_SUCCESSFUL;
+
+ if (is_bad_page(first_page_of_block, 0)) {
+ return RTEMS_INCORRECT_STATE;
+ }
+
+ if (is_bad_page(first_page_of_block, 1)) {
+ return RTEMS_INCORRECT_STATE;
+ }
+
+ sc = lpc32xx_mlc_erase_block(block_index);
+ if (sc != RTEMS_SUCCESSFUL) {
+ zero_block(first_page_of_block, pages_per_block);
+
+ return RTEMS_IO_ERROR;
+ }
+
+ return RTEMS_SUCCESSFUL;
+}
+
+rtems_status_code lpc32xx_mlc_erase_block_safe(uint32_t block_index)
+{
+ uint32_t pages_per_block = lpc32xx_mlc_pages_per_block();
+
+ return lpc32xx_mlc_erase_block_safe_3(
+ block_index,
+ block_index * pages_per_block,
+ pages_per_block
+ );
+}
</font>
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc32xx/misc/nand-mlc-write-blocks.c:1.1 rtems/c/src/lib/libbsp/arm/lpc32xx/misc/nand-mlc-write-blocks.c:1.2
--- rtems/c/src/lib/libbsp/arm/lpc32xx/misc/nand-mlc-write-blocks.c:1.1 Wed Jun 23 03:27:57 2010
+++ rtems/c/src/lib/libbsp/arm/lpc32xx/misc/nand-mlc-write-blocks.c Fri Jul 1 08:05:06 2011
</font><font color='#997700'>@@ -7,12 +7,13 @@
</font> */
/*
<font color='#880000'>- * Copyright (c) 2010
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
</font><font color='#000088'>+ * Copyright (c) 2010-2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
</font> *
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
<font color='#997700'>@@ -21,10 +22,6 @@
</font>
#include <bsp/nand-mlc.h>
<font color='#880000'>-#include <string.h>
-
-#include <bsp.h>
-
</font> static const uint32_t ones_spare [MLC_LARGE_SPARE_WORD_COUNT] = {
0xffffffff,
0xffffffff,
<font color='#997700'>@@ -44,61 +41,6 @@
</font> 0xffffffff
};
<font color='#880000'>-static void zero_block(uint32_t first_page_of_block, uint32_t pages_per_block)
-{
- uint32_t page = 0;
-
- for (page = 0; page < pages_per_block; ++page) {
- lpc32xx_mlc_write_page_with_ecc(
- first_page_of_block + page,
- lpc32xx_magic_zero_begin,
- lpc32xx_magic_zero_begin
- );
- }
-}
-
-static bool is_bad_page(
- uint32_t first_page_of_block,
- uint32_t page
-)
-{
- uint32_t spare [MLC_LARGE_SPARE_WORD_COUNT];
-
- memset(spare, 0, MLC_LARGE_SPARE_SIZE);
- lpc32xx_mlc_read_page(
- first_page_of_block + page,
- lpc32xx_magic_zero_begin,
- spare
- );
- return lpc32xx_mlc_is_bad_page(spare);
-}
-
-static rtems_status_code erase_block(
- uint32_t block,
- uint32_t first_page_of_block,
- uint32_t pages_per_block
-)
-{
- rtems_status_code sc = RTEMS_SUCCESSFUL;
-
- if (is_bad_page(first_page_of_block, 0)) {
- return RTEMS_IO_ERROR;
- }
-
- if (is_bad_page(first_page_of_block, 1)) {
- return RTEMS_IO_ERROR;
- }
-
- sc = lpc32xx_mlc_erase_block(block);
- if (sc != RTEMS_SUCCESSFUL) {
- zero_block(first_page_of_block, pages_per_block);
-
- return RTEMS_IO_ERROR;
- }
-
- return RTEMS_SUCCESSFUL;
-}
-
</font> rtems_status_code lpc32xx_mlc_write_blocks(
uint32_t block_begin,
uint32_t block_end,
<font color='#997700'>@@ -124,7 +66,11 @@
</font> uint32_t first_page_of_block = block * pages_per_block;
uint32_t page = 0;
<font color='#880000'>- sc = erase_block(block, first_page_of_block, pages_per_block);
</font><font color='#000088'>+ sc = lpc32xx_mlc_erase_block_safe_3(
+ block,
+ first_page_of_block,
+ pages_per_block
+ );
</font> if (sc != RTEMS_SUCCESSFUL) {
continue;
}
</pre>
<p> </p>
<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>