summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-27 16:24:45 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-27 16:24:45 +0000
commit68a797def39476f4cfe5764a364bba719d85a797 (patch)
treefebbd6f10aed6cdfebfeb85c3dc309ad2d745153
parent6831c49a517bfe90b75a732b1d39ce303960c023 (diff)
downloadnuttx-68a797def39476f4cfe5764a364bba719d85a797.tar.gz
nuttx-68a797def39476f4cfe5764a364bba719d85a797.tar.bz2
nuttx-68a797def39476f4cfe5764a364bba719d85a797.zip
Fixes to get SDRAM working on the Open1788. Works but is not reliable
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5794 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--apps/system/ramtest/ramtest.c181
-rw-r--r--nuttx/configs/open1788/README.txt1
-rw-r--r--nuttx/configs/open1788/include/board.h4
-rw-r--r--nuttx/configs/open1788/src/Makefile6
-rw-r--r--nuttx/configs/open1788/src/lpc17_boardinitialize.c6
-rw-r--r--nuttx/configs/open1788/src/lpc17_nandinitialize.c4
-rw-r--r--nuttx/configs/open1788/src/lpc17_norinitialize.c4
-rw-r--r--nuttx/configs/open1788/src/lpc17_sdraminitialize.c13
-rw-r--r--nuttx/configs/open1788/src/open1788.h6
-rw-r--r--nuttx/libc/string/lib_strtoul.c1
10 files changed, 165 insertions, 61 deletions
diff --git a/apps/system/ramtest/ramtest.c b/apps/system/ramtest/ramtest.c
index 378a9a333..fb3519a13 100644
--- a/apps/system/ramtest/ramtest.c
+++ b/apps/system/ramtest/ramtest.c
@@ -70,6 +70,7 @@ struct ramtest_s
uint8_t width;
uintptr_t start;
size_t size;
+ size_t nxfrs;
uint32_t mask;
};
@@ -81,19 +82,28 @@ struct ramtest_s
* Private Functions
****************************************************************************/
+/****************************************************************************
+ * Name: show_usage
+ ****************************************************************************/
+
static void show_usage(FAR const char *progname, int exitcode)
{
printf("\nUsage: %s [-w|h|b] <hex-address> <decimal-size>\n", progname);
printf("\nWhere:\n");
printf(" <hex-address> starting address of the test.\n");
- printf(" <decimal-size> number of memory locations.\n");
+ printf(" <decimal-size> number of memory locations (in bytes).\n");
printf(" -w Sets the width of a memory location to 32-bits.\n");
printf(" -h Sets the width of a memory location to 16-bits (default).\n");
printf(" -b Sets the width of a memory location to 8-bits.\n");
exit(exitcode);
}
-static void parse_commandline(int argc, char **argv, FAR struct ramtest_s *info)
+/****************************************************************************
+ * Name: parse_commandline
+ ****************************************************************************/
+
+static void parse_commandline(int argc, char **argv,
+ FAR struct ramtest_s *info)
{
FAR char *ptr;
int option;
@@ -131,14 +141,14 @@ static void parse_commandline(int argc, char **argv, FAR struct ramtest_s *info)
}
info->start = (uintptr_t)strtoul(argv[optind], &ptr, 16);
- if (*ptr != '\0');
+ if (*ptr != '\0')
{
- printf(RAMTEST_PREFIX "Invalid <hex-address>\n");
+ printf(RAMTEST_PREFIX "Invalid <hex-address>: %s->%lx [%02x]\n",
+ argv[optind], info->start, *ptr);
show_usage(argv[0], EXIT_FAILURE);
}
optind++;
-
if (optind >= argc)
{
printf(RAMTEST_PREFIX "Missing <decimal-size>\n");
@@ -146,12 +156,32 @@ static void parse_commandline(int argc, char **argv, FAR struct ramtest_s *info)
}
info->size = (size_t)strtoul(argv[optind], &ptr, 10);
- if (*ptr != '\0');
+ if (*ptr != '\0')
{
- printf(RAMTEST_PREFIX "Invalid <decimal-size>\n");
+ printf(RAMTEST_PREFIX "Invalid <decimal-size>: %s->%lx [%02x]\n",
+ argv[optind], info->size, *ptr);
show_usage(argv[0], EXIT_FAILURE);
}
+ /* Convert the size (in bytes) to the corresponding number of transfers
+ * of the selected width.
+ */
+
+ if (info->width == 8)
+ {
+ info->nxfrs = info->size;
+ }
+ else if (info->width == 32)
+ {
+ info->nxfrs = info->size >> 2;
+ }
+ else
+ {
+ info->width = 16;
+ info->nxfrs = info->size >> 1;
+ }
+
+ optind++;
if (optind != argc)
{
printf(RAMTEST_PREFIX "Too many arguments\n");
@@ -159,6 +189,10 @@ static void parse_commandline(int argc, char **argv, FAR struct ramtest_s *info)
}
}
+/****************************************************************************
+ * Name: write_memory
+ ****************************************************************************/
+
static void write_memory(FAR struct ramtest_s *info, uint32_t value)
{
size_t i;
@@ -166,7 +200,7 @@ static void write_memory(FAR struct ramtest_s *info, uint32_t value)
if (info->width == 32)
{
uint32_t *ptr = (uint32_t*)info->start;
- for (i = 0; i < info->size; i++)
+ for (i = 0; i < info->nxfrs; i++)
{
*ptr++ = value;
}
@@ -174,7 +208,7 @@ static void write_memory(FAR struct ramtest_s *info, uint32_t value)
else if (info->width == 16)
{
uint16_t *ptr = (uint16_t*)info->start;
- for (i = 0; i < info->size; i++)
+ for (i = 0; i < info->nxfrs; i++)
{
*ptr++ = (uint16_t)value;
}
@@ -182,13 +216,17 @@ static void write_memory(FAR struct ramtest_s *info, uint32_t value)
else /* if (info->width == 8) */
{
uint8_t *ptr = (uint8_t*)info->start;
- for (i = 0; i < info->size; i++)
+ for (i = 0; i < info->nxfrs; i++)
{
*ptr++ = (uint8_t)value;
}
}
}
+/****************************************************************************
+ * Name: verify_memory
+ ****************************************************************************/
+
static void verify_memory(FAR struct ramtest_s *info, uint32_t value)
{
size_t i;
@@ -196,11 +234,12 @@ static void verify_memory(FAR struct ramtest_s *info, uint32_t value)
if (info->width == 32)
{
uint32_t *ptr = (uint32_t*)info->start;
- for (i = 0; i < info->size; i++)
+ for (i = 0; i < info->nxfrs; i++)
{
if (*ptr != value)
{
- printf(RAMTEST_PREFIX "ERROR: Address %p Found: %08x Expected %08x\n",
+ printf(RAMTEST_PREFIX
+ "ERROR: Address %p Found: %08x Expected %08x\n",
ptr, *ptr, value);
}
@@ -211,11 +250,12 @@ static void verify_memory(FAR struct ramtest_s *info, uint32_t value)
{
uint16_t value16 = (uint16_t)(value & 0x0000ffff);
uint16_t *ptr = (uint16_t*)info->start;
- for (i = 0; i < info->size; i++)
+ for (i = 0; i < info->nxfrs; i++)
{
if (*ptr != value16)
{
- printf(RAMTEST_PREFIX "ERROR: Address %p Found: %04x Expected %04x\n",
+ printf(RAMTEST_PREFIX
+ "ERROR: Address %p Found: %04x Expected %04x\n",
ptr, *ptr, value16);
}
@@ -226,11 +266,12 @@ static void verify_memory(FAR struct ramtest_s *info, uint32_t value)
{
uint8_t value8 = (uint8_t)(value & 0x000000ff);
uint8_t *ptr = (uint8_t*)info->start;
- for (i = 0; i < info->size; i++)
+ for (i = 0; i < info->nxfrs; i++)
{
if (*ptr != value8)
{
- printf(RAMTEST_PREFIX "ERROR: Address %p Found: %02x Expected %02x\n",
+ printf(RAMTEST_PREFIX
+ "ERROR: Address %p Found: %02x Expected %02x\n",
ptr, *ptr, value8);
}
@@ -239,10 +280,17 @@ static void verify_memory(FAR struct ramtest_s *info, uint32_t value)
}
}
+/****************************************************************************
+ * Name: marching_ones
+ ****************************************************************************/
+
static void marching_ones(FAR struct ramtest_s *info)
{
uint32_t pattern = 0x00000001;
+ printf(RAMTEST_PREFIX "Marching ones: %08x %d\n",
+ info->start, info->size);
+
while (pattern != 0)
{
write_memory(info, pattern);
@@ -252,10 +300,17 @@ static void marching_ones(FAR struct ramtest_s *info)
}
}
+/****************************************************************************
+ * Name: marching_zeros
+ ****************************************************************************/
+
static void marching_zeros(FAR struct ramtest_s *info)
{
uint32_t pattern = 0xfffffffe;
+ printf(RAMTEST_PREFIX "Marching zeroes: %08x %d\n",
+ info->start, info->size);
+
while (pattern != 0xffffffff)
{
write_memory(info, pattern);
@@ -266,15 +321,20 @@ static void marching_zeros(FAR struct ramtest_s *info)
}
}
-static void write_memory2(FAR struct ramtest_s *info, uint32_t value_1, uint32_t value_2)
+/****************************************************************************
+ * Name: write_memory2
+ ****************************************************************************/
+
+static void write_memory2(FAR struct ramtest_s *info, uint32_t value_1,
+ uint32_t value_2)
{
- size_t even_size = info->size & ~1;
+ size_t even_nxfrs = info->nxfrs & ~1;
size_t i;
if (info->width == 32)
{
uint32_t *ptr = (uint32_t*)info->start;
- for (i = 0; i < even_size; i += 2)
+ for (i = 0; i < even_nxfrs; i += 2)
{
*ptr++ = value_1;
*ptr++ = value_2;
@@ -283,7 +343,7 @@ static void write_memory2(FAR struct ramtest_s *info, uint32_t value_1, uint32_t
else if (info->width == 16)
{
uint16_t *ptr = (uint16_t*)info->start;
- for (i = 0; i < even_size; i += 2)
+ for (i = 0; i < even_nxfrs; i += 2)
{
*ptr++ = (uint16_t)value_1;
*ptr++ = (uint16_t)value_2;
@@ -292,7 +352,7 @@ static void write_memory2(FAR struct ramtest_s *info, uint32_t value_1, uint32_t
else /* if (info->width == 8) */
{
uint8_t *ptr = (uint8_t*)info->start;
- for (i = 0; i < even_size; i += 2)
+ for (i = 0; i < even_nxfrs; i += 2)
{
*ptr++ = (uint8_t)value_1;
*ptr++ = (uint8_t)value_2;
@@ -300,21 +360,28 @@ static void write_memory2(FAR struct ramtest_s *info, uint32_t value_1, uint32_t
}
}
-static void verify_memory2(FAR struct ramtest_s *info, uint32_t value_1, uint32_t value_2)
+/****************************************************************************
+ * Name: verify_memory2
+ ****************************************************************************/
+
+static void verify_memory2(FAR struct ramtest_s *info, uint32_t value_1,
+ uint32_t value_2)
{
- size_t even_size = info->size & ~1;
+ size_t even_nxfrs = info->nxfrs & ~1;
size_t i;
if (info->width == 32)
{
uint32_t *ptr = (uint32_t*)info->start;
- for (i = 0; i < even_size; i += 2)
+ for (i = 0; i < even_nxfrs; i += 2)
{
if (ptr[0] != value_1 || ptr[1] != value_2)
{
- printf(RAMTEST_PREFIX "ERROR: Address %p Found: %08x and %08x\n",
+ printf(RAMTEST_PREFIX
+ "ERROR: Address %p Found: %08x and %08x\n",
ptr, ptr[0], ptr[1]);
- printf(RAMTEST_PREFIX " Expected: %08x and %08x\n",
+ printf(RAMTEST_PREFIX
+ " Expected: %08x and %08x\n",
value_1, value_2);
}
@@ -326,13 +393,15 @@ static void verify_memory2(FAR struct ramtest_s *info, uint32_t value_1, uint32_
uint16_t value16_1 = (uint16_t)(value_1 & 0x0000ffff);
uint16_t value16_2 = (uint16_t)(value_2 & 0x0000ffff);
uint16_t *ptr = (uint16_t*)info->start;
- for (i = 0; i < even_size; i += 2)
+ for (i = 0; i < even_nxfrs; i += 2)
{
if (ptr[0] != value16_1 || ptr[1] != value16_2)
{
- printf(RAMTEST_PREFIX "ERROR: Address %p Found: %04x and %04x\n",
+ printf(RAMTEST_PREFIX
+ "ERROR: Address %p Found: %04x and %04x\n",
ptr, ptr[0], ptr[1]);
- printf(RAMTEST_PREFIX " Expected: %04x and %04x\n",
+ printf(RAMTEST_PREFIX
+ " Expected: %04x and %04x\n",
value16_1, value16_2);
}
@@ -344,13 +413,15 @@ static void verify_memory2(FAR struct ramtest_s *info, uint32_t value_1, uint32_
uint8_t value8_1 = (uint8_t)(value_1 & 0x000000ff);
uint8_t value8_2 = (uint8_t)(value_2 & 0x000000ff);
uint8_t *ptr = (uint8_t*)info->start;
- for (i = 0; i < even_size; i += 2)
+ for (i = 0; i < even_nxfrs; i += 2)
{
if (ptr[0] != value8_1 || ptr[1] != value8_2)
{
- printf(RAMTEST_PREFIX "ERROR: Address %p Found: %02x and %02x\n",
+ printf(RAMTEST_PREFIX
+ "ERROR: Address %p Found: %02x and %02x\n",
ptr, ptr[0], ptr[1]);
- printf(RAMTEST_PREFIX " Expected: %02x and %02x\n",
+ printf(RAMTEST_PREFIX
+ " Expected: %02x and %02x\n",
value8_1, value8_2);
}
@@ -359,12 +430,24 @@ static void verify_memory2(FAR struct ramtest_s *info, uint32_t value_1, uint32_
}
}
-static void pattern_test(FAR struct ramtest_s *info, uint32_t pattern1, uint32_t pattern2)
+/****************************************************************************
+ * Name: pattern_test
+ ****************************************************************************/
+
+static void pattern_test(FAR struct ramtest_s *info, uint32_t pattern1,
+ uint32_t pattern2)
{
+ printf(RAMTEST_PREFIX "Pattern test: %08x %d %08x %08x\n",
+ info->start, info->size, pattern1, pattern2);
+
write_memory2(info, pattern1, pattern2);
verify_memory2(info, pattern1, pattern2);
}
+/****************************************************************************
+ * Name: write_addrinaddr
+ ****************************************************************************/
+
static void write_addrinaddr(FAR struct ramtest_s *info)
{
size_t i;
@@ -372,7 +455,7 @@ static void write_addrinaddr(FAR struct ramtest_s *info)
if (info->width == 32)
{
uint32_t *ptr = (uint32_t*)info->start;
- for (i = 0; i < info->size; i++)
+ for (i = 0; i < info->nxfrs; i++)
{
uint32_t value32 = (uint32_t)((uintptr_t)ptr);
*ptr++ = value32;
@@ -381,7 +464,7 @@ static void write_addrinaddr(FAR struct ramtest_s *info)
else if (info->width == 16)
{
uint16_t *ptr = (uint16_t*)info->start;
- for (i = 0; i < info->size; i++)
+ for (i = 0; i < info->nxfrs; i++)
{
uint16_t value16 = (uint16_t)((uintptr_t)ptr & 0x0000ffff);
*ptr++ = value16;
@@ -390,7 +473,7 @@ static void write_addrinaddr(FAR struct ramtest_s *info)
else /* if (info->width == 8) */
{
uint8_t *ptr = (uint8_t*)info->start;
- for (i = 0; i < info->size; i++)
+ for (i = 0; i < info->nxfrs; i++)
{
uint8_t value8 = (uint8_t)((uintptr_t)ptr & 0x000000ff);
*ptr++ = value8;
@@ -398,6 +481,10 @@ static void write_addrinaddr(FAR struct ramtest_s *info)
}
}
+/****************************************************************************
+ * Name: verify_addrinaddr
+ ****************************************************************************/
+
static void verify_addrinaddr(FAR struct ramtest_s *info)
{
size_t i;
@@ -405,12 +492,13 @@ static void verify_addrinaddr(FAR struct ramtest_s *info)
if (info->width == 32)
{
uint32_t *ptr = (uint32_t*)info->start;
- for (i = 0; i < info->size; i++)
+ for (i = 0; i < info->nxfrs; i++)
{
uint32_t value32 = (uint32_t)((uintptr_t)ptr);
if (*ptr != value32)
{
- printf(RAMTEST_PREFIX "ERROR: Address %p Found: %08x Expected %08x\n",
+ printf(RAMTEST_PREFIX
+ "ERROR: Address %p Found: %08x Expected %08x\n",
ptr, *ptr, value32);
}
@@ -420,12 +508,13 @@ static void verify_addrinaddr(FAR struct ramtest_s *info)
else if (info->width == 16)
{
uint16_t *ptr = (uint16_t*)info->start;
- for (i = 0; i < info->size; i++)
+ for (i = 0; i < info->nxfrs; i++)
{
uint16_t value16 = (uint16_t)((uintptr_t)ptr & 0x0000ffff);
if (*ptr != value16)
{
- printf(RAMTEST_PREFIX "ERROR: Address %p Found: %04x Expected %04x\n",
+ printf(RAMTEST_PREFIX
+ "ERROR: Address %p Found: %04x Expected %04x\n",
ptr, *ptr, value16);
}
@@ -435,12 +524,13 @@ static void verify_addrinaddr(FAR struct ramtest_s *info)
else /* if (info->width == 8) */
{
uint8_t *ptr = (uint8_t*)info->start;
- for (i = 0; i < info->size; i++)
+ for (i = 0; i < info->nxfrs; i++)
{
uint16_t value8 = (uint8_t)((uintptr_t)ptr & 0x000000ff);
if (*ptr != value8)
{
- printf(RAMTEST_PREFIX "ERROR: Address %p Found: %02x Expected %02x\n",
+ printf(RAMTEST_PREFIX
+ "ERROR: Address %p Found: %02x Expected %02x\n",
ptr, *ptr, value8);
}
@@ -449,8 +539,15 @@ static void verify_addrinaddr(FAR struct ramtest_s *info)
}
}
+/****************************************************************************
+ * Name: addr_in_addr
+ ****************************************************************************/
+
static void addr_in_addr(FAR struct ramtest_s *info)
{
+ printf(RAMTEST_PREFIX "Address-in-address test: %08x %d\n",
+ info->start, info->size);
+
write_addrinaddr(info);
verify_addrinaddr(info);
}
diff --git a/nuttx/configs/open1788/README.txt b/nuttx/configs/open1788/README.txt
index 999bc1070..dc113aa4e 100644
--- a/nuttx/configs/open1788/README.txt
+++ b/nuttx/configs/open1788/README.txt
@@ -427,3 +427,4 @@ CONFIGURATION
not excessible to the applications. So the RAM test can be
freely executed against the SRAM memory beginning at address
0xa000:0000 (CS0).
+
diff --git a/nuttx/configs/open1788/include/board.h b/nuttx/configs/open1788/include/board.h
index 819a314ca..369d08eba 100644
--- a/nuttx/configs/open1788/include/board.h
+++ b/nuttx/configs/open1788/include/board.h
@@ -197,7 +197,8 @@
* Needed for NAND and SDRAM: {17,1,2,1}
*/
-#if defined(CONFIG_LPC17_EMC_NAND) || defined(CONFIG_LPC17_EMC_SDRAM)
+#ifdef CONFIG_LPC17_EMC
+#if defined(CONFIG_ARCH_EXTNAND) || defined(CONFIG_ARCH_EXTDRAM)
# define BOARD_CMDDLY 17
# define BOARD_FBCLKDLY 17
# define BOARD_CLKOUT0DLY 1
@@ -208,6 +209,7 @@
# define BOARD_CLKOUT0DLY 1
# define BOARD_CLKOUT1DLY 1
#endif
+#endif
/* LED definitions ******************************************************************/
/* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in
diff --git a/nuttx/configs/open1788/src/Makefile b/nuttx/configs/open1788/src/Makefile
index e00bdf170..548a5792a 100644
--- a/nuttx/configs/open1788/src/Makefile
+++ b/nuttx/configs/open1788/src/Makefile
@@ -40,15 +40,15 @@ CFLAGS += -I$(TOPDIR)/sched
ASRCS =
CSRCS = lpc17_boardinitialize.c
-ifeq ($(CONFIG_LPC17_EMC_NOR),y)
+ifeq ($(CONFIG_ARCH_EXTNOR),y)
CSRCS += lpc17_norinitialize.c
endif
-ifeq ($(CONFIG_LPC17_EMC_NAND),y)
+ifeq ($(CONFIG_ARCH_EXTNAND),y)
CSRCS += lpc17_nandinitialize.c
endif
-ifeq ($(CONFIG_LPC17_EMC_SDRM),y)
+ifeq ($(CONFIG_ARCH_EXTDRAM),y)
CSRCS += lpc17_sdraminitialize.c
endif
diff --git a/nuttx/configs/open1788/src/lpc17_boardinitialize.c b/nuttx/configs/open1788/src/lpc17_boardinitialize.c
index a16f83024..f8916f0da 100644
--- a/nuttx/configs/open1788/src/lpc17_boardinitialize.c
+++ b/nuttx/configs/open1788/src/lpc17_boardinitialize.c
@@ -80,13 +80,13 @@ void lpc17_boardinitialize(void)
#ifdef CONFIG_LPC17_EMC
lpc17_emcinitialize();
-#ifdef CONFIG_LPC17_EMC_SDRAM
+#ifdef CONFIG_ARCH_EXTDRAM
lpc17_sdram_initialize();
#endif
-#ifdef CONFIG_LPC17_EMC_NOR
+#ifdef CONFIG_ARCH_EXTNOR
lpc17_nor_initialize();
#endif
-#ifdef CONFIG_LPC17_EMC_NAND
+#ifdef CONFIG_ARCH_EXTNAND
lpc17_nand_initialize();
#endif
#endif
diff --git a/nuttx/configs/open1788/src/lpc17_nandinitialize.c b/nuttx/configs/open1788/src/lpc17_nandinitialize.c
index 1c72b754c..aa66b0d41 100644
--- a/nuttx/configs/open1788/src/lpc17_nandinitialize.c
+++ b/nuttx/configs/open1788/src/lpc17_nandinitialize.c
@@ -49,7 +49,7 @@
#include "open1788.h"
-#if defined(CONFIG_LPC17_EMC) && defined(CONFIG_LPC17_EMC_NAND)
+#if defined(CONFIG_LPC17_EMC) && defined(CONFIG_ARCH_EXTNAND)
/************************************************************************************
* Definitions
@@ -98,4 +98,4 @@ void lpc17_nand_initialize(void)
lpc17_gpioconfig(GPIO_NAND_RB);
}
-#endif /* CONFIG_LPC17_EMC && CONFIG_LPC17_EMC_NAND */
+#endif /* CONFIG_LPC17_EMC && CONFIG_ARCH_EXTNAND */
diff --git a/nuttx/configs/open1788/src/lpc17_norinitialize.c b/nuttx/configs/open1788/src/lpc17_norinitialize.c
index 76838b3f0..5c4e4714a 100644
--- a/nuttx/configs/open1788/src/lpc17_norinitialize.c
+++ b/nuttx/configs/open1788/src/lpc17_norinitialize.c
@@ -49,7 +49,7 @@
#include "open1788.h"
-#if defined(CONFIG_LPC17_EMC) && defined(CONFIG_LPC17_EMC_NOR)
+#if defined(CONFIG_LPC17_EMC) && defined(CONFIG_ARCH_EXTNOR)
/************************************************************************************
* Definitions
@@ -94,4 +94,4 @@ void lpc17_nor_initialize(void)
up_mdelay(10);
}
-#endif /* CONFIG_LPC17_EMC && CONFIG_LPC17_EMC_NOR */
+#endif /* CONFIG_LPC17_EMC && CONFIG_ARCH_EXTNOR */
diff --git a/nuttx/configs/open1788/src/lpc17_sdraminitialize.c b/nuttx/configs/open1788/src/lpc17_sdraminitialize.c
index 4f5c7c0f7..e18643f20 100644
--- a/nuttx/configs/open1788/src/lpc17_sdraminitialize.c
+++ b/nuttx/configs/open1788/src/lpc17_sdraminitialize.c
@@ -42,14 +42,17 @@
#include <debug.h>
+#include <nuttx/arch.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "up_internal.h"
+#include "chip/lpc17_syscon.h"
+#include "lpc17_emc.h"
#include "open1788.h"
-#if defined(CONFIG_LPC17_EMC) && defined(CONFIG_LPC17_EMC_SDRAM)
+#if defined(CONFIG_LPC17_EMC) && defined(CONFIG_ARCH_EXTDRAM)
/************************************************************************************
* Definitions
@@ -139,8 +142,8 @@ void lpc17_sdram_initialize(void)
putreg32( 1, LPC17_EMC_DYNAMICAPR); /* TAPR = 2 clocks? */
putreg32(EMC_NS2CLK(20) + 2, LPC17_EMC_DYNAMICDAL); /* TDAL = TRP + TDPL = 20ns + 2clk */
putreg32( 1, LPC17_EMC_DYNAMICWR); /* TWR = 2 clocks */
- putreg32( EMC_NS2CLK(63), LPC17_EMC_DYNAMICRC); /* H57V2562GTR-75C TRC = 63ns(min)*/
- putreg32( EMC_NS2CLK(63, LPC17_EMC_DYNAMICRFC); /* H57V2562GTR-75C TRFC = TRC */
+ putreg32( EMC_NS2CLK(63), LPC17_EMC_DYNAMICRC); /* H57V2562GTR-75C TRC = 63ns(min)*/
+ putreg32( EMC_NS2CLK(63), LPC17_EMC_DYNAMICRFC); /* H57V2562GTR-75C TRFC = TRC */
putreg32( 15, LPC17_EMC_DYNAMICXSR); /* Exit self-refresh to active */
putreg32( EMC_NS2CLK(63), LPC17_EMC_DYNAMICRRD); /* 3 clock, TRRD = 15ns (min) */
putreg32( 1, LPC17_EMC_DYNAMICMRD); /* 2 clock, TMRD = 2 clocks (min) */
@@ -207,7 +210,7 @@ void lpc17_sdram_initialize(void)
#ifdef CONFIG_ARCH_SDRAM_16BIT
dummy = getreg16(SDRAM_BASE | (0x33 << 12)); /* 8 burst, 3 CAS latency */
#elif defined CONFIG_ARCH_SDRAM_32BIT
- dummy = getreg32(SDRAM_BASE | (0x32 << 13))); /* 4 burst, 3 CAS latency */
+ dummy = getreg32(SDRAM_BASE | (0x32 << 13)); /* 4 burst, 3 CAS latency */
#endif
/* Issue NORMAL command */
@@ -227,4 +230,4 @@ void lpc17_sdram_initialize(void)
putreg32(regval, LPC17_SYSCON_EMCDLYCTL);
}
-#endif /* CONFIG_LPC17_EMC && CONFIG_LPC17_EMC_SDRAM */
+#endif /* CONFIG_LPC17_EMC && CONFIG_ARCH_EXTDRAM */
diff --git a/nuttx/configs/open1788/src/open1788.h b/nuttx/configs/open1788/src/open1788.h
index ccac52db4..f0362e855 100644
--- a/nuttx/configs/open1788/src/open1788.h
+++ b/nuttx/configs/open1788/src/open1788.h
@@ -149,7 +149,7 @@ void weak_function lpc17_sspinitialize(void);
************************************************************************************/
#ifdef CONFIG_LPC17_EMC
-#ifdef CONFIG_LPC17_EMC_SDRAM
+#ifdef CONFIG_ARCH_EXTDRAM
void lpc17_sdram_initialize(void);
#endif
@@ -161,7 +161,7 @@ void lpc17_sdram_initialize(void);
*
************************************************************************************/
-#ifdef CONFIG_LPC17_EMC_NOR
+#ifdef CONFIG_ARCH_EXTNOR
void lpc17_nor_initialize(void);
#endif
@@ -173,7 +173,7 @@ void lpc17_nor_initialize(void);
*
************************************************************************************/
-#ifdef CONFIG_LPC17_EMC_NAND
+#ifdef CONFIG_ARCH_EXTNAND
void lpc17_nand_initialize(void);
#endif
#endif /* CONFIG_LPC17_EMC */
diff --git a/nuttx/libc/string/lib_strtoul.c b/nuttx/libc/string/lib_strtoul.c
index 8f27ae3f2..62a768043 100644
--- a/nuttx/libc/string/lib_strtoul.c
+++ b/nuttx/libc/string/lib_strtoul.c
@@ -93,6 +93,7 @@ unsigned long strtoul(const char *nptr, char **endptr, int base)
*endptr = (char *)nptr;
}
}
+
return accum;
}