📄 64m_qdre.c
字号:
/*****************************************************************************
*
* File name : 64M_QDRE.c
* The Quick Data Reclaim sample program file for 64Mbit Flash
* Version : 0.40.10
* CPU : SH7709A
* Compiler : SHC V.5.1C
* Author : S.Ishimoto, F.Saeki
*
* The information described here may contain technical inaccuracies or
* typographical errors. Renesas technology Corporation and Renesas Solutions
* and Oyo Electric Corporation assume no responsibility for any damage,
* liability, or other loss rising from these inaccuracies or errors.
*
* Copyright (c) 2000-2003
* Renesas Technology Coporation and Renesas Solutions Corporation
* and Oyo Electric Corporation All Rights Reserved
*
* ---------------------------------------------------------------------------
* This sample program provides C code for using the Renesas
* 64Mbit(4Mb x16) NOR type Flash Memory and MCP(Multi Chip Package).
* The following typical devices are supported in this file.
* M5M29KB/T641AVP
* M6MGB/T641S4TP
* M6MGB/T641S8AKT
* M6MGB/T647M17AKT
* M6MGB/T647M34CKT
* M6MGB/T64BS4AWG
* M6MGB/T64BS8AWG
* M6MGB/T64BM17AWG
* M6MGB/T64BM34CWG
*
* The following function commands are available in this file.
* FmQuickDataReclaim() Quick Data Reclaim
*
* ---------------------------------------------------------------------------
* Version History: Ver. 0.10.00 '00/08/09 First release
* Ver. 0.20.00 '01/09/04 Change some comments
* Ver. 0.30.00 '01/10/16 Change some comments
* Ver. 0.40.00 '03/03/07 Change some comments
* Ver. 0.40.10 '03/08/22 Change of a product type name
* Change of a comment(NOR type)
*****************************************************************************/
#define TRUE 1
#define FALSE 0
/*****************************************************************************
* FmQuickDataReclaim() Quick Data Reclaim
* ---------------------------------------------------------------------------
* Declaration int FmQuickDataReclaim(unsigned short *pProgStart,
* unsigned short *pQDRStart)
* ---------------------------------------------------------------------------
* Description The 1-page data of a flash memory is copied to another address.
* The data of the address specified using the Flash to Page Buffer
* command is read into a page buffer. Data is programmed to the
* address specified using the Page Buffer to Flash command.
* The data of the address to program must be erased.
* ---------------------------------------------------------------------------
* Parameter unsigned short *pProgStart; Program start address
* unsigned short *pQDRStart; Start address of the data to be programed
* ---------------------------------------------------------------------------
* return value int Errflg;
* TRUE : Program normal stop
* FALSE: Program abnormal stop
* ---------------------------------------------------------------------------
* No Related Function
* ---------------------------------------------------------------------------
* Note Please do not optimize the polling portion of a status register.
* ---------------------------------------------------------------------------
* Version Ver. 0.10.00 '00/08/09 First release
* Ver. 0.20.00 '01/09/04 In error determination
* if ((*pEraseStart & 0x10) == 0x10) {
* -> if ((*pEraseStart & 0x38) != 0x00) {
* Ver. 0.40.00 '03/03/07 Change some comments
*****************************************************************************/
int FmQuickDataReclaim(unsigned short *pProgStart,unsigned short *pQDRStart)
{
int Errflg = TRUE; /* Error Flag */
/*==== Copy from source data to Page Buffer ====*/
/***** Output of Flash to Page Buffer Command *****/
*pQDRStart = 0xF1; /* 1st Bus Cycle */
*pQDRStart = 0xD0; /* 2nd Bus Cycle */
/*==== Status Polling ====*/
while((*pQDRStart & 0x80) != 0x80); /* Status Data Confirmation */
*pQDRStart = 0x50; /* Clear Status */
/*==== Program from Page Buffer to Flash ====*/
/***** Output of Page Buffer to Flash Command *****/
*pProgStart = 0x0E; /* 1st Bus Cycle */
*pProgStart = 0xD0; /* 2nd Bus Cycle */
/*==== Status Polling ====*/
while((*pProgStart & 0x80) != 0x80) ; /* Status Data Confirmation */
if ((*pProgStart & 0x38) != 0x00) { /* Check of Error */
Errflg = FALSE; /* Set of Error Flag */
*pProgStart = 0x50; /* Clear Status */
}
*pProgStart = 0xff; /* OUtput of Read Array Command */
return Errflg;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -