stm3210e_eval_fsmc_nand.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm3210e_eval_fsmc_nand.h
00004   * @author  MCD Application Team
00005   * @version V4.3.0
00006   * @date    10/15/2010
00007   * @brief   This file contains all the functions prototypes for the 
00008   *          stm3210e_eval_fsmc_nand firmware driver.
00009   ******************************************************************************
00010   * @copy
00011   *
00012   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00013   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
00014   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
00015   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
00016   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
00017   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00018   *
00019   * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
00020   */
00021    
00022 /* Define to prevent recursive inclusion -------------------------------------*/
00023 #ifndef __STM3210E_EVAL_FSMC_NAND_H
00024 #define __STM3210E_EVAL_FSMC_NAND_H
00025 
00026 #ifdef __cplusplus
00027  extern "C" {
00028 #endif
00029 
00030 /* Includes ------------------------------------------------------------------*/
00031 #include "stm32f10x.h"
00032 
00033 /** @addtogroup Utilities
00034   * @{
00035   */
00036   
00037 /** @addtogroup STM32_EVAL
00038   * @{
00039   */ 
00040 
00041 /** @addtogroup STM3210E_EVAL
00042   * @{
00043   */
00044   
00045 /** @addtogroup STM3210E_EVAL_FSMC_NAND
00046   * @{
00047   */  
00048 
00049 /** @defgroup STM3210E_EVAL_FSMC_NAND_Exported_Types
00050   * @{
00051   */
00052 typedef struct
00053 {
00054   uint8_t Maker_ID;
00055   uint8_t Device_ID;
00056   uint8_t Third_ID;
00057   uint8_t Fourth_ID;
00058 }NAND_IDTypeDef;
00059 
00060 typedef struct 
00061 {
00062   uint16_t Zone;
00063   uint16_t Block;
00064   uint16_t Page;
00065 } NAND_ADDRESS;  
00066 /**
00067   * @}
00068   */
00069   
00070 /** @defgroup STM3210E_EVAL_FSMC_NAND_Exported_Constants
00071   * @{
00072   */
00073 /** 
00074   * @brief  NAND Area definition  for STM3210E-EVAL Board RevD  
00075   */  
00076 #define CMD_AREA                   (uint32_t)(1<<16)  /* A16 = CLE  high */
00077 #define ADDR_AREA                  (uint32_t)(1<<17)  /* A17 = ALE high */
00078 
00079 #define DATA_AREA                  ((uint32_t)0x00000000) 
00080 
00081 /** 
00082   * @brief  FSMC NAND memory command  
00083   */  
00084 #define NAND_CMD_AREA_A            ((uint8_t)0x00)
00085 #define NAND_CMD_AREA_B            ((uint8_t)0x01)
00086 #define NAND_CMD_AREA_C            ((uint8_t)0x50)
00087 
00088 #define NAND_CMD_WRITE0            ((uint8_t)0x80)
00089 #define NAND_CMD_WRITE_TRUE1       ((uint8_t)0x10)
00090 
00091 #define NAND_CMD_ERASE0            ((uint8_t)0x60)
00092 #define NAND_CMD_ERASE1            ((uint8_t)0xD0)
00093 
00094 #define NAND_CMD_READID            ((uint8_t)0x90)
00095 #define NAND_CMD_STATUS            ((uint8_t)0x70)
00096 #define NAND_CMD_LOCK_STATUS       ((uint8_t)0x7A)
00097 #define NAND_CMD_RESET             ((uint8_t)0xFF)
00098 
00099 /** 
00100   * @brief  NAND memory status  
00101   */  
00102 #define NAND_VALID_ADDRESS         ((uint32_t)0x00000100)
00103 #define NAND_INVALID_ADDRESS       ((uint32_t)0x00000200)
00104 #define NAND_TIMEOUT_ERROR         ((uint32_t)0x00000400)
00105 #define NAND_BUSY                  ((uint32_t)0x00000000)
00106 #define NAND_ERROR                 ((uint32_t)0x00000001)
00107 #define NAND_READY                 ((uint32_t)0x00000040)
00108 
00109 /** 
00110   * @brief  FSMC NAND memory parameters  
00111   */  
00112 #define NAND_PAGE_SIZE             ((uint16_t)0x0200) /* 512 bytes per page w/o Spare Area */
00113 #define NAND_BLOCK_SIZE            ((uint16_t)0x0020) /* 32x512 bytes pages per block */
00114 #define NAND_ZONE_SIZE             ((uint16_t)0x0400) /* 1024 Block per zone */
00115 #define NAND_SPARE_AREA_SIZE       ((uint16_t)0x0010) /* last 16 bytes as spare area */
00116 #define NAND_MAX_ZONE              ((uint16_t)0x0004) /* 4 zones of 1024 block */
00117 
00118 /** 
00119   * @brief  FSMC NAND memory address computation  
00120   */  
00121 #define ADDR_1st_CYCLE(ADDR)       (uint8_t)((ADDR)& 0xFF)               /* 1st addressing cycle */
00122 #define ADDR_2nd_CYCLE(ADDR)       (uint8_t)(((ADDR)& 0xFF00) >> 8)      /* 2nd addressing cycle */
00123 #define ADDR_3rd_CYCLE(ADDR)       (uint8_t)(((ADDR)& 0xFF0000) >> 16)   /* 3rd addressing cycle */
00124 #define ADDR_4th_CYCLE(ADDR)       (uint8_t)(((ADDR)& 0xFF000000) >> 24) /* 4th addressing cycle */   
00125 /**
00126   * @}
00127   */ 
00128   
00129 /** @defgroup STM3210E_EVAL_FSMC_NAND_Exported_Macros
00130   * @{
00131   */ 
00132 /**
00133   * @}
00134   */ 
00135 
00136 /** @defgroup STM3210E_EVAL_FSMC_NAND_Exported_Functions
00137   * @{
00138   */ 
00139 void NAND_Init(void);
00140 void NAND_ReadID(NAND_IDTypeDef* NAND_ID);
00141 uint32_t NAND_WriteSmallPage(uint8_t *pBuffer, NAND_ADDRESS Address, uint32_t NumPageToWrite);
00142 uint32_t NAND_ReadSmallPage (uint8_t *pBuffer, NAND_ADDRESS Address, uint32_t NumPageToRead);
00143 uint32_t NAND_WriteSpareArea(uint8_t *pBuffer, NAND_ADDRESS Address, uint32_t NumSpareAreaTowrite);
00144 uint32_t NAND_ReadSpareArea(uint8_t *pBuffer, NAND_ADDRESS Address, uint32_t NumSpareAreaToRead);
00145 uint32_t NAND_EraseBlock(NAND_ADDRESS Address);
00146 uint32_t NAND_Reset(void);
00147 uint32_t NAND_GetStatus(void);
00148 uint32_t NAND_ReadStatus(void);
00149 uint32_t NAND_AddressIncrement(NAND_ADDRESS* Address);
00150 
00151 #ifdef __cplusplus
00152 }
00153 #endif
00154 
00155 #endif /* __STM3210E_EVAL_FSMC_NAND_H */
00156 /**
00157   * @}
00158   */
00159 
00160 /**
00161   * @}
00162   */
00163 
00164 /**
00165   * @}
00166   */
00167 
00168 /**
00169   * @}
00170   */ 
00171 
00172 /**
00173   * @}
00174   */ 
00175 
00176 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32