📄 memory.c
字号:
#include "dp8051.h"
#include "config.h"
#include "absacc.h"
#include "constant.h"
#include "variable.h"
#include "function.h"
#include "sdhost.h"
#include "sssmp3_regs.h"
#include "fat.h"
#include "mp3_appl.h"
//***********************************************
/************************************************
函 数 名: check_nor_flash()
功 能:测试nor flash ( read )
说 明:
调 用:
全局变量:
入口参数:无
出口参数:无
返 回 值:无
************************************************/
//测试nor flash ( read )
bit check_nor_flash(void)
{
U32 xdata address = 0x100000L,j;
U8 data i;
#if TX_DEBUG
//读出数据并将其通过串口发出
SendChar(FVAR(U8, address));
for(i = 0; i < 20; i++)
SendChar(FVAR(U8, address |(0x01L << i)));
address = 0x100001L;
j = 0x01L;
for(i = 1; i < 20; i++)
{
j |= (0x01L << i);
SendChar(FVAR(U8, address | j));
}
#endif
//***********************************************
//检查nor flash数据是否正确
address = 0x100000L;
if(FVAR(U8, address) != 0x00)
{
return KO;
}
for(i = 0; i < 20; i++)
{
if(FVAR(U8, (address |(0x01L << i))) != i + 1)
{
return KO;
}
}
address = 0x100001L;
j = 0x01L;
for(i = 1; i < 20; i++)
{
j |= (0x01L << i);
if(FVAR(U8, (address | j)) != i + 0x14)
{
return KO;
}
}
return OK;
}
/************************************************
函 数 名: check_sram()
功 能:测试外接SRAM ( read and write )
说 明:
调 用:
全局变量:
入口参数:无
出口参数:无
返 回 值:无
************************************************/
//测试外接SRAM ( read and write )
bit check_sram(void)
{
U32 xdata address,j;
U8 data i;
//往SRAM写入数据
address = 0x200000L;
*FARRAY(U8, address) = 0x28;
for(i = 0; i < 17; i++)
{
*FARRAY(U8, address |(0x01L << i)) = 0x29 + i;
}
address = 0x200001L;
j = 0x01L;
for(i = 1; i < 17; i++)
{
j |= (0x01L << i);
*FARRAY(U8, address | j) = 0x39 + i;
}
//***********************************************
#if TX_DEBUG
//将写入的数据读出并通过串口发出
address = 0x200000L;
SendChar(FVAR(U8, address));
for(i = 0; i < 17; i++)
{
SendChar(FVAR(U8, (address |(0x01L << i))));
}
address = 0x200001L;
j = 0x01L;
for(i = 1; i < 17; i++)
{
j |= (0x01L << i);
SendChar(FVAR(U8, (address | j)));
}
#endif
//***********************************************
//检查写入SRAM的数据是否正确
//ExternSRAMFlag = OK;
address = 0x200000L;
if(FVAR(U8, address) != 0x28)
{
return KO;
}
for(i = 0; i < 17; i++)
{
if(FVAR(U8, (address |(0x01L << i))) != 0x29 + i)
{
return KO;
}
}
address = 0x200001L;
j = 0x01L;
for(i = 1; i < 17; i++)
{
j |= (0x01L << i);
if(FVAR(U8, (address | j)) != 0x39 + i)
{
return KO;
}
}
return OK;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -