www.pudn.com > writemac.rar > dm643_flash_write.c
/* * Copyright 2003 by Spectrum Digital Incorporated. * All rights reserved. Property of Spectrum Digital Incorporated. */ /* * ======== dm643_flash_write.c ======== * DM643_FLASH_write() implementation */ #include#include #include #include /* Write data to a data range in Flash */ void DM643_FLASH_write(Uint32 src, Uint32 dst, Uint32 length) { Uint8 *psrc, *pdst; Uint32 i; /* Establish source and destination */ psrc = (Uint8 *)src; pdst = (Uint8 *)dst; for (i = 0; i < length; i++) { // Program one 8-bit word *((Uint8 *)DM643_FLASH_BASE) = 0xaa; *((Uint8 *)DM643_FLASH_BASE) = 0x55; *((Uint8 *)DM643_FLASH_BASE) = 0xa0; *pdst = *psrc; // Wait for operation to complete while(1) if (*pdst == *psrc) break; pdst++; psrc++; } /* Put back in read mode */ *((Uint16 *)DM643_FLASH_BASE) = 0xf0; }