📄 burdentest.c
字号:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "option.h"
#include "2460addr.h"
#include "2460lib.h"
#include "2460slib.h"
#include "Dhry_1.h"
#include "mmu.h"
int Burden_Test(void)
{
int i,j,k,l,m,err=0, size, count;
int *pt_nor1, *pt_nor2;
printf("SDRAM Write Test\n");
size = 0x400000;//16MB
count = 0x10000;
pt_nor1=(int *)0x20000000;//CB(WT Cache, on buffer)
pt_nor2=(int *)0x21000000;//NCNB(Off cache, off buffer)
for(i=0;i<size;i++)
{
*pt_nor1++=(unsigned int)i;
if((i%(count*10))==0)
Dhry_Run();
*pt_nor2++=(unsigned int)i;
if((i%(count*10))==0)
Dhry_Run();
if((i%(count*10))==0)
Dhry_Run();
if((i%(count*10))==0)
Dhry_Run();
if((i%count)==0)
printf(".");
if(Uart_GetKey())
return 0;
}
printf("\nWriting is completed.\n");
pt_nor1=(int *)0x20000000;
pt_nor2=(int *)0x21000000;
for(i=0;i<size;i++)
{
j=*pt_nor1++;
if((i%(count*10))==0)
Dhry_Run();
k=*pt_nor2++;
if((i%(count*10))==0)
Dhry_Run();
if((i%(count*10))==0)
Dhry_Run();
if((i%(count*10))==0)
Dhry_Run();
if(j!=(unsigned int)i)
{
printf("%x=%x,%x\n",(unsigned int)pt_nor1,j,i);
err++;
}
if(k!=(unsigned int)i)
{
printf("%x=%x,%x\n",(unsigned int)pt_nor2,k,i);
err++;
}
if((i%count)==0)printf(".");
if(Uart_GetKey())
return 0;
}
if(err==0)
printf("\nMemory read test:O.K.\n");
else
{
printf("\nMemory read test:FAIL!!!\n");
Led_Display(0xf);
while(1);
}
return 1;
}
void __irq Burden_Done(void);
volatile unsigned int var0;
void Timer_Burden(void)
{
unsigned int Cnt;
var0 = 0;
pISR_TIMER0 = (int)Burden_Done;
rINTMSK = ~(BIT_TIMER0);
rTCFG0 = 0xff; //Dead zone=0,Prescaler0=256(0xff)
rTCFG1 = 0x3; //All interrupt,Mux0=1/16
Cnt = PCLK/256/16;
rTCNTB0 = (25 * Cnt) / 1000; //(1/(50MHz/16/16)) * 0x3333 (13107) = 0.334s ( 1.124Hz)
rTCON = 0xa; //Auto reload, Inverter off, Manual update, Dead zone disable, Stop
rTCON = rTCON & ~(0xffffff) | 0x9;
}
void __irq Burden_Done(void)
{
rSRCPND = BIT_TIMER0; //Clear pending bit
rINTPND = BIT_TIMER0;
rINTPND; //Prevent an double interrupt pending
Led_Display(var0%16);
var0++;
// printf("!");
}
void System_Burden_Test(void)
{
// rGPHCON=rGPHCON&~(0xf<<18)|(0xa<<18);
// rMISCCR=rMISCCR&~(0x7<<8)|(0x4<<8);
// Timer_Burden();
while(1){
Dhry_Run();
}
// while(Burden_Test());
rTCON = 0x0;
rINTMSK |= BIT_TIMER0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -