亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

原理代碼求注釋,幫幫忙??!

原理代碼求注釋,幫幫忙啊!

婷婷同學_ 2022-10-02 14:10:48
* 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 testuart_printf("\nMemoryTest(%xh-%xh):WR\n", _RAM_STARTADDRESS+0xe00000,(_ISR_STARTADDRESS&0xf0ff0000));//memory writept=(UINT32T*)(_RAM_STARTADDRESS+0xe00000);while((UINT32T)pt<(_ISR_STARTADDRESS&0xf0ff0000)){*pt=(UINT32T)pt;pt++;}//MEMORY READuart_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");}盡量多的注釋,非常急
查看完整描述

1 回答

?
青春有我

TA貢獻1784條經驗 獲得超8個贊

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)); /*打印出內存測試函數所覆蓋地址1-地址2的范圍*/
//memory write
pt=(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 READ
uart_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中的內容全為其地址值,測試成功*/


查看完整回答
反對 回復 2022-10-06
  • 1 回答
  • 0 關注
  • 124 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號