PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
main_flash.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2013 Spansion LLC. All Rights Reserved.
3 *
4 * This software is owned and published by:
5 * Spansion LLC, 915 DeGuigne Dr. Sunnyvale, CA 94088-3453 ("Spansion").
6 *
7 * BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
8 * BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
9 *
10 * This software contains source code for use with Spansion
11 * components. This software is licensed by Spansion to be adapted only
12 * for use in systems utilizing Spansion components. Spansion shall not be
13 * responsible for misuse or illegal use of this software for devices not
14 * supported herein. Spansion is providing this software "AS IS" and will
15 * not be responsible for issues arising from incorrect user implementation
16 * of the software.
17 *
18 * SPANSION MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
19 * REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
20 * ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
21 * WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
22 * WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
23 * WARRANTY OF NONINFRINGEMENT.
24 * SPANSION SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
25 * NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
26 * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
27 * LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
28 * INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
29 * INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
30 * SAVINGS OR PROFITS,
31 * EVEN IF SPANSION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32 * YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
33 * INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
34 * FROM, THE SOFTWARE.
35 *
36 * This software may be replicated in part or whole for the licensed use,
37 * with the restriction that this Disclaimer and Copyright notice must be
38 * included with each copy of this software, whether used in part or whole,
39 * at all times.
40 */
41 
42 /******************************************************************************/
53 #ifndef _MAIN_FLASH_H_
54 #define _MAIN_FLASH_H_
55 
86 /*---------------------------------------------------------------------------*/
87 /* include files */
88 /*---------------------------------------------------------------------------*/
89 #include "pdl.h"
90 
91 #if defined(PDL_PERIPHERAL_MAIN_FLASH_ACTIVE)
92 
94 
95 #define MFLASH_CODE1 0x0AA8
96 #define MFLASH_CODE2 0x0554
97 
98 #define MFLASH_RET_OK 0
99 #define MFLASH_RET_INVALID_PARA 1
100 #define MFLASH_RET_ABNORMAL 2
101 
102 #define MFLASH_CHK_TOGG_NORMAL 0
103 #define MFLASH_CHK_TOGG_ABNORMAL 1
104 
105 #define MFLASH_CHK_DPOL_NORMAL 0
106 #define MFLASH_CHK_DPOL_ABNORMAL 1
107 
108 #define MFLASH_CHK_DPOL_MASK (uint16_t)0x0080
109 #define MFLASH_CHK_TOGG_MASK (uint16_t)0x0040
110 #define MFLASH_CHK_TLOV_MASK (uint16_t)0x0020
111 
112 #define CR_DATA_ADDR (0x00402000)
113 
114 /*---------------------------------------------------------------------------*/
115 /* function prototypes */
116 /*---------------------------------------------------------------------------*/
117 #ifdef __cplusplus
118 extern "C" {
119 #endif
120 uint8_t MFlash_ChipErase(boolean_t bCrRemain);
121 uint8_t MFlash_SectorErase(uint16_t* pu16SecAddr);
122 uint8_t MFlash_Write(uint16_t* pWriteAddr,
123  uint16_t* pWriteData,
124  uint32_t EvenSize,
125  boolean_t bVerifyAndEccCheck);
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
132 
133 #endif /* PERIPHERAL_AVAILABLE_MAINFLASH */
134 
135 #endif /* _MAINFLASH_FM3_H_ */