/** ****************************************************************************** * @file nand_if.h * @author MCD Application Team * @version V4.0.0 * @date 21-January-2013 * @brief All functions related to the NAND process ****************************************************************************** * @attention * *

© COPYRIGHT 2013 STMicroelectronics

* * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.st.com/software_license_agreement_liberty_v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __NAND_IF_H #define __NAND_IF_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ #define NAND_OK 0 #define NAND_FAIL 1 #define FREE_BLOCK (1 << 12 ) #define BAD_BLOCK (1 << 13 ) #define VALID_BLOCK (1 << 14 ) #define USED_BLOCK (1 << 15 ) #define MAX_PHY_BLOCKS_PER_ZONE 1024 #define MAX_LOG_BLOCKS_PER_ZONE 1000 /* Private Structures---------------------------------------------------------*/ typedef struct __SPARE_AREA { uint16_t LogicalIndex; uint16_t DataStatus; uint16_t BlockStatus; } SPARE_AREA; typedef enum { WRITE_IDLE = 0, POST_WRITE, PRE_WRITE, WRITE_CLEANUP, WRITE_ONGOING }WRITE_STATE; typedef enum { OLD_BLOCK = 0, UNUSED_BLOCK }BLOCK_STATE; /* Private macro --------------------------------------------------------------*/ //#define WEAR_LEVELLING_SUPPORT #define WEAR_DEPTH 10 #define PAGE_TO_WRITE (Transfer_Length/512) /* Private variables ----------------------------------------------------------*/ /* Private function prototypes ------------------------------------------------*/ /* exported functions ---------------------------------------------------------*/ uint16_t NAND_Init (void); uint16_t NAND_Write (uint32_t Memory_Offset, uint32_t *Writebuff, uint16_t Transfer_Length); uint16_t NAND_Read (uint32_t Memory_Offset, uint32_t *Readbuff, uint16_t Transfer_Length); uint16_t NAND_Format (void); SPARE_AREA ReadSpareArea (uint32_t address); #endif /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/