From 24ef72ab24413f7c0ea5cf74b6a62efe24c8deb2 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Sun, 14 Jun 2015 07:49:42 +0000 Subject: [PATCH] - disabled dedicated SPI test git-svn-id: http://moon:8086/svn/mips@53 a8ebac50-d88d-4704-bea3-6648445a41b3 --- src/bootloader/test.c | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/src/bootloader/test.c b/src/bootloader/test.c index 2055744..534bb88 100644 --- a/src/bootloader/test.c +++ b/src/bootloader/test.c @@ -1,7 +1,7 @@ #include "libsys_boot.h" #define ARRAY_SIZE(a) (sizeof(a)/sizeof(*a)) -#define SDRAM_SIZE (32*1024*1024) +#define SDRAM_SIZE (256) void uart_isr(void) { @@ -39,9 +39,11 @@ void main() uint32_t data; volatile uint32_t *pUART0_stat = (uint32_t*)SYS_UART_STAT; volatile uint32_t *pGPIODIR = (uint32_t*)SYS_GPIO_0_DIR; - volatile uint32_t *pSDRAM32 = (uint32_t*)FLASH_BASE_MEM; - volatile uint16_t *pSDRAM16 = (uint16_t*)FLASH_BASE_MEM; - volatile uint8_t *pSDRAM8 = (uint8_t*)FLASH_BASE_MEM; + volatile uint32_t pSDRAM32[SDRAM_SIZE/4]; + volatile uint16_t *pSDRAM16 = (uint16_t*)pSDRAM32; + volatile uint8_t *pSDRAM8 = (uint8_t*)pSDRAM32; + volatile uint32_t *pFlashMem = (uint32_t*)FLASH_BASE_MEM + 0x100000/4; + volatile uint32_t *pTim_ctrl = (uint32_t*)SYS_ITIM_CTRL; volatile uint32_t *pTim_stat = (uint32_t*)SYS_ITIM_STAT; volatile uint32_t *pTim0_cnt = (uint32_t*)SYS_ITIM0_CNT; @@ -86,9 +88,12 @@ void main() while(1) { sputs("Iteration # ");print_word(k);sputs("\n"); +#if 0 + // SPI Bit rate + // fsys / (2*(1+div)) + *pSpiCtrl = (*pSpiCtrl & 0xFFFFFF00) | 0; sputs("Test SPI\n"); - *pSpiCtrl = (*pSpiCtrl & 0xFFFFFF00) | 0; // fsys / (2*(1+div)) *pSpiData = 0x9F000000; *pSpiDataSize = 8; *pSpiXferSize = 8+648; @@ -108,6 +113,23 @@ void main() print_word(*pSpiData);sputs("\n"); } while (*pSpiStat & SPI_STAT_DOUTRDY); + sputs("SPI: Read at 0x100000\n"); + *pSpiData = 0x03100000; + *pSpiDataSize = 32; + *pSpiXferSize = 32+8*256; + *pSpiStat = SPI_STAT_COMMIT; + + while(!(*pSpiStat & SPI_STAT_DOUTRDY)) + { + } + + do + { + print_word(*pSpiData);sputs("\n"); + } while (*pSpiStat & SPI_STAT_DOUTRDY); + +#endif + sputs("Testing SDRAM (pattern)\n"); for (j=0; j < ARRAY_SIZE(test_pattern); j++) { @@ -132,6 +154,12 @@ void main() } sputs("\n"); + sputs("Reading SPI Flash\n"); + DCACHE_invalidate_all(); + memdump((uint8_t*)pFlashMem, 0, 16, 512); + sputs("\n"); + sputs("Size "); print_word(*(pFlashMem+3)); sputs("\n"); + sputs("Testing SDRAM (32-bit write)\n"); data = 0x00010203; for (i=0; i < 256/4; i++)