annotate Common/Drivers/STM32F4xx_HAL_DRIVER_v120/Src/stm32f4xx_hal_dma.c @ 59:00e70b60c69f

language updates
author heinrichsweikamp
date Fri, 10 Aug 2018 19:22:12 +0200
parents 5f11787b4f42
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @file stm32f4xx_hal_dma.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @author MCD Application Team
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @version V1.2.0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 26-December-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @brief DMA HAL module driver.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 * This file provides firmware functions to manage the following
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 * functionalities of the Direct Memory Access (DMA) peripheral:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 * + Initialization and de-initialization functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 * + IO operation functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 * + Peripheral State and errors functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 ##### How to use this driver #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 ==============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 (#) Enable and configure the peripheral to be connected to the DMA Stream
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 (except for internal SRAM/FLASH memories: no initialization is
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 necessary) please refer to Reference manual for connection between peripherals
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 and DMA requests .
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 (#) For a given Stream, program the required configuration through the following parameters:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 Transfer Direction, Source and Destination data formats,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 Circular, Normal or peripheral flow control mode, Stream Priority level,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 Source and Destination Increment mode, FIFO mode and its Threshold (if needed),
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 Burst mode for Source and/or Destination (if needed) using HAL_DMA_Init() function.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 *** Polling mode IO operation ***
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 =================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 (+) Use HAL_DMA_Start() to start DMA transfer after the configuration of Source
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 address and destination address and the Length of data to be transferred
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 (+) Use HAL_DMA_PollForTransfer() to poll for the end of current transfer, in this
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 case a fixed Timeout can be configured by User depending from his application.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 *** Interrupt mode IO operation ***
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 ===================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 (+) Configure the DMA interrupt priority using HAL_NVIC_SetPriority()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 (+) Enable the DMA IRQ handler using HAL_NVIC_EnableIRQ()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 (+) Use HAL_DMA_Start_IT() to start DMA transfer after the configuration of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 Source address and destination address and the Length of data to be transferred. In this
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 case the DMA interrupt is configured
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 (+) Use HAL_DMA_IRQHandler() called under DMA_IRQHandler() Interrupt subroutine
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 (+) At the end of data transfer HAL_DMA_IRQHandler() function is executed and user can
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 add his own function by customization of function pointer XferCpltCallback and
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 XferErrorCallback (i.e a member of DMA handle structure).
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 (#) Use HAL_DMA_GetState() function to return the DMA state and HAL_DMA_GetError() in case of error
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 detection.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 (#) Use HAL_DMA_Abort() function to abort the current transfer
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 -@- In Memory-to-Memory transfer mode, Circular mode is not allowed.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 -@- The FIFO is used mainly to reduce bus usage and to allow data packing/unpacking: it is
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 possible to set different Data Sizes for the Peripheral and the Memory (ie. you can set
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 Half-Word data size for the peripheral to access its data register and set Word data size
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 for the Memory to gain in access time. Each two half words will be packed and written in
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 a single access to a Word in the Memory).
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 -@- When FIFO is disabled, it is not allowed to configure different Data Sizes for Source
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 and Destination. In this case the Peripheral Data Size will be applied to both Source
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 and Destination.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 *** DMA HAL driver macros list ***
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 =============================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 Below the list of most used macros in DMA HAL driver.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 (+) __HAL_DMA_ENABLE: Enable the specified DMA Stream.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 (+) __HAL_DMA_DISABLE: Disable the specified DMA Stream.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 (+) __HAL_DMA_GET_FS: Return the current DMA Stream FIFO filled level.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 (+) __HAL_DMA_GET_FLAG: Get the DMA Stream pending flags.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 (+) __HAL_DMA_CLEAR_FLAG: Clear the DMA Stream pending flags.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 (+) __HAL_DMA_ENABLE_IT: Enable the specified DMA Stream interrupts.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 (+) __HAL_DMA_DISABLE_IT: Disable the specified DMA Stream interrupts.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 (+) __HAL_DMA_GET_IT_SOURCE: Check whether the specified DMA Stream interrupt has occurred or not.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 (@) You can refer to the DMA HAL driver header file for more useful macros
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 * Redistribution and use in source and binary forms, with or without modification,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 * are permitted provided that the following conditions are met:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 * 1. Redistributions of source code must retain the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 * this list of conditions and the following disclaimer.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 * 2. Redistributions in binary form must reproduce the above copyright notice,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 * this list of conditions and the following disclaimer in the documentation
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 * and/or other materials provided with the distribution.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 * 3. Neither the name of STMicroelectronics nor the names of its contributors
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 * may be used to endorse or promote products derived from this software
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 * without specific prior written permission.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 /** @addtogroup STM32F4xx_HAL_Driver
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 /** @defgroup DMA DMA
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 * @brief DMA HAL module driver
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 #ifdef HAL_DMA_MODULE_ENABLED
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 /* Private types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 /* Private variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 /* Private constants ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 /** @addtogroup DMA_Private_Constants
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136 #define HAL_TIMEOUT_DMA_ABORT ((uint32_t)1000) /* 1s */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 /* Private macros ------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 /** @addtogroup DMA_Private_Functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 static void DMA_SetConfig(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 /* Exported functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 /** @addtogroup DMA_Exported_Functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 /** @addtogroup DMA_Exported_Functions_Group1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 ===============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 ##### Initialization and de-initialization functions #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160 ===============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 This section provides functions allowing to initialize the DMA Stream source
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 and destination addresses, incrementation and data sizes, transfer direction,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 circular/normal mode selection, memory-to-memory mode selection and Stream priority value.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 The HAL_DMA_Init() function follows the DMA configuration procedures as described in
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 reference manual.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 * @brief Initializes the DMA according to the specified
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 * parameters in the DMA_InitTypeDef and create the associated handle.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 * @param hdma: Pointer to a DMA_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 * the configuration information for the specified DMA Stream.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 uint32_t tmp = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 /* Check the DMA peripheral state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185 if(hdma == NULL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 return HAL_ERROR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 /* Check the parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 assert_param(IS_DMA_STREAM_ALL_INSTANCE(hdma->Instance));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 assert_param(IS_DMA_CHANNEL(hdma->Init.Channel));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 assert_param(IS_DMA_DIRECTION(hdma->Init.Direction));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 assert_param(IS_DMA_PERIPHERAL_INC_STATE(hdma->Init.PeriphInc));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 assert_param(IS_DMA_MEMORY_INC_STATE(hdma->Init.MemInc));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 assert_param(IS_DMA_PERIPHERAL_DATA_SIZE(hdma->Init.PeriphDataAlignment));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 assert_param(IS_DMA_MEMORY_DATA_SIZE(hdma->Init.MemDataAlignment));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 assert_param(IS_DMA_MODE(hdma->Init.Mode));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 assert_param(IS_DMA_PRIORITY(hdma->Init.Priority));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 assert_param(IS_DMA_FIFO_MODE_STATE(hdma->Init.FIFOMode));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 /* Check the memory burst, peripheral burst and FIFO threshold parameters only
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 when FIFO mode is enabled */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 if(hdma->Init.FIFOMode != DMA_FIFOMODE_DISABLE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 assert_param(IS_DMA_FIFO_THRESHOLD(hdma->Init.FIFOThreshold));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 assert_param(IS_DMA_MEMORY_BURST(hdma->Init.MemBurst));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 assert_param(IS_DMA_PERIPHERAL_BURST(hdma->Init.PeriphBurst));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 /* Change DMA peripheral state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 hdma->State = HAL_DMA_STATE_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 /* Get the CR register value */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 tmp = hdma->Instance->CR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 /* Clear CHSEL, MBURST, PBURST, PL, MSIZE, PSIZE, MINC, PINC, CIRC, DIR, CT and DBM bits */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 tmp &= ((uint32_t)~(DMA_SxCR_CHSEL | DMA_SxCR_MBURST | DMA_SxCR_PBURST | \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 DMA_SxCR_PL | DMA_SxCR_MSIZE | DMA_SxCR_PSIZE | \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 DMA_SxCR_MINC | DMA_SxCR_PINC | DMA_SxCR_CIRC | \
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 DMA_SxCR_DIR | DMA_SxCR_CT | DMA_SxCR_DBM));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 /* Prepare the DMA Stream configuration */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 tmp |= hdma->Init.Channel | hdma->Init.Direction |
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 hdma->Init.PeriphInc | hdma->Init.MemInc |
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 hdma->Init.PeriphDataAlignment | hdma->Init.MemDataAlignment |
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 hdma->Init.Mode | hdma->Init.Priority;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 /* the Memory burst and peripheral burst are not used when the FIFO is disabled */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 if(hdma->Init.FIFOMode == DMA_FIFOMODE_ENABLE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 /* Get memory burst and peripheral burst */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 tmp |= hdma->Init.MemBurst | hdma->Init.PeriphBurst;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 /* Write to DMA Stream CR register */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 hdma->Instance->CR = tmp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 /* Get the FCR register value */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 tmp = hdma->Instance->FCR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 /* Clear Direct mode and FIFO threshold bits */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 tmp &= (uint32_t)~(DMA_SxFCR_DMDIS | DMA_SxFCR_FTH);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 /* Prepare the DMA Stream FIFO configuration */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 tmp |= hdma->Init.FIFOMode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 /* the FIFO threshold is not used when the FIFO mode is disabled */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 if(hdma->Init.FIFOMode == DMA_FIFOMODE_ENABLE)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 /* Get the FIFO threshold */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 tmp |= hdma->Init.FIFOThreshold;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 /* Write to DMA Stream FCR */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 hdma->Instance->FCR = tmp;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 /* Initialize the error code */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 hdma->ErrorCode = HAL_DMA_ERROR_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 /* Initialize the DMA state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261 hdma->State = HAL_DMA_STATE_READY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267 * @brief DeInitializes the DMA peripheral
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 * @param hdma: pointer to a DMA_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 * the configuration information for the specified DMA Stream.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272 HAL_StatusTypeDef HAL_DMA_DeInit(DMA_HandleTypeDef *hdma)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 /* Check the DMA peripheral state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 if(hdma == NULL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 return HAL_ERROR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280 /* Check the DMA peripheral state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 if(hdma->State == HAL_DMA_STATE_BUSY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283 return HAL_ERROR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 /* Disable the selected DMA Streamx */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 __HAL_DMA_DISABLE(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 /* Reset DMA Streamx control register */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 hdma->Instance->CR = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 /* Reset DMA Streamx number of data to transfer register */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 hdma->Instance->NDTR = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 /* Reset DMA Streamx peripheral address register */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296 hdma->Instance->PAR = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298 /* Reset DMA Streamx memory 0 address register */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 hdma->Instance->M0AR = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301 /* Reset DMA Streamx memory 1 address register */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 hdma->Instance->M1AR = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304 /* Reset DMA Streamx FIFO control register */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305 hdma->Instance->FCR = (uint32_t)0x00000021;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 /* Clear all flags */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_DME_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_TC_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_TE_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_FE_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_HT_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 /* Initialize the error code */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 hdma->ErrorCode = HAL_DMA_ERROR_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317 /* Initialize the DMA state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 hdma->State = HAL_DMA_STATE_RESET;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 /* Release Lock */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 __HAL_UNLOCK(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 /** @addtogroup DMA_Exported_Functions_Group2
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 ===============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 ##### IO operation functions #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 ===============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 [..] This section provides functions allowing to:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 (+) Configure the source, destination address and data length and Start DMA transfer
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 (+) Configure the source, destination address and data length and
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 Start DMA transfer with interrupt
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 (+) Abort DMA transfer
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 (+) Poll for transfer complete
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 (+) Handle DMA interrupt request
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 * @brief Starts the DMA Transfer.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 * @param hdma : pointer to a DMA_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351 * the configuration information for the specified DMA Stream.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 * @param SrcAddress: The source memory Buffer address
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353 * @param DstAddress: The destination memory Buffer address
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 * @param DataLength: The length of data to be transferred from source to destination
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 HAL_StatusTypeDef HAL_DMA_Start(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 /* Process locked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 __HAL_LOCK(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 /* Change DMA peripheral state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 hdma->State = HAL_DMA_STATE_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 /* Check the parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 assert_param(IS_DMA_BUFFER_SIZE(DataLength));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 /* Disable the peripheral */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 __HAL_DMA_DISABLE(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 /* Configure the source, destination address and the data length */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 DMA_SetConfig(hdma, SrcAddress, DstAddress, DataLength);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374 /* Enable the Peripheral */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 __HAL_DMA_ENABLE(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 * @brief Start the DMA Transfer with interrupt enabled.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 * @param hdma: pointer to a DMA_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383 * the configuration information for the specified DMA Stream.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384 * @param SrcAddress: The source memory Buffer address
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385 * @param DstAddress: The destination memory Buffer address
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 * @param DataLength: The length of data to be transferred from source to destination
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389 HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391 /* Process locked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392 __HAL_LOCK(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 /* Change DMA peripheral state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395 hdma->State = HAL_DMA_STATE_BUSY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397 /* Check the parameters */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 assert_param(IS_DMA_BUFFER_SIZE(DataLength));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400 /* Disable the peripheral */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 __HAL_DMA_DISABLE(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403 /* Configure the source, destination address and the data length */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 DMA_SetConfig(hdma, SrcAddress, DstAddress, DataLength);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406 /* Enable the transfer complete interrupt */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407 __HAL_DMA_ENABLE_IT(hdma, DMA_IT_TC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409 /* Enable the Half transfer complete interrupt */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410 __HAL_DMA_ENABLE_IT(hdma, DMA_IT_HT);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412 /* Enable the transfer Error interrupt */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413 __HAL_DMA_ENABLE_IT(hdma, DMA_IT_TE);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415 /* Enable the FIFO Error interrupt */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416 __HAL_DMA_ENABLE_IT(hdma, DMA_IT_FE);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418 /* Enable the direct mode Error interrupt */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 __HAL_DMA_ENABLE_IT(hdma, DMA_IT_DME);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 /* Enable the Peripheral */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422 __HAL_DMA_ENABLE(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428 * @brief Aborts the DMA Transfer.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429 * @param hdma : pointer to a DMA_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
430 * the configuration information for the specified DMA Stream.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
431 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
432 * @note After disabling a DMA Stream, a check for wait until the DMA Stream is
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433 * effectively disabled is added. If a Stream is disabled
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434 * while a data transfer is ongoing, the current data will be transferred
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435 * and the Stream will be effectively disabled only after the transfer of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436 * this single data is finished.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439 HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 uint32_t tickstart = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443 /* Disable the stream */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 __HAL_DMA_DISABLE(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446 /* Get tick */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447 tickstart = HAL_GetTick();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 /* Check if the DMA Stream is effectively disabled */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450 while((hdma->Instance->CR & DMA_SxCR_EN) != 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452 /* Check for the Timeout */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453 if((HAL_GetTick() - tickstart ) > HAL_TIMEOUT_DMA_ABORT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
454 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455 /* Update error code */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456 hdma->ErrorCode |= HAL_DMA_ERROR_TIMEOUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458 /* Process Unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
459 __HAL_UNLOCK(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461 /* Change the DMA state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 hdma->State = HAL_DMA_STATE_TIMEOUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464 return HAL_TIMEOUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467 /* Process Unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468 __HAL_UNLOCK(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470 /* Change the DMA state*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471 hdma->State = HAL_DMA_STATE_READY;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477 * @brief Polling for transfer complete.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478 * @param hdma: pointer to a DMA_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479 * the configuration information for the specified DMA Stream.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480 * @param CompleteLevel: Specifies the DMA level complete.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481 * @param Timeout: Timeout duration.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484 HAL_StatusTypeDef HAL_DMA_PollForTransfer(DMA_HandleTypeDef *hdma, uint32_t CompleteLevel, uint32_t Timeout)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
485 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486 uint32_t temp, tmp, tmp1, tmp2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487 uint32_t tickstart = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
489 /* Get the level transfer complete flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
490 if(CompleteLevel == HAL_DMA_FULL_TRANSFER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
491 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
492 /* Transfer Complete flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493 temp = __HAL_DMA_GET_TC_FLAG_INDEX(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
494 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
495 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
496 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
497 /* Half Transfer Complete flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
498 temp = __HAL_DMA_GET_HT_FLAG_INDEX(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
499 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
500
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
501 /* Get tick */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
502 tickstart = HAL_GetTick();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
503
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
504 while(__HAL_DMA_GET_FLAG(hdma, temp) == RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
505 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
506 tmp = __HAL_DMA_GET_FLAG(hdma, __HAL_DMA_GET_TE_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
507 tmp1 = __HAL_DMA_GET_FLAG(hdma, __HAL_DMA_GET_FE_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
508 tmp2 = __HAL_DMA_GET_FLAG(hdma, __HAL_DMA_GET_DME_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
509 if((tmp != RESET) || (tmp1 != RESET) || (tmp2 != RESET))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
510 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
511 if(tmp != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
512 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
513 /* Update error code */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
514 hdma->ErrorCode |= HAL_DMA_ERROR_TE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
515
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
516 /* Clear the transfer error flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
517 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_TE_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
518 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
519 if(tmp1 != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
520 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
521 /* Update error code */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
522 hdma->ErrorCode |= HAL_DMA_ERROR_FE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
523
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524 /* Clear the FIFO error flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
525 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_FE_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
526 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
527 if(tmp2 != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
528 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
529 /* Update error code */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
530 hdma->ErrorCode |= HAL_DMA_ERROR_DME;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
531
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
532 /* Clear the Direct Mode error flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
533 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_DME_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
534 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
535 /* Change the DMA state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
536 hdma->State= HAL_DMA_STATE_ERROR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
537
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
538 /* Process Unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
539 __HAL_UNLOCK(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
540
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
541 return HAL_ERROR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
542 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
543 /* Check for the Timeout */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
544 if(Timeout != HAL_MAX_DELAY)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
545 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
546 if((Timeout == 0)||((HAL_GetTick() - tickstart ) > Timeout))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
547 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
548 /* Update error code */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
549 hdma->ErrorCode |= HAL_DMA_ERROR_TIMEOUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
550
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
551 /* Change the DMA state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
552 hdma->State = HAL_DMA_STATE_TIMEOUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
553
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
554 /* Process Unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
555 __HAL_UNLOCK(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
556
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
557 return HAL_TIMEOUT;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
558 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
559 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
560 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
561
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
562 if(CompleteLevel == HAL_DMA_FULL_TRANSFER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
563 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
564 /* Multi_Buffering mode enabled */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
565 if(((hdma->Instance->CR) & (uint32_t)(DMA_SxCR_DBM)) != 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
566 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
567 /* Clear the half transfer complete flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
568 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_HT_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
569 /* Clear the transfer complete flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
570 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_TC_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
571
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
572 /* Current memory buffer used is Memory 0 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
573 if((hdma->Instance->CR & DMA_SxCR_CT) == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
574 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
575 /* Change DMA peripheral state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
576 hdma->State = HAL_DMA_STATE_READY_MEM0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
577 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
578 /* Current memory buffer used is Memory 1 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
579 else if((hdma->Instance->CR & DMA_SxCR_CT) != 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
580 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
581 /* Change DMA peripheral state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
582 hdma->State = HAL_DMA_STATE_READY_MEM1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
583 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
584 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
585 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
586 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
587 /* Clear the half transfer complete flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
588 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_HT_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
589 /* Clear the transfer complete flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
590 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_TC_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
591
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
592 /* The selected Streamx EN bit is cleared (DMA is disabled and all transfers
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
593 are complete) */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
594 hdma->State = HAL_DMA_STATE_READY_MEM0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
595 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
596 /* Process Unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
597 __HAL_UNLOCK(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
598 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
599 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
600 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
601 /* Multi_Buffering mode enabled */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
602 if(((hdma->Instance->CR) & (uint32_t)(DMA_SxCR_DBM)) != 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
603 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
604 /* Clear the half transfer complete flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
605 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_HT_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
606
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
607 /* Current memory buffer used is Memory 0 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
608 if((hdma->Instance->CR & DMA_SxCR_CT) == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
609 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
610 /* Change DMA peripheral state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
611 hdma->State = HAL_DMA_STATE_READY_HALF_MEM0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
612 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
613 /* Current memory buffer used is Memory 1 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
614 else if((hdma->Instance->CR & DMA_SxCR_CT) != 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
615 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
616 /* Change DMA peripheral state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
617 hdma->State = HAL_DMA_STATE_READY_HALF_MEM1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
618 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
619 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
620 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
621 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
622 /* Clear the half transfer complete flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
623 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_HT_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
624
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
625 /* Change DMA peripheral state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
626 hdma->State = HAL_DMA_STATE_READY_HALF_MEM0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
627 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
628 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
629 return HAL_OK;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
630 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
631
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
632 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
633 * @brief Handles DMA interrupt request.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
634 * @param hdma: pointer to a DMA_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
635 * the configuration information for the specified DMA Stream.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
636 * @retval None
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
637 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
638 void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
639 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
640 /* Transfer Error Interrupt management ***************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
641 if(__HAL_DMA_GET_FLAG(hdma, __HAL_DMA_GET_TE_FLAG_INDEX(hdma)) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
642 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
643 if(__HAL_DMA_GET_IT_SOURCE(hdma, DMA_IT_TE) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
644 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
645 /* Disable the transfer error interrupt */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
646 __HAL_DMA_DISABLE_IT(hdma, DMA_IT_TE);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
647
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
648 /* Clear the transfer error flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
649 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_TE_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
650
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
651 /* Update error code */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
652 hdma->ErrorCode |= HAL_DMA_ERROR_TE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
653
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
654 /* Change the DMA state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
655 hdma->State = HAL_DMA_STATE_ERROR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
656
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
657 /* Process Unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
658 __HAL_UNLOCK(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
659
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
660 if(hdma->XferErrorCallback != NULL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
661 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
662 /* Transfer error callback */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
663 hdma->XferErrorCallback(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
664 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
665 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
666 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
667 /* FIFO Error Interrupt management ******************************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
668 if(__HAL_DMA_GET_FLAG(hdma, __HAL_DMA_GET_FE_FLAG_INDEX(hdma)) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
669 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
670 if(__HAL_DMA_GET_IT_SOURCE(hdma, DMA_IT_FE) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
671 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
672 /* Disable the FIFO Error interrupt */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
673 __HAL_DMA_DISABLE_IT(hdma, DMA_IT_FE);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
674
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
675 /* Clear the FIFO error flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
676 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_FE_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
677
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
678 /* Update error code */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
679 hdma->ErrorCode |= HAL_DMA_ERROR_FE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
680
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
681 /* Change the DMA state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
682 hdma->State = HAL_DMA_STATE_ERROR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
683
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
684 /* Process Unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
685 __HAL_UNLOCK(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
686
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
687 if(hdma->XferErrorCallback != NULL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
688 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
689 /* Transfer error callback */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
690 hdma->XferErrorCallback(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
691 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
692 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
693 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
694 /* Direct Mode Error Interrupt management ***********************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
695 if(__HAL_DMA_GET_FLAG(hdma, __HAL_DMA_GET_DME_FLAG_INDEX(hdma)) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
696 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
697 if(__HAL_DMA_GET_IT_SOURCE(hdma, DMA_IT_DME) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
698 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
699 /* Disable the direct mode Error interrupt */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
700 __HAL_DMA_DISABLE_IT(hdma, DMA_IT_DME);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
701
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
702 /* Clear the direct mode error flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
703 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_DME_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
704
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
705 /* Update error code */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
706 hdma->ErrorCode |= HAL_DMA_ERROR_DME;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
707
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
708 /* Change the DMA state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
709 hdma->State = HAL_DMA_STATE_ERROR;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
710
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
711 /* Process Unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
712 __HAL_UNLOCK(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
713
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
714 if(hdma->XferErrorCallback != NULL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
715 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
716 /* Transfer error callback */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
717 hdma->XferErrorCallback(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
718 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
719 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
720 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
721 /* Half Transfer Complete Interrupt management ******************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
722 if(__HAL_DMA_GET_FLAG(hdma, __HAL_DMA_GET_HT_FLAG_INDEX(hdma)) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
723 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
724 if(__HAL_DMA_GET_IT_SOURCE(hdma, DMA_IT_HT) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
725 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
726 /* Multi_Buffering mode enabled */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
727 if(((hdma->Instance->CR) & (uint32_t)(DMA_SxCR_DBM)) != 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
728 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
729 /* Clear the half transfer complete flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
730 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_HT_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
731
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
732 /* Current memory buffer used is Memory 0 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
733 if((hdma->Instance->CR & DMA_SxCR_CT) == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
734 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
735 /* Change DMA peripheral state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
736 hdma->State = HAL_DMA_STATE_READY_HALF_MEM0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
737 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
738 /* Current memory buffer used is Memory 1 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
739 else if((hdma->Instance->CR & DMA_SxCR_CT) != 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
740 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
741 /* Change DMA peripheral state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
742 hdma->State = HAL_DMA_STATE_READY_HALF_MEM1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
743 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
744 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
745 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
746 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
747 /* Disable the half transfer interrupt if the DMA mode is not CIRCULAR */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
748 if((hdma->Instance->CR & DMA_SxCR_CIRC) == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
749 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
750 /* Disable the half transfer interrupt */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
751 __HAL_DMA_DISABLE_IT(hdma, DMA_IT_HT);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
752 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
753 /* Clear the half transfer complete flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
754 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_HT_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
755
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
756 /* Change DMA peripheral state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
757 hdma->State = HAL_DMA_STATE_READY_HALF_MEM0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
758 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
759
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
760 if(hdma->XferHalfCpltCallback != NULL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
761 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
762 /* Half transfer callback */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
763 hdma->XferHalfCpltCallback(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
764 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
765 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
766 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
767 /* Transfer Complete Interrupt management ***********************************/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
768 if(__HAL_DMA_GET_FLAG(hdma, __HAL_DMA_GET_TC_FLAG_INDEX(hdma)) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
769 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
770 if(__HAL_DMA_GET_IT_SOURCE(hdma, DMA_IT_TC) != RESET)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
771 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
772 if(((hdma->Instance->CR) & (uint32_t)(DMA_SxCR_DBM)) != 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
773 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
774 /* Clear the transfer complete flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
775 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_TC_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
776
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
777 /* Current memory buffer used is Memory 1 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
778 if((hdma->Instance->CR & DMA_SxCR_CT) == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
779 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
780 if(hdma->XferM1CpltCallback != NULL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
781 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
782 /* Transfer complete Callback for memory1 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
783 hdma->XferM1CpltCallback(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
784 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
785 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
786 /* Current memory buffer used is Memory 0 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
787 else if((hdma->Instance->CR & DMA_SxCR_CT) != 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
788 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
789 if(hdma->XferCpltCallback != NULL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
790 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
791 /* Transfer complete Callback for memory0 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
792 hdma->XferCpltCallback(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
793 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
794 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
795 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
796 /* Disable the transfer complete interrupt if the DMA mode is not CIRCULAR */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
797 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
798 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
799 if((hdma->Instance->CR & DMA_SxCR_CIRC) == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
800 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
801 /* Disable the transfer complete interrupt */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
802 __HAL_DMA_DISABLE_IT(hdma, DMA_IT_TC);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
803 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
804 /* Clear the transfer complete flag */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
805 __HAL_DMA_CLEAR_FLAG(hdma, __HAL_DMA_GET_TC_FLAG_INDEX(hdma));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
806
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
807 /* Update error code */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
808 hdma->ErrorCode |= HAL_DMA_ERROR_NONE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
809
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
810 /* Change the DMA state */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
811 hdma->State = HAL_DMA_STATE_READY_MEM0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
812
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
813 /* Process Unlocked */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
814 __HAL_UNLOCK(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
815
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
816 if(hdma->XferCpltCallback != NULL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
817 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
818 /* Transfer complete callback */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
819 hdma->XferCpltCallback(hdma);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
820 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
821 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
822 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
823 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
824 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
825
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
826 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
827 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
828 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
829
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
830 /** @addtogroup DMA_Exported_Functions_Group3
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
831 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
832 @verbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
833 ===============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
834 ##### State and Errors functions #####
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
835 ===============================================================================
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
836 [..]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
837 This subsection provides functions allowing to
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
838 (+) Check the DMA state
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
839 (+) Get error code
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
840
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
841 @endverbatim
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
842 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
843 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
844
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
845 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
846 * @brief Returns the DMA state.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
847 * @param hdma: pointer to a DMA_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
848 * the configuration information for the specified DMA Stream.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
849 * @retval HAL state
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
850 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
851 HAL_DMA_StateTypeDef HAL_DMA_GetState(DMA_HandleTypeDef *hdma)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
852 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
853 return hdma->State;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
854 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
855
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
856 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
857 * @brief Return the DMA error code
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
858 * @param hdma : pointer to a DMA_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
859 * the configuration information for the specified DMA Stream.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
860 * @retval DMA Error Code
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
861 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
862 uint32_t HAL_DMA_GetError(DMA_HandleTypeDef *hdma)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
863 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
864 return hdma->ErrorCode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
865 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
866
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
867 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
868 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
869 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
870
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
871 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
872 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
873 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
874
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
875 /** @addtogroup DMA_Private_Functions
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
876 * @{
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
877 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
878
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
879 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
880 * @brief Sets the DMA Transfer parameter.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
881 * @param hdma: pointer to a DMA_HandleTypeDef structure that contains
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
882 * the configuration information for the specified DMA Stream.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
883 * @param SrcAddress: The source memory Buffer address
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
884 * @param DstAddress: The destination memory Buffer address
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
885 * @param DataLength: The length of data to be transferred from source to destination
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
886 * @retval HAL status
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
887 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
888 static void DMA_SetConfig(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
889 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
890 /* Clear DBM bit */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
891 hdma->Instance->CR &= (uint32_t)(~DMA_SxCR_DBM);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
892
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
893 /* Configure DMA Stream data length */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
894 hdma->Instance->NDTR = DataLength;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
895
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
896 /* Peripheral to Memory */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
897 if((hdma->Init.Direction) == DMA_MEMORY_TO_PERIPH)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
898 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
899 /* Configure DMA Stream destination address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
900 hdma->Instance->PAR = DstAddress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
901
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
902 /* Configure DMA Stream source address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
903 hdma->Instance->M0AR = SrcAddress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
904 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
905 /* Memory to Peripheral */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
906 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
907 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
908 /* Configure DMA Stream source address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
909 hdma->Instance->PAR = SrcAddress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
910
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
911 /* Configure DMA Stream destination address */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
912 hdma->Instance->M0AR = DstAddress;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
913 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
914 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
915 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
916 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
917 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
918
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
919 #endif /* HAL_DMA_MODULE_ENABLED */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
920 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
921 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
922 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
923
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
924 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
925 * @}
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
926 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
927
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
928 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/