PERFORCE change 96335 for review
Warner Losh
imp at FreeBSD.org
Fri Apr 28 22:56:03 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=96335
Change 96335 by imp at 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);
More information about the p4-projects
mailing list