📄 esram.c
字号:
#include "hardware.h"
#include "hardware_reg.h"
#include "HA_typedef.h"
int write_esram(U32 addr, U32 size, U32 bit)
{
U32 temp32 = 0;
U16 temp16 = 0;
U8 temp8 = 0;
switch(bit){
U32 i;
case 8:
for(i = 0; i < size; i++, temp8++) *(U8 *)(addr + i) = 0x5a;
break;
case 16:
for(i = 0; i < size; i++, temp16++) *(U16 *)(addr + i * 2)= 0x5a5a;
break;
case 32:
for(i = 0; i < size; i++, temp32++) *(U32 *)(addr + i * 4) = 0x5a5a5a5a;
break;
}
#if 0
__asm{
cmp bit, #8
8
16
32
}
#endif
}
static U32 esramadd = 0x1fff2800;
void read_esram(U32 src, U32 size, U32 bit)
{
U32 temp32;
U16 temp16;
U8 temp8;
switch(bit){
U32 i;
case 8:
for(i = 0; i < size; i++, temp8++) *(U8 *)(esramadd + i) = *(U8 *)(src + i);
break;
case 16:
for(i = 0; i < size; i++, temp16++) *(U16 *)(esramadd + i * 2)= *(U16 *)(src + i * 2);
break;
case 32:
for(i = 0; i < size; i++, temp32++) *(U32 *)(esramadd + i * 4) = *(U32 *)(src + i * 4);
break;
}
}
void esram()
{
write_esram(0x1fff0000, 0xa00, 32); /* write full esram */
read_esram(0x1fff0000, 0xa00, 32);
compare(0x1fff0000, 0x1fff2800, 0xa00, 32);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -