做了一个遍历4g mmc例子;
先写入,再读出,再校验;
当单次读、写、校验对比文件为1M字节时基本没问题;当单次文件为8M时,在读取或校验对比时总会进入data aboart异常;
每次调制中在异常中打印信息如下:
Data abort with Data Fault Status Register 805
Address of Instruction causing Data abort 102AAC
//////////////////////////////////////////////////////////////
Data abort with Data Fault Status Register 5
Address of Instruction causing Data abort 11FE68
//////////////////////////////////////////////////////////////
Data abort with Data Fault Status Register 5
Address of Instruction causing Data abort 11FE68
//////////////////////////////////////////////////////////////
Data abort with Data Fault Status Register 5
Address of Instruction causing Data abort 11FE68
//////////////////////////////////////////////////////////////
Data abort with Data Fault Status Register 1
Address of Instruction causing Data abort 11FE68
//////////////////////////////////////////////////////////////
Data abort with Data Fault Status Register 5
Address of Instruction causing Data abort 11FE68
//////////////////////////////////////////////////////////////
Data abort with Data Fault Status Register 5
Address of Instruction causing Data abort 120068
//////////////////////////////////////////////////////////////
Data abort with Data Fault Status Register 1
Address of Instruction causing Data abort 120068
//////////////////////////////////////////////////////////////
Data abort with Data Fault Status Register 5
Address of Instruction causing Data abort 1200A8
//////////////////////////////////////////////////////////////
看失效状态寄存器多为5,查了下是MMU产生域控制失效;
请问有没有遇到这种情况的?能否测试一下;
源代码:
void emmc_cap_test(TCHAR *Path)
{
u32 emmc_i,emmc_j;
u8 sd_error_flag = 0;
u16 sd_error_num = 0;
u32 RD_Buf[0x200000];
u32 WR_Buf[0x200000];
char FILE_NAME[30] = "";
u32 emmc_total = 0;
u32 emmc_free = 0;
exf_getfree(Path, &emmc_total, &emmc_free);
xil_printf("emmc total space:%lu KB.\r\n",emmc_total);
for(emmc_i=0; emmc_i<1000; emmc_i++)
{
for(emmc_j=0; emmc_j<(0X800000>>2); emmc_j++) //赋值
{
WR_Buf[emmc_j] = emmc_j + emmc_i;
}
sprintf(FILE_NAME, "%lu", (emmc_i + 1));
strcat(FILE_NAME,".txt");
exf_getfree(Path,&emmc_total,&emmc_free); //获取剩余空间
if(emmc_free < 8192) //跳出
{
xil_printf("emmc free space:%lu KB,no space to write once again.\r\n",emmc_free);
xil_printf("Test write num:%lu.\r\n",emmc_i);
xil_printf("Total number of errors written to the fault record file:%u.\r\n",sd_error_num);
return;
}
else
{
xil_printf("Test write num:%lu.\r\n",emmc_i + 1);
xil_printf("emmc free space:%lu KB.\r\n",emmc_free);
}
xil_printf("Test write 8MB file.file name %lu.txt\r\n",emmc_i + 1);
//SD卡写数据
sd_write_data(FILE_NAME,(u32)WR_Buf,0X800000,0);
xil_printf("Test read 8MB file.file name %lu.txt\r\n",emmc_i + 1);
//SD卡读数据
sd_read_data(FILE_NAME,(u32)RD_Buf,0X800000,0);
xil_printf("Test verify 8MB file.file name %lu.txt\r\n",emmc_i + 1);
//核对
for(emmc_j=0; emmc_j<(0X800000>>2);emmc_j++)
{
if(WR_Buf[emmc_j] != RD_Buf[emmc_j])
{
sd_error_flag = 1; //一个故障记录文件中有错误数据
xil_printf("Check error position(u32):%lu.\r\n",emmc_j);
xil_printf("write data:%u.\r\n",WR_Buf[emmc_j]);
xil_printf("read data:%u.\r\n",RD_Buf[emmc_j]);
}
}
if(sd_error_flag)
{
xil_printf("EMMC Data checked Error.\r\n");
sd_error_num++;
sd_error_flag = 0;
}
else
{
xil_printf("EMMC Data checked Successfully.\r\n");
}
}
return;
} |
|