您好,欢迎光临本网站![请登录][注册会员]  
文件名称: DSP6713例程 FLASH
  所属分类: Flash
  开发工具:
  文件大小: 5kb
  下载次数: 0
  上传时间: 2011-02-22
  提 供 者: b053*****
 详细说明: /********************************************************************************\ \* 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 is success."); } /********************************************************************************\ \* Flash function difine. *\ \********************************************************************************/ /********************************************************************************\ \* Flash erase function. *\ \********************************************************************************/ Uint32 Flash_Erase(Uint32 addr,Uint16 type) { Uint32 i,j; *FLASH_5555 = FLASH_UL1; //first *FLASH_2AAA = FLASH_UL2; //second *FLASH_5555 = FLASH_UL3; //third *FLASH_5555 = FLASH_UL4; *FLASH_2AAA = FLASH_UL5; switch(type) { case 0x50: //block erase *(Uint16 *)addr = type; while((*(Uint16 *)addr & 0x80) != 0x80); for(i = 0; i < BLOCK_SIZE; i++) { if(*(Uint16 *)(addr + i) != 0xffff) { j = 0; break; } } j = 1; break; case 0x30: //sector erase *(Uint16 *)addr = type; while((*(Uint16 *)addr & 0x80) != 0x80); for(i = 0; i < SECTOR_SIZE; i++) { if(*(Uint16 *)(addr + i) != 0xffff) { j = 0; break; } } j = 1; break; case 0x10: //chip erase // for(;;) // { *FLASH_5555 = type; // } while((*FLASH_5555 & 0x80) != 0x80); for(i = 0; i < CHIP_SIZE; i++) { if(*(Uint16 *)(addr + i) != 0xffff) { j = 0; break; } } j = 1; break; default: break; } return (j); } /********************************************************************************\ \* Write a single data. *\ \********************************************************************************/ void Flash_Writes(Uint32 addr,Uint16 data) { //Uint16 TempData=0; *FLASH_5555 = FLASH_UL1; *FLASH_2AAA = FLASH_UL2; *FLASH_5555 = FLASH_PROGRAM; //for(;;) //{ *(Uint16 *)addr = data; //TempData = *(Uint16 *)(addr); //} //TempData = *(Uint16 *)(addr); while(*(Uint16 *)addr != data); } /********************************************************************************\ \* Write the certain length data. *\ \********************************************************************************/ void Flash_Writem(Uint32 addr,Uint16 *ptr,Uint32 length) { Uint32 i; for(i = 0; i < length; i++) { // for(;;) // { Flash_Writes(addr+2*i,*(ptr+i)); // } } } /********************************************************************************\ \* Read a single data. *\ \********************************************************************************/ Uint32 Flash_Reads(Uint32 addr) { return (*(Uint16 *)addr); } /********************************************************************************\ \* Read the certain length data. *\ \********************************************************************************/ void Flash_Readm(Uint32 addr,Uint16 *ptr,Uint32 length) { Uint32 i; for(i = 0; i < length; i++) { *(ptr + i) = Flash_Reads(addr+2*i); } } /********************************************************************************\ \* End of DEC6713_FLASH.C *\ \********************************************************************************/ ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: DSP6713例程 FLASH
 输入关键字,在本站1000多万海量源码库中尽情搜索: