原理代码求注释,帮帮忙啊!

* File: main.c

* Author: WuhanR&Dembest
* Desc: cmain entry
* History:
/* includes files*/
#include"2410lib.h"
/*********************************************************************************************
* name: main
* func: c code entry
* para: none
* ret: none
* modify:
* comment:
*********************************************************************************************/
void main(intargc,char **argv)
{
sys_init(); /* Initials3c2410's Clock, MMU, Interrupt,Port and UART */
memory_test();
while(1)
{
};
}
/****************************************************/
* File: memory.c
* Author: WuhanR&D Center, embest
* Desc: memorytest file
* History:
*****************************************************/
#include"def.h"
#include"option.h"
void memory_test(void)
{
int i;
UINT32T data;
int memError=0;
UINT32T *pt;
// memory test
uart_printf("\nMemoryTest(%xh-%xh):WR\n", _RAM_STARTADDRESS+0xe00000,
(_ISR_STARTADDRESS&0xf0ff0000));
//memory write
pt=(UINT32T*)(_RAM_STARTADDRESS+0xe00000);
while((UINT32T)pt<(_ISR_STARTADDRESS&0xf0ff0000))
{
*pt=(UINT32T)pt;
pt++;
}
//MEMORY READ
uart_printf("MemoryTest(%xh-%xh):RD\n", _RAM_STARTADDRESS+0xe00000,
(_ISR_STARTADDRESS&0x0f0ff0000));
//uart_printf("\b\bRD");
pt=(UINT32T*)(_RAM_STARTADDRESS+0xe00000);
while((UINT32T)pt<(_ISR_STARTADDRESS&0xf0ff0000))
{data=*pt;
if(data!=(UINT32T)pt)
{memError=1;
uart_printf("\b\bFAIL:0x%x=0x%x\n",i,data);
break;}
pt++;}
if(memError==0)
uart_printf("\n\b\bO.K.\n");}
尽量多的注释,非常急

婷婷同学_
浏览 129回答 1
1回答

青春有我

void memory_test(void){int i;UINT32T data;int memError=0;UINT32T *pt;// memory testuart_printf("\nMemoryTest(%xh-%xh):WR\n", _RAM_STARTADDRESS+0xe00000,(_ISR_STARTADDRESS&0xf0ff0000)); /*打印出内存测试函数所覆盖地址1-地址2的范围*///memory writept=(UINT32T*)(_RAM_STARTADDRESS+0xe00000);/*指针pt指向地址1*/while((UINT32T)pt<(_ISR_STARTADDRESS&0xf0ff0000)){/*向内存地址中不断写入其地址值的内容假设现在地址是0x2000 1000这个地方写上一个叫做0x2000 1000的值再在地址是0x2000 1004这个地方写上一个叫做0x2000 1004的值以此类推*/*pt=(UINT32T)pt;pt++;}/*全部写完*///MEMORY READuart_printf("MemoryTest(%xh-%xh):RD\n", _RAM_STARTADDRESS+0xe00000,(_ISR_STARTADDRESS&0x0f0ff0000));/*打印出需要读取内容的地址范围,地址1-地址2*///uart_printf("\b\bRD");pt=(UINT32T*)(_RAM_STARTADDRESS+0xe00000);/*用指针pt指向地址1*//*将地址1-地址2的内容依次以32位取出*/while((UINT32T)pt<(_ISR_STARTADDRESS&0xf0ff0000)){data=*pt;/*取出pt指针所指向地址的内容*/if(data!=(UINT32T)pt)/*判断该内容是否为其地址值*/{memError=1;uart_printf("\b\bFAIL:0x%x=0x%x\n",i,data);/*不等,则测试失败*/break;}pt++;}if(memError==0)uart_printf("\n\b\bO.K.\n");}/*地址1-地址2中的内容全为其地址值,测试成功*/
打开App,查看更多内容
随时随地看视频慕课网APP