123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675 |
- #ifndef __STM32F4xx_FSMC_H
- #define __STM32F4xx_FSMC_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include "stm32f4xx.h"
- typedef struct
- {
- uint32_t FSMC_AddressSetupTime;
- uint32_t FSMC_AddressHoldTime;
- uint32_t FSMC_DataSetupTime;
- uint32_t FSMC_BusTurnAroundDuration;
- uint32_t FSMC_CLKDivision;
- uint32_t FSMC_DataLatency;
- uint32_t FSMC_AccessMode;
- }FSMC_NORSRAMTimingInitTypeDef;
- typedef struct
- {
- uint32_t FSMC_Bank;
- uint32_t FSMC_DataAddressMux;
- uint32_t FSMC_MemoryType;
- uint32_t FSMC_MemoryDataWidth;
- uint32_t FSMC_BurstAccessMode;
- uint32_t FSMC_AsynchronousWait;
-
- uint32_t FSMC_WaitSignalPolarity;
- uint32_t FSMC_WrapMode;
- uint32_t FSMC_WaitSignalActive;
- uint32_t FSMC_WriteOperation;
- uint32_t FSMC_WaitSignal;
- uint32_t FSMC_ExtendedMode;
- uint32_t FSMC_WriteBurst;
-
- FSMC_NORSRAMTimingInitTypeDef* FSMC_ReadWriteTimingStruct;
- FSMC_NORSRAMTimingInitTypeDef* FSMC_WriteTimingStruct;
- }FSMC_NORSRAMInitTypeDef;
- typedef struct
- {
- uint32_t FSMC_SetupTime;
- uint32_t FSMC_WaitSetupTime;
- uint32_t FSMC_HoldSetupTime;
- uint32_t FSMC_HiZSetupTime;
- }FSMC_NAND_PCCARDTimingInitTypeDef;
- typedef struct
- {
- uint32_t FSMC_Bank;
- uint32_t FSMC_Waitfeature;
- uint32_t FSMC_MemoryDataWidth;
- uint32_t FSMC_ECC;
- uint32_t FSMC_ECCPageSize;
- uint32_t FSMC_TCLRSetupTime;
- uint32_t FSMC_TARSetupTime;
-
- FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_CommonSpaceTimingStruct;
- FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_AttributeSpaceTimingStruct;
- }FSMC_NANDInitTypeDef;
- typedef struct
- {
- uint32_t FSMC_Waitfeature;
- uint32_t FSMC_TCLRSetupTime;
- uint32_t FSMC_TARSetupTime;
-
-
- FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_CommonSpaceTimingStruct;
- FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_AttributeSpaceTimingStruct;
-
- FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_IOSpaceTimingStruct;
- }FSMC_PCCARDInitTypeDef;
- #define FSMC_Bank1_NORSRAM1 ((uint32_t)0x00000000)
- #define FSMC_Bank1_NORSRAM2 ((uint32_t)0x00000002)
- #define FSMC_Bank1_NORSRAM3 ((uint32_t)0x00000004)
- #define FSMC_Bank1_NORSRAM4 ((uint32_t)0x00000006)
-
- #define FSMC_Bank2_NAND ((uint32_t)0x00000010)
- #define FSMC_Bank3_NAND ((uint32_t)0x00000100)
-
- #define FSMC_Bank4_PCCARD ((uint32_t)0x00001000)
- #define IS_FSMC_NORSRAM_BANK(BANK) (((BANK) == FSMC_Bank1_NORSRAM1) || \
- ((BANK) == FSMC_Bank1_NORSRAM2) || \
- ((BANK) == FSMC_Bank1_NORSRAM3) || \
- ((BANK) == FSMC_Bank1_NORSRAM4))
- #define IS_FSMC_NAND_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
- ((BANK) == FSMC_Bank3_NAND))
- #define IS_FSMC_GETFLAG_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
- ((BANK) == FSMC_Bank3_NAND) || \
- ((BANK) == FSMC_Bank4_PCCARD))
- #define IS_FSMC_IT_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \
- ((BANK) == FSMC_Bank3_NAND) || \
- ((BANK) == FSMC_Bank4_PCCARD))
- #define FSMC_DataAddressMux_Disable ((uint32_t)0x00000000)
- #define FSMC_DataAddressMux_Enable ((uint32_t)0x00000002)
- #define IS_FSMC_MUX(MUX) (((MUX) == FSMC_DataAddressMux_Disable) || \
- ((MUX) == FSMC_DataAddressMux_Enable))
- #define FSMC_MemoryType_SRAM ((uint32_t)0x00000000)
- #define FSMC_MemoryType_PSRAM ((uint32_t)0x00000004)
- #define FSMC_MemoryType_NOR ((uint32_t)0x00000008)
- #define IS_FSMC_MEMORY(MEMORY) (((MEMORY) == FSMC_MemoryType_SRAM) || \
- ((MEMORY) == FSMC_MemoryType_PSRAM)|| \
- ((MEMORY) == FSMC_MemoryType_NOR))
- #define FSMC_MemoryDataWidth_8b ((uint32_t)0x00000000)
- #define FSMC_MemoryDataWidth_16b ((uint32_t)0x00000010)
- #define IS_FSMC_MEMORY_WIDTH(WIDTH) (((WIDTH) == FSMC_MemoryDataWidth_8b) || \
- ((WIDTH) == FSMC_MemoryDataWidth_16b))
- #define FSMC_BurstAccessMode_Disable ((uint32_t)0x00000000)
- #define FSMC_BurstAccessMode_Enable ((uint32_t)0x00000100)
- #define IS_FSMC_BURSTMODE(STATE) (((STATE) == FSMC_BurstAccessMode_Disable) || \
- ((STATE) == FSMC_BurstAccessMode_Enable))
-
- #define FSMC_AsynchronousWait_Disable ((uint32_t)0x00000000)
- #define FSMC_AsynchronousWait_Enable ((uint32_t)0x00008000)
- #define IS_FSMC_ASYNWAIT(STATE) (((STATE) == FSMC_AsynchronousWait_Disable) || \
- ((STATE) == FSMC_AsynchronousWait_Enable))
- #define FSMC_WaitSignalPolarity_Low ((uint32_t)0x00000000)
- #define FSMC_WaitSignalPolarity_High ((uint32_t)0x00000200)
- #define IS_FSMC_WAIT_POLARITY(POLARITY) (((POLARITY) == FSMC_WaitSignalPolarity_Low) || \
- ((POLARITY) == FSMC_WaitSignalPolarity_High))
- #define FSMC_WrapMode_Disable ((uint32_t)0x00000000)
- #define FSMC_WrapMode_Enable ((uint32_t)0x00000400)
- #define IS_FSMC_WRAP_MODE(MODE) (((MODE) == FSMC_WrapMode_Disable) || \
- ((MODE) == FSMC_WrapMode_Enable))
- #define FSMC_WaitSignalActive_BeforeWaitState ((uint32_t)0x00000000)
- #define FSMC_WaitSignalActive_DuringWaitState ((uint32_t)0x00000800)
- #define IS_FSMC_WAIT_SIGNAL_ACTIVE(ACTIVE) (((ACTIVE) == FSMC_WaitSignalActive_BeforeWaitState) || \
- ((ACTIVE) == FSMC_WaitSignalActive_DuringWaitState))
- #define FSMC_WriteOperation_Disable ((uint32_t)0x00000000)
- #define FSMC_WriteOperation_Enable ((uint32_t)0x00001000)
- #define IS_FSMC_WRITE_OPERATION(OPERATION) (((OPERATION) == FSMC_WriteOperation_Disable) || \
- ((OPERATION) == FSMC_WriteOperation_Enable))
- #define FSMC_WaitSignal_Disable ((uint32_t)0x00000000)
- #define FSMC_WaitSignal_Enable ((uint32_t)0x00002000)
- #define IS_FSMC_WAITE_SIGNAL(SIGNAL) (((SIGNAL) == FSMC_WaitSignal_Disable) || \
- ((SIGNAL) == FSMC_WaitSignal_Enable))
- #define FSMC_ExtendedMode_Disable ((uint32_t)0x00000000)
- #define FSMC_ExtendedMode_Enable ((uint32_t)0x00004000)
- #define IS_FSMC_EXTENDED_MODE(MODE) (((MODE) == FSMC_ExtendedMode_Disable) || \
- ((MODE) == FSMC_ExtendedMode_Enable))
- #define FSMC_WriteBurst_Disable ((uint32_t)0x00000000)
- #define FSMC_WriteBurst_Enable ((uint32_t)0x00080000)
- #define IS_FSMC_WRITE_BURST(BURST) (((BURST) == FSMC_WriteBurst_Disable) || \
- ((BURST) == FSMC_WriteBurst_Enable))
- #define IS_FSMC_ADDRESS_SETUP_TIME(TIME) ((TIME) <= 0xF)
- #define IS_FSMC_ADDRESS_HOLD_TIME(TIME) ((TIME) <= 0xF)
- #define IS_FSMC_DATASETUP_TIME(TIME) (((TIME) > 0) && ((TIME) <= 0xFF))
- #define IS_FSMC_TURNAROUND_TIME(TIME) ((TIME) <= 0xF)
- #define IS_FSMC_CLK_DIV(DIV) ((DIV) <= 0xF)
- #define IS_FSMC_DATA_LATENCY(LATENCY) ((LATENCY) <= 0xF)
- #define FSMC_AccessMode_A ((uint32_t)0x00000000)
- #define FSMC_AccessMode_B ((uint32_t)0x10000000)
- #define FSMC_AccessMode_C ((uint32_t)0x20000000)
- #define FSMC_AccessMode_D ((uint32_t)0x30000000)
- #define IS_FSMC_ACCESS_MODE(MODE) (((MODE) == FSMC_AccessMode_A) || \
- ((MODE) == FSMC_AccessMode_B) || \
- ((MODE) == FSMC_AccessMode_C) || \
- ((MODE) == FSMC_AccessMode_D))
-
- #define FSMC_Waitfeature_Disable ((uint32_t)0x00000000)
- #define FSMC_Waitfeature_Enable ((uint32_t)0x00000002)
- #define IS_FSMC_WAIT_FEATURE(FEATURE) (((FEATURE) == FSMC_Waitfeature_Disable) || \
- ((FEATURE) == FSMC_Waitfeature_Enable))
- #define FSMC_ECC_Disable ((uint32_t)0x00000000)
- #define FSMC_ECC_Enable ((uint32_t)0x00000040)
- #define IS_FSMC_ECC_STATE(STATE) (((STATE) == FSMC_ECC_Disable) || \
- ((STATE) == FSMC_ECC_Enable))
- #define FSMC_ECCPageSize_256Bytes ((uint32_t)0x00000000)
- #define FSMC_ECCPageSize_512Bytes ((uint32_t)0x00020000)
- #define FSMC_ECCPageSize_1024Bytes ((uint32_t)0x00040000)
- #define FSMC_ECCPageSize_2048Bytes ((uint32_t)0x00060000)
- #define FSMC_ECCPageSize_4096Bytes ((uint32_t)0x00080000)
- #define FSMC_ECCPageSize_8192Bytes ((uint32_t)0x000A0000)
- #define IS_FSMC_ECCPAGE_SIZE(SIZE) (((SIZE) == FSMC_ECCPageSize_256Bytes) || \
- ((SIZE) == FSMC_ECCPageSize_512Bytes) || \
- ((SIZE) == FSMC_ECCPageSize_1024Bytes) || \
- ((SIZE) == FSMC_ECCPageSize_2048Bytes) || \
- ((SIZE) == FSMC_ECCPageSize_4096Bytes) || \
- ((SIZE) == FSMC_ECCPageSize_8192Bytes))
- #define IS_FSMC_TCLR_TIME(TIME) ((TIME) <= 0xFF)
- #define IS_FSMC_TAR_TIME(TIME) ((TIME) <= 0xFF)
- #define IS_FSMC_SETUP_TIME(TIME) ((TIME) <= 0xFF)
- #define IS_FSMC_WAIT_TIME(TIME) ((TIME) <= 0xFF)
- #define IS_FSMC_HOLD_TIME(TIME) ((TIME) <= 0xFF)
- #define IS_FSMC_HIZ_TIME(TIME) ((TIME) <= 0xFF)
- #define FSMC_IT_RisingEdge ((uint32_t)0x00000008)
- #define FSMC_IT_Level ((uint32_t)0x00000010)
- #define FSMC_IT_FallingEdge ((uint32_t)0x00000020)
- #define IS_FSMC_IT(IT) ((((IT) & (uint32_t)0xFFFFFFC7) == 0x00000000) && ((IT) != 0x00000000))
- #define IS_FSMC_GET_IT(IT) (((IT) == FSMC_IT_RisingEdge) || \
- ((IT) == FSMC_IT_Level) || \
- ((IT) == FSMC_IT_FallingEdge))
- #define FSMC_FLAG_RisingEdge ((uint32_t)0x00000001)
- #define FSMC_FLAG_Level ((uint32_t)0x00000002)
- #define FSMC_FLAG_FallingEdge ((uint32_t)0x00000004)
- #define FSMC_FLAG_FEMPT ((uint32_t)0x00000040)
- #define IS_FSMC_GET_FLAG(FLAG) (((FLAG) == FSMC_FLAG_RisingEdge) || \
- ((FLAG) == FSMC_FLAG_Level) || \
- ((FLAG) == FSMC_FLAG_FallingEdge) || \
- ((FLAG) == FSMC_FLAG_FEMPT))
- #define IS_FSMC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFF8) == 0x00000000) && ((FLAG) != 0x00000000))
-
- void FSMC_NORSRAMDeInit(uint32_t FSMC_Bank);
- void FSMC_NORSRAMInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);
- void FSMC_NORSRAMStructInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct);
- void FSMC_NORSRAMCmd(uint32_t FSMC_Bank, FunctionalState NewState);
- void FSMC_NANDDeInit(uint32_t FSMC_Bank);
- void FSMC_NANDInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);
- void FSMC_NANDStructInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct);
- void FSMC_NANDCmd(uint32_t FSMC_Bank, FunctionalState NewState);
- void FSMC_NANDECCCmd(uint32_t FSMC_Bank, FunctionalState NewState);
- uint32_t FSMC_GetECC(uint32_t FSMC_Bank);
- void FSMC_PCCARDDeInit(void);
- void FSMC_PCCARDInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
- void FSMC_PCCARDStructInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct);
- void FSMC_PCCARDCmd(FunctionalState NewState);
- void FSMC_ITConfig(uint32_t FSMC_Bank, uint32_t FSMC_IT, FunctionalState NewState);
- FlagStatus FSMC_GetFlagStatus(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);
- void FSMC_ClearFlag(uint32_t FSMC_Bank, uint32_t FSMC_FLAG);
- ITStatus FSMC_GetITStatus(uint32_t FSMC_Bank, uint32_t FSMC_IT);
- void FSMC_ClearITPendingBit(uint32_t FSMC_Bank, uint32_t FSMC_IT);
- #ifdef __cplusplus
- }
- #endif
- #endif
-
|