52 #define BCR_MBKEN_SET ((uint32_t)0x00000001)
53 #define BCR_MBKEN_RESET ((uint32_t)0x000FFFFE)
54 #define BCR_FACCEN_SET ((uint32_t)0x00000040)
57 #define PCR_PBKEN_SET ((uint32_t)0x00000004)
58 #define PCR_PBKEN_RESET ((uint32_t)0x000FFFFB)
59 #define PCR_ECCEN_SET ((uint32_t)0x00000040)
60 #define PCR_ECCEN_RESET ((uint32_t)0x000FFFBF)
61 #define PCR_MEMORYTYPE_NAND ((uint32_t)0x00000008)
124 assert_param(IS_FSMC_NORSRAM_BANK(FSMC_Bank));
127 if(FSMC_Bank == FSMC_Bank1_NORSRAM1)
129 FSMC_Bank1->BTCR[FSMC_Bank] = 0x000030DB;
134 FSMC_Bank1->BTCR[FSMC_Bank] = 0x000030D2;
136 FSMC_Bank1->BTCR[FSMC_Bank + 1] = 0x0FFFFFFF;
137 FSMC_Bank1E->BWTR[FSMC_Bank] = 0x0FFFFFFF;
151 assert_param(IS_FSMC_NORSRAM_BANK(FSMC_NORSRAMInitStruct->
FSMC_Bank));
158 assert_param(IS_FSMC_WRAP_MODE(FSMC_NORSRAMInitStruct->
FSMC_WrapMode));
161 assert_param(IS_FSMC_WAITE_SIGNAL(FSMC_NORSRAMInitStruct->
FSMC_WaitSignal));
163 assert_param(IS_FSMC_WRITE_BURST(FSMC_NORSRAMInitStruct->
FSMC_WriteBurst));
173 FSMC_Bank1->BTCR[FSMC_NORSRAMInitStruct->
FSMC_Bank] =
188 FSMC_Bank1->BTCR[FSMC_NORSRAMInitStruct->
FSMC_Bank] |= (uint32_t)BCR_FACCEN_SET;
191 FSMC_Bank1->BTCR[FSMC_NORSRAMInitStruct->
FSMC_Bank+1] =
210 FSMC_Bank1E->BWTR[FSMC_NORSRAMInitStruct->
FSMC_Bank] =
220 FSMC_Bank1E->BWTR[FSMC_NORSRAMInitStruct->
FSMC_Bank] = 0x0FFFFFFF;
233 FSMC_NORSRAMInitStruct->
FSMC_Bank = FSMC_Bank1_NORSRAM1;
240 FSMC_NORSRAMInitStruct->
FSMC_WrapMode = FSMC_WrapMode_Disable;
275 assert_param(IS_FSMC_NORSRAM_BANK(FSMC_Bank));
276 assert_param(IS_FUNCTIONAL_STATE(NewState));
278 if (NewState != DISABLE)
281 FSMC_Bank1->BTCR[FSMC_Bank] |= BCR_MBKEN_SET;
286 FSMC_Bank1->BTCR[FSMC_Bank] &= BCR_MBKEN_RESET;
349 assert_param(IS_FSMC_NAND_BANK(FSMC_Bank));
351 if(FSMC_Bank == FSMC_Bank2_NAND)
354 FSMC_Bank2->PCR2 = 0x00000018;
355 FSMC_Bank2->SR2 = 0x00000040;
356 FSMC_Bank2->PMEM2 = 0xFCFCFCFC;
357 FSMC_Bank2->PATT2 = 0xFCFCFCFC;
363 FSMC_Bank3->PCR3 = 0x00000018;
364 FSMC_Bank3->SR3 = 0x00000040;
365 FSMC_Bank3->PMEM3 = 0xFCFCFCFC;
366 FSMC_Bank3->PATT3 = 0xFCFCFCFC;
379 uint32_t tmppcr = 0x00000000, tmppmem = 0x00000000, tmppatt = 0x00000000;
382 assert_param( IS_FSMC_NAND_BANK(FSMC_NANDInitStruct->
FSMC_Bank));
385 assert_param( IS_FSMC_ECC_STATE(FSMC_NANDInitStruct->
FSMC_ECC));
400 PCR_MEMORYTYPE_NAND |
419 if(FSMC_NANDInitStruct->
FSMC_Bank == FSMC_Bank2_NAND)
422 FSMC_Bank2->PCR2 = tmppcr;
423 FSMC_Bank2->PMEM2 = tmppmem;
424 FSMC_Bank2->PATT2 = tmppatt;
429 FSMC_Bank3->PCR3 = tmppcr;
430 FSMC_Bank3->PMEM3 = tmppmem;
431 FSMC_Bank3->PATT3 = tmppatt;
445 FSMC_NANDInitStruct->
FSMC_Bank = FSMC_Bank2_NAND;
448 FSMC_NANDInitStruct->
FSMC_ECC = FSMC_ECC_Disable;
473 assert_param(IS_FSMC_NAND_BANK(FSMC_Bank));
474 assert_param(IS_FUNCTIONAL_STATE(NewState));
476 if (NewState != DISABLE)
479 if(FSMC_Bank == FSMC_Bank2_NAND)
481 FSMC_Bank2->PCR2 |= PCR_PBKEN_SET;
485 FSMC_Bank3->PCR3 |= PCR_PBKEN_SET;
491 if(FSMC_Bank == FSMC_Bank2_NAND)
493 FSMC_Bank2->PCR2 &= PCR_PBKEN_RESET;
497 FSMC_Bank3->PCR3 &= PCR_PBKEN_RESET;
513 assert_param(IS_FSMC_NAND_BANK(FSMC_Bank));
514 assert_param(IS_FUNCTIONAL_STATE(NewState));
516 if (NewState != DISABLE)
519 if(FSMC_Bank == FSMC_Bank2_NAND)
521 FSMC_Bank2->PCR2 |= PCR_ECCEN_SET;
525 FSMC_Bank3->PCR3 |= PCR_ECCEN_SET;
531 if(FSMC_Bank == FSMC_Bank2_NAND)
533 FSMC_Bank2->PCR2 &= PCR_ECCEN_RESET;
537 FSMC_Bank3->PCR3 &= PCR_ECCEN_RESET;
552 uint32_t eccval = 0x00000000;
554 if(FSMC_Bank == FSMC_Bank2_NAND)
557 eccval = FSMC_Bank2->ECCR2;
562 eccval = FSMC_Bank3->ECCR3;
617 FSMC_Bank4->PCR4 = 0x00000018;
618 FSMC_Bank4->SR4 = 0x00000000;
619 FSMC_Bank4->PMEM4 = 0xFCFCFCFC;
620 FSMC_Bank4->PATT4 = 0xFCFCFCFC;
621 FSMC_Bank4->PIO4 = 0xFCFCFCFC;
634 assert_param(IS_FSMC_WAIT_FEATURE(FSMC_PCCARDInitStruct->
FSMC_Waitfeature));
654 FSMC_MemoryDataWidth_16b |
711 assert_param(IS_FUNCTIONAL_STATE(NewState));
713 if (NewState != DISABLE)
716 FSMC_Bank4->PCR4 |= PCR_PBKEN_SET;
721 FSMC_Bank4->PCR4 &= PCR_PBKEN_RESET;
756 void FSMC_ITConfig(uint32_t FSMC_Bank, uint32_t FSMC_IT, FunctionalState NewState)
758 assert_param(IS_FSMC_IT_BANK(FSMC_Bank));
759 assert_param(IS_FSMC_IT(FSMC_IT));
760 assert_param(IS_FUNCTIONAL_STATE(NewState));
762 if (NewState != DISABLE)
765 if(FSMC_Bank == FSMC_Bank2_NAND)
767 FSMC_Bank2->SR2 |= FSMC_IT;
770 else if (FSMC_Bank == FSMC_Bank3_NAND)
772 FSMC_Bank3->SR3 |= FSMC_IT;
777 FSMC_Bank4->SR4 |= FSMC_IT;
783 if(FSMC_Bank == FSMC_Bank2_NAND)
786 FSMC_Bank2->SR2 &= (uint32_t)~FSMC_IT;
789 else if (FSMC_Bank == FSMC_Bank3_NAND)
791 FSMC_Bank3->SR3 &= (uint32_t)~FSMC_IT;
796 FSMC_Bank4->SR4 &= (uint32_t)~FSMC_IT;
818 FlagStatus bitstatus = RESET;
819 uint32_t tmpsr = 0x00000000;
822 assert_param(IS_FSMC_GETFLAG_BANK(FSMC_Bank));
823 assert_param(IS_FSMC_GET_FLAG(FSMC_FLAG));
825 if(FSMC_Bank == FSMC_Bank2_NAND)
827 tmpsr = FSMC_Bank2->SR2;
829 else if(FSMC_Bank == FSMC_Bank3_NAND)
831 tmpsr = FSMC_Bank3->SR3;
836 tmpsr = FSMC_Bank4->SR4;
840 if ((tmpsr & FSMC_FLAG) != (uint16_t)RESET )
869 assert_param(IS_FSMC_GETFLAG_BANK(FSMC_Bank));
870 assert_param(IS_FSMC_CLEAR_FLAG(FSMC_FLAG)) ;
872 if(FSMC_Bank == FSMC_Bank2_NAND)
874 FSMC_Bank2->SR2 &= ~FSMC_FLAG;
876 else if(FSMC_Bank == FSMC_Bank3_NAND)
878 FSMC_Bank3->SR3 &= ~FSMC_FLAG;
883 FSMC_Bank4->SR4 &= ~FSMC_FLAG;
903 ITStatus bitstatus = RESET;
904 uint32_t tmpsr = 0x0, itstatus = 0x0, itenable = 0x0;
907 assert_param(IS_FSMC_IT_BANK(FSMC_Bank));
908 assert_param(IS_FSMC_GET_IT(FSMC_IT));
910 if(FSMC_Bank == FSMC_Bank2_NAND)
912 tmpsr = FSMC_Bank2->SR2;
914 else if(FSMC_Bank == FSMC_Bank3_NAND)
916 tmpsr = FSMC_Bank3->SR3;
921 tmpsr = FSMC_Bank4->SR4;
924 itstatus = tmpsr & FSMC_IT;
926 itenable = tmpsr & (FSMC_IT >> 3);
927 if ((itstatus != (uint32_t)RESET) && (itenable != (uint32_t)RESET))
955 assert_param(IS_FSMC_IT_BANK(FSMC_Bank));
956 assert_param(IS_FSMC_IT(FSMC_IT));
958 if(FSMC_Bank == FSMC_Bank2_NAND)
960 FSMC_Bank2->SR2 &= ~(FSMC_IT >> 3);
962 else if(FSMC_Bank == FSMC_Bank3_NAND)
964 FSMC_Bank3->SR3 &= ~(FSMC_IT >> 3);
969 FSMC_Bank4->SR4 &= ~(FSMC_IT >> 3);
This file contains all the functions prototypes for the RCC firmware library.
void FSMC_NORSRAMStructInit(FSMC_NORSRAMInitTypeDef *FSMC_NORSRAMInitStruct)
Fills each FSMC_NORSRAMInitStruct member with its default value.
FSMC_NAND_PCCARDTimingInitTypeDef * FSMC_CommonSpaceTimingStruct
uint32_t FSMC_MemoryDataWidth
uint32_t FSMC_HoldSetupTime
uint32_t FSMC_TARSetupTime
FSMC NAND Init structure definition.
uint32_t FSMC_TCLRSetupTime
void FSMC_NANDECCCmd(uint32_t FSMC_Bank, FunctionalState NewState)
Enables or disables the FSMC NAND ECC feature.
void FSMC_NORSRAMInit(FSMC_NORSRAMInitTypeDef *FSMC_NORSRAMInitStruct)
Initializes the FSMC NOR/SRAM Banks according to the specified parameters in the FSMC_NORSRAMInitStru...
ITStatus FSMC_GetITStatus(uint32_t FSMC_Bank, uint32_t FSMC_IT)
Checks whether the specified FSMC interrupt has occurred or not.
uint32_t FSMC_BurstAccessMode
uint32_t FSMC_DataSetupTime
uint32_t FSMC_WaitSetupTime
void FSMC_NANDDeInit(uint32_t FSMC_Bank)
De-initializes the FSMC NAND Banks registers to their default reset values.
uint32_t FSMC_AsynchronousWait
uint32_t FSMC_WriteOperation
void FSMC_ITConfig(uint32_t FSMC_Bank, uint32_t FSMC_IT, FunctionalState NewState)
Enables or disables the specified FSMC interrupts.
uint32_t FSMC_ECCPageSize
FSMC_NAND_PCCARDTimingInitTypeDef * FSMC_AttributeSpaceTimingStruct
uint32_t FSMC_WaitSignalActive
void FSMC_ClearITPendingBit(uint32_t FSMC_Bank, uint32_t FSMC_IT)
Clears the FSMC's interrupt pending bits.
uint32_t FSMC_GetECC(uint32_t FSMC_Bank)
Returns the error correction code register value.
FSMC NOR/SRAM Init structure definition.
void FSMC_NORSRAMCmd(uint32_t FSMC_Bank, FunctionalState NewState)
Enables or disables the specified NOR/SRAM Memory Bank.
void FSMC_NANDCmd(uint32_t FSMC_Bank, FunctionalState NewState)
Enables or disables the specified NAND Memory Bank.
uint32_t FSMC_WaitSignalPolarity
FSMC_NAND_PCCARDTimingInitTypeDef * FSMC_AttributeSpaceTimingStruct
uint32_t FSMC_BusTurnAroundDuration
FSMC_NORSRAMTimingInitTypeDef * FSMC_ReadWriteTimingStruct
FSMC PCCARD Init structure definition.
uint32_t FSMC_Waitfeature
uint32_t FSMC_AddressHoldTime
This file contains all the functions prototypes for the FSMC firmware library.
void FSMC_PCCARDStructInit(FSMC_PCCARDInitTypeDef *FSMC_PCCARDInitStruct)
Fills each FSMC_PCCARDInitStruct member with its default value.
uint32_t FSMC_Waitfeature
void FSMC_NORSRAMDeInit(uint32_t FSMC_Bank)
De-initializes the FSMC NOR/SRAM Banks registers to their default reset values.
uint32_t FSMC_MemoryDataWidth
uint32_t FSMC_TCLRSetupTime
uint32_t FSMC_DataAddressMux
void FSMC_NANDStructInit(FSMC_NANDInitTypeDef *FSMC_NANDInitStruct)
Fills each FSMC_NANDInitStruct member with its default value.
uint32_t FSMC_HiZSetupTime
void FSMC_PCCARDDeInit(void)
De-initializes the FSMC PCCARD Bank registers to their default reset values.
uint32_t FSMC_AddressSetupTime
FSMC_NORSRAMTimingInitTypeDef * FSMC_WriteTimingStruct
void FSMC_ClearFlag(uint32_t FSMC_Bank, uint32_t FSMC_FLAG)
Clears the FSMC's pending flags.
FlagStatus FSMC_GetFlagStatus(uint32_t FSMC_Bank, uint32_t FSMC_FLAG)
Checks whether the specified FSMC flag is set or not.
void FSMC_NANDInit(FSMC_NANDInitTypeDef *FSMC_NANDInitStruct)
Initializes the FSMC NAND Banks according to the specified parameters in the FSMC_NANDInitStruct.
FSMC_NAND_PCCARDTimingInitTypeDef * FSMC_IOSpaceTimingStruct
void FSMC_PCCARDInit(FSMC_PCCARDInitTypeDef *FSMC_PCCARDInitStruct)
Initializes the FSMC PCCARD Bank according to the specified parameters in the FSMC_PCCARDInitStruct.
uint32_t FSMC_CLKDivision
uint32_t FSMC_ExtendedMode
uint32_t FSMC_TARSetupTime
uint32_t FSMC_DataLatency
FSMC_NAND_PCCARDTimingInitTypeDef * FSMC_CommonSpaceTimingStruct
void FSMC_PCCARDCmd(FunctionalState NewState)
Enables or disables the PCCARD Memory Bank.