DSP6713板子里的flash擦除成功后写数据出错
时间:10-02
整理:3721RD
点击:
flash里写数据的函数,大家帮我看下有什么问题,谢谢
void Flash_Writes(unsigned int addr,unsigned short data)
{
*(char *)FLASH_ADR1 = FLASH_KEY1;//aa ///adr1: 555
*(char *)FLASH_ADR2 = FLASH_KEY2;//55 ///adr2: aaa
*(char *)FLASH_ADR1 = FLASH_KEY3;//a0
*(unsigned short *)addr = data;
// while(*(int *)addr != data);
if (*(int *)addr != data)
{
printf("Writes failure!");
exit(0);
}
void Flash_Writes(unsigned int addr,unsigned short data)
{
*(char *)FLASH_ADR1 = FLASH_KEY1;//aa ///adr1: 555
*(char *)FLASH_ADR2 = FLASH_KEY2;//55 ///adr2: aaa
*(char *)FLASH_ADR1 = FLASH_KEY3;//a0
*(unsigned short *)addr = data;
// while(*(int *)addr != data);
if (*(int *)addr != data)
{
printf("Writes failure!");
exit(0);
}