📄 evm5509_flash_write.c
字号:
/*
* Copyright 2002 by Spectrum Digital Incorporated.
* All rights reserved. Property of Spectrum Digital Incorporated.
*/
/*
* ======== evm5509_flash_write.c ========
* EVM5509_FLASH_write() implementation
*/
#include <std.h>
#include <csl.h>
#include <evm5509.h>
#include <evm5509_flash.h>
/* Write data to a data range in Flash */
void EVM5509_FLASH_write(Uint32 src, Uint32 dst, Uint32 length)
{
Uint32 i, tmpval;
/* Establish source and destination */
for (i = 0; i < length; i++)
{
// Program one 16-bit word
EVM5509_mset(EVM5509_FLASH_CTL555, 0xaa);
EVM5509_mset(EVM5509_FLASH_CTL2AA, 0x55);
EVM5509_mset(EVM5509_FLASH_CTL555, 0xa0);
tmpval = EVM5509_mget(src);
EVM5509_mset(dst, tmpval);
// Wait for operation to complete
while(1)
{
tmpval = EVM5509_mget(src);
if (EVM5509_mget(dst) == tmpval)
break;
}
src++;
dst++;
}
/* Put back in read mode */
EVM5509_mset(EVM5509_FLASH_BASE, 0xf0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -