annotate Common/Drivers/STM32F4xx_HAL_DRIVER_v120/Src/stm32f4xx_hal_nand.c @ 45:219943ef9dc0

Replaced generic with individual sections to invert the link order and to be able to place specific fonts at defined locations
author Ideenmodellierer
date Sun, 29 Jul 2018 18:07:52 +0200
parents 5f11787b4f42
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @file stm32f4xx_hal_nand.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @author MCD Application Team
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @version V1.2.0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 26-December-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @brief NAND HAL module driver.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 * This file provides a generic firmware to drive NAND memories mounted
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 * as external device.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 ##### How to use this driver #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 This driver is a generic layered driver which contains a set of APIs used to
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 control NAND flash memories. It uses the FMC/FSMC layer functions to interface
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 with NAND devices. This driver is used as follows:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 (+) NAND flash memory configuration sequence using the function HAL_NAND_Init()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 with control and timing parameters for both common and attribute spaces.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 (+) Read NAND flash memory maker and device IDs using the function
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 HAL_NAND_Read_ID(). The read information is stored in the NAND_ID_TypeDef
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 structure declared by the function caller.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 (+) Access NAND flash memory by read/write operations using the functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 HAL_NAND_Read_Page()/HAL_NAND_Read_SpareArea(), HAL_NAND_Write_Page()/HAL_NAND_Write_SpareArea()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 to read/write page(s)/spare area(s). These functions use specific device
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 information (Block, page size..) predefined by the user in the HAL_NAND_Info_TypeDef
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 structure. The read/write address information is contained by the Nand_Address_Typedef
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 structure passed as parameter.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 (+) Perform NAND flash Reset chip operation using the function HAL_NAND_Reset().
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 (+) Perform NAND flash erase block operation using the function HAL_NAND_Erase_Block().
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 The erase block address information is contained in the Nand_Address_Typedef
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 structure passed as parameter.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 (+) Read the NAND flash status operation using the function HAL_NAND_Read_Status().
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 (+) You can also control the NAND device by calling the control APIs HAL_NAND_ECC_Enable()/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 HAL_NAND_ECC_Disable() to respectively enable/disable the ECC code correction
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 feature or the function HAL_NAND_GetECC() to get the ECC correction code.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 (+) You can monitor the NAND device HAL state by calling the function
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 HAL_NAND_GetState()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 (@) This driver is a set of generic APIs which handle standard NAND flash operations.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 If a NAND flash device contains different operations and/or implementations,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 it should be implemented separately.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 * Redistribution and use in source and binary forms, with or without modification,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 * are permitted provided that the following conditions are met:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 * 1. Redistributions of source code must retain the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 * this list of conditions and the following disclaimer.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 * 2. Redistributions in binary form must reproduce the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 * this list of conditions and the following disclaimer in the documentation
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 * and/or other materials provided with the distribution.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 * 3. Neither the name of STMicroelectronics nor the names of its contributors
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 * may be used to endorse or promote products derived from this software
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 * without specific prior written permission.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 /** @addtogroup STM32F4xx_HAL_Driver
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 #ifdef HAL_NAND_MODULE_ENABLED
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 /** @defgroup NAND NAND
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 * @brief NAND HAL module driver
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 /* Private typedef -----------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 /* Private define ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 /** @defgroup NAND_Private_Constants NAND Private Constants
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 /* Private macro -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 /** @defgroup NAND_Private_Macros NAND Private Macros
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 /** @defgroup NAND_Exported_Functions NAND Exported Functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 /** @defgroup NAND_Exported_Functions_Group1 Initialization and de-initialization functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 * @brief Initialization and Configuration functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 ##### NAND Initialization and de-initialization functions #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 This section provides functions allowing to initialize/de-initialize
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 the NAND memory
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 * @brief Perform NAND memory Initialization sequence
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 * @param ComSpace_Timing: pointer to Common space timing structure
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 * @param AttSpace_Timing: pointer to Attribute space timing structure
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 HAL_StatusTypeDef HAL_NAND_Init(NAND_HandleTypeDef *hnand, FMC_NAND_PCC_TimingTypeDef *ComSpace_Timing, FMC_NAND_PCC_TimingTypeDef *AttSpace_Timing)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 /* Check the NAND handle state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 if(hnand == NULL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 return HAL_ERROR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 if(hnand->State == HAL_NAND_STATE_RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 /* Initialize the low level hardware (MSP) */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 HAL_NAND_MspInit(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 /* Initialize NAND control Interface */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 FMC_NAND_Init(hnand->Instance, &(hnand->Init));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 /* Initialize NAND common space timing Interface */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 FMC_NAND_CommonSpace_Timing_Init(hnand->Instance, ComSpace_Timing, hnand->Init.NandBank);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 /* Initialize NAND attribute space timing Interface */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 FMC_NAND_AttributeSpace_Timing_Init(hnand->Instance, AttSpace_Timing, hnand->Init.NandBank);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 /* Enable the NAND device */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 __FMC_NAND_ENABLE(hnand->Instance, hnand->Init.NandBank);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 /* Update the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 hnand->State = HAL_NAND_STATE_READY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183 * @brief Perform NAND memory De-Initialization sequence
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 HAL_StatusTypeDef HAL_NAND_DeInit(NAND_HandleTypeDef *hnand)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 /* Initialize the low level hardware (MSP) */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 HAL_NAND_MspDeInit(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 /* Configure the NAND registers with their reset values */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 FMC_NAND_DeInit(hnand->Instance, hnand->Init.NandBank);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 /* Reset the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 hnand->State = HAL_NAND_STATE_RESET;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 /* Release Lock */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 __HAL_UNLOCK(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 * @brief NAND MSP Init
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 __weak void HAL_NAND_MspInit(NAND_HandleTypeDef *hnand)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 /* NOTE : This function Should not be modified, when the callback is needed,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 the HAL_NAND_MspInit could be implemented in the user file
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 * @brief NAND MSP DeInit
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 __weak void HAL_NAND_MspDeInit(NAND_HandleTypeDef *hnand)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 /* NOTE : This function Should not be modified, when the callback is needed,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 the HAL_NAND_MspDeInit could be implemented in the user file
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 * @brief This function handles NAND device interrupt request.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 void HAL_NAND_IRQHandler(NAND_HandleTypeDef *hnand)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 /* Check NAND interrupt Rising edge flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 if(__FMC_NAND_GET_FLAG(hnand->Instance, hnand->Init.NandBank, FMC_FLAG_RISING_EDGE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 /* NAND interrupt callback*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 HAL_NAND_ITCallback(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 /* Clear NAND interrupt Rising edge pending bit */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 __FMC_NAND_CLEAR_FLAG(hnand->Instance, hnand->Init.NandBank, FMC_FLAG_RISING_EDGE);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 /* Check NAND interrupt Level flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 if(__FMC_NAND_GET_FLAG(hnand->Instance, hnand->Init.NandBank, FMC_FLAG_LEVEL))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 /* NAND interrupt callback*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 HAL_NAND_ITCallback(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 /* Clear NAND interrupt Level pending bit */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 __FMC_NAND_CLEAR_FLAG(hnand->Instance, hnand->Init.NandBank, FMC_FLAG_LEVEL);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 /* Check NAND interrupt Falling edge flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 if(__FMC_NAND_GET_FLAG(hnand->Instance, hnand->Init.NandBank, FMC_FLAG_FALLING_EDGE))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 /* NAND interrupt callback*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 HAL_NAND_ITCallback(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 /* Clear NAND interrupt Falling edge pending bit */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 __FMC_NAND_CLEAR_FLAG(hnand->Instance, hnand->Init.NandBank, FMC_FLAG_FALLING_EDGE);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 /* Check NAND interrupt FIFO empty flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 if(__FMC_NAND_GET_FLAG(hnand->Instance, hnand->Init.NandBank, FMC_FLAG_FEMPT))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 /* NAND interrupt callback*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 HAL_NAND_ITCallback(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 /* Clear NAND interrupt FIFO empty pending bit */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 __FMC_NAND_CLEAR_FLAG(hnand->Instance, hnand->Init.NandBank, FMC_FLAG_FEMPT);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 * @brief NAND interrupt feature callback
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 __weak void HAL_NAND_ITCallback(NAND_HandleTypeDef *hnand)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 /* NOTE : This function Should not be modified, when the callback is needed,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 the HAL_NAND_ITCallback could be implemented in the user file
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 /** @defgroup NAND_Exported_Functions_Group2 Input and Output functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300 * @brief Input Output and memory control functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304 ##### NAND Input and Output functions #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 This section provides functions allowing to use and control the NAND
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 memory
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 * @brief Read the NAND memory electronic signature
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 * @param pNAND_ID: NAND ID structure
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 HAL_StatusTypeDef HAL_NAND_Read_ID(NAND_HandleTypeDef *hnand, NAND_IDTypeDef *pNAND_ID)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 __IO uint32_t data = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324 uint32_t deviceaddress = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 /* Process Locked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 __HAL_LOCK(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 /* Check the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 if(hnand->State == HAL_NAND_STATE_BUSY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 return HAL_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 /* Identify the device address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 if(hnand->Init.NandBank == FMC_NAND_BANK2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 deviceaddress = NAND_DEVICE1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 deviceaddress = NAND_DEVICE2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 /* Update the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 hnand->State = HAL_NAND_STATE_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 /* Send Read ID command sequence */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 *(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = NAND_CMD_READID;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = 0x00;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 /* Read the electronic signature from NAND flash */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353 data = *(__IO uint32_t *)deviceaddress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 /* Return the data read */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 pNAND_ID->Maker_Id = ADDR_1ST_CYCLE(data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 pNAND_ID->Device_Id = ADDR_2ND_CYCLE(data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 pNAND_ID->Third_Id = ADDR_3RD_CYCLE(data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 pNAND_ID->Fourth_Id = ADDR_4TH_CYCLE(data);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 /* Update the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 hnand->State = HAL_NAND_STATE_READY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 /* Process unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 __HAL_UNLOCK(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 * @brief NAND memory reset
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 HAL_StatusTypeDef HAL_NAND_Reset(NAND_HandleTypeDef *hnand)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 uint32_t deviceaddress = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 /* Process Locked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 __HAL_LOCK(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383 /* Check the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384 if(hnand->State == HAL_NAND_STATE_BUSY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 return HAL_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389 /* Identify the device address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390 if(hnand->Init.NandBank == FMC_NAND_BANK2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392 deviceaddress = NAND_DEVICE1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396 deviceaddress = NAND_DEVICE2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 /* Update the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400 hnand->State = HAL_NAND_STATE_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402 /* Send NAND reset command */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403 *(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = 0xFF;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406 /* Update the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407 hnand->State = HAL_NAND_STATE_READY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409 /* Process unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410 __HAL_UNLOCK(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417 * @brief Read Page(s) from NAND memory block
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420 * @param pAddress : pointer to NAND address structure
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 * @param pBuffer : pointer to destination read buffer
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422 * @param NumPageToRead : number of pages to read from block
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 HAL_StatusTypeDef HAL_NAND_Read_Page(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumPageToRead)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427 __IO uint32_t index = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428 uint32_t deviceaddress = 0, size = 0, numpagesread = 0, addressstatus = NAND_VALID_ADDRESS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429 NAND_AddressTypeDef nandaddress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
430 uint32_t addressoffset = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
431
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
432 /* Process Locked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433 __HAL_LOCK(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435 /* Check the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436 if(hnand->State == HAL_NAND_STATE_BUSY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 return HAL_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 /* Identify the device address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442 if(hnand->Init.NandBank == FMC_NAND_BANK2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 deviceaddress = NAND_DEVICE1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448 deviceaddress = NAND_DEVICE2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451 /* Update the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452 hnand->State = HAL_NAND_STATE_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
454 /* Save the content of pAddress as it will be modified */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455 nandaddress.Block = pAddress->Block;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456 nandaddress.Page = pAddress->Page;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457 nandaddress.Zone = pAddress->Zone;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
459 /* Page(s) read loop */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460 while((NumPageToRead != 0) && (addressstatus == NAND_VALID_ADDRESS))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 /* update the buffer size */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463 size = hnand->Info.PageSize + ((hnand->Info.PageSize) * numpagesread);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465 /* Get the address offset */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466 addressoffset = ARRAY_ADDRESS(&nandaddress, hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468 /* Send read page command sequence */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 *(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = NAND_CMD_AREA_A;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = 0x00;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_1ST_CYCLE(addressoffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_2ND_CYCLE(addressoffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_3RD_CYCLE(addressoffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476 /* for 512 and 1 GB devices, 4th cycle is required */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477 if(hnand->Info.BlockNbr >= 1024)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_4TH_CYCLE(addressoffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 *(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = NAND_CMD_AREA_TRUE1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484 /* Get Data into Buffer */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
485 for(; index < size; index++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487 *(uint8_t *)pBuffer++ = *(uint8_t *)deviceaddress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
489
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
490 /* Increment read pages number */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
491 numpagesread++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
492
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493 /* Decrement pages to read */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
494 NumPageToRead--;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
495
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
496 /* Increment the NAND address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
497 addressstatus = HAL_NAND_Address_Inc(hnand, &nandaddress);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
498 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
499
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
500 /* Update the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
501 hnand->State = HAL_NAND_STATE_READY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
502
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
503 /* Process unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
504 __HAL_UNLOCK(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
505
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
506 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
507
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
508 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
509
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
510 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
511 * @brief Write Page(s) to NAND memory block
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
512 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
513 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
514 * @param pAddress : pointer to NAND address structure
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
515 * @param pBuffer : pointer to source buffer to write
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
516 * @param NumPageToWrite : number of pages to write to block
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
517 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
518 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
519 HAL_StatusTypeDef HAL_NAND_Write_Page(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumPageToWrite)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
520 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
521 __IO uint32_t index = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
522 uint32_t tickstart = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
523 uint32_t deviceaddress = 0 , size = 0, numpageswritten = 0, addressstatus = NAND_VALID_ADDRESS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524 NAND_AddressTypeDef nandaddress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
525 uint32_t addressoffset = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
526
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
527 /* Process Locked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
528 __HAL_LOCK(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
529
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
530 /* Check the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
531 if(hnand->State == HAL_NAND_STATE_BUSY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
532 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
533 return HAL_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
534 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
535
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
536 /* Identify the device address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
537 if(hnand->Init.NandBank == FMC_NAND_BANK2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
538 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
539 deviceaddress = NAND_DEVICE1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
540 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
541 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
542 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
543 deviceaddress = NAND_DEVICE2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
544 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
545
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
546 /* Update the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
547 hnand->State = HAL_NAND_STATE_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
548
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
549 /* Save the content of pAddress as it will be modified */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
550 nandaddress.Block = pAddress->Block;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
551 nandaddress.Page = pAddress->Page;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
552 nandaddress.Zone = pAddress->Zone;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
553
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
554 /* Page(s) write loop */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
555 while((NumPageToWrite != 0) && (addressstatus == NAND_VALID_ADDRESS))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
556 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
557 /* update the buffer size */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
558 size = hnand->Info.PageSize + ((hnand->Info.PageSize) * numpageswritten);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
559
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
560 /* Get the address offset */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
561 addressoffset = ARRAY_ADDRESS(&nandaddress, hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
562
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
563 /* Send write page command sequence */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
564 *(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = NAND_CMD_AREA_A;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
565 *(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = NAND_CMD_WRITE0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
566
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
567 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = 0x00;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
568 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_1ST_CYCLE(addressoffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
569 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_2ND_CYCLE(addressoffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
570 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_3RD_CYCLE(addressoffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
571
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
572 /* for 512 and 1 GB devices, 4th cycle is required */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
573 if(hnand->Info.BlockNbr >= 1024)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
574 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
575 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_4TH_CYCLE(addressoffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
576 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
577
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
578 /* Write data to memory */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
579 for(; index < size; index++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
580 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
581 *(__IO uint8_t *)deviceaddress = *(uint8_t *)pBuffer++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
582 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
583
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
584 *(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = NAND_CMD_WRITE_TRUE1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
585
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
586 /* Get tick */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
587 tickstart = HAL_GetTick();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
588
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
589 /* Read status until NAND is ready */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
590 while(HAL_NAND_Read_Status(hnand) != NAND_READY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
591 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
592 if((HAL_GetTick() - tickstart ) > NAND_WRITE_TIMEOUT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
593 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
594 return HAL_TIMEOUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
595 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
596 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
597
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
598 /* Increment written pages number */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
599 numpageswritten++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
600
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
601 /* Decrement pages to write */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
602 NumPageToWrite--;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
603
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
604 /* Increment the NAND address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
605 addressstatus = HAL_NAND_Address_Inc(hnand, &nandaddress);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
606 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
607
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
608 /* Update the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
609 hnand->State = HAL_NAND_STATE_READY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
610
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
611 /* Process unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
612 __HAL_UNLOCK(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
613
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
614 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
615 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
616
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
617 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
618 * @brief Read Spare area(s) from NAND memory
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
619 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
620 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
621 * @param pAddress : pointer to NAND address structure
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
622 * @param pBuffer: pointer to source buffer to write
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
623 * @param NumSpareAreaToRead: Number of spare area to read
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
624 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
625 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
626 HAL_StatusTypeDef HAL_NAND_Read_SpareArea(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumSpareAreaToRead)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
627 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
628 __IO uint32_t index = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
629 uint32_t deviceaddress = 0, size = 0, num_spare_area_read = 0, addressstatus = NAND_VALID_ADDRESS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
630 NAND_AddressTypeDef nandaddress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
631 uint32_t addressoffset = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
632
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
633 /* Process Locked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
634 __HAL_LOCK(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
635
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
636 /* Check the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
637 if(hnand->State == HAL_NAND_STATE_BUSY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
638 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
639 return HAL_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
640 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
641
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
642 /* Identify the device address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
643 if(hnand->Init.NandBank == FMC_NAND_BANK2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
644 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
645 deviceaddress = NAND_DEVICE1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
646 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
647 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
648 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
649 deviceaddress = NAND_DEVICE2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
650 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
651
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
652 /* Update the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
653 hnand->State = HAL_NAND_STATE_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
654
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
655 /* Save the content of pAddress as it will be modified */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
656 nandaddress.Block = pAddress->Block;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
657 nandaddress.Page = pAddress->Page;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
658 nandaddress.Zone = pAddress->Zone;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
659
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
660 /* Spare area(s) read loop */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
661 while((NumSpareAreaToRead != 0) && (addressstatus == NAND_VALID_ADDRESS))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
662 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
663 /* update the buffer size */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
664 size = (hnand->Info.SpareAreaSize) + ((hnand->Info.SpareAreaSize) * num_spare_area_read);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
665
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
666 /* Get the address offset */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
667 addressoffset = ARRAY_ADDRESS(&nandaddress, hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
668
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
669 /* Send read spare area command sequence */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
670 *(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = NAND_CMD_AREA_C;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
671
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
672 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = 0x00;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
673 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_1ST_CYCLE(addressoffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
674 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_2ND_CYCLE(addressoffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
675 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_3RD_CYCLE(addressoffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
676
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
677 /* for 512 and 1 GB devices, 4th cycle is required */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
678 if(hnand->Info.BlockNbr >= 1024)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
679 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
680 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_4TH_CYCLE(addressoffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
681 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
682
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
683 *(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = NAND_CMD_AREA_TRUE1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
684
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
685 /* Get Data into Buffer */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
686 for ( ;index < size; index++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
687 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
688 *(uint8_t *)pBuffer++ = *(uint8_t *)deviceaddress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
689 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
690
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
691 /* Increment read spare areas number */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
692 num_spare_area_read++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
693
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
694 /* Decrement spare areas to read */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
695 NumSpareAreaToRead--;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
696
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
697 /* Increment the NAND address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
698 addressstatus = HAL_NAND_Address_Inc(hnand, &nandaddress);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
699 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
700
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
701 /* Update the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
702 hnand->State = HAL_NAND_STATE_READY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
703
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
704 /* Process unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
705 __HAL_UNLOCK(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
706
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
707 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
708 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
709
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
710 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
711 * @brief Write Spare area(s) to NAND memory
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
712 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
713 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
714 * @param pAddress : pointer to NAND address structure
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
715 * @param pBuffer : pointer to source buffer to write
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
716 * @param NumSpareAreaTowrite : number of spare areas to write to block
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
717 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
718 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
719 HAL_StatusTypeDef HAL_NAND_Write_SpareArea(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumSpareAreaTowrite)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
720 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
721 __IO uint32_t index = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
722 uint32_t tickstart = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
723 uint32_t deviceaddress = 0, size = 0, num_spare_area_written = 0, addressstatus = NAND_VALID_ADDRESS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
724 NAND_AddressTypeDef nandaddress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
725 uint32_t addressoffset = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
726
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
727 /* Process Locked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
728 __HAL_LOCK(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
729
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
730 /* Check the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
731 if(hnand->State == HAL_NAND_STATE_BUSY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
732 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
733 return HAL_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
734 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
735
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
736 /* Identify the device address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
737 if(hnand->Init.NandBank == FMC_NAND_BANK2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
738 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
739 deviceaddress = NAND_DEVICE1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
740 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
741 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
742 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
743 deviceaddress = NAND_DEVICE2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
744 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
745
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
746 /* Update the FMC_NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
747 hnand->State = HAL_NAND_STATE_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
748
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
749 /* Save the content of pAddress as it will be modified */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
750 nandaddress.Block = pAddress->Block;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
751 nandaddress.Page = pAddress->Page;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
752 nandaddress.Zone = pAddress->Zone;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
753
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
754 /* Spare area(s) write loop */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
755 while((NumSpareAreaTowrite != 0) && (addressstatus == NAND_VALID_ADDRESS))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
756 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
757 /* update the buffer size */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
758 size = (hnand->Info.SpareAreaSize) + ((hnand->Info.SpareAreaSize) * num_spare_area_written);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
759
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
760 /* Get the address offset */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
761 addressoffset = ARRAY_ADDRESS(&nandaddress, hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
762
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
763 /* Send write Spare area command sequence */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
764 *(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = NAND_CMD_AREA_C;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
765 *(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = NAND_CMD_WRITE0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
766
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
767 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = 0x00;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
768 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_1ST_CYCLE(addressoffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
769 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_2ND_CYCLE(addressoffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
770 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_3RD_CYCLE(addressoffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
771
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
772 /* for 512 and 1 GB devices, 4th cycle is required */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
773 if(hnand->Info.BlockNbr >= 1024)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
774 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
775 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_4TH_CYCLE(addressoffset);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
776 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
777
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
778 /* Write data to memory */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
779 for(; index < size; index++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
780 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
781 *(__IO uint8_t *)deviceaddress = *(uint8_t *)pBuffer++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
782 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
783
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
784 *(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = NAND_CMD_WRITE_TRUE1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
785
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
786 /* Get tick */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
787 tickstart = HAL_GetTick();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
788
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
789 /* Read status until NAND is ready */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
790 while(HAL_NAND_Read_Status(hnand) != NAND_READY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
791 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
792 if((HAL_GetTick() - tickstart ) > NAND_WRITE_TIMEOUT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
793 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
794 return HAL_TIMEOUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
795 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
796 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
797
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
798 /* Increment written spare areas number */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
799 num_spare_area_written++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
800
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
801 /* Decrement spare areas to write */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
802 NumSpareAreaTowrite--;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
803
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
804 /* Increment the NAND address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
805 addressstatus = HAL_NAND_Address_Inc(hnand, &nandaddress);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
806 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
807
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
808 /* Update the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
809 hnand->State = HAL_NAND_STATE_READY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
810
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
811 /* Process unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
812 __HAL_UNLOCK(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
813
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
814 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
815 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
816
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
817 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
818 * @brief NAND memory Block erase
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
819 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
820 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
821 * @param pAddress : pointer to NAND address structure
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
822 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
823 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
824 HAL_StatusTypeDef HAL_NAND_Erase_Block(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
825 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
826 uint32_t deviceaddress = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
827 uint32_t tickstart = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
828
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
829 /* Process Locked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
830 __HAL_LOCK(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
831
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
832 /* Check the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
833 if(hnand->State == HAL_NAND_STATE_BUSY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
834 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
835 return HAL_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
836 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
837
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
838 /* Identify the device address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
839 if(hnand->Init.NandBank == FMC_NAND_BANK2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
840 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
841 deviceaddress = NAND_DEVICE1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
842 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
843 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
844 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
845 deviceaddress = NAND_DEVICE2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
846 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
847
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
848 /* Update the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
849 hnand->State = HAL_NAND_STATE_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
850
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
851 /* Send Erase block command sequence */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
852 *(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = NAND_CMD_ERASE0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
853
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
854 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_1ST_CYCLE(ARRAY_ADDRESS(pAddress, hnand));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
855 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_2ND_CYCLE(ARRAY_ADDRESS(pAddress, hnand));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
856 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_3RD_CYCLE(ARRAY_ADDRESS(pAddress, hnand));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
857
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
858 /* for 512 and 1 GB devices, 4th cycle is required */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
859 if(hnand->Info.BlockNbr >= 1024)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
860 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
861 *(__IO uint8_t *)((uint32_t)(deviceaddress | ADDR_AREA)) = ADDR_4TH_CYCLE(ARRAY_ADDRESS(pAddress, hnand));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
862 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
863
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
864 *(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = NAND_CMD_ERASE1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
865
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
866 /* Update the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
867 hnand->State = HAL_NAND_STATE_READY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
868
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
869 /* Get tick */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
870 tickstart = HAL_GetTick();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
871
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
872 /* Read status until NAND is ready */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
873 while(HAL_NAND_Read_Status(hnand) != NAND_READY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
874 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
875 if((HAL_GetTick() - tickstart ) > NAND_WRITE_TIMEOUT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
876 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
877 /* Process unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
878 __HAL_UNLOCK(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
879
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
880 return HAL_TIMEOUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
881 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
882 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
883
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
884 /* Process unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
885 __HAL_UNLOCK(hnand);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
886
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
887 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
888 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
889
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
890 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
891 * @brief NAND memory read status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
892 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
893 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
894 * @retval NAND status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
895 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
896 uint32_t HAL_NAND_Read_Status(NAND_HandleTypeDef *hnand)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
897 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
898 uint32_t data = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
899 uint32_t deviceaddress = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
900
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
901 /* Identify the device address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
902 if(hnand->Init.NandBank == FMC_NAND_BANK2)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
903 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
904 deviceaddress = NAND_DEVICE1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
905 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
906 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
907 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
908 deviceaddress = NAND_DEVICE2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
909 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
910
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
911 /* Send Read status operation command */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
912 *(__IO uint8_t *)((uint32_t)(deviceaddress | CMD_AREA)) = NAND_CMD_STATUS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
913
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
914 /* Read status register data */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
915 data = *(__IO uint8_t *)deviceaddress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
916
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
917 /* Return the status */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
918 if((data & NAND_ERROR) == NAND_ERROR)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
919 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
920 return NAND_ERROR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
921 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
922 else if((data & NAND_READY) == NAND_READY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
923 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
924 return NAND_READY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
925 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
926
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
927 return NAND_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
928 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
929
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
930 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
931 * @brief Increment the NAND memory address
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
932 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
933 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
934 * @param pAddress: pointer to NAND address structure
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
935 * @retval The new status of the increment address operation. It can be:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
936 * - NAND_VALID_ADDRESS: When the new address is valid address
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
937 * - NAND_INVALID_ADDRESS: When the new address is invalid address
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
938 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
939 uint32_t HAL_NAND_Address_Inc(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
940 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
941 uint32_t status = NAND_VALID_ADDRESS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
942
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
943 /* Increment page address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
944 pAddress->Page++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
945
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
946 /* Check NAND address is valid */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
947 if(pAddress->Page == hnand->Info.BlockSize)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
948 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
949 pAddress->Page = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
950 pAddress->Block++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
951
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
952 if(pAddress->Block == hnand->Info.ZoneSize)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
953 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
954 pAddress->Block = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
955 pAddress->Zone++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
956
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
957 if(pAddress->Zone == (hnand->Info.ZoneSize/ hnand->Info.BlockNbr))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
958 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
959 status = NAND_INVALID_ADDRESS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
960 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
961 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
962 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
963
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
964 return (status);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
965 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
966 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
967 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
968 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
969
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
970 /** @defgroup NAND_Exported_Functions_Group3 Peripheral Control functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
971 * @brief management functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
972 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
973 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
974 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
975 ##### NAND Control functions #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
976 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
977 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
978 This subsection provides a set of functions allowing to control dynamically
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
979 the NAND interface.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
980
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
981 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
982 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
983 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
984
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
985
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
986 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
987 * @brief Enables dynamically NAND ECC feature.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
988 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
989 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
990 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
991 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
992 HAL_StatusTypeDef HAL_NAND_ECC_Enable(NAND_HandleTypeDef *hnand)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
993 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
994 /* Check the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
995 if(hnand->State == HAL_NAND_STATE_BUSY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
996 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
997 return HAL_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
998 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
999
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1000 /* Update the NAND state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1001 hnand->State = HAL_NAND_STATE_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1002
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1003 /* Enable ECC feature */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1004 FMC_NAND_ECC_Enable(hnand->Instance, hnand->Init.NandBank);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1005
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1006 /* Update the NAND state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1007 hnand->State = HAL_NAND_STATE_READY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1008
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1009 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1010 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1011
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1012 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1013 * @brief Disables dynamically FMC_NAND ECC feature.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1014 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1015 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1016 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1017 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1018 HAL_StatusTypeDef HAL_NAND_ECC_Disable(NAND_HandleTypeDef *hnand)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1019 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1020 /* Check the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1021 if(hnand->State == HAL_NAND_STATE_BUSY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1022 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1023 return HAL_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1024 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1025
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1026 /* Update the NAND state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1027 hnand->State = HAL_NAND_STATE_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1028
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1029 /* Disable ECC feature */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1030 FMC_NAND_ECC_Disable(hnand->Instance, hnand->Init.NandBank);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1031
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1032 /* Update the NAND state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1033 hnand->State = HAL_NAND_STATE_READY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1034
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1035 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1036 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1037
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1038 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1039 * @brief Disables dynamically NAND ECC feature.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1040 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1041 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1042 * @param ECCval: pointer to ECC value
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1043 * @param Timeout: maximum timeout to wait
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1044 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1045 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1046 HAL_StatusTypeDef HAL_NAND_GetECC(NAND_HandleTypeDef *hnand, uint32_t *ECCval, uint32_t Timeout)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1047 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1048 HAL_StatusTypeDef status = HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1049
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1050 /* Check the NAND controller state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1051 if(hnand->State == HAL_NAND_STATE_BUSY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1052 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1053 return HAL_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1054 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1055
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1056 /* Update the NAND state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1057 hnand->State = HAL_NAND_STATE_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1058
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1059 /* Get NAND ECC value */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1060 status = FMC_NAND_GetECC(hnand->Instance, ECCval, hnand->Init.NandBank, Timeout);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1061
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1062 /* Update the NAND state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1063 hnand->State = HAL_NAND_STATE_READY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1064
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1065 return status;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1066 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1067
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1068 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1069 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1070 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1071
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1072
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1073 /** @defgroup NAND_Exported_Functions_Group4 Peripheral State functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1074 * @brief Peripheral State functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1075 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1076 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1077 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1078 ##### NAND State functions #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1079 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1080 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1081 This subsection permits to get in run-time the status of the NAND controller
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1082 and the data flow.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1083
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1084 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1085 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1086 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1087
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1088 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1089 * @brief return the NAND state
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1090 * @param hnand: pointer to a NAND_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1091 * the configuration information for NAND module.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1092 * @retval HAL state
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1093 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1094 HAL_NAND_StateTypeDef HAL_NAND_GetState(NAND_HandleTypeDef *hnand)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1095 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1096 return hnand->State;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1097 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1098
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1099 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1100 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1101 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1102
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1103 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1104 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1105 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1106
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1107 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1108 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1109 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1110
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1111 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1112 #endif /* HAL_NAND_MODULE_ENABLED */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1113
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1114 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1115 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1116 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1117
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1118 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/