📄 sdram.c
字号:
#include "hardware.h"
#include "hardware_reg.h"
#include "HA_typedef.h"
#include <stdio.h>
extern U32 para;
static void SDRAM_FullWrite32(U32 dest, U32 size, U32 bit)
{
U32 i;
for(i=0; i <size/4; i++)
*(RP)(dest+i*4) = (0xAAA80000 | i);
}
static void SDRAM_FullRead32(U32 dest, U32 size, U32 bit)
{
U32 i;
for(i=0; i <size/4; i++) {
if(*(RP)(dest+i*4)!= (0xAAA80000 | i))
printf("%x\n", (dest + i * 4 ));
}
}
ER SDRAM32(void)
{
SDRAM_FullWrite32(0x30000000, 0x0800000, 8); /* write full size of sdram */
printf("32 bits write finish!\n");
SDRAM_FullRead32(0x30000000, 0x0800000, 8);
return 0;
}
//////////////////////////////////////////////
/* Test in 16 bits*/
static void SDRAM_FullWrite16(U32 dest, U32 size, U32 bit)
{
U32 i;
for(i=0; i <size/2 ; i++)
*(RP16)(dest+i*2) =(U16)(0xffff&i);
}
static void SDRAM_FullRead16(U32 dest, U32 size, U32 bit)
{
U32 i;
for(i=0; i <size/2 ; i++) {
if( *(RP16)(dest+i*2) != (U16)(0xffff&i)) {
printf("%x\n", (dest + i * 2 ));
}
}
}
ER SDRAM16(void)
{
SDRAM_FullWrite16(0x30000000, 0x1000000, 8); /* write full size of sdram */
printf("16 bits write finish!\n");
SDRAM_FullRead16(0x30000000, 0x1000000, 8);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -