84 lines
2.9 KiB
C
84 lines
2.9 KiB
C
/* USER CODE BEGIN Header */
|
|
/**
|
|
******************************************************************************
|
|
* @file dma.c
|
|
* @brief This file provides code for the configuration
|
|
* of all the requested memory to memory DMA transfers.
|
|
******************************************************************************
|
|
* @attention
|
|
*
|
|
* Copyright (c) 2024 STMicroelectronics.
|
|
* All rights reserved.
|
|
*
|
|
* This software is licensed under terms that can be found in the LICENSE file
|
|
* in the root directory of this software component.
|
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
/* USER CODE END Header */
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "dma.h"
|
|
|
|
/* USER CODE BEGIN 0 */
|
|
|
|
/* USER CODE END 0 */
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
/* Configure DMA */
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/* USER CODE BEGIN 1 */
|
|
|
|
/* USER CODE END 1 */
|
|
DMA_HandleTypeDef hdma_memtomem_dma1_channel1;
|
|
DMA_HandleTypeDef hdma_memtomem_dma1_channel2;
|
|
|
|
/**
|
|
* Enable DMA controller clock
|
|
* Configure DMA for memory to memory transfers
|
|
* hdma_memtomem_dma1_channel1
|
|
* hdma_memtomem_dma1_channel2
|
|
*/
|
|
void MX_DMA_Init(void)
|
|
{
|
|
|
|
/* DMA controller clock enable */
|
|
__HAL_RCC_DMA1_CLK_ENABLE();
|
|
|
|
/* Configure DMA request hdma_memtomem_dma1_channel1 on DMA1_Channel1 */
|
|
hdma_memtomem_dma1_channel1.Instance = DMA1_Channel1;
|
|
hdma_memtomem_dma1_channel1.Init.Direction = DMA_MEMORY_TO_MEMORY;
|
|
hdma_memtomem_dma1_channel1.Init.PeriphInc = DMA_PINC_ENABLE;
|
|
hdma_memtomem_dma1_channel1.Init.MemInc = DMA_MINC_ENABLE;
|
|
hdma_memtomem_dma1_channel1.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
|
hdma_memtomem_dma1_channel1.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
|
hdma_memtomem_dma1_channel1.Init.Mode = DMA_NORMAL;
|
|
hdma_memtomem_dma1_channel1.Init.Priority = DMA_PRIORITY_LOW;
|
|
if (HAL_DMA_Init(&hdma_memtomem_dma1_channel1) != HAL_OK)
|
|
{
|
|
Error_Handler();
|
|
}
|
|
|
|
/* Configure DMA request hdma_memtomem_dma1_channel2 on DMA1_Channel2 */
|
|
hdma_memtomem_dma1_channel2.Instance = DMA1_Channel2;
|
|
hdma_memtomem_dma1_channel2.Init.Direction = DMA_MEMORY_TO_MEMORY;
|
|
hdma_memtomem_dma1_channel2.Init.PeriphInc = DMA_PINC_ENABLE;
|
|
hdma_memtomem_dma1_channel2.Init.MemInc = DMA_MINC_ENABLE;
|
|
hdma_memtomem_dma1_channel2.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
|
hdma_memtomem_dma1_channel2.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
|
hdma_memtomem_dma1_channel2.Init.Mode = DMA_NORMAL;
|
|
hdma_memtomem_dma1_channel2.Init.Priority = DMA_PRIORITY_LOW;
|
|
if (HAL_DMA_Init(&hdma_memtomem_dma1_channel2) != HAL_OK)
|
|
{
|
|
Error_Handler();
|
|
}
|
|
|
|
}
|
|
|
|
/* USER CODE BEGIN 2 */
|
|
|
|
/* USER CODE END 2 */
|
|
|