Date: Fri, 28 Apr 2006 22:56:01 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 96335 for review Message-ID: <200604282256.k3SMu155035328@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=96335 Change 96335 by imp@imp_hammer on 2006/04/28 22:55:10 Move delay to its own function so fpga can use it Make fpga loading work. cleanup spi support Affected files ... .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/Makefile#13 edit .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/delay.c#1 add .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/lib.h#9 edit .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/spi_flash.c#8 edit Differences ... ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/Makefile#13 (text+ko) ==== @@ -4,7 +4,7 @@ LIB= at91 INTERNALLIB= -SRCS=at91rm9200_lowlevel.c eeprom.c emac.c getc.c \ +SRCS=at91rm9200_lowlevel.c delay.c eeprom.c emac.c fpga.c getc.c \ p_string.c putchar.c printf.c reset.c spi_flash.c xmodem.c NO_MAN= ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/lib.h#9 (text) ==== @@ -43,4 +43,7 @@ /* Reboot! Reset! */ void reset(void); +/* Delay us */ +void Delay(int us); + #endif ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/spi_flash.c#8 (text+ko) ==== @@ -31,17 +31,6 @@ static spiCommand_t spi_command; static char tx_commandBuffer[8], rx_commandBuffer[8]; - -static void -Delay(void) -{ - unsigned later; - - later = (AT91C_BASE_ST->ST_CRTR + 23) & AT91C_ST_CRTV; - while (later != AT91C_BASE_ST->ST_CRTR) - continue; -} - /* * .KB_C_FN_DEFINITION_START * void SendCommand(spiCommand_t *pCommand) @@ -71,7 +60,7 @@ // wait for completion while (!((v = pSPI->SPI_SR) & AT91C_SPI_SPENDRX)) - Delay(); + Delay(70); } @@ -148,7 +137,6 @@ char *src_addr, unsigned size) { - printf("PA %x BA %x Size %u\r\n", pageAddress, byteAddress, size); p_memset(tx_commandBuffer, 0, 8); tx_commandBuffer[0] = PROGRAM_THROUGH_BUFFER; // tx_commandBuffer[0] = 0x84; // write buffer 1 @@ -195,10 +183,8 @@ // determine byte address byteAddress = flash_addr % FLASH_PAGE_SIZE; - printf("Flash addr %x PA %x BA %x\r\n", flash_addr, pageAddress, byteAddress); p_memset(tx_commandBuffer, 0, 8); tx_commandBuffer[0] = CONTINUOUS_ARRAY_READ_HF; -// tx_commandBuffer[0] = 0xD4; // read buffer 1 tx_commandBuffer[1] = ((pageAddress >> 5) & 0xFF); tx_commandBuffer[2] = ((pageAddress << 3) & 0xF8) | ((byteAddress >> 8) & 0x7);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604282256.k3SMu155035328>