Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 May 2006 22:44:02 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 96629 for review
Message-ID:  <200605032244.k43Mi2Js010411@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=96629

Change 96629 by imp@imp_hammer on 2006/05/03 22:43:41

	Load a few more bytes into the FPGA...  They seem to be needed,
	even though they are effectively random...
	Allow loading fpga via Xmodem for testing.
	
	# We still have 1.7k left, but I suspect that will fill soon...

Affected files ...

.. //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.c#4 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.h#4 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootspi/main.c#7 edit

Differences ...

==== //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.c#4 (text+ko) ====

@@ -23,6 +23,7 @@
  *****************************************************************************/
 
 #include "at91rm9200_lowlevel.h"
+#include "at91rm9200.h"
 #include "p_string.h"
 #include "eeprom.h"
 #ifdef SUPPORT_TAG_LIST
@@ -33,6 +34,7 @@
 #include "env_vars.h"
 #include "lib.h"
 #include "spi_flash.h"
+#include "fpga.h"
 
 /******************************* GLOBALS *************************************/
 
@@ -65,11 +67,39 @@
 	{COMMAND_RESET, "R"},
 	{COMMAND_REPLACE_FLASH_VIA_XMODEM, "I"},
 	{COMMAND_REPLACE_FPGA_VIA_XMODEM, "F"},
+	{COMMAND_PROGRAM_FPGA_VIA_XMODEM, "f"},
 	{COMMAND_FINAL_FLAG, 0}
 };
 
 static unsigned tagAddress;
 
+#ifdef TSC_FPGA
+#include "fpga.h"
+
+const struct fpga main_fpga = 
+{
+    AT91C_BASE_PIOB, AT91C_PIO_PB0,
+    AT91C_BASE_PIOC, AT91C_PIO_PC11,
+    AT91C_BASE_PIOB, AT91C_PIO_PB2,
+    AT91C_BASE_PIOC, AT91C_PIO_PC12
+};
+
+void
+fpga_load(void)
+{
+	int len;
+	char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */
+
+	len = 212608;
+	SPI_ReadFlash(15 * FLASH_PAGE_SIZE, addr, len);
+	printf("Loading %u bytes into the FPGA...\r\n", len);
+	fpga_init(&main_fpga);
+	fpga_clear(&main_fpga);
+	fpga_write_bytes(&main_fpga, addr, len);
+	fpga_done(&main_fpga);
+}
+#endif
+
 /*
  * .KB_C_FN_DEFINITION_START
  * unsigned BuildIP(void)
@@ -195,6 +225,21 @@
 	}
 }
 
+static void
+ProgramFpga(void)
+{
+	char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */
+	int len;
+
+	while ((len = xmodem_rx(addr)) == -1)
+		continue;
+	printf("Loading %u bytes into the FPGA...\r\n", len);
+	fpga_init(&main_fpga);
+	fpga_clear(&main_fpga);
+	fpga_write_bytes(&main_fpga, addr, len);
+	fpga_done(&main_fpga);
+}
+
 /*
  * .KB_C_FN_DEFINITION_START
  * void ParseCommand(char *)
@@ -364,6 +409,8 @@
 		printf("Updating FLASH image\r\n");
 		UpdateFlash(0);
 		break;
+	case COMMAND_PROGRAM_FPGA_VIA_XMODEM:
+		ProgramFpga();
 	default:
 		break;
 	}

==== //depot/projects/arm/src/sys/boot/arm/at91/bootspi/loader_prompt.h#4 (text+ko) ====

@@ -43,6 +43,7 @@
 	COMMAND_RESET,
 	COMMAND_REPLACE_FLASH_VIA_XMODEM,
 	COMMAND_REPLACE_FPGA_VIA_XMODEM,
+	COMMAND_PROGRAM_FPGA_VIA_XMODEM,
 	COMMAND_FINAL_FLAG
 } e_cmd_t;
 
@@ -54,5 +55,6 @@
 
 void EnterInteractiveBootloader(int(*inputFunction)(int));
 void Bootloader(int(*inputFunction)(int));
+void fpga_load(void);
 
 #endif /* _LOADER_PROMPT_H_ */

==== //depot/projects/arm/src/sys/boot/arm/at91/bootspi/main.c#7 (text+ko) ====

@@ -41,32 +41,6 @@
 #include "emac.h"
 #include "lib.h"
 #include "spi_flash.h"
-#ifdef TSC_FPGA
-#include "fpga.h"
-
-const struct fpga main_fpga = 
-{
-    AT91C_BASE_PIOB, AT91C_PIO_PB0,
-    AT91C_BASE_PIOC, AT91C_PIO_PC11,
-    AT91C_BASE_PIOB, AT91C_PIO_PB2,
-    AT91C_BASE_PIOC, AT91C_PIO_PC12
-};
-
-static void
-fpga_load(void)
-{
-	int len;
-	char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */
-
-	len = 212482;
-	SPI_ReadFlash(15 * FLASH_PAGE_SIZE, addr, len);
-	printf("Loading %u bytes into the FPGA...\r\n", len);
-	fpga_init(&main_fpga);
-	fpga_clear(&main_fpga);
-	fpga_write_bytes(&main_fpga, addr, len);
-	fpga_done(&main_fpga);
-}
-#endif
 
 int
 main(void)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605032244.k43Mi2Js010411>