Advertisement
Guest User

FSMC_NORSRAMInit

a guest
Nov 26th, 2014
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.50 KB | None | 0 0
  1. void FSMC_NORSRAMInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct)
  2. {
  3.   /* Bank1 NOR/SRAM control register configuration */
  4.   FSMC_Bank1->BTCR[FSMC_NORSRAMInitStruct->FSMC_Bank] =
  5.             (uint32_t)FSMC_NORSRAMInitStruct->FSMC_DataAddressMux |
  6.             FSMC_NORSRAMInitStruct->FSMC_MemoryType |
  7.             FSMC_NORSRAMInitStruct->FSMC_MemoryDataWidth |
  8.             FSMC_NORSRAMInitStruct->FSMC_BurstAccessMode |
  9.             FSMC_NORSRAMInitStruct->FSMC_AsynchronousWait |
  10.             FSMC_NORSRAMInitStruct->FSMC_WaitSignalPolarity |
  11.             FSMC_NORSRAMInitStruct->FSMC_WrapMode |
  12.             FSMC_NORSRAMInitStruct->FSMC_WaitSignalActive |
  13.             FSMC_NORSRAMInitStruct->FSMC_WriteOperation |
  14.             FSMC_NORSRAMInitStruct->FSMC_WaitSignal |
  15.             FSMC_NORSRAMInitStruct->FSMC_ExtendedMode |
  16.             FSMC_NORSRAMInitStruct->FSMC_WriteBurst;
  17.   /* Bank1 NOR/SRAM timing register configuration */
  18.   FSMC_Bank1->BTCR[FSMC_NORSRAMInitStruct->FSMC_Bank+1] =
  19.             (uint32_t)FSMC_NORSRAMInitStruct->FSMC_ReadWriteTimingStruct->FSMC_AddressSetupTime |
  20.             (FSMC_NORSRAMInitStruct->FSMC_ReadWriteTimingStruct->FSMC_AddressHoldTime << 4) |
  21.             (FSMC_NORSRAMInitStruct->FSMC_ReadWriteTimingStruct->FSMC_DataSetupTime << 8) |
  22.             (FSMC_NORSRAMInitStruct->FSMC_ReadWriteTimingStruct->FSMC_BusTurnAroundDuration << 16) |
  23.             (FSMC_NORSRAMInitStruct->FSMC_ReadWriteTimingStruct->FSMC_CLKDivision << 20) |
  24.             (FSMC_NORSRAMInitStruct->FSMC_ReadWriteTimingStruct->FSMC_DataLatency << 24) |
  25.              FSMC_NORSRAMInitStruct->FSMC_ReadWriteTimingStruct->FSMC_AccessMode;
  26.            
  27.    
  28.   /* Bank1 NOR/SRAM timing register for write configuration, if extended mode is used */
  29.   if(FSMC_NORSRAMInitStruct->FSMC_ExtendedMode == FSMC_ExtendedMode_Enable)
  30.   {
  31.     FSMC_Bank1E->BWTR[FSMC_NORSRAMInitStruct->FSMC_Bank] =
  32.               (uint32_t)FSMC_NORSRAMInitStruct->FSMC_WriteTimingStruct->FSMC_AddressSetupTime |
  33.               (FSMC_NORSRAMInitStruct->FSMC_WriteTimingStruct->FSMC_AddressHoldTime << 4 )|
  34.               (FSMC_NORSRAMInitStruct->FSMC_WriteTimingStruct->FSMC_DataSetupTime << 8) |
  35.               (FSMC_NORSRAMInitStruct->FSMC_WriteTimingStruct->FSMC_CLKDivision << 20) |
  36.               (FSMC_NORSRAMInitStruct->FSMC_WriteTimingStruct->FSMC_DataLatency << 24) |
  37.                FSMC_NORSRAMInitStruct->FSMC_WriteTimingStruct->FSMC_AccessMode;
  38.   }
  39.   else
  40.   {
  41.     FSMC_Bank1E->BWTR[FSMC_NORSRAMInitStruct->FSMC_Bank] = 0x0FFFFFFF;
  42.   }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement