fsmc_sram.c 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
  2. * File Name : fsmc_sram.c
  3. * Author : MCD Application Team
  4. * Version : V2.0.3
  5. * Date : 09/22/2008
  6. * Description : This file provides a set of functions needed to drive the
  7. * IS61WV51216BLL SRAM memory mounted on STM3210E-EVAL board.
  8. ********************************************************************************
  9. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  10. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
  11. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
  12. * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
  13. * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
  14. * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  15. *******************************************************************************/
  16. #include "stm32f10x.h"
  17. /* Private typedef -----------------------------------------------------------*/
  18. /* Private define ------------------------------------------------------------*/
  19. #define Bank1_SRAM3_ADDR ((u32)0x68000000)
  20. /* Private macro -------------------------------------------------------------*/
  21. /* Private variables ---------------------------------------------------------*/
  22. /* Private function prototypes -----------------------------------------------*/
  23. /* Private functions ---------------------------------------------------------*/
  24. /*******************************************************************************
  25. * Function Name : FSMC_SRAM_Init
  26. * Description : Configures the FSMC and GPIOs to interface with the SRAM memory.
  27. * This function must be called before any write/read operation
  28. * on the SRAM.
  29. * Input : None
  30. * Output : None
  31. * Return : None
  32. *******************************************************************************/
  33. void FSMC_SRAM_Init(void)
  34. {
  35. FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure;
  36. FSMC_NORSRAMTimingInitTypeDef p;
  37. /*-- FSMC Configuration ------------------------------------------------------*/
  38. p.FSMC_AddressSetupTime = 0;
  39. p.FSMC_AddressHoldTime = 0;
  40. p.FSMC_DataSetupTime = 2;
  41. p.FSMC_BusTurnAroundDuration = 0;
  42. p.FSMC_CLKDivision = 0;
  43. p.FSMC_DataLatency = 0;
  44. p.FSMC_AccessMode = FSMC_AccessMode_A;
  45. FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM3;
  46. FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable;
  47. FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM;
  48. FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b;
  49. FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable;
  50. FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low;
  51. FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable;
  52. FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState;
  53. FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable;
  54. FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable;
  55. FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable;
  56. FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable;
  57. FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p;
  58. FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p;
  59. FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
  60. FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM4;
  61. FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure);
  62. /* Enable FSMC Bank1_SRAM Bank */
  63. FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM3, ENABLE);
  64. FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM4, ENABLE);
  65. }
  66. /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/