STM32F10x Standard Peripherals Library  3.5.0
/opt/STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_fsmc.h
Go to the documentation of this file.
00001 
00023 /* Define to prevent recursive inclusion -------------------------------------*/
00024 #ifndef __STM32F10x_FSMC_H
00025 #define __STM32F10x_FSMC_H
00026 
00027 #ifdef __cplusplus
00028  extern "C" {
00029 #endif
00030 
00031 /* Includes ------------------------------------------------------------------*/
00032 #include "stm32f10x.h"
00033 
00050 typedef struct
00051 {
00052   uint32_t FSMC_AddressSetupTime;       
00057   uint32_t FSMC_AddressHoldTime;        
00062   uint32_t FSMC_DataSetupTime;          
00067   uint32_t FSMC_BusTurnAroundDuration;  
00072   uint32_t FSMC_CLKDivision;            
00076   uint32_t FSMC_DataLatency;            
00084   uint32_t FSMC_AccessMode;             
00086 }FSMC_NORSRAMTimingInitTypeDef;
00087 
00092 typedef struct
00093 {
00094   uint32_t FSMC_Bank;                
00097   uint32_t FSMC_DataAddressMux;      
00101   uint32_t FSMC_MemoryType;          
00105   uint32_t FSMC_MemoryDataWidth;     
00108   uint32_t FSMC_BurstAccessMode;     
00112   uint32_t FSMC_AsynchronousWait;     
00116   uint32_t FSMC_WaitSignalPolarity;  
00120   uint32_t FSMC_WrapMode;            
00124   uint32_t FSMC_WaitSignalActive;    
00129   uint32_t FSMC_WriteOperation;      
00132   uint32_t FSMC_WaitSignal;          
00136   uint32_t FSMC_ExtendedMode;        
00139   uint32_t FSMC_WriteBurst;          
00142   FSMC_NORSRAMTimingInitTypeDef* FSMC_ReadWriteTimingStruct; 
00144   FSMC_NORSRAMTimingInitTypeDef* FSMC_WriteTimingStruct;     
00145 }FSMC_NORSRAMInitTypeDef;
00146 
00151 typedef struct
00152 {
00153   uint32_t FSMC_SetupTime;      
00159   uint32_t FSMC_WaitSetupTime;  
00165   uint32_t FSMC_HoldSetupTime;  
00172   uint32_t FSMC_HiZSetupTime;   
00177 }FSMC_NAND_PCCARDTimingInitTypeDef;
00178 
00183 typedef struct
00184 {
00185   uint32_t FSMC_Bank;              
00188   uint32_t FSMC_Waitfeature;      
00191   uint32_t FSMC_MemoryDataWidth;  
00194   uint32_t FSMC_ECC;              
00197   uint32_t FSMC_ECCPageSize;      
00200   uint32_t FSMC_TCLRSetupTime;    
00204   uint32_t FSMC_TARSetupTime;     
00208   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_CommonSpaceTimingStruct;   
00210   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_AttributeSpaceTimingStruct; 
00211 }FSMC_NANDInitTypeDef;
00212 
00217 typedef struct
00218 {
00219   uint32_t FSMC_Waitfeature;    
00222   uint32_t FSMC_TCLRSetupTime;  
00226   uint32_t FSMC_TARSetupTime;   
00231   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_CommonSpaceTimingStruct; 
00233   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_AttributeSpaceTimingStruct;  
00235   FSMC_NAND_PCCARDTimingInitTypeDef*  FSMC_IOSpaceTimingStruct; 
00236 }FSMC_PCCARDInitTypeDef;
00237 
00249 #define FSMC_Bank1_NORSRAM1                             ((uint32_t)0x00000000)
00250 #define FSMC_Bank1_NORSRAM2                             ((uint32_t)0x00000002)
00251 #define FSMC_Bank1_NORSRAM3                             ((uint32_t)0x00000004)
00252 #define FSMC_Bank1_NORSRAM4                             ((uint32_t)0x00000006)
00253 
00260 #define FSMC_Bank2_NAND                                 ((uint32_t)0x00000010)
00261 #define FSMC_Bank3_NAND                                 ((uint32_t)0x00000100)
00262 
00269 #define FSMC_Bank4_PCCARD                               ((uint32_t)0x00001000)
00270 
00274 #define IS_FSMC_NORSRAM_BANK(BANK) (((BANK) == FSMC_Bank1_NORSRAM1) || \
00275                                     ((BANK) == FSMC_Bank1_NORSRAM2) || \
00276                                     ((BANK) == FSMC_Bank1_NORSRAM3) || \
00277                                     ((BANK) == FSMC_Bank1_NORSRAM4))
00278 
00279 #define IS_FSMC_NAND_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
00280                                  ((BANK) == FSMC_Bank3_NAND))
00281 
00282 #define IS_FSMC_GETFLAG_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
00283                                     ((BANK) == FSMC_Bank3_NAND) || \
00284                                     ((BANK) == FSMC_Bank4_PCCARD))
00285 
00286 #define IS_FSMC_IT_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
00287                                ((BANK) == FSMC_Bank3_NAND) || \
00288                                ((BANK) == FSMC_Bank4_PCCARD))
00289 
00298 #define FSMC_DataAddressMux_Disable                       ((uint32_t)0x00000000)
00299 #define FSMC_DataAddressMux_Enable                        ((uint32_t)0x00000002)
00300 #define IS_FSMC_MUX(MUX) (((MUX) == FSMC_DataAddressMux_Disable) || \
00301                           ((MUX) == FSMC_DataAddressMux_Enable))
00302 
00311 #define FSMC_MemoryType_SRAM                            ((uint32_t)0x00000000)
00312 #define FSMC_MemoryType_PSRAM                           ((uint32_t)0x00000004)
00313 #define FSMC_MemoryType_NOR                             ((uint32_t)0x00000008)
00314 #define IS_FSMC_MEMORY(MEMORY) (((MEMORY) == FSMC_MemoryType_SRAM) || \
00315                                 ((MEMORY) == FSMC_MemoryType_PSRAM)|| \
00316                                 ((MEMORY) == FSMC_MemoryType_NOR))
00317 
00326 #define FSMC_MemoryDataWidth_8b                         ((uint32_t)0x00000000)
00327 #define FSMC_MemoryDataWidth_16b                        ((uint32_t)0x00000010)
00328 #define IS_FSMC_MEMORY_WIDTH(WIDTH) (((WIDTH) == FSMC_MemoryDataWidth_8b) || \
00329                                      ((WIDTH) == FSMC_MemoryDataWidth_16b))
00330 
00339 #define FSMC_BurstAccessMode_Disable                    ((uint32_t)0x00000000) 
00340 #define FSMC_BurstAccessMode_Enable                     ((uint32_t)0x00000100)
00341 #define IS_FSMC_BURSTMODE(STATE) (((STATE) == FSMC_BurstAccessMode_Disable) || \
00342                                   ((STATE) == FSMC_BurstAccessMode_Enable))
00343 
00350 #define FSMC_AsynchronousWait_Disable                   ((uint32_t)0x00000000)
00351 #define FSMC_AsynchronousWait_Enable                    ((uint32_t)0x00008000)
00352 #define IS_FSMC_ASYNWAIT(STATE) (((STATE) == FSMC_AsynchronousWait_Disable) || \
00353                                  ((STATE) == FSMC_AsynchronousWait_Enable))
00354 
00363 #define FSMC_WaitSignalPolarity_Low                     ((uint32_t)0x00000000)
00364 #define FSMC_WaitSignalPolarity_High                    ((uint32_t)0x00000200)
00365 #define IS_FSMC_WAIT_POLARITY(POLARITY) (((POLARITY) == FSMC_WaitSignalPolarity_Low) || \
00366                                          ((POLARITY) == FSMC_WaitSignalPolarity_High)) 
00367 
00376 #define FSMC_WrapMode_Disable                           ((uint32_t)0x00000000)
00377 #define FSMC_WrapMode_Enable                            ((uint32_t)0x00000400) 
00378 #define IS_FSMC_WRAP_MODE(MODE) (((MODE) == FSMC_WrapMode_Disable) || \
00379                                  ((MODE) == FSMC_WrapMode_Enable))
00380 
00389 #define FSMC_WaitSignalActive_BeforeWaitState           ((uint32_t)0x00000000)
00390 #define FSMC_WaitSignalActive_DuringWaitState           ((uint32_t)0x00000800) 
00391 #define IS_FSMC_WAIT_SIGNAL_ACTIVE(ACTIVE) (((ACTIVE) == FSMC_WaitSignalActive_BeforeWaitState) || \
00392                                             ((ACTIVE) == FSMC_WaitSignalActive_DuringWaitState))
00393 
00402 #define FSMC_WriteOperation_Disable                     ((uint32_t)0x00000000)
00403 #define FSMC_WriteOperation_Enable                      ((uint32_t)0x00001000)
00404 #define IS_FSMC_WRITE_OPERATION(OPERATION) (((OPERATION) == FSMC_WriteOperation_Disable) || \
00405                                             ((OPERATION) == FSMC_WriteOperation_Enable))
00406                               
00415 #define FSMC_WaitSignal_Disable                         ((uint32_t)0x00000000)
00416 #define FSMC_WaitSignal_Enable                          ((uint32_t)0x00002000) 
00417 #define IS_FSMC_WAITE_SIGNAL(SIGNAL) (((SIGNAL) == FSMC_WaitSignal_Disable) || \
00418                                       ((SIGNAL) == FSMC_WaitSignal_Enable))
00419 
00427 #define FSMC_ExtendedMode_Disable                       ((uint32_t)0x00000000)
00428 #define FSMC_ExtendedMode_Enable                        ((uint32_t)0x00004000)
00429 
00430 #define IS_FSMC_EXTENDED_MODE(MODE) (((MODE) == FSMC_ExtendedMode_Disable) || \
00431                                      ((MODE) == FSMC_ExtendedMode_Enable)) 
00432 
00441 #define FSMC_WriteBurst_Disable                         ((uint32_t)0x00000000)
00442 #define FSMC_WriteBurst_Enable                          ((uint32_t)0x00080000) 
00443 #define IS_FSMC_WRITE_BURST(BURST) (((BURST) == FSMC_WriteBurst_Disable) || \
00444                                     ((BURST) == FSMC_WriteBurst_Enable))
00445 
00453 #define IS_FSMC_ADDRESS_SETUP_TIME(TIME) ((TIME) <= 0xF)
00454 
00463 #define IS_FSMC_ADDRESS_HOLD_TIME(TIME) ((TIME) <= 0xF)
00464 
00473 #define IS_FSMC_DATASETUP_TIME(TIME) (((TIME) > 0) && ((TIME) <= 0xFF))
00474 
00483 #define IS_FSMC_TURNAROUND_TIME(TIME) ((TIME) <= 0xF)
00484 
00493 #define IS_FSMC_CLK_DIV(DIV) ((DIV) <= 0xF)
00494 
00503 #define IS_FSMC_DATA_LATENCY(LATENCY) ((LATENCY) <= 0xF)
00504 
00513 #define FSMC_AccessMode_A                               ((uint32_t)0x00000000)
00514 #define FSMC_AccessMode_B                               ((uint32_t)0x10000000) 
00515 #define FSMC_AccessMode_C                               ((uint32_t)0x20000000)
00516 #define FSMC_AccessMode_D                               ((uint32_t)0x30000000)
00517 #define IS_FSMC_ACCESS_MODE(MODE) (((MODE) == FSMC_AccessMode_A) || \
00518                                    ((MODE) == FSMC_AccessMode_B) || \
00519                                    ((MODE) == FSMC_AccessMode_C) || \
00520                                    ((MODE) == FSMC_AccessMode_D)) 
00521 
00538 #define FSMC_Waitfeature_Disable                        ((uint32_t)0x00000000)
00539 #define FSMC_Waitfeature_Enable                         ((uint32_t)0x00000002)
00540 #define IS_FSMC_WAIT_FEATURE(FEATURE) (((FEATURE) == FSMC_Waitfeature_Disable) || \
00541                                        ((FEATURE) == FSMC_Waitfeature_Enable))
00542 
00552 #define FSMC_ECC_Disable                                ((uint32_t)0x00000000)
00553 #define FSMC_ECC_Enable                                 ((uint32_t)0x00000040)
00554 #define IS_FSMC_ECC_STATE(STATE) (((STATE) == FSMC_ECC_Disable) || \
00555                                   ((STATE) == FSMC_ECC_Enable))
00556 
00565 #define FSMC_ECCPageSize_256Bytes                       ((uint32_t)0x00000000)
00566 #define FSMC_ECCPageSize_512Bytes                       ((uint32_t)0x00020000)
00567 #define FSMC_ECCPageSize_1024Bytes                      ((uint32_t)0x00040000)
00568 #define FSMC_ECCPageSize_2048Bytes                      ((uint32_t)0x00060000)
00569 #define FSMC_ECCPageSize_4096Bytes                      ((uint32_t)0x00080000)
00570 #define FSMC_ECCPageSize_8192Bytes                      ((uint32_t)0x000A0000)
00571 #define IS_FSMC_ECCPAGE_SIZE(SIZE) (((SIZE) == FSMC_ECCPageSize_256Bytes) || \
00572                                     ((SIZE) == FSMC_ECCPageSize_512Bytes) || \
00573                                     ((SIZE) == FSMC_ECCPageSize_1024Bytes) || \
00574                                     ((SIZE) == FSMC_ECCPageSize_2048Bytes) || \
00575                                     ((SIZE) == FSMC_ECCPageSize_4096Bytes) || \
00576                                     ((SIZE) == FSMC_ECCPageSize_8192Bytes))
00577 
00586 #define IS_FSMC_TCLR_TIME(TIME) ((TIME) <= 0xFF)
00587 
00596 #define IS_FSMC_TAR_TIME(TIME) ((TIME) <= 0xFF)
00597 
00606 #define IS_FSMC_SETUP_TIME(TIME) ((TIME) <= 0xFF)
00607 
00616 #define IS_FSMC_WAIT_TIME(TIME) ((TIME) <= 0xFF)
00617 
00626 #define IS_FSMC_HOLD_TIME(TIME) ((TIME) <= 0xFF)
00627 
00636 #define IS_FSMC_HIZ_TIME(TIME) ((TIME) <= 0xFF)
00637 
00646 #define FSMC_IT_RisingEdge                              ((uint32_t)0x00000008)
00647 #define FSMC_IT_Level                                   ((uint32_t)0x00000010)
00648 #define FSMC_IT_FallingEdge                             ((uint32_t)0x00000020)
00649 #define IS_FSMC_IT(IT) ((((IT) & (uint32_t)0xFFFFFFC7) == 0x00000000) && ((IT) != 0x00000000))
00650 #define IS_FSMC_GET_IT(IT) (((IT) == FSMC_IT_RisingEdge) || \
00651                             ((IT) == FSMC_IT_Level) || \
00652                             ((IT) == FSMC_IT_FallingEdge)) 
00653 
00661 #define FSMC_FLAG_RisingEdge                            ((uint32_t)0x00000001)
00662 #define FSMC_FLAG_Level                                 ((uint32_t)0x00000002)
00663 #define FSMC_FLAG_FallingEdge                           ((uint32_t)0x00000004)
00664 #define FSMC_FLAG_FEMPT                                 ((uint32_t)0x00000040)
00665 #define IS_FSMC_GET_FLAG(FLAG) (((FLAG) == FSMC_FLAG_RisingEdge) || \
00666                                 ((FLAG) == FSMC_FLAG_Level) || \
00667                                 ((FLAG) == FSMC_FLAG_FallingEdge) || \
00668                                 ((FLAG) == FSMC_FLAG_FEMPT))
00669 
00670 #define IS_FSMC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFF8) == 0x00000000) && ((FLAG) != 0x00000000))
00671 
00696 void FSMC_NORSRAMDeInit(uint32_t FSMC_Bank);
00697 void FSMC_NANDDeInit(uint32_t FSMC_Bank);
00698 void FSMC_PCCARDDeInit(void);
00699 void FSMC_NORSRAMInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);
00700 void FSMC_NANDInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);
00701 void FSMC_PCCARDInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
00702 void FSMC_NORSRAMStructInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);
00703 void FSMC_NANDStructInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);
00704 void FSMC_PCCARDStructInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
00705 void FSMC_NORSRAMCmd(uint32_t FSMC_Bank, FunctionalState NewState);
00706 void FSMC_NANDCmd(uint32_t FSMC_Bank, FunctionalState NewState);
00707 void FSMC_PCCARDCmd(FunctionalState NewState);
00708 void FSMC_NANDECCCmd(uint32_t FSMC_Bank, FunctionalState NewState);
00709 uint32_t FSMC_GetECC(uint32_t FSMC_Bank);
00710 void FSMC_ITConfig(uint32_t FSMC_Bank, uint32_t FSMC_IT, FunctionalState NewState);
00711 FlagStatus FSMC_GetFlagStatus(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);
00712 void FSMC_ClearFlag(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);
00713 ITStatus FSMC_GetITStatus(uint32_t FSMC_Bank, uint32_t FSMC_IT);
00714 void FSMC_ClearITPendingBit(uint32_t FSMC_Bank, uint32_t FSMC_IT);
00715 
00716 #ifdef __cplusplus
00717 }
00718 #endif
00719 
00720 #endif /*__STM32F10x_FSMC_H */
00721 
00733 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/