以下是2440 mmu的部分程序
/*
*关开门狗
*/
#define WTCON (*(volatile unsigned long *)0x53000000)
void dis_wtd(void)
{
WTCON = 0;
}
/*
*将前4K代码复制到SDRAM
*/
#define mem_ctl_base 0x48000000
void memset(void)
{
unsigned long const mem_cfg_val[] = {
0x22011110,
0x00000700,
0x00000700,
0x00000700,
0x00000700,
0x00000700,
0x00000700,
0x00018005,
0x00018005,
0x008c07a3,
0x000000b1,
0x00000030,
0x00000030,
};
unsigned char i;
volatile unsigned long *p = (volatile unsigned long *)mem_ctl_base;
for(i=0; i<13; i++)
{
p = mem_cfg_val;
}
}
void copy_to_sdram(void)
{
unsigned int *pdwsrc = (unsigned int *)2048;
unsigned int *pdwdest = (unsigned int *)0x30004000;
while(pdwsrc < (unsigned int *)4096)
{
*pdwdest = *pdwsrc;
pdwdest++;
pdwsrc++;
}
}
我想问一下为何程序中,两处用的数据类型为何不同?必须这么用吗?
volatile unsigned long *p = (volatile unsigned long *)mem_ctl_base;
而后面的程序则是unsigned int *pdwsrc = (unsigned int *)2048;
unsigned int *pdwdest = (unsigned int *)0x30004000;
我是新手,希望各位前辈能够指点一下,谢谢了!
|