PERFORCE change 95861 for review
Warner Losh
imp at FreeBSD.org
Sat Apr 22 03:46:23 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=95861
Change 95861 by imp at imp_hammer on 2006/04/22 03:46:20
Turn this into a more diagnostic for spi flash testing.
Affected files ...
.. //depot/projects/arm/src/sys/boot/arm/at91/boot0spi/main.c#4 edit
Differences ...
==== //depot/projects/arm/src/sys/boot/arm/at91/boot0spi/main.c#4 (text) ====
@@ -26,6 +26,7 @@
#include "at91rm9200.h"
#include "lib.h"
+#include "p_string.h"
#include "at91rm9200_lowlevel.h"
#include "spi_flash.h"
@@ -33,12 +34,48 @@
main(void)
{
char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */
- int len;
+ int len, i;
+#if 0
+ char *addr2 = (char *)SDRAM_BASE + (2 << 20); /* Load to base + 2MB */
+ unsigned this_sec;
+#endif
+ printf("b4\r\n");
+ SPI_InitFlash();
+ printf("after\r\n");
+#if 0
while ((len = xmodem_rx(addr)) == -1)
continue;
- SPI_InitFlash();
- SPI_WriteFlash(FLASH_PAGE_SIZE, addr, len);
-
+#else
+ len = FLASH_PAGE_SIZE;
+ for (i = 0; i < FLASH_PAGE_SIZE; i++)
+ addr[i] = i;
+ SPI_GetId(0);
+ printf("Memory after init:\r\n");
+ for (i = 0; i < 4; i++)
+ printf("0x%x ", addr[i]);
+ printf("\r\n");
+#endif
+#if 0
+ while (1) {
+ printf("Writing %u bytes to flash\r\n", len);
+ SPI_WriteFlash(FLASH_PAGE_SIZE, addr, len);
+ printf("Reading back %u bytes from flash\r\n", len);
+ SPI_ReadFlash(FLASH_PAGE_SIZE, addr2, len);
+ if (p_memcmp(addr, addr2, len) != 0) {
+ printf("Readback failed:\r\n");
+ for (i = 0; i < 4; i++)
+ printf("0x%x ", addr[i]);
+ printf("\r\n");
+ for (i = 0; i < 4; i++)
+ printf("0x%x ", addr2[i]);
+ printf("\r\n");
+ } else
+ printf("Readback OK\r\n");
+ this_sec = GetSeconds() + 1;
+ while (GetSeconds() < this_sec)
+ continue;
+ }
+#endif
return (1);
}
More information about the p4-projects
mailing list