sdram_usart_test.c File Reference

#include "sdram.h"
#include <avr32/io.h>
#include "mt481c2m32b2tg.h"

Include dependency graph for sdram_usart_test.c:

Go to the source code of this file.

Defines

#define AVR32_USART1_RXD_0_FUNCTION   0
#define AVR32_USART1_RXD_0_PIN   17
#define AVR32_USART1_TXD_0_FUNCTION   0
#define AVR32_USART1_TXD_0_PIN   18
#define CPU_HZ   20000000
#define FAILURE   -1
#define STK1000_SDRAM_BASE   0xB0000000
#define SUCCESS   0
#define USART   0

Functions

int main (void)


Define Documentation

#define AVR32_USART1_RXD_0_FUNCTION   0

Definition at line 23 of file sdram_usart_test.c.

#define AVR32_USART1_RXD_0_PIN   17

Definition at line 22 of file sdram_usart_test.c.

#define AVR32_USART1_TXD_0_FUNCTION   0

Definition at line 25 of file sdram_usart_test.c.

#define AVR32_USART1_TXD_0_PIN   18

Definition at line 24 of file sdram_usart_test.c.

#define CPU_HZ   20000000

Definition at line 29 of file sdram_usart_test.c.

#define FAILURE   -1

Definition at line 12 of file sdram_usart_test.c.

Referenced by main().

#define STK1000_SDRAM_BASE   0xB0000000

Definition at line 28 of file sdram_usart_test.c.

#define SUCCESS   0

Definition at line 11 of file sdram_usart_test.c.

Referenced by main().

#define USART   0

Definition at line 1 of file sdram_usart_test.c.

Referenced by main().


Function Documentation

int main ( void   ) 

Definition at line 31 of file sdram_usart_test.c.

References sdram_info::banks, sdram_info::cas, sdram_info::cols, FAILURE, mt481c2m32b2tg_banks, mt481c2m32b2tg_cas, mt481c2m32b2tg_cols, mt481c2m32b2tg_init(), mt481c2m32b2tg_rows, mt481c2m32b2tg_tras, mt481c2m32b2tg_trc, mt481c2m32b2tg_trcd, mt481c2m32b2tg_trp, mt481c2m32b2tg_twr, mt481c2m32b2tg_txsr, sdram_info::physical_address, sdram_info::rows, sdramc_init(), STK1000_SDRAM_BASE, SUCCESS, sdram_info::tras, sdram_info::trc, sdram_info::trcd, sdram_info::trp, sdram_info::twr, sdram_info::txsr, and USART.

00032 {
00033   static sdram_info *info;
00034   unsigned long sdram_size, tmp, i;
00035   int noErrors=0;
00036   volatile unsigned long *sdram = (void *) STK1000_SDRAM_BASE;
00037 
00038   info->physical_address = STK1000_SDRAM_BASE;
00039   info->cols = mt481c2m32b2tg_cols;
00040   info->rows = mt481c2m32b2tg_rows;
00041   info->banks = mt481c2m32b2tg_banks;
00042   info->cas = mt481c2m32b2tg_cas;
00043   info->twr = mt481c2m32b2tg_twr;
00044   info->trc = mt481c2m32b2tg_trc;
00045   info->trp = mt481c2m32b2tg_trp;
00046   info->trcd = mt481c2m32b2tg_trcd;
00047   info->tras = mt481c2m32b2tg_tras;
00048   info->txsr = mt481c2m32b2tg_txsr;
00049 
00050   /* Calculate sdram size */
00051   sdram_size = 1 << (info->rows + info->cols + info->banks + 2);
00052 
00053 #if USART
00054   init_rs232();
00055 #endif
00056   printf("\nEXTERNAL SDRAM TEST\n\n");
00057   sdramc_init(info);
00058   mt481c2m32b2tg_init(info);
00059   printf("Initialization complete\nTest starting...\n");
00060   printf("Filling memoryspace (0x%lx)\n", sdram_size);
00061 
00062   for (i = 0; i < sdram_size; i++){
00063     sdram[i] = i;
00064     tmp = sdram[i];
00065     if (tmp != i) {
00066     #if USART
00067       printf("SDRAM verifcation failed at 0x%lx", STK1000_SDRAM_BASE + i);
00068       printf(". Read 0x%lx instead of expected 0x%lx\n", tmp, i);
00069     #endif
00070       noErrors++;
00071     }
00072   }
00073 
00074   if(noErrors==0){
00075     printf("SDRAM test completed successfully\n");
00076     return SUCCESS;
00077   }else{
00078     printf("SDRAM test completed with %x errors", noErrors);
00079     return FAILURE;
00080   }
00081 }

Here is the call graph for this function:


Generated on Thu May 10 13:52:44 2007 for AVR32102 - Using the AVR32 SDRAM controller by  doxygen 1.5.1