/Projects/STM32F769I_EVAL/Examples/FMC/FMC_NOR/Src/stm32f7xx_hal_msp.c

https://github.com/STMicroelectronics/STM32CubeF7 · C · 138 lines · 45 code · 22 blank · 71 comment · 0 complexity · b52814b386d7fcc3c0b7c689d988346f MD5 · raw file

  1. /**
  2. ******************************************************************************
  3. * @file FMC/FMC_NOR/Src/stm32f7xx_hal_msp.c
  4. * @author MCD Application Team
  5. * @brief HAL MSP module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Includes ------------------------------------------------------------------*/
  20. #include "main.h"
  21. /** @addtogroup STM32F7xx_HAL_Examples
  22. * @{
  23. */
  24. /** @defgroup FMC_NOR_Basic
  25. * @brief HAL MSP module.
  26. * @{
  27. */
  28. /* Private typedef -----------------------------------------------------------*/
  29. /* Private define ------------------------------------------------------------*/
  30. /* Private macro -------------------------------------------------------------*/
  31. /* Private variables ---------------------------------------------------------*/
  32. /* Private function prototypes -----------------------------------------------*/
  33. /* Private functions ---------------------------------------------------------*/
  34. /** @defgroup HAL_MSP_Private_Functions
  35. * @{
  36. */
  37. /**
  38. * @brief NOR MSP Initialization
  39. * This function configures the hardware resources used in this example:
  40. * - Peripheral's clock enable
  41. * - Peripheral's GPIO Configuration
  42. * @param hnor: NOR handle pointer
  43. * @retval None
  44. */
  45. void HAL_NOR_MspInit(NOR_HandleTypeDef *hnor)
  46. {
  47. GPIO_InitTypeDef gpio_init_structure;
  48. /* Enable FMC clock */
  49. __HAL_RCC_FMC_CLK_ENABLE();
  50. /* Enable GPIOs clock */
  51. __HAL_RCC_GPIOD_CLK_ENABLE();
  52. __HAL_RCC_GPIOC_CLK_ENABLE();
  53. __HAL_RCC_GPIOE_CLK_ENABLE();
  54. __HAL_RCC_GPIOF_CLK_ENABLE();
  55. __HAL_RCC_GPIOG_CLK_ENABLE();
  56. /* Common GPIO configuration */
  57. gpio_init_structure.Mode = GPIO_MODE_AF_PP;
  58. gpio_init_structure.Pull = GPIO_PULLUP;
  59. gpio_init_structure.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
  60. /* GPIOC configuration */
  61. gpio_init_structure.Alternate = GPIO_AF9_FMC;
  62. gpio_init_structure.Pin = GPIO_PIN_6 | GPIO_PIN_7;
  63. HAL_GPIO_Init(GPIOC, &gpio_init_structure);
  64. /* GPIOD configuration */
  65. gpio_init_structure.Alternate = GPIO_AF12_FMC;
  66. gpio_init_structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5|\
  67. GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 |\
  68. GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
  69. HAL_GPIO_Init(GPIOD, &gpio_init_structure);
  70. /* GPIOE configuration */
  71. gpio_init_structure.Pin = GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 |\
  72. GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 |\
  73. GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
  74. HAL_GPIO_Init(GPIOE, &gpio_init_structure);
  75. /* GPIOF configuration */
  76. gpio_init_structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2| GPIO_PIN_3 | GPIO_PIN_4 |\
  77. GPIO_PIN_5 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
  78. HAL_GPIO_Init(GPIOF, &gpio_init_structure);
  79. /* GPIOG configuration */
  80. gpio_init_structure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2| GPIO_PIN_3 | GPIO_PIN_4 |\
  81. GPIO_PIN_5;
  82. HAL_GPIO_Init(GPIOG, &gpio_init_structure);
  83. }
  84. /**
  85. * @brief NOR MSP De-Initialization
  86. * This function frees the hardware resources used in this example:
  87. * - Disable the Peripheral's clock
  88. * - Revert GPIO configuration to their default state
  89. * @param hnor: NOR handle pointer
  90. * @retval None
  91. */
  92. void HAL_NOR_MspDeInit(NOR_HandleTypeDef *hnor)
  93. {
  94. /*## Disable peripherals and GPIO Clocks ###################################*/
  95. /* Configure FMC as alternate function */
  96. HAL_GPIO_DeInit(GPIOD, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 |\
  97. GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 |\
  98. GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);
  99. HAL_GPIO_DeInit(GPIOE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 |\
  100. GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 |\
  101. GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);
  102. HAL_GPIO_DeInit(GPIOF, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2| GPIO_PIN_3 | GPIO_PIN_4 |\
  103. GPIO_PIN_5 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);
  104. HAL_GPIO_DeInit(GPIOG, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2| GPIO_PIN_3 | GPIO_PIN_4 |\
  105. GPIO_PIN_5);
  106. }
  107. /**
  108. * @}
  109. */
  110. /**
  111. * @}
  112. */
  113. /**
  114. * @}
  115. */
  116. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/