stm32f7xx_ll_dma.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. /**
  2. ******************************************************************************
  3. * @file stm32f7xx_ll_dma.c
  4. * @author MCD Application Team
  5. * @brief DMA LL module driver.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification,
  12. * are permitted provided that the following conditions are met:
  13. * 1. Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  25. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  28. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  29. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. ******************************************************************************
  34. */
  35. #if defined(USE_FULL_LL_DRIVER)
  36. /* Includes ------------------------------------------------------------------*/
  37. #include "stm32f7xx_ll_dma.h"
  38. #include "stm32f7xx_ll_bus.h"
  39. #ifdef USE_FULL_ASSERT
  40. #include "stm32_assert.h"
  41. #else
  42. #define assert_param(expr) ((void)0U)
  43. #endif
  44. /** @addtogroup STM32F7xx_LL_Driver
  45. * @{
  46. */
  47. #if defined (DMA1) || defined (DMA2)
  48. /** @defgroup DMA_LL DMA
  49. * @{
  50. */
  51. /* Private types -------------------------------------------------------------*/
  52. /* Private variables ---------------------------------------------------------*/
  53. /* Private constants ---------------------------------------------------------*/
  54. /* Private macros ------------------------------------------------------------*/
  55. /** @addtogroup DMA_LL_Private_Macros
  56. * @{
  57. */
  58. #define IS_LL_DMA_DIRECTION(__VALUE__) (((__VALUE__) == LL_DMA_DIRECTION_PERIPH_TO_MEMORY) || \
  59. ((__VALUE__) == LL_DMA_DIRECTION_MEMORY_TO_PERIPH) || \
  60. ((__VALUE__) == LL_DMA_DIRECTION_MEMORY_TO_MEMORY))
  61. #define IS_LL_DMA_MODE(__VALUE__) (((__VALUE__) == LL_DMA_MODE_NORMAL) || \
  62. ((__VALUE__) == LL_DMA_MODE_CIRCULAR) || \
  63. ((__VALUE__) == LL_DMA_MODE_PFCTRL))
  64. #define IS_LL_DMA_PERIPHINCMODE(__VALUE__) (((__VALUE__) == LL_DMA_PERIPH_INCREMENT) || \
  65. ((__VALUE__) == LL_DMA_PERIPH_NOINCREMENT))
  66. #define IS_LL_DMA_MEMORYINCMODE(__VALUE__) (((__VALUE__) == LL_DMA_MEMORY_INCREMENT) || \
  67. ((__VALUE__) == LL_DMA_MEMORY_NOINCREMENT))
  68. #define IS_LL_DMA_PERIPHDATASIZE(__VALUE__) (((__VALUE__) == LL_DMA_PDATAALIGN_BYTE) || \
  69. ((__VALUE__) == LL_DMA_PDATAALIGN_HALFWORD) || \
  70. ((__VALUE__) == LL_DMA_PDATAALIGN_WORD))
  71. #define IS_LL_DMA_MEMORYDATASIZE(__VALUE__) (((__VALUE__) == LL_DMA_MDATAALIGN_BYTE) || \
  72. ((__VALUE__) == LL_DMA_MDATAALIGN_HALFWORD) || \
  73. ((__VALUE__) == LL_DMA_MDATAALIGN_WORD))
  74. #define IS_LL_DMA_NBDATA(__VALUE__) ((__VALUE__) <= 0x0000FFFFU)
  75. #if defined(DMA_CHANNEL_SELECTION_8_15)
  76. #define IS_LL_DMA_CHANNEL(__VALUE__) (((__VALUE__) == LL_DMA_CHANNEL_0) || \
  77. ((__VALUE__) == LL_DMA_CHANNEL_1) || \
  78. ((__VALUE__) == LL_DMA_CHANNEL_2) || \
  79. ((__VALUE__) == LL_DMA_CHANNEL_3) || \
  80. ((__VALUE__) == LL_DMA_CHANNEL_4) || \
  81. ((__VALUE__) == LL_DMA_CHANNEL_5) || \
  82. ((__VALUE__) == LL_DMA_CHANNEL_6) || \
  83. ((__VALUE__) == LL_DMA_CHANNEL_7) || \
  84. ((__VALUE__) == LL_DMA_CHANNEL_8) || \
  85. ((__VALUE__) == LL_DMA_CHANNEL_9) || \
  86. ((__VALUE__) == LL_DMA_CHANNEL_10) || \
  87. ((__VALUE__) == LL_DMA_CHANNEL_11) || \
  88. ((__VALUE__) == LL_DMA_CHANNEL_12) || \
  89. ((__VALUE__) == LL_DMA_CHANNEL_13) || \
  90. ((__VALUE__) == LL_DMA_CHANNEL_14) || \
  91. ((__VALUE__) == LL_DMA_CHANNEL_15))
  92. #else
  93. #define IS_LL_DMA_CHANNEL(__VALUE__) (((__VALUE__) == LL_DMA_CHANNEL_0) || \
  94. ((__VALUE__) == LL_DMA_CHANNEL_1) || \
  95. ((__VALUE__) == LL_DMA_CHANNEL_2) || \
  96. ((__VALUE__) == LL_DMA_CHANNEL_3) || \
  97. ((__VALUE__) == LL_DMA_CHANNEL_4) || \
  98. ((__VALUE__) == LL_DMA_CHANNEL_5) || \
  99. ((__VALUE__) == LL_DMA_CHANNEL_6) || \
  100. ((__VALUE__) == LL_DMA_CHANNEL_7))
  101. #endif /* DMA_CHANNEL_SELECTION_8_15 */
  102. #define IS_LL_DMA_PRIORITY(__VALUE__) (((__VALUE__) == LL_DMA_PRIORITY_LOW) || \
  103. ((__VALUE__) == LL_DMA_PRIORITY_MEDIUM) || \
  104. ((__VALUE__) == LL_DMA_PRIORITY_HIGH) || \
  105. ((__VALUE__) == LL_DMA_PRIORITY_VERYHIGH))
  106. #define IS_LL_DMA_ALL_STREAM_INSTANCE(INSTANCE, STREAM) ((((INSTANCE) == DMA1) && \
  107. (((STREAM) == LL_DMA_STREAM_0) || \
  108. ((STREAM) == LL_DMA_STREAM_1) || \
  109. ((STREAM) == LL_DMA_STREAM_2) || \
  110. ((STREAM) == LL_DMA_STREAM_3) || \
  111. ((STREAM) == LL_DMA_STREAM_4) || \
  112. ((STREAM) == LL_DMA_STREAM_5) || \
  113. ((STREAM) == LL_DMA_STREAM_6) || \
  114. ((STREAM) == LL_DMA_STREAM_7) || \
  115. ((STREAM) == LL_DMA_STREAM_ALL))) ||\
  116. (((INSTANCE) == DMA2) && \
  117. (((STREAM) == LL_DMA_STREAM_0) || \
  118. ((STREAM) == LL_DMA_STREAM_1) || \
  119. ((STREAM) == LL_DMA_STREAM_2) || \
  120. ((STREAM) == LL_DMA_STREAM_3) || \
  121. ((STREAM) == LL_DMA_STREAM_4) || \
  122. ((STREAM) == LL_DMA_STREAM_5) || \
  123. ((STREAM) == LL_DMA_STREAM_6) || \
  124. ((STREAM) == LL_DMA_STREAM_7) || \
  125. ((STREAM) == LL_DMA_STREAM_ALL))))
  126. #define IS_LL_DMA_FIFO_MODE_STATE(STATE) (((STATE) == LL_DMA_FIFOMODE_DISABLE ) || \
  127. ((STATE) == LL_DMA_FIFOMODE_ENABLE))
  128. #define IS_LL_DMA_FIFO_THRESHOLD(THRESHOLD) (((THRESHOLD) == LL_DMA_FIFOTHRESHOLD_1_4) || \
  129. ((THRESHOLD) == LL_DMA_FIFOTHRESHOLD_1_2) || \
  130. ((THRESHOLD) == LL_DMA_FIFOTHRESHOLD_3_4) || \
  131. ((THRESHOLD) == LL_DMA_FIFOTHRESHOLD_FULL))
  132. #define IS_LL_DMA_MEMORY_BURST(BURST) (((BURST) == LL_DMA_MBURST_SINGLE) || \
  133. ((BURST) == LL_DMA_MBURST_INC4) || \
  134. ((BURST) == LL_DMA_MBURST_INC8) || \
  135. ((BURST) == LL_DMA_MBURST_INC16))
  136. #define IS_LL_DMA_PERIPHERAL_BURST(BURST) (((BURST) == LL_DMA_PBURST_SINGLE) || \
  137. ((BURST) == LL_DMA_PBURST_INC4) || \
  138. ((BURST) == LL_DMA_PBURST_INC8) || \
  139. ((BURST) == LL_DMA_PBURST_INC16))
  140. /**
  141. * @}
  142. */
  143. /* Private function prototypes -----------------------------------------------*/
  144. /* Exported functions --------------------------------------------------------*/
  145. /** @addtogroup DMA_LL_Exported_Functions
  146. * @{
  147. */
  148. /** @addtogroup DMA_LL_EF_Init
  149. * @{
  150. */
  151. /**
  152. * @brief De-initialize the DMA registers to their default reset values.
  153. * @param DMAx DMAx Instance
  154. * @param Stream This parameter can be one of the following values:
  155. * @arg @ref LL_DMA_STREAM_0
  156. * @arg @ref LL_DMA_STREAM_1
  157. * @arg @ref LL_DMA_STREAM_2
  158. * @arg @ref LL_DMA_STREAM_3
  159. * @arg @ref LL_DMA_STREAM_4
  160. * @arg @ref LL_DMA_STREAM_5
  161. * @arg @ref LL_DMA_STREAM_6
  162. * @arg @ref LL_DMA_STREAM_7
  163. * @arg @ref LL_DMA_STREAM_ALL
  164. * @retval An ErrorStatus enumeration value:
  165. * - SUCCESS: DMA registers are de-initialized
  166. * - ERROR: DMA registers are not de-initialized
  167. */
  168. uint32_t LL_DMA_DeInit(DMA_TypeDef *DMAx, uint32_t Stream)
  169. {
  170. DMA_Stream_TypeDef *tmp = (DMA_Stream_TypeDef *)DMA1_Stream0;
  171. ErrorStatus status = SUCCESS;
  172. /* Check the DMA Instance DMAx and Stream parameters*/
  173. assert_param(IS_LL_DMA_ALL_STREAM_INSTANCE(DMAx, Stream));
  174. if (Stream == LL_DMA_STREAM_ALL)
  175. {
  176. if (DMAx == DMA1)
  177. {
  178. /* Force reset of DMA clock */
  179. LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_DMA1);
  180. /* Release reset of DMA clock */
  181. LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_DMA1);
  182. }
  183. else if (DMAx == DMA2)
  184. {
  185. /* Force reset of DMA clock */
  186. LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_DMA2);
  187. /* Release reset of DMA clock */
  188. LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_DMA2);
  189. }
  190. else
  191. {
  192. status = ERROR;
  193. }
  194. }
  195. else
  196. {
  197. /* Disable the selected Stream */
  198. LL_DMA_DisableStream(DMAx,Stream);
  199. /* Get the DMA Stream Instance */
  200. tmp = (DMA_Stream_TypeDef *)(__LL_DMA_GET_STREAM_INSTANCE(DMAx, Stream));
  201. /* Reset DMAx_Streamy configuration register */
  202. LL_DMA_WriteReg(tmp, CR, 0U);
  203. /* Reset DMAx_Streamy remaining bytes register */
  204. LL_DMA_WriteReg(tmp, NDTR, 0U);
  205. /* Reset DMAx_Streamy peripheral address register */
  206. LL_DMA_WriteReg(tmp, PAR, 0U);
  207. /* Reset DMAx_Streamy memory address register */
  208. LL_DMA_WriteReg(tmp, M0AR, 0U);
  209. /* Reset DMAx_Streamy memory address register */
  210. LL_DMA_WriteReg(tmp, M1AR, 0U);
  211. /* Reset DMAx_Streamy FIFO control register */
  212. LL_DMA_WriteReg(tmp, FCR, 0x00000021U);
  213. /* Reset Channel register field for DMAx Stream*/
  214. LL_DMA_SetChannelSelection(DMAx, Stream, LL_DMA_CHANNEL_0);
  215. if(Stream == LL_DMA_STREAM_0)
  216. {
  217. /* Reset the Stream0 pending flags */
  218. DMAx->LIFCR = 0x0000003FU;
  219. }
  220. else if(Stream == LL_DMA_STREAM_1)
  221. {
  222. /* Reset the Stream1 pending flags */
  223. DMAx->LIFCR = 0x00000F40U;
  224. }
  225. else if(Stream == LL_DMA_STREAM_2)
  226. {
  227. /* Reset the Stream2 pending flags */
  228. DMAx->LIFCR = 0x003F0000U;
  229. }
  230. else if(Stream == LL_DMA_STREAM_3)
  231. {
  232. /* Reset the Stream3 pending flags */
  233. DMAx->LIFCR = 0x0F400000U;
  234. }
  235. else if(Stream == LL_DMA_STREAM_4)
  236. {
  237. /* Reset the Stream4 pending flags */
  238. DMAx->HIFCR = 0x0000003FU;
  239. }
  240. else if(Stream == LL_DMA_STREAM_5)
  241. {
  242. /* Reset the Stream5 pending flags */
  243. DMAx->HIFCR = 0x00000F40U;
  244. }
  245. else if(Stream == LL_DMA_STREAM_6)
  246. {
  247. /* Reset the Stream6 pending flags */
  248. DMAx->HIFCR = 0x003F0000U;
  249. }
  250. else if(Stream == LL_DMA_STREAM_7)
  251. {
  252. /* Reset the Stream7 pending flags */
  253. DMAx->HIFCR = 0x0F400000U;
  254. }
  255. else
  256. {
  257. status = ERROR;
  258. }
  259. }
  260. return status;
  261. }
  262. /**
  263. * @brief Initialize the DMA registers according to the specified parameters in DMA_InitStruct.
  264. * @note To convert DMAx_Streamy Instance to DMAx Instance and Streamy, use helper macros :
  265. * @arg @ref __LL_DMA_GET_INSTANCE
  266. * @arg @ref __LL_DMA_GET_STREAM
  267. * @param DMAx DMAx Instance
  268. * @param Stream This parameter can be one of the following values:
  269. * @arg @ref LL_DMA_STREAM_0
  270. * @arg @ref LL_DMA_STREAM_1
  271. * @arg @ref LL_DMA_STREAM_2
  272. * @arg @ref LL_DMA_STREAM_3
  273. * @arg @ref LL_DMA_STREAM_4
  274. * @arg @ref LL_DMA_STREAM_5
  275. * @arg @ref LL_DMA_STREAM_6
  276. * @arg @ref LL_DMA_STREAM_7
  277. * @param DMA_InitStruct pointer to a @ref LL_DMA_InitTypeDef structure.
  278. * @retval An ErrorStatus enumeration value:
  279. * - SUCCESS: DMA registers are initialized
  280. * - ERROR: Not applicable
  281. */
  282. uint32_t LL_DMA_Init(DMA_TypeDef *DMAx, uint32_t Stream, LL_DMA_InitTypeDef *DMA_InitStruct)
  283. {
  284. /* Check the DMA Instance DMAx and Stream parameters*/
  285. assert_param(IS_LL_DMA_ALL_STREAM_INSTANCE(DMAx, Stream));
  286. /* Check the DMA parameters from DMA_InitStruct */
  287. assert_param(IS_LL_DMA_DIRECTION(DMA_InitStruct->Direction));
  288. assert_param(IS_LL_DMA_MODE(DMA_InitStruct->Mode));
  289. assert_param(IS_LL_DMA_PERIPHINCMODE(DMA_InitStruct->PeriphOrM2MSrcIncMode));
  290. assert_param(IS_LL_DMA_MEMORYINCMODE(DMA_InitStruct->MemoryOrM2MDstIncMode));
  291. assert_param(IS_LL_DMA_PERIPHDATASIZE(DMA_InitStruct->PeriphOrM2MSrcDataSize));
  292. assert_param(IS_LL_DMA_MEMORYDATASIZE(DMA_InitStruct->MemoryOrM2MDstDataSize));
  293. assert_param(IS_LL_DMA_NBDATA(DMA_InitStruct->NbData));
  294. assert_param(IS_LL_DMA_CHANNEL(DMA_InitStruct->Channel));
  295. assert_param(IS_LL_DMA_PRIORITY(DMA_InitStruct->Priority));
  296. assert_param(IS_LL_DMA_FIFO_MODE_STATE(DMA_InitStruct->FIFOMode));
  297. /* Check the memory burst, peripheral burst and FIFO threshold parameters only
  298. when FIFO mode is enabled */
  299. if(DMA_InitStruct->FIFOMode != LL_DMA_FIFOMODE_DISABLE)
  300. {
  301. assert_param(IS_LL_DMA_FIFO_THRESHOLD(DMA_InitStruct->FIFOThreshold));
  302. assert_param(IS_LL_DMA_MEMORY_BURST(DMA_InitStruct->MemBurst));
  303. assert_param(IS_LL_DMA_PERIPHERAL_BURST(DMA_InitStruct->PeriphBurst));
  304. }
  305. /*---------------------------- DMAx SxCR Configuration ------------------------
  306. * Configure DMAx_Streamy: data transfer direction, data transfer mode,
  307. * peripheral and memory increment mode,
  308. * data size alignment and priority level with parameters :
  309. * - Direction: DMA_SxCR_DIR[1:0] bits
  310. * - Mode: DMA_SxCR_CIRC bit
  311. * - PeriphOrM2MSrcIncMode: DMA_SxCR_PINC bit
  312. * - MemoryOrM2MDstIncMode: DMA_SxCR_MINC bit
  313. * - PeriphOrM2MSrcDataSize: DMA_SxCR_PSIZE[1:0] bits
  314. * - MemoryOrM2MDstDataSize: DMA_SxCR_MSIZE[1:0] bits
  315. * - Priority: DMA_SxCR_PL[1:0] bits
  316. */
  317. LL_DMA_ConfigTransfer(DMAx, Stream, DMA_InitStruct->Direction | \
  318. DMA_InitStruct->Mode | \
  319. DMA_InitStruct->PeriphOrM2MSrcIncMode | \
  320. DMA_InitStruct->MemoryOrM2MDstIncMode | \
  321. DMA_InitStruct->PeriphOrM2MSrcDataSize | \
  322. DMA_InitStruct->MemoryOrM2MDstDataSize | \
  323. DMA_InitStruct->Priority
  324. );
  325. if(DMA_InitStruct->FIFOMode != LL_DMA_FIFOMODE_DISABLE)
  326. {
  327. /*---------------------------- DMAx SxFCR Configuration ------------------------
  328. * Configure DMAx_Streamy: fifo mode and fifo threshold with parameters :
  329. * - FIFOMode: DMA_SxFCR_DMDIS bit
  330. * - FIFOThreshold: DMA_SxFCR_FTH[1:0] bits
  331. */
  332. LL_DMA_ConfigFifo(DMAx, Stream, DMA_InitStruct->FIFOMode, DMA_InitStruct->FIFOThreshold);
  333. /*---------------------------- DMAx SxCR Configuration --------------------------
  334. * Configure DMAx_Streamy: memory burst transfer with parameters :
  335. * - MemBurst: DMA_SxCR_MBURST[1:0] bits
  336. */
  337. LL_DMA_SetMemoryBurstxfer(DMAx,Stream,DMA_InitStruct->MemBurst);
  338. /*---------------------------- DMAx SxCR Configuration --------------------------
  339. * Configure DMAx_Streamy: peripheral burst transfer with parameters :
  340. * - PeriphBurst: DMA_SxCR_PBURST[1:0] bits
  341. */
  342. LL_DMA_SetPeriphBurstxfer(DMAx,Stream,DMA_InitStruct->PeriphBurst);
  343. }
  344. /*-------------------------- DMAx SxM0AR Configuration --------------------------
  345. * Configure the memory or destination base address with parameter :
  346. * - MemoryOrM2MDstAddress: DMA_SxM0AR_M0A[31:0] bits
  347. */
  348. LL_DMA_SetMemoryAddress(DMAx, Stream, DMA_InitStruct->MemoryOrM2MDstAddress);
  349. /*-------------------------- DMAx SxPAR Configuration ---------------------------
  350. * Configure the peripheral or source base address with parameter :
  351. * - PeriphOrM2MSrcAddress: DMA_SxPAR_PA[31:0] bits
  352. */
  353. LL_DMA_SetPeriphAddress(DMAx, Stream, DMA_InitStruct->PeriphOrM2MSrcAddress);
  354. /*--------------------------- DMAx SxNDTR Configuration -------------------------
  355. * Configure the peripheral base address with parameter :
  356. * - NbData: DMA_SxNDT[15:0] bits
  357. */
  358. LL_DMA_SetDataLength(DMAx, Stream, DMA_InitStruct->NbData);
  359. /*--------------------------- DMA SxCR_CHSEL Configuration ----------------------
  360. * Configure the peripheral base address with parameter :
  361. * - PeriphRequest: DMA_SxCR_CHSEL[3:0] bits
  362. */
  363. LL_DMA_SetChannelSelection(DMAx, Stream, DMA_InitStruct->Channel);
  364. return SUCCESS;
  365. }
  366. /**
  367. * @brief Set each @ref LL_DMA_InitTypeDef field to default value.
  368. * @param DMA_InitStruct Pointer to a @ref LL_DMA_InitTypeDef structure.
  369. * @retval None
  370. */
  371. void LL_DMA_StructInit(LL_DMA_InitTypeDef *DMA_InitStruct)
  372. {
  373. /* Set DMA_InitStruct fields to default values */
  374. DMA_InitStruct->PeriphOrM2MSrcAddress = 0x00000000U;
  375. DMA_InitStruct->MemoryOrM2MDstAddress = 0x00000000U;
  376. DMA_InitStruct->Direction = LL_DMA_DIRECTION_PERIPH_TO_MEMORY;
  377. DMA_InitStruct->Mode = LL_DMA_MODE_NORMAL;
  378. DMA_InitStruct->PeriphOrM2MSrcIncMode = LL_DMA_PERIPH_NOINCREMENT;
  379. DMA_InitStruct->MemoryOrM2MDstIncMode = LL_DMA_MEMORY_NOINCREMENT;
  380. DMA_InitStruct->PeriphOrM2MSrcDataSize = LL_DMA_PDATAALIGN_BYTE;
  381. DMA_InitStruct->MemoryOrM2MDstDataSize = LL_DMA_MDATAALIGN_BYTE;
  382. DMA_InitStruct->NbData = 0x00000000U;
  383. DMA_InitStruct->Channel = LL_DMA_CHANNEL_0;
  384. DMA_InitStruct->Priority = LL_DMA_PRIORITY_LOW;
  385. DMA_InitStruct->FIFOMode = LL_DMA_FIFOMODE_DISABLE;
  386. DMA_InitStruct->FIFOThreshold = LL_DMA_FIFOTHRESHOLD_1_4;
  387. DMA_InitStruct->MemBurst = LL_DMA_MBURST_SINGLE;
  388. DMA_InitStruct->PeriphBurst = LL_DMA_PBURST_SINGLE;
  389. }
  390. /**
  391. * @}
  392. */
  393. /**
  394. * @}
  395. */
  396. /**
  397. * @}
  398. */
  399. #endif /* DMA1 || DMA2 */
  400. /**
  401. * @}
  402. */
  403. #endif /* USE_FULL_LL_DRIVER */
  404. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/