?? test_sdram.c
字號:
/**********************************************************/
/* Copyright 2004 by SAGA Work House. */
/* All rights reserved. Property of Saga W.H. */
/* Restricted rights to use, duplicate or disclose this */
/* code aregranted through contract. */
/* */
/**********************************************************/
/**********************************************************/
/* SDRAM_TEST for DragonFly-1 video board */
/* parameter "error" indicates the first error occurs */
/* Author: Ku.li */
/* Date: 2005,10,20 */
/* Version: 1.0 */
/**********************************************************/
#include <csl.h>
#include <csl_dat.h>
#include <csl_edma.h>
#include "emiface1cfg.h"
#include "stdio.h"
/* definitions */
#define MEM_SRC 0x00080000 /* Source address */
#define SDRAM_ADDR 0x80000000 /* Destination address*/
//#define length 0x01000000 /* for 16MX32bit */
#define length 0x00800000 /* for 8Mx32bit */
//#define length 0x00090000 /* for 4Mx32bit */
/* prototypes */
void wait(void);
int check_data(unsigned int);
/**************************************main***********************************/
/* Main code body. */
/*****************************************************************************/
void main(void)
{
int i,j=0;
EMIFA_config(&emifaCfg0);
////////test the data 0x55555555//////////////////////////
test:
for(i=0;i<length;i++)
*(int *) (SDRAM_ADDR+(i<<2)) = 0x55555555;
for (i = 0; i < length; i++)
{
if (*(int *) (SDRAM_ADDR+(i<<2)) != 0x55555555)
{
printf(" SDRAM is error! 0x55555555 %x\n",i);
j=1;
}
}
if(j==0)
printf(" SDRAM is ok! 0x55555555\n");
////////////////test the data 0xaaaaaaaa////////////////////
for(i=0;i<length;i++)
*(int *) (SDRAM_ADDR+(i<<2)) = 0xaaaaaaaa;
for (i = 0; i < length; i++)
{
if (*(int *) (SDRAM_ADDR+(i<<2)) != 0xaaaaaaaa)
{
printf(" SDRAM is error! 0xaaaaaaaa %x\n",i);
j=1;
}
}
if(j==0)
printf(" SDRAM is ok! 0xaaaaaaaa\n");
///////////////test the data i/////////////////////////////////
for(i=0;i<length;i++)
*(int *) (SDRAM_ADDR+(i<<2)) = i;
for (i = 0; i < length; i++)
{
if (*(int *) (SDRAM_ADDR+(i<<2)) != i)
{
printf(" SDRAM is error! i %x\n",i);
j=1;
}
}
if(j==0)
printf(" SDRAM is ok! i\n");
goto test;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -