dma.c 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /**
  2. ******************************************************************************
  3. * @file dma.c
  4. * @brief This file provides code for the configuration
  5. * of all the requested memory to memory DMA transfers.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2022 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 "dma.h"
  21. /* USER CODE BEGIN 0 */
  22. /* USER CODE END 0 */
  23. /*----------------------------------------------------------------------------*/
  24. /* Configure DMA */
  25. /*----------------------------------------------------------------------------*/
  26. /* USER CODE BEGIN 1 */
  27. /* USER CODE END 1 */
  28. /**
  29. * Enable DMA controller clock
  30. */
  31. void MX_DMA_Init(void)
  32. {
  33. /* DMA controller clock enable */
  34. __HAL_RCC_DMA1_CLK_ENABLE();
  35. __HAL_RCC_DMA2_CLK_ENABLE();
  36. /* DMA interrupt init */
  37. /* DMA1_Channel2_IRQn interrupt configuration */
  38. HAL_NVIC_SetPriority(DMA1_Channel2_IRQn, 1, 0);
  39. HAL_NVIC_EnableIRQ(DMA1_Channel2_IRQn);
  40. /* DMA1_Channel3_IRQn interrupt configuration */
  41. HAL_NVIC_SetPriority(DMA1_Channel3_IRQn, 1, 0);
  42. HAL_NVIC_EnableIRQ(DMA1_Channel3_IRQn);
  43. /* DMA1_Channel4_IRQn interrupt configuration */
  44. HAL_NVIC_SetPriority(DMA1_Channel4_IRQn, 1, 0);
  45. HAL_NVIC_EnableIRQ(DMA1_Channel4_IRQn);
  46. /* DMA1_Channel5_IRQn interrupt configuration */
  47. HAL_NVIC_SetPriority(DMA1_Channel5_IRQn, 1, 0);
  48. HAL_NVIC_EnableIRQ(DMA1_Channel5_IRQn);
  49. /* DMA1_Channel6_IRQn interrupt configuration */
  50. HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 1, 0);
  51. HAL_NVIC_EnableIRQ(DMA1_Channel6_IRQn);
  52. /* DMA1_Channel7_IRQn interrupt configuration */
  53. HAL_NVIC_SetPriority(DMA1_Channel7_IRQn, 1, 0);
  54. HAL_NVIC_EnableIRQ(DMA1_Channel7_IRQn);
  55. /* DMA2_Channel3_IRQn interrupt configuration */
  56. HAL_NVIC_SetPriority(DMA2_Channel3_IRQn, 1, 0);
  57. HAL_NVIC_EnableIRQ(DMA2_Channel3_IRQn);
  58. /* DMA2_Channel4_5_IRQn interrupt configuration */
  59. HAL_NVIC_SetPriority(DMA2_Channel4_5_IRQn, 1, 0);
  60. HAL_NVIC_EnableIRQ(DMA2_Channel4_5_IRQn);
  61. }
  62. /* USER CODE BEGIN 2 */
  63. /* USER CODE END 2 */
  64. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/