⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_sdram.c

📁 关于DM642的外设的例程
💻 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 + -