/********************************************************************************\
\*  DEC6713_FLASH.c	V2.00													    *\
\*  Copyright 2004 by SEED Electronic Technology LTD.                           *\
\*  All rights reserved. SEED Electronic Technology LTD.                        *\
\*  Restricted rights to use, duplicate or disclose this code are               *\
\*  granted through contract.    											    *\
                                             
\*	Designed by: Hongshuai.Li
\*	Discription: Erase, write and read the whole chip.
\*	Date: Modified	05.10.2005											    *\
\********************************************************************************/
#include 
#include 
#include 
#include 
#include 
#include 
#include "DEC6713_FLASH.h"
#include 
/********************************************************************************/
Uint32 i;
Uint16 TempData;
Uint32 Src_StartAdd;
Uint32 Dst_StartAdd;
extern far void vectors();
/********************************************************************************/
/********************************************************************************/
void main()
{
	Src_StartAdd = 0x90000000;
	/* Initialize CSL, must when using. */
	CSL_init();
	
	/* Initialize DEC6713 board. */
	DEC6713_init();
	
	/* Configure interrupt. */
	IRQ_setVecs(vectors);
    IRQ_nmiEnable();
    IRQ_globalEnable();
    
    /* Erase flash memory. */
    Flash_Erase(0x90000000,0x10);
	printf("\nErase flash ok.");
	
    /* Write flash memory. */
    for(i=0;i<0x40000;i++)
    {
    	Flash_Writes(Src_StartAdd+2*i,fmod(i,0x10000));
    }
    printf("\nWrite flash ok.");
    	
    /* Read flash memory. */
    for(i=0;i<0x40000;i++)
    {
    	TempData = Flash_Reads(Src_StartAdd+2*i);
    	if(TempData != fmod(i,0x10000))
    	{
    		printf("\n Testing is Failure!");
    		printf("\nAddress 0x%x is error!",i);
    		exit(0);
    	}
    }
	
	printf("\nOpereation i
                                    
                                    
                                        
                                            1