stm32f1xx_ll_dma.h 74 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_ll_dma.h
  4. * @author MCD Application Team
  5. * @brief Header file of DMA LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2016 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file in
  13. * the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef __STM32F1xx_LL_DMA_H
  20. #define __STM32F1xx_LL_DMA_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32f1xx.h"
  26. /** @addtogroup STM32F1xx_LL_Driver
  27. * @{
  28. */
  29. #if defined (DMA1) || defined (DMA2)
  30. /** @defgroup DMA_LL DMA
  31. * @{
  32. */
  33. /* Private types -------------------------------------------------------------*/
  34. /* Private variables ---------------------------------------------------------*/
  35. /** @defgroup DMA_LL_Private_Variables DMA Private Variables
  36. * @{
  37. */
  38. /* Array used to get the DMA channel register offset versus channel index LL_DMA_CHANNEL_x */
  39. static const uint8_t CHANNEL_OFFSET_TAB[] =
  40. {
  41. (uint8_t)(DMA1_Channel1_BASE - DMA1_BASE),
  42. (uint8_t)(DMA1_Channel2_BASE - DMA1_BASE),
  43. (uint8_t)(DMA1_Channel3_BASE - DMA1_BASE),
  44. (uint8_t)(DMA1_Channel4_BASE - DMA1_BASE),
  45. (uint8_t)(DMA1_Channel5_BASE - DMA1_BASE),
  46. (uint8_t)(DMA1_Channel6_BASE - DMA1_BASE),
  47. (uint8_t)(DMA1_Channel7_BASE - DMA1_BASE)
  48. };
  49. /**
  50. * @}
  51. */
  52. /* Private constants ---------------------------------------------------------*/
  53. /* Private macros ------------------------------------------------------------*/
  54. #if defined(USE_FULL_LL_DRIVER)
  55. /** @defgroup DMA_LL_Private_Macros DMA Private Macros
  56. * @{
  57. */
  58. /**
  59. * @}
  60. */
  61. #endif /*USE_FULL_LL_DRIVER*/
  62. /* Exported types ------------------------------------------------------------*/
  63. #if defined(USE_FULL_LL_DRIVER)
  64. /** @defgroup DMA_LL_ES_INIT DMA Exported Init structure
  65. * @{
  66. */
  67. typedef struct
  68. {
  69. uint32_t PeriphOrM2MSrcAddress; /*!< Specifies the peripheral base address for DMA transfer
  70. or as Source base address in case of memory to memory transfer direction.
  71. This parameter must be a value between Min_Data = 0 and Max_Data = 0xFFFFFFFF. */
  72. uint32_t MemoryOrM2MDstAddress; /*!< Specifies the memory base address for DMA transfer
  73. or as Destination base address in case of memory to memory transfer direction.
  74. This parameter must be a value between Min_Data = 0 and Max_Data = 0xFFFFFFFF. */
  75. uint32_t Direction; /*!< Specifies if the data will be transferred from memory to peripheral,
  76. from memory to memory or from peripheral to memory.
  77. This parameter can be a value of @ref DMA_LL_EC_DIRECTION
  78. This feature can be modified afterwards using unitary function @ref LL_DMA_SetDataTransferDirection(). */
  79. uint32_t Mode; /*!< Specifies the normal or circular operation mode.
  80. This parameter can be a value of @ref DMA_LL_EC_MODE
  81. @note: The circular buffer mode cannot be used if the memory to memory
  82. data transfer direction is configured on the selected Channel
  83. This feature can be modified afterwards using unitary function @ref LL_DMA_SetMode(). */
  84. uint32_t PeriphOrM2MSrcIncMode; /*!< Specifies whether the Peripheral address or Source address in case of memory to memory transfer direction
  85. is incremented or not.
  86. This parameter can be a value of @ref DMA_LL_EC_PERIPH
  87. This feature can be modified afterwards using unitary function @ref LL_DMA_SetPeriphIncMode(). */
  88. uint32_t MemoryOrM2MDstIncMode; /*!< Specifies whether the Memory address or Destination address in case of memory to memory transfer direction
  89. is incremented or not.
  90. This parameter can be a value of @ref DMA_LL_EC_MEMORY
  91. This feature can be modified afterwards using unitary function @ref LL_DMA_SetMemoryIncMode(). */
  92. uint32_t PeriphOrM2MSrcDataSize; /*!< Specifies the Peripheral data size alignment or Source data size alignment (byte, half word, word)
  93. in case of memory to memory transfer direction.
  94. This parameter can be a value of @ref DMA_LL_EC_PDATAALIGN
  95. This feature can be modified afterwards using unitary function @ref LL_DMA_SetPeriphSize(). */
  96. uint32_t MemoryOrM2MDstDataSize; /*!< Specifies the Memory data size alignment or Destination data size alignment (byte, half word, word)
  97. in case of memory to memory transfer direction.
  98. This parameter can be a value of @ref DMA_LL_EC_MDATAALIGN
  99. This feature can be modified afterwards using unitary function @ref LL_DMA_SetMemorySize(). */
  100. uint32_t NbData; /*!< Specifies the number of data to transfer, in data unit.
  101. The data unit is equal to the source buffer configuration set in PeripheralSize
  102. or MemorySize parameters depending in the transfer direction.
  103. This parameter must be a value between Min_Data = 0 and Max_Data = 0x0000FFFF
  104. This feature can be modified afterwards using unitary function @ref LL_DMA_SetDataLength(). */
  105. uint32_t Priority; /*!< Specifies the channel priority level.
  106. This parameter can be a value of @ref DMA_LL_EC_PRIORITY
  107. This feature can be modified afterwards using unitary function @ref LL_DMA_SetChannelPriorityLevel(). */
  108. } LL_DMA_InitTypeDef;
  109. /**
  110. * @}
  111. */
  112. #endif /*USE_FULL_LL_DRIVER*/
  113. /* Exported constants --------------------------------------------------------*/
  114. /** @defgroup DMA_LL_Exported_Constants DMA Exported Constants
  115. * @{
  116. */
  117. /** @defgroup DMA_LL_EC_CLEAR_FLAG Clear Flags Defines
  118. * @brief Flags defines which can be used with LL_DMA_WriteReg function
  119. * @{
  120. */
  121. #define LL_DMA_IFCR_CGIF1 DMA_IFCR_CGIF1 /*!< Channel 1 global flag */
  122. #define LL_DMA_IFCR_CTCIF1 DMA_IFCR_CTCIF1 /*!< Channel 1 transfer complete flag */
  123. #define LL_DMA_IFCR_CHTIF1 DMA_IFCR_CHTIF1 /*!< Channel 1 half transfer flag */
  124. #define LL_DMA_IFCR_CTEIF1 DMA_IFCR_CTEIF1 /*!< Channel 1 transfer error flag */
  125. #define LL_DMA_IFCR_CGIF2 DMA_IFCR_CGIF2 /*!< Channel 2 global flag */
  126. #define LL_DMA_IFCR_CTCIF2 DMA_IFCR_CTCIF2 /*!< Channel 2 transfer complete flag */
  127. #define LL_DMA_IFCR_CHTIF2 DMA_IFCR_CHTIF2 /*!< Channel 2 half transfer flag */
  128. #define LL_DMA_IFCR_CTEIF2 DMA_IFCR_CTEIF2 /*!< Channel 2 transfer error flag */
  129. #define LL_DMA_IFCR_CGIF3 DMA_IFCR_CGIF3 /*!< Channel 3 global flag */
  130. #define LL_DMA_IFCR_CTCIF3 DMA_IFCR_CTCIF3 /*!< Channel 3 transfer complete flag */
  131. #define LL_DMA_IFCR_CHTIF3 DMA_IFCR_CHTIF3 /*!< Channel 3 half transfer flag */
  132. #define LL_DMA_IFCR_CTEIF3 DMA_IFCR_CTEIF3 /*!< Channel 3 transfer error flag */
  133. #define LL_DMA_IFCR_CGIF4 DMA_IFCR_CGIF4 /*!< Channel 4 global flag */
  134. #define LL_DMA_IFCR_CTCIF4 DMA_IFCR_CTCIF4 /*!< Channel 4 transfer complete flag */
  135. #define LL_DMA_IFCR_CHTIF4 DMA_IFCR_CHTIF4 /*!< Channel 4 half transfer flag */
  136. #define LL_DMA_IFCR_CTEIF4 DMA_IFCR_CTEIF4 /*!< Channel 4 transfer error flag */
  137. #define LL_DMA_IFCR_CGIF5 DMA_IFCR_CGIF5 /*!< Channel 5 global flag */
  138. #define LL_DMA_IFCR_CTCIF5 DMA_IFCR_CTCIF5 /*!< Channel 5 transfer complete flag */
  139. #define LL_DMA_IFCR_CHTIF5 DMA_IFCR_CHTIF5 /*!< Channel 5 half transfer flag */
  140. #define LL_DMA_IFCR_CTEIF5 DMA_IFCR_CTEIF5 /*!< Channel 5 transfer error flag */
  141. #define LL_DMA_IFCR_CGIF6 DMA_IFCR_CGIF6 /*!< Channel 6 global flag */
  142. #define LL_DMA_IFCR_CTCIF6 DMA_IFCR_CTCIF6 /*!< Channel 6 transfer complete flag */
  143. #define LL_DMA_IFCR_CHTIF6 DMA_IFCR_CHTIF6 /*!< Channel 6 half transfer flag */
  144. #define LL_DMA_IFCR_CTEIF6 DMA_IFCR_CTEIF6 /*!< Channel 6 transfer error flag */
  145. #define LL_DMA_IFCR_CGIF7 DMA_IFCR_CGIF7 /*!< Channel 7 global flag */
  146. #define LL_DMA_IFCR_CTCIF7 DMA_IFCR_CTCIF7 /*!< Channel 7 transfer complete flag */
  147. #define LL_DMA_IFCR_CHTIF7 DMA_IFCR_CHTIF7 /*!< Channel 7 half transfer flag */
  148. #define LL_DMA_IFCR_CTEIF7 DMA_IFCR_CTEIF7 /*!< Channel 7 transfer error flag */
  149. /**
  150. * @}
  151. */
  152. /** @defgroup DMA_LL_EC_GET_FLAG Get Flags Defines
  153. * @brief Flags defines which can be used with LL_DMA_ReadReg function
  154. * @{
  155. */
  156. #define LL_DMA_ISR_GIF1 DMA_ISR_GIF1 /*!< Channel 1 global flag */
  157. #define LL_DMA_ISR_TCIF1 DMA_ISR_TCIF1 /*!< Channel 1 transfer complete flag */
  158. #define LL_DMA_ISR_HTIF1 DMA_ISR_HTIF1 /*!< Channel 1 half transfer flag */
  159. #define LL_DMA_ISR_TEIF1 DMA_ISR_TEIF1 /*!< Channel 1 transfer error flag */
  160. #define LL_DMA_ISR_GIF2 DMA_ISR_GIF2 /*!< Channel 2 global flag */
  161. #define LL_DMA_ISR_TCIF2 DMA_ISR_TCIF2 /*!< Channel 2 transfer complete flag */
  162. #define LL_DMA_ISR_HTIF2 DMA_ISR_HTIF2 /*!< Channel 2 half transfer flag */
  163. #define LL_DMA_ISR_TEIF2 DMA_ISR_TEIF2 /*!< Channel 2 transfer error flag */
  164. #define LL_DMA_ISR_GIF3 DMA_ISR_GIF3 /*!< Channel 3 global flag */
  165. #define LL_DMA_ISR_TCIF3 DMA_ISR_TCIF3 /*!< Channel 3 transfer complete flag */
  166. #define LL_DMA_ISR_HTIF3 DMA_ISR_HTIF3 /*!< Channel 3 half transfer flag */
  167. #define LL_DMA_ISR_TEIF3 DMA_ISR_TEIF3 /*!< Channel 3 transfer error flag */
  168. #define LL_DMA_ISR_GIF4 DMA_ISR_GIF4 /*!< Channel 4 global flag */
  169. #define LL_DMA_ISR_TCIF4 DMA_ISR_TCIF4 /*!< Channel 4 transfer complete flag */
  170. #define LL_DMA_ISR_HTIF4 DMA_ISR_HTIF4 /*!< Channel 4 half transfer flag */
  171. #define LL_DMA_ISR_TEIF4 DMA_ISR_TEIF4 /*!< Channel 4 transfer error flag */
  172. #define LL_DMA_ISR_GIF5 DMA_ISR_GIF5 /*!< Channel 5 global flag */
  173. #define LL_DMA_ISR_TCIF5 DMA_ISR_TCIF5 /*!< Channel 5 transfer complete flag */
  174. #define LL_DMA_ISR_HTIF5 DMA_ISR_HTIF5 /*!< Channel 5 half transfer flag */
  175. #define LL_DMA_ISR_TEIF5 DMA_ISR_TEIF5 /*!< Channel 5 transfer error flag */
  176. #define LL_DMA_ISR_GIF6 DMA_ISR_GIF6 /*!< Channel 6 global flag */
  177. #define LL_DMA_ISR_TCIF6 DMA_ISR_TCIF6 /*!< Channel 6 transfer complete flag */
  178. #define LL_DMA_ISR_HTIF6 DMA_ISR_HTIF6 /*!< Channel 6 half transfer flag */
  179. #define LL_DMA_ISR_TEIF6 DMA_ISR_TEIF6 /*!< Channel 6 transfer error flag */
  180. #define LL_DMA_ISR_GIF7 DMA_ISR_GIF7 /*!< Channel 7 global flag */
  181. #define LL_DMA_ISR_TCIF7 DMA_ISR_TCIF7 /*!< Channel 7 transfer complete flag */
  182. #define LL_DMA_ISR_HTIF7 DMA_ISR_HTIF7 /*!< Channel 7 half transfer flag */
  183. #define LL_DMA_ISR_TEIF7 DMA_ISR_TEIF7 /*!< Channel 7 transfer error flag */
  184. /**
  185. * @}
  186. */
  187. /** @defgroup DMA_LL_EC_IT IT Defines
  188. * @brief IT defines which can be used with LL_DMA_ReadReg and LL_DMA_WriteReg functions
  189. * @{
  190. */
  191. #define LL_DMA_CCR_TCIE DMA_CCR_TCIE /*!< Transfer complete interrupt */
  192. #define LL_DMA_CCR_HTIE DMA_CCR_HTIE /*!< Half Transfer interrupt */
  193. #define LL_DMA_CCR_TEIE DMA_CCR_TEIE /*!< Transfer error interrupt */
  194. /**
  195. * @}
  196. */
  197. /** @defgroup DMA_LL_EC_CHANNEL CHANNEL
  198. * @{
  199. */
  200. #define LL_DMA_CHANNEL_1 0x00000001U /*!< DMA Channel 1 */
  201. #define LL_DMA_CHANNEL_2 0x00000002U /*!< DMA Channel 2 */
  202. #define LL_DMA_CHANNEL_3 0x00000003U /*!< DMA Channel 3 */
  203. #define LL_DMA_CHANNEL_4 0x00000004U /*!< DMA Channel 4 */
  204. #define LL_DMA_CHANNEL_5 0x00000005U /*!< DMA Channel 5 */
  205. #define LL_DMA_CHANNEL_6 0x00000006U /*!< DMA Channel 6 */
  206. #define LL_DMA_CHANNEL_7 0x00000007U /*!< DMA Channel 7 */
  207. #if defined(USE_FULL_LL_DRIVER)
  208. #define LL_DMA_CHANNEL_ALL 0xFFFF0000U /*!< DMA Channel all (used only for function @ref LL_DMA_DeInit(). */
  209. #endif /*USE_FULL_LL_DRIVER*/
  210. /**
  211. * @}
  212. */
  213. /** @defgroup DMA_LL_EC_DIRECTION Transfer Direction
  214. * @{
  215. */
  216. #define LL_DMA_DIRECTION_PERIPH_TO_MEMORY 0x00000000U /*!< Peripheral to memory direction */
  217. #define LL_DMA_DIRECTION_MEMORY_TO_PERIPH DMA_CCR_DIR /*!< Memory to peripheral direction */
  218. #define LL_DMA_DIRECTION_MEMORY_TO_MEMORY DMA_CCR_MEM2MEM /*!< Memory to memory direction */
  219. /**
  220. * @}
  221. */
  222. /** @defgroup DMA_LL_EC_MODE Transfer mode
  223. * @{
  224. */
  225. #define LL_DMA_MODE_NORMAL 0x00000000U /*!< Normal Mode */
  226. #define LL_DMA_MODE_CIRCULAR DMA_CCR_CIRC /*!< Circular Mode */
  227. /**
  228. * @}
  229. */
  230. /** @defgroup DMA_LL_EC_PERIPH Peripheral increment mode
  231. * @{
  232. */
  233. #define LL_DMA_PERIPH_INCREMENT DMA_CCR_PINC /*!< Peripheral increment mode Enable */
  234. #define LL_DMA_PERIPH_NOINCREMENT 0x00000000U /*!< Peripheral increment mode Disable */
  235. /**
  236. * @}
  237. */
  238. /** @defgroup DMA_LL_EC_MEMORY Memory increment mode
  239. * @{
  240. */
  241. #define LL_DMA_MEMORY_INCREMENT DMA_CCR_MINC /*!< Memory increment mode Enable */
  242. #define LL_DMA_MEMORY_NOINCREMENT 0x00000000U /*!< Memory increment mode Disable */
  243. /**
  244. * @}
  245. */
  246. /** @defgroup DMA_LL_EC_PDATAALIGN Peripheral data alignment
  247. * @{
  248. */
  249. #define LL_DMA_PDATAALIGN_BYTE 0x00000000U /*!< Peripheral data alignment : Byte */
  250. #define LL_DMA_PDATAALIGN_HALFWORD DMA_CCR_PSIZE_0 /*!< Peripheral data alignment : HalfWord */
  251. #define LL_DMA_PDATAALIGN_WORD DMA_CCR_PSIZE_1 /*!< Peripheral data alignment : Word */
  252. /**
  253. * @}
  254. */
  255. /** @defgroup DMA_LL_EC_MDATAALIGN Memory data alignment
  256. * @{
  257. */
  258. #define LL_DMA_MDATAALIGN_BYTE 0x00000000U /*!< Memory data alignment : Byte */
  259. #define LL_DMA_MDATAALIGN_HALFWORD DMA_CCR_MSIZE_0 /*!< Memory data alignment : HalfWord */
  260. #define LL_DMA_MDATAALIGN_WORD DMA_CCR_MSIZE_1 /*!< Memory data alignment : Word */
  261. /**
  262. * @}
  263. */
  264. /** @defgroup DMA_LL_EC_PRIORITY Transfer Priority level
  265. * @{
  266. */
  267. #define LL_DMA_PRIORITY_LOW 0x00000000U /*!< Priority level : Low */
  268. #define LL_DMA_PRIORITY_MEDIUM DMA_CCR_PL_0 /*!< Priority level : Medium */
  269. #define LL_DMA_PRIORITY_HIGH DMA_CCR_PL_1 /*!< Priority level : High */
  270. #define LL_DMA_PRIORITY_VERYHIGH DMA_CCR_PL /*!< Priority level : Very_High */
  271. /**
  272. * @}
  273. */
  274. /**
  275. * @}
  276. */
  277. /* Exported macro ------------------------------------------------------------*/
  278. /** @defgroup DMA_LL_Exported_Macros DMA Exported Macros
  279. * @{
  280. */
  281. /** @defgroup DMA_LL_EM_WRITE_READ Common Write and read registers macros
  282. * @{
  283. */
  284. /**
  285. * @brief Write a value in DMA register
  286. * @param __INSTANCE__ DMA Instance
  287. * @param __REG__ Register to be written
  288. * @param __VALUE__ Value to be written in the register
  289. * @retval None
  290. */
  291. #define LL_DMA_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
  292. /**
  293. * @brief Read a value in DMA register
  294. * @param __INSTANCE__ DMA Instance
  295. * @param __REG__ Register to be read
  296. * @retval Register value
  297. */
  298. #define LL_DMA_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
  299. /**
  300. * @}
  301. */
  302. /** @defgroup DMA_LL_EM_CONVERT_DMAxCHANNELy Convert DMAxChannely
  303. * @{
  304. */
  305. /**
  306. * @brief Convert DMAx_Channely into DMAx
  307. * @param __CHANNEL_INSTANCE__ DMAx_Channely
  308. * @retval DMAx
  309. */
  310. #if defined(DMA2)
  311. #define __LL_DMA_GET_INSTANCE(__CHANNEL_INSTANCE__) \
  312. (((uint32_t)(__CHANNEL_INSTANCE__) > ((uint32_t)DMA1_Channel7)) ? DMA2 : DMA1)
  313. #else
  314. #define __LL_DMA_GET_INSTANCE(__CHANNEL_INSTANCE__) (DMA1)
  315. #endif
  316. /**
  317. * @brief Convert DMAx_Channely into LL_DMA_CHANNEL_y
  318. * @param __CHANNEL_INSTANCE__ DMAx_Channely
  319. * @retval LL_DMA_CHANNEL_y
  320. */
  321. #if defined (DMA2)
  322. #define __LL_DMA_GET_CHANNEL(__CHANNEL_INSTANCE__) \
  323. (((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel1)) ? LL_DMA_CHANNEL_1 : \
  324. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel1)) ? LL_DMA_CHANNEL_1 : \
  325. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel2)) ? LL_DMA_CHANNEL_2 : \
  326. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel2)) ? LL_DMA_CHANNEL_2 : \
  327. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel3)) ? LL_DMA_CHANNEL_3 : \
  328. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel3)) ? LL_DMA_CHANNEL_3 : \
  329. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel4)) ? LL_DMA_CHANNEL_4 : \
  330. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel4)) ? LL_DMA_CHANNEL_4 : \
  331. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel5)) ? LL_DMA_CHANNEL_5 : \
  332. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel5)) ? LL_DMA_CHANNEL_5 : \
  333. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel6)) ? LL_DMA_CHANNEL_6 : \
  334. LL_DMA_CHANNEL_7)
  335. #else
  336. #define __LL_DMA_GET_CHANNEL(__CHANNEL_INSTANCE__) \
  337. (((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel1)) ? LL_DMA_CHANNEL_1 : \
  338. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel2)) ? LL_DMA_CHANNEL_2 : \
  339. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel3)) ? LL_DMA_CHANNEL_3 : \
  340. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel4)) ? LL_DMA_CHANNEL_4 : \
  341. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel5)) ? LL_DMA_CHANNEL_5 : \
  342. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel6)) ? LL_DMA_CHANNEL_6 : \
  343. LL_DMA_CHANNEL_7)
  344. #endif
  345. /**
  346. * @brief Convert DMA Instance DMAx and LL_DMA_CHANNEL_y into DMAx_Channely
  347. * @param __DMA_INSTANCE__ DMAx
  348. * @param __CHANNEL__ LL_DMA_CHANNEL_y
  349. * @retval DMAx_Channely
  350. */
  351. #if defined (DMA2)
  352. #define __LL_DMA_GET_CHANNEL_INSTANCE(__DMA_INSTANCE__, __CHANNEL__) \
  353. ((((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_1))) ? DMA1_Channel1 : \
  354. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_1))) ? DMA2_Channel1 : \
  355. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_2))) ? DMA1_Channel2 : \
  356. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_2))) ? DMA2_Channel2 : \
  357. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_3))) ? DMA1_Channel3 : \
  358. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_3))) ? DMA2_Channel3 : \
  359. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_4))) ? DMA1_Channel4 : \
  360. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_4))) ? DMA2_Channel4 : \
  361. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_5))) ? DMA1_Channel5 : \
  362. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_5))) ? DMA2_Channel5 : \
  363. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_6))) ? DMA1_Channel6 : \
  364. DMA1_Channel7)
  365. #else
  366. #define __LL_DMA_GET_CHANNEL_INSTANCE(__DMA_INSTANCE__, __CHANNEL__) \
  367. ((((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_1))) ? DMA1_Channel1 : \
  368. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_2))) ? DMA1_Channel2 : \
  369. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_3))) ? DMA1_Channel3 : \
  370. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_4))) ? DMA1_Channel4 : \
  371. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_5))) ? DMA1_Channel5 : \
  372. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_6))) ? DMA1_Channel6 : \
  373. DMA1_Channel7)
  374. #endif
  375. /**
  376. * @}
  377. */
  378. /**
  379. * @}
  380. */
  381. /* Exported functions --------------------------------------------------------*/
  382. /** @defgroup DMA_LL_Exported_Functions DMA Exported Functions
  383. * @{
  384. */
  385. /** @defgroup DMA_LL_EF_Configuration Configuration
  386. * @{
  387. */
  388. /**
  389. * @brief Enable DMA channel.
  390. * @rmtoll CCR EN LL_DMA_EnableChannel
  391. * @param DMAx DMAx Instance
  392. * @param Channel This parameter can be one of the following values:
  393. * @arg @ref LL_DMA_CHANNEL_1
  394. * @arg @ref LL_DMA_CHANNEL_2
  395. * @arg @ref LL_DMA_CHANNEL_3
  396. * @arg @ref LL_DMA_CHANNEL_4
  397. * @arg @ref LL_DMA_CHANNEL_5
  398. * @arg @ref LL_DMA_CHANNEL_6
  399. * @arg @ref LL_DMA_CHANNEL_7
  400. * @retval None
  401. */
  402. __STATIC_INLINE void LL_DMA_EnableChannel(DMA_TypeDef *DMAx, uint32_t Channel)
  403. {
  404. SET_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_EN);
  405. }
  406. /**
  407. * @brief Disable DMA channel.
  408. * @rmtoll CCR EN LL_DMA_DisableChannel
  409. * @param DMAx DMAx Instance
  410. * @param Channel This parameter can be one of the following values:
  411. * @arg @ref LL_DMA_CHANNEL_1
  412. * @arg @ref LL_DMA_CHANNEL_2
  413. * @arg @ref LL_DMA_CHANNEL_3
  414. * @arg @ref LL_DMA_CHANNEL_4
  415. * @arg @ref LL_DMA_CHANNEL_5
  416. * @arg @ref LL_DMA_CHANNEL_6
  417. * @arg @ref LL_DMA_CHANNEL_7
  418. * @retval None
  419. */
  420. __STATIC_INLINE void LL_DMA_DisableChannel(DMA_TypeDef *DMAx, uint32_t Channel)
  421. {
  422. CLEAR_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_EN);
  423. }
  424. /**
  425. * @brief Check if DMA channel is enabled or disabled.
  426. * @rmtoll CCR EN LL_DMA_IsEnabledChannel
  427. * @param DMAx DMAx Instance
  428. * @param Channel This parameter can be one of the following values:
  429. * @arg @ref LL_DMA_CHANNEL_1
  430. * @arg @ref LL_DMA_CHANNEL_2
  431. * @arg @ref LL_DMA_CHANNEL_3
  432. * @arg @ref LL_DMA_CHANNEL_4
  433. * @arg @ref LL_DMA_CHANNEL_5
  434. * @arg @ref LL_DMA_CHANNEL_6
  435. * @arg @ref LL_DMA_CHANNEL_7
  436. * @retval State of bit (1 or 0).
  437. */
  438. __STATIC_INLINE uint32_t LL_DMA_IsEnabledChannel(DMA_TypeDef *DMAx, uint32_t Channel)
  439. {
  440. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  441. DMA_CCR_EN) == (DMA_CCR_EN));
  442. }
  443. /**
  444. * @brief Configure all parameters link to DMA transfer.
  445. * @rmtoll CCR DIR LL_DMA_ConfigTransfer\n
  446. * CCR MEM2MEM LL_DMA_ConfigTransfer\n
  447. * CCR CIRC LL_DMA_ConfigTransfer\n
  448. * CCR PINC LL_DMA_ConfigTransfer\n
  449. * CCR MINC LL_DMA_ConfigTransfer\n
  450. * CCR PSIZE LL_DMA_ConfigTransfer\n
  451. * CCR MSIZE LL_DMA_ConfigTransfer\n
  452. * CCR PL LL_DMA_ConfigTransfer
  453. * @param DMAx DMAx Instance
  454. * @param Channel This parameter can be one of the following values:
  455. * @arg @ref LL_DMA_CHANNEL_1
  456. * @arg @ref LL_DMA_CHANNEL_2
  457. * @arg @ref LL_DMA_CHANNEL_3
  458. * @arg @ref LL_DMA_CHANNEL_4
  459. * @arg @ref LL_DMA_CHANNEL_5
  460. * @arg @ref LL_DMA_CHANNEL_6
  461. * @arg @ref LL_DMA_CHANNEL_7
  462. * @param Configuration This parameter must be a combination of all the following values:
  463. * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY or @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH or @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY
  464. * @arg @ref LL_DMA_MODE_NORMAL or @ref LL_DMA_MODE_CIRCULAR
  465. * @arg @ref LL_DMA_PERIPH_INCREMENT or @ref LL_DMA_PERIPH_NOINCREMENT
  466. * @arg @ref LL_DMA_MEMORY_INCREMENT or @ref LL_DMA_MEMORY_NOINCREMENT
  467. * @arg @ref LL_DMA_PDATAALIGN_BYTE or @ref LL_DMA_PDATAALIGN_HALFWORD or @ref LL_DMA_PDATAALIGN_WORD
  468. * @arg @ref LL_DMA_MDATAALIGN_BYTE or @ref LL_DMA_MDATAALIGN_HALFWORD or @ref LL_DMA_MDATAALIGN_WORD
  469. * @arg @ref LL_DMA_PRIORITY_LOW or @ref LL_DMA_PRIORITY_MEDIUM or @ref LL_DMA_PRIORITY_HIGH or @ref LL_DMA_PRIORITY_VERYHIGH
  470. * @retval None
  471. */
  472. __STATIC_INLINE void LL_DMA_ConfigTransfer(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t Configuration)
  473. {
  474. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  475. DMA_CCR_DIR | DMA_CCR_MEM2MEM | DMA_CCR_CIRC | DMA_CCR_PINC | DMA_CCR_MINC | DMA_CCR_PSIZE | DMA_CCR_MSIZE | DMA_CCR_PL,
  476. Configuration);
  477. }
  478. /**
  479. * @brief Set Data transfer direction (read from peripheral or from memory).
  480. * @rmtoll CCR DIR LL_DMA_SetDataTransferDirection\n
  481. * CCR MEM2MEM LL_DMA_SetDataTransferDirection
  482. * @param DMAx DMAx Instance
  483. * @param Channel This parameter can be one of the following values:
  484. * @arg @ref LL_DMA_CHANNEL_1
  485. * @arg @ref LL_DMA_CHANNEL_2
  486. * @arg @ref LL_DMA_CHANNEL_3
  487. * @arg @ref LL_DMA_CHANNEL_4
  488. * @arg @ref LL_DMA_CHANNEL_5
  489. * @arg @ref LL_DMA_CHANNEL_6
  490. * @arg @ref LL_DMA_CHANNEL_7
  491. * @param Direction This parameter can be one of the following values:
  492. * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY
  493. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH
  494. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY
  495. * @retval None
  496. */
  497. __STATIC_INLINE void LL_DMA_SetDataTransferDirection(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t Direction)
  498. {
  499. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  500. DMA_CCR_DIR | DMA_CCR_MEM2MEM, Direction);
  501. }
  502. /**
  503. * @brief Get Data transfer direction (read from peripheral or from memory).
  504. * @rmtoll CCR DIR LL_DMA_GetDataTransferDirection\n
  505. * CCR MEM2MEM LL_DMA_GetDataTransferDirection
  506. * @param DMAx DMAx Instance
  507. * @param Channel This parameter can be one of the following values:
  508. * @arg @ref LL_DMA_CHANNEL_1
  509. * @arg @ref LL_DMA_CHANNEL_2
  510. * @arg @ref LL_DMA_CHANNEL_3
  511. * @arg @ref LL_DMA_CHANNEL_4
  512. * @arg @ref LL_DMA_CHANNEL_5
  513. * @arg @ref LL_DMA_CHANNEL_6
  514. * @arg @ref LL_DMA_CHANNEL_7
  515. * @retval Returned value can be one of the following values:
  516. * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY
  517. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH
  518. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY
  519. */
  520. __STATIC_INLINE uint32_t LL_DMA_GetDataTransferDirection(DMA_TypeDef *DMAx, uint32_t Channel)
  521. {
  522. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  523. DMA_CCR_DIR | DMA_CCR_MEM2MEM));
  524. }
  525. /**
  526. * @brief Set DMA mode circular or normal.
  527. * @note The circular buffer mode cannot be used if the memory-to-memory
  528. * data transfer is configured on the selected Channel.
  529. * @rmtoll CCR CIRC LL_DMA_SetMode
  530. * @param DMAx DMAx Instance
  531. * @param Channel This parameter can be one of the following values:
  532. * @arg @ref LL_DMA_CHANNEL_1
  533. * @arg @ref LL_DMA_CHANNEL_2
  534. * @arg @ref LL_DMA_CHANNEL_3
  535. * @arg @ref LL_DMA_CHANNEL_4
  536. * @arg @ref LL_DMA_CHANNEL_5
  537. * @arg @ref LL_DMA_CHANNEL_6
  538. * @arg @ref LL_DMA_CHANNEL_7
  539. * @param Mode This parameter can be one of the following values:
  540. * @arg @ref LL_DMA_MODE_NORMAL
  541. * @arg @ref LL_DMA_MODE_CIRCULAR
  542. * @retval None
  543. */
  544. __STATIC_INLINE void LL_DMA_SetMode(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t Mode)
  545. {
  546. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_CIRC,
  547. Mode);
  548. }
  549. /**
  550. * @brief Get DMA mode circular or normal.
  551. * @rmtoll CCR CIRC LL_DMA_GetMode
  552. * @param DMAx DMAx Instance
  553. * @param Channel This parameter can be one of the following values:
  554. * @arg @ref LL_DMA_CHANNEL_1
  555. * @arg @ref LL_DMA_CHANNEL_2
  556. * @arg @ref LL_DMA_CHANNEL_3
  557. * @arg @ref LL_DMA_CHANNEL_4
  558. * @arg @ref LL_DMA_CHANNEL_5
  559. * @arg @ref LL_DMA_CHANNEL_6
  560. * @arg @ref LL_DMA_CHANNEL_7
  561. * @retval Returned value can be one of the following values:
  562. * @arg @ref LL_DMA_MODE_NORMAL
  563. * @arg @ref LL_DMA_MODE_CIRCULAR
  564. */
  565. __STATIC_INLINE uint32_t LL_DMA_GetMode(DMA_TypeDef *DMAx, uint32_t Channel)
  566. {
  567. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  568. DMA_CCR_CIRC));
  569. }
  570. /**
  571. * @brief Set Peripheral increment mode.
  572. * @rmtoll CCR PINC LL_DMA_SetPeriphIncMode
  573. * @param DMAx DMAx Instance
  574. * @param Channel This parameter can be one of the following values:
  575. * @arg @ref LL_DMA_CHANNEL_1
  576. * @arg @ref LL_DMA_CHANNEL_2
  577. * @arg @ref LL_DMA_CHANNEL_3
  578. * @arg @ref LL_DMA_CHANNEL_4
  579. * @arg @ref LL_DMA_CHANNEL_5
  580. * @arg @ref LL_DMA_CHANNEL_6
  581. * @arg @ref LL_DMA_CHANNEL_7
  582. * @param PeriphOrM2MSrcIncMode This parameter can be one of the following values:
  583. * @arg @ref LL_DMA_PERIPH_INCREMENT
  584. * @arg @ref LL_DMA_PERIPH_NOINCREMENT
  585. * @retval None
  586. */
  587. __STATIC_INLINE void LL_DMA_SetPeriphIncMode(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t PeriphOrM2MSrcIncMode)
  588. {
  589. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_PINC,
  590. PeriphOrM2MSrcIncMode);
  591. }
  592. /**
  593. * @brief Get Peripheral increment mode.
  594. * @rmtoll CCR PINC LL_DMA_GetPeriphIncMode
  595. * @param DMAx DMAx Instance
  596. * @param Channel This parameter can be one of the following values:
  597. * @arg @ref LL_DMA_CHANNEL_1
  598. * @arg @ref LL_DMA_CHANNEL_2
  599. * @arg @ref LL_DMA_CHANNEL_3
  600. * @arg @ref LL_DMA_CHANNEL_4
  601. * @arg @ref LL_DMA_CHANNEL_5
  602. * @arg @ref LL_DMA_CHANNEL_6
  603. * @arg @ref LL_DMA_CHANNEL_7
  604. * @retval Returned value can be one of the following values:
  605. * @arg @ref LL_DMA_PERIPH_INCREMENT
  606. * @arg @ref LL_DMA_PERIPH_NOINCREMENT
  607. */
  608. __STATIC_INLINE uint32_t LL_DMA_GetPeriphIncMode(DMA_TypeDef *DMAx, uint32_t Channel)
  609. {
  610. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  611. DMA_CCR_PINC));
  612. }
  613. /**
  614. * @brief Set Memory increment mode.
  615. * @rmtoll CCR MINC LL_DMA_SetMemoryIncMode
  616. * @param DMAx DMAx Instance
  617. * @param Channel This parameter can be one of the following values:
  618. * @arg @ref LL_DMA_CHANNEL_1
  619. * @arg @ref LL_DMA_CHANNEL_2
  620. * @arg @ref LL_DMA_CHANNEL_3
  621. * @arg @ref LL_DMA_CHANNEL_4
  622. * @arg @ref LL_DMA_CHANNEL_5
  623. * @arg @ref LL_DMA_CHANNEL_6
  624. * @arg @ref LL_DMA_CHANNEL_7
  625. * @param MemoryOrM2MDstIncMode This parameter can be one of the following values:
  626. * @arg @ref LL_DMA_MEMORY_INCREMENT
  627. * @arg @ref LL_DMA_MEMORY_NOINCREMENT
  628. * @retval None
  629. */
  630. __STATIC_INLINE void LL_DMA_SetMemoryIncMode(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t MemoryOrM2MDstIncMode)
  631. {
  632. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_MINC,
  633. MemoryOrM2MDstIncMode);
  634. }
  635. /**
  636. * @brief Get Memory increment mode.
  637. * @rmtoll CCR MINC LL_DMA_GetMemoryIncMode
  638. * @param DMAx DMAx Instance
  639. * @param Channel This parameter can be one of the following values:
  640. * @arg @ref LL_DMA_CHANNEL_1
  641. * @arg @ref LL_DMA_CHANNEL_2
  642. * @arg @ref LL_DMA_CHANNEL_3
  643. * @arg @ref LL_DMA_CHANNEL_4
  644. * @arg @ref LL_DMA_CHANNEL_5
  645. * @arg @ref LL_DMA_CHANNEL_6
  646. * @arg @ref LL_DMA_CHANNEL_7
  647. * @retval Returned value can be one of the following values:
  648. * @arg @ref LL_DMA_MEMORY_INCREMENT
  649. * @arg @ref LL_DMA_MEMORY_NOINCREMENT
  650. */
  651. __STATIC_INLINE uint32_t LL_DMA_GetMemoryIncMode(DMA_TypeDef *DMAx, uint32_t Channel)
  652. {
  653. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  654. DMA_CCR_MINC));
  655. }
  656. /**
  657. * @brief Set Peripheral size.
  658. * @rmtoll CCR PSIZE LL_DMA_SetPeriphSize
  659. * @param DMAx DMAx Instance
  660. * @param Channel This parameter can be one of the following values:
  661. * @arg @ref LL_DMA_CHANNEL_1
  662. * @arg @ref LL_DMA_CHANNEL_2
  663. * @arg @ref LL_DMA_CHANNEL_3
  664. * @arg @ref LL_DMA_CHANNEL_4
  665. * @arg @ref LL_DMA_CHANNEL_5
  666. * @arg @ref LL_DMA_CHANNEL_6
  667. * @arg @ref LL_DMA_CHANNEL_7
  668. * @param PeriphOrM2MSrcDataSize This parameter can be one of the following values:
  669. * @arg @ref LL_DMA_PDATAALIGN_BYTE
  670. * @arg @ref LL_DMA_PDATAALIGN_HALFWORD
  671. * @arg @ref LL_DMA_PDATAALIGN_WORD
  672. * @retval None
  673. */
  674. __STATIC_INLINE void LL_DMA_SetPeriphSize(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t PeriphOrM2MSrcDataSize)
  675. {
  676. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_PSIZE,
  677. PeriphOrM2MSrcDataSize);
  678. }
  679. /**
  680. * @brief Get Peripheral size.
  681. * @rmtoll CCR PSIZE LL_DMA_GetPeriphSize
  682. * @param DMAx DMAx Instance
  683. * @param Channel This parameter can be one of the following values:
  684. * @arg @ref LL_DMA_CHANNEL_1
  685. * @arg @ref LL_DMA_CHANNEL_2
  686. * @arg @ref LL_DMA_CHANNEL_3
  687. * @arg @ref LL_DMA_CHANNEL_4
  688. * @arg @ref LL_DMA_CHANNEL_5
  689. * @arg @ref LL_DMA_CHANNEL_6
  690. * @arg @ref LL_DMA_CHANNEL_7
  691. * @retval Returned value can be one of the following values:
  692. * @arg @ref LL_DMA_PDATAALIGN_BYTE
  693. * @arg @ref LL_DMA_PDATAALIGN_HALFWORD
  694. * @arg @ref LL_DMA_PDATAALIGN_WORD
  695. */
  696. __STATIC_INLINE uint32_t LL_DMA_GetPeriphSize(DMA_TypeDef *DMAx, uint32_t Channel)
  697. {
  698. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  699. DMA_CCR_PSIZE));
  700. }
  701. /**
  702. * @brief Set Memory size.
  703. * @rmtoll CCR MSIZE LL_DMA_SetMemorySize
  704. * @param DMAx DMAx Instance
  705. * @param Channel This parameter can be one of the following values:
  706. * @arg @ref LL_DMA_CHANNEL_1
  707. * @arg @ref LL_DMA_CHANNEL_2
  708. * @arg @ref LL_DMA_CHANNEL_3
  709. * @arg @ref LL_DMA_CHANNEL_4
  710. * @arg @ref LL_DMA_CHANNEL_5
  711. * @arg @ref LL_DMA_CHANNEL_6
  712. * @arg @ref LL_DMA_CHANNEL_7
  713. * @param MemoryOrM2MDstDataSize This parameter can be one of the following values:
  714. * @arg @ref LL_DMA_MDATAALIGN_BYTE
  715. * @arg @ref LL_DMA_MDATAALIGN_HALFWORD
  716. * @arg @ref LL_DMA_MDATAALIGN_WORD
  717. * @retval None
  718. */
  719. __STATIC_INLINE void LL_DMA_SetMemorySize(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t MemoryOrM2MDstDataSize)
  720. {
  721. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_MSIZE,
  722. MemoryOrM2MDstDataSize);
  723. }
  724. /**
  725. * @brief Get Memory size.
  726. * @rmtoll CCR MSIZE LL_DMA_GetMemorySize
  727. * @param DMAx DMAx Instance
  728. * @param Channel This parameter can be one of the following values:
  729. * @arg @ref LL_DMA_CHANNEL_1
  730. * @arg @ref LL_DMA_CHANNEL_2
  731. * @arg @ref LL_DMA_CHANNEL_3
  732. * @arg @ref LL_DMA_CHANNEL_4
  733. * @arg @ref LL_DMA_CHANNEL_5
  734. * @arg @ref LL_DMA_CHANNEL_6
  735. * @arg @ref LL_DMA_CHANNEL_7
  736. * @retval Returned value can be one of the following values:
  737. * @arg @ref LL_DMA_MDATAALIGN_BYTE
  738. * @arg @ref LL_DMA_MDATAALIGN_HALFWORD
  739. * @arg @ref LL_DMA_MDATAALIGN_WORD
  740. */
  741. __STATIC_INLINE uint32_t LL_DMA_GetMemorySize(DMA_TypeDef *DMAx, uint32_t Channel)
  742. {
  743. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  744. DMA_CCR_MSIZE));
  745. }
  746. /**
  747. * @brief Set Channel priority level.
  748. * @rmtoll CCR PL LL_DMA_SetChannelPriorityLevel
  749. * @param DMAx DMAx Instance
  750. * @param Channel This parameter can be one of the following values:
  751. * @arg @ref LL_DMA_CHANNEL_1
  752. * @arg @ref LL_DMA_CHANNEL_2
  753. * @arg @ref LL_DMA_CHANNEL_3
  754. * @arg @ref LL_DMA_CHANNEL_4
  755. * @arg @ref LL_DMA_CHANNEL_5
  756. * @arg @ref LL_DMA_CHANNEL_6
  757. * @arg @ref LL_DMA_CHANNEL_7
  758. * @param Priority This parameter can be one of the following values:
  759. * @arg @ref LL_DMA_PRIORITY_LOW
  760. * @arg @ref LL_DMA_PRIORITY_MEDIUM
  761. * @arg @ref LL_DMA_PRIORITY_HIGH
  762. * @arg @ref LL_DMA_PRIORITY_VERYHIGH
  763. * @retval None
  764. */
  765. __STATIC_INLINE void LL_DMA_SetChannelPriorityLevel(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t Priority)
  766. {
  767. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_PL,
  768. Priority);
  769. }
  770. /**
  771. * @brief Get Channel priority level.
  772. * @rmtoll CCR PL LL_DMA_GetChannelPriorityLevel
  773. * @param DMAx DMAx Instance
  774. * @param Channel This parameter can be one of the following values:
  775. * @arg @ref LL_DMA_CHANNEL_1
  776. * @arg @ref LL_DMA_CHANNEL_2
  777. * @arg @ref LL_DMA_CHANNEL_3
  778. * @arg @ref LL_DMA_CHANNEL_4
  779. * @arg @ref LL_DMA_CHANNEL_5
  780. * @arg @ref LL_DMA_CHANNEL_6
  781. * @arg @ref LL_DMA_CHANNEL_7
  782. * @retval Returned value can be one of the following values:
  783. * @arg @ref LL_DMA_PRIORITY_LOW
  784. * @arg @ref LL_DMA_PRIORITY_MEDIUM
  785. * @arg @ref LL_DMA_PRIORITY_HIGH
  786. * @arg @ref LL_DMA_PRIORITY_VERYHIGH
  787. */
  788. __STATIC_INLINE uint32_t LL_DMA_GetChannelPriorityLevel(DMA_TypeDef *DMAx, uint32_t Channel)
  789. {
  790. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  791. DMA_CCR_PL));
  792. }
  793. /**
  794. * @brief Set Number of data to transfer.
  795. * @note This action has no effect if
  796. * channel is enabled.
  797. * @rmtoll CNDTR NDT LL_DMA_SetDataLength
  798. * @param DMAx DMAx Instance
  799. * @param Channel This parameter can be one of the following values:
  800. * @arg @ref LL_DMA_CHANNEL_1
  801. * @arg @ref LL_DMA_CHANNEL_2
  802. * @arg @ref LL_DMA_CHANNEL_3
  803. * @arg @ref LL_DMA_CHANNEL_4
  804. * @arg @ref LL_DMA_CHANNEL_5
  805. * @arg @ref LL_DMA_CHANNEL_6
  806. * @arg @ref LL_DMA_CHANNEL_7
  807. * @param NbData Between Min_Data = 0 and Max_Data = 0x0000FFFF
  808. * @retval None
  809. */
  810. __STATIC_INLINE void LL_DMA_SetDataLength(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t NbData)
  811. {
  812. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CNDTR,
  813. DMA_CNDTR_NDT, NbData);
  814. }
  815. /**
  816. * @brief Get Number of data to transfer.
  817. * @note Once the channel is enabled, the return value indicate the
  818. * remaining bytes to be transmitted.
  819. * @rmtoll CNDTR NDT LL_DMA_GetDataLength
  820. * @param DMAx DMAx Instance
  821. * @param Channel This parameter can be one of the following values:
  822. * @arg @ref LL_DMA_CHANNEL_1
  823. * @arg @ref LL_DMA_CHANNEL_2
  824. * @arg @ref LL_DMA_CHANNEL_3
  825. * @arg @ref LL_DMA_CHANNEL_4
  826. * @arg @ref LL_DMA_CHANNEL_5
  827. * @arg @ref LL_DMA_CHANNEL_6
  828. * @arg @ref LL_DMA_CHANNEL_7
  829. * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  830. */
  831. __STATIC_INLINE uint32_t LL_DMA_GetDataLength(DMA_TypeDef *DMAx, uint32_t Channel)
  832. {
  833. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CNDTR,
  834. DMA_CNDTR_NDT));
  835. }
  836. /**
  837. * @brief Configure the Source and Destination addresses.
  838. * @note This API must not be called when the DMA channel is enabled.
  839. * @note Each IP using DMA provides an API to get directly the register address (LL_PPP_DMA_GetRegAddr).
  840. * @rmtoll CPAR PA LL_DMA_ConfigAddresses\n
  841. * CMAR MA LL_DMA_ConfigAddresses
  842. * @param DMAx DMAx Instance
  843. * @param Channel This parameter can be one of the following values:
  844. * @arg @ref LL_DMA_CHANNEL_1
  845. * @arg @ref LL_DMA_CHANNEL_2
  846. * @arg @ref LL_DMA_CHANNEL_3
  847. * @arg @ref LL_DMA_CHANNEL_4
  848. * @arg @ref LL_DMA_CHANNEL_5
  849. * @arg @ref LL_DMA_CHANNEL_6
  850. * @arg @ref LL_DMA_CHANNEL_7
  851. * @param SrcAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  852. * @param DstAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  853. * @param Direction This parameter can be one of the following values:
  854. * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY
  855. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH
  856. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY
  857. * @retval None
  858. */
  859. __STATIC_INLINE void LL_DMA_ConfigAddresses(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t SrcAddress,
  860. uint32_t DstAddress, uint32_t Direction)
  861. {
  862. /* Direction Memory to Periph */
  863. if (Direction == LL_DMA_DIRECTION_MEMORY_TO_PERIPH)
  864. {
  865. WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR, SrcAddress);
  866. WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR, DstAddress);
  867. }
  868. /* Direction Periph to Memory and Memory to Memory */
  869. else
  870. {
  871. WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR, SrcAddress);
  872. WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR, DstAddress);
  873. }
  874. }
  875. /**
  876. * @brief Set the Memory address.
  877. * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only.
  878. * @note This API must not be called when the DMA channel is enabled.
  879. * @rmtoll CMAR MA LL_DMA_SetMemoryAddress
  880. * @param DMAx DMAx Instance
  881. * @param Channel This parameter can be one of the following values:
  882. * @arg @ref LL_DMA_CHANNEL_1
  883. * @arg @ref LL_DMA_CHANNEL_2
  884. * @arg @ref LL_DMA_CHANNEL_3
  885. * @arg @ref LL_DMA_CHANNEL_4
  886. * @arg @ref LL_DMA_CHANNEL_5
  887. * @arg @ref LL_DMA_CHANNEL_6
  888. * @arg @ref LL_DMA_CHANNEL_7
  889. * @param MemoryAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  890. * @retval None
  891. */
  892. __STATIC_INLINE void LL_DMA_SetMemoryAddress(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t MemoryAddress)
  893. {
  894. WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR, MemoryAddress);
  895. }
  896. /**
  897. * @brief Set the Peripheral address.
  898. * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only.
  899. * @note This API must not be called when the DMA channel is enabled.
  900. * @rmtoll CPAR PA LL_DMA_SetPeriphAddress
  901. * @param DMAx DMAx Instance
  902. * @param Channel This parameter can be one of the following values:
  903. * @arg @ref LL_DMA_CHANNEL_1
  904. * @arg @ref LL_DMA_CHANNEL_2
  905. * @arg @ref LL_DMA_CHANNEL_3
  906. * @arg @ref LL_DMA_CHANNEL_4
  907. * @arg @ref LL_DMA_CHANNEL_5
  908. * @arg @ref LL_DMA_CHANNEL_6
  909. * @arg @ref LL_DMA_CHANNEL_7
  910. * @param PeriphAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  911. * @retval None
  912. */
  913. __STATIC_INLINE void LL_DMA_SetPeriphAddress(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t PeriphAddress)
  914. {
  915. WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR, PeriphAddress);
  916. }
  917. /**
  918. * @brief Get Memory address.
  919. * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only.
  920. * @rmtoll CMAR MA LL_DMA_GetMemoryAddress
  921. * @param DMAx DMAx Instance
  922. * @param Channel This parameter can be one of the following values:
  923. * @arg @ref LL_DMA_CHANNEL_1
  924. * @arg @ref LL_DMA_CHANNEL_2
  925. * @arg @ref LL_DMA_CHANNEL_3
  926. * @arg @ref LL_DMA_CHANNEL_4
  927. * @arg @ref LL_DMA_CHANNEL_5
  928. * @arg @ref LL_DMA_CHANNEL_6
  929. * @arg @ref LL_DMA_CHANNEL_7
  930. * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  931. */
  932. __STATIC_INLINE uint32_t LL_DMA_GetMemoryAddress(DMA_TypeDef *DMAx, uint32_t Channel)
  933. {
  934. return (READ_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR));
  935. }
  936. /**
  937. * @brief Get Peripheral address.
  938. * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only.
  939. * @rmtoll CPAR PA LL_DMA_GetPeriphAddress
  940. * @param DMAx DMAx Instance
  941. * @param Channel This parameter can be one of the following values:
  942. * @arg @ref LL_DMA_CHANNEL_1
  943. * @arg @ref LL_DMA_CHANNEL_2
  944. * @arg @ref LL_DMA_CHANNEL_3
  945. * @arg @ref LL_DMA_CHANNEL_4
  946. * @arg @ref LL_DMA_CHANNEL_5
  947. * @arg @ref LL_DMA_CHANNEL_6
  948. * @arg @ref LL_DMA_CHANNEL_7
  949. * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  950. */
  951. __STATIC_INLINE uint32_t LL_DMA_GetPeriphAddress(DMA_TypeDef *DMAx, uint32_t Channel)
  952. {
  953. return (READ_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR));
  954. }
  955. /**
  956. * @brief Set the Memory to Memory Source address.
  957. * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only.
  958. * @note This API must not be called when the DMA channel is enabled.
  959. * @rmtoll CPAR PA LL_DMA_SetM2MSrcAddress
  960. * @param DMAx DMAx Instance
  961. * @param Channel This parameter can be one of the following values:
  962. * @arg @ref LL_DMA_CHANNEL_1
  963. * @arg @ref LL_DMA_CHANNEL_2
  964. * @arg @ref LL_DMA_CHANNEL_3
  965. * @arg @ref LL_DMA_CHANNEL_4
  966. * @arg @ref LL_DMA_CHANNEL_5
  967. * @arg @ref LL_DMA_CHANNEL_6
  968. * @arg @ref LL_DMA_CHANNEL_7
  969. * @param MemoryAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  970. * @retval None
  971. */
  972. __STATIC_INLINE void LL_DMA_SetM2MSrcAddress(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t MemoryAddress)
  973. {
  974. WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR, MemoryAddress);
  975. }
  976. /**
  977. * @brief Set the Memory to Memory Destination address.
  978. * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only.
  979. * @note This API must not be called when the DMA channel is enabled.
  980. * @rmtoll CMAR MA LL_DMA_SetM2MDstAddress
  981. * @param DMAx DMAx Instance
  982. * @param Channel This parameter can be one of the following values:
  983. * @arg @ref LL_DMA_CHANNEL_1
  984. * @arg @ref LL_DMA_CHANNEL_2
  985. * @arg @ref LL_DMA_CHANNEL_3
  986. * @arg @ref LL_DMA_CHANNEL_4
  987. * @arg @ref LL_DMA_CHANNEL_5
  988. * @arg @ref LL_DMA_CHANNEL_6
  989. * @arg @ref LL_DMA_CHANNEL_7
  990. * @param MemoryAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  991. * @retval None
  992. */
  993. __STATIC_INLINE void LL_DMA_SetM2MDstAddress(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t MemoryAddress)
  994. {
  995. WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR, MemoryAddress);
  996. }
  997. /**
  998. * @brief Get the Memory to Memory Source address.
  999. * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only.
  1000. * @rmtoll CPAR PA LL_DMA_GetM2MSrcAddress
  1001. * @param DMAx DMAx Instance
  1002. * @param Channel This parameter can be one of the following values:
  1003. * @arg @ref LL_DMA_CHANNEL_1
  1004. * @arg @ref LL_DMA_CHANNEL_2
  1005. * @arg @ref LL_DMA_CHANNEL_3
  1006. * @arg @ref LL_DMA_CHANNEL_4
  1007. * @arg @ref LL_DMA_CHANNEL_5
  1008. * @arg @ref LL_DMA_CHANNEL_6
  1009. * @arg @ref LL_DMA_CHANNEL_7
  1010. * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  1011. */
  1012. __STATIC_INLINE uint32_t LL_DMA_GetM2MSrcAddress(DMA_TypeDef *DMAx, uint32_t Channel)
  1013. {
  1014. return (READ_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR));
  1015. }
  1016. /**
  1017. * @brief Get the Memory to Memory Destination address.
  1018. * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only.
  1019. * @rmtoll CMAR MA LL_DMA_GetM2MDstAddress
  1020. * @param DMAx DMAx Instance
  1021. * @param Channel This parameter can be one of the following values:
  1022. * @arg @ref LL_DMA_CHANNEL_1
  1023. * @arg @ref LL_DMA_CHANNEL_2
  1024. * @arg @ref LL_DMA_CHANNEL_3
  1025. * @arg @ref LL_DMA_CHANNEL_4
  1026. * @arg @ref LL_DMA_CHANNEL_5
  1027. * @arg @ref LL_DMA_CHANNEL_6
  1028. * @arg @ref LL_DMA_CHANNEL_7
  1029. * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  1030. */
  1031. __STATIC_INLINE uint32_t LL_DMA_GetM2MDstAddress(DMA_TypeDef *DMAx, uint32_t Channel)
  1032. {
  1033. return (READ_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR));
  1034. }
  1035. /**
  1036. * @}
  1037. */
  1038. /** @defgroup DMA_LL_EF_FLAG_Management FLAG_Management
  1039. * @{
  1040. */
  1041. /**
  1042. * @brief Get Channel 1 global interrupt flag.
  1043. * @rmtoll ISR GIF1 LL_DMA_IsActiveFlag_GI1
  1044. * @param DMAx DMAx Instance
  1045. * @retval State of bit (1 or 0).
  1046. */
  1047. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI1(DMA_TypeDef *DMAx)
  1048. {
  1049. return (READ_BIT(DMAx->ISR, DMA_ISR_GIF1) == (DMA_ISR_GIF1));
  1050. }
  1051. /**
  1052. * @brief Get Channel 2 global interrupt flag.
  1053. * @rmtoll ISR GIF2 LL_DMA_IsActiveFlag_GI2
  1054. * @param DMAx DMAx Instance
  1055. * @retval State of bit (1 or 0).
  1056. */
  1057. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI2(DMA_TypeDef *DMAx)
  1058. {
  1059. return (READ_BIT(DMAx->ISR, DMA_ISR_GIF2) == (DMA_ISR_GIF2));
  1060. }
  1061. /**
  1062. * @brief Get Channel 3 global interrupt flag.
  1063. * @rmtoll ISR GIF3 LL_DMA_IsActiveFlag_GI3
  1064. * @param DMAx DMAx Instance
  1065. * @retval State of bit (1 or 0).
  1066. */
  1067. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI3(DMA_TypeDef *DMAx)
  1068. {
  1069. return (READ_BIT(DMAx->ISR, DMA_ISR_GIF3) == (DMA_ISR_GIF3));
  1070. }
  1071. /**
  1072. * @brief Get Channel 4 global interrupt flag.
  1073. * @rmtoll ISR GIF4 LL_DMA_IsActiveFlag_GI4
  1074. * @param DMAx DMAx Instance
  1075. * @retval State of bit (1 or 0).
  1076. */
  1077. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI4(DMA_TypeDef *DMAx)
  1078. {
  1079. return (READ_BIT(DMAx->ISR, DMA_ISR_GIF4) == (DMA_ISR_GIF4));
  1080. }
  1081. /**
  1082. * @brief Get Channel 5 global interrupt flag.
  1083. * @rmtoll ISR GIF5 LL_DMA_IsActiveFlag_GI5
  1084. * @param DMAx DMAx Instance
  1085. * @retval State of bit (1 or 0).
  1086. */
  1087. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI5(DMA_TypeDef *DMAx)
  1088. {
  1089. return (READ_BIT(DMAx->ISR, DMA_ISR_GIF5) == (DMA_ISR_GIF5));
  1090. }
  1091. /**
  1092. * @brief Get Channel 6 global interrupt flag.
  1093. * @rmtoll ISR GIF6 LL_DMA_IsActiveFlag_GI6
  1094. * @param DMAx DMAx Instance
  1095. * @retval State of bit (1 or 0).
  1096. */
  1097. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI6(DMA_TypeDef *DMAx)
  1098. {
  1099. return (READ_BIT(DMAx->ISR, DMA_ISR_GIF6) == (DMA_ISR_GIF6));
  1100. }
  1101. /**
  1102. * @brief Get Channel 7 global interrupt flag.
  1103. * @rmtoll ISR GIF7 LL_DMA_IsActiveFlag_GI7
  1104. * @param DMAx DMAx Instance
  1105. * @retval State of bit (1 or 0).
  1106. */
  1107. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI7(DMA_TypeDef *DMAx)
  1108. {
  1109. return (READ_BIT(DMAx->ISR, DMA_ISR_GIF7) == (DMA_ISR_GIF7));
  1110. }
  1111. /**
  1112. * @brief Get Channel 1 transfer complete flag.
  1113. * @rmtoll ISR TCIF1 LL_DMA_IsActiveFlag_TC1
  1114. * @param DMAx DMAx Instance
  1115. * @retval State of bit (1 or 0).
  1116. */
  1117. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC1(DMA_TypeDef *DMAx)
  1118. {
  1119. return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF1) == (DMA_ISR_TCIF1));
  1120. }
  1121. /**
  1122. * @brief Get Channel 2 transfer complete flag.
  1123. * @rmtoll ISR TCIF2 LL_DMA_IsActiveFlag_TC2
  1124. * @param DMAx DMAx Instance
  1125. * @retval State of bit (1 or 0).
  1126. */
  1127. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC2(DMA_TypeDef *DMAx)
  1128. {
  1129. return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF2) == (DMA_ISR_TCIF2));
  1130. }
  1131. /**
  1132. * @brief Get Channel 3 transfer complete flag.
  1133. * @rmtoll ISR TCIF3 LL_DMA_IsActiveFlag_TC3
  1134. * @param DMAx DMAx Instance
  1135. * @retval State of bit (1 or 0).
  1136. */
  1137. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC3(DMA_TypeDef *DMAx)
  1138. {
  1139. return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF3) == (DMA_ISR_TCIF3));
  1140. }
  1141. /**
  1142. * @brief Get Channel 4 transfer complete flag.
  1143. * @rmtoll ISR TCIF4 LL_DMA_IsActiveFlag_TC4
  1144. * @param DMAx DMAx Instance
  1145. * @retval State of bit (1 or 0).
  1146. */
  1147. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC4(DMA_TypeDef *DMAx)
  1148. {
  1149. return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF4) == (DMA_ISR_TCIF4));
  1150. }
  1151. /**
  1152. * @brief Get Channel 5 transfer complete flag.
  1153. * @rmtoll ISR TCIF5 LL_DMA_IsActiveFlag_TC5
  1154. * @param DMAx DMAx Instance
  1155. * @retval State of bit (1 or 0).
  1156. */
  1157. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC5(DMA_TypeDef *DMAx)
  1158. {
  1159. return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF5) == (DMA_ISR_TCIF5));
  1160. }
  1161. /**
  1162. * @brief Get Channel 6 transfer complete flag.
  1163. * @rmtoll ISR TCIF6 LL_DMA_IsActiveFlag_TC6
  1164. * @param DMAx DMAx Instance
  1165. * @retval State of bit (1 or 0).
  1166. */
  1167. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC6(DMA_TypeDef *DMAx)
  1168. {
  1169. return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF6) == (DMA_ISR_TCIF6));
  1170. }
  1171. /**
  1172. * @brief Get Channel 7 transfer complete flag.
  1173. * @rmtoll ISR TCIF7 LL_DMA_IsActiveFlag_TC7
  1174. * @param DMAx DMAx Instance
  1175. * @retval State of bit (1 or 0).
  1176. */
  1177. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC7(DMA_TypeDef *DMAx)
  1178. {
  1179. return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF7) == (DMA_ISR_TCIF7));
  1180. }
  1181. /**
  1182. * @brief Get Channel 1 half transfer flag.
  1183. * @rmtoll ISR HTIF1 LL_DMA_IsActiveFlag_HT1
  1184. * @param DMAx DMAx Instance
  1185. * @retval State of bit (1 or 0).
  1186. */
  1187. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT1(DMA_TypeDef *DMAx)
  1188. {
  1189. return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF1) == (DMA_ISR_HTIF1));
  1190. }
  1191. /**
  1192. * @brief Get Channel 2 half transfer flag.
  1193. * @rmtoll ISR HTIF2 LL_DMA_IsActiveFlag_HT2
  1194. * @param DMAx DMAx Instance
  1195. * @retval State of bit (1 or 0).
  1196. */
  1197. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT2(DMA_TypeDef *DMAx)
  1198. {
  1199. return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF2) == (DMA_ISR_HTIF2));
  1200. }
  1201. /**
  1202. * @brief Get Channel 3 half transfer flag.
  1203. * @rmtoll ISR HTIF3 LL_DMA_IsActiveFlag_HT3
  1204. * @param DMAx DMAx Instance
  1205. * @retval State of bit (1 or 0).
  1206. */
  1207. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT3(DMA_TypeDef *DMAx)
  1208. {
  1209. return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF3) == (DMA_ISR_HTIF3));
  1210. }
  1211. /**
  1212. * @brief Get Channel 4 half transfer flag.
  1213. * @rmtoll ISR HTIF4 LL_DMA_IsActiveFlag_HT4
  1214. * @param DMAx DMAx Instance
  1215. * @retval State of bit (1 or 0).
  1216. */
  1217. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT4(DMA_TypeDef *DMAx)
  1218. {
  1219. return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF4) == (DMA_ISR_HTIF4));
  1220. }
  1221. /**
  1222. * @brief Get Channel 5 half transfer flag.
  1223. * @rmtoll ISR HTIF5 LL_DMA_IsActiveFlag_HT5
  1224. * @param DMAx DMAx Instance
  1225. * @retval State of bit (1 or 0).
  1226. */
  1227. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT5(DMA_TypeDef *DMAx)
  1228. {
  1229. return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF5) == (DMA_ISR_HTIF5));
  1230. }
  1231. /**
  1232. * @brief Get Channel 6 half transfer flag.
  1233. * @rmtoll ISR HTIF6 LL_DMA_IsActiveFlag_HT6
  1234. * @param DMAx DMAx Instance
  1235. * @retval State of bit (1 or 0).
  1236. */
  1237. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT6(DMA_TypeDef *DMAx)
  1238. {
  1239. return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF6) == (DMA_ISR_HTIF6));
  1240. }
  1241. /**
  1242. * @brief Get Channel 7 half transfer flag.
  1243. * @rmtoll ISR HTIF7 LL_DMA_IsActiveFlag_HT7
  1244. * @param DMAx DMAx Instance
  1245. * @retval State of bit (1 or 0).
  1246. */
  1247. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT7(DMA_TypeDef *DMAx)
  1248. {
  1249. return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF7) == (DMA_ISR_HTIF7));
  1250. }
  1251. /**
  1252. * @brief Get Channel 1 transfer error flag.
  1253. * @rmtoll ISR TEIF1 LL_DMA_IsActiveFlag_TE1
  1254. * @param DMAx DMAx Instance
  1255. * @retval State of bit (1 or 0).
  1256. */
  1257. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE1(DMA_TypeDef *DMAx)
  1258. {
  1259. return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF1) == (DMA_ISR_TEIF1));
  1260. }
  1261. /**
  1262. * @brief Get Channel 2 transfer error flag.
  1263. * @rmtoll ISR TEIF2 LL_DMA_IsActiveFlag_TE2
  1264. * @param DMAx DMAx Instance
  1265. * @retval State of bit (1 or 0).
  1266. */
  1267. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE2(DMA_TypeDef *DMAx)
  1268. {
  1269. return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF2) == (DMA_ISR_TEIF2));
  1270. }
  1271. /**
  1272. * @brief Get Channel 3 transfer error flag.
  1273. * @rmtoll ISR TEIF3 LL_DMA_IsActiveFlag_TE3
  1274. * @param DMAx DMAx Instance
  1275. * @retval State of bit (1 or 0).
  1276. */
  1277. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE3(DMA_TypeDef *DMAx)
  1278. {
  1279. return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF3) == (DMA_ISR_TEIF3));
  1280. }
  1281. /**
  1282. * @brief Get Channel 4 transfer error flag.
  1283. * @rmtoll ISR TEIF4 LL_DMA_IsActiveFlag_TE4
  1284. * @param DMAx DMAx Instance
  1285. * @retval State of bit (1 or 0).
  1286. */
  1287. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE4(DMA_TypeDef *DMAx)
  1288. {
  1289. return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF4) == (DMA_ISR_TEIF4));
  1290. }
  1291. /**
  1292. * @brief Get Channel 5 transfer error flag.
  1293. * @rmtoll ISR TEIF5 LL_DMA_IsActiveFlag_TE5
  1294. * @param DMAx DMAx Instance
  1295. * @retval State of bit (1 or 0).
  1296. */
  1297. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE5(DMA_TypeDef *DMAx)
  1298. {
  1299. return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF5) == (DMA_ISR_TEIF5));
  1300. }
  1301. /**
  1302. * @brief Get Channel 6 transfer error flag.
  1303. * @rmtoll ISR TEIF6 LL_DMA_IsActiveFlag_TE6
  1304. * @param DMAx DMAx Instance
  1305. * @retval State of bit (1 or 0).
  1306. */
  1307. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE6(DMA_TypeDef *DMAx)
  1308. {
  1309. return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF6) == (DMA_ISR_TEIF6));
  1310. }
  1311. /**
  1312. * @brief Get Channel 7 transfer error flag.
  1313. * @rmtoll ISR TEIF7 LL_DMA_IsActiveFlag_TE7
  1314. * @param DMAx DMAx Instance
  1315. * @retval State of bit (1 or 0).
  1316. */
  1317. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE7(DMA_TypeDef *DMAx)
  1318. {
  1319. return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF7) == (DMA_ISR_TEIF7));
  1320. }
  1321. /**
  1322. * @brief Clear Channel 1 global interrupt flag.
  1323. * @rmtoll IFCR CGIF1 LL_DMA_ClearFlag_GI1
  1324. * @param DMAx DMAx Instance
  1325. * @retval None
  1326. */
  1327. __STATIC_INLINE void LL_DMA_ClearFlag_GI1(DMA_TypeDef *DMAx)
  1328. {
  1329. WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF1);
  1330. }
  1331. /**
  1332. * @brief Clear Channel 2 global interrupt flag.
  1333. * @rmtoll IFCR CGIF2 LL_DMA_ClearFlag_GI2
  1334. * @param DMAx DMAx Instance
  1335. * @retval None
  1336. */
  1337. __STATIC_INLINE void LL_DMA_ClearFlag_GI2(DMA_TypeDef *DMAx)
  1338. {
  1339. WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF2);
  1340. }
  1341. /**
  1342. * @brief Clear Channel 3 global interrupt flag.
  1343. * @rmtoll IFCR CGIF3 LL_DMA_ClearFlag_GI3
  1344. * @param DMAx DMAx Instance
  1345. * @retval None
  1346. */
  1347. __STATIC_INLINE void LL_DMA_ClearFlag_GI3(DMA_TypeDef *DMAx)
  1348. {
  1349. WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF3);
  1350. }
  1351. /**
  1352. * @brief Clear Channel 4 global interrupt flag.
  1353. * @rmtoll IFCR CGIF4 LL_DMA_ClearFlag_GI4
  1354. * @param DMAx DMAx Instance
  1355. * @retval None
  1356. */
  1357. __STATIC_INLINE void LL_DMA_ClearFlag_GI4(DMA_TypeDef *DMAx)
  1358. {
  1359. WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF4);
  1360. }
  1361. /**
  1362. * @brief Clear Channel 5 global interrupt flag.
  1363. * @rmtoll IFCR CGIF5 LL_DMA_ClearFlag_GI5
  1364. * @param DMAx DMAx Instance
  1365. * @retval None
  1366. */
  1367. __STATIC_INLINE void LL_DMA_ClearFlag_GI5(DMA_TypeDef *DMAx)
  1368. {
  1369. WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF5);
  1370. }
  1371. /**
  1372. * @brief Clear Channel 6 global interrupt flag.
  1373. * @rmtoll IFCR CGIF6 LL_DMA_ClearFlag_GI6
  1374. * @param DMAx DMAx Instance
  1375. * @retval None
  1376. */
  1377. __STATIC_INLINE void LL_DMA_ClearFlag_GI6(DMA_TypeDef *DMAx)
  1378. {
  1379. WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF6);
  1380. }
  1381. /**
  1382. * @brief Clear Channel 7 global interrupt flag.
  1383. * @rmtoll IFCR CGIF7 LL_DMA_ClearFlag_GI7
  1384. * @param DMAx DMAx Instance
  1385. * @retval None
  1386. */
  1387. __STATIC_INLINE void LL_DMA_ClearFlag_GI7(DMA_TypeDef *DMAx)
  1388. {
  1389. WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF7);
  1390. }
  1391. /**
  1392. * @brief Clear Channel 1 transfer complete flag.
  1393. * @rmtoll IFCR CTCIF1 LL_DMA_ClearFlag_TC1
  1394. * @param DMAx DMAx Instance
  1395. * @retval None
  1396. */
  1397. __STATIC_INLINE void LL_DMA_ClearFlag_TC1(DMA_TypeDef *DMAx)
  1398. {
  1399. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF1);
  1400. }
  1401. /**
  1402. * @brief Clear Channel 2 transfer complete flag.
  1403. * @rmtoll IFCR CTCIF2 LL_DMA_ClearFlag_TC2
  1404. * @param DMAx DMAx Instance
  1405. * @retval None
  1406. */
  1407. __STATIC_INLINE void LL_DMA_ClearFlag_TC2(DMA_TypeDef *DMAx)
  1408. {
  1409. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF2);
  1410. }
  1411. /**
  1412. * @brief Clear Channel 3 transfer complete flag.
  1413. * @rmtoll IFCR CTCIF3 LL_DMA_ClearFlag_TC3
  1414. * @param DMAx DMAx Instance
  1415. * @retval None
  1416. */
  1417. __STATIC_INLINE void LL_DMA_ClearFlag_TC3(DMA_TypeDef *DMAx)
  1418. {
  1419. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF3);
  1420. }
  1421. /**
  1422. * @brief Clear Channel 4 transfer complete flag.
  1423. * @rmtoll IFCR CTCIF4 LL_DMA_ClearFlag_TC4
  1424. * @param DMAx DMAx Instance
  1425. * @retval None
  1426. */
  1427. __STATIC_INLINE void LL_DMA_ClearFlag_TC4(DMA_TypeDef *DMAx)
  1428. {
  1429. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF4);
  1430. }
  1431. /**
  1432. * @brief Clear Channel 5 transfer complete flag.
  1433. * @rmtoll IFCR CTCIF5 LL_DMA_ClearFlag_TC5
  1434. * @param DMAx DMAx Instance
  1435. * @retval None
  1436. */
  1437. __STATIC_INLINE void LL_DMA_ClearFlag_TC5(DMA_TypeDef *DMAx)
  1438. {
  1439. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF5);
  1440. }
  1441. /**
  1442. * @brief Clear Channel 6 transfer complete flag.
  1443. * @rmtoll IFCR CTCIF6 LL_DMA_ClearFlag_TC6
  1444. * @param DMAx DMAx Instance
  1445. * @retval None
  1446. */
  1447. __STATIC_INLINE void LL_DMA_ClearFlag_TC6(DMA_TypeDef *DMAx)
  1448. {
  1449. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF6);
  1450. }
  1451. /**
  1452. * @brief Clear Channel 7 transfer complete flag.
  1453. * @rmtoll IFCR CTCIF7 LL_DMA_ClearFlag_TC7
  1454. * @param DMAx DMAx Instance
  1455. * @retval None
  1456. */
  1457. __STATIC_INLINE void LL_DMA_ClearFlag_TC7(DMA_TypeDef *DMAx)
  1458. {
  1459. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF7);
  1460. }
  1461. /**
  1462. * @brief Clear Channel 1 half transfer flag.
  1463. * @rmtoll IFCR CHTIF1 LL_DMA_ClearFlag_HT1
  1464. * @param DMAx DMAx Instance
  1465. * @retval None
  1466. */
  1467. __STATIC_INLINE void LL_DMA_ClearFlag_HT1(DMA_TypeDef *DMAx)
  1468. {
  1469. WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF1);
  1470. }
  1471. /**
  1472. * @brief Clear Channel 2 half transfer flag.
  1473. * @rmtoll IFCR CHTIF2 LL_DMA_ClearFlag_HT2
  1474. * @param DMAx DMAx Instance
  1475. * @retval None
  1476. */
  1477. __STATIC_INLINE void LL_DMA_ClearFlag_HT2(DMA_TypeDef *DMAx)
  1478. {
  1479. WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF2);
  1480. }
  1481. /**
  1482. * @brief Clear Channel 3 half transfer flag.
  1483. * @rmtoll IFCR CHTIF3 LL_DMA_ClearFlag_HT3
  1484. * @param DMAx DMAx Instance
  1485. * @retval None
  1486. */
  1487. __STATIC_INLINE void LL_DMA_ClearFlag_HT3(DMA_TypeDef *DMAx)
  1488. {
  1489. WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF3);
  1490. }
  1491. /**
  1492. * @brief Clear Channel 4 half transfer flag.
  1493. * @rmtoll IFCR CHTIF4 LL_DMA_ClearFlag_HT4
  1494. * @param DMAx DMAx Instance
  1495. * @retval None
  1496. */
  1497. __STATIC_INLINE void LL_DMA_ClearFlag_HT4(DMA_TypeDef *DMAx)
  1498. {
  1499. WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF4);
  1500. }
  1501. /**
  1502. * @brief Clear Channel 5 half transfer flag.
  1503. * @rmtoll IFCR CHTIF5 LL_DMA_ClearFlag_HT5
  1504. * @param DMAx DMAx Instance
  1505. * @retval None
  1506. */
  1507. __STATIC_INLINE void LL_DMA_ClearFlag_HT5(DMA_TypeDef *DMAx)
  1508. {
  1509. WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF5);
  1510. }
  1511. /**
  1512. * @brief Clear Channel 6 half transfer flag.
  1513. * @rmtoll IFCR CHTIF6 LL_DMA_ClearFlag_HT6
  1514. * @param DMAx DMAx Instance
  1515. * @retval None
  1516. */
  1517. __STATIC_INLINE void LL_DMA_ClearFlag_HT6(DMA_TypeDef *DMAx)
  1518. {
  1519. WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF6);
  1520. }
  1521. /**
  1522. * @brief Clear Channel 7 half transfer flag.
  1523. * @rmtoll IFCR CHTIF7 LL_DMA_ClearFlag_HT7
  1524. * @param DMAx DMAx Instance
  1525. * @retval None
  1526. */
  1527. __STATIC_INLINE void LL_DMA_ClearFlag_HT7(DMA_TypeDef *DMAx)
  1528. {
  1529. WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF7);
  1530. }
  1531. /**
  1532. * @brief Clear Channel 1 transfer error flag.
  1533. * @rmtoll IFCR CTEIF1 LL_DMA_ClearFlag_TE1
  1534. * @param DMAx DMAx Instance
  1535. * @retval None
  1536. */
  1537. __STATIC_INLINE void LL_DMA_ClearFlag_TE1(DMA_TypeDef *DMAx)
  1538. {
  1539. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF1);
  1540. }
  1541. /**
  1542. * @brief Clear Channel 2 transfer error flag.
  1543. * @rmtoll IFCR CTEIF2 LL_DMA_ClearFlag_TE2
  1544. * @param DMAx DMAx Instance
  1545. * @retval None
  1546. */
  1547. __STATIC_INLINE void LL_DMA_ClearFlag_TE2(DMA_TypeDef *DMAx)
  1548. {
  1549. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF2);
  1550. }
  1551. /**
  1552. * @brief Clear Channel 3 transfer error flag.
  1553. * @rmtoll IFCR CTEIF3 LL_DMA_ClearFlag_TE3
  1554. * @param DMAx DMAx Instance
  1555. * @retval None
  1556. */
  1557. __STATIC_INLINE void LL_DMA_ClearFlag_TE3(DMA_TypeDef *DMAx)
  1558. {
  1559. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF3);
  1560. }
  1561. /**
  1562. * @brief Clear Channel 4 transfer error flag.
  1563. * @rmtoll IFCR CTEIF4 LL_DMA_ClearFlag_TE4
  1564. * @param DMAx DMAx Instance
  1565. * @retval None
  1566. */
  1567. __STATIC_INLINE void LL_DMA_ClearFlag_TE4(DMA_TypeDef *DMAx)
  1568. {
  1569. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF4);
  1570. }
  1571. /**
  1572. * @brief Clear Channel 5 transfer error flag.
  1573. * @rmtoll IFCR CTEIF5 LL_DMA_ClearFlag_TE5
  1574. * @param DMAx DMAx Instance
  1575. * @retval None
  1576. */
  1577. __STATIC_INLINE void LL_DMA_ClearFlag_TE5(DMA_TypeDef *DMAx)
  1578. {
  1579. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF5);
  1580. }
  1581. /**
  1582. * @brief Clear Channel 6 transfer error flag.
  1583. * @rmtoll IFCR CTEIF6 LL_DMA_ClearFlag_TE6
  1584. * @param DMAx DMAx Instance
  1585. * @retval None
  1586. */
  1587. __STATIC_INLINE void LL_DMA_ClearFlag_TE6(DMA_TypeDef *DMAx)
  1588. {
  1589. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF6);
  1590. }
  1591. /**
  1592. * @brief Clear Channel 7 transfer error flag.
  1593. * @rmtoll IFCR CTEIF7 LL_DMA_ClearFlag_TE7
  1594. * @param DMAx DMAx Instance
  1595. * @retval None
  1596. */
  1597. __STATIC_INLINE void LL_DMA_ClearFlag_TE7(DMA_TypeDef *DMAx)
  1598. {
  1599. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF7);
  1600. }
  1601. /**
  1602. * @}
  1603. */
  1604. /** @defgroup DMA_LL_EF_IT_Management IT_Management
  1605. * @{
  1606. */
  1607. /**
  1608. * @brief Enable Transfer complete interrupt.
  1609. * @rmtoll CCR TCIE LL_DMA_EnableIT_TC
  1610. * @param DMAx DMAx Instance
  1611. * @param Channel This parameter can be one of the following values:
  1612. * @arg @ref LL_DMA_CHANNEL_1
  1613. * @arg @ref LL_DMA_CHANNEL_2
  1614. * @arg @ref LL_DMA_CHANNEL_3
  1615. * @arg @ref LL_DMA_CHANNEL_4
  1616. * @arg @ref LL_DMA_CHANNEL_5
  1617. * @arg @ref LL_DMA_CHANNEL_6
  1618. * @arg @ref LL_DMA_CHANNEL_7
  1619. * @retval None
  1620. */
  1621. __STATIC_INLINE void LL_DMA_EnableIT_TC(DMA_TypeDef *DMAx, uint32_t Channel)
  1622. {
  1623. SET_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_TCIE);
  1624. }
  1625. /**
  1626. * @brief Enable Half transfer interrupt.
  1627. * @rmtoll CCR HTIE LL_DMA_EnableIT_HT
  1628. * @param DMAx DMAx Instance
  1629. * @param Channel This parameter can be one of the following values:
  1630. * @arg @ref LL_DMA_CHANNEL_1
  1631. * @arg @ref LL_DMA_CHANNEL_2
  1632. * @arg @ref LL_DMA_CHANNEL_3
  1633. * @arg @ref LL_DMA_CHANNEL_4
  1634. * @arg @ref LL_DMA_CHANNEL_5
  1635. * @arg @ref LL_DMA_CHANNEL_6
  1636. * @arg @ref LL_DMA_CHANNEL_7
  1637. * @retval None
  1638. */
  1639. __STATIC_INLINE void LL_DMA_EnableIT_HT(DMA_TypeDef *DMAx, uint32_t Channel)
  1640. {
  1641. SET_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_HTIE);
  1642. }
  1643. /**
  1644. * @brief Enable Transfer error interrupt.
  1645. * @rmtoll CCR TEIE LL_DMA_EnableIT_TE
  1646. * @param DMAx DMAx Instance
  1647. * @param Channel This parameter can be one of the following values:
  1648. * @arg @ref LL_DMA_CHANNEL_1
  1649. * @arg @ref LL_DMA_CHANNEL_2
  1650. * @arg @ref LL_DMA_CHANNEL_3
  1651. * @arg @ref LL_DMA_CHANNEL_4
  1652. * @arg @ref LL_DMA_CHANNEL_5
  1653. * @arg @ref LL_DMA_CHANNEL_6
  1654. * @arg @ref LL_DMA_CHANNEL_7
  1655. * @retval None
  1656. */
  1657. __STATIC_INLINE void LL_DMA_EnableIT_TE(DMA_TypeDef *DMAx, uint32_t Channel)
  1658. {
  1659. SET_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_TEIE);
  1660. }
  1661. /**
  1662. * @brief Disable Transfer complete interrupt.
  1663. * @rmtoll CCR TCIE LL_DMA_DisableIT_TC
  1664. * @param DMAx DMAx Instance
  1665. * @param Channel This parameter can be one of the following values:
  1666. * @arg @ref LL_DMA_CHANNEL_1
  1667. * @arg @ref LL_DMA_CHANNEL_2
  1668. * @arg @ref LL_DMA_CHANNEL_3
  1669. * @arg @ref LL_DMA_CHANNEL_4
  1670. * @arg @ref LL_DMA_CHANNEL_5
  1671. * @arg @ref LL_DMA_CHANNEL_6
  1672. * @arg @ref LL_DMA_CHANNEL_7
  1673. * @retval None
  1674. */
  1675. __STATIC_INLINE void LL_DMA_DisableIT_TC(DMA_TypeDef *DMAx, uint32_t Channel)
  1676. {
  1677. CLEAR_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_TCIE);
  1678. }
  1679. /**
  1680. * @brief Disable Half transfer interrupt.
  1681. * @rmtoll CCR HTIE LL_DMA_DisableIT_HT
  1682. * @param DMAx DMAx Instance
  1683. * @param Channel This parameter can be one of the following values:
  1684. * @arg @ref LL_DMA_CHANNEL_1
  1685. * @arg @ref LL_DMA_CHANNEL_2
  1686. * @arg @ref LL_DMA_CHANNEL_3
  1687. * @arg @ref LL_DMA_CHANNEL_4
  1688. * @arg @ref LL_DMA_CHANNEL_5
  1689. * @arg @ref LL_DMA_CHANNEL_6
  1690. * @arg @ref LL_DMA_CHANNEL_7
  1691. * @retval None
  1692. */
  1693. __STATIC_INLINE void LL_DMA_DisableIT_HT(DMA_TypeDef *DMAx, uint32_t Channel)
  1694. {
  1695. CLEAR_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_HTIE);
  1696. }
  1697. /**
  1698. * @brief Disable Transfer error interrupt.
  1699. * @rmtoll CCR TEIE LL_DMA_DisableIT_TE
  1700. * @param DMAx DMAx Instance
  1701. * @param Channel This parameter can be one of the following values:
  1702. * @arg @ref LL_DMA_CHANNEL_1
  1703. * @arg @ref LL_DMA_CHANNEL_2
  1704. * @arg @ref LL_DMA_CHANNEL_3
  1705. * @arg @ref LL_DMA_CHANNEL_4
  1706. * @arg @ref LL_DMA_CHANNEL_5
  1707. * @arg @ref LL_DMA_CHANNEL_6
  1708. * @arg @ref LL_DMA_CHANNEL_7
  1709. * @retval None
  1710. */
  1711. __STATIC_INLINE void LL_DMA_DisableIT_TE(DMA_TypeDef *DMAx, uint32_t Channel)
  1712. {
  1713. CLEAR_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_TEIE);
  1714. }
  1715. /**
  1716. * @brief Check if Transfer complete Interrupt is enabled.
  1717. * @rmtoll CCR TCIE LL_DMA_IsEnabledIT_TC
  1718. * @param DMAx DMAx Instance
  1719. * @param Channel This parameter can be one of the following values:
  1720. * @arg @ref LL_DMA_CHANNEL_1
  1721. * @arg @ref LL_DMA_CHANNEL_2
  1722. * @arg @ref LL_DMA_CHANNEL_3
  1723. * @arg @ref LL_DMA_CHANNEL_4
  1724. * @arg @ref LL_DMA_CHANNEL_5
  1725. * @arg @ref LL_DMA_CHANNEL_6
  1726. * @arg @ref LL_DMA_CHANNEL_7
  1727. * @retval State of bit (1 or 0).
  1728. */
  1729. __STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_TC(DMA_TypeDef *DMAx, uint32_t Channel)
  1730. {
  1731. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  1732. DMA_CCR_TCIE) == (DMA_CCR_TCIE));
  1733. }
  1734. /**
  1735. * @brief Check if Half transfer Interrupt is enabled.
  1736. * @rmtoll CCR HTIE LL_DMA_IsEnabledIT_HT
  1737. * @param DMAx DMAx Instance
  1738. * @param Channel This parameter can be one of the following values:
  1739. * @arg @ref LL_DMA_CHANNEL_1
  1740. * @arg @ref LL_DMA_CHANNEL_2
  1741. * @arg @ref LL_DMA_CHANNEL_3
  1742. * @arg @ref LL_DMA_CHANNEL_4
  1743. * @arg @ref LL_DMA_CHANNEL_5
  1744. * @arg @ref LL_DMA_CHANNEL_6
  1745. * @arg @ref LL_DMA_CHANNEL_7
  1746. * @retval State of bit (1 or 0).
  1747. */
  1748. __STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_HT(DMA_TypeDef *DMAx, uint32_t Channel)
  1749. {
  1750. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  1751. DMA_CCR_HTIE) == (DMA_CCR_HTIE));
  1752. }
  1753. /**
  1754. * @brief Check if Transfer error Interrupt is enabled.
  1755. * @rmtoll CCR TEIE LL_DMA_IsEnabledIT_TE
  1756. * @param DMAx DMAx Instance
  1757. * @param Channel This parameter can be one of the following values:
  1758. * @arg @ref LL_DMA_CHANNEL_1
  1759. * @arg @ref LL_DMA_CHANNEL_2
  1760. * @arg @ref LL_DMA_CHANNEL_3
  1761. * @arg @ref LL_DMA_CHANNEL_4
  1762. * @arg @ref LL_DMA_CHANNEL_5
  1763. * @arg @ref LL_DMA_CHANNEL_6
  1764. * @arg @ref LL_DMA_CHANNEL_7
  1765. * @retval State of bit (1 or 0).
  1766. */
  1767. __STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_TE(DMA_TypeDef *DMAx, uint32_t Channel)
  1768. {
  1769. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  1770. DMA_CCR_TEIE) == (DMA_CCR_TEIE));
  1771. }
  1772. /**
  1773. * @}
  1774. */
  1775. #if defined(USE_FULL_LL_DRIVER)
  1776. /** @defgroup DMA_LL_EF_Init Initialization and de-initialization functions
  1777. * @{
  1778. */
  1779. uint32_t LL_DMA_Init(DMA_TypeDef *DMAx, uint32_t Channel, LL_DMA_InitTypeDef *DMA_InitStruct);
  1780. uint32_t LL_DMA_DeInit(DMA_TypeDef *DMAx, uint32_t Channel);
  1781. void LL_DMA_StructInit(LL_DMA_InitTypeDef *DMA_InitStruct);
  1782. /**
  1783. * @}
  1784. */
  1785. #endif /* USE_FULL_LL_DRIVER */
  1786. /**
  1787. * @}
  1788. */
  1789. /**
  1790. * @}
  1791. */
  1792. #endif /* DMA1 || DMA2 */
  1793. /**
  1794. * @}
  1795. */
  1796. #ifdef __cplusplus
  1797. }
  1798. #endif
  1799. #endif /* __STM32F1xx_LL_DMA_H */