stm32f7xx_ll_dma.h 108 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891
  1. /**
  2. ******************************************************************************
  3. * @file stm32f7xx_ll_dma.h
  4. * @author MCD Application Team
  5. * @brief Header file of DMA LL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file in
  13. * the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef __STM32F7xx_LL_DMA_H
  20. #define __STM32F7xx_LL_DMA_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32f7xx.h"
  26. /** @addtogroup STM32F7xx_LL_Driver
  27. * @{
  28. */
  29. #if defined (DMA1) || defined (DMA2)
  30. /** @defgroup DMA_LL DMA
  31. * @{
  32. */
  33. /* Private types -------------------------------------------------------------*/
  34. /* Private variables ---------------------------------------------------------*/
  35. /** @defgroup DMA_LL_Private_Variables DMA Private Variables
  36. * @{
  37. */
  38. /* Array used to get the DMA stream register offset versus stream index LL_DMA_STREAM_x */
  39. static const uint8_t STREAM_OFFSET_TAB[] =
  40. {
  41. (uint8_t)(DMA1_Stream0_BASE - DMA1_BASE),
  42. (uint8_t)(DMA1_Stream1_BASE - DMA1_BASE),
  43. (uint8_t)(DMA1_Stream2_BASE - DMA1_BASE),
  44. (uint8_t)(DMA1_Stream3_BASE - DMA1_BASE),
  45. (uint8_t)(DMA1_Stream4_BASE - DMA1_BASE),
  46. (uint8_t)(DMA1_Stream5_BASE - DMA1_BASE),
  47. (uint8_t)(DMA1_Stream6_BASE - DMA1_BASE),
  48. (uint8_t)(DMA1_Stream7_BASE - DMA1_BASE)
  49. };
  50. /**
  51. * @}
  52. */
  53. /* Private constants ---------------------------------------------------------*/
  54. /** @defgroup DMA_LL_Private_Constants DMA Private Constants
  55. * @{
  56. */
  57. #if defined(DMA_SxCR_CHSEL_3)
  58. #define DMA_CHANNEL_SELECTION_8_15
  59. #endif /* DMA_SxCR_CHSEL_3 */
  60. /**
  61. * @}
  62. */
  63. /* Private macros ------------------------------------------------------------*/
  64. /* Exported types ------------------------------------------------------------*/
  65. #if defined(USE_FULL_LL_DRIVER)
  66. /** @defgroup DMA_LL_ES_INIT DMA Exported Init structure
  67. * @{
  68. */
  69. typedef struct
  70. {
  71. uint32_t PeriphOrM2MSrcAddress; /*!< Specifies the peripheral base address for DMA transfer
  72. or as Source base address in case of memory to memory transfer direction.
  73. This parameter must be a value between Min_Data = 0 and Max_Data = 0xFFFFFFFF. */
  74. uint32_t MemoryOrM2MDstAddress; /*!< Specifies the memory base address for DMA transfer
  75. or as Destination base address in case of memory to memory transfer direction.
  76. This parameter must be a value between Min_Data = 0 and Max_Data = 0xFFFFFFFF. */
  77. uint32_t Direction; /*!< Specifies if the data will be transferred from memory to peripheral,
  78. from memory to memory or from peripheral to memory.
  79. This parameter can be a value of @ref DMA_LL_EC_DIRECTION
  80. This feature can be modified afterwards using unitary function @ref LL_DMA_SetDataTransferDirection(). */
  81. uint32_t Mode; /*!< Specifies the normal or circular operation mode.
  82. This parameter can be a value of @ref DMA_LL_EC_MODE
  83. @note The circular buffer mode cannot be used if the memory to memory
  84. data transfer direction is configured on the selected Stream
  85. This feature can be modified afterwards using unitary function @ref LL_DMA_SetMode(). */
  86. uint32_t PeriphOrM2MSrcIncMode; /*!< Specifies whether the Peripheral address or Source address in case of memory to memory transfer direction
  87. is incremented or not.
  88. This parameter can be a value of @ref DMA_LL_EC_PERIPH
  89. This feature can be modified afterwards using unitary function @ref LL_DMA_SetPeriphIncMode(). */
  90. uint32_t MemoryOrM2MDstIncMode; /*!< Specifies whether the Memory address or Destination address in case of memory to memory transfer direction
  91. is incremented or not.
  92. This parameter can be a value of @ref DMA_LL_EC_MEMORY
  93. This feature can be modified afterwards using unitary function @ref LL_DMA_SetMemoryIncMode(). */
  94. uint32_t PeriphOrM2MSrcDataSize; /*!< Specifies the Peripheral data size alignment or Source data size alignment (byte, half word, word)
  95. in case of memory to memory transfer direction.
  96. This parameter can be a value of @ref DMA_LL_EC_PDATAALIGN
  97. This feature can be modified afterwards using unitary function @ref LL_DMA_SetPeriphSize(). */
  98. uint32_t MemoryOrM2MDstDataSize; /*!< Specifies the Memory data size alignment or Destination data size alignment (byte, half word, word)
  99. in case of memory to memory transfer direction.
  100. This parameter can be a value of @ref DMA_LL_EC_MDATAALIGN
  101. This feature can be modified afterwards using unitary function @ref LL_DMA_SetMemorySize(). */
  102. uint32_t NbData; /*!< Specifies the number of data to transfer, in data unit.
  103. The data unit is equal to the source buffer configuration set in PeripheralSize
  104. or MemorySize parameters depending in the transfer direction.
  105. This parameter must be a value between Min_Data = 0 and Max_Data = 0x0000FFFF
  106. This feature can be modified afterwards using unitary function @ref LL_DMA_SetDataLength(). */
  107. uint32_t Channel; /*!< Specifies the peripheral channel.
  108. This parameter can be a value of @ref DMA_LL_EC_CHANNEL
  109. This feature can be modified afterwards using unitary function @ref LL_DMA_SetChannelSelection(). */
  110. uint32_t Priority; /*!< Specifies the channel priority level.
  111. This parameter can be a value of @ref DMA_LL_EC_PRIORITY
  112. This feature can be modified afterwards using unitary function @ref LL_DMA_SetStreamPriorityLevel(). */
  113. uint32_t FIFOMode; /*!< Specifies if the FIFO mode or Direct mode will be used for the specified stream.
  114. This parameter can be a value of @ref DMA_LL_FIFOMODE
  115. @note The Direct mode (FIFO mode disabled) cannot be used if the
  116. memory-to-memory data transfer is configured on the selected stream
  117. This feature can be modified afterwards using unitary functions @ref LL_DMA_EnableFifoMode() or @ref LL_DMA_EnableFifoMode() . */
  118. uint32_t FIFOThreshold; /*!< Specifies the FIFO threshold level.
  119. This parameter can be a value of @ref DMA_LL_EC_FIFOTHRESHOLD
  120. This feature can be modified afterwards using unitary function @ref LL_DMA_SetFIFOThreshold(). */
  121. uint32_t MemBurst; /*!< Specifies the Burst transfer configuration for the memory transfers.
  122. It specifies the amount of data to be transferred in a single non interruptible
  123. transaction.
  124. This parameter can be a value of @ref DMA_LL_EC_MBURST
  125. @note The burst mode is possible only if the address Increment mode is enabled.
  126. This feature can be modified afterwards using unitary function @ref LL_DMA_SetMemoryBurstxfer(). */
  127. uint32_t PeriphBurst; /*!< Specifies the Burst transfer configuration for the peripheral transfers.
  128. It specifies the amount of data to be transferred in a single non interruptible
  129. transaction.
  130. This parameter can be a value of @ref DMA_LL_EC_PBURST
  131. @note The burst mode is possible only if the address Increment mode is enabled.
  132. This feature can be modified afterwards using unitary function @ref LL_DMA_SetPeriphBurstxfer(). */
  133. } LL_DMA_InitTypeDef;
  134. /**
  135. * @}
  136. */
  137. #endif /*USE_FULL_LL_DRIVER*/
  138. /* Exported constants --------------------------------------------------------*/
  139. /** @defgroup DMA_LL_Exported_Constants DMA Exported Constants
  140. * @{
  141. */
  142. /** @defgroup DMA_LL_EC_STREAM STREAM
  143. * @{
  144. */
  145. #define LL_DMA_STREAM_0 0x00000000U
  146. #define LL_DMA_STREAM_1 0x00000001U
  147. #define LL_DMA_STREAM_2 0x00000002U
  148. #define LL_DMA_STREAM_3 0x00000003U
  149. #define LL_DMA_STREAM_4 0x00000004U
  150. #define LL_DMA_STREAM_5 0x00000005U
  151. #define LL_DMA_STREAM_6 0x00000006U
  152. #define LL_DMA_STREAM_7 0x00000007U
  153. #define LL_DMA_STREAM_ALL 0xFFFF0000U
  154. /**
  155. * @}
  156. */
  157. /** @defgroup DMA_LL_EC_DIRECTION DIRECTION
  158. * @{
  159. */
  160. #define LL_DMA_DIRECTION_PERIPH_TO_MEMORY 0x00000000U /*!< Peripheral to memory direction */
  161. #define LL_DMA_DIRECTION_MEMORY_TO_PERIPH DMA_SxCR_DIR_0 /*!< Memory to peripheral direction */
  162. #define LL_DMA_DIRECTION_MEMORY_TO_MEMORY DMA_SxCR_DIR_1 /*!< Memory to memory direction */
  163. /**
  164. * @}
  165. */
  166. /** @defgroup DMA_LL_EC_MODE MODE
  167. * @{
  168. */
  169. #define LL_DMA_MODE_NORMAL 0x00000000U /*!< Normal Mode */
  170. #define LL_DMA_MODE_CIRCULAR DMA_SxCR_CIRC /*!< Circular Mode */
  171. #define LL_DMA_MODE_PFCTRL DMA_SxCR_PFCTRL /*!< Peripheral flow control mode */
  172. /**
  173. * @}
  174. */
  175. /** @defgroup DMA_LL_EC_DOUBLEBUFFER_MODE DOUBLE BUFFER MODE
  176. * @{
  177. */
  178. #define LL_DMA_DOUBLEBUFFER_MODE_DISABLE 0x00000000U /*!< Disable double buffering mode */
  179. #define LL_DMA_DOUBLEBUFFER_MODE_ENABLE DMA_SxCR_DBM /*!< Enable double buffering mode */
  180. /**
  181. * @}
  182. */
  183. /** @defgroup DMA_LL_EC_PERIPH PERIPH
  184. * @{
  185. */
  186. #define LL_DMA_PERIPH_NOINCREMENT 0x00000000U /*!< Peripheral increment mode Disable */
  187. #define LL_DMA_PERIPH_INCREMENT DMA_SxCR_PINC /*!< Peripheral increment mode Enable */
  188. /**
  189. * @}
  190. */
  191. /** @defgroup DMA_LL_EC_MEMORY MEMORY
  192. * @{
  193. */
  194. #define LL_DMA_MEMORY_NOINCREMENT 0x00000000U /*!< Memory increment mode Disable */
  195. #define LL_DMA_MEMORY_INCREMENT DMA_SxCR_MINC /*!< Memory increment mode Enable */
  196. /**
  197. * @}
  198. */
  199. /** @defgroup DMA_LL_EC_PDATAALIGN PDATAALIGN
  200. * @{
  201. */
  202. #define LL_DMA_PDATAALIGN_BYTE 0x00000000U /*!< Peripheral data alignment : Byte */
  203. #define LL_DMA_PDATAALIGN_HALFWORD DMA_SxCR_PSIZE_0 /*!< Peripheral data alignment : HalfWord */
  204. #define LL_DMA_PDATAALIGN_WORD DMA_SxCR_PSIZE_1 /*!< Peripheral data alignment : Word */
  205. /**
  206. * @}
  207. */
  208. /** @defgroup DMA_LL_EC_MDATAALIGN MDATAALIGN
  209. * @{
  210. */
  211. #define LL_DMA_MDATAALIGN_BYTE 0x00000000U /*!< Memory data alignment : Byte */
  212. #define LL_DMA_MDATAALIGN_HALFWORD DMA_SxCR_MSIZE_0 /*!< Memory data alignment : HalfWord */
  213. #define LL_DMA_MDATAALIGN_WORD DMA_SxCR_MSIZE_1 /*!< Memory data alignment : Word */
  214. /**
  215. * @}
  216. */
  217. /** @defgroup DMA_LL_EC_OFFSETSIZE OFFSETSIZE
  218. * @{
  219. */
  220. #define LL_DMA_OFFSETSIZE_PSIZE 0x00000000U /*!< Peripheral increment offset size is linked to the PSIZE */
  221. #define LL_DMA_OFFSETSIZE_FIXEDTO4 DMA_SxCR_PINCOS /*!< Peripheral increment offset size is fixed to 4 (32-bit alignment) */
  222. /**
  223. * @}
  224. */
  225. /** @defgroup DMA_LL_EC_PRIORITY PRIORITY
  226. * @{
  227. */
  228. #define LL_DMA_PRIORITY_LOW 0x00000000U /*!< Priority level : Low */
  229. #define LL_DMA_PRIORITY_MEDIUM DMA_SxCR_PL_0 /*!< Priority level : Medium */
  230. #define LL_DMA_PRIORITY_HIGH DMA_SxCR_PL_1 /*!< Priority level : High */
  231. #define LL_DMA_PRIORITY_VERYHIGH DMA_SxCR_PL /*!< Priority level : Very_High */
  232. /**
  233. * @}
  234. */
  235. /** @defgroup DMA_LL_EC_CHANNEL CHANNEL
  236. * @{
  237. */
  238. #define LL_DMA_CHANNEL_0 0x00000000U /* Select Channel0 of DMA Instance */
  239. #define LL_DMA_CHANNEL_1 DMA_SxCR_CHSEL_0 /* Select Channel1 of DMA Instance */
  240. #define LL_DMA_CHANNEL_2 DMA_SxCR_CHSEL_1 /* Select Channel2 of DMA Instance */
  241. #define LL_DMA_CHANNEL_3 (DMA_SxCR_CHSEL_0 | DMA_SxCR_CHSEL_1) /* Select Channel3 of DMA Instance */
  242. #define LL_DMA_CHANNEL_4 DMA_SxCR_CHSEL_2 /* Select Channel4 of DMA Instance */
  243. #define LL_DMA_CHANNEL_5 (DMA_SxCR_CHSEL_2 | DMA_SxCR_CHSEL_0) /* Select Channel5 of DMA Instance */
  244. #define LL_DMA_CHANNEL_6 (DMA_SxCR_CHSEL_2 | DMA_SxCR_CHSEL_1) /* Select Channel6 of DMA Instance */
  245. #define LL_DMA_CHANNEL_7 (DMA_SxCR_CHSEL_2 | DMA_SxCR_CHSEL_1 | DMA_SxCR_CHSEL_0) /* Select Channel7 of DMA Instance */
  246. #if defined(DMA_CHANNEL_SELECTION_8_15)
  247. #define LL_DMA_CHANNEL_8 DMA_SxCR_CHSEL_3 /* Select Channel8 of DMA Instance */
  248. #define LL_DMA_CHANNEL_9 (DMA_SxCR_CHSEL_3 | DMA_SxCR_CHSEL_0) /* Select Channel9 of DMA Instance */
  249. #define LL_DMA_CHANNEL_10 (DMA_SxCR_CHSEL_3 | DMA_SxCR_CHSEL_1) /* Select Channel10 of DMA Instance */
  250. #define LL_DMA_CHANNEL_11 (DMA_SxCR_CHSEL_3 | DMA_SxCR_CHSEL_1 | DMA_SxCR_CHSEL_0) /* Select Channel11 of DMA Instance */
  251. #define LL_DMA_CHANNEL_12 (DMA_SxCR_CHSEL_3 | DMA_SxCR_CHSEL_2) /* Select Channel12 of DMA Instance */
  252. #define LL_DMA_CHANNEL_13 (DMA_SxCR_CHSEL_3 | DMA_SxCR_CHSEL_2 | DMA_SxCR_CHSEL_0) /* Select Channel13 of DMA Instance */
  253. #define LL_DMA_CHANNEL_14 (DMA_SxCR_CHSEL_3 | DMA_SxCR_CHSEL_2 | DMA_SxCR_CHSEL_1) /* Select Channel14 of DMA Instance */
  254. #define LL_DMA_CHANNEL_15 DMA_SxCR_CHSEL /* Select Channel15 of DMA Instance */
  255. #endif /* DMA_CHANNEL_SELECTION_8_15 */
  256. /**
  257. * @}
  258. */
  259. /** @defgroup DMA_LL_EC_MBURST MBURST
  260. * @{
  261. */
  262. #define LL_DMA_MBURST_SINGLE 0x00000000U /*!< Memory burst single transfer configuration */
  263. #define LL_DMA_MBURST_INC4 DMA_SxCR_MBURST_0 /*!< Memory burst of 4 beats transfer configuration */
  264. #define LL_DMA_MBURST_INC8 DMA_SxCR_MBURST_1 /*!< Memory burst of 8 beats transfer configuration */
  265. #define LL_DMA_MBURST_INC16 (DMA_SxCR_MBURST_0 | DMA_SxCR_MBURST_1) /*!< Memory burst of 16 beats transfer configuration */
  266. /**
  267. * @}
  268. */
  269. /** @defgroup DMA_LL_EC_PBURST PBURST
  270. * @{
  271. */
  272. #define LL_DMA_PBURST_SINGLE 0x00000000U /*!< Peripheral burst single transfer configuration */
  273. #define LL_DMA_PBURST_INC4 DMA_SxCR_PBURST_0 /*!< Peripheral burst of 4 beats transfer configuration */
  274. #define LL_DMA_PBURST_INC8 DMA_SxCR_PBURST_1 /*!< Peripheral burst of 8 beats transfer configuration */
  275. #define LL_DMA_PBURST_INC16 (DMA_SxCR_PBURST_0 | DMA_SxCR_PBURST_1) /*!< Peripheral burst of 16 beats transfer configuration */
  276. /**
  277. * @}
  278. */
  279. /** @defgroup DMA_LL_FIFOMODE DMA_LL_FIFOMODE
  280. * @{
  281. */
  282. #define LL_DMA_FIFOMODE_DISABLE 0x00000000U /*!< FIFO mode disable (direct mode is enabled) */
  283. #define LL_DMA_FIFOMODE_ENABLE DMA_SxFCR_DMDIS /*!< FIFO mode enable */
  284. /**
  285. * @}
  286. */
  287. /** @defgroup DMA_LL_EC_FIFOSTATUS_0 FIFOSTATUS 0
  288. * @{
  289. */
  290. #define LL_DMA_FIFOSTATUS_0_25 0x00000000U /*!< 0 < fifo_level < 1/4 */
  291. #define LL_DMA_FIFOSTATUS_25_50 DMA_SxFCR_FS_0 /*!< 1/4 < fifo_level < 1/2 */
  292. #define LL_DMA_FIFOSTATUS_50_75 DMA_SxFCR_FS_1 /*!< 1/2 < fifo_level < 3/4 */
  293. #define LL_DMA_FIFOSTATUS_75_100 (DMA_SxFCR_FS_1 | DMA_SxFCR_FS_0) /*!< 3/4 < fifo_level < full */
  294. #define LL_DMA_FIFOSTATUS_EMPTY DMA_SxFCR_FS_2 /*!< FIFO is empty */
  295. #define LL_DMA_FIFOSTATUS_FULL (DMA_SxFCR_FS_2 | DMA_SxFCR_FS_0) /*!< FIFO is full */
  296. /**
  297. * @}
  298. */
  299. /** @defgroup DMA_LL_EC_FIFOTHRESHOLD FIFOTHRESHOLD
  300. * @{
  301. */
  302. #define LL_DMA_FIFOTHRESHOLD_1_4 0x00000000U /*!< FIFO threshold 1 quart full configuration */
  303. #define LL_DMA_FIFOTHRESHOLD_1_2 DMA_SxFCR_FTH_0 /*!< FIFO threshold half full configuration */
  304. #define LL_DMA_FIFOTHRESHOLD_3_4 DMA_SxFCR_FTH_1 /*!< FIFO threshold 3 quarts full configuration */
  305. #define LL_DMA_FIFOTHRESHOLD_FULL DMA_SxFCR_FTH /*!< FIFO threshold full configuration */
  306. /**
  307. * @}
  308. */
  309. /** @defgroup DMA_LL_EC_CURRENTTARGETMEM CURRENTTARGETMEM
  310. * @{
  311. */
  312. #define LL_DMA_CURRENTTARGETMEM0 0x00000000U /*!< Set CurrentTarget Memory to Memory 0 */
  313. #define LL_DMA_CURRENTTARGETMEM1 DMA_SxCR_CT /*!< Set CurrentTarget Memory to Memory 1 */
  314. /**
  315. * @}
  316. */
  317. /**
  318. * @}
  319. */
  320. /* Exported macro ------------------------------------------------------------*/
  321. /** @defgroup DMA_LL_Exported_Macros DMA Exported Macros
  322. * @{
  323. */
  324. /** @defgroup DMA_LL_EM_WRITE_READ Common Write and read registers macros
  325. * @{
  326. */
  327. /**
  328. * @brief Write a value in DMA register
  329. * @param __INSTANCE__ DMA Instance
  330. * @param __REG__ Register to be written
  331. * @param __VALUE__ Value to be written in the register
  332. * @retval None
  333. */
  334. #define LL_DMA_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
  335. /**
  336. * @brief Read a value in DMA register
  337. * @param __INSTANCE__ DMA Instance
  338. * @param __REG__ Register to be read
  339. * @retval Register value
  340. */
  341. #define LL_DMA_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
  342. /**
  343. * @}
  344. */
  345. /** @defgroup DMA_LL_EM_CONVERT_DMAxCHANNELy Convert DMAxStreamy
  346. * @{
  347. */
  348. /**
  349. * @brief Convert DMAx_Streamy into DMAx
  350. * @param __STREAM_INSTANCE__ DMAx_Streamy
  351. * @retval DMAx
  352. */
  353. #define __LL_DMA_GET_INSTANCE(__STREAM_INSTANCE__) \
  354. (((uint32_t)(__STREAM_INSTANCE__) > ((uint32_t)DMA1_Stream7)) ? DMA2 : DMA1)
  355. /**
  356. * @brief Convert DMAx_Streamy into LL_DMA_STREAM_y
  357. * @param __STREAM_INSTANCE__ DMAx_Streamy
  358. * @retval LL_DMA_CHANNEL_y
  359. */
  360. #define __LL_DMA_GET_STREAM(__STREAM_INSTANCE__) \
  361. (((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA1_Stream0)) ? LL_DMA_STREAM_0 : \
  362. ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA2_Stream0)) ? LL_DMA_STREAM_0 : \
  363. ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA1_Stream1)) ? LL_DMA_STREAM_1 : \
  364. ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA2_Stream1)) ? LL_DMA_STREAM_1 : \
  365. ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA1_Stream2)) ? LL_DMA_STREAM_2 : \
  366. ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA2_Stream2)) ? LL_DMA_STREAM_2 : \
  367. ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA1_Stream3)) ? LL_DMA_STREAM_3 : \
  368. ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA2_Stream3)) ? LL_DMA_STREAM_3 : \
  369. ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA1_Stream4)) ? LL_DMA_STREAM_4 : \
  370. ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA2_Stream4)) ? LL_DMA_STREAM_4 : \
  371. ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA1_Stream5)) ? LL_DMA_STREAM_5 : \
  372. ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA2_Stream5)) ? LL_DMA_STREAM_5 : \
  373. ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA1_Stream6)) ? LL_DMA_STREAM_6 : \
  374. ((uint32_t)(__STREAM_INSTANCE__) == ((uint32_t)DMA2_Stream6)) ? LL_DMA_STREAM_6 : \
  375. LL_DMA_STREAM_7)
  376. /**
  377. * @brief Convert DMA Instance DMAx and LL_DMA_STREAM_y into DMAx_Streamy
  378. * @param __DMA_INSTANCE__ DMAx
  379. * @param __STREAM__ LL_DMA_STREAM_y
  380. * @retval DMAx_Streamy
  381. */
  382. #define __LL_DMA_GET_STREAM_INSTANCE(__DMA_INSTANCE__, __STREAM__) \
  383. ((((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_0))) ? DMA1_Stream0 : \
  384. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_0))) ? DMA2_Stream0 : \
  385. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_1))) ? DMA1_Stream1 : \
  386. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_1))) ? DMA2_Stream1 : \
  387. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_2))) ? DMA1_Stream2 : \
  388. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_2))) ? DMA2_Stream2 : \
  389. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_3))) ? DMA1_Stream3 : \
  390. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_3))) ? DMA2_Stream3 : \
  391. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_4))) ? DMA1_Stream4 : \
  392. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_4))) ? DMA2_Stream4 : \
  393. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_5))) ? DMA1_Stream5 : \
  394. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_5))) ? DMA2_Stream5 : \
  395. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_6))) ? DMA1_Stream6 : \
  396. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA2)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_6))) ? DMA2_Stream6 : \
  397. (((uint32_t)(__DMA_INSTANCE__) == ((uint32_t)DMA1)) && ((uint32_t)(__STREAM__) == ((uint32_t)LL_DMA_STREAM_7))) ? DMA1_Stream7 : \
  398. DMA2_Stream7)
  399. /**
  400. * @}
  401. */
  402. /**
  403. * @}
  404. */
  405. /* Exported functions --------------------------------------------------------*/
  406. /** @defgroup DMA_LL_Exported_Functions DMA Exported Functions
  407. * @{
  408. */
  409. /** @defgroup DMA_LL_EF_Configuration Configuration
  410. * @{
  411. */
  412. /**
  413. * @brief Enable DMA stream.
  414. * @rmtoll CR EN LL_DMA_EnableStream
  415. * @param DMAx DMAx Instance
  416. * @param Stream This parameter can be one of the following values:
  417. * @arg @ref LL_DMA_STREAM_0
  418. * @arg @ref LL_DMA_STREAM_1
  419. * @arg @ref LL_DMA_STREAM_2
  420. * @arg @ref LL_DMA_STREAM_3
  421. * @arg @ref LL_DMA_STREAM_4
  422. * @arg @ref LL_DMA_STREAM_5
  423. * @arg @ref LL_DMA_STREAM_6
  424. * @arg @ref LL_DMA_STREAM_7
  425. * @retval None
  426. */
  427. __STATIC_INLINE void LL_DMA_EnableStream(DMA_TypeDef *DMAx, uint32_t Stream)
  428. {
  429. SET_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_EN);
  430. }
  431. /**
  432. * @brief Disable DMA stream.
  433. * @rmtoll CR EN LL_DMA_DisableStream
  434. * @param DMAx DMAx Instance
  435. * @param Stream This parameter can be one of the following values:
  436. * @arg @ref LL_DMA_STREAM_0
  437. * @arg @ref LL_DMA_STREAM_1
  438. * @arg @ref LL_DMA_STREAM_2
  439. * @arg @ref LL_DMA_STREAM_3
  440. * @arg @ref LL_DMA_STREAM_4
  441. * @arg @ref LL_DMA_STREAM_5
  442. * @arg @ref LL_DMA_STREAM_6
  443. * @arg @ref LL_DMA_STREAM_7
  444. * @retval None
  445. */
  446. __STATIC_INLINE void LL_DMA_DisableStream(DMA_TypeDef *DMAx, uint32_t Stream)
  447. {
  448. CLEAR_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_EN);
  449. }
  450. /**
  451. * @brief Check if DMA stream is enabled or disabled.
  452. * @rmtoll CR EN LL_DMA_IsEnabledStream
  453. * @param DMAx DMAx Instance
  454. * @param Stream This parameter can be one of the following values:
  455. * @arg @ref LL_DMA_STREAM_0
  456. * @arg @ref LL_DMA_STREAM_1
  457. * @arg @ref LL_DMA_STREAM_2
  458. * @arg @ref LL_DMA_STREAM_3
  459. * @arg @ref LL_DMA_STREAM_4
  460. * @arg @ref LL_DMA_STREAM_5
  461. * @arg @ref LL_DMA_STREAM_6
  462. * @arg @ref LL_DMA_STREAM_7
  463. * @retval State of bit (1 or 0).
  464. */
  465. __STATIC_INLINE uint32_t LL_DMA_IsEnabledStream(DMA_TypeDef *DMAx, uint32_t Stream)
  466. {
  467. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_EN) == (DMA_SxCR_EN));
  468. }
  469. /**
  470. * @brief Configure all parameters linked to DMA transfer.
  471. * @rmtoll CR DIR LL_DMA_ConfigTransfer\n
  472. * CR CIRC LL_DMA_ConfigTransfer\n
  473. * CR PINC LL_DMA_ConfigTransfer\n
  474. * CR MINC LL_DMA_ConfigTransfer\n
  475. * CR PSIZE LL_DMA_ConfigTransfer\n
  476. * CR MSIZE LL_DMA_ConfigTransfer\n
  477. * CR PL LL_DMA_ConfigTransfer\n
  478. * CR PFCTRL LL_DMA_ConfigTransfer
  479. * @param DMAx DMAx Instance
  480. * @param Stream This parameter can be one of the following values:
  481. * @arg @ref LL_DMA_STREAM_0
  482. * @arg @ref LL_DMA_STREAM_1
  483. * @arg @ref LL_DMA_STREAM_2
  484. * @arg @ref LL_DMA_STREAM_3
  485. * @arg @ref LL_DMA_STREAM_4
  486. * @arg @ref LL_DMA_STREAM_5
  487. * @arg @ref LL_DMA_STREAM_6
  488. * @arg @ref LL_DMA_STREAM_7
  489. * @param Configuration This parameter must be a combination of all the following values:
  490. * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY or @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH or @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY
  491. * @arg @ref LL_DMA_MODE_NORMAL or @ref LL_DMA_MODE_CIRCULAR or @ref LL_DMA_MODE_PFCTRL
  492. * @arg @ref LL_DMA_PERIPH_INCREMENT or @ref LL_DMA_PERIPH_NOINCREMENT
  493. * @arg @ref LL_DMA_MEMORY_INCREMENT or @ref LL_DMA_MEMORY_NOINCREMENT
  494. * @arg @ref LL_DMA_PDATAALIGN_BYTE or @ref LL_DMA_PDATAALIGN_HALFWORD or @ref LL_DMA_PDATAALIGN_WORD
  495. * @arg @ref LL_DMA_MDATAALIGN_BYTE or @ref LL_DMA_MDATAALIGN_HALFWORD or @ref LL_DMA_MDATAALIGN_WORD
  496. * @arg @ref LL_DMA_PRIORITY_LOW or @ref LL_DMA_PRIORITY_MEDIUM or @ref LL_DMA_PRIORITY_HIGH or @ref LL_DMA_PRIORITY_VERYHIGH
  497. *@retval None
  498. */
  499. __STATIC_INLINE void LL_DMA_ConfigTransfer(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Configuration)
  500. {
  501. MODIFY_REG(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR,
  502. DMA_SxCR_DIR | DMA_SxCR_CIRC | DMA_SxCR_PINC | DMA_SxCR_MINC | DMA_SxCR_PSIZE | DMA_SxCR_MSIZE | DMA_SxCR_PL | DMA_SxCR_PFCTRL,
  503. Configuration);
  504. }
  505. /**
  506. * @brief Set Data transfer direction (read from peripheral or from memory).
  507. * @rmtoll CR DIR LL_DMA_SetDataTransferDirection
  508. * @param DMAx DMAx Instance
  509. * @param Stream This parameter can be one of the following values:
  510. * @arg @ref LL_DMA_STREAM_0
  511. * @arg @ref LL_DMA_STREAM_1
  512. * @arg @ref LL_DMA_STREAM_2
  513. * @arg @ref LL_DMA_STREAM_3
  514. * @arg @ref LL_DMA_STREAM_4
  515. * @arg @ref LL_DMA_STREAM_5
  516. * @arg @ref LL_DMA_STREAM_6
  517. * @arg @ref LL_DMA_STREAM_7
  518. * @param Direction This parameter can be one of the following values:
  519. * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY
  520. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH
  521. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY
  522. * @retval None
  523. */
  524. __STATIC_INLINE void LL_DMA_SetDataTransferDirection(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Direction)
  525. {
  526. MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_DIR, Direction);
  527. }
  528. /**
  529. * @brief Get Data transfer direction (read from peripheral or from memory).
  530. * @rmtoll CR DIR LL_DMA_GetDataTransferDirection
  531. * @param DMAx DMAx Instance
  532. * @param Stream This parameter can be one of the following values:
  533. * @arg @ref LL_DMA_STREAM_0
  534. * @arg @ref LL_DMA_STREAM_1
  535. * @arg @ref LL_DMA_STREAM_2
  536. * @arg @ref LL_DMA_STREAM_3
  537. * @arg @ref LL_DMA_STREAM_4
  538. * @arg @ref LL_DMA_STREAM_5
  539. * @arg @ref LL_DMA_STREAM_6
  540. * @arg @ref LL_DMA_STREAM_7
  541. * @retval Returned value can be one of the following values:
  542. * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY
  543. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH
  544. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY
  545. */
  546. __STATIC_INLINE uint32_t LL_DMA_GetDataTransferDirection(DMA_TypeDef *DMAx, uint32_t Stream)
  547. {
  548. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_DIR));
  549. }
  550. /**
  551. * @brief Set DMA mode normal, circular or peripheral flow control.
  552. * @rmtoll CR CIRC LL_DMA_SetMode\n
  553. * CR PFCTRL LL_DMA_SetMode
  554. * @param DMAx DMAx Instance
  555. * @param Stream This parameter can be one of the following values:
  556. * @arg @ref LL_DMA_STREAM_0
  557. * @arg @ref LL_DMA_STREAM_1
  558. * @arg @ref LL_DMA_STREAM_2
  559. * @arg @ref LL_DMA_STREAM_3
  560. * @arg @ref LL_DMA_STREAM_4
  561. * @arg @ref LL_DMA_STREAM_5
  562. * @arg @ref LL_DMA_STREAM_6
  563. * @arg @ref LL_DMA_STREAM_7
  564. * @param Mode This parameter can be one of the following values:
  565. * @arg @ref LL_DMA_MODE_NORMAL
  566. * @arg @ref LL_DMA_MODE_CIRCULAR
  567. * @arg @ref LL_DMA_MODE_PFCTRL
  568. * @retval None
  569. */
  570. __STATIC_INLINE void LL_DMA_SetMode(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Mode)
  571. {
  572. MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_CIRC | DMA_SxCR_PFCTRL, Mode);
  573. }
  574. /**
  575. * @brief Get DMA mode normal, circular or peripheral flow control.
  576. * @rmtoll CR CIRC LL_DMA_GetMode\n
  577. * CR PFCTRL LL_DMA_GetMode
  578. * @param DMAx DMAx Instance
  579. * @param Stream This parameter can be one of the following values:
  580. * @arg @ref LL_DMA_STREAM_0
  581. * @arg @ref LL_DMA_STREAM_1
  582. * @arg @ref LL_DMA_STREAM_2
  583. * @arg @ref LL_DMA_STREAM_3
  584. * @arg @ref LL_DMA_STREAM_4
  585. * @arg @ref LL_DMA_STREAM_5
  586. * @arg @ref LL_DMA_STREAM_6
  587. * @arg @ref LL_DMA_STREAM_7
  588. * @retval Returned value can be one of the following values:
  589. * @arg @ref LL_DMA_MODE_NORMAL
  590. * @arg @ref LL_DMA_MODE_CIRCULAR
  591. * @arg @ref LL_DMA_MODE_PFCTRL
  592. */
  593. __STATIC_INLINE uint32_t LL_DMA_GetMode(DMA_TypeDef *DMAx, uint32_t Stream)
  594. {
  595. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_CIRC | DMA_SxCR_PFCTRL));
  596. }
  597. /**
  598. * @brief Set Peripheral increment mode.
  599. * @rmtoll CR PINC LL_DMA_SetPeriphIncMode
  600. * @param DMAx DMAx Instance
  601. * @param Stream This parameter can be one of the following values:
  602. * @arg @ref LL_DMA_STREAM_0
  603. * @arg @ref LL_DMA_STREAM_1
  604. * @arg @ref LL_DMA_STREAM_2
  605. * @arg @ref LL_DMA_STREAM_3
  606. * @arg @ref LL_DMA_STREAM_4
  607. * @arg @ref LL_DMA_STREAM_5
  608. * @arg @ref LL_DMA_STREAM_6
  609. * @arg @ref LL_DMA_STREAM_7
  610. * @param IncrementMode This parameter can be one of the following values:
  611. * @arg @ref LL_DMA_PERIPH_NOINCREMENT
  612. * @arg @ref LL_DMA_PERIPH_INCREMENT
  613. * @retval None
  614. */
  615. __STATIC_INLINE void LL_DMA_SetPeriphIncMode(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t IncrementMode)
  616. {
  617. MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PINC, IncrementMode);
  618. }
  619. /**
  620. * @brief Get Peripheral increment mode.
  621. * @rmtoll CR PINC LL_DMA_GetPeriphIncMode
  622. * @param DMAx DMAx Instance
  623. * @param Stream This parameter can be one of the following values:
  624. * @arg @ref LL_DMA_STREAM_0
  625. * @arg @ref LL_DMA_STREAM_1
  626. * @arg @ref LL_DMA_STREAM_2
  627. * @arg @ref LL_DMA_STREAM_3
  628. * @arg @ref LL_DMA_STREAM_4
  629. * @arg @ref LL_DMA_STREAM_5
  630. * @arg @ref LL_DMA_STREAM_6
  631. * @arg @ref LL_DMA_STREAM_7
  632. * @retval Returned value can be one of the following values:
  633. * @arg @ref LL_DMA_PERIPH_NOINCREMENT
  634. * @arg @ref LL_DMA_PERIPH_INCREMENT
  635. */
  636. __STATIC_INLINE uint32_t LL_DMA_GetPeriphIncMode(DMA_TypeDef *DMAx, uint32_t Stream)
  637. {
  638. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PINC));
  639. }
  640. /**
  641. * @brief Set Memory increment mode.
  642. * @rmtoll CR MINC LL_DMA_SetMemoryIncMode
  643. * @param DMAx DMAx Instance
  644. * @param Stream This parameter can be one of the following values:
  645. * @arg @ref LL_DMA_STREAM_0
  646. * @arg @ref LL_DMA_STREAM_1
  647. * @arg @ref LL_DMA_STREAM_2
  648. * @arg @ref LL_DMA_STREAM_3
  649. * @arg @ref LL_DMA_STREAM_4
  650. * @arg @ref LL_DMA_STREAM_5
  651. * @arg @ref LL_DMA_STREAM_6
  652. * @arg @ref LL_DMA_STREAM_7
  653. * @param IncrementMode This parameter can be one of the following values:
  654. * @arg @ref LL_DMA_MEMORY_NOINCREMENT
  655. * @arg @ref LL_DMA_MEMORY_INCREMENT
  656. * @retval None
  657. */
  658. __STATIC_INLINE void LL_DMA_SetMemoryIncMode(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t IncrementMode)
  659. {
  660. MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_MINC, IncrementMode);
  661. }
  662. /**
  663. * @brief Get Memory increment mode.
  664. * @rmtoll CR MINC LL_DMA_GetMemoryIncMode
  665. * @param DMAx DMAx Instance
  666. * @param Stream This parameter can be one of the following values:
  667. * @arg @ref LL_DMA_STREAM_0
  668. * @arg @ref LL_DMA_STREAM_1
  669. * @arg @ref LL_DMA_STREAM_2
  670. * @arg @ref LL_DMA_STREAM_3
  671. * @arg @ref LL_DMA_STREAM_4
  672. * @arg @ref LL_DMA_STREAM_5
  673. * @arg @ref LL_DMA_STREAM_6
  674. * @arg @ref LL_DMA_STREAM_7
  675. * @retval Returned value can be one of the following values:
  676. * @arg @ref LL_DMA_MEMORY_NOINCREMENT
  677. * @arg @ref LL_DMA_MEMORY_INCREMENT
  678. */
  679. __STATIC_INLINE uint32_t LL_DMA_GetMemoryIncMode(DMA_TypeDef *DMAx, uint32_t Stream)
  680. {
  681. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_MINC));
  682. }
  683. /**
  684. * @brief Set Peripheral size.
  685. * @rmtoll CR PSIZE LL_DMA_SetPeriphSize
  686. * @param DMAx DMAx Instance
  687. * @param Stream This parameter can be one of the following values:
  688. * @arg @ref LL_DMA_STREAM_0
  689. * @arg @ref LL_DMA_STREAM_1
  690. * @arg @ref LL_DMA_STREAM_2
  691. * @arg @ref LL_DMA_STREAM_3
  692. * @arg @ref LL_DMA_STREAM_4
  693. * @arg @ref LL_DMA_STREAM_5
  694. * @arg @ref LL_DMA_STREAM_6
  695. * @arg @ref LL_DMA_STREAM_7
  696. * @param Size This parameter can be one of the following values:
  697. * @arg @ref LL_DMA_PDATAALIGN_BYTE
  698. * @arg @ref LL_DMA_PDATAALIGN_HALFWORD
  699. * @arg @ref LL_DMA_PDATAALIGN_WORD
  700. * @retval None
  701. */
  702. __STATIC_INLINE void LL_DMA_SetPeriphSize(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Size)
  703. {
  704. MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PSIZE, Size);
  705. }
  706. /**
  707. * @brief Get Peripheral size.
  708. * @rmtoll CR PSIZE LL_DMA_GetPeriphSize
  709. * @param DMAx DMAx Instance
  710. * @param Stream This parameter can be one of the following values:
  711. * @arg @ref LL_DMA_STREAM_0
  712. * @arg @ref LL_DMA_STREAM_1
  713. * @arg @ref LL_DMA_STREAM_2
  714. * @arg @ref LL_DMA_STREAM_3
  715. * @arg @ref LL_DMA_STREAM_4
  716. * @arg @ref LL_DMA_STREAM_5
  717. * @arg @ref LL_DMA_STREAM_6
  718. * @arg @ref LL_DMA_STREAM_7
  719. * @retval Returned value can be one of the following values:
  720. * @arg @ref LL_DMA_PDATAALIGN_BYTE
  721. * @arg @ref LL_DMA_PDATAALIGN_HALFWORD
  722. * @arg @ref LL_DMA_PDATAALIGN_WORD
  723. */
  724. __STATIC_INLINE uint32_t LL_DMA_GetPeriphSize(DMA_TypeDef *DMAx, uint32_t Stream)
  725. {
  726. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PSIZE));
  727. }
  728. /**
  729. * @brief Set Memory size.
  730. * @rmtoll CR MSIZE LL_DMA_SetMemorySize
  731. * @param DMAx DMAx Instance
  732. * @param Stream This parameter can be one of the following values:
  733. * @arg @ref LL_DMA_STREAM_0
  734. * @arg @ref LL_DMA_STREAM_1
  735. * @arg @ref LL_DMA_STREAM_2
  736. * @arg @ref LL_DMA_STREAM_3
  737. * @arg @ref LL_DMA_STREAM_4
  738. * @arg @ref LL_DMA_STREAM_5
  739. * @arg @ref LL_DMA_STREAM_6
  740. * @arg @ref LL_DMA_STREAM_7
  741. * @param Size This parameter can be one of the following values:
  742. * @arg @ref LL_DMA_MDATAALIGN_BYTE
  743. * @arg @ref LL_DMA_MDATAALIGN_HALFWORD
  744. * @arg @ref LL_DMA_MDATAALIGN_WORD
  745. * @retval None
  746. */
  747. __STATIC_INLINE void LL_DMA_SetMemorySize(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Size)
  748. {
  749. MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_MSIZE, Size);
  750. }
  751. /**
  752. * @brief Get Memory size.
  753. * @rmtoll CR MSIZE LL_DMA_GetMemorySize
  754. * @param DMAx DMAx Instance
  755. * @param Stream This parameter can be one of the following values:
  756. * @arg @ref LL_DMA_STREAM_0
  757. * @arg @ref LL_DMA_STREAM_1
  758. * @arg @ref LL_DMA_STREAM_2
  759. * @arg @ref LL_DMA_STREAM_3
  760. * @arg @ref LL_DMA_STREAM_4
  761. * @arg @ref LL_DMA_STREAM_5
  762. * @arg @ref LL_DMA_STREAM_6
  763. * @arg @ref LL_DMA_STREAM_7
  764. * @retval Returned value can be one of the following values:
  765. * @arg @ref LL_DMA_MDATAALIGN_BYTE
  766. * @arg @ref LL_DMA_MDATAALIGN_HALFWORD
  767. * @arg @ref LL_DMA_MDATAALIGN_WORD
  768. */
  769. __STATIC_INLINE uint32_t LL_DMA_GetMemorySize(DMA_TypeDef *DMAx, uint32_t Stream)
  770. {
  771. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_MSIZE));
  772. }
  773. /**
  774. * @brief Set Peripheral increment offset size.
  775. * @rmtoll CR PINCOS LL_DMA_SetIncOffsetSize
  776. * @param DMAx DMAx Instance
  777. * @param Stream This parameter can be one of the following values:
  778. * @arg @ref LL_DMA_STREAM_0
  779. * @arg @ref LL_DMA_STREAM_1
  780. * @arg @ref LL_DMA_STREAM_2
  781. * @arg @ref LL_DMA_STREAM_3
  782. * @arg @ref LL_DMA_STREAM_4
  783. * @arg @ref LL_DMA_STREAM_5
  784. * @arg @ref LL_DMA_STREAM_6
  785. * @arg @ref LL_DMA_STREAM_7
  786. * @param OffsetSize This parameter can be one of the following values:
  787. * @arg @ref LL_DMA_OFFSETSIZE_PSIZE
  788. * @arg @ref LL_DMA_OFFSETSIZE_FIXEDTO4
  789. * @retval None
  790. */
  791. __STATIC_INLINE void LL_DMA_SetIncOffsetSize(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t OffsetSize)
  792. {
  793. MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PINCOS, OffsetSize);
  794. }
  795. /**
  796. * @brief Get Peripheral increment offset size.
  797. * @rmtoll CR PINCOS LL_DMA_GetIncOffsetSize
  798. * @param DMAx DMAx Instance
  799. * @param Stream This parameter can be one of the following values:
  800. * @arg @ref LL_DMA_STREAM_0
  801. * @arg @ref LL_DMA_STREAM_1
  802. * @arg @ref LL_DMA_STREAM_2
  803. * @arg @ref LL_DMA_STREAM_3
  804. * @arg @ref LL_DMA_STREAM_4
  805. * @arg @ref LL_DMA_STREAM_5
  806. * @arg @ref LL_DMA_STREAM_6
  807. * @arg @ref LL_DMA_STREAM_7
  808. * @retval Returned value can be one of the following values:
  809. * @arg @ref LL_DMA_OFFSETSIZE_PSIZE
  810. * @arg @ref LL_DMA_OFFSETSIZE_FIXEDTO4
  811. */
  812. __STATIC_INLINE uint32_t LL_DMA_GetIncOffsetSize(DMA_TypeDef *DMAx, uint32_t Stream)
  813. {
  814. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PINCOS));
  815. }
  816. /**
  817. * @brief Set Stream priority level.
  818. * @rmtoll CR PL LL_DMA_SetStreamPriorityLevel
  819. * @param DMAx DMAx Instance
  820. * @param Stream This parameter can be one of the following values:
  821. * @arg @ref LL_DMA_STREAM_0
  822. * @arg @ref LL_DMA_STREAM_1
  823. * @arg @ref LL_DMA_STREAM_2
  824. * @arg @ref LL_DMA_STREAM_3
  825. * @arg @ref LL_DMA_STREAM_4
  826. * @arg @ref LL_DMA_STREAM_5
  827. * @arg @ref LL_DMA_STREAM_6
  828. * @arg @ref LL_DMA_STREAM_7
  829. * @param Priority This parameter can be one of the following values:
  830. * @arg @ref LL_DMA_PRIORITY_LOW
  831. * @arg @ref LL_DMA_PRIORITY_MEDIUM
  832. * @arg @ref LL_DMA_PRIORITY_HIGH
  833. * @arg @ref LL_DMA_PRIORITY_VERYHIGH
  834. * @retval None
  835. */
  836. __STATIC_INLINE void LL_DMA_SetStreamPriorityLevel(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Priority)
  837. {
  838. MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PL, Priority);
  839. }
  840. /**
  841. * @brief Get Stream priority level.
  842. * @rmtoll CR PL LL_DMA_GetStreamPriorityLevel
  843. * @param DMAx DMAx Instance
  844. * @param Stream This parameter can be one of the following values:
  845. * @arg @ref LL_DMA_STREAM_0
  846. * @arg @ref LL_DMA_STREAM_1
  847. * @arg @ref LL_DMA_STREAM_2
  848. * @arg @ref LL_DMA_STREAM_3
  849. * @arg @ref LL_DMA_STREAM_4
  850. * @arg @ref LL_DMA_STREAM_5
  851. * @arg @ref LL_DMA_STREAM_6
  852. * @arg @ref LL_DMA_STREAM_7
  853. * @retval Returned value can be one of the following values:
  854. * @arg @ref LL_DMA_PRIORITY_LOW
  855. * @arg @ref LL_DMA_PRIORITY_MEDIUM
  856. * @arg @ref LL_DMA_PRIORITY_HIGH
  857. * @arg @ref LL_DMA_PRIORITY_VERYHIGH
  858. */
  859. __STATIC_INLINE uint32_t LL_DMA_GetStreamPriorityLevel(DMA_TypeDef *DMAx, uint32_t Stream)
  860. {
  861. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PL));
  862. }
  863. /**
  864. * @brief Set Number of data to transfer.
  865. * @rmtoll NDTR NDT LL_DMA_SetDataLength
  866. * @note This action has no effect if
  867. * stream is enabled.
  868. * @param DMAx DMAx Instance
  869. * @param Stream This parameter can be one of the following values:
  870. * @arg @ref LL_DMA_STREAM_0
  871. * @arg @ref LL_DMA_STREAM_1
  872. * @arg @ref LL_DMA_STREAM_2
  873. * @arg @ref LL_DMA_STREAM_3
  874. * @arg @ref LL_DMA_STREAM_4
  875. * @arg @ref LL_DMA_STREAM_5
  876. * @arg @ref LL_DMA_STREAM_6
  877. * @arg @ref LL_DMA_STREAM_7
  878. * @param NbData Between 0 to 0xFFFFFFFF
  879. * @retval None
  880. */
  881. __STATIC_INLINE void LL_DMA_SetDataLength(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t NbData)
  882. {
  883. MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->NDTR, DMA_SxNDT, NbData);
  884. }
  885. /**
  886. * @brief Get Number of data to transfer.
  887. * @rmtoll NDTR NDT LL_DMA_GetDataLength
  888. * @note Once the stream is enabled, the return value indicate the
  889. * remaining bytes to be transmitted.
  890. * @param DMAx DMAx Instance
  891. * @param Stream This parameter can be one of the following values:
  892. * @arg @ref LL_DMA_STREAM_0
  893. * @arg @ref LL_DMA_STREAM_1
  894. * @arg @ref LL_DMA_STREAM_2
  895. * @arg @ref LL_DMA_STREAM_3
  896. * @arg @ref LL_DMA_STREAM_4
  897. * @arg @ref LL_DMA_STREAM_5
  898. * @arg @ref LL_DMA_STREAM_6
  899. * @arg @ref LL_DMA_STREAM_7
  900. * @retval Between 0 to 0xFFFFFFFF
  901. */
  902. __STATIC_INLINE uint32_t LL_DMA_GetDataLength(DMA_TypeDef* DMAx, uint32_t Stream)
  903. {
  904. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->NDTR, DMA_SxNDT));
  905. }
  906. /**
  907. * @brief Select Channel number associated to the Stream.
  908. * @rmtoll CR CHSEL LL_DMA_SetChannelSelection
  909. * @param DMAx DMAx Instance
  910. * @param Stream This parameter can be one of the following values:
  911. * @arg @ref LL_DMA_STREAM_0
  912. * @arg @ref LL_DMA_STREAM_1
  913. * @arg @ref LL_DMA_STREAM_2
  914. * @arg @ref LL_DMA_STREAM_3
  915. * @arg @ref LL_DMA_STREAM_4
  916. * @arg @ref LL_DMA_STREAM_5
  917. * @arg @ref LL_DMA_STREAM_6
  918. * @arg @ref LL_DMA_STREAM_7
  919. * @param Channel This parameter can be one of the following values:
  920. * @arg @ref LL_DMA_CHANNEL_0
  921. * @arg @ref LL_DMA_CHANNEL_1
  922. * @arg @ref LL_DMA_CHANNEL_2
  923. * @arg @ref LL_DMA_CHANNEL_3
  924. * @arg @ref LL_DMA_CHANNEL_4
  925. * @arg @ref LL_DMA_CHANNEL_5
  926. * @arg @ref LL_DMA_CHANNEL_6
  927. * @arg @ref LL_DMA_CHANNEL_7
  928. * @arg @ref LL_DMA_CHANNEL_8 (*)
  929. * @arg @ref LL_DMA_CHANNEL_9 (*)
  930. * @arg @ref LL_DMA_CHANNEL_10 (*)
  931. * @arg @ref LL_DMA_CHANNEL_11 (*)
  932. * @arg @ref LL_DMA_CHANNEL_12 (*)
  933. * @arg @ref LL_DMA_CHANNEL_13 (*)
  934. * @arg @ref LL_DMA_CHANNEL_14 (*)
  935. * @arg @ref LL_DMA_CHANNEL_15 (*)
  936. *
  937. * (*) value not defined in all devices.
  938. * @retval None
  939. */
  940. __STATIC_INLINE void LL_DMA_SetChannelSelection(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Channel)
  941. {
  942. MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_CHSEL, Channel);
  943. }
  944. /**
  945. * @brief Get the Channel number associated to the Stream.
  946. * @rmtoll CR CHSEL LL_DMA_GetChannelSelection
  947. * @param DMAx DMAx Instance
  948. * @param Stream This parameter can be one of the following values:
  949. * @arg @ref LL_DMA_STREAM_0
  950. * @arg @ref LL_DMA_STREAM_1
  951. * @arg @ref LL_DMA_STREAM_2
  952. * @arg @ref LL_DMA_STREAM_3
  953. * @arg @ref LL_DMA_STREAM_4
  954. * @arg @ref LL_DMA_STREAM_5
  955. * @arg @ref LL_DMA_STREAM_6
  956. * @arg @ref LL_DMA_STREAM_7
  957. * @retval Returned value can be one of the following values:
  958. * @arg @ref LL_DMA_CHANNEL_0
  959. * @arg @ref LL_DMA_CHANNEL_1
  960. * @arg @ref LL_DMA_CHANNEL_2
  961. * @arg @ref LL_DMA_CHANNEL_3
  962. * @arg @ref LL_DMA_CHANNEL_4
  963. * @arg @ref LL_DMA_CHANNEL_5
  964. * @arg @ref LL_DMA_CHANNEL_6
  965. * @arg @ref LL_DMA_CHANNEL_7
  966. * @arg @ref LL_DMA_CHANNEL_8 (*)
  967. * @arg @ref LL_DMA_CHANNEL_9 (*)
  968. * @arg @ref LL_DMA_CHANNEL_10 (*)
  969. * @arg @ref LL_DMA_CHANNEL_11 (*)
  970. * @arg @ref LL_DMA_CHANNEL_12 (*)
  971. * @arg @ref LL_DMA_CHANNEL_13 (*)
  972. * @arg @ref LL_DMA_CHANNEL_14 (*)
  973. * @arg @ref LL_DMA_CHANNEL_15 (*)
  974. *
  975. * (*) value not defined in all devices.
  976. */
  977. __STATIC_INLINE uint32_t LL_DMA_GetChannelSelection(DMA_TypeDef *DMAx, uint32_t Stream)
  978. {
  979. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_CHSEL));
  980. }
  981. /**
  982. * @brief Set Memory burst transfer configuration.
  983. * @rmtoll CR MBURST LL_DMA_SetMemoryBurstxfer
  984. * @param DMAx DMAx Instance
  985. * @param Stream This parameter can be one of the following values:
  986. * @arg @ref LL_DMA_STREAM_0
  987. * @arg @ref LL_DMA_STREAM_1
  988. * @arg @ref LL_DMA_STREAM_2
  989. * @arg @ref LL_DMA_STREAM_3
  990. * @arg @ref LL_DMA_STREAM_4
  991. * @arg @ref LL_DMA_STREAM_5
  992. * @arg @ref LL_DMA_STREAM_6
  993. * @arg @ref LL_DMA_STREAM_7
  994. * @param Mburst This parameter can be one of the following values:
  995. * @arg @ref LL_DMA_MBURST_SINGLE
  996. * @arg @ref LL_DMA_MBURST_INC4
  997. * @arg @ref LL_DMA_MBURST_INC8
  998. * @arg @ref LL_DMA_MBURST_INC16
  999. * @retval None
  1000. */
  1001. __STATIC_INLINE void LL_DMA_SetMemoryBurstxfer(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Mburst)
  1002. {
  1003. MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_MBURST, Mburst);
  1004. }
  1005. /**
  1006. * @brief Get Memory burst transfer configuration.
  1007. * @rmtoll CR MBURST LL_DMA_GetMemoryBurstxfer
  1008. * @param DMAx DMAx Instance
  1009. * @param Stream This parameter can be one of the following values:
  1010. * @arg @ref LL_DMA_STREAM_0
  1011. * @arg @ref LL_DMA_STREAM_1
  1012. * @arg @ref LL_DMA_STREAM_2
  1013. * @arg @ref LL_DMA_STREAM_3
  1014. * @arg @ref LL_DMA_STREAM_4
  1015. * @arg @ref LL_DMA_STREAM_5
  1016. * @arg @ref LL_DMA_STREAM_6
  1017. * @arg @ref LL_DMA_STREAM_7
  1018. * @retval Returned value can be one of the following values:
  1019. * @arg @ref LL_DMA_MBURST_SINGLE
  1020. * @arg @ref LL_DMA_MBURST_INC4
  1021. * @arg @ref LL_DMA_MBURST_INC8
  1022. * @arg @ref LL_DMA_MBURST_INC16
  1023. */
  1024. __STATIC_INLINE uint32_t LL_DMA_GetMemoryBurstxfer(DMA_TypeDef *DMAx, uint32_t Stream)
  1025. {
  1026. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_MBURST));
  1027. }
  1028. /**
  1029. * @brief Set Peripheral burst transfer configuration.
  1030. * @rmtoll CR PBURST LL_DMA_SetPeriphBurstxfer
  1031. * @param DMAx DMAx Instance
  1032. * @param Stream This parameter can be one of the following values:
  1033. * @arg @ref LL_DMA_STREAM_0
  1034. * @arg @ref LL_DMA_STREAM_1
  1035. * @arg @ref LL_DMA_STREAM_2
  1036. * @arg @ref LL_DMA_STREAM_3
  1037. * @arg @ref LL_DMA_STREAM_4
  1038. * @arg @ref LL_DMA_STREAM_5
  1039. * @arg @ref LL_DMA_STREAM_6
  1040. * @arg @ref LL_DMA_STREAM_7
  1041. * @param Pburst This parameter can be one of the following values:
  1042. * @arg @ref LL_DMA_PBURST_SINGLE
  1043. * @arg @ref LL_DMA_PBURST_INC4
  1044. * @arg @ref LL_DMA_PBURST_INC8
  1045. * @arg @ref LL_DMA_PBURST_INC16
  1046. * @retval None
  1047. */
  1048. __STATIC_INLINE void LL_DMA_SetPeriphBurstxfer(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Pburst)
  1049. {
  1050. MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PBURST, Pburst);
  1051. }
  1052. /**
  1053. * @brief Get Peripheral burst transfer configuration.
  1054. * @rmtoll CR PBURST LL_DMA_GetPeriphBurstxfer
  1055. * @param DMAx DMAx Instance
  1056. * @param Stream This parameter can be one of the following values:
  1057. * @arg @ref LL_DMA_STREAM_0
  1058. * @arg @ref LL_DMA_STREAM_1
  1059. * @arg @ref LL_DMA_STREAM_2
  1060. * @arg @ref LL_DMA_STREAM_3
  1061. * @arg @ref LL_DMA_STREAM_4
  1062. * @arg @ref LL_DMA_STREAM_5
  1063. * @arg @ref LL_DMA_STREAM_6
  1064. * @arg @ref LL_DMA_STREAM_7
  1065. * @retval Returned value can be one of the following values:
  1066. * @arg @ref LL_DMA_PBURST_SINGLE
  1067. * @arg @ref LL_DMA_PBURST_INC4
  1068. * @arg @ref LL_DMA_PBURST_INC8
  1069. * @arg @ref LL_DMA_PBURST_INC16
  1070. */
  1071. __STATIC_INLINE uint32_t LL_DMA_GetPeriphBurstxfer(DMA_TypeDef *DMAx, uint32_t Stream)
  1072. {
  1073. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_PBURST));
  1074. }
  1075. /**
  1076. * @brief Set Current target (only in double buffer mode) to Memory 1 or Memory 0.
  1077. * @rmtoll CR CT LL_DMA_SetCurrentTargetMem
  1078. * @param DMAx DMAx Instance
  1079. * @param Stream This parameter can be one of the following values:
  1080. * @arg @ref LL_DMA_STREAM_0
  1081. * @arg @ref LL_DMA_STREAM_1
  1082. * @arg @ref LL_DMA_STREAM_2
  1083. * @arg @ref LL_DMA_STREAM_3
  1084. * @arg @ref LL_DMA_STREAM_4
  1085. * @arg @ref LL_DMA_STREAM_5
  1086. * @arg @ref LL_DMA_STREAM_6
  1087. * @arg @ref LL_DMA_STREAM_7
  1088. * @param CurrentMemory This parameter can be one of the following values:
  1089. * @arg @ref LL_DMA_CURRENTTARGETMEM0
  1090. * @arg @ref LL_DMA_CURRENTTARGETMEM1
  1091. * @retval None
  1092. */
  1093. __STATIC_INLINE void LL_DMA_SetCurrentTargetMem(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t CurrentMemory)
  1094. {
  1095. MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_CT, CurrentMemory);
  1096. }
  1097. /**
  1098. * @brief Set Current target (only in double buffer mode) to Memory 1 or Memory 0.
  1099. * @rmtoll CR CT LL_DMA_GetCurrentTargetMem
  1100. * @param DMAx DMAx Instance
  1101. * @param Stream This parameter can be one of the following values:
  1102. * @arg @ref LL_DMA_STREAM_0
  1103. * @arg @ref LL_DMA_STREAM_1
  1104. * @arg @ref LL_DMA_STREAM_2
  1105. * @arg @ref LL_DMA_STREAM_3
  1106. * @arg @ref LL_DMA_STREAM_4
  1107. * @arg @ref LL_DMA_STREAM_5
  1108. * @arg @ref LL_DMA_STREAM_6
  1109. * @arg @ref LL_DMA_STREAM_7
  1110. * @retval Returned value can be one of the following values:
  1111. * @arg @ref LL_DMA_CURRENTTARGETMEM0
  1112. * @arg @ref LL_DMA_CURRENTTARGETMEM1
  1113. */
  1114. __STATIC_INLINE uint32_t LL_DMA_GetCurrentTargetMem(DMA_TypeDef *DMAx, uint32_t Stream)
  1115. {
  1116. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_CT));
  1117. }
  1118. /**
  1119. * @brief Enable the double buffer mode.
  1120. * @rmtoll CR DBM LL_DMA_EnableDoubleBufferMode
  1121. * @param DMAx DMAx Instance
  1122. * @param Stream This parameter can be one of the following values:
  1123. * @arg @ref LL_DMA_STREAM_0
  1124. * @arg @ref LL_DMA_STREAM_1
  1125. * @arg @ref LL_DMA_STREAM_2
  1126. * @arg @ref LL_DMA_STREAM_3
  1127. * @arg @ref LL_DMA_STREAM_4
  1128. * @arg @ref LL_DMA_STREAM_5
  1129. * @arg @ref LL_DMA_STREAM_6
  1130. * @arg @ref LL_DMA_STREAM_7
  1131. * @retval None
  1132. */
  1133. __STATIC_INLINE void LL_DMA_EnableDoubleBufferMode(DMA_TypeDef *DMAx, uint32_t Stream)
  1134. {
  1135. SET_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_DBM);
  1136. }
  1137. /**
  1138. * @brief Disable the double buffer mode.
  1139. * @rmtoll CR DBM LL_DMA_DisableDoubleBufferMode
  1140. * @param DMAx DMAx Instance
  1141. * @param Stream This parameter can be one of the following values:
  1142. * @arg @ref LL_DMA_STREAM_0
  1143. * @arg @ref LL_DMA_STREAM_1
  1144. * @arg @ref LL_DMA_STREAM_2
  1145. * @arg @ref LL_DMA_STREAM_3
  1146. * @arg @ref LL_DMA_STREAM_4
  1147. * @arg @ref LL_DMA_STREAM_5
  1148. * @arg @ref LL_DMA_STREAM_6
  1149. * @arg @ref LL_DMA_STREAM_7
  1150. * @retval None
  1151. */
  1152. __STATIC_INLINE void LL_DMA_DisableDoubleBufferMode(DMA_TypeDef *DMAx, uint32_t Stream)
  1153. {
  1154. CLEAR_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_DBM);
  1155. }
  1156. /**
  1157. * @brief Get FIFO status.
  1158. * @rmtoll FCR FS LL_DMA_GetFIFOStatus
  1159. * @param DMAx DMAx Instance
  1160. * @param Stream This parameter can be one of the following values:
  1161. * @arg @ref LL_DMA_STREAM_0
  1162. * @arg @ref LL_DMA_STREAM_1
  1163. * @arg @ref LL_DMA_STREAM_2
  1164. * @arg @ref LL_DMA_STREAM_3
  1165. * @arg @ref LL_DMA_STREAM_4
  1166. * @arg @ref LL_DMA_STREAM_5
  1167. * @arg @ref LL_DMA_STREAM_6
  1168. * @arg @ref LL_DMA_STREAM_7
  1169. * @retval Returned value can be one of the following values:
  1170. * @arg @ref LL_DMA_FIFOSTATUS_0_25
  1171. * @arg @ref LL_DMA_FIFOSTATUS_25_50
  1172. * @arg @ref LL_DMA_FIFOSTATUS_50_75
  1173. * @arg @ref LL_DMA_FIFOSTATUS_75_100
  1174. * @arg @ref LL_DMA_FIFOSTATUS_EMPTY
  1175. * @arg @ref LL_DMA_FIFOSTATUS_FULL
  1176. */
  1177. __STATIC_INLINE uint32_t LL_DMA_GetFIFOStatus(DMA_TypeDef *DMAx, uint32_t Stream)
  1178. {
  1179. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_FS));
  1180. }
  1181. /**
  1182. * @brief Disable Fifo mode.
  1183. * @rmtoll FCR DMDIS LL_DMA_DisableFifoMode
  1184. * @param DMAx DMAx Instance
  1185. * @param Stream This parameter can be one of the following values:
  1186. * @arg @ref LL_DMA_STREAM_0
  1187. * @arg @ref LL_DMA_STREAM_1
  1188. * @arg @ref LL_DMA_STREAM_2
  1189. * @arg @ref LL_DMA_STREAM_3
  1190. * @arg @ref LL_DMA_STREAM_4
  1191. * @arg @ref LL_DMA_STREAM_5
  1192. * @arg @ref LL_DMA_STREAM_6
  1193. * @arg @ref LL_DMA_STREAM_7
  1194. * @retval None
  1195. */
  1196. __STATIC_INLINE void LL_DMA_DisableFifoMode(DMA_TypeDef *DMAx, uint32_t Stream)
  1197. {
  1198. CLEAR_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_DMDIS);
  1199. }
  1200. /**
  1201. * @brief Enable Fifo mode.
  1202. * @rmtoll FCR DMDIS LL_DMA_EnableFifoMode
  1203. * @param DMAx DMAx Instance
  1204. * @param Stream This parameter can be one of the following values:
  1205. * @arg @ref LL_DMA_STREAM_0
  1206. * @arg @ref LL_DMA_STREAM_1
  1207. * @arg @ref LL_DMA_STREAM_2
  1208. * @arg @ref LL_DMA_STREAM_3
  1209. * @arg @ref LL_DMA_STREAM_4
  1210. * @arg @ref LL_DMA_STREAM_5
  1211. * @arg @ref LL_DMA_STREAM_6
  1212. * @arg @ref LL_DMA_STREAM_7
  1213. * @retval None
  1214. */
  1215. __STATIC_INLINE void LL_DMA_EnableFifoMode(DMA_TypeDef *DMAx, uint32_t Stream)
  1216. {
  1217. SET_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_DMDIS);
  1218. }
  1219. /**
  1220. * @brief Select FIFO threshold.
  1221. * @rmtoll FCR FTH LL_DMA_SetFIFOThreshold
  1222. * @param DMAx DMAx Instance
  1223. * @param Stream This parameter can be one of the following values:
  1224. * @arg @ref LL_DMA_STREAM_0
  1225. * @arg @ref LL_DMA_STREAM_1
  1226. * @arg @ref LL_DMA_STREAM_2
  1227. * @arg @ref LL_DMA_STREAM_3
  1228. * @arg @ref LL_DMA_STREAM_4
  1229. * @arg @ref LL_DMA_STREAM_5
  1230. * @arg @ref LL_DMA_STREAM_6
  1231. * @arg @ref LL_DMA_STREAM_7
  1232. * @param Threshold This parameter can be one of the following values:
  1233. * @arg @ref LL_DMA_FIFOTHRESHOLD_1_4
  1234. * @arg @ref LL_DMA_FIFOTHRESHOLD_1_2
  1235. * @arg @ref LL_DMA_FIFOTHRESHOLD_3_4
  1236. * @arg @ref LL_DMA_FIFOTHRESHOLD_FULL
  1237. * @retval None
  1238. */
  1239. __STATIC_INLINE void LL_DMA_SetFIFOThreshold(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Threshold)
  1240. {
  1241. MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_FTH, Threshold);
  1242. }
  1243. /**
  1244. * @brief Get FIFO threshold.
  1245. * @rmtoll FCR FTH LL_DMA_GetFIFOThreshold
  1246. * @param DMAx DMAx Instance
  1247. * @param Stream This parameter can be one of the following values:
  1248. * @arg @ref LL_DMA_STREAM_0
  1249. * @arg @ref LL_DMA_STREAM_1
  1250. * @arg @ref LL_DMA_STREAM_2
  1251. * @arg @ref LL_DMA_STREAM_3
  1252. * @arg @ref LL_DMA_STREAM_4
  1253. * @arg @ref LL_DMA_STREAM_5
  1254. * @arg @ref LL_DMA_STREAM_6
  1255. * @arg @ref LL_DMA_STREAM_7
  1256. * @retval Returned value can be one of the following values:
  1257. * @arg @ref LL_DMA_FIFOTHRESHOLD_1_4
  1258. * @arg @ref LL_DMA_FIFOTHRESHOLD_1_2
  1259. * @arg @ref LL_DMA_FIFOTHRESHOLD_3_4
  1260. * @arg @ref LL_DMA_FIFOTHRESHOLD_FULL
  1261. */
  1262. __STATIC_INLINE uint32_t LL_DMA_GetFIFOThreshold(DMA_TypeDef *DMAx, uint32_t Stream)
  1263. {
  1264. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_FTH));
  1265. }
  1266. /**
  1267. * @brief Configure the FIFO .
  1268. * @rmtoll FCR FTH LL_DMA_ConfigFifo\n
  1269. * FCR DMDIS LL_DMA_ConfigFifo
  1270. * @param DMAx DMAx Instance
  1271. * @param Stream This parameter can be one of the following values:
  1272. * @arg @ref LL_DMA_STREAM_0
  1273. * @arg @ref LL_DMA_STREAM_1
  1274. * @arg @ref LL_DMA_STREAM_2
  1275. * @arg @ref LL_DMA_STREAM_3
  1276. * @arg @ref LL_DMA_STREAM_4
  1277. * @arg @ref LL_DMA_STREAM_5
  1278. * @arg @ref LL_DMA_STREAM_6
  1279. * @arg @ref LL_DMA_STREAM_7
  1280. * @param FifoMode This parameter can be one of the following values:
  1281. * @arg @ref LL_DMA_FIFOMODE_ENABLE
  1282. * @arg @ref LL_DMA_FIFOMODE_DISABLE
  1283. * @param FifoThreshold This parameter can be one of the following values:
  1284. * @arg @ref LL_DMA_FIFOTHRESHOLD_1_4
  1285. * @arg @ref LL_DMA_FIFOTHRESHOLD_1_2
  1286. * @arg @ref LL_DMA_FIFOTHRESHOLD_3_4
  1287. * @arg @ref LL_DMA_FIFOTHRESHOLD_FULL
  1288. * @retval None
  1289. */
  1290. __STATIC_INLINE void LL_DMA_ConfigFifo(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t FifoMode, uint32_t FifoThreshold)
  1291. {
  1292. MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_FTH|DMA_SxFCR_DMDIS, FifoMode|FifoThreshold);
  1293. }
  1294. /**
  1295. * @brief Configure the Source and Destination addresses.
  1296. * @note This API must not be called when the DMA stream is enabled.
  1297. * @rmtoll M0AR M0A LL_DMA_ConfigAddresses\n
  1298. * PAR PA LL_DMA_ConfigAddresses
  1299. * @param DMAx DMAx Instance
  1300. * @param Stream This parameter can be one of the following values:
  1301. * @arg @ref LL_DMA_STREAM_0
  1302. * @arg @ref LL_DMA_STREAM_1
  1303. * @arg @ref LL_DMA_STREAM_2
  1304. * @arg @ref LL_DMA_STREAM_3
  1305. * @arg @ref LL_DMA_STREAM_4
  1306. * @arg @ref LL_DMA_STREAM_5
  1307. * @arg @ref LL_DMA_STREAM_6
  1308. * @arg @ref LL_DMA_STREAM_7
  1309. * @param SrcAddress Between 0 to 0xFFFFFFFF
  1310. * @param DstAddress Between 0 to 0xFFFFFFFF
  1311. * @param Direction This parameter can be one of the following values:
  1312. * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY
  1313. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH
  1314. * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY
  1315. * @retval None
  1316. */
  1317. __STATIC_INLINE void LL_DMA_ConfigAddresses(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t SrcAddress, uint32_t DstAddress, uint32_t Direction)
  1318. {
  1319. /* Direction Memory to Periph */
  1320. if (Direction == LL_DMA_DIRECTION_MEMORY_TO_PERIPH)
  1321. {
  1322. WRITE_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->M0AR, SrcAddress);
  1323. WRITE_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->PAR, DstAddress);
  1324. }
  1325. /* Direction Periph to Memory and Memory to Memory */
  1326. else
  1327. {
  1328. WRITE_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->PAR, SrcAddress);
  1329. WRITE_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->M0AR, DstAddress);
  1330. }
  1331. }
  1332. /**
  1333. * @brief Set the Memory address.
  1334. * @rmtoll M0AR M0A LL_DMA_SetMemoryAddress
  1335. * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only.
  1336. * @note This API must not be called when the DMA channel is enabled.
  1337. * @param DMAx DMAx Instance
  1338. * @param Stream This parameter can be one of the following values:
  1339. * @arg @ref LL_DMA_STREAM_0
  1340. * @arg @ref LL_DMA_STREAM_1
  1341. * @arg @ref LL_DMA_STREAM_2
  1342. * @arg @ref LL_DMA_STREAM_3
  1343. * @arg @ref LL_DMA_STREAM_4
  1344. * @arg @ref LL_DMA_STREAM_5
  1345. * @arg @ref LL_DMA_STREAM_6
  1346. * @arg @ref LL_DMA_STREAM_7
  1347. * @param MemoryAddress Between 0 to 0xFFFFFFFF
  1348. * @retval None
  1349. */
  1350. __STATIC_INLINE void LL_DMA_SetMemoryAddress(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t MemoryAddress)
  1351. {
  1352. WRITE_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->M0AR, MemoryAddress);
  1353. }
  1354. /**
  1355. * @brief Set the Peripheral address.
  1356. * @rmtoll PAR PA LL_DMA_SetPeriphAddress
  1357. * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only.
  1358. * @note This API must not be called when the DMA channel is enabled.
  1359. * @param DMAx DMAx Instance
  1360. * @param Stream This parameter can be one of the following values:
  1361. * @arg @ref LL_DMA_STREAM_0
  1362. * @arg @ref LL_DMA_STREAM_1
  1363. * @arg @ref LL_DMA_STREAM_2
  1364. * @arg @ref LL_DMA_STREAM_3
  1365. * @arg @ref LL_DMA_STREAM_4
  1366. * @arg @ref LL_DMA_STREAM_5
  1367. * @arg @ref LL_DMA_STREAM_6
  1368. * @arg @ref LL_DMA_STREAM_7
  1369. * @param PeriphAddress Between 0 to 0xFFFFFFFF
  1370. * @retval None
  1371. */
  1372. __STATIC_INLINE void LL_DMA_SetPeriphAddress(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t PeriphAddress)
  1373. {
  1374. WRITE_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->PAR, PeriphAddress);
  1375. }
  1376. /**
  1377. * @brief Get the Memory address.
  1378. * @rmtoll M0AR M0A LL_DMA_GetMemoryAddress
  1379. * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only.
  1380. * @param DMAx DMAx Instance
  1381. * @param Stream This parameter can be one of the following values:
  1382. * @arg @ref LL_DMA_STREAM_0
  1383. * @arg @ref LL_DMA_STREAM_1
  1384. * @arg @ref LL_DMA_STREAM_2
  1385. * @arg @ref LL_DMA_STREAM_3
  1386. * @arg @ref LL_DMA_STREAM_4
  1387. * @arg @ref LL_DMA_STREAM_5
  1388. * @arg @ref LL_DMA_STREAM_6
  1389. * @arg @ref LL_DMA_STREAM_7
  1390. * @retval Between 0 to 0xFFFFFFFF
  1391. */
  1392. __STATIC_INLINE uint32_t LL_DMA_GetMemoryAddress(DMA_TypeDef* DMAx, uint32_t Stream)
  1393. {
  1394. return (READ_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->M0AR));
  1395. }
  1396. /**
  1397. * @brief Get the Peripheral address.
  1398. * @rmtoll PAR PA LL_DMA_GetPeriphAddress
  1399. * @note Interface used for direction LL_DMA_DIRECTION_PERIPH_TO_MEMORY or LL_DMA_DIRECTION_MEMORY_TO_PERIPH only.
  1400. * @param DMAx DMAx Instance
  1401. * @param Stream This parameter can be one of the following values:
  1402. * @arg @ref LL_DMA_STREAM_0
  1403. * @arg @ref LL_DMA_STREAM_1
  1404. * @arg @ref LL_DMA_STREAM_2
  1405. * @arg @ref LL_DMA_STREAM_3
  1406. * @arg @ref LL_DMA_STREAM_4
  1407. * @arg @ref LL_DMA_STREAM_5
  1408. * @arg @ref LL_DMA_STREAM_6
  1409. * @arg @ref LL_DMA_STREAM_7
  1410. * @retval Between 0 to 0xFFFFFFFF
  1411. */
  1412. __STATIC_INLINE uint32_t LL_DMA_GetPeriphAddress(DMA_TypeDef* DMAx, uint32_t Stream)
  1413. {
  1414. return (READ_REG(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->PAR));
  1415. }
  1416. /**
  1417. * @brief Set the Memory to Memory Source address.
  1418. * @rmtoll PAR PA LL_DMA_SetM2MSrcAddress
  1419. * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only.
  1420. * @note This API must not be called when the DMA channel is enabled.
  1421. * @param DMAx DMAx Instance
  1422. * @param Stream This parameter can be one of the following values:
  1423. * @arg @ref LL_DMA_STREAM_0
  1424. * @arg @ref LL_DMA_STREAM_1
  1425. * @arg @ref LL_DMA_STREAM_2
  1426. * @arg @ref LL_DMA_STREAM_3
  1427. * @arg @ref LL_DMA_STREAM_4
  1428. * @arg @ref LL_DMA_STREAM_5
  1429. * @arg @ref LL_DMA_STREAM_6
  1430. * @arg @ref LL_DMA_STREAM_7
  1431. * @param MemoryAddress Between 0 to 0xFFFFFFFF
  1432. * @retval None
  1433. */
  1434. __STATIC_INLINE void LL_DMA_SetM2MSrcAddress(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t MemoryAddress)
  1435. {
  1436. WRITE_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->PAR, MemoryAddress);
  1437. }
  1438. /**
  1439. * @brief Set the Memory to Memory Destination address.
  1440. * @rmtoll M0AR M0A LL_DMA_SetM2MDstAddress
  1441. * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only.
  1442. * @note This API must not be called when the DMA channel is enabled.
  1443. * @param DMAx DMAx Instance
  1444. * @param Stream This parameter can be one of the following values:
  1445. * @arg @ref LL_DMA_STREAM_0
  1446. * @arg @ref LL_DMA_STREAM_1
  1447. * @arg @ref LL_DMA_STREAM_2
  1448. * @arg @ref LL_DMA_STREAM_3
  1449. * @arg @ref LL_DMA_STREAM_4
  1450. * @arg @ref LL_DMA_STREAM_5
  1451. * @arg @ref LL_DMA_STREAM_6
  1452. * @arg @ref LL_DMA_STREAM_7
  1453. * @param MemoryAddress Between 0 to 0xFFFFFFFF
  1454. * @retval None
  1455. */
  1456. __STATIC_INLINE void LL_DMA_SetM2MDstAddress(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t MemoryAddress)
  1457. {
  1458. WRITE_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->M0AR, MemoryAddress);
  1459. }
  1460. /**
  1461. * @brief Get the Memory to Memory Source address.
  1462. * @rmtoll PAR PA LL_DMA_GetM2MSrcAddress
  1463. * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only.
  1464. * @param DMAx DMAx Instance
  1465. * @param Stream This parameter can be one of the following values:
  1466. * @arg @ref LL_DMA_STREAM_0
  1467. * @arg @ref LL_DMA_STREAM_1
  1468. * @arg @ref LL_DMA_STREAM_2
  1469. * @arg @ref LL_DMA_STREAM_3
  1470. * @arg @ref LL_DMA_STREAM_4
  1471. * @arg @ref LL_DMA_STREAM_5
  1472. * @arg @ref LL_DMA_STREAM_6
  1473. * @arg @ref LL_DMA_STREAM_7
  1474. * @retval Between 0 to 0xFFFFFFFF
  1475. */
  1476. __STATIC_INLINE uint32_t LL_DMA_GetM2MSrcAddress(DMA_TypeDef* DMAx, uint32_t Stream)
  1477. {
  1478. return (READ_REG(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->PAR));
  1479. }
  1480. /**
  1481. * @brief Get the Memory to Memory Destination address.
  1482. * @rmtoll M0AR M0A LL_DMA_GetM2MDstAddress
  1483. * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only.
  1484. * @param DMAx DMAx Instance
  1485. * @param Stream This parameter can be one of the following values:
  1486. * @arg @ref LL_DMA_STREAM_0
  1487. * @arg @ref LL_DMA_STREAM_1
  1488. * @arg @ref LL_DMA_STREAM_2
  1489. * @arg @ref LL_DMA_STREAM_3
  1490. * @arg @ref LL_DMA_STREAM_4
  1491. * @arg @ref LL_DMA_STREAM_5
  1492. * @arg @ref LL_DMA_STREAM_6
  1493. * @arg @ref LL_DMA_STREAM_7
  1494. * @retval Between 0 to 0xFFFFFFFF
  1495. */
  1496. __STATIC_INLINE uint32_t LL_DMA_GetM2MDstAddress(DMA_TypeDef* DMAx, uint32_t Stream)
  1497. {
  1498. return (READ_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->M0AR));
  1499. }
  1500. /**
  1501. * @brief Set Memory 1 address (used in case of Double buffer mode).
  1502. * @rmtoll M1AR M1A LL_DMA_SetMemory1Address
  1503. * @param DMAx DMAx Instance
  1504. * @param Stream This parameter can be one of the following values:
  1505. * @arg @ref LL_DMA_STREAM_0
  1506. * @arg @ref LL_DMA_STREAM_1
  1507. * @arg @ref LL_DMA_STREAM_2
  1508. * @arg @ref LL_DMA_STREAM_3
  1509. * @arg @ref LL_DMA_STREAM_4
  1510. * @arg @ref LL_DMA_STREAM_5
  1511. * @arg @ref LL_DMA_STREAM_6
  1512. * @arg @ref LL_DMA_STREAM_7
  1513. * @param Address Between 0 to 0xFFFFFFFF
  1514. * @retval None
  1515. */
  1516. __STATIC_INLINE void LL_DMA_SetMemory1Address(DMA_TypeDef *DMAx, uint32_t Stream, uint32_t Address)
  1517. {
  1518. MODIFY_REG(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->M1AR, DMA_SxM1AR_M1A, Address);
  1519. }
  1520. /**
  1521. * @brief Get Memory 1 address (used in case of Double buffer mode).
  1522. * @rmtoll M1AR M1A LL_DMA_GetMemory1Address
  1523. * @param DMAx DMAx Instance
  1524. * @param Stream This parameter can be one of the following values:
  1525. * @arg @ref LL_DMA_STREAM_0
  1526. * @arg @ref LL_DMA_STREAM_1
  1527. * @arg @ref LL_DMA_STREAM_2
  1528. * @arg @ref LL_DMA_STREAM_3
  1529. * @arg @ref LL_DMA_STREAM_4
  1530. * @arg @ref LL_DMA_STREAM_5
  1531. * @arg @ref LL_DMA_STREAM_6
  1532. * @arg @ref LL_DMA_STREAM_7
  1533. * @retval Between 0 to 0xFFFFFFFF
  1534. */
  1535. __STATIC_INLINE uint32_t LL_DMA_GetMemory1Address(DMA_TypeDef *DMAx, uint32_t Stream)
  1536. {
  1537. return (((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->M1AR);
  1538. }
  1539. /**
  1540. * @}
  1541. */
  1542. /** @defgroup DMA_LL_EF_FLAG_Management FLAG_Management
  1543. * @{
  1544. */
  1545. /**
  1546. * @brief Get Stream 0 half transfer flag.
  1547. * @rmtoll LISR HTIF0 LL_DMA_IsActiveFlag_HT0
  1548. * @param DMAx DMAx Instance
  1549. * @retval State of bit (1 or 0).
  1550. */
  1551. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT0(DMA_TypeDef *DMAx)
  1552. {
  1553. return (READ_BIT(DMAx->LISR ,DMA_LISR_HTIF0)==(DMA_LISR_HTIF0));
  1554. }
  1555. /**
  1556. * @brief Get Stream 1 half transfer flag.
  1557. * @rmtoll LISR HTIF1 LL_DMA_IsActiveFlag_HT1
  1558. * @param DMAx DMAx Instance
  1559. * @retval State of bit (1 or 0).
  1560. */
  1561. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT1(DMA_TypeDef *DMAx)
  1562. {
  1563. return (READ_BIT(DMAx->LISR ,DMA_LISR_HTIF1)==(DMA_LISR_HTIF1));
  1564. }
  1565. /**
  1566. * @brief Get Stream 2 half transfer flag.
  1567. * @rmtoll LISR HTIF2 LL_DMA_IsActiveFlag_HT2
  1568. * @param DMAx DMAx Instance
  1569. * @retval State of bit (1 or 0).
  1570. */
  1571. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT2(DMA_TypeDef *DMAx)
  1572. {
  1573. return (READ_BIT(DMAx->LISR ,DMA_LISR_HTIF2)==(DMA_LISR_HTIF2));
  1574. }
  1575. /**
  1576. * @brief Get Stream 3 half transfer flag.
  1577. * @rmtoll LISR HTIF3 LL_DMA_IsActiveFlag_HT3
  1578. * @param DMAx DMAx Instance
  1579. * @retval State of bit (1 or 0).
  1580. */
  1581. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT3(DMA_TypeDef *DMAx)
  1582. {
  1583. return (READ_BIT(DMAx->LISR ,DMA_LISR_HTIF3)==(DMA_LISR_HTIF3));
  1584. }
  1585. /**
  1586. * @brief Get Stream 4 half transfer flag.
  1587. * @rmtoll HISR HTIF4 LL_DMA_IsActiveFlag_HT4
  1588. * @param DMAx DMAx Instance
  1589. * @retval State of bit (1 or 0).
  1590. */
  1591. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT4(DMA_TypeDef *DMAx)
  1592. {
  1593. return (READ_BIT(DMAx->HISR ,DMA_HISR_HTIF4)==(DMA_HISR_HTIF4));
  1594. }
  1595. /**
  1596. * @brief Get Stream 5 half transfer flag.
  1597. * @rmtoll HISR HTIF0 LL_DMA_IsActiveFlag_HT5
  1598. * @param DMAx DMAx Instance
  1599. * @retval State of bit (1 or 0).
  1600. */
  1601. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT5(DMA_TypeDef *DMAx)
  1602. {
  1603. return (READ_BIT(DMAx->HISR ,DMA_HISR_HTIF5)==(DMA_HISR_HTIF5));
  1604. }
  1605. /**
  1606. * @brief Get Stream 6 half transfer flag.
  1607. * @rmtoll HISR HTIF6 LL_DMA_IsActiveFlag_HT6
  1608. * @param DMAx DMAx Instance
  1609. * @retval State of bit (1 or 0).
  1610. */
  1611. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT6(DMA_TypeDef *DMAx)
  1612. {
  1613. return (READ_BIT(DMAx->HISR ,DMA_HISR_HTIF6)==(DMA_HISR_HTIF6));
  1614. }
  1615. /**
  1616. * @brief Get Stream 7 half transfer flag.
  1617. * @rmtoll HISR HTIF7 LL_DMA_IsActiveFlag_HT7
  1618. * @param DMAx DMAx Instance
  1619. * @retval State of bit (1 or 0).
  1620. */
  1621. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_HT7(DMA_TypeDef *DMAx)
  1622. {
  1623. return (READ_BIT(DMAx->HISR ,DMA_HISR_HTIF7)==(DMA_HISR_HTIF7));
  1624. }
  1625. /**
  1626. * @brief Get Stream 0 transfer complete flag.
  1627. * @rmtoll LISR TCIF0 LL_DMA_IsActiveFlag_TC0
  1628. * @param DMAx DMAx Instance
  1629. * @retval State of bit (1 or 0).
  1630. */
  1631. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC0(DMA_TypeDef *DMAx)
  1632. {
  1633. return (READ_BIT(DMAx->LISR ,DMA_LISR_TCIF0)==(DMA_LISR_TCIF0));
  1634. }
  1635. /**
  1636. * @brief Get Stream 1 transfer complete flag.
  1637. * @rmtoll LISR TCIF1 LL_DMA_IsActiveFlag_TC1
  1638. * @param DMAx DMAx Instance
  1639. * @retval State of bit (1 or 0).
  1640. */
  1641. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC1(DMA_TypeDef *DMAx)
  1642. {
  1643. return (READ_BIT(DMAx->LISR ,DMA_LISR_TCIF1)==(DMA_LISR_TCIF1));
  1644. }
  1645. /**
  1646. * @brief Get Stream 2 transfer complete flag.
  1647. * @rmtoll LISR TCIF2 LL_DMA_IsActiveFlag_TC2
  1648. * @param DMAx DMAx Instance
  1649. * @retval State of bit (1 or 0).
  1650. */
  1651. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC2(DMA_TypeDef *DMAx)
  1652. {
  1653. return (READ_BIT(DMAx->LISR ,DMA_LISR_TCIF2)==(DMA_LISR_TCIF2));
  1654. }
  1655. /**
  1656. * @brief Get Stream 3 transfer complete flag.
  1657. * @rmtoll LISR TCIF3 LL_DMA_IsActiveFlag_TC3
  1658. * @param DMAx DMAx Instance
  1659. * @retval State of bit (1 or 0).
  1660. */
  1661. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC3(DMA_TypeDef *DMAx)
  1662. {
  1663. return (READ_BIT(DMAx->LISR ,DMA_LISR_TCIF3)==(DMA_LISR_TCIF3));
  1664. }
  1665. /**
  1666. * @brief Get Stream 4 transfer complete flag.
  1667. * @rmtoll HISR TCIF4 LL_DMA_IsActiveFlag_TC4
  1668. * @param DMAx DMAx Instance
  1669. * @retval State of bit (1 or 0).
  1670. */
  1671. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC4(DMA_TypeDef *DMAx)
  1672. {
  1673. return (READ_BIT(DMAx->HISR ,DMA_HISR_TCIF4)==(DMA_HISR_TCIF4));
  1674. }
  1675. /**
  1676. * @brief Get Stream 5 transfer complete flag.
  1677. * @rmtoll HISR TCIF0 LL_DMA_IsActiveFlag_TC5
  1678. * @param DMAx DMAx Instance
  1679. * @retval State of bit (1 or 0).
  1680. */
  1681. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC5(DMA_TypeDef *DMAx)
  1682. {
  1683. return (READ_BIT(DMAx->HISR ,DMA_HISR_TCIF5)==(DMA_HISR_TCIF5));
  1684. }
  1685. /**
  1686. * @brief Get Stream 6 transfer complete flag.
  1687. * @rmtoll HISR TCIF6 LL_DMA_IsActiveFlag_TC6
  1688. * @param DMAx DMAx Instance
  1689. * @retval State of bit (1 or 0).
  1690. */
  1691. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC6(DMA_TypeDef *DMAx)
  1692. {
  1693. return (READ_BIT(DMAx->HISR ,DMA_HISR_TCIF6)==(DMA_HISR_TCIF6));
  1694. }
  1695. /**
  1696. * @brief Get Stream 7 transfer complete flag.
  1697. * @rmtoll HISR TCIF7 LL_DMA_IsActiveFlag_TC7
  1698. * @param DMAx DMAx Instance
  1699. * @retval State of bit (1 or 0).
  1700. */
  1701. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TC7(DMA_TypeDef *DMAx)
  1702. {
  1703. return (READ_BIT(DMAx->HISR ,DMA_HISR_TCIF7)==(DMA_HISR_TCIF7));
  1704. }
  1705. /**
  1706. * @brief Get Stream 0 transfer error flag.
  1707. * @rmtoll LISR TEIF0 LL_DMA_IsActiveFlag_TE0
  1708. * @param DMAx DMAx Instance
  1709. * @retval State of bit (1 or 0).
  1710. */
  1711. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE0(DMA_TypeDef *DMAx)
  1712. {
  1713. return (READ_BIT(DMAx->LISR ,DMA_LISR_TEIF0)==(DMA_LISR_TEIF0));
  1714. }
  1715. /**
  1716. * @brief Get Stream 1 transfer error flag.
  1717. * @rmtoll LISR TEIF1 LL_DMA_IsActiveFlag_TE1
  1718. * @param DMAx DMAx Instance
  1719. * @retval State of bit (1 or 0).
  1720. */
  1721. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE1(DMA_TypeDef *DMAx)
  1722. {
  1723. return (READ_BIT(DMAx->LISR ,DMA_LISR_TEIF1)==(DMA_LISR_TEIF1));
  1724. }
  1725. /**
  1726. * @brief Get Stream 2 transfer error flag.
  1727. * @rmtoll LISR TEIF2 LL_DMA_IsActiveFlag_TE2
  1728. * @param DMAx DMAx Instance
  1729. * @retval State of bit (1 or 0).
  1730. */
  1731. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE2(DMA_TypeDef *DMAx)
  1732. {
  1733. return (READ_BIT(DMAx->LISR ,DMA_LISR_TEIF2)==(DMA_LISR_TEIF2));
  1734. }
  1735. /**
  1736. * @brief Get Stream 3 transfer error flag.
  1737. * @rmtoll LISR TEIF3 LL_DMA_IsActiveFlag_TE3
  1738. * @param DMAx DMAx Instance
  1739. * @retval State of bit (1 or 0).
  1740. */
  1741. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE3(DMA_TypeDef *DMAx)
  1742. {
  1743. return (READ_BIT(DMAx->LISR ,DMA_LISR_TEIF3)==(DMA_LISR_TEIF3));
  1744. }
  1745. /**
  1746. * @brief Get Stream 4 transfer error flag.
  1747. * @rmtoll HISR TEIF4 LL_DMA_IsActiveFlag_TE4
  1748. * @param DMAx DMAx Instance
  1749. * @retval State of bit (1 or 0).
  1750. */
  1751. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE4(DMA_TypeDef *DMAx)
  1752. {
  1753. return (READ_BIT(DMAx->HISR ,DMA_HISR_TEIF4)==(DMA_HISR_TEIF4));
  1754. }
  1755. /**
  1756. * @brief Get Stream 5 transfer error flag.
  1757. * @rmtoll HISR TEIF0 LL_DMA_IsActiveFlag_TE5
  1758. * @param DMAx DMAx Instance
  1759. * @retval State of bit (1 or 0).
  1760. */
  1761. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE5(DMA_TypeDef *DMAx)
  1762. {
  1763. return (READ_BIT(DMAx->HISR ,DMA_HISR_TEIF5)==(DMA_HISR_TEIF5));
  1764. }
  1765. /**
  1766. * @brief Get Stream 6 transfer error flag.
  1767. * @rmtoll HISR TEIF6 LL_DMA_IsActiveFlag_TE6
  1768. * @param DMAx DMAx Instance
  1769. * @retval State of bit (1 or 0).
  1770. */
  1771. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE6(DMA_TypeDef *DMAx)
  1772. {
  1773. return (READ_BIT(DMAx->HISR ,DMA_HISR_TEIF6)==(DMA_HISR_TEIF6));
  1774. }
  1775. /**
  1776. * @brief Get Stream 7 transfer error flag.
  1777. * @rmtoll HISR TEIF7 LL_DMA_IsActiveFlag_TE7
  1778. * @param DMAx DMAx Instance
  1779. * @retval State of bit (1 or 0).
  1780. */
  1781. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_TE7(DMA_TypeDef *DMAx)
  1782. {
  1783. return (READ_BIT(DMAx->HISR ,DMA_HISR_TEIF7)==(DMA_HISR_TEIF7));
  1784. }
  1785. /**
  1786. * @brief Get Stream 0 direct mode error flag.
  1787. * @rmtoll LISR DMEIF0 LL_DMA_IsActiveFlag_DME0
  1788. * @param DMAx DMAx Instance
  1789. * @retval State of bit (1 or 0).
  1790. */
  1791. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME0(DMA_TypeDef *DMAx)
  1792. {
  1793. return (READ_BIT(DMAx->LISR ,DMA_LISR_DMEIF0)==(DMA_LISR_DMEIF0));
  1794. }
  1795. /**
  1796. * @brief Get Stream 1 direct mode error flag.
  1797. * @rmtoll LISR DMEIF1 LL_DMA_IsActiveFlag_DME1
  1798. * @param DMAx DMAx Instance
  1799. * @retval State of bit (1 or 0).
  1800. */
  1801. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME1(DMA_TypeDef *DMAx)
  1802. {
  1803. return (READ_BIT(DMAx->LISR ,DMA_LISR_DMEIF1)==(DMA_LISR_DMEIF1));
  1804. }
  1805. /**
  1806. * @brief Get Stream 2 direct mode error flag.
  1807. * @rmtoll LISR DMEIF2 LL_DMA_IsActiveFlag_DME2
  1808. * @param DMAx DMAx Instance
  1809. * @retval State of bit (1 or 0).
  1810. */
  1811. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME2(DMA_TypeDef *DMAx)
  1812. {
  1813. return (READ_BIT(DMAx->LISR ,DMA_LISR_DMEIF2)==(DMA_LISR_DMEIF2));
  1814. }
  1815. /**
  1816. * @brief Get Stream 3 direct mode error flag.
  1817. * @rmtoll LISR DMEIF3 LL_DMA_IsActiveFlag_DME3
  1818. * @param DMAx DMAx Instance
  1819. * @retval State of bit (1 or 0).
  1820. */
  1821. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME3(DMA_TypeDef *DMAx)
  1822. {
  1823. return (READ_BIT(DMAx->LISR ,DMA_LISR_DMEIF3)==(DMA_LISR_DMEIF3));
  1824. }
  1825. /**
  1826. * @brief Get Stream 4 direct mode error flag.
  1827. * @rmtoll HISR DMEIF4 LL_DMA_IsActiveFlag_DME4
  1828. * @param DMAx DMAx Instance
  1829. * @retval State of bit (1 or 0).
  1830. */
  1831. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME4(DMA_TypeDef *DMAx)
  1832. {
  1833. return (READ_BIT(DMAx->HISR ,DMA_HISR_DMEIF4)==(DMA_HISR_DMEIF4));
  1834. }
  1835. /**
  1836. * @brief Get Stream 5 direct mode error flag.
  1837. * @rmtoll HISR DMEIF0 LL_DMA_IsActiveFlag_DME5
  1838. * @param DMAx DMAx Instance
  1839. * @retval State of bit (1 or 0).
  1840. */
  1841. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME5(DMA_TypeDef *DMAx)
  1842. {
  1843. return (READ_BIT(DMAx->HISR ,DMA_HISR_DMEIF5)==(DMA_HISR_DMEIF5));
  1844. }
  1845. /**
  1846. * @brief Get Stream 6 direct mode error flag.
  1847. * @rmtoll HISR DMEIF6 LL_DMA_IsActiveFlag_DME6
  1848. * @param DMAx DMAx Instance
  1849. * @retval State of bit (1 or 0).
  1850. */
  1851. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME6(DMA_TypeDef *DMAx)
  1852. {
  1853. return (READ_BIT(DMAx->HISR ,DMA_HISR_DMEIF6)==(DMA_HISR_DMEIF6));
  1854. }
  1855. /**
  1856. * @brief Get Stream 7 direct mode error flag.
  1857. * @rmtoll HISR DMEIF7 LL_DMA_IsActiveFlag_DME7
  1858. * @param DMAx DMAx Instance
  1859. * @retval State of bit (1 or 0).
  1860. */
  1861. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_DME7(DMA_TypeDef *DMAx)
  1862. {
  1863. return (READ_BIT(DMAx->HISR ,DMA_HISR_DMEIF7)==(DMA_HISR_DMEIF7));
  1864. }
  1865. /**
  1866. * @brief Get Stream 0 FIFO error flag.
  1867. * @rmtoll LISR FEIF0 LL_DMA_IsActiveFlag_FE0
  1868. * @param DMAx DMAx Instance
  1869. * @retval State of bit (1 or 0).
  1870. */
  1871. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE0(DMA_TypeDef *DMAx)
  1872. {
  1873. return (READ_BIT(DMAx->LISR ,DMA_LISR_FEIF0)==(DMA_LISR_FEIF0));
  1874. }
  1875. /**
  1876. * @brief Get Stream 1 FIFO error flag.
  1877. * @rmtoll LISR FEIF1 LL_DMA_IsActiveFlag_FE1
  1878. * @param DMAx DMAx Instance
  1879. * @retval State of bit (1 or 0).
  1880. */
  1881. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE1(DMA_TypeDef *DMAx)
  1882. {
  1883. return (READ_BIT(DMAx->LISR ,DMA_LISR_FEIF1)==(DMA_LISR_FEIF1));
  1884. }
  1885. /**
  1886. * @brief Get Stream 2 FIFO error flag.
  1887. * @rmtoll LISR FEIF2 LL_DMA_IsActiveFlag_FE2
  1888. * @param DMAx DMAx Instance
  1889. * @retval State of bit (1 or 0).
  1890. */
  1891. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE2(DMA_TypeDef *DMAx)
  1892. {
  1893. return (READ_BIT(DMAx->LISR ,DMA_LISR_FEIF2)==(DMA_LISR_FEIF2));
  1894. }
  1895. /**
  1896. * @brief Get Stream 3 FIFO error flag.
  1897. * @rmtoll LISR FEIF3 LL_DMA_IsActiveFlag_FE3
  1898. * @param DMAx DMAx Instance
  1899. * @retval State of bit (1 or 0).
  1900. */
  1901. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE3(DMA_TypeDef *DMAx)
  1902. {
  1903. return (READ_BIT(DMAx->LISR ,DMA_LISR_FEIF3)==(DMA_LISR_FEIF3));
  1904. }
  1905. /**
  1906. * @brief Get Stream 4 FIFO error flag.
  1907. * @rmtoll HISR FEIF4 LL_DMA_IsActiveFlag_FE4
  1908. * @param DMAx DMAx Instance
  1909. * @retval State of bit (1 or 0).
  1910. */
  1911. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE4(DMA_TypeDef *DMAx)
  1912. {
  1913. return (READ_BIT(DMAx->HISR ,DMA_HISR_FEIF4)==(DMA_HISR_FEIF4));
  1914. }
  1915. /**
  1916. * @brief Get Stream 5 FIFO error flag.
  1917. * @rmtoll HISR FEIF0 LL_DMA_IsActiveFlag_FE5
  1918. * @param DMAx DMAx Instance
  1919. * @retval State of bit (1 or 0).
  1920. */
  1921. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE5(DMA_TypeDef *DMAx)
  1922. {
  1923. return (READ_BIT(DMAx->HISR ,DMA_HISR_FEIF5)==(DMA_HISR_FEIF5));
  1924. }
  1925. /**
  1926. * @brief Get Stream 6 FIFO error flag.
  1927. * @rmtoll HISR FEIF6 LL_DMA_IsActiveFlag_FE6
  1928. * @param DMAx DMAx Instance
  1929. * @retval State of bit (1 or 0).
  1930. */
  1931. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE6(DMA_TypeDef *DMAx)
  1932. {
  1933. return (READ_BIT(DMAx->HISR ,DMA_HISR_FEIF6)==(DMA_HISR_FEIF6));
  1934. }
  1935. /**
  1936. * @brief Get Stream 7 FIFO error flag.
  1937. * @rmtoll HISR FEIF7 LL_DMA_IsActiveFlag_FE7
  1938. * @param DMAx DMAx Instance
  1939. * @retval State of bit (1 or 0).
  1940. */
  1941. __STATIC_INLINE uint32_t LL_DMA_IsActiveFlag_FE7(DMA_TypeDef *DMAx)
  1942. {
  1943. return (READ_BIT(DMAx->HISR ,DMA_HISR_FEIF7)==(DMA_HISR_FEIF7));
  1944. }
  1945. /**
  1946. * @brief Clear Stream 0 half transfer flag.
  1947. * @rmtoll LIFCR CHTIF0 LL_DMA_ClearFlag_HT0
  1948. * @param DMAx DMAx Instance
  1949. * @retval None
  1950. */
  1951. __STATIC_INLINE void LL_DMA_ClearFlag_HT0(DMA_TypeDef *DMAx)
  1952. {
  1953. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CHTIF0);
  1954. }
  1955. /**
  1956. * @brief Clear Stream 1 half transfer flag.
  1957. * @rmtoll LIFCR CHTIF1 LL_DMA_ClearFlag_HT1
  1958. * @param DMAx DMAx Instance
  1959. * @retval None
  1960. */
  1961. __STATIC_INLINE void LL_DMA_ClearFlag_HT1(DMA_TypeDef *DMAx)
  1962. {
  1963. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CHTIF1);
  1964. }
  1965. /**
  1966. * @brief Clear Stream 2 half transfer flag.
  1967. * @rmtoll LIFCR CHTIF2 LL_DMA_ClearFlag_HT2
  1968. * @param DMAx DMAx Instance
  1969. * @retval None
  1970. */
  1971. __STATIC_INLINE void LL_DMA_ClearFlag_HT2(DMA_TypeDef *DMAx)
  1972. {
  1973. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CHTIF2);
  1974. }
  1975. /**
  1976. * @brief Clear Stream 3 half transfer flag.
  1977. * @rmtoll LIFCR CHTIF3 LL_DMA_ClearFlag_HT3
  1978. * @param DMAx DMAx Instance
  1979. * @retval None
  1980. */
  1981. __STATIC_INLINE void LL_DMA_ClearFlag_HT3(DMA_TypeDef *DMAx)
  1982. {
  1983. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CHTIF3);
  1984. }
  1985. /**
  1986. * @brief Clear Stream 4 half transfer flag.
  1987. * @rmtoll HIFCR CHTIF4 LL_DMA_ClearFlag_HT4
  1988. * @param DMAx DMAx Instance
  1989. * @retval None
  1990. */
  1991. __STATIC_INLINE void LL_DMA_ClearFlag_HT4(DMA_TypeDef *DMAx)
  1992. {
  1993. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CHTIF4);
  1994. }
  1995. /**
  1996. * @brief Clear Stream 5 half transfer flag.
  1997. * @rmtoll HIFCR CHTIF5 LL_DMA_ClearFlag_HT5
  1998. * @param DMAx DMAx Instance
  1999. * @retval None
  2000. */
  2001. __STATIC_INLINE void LL_DMA_ClearFlag_HT5(DMA_TypeDef *DMAx)
  2002. {
  2003. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CHTIF5);
  2004. }
  2005. /**
  2006. * @brief Clear Stream 6 half transfer flag.
  2007. * @rmtoll HIFCR CHTIF6 LL_DMA_ClearFlag_HT6
  2008. * @param DMAx DMAx Instance
  2009. * @retval None
  2010. */
  2011. __STATIC_INLINE void LL_DMA_ClearFlag_HT6(DMA_TypeDef *DMAx)
  2012. {
  2013. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CHTIF6);
  2014. }
  2015. /**
  2016. * @brief Clear Stream 7 half transfer flag.
  2017. * @rmtoll HIFCR CHTIF7 LL_DMA_ClearFlag_HT7
  2018. * @param DMAx DMAx Instance
  2019. * @retval None
  2020. */
  2021. __STATIC_INLINE void LL_DMA_ClearFlag_HT7(DMA_TypeDef *DMAx)
  2022. {
  2023. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CHTIF7);
  2024. }
  2025. /**
  2026. * @brief Clear Stream 0 transfer complete flag.
  2027. * @rmtoll LIFCR CTCIF0 LL_DMA_ClearFlag_TC0
  2028. * @param DMAx DMAx Instance
  2029. * @retval None
  2030. */
  2031. __STATIC_INLINE void LL_DMA_ClearFlag_TC0(DMA_TypeDef *DMAx)
  2032. {
  2033. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CTCIF0);
  2034. }
  2035. /**
  2036. * @brief Clear Stream 1 transfer complete flag.
  2037. * @rmtoll LIFCR CTCIF1 LL_DMA_ClearFlag_TC1
  2038. * @param DMAx DMAx Instance
  2039. * @retval None
  2040. */
  2041. __STATIC_INLINE void LL_DMA_ClearFlag_TC1(DMA_TypeDef *DMAx)
  2042. {
  2043. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CTCIF1);
  2044. }
  2045. /**
  2046. * @brief Clear Stream 2 transfer complete flag.
  2047. * @rmtoll LIFCR CTCIF2 LL_DMA_ClearFlag_TC2
  2048. * @param DMAx DMAx Instance
  2049. * @retval None
  2050. */
  2051. __STATIC_INLINE void LL_DMA_ClearFlag_TC2(DMA_TypeDef *DMAx)
  2052. {
  2053. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CTCIF2);
  2054. }
  2055. /**
  2056. * @brief Clear Stream 3 transfer complete flag.
  2057. * @rmtoll LIFCR CTCIF3 LL_DMA_ClearFlag_TC3
  2058. * @param DMAx DMAx Instance
  2059. * @retval None
  2060. */
  2061. __STATIC_INLINE void LL_DMA_ClearFlag_TC3(DMA_TypeDef *DMAx)
  2062. {
  2063. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CTCIF3);
  2064. }
  2065. /**
  2066. * @brief Clear Stream 4 transfer complete flag.
  2067. * @rmtoll HIFCR CTCIF4 LL_DMA_ClearFlag_TC4
  2068. * @param DMAx DMAx Instance
  2069. * @retval None
  2070. */
  2071. __STATIC_INLINE void LL_DMA_ClearFlag_TC4(DMA_TypeDef *DMAx)
  2072. {
  2073. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CTCIF4);
  2074. }
  2075. /**
  2076. * @brief Clear Stream 5 transfer complete flag.
  2077. * @rmtoll HIFCR CTCIF5 LL_DMA_ClearFlag_TC5
  2078. * @param DMAx DMAx Instance
  2079. * @retval None
  2080. */
  2081. __STATIC_INLINE void LL_DMA_ClearFlag_TC5(DMA_TypeDef *DMAx)
  2082. {
  2083. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CTCIF5);
  2084. }
  2085. /**
  2086. * @brief Clear Stream 6 transfer complete flag.
  2087. * @rmtoll HIFCR CTCIF6 LL_DMA_ClearFlag_TC6
  2088. * @param DMAx DMAx Instance
  2089. * @retval None
  2090. */
  2091. __STATIC_INLINE void LL_DMA_ClearFlag_TC6(DMA_TypeDef *DMAx)
  2092. {
  2093. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CTCIF6);
  2094. }
  2095. /**
  2096. * @brief Clear Stream 7 transfer complete flag.
  2097. * @rmtoll HIFCR CTCIF7 LL_DMA_ClearFlag_TC7
  2098. * @param DMAx DMAx Instance
  2099. * @retval None
  2100. */
  2101. __STATIC_INLINE void LL_DMA_ClearFlag_TC7(DMA_TypeDef *DMAx)
  2102. {
  2103. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CTCIF7);
  2104. }
  2105. /**
  2106. * @brief Clear Stream 0 transfer error flag.
  2107. * @rmtoll LIFCR CTEIF0 LL_DMA_ClearFlag_TE0
  2108. * @param DMAx DMAx Instance
  2109. * @retval None
  2110. */
  2111. __STATIC_INLINE void LL_DMA_ClearFlag_TE0(DMA_TypeDef *DMAx)
  2112. {
  2113. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CTEIF0);
  2114. }
  2115. /**
  2116. * @brief Clear Stream 1 transfer error flag.
  2117. * @rmtoll LIFCR CTEIF1 LL_DMA_ClearFlag_TE1
  2118. * @param DMAx DMAx Instance
  2119. * @retval None
  2120. */
  2121. __STATIC_INLINE void LL_DMA_ClearFlag_TE1(DMA_TypeDef *DMAx)
  2122. {
  2123. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CTEIF1);
  2124. }
  2125. /**
  2126. * @brief Clear Stream 2 transfer error flag.
  2127. * @rmtoll LIFCR CTEIF2 LL_DMA_ClearFlag_TE2
  2128. * @param DMAx DMAx Instance
  2129. * @retval None
  2130. */
  2131. __STATIC_INLINE void LL_DMA_ClearFlag_TE2(DMA_TypeDef *DMAx)
  2132. {
  2133. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CTEIF2);
  2134. }
  2135. /**
  2136. * @brief Clear Stream 3 transfer error flag.
  2137. * @rmtoll LIFCR CTEIF3 LL_DMA_ClearFlag_TE3
  2138. * @param DMAx DMAx Instance
  2139. * @retval None
  2140. */
  2141. __STATIC_INLINE void LL_DMA_ClearFlag_TE3(DMA_TypeDef *DMAx)
  2142. {
  2143. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CTEIF3);
  2144. }
  2145. /**
  2146. * @brief Clear Stream 4 transfer error flag.
  2147. * @rmtoll HIFCR CTEIF4 LL_DMA_ClearFlag_TE4
  2148. * @param DMAx DMAx Instance
  2149. * @retval None
  2150. */
  2151. __STATIC_INLINE void LL_DMA_ClearFlag_TE4(DMA_TypeDef *DMAx)
  2152. {
  2153. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CTEIF4);
  2154. }
  2155. /**
  2156. * @brief Clear Stream 5 transfer error flag.
  2157. * @rmtoll HIFCR CTEIF5 LL_DMA_ClearFlag_TE5
  2158. * @param DMAx DMAx Instance
  2159. * @retval None
  2160. */
  2161. __STATIC_INLINE void LL_DMA_ClearFlag_TE5(DMA_TypeDef *DMAx)
  2162. {
  2163. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CTEIF5);
  2164. }
  2165. /**
  2166. * @brief Clear Stream 6 transfer error flag.
  2167. * @rmtoll HIFCR CTEIF6 LL_DMA_ClearFlag_TE6
  2168. * @param DMAx DMAx Instance
  2169. * @retval None
  2170. */
  2171. __STATIC_INLINE void LL_DMA_ClearFlag_TE6(DMA_TypeDef *DMAx)
  2172. {
  2173. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CTEIF6);
  2174. }
  2175. /**
  2176. * @brief Clear Stream 7 transfer error flag.
  2177. * @rmtoll HIFCR CTEIF7 LL_DMA_ClearFlag_TE7
  2178. * @param DMAx DMAx Instance
  2179. * @retval None
  2180. */
  2181. __STATIC_INLINE void LL_DMA_ClearFlag_TE7(DMA_TypeDef *DMAx)
  2182. {
  2183. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CTEIF7);
  2184. }
  2185. /**
  2186. * @brief Clear Stream 0 direct mode error flag.
  2187. * @rmtoll LIFCR CDMEIF0 LL_DMA_ClearFlag_DME0
  2188. * @param DMAx DMAx Instance
  2189. * @retval None
  2190. */
  2191. __STATIC_INLINE void LL_DMA_ClearFlag_DME0(DMA_TypeDef *DMAx)
  2192. {
  2193. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CDMEIF0);
  2194. }
  2195. /**
  2196. * @brief Clear Stream 1 direct mode error flag.
  2197. * @rmtoll LIFCR CDMEIF1 LL_DMA_ClearFlag_DME1
  2198. * @param DMAx DMAx Instance
  2199. * @retval None
  2200. */
  2201. __STATIC_INLINE void LL_DMA_ClearFlag_DME1(DMA_TypeDef *DMAx)
  2202. {
  2203. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CDMEIF1);
  2204. }
  2205. /**
  2206. * @brief Clear Stream 2 direct mode error flag.
  2207. * @rmtoll LIFCR CDMEIF2 LL_DMA_ClearFlag_DME2
  2208. * @param DMAx DMAx Instance
  2209. * @retval None
  2210. */
  2211. __STATIC_INLINE void LL_DMA_ClearFlag_DME2(DMA_TypeDef *DMAx)
  2212. {
  2213. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CDMEIF2);
  2214. }
  2215. /**
  2216. * @brief Clear Stream 3 direct mode error flag.
  2217. * @rmtoll LIFCR CDMEIF3 LL_DMA_ClearFlag_DME3
  2218. * @param DMAx DMAx Instance
  2219. * @retval None
  2220. */
  2221. __STATIC_INLINE void LL_DMA_ClearFlag_DME3(DMA_TypeDef *DMAx)
  2222. {
  2223. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CDMEIF3);
  2224. }
  2225. /**
  2226. * @brief Clear Stream 4 direct mode error flag.
  2227. * @rmtoll HIFCR CDMEIF4 LL_DMA_ClearFlag_DME4
  2228. * @param DMAx DMAx Instance
  2229. * @retval None
  2230. */
  2231. __STATIC_INLINE void LL_DMA_ClearFlag_DME4(DMA_TypeDef *DMAx)
  2232. {
  2233. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CDMEIF4);
  2234. }
  2235. /**
  2236. * @brief Clear Stream 5 direct mode error flag.
  2237. * @rmtoll HIFCR CDMEIF5 LL_DMA_ClearFlag_DME5
  2238. * @param DMAx DMAx Instance
  2239. * @retval None
  2240. */
  2241. __STATIC_INLINE void LL_DMA_ClearFlag_DME5(DMA_TypeDef *DMAx)
  2242. {
  2243. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CDMEIF5);
  2244. }
  2245. /**
  2246. * @brief Clear Stream 6 direct mode error flag.
  2247. * @rmtoll HIFCR CDMEIF6 LL_DMA_ClearFlag_DME6
  2248. * @param DMAx DMAx Instance
  2249. * @retval None
  2250. */
  2251. __STATIC_INLINE void LL_DMA_ClearFlag_DME6(DMA_TypeDef *DMAx)
  2252. {
  2253. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CDMEIF6);
  2254. }
  2255. /**
  2256. * @brief Clear Stream 7 direct mode error flag.
  2257. * @rmtoll HIFCR CDMEIF7 LL_DMA_ClearFlag_DME7
  2258. * @param DMAx DMAx Instance
  2259. * @retval None
  2260. */
  2261. __STATIC_INLINE void LL_DMA_ClearFlag_DME7(DMA_TypeDef *DMAx)
  2262. {
  2263. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CDMEIF7);
  2264. }
  2265. /**
  2266. * @brief Clear Stream 0 FIFO error flag.
  2267. * @rmtoll LIFCR CFEIF0 LL_DMA_ClearFlag_FE0
  2268. * @param DMAx DMAx Instance
  2269. * @retval None
  2270. */
  2271. __STATIC_INLINE void LL_DMA_ClearFlag_FE0(DMA_TypeDef *DMAx)
  2272. {
  2273. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CFEIF0);
  2274. }
  2275. /**
  2276. * @brief Clear Stream 1 FIFO error flag.
  2277. * @rmtoll LIFCR CFEIF1 LL_DMA_ClearFlag_FE1
  2278. * @param DMAx DMAx Instance
  2279. * @retval None
  2280. */
  2281. __STATIC_INLINE void LL_DMA_ClearFlag_FE1(DMA_TypeDef *DMAx)
  2282. {
  2283. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CFEIF1);
  2284. }
  2285. /**
  2286. * @brief Clear Stream 2 FIFO error flag.
  2287. * @rmtoll LIFCR CFEIF2 LL_DMA_ClearFlag_FE2
  2288. * @param DMAx DMAx Instance
  2289. * @retval None
  2290. */
  2291. __STATIC_INLINE void LL_DMA_ClearFlag_FE2(DMA_TypeDef *DMAx)
  2292. {
  2293. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CFEIF2);
  2294. }
  2295. /**
  2296. * @brief Clear Stream 3 FIFO error flag.
  2297. * @rmtoll LIFCR CFEIF3 LL_DMA_ClearFlag_FE3
  2298. * @param DMAx DMAx Instance
  2299. * @retval None
  2300. */
  2301. __STATIC_INLINE void LL_DMA_ClearFlag_FE3(DMA_TypeDef *DMAx)
  2302. {
  2303. WRITE_REG(DMAx->LIFCR , DMA_LIFCR_CFEIF3);
  2304. }
  2305. /**
  2306. * @brief Clear Stream 4 FIFO error flag.
  2307. * @rmtoll HIFCR CFEIF4 LL_DMA_ClearFlag_FE4
  2308. * @param DMAx DMAx Instance
  2309. * @retval None
  2310. */
  2311. __STATIC_INLINE void LL_DMA_ClearFlag_FE4(DMA_TypeDef *DMAx)
  2312. {
  2313. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CFEIF4);
  2314. }
  2315. /**
  2316. * @brief Clear Stream 5 FIFO error flag.
  2317. * @rmtoll HIFCR CFEIF5 LL_DMA_ClearFlag_FE5
  2318. * @param DMAx DMAx Instance
  2319. * @retval None
  2320. */
  2321. __STATIC_INLINE void LL_DMA_ClearFlag_FE5(DMA_TypeDef *DMAx)
  2322. {
  2323. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CFEIF5);
  2324. }
  2325. /**
  2326. * @brief Clear Stream 6 FIFO error flag.
  2327. * @rmtoll HIFCR CFEIF6 LL_DMA_ClearFlag_FE6
  2328. * @param DMAx DMAx Instance
  2329. * @retval None
  2330. */
  2331. __STATIC_INLINE void LL_DMA_ClearFlag_FE6(DMA_TypeDef *DMAx)
  2332. {
  2333. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CFEIF6);
  2334. }
  2335. /**
  2336. * @brief Clear Stream 7 FIFO error flag.
  2337. * @rmtoll HIFCR CFEIF7 LL_DMA_ClearFlag_FE7
  2338. * @param DMAx DMAx Instance
  2339. * @retval None
  2340. */
  2341. __STATIC_INLINE void LL_DMA_ClearFlag_FE7(DMA_TypeDef *DMAx)
  2342. {
  2343. WRITE_REG(DMAx->HIFCR , DMA_HIFCR_CFEIF7);
  2344. }
  2345. /**
  2346. * @}
  2347. */
  2348. /** @defgroup DMA_LL_EF_IT_Management IT_Management
  2349. * @{
  2350. */
  2351. /**
  2352. * @brief Enable Half transfer interrupt.
  2353. * @rmtoll CR HTIE LL_DMA_EnableIT_HT
  2354. * @param DMAx DMAx Instance
  2355. * @param Stream This parameter can be one of the following values:
  2356. * @arg @ref LL_DMA_STREAM_0
  2357. * @arg @ref LL_DMA_STREAM_1
  2358. * @arg @ref LL_DMA_STREAM_2
  2359. * @arg @ref LL_DMA_STREAM_3
  2360. * @arg @ref LL_DMA_STREAM_4
  2361. * @arg @ref LL_DMA_STREAM_5
  2362. * @arg @ref LL_DMA_STREAM_6
  2363. * @arg @ref LL_DMA_STREAM_7
  2364. * @retval None
  2365. */
  2366. __STATIC_INLINE void LL_DMA_EnableIT_HT(DMA_TypeDef *DMAx, uint32_t Stream)
  2367. {
  2368. SET_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_HTIE);
  2369. }
  2370. /**
  2371. * @brief Enable Transfer error interrupt.
  2372. * @rmtoll CR TEIE LL_DMA_EnableIT_TE
  2373. * @param DMAx DMAx Instance
  2374. * @param Stream This parameter can be one of the following values:
  2375. * @arg @ref LL_DMA_STREAM_0
  2376. * @arg @ref LL_DMA_STREAM_1
  2377. * @arg @ref LL_DMA_STREAM_2
  2378. * @arg @ref LL_DMA_STREAM_3
  2379. * @arg @ref LL_DMA_STREAM_4
  2380. * @arg @ref LL_DMA_STREAM_5
  2381. * @arg @ref LL_DMA_STREAM_6
  2382. * @arg @ref LL_DMA_STREAM_7
  2383. * @retval None
  2384. */
  2385. __STATIC_INLINE void LL_DMA_EnableIT_TE(DMA_TypeDef *DMAx, uint32_t Stream)
  2386. {
  2387. SET_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_TEIE);
  2388. }
  2389. /**
  2390. * @brief Enable Transfer complete interrupt.
  2391. * @rmtoll CR TCIE LL_DMA_EnableIT_TC
  2392. * @param DMAx DMAx Instance
  2393. * @param Stream This parameter can be one of the following values:
  2394. * @arg @ref LL_DMA_STREAM_0
  2395. * @arg @ref LL_DMA_STREAM_1
  2396. * @arg @ref LL_DMA_STREAM_2
  2397. * @arg @ref LL_DMA_STREAM_3
  2398. * @arg @ref LL_DMA_STREAM_4
  2399. * @arg @ref LL_DMA_STREAM_5
  2400. * @arg @ref LL_DMA_STREAM_6
  2401. * @arg @ref LL_DMA_STREAM_7
  2402. * @retval None
  2403. */
  2404. __STATIC_INLINE void LL_DMA_EnableIT_TC(DMA_TypeDef *DMAx, uint32_t Stream)
  2405. {
  2406. SET_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_TCIE);
  2407. }
  2408. /**
  2409. * @brief Enable Direct mode error interrupt.
  2410. * @rmtoll CR DMEIE LL_DMA_EnableIT_DME
  2411. * @param DMAx DMAx Instance
  2412. * @param Stream This parameter can be one of the following values:
  2413. * @arg @ref LL_DMA_STREAM_0
  2414. * @arg @ref LL_DMA_STREAM_1
  2415. * @arg @ref LL_DMA_STREAM_2
  2416. * @arg @ref LL_DMA_STREAM_3
  2417. * @arg @ref LL_DMA_STREAM_4
  2418. * @arg @ref LL_DMA_STREAM_5
  2419. * @arg @ref LL_DMA_STREAM_6
  2420. * @arg @ref LL_DMA_STREAM_7
  2421. * @retval None
  2422. */
  2423. __STATIC_INLINE void LL_DMA_EnableIT_DME(DMA_TypeDef *DMAx, uint32_t Stream)
  2424. {
  2425. SET_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_DMEIE);
  2426. }
  2427. /**
  2428. * @brief Enable FIFO error interrupt.
  2429. * @rmtoll FCR FEIE LL_DMA_EnableIT_FE
  2430. * @param DMAx DMAx Instance
  2431. * @param Stream This parameter can be one of the following values:
  2432. * @arg @ref LL_DMA_STREAM_0
  2433. * @arg @ref LL_DMA_STREAM_1
  2434. * @arg @ref LL_DMA_STREAM_2
  2435. * @arg @ref LL_DMA_STREAM_3
  2436. * @arg @ref LL_DMA_STREAM_4
  2437. * @arg @ref LL_DMA_STREAM_5
  2438. * @arg @ref LL_DMA_STREAM_6
  2439. * @arg @ref LL_DMA_STREAM_7
  2440. * @retval None
  2441. */
  2442. __STATIC_INLINE void LL_DMA_EnableIT_FE(DMA_TypeDef *DMAx, uint32_t Stream)
  2443. {
  2444. SET_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_FEIE);
  2445. }
  2446. /**
  2447. * @brief Disable Half transfer interrupt.
  2448. * @rmtoll CR HTIE LL_DMA_DisableIT_HT
  2449. * @param DMAx DMAx Instance
  2450. * @param Stream This parameter can be one of the following values:
  2451. * @arg @ref LL_DMA_STREAM_0
  2452. * @arg @ref LL_DMA_STREAM_1
  2453. * @arg @ref LL_DMA_STREAM_2
  2454. * @arg @ref LL_DMA_STREAM_3
  2455. * @arg @ref LL_DMA_STREAM_4
  2456. * @arg @ref LL_DMA_STREAM_5
  2457. * @arg @ref LL_DMA_STREAM_6
  2458. * @arg @ref LL_DMA_STREAM_7
  2459. * @retval None
  2460. */
  2461. __STATIC_INLINE void LL_DMA_DisableIT_HT(DMA_TypeDef *DMAx, uint32_t Stream)
  2462. {
  2463. CLEAR_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_HTIE);
  2464. }
  2465. /**
  2466. * @brief Disable Transfer error interrupt.
  2467. * @rmtoll CR TEIE LL_DMA_DisableIT_TE
  2468. * @param DMAx DMAx Instance
  2469. * @param Stream This parameter can be one of the following values:
  2470. * @arg @ref LL_DMA_STREAM_0
  2471. * @arg @ref LL_DMA_STREAM_1
  2472. * @arg @ref LL_DMA_STREAM_2
  2473. * @arg @ref LL_DMA_STREAM_3
  2474. * @arg @ref LL_DMA_STREAM_4
  2475. * @arg @ref LL_DMA_STREAM_5
  2476. * @arg @ref LL_DMA_STREAM_6
  2477. * @arg @ref LL_DMA_STREAM_7
  2478. * @retval None
  2479. */
  2480. __STATIC_INLINE void LL_DMA_DisableIT_TE(DMA_TypeDef *DMAx, uint32_t Stream)
  2481. {
  2482. CLEAR_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_TEIE);
  2483. }
  2484. /**
  2485. * @brief Disable Transfer complete interrupt.
  2486. * @rmtoll CR TCIE LL_DMA_DisableIT_TC
  2487. * @param DMAx DMAx Instance
  2488. * @param Stream This parameter can be one of the following values:
  2489. * @arg @ref LL_DMA_STREAM_0
  2490. * @arg @ref LL_DMA_STREAM_1
  2491. * @arg @ref LL_DMA_STREAM_2
  2492. * @arg @ref LL_DMA_STREAM_3
  2493. * @arg @ref LL_DMA_STREAM_4
  2494. * @arg @ref LL_DMA_STREAM_5
  2495. * @arg @ref LL_DMA_STREAM_6
  2496. * @arg @ref LL_DMA_STREAM_7
  2497. * @retval None
  2498. */
  2499. __STATIC_INLINE void LL_DMA_DisableIT_TC(DMA_TypeDef *DMAx, uint32_t Stream)
  2500. {
  2501. CLEAR_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_TCIE);
  2502. }
  2503. /**
  2504. * @brief Disable Direct mode error interrupt.
  2505. * @rmtoll CR DMEIE LL_DMA_DisableIT_DME
  2506. * @param DMAx DMAx Instance
  2507. * @param Stream This parameter can be one of the following values:
  2508. * @arg @ref LL_DMA_STREAM_0
  2509. * @arg @ref LL_DMA_STREAM_1
  2510. * @arg @ref LL_DMA_STREAM_2
  2511. * @arg @ref LL_DMA_STREAM_3
  2512. * @arg @ref LL_DMA_STREAM_4
  2513. * @arg @ref LL_DMA_STREAM_5
  2514. * @arg @ref LL_DMA_STREAM_6
  2515. * @arg @ref LL_DMA_STREAM_7
  2516. * @retval None
  2517. */
  2518. __STATIC_INLINE void LL_DMA_DisableIT_DME(DMA_TypeDef *DMAx, uint32_t Stream)
  2519. {
  2520. CLEAR_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_DMEIE);
  2521. }
  2522. /**
  2523. * @brief Disable FIFO error interrupt.
  2524. * @rmtoll FCR FEIE LL_DMA_DisableIT_FE
  2525. * @param DMAx DMAx Instance
  2526. * @param Stream This parameter can be one of the following values:
  2527. * @arg @ref LL_DMA_STREAM_0
  2528. * @arg @ref LL_DMA_STREAM_1
  2529. * @arg @ref LL_DMA_STREAM_2
  2530. * @arg @ref LL_DMA_STREAM_3
  2531. * @arg @ref LL_DMA_STREAM_4
  2532. * @arg @ref LL_DMA_STREAM_5
  2533. * @arg @ref LL_DMA_STREAM_6
  2534. * @arg @ref LL_DMA_STREAM_7
  2535. * @retval None
  2536. */
  2537. __STATIC_INLINE void LL_DMA_DisableIT_FE(DMA_TypeDef *DMAx, uint32_t Stream)
  2538. {
  2539. CLEAR_BIT(((DMA_Stream_TypeDef *)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_FEIE);
  2540. }
  2541. /**
  2542. * @brief Check if Half transfer interrup is enabled.
  2543. * @rmtoll CR HTIE LL_DMA_IsEnabledIT_HT
  2544. * @param DMAx DMAx Instance
  2545. * @param Stream This parameter can be one of the following values:
  2546. * @arg @ref LL_DMA_STREAM_0
  2547. * @arg @ref LL_DMA_STREAM_1
  2548. * @arg @ref LL_DMA_STREAM_2
  2549. * @arg @ref LL_DMA_STREAM_3
  2550. * @arg @ref LL_DMA_STREAM_4
  2551. * @arg @ref LL_DMA_STREAM_5
  2552. * @arg @ref LL_DMA_STREAM_6
  2553. * @arg @ref LL_DMA_STREAM_7
  2554. * @retval State of bit (1 or 0).
  2555. */
  2556. __STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_HT(DMA_TypeDef *DMAx, uint32_t Stream)
  2557. {
  2558. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_HTIE) == DMA_SxCR_HTIE);
  2559. }
  2560. /**
  2561. * @brief Check if Transfer error nterrup is enabled.
  2562. * @rmtoll CR TEIE LL_DMA_IsEnabledIT_TE
  2563. * @param DMAx DMAx Instance
  2564. * @param Stream This parameter can be one of the following values:
  2565. * @arg @ref LL_DMA_STREAM_0
  2566. * @arg @ref LL_DMA_STREAM_1
  2567. * @arg @ref LL_DMA_STREAM_2
  2568. * @arg @ref LL_DMA_STREAM_3
  2569. * @arg @ref LL_DMA_STREAM_4
  2570. * @arg @ref LL_DMA_STREAM_5
  2571. * @arg @ref LL_DMA_STREAM_6
  2572. * @arg @ref LL_DMA_STREAM_7
  2573. * @retval State of bit (1 or 0).
  2574. */
  2575. __STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_TE(DMA_TypeDef *DMAx, uint32_t Stream)
  2576. {
  2577. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_TEIE) == DMA_SxCR_TEIE);
  2578. }
  2579. /**
  2580. * @brief Check if Transfer complete interrup is enabled.
  2581. * @rmtoll CR TCIE LL_DMA_IsEnabledIT_TC
  2582. * @param DMAx DMAx Instance
  2583. * @param Stream This parameter can be one of the following values:
  2584. * @arg @ref LL_DMA_STREAM_0
  2585. * @arg @ref LL_DMA_STREAM_1
  2586. * @arg @ref LL_DMA_STREAM_2
  2587. * @arg @ref LL_DMA_STREAM_3
  2588. * @arg @ref LL_DMA_STREAM_4
  2589. * @arg @ref LL_DMA_STREAM_5
  2590. * @arg @ref LL_DMA_STREAM_6
  2591. * @arg @ref LL_DMA_STREAM_7
  2592. * @retval State of bit (1 or 0).
  2593. */
  2594. __STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_TC(DMA_TypeDef *DMAx, uint32_t Stream)
  2595. {
  2596. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_TCIE) == DMA_SxCR_TCIE);
  2597. }
  2598. /**
  2599. * @brief Check if Direct mode error interrupt is enabled.
  2600. * @rmtoll CR DMEIE LL_DMA_IsEnabledIT_DME
  2601. * @param DMAx DMAx Instance
  2602. * @param Stream This parameter can be one of the following values:
  2603. * @arg @ref LL_DMA_STREAM_0
  2604. * @arg @ref LL_DMA_STREAM_1
  2605. * @arg @ref LL_DMA_STREAM_2
  2606. * @arg @ref LL_DMA_STREAM_3
  2607. * @arg @ref LL_DMA_STREAM_4
  2608. * @arg @ref LL_DMA_STREAM_5
  2609. * @arg @ref LL_DMA_STREAM_6
  2610. * @arg @ref LL_DMA_STREAM_7
  2611. * @retval State of bit (1 or 0).
  2612. */
  2613. __STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_DME(DMA_TypeDef *DMAx, uint32_t Stream)
  2614. {
  2615. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->CR, DMA_SxCR_DMEIE) == DMA_SxCR_DMEIE);
  2616. }
  2617. /**
  2618. * @brief Check if FIFO error interrup is enabled.
  2619. * @rmtoll FCR FEIE LL_DMA_IsEnabledIT_FE
  2620. * @param DMAx DMAx Instance
  2621. * @param Stream This parameter can be one of the following values:
  2622. * @arg @ref LL_DMA_STREAM_0
  2623. * @arg @ref LL_DMA_STREAM_1
  2624. * @arg @ref LL_DMA_STREAM_2
  2625. * @arg @ref LL_DMA_STREAM_3
  2626. * @arg @ref LL_DMA_STREAM_4
  2627. * @arg @ref LL_DMA_STREAM_5
  2628. * @arg @ref LL_DMA_STREAM_6
  2629. * @arg @ref LL_DMA_STREAM_7
  2630. * @retval State of bit (1 or 0).
  2631. */
  2632. __STATIC_INLINE uint32_t LL_DMA_IsEnabledIT_FE(DMA_TypeDef *DMAx, uint32_t Stream)
  2633. {
  2634. return (READ_BIT(((DMA_Stream_TypeDef*)((uint32_t)((uint32_t)DMAx + STREAM_OFFSET_TAB[Stream])))->FCR, DMA_SxFCR_FEIE) == DMA_SxFCR_FEIE);
  2635. }
  2636. /**
  2637. * @}
  2638. */
  2639. #if defined(USE_FULL_LL_DRIVER)
  2640. /** @defgroup DMA_LL_EF_Init Initialization and de-initialization functions
  2641. * @{
  2642. */
  2643. uint32_t LL_DMA_Init(DMA_TypeDef *DMAx, uint32_t Stream, LL_DMA_InitTypeDef *DMA_InitStruct);
  2644. uint32_t LL_DMA_DeInit(DMA_TypeDef *DMAx, uint32_t Stream);
  2645. void LL_DMA_StructInit(LL_DMA_InitTypeDef *DMA_InitStruct);
  2646. /**
  2647. * @}
  2648. */
  2649. #endif /* USE_FULL_LL_DRIVER */
  2650. /**
  2651. * @}
  2652. */
  2653. /**
  2654. * @}
  2655. */
  2656. #endif /* DMA1 || DMA2 */
  2657. /**
  2658. * @}
  2659. */
  2660. #ifdef __cplusplus
  2661. }
  2662. #endif
  2663. #endif /* __STM32F7xx_LL_DMA_H */