Date: Tue, 2 May 2006 22:39:06 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 96573 for review Message-ID: <200605022239.k42Md6pl056593@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=96573 Change 96573 by imp@imp_hammer on 2006/05/02 22:38:41 checkpoint FPGA burning routine. Affected files ... .. //depot/projects/arm/src/sys/boot/arm/at91/boot0spi/main.c#9 edit Differences ... ==== //depot/projects/arm/src/sys/boot/arm/at91/boot0spi/main.c#9 (text) ==== @@ -39,34 +39,40 @@ AT91C_BASE_PIOC, AT91C_PIO_PC12 }; +#define BURN_FPGA 1 int main(void) { - int len; + int len, i, j, off; char *addr = (char *)SDRAM_BASE + (1 << 20); /* Load to base + 1MB */ -#if 0 +#ifdef BURN_FPGA char *addr2 = (char *)SDRAM_BASE + (2 << 20); /* Load to base + 2MB */ char *addr3 = (char *)SDRAM_BASE + (3 << 20); /* Load to base + 2MB */ #endif SPI_InitFlash(); -#if 0 while ((len = xmodem_rx(addr)) == -1) continue; - printf("Downloaded %u bytes.\r\n", len); +#ifdef BURN_FPGA + printf("\r\nDownloaded %u bytes.\r\n", len); p_memcpy(addr3, addr, len); printf("Writing %u bytes to flash\r\n", len); - SPI_WriteFlash(15 * FLASH_PAGE_SIZE, addr, len); - printf("Reading back %u bytes from flash\r\n", len); - SPI_ReadFlash(15 * FLASH_PAGE_SIZE, addr2, len); - if (p_memcmp(addr3, addr2, len) != 0) - printf("Readback failed\r\n"); - else - printf("Readback OK\r\n"); + for (i = 0; i < len; i+= FLASH_PAGE_SIZE) { + for (j = 0; j < 10; j++) { + off = i + 15 * FLASH_PAGE_SIZE; + SPI_WriteFlash(off, addr + i, FLASH_PAGE_SIZE); + SPI_ReadFlash(off, addr2 + i, FLASH_PAGE_SIZE); + if (p_memcmp(addr3 + off, addr2 + off, FLASH_PAGE_SIZE) == 0) + break; + } + if (j >= 10) + printf("Bad Readback at %u\r\n", i); + } #else len = 212482; SPI_ReadFlash(15 * FLASH_PAGE_SIZE, addr, len); + printf("Downloaded %u bytes... burning FPGA...\r\n", len); fpga_init(&main_fpga); fpga_clear(&main_fpga); fpga_write_bytes(&main_fpga, addr, len);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605022239.k42Md6pl056593>