stm32l4xx_ll_dma.h 106 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481
  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_ll_dma.h
  4. * @author MCD Application Team
  5. * @brief Header file of DMA LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; COPYRIGHT(c) 2016 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. /* Define to prevent recursive inclusion -------------------------------------*/
  36. #ifndef __STM32L4xx_LL_DMA_H
  37. #define __STM32L4xx_LL_DMA_H
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. /* Includes ------------------------------------------------------------------*/
  42. #include "stm32l4xx.h"
  43. #if defined(DMAMUX1)
  44. #include "stm32l4xx_ll_dmamux.h"
  45. #endif /* DMAMUX1 */
  46. /** @addtogroup STM32L4xx_LL_Driver
  47. * @{
  48. */
  49. #if defined (DMA1) || defined (DMA2)
  50. /** @defgroup DMA_LL DMA
  51. * @{
  52. */
  53. /* Private types -------------------------------------------------------------*/
  54. /* Private variables ---------------------------------------------------------*/
  55. /** @defgroup DMA_LL_Private_Variables DMA Private Variables
  56. * @{
  57. */
  58. /* Array used to get the DMA channel register offset versus channel index LL_DMA_CHANNEL_x */
  59. static const uint8_t CHANNEL_OFFSET_TAB[] =
  60. {
  61. (uint8_t)(DMA1_Channel1_BASE - DMA1_BASE),
  62. (uint8_t)(DMA1_Channel2_BASE - DMA1_BASE),
  63. (uint8_t)(DMA1_Channel3_BASE - DMA1_BASE),
  64. (uint8_t)(DMA1_Channel4_BASE - DMA1_BASE),
  65. (uint8_t)(DMA1_Channel5_BASE - DMA1_BASE),
  66. (uint8_t)(DMA1_Channel6_BASE - DMA1_BASE),
  67. (uint8_t)(DMA1_Channel7_BASE - DMA1_BASE)
  68. };
  69. /**
  70. * @}
  71. */
  72. /* Private constants ---------------------------------------------------------*/
  73. #if defined(DMAMUX1)
  74. #else
  75. /** @defgroup DMA_LL_Private_Constants DMA Private Constants
  76. * @{
  77. */
  78. /* Define used to get CSELR register offset */
  79. #define DMA_CSELR_OFFSET (uint32_t)(DMA1_CSELR_BASE - DMA1_BASE)
  80. /* Defines used for the bit position in the register and perform offsets */
  81. #define DMA_POSITION_CSELR_CXS POSITION_VAL(DMA_CSELR_C1S << ((Channel-1U)*4U))
  82. /**
  83. * @}
  84. */
  85. #endif /* DMAMUX1 */
  86. /* Private macros ------------------------------------------------------------*/
  87. #if defined(DMAMUX1)
  88. /** @defgroup DMA_LL_Private_Macros DMA Private Macros
  89. * @{
  90. */
  91. /**
  92. * @brief Helper macro to convert DMA Instance DMAx into DMAMUX channel
  93. * @note DMAMUX channel 0 to 6 are mapped to DMA1 channel 1 to 7.
  94. * DMAMUX channel 7 to 13 are mapped to DMA2 channel 1 to 7.
  95. * @param __DMA_INSTANCE__ DMAx
  96. * @retval Channel_Offset (LL_DMA_CHANNEL_7 or 0).
  97. */
  98. #define __LL_DMA_INSTANCE_TO_DMAMUX_CHANNEL(__DMA_INSTANCE__) \
  99. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) ? 0 : LL_DMA_CHANNEL_7)
  100. /**
  101. * @}
  102. */
  103. #else
  104. #if defined(USE_FULL_LL_DRIVER)
  105. /** @defgroup DMA_LL_Private_Macros DMA Private Macros
  106. * @{
  107. */
  108. /**
  109. * @}
  110. */
  111. #endif /*USE_FULL_LL_DRIVER*/
  112. #endif /* DMAMUX1 */
  113. /* Exported types ------------------------------------------------------------*/
  114. #if defined(USE_FULL_LL_DRIVER)
  115. /** @defgroup DMA_LL_ES_INIT DMA Exported Init structure
  116. * @{
  117. */
  118. typedef struct
  119. {
  120. uint32_t PeriphOrM2MSrcAddress; /*!< Specifies the peripheral base address for DMA transfer
  121. or as Source base address in case of memory to memory transfer direction.
  122. This parameter must be a value between Min_Data = 0 and Max_Data = 0xFFFFFFFF. */
  123. uint32_t MemoryOrM2MDstAddress; /*!< Specifies the memory base address for DMA transfer
  124. or as Destination base address in case of memory to memory transfer direction.
  125. This parameter must be a value between Min_Data = 0 and Max_Data = 0xFFFFFFFF. */
  126. uint32_t Direction; /*!< Specifies if the data will be transferred from memory to peripheral,
  127. from memory to memory or from peripheral to memory.
  128. This parameter can be a value of @ref DMA_LL_EC_DIRECTION
  129. This feature can be modified afterwards using unitary function @ref LL_DMA_SetDataTransferDirection(). */
  130. uint32_t Mode; /*!< Specifies the normal or circular operation mode.
  131. This parameter can be a value of @ref DMA_LL_EC_MODE
  132. @note: The circular buffer mode cannot be used if the memory to memory
  133. data transfer direction is configured on the selected Channel
  134. This feature can be modified afterwards using unitary function @ref LL_DMA_SetMode(). */
  135. uint32_t PeriphOrM2MSrcIncMode; /*!< Specifies whether the Peripheral address or Source address in case of memory to memory transfer direction
  136. is incremented or not.
  137. This parameter can be a value of @ref DMA_LL_EC_PERIPH
  138. This feature can be modified afterwards using unitary function @ref LL_DMA_SetPeriphIncMode(). */
  139. uint32_t MemoryOrM2MDstIncMode; /*!< Specifies whether the Memory address or Destination address in case of memory to memory transfer direction
  140. is incremented or not.
  141. This parameter can be a value of @ref DMA_LL_EC_MEMORY
  142. This feature can be modified afterwards using unitary function @ref LL_DMA_SetMemoryIncMode(). */
  143. uint32_t PeriphOrM2MSrcDataSize; /*!< Specifies the Peripheral data size alignment or Source data size alignment (byte, half word, word)
  144. in case of memory to memory transfer direction.
  145. This parameter can be a value of @ref DMA_LL_EC_PDATAALIGN
  146. This feature can be modified afterwards using unitary function @ref LL_DMA_SetPeriphSize(). */
  147. uint32_t MemoryOrM2MDstDataSize; /*!< Specifies the Memory data size alignment or Destination data size alignment (byte, half word, word)
  148. in case of memory to memory transfer direction.
  149. This parameter can be a value of @ref DMA_LL_EC_MDATAALIGN
  150. This feature can be modified afterwards using unitary function @ref LL_DMA_SetMemorySize(). */
  151. uint32_t NbData; /*!< Specifies the number of data to transfer, in data unit.
  152. The data unit is equal to the source buffer configuration set in PeripheralSize
  153. or MemorySize parameters depending in the transfer direction.
  154. This parameter must be a value between Min_Data = 0 and Max_Data = 0x0000FFFF
  155. This feature can be modified afterwards using unitary function @ref LL_DMA_SetDataLength(). */
  156. #if defined(DMAMUX1)
  157. uint32_t PeriphRequest; /*!< Specifies the peripheral request.
  158. This parameter can be a value of @ref DMAMUX_LL_EC_REQUEST
  159. This feature can be modified afterwards using unitary function @ref LL_DMA_SetPeriphRequest(). */
  160. #else
  161. uint32_t PeriphRequest; /*!< Specifies the peripheral request.
  162. This parameter can be a value of @ref DMA_LL_EC_REQUEST
  163. This feature can be modified afterwards using unitary function @ref LL_DMA_SetPeriphRequest(). */
  164. #endif /* DMAMUX1 */
  165. uint32_t Priority; /*!< Specifies the channel priority level.
  166. This parameter can be a value of @ref DMA_LL_EC_PRIORITY
  167. This feature can be modified afterwards using unitary function @ref LL_DMA_SetChannelPriorityLevel(). */
  168. } LL_DMA_InitTypeDef;
  169. /**
  170. * @}
  171. */
  172. #endif /*USE_FULL_LL_DRIVER*/
  173. /* Exported constants --------------------------------------------------------*/
  174. /** @defgroup DMA_LL_Exported_Constants DMA Exported Constants
  175. * @{
  176. */
  177. /** @defgroup DMA_LL_EC_CLEAR_FLAG Clear Flags Defines
  178. * @brief Flags defines which can be used with LL_DMA_WriteReg function
  179. * @{
  180. */
  181. #define LL_DMA_IFCR_CGIF1 DMA_IFCR_CGIF1 /*!< Channel 1 global flag */
  182. #define LL_DMA_IFCR_CTCIF1 DMA_IFCR_CTCIF1 /*!< Channel 1 transfer complete flag */
  183. #define LL_DMA_IFCR_CHTIF1 DMA_IFCR_CHTIF1 /*!< Channel 1 half transfer flag */
  184. #define LL_DMA_IFCR_CTEIF1 DMA_IFCR_CTEIF1 /*!< Channel 1 transfer error flag */
  185. #define LL_DMA_IFCR_CGIF2 DMA_IFCR_CGIF2 /*!< Channel 2 global flag */
  186. #define LL_DMA_IFCR_CTCIF2 DMA_IFCR_CTCIF2 /*!< Channel 2 transfer complete flag */
  187. #define LL_DMA_IFCR_CHTIF2 DMA_IFCR_CHTIF2 /*!< Channel 2 half transfer flag */
  188. #define LL_DMA_IFCR_CTEIF2 DMA_IFCR_CTEIF2 /*!< Channel 2 transfer error flag */
  189. #define LL_DMA_IFCR_CGIF3 DMA_IFCR_CGIF3 /*!< Channel 3 global flag */
  190. #define LL_DMA_IFCR_CTCIF3 DMA_IFCR_CTCIF3 /*!< Channel 3 transfer complete flag */
  191. #define LL_DMA_IFCR_CHTIF3 DMA_IFCR_CHTIF3 /*!< Channel 3 half transfer flag */
  192. #define LL_DMA_IFCR_CTEIF3 DMA_IFCR_CTEIF3 /*!< Channel 3 transfer error flag */
  193. #define LL_DMA_IFCR_CGIF4 DMA_IFCR_CGIF4 /*!< Channel 4 global flag */
  194. #define LL_DMA_IFCR_CTCIF4 DMA_IFCR_CTCIF4 /*!< Channel 4 transfer complete flag */
  195. #define LL_DMA_IFCR_CHTIF4 DMA_IFCR_CHTIF4 /*!< Channel 4 half transfer flag */
  196. #define LL_DMA_IFCR_CTEIF4 DMA_IFCR_CTEIF4 /*!< Channel 4 transfer error flag */
  197. #define LL_DMA_IFCR_CGIF5 DMA_IFCR_CGIF5 /*!< Channel 5 global flag */
  198. #define LL_DMA_IFCR_CTCIF5 DMA_IFCR_CTCIF5 /*!< Channel 5 transfer complete flag */
  199. #define LL_DMA_IFCR_CHTIF5 DMA_IFCR_CHTIF5 /*!< Channel 5 half transfer flag */
  200. #define LL_DMA_IFCR_CTEIF5 DMA_IFCR_CTEIF5 /*!< Channel 5 transfer error flag */
  201. #define LL_DMA_IFCR_CGIF6 DMA_IFCR_CGIF6 /*!< Channel 6 global flag */
  202. #define LL_DMA_IFCR_CTCIF6 DMA_IFCR_CTCIF6 /*!< Channel 6 transfer complete flag */
  203. #define LL_DMA_IFCR_CHTIF6 DMA_IFCR_CHTIF6 /*!< Channel 6 half transfer flag */
  204. #define LL_DMA_IFCR_CTEIF6 DMA_IFCR_CTEIF6 /*!< Channel 6 transfer error flag */
  205. #define LL_DMA_IFCR_CGIF7 DMA_IFCR_CGIF7 /*!< Channel 7 global flag */
  206. #define LL_DMA_IFCR_CTCIF7 DMA_IFCR_CTCIF7 /*!< Channel 7 transfer complete flag */
  207. #define LL_DMA_IFCR_CHTIF7 DMA_IFCR_CHTIF7 /*!< Channel 7 half transfer flag */
  208. #define LL_DMA_IFCR_CTEIF7 DMA_IFCR_CTEIF7 /*!< Channel 7 transfer error flag */
  209. /**
  210. * @}
  211. */
  212. /** @defgroup DMA_LL_EC_GET_FLAG Get Flags Defines
  213. * @brief Flags defines which can be used with LL_DMA_ReadReg function
  214. * @{
  215. */
  216. #define LL_DMA_ISR_GIF1 DMA_ISR_GIF1 /*!< Channel 1 global flag */
  217. #define LL_DMA_ISR_TCIF1 DMA_ISR_TCIF1 /*!< Channel 1 transfer complete flag */
  218. #define LL_DMA_ISR_HTIF1 DMA_ISR_HTIF1 /*!< Channel 1 half transfer flag */
  219. #define LL_DMA_ISR_TEIF1 DMA_ISR_TEIF1 /*!< Channel 1 transfer error flag */
  220. #define LL_DMA_ISR_GIF2 DMA_ISR_GIF2 /*!< Channel 2 global flag */
  221. #define LL_DMA_ISR_TCIF2 DMA_ISR_TCIF2 /*!< Channel 2 transfer complete flag */
  222. #define LL_DMA_ISR_HTIF2 DMA_ISR_HTIF2 /*!< Channel 2 half transfer flag */
  223. #define LL_DMA_ISR_TEIF2 DMA_ISR_TEIF2 /*!< Channel 2 transfer error flag */
  224. #define LL_DMA_ISR_GIF3 DMA_ISR_GIF3 /*!< Channel 3 global flag */
  225. #define LL_DMA_ISR_TCIF3 DMA_ISR_TCIF3 /*!< Channel 3 transfer complete flag */
  226. #define LL_DMA_ISR_HTIF3 DMA_ISR_HTIF3 /*!< Channel 3 half transfer flag */
  227. #define LL_DMA_ISR_TEIF3 DMA_ISR_TEIF3 /*!< Channel 3 transfer error flag */
  228. #define LL_DMA_ISR_GIF4 DMA_ISR_GIF4 /*!< Channel 4 global flag */
  229. #define LL_DMA_ISR_TCIF4 DMA_ISR_TCIF4 /*!< Channel 4 transfer complete flag */
  230. #define LL_DMA_ISR_HTIF4 DMA_ISR_HTIF4 /*!< Channel 4 half transfer flag */
  231. #define LL_DMA_ISR_TEIF4 DMA_ISR_TEIF4 /*!< Channel 4 transfer error flag */
  232. #define LL_DMA_ISR_GIF5 DMA_ISR_GIF5 /*!< Channel 5 global flag */
  233. #define LL_DMA_ISR_TCIF5 DMA_ISR_TCIF5 /*!< Channel 5 transfer complete flag */
  234. #define LL_DMA_ISR_HTIF5 DMA_ISR_HTIF5 /*!< Channel 5 half transfer flag */
  235. #define LL_DMA_ISR_TEIF5 DMA_ISR_TEIF5 /*!< Channel 5 transfer error flag */
  236. #define LL_DMA_ISR_GIF6 DMA_ISR_GIF6 /*!< Channel 6 global flag */
  237. #define LL_DMA_ISR_TCIF6 DMA_ISR_TCIF6 /*!< Channel 6 transfer complete flag */
  238. #define LL_DMA_ISR_HTIF6 DMA_ISR_HTIF6 /*!< Channel 6 half transfer flag */
  239. #define LL_DMA_ISR_TEIF6 DMA_ISR_TEIF6 /*!< Channel 6 transfer error flag */
  240. #define LL_DMA_ISR_GIF7 DMA_ISR_GIF7 /*!< Channel 7 global flag */
  241. #define LL_DMA_ISR_TCIF7 DMA_ISR_TCIF7 /*!< Channel 7 transfer complete flag */
  242. #define LL_DMA_ISR_HTIF7 DMA_ISR_HTIF7 /*!< Channel 7 half transfer flag */
  243. #define LL_DMA_ISR_TEIF7 DMA_ISR_TEIF7 /*!< Channel 7 transfer error flag */
  244. /**
  245. * @}
  246. */
  247. /** @defgroup DMA_LL_EC_IT IT Defines
  248. * @brief IT defines which can be used with LL_DMA_ReadReg and LL_DMA_WriteReg functions
  249. * @{
  250. */
  251. #define LL_DMA_CCR_TCIE DMA_CCR_TCIE /*!< Transfer complete interrupt */
  252. #define LL_DMA_CCR_HTIE DMA_CCR_HTIE /*!< Half Transfer interrupt */
  253. #define LL_DMA_CCR_TEIE DMA_CCR_TEIE /*!< Transfer error interrupt */
  254. /**
  255. * @}
  256. */
  257. /** @defgroup DMA_LL_EC_CHANNEL CHANNEL
  258. * @{
  259. */
  260. #define LL_DMA_CHANNEL_1 0x00000001U /*!< DMA Channel 1 */
  261. #define LL_DMA_CHANNEL_2 0x00000002U /*!< DMA Channel 2 */
  262. #define LL_DMA_CHANNEL_3 0x00000003U /*!< DMA Channel 3 */
  263. #define LL_DMA_CHANNEL_4 0x00000004U /*!< DMA Channel 4 */
  264. #define LL_DMA_CHANNEL_5 0x00000005U /*!< DMA Channel 5 */
  265. #define LL_DMA_CHANNEL_6 0x00000006U /*!< DMA Channel 6 */
  266. #define LL_DMA_CHANNEL_7 0x00000007U /*!< DMA Channel 7 */
  267. #if defined(USE_FULL_LL_DRIVER)
  268. #define LL_DMA_CHANNEL_ALL 0xFFFF0000U /*!< DMA Channel all (used only for function @ref LL_DMA_DeInit(). */
  269. #endif /*USE_FULL_LL_DRIVER*/
  270. /**
  271. * @}
  272. */
  273. /** @defgroup DMA_LL_EC_DIRECTION Transfer Direction
  274. * @{
  275. */
  276. #define LL_DMA_DIRECTION_PERIPH_TO_MEMORY 0x00000000U /*!< Peripheral to memory direction */
  277. #define LL_DMA_DIRECTION_MEMORY_TO_PERIPH DMA_CCR_DIR /*!< Memory to peripheral direction */
  278. #define LL_DMA_DIRECTION_MEMORY_TO_MEMORY DMA_CCR_MEM2MEM /*!< Memory to memory direction */
  279. /**
  280. * @}
  281. */
  282. /** @defgroup DMA_LL_EC_MODE Transfer mode
  283. * @{
  284. */
  285. #define LL_DMA_MODE_NORMAL 0x00000000U /*!< Normal Mode */
  286. #define LL_DMA_MODE_CIRCULAR DMA_CCR_CIRC /*!< Circular Mode */
  287. /**
  288. * @}
  289. */
  290. /** @defgroup DMA_LL_EC_PERIPH Peripheral increment mode
  291. * @{
  292. */
  293. #define LL_DMA_PERIPH_INCREMENT DMA_CCR_PINC /*!< Peripheral increment mode Enable */
  294. #define LL_DMA_PERIPH_NOINCREMENT 0x00000000U /*!< Peripheral increment mode Disable */
  295. /**
  296. * @}
  297. */
  298. /** @defgroup DMA_LL_EC_MEMORY Memory increment mode
  299. * @{
  300. */
  301. #define LL_DMA_MEMORY_INCREMENT DMA_CCR_MINC /*!< Memory increment mode Enable */
  302. #define LL_DMA_MEMORY_NOINCREMENT 0x00000000U /*!< Memory increment mode Disable */
  303. /**
  304. * @}
  305. */
  306. /** @defgroup DMA_LL_EC_PDATAALIGN Peripheral data alignment
  307. * @{
  308. */
  309. #define LL_DMA_PDATAALIGN_BYTE 0x00000000U /*!< Peripheral data alignment : Byte */
  310. #define LL_DMA_PDATAALIGN_HALFWORD DMA_CCR_PSIZE_0 /*!< Peripheral data alignment : HalfWord */
  311. #define LL_DMA_PDATAALIGN_WORD DMA_CCR_PSIZE_1 /*!< Peripheral data alignment : Word */
  312. /**
  313. * @}
  314. */
  315. /** @defgroup DMA_LL_EC_MDATAALIGN Memory data alignment
  316. * @{
  317. */
  318. #define LL_DMA_MDATAALIGN_BYTE 0x00000000U /*!< Memory data alignment : Byte */
  319. #define LL_DMA_MDATAALIGN_HALFWORD DMA_CCR_MSIZE_0 /*!< Memory data alignment : HalfWord */
  320. #define LL_DMA_MDATAALIGN_WORD DMA_CCR_MSIZE_1 /*!< Memory data alignment : Word */
  321. /**
  322. * @}
  323. */
  324. /** @defgroup DMA_LL_EC_PRIORITY Transfer Priority level
  325. * @{
  326. */
  327. #define LL_DMA_PRIORITY_LOW 0x00000000U /*!< Priority level : Low */
  328. #define LL_DMA_PRIORITY_MEDIUM DMA_CCR_PL_0 /*!< Priority level : Medium */
  329. #define LL_DMA_PRIORITY_HIGH DMA_CCR_PL_1 /*!< Priority level : High */
  330. #define LL_DMA_PRIORITY_VERYHIGH DMA_CCR_PL /*!< Priority level : Very_High */
  331. /**
  332. * @}
  333. */
  334. #if defined(DMAMUX1)
  335. /** @defgroup DMAMUX_LL_EC_REQUEST Transfer request
  336. * @{
  337. */
  338. #define LL_DMAMUX_REQUEST_MEM2MEM 0U /*!< Memory to memory transfer */
  339. #define LL_DMAMUX_REQUEST_GENERATOR0 1U /*!< DMAMUX request generator 0 */
  340. #define LL_DMAMUX_REQUEST_GENERATOR1 2U /*!< DMAMUX request generator 1 */
  341. #define LL_DMAMUX_REQUEST_GENERATOR2 3U /*!< DMAMUX request generator 2 */
  342. #define LL_DMAMUX_REQUEST_GENERATOR3 4U /*!< DMAMUX request generator 3 */
  343. #define LL_DMAMUX_REQUEST_ADC1 5U /*!< DMAMUX ADC1 request */
  344. #define LL_DMAMUX_REQUEST_DAC1_CH1 6U /*!< DMAMUX DAC1 CH1 request */
  345. #define LL_DMAMUX_REQUEST_DAC1_CH2 7U /*!< DMAMUX DAC1 CH2 request */
  346. #define LL_DMAMUX_REQUEST_TIM6_UP 8U /*!< DMAMUX TIM6 UP request */
  347. #define LL_DMAMUX_REQUEST_TIM7_UP 9U /*!< DMAMUX TIM7 UP request */
  348. #define LL_DMAMUX_REQUEST_SPI1_RX 10U /*!< DMAMUX SPI1 RX request */
  349. #define LL_DMAMUX_REQUEST_SPI1_TX 11U /*!< DMAMUX SPI1 TX request */
  350. #define LL_DMAMUX_REQUEST_SPI2_RX 12U /*!< DMAMUX SPI2 RX request */
  351. #define LL_DMAMUX_REQUEST_SPI2_TX 13U /*!< DMAMUX SPI2 TX request */
  352. #define LL_DMAMUX_REQUEST_SPI3_RX 14U /*!< DMAMUX SPI3 RX request */
  353. #define LL_DMAMUX_REQUEST_SPI3_TX 15U /*!< DMAMUX SPI3 TX request */
  354. #define LL_DMAMUX_REQUEST_I2C1_RX 16U /*!< DMAMUX I2C1 RX request */
  355. #define LL_DMAMUX_REQUEST_I2C1_TX 17U /*!< DMAMUX I2C1 TX request */
  356. #define LL_DMAMUX_REQUEST_I2C2_RX 18U /*!< DMAMUX I2C2 RX request */
  357. #define LL_DMAMUX_REQUEST_I2C2_TX 19U /*!< DMAMUX I2C2 TX request */
  358. #define LL_DMAMUX_REQUEST_I2C3_RX 20U /*!< DMAMUX I2C3 RX request */
  359. #define LL_DMAMUX_REQUEST_I2C3_TX 21U /*!< DMAMUX I2C3 TX request */
  360. #define LL_DMAMUX_REQUEST_I2C4_RX 22U /*!< DMAMUX I2C4 RX request */
  361. #define LL_DMAMUX_REQUEST_I2C4_TX 23U /*!< DMAMUX I2C4 TX request */
  362. #define LL_DMAMUX_REQUEST_USART1_RX 24U /*!< DMAMUX USART1 RX request */
  363. #define LL_DMAMUX_REQUEST_USART1_TX 25U /*!< DMAMUX USART1 TX request */
  364. #define LL_DMAMUX_REQUEST_USART2_RX 26U /*!< DMAMUX USART2 RX request */
  365. #define LL_DMAMUX_REQUEST_USART2_TX 27U /*!< DMAMUX USART2 TX request */
  366. #define LL_DMAMUX_REQUEST_USART3_RX 28U /*!< DMAMUX USART3 RX request */
  367. #define LL_DMAMUX_REQUEST_USART3_TX 29U /*!< DMAMUX USART3 TX request */
  368. #define LL_DMAMUX_REQUEST_UART4_RX 30U /*!< DMAMUX UART4 RX request */
  369. #define LL_DMAMUX_REQUEST_UART4_TX 31U /*!< DMAMUX UART4 TX request */
  370. #define LL_DMAMUX_REQUEST_UART5_RX 32U /*!< DMAMUX UART5 RX request */
  371. #define LL_DMAMUX_REQUEST_UART5_TX 33U /*!< DMAMUX UART5 TX request */
  372. #define LL_DMAMUX_REQUEST_LPUART1_RX 34U /*!< DMAMUX LPUART1 RX request */
  373. #define LL_DMAMUX_REQUEST_LPUART1_TX 35U /*!< DMAMUX LPUART1 TX request */
  374. #define LL_DMAMUX_REQUEST_SAI1_A 36U /*!< DMAMUX SAI1 A request */
  375. #define LL_DMAMUX_REQUEST_SAI1_B 37U /*!< DMAMUX SAI1 B request */
  376. #define LL_DMAMUX_REQUEST_SAI2_A 38U /*!< DMAMUX SAI2 A request */
  377. #define LL_DMAMUX_REQUEST_SAI2_B 39U /*!< DMAMUX SAI2 B request */
  378. #define LL_DMAMUX_REQUEST_OSPI1 40U /*!< DMAMUX OCTOSPI1 request */
  379. #define LL_DMAMUX_REQUEST_OSPI2 41U /*!< DMAMUX OCTOSPI2 request */
  380. #define LL_DMAMUX_REQUEST_TIM1_CH1 42U /*!< DMAMUX TIM1 CH1 request */
  381. #define LL_DMAMUX_REQUEST_TIM1_CH2 43U /*!< DMAMUX TIM1 CH2 request */
  382. #define LL_DMAMUX_REQUEST_TIM1_CH3 44U /*!< DMAMUX TIM1 CH3 request */
  383. #define LL_DMAMUX_REQUEST_TIM1_CH4 45U /*!< DMAMUX TIM1 CH4 request */
  384. #define LL_DMAMUX_REQUEST_TIM1_UP 46U /*!< DMAMUX TIM1 UP request */
  385. #define LL_DMAMUX_REQUEST_TIM1_TRIG 47U /*!< DMAMUX TIM1 TRIG request */
  386. #define LL_DMAMUX_REQUEST_TIM1_COM 48U /*!< DMAMUX TIM1 COM request */
  387. #define LL_DMAMUX_REQUEST_TIM8_CH1 49U /*!< DMAMUX TIM8 CH1 request */
  388. #define LL_DMAMUX_REQUEST_TIM8_CH2 50U /*!< DMAMUX TIM8 CH2 request */
  389. #define LL_DMAMUX_REQUEST_TIM8_CH3 51U /*!< DMAMUX TIM8 CH3 request */
  390. #define LL_DMAMUX_REQUEST_TIM8_CH4 52U /*!< DMAMUX TIM8 CH4 request */
  391. #define LL_DMAMUX_REQUEST_TIM8_UP 53U /*!< DMAMUX TIM8 UP request */
  392. #define LL_DMAMUX_REQUEST_TIM8_TRIG 54U /*!< DMAMUX TIM8 TRIG request */
  393. #define LL_DMAMUX_REQUEST_TIM8_COM 55U /*!< DMAMUX TIM8 COM request */
  394. #define LL_DMAMUX_REQUEST_TIM2_CH1 56U /*!< DMAMUX TIM2 CH1 request */
  395. #define LL_DMAMUX_REQUEST_TIM2_CH2 57U /*!< DMAMUX TIM2 CH2 request */
  396. #define LL_DMAMUX_REQUEST_TIM2_CH3 58U /*!< DMAMUX TIM2 CH3 request */
  397. #define LL_DMAMUX_REQUEST_TIM2_CH4 59U /*!< DMAMUX TIM2 CH4 request */
  398. #define LL_DMAMUX_REQUEST_TIM2_UP 60U /*!< DMAMUX TIM2 UP request */
  399. #define LL_DMAMUX_REQUEST_TIM3_CH1 61U /*!< DMAMUX TIM3 CH1 request */
  400. #define LL_DMAMUX_REQUEST_TIM3_CH2 62U /*!< DMAMUX TIM3 CH2 request */
  401. #define LL_DMAMUX_REQUEST_TIM3_CH3 63U /*!< DMAMUX TIM3 CH3 request */
  402. #define LL_DMAMUX_REQUEST_TIM3_CH4 64U /*!< DMAMUX TIM3 CH4 request */
  403. #define LL_DMAMUX_REQUEST_TIM3_UP 65U /*!< DMAMUX TIM3 UP request */
  404. #define LL_DMAMUX_REQUEST_TIM3_TRIG 66U /*!< DMAMUX TIM3 TRIG request */
  405. #define LL_DMAMUX_REQUEST_TIM4_CH1 67U /*!< DMAMUX TIM4 CH1 request */
  406. #define LL_DMAMUX_REQUEST_TIM4_CH2 68U /*!< DMAMUX TIM4 CH2 request */
  407. #define LL_DMAMUX_REQUEST_TIM4_CH3 69U /*!< DMAMUX TIM4 CH3 request */
  408. #define LL_DMAMUX_REQUEST_TIM4_CH4 70U /*!< DMAMUX TIM4 CH4 request */
  409. #define LL_DMAMUX_REQUEST_TIM4_UP 71U /*!< DMAMUX TIM4 UP request */
  410. #define LL_DMAMUX_REQUEST_TIM5_CH1 72U /*!< DMAMUX TIM5 CH1 request */
  411. #define LL_DMAMUX_REQUEST_TIM5_CH2 73U /*!< DMAMUX TIM5 CH2 request */
  412. #define LL_DMAMUX_REQUEST_TIM5_CH3 74U /*!< DMAMUX TIM5 CH3 request */
  413. #define LL_DMAMUX_REQUEST_TIM5_CH4 75U /*!< DMAMUX TIM5 CH4 request */
  414. #define LL_DMAMUX_REQUEST_TIM5_UP 76U /*!< DMAMUX TIM5 UP request */
  415. #define LL_DMAMUX_REQUEST_TIM5_TRIG 77U /*!< DMAMUX TIM5 TRIG request */
  416. #define LL_DMAMUX_REQUEST_TIM15_CH1 78U /*!< DMAMUX TIM15 CH1 request */
  417. #define LL_DMAMUX_REQUEST_TIM15_UP 79U /*!< DMAMUX TIM15 UP request */
  418. #define LL_DMAMUX_REQUEST_TIM15_TRIG 80U /*!< DMAMUX TIM15 TRIG request */
  419. #define LL_DMAMUX_REQUEST_TIM15_COM 81U /*!< DMAMUX TIM15 COM request */
  420. #define LL_DMAMUX_REQUEST_TIM16_CH1 82U /*!< DMAMUX TIM16 CH1 request */
  421. #define LL_DMAMUX_REQUEST_TIM16_UP 83U /*!< DMAMUX TIM16 UP request */
  422. #define LL_DMAMUX_REQUEST_TIM17_CH1 84U /*!< DMAMUX TIM17 CH1 request */
  423. #define LL_DMAMUX_REQUEST_TIM17_UP 85U /*!< DMAMUX TIM17 UP request */
  424. #define LL_DMAMUX_REQUEST_DFSDM1_FLT0 86U /*!< DMAMUX DFSDM1_FLT0 request */
  425. #define LL_DMAMUX_REQUEST_DFSDM1_FLT1 87U /*!< DMAMUX DFSDM1_FLT1 request */
  426. #define LL_DMAMUX_REQUEST_DFSDM1_FLT2 88U /*!< DMAMUX DFSDM1_FLT2 request */
  427. #define LL_DMAMUX_REQUEST_DFSDM1_FLT3 89U /*!< DMAMUX DFSDM1_FLT3 request */
  428. #define LL_DMAMUX_REQUEST_DCMI 90U /*!< DMAMUX DCMI request */
  429. #define LL_DMAMUX_REQUEST_AES_IN 91U /*!< DMAMUX AES_IN request */
  430. #define LL_DMAMUX_REQUEST_AES_OUT 92U /*!< DMAMUX AES_OUT request */
  431. #define LL_DMAMUX_REQUEST_HASH_IN 93U /*!< DMAMUX HASH_IN request */
  432. /**
  433. * @}
  434. */
  435. #else
  436. /** @defgroup DMA_LL_EC_REQUEST Transfer peripheral request
  437. * @{
  438. */
  439. #define LL_DMA_REQUEST_0 0x00000000U /*!< DMA peripheral request 0 */
  440. #define LL_DMA_REQUEST_1 0x00000001U /*!< DMA peripheral request 1 */
  441. #define LL_DMA_REQUEST_2 0x00000002U /*!< DMA peripheral request 2 */
  442. #define LL_DMA_REQUEST_3 0x00000003U /*!< DMA peripheral request 3 */
  443. #define LL_DMA_REQUEST_4 0x00000004U /*!< DMA peripheral request 4 */
  444. #define LL_DMA_REQUEST_5 0x00000005U /*!< DMA peripheral request 5 */
  445. #define LL_DMA_REQUEST_6 0x00000006U /*!< DMA peripheral request 6 */
  446. #define LL_DMA_REQUEST_7 0x00000007U /*!< DMA peripheral request 7 */
  447. /**
  448. * @}
  449. */
  450. #endif /* DMAMUX1 */
  451. /**
  452. * @}
  453. */
  454. /* Exported macro ------------------------------------------------------------*/
  455. /** @defgroup DMA_LL_Exported_Macros DMA Exported Macros
  456. * @{
  457. */
  458. /** @defgroup DMA_LL_EM_WRITE_READ Common Write and read registers macros
  459. * @{
  460. */
  461. /**
  462. * @brief Write a value in DMA register
  463. * @param __INSTANCE__ DMA Instance
  464. * @param __REG__ Register to be written
  465. * @param __VALUE__ Value to be written in the register
  466. * @retval None
  467. */
  468. #define LL_DMA_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
  469. /**
  470. * @brief Read a value in DMA register
  471. * @param __INSTANCE__ DMA Instance
  472. * @param __REG__ Register to be read
  473. * @retval Register value
  474. */
  475. #define LL_DMA_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
  476. /**
  477. * @}
  478. */
  479. /** @defgroup DMA_LL_EM_CONVERT_DMAxCHANNELy Convert DMAxChannely
  480. * @{
  481. */
  482. /**
  483. * @brief Convert DMAx_Channely into DMAx
  484. * @param __CHANNEL_INSTANCE__ DMAx_Channely
  485. * @retval DMAx
  486. */
  487. #if defined(DMA2)
  488. #define __LL_DMA_GET_INSTANCE(__CHANNEL_INSTANCE__) \
  489. (((uint32_t)(__CHANNEL_INSTANCE__) > ((uint32_t)DMA1_Channel7)) ? DMA2 : DMA1)
  490. #else
  491. #define __LL_DMA_GET_INSTANCE(__CHANNEL_INSTANCE__) (DMA1)
  492. #endif
  493. /**
  494. * @brief Convert DMAx_Channely into LL_DMA_CHANNEL_y
  495. * @param __CHANNEL_INSTANCE__ DMAx_Channely
  496. * @retval LL_DMA_CHANNEL_y
  497. */
  498. #if defined (DMA2)
  499. #if defined (DMA2_Channel6) && defined (DMA2_Channel7)
  500. #define __LL_DMA_GET_CHANNEL(__CHANNEL_INSTANCE__) \
  501. (((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel1)) ? LL_DMA_CHANNEL_1 : \
  502. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel1)) ? LL_DMA_CHANNEL_1 : \
  503. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel2)) ? LL_DMA_CHANNEL_2 : \
  504. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel2)) ? LL_DMA_CHANNEL_2 : \
  505. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel3)) ? LL_DMA_CHANNEL_3 : \
  506. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel3)) ? LL_DMA_CHANNEL_3 : \
  507. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel4)) ? LL_DMA_CHANNEL_4 : \
  508. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel4)) ? LL_DMA_CHANNEL_4 : \
  509. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel5)) ? LL_DMA_CHANNEL_5 : \
  510. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel5)) ? LL_DMA_CHANNEL_5 : \
  511. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel6)) ? LL_DMA_CHANNEL_6 : \
  512. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel6)) ? LL_DMA_CHANNEL_6 : \
  513. LL_DMA_CHANNEL_7)
  514. #else
  515. #define __LL_DMA_GET_CHANNEL(__CHANNEL_INSTANCE__) \
  516. (((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel1)) ? LL_DMA_CHANNEL_1 : \
  517. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel1)) ? LL_DMA_CHANNEL_1 : \
  518. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel2)) ? LL_DMA_CHANNEL_2 : \
  519. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel2)) ? LL_DMA_CHANNEL_2 : \
  520. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel3)) ? LL_DMA_CHANNEL_3 : \
  521. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel3)) ? LL_DMA_CHANNEL_3 : \
  522. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel4)) ? LL_DMA_CHANNEL_4 : \
  523. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel4)) ? LL_DMA_CHANNEL_4 : \
  524. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel5)) ? LL_DMA_CHANNEL_5 : \
  525. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA2_Channel5)) ? LL_DMA_CHANNEL_5 : \
  526. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel6)) ? LL_DMA_CHANNEL_6 : \
  527. LL_DMA_CHANNEL_7)
  528. #endif
  529. #else
  530. #define __LL_DMA_GET_CHANNEL(__CHANNEL_INSTANCE__) \
  531. (((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel1)) ? LL_DMA_CHANNEL_1 : \
  532. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel2)) ? LL_DMA_CHANNEL_2 : \
  533. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel3)) ? LL_DMA_CHANNEL_3 : \
  534. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel4)) ? LL_DMA_CHANNEL_4 : \
  535. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel5)) ? LL_DMA_CHANNEL_5 : \
  536. ((uint32_t)(__CHANNEL_INSTANCE__) == ((uint32_t)DMA1_Channel6)) ? LL_DMA_CHANNEL_6 : \
  537. LL_DMA_CHANNEL_7)
  538. #endif
  539. /**
  540. * @brief Convert DMA Instance DMAx and LL_DMA_CHANNEL_y into DMAx_Channely
  541. * @param __DMA_INSTANCE__ DMAx
  542. * @param __CHANNEL__ LL_DMA_CHANNEL_y
  543. * @retval DMAx_Channely
  544. */
  545. #if defined (DMA2)
  546. #if defined (DMA2_Channel6) && defined (DMA2_Channel7)
  547. #define __LL_DMA_GET_CHANNEL_INSTANCE(__DMA_INSTANCE__, __CHANNEL__) \
  548. ((((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_1))) ? DMA1_Channel1 : \
  549. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_1))) ? DMA2_Channel1 : \
  550. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_2))) ? DMA1_Channel2 : \
  551. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_2))) ? DMA2_Channel2 : \
  552. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_3))) ? DMA1_Channel3 : \
  553. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_3))) ? DMA2_Channel3 : \
  554. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_4))) ? DMA1_Channel4 : \
  555. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_4))) ? DMA2_Channel4 : \
  556. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_5))) ? DMA1_Channel5 : \
  557. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_5))) ? DMA2_Channel5 : \
  558. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_6))) ? DMA1_Channel6 : \
  559. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_6))) ? DMA2_Channel6 : \
  560. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_7))) ? DMA1_Channel7 : \
  561. DMA2_Channel7)
  562. #else
  563. #define __LL_DMA_GET_CHANNEL_INSTANCE(__DMA_INSTANCE__, __CHANNEL__) \
  564. ((((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_1))) ? DMA1_Channel1 : \
  565. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_1))) ? DMA2_Channel1 : \
  566. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_2))) ? DMA1_Channel2 : \
  567. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_2))) ? DMA2_Channel2 : \
  568. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_3))) ? DMA1_Channel3 : \
  569. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_3))) ? DMA2_Channel3 : \
  570. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_4))) ? DMA1_Channel4 : \
  571. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_4))) ? DMA2_Channel4 : \
  572. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_5))) ? DMA1_Channel5 : \
  573. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_5))) ? DMA2_Channel5 : \
  574. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_6))) ? DMA1_Channel6 : \
  575. DMA1_Channel7)
  576. #endif
  577. #else
  578. #define __LL_DMA_GET_CHANNEL_INSTANCE(__DMA_INSTANCE__, __CHANNEL__) \
  579. ((((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_1))) ? DMA1_Channel1 : \
  580. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_2))) ? DMA1_Channel2 : \
  581. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_3))) ? DMA1_Channel3 : \
  582. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_4))) ? DMA1_Channel4 : \
  583. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_5))) ? DMA1_Channel5 : \
  584. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__CHANNEL__) == ((uint32_t)LL_DMA_CHANNEL_6))) ? DMA1_Channel6 : \
  585. DMA1_Channel7)
  586. #endif
  587. /**
  588. * @}
  589. */
  590. /**
  591. * @}
  592. */
  593. /* Exported functions --------------------------------------------------------*/
  594. /** @defgroup DMA_LL_Exported_Functions DMA Exported Functions
  595. * @{
  596. */
  597. /** @defgroup DMA_LL_EF_Configuration Configuration
  598. * @{
  599. */
  600. /**
  601. * @brief Enable DMA channel.
  602. * @rmtoll CCR EN LL_DMA_EnableChannel
  603. * @param DMAx DMAx Instance
  604. * @param Channel This parameter can be one of the following values:
  605. * @arg @ref LL_DMA_CHANNEL_1
  606. * @arg @ref LL_DMA_CHANNEL_2
  607. * @arg @ref LL_DMA_CHANNEL_3
  608. * @arg @ref LL_DMA_CHANNEL_4
  609. * @arg @ref LL_DMA_CHANNEL_5
  610. * @arg @ref LL_DMA_CHANNEL_6
  611. * @arg @ref LL_DMA_CHANNEL_7
  612. * @retval None
  613. */
  614. __STATIC_INLINE void LL_DMA_EnableChannel(DMA_TypeDef *DMAx, uint32_t Channel)
  615. {
  616. SET_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_EN);
  617. }
  618. /**
  619. * @brief Disable DMA channel.
  620. * @rmtoll CCR EN LL_DMA_DisableChannel
  621. * @param DMAx DMAx Instance
  622. * @param Channel This parameter can be one of the following values:
  623. * @arg @ref LL_DMA_CHANNEL_1
  624. * @arg @ref LL_DMA_CHANNEL_2
  625. * @arg @ref LL_DMA_CHANNEL_3
  626. * @arg @ref LL_DMA_CHANNEL_4
  627. * @arg @ref LL_DMA_CHANNEL_5
  628. * @arg @ref LL_DMA_CHANNEL_6
  629. * @arg @ref LL_DMA_CHANNEL_7
  630. * @retval None
  631. */
  632. __STATIC_INLINE void LL_DMA_DisableChannel(DMA_TypeDef *DMAx, uint32_t Channel)
  633. {
  634. CLEAR_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_EN);
  635. }
  636. /**
  637. * @brief Check if DMA channel is enabled or disabled.
  638. * @rmtoll CCR EN LL_DMA_IsEnabledChannel
  639. * @param DMAx DMAx Instance
  640. * @param Channel This parameter can be one of the following values:
  641. * @arg @ref LL_DMA_CHANNEL_1
  642. * @arg @ref LL_DMA_CHANNEL_2
  643. * @arg @ref LL_DMA_CHANNEL_3
  644. * @arg @ref LL_DMA_CHANNEL_4
  645. * @arg @ref LL_DMA_CHANNEL_5
  646. * @arg @ref LL_DMA_CHANNEL_6
  647. * @arg @ref LL_DMA_CHANNEL_7
  648. * @retval State of bit (1 or 0).
  649. */
  650. __STATIC_INLINE uint32_t LL_DMA_IsEnabledChannel(DMA_TypeDef *DMAx, uint32_t Channel)
  651. {
  652. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  653. DMA_CCR_EN) == (DMA_CCR_EN));
  654. }
  655. /**
  656. * @brief Configure all parameters link to DMA transfer.
  657. * @rmtoll CCR DIR LL_DMA_ConfigTransfer\n
  658. * CCR MEM2MEM LL_DMA_ConfigTransfer\n
  659. * CCR CIRC LL_DMA_ConfigTransfer\n
  660. * CCR PINC LL_DMA_ConfigTransfer\n
  661. * CCR MINC LL_DMA_ConfigTransfer\n
  662. * CCR PSIZE LL_DMA_ConfigTransfer\n
  663. * CCR MSIZE LL_DMA_ConfigTransfer\n
  664. * CCR PL LL_DMA_ConfigTransfer
  665. * @param DMAx DMAx Instance
  666. * @param Channel This parameter can be one of the following values:
  667. * @arg @ref LL_DMA_CHANNEL_1
  668. * @arg @ref LL_DMA_CHANNEL_2
  669. * @arg @ref LL_DMA_CHANNEL_3
  670. * @arg @ref LL_DMA_CHANNEL_4
  671. * @arg @ref LL_DMA_CHANNEL_5
  672. * @arg @ref LL_DMA_CHANNEL_6
  673. * @arg @ref LL_DMA_CHANNEL_7
  674. * @param Configuration This parameter must be a combination of all the following values:
  675. * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY or @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH or @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY
  676. * @arg @ref LL_DMA_MODE_NORMAL or @ref LL_DMA_MODE_CIRCULAR
  677. * @arg @ref LL_DMA_PERIPH_INCREMENT or @ref LL_DMA_PERIPH_NOINCREMENT
  678. * @arg @ref LL_DMA_MEMORY_INCREMENT or @ref LL_DMA_MEMORY_NOINCREMENT
  679. * @arg @ref LL_DMA_PDATAALIGN_BYTE or @ref LL_DMA_PDATAALIGN_HALFWORD or @ref LL_DMA_PDATAALIGN_WORD
  680. * @arg @ref LL_DMA_MDATAALIGN_BYTE or @ref LL_DMA_MDATAALIGN_HALFWORD or @ref LL_DMA_MDATAALIGN_WORD
  681. * @arg @ref LL_DMA_PRIORITY_LOW or @ref LL_DMA_PRIORITY_MEDIUM or @ref LL_DMA_PRIORITY_HIGH or @ref LL_DMA_PRIORITY_VERYHIGH
  682. * @retval None
  683. */
  684. __STATIC_INLINE void LL_DMA_ConfigTransfer(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t Configuration)
  685. {
  686. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  687. DMA_CCR_DIR | DMA_CCR_MEM2MEM | DMA_CCR_CIRC | DMA_CCR_PINC | DMA_CCR_MINC | DMA_CCR_PSIZE | DMA_CCR_MSIZE | DMA_CCR_PL,
  688. Configuration);
  689. }
  690. /**
  691. * @brief Set Data transfer direction (read from peripheral or from memory).
  692. * @rmtoll CCR DIR LL_DMA_SetDataTransferDirection\n
  693. * CCR MEM2MEM LL_DMA_SetDataTransferDirection
  694. * @param DMAx DMAx Instance
  695. * @param Channel This parameter can be one of the following values:
  696. * @arg @ref LL_DMA_CHANNEL_1
  697. * @arg @ref LL_DMA_CHANNEL_2
  698. * @arg @ref LL_DMA_CHANNEL_3
  699. * @arg @ref LL_DMA_CHANNEL_4
  700. * @arg @ref LL_DMA_CHANNEL_5
  701. * @arg @ref LL_DMA_CHANNEL_6
  702. * @arg @ref LL_DMA_CHANNEL_7
  703. * @param Direction This parameter can be one of the following values:
  704. * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY
  705. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH
  706. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY
  707. * @retval None
  708. */
  709. __STATIC_INLINE void LL_DMA_SetDataTransferDirection(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t Direction)
  710. {
  711. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  712. DMA_CCR_DIR | DMA_CCR_MEM2MEM, Direction);
  713. }
  714. /**
  715. * @brief Get Data transfer direction (read from peripheral or from memory).
  716. * @rmtoll CCR DIR LL_DMA_GetDataTransferDirection\n
  717. * CCR MEM2MEM LL_DMA_GetDataTransferDirection
  718. * @param DMAx DMAx Instance
  719. * @param Channel This parameter can be one of the following values:
  720. * @arg @ref LL_DMA_CHANNEL_1
  721. * @arg @ref LL_DMA_CHANNEL_2
  722. * @arg @ref LL_DMA_CHANNEL_3
  723. * @arg @ref LL_DMA_CHANNEL_4
  724. * @arg @ref LL_DMA_CHANNEL_5
  725. * @arg @ref LL_DMA_CHANNEL_6
  726. * @arg @ref LL_DMA_CHANNEL_7
  727. * @retval Returned value can be one of the following values:
  728. * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY
  729. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH
  730. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY
  731. */
  732. __STATIC_INLINE uint32_t LL_DMA_GetDataTransferDirection(DMA_TypeDef *DMAx, uint32_t Channel)
  733. {
  734. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  735. DMA_CCR_DIR | DMA_CCR_MEM2MEM));
  736. }
  737. /**
  738. * @brief Set DMA mode circular or normal.
  739. * @note The circular buffer mode cannot be used if the memory-to-memory
  740. * data transfer is configured on the selected Channel.
  741. * @rmtoll CCR CIRC LL_DMA_SetMode
  742. * @param DMAx DMAx Instance
  743. * @param Channel This parameter can be one of the following values:
  744. * @arg @ref LL_DMA_CHANNEL_1
  745. * @arg @ref LL_DMA_CHANNEL_2
  746. * @arg @ref LL_DMA_CHANNEL_3
  747. * @arg @ref LL_DMA_CHANNEL_4
  748. * @arg @ref LL_DMA_CHANNEL_5
  749. * @arg @ref LL_DMA_CHANNEL_6
  750. * @arg @ref LL_DMA_CHANNEL_7
  751. * @param Mode This parameter can be one of the following values:
  752. * @arg @ref LL_DMA_MODE_NORMAL
  753. * @arg @ref LL_DMA_MODE_CIRCULAR
  754. * @retval None
  755. */
  756. __STATIC_INLINE void LL_DMA_SetMode(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t Mode)
  757. {
  758. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_CIRC,
  759. Mode);
  760. }
  761. /**
  762. * @brief Get DMA mode circular or normal.
  763. * @rmtoll CCR CIRC LL_DMA_GetMode
  764. * @param DMAx DMAx Instance
  765. * @param Channel This parameter can be one of the following values:
  766. * @arg @ref LL_DMA_CHANNEL_1
  767. * @arg @ref LL_DMA_CHANNEL_2
  768. * @arg @ref LL_DMA_CHANNEL_3
  769. * @arg @ref LL_DMA_CHANNEL_4
  770. * @arg @ref LL_DMA_CHANNEL_5
  771. * @arg @ref LL_DMA_CHANNEL_6
  772. * @arg @ref LL_DMA_CHANNEL_7
  773. * @retval Returned value can be one of the following values:
  774. * @arg @ref LL_DMA_MODE_NORMAL
  775. * @arg @ref LL_DMA_MODE_CIRCULAR
  776. */
  777. __STATIC_INLINE uint32_t LL_DMA_GetMode(DMA_TypeDef *DMAx, uint32_t Channel)
  778. {
  779. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  780. DMA_CCR_CIRC));
  781. }
  782. /**
  783. * @brief Set Peripheral increment mode.
  784. * @rmtoll CCR PINC LL_DMA_SetPeriphIncMode
  785. * @param DMAx DMAx Instance
  786. * @param Channel This parameter can be one of the following values:
  787. * @arg @ref LL_DMA_CHANNEL_1
  788. * @arg @ref LL_DMA_CHANNEL_2
  789. * @arg @ref LL_DMA_CHANNEL_3
  790. * @arg @ref LL_DMA_CHANNEL_4
  791. * @arg @ref LL_DMA_CHANNEL_5
  792. * @arg @ref LL_DMA_CHANNEL_6
  793. * @arg @ref LL_DMA_CHANNEL_7
  794. * @param PeriphOrM2MSrcIncMode This parameter can be one of the following values:
  795. * @arg @ref LL_DMA_PERIPH_INCREMENT
  796. * @arg @ref LL_DMA_PERIPH_NOINCREMENT
  797. * @retval None
  798. */
  799. __STATIC_INLINE void LL_DMA_SetPeriphIncMode(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t PeriphOrM2MSrcIncMode)
  800. {
  801. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_PINC,
  802. PeriphOrM2MSrcIncMode);
  803. }
  804. /**
  805. * @brief Get Peripheral increment mode.
  806. * @rmtoll CCR PINC LL_DMA_GetPeriphIncMode
  807. * @param DMAx DMAx Instance
  808. * @param Channel This parameter can be one of the following values:
  809. * @arg @ref LL_DMA_CHANNEL_1
  810. * @arg @ref LL_DMA_CHANNEL_2
  811. * @arg @ref LL_DMA_CHANNEL_3
  812. * @arg @ref LL_DMA_CHANNEL_4
  813. * @arg @ref LL_DMA_CHANNEL_5
  814. * @arg @ref LL_DMA_CHANNEL_6
  815. * @arg @ref LL_DMA_CHANNEL_7
  816. * @retval Returned value can be one of the following values:
  817. * @arg @ref LL_DMA_PERIPH_INCREMENT
  818. * @arg @ref LL_DMA_PERIPH_NOINCREMENT
  819. */
  820. __STATIC_INLINE uint32_t LL_DMA_GetPeriphIncMode(DMA_TypeDef *DMAx, uint32_t Channel)
  821. {
  822. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  823. DMA_CCR_PINC));
  824. }
  825. /**
  826. * @brief Set Memory increment mode.
  827. * @rmtoll CCR MINC LL_DMA_SetMemoryIncMode
  828. * @param DMAx DMAx Instance
  829. * @param Channel This parameter can be one of the following values:
  830. * @arg @ref LL_DMA_CHANNEL_1
  831. * @arg @ref LL_DMA_CHANNEL_2
  832. * @arg @ref LL_DMA_CHANNEL_3
  833. * @arg @ref LL_DMA_CHANNEL_4
  834. * @arg @ref LL_DMA_CHANNEL_5
  835. * @arg @ref LL_DMA_CHANNEL_6
  836. * @arg @ref LL_DMA_CHANNEL_7
  837. * @param MemoryOrM2MDstIncMode This parameter can be one of the following values:
  838. * @arg @ref LL_DMA_MEMORY_INCREMENT
  839. * @arg @ref LL_DMA_MEMORY_NOINCREMENT
  840. * @retval None
  841. */
  842. __STATIC_INLINE void LL_DMA_SetMemoryIncMode(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t MemoryOrM2MDstIncMode)
  843. {
  844. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_MINC,
  845. MemoryOrM2MDstIncMode);
  846. }
  847. /**
  848. * @brief Get Memory increment mode.
  849. * @rmtoll CCR MINC LL_DMA_GetMemoryIncMode
  850. * @param DMAx DMAx Instance
  851. * @param Channel This parameter can be one of the following values:
  852. * @arg @ref LL_DMA_CHANNEL_1
  853. * @arg @ref LL_DMA_CHANNEL_2
  854. * @arg @ref LL_DMA_CHANNEL_3
  855. * @arg @ref LL_DMA_CHANNEL_4
  856. * @arg @ref LL_DMA_CHANNEL_5
  857. * @arg @ref LL_DMA_CHANNEL_6
  858. * @arg @ref LL_DMA_CHANNEL_7
  859. * @retval Returned value can be one of the following values:
  860. * @arg @ref LL_DMA_MEMORY_INCREMENT
  861. * @arg @ref LL_DMA_MEMORY_NOINCREMENT
  862. */
  863. __STATIC_INLINE uint32_t LL_DMA_GetMemoryIncMode(DMA_TypeDef *DMAx, uint32_t Channel)
  864. {
  865. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  866. DMA_CCR_MINC));
  867. }
  868. /**
  869. * @brief Set Peripheral size.
  870. * @rmtoll CCR PSIZE LL_DMA_SetPeriphSize
  871. * @param DMAx DMAx Instance
  872. * @param Channel This parameter can be one of the following values:
  873. * @arg @ref LL_DMA_CHANNEL_1
  874. * @arg @ref LL_DMA_CHANNEL_2
  875. * @arg @ref LL_DMA_CHANNEL_3
  876. * @arg @ref LL_DMA_CHANNEL_4
  877. * @arg @ref LL_DMA_CHANNEL_5
  878. * @arg @ref LL_DMA_CHANNEL_6
  879. * @arg @ref LL_DMA_CHANNEL_7
  880. * @param PeriphOrM2MSrcDataSize This parameter can be one of the following values:
  881. * @arg @ref LL_DMA_PDATAALIGN_BYTE
  882. * @arg @ref LL_DMA_PDATAALIGN_HALFWORD
  883. * @arg @ref LL_DMA_PDATAALIGN_WORD
  884. * @retval None
  885. */
  886. __STATIC_INLINE void LL_DMA_SetPeriphSize(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t PeriphOrM2MSrcDataSize)
  887. {
  888. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_PSIZE,
  889. PeriphOrM2MSrcDataSize);
  890. }
  891. /**
  892. * @brief Get Peripheral size.
  893. * @rmtoll CCR PSIZE LL_DMA_GetPeriphSize
  894. * @param DMAx DMAx Instance
  895. * @param Channel This parameter can be one of the following values:
  896. * @arg @ref LL_DMA_CHANNEL_1
  897. * @arg @ref LL_DMA_CHANNEL_2
  898. * @arg @ref LL_DMA_CHANNEL_3
  899. * @arg @ref LL_DMA_CHANNEL_4
  900. * @arg @ref LL_DMA_CHANNEL_5
  901. * @arg @ref LL_DMA_CHANNEL_6
  902. * @arg @ref LL_DMA_CHANNEL_7
  903. * @retval Returned value can be one of the following values:
  904. * @arg @ref LL_DMA_PDATAALIGN_BYTE
  905. * @arg @ref LL_DMA_PDATAALIGN_HALFWORD
  906. * @arg @ref LL_DMA_PDATAALIGN_WORD
  907. */
  908. __STATIC_INLINE uint32_t LL_DMA_GetPeriphSize(DMA_TypeDef *DMAx, uint32_t Channel)
  909. {
  910. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  911. DMA_CCR_PSIZE));
  912. }
  913. /**
  914. * @brief Set Memory size.
  915. * @rmtoll CCR MSIZE LL_DMA_SetMemorySize
  916. * @param DMAx DMAx Instance
  917. * @param Channel This parameter can be one of the following values:
  918. * @arg @ref LL_DMA_CHANNEL_1
  919. * @arg @ref LL_DMA_CHANNEL_2
  920. * @arg @ref LL_DMA_CHANNEL_3
  921. * @arg @ref LL_DMA_CHANNEL_4
  922. * @arg @ref LL_DMA_CHANNEL_5
  923. * @arg @ref LL_DMA_CHANNEL_6
  924. * @arg @ref LL_DMA_CHANNEL_7
  925. * @param MemoryOrM2MDstDataSize This parameter can be one of the following values:
  926. * @arg @ref LL_DMA_MDATAALIGN_BYTE
  927. * @arg @ref LL_DMA_MDATAALIGN_HALFWORD
  928. * @arg @ref LL_DMA_MDATAALIGN_WORD
  929. * @retval None
  930. */
  931. __STATIC_INLINE void LL_DMA_SetMemorySize(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t MemoryOrM2MDstDataSize)
  932. {
  933. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_MSIZE,
  934. MemoryOrM2MDstDataSize);
  935. }
  936. /**
  937. * @brief Get Memory size.
  938. * @rmtoll CCR MSIZE LL_DMA_GetMemorySize
  939. * @param DMAx DMAx Instance
  940. * @param Channel This parameter can be one of the following values:
  941. * @arg @ref LL_DMA_CHANNEL_1
  942. * @arg @ref LL_DMA_CHANNEL_2
  943. * @arg @ref LL_DMA_CHANNEL_3
  944. * @arg @ref LL_DMA_CHANNEL_4
  945. * @arg @ref LL_DMA_CHANNEL_5
  946. * @arg @ref LL_DMA_CHANNEL_6
  947. * @arg @ref LL_DMA_CHANNEL_7
  948. * @retval Returned value can be one of the following values:
  949. * @arg @ref LL_DMA_MDATAALIGN_BYTE
  950. * @arg @ref LL_DMA_MDATAALIGN_HALFWORD
  951. * @arg @ref LL_DMA_MDATAALIGN_WORD
  952. */
  953. __STATIC_INLINE uint32_t LL_DMA_GetMemorySize(DMA_TypeDef *DMAx, uint32_t Channel)
  954. {
  955. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  956. DMA_CCR_MSIZE));
  957. }
  958. /**
  959. * @brief Set Channel priority level.
  960. * @rmtoll CCR PL LL_DMA_SetChannelPriorityLevel
  961. * @param DMAx DMAx Instance
  962. * @param Channel This parameter can be one of the following values:
  963. * @arg @ref LL_DMA_CHANNEL_1
  964. * @arg @ref LL_DMA_CHANNEL_2
  965. * @arg @ref LL_DMA_CHANNEL_3
  966. * @arg @ref LL_DMA_CHANNEL_4
  967. * @arg @ref LL_DMA_CHANNEL_5
  968. * @arg @ref LL_DMA_CHANNEL_6
  969. * @arg @ref LL_DMA_CHANNEL_7
  970. * @param Priority This parameter can be one of the following values:
  971. * @arg @ref LL_DMA_PRIORITY_LOW
  972. * @arg @ref LL_DMA_PRIORITY_MEDIUM
  973. * @arg @ref LL_DMA_PRIORITY_HIGH
  974. * @arg @ref LL_DMA_PRIORITY_VERYHIGH
  975. * @retval None
  976. */
  977. __STATIC_INLINE void LL_DMA_SetChannelPriorityLevel(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t Priority)
  978. {
  979. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_PL,
  980. Priority);
  981. }
  982. /**
  983. * @brief Get Channel priority level.
  984. * @rmtoll CCR PL LL_DMA_GetChannelPriorityLevel
  985. * @param DMAx DMAx Instance
  986. * @param Channel This parameter can be one of the following values:
  987. * @arg @ref LL_DMA_CHANNEL_1
  988. * @arg @ref LL_DMA_CHANNEL_2
  989. * @arg @ref LL_DMA_CHANNEL_3
  990. * @arg @ref LL_DMA_CHANNEL_4
  991. * @arg @ref LL_DMA_CHANNEL_5
  992. * @arg @ref LL_DMA_CHANNEL_6
  993. * @arg @ref LL_DMA_CHANNEL_7
  994. * @retval Returned value can be one of the following values:
  995. * @arg @ref LL_DMA_PRIORITY_LOW
  996. * @arg @ref LL_DMA_PRIORITY_MEDIUM
  997. * @arg @ref LL_DMA_PRIORITY_HIGH
  998. * @arg @ref LL_DMA_PRIORITY_VERYHIGH
  999. */
  1000. __STATIC_INLINE uint32_t LL_DMA_GetChannelPriorityLevel(DMA_TypeDef *DMAx, uint32_t Channel)
  1001. {
  1002. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  1003. DMA_CCR_PL));
  1004. }
  1005. /**
  1006. * @brief Set Number of data to transfer.
  1007. * @note This action has no effect if
  1008. * channel is enabled.
  1009. * @rmtoll CNDTR NDT LL_DMA_SetDataLength
  1010. * @param DMAx DMAx Instance
  1011. * @param Channel This parameter can be one of the following values:
  1012. * @arg @ref LL_DMA_CHANNEL_1
  1013. * @arg @ref LL_DMA_CHANNEL_2
  1014. * @arg @ref LL_DMA_CHANNEL_3
  1015. * @arg @ref LL_DMA_CHANNEL_4
  1016. * @arg @ref LL_DMA_CHANNEL_5
  1017. * @arg @ref LL_DMA_CHANNEL_6
  1018. * @arg @ref LL_DMA_CHANNEL_7
  1019. * @param NbData Between Min_Data = 0 and Max_Data = 0x0000FFFF
  1020. * @retval None
  1021. */
  1022. __STATIC_INLINE void LL_DMA_SetDataLength(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t NbData)
  1023. {
  1024. MODIFY_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CNDTR,
  1025. DMA_CNDTR_NDT, NbData);
  1026. }
  1027. /**
  1028. * @brief Get Number of data to transfer.
  1029. * @note Once the channel is enabled, the return value indicate the
  1030. * remaining bytes to be transmitted.
  1031. * @rmtoll CNDTR NDT LL_DMA_GetDataLength
  1032. * @param DMAx DMAx Instance
  1033. * @param Channel This parameter can be one of the following values:
  1034. * @arg @ref LL_DMA_CHANNEL_1
  1035. * @arg @ref LL_DMA_CHANNEL_2
  1036. * @arg @ref LL_DMA_CHANNEL_3
  1037. * @arg @ref LL_DMA_CHANNEL_4
  1038. * @arg @ref LL_DMA_CHANNEL_5
  1039. * @arg @ref LL_DMA_CHANNEL_6
  1040. * @arg @ref LL_DMA_CHANNEL_7
  1041. * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  1042. */
  1043. __STATIC_INLINE uint32_t LL_DMA_GetDataLength(DMA_TypeDef *DMAx, uint32_t Channel)
  1044. {
  1045. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CNDTR,
  1046. DMA_CNDTR_NDT));
  1047. }
  1048. /**
  1049. * @brief Configure the Source and Destination addresses.
  1050. * @note This API must not be called when the DMA channel is enabled.
  1051. * @note Each IP using DMA provides an API to get directly the register adress (LL_PPP_DMA_GetRegAddr).
  1052. * @rmtoll CPAR PA LL_DMA_ConfigAddresses\n
  1053. * CMAR MA LL_DMA_ConfigAddresses
  1054. * @param DMAx DMAx Instance
  1055. * @param Channel This parameter can be one of the following values:
  1056. * @arg @ref LL_DMA_CHANNEL_1
  1057. * @arg @ref LL_DMA_CHANNEL_2
  1058. * @arg @ref LL_DMA_CHANNEL_3
  1059. * @arg @ref LL_DMA_CHANNEL_4
  1060. * @arg @ref LL_DMA_CHANNEL_5
  1061. * @arg @ref LL_DMA_CHANNEL_6
  1062. * @arg @ref LL_DMA_CHANNEL_7
  1063. * @param SrcAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  1064. * @param DstAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  1065. * @param Direction This parameter can be one of the following values:
  1066. * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY
  1067. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH
  1068. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY
  1069. * @retval None
  1070. */
  1071. __STATIC_INLINE void LL_DMA_ConfigAddresses(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t SrcAddress,
  1072. uint32_t DstAddress, uint32_t Direction)
  1073. {
  1074. /* Direction Memory to Periph */
  1075. if (Direction == LL_DMA_DIRECTION_MEMORY_TO_PERIPH)
  1076. {
  1077. WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR, SrcAddress);
  1078. WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR, DstAddress);
  1079. }
  1080. /* Direction Periph to Memory and Memory to Memory */
  1081. else
  1082. {
  1083. WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR, SrcAddress);
  1084. WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR, DstAddress);
  1085. }
  1086. }
  1087. /**
  1088. * @brief Set the Memory address.
  1089. * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only.
  1090. * @note This API must not be called when the DMA channel is enabled.
  1091. * @rmtoll CMAR MA LL_DMA_SetMemoryAddress
  1092. * @param DMAx DMAx Instance
  1093. * @param Channel This parameter can be one of the following values:
  1094. * @arg @ref LL_DMA_CHANNEL_1
  1095. * @arg @ref LL_DMA_CHANNEL_2
  1096. * @arg @ref LL_DMA_CHANNEL_3
  1097. * @arg @ref LL_DMA_CHANNEL_4
  1098. * @arg @ref LL_DMA_CHANNEL_5
  1099. * @arg @ref LL_DMA_CHANNEL_6
  1100. * @arg @ref LL_DMA_CHANNEL_7
  1101. * @param MemoryAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  1102. * @retval None
  1103. */
  1104. __STATIC_INLINE void LL_DMA_SetMemoryAddress(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t MemoryAddress)
  1105. {
  1106. WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR, MemoryAddress);
  1107. }
  1108. /**
  1109. * @brief Set the Peripheral address.
  1110. * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only.
  1111. * @note This API must not be called when the DMA channel is enabled.
  1112. * @rmtoll CPAR PA LL_DMA_SetPeriphAddress
  1113. * @param DMAx DMAx Instance
  1114. * @param Channel This parameter can be one of the following values:
  1115. * @arg @ref LL_DMA_CHANNEL_1
  1116. * @arg @ref LL_DMA_CHANNEL_2
  1117. * @arg @ref LL_DMA_CHANNEL_3
  1118. * @arg @ref LL_DMA_CHANNEL_4
  1119. * @arg @ref LL_DMA_CHANNEL_5
  1120. * @arg @ref LL_DMA_CHANNEL_6
  1121. * @arg @ref LL_DMA_CHANNEL_7
  1122. * @param PeriphAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  1123. * @retval None
  1124. */
  1125. __STATIC_INLINE void LL_DMA_SetPeriphAddress(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t PeriphAddress)
  1126. {
  1127. WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR, PeriphAddress);
  1128. }
  1129. /**
  1130. * @brief Get Memory address.
  1131. * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only.
  1132. * @rmtoll CMAR MA LL_DMA_GetMemoryAddress
  1133. * @param DMAx DMAx Instance
  1134. * @param Channel This parameter can be one of the following values:
  1135. * @arg @ref LL_DMA_CHANNEL_1
  1136. * @arg @ref LL_DMA_CHANNEL_2
  1137. * @arg @ref LL_DMA_CHANNEL_3
  1138. * @arg @ref LL_DMA_CHANNEL_4
  1139. * @arg @ref LL_DMA_CHANNEL_5
  1140. * @arg @ref LL_DMA_CHANNEL_6
  1141. * @arg @ref LL_DMA_CHANNEL_7
  1142. * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  1143. */
  1144. __STATIC_INLINE uint32_t LL_DMA_GetMemoryAddress(DMA_TypeDef *DMAx, uint32_t Channel)
  1145. {
  1146. return (READ_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR));
  1147. }
  1148. /**
  1149. * @brief Get Peripheral address.
  1150. * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only.
  1151. * @rmtoll CPAR PA LL_DMA_GetPeriphAddress
  1152. * @param DMAx DMAx Instance
  1153. * @param Channel This parameter can be one of the following values:
  1154. * @arg @ref LL_DMA_CHANNEL_1
  1155. * @arg @ref LL_DMA_CHANNEL_2
  1156. * @arg @ref LL_DMA_CHANNEL_3
  1157. * @arg @ref LL_DMA_CHANNEL_4
  1158. * @arg @ref LL_DMA_CHANNEL_5
  1159. * @arg @ref LL_DMA_CHANNEL_6
  1160. * @arg @ref LL_DMA_CHANNEL_7
  1161. * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  1162. */
  1163. __STATIC_INLINE uint32_t LL_DMA_GetPeriphAddress(DMA_TypeDef *DMAx, uint32_t Channel)
  1164. {
  1165. return (READ_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR));
  1166. }
  1167. /**
  1168. * @brief Set the Memory to Memory Source address.
  1169. * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only.
  1170. * @note This API must not be called when the DMA channel is enabled.
  1171. * @rmtoll CPAR PA LL_DMA_SetM2MSrcAddress
  1172. * @param DMAx DMAx Instance
  1173. * @param Channel This parameter can be one of the following values:
  1174. * @arg @ref LL_DMA_CHANNEL_1
  1175. * @arg @ref LL_DMA_CHANNEL_2
  1176. * @arg @ref LL_DMA_CHANNEL_3
  1177. * @arg @ref LL_DMA_CHANNEL_4
  1178. * @arg @ref LL_DMA_CHANNEL_5
  1179. * @arg @ref LL_DMA_CHANNEL_6
  1180. * @arg @ref LL_DMA_CHANNEL_7
  1181. * @param MemoryAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  1182. * @retval None
  1183. */
  1184. __STATIC_INLINE void LL_DMA_SetM2MSrcAddress(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t MemoryAddress)
  1185. {
  1186. WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR, MemoryAddress);
  1187. }
  1188. /**
  1189. * @brief Set the Memory to Memory Destination address.
  1190. * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only.
  1191. * @note This API must not be called when the DMA channel is enabled.
  1192. * @rmtoll CMAR MA LL_DMA_SetM2MDstAddress
  1193. * @param DMAx DMAx Instance
  1194. * @param Channel This parameter can be one of the following values:
  1195. * @arg @ref LL_DMA_CHANNEL_1
  1196. * @arg @ref LL_DMA_CHANNEL_2
  1197. * @arg @ref LL_DMA_CHANNEL_3
  1198. * @arg @ref LL_DMA_CHANNEL_4
  1199. * @arg @ref LL_DMA_CHANNEL_5
  1200. * @arg @ref LL_DMA_CHANNEL_6
  1201. * @arg @ref LL_DMA_CHANNEL_7
  1202. * @param MemoryAddress Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  1203. * @retval None
  1204. */
  1205. __STATIC_INLINE void LL_DMA_SetM2MDstAddress(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t MemoryAddress)
  1206. {
  1207. WRITE_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR, MemoryAddress);
  1208. }
  1209. /**
  1210. * @brief Get the Memory to Memory Source address.
  1211. * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only.
  1212. * @rmtoll CPAR PA LL_DMA_GetM2MSrcAddress
  1213. * @param DMAx DMAx Instance
  1214. * @param Channel This parameter can be one of the following values:
  1215. * @arg @ref LL_DMA_CHANNEL_1
  1216. * @arg @ref LL_DMA_CHANNEL_2
  1217. * @arg @ref LL_DMA_CHANNEL_3
  1218. * @arg @ref LL_DMA_CHANNEL_4
  1219. * @arg @ref LL_DMA_CHANNEL_5
  1220. * @arg @ref LL_DMA_CHANNEL_6
  1221. * @arg @ref LL_DMA_CHANNEL_7
  1222. * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  1223. */
  1224. __STATIC_INLINE uint32_t LL_DMA_GetM2MSrcAddress(DMA_TypeDef *DMAx, uint32_t Channel)
  1225. {
  1226. return (READ_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CPAR));
  1227. }
  1228. /**
  1229. * @brief Get the Memory to Memory Destination address.
  1230. * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only.
  1231. * @rmtoll CMAR MA LL_DMA_GetM2MDstAddress
  1232. * @param DMAx DMAx Instance
  1233. * @param Channel This parameter can be one of the following values:
  1234. * @arg @ref LL_DMA_CHANNEL_1
  1235. * @arg @ref LL_DMA_CHANNEL_2
  1236. * @arg @ref LL_DMA_CHANNEL_3
  1237. * @arg @ref LL_DMA_CHANNEL_4
  1238. * @arg @ref LL_DMA_CHANNEL_5
  1239. * @arg @ref LL_DMA_CHANNEL_6
  1240. * @arg @ref LL_DMA_CHANNEL_7
  1241. * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF
  1242. */
  1243. __STATIC_INLINE uint32_t LL_DMA_GetM2MDstAddress(DMA_TypeDef *DMAx, uint32_t Channel)
  1244. {
  1245. return (READ_REG(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CMAR));
  1246. }
  1247. #if defined(DMAMUX1)
  1248. /**
  1249. * @brief Set DMA request for DMA Channels on DMAMUX Channel x.
  1250. * @note DMAMUX channel 0 to 6 are mapped to DMA1 channel 1 to 7.
  1251. * DMAMUX channel 7 to 13 are mapped to DMA2 channel 1 to 7.
  1252. * @rmtoll CxCR DMAREQ_ID LL_DMA_SetPeriphRequest
  1253. * @param DMAx DMAx Instance
  1254. * @param Channel This parameter can be one of the following values:
  1255. * @arg @ref LL_DMA_CHANNEL_1
  1256. * @arg @ref LL_DMA_CHANNEL_2
  1257. * @arg @ref LL_DMA_CHANNEL_3
  1258. * @arg @ref LL_DMA_CHANNEL_4
  1259. * @arg @ref LL_DMA_CHANNEL_5
  1260. * @arg @ref LL_DMA_CHANNEL_6
  1261. * @arg @ref LL_DMA_CHANNEL_7
  1262. * @param Request This parameter can be one of the following values:
  1263. * @arg @ref LL_DMAMUX_REQUEST_MEM2MEM
  1264. * @arg @ref LL_DMAMUX_REQUEST_GENERATOR0
  1265. * @arg @ref LL_DMAMUX_REQUEST_GENERATOR1
  1266. * @arg @ref LL_DMAMUX_REQUEST_GENERATOR2
  1267. * @arg @ref LL_DMAMUX_REQUEST_GENERATOR3
  1268. * @arg @ref LL_DMAMUX_REQUEST_ADC1
  1269. * @arg @ref LL_DMAMUX_REQUEST_DAC1_CH1
  1270. * @arg @ref LL_DMAMUX_REQUEST_DAC1_CH2
  1271. * @arg @ref LL_DMAMUX_REQUEST_TIM6_UP
  1272. * @arg @ref LL_DMAMUX_REQUEST_TIM7_UP
  1273. * @arg @ref LL_DMAMUX_REQUEST_SPI1_RX
  1274. * @arg @ref LL_DMAMUX_REQUEST_SPI1_TX
  1275. * @arg @ref LL_DMAMUX_REQUEST_SPI2_RX
  1276. * @arg @ref LL_DMAMUX_REQUEST_SPI2_TX
  1277. * @arg @ref LL_DMAMUX_REQUEST_SPI3_RX
  1278. * @arg @ref LL_DMAMUX_REQUEST_SPI3_TX
  1279. * @arg @ref LL_DMAMUX_REQUEST_I2C1_RX
  1280. * @arg @ref LL_DMAMUX_REQUEST_I2C1_TX
  1281. * @arg @ref LL_DMAMUX_REQUEST_I2C2_RX
  1282. * @arg @ref LL_DMAMUX_REQUEST_I2C2_TX
  1283. * @arg @ref LL_DMAMUX_REQUEST_I2C3_RX
  1284. * @arg @ref LL_DMAMUX_REQUEST_I2C3_TX
  1285. * @arg @ref LL_DMAMUX_REQUEST_I2C4_RX
  1286. * @arg @ref LL_DMAMUX_REQUEST_I2C4_TX
  1287. * @arg @ref LL_DMAMUX_REQUEST_USART1_RX
  1288. * @arg @ref LL_DMAMUX_REQUEST_USART1_TX
  1289. * @arg @ref LL_DMAMUX_REQUEST_USART2_RX
  1290. * @arg @ref LL_DMAMUX_REQUEST_USART2_TX
  1291. * @arg @ref LL_DMAMUX_REQUEST_USART3_RX
  1292. * @arg @ref LL_DMAMUX_REQUEST_USART3_TX
  1293. * @arg @ref LL_DMAMUX_REQUEST_UART4_RX
  1294. * @arg @ref LL_DMAMUX_REQUEST_UART4_TX
  1295. * @arg @ref LL_DMAMUX_REQUEST_UART5_RX
  1296. * @arg @ref LL_DMAMUX_REQUEST_UART5_TX
  1297. * @arg @ref LL_DMAMUX_REQUEST_LPUART1_RX
  1298. * @arg @ref LL_DMAMUX_REQUEST_LPUART1_TX
  1299. * @arg @ref LL_DMAMUX_REQUEST_SAI1_A
  1300. * @arg @ref LL_DMAMUX_REQUEST_SAI1_B
  1301. * @arg @ref LL_DMAMUX_REQUEST_SAI2_A
  1302. * @arg @ref LL_DMAMUX_REQUEST_SAI2_B
  1303. * @arg @ref LL_DMAMUX_REQUEST_OSPI1
  1304. * @arg @ref LL_DMAMUX_REQUEST_OSPI2
  1305. * @arg @ref LL_DMAMUX_REQUEST_TIM1_CH1
  1306. * @arg @ref LL_DMAMUX_REQUEST_TIM1_CH2
  1307. * @arg @ref LL_DMAMUX_REQUEST_TIM1_CH3
  1308. * @arg @ref LL_DMAMUX_REQUEST_TIM1_CH4
  1309. * @arg @ref LL_DMAMUX_REQUEST_TIM1_UP
  1310. * @arg @ref LL_DMAMUX_REQUEST_TIM1_TRIG
  1311. * @arg @ref LL_DMAMUX_REQUEST_TIM1_COM
  1312. * @arg @ref LL_DMAMUX_REQUEST_TIM8_CH1
  1313. * @arg @ref LL_DMAMUX_REQUEST_TIM8_CH2
  1314. * @arg @ref LL_DMAMUX_REQUEST_TIM8_CH3
  1315. * @arg @ref LL_DMAMUX_REQUEST_TIM8_CH4
  1316. * @arg @ref LL_DMAMUX_REQUEST_TIM8_UP
  1317. * @arg @ref LL_DMAMUX_REQUEST_TIM8_TRIG
  1318. * @arg @ref LL_DMAMUX_REQUEST_TIM8_COM
  1319. * @arg @ref LL_DMAMUX_REQUEST_TIM2_CH1
  1320. * @arg @ref LL_DMAMUX_REQUEST_TIM2_CH2
  1321. * @arg @ref LL_DMAMUX_REQUEST_TIM2_CH3
  1322. * @arg @ref LL_DMAMUX_REQUEST_TIM2_CH4
  1323. * @arg @ref LL_DMAMUX_REQUEST_TIM2_UP
  1324. * @arg @ref LL_DMAMUX_REQUEST_TIM3_CH1
  1325. * @arg @ref LL_DMAMUX_REQUEST_TIM3_CH2
  1326. * @arg @ref LL_DMAMUX_REQUEST_TIM3_CH3
  1327. * @arg @ref LL_DMAMUX_REQUEST_TIM3_CH4
  1328. * @arg @ref LL_DMAMUX_REQUEST_TIM3_UP
  1329. * @arg @ref LL_DMAMUX_REQUEST_TIM3_TRIG
  1330. * @arg @ref LL_DMAMUX_REQUEST_TIM4_CH1
  1331. * @arg @ref LL_DMAMUX_REQUEST_TIM4_CH2
  1332. * @arg @ref LL_DMAMUX_REQUEST_TIM4_CH3
  1333. * @arg @ref LL_DMAMUX_REQUEST_TIM4_CH4
  1334. * @arg @ref LL_DMAMUX_REQUEST_TIM4_UP
  1335. * @arg @ref LL_DMAMUX_REQUEST_TIM5_CH1
  1336. * @arg @ref LL_DMAMUX_REQUEST_TIM5_CH2
  1337. * @arg @ref LL_DMAMUX_REQUEST_TIM5_CH3
  1338. * @arg @ref LL_DMAMUX_REQUEST_TIM5_CH4
  1339. * @arg @ref LL_DMAMUX_REQUEST_TIM5_UP
  1340. * @arg @ref LL_DMAMUX_REQUEST_TIM5_TRIG
  1341. * @arg @ref LL_DMAMUX_REQUEST_TIM15_CH1
  1342. * @arg @ref LL_DMAMUX_REQUEST_TIM15_UP
  1343. * @arg @ref LL_DMAMUX_REQUEST_TIM15_TRIG
  1344. * @arg @ref LL_DMAMUX_REQUEST_TIM15_COM
  1345. * @arg @ref LL_DMAMUX_REQUEST_TIM16_CH1
  1346. * @arg @ref LL_DMAMUX_REQUEST_TIM16_UP
  1347. * @arg @ref LL_DMAMUX_REQUEST_TIM17_CH1
  1348. * @arg @ref LL_DMAMUX_REQUEST_TIM17_UP
  1349. * @arg @ref LL_DMAMUX_REQUEST_DFSDM1_FLT0
  1350. * @arg @ref LL_DMAMUX_REQUEST_DFSDM1_FLT1
  1351. * @arg @ref LL_DMAMUX_REQUEST_DFSDM1_FLT2
  1352. * @arg @ref LL_DMAMUX_REQUEST_DFSDM1_FLT3
  1353. * @arg @ref LL_DMAMUX_REQUEST_DCMI
  1354. * @arg @ref LL_DMAMUX_REQUEST_AES_IN
  1355. * @arg @ref LL_DMAMUX_REQUEST_AES_OUT
  1356. * @arg @ref LL_DMAMUX_REQUEST_HASH_IN
  1357. * @retval None
  1358. */
  1359. __STATIC_INLINE void LL_DMA_SetPeriphRequest(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t Request)
  1360. {
  1361. MODIFY_REG(((DMAMUX_Channel_TypeDef*)(uint32_t)((uint32_t)DMAMUX1_Channel0 + (DMAMUX_CCR_SIZE*(Channel-1U)) + (uint32_t)(DMAMUX_CCR_SIZE*__LL_DMA_INSTANCE_TO_DMAMUX_CHANNEL(DMAx))))->CCR, DMAMUX_CxCR_DMAREQ_ID, Request);
  1362. }
  1363. /**
  1364. * @brief Get DMA request for DMA Channels on DMAMUX Channel x.
  1365. * @note DMAMUX channel 0 to 6 are mapped to DMA1 channel 1 to 7.
  1366. * DMAMUX channel 7 to 13 are mapped to DMA2 channel 1 to 7.
  1367. * @rmtoll CxCR DMAREQ_ID LL_DMA_GetPeriphRequest
  1368. * @param DMAx DMAx Instance
  1369. * @param Channel This parameter can be one of the following values:
  1370. * @arg @ref LL_DMA_CHANNEL_1
  1371. * @arg @ref LL_DMA_CHANNEL_2
  1372. * @arg @ref LL_DMA_CHANNEL_3
  1373. * @arg @ref LL_DMA_CHANNEL_4
  1374. * @arg @ref LL_DMA_CHANNEL_5
  1375. * @arg @ref LL_DMA_CHANNEL_6
  1376. * @arg @ref LL_DMA_CHANNEL_7
  1377. * @retval Returned value can be one of the following values:
  1378. * @arg @ref LL_DMAMUX_REQUEST_MEM2MEM
  1379. * @arg @ref LL_DMAMUX_REQUEST_GENERATOR0
  1380. * @arg @ref LL_DMAMUX_REQUEST_GENERATOR1
  1381. * @arg @ref LL_DMAMUX_REQUEST_GENERATOR2
  1382. * @arg @ref LL_DMAMUX_REQUEST_GENERATOR3
  1383. * @arg @ref LL_DMAMUX_REQUEST_ADC1
  1384. * @arg @ref LL_DMAMUX_REQUEST_DAC1_CH1
  1385. * @arg @ref LL_DMAMUX_REQUEST_DAC1_CH2
  1386. * @arg @ref LL_DMAMUX_REQUEST_TIM6_UP
  1387. * @arg @ref LL_DMAMUX_REQUEST_TIM7_UP
  1388. * @arg @ref LL_DMAMUX_REQUEST_SPI1_RX
  1389. * @arg @ref LL_DMAMUX_REQUEST_SPI1_TX
  1390. * @arg @ref LL_DMAMUX_REQUEST_SPI2_RX
  1391. * @arg @ref LL_DMAMUX_REQUEST_SPI2_TX
  1392. * @arg @ref LL_DMAMUX_REQUEST_SPI3_RX
  1393. * @arg @ref LL_DMAMUX_REQUEST_SPI3_TX
  1394. * @arg @ref LL_DMAMUX_REQUEST_I2C1_RX
  1395. * @arg @ref LL_DMAMUX_REQUEST_I2C1_TX
  1396. * @arg @ref LL_DMAMUX_REQUEST_I2C2_RX
  1397. * @arg @ref LL_DMAMUX_REQUEST_I2C2_TX
  1398. * @arg @ref LL_DMAMUX_REQUEST_I2C3_RX
  1399. * @arg @ref LL_DMAMUX_REQUEST_I2C3_TX
  1400. * @arg @ref LL_DMAMUX_REQUEST_I2C4_RX
  1401. * @arg @ref LL_DMAMUX_REQUEST_I2C4_TX
  1402. * @arg @ref LL_DMAMUX_REQUEST_USART1_RX
  1403. * @arg @ref LL_DMAMUX_REQUEST_USART1_TX
  1404. * @arg @ref LL_DMAMUX_REQUEST_USART2_RX
  1405. * @arg @ref LL_DMAMUX_REQUEST_USART2_TX
  1406. * @arg @ref LL_DMAMUX_REQUEST_USART3_RX
  1407. * @arg @ref LL_DMAMUX_REQUEST_USART3_TX
  1408. * @arg @ref LL_DMAMUX_REQUEST_UART4_RX
  1409. * @arg @ref LL_DMAMUX_REQUEST_UART4_TX
  1410. * @arg @ref LL_DMAMUX_REQUEST_UART5_RX
  1411. * @arg @ref LL_DMAMUX_REQUEST_UART5_TX
  1412. * @arg @ref LL_DMAMUX_REQUEST_LPUART1_RX
  1413. * @arg @ref LL_DMAMUX_REQUEST_LPUART1_TX
  1414. * @arg @ref LL_DMAMUX_REQUEST_SAI1_A
  1415. * @arg @ref LL_DMAMUX_REQUEST_SAI1_B
  1416. * @arg @ref LL_DMAMUX_REQUEST_SAI2_A
  1417. * @arg @ref LL_DMAMUX_REQUEST_SAI2_B
  1418. * @arg @ref LL_DMAMUX_REQUEST_OSPI1
  1419. * @arg @ref LL_DMAMUX_REQUEST_OSPI2
  1420. * @arg @ref LL_DMAMUX_REQUEST_TIM1_CH1
  1421. * @arg @ref LL_DMAMUX_REQUEST_TIM1_CH2
  1422. * @arg @ref LL_DMAMUX_REQUEST_TIM1_CH3
  1423. * @arg @ref LL_DMAMUX_REQUEST_TIM1_CH4
  1424. * @arg @ref LL_DMAMUX_REQUEST_TIM1_UP
  1425. * @arg @ref LL_DMAMUX_REQUEST_TIM1_TRIG
  1426. * @arg @ref LL_DMAMUX_REQUEST_TIM1_COM
  1427. * @arg @ref LL_DMAMUX_REQUEST_TIM8_CH1
  1428. * @arg @ref LL_DMAMUX_REQUEST_TIM8_CH2
  1429. * @arg @ref LL_DMAMUX_REQUEST_TIM8_CH3
  1430. * @arg @ref LL_DMAMUX_REQUEST_TIM8_CH4
  1431. * @arg @ref LL_DMAMUX_REQUEST_TIM8_UP
  1432. * @arg @ref LL_DMAMUX_REQUEST_TIM8_TRIG
  1433. * @arg @ref LL_DMAMUX_REQUEST_TIM8_COM
  1434. * @arg @ref LL_DMAMUX_REQUEST_TIM2_CH1
  1435. * @arg @ref LL_DMAMUX_REQUEST_TIM2_CH2
  1436. * @arg @ref LL_DMAMUX_REQUEST_TIM2_CH3
  1437. * @arg @ref LL_DMAMUX_REQUEST_TIM2_CH4
  1438. * @arg @ref LL_DMAMUX_REQUEST_TIM2_UP
  1439. * @arg @ref LL_DMAMUX_REQUEST_TIM3_CH1
  1440. * @arg @ref LL_DMAMUX_REQUEST_TIM3_CH2
  1441. * @arg @ref LL_DMAMUX_REQUEST_TIM3_CH3
  1442. * @arg @ref LL_DMAMUX_REQUEST_TIM3_CH4
  1443. * @arg @ref LL_DMAMUX_REQUEST_TIM3_UP
  1444. * @arg @ref LL_DMAMUX_REQUEST_TIM3_TRIG
  1445. * @arg @ref LL_DMAMUX_REQUEST_TIM4_CH1
  1446. * @arg @ref LL_DMAMUX_REQUEST_TIM4_CH2
  1447. * @arg @ref LL_DMAMUX_REQUEST_TIM4_CH3
  1448. * @arg @ref LL_DMAMUX_REQUEST_TIM4_CH4
  1449. * @arg @ref LL_DMAMUX_REQUEST_TIM4_UP
  1450. * @arg @ref LL_DMAMUX_REQUEST_TIM5_CH1
  1451. * @arg @ref LL_DMAMUX_REQUEST_TIM5_CH2
  1452. * @arg @ref LL_DMAMUX_REQUEST_TIM5_CH3
  1453. * @arg @ref LL_DMAMUX_REQUEST_TIM5_CH4
  1454. * @arg @ref LL_DMAMUX_REQUEST_TIM5_UP
  1455. * @arg @ref LL_DMAMUX_REQUEST_TIM5_TRIG
  1456. * @arg @ref LL_DMAMUX_REQUEST_TIM15_CH1
  1457. * @arg @ref LL_DMAMUX_REQUEST_TIM15_UP
  1458. * @arg @ref LL_DMAMUX_REQUEST_TIM15_TRIG
  1459. * @arg @ref LL_DMAMUX_REQUEST_TIM15_COM
  1460. * @arg @ref LL_DMAMUX_REQUEST_TIM16_CH1
  1461. * @arg @ref LL_DMAMUX_REQUEST_TIM16_UP
  1462. * @arg @ref LL_DMAMUX_REQUEST_TIM17_CH1
  1463. * @arg @ref LL_DMAMUX_REQUEST_TIM17_UP
  1464. * @arg @ref LL_DMAMUX_REQUEST_DFSDM1_FLT0
  1465. * @arg @ref LL_DMAMUX_REQUEST_DFSDM1_FLT1
  1466. * @arg @ref LL_DMAMUX_REQUEST_DFSDM1_FLT2
  1467. * @arg @ref LL_DMAMUX_REQUEST_DFSDM1_FLT3
  1468. * @arg @ref LL_DMAMUX_REQUEST_DCMI
  1469. * @arg @ref LL_DMAMUX_REQUEST_AES_IN
  1470. * @arg @ref LL_DMAMUX_REQUEST_AES_OUT
  1471. * @arg @ref LL_DMAMUX_REQUEST_HASH_IN
  1472. */
  1473. __STATIC_INLINE uint32_t LL_DMA_GetPeriphRequest(DMA_TypeDef *DMAx, uint32_t Channel)
  1474. {
  1475. return (READ_BIT(((DMAMUX_Channel_TypeDef*)((uint32_t)((uint32_t)DMAMUX1_Channel0 + (DMAMUX_CCR_SIZE*(Channel-1U)) + (uint32_t)(DMAMUX_CCR_SIZE*__LL_DMA_INSTANCE_TO_DMAMUX_CHANNEL(DMAx)))))->CCR, DMAMUX_CxCR_DMAREQ_ID));
  1476. }
  1477. #else
  1478. /**
  1479. * @brief Set DMA request for DMA instance on Channel x.
  1480. * @note Please refer to Reference Manual to get the available mapping of Request value link to Channel Selection.
  1481. * @rmtoll CSELR C1S LL_DMA_SetPeriphRequest\n
  1482. * CSELR C2S LL_DMA_SetPeriphRequest\n
  1483. * CSELR C3S LL_DMA_SetPeriphRequest\n
  1484. * CSELR C4S LL_DMA_SetPeriphRequest\n
  1485. * CSELR C5S LL_DMA_SetPeriphRequest\n
  1486. * CSELR C6S LL_DMA_SetPeriphRequest\n
  1487. * CSELR C7S LL_DMA_SetPeriphRequest
  1488. * @param DMAx DMAx Instance
  1489. * @param Channel This parameter can be one of the following values:
  1490. * @arg @ref LL_DMA_CHANNEL_1
  1491. * @arg @ref LL_DMA_CHANNEL_2
  1492. * @arg @ref LL_DMA_CHANNEL_3
  1493. * @arg @ref LL_DMA_CHANNEL_4
  1494. * @arg @ref LL_DMA_CHANNEL_5
  1495. * @arg @ref LL_DMA_CHANNEL_6
  1496. * @arg @ref LL_DMA_CHANNEL_7
  1497. * @param PeriphRequest This parameter can be one of the following values:
  1498. * @arg @ref LL_DMA_REQUEST_0
  1499. * @arg @ref LL_DMA_REQUEST_1
  1500. * @arg @ref LL_DMA_REQUEST_2
  1501. * @arg @ref LL_DMA_REQUEST_3
  1502. * @arg @ref LL_DMA_REQUEST_4
  1503. * @arg @ref LL_DMA_REQUEST_5
  1504. * @arg @ref LL_DMA_REQUEST_6
  1505. * @arg @ref LL_DMA_REQUEST_7
  1506. * @retval None
  1507. */
  1508. __STATIC_INLINE void LL_DMA_SetPeriphRequest(DMA_TypeDef *DMAx, uint32_t Channel, uint32_t PeriphRequest)
  1509. {
  1510. MODIFY_REG(((DMA_Request_TypeDef *)((uint32_t)((uint32_t)DMAx + DMA_CSELR_OFFSET)))->CSELR,
  1511. DMA_CSELR_C1S << ((Channel - 1U) * 4U), PeriphRequest << DMA_POSITION_CSELR_CXS);
  1512. }
  1513. /**
  1514. * @brief Get DMA request for DMA instance on Channel x.
  1515. * @rmtoll CSELR C1S LL_DMA_GetPeriphRequest\n
  1516. * CSELR C2S LL_DMA_GetPeriphRequest\n
  1517. * CSELR C3S LL_DMA_GetPeriphRequest\n
  1518. * CSELR C4S LL_DMA_GetPeriphRequest\n
  1519. * CSELR C5S LL_DMA_GetPeriphRequest\n
  1520. * CSELR C6S LL_DMA_GetPeriphRequest\n
  1521. * CSELR C7S LL_DMA_GetPeriphRequest
  1522. * @param DMAx DMAx Instance
  1523. * @param Channel This parameter can be one of the following values:
  1524. * @arg @ref LL_DMA_CHANNEL_1
  1525. * @arg @ref LL_DMA_CHANNEL_2
  1526. * @arg @ref LL_DMA_CHANNEL_3
  1527. * @arg @ref LL_DMA_CHANNEL_4
  1528. * @arg @ref LL_DMA_CHANNEL_5
  1529. * @arg @ref LL_DMA_CHANNEL_6
  1530. * @arg @ref LL_DMA_CHANNEL_7
  1531. * @retval Returned value can be one of the following values:
  1532. * @arg @ref LL_DMA_REQUEST_0
  1533. * @arg @ref LL_DMA_REQUEST_1
  1534. * @arg @ref LL_DMA_REQUEST_2
  1535. * @arg @ref LL_DMA_REQUEST_3
  1536. * @arg @ref LL_DMA_REQUEST_4
  1537. * @arg @ref LL_DMA_REQUEST_5
  1538. * @arg @ref LL_DMA_REQUEST_6
  1539. * @arg @ref LL_DMA_REQUEST_7
  1540. */
  1541. __STATIC_INLINE uint32_t LL_DMA_GetPeriphRequest(DMA_TypeDef *DMAx, uint32_t Channel)
  1542. {
  1543. return (READ_BIT(((DMA_Request_TypeDef *)((uint32_t)((uint32_t)DMAx + DMA_CSELR_OFFSET)))->CSELR,
  1544. DMA_CSELR_C1S << ((Channel - 1U) * 4U)) >> DMA_POSITION_CSELR_CXS);
  1545. }
  1546. #endif /* DMAMUX1 */
  1547. /**
  1548. * @}
  1549. */
  1550. /** @defgroup DMA_LL_EF_FLAG_Management FLAG_Management
  1551. * @{
  1552. */
  1553. /**
  1554. * @brief Get Channel 1 global interrupt flag.
  1555. * @rmtoll ISR GIF1 LL_DMA_IsActiveFlag_GI1
  1556. * @param DMAx DMAx Instance
  1557. * @retval State of bit (1 or 0).
  1558. */
  1559. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI1(DMA_TypeDef *DMAx)
  1560. {
  1561. return (READ_BIT(DMAx->ISR, DMA_ISR_GIF1) == (DMA_ISR_GIF1));
  1562. }
  1563. /**
  1564. * @brief Get Channel 2 global interrupt flag.
  1565. * @rmtoll ISR GIF2 LL_DMA_IsActiveFlag_GI2
  1566. * @param DMAx DMAx Instance
  1567. * @retval State of bit (1 or 0).
  1568. */
  1569. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI2(DMA_TypeDef *DMAx)
  1570. {
  1571. return (READ_BIT(DMAx->ISR, DMA_ISR_GIF2) == (DMA_ISR_GIF2));
  1572. }
  1573. /**
  1574. * @brief Get Channel 3 global interrupt flag.
  1575. * @rmtoll ISR GIF3 LL_DMA_IsActiveFlag_GI3
  1576. * @param DMAx DMAx Instance
  1577. * @retval State of bit (1 or 0).
  1578. */
  1579. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI3(DMA_TypeDef *DMAx)
  1580. {
  1581. return (READ_BIT(DMAx->ISR, DMA_ISR_GIF3) == (DMA_ISR_GIF3));
  1582. }
  1583. /**
  1584. * @brief Get Channel 4 global interrupt flag.
  1585. * @rmtoll ISR GIF4 LL_DMA_IsActiveFlag_GI4
  1586. * @param DMAx DMAx Instance
  1587. * @retval State of bit (1 or 0).
  1588. */
  1589. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI4(DMA_TypeDef *DMAx)
  1590. {
  1591. return (READ_BIT(DMAx->ISR, DMA_ISR_GIF4) == (DMA_ISR_GIF4));
  1592. }
  1593. /**
  1594. * @brief Get Channel 5 global interrupt flag.
  1595. * @rmtoll ISR GIF5 LL_DMA_IsActiveFlag_GI5
  1596. * @param DMAx DMAx Instance
  1597. * @retval State of bit (1 or 0).
  1598. */
  1599. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI5(DMA_TypeDef *DMAx)
  1600. {
  1601. return (READ_BIT(DMAx->ISR, DMA_ISR_GIF5) == (DMA_ISR_GIF5));
  1602. }
  1603. /**
  1604. * @brief Get Channel 6 global interrupt flag.
  1605. * @rmtoll ISR GIF6 LL_DMA_IsActiveFlag_GI6
  1606. * @param DMAx DMAx Instance
  1607. * @retval State of bit (1 or 0).
  1608. */
  1609. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI6(DMA_TypeDef *DMAx)
  1610. {
  1611. return (READ_BIT(DMAx->ISR, DMA_ISR_GIF6) == (DMA_ISR_GIF6));
  1612. }
  1613. /**
  1614. * @brief Get Channel 7 global interrupt flag.
  1615. * @rmtoll ISR GIF7 LL_DMA_IsActiveFlag_GI7
  1616. * @param DMAx DMAx Instance
  1617. * @retval State of bit (1 or 0).
  1618. */
  1619. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_GI7(DMA_TypeDef *DMAx)
  1620. {
  1621. return (READ_BIT(DMAx->ISR, DMA_ISR_GIF7) == (DMA_ISR_GIF7));
  1622. }
  1623. /**
  1624. * @brief Get Channel 1 transfer complete flag.
  1625. * @rmtoll ISR TCIF1 LL_DMA_IsActiveFlag_TC1
  1626. * @param DMAx DMAx Instance
  1627. * @retval State of bit (1 or 0).
  1628. */
  1629. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC1(DMA_TypeDef *DMAx)
  1630. {
  1631. return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF1) == (DMA_ISR_TCIF1));
  1632. }
  1633. /**
  1634. * @brief Get Channel 2 transfer complete flag.
  1635. * @rmtoll ISR TCIF2 LL_DMA_IsActiveFlag_TC2
  1636. * @param DMAx DMAx Instance
  1637. * @retval State of bit (1 or 0).
  1638. */
  1639. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC2(DMA_TypeDef *DMAx)
  1640. {
  1641. return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF2) == (DMA_ISR_TCIF2));
  1642. }
  1643. /**
  1644. * @brief Get Channel 3 transfer complete flag.
  1645. * @rmtoll ISR TCIF3 LL_DMA_IsActiveFlag_TC3
  1646. * @param DMAx DMAx Instance
  1647. * @retval State of bit (1 or 0).
  1648. */
  1649. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC3(DMA_TypeDef *DMAx)
  1650. {
  1651. return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF3) == (DMA_ISR_TCIF3));
  1652. }
  1653. /**
  1654. * @brief Get Channel 4 transfer complete flag.
  1655. * @rmtoll ISR TCIF4 LL_DMA_IsActiveFlag_TC4
  1656. * @param DMAx DMAx Instance
  1657. * @retval State of bit (1 or 0).
  1658. */
  1659. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC4(DMA_TypeDef *DMAx)
  1660. {
  1661. return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF4) == (DMA_ISR_TCIF4));
  1662. }
  1663. /**
  1664. * @brief Get Channel 5 transfer complete flag.
  1665. * @rmtoll ISR TCIF5 LL_DMA_IsActiveFlag_TC5
  1666. * @param DMAx DMAx Instance
  1667. * @retval State of bit (1 or 0).
  1668. */
  1669. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC5(DMA_TypeDef *DMAx)
  1670. {
  1671. return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF5) == (DMA_ISR_TCIF5));
  1672. }
  1673. /**
  1674. * @brief Get Channel 6 transfer complete flag.
  1675. * @rmtoll ISR TCIF6 LL_DMA_IsActiveFlag_TC6
  1676. * @param DMAx DMAx Instance
  1677. * @retval State of bit (1 or 0).
  1678. */
  1679. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC6(DMA_TypeDef *DMAx)
  1680. {
  1681. return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF6) == (DMA_ISR_TCIF6));
  1682. }
  1683. /**
  1684. * @brief Get Channel 7 transfer complete flag.
  1685. * @rmtoll ISR TCIF7 LL_DMA_IsActiveFlag_TC7
  1686. * @param DMAx DMAx Instance
  1687. * @retval State of bit (1 or 0).
  1688. */
  1689. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC7(DMA_TypeDef *DMAx)
  1690. {
  1691. return (READ_BIT(DMAx->ISR, DMA_ISR_TCIF7) == (DMA_ISR_TCIF7));
  1692. }
  1693. /**
  1694. * @brief Get Channel 1 half transfer flag.
  1695. * @rmtoll ISR HTIF1 LL_DMA_IsActiveFlag_HT1
  1696. * @param DMAx DMAx Instance
  1697. * @retval State of bit (1 or 0).
  1698. */
  1699. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT1(DMA_TypeDef *DMAx)
  1700. {
  1701. return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF1) == (DMA_ISR_HTIF1));
  1702. }
  1703. /**
  1704. * @brief Get Channel 2 half transfer flag.
  1705. * @rmtoll ISR HTIF2 LL_DMA_IsActiveFlag_HT2
  1706. * @param DMAx DMAx Instance
  1707. * @retval State of bit (1 or 0).
  1708. */
  1709. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT2(DMA_TypeDef *DMAx)
  1710. {
  1711. return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF2) == (DMA_ISR_HTIF2));
  1712. }
  1713. /**
  1714. * @brief Get Channel 3 half transfer flag.
  1715. * @rmtoll ISR HTIF3 LL_DMA_IsActiveFlag_HT3
  1716. * @param DMAx DMAx Instance
  1717. * @retval State of bit (1 or 0).
  1718. */
  1719. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT3(DMA_TypeDef *DMAx)
  1720. {
  1721. return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF3) == (DMA_ISR_HTIF3));
  1722. }
  1723. /**
  1724. * @brief Get Channel 4 half transfer flag.
  1725. * @rmtoll ISR HTIF4 LL_DMA_IsActiveFlag_HT4
  1726. * @param DMAx DMAx Instance
  1727. * @retval State of bit (1 or 0).
  1728. */
  1729. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT4(DMA_TypeDef *DMAx)
  1730. {
  1731. return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF4) == (DMA_ISR_HTIF4));
  1732. }
  1733. /**
  1734. * @brief Get Channel 5 half transfer flag.
  1735. * @rmtoll ISR HTIF5 LL_DMA_IsActiveFlag_HT5
  1736. * @param DMAx DMAx Instance
  1737. * @retval State of bit (1 or 0).
  1738. */
  1739. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT5(DMA_TypeDef *DMAx)
  1740. {
  1741. return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF5) == (DMA_ISR_HTIF5));
  1742. }
  1743. /**
  1744. * @brief Get Channel 6 half transfer flag.
  1745. * @rmtoll ISR HTIF6 LL_DMA_IsActiveFlag_HT6
  1746. * @param DMAx DMAx Instance
  1747. * @retval State of bit (1 or 0).
  1748. */
  1749. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT6(DMA_TypeDef *DMAx)
  1750. {
  1751. return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF6) == (DMA_ISR_HTIF6));
  1752. }
  1753. /**
  1754. * @brief Get Channel 7 half transfer flag.
  1755. * @rmtoll ISR HTIF7 LL_DMA_IsActiveFlag_HT7
  1756. * @param DMAx DMAx Instance
  1757. * @retval State of bit (1 or 0).
  1758. */
  1759. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT7(DMA_TypeDef *DMAx)
  1760. {
  1761. return (READ_BIT(DMAx->ISR, DMA_ISR_HTIF7) == (DMA_ISR_HTIF7));
  1762. }
  1763. /**
  1764. * @brief Get Channel 1 transfer error flag.
  1765. * @rmtoll ISR TEIF1 LL_DMA_IsActiveFlag_TE1
  1766. * @param DMAx DMAx Instance
  1767. * @retval State of bit (1 or 0).
  1768. */
  1769. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE1(DMA_TypeDef *DMAx)
  1770. {
  1771. return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF1) == (DMA_ISR_TEIF1));
  1772. }
  1773. /**
  1774. * @brief Get Channel 2 transfer error flag.
  1775. * @rmtoll ISR TEIF2 LL_DMA_IsActiveFlag_TE2
  1776. * @param DMAx DMAx Instance
  1777. * @retval State of bit (1 or 0).
  1778. */
  1779. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE2(DMA_TypeDef *DMAx)
  1780. {
  1781. return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF2) == (DMA_ISR_TEIF2));
  1782. }
  1783. /**
  1784. * @brief Get Channel 3 transfer error flag.
  1785. * @rmtoll ISR TEIF3 LL_DMA_IsActiveFlag_TE3
  1786. * @param DMAx DMAx Instance
  1787. * @retval State of bit (1 or 0).
  1788. */
  1789. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE3(DMA_TypeDef *DMAx)
  1790. {
  1791. return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF3) == (DMA_ISR_TEIF3));
  1792. }
  1793. /**
  1794. * @brief Get Channel 4 transfer error flag.
  1795. * @rmtoll ISR TEIF4 LL_DMA_IsActiveFlag_TE4
  1796. * @param DMAx DMAx Instance
  1797. * @retval State of bit (1 or 0).
  1798. */
  1799. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE4(DMA_TypeDef *DMAx)
  1800. {
  1801. return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF4) == (DMA_ISR_TEIF4));
  1802. }
  1803. /**
  1804. * @brief Get Channel 5 transfer error flag.
  1805. * @rmtoll ISR TEIF5 LL_DMA_IsActiveFlag_TE5
  1806. * @param DMAx DMAx Instance
  1807. * @retval State of bit (1 or 0).
  1808. */
  1809. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE5(DMA_TypeDef *DMAx)
  1810. {
  1811. return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF5) == (DMA_ISR_TEIF5));
  1812. }
  1813. /**
  1814. * @brief Get Channel 6 transfer error flag.
  1815. * @rmtoll ISR TEIF6 LL_DMA_IsActiveFlag_TE6
  1816. * @param DMAx DMAx Instance
  1817. * @retval State of bit (1 or 0).
  1818. */
  1819. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE6(DMA_TypeDef *DMAx)
  1820. {
  1821. return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF6) == (DMA_ISR_TEIF6));
  1822. }
  1823. /**
  1824. * @brief Get Channel 7 transfer error flag.
  1825. * @rmtoll ISR TEIF7 LL_DMA_IsActiveFlag_TE7
  1826. * @param DMAx DMAx Instance
  1827. * @retval State of bit (1 or 0).
  1828. */
  1829. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE7(DMA_TypeDef *DMAx)
  1830. {
  1831. return (READ_BIT(DMAx->ISR, DMA_ISR_TEIF7) == (DMA_ISR_TEIF7));
  1832. }
  1833. /**
  1834. * @brief Clear Channel 1 global interrupt flag.
  1835. * @rmtoll IFCR CGIF1 LL_DMA_ClearFlag_GI1
  1836. * @param DMAx DMAx Instance
  1837. * @retval None
  1838. */
  1839. __STATIC_INLINE void LL_DMA_ClearFlag_GI1(DMA_TypeDef *DMAx)
  1840. {
  1841. WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF1);
  1842. }
  1843. /**
  1844. * @brief Clear Channel 2 global interrupt flag.
  1845. * @rmtoll IFCR CGIF2 LL_DMA_ClearFlag_GI2
  1846. * @param DMAx DMAx Instance
  1847. * @retval None
  1848. */
  1849. __STATIC_INLINE void LL_DMA_ClearFlag_GI2(DMA_TypeDef *DMAx)
  1850. {
  1851. WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF2);
  1852. }
  1853. /**
  1854. * @brief Clear Channel 3 global interrupt flag.
  1855. * @rmtoll IFCR CGIF3 LL_DMA_ClearFlag_GI3
  1856. * @param DMAx DMAx Instance
  1857. * @retval None
  1858. */
  1859. __STATIC_INLINE void LL_DMA_ClearFlag_GI3(DMA_TypeDef *DMAx)
  1860. {
  1861. WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF3);
  1862. }
  1863. /**
  1864. * @brief Clear Channel 4 global interrupt flag.
  1865. * @rmtoll IFCR CGIF4 LL_DMA_ClearFlag_GI4
  1866. * @param DMAx DMAx Instance
  1867. * @retval None
  1868. */
  1869. __STATIC_INLINE void LL_DMA_ClearFlag_GI4(DMA_TypeDef *DMAx)
  1870. {
  1871. WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF4);
  1872. }
  1873. /**
  1874. * @brief Clear Channel 5 global interrupt flag.
  1875. * @rmtoll IFCR CGIF5 LL_DMA_ClearFlag_GI5
  1876. * @param DMAx DMAx Instance
  1877. * @retval None
  1878. */
  1879. __STATIC_INLINE void LL_DMA_ClearFlag_GI5(DMA_TypeDef *DMAx)
  1880. {
  1881. WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF5);
  1882. }
  1883. /**
  1884. * @brief Clear Channel 6 global interrupt flag.
  1885. * @rmtoll IFCR CGIF6 LL_DMA_ClearFlag_GI6
  1886. * @param DMAx DMAx Instance
  1887. * @retval None
  1888. */
  1889. __STATIC_INLINE void LL_DMA_ClearFlag_GI6(DMA_TypeDef *DMAx)
  1890. {
  1891. WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF6);
  1892. }
  1893. /**
  1894. * @brief Clear Channel 7 global interrupt flag.
  1895. * @rmtoll IFCR CGIF7 LL_DMA_ClearFlag_GI7
  1896. * @param DMAx DMAx Instance
  1897. * @retval None
  1898. */
  1899. __STATIC_INLINE void LL_DMA_ClearFlag_GI7(DMA_TypeDef *DMAx)
  1900. {
  1901. WRITE_REG(DMAx->IFCR, DMA_IFCR_CGIF7);
  1902. }
  1903. /**
  1904. * @brief Clear Channel 1 transfer complete flag.
  1905. * @rmtoll IFCR CTCIF1 LL_DMA_ClearFlag_TC1
  1906. * @param DMAx DMAx Instance
  1907. * @retval None
  1908. */
  1909. __STATIC_INLINE void LL_DMA_ClearFlag_TC1(DMA_TypeDef *DMAx)
  1910. {
  1911. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF1);
  1912. }
  1913. /**
  1914. * @brief Clear Channel 2 transfer complete flag.
  1915. * @rmtoll IFCR CTCIF2 LL_DMA_ClearFlag_TC2
  1916. * @param DMAx DMAx Instance
  1917. * @retval None
  1918. */
  1919. __STATIC_INLINE void LL_DMA_ClearFlag_TC2(DMA_TypeDef *DMAx)
  1920. {
  1921. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF2);
  1922. }
  1923. /**
  1924. * @brief Clear Channel 3 transfer complete flag.
  1925. * @rmtoll IFCR CTCIF3 LL_DMA_ClearFlag_TC3
  1926. * @param DMAx DMAx Instance
  1927. * @retval None
  1928. */
  1929. __STATIC_INLINE void LL_DMA_ClearFlag_TC3(DMA_TypeDef *DMAx)
  1930. {
  1931. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF3);
  1932. }
  1933. /**
  1934. * @brief Clear Channel 4 transfer complete flag.
  1935. * @rmtoll IFCR CTCIF4 LL_DMA_ClearFlag_TC4
  1936. * @param DMAx DMAx Instance
  1937. * @retval None
  1938. */
  1939. __STATIC_INLINE void LL_DMA_ClearFlag_TC4(DMA_TypeDef *DMAx)
  1940. {
  1941. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF4);
  1942. }
  1943. /**
  1944. * @brief Clear Channel 5 transfer complete flag.
  1945. * @rmtoll IFCR CTCIF5 LL_DMA_ClearFlag_TC5
  1946. * @param DMAx DMAx Instance
  1947. * @retval None
  1948. */
  1949. __STATIC_INLINE void LL_DMA_ClearFlag_TC5(DMA_TypeDef *DMAx)
  1950. {
  1951. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF5);
  1952. }
  1953. /**
  1954. * @brief Clear Channel 6 transfer complete flag.
  1955. * @rmtoll IFCR CTCIF6 LL_DMA_ClearFlag_TC6
  1956. * @param DMAx DMAx Instance
  1957. * @retval None
  1958. */
  1959. __STATIC_INLINE void LL_DMA_ClearFlag_TC6(DMA_TypeDef *DMAx)
  1960. {
  1961. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF6);
  1962. }
  1963. /**
  1964. * @brief Clear Channel 7 transfer complete flag.
  1965. * @rmtoll IFCR CTCIF7 LL_DMA_ClearFlag_TC7
  1966. * @param DMAx DMAx Instance
  1967. * @retval None
  1968. */
  1969. __STATIC_INLINE void LL_DMA_ClearFlag_TC7(DMA_TypeDef *DMAx)
  1970. {
  1971. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTCIF7);
  1972. }
  1973. /**
  1974. * @brief Clear Channel 1 half transfer flag.
  1975. * @rmtoll IFCR CHTIF1 LL_DMA_ClearFlag_HT1
  1976. * @param DMAx DMAx Instance
  1977. * @retval None
  1978. */
  1979. __STATIC_INLINE void LL_DMA_ClearFlag_HT1(DMA_TypeDef *DMAx)
  1980. {
  1981. WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF1);
  1982. }
  1983. /**
  1984. * @brief Clear Channel 2 half transfer flag.
  1985. * @rmtoll IFCR CHTIF2 LL_DMA_ClearFlag_HT2
  1986. * @param DMAx DMAx Instance
  1987. * @retval None
  1988. */
  1989. __STATIC_INLINE void LL_DMA_ClearFlag_HT2(DMA_TypeDef *DMAx)
  1990. {
  1991. WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF2);
  1992. }
  1993. /**
  1994. * @brief Clear Channel 3 half transfer flag.
  1995. * @rmtoll IFCR CHTIF3 LL_DMA_ClearFlag_HT3
  1996. * @param DMAx DMAx Instance
  1997. * @retval None
  1998. */
  1999. __STATIC_INLINE void LL_DMA_ClearFlag_HT3(DMA_TypeDef *DMAx)
  2000. {
  2001. WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF3);
  2002. }
  2003. /**
  2004. * @brief Clear Channel 4 half transfer flag.
  2005. * @rmtoll IFCR CHTIF4 LL_DMA_ClearFlag_HT4
  2006. * @param DMAx DMAx Instance
  2007. * @retval None
  2008. */
  2009. __STATIC_INLINE void LL_DMA_ClearFlag_HT4(DMA_TypeDef *DMAx)
  2010. {
  2011. WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF4);
  2012. }
  2013. /**
  2014. * @brief Clear Channel 5 half transfer flag.
  2015. * @rmtoll IFCR CHTIF5 LL_DMA_ClearFlag_HT5
  2016. * @param DMAx DMAx Instance
  2017. * @retval None
  2018. */
  2019. __STATIC_INLINE void LL_DMA_ClearFlag_HT5(DMA_TypeDef *DMAx)
  2020. {
  2021. WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF5);
  2022. }
  2023. /**
  2024. * @brief Clear Channel 6 half transfer flag.
  2025. * @rmtoll IFCR CHTIF6 LL_DMA_ClearFlag_HT6
  2026. * @param DMAx DMAx Instance
  2027. * @retval None
  2028. */
  2029. __STATIC_INLINE void LL_DMA_ClearFlag_HT6(DMA_TypeDef *DMAx)
  2030. {
  2031. WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF6);
  2032. }
  2033. /**
  2034. * @brief Clear Channel 7 half transfer flag.
  2035. * @rmtoll IFCR CHTIF7 LL_DMA_ClearFlag_HT7
  2036. * @param DMAx DMAx Instance
  2037. * @retval None
  2038. */
  2039. __STATIC_INLINE void LL_DMA_ClearFlag_HT7(DMA_TypeDef *DMAx)
  2040. {
  2041. WRITE_REG(DMAx->IFCR, DMA_IFCR_CHTIF7);
  2042. }
  2043. /**
  2044. * @brief Clear Channel 1 transfer error flag.
  2045. * @rmtoll IFCR CTEIF1 LL_DMA_ClearFlag_TE1
  2046. * @param DMAx DMAx Instance
  2047. * @retval None
  2048. */
  2049. __STATIC_INLINE void LL_DMA_ClearFlag_TE1(DMA_TypeDef *DMAx)
  2050. {
  2051. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF1);
  2052. }
  2053. /**
  2054. * @brief Clear Channel 2 transfer error flag.
  2055. * @rmtoll IFCR CTEIF2 LL_DMA_ClearFlag_TE2
  2056. * @param DMAx DMAx Instance
  2057. * @retval None
  2058. */
  2059. __STATIC_INLINE void LL_DMA_ClearFlag_TE2(DMA_TypeDef *DMAx)
  2060. {
  2061. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF2);
  2062. }
  2063. /**
  2064. * @brief Clear Channel 3 transfer error flag.
  2065. * @rmtoll IFCR CTEIF3 LL_DMA_ClearFlag_TE3
  2066. * @param DMAx DMAx Instance
  2067. * @retval None
  2068. */
  2069. __STATIC_INLINE void LL_DMA_ClearFlag_TE3(DMA_TypeDef *DMAx)
  2070. {
  2071. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF3);
  2072. }
  2073. /**
  2074. * @brief Clear Channel 4 transfer error flag.
  2075. * @rmtoll IFCR CTEIF4 LL_DMA_ClearFlag_TE4
  2076. * @param DMAx DMAx Instance
  2077. * @retval None
  2078. */
  2079. __STATIC_INLINE void LL_DMA_ClearFlag_TE4(DMA_TypeDef *DMAx)
  2080. {
  2081. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF4);
  2082. }
  2083. /**
  2084. * @brief Clear Channel 5 transfer error flag.
  2085. * @rmtoll IFCR CTEIF5 LL_DMA_ClearFlag_TE5
  2086. * @param DMAx DMAx Instance
  2087. * @retval None
  2088. */
  2089. __STATIC_INLINE void LL_DMA_ClearFlag_TE5(DMA_TypeDef *DMAx)
  2090. {
  2091. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF5);
  2092. }
  2093. /**
  2094. * @brief Clear Channel 6 transfer error flag.
  2095. * @rmtoll IFCR CTEIF6 LL_DMA_ClearFlag_TE6
  2096. * @param DMAx DMAx Instance
  2097. * @retval None
  2098. */
  2099. __STATIC_INLINE void LL_DMA_ClearFlag_TE6(DMA_TypeDef *DMAx)
  2100. {
  2101. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF6);
  2102. }
  2103. /**
  2104. * @brief Clear Channel 7 transfer error flag.
  2105. * @rmtoll IFCR CTEIF7 LL_DMA_ClearFlag_TE7
  2106. * @param DMAx DMAx Instance
  2107. * @retval None
  2108. */
  2109. __STATIC_INLINE void LL_DMA_ClearFlag_TE7(DMA_TypeDef *DMAx)
  2110. {
  2111. WRITE_REG(DMAx->IFCR, DMA_IFCR_CTEIF7);
  2112. }
  2113. /**
  2114. * @}
  2115. */
  2116. /** @defgroup DMA_LL_EF_IT_Management IT_Management
  2117. * @{
  2118. */
  2119. /**
  2120. * @brief Enable Transfer complete interrupt.
  2121. * @rmtoll CCR TCIE LL_DMA_EnableIT_TC
  2122. * @param DMAx DMAx Instance
  2123. * @param Channel This parameter can be one of the following values:
  2124. * @arg @ref LL_DMA_CHANNEL_1
  2125. * @arg @ref LL_DMA_CHANNEL_2
  2126. * @arg @ref LL_DMA_CHANNEL_3
  2127. * @arg @ref LL_DMA_CHANNEL_4
  2128. * @arg @ref LL_DMA_CHANNEL_5
  2129. * @arg @ref LL_DMA_CHANNEL_6
  2130. * @arg @ref LL_DMA_CHANNEL_7
  2131. * @retval None
  2132. */
  2133. __STATIC_INLINE void LL_DMA_EnableIT_TC(DMA_TypeDef *DMAx, uint32_t Channel)
  2134. {
  2135. SET_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_TCIE);
  2136. }
  2137. /**
  2138. * @brief Enable Half transfer interrupt.
  2139. * @rmtoll CCR HTIE LL_DMA_EnableIT_HT
  2140. * @param DMAx DMAx Instance
  2141. * @param Channel This parameter can be one of the following values:
  2142. * @arg @ref LL_DMA_CHANNEL_1
  2143. * @arg @ref LL_DMA_CHANNEL_2
  2144. * @arg @ref LL_DMA_CHANNEL_3
  2145. * @arg @ref LL_DMA_CHANNEL_4
  2146. * @arg @ref LL_DMA_CHANNEL_5
  2147. * @arg @ref LL_DMA_CHANNEL_6
  2148. * @arg @ref LL_DMA_CHANNEL_7
  2149. * @retval None
  2150. */
  2151. __STATIC_INLINE void LL_DMA_EnableIT_HT(DMA_TypeDef *DMAx, uint32_t Channel)
  2152. {
  2153. SET_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_HTIE);
  2154. }
  2155. /**
  2156. * @brief Enable Transfer error interrupt.
  2157. * @rmtoll CCR TEIE LL_DMA_EnableIT_TE
  2158. * @param DMAx DMAx Instance
  2159. * @param Channel This parameter can be one of the following values:
  2160. * @arg @ref LL_DMA_CHANNEL_1
  2161. * @arg @ref LL_DMA_CHANNEL_2
  2162. * @arg @ref LL_DMA_CHANNEL_3
  2163. * @arg @ref LL_DMA_CHANNEL_4
  2164. * @arg @ref LL_DMA_CHANNEL_5
  2165. * @arg @ref LL_DMA_CHANNEL_6
  2166. * @arg @ref LL_DMA_CHANNEL_7
  2167. * @retval None
  2168. */
  2169. __STATIC_INLINE void LL_DMA_EnableIT_TE(DMA_TypeDef *DMAx, uint32_t Channel)
  2170. {
  2171. SET_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_TEIE);
  2172. }
  2173. /**
  2174. * @brief Disable Transfer complete interrupt.
  2175. * @rmtoll CCR TCIE LL_DMA_DisableIT_TC
  2176. * @param DMAx DMAx Instance
  2177. * @param Channel This parameter can be one of the following values:
  2178. * @arg @ref LL_DMA_CHANNEL_1
  2179. * @arg @ref LL_DMA_CHANNEL_2
  2180. * @arg @ref LL_DMA_CHANNEL_3
  2181. * @arg @ref LL_DMA_CHANNEL_4
  2182. * @arg @ref LL_DMA_CHANNEL_5
  2183. * @arg @ref LL_DMA_CHANNEL_6
  2184. * @arg @ref LL_DMA_CHANNEL_7
  2185. * @retval None
  2186. */
  2187. __STATIC_INLINE void LL_DMA_DisableIT_TC(DMA_TypeDef *DMAx, uint32_t Channel)
  2188. {
  2189. CLEAR_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_TCIE);
  2190. }
  2191. /**
  2192. * @brief Disable Half transfer interrupt.
  2193. * @rmtoll CCR HTIE LL_DMA_DisableIT_HT
  2194. * @param DMAx DMAx Instance
  2195. * @param Channel This parameter can be one of the following values:
  2196. * @arg @ref LL_DMA_CHANNEL_1
  2197. * @arg @ref LL_DMA_CHANNEL_2
  2198. * @arg @ref LL_DMA_CHANNEL_3
  2199. * @arg @ref LL_DMA_CHANNEL_4
  2200. * @arg @ref LL_DMA_CHANNEL_5
  2201. * @arg @ref LL_DMA_CHANNEL_6
  2202. * @arg @ref LL_DMA_CHANNEL_7
  2203. * @retval None
  2204. */
  2205. __STATIC_INLINE void LL_DMA_DisableIT_HT(DMA_TypeDef *DMAx, uint32_t Channel)
  2206. {
  2207. CLEAR_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_HTIE);
  2208. }
  2209. /**
  2210. * @brief Disable Transfer error interrupt.
  2211. * @rmtoll CCR TEIE LL_DMA_DisableIT_TE
  2212. * @param DMAx DMAx Instance
  2213. * @param Channel This parameter can be one of the following values:
  2214. * @arg @ref LL_DMA_CHANNEL_1
  2215. * @arg @ref LL_DMA_CHANNEL_2
  2216. * @arg @ref LL_DMA_CHANNEL_3
  2217. * @arg @ref LL_DMA_CHANNEL_4
  2218. * @arg @ref LL_DMA_CHANNEL_5
  2219. * @arg @ref LL_DMA_CHANNEL_6
  2220. * @arg @ref LL_DMA_CHANNEL_7
  2221. * @retval None
  2222. */
  2223. __STATIC_INLINE void LL_DMA_DisableIT_TE(DMA_TypeDef *DMAx, uint32_t Channel)
  2224. {
  2225. CLEAR_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR, DMA_CCR_TEIE);
  2226. }
  2227. /**
  2228. * @brief Check if Transfer complete Interrupt is enabled.
  2229. * @rmtoll CCR TCIE LL_DMA_IsEnabledIT_TC
  2230. * @param DMAx DMAx Instance
  2231. * @param Channel This parameter can be one of the following values:
  2232. * @arg @ref LL_DMA_CHANNEL_1
  2233. * @arg @ref LL_DMA_CHANNEL_2
  2234. * @arg @ref LL_DMA_CHANNEL_3
  2235. * @arg @ref LL_DMA_CHANNEL_4
  2236. * @arg @ref LL_DMA_CHANNEL_5
  2237. * @arg @ref LL_DMA_CHANNEL_6
  2238. * @arg @ref LL_DMA_CHANNEL_7
  2239. * @retval State of bit (1 or 0).
  2240. */
  2241. __STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_TC(DMA_TypeDef *DMAx, uint32_t Channel)
  2242. {
  2243. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  2244. DMA_CCR_TCIE) == (DMA_CCR_TCIE));
  2245. }
  2246. /**
  2247. * @brief Check if Half transfer Interrupt is enabled.
  2248. * @rmtoll CCR HTIE LL_DMA_IsEnabledIT_HT
  2249. * @param DMAx DMAx Instance
  2250. * @param Channel This parameter can be one of the following values:
  2251. * @arg @ref LL_DMA_CHANNEL_1
  2252. * @arg @ref LL_DMA_CHANNEL_2
  2253. * @arg @ref LL_DMA_CHANNEL_3
  2254. * @arg @ref LL_DMA_CHANNEL_4
  2255. * @arg @ref LL_DMA_CHANNEL_5
  2256. * @arg @ref LL_DMA_CHANNEL_6
  2257. * @arg @ref LL_DMA_CHANNEL_7
  2258. * @retval State of bit (1 or 0).
  2259. */
  2260. __STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_HT(DMA_TypeDef *DMAx, uint32_t Channel)
  2261. {
  2262. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  2263. DMA_CCR_HTIE) == (DMA_CCR_HTIE));
  2264. }
  2265. /**
  2266. * @brief Check if Transfer error Interrupt is enabled.
  2267. * @rmtoll CCR TEIE LL_DMA_IsEnabledIT_TE
  2268. * @param DMAx DMAx Instance
  2269. * @param Channel This parameter can be one of the following values:
  2270. * @arg @ref LL_DMA_CHANNEL_1
  2271. * @arg @ref LL_DMA_CHANNEL_2
  2272. * @arg @ref LL_DMA_CHANNEL_3
  2273. * @arg @ref LL_DMA_CHANNEL_4
  2274. * @arg @ref LL_DMA_CHANNEL_5
  2275. * @arg @ref LL_DMA_CHANNEL_6
  2276. * @arg @ref LL_DMA_CHANNEL_7
  2277. * @retval State of bit (1 or 0).
  2278. */
  2279. __STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_TE(DMA_TypeDef *DMAx, uint32_t Channel)
  2280. {
  2281. return (READ_BIT(((DMA_Channel_TypeDef *)((uint32_t)((uint32_t)DMAx + CHANNEL_OFFSET_TAB[Channel - 1U])))->CCR,
  2282. DMA_CCR_TEIE) == (DMA_CCR_TEIE));
  2283. }
  2284. /**
  2285. * @}
  2286. */
  2287. #if defined(USE_FULL_LL_DRIVER)
  2288. /** @defgroup DMA_LL_EF_Init Initialization and de-initialization functions
  2289. * @{
  2290. */
  2291. uint32_t LL_DMA_Init(DMA_TypeDef *DMAx, uint32_t Channel, LL_DMA_InitTypeDef *DMA_InitStruct);
  2292. uint32_t LL_DMA_DeInit(DMA_TypeDef *DMAx, uint32_t Channel);
  2293. void LL_DMA_StructInit(LL_DMA_InitTypeDef *DMA_InitStruct);
  2294. /**
  2295. * @}
  2296. */
  2297. #endif /* USE_FULL_LL_DRIVER */
  2298. /**
  2299. * @}
  2300. */
  2301. /**
  2302. * @}
  2303. */
  2304. #endif /* DMA1 || DMA2 */
  2305. /**
  2306. * @}
  2307. */
  2308. #ifdef __cplusplus
  2309. }
  2310. #endif
  2311. #endif /* __STM32L4xx_LL_DMA_H */
  2312. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/