sdram_test.c File Reference

#include "sdram.h"
#include "mt481c2m32b2tg.h"

Include dependency graph for sdram_test.c:

Go to the source code of this file.

Defines

#define STK1000_SDRAM_BASE   0xB0000000

Functions

int main (void)


Define Documentation

#define STK1000_SDRAM_BASE   0xB0000000

Definition at line 39 of file sdram_test.c.

Referenced by main().


Function Documentation

int main ( void   ) 

This function will setup the the SDRAM controller, intialize the SDRAM found on the STK1000 and test it.

Returns:
The number of errors

Definition at line 45 of file sdram_test.c.

References sdram_info::banks, sdram_info::cas, sdram_info::cols, 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, sdram_info::tras, sdram_info::trc, sdram_info::trcd, sdram_info::trp, sdram_info::twr, and sdram_info::txsr.

00046 {
00047   static sdram_info *info;
00048   unsigned long sdram_size, tmp, i;
00049   int noErrors=0;
00050   volatile unsigned long *sdram = (void *) STK1000_SDRAM_BASE;
00051 
00052   info->physical_address = STK1000_SDRAM_BASE;
00053   info->cols = mt481c2m32b2tg_cols;
00054   info->rows = mt481c2m32b2tg_rows;
00055   info->banks = mt481c2m32b2tg_banks;
00056   info->cas = mt481c2m32b2tg_cas;
00057   info->twr = mt481c2m32b2tg_twr;
00058   info->trc = mt481c2m32b2tg_trc;
00059   info->trp = mt481c2m32b2tg_trp;
00060   info->trcd = mt481c2m32b2tg_trcd;
00061   info->tras = mt481c2m32b2tg_tras;
00062   info->txsr = mt481c2m32b2tg_txsr;
00063 
00064   /* Calculate sdram size */
00065   sdram_size = 1 << (info->rows + info->cols + info->banks + 2);
00066 
00067   /* initialize the avr32 sdram controller */
00068   sdramc_init(info);
00069 
00070   /* initialize the external sdram chip */
00071   mt481c2m32b2tg_init(info);
00072 
00073   /* test the chip */
00074   for (i = 0; i < sdram_size; i++){
00075     sdram[i] = i;
00076     tmp = sdram[i];
00077     if (tmp != i) {
00078       noErrors++;
00079     }
00080   }
00081 
00082   return noErrors;
00083 }

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