|
| 1 | +/* USER CODE BEGIN Header */ |
| 2 | +/** |
| 3 | + ****************************************************************************** |
| 4 | + * File Name : linked_list.c |
| 5 | + * Description : This file provides code for the configuration |
| 6 | + * of the LinkedList. |
| 7 | + ****************************************************************************** |
| 8 | + * @attention |
| 9 | + * |
| 10 | + * Copyright (c) 2026 STMicroelectronics. |
| 11 | + * All rights reserved. |
| 12 | + * |
| 13 | + * This software is licensed under terms that can be found in the LICENSE file |
| 14 | + * in the root directory of this software component. |
| 15 | + * If no LICENSE file comes with this software, it is provided AS-IS. |
| 16 | + * |
| 17 | + ****************************************************************************** |
| 18 | + */ |
| 19 | +/* USER CODE END Header */ |
| 20 | +/* Includes ------------------------------------------------------------------*/ |
| 21 | +#include "linked_list.h" |
| 22 | + |
| 23 | +/* Private includes ----------------------------------------------------------*/ |
| 24 | +/* USER CODE BEGIN Includes */ |
| 25 | + |
| 26 | +/* USER CODE END Includes */ |
| 27 | + |
| 28 | +DMA_NodeTypeDef YourNodeName; |
| 29 | +DMA_QListTypeDef YourQueueName; |
| 30 | + |
| 31 | +/* Private typedef -----------------------------------------------------------*/ |
| 32 | +/* USER CODE BEGIN PTD */ |
| 33 | + |
| 34 | +/* USER CODE END PTD */ |
| 35 | + |
| 36 | +/* Private define ------------------------------------------------------------*/ |
| 37 | +/* USER CODE BEGIN PD */ |
| 38 | + |
| 39 | +/* USER CODE END PD */ |
| 40 | + |
| 41 | +/* Private macro -------------------------------------------------------------*/ |
| 42 | +/* USER CODE BEGIN PM */ |
| 43 | + |
| 44 | +/* USER CODE END PM */ |
| 45 | + |
| 46 | +/** |
| 47 | + * @brief DMA Linked-list YourQueueName configuration |
| 48 | + * @param None |
| 49 | + * @retval None |
| 50 | + */ |
| 51 | +HAL_StatusTypeDef MX_YourQueueName_Config(void) |
| 52 | +{ |
| 53 | + HAL_StatusTypeDef ret = HAL_OK; |
| 54 | + /* DMA node configuration declaration */ |
| 55 | + DMA_NodeConfTypeDef pNodeConfig; |
| 56 | + |
| 57 | + /* Set node configuration ################################################*/ |
| 58 | + pNodeConfig.NodeType = DMA_GPDMA_2D_NODE; |
| 59 | + pNodeConfig.Init.Request = GPDMA1_REQUEST_ADC1; |
| 60 | + pNodeConfig.Init.BlkHWRequest = DMA_BREQ_SINGLE_BURST; |
| 61 | + pNodeConfig.Init.Direction = DMA_PERIPH_TO_MEMORY; |
| 62 | + pNodeConfig.Init.SrcInc = DMA_SINC_FIXED; |
| 63 | + pNodeConfig.Init.DestInc = DMA_DINC_INCREMENTED; |
| 64 | + pNodeConfig.Init.SrcDataWidth = DMA_SRC_DATAWIDTH_BYTE; |
| 65 | + pNodeConfig.Init.DestDataWidth = DMA_DEST_DATAWIDTH_HALFWORD; |
| 66 | + pNodeConfig.Init.SrcBurstLength = 1; |
| 67 | + pNodeConfig.Init.DestBurstLength = 1; |
| 68 | + pNodeConfig.Init.TransferAllocatedPort = DMA_SRC_ALLOCATED_PORT0|DMA_DEST_ALLOCATED_PORT0; |
| 69 | + pNodeConfig.Init.TransferEventMode = DMA_TCEM_BLOCK_TRANSFER; |
| 70 | + pNodeConfig.Init.Mode = DMA_NORMAL; |
| 71 | + pNodeConfig.RepeatBlockConfig.RepeatCount = 1; |
| 72 | + pNodeConfig.RepeatBlockConfig.SrcAddrOffset = 0; |
| 73 | + pNodeConfig.RepeatBlockConfig.DestAddrOffset = 0; |
| 74 | + pNodeConfig.RepeatBlockConfig.BlkSrcAddrOffset = 0; |
| 75 | + pNodeConfig.RepeatBlockConfig.BlkDestAddrOffset = 0; |
| 76 | + pNodeConfig.TriggerConfig.TriggerPolarity = DMA_TRIG_POLARITY_MASKED; |
| 77 | + pNodeConfig.DataHandlingConfig.DataExchange = DMA_EXCHANGE_NONE; |
| 78 | + pNodeConfig.DataHandlingConfig.DataAlignment = DMA_DATA_RIGHTALIGN_ZEROPADDED; |
| 79 | + pNodeConfig.SrcAddress = 0; |
| 80 | + pNodeConfig.DstAddress = 0; |
| 81 | + pNodeConfig.DataSize = 0; |
| 82 | + |
| 83 | + /* Build YourNodeName Node */ |
| 84 | + ret |= HAL_DMAEx_List_BuildNode(&pNodeConfig, &YourNodeName); |
| 85 | + |
| 86 | + /* Insert YourNodeName to Queue */ |
| 87 | + ret |= HAL_DMAEx_List_InsertNode_Tail(&YourQueueName, &YourNodeName); |
| 88 | + |
| 89 | + ret |= HAL_DMAEx_List_SetCircularMode(&YourQueueName); |
| 90 | + |
| 91 | + return ret; |
| 92 | +} |
| 93 | + |
0 commit comments