ciu32f003(1).h 201 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800
  1. /************************************************************************************************/
  2. /**
  3. * @file ciu32f003.h
  4. * @author MCU Ecosystem Development Team
  5. * @brief CMSIS Core Peripheral Access Layer Header File for
  6. * CIU32F003(CM0+).
  7. *
  8. *
  9. **************************************************************************************************
  10. * @attention
  11. * Copyright (c) CEC Huada Electronic Design Co.,Ltd. All rights reserved.
  12. *
  13. **************************************************************************************************
  14. */
  15. #ifndef CIU32F003_H
  16. #define CIU32F003_H
  17. /************************************************************************************************/
  18. /**
  19. * @addtogroup CMSIS
  20. * @{
  21. */
  22. /**
  23. * @defgroup CIU32F003 CIU32F003
  24. * @{
  25. */
  26. /************************************************************************************************/
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif /* __cplusplus */
  30. /*-----------------------------------------type define------------------------------------------*/
  31. /************************************************************************************************/
  32. /**
  33. * @defgroup CIU32F003_Types CIU32F003 Types
  34. * @brief CIU32F003 data type definition
  35. * @{
  36. */
  37. /************************************************************************************************/
  38. /**
  39. * @brief Interrupt Number Definition
  40. */
  41. typedef enum IRQn
  42. {
  43. /* -------------------------------Cortex-M0+ Processor Exceptions Numbers -------------------------------------- */
  44. NonMaskableInt_IRQn = -14, /**< 2 Non Maskable Interrupt */
  45. HardFault_IRQn = -13, /**< 3 Cortex-M Hard Fault Interrupt */
  46. SVC_IRQn = -5, /**< 11 Cortex-M SV Call Interrupt */
  47. PendSV_IRQn = -2, /**< 14 Cortex-M Pend SV Interrupt */
  48. SysTick_IRQn = -1, /**< 15 Cortex-M System Tick Interrupt */
  49. /* -------------------------------CIU32F003 Interrupt Numbers---------------------------------------------------- */
  50. FLASH_IRQn = 3, /**< FLASH global interrupt */
  51. RCC_IRQn = 4, /**< RCC global interrupt */
  52. EXTI0_1_IRQn = 5, /**< EXTI line 0 & 1 interrupts */
  53. EXTI2_3_IRQn = 6, /**< EXTI line 2 & 3 interrupts */
  54. EXTI4_7_IRQn = 7, /**< EXTI line 4 to 7 interrupts */
  55. ADC_COMP_IRQn = 12, /**< ADC, COMP1 and COMP2 interrupts */
  56. TIM1_BRK_UP_TRG_COM_IRQn = 13, /**< TIM1 break, update, trigger and commutation interrupts */
  57. TIM1_CC_IRQn = 14, /**< TIM1 capture compare interrupt */
  58. TIM3_IRQn = 15, /**< TIM3 global interrupt */
  59. LPTIM1_IRQn = 20, /**< LPTIM1 global interrupt */
  60. I2C1_IRQn = 21, /**< I2C1 globlal interrupt */
  61. SPI1_IRQn = 23, /**< SPI1 globlal interrupt */
  62. UART1_IRQn = 25, /**< UART1 globlal interrupt */
  63. UART2_IRQn = 26, /**< UART2 globlal interrupt */
  64. } IRQn_Type;
  65. /**
  66. * @}
  67. */
  68. /*--------------------------------------------define--------------------------------------------*/
  69. /************************************************************************************************/
  70. /**
  71. * @defgroup CIU32F003_Constants CIU32F003 Constants
  72. * @brief CIU32F003 constants definition
  73. * @{
  74. *
  75. */
  76. /************************************************************************************************/
  77. /**
  78. * @brief Configuration of Core Peripherals
  79. */
  80. #define __CM0PLUS_REV 0x0001U /**< core revision r0p1 */
  81. #define __MPU_PRESENT 0U /**< MPU not defined */
  82. #define __VTOR_PRESENT 1U /**< VTOR present */
  83. #define __NVIC_PRIO_BITS 2U /**< number of bits used for priority levels */
  84. #define __Vendor_SysTickConfig 0U /**< set to 1 if different SysTick Config is used */
  85. /**
  86. * @brief NVIC interrupt priority
  87. */
  88. #define NVIC_PRIO_0 (0x00U)
  89. #define NVIC_PRIO_1 (0x01U)
  90. #define NVIC_PRIO_2 (0x02U)
  91. #define NVIC_PRIO_3 (0x03U)
  92. /**
  93. * @}
  94. */
  95. /*------------------------------------------includes--------------------------------------------*/
  96. #include "core_cm0plus.h" /* Cortex-M0+ processor and core peripherals */
  97. #include "system_ciu32f003.h" /* CIU32F003 System Header */
  98. #include <stdint.h>
  99. /*-----------------------------------------type define------------------------------------------*/
  100. /************************************************************************************************/
  101. /**
  102. * @addtogroup CIU32F003_Types
  103. * @{
  104. */
  105. /************************************************************************************************/
  106. /**
  107. * @brief registers of ADC
  108. */
  109. typedef struct
  110. {
  111. __IO uint32_t CR; /**< ADC control register, Address offset: 0x000 */
  112. __IO uint32_t CFG1; /**< ADC configuration register 1, Address offset: 0x004 */
  113. __IO uint32_t CFG2; /**< ADC configuration register 2, Address offset: 0x008 */
  114. uint32_t RESERVED_0[1]; /**< Reserved, Address offset: 0x00C */
  115. __IO uint32_t ISR; /**< ADC interrupt and status register, Address offset: 0x010 */
  116. __IO uint32_t IER; /**< ADC interrupt enable register, Address offset: 0x014 */
  117. __IO uint32_t SAMPT; /**< ADC sampling time register, Address offset: 0x018 */
  118. __IO uint32_t CHCFG; /**< ADC group regular sequencer register, Address offset: 0x01C */
  119. __IO uint32_t AWDGCR; /**< ADC analog watchdog configuration register, Address offset: 0x020 */
  120. uint32_t RESERVED_1[1]; /**< Reserved, Address offset: 0x024 */
  121. __IO uint32_t AWDGTR; /**< ADC analog watchdog threshold register, Address offset: 0x028 */
  122. uint32_t RESERVED_2[1]; /**< Reserved, Address offset: 0x02C */
  123. __IO uint32_t CALFACT; /**< ADC calibration factor register, Address offset: 0x030 */
  124. uint32_t RESERVED_3[3]; /**< Reserved, Address offset: 0x034 - 0x03C */
  125. __IO uint32_t DR; /**< ADC group regular data register, Address offset: 0x040 */
  126. uint32_t RESERVED_4[111]; /**< Reserved, Address offset: 0x044 - 0x1FC */
  127. __IO uint32_t CFG3; /**< ADC configuration register 3, Address offset: 0x200 */
  128. } ADC_t;
  129. /**
  130. * @brief registers of COMP common control
  131. */
  132. typedef struct
  133. {
  134. __IO uint32_t CR; /**< COMP common control regigster, Address offset: 0x00 */
  135. } COMP_COMMON_t;
  136. /**
  137. * @brief registers of COMP
  138. */
  139. typedef struct
  140. {
  141. __IO uint32_t CSR; /**< COMP control and status register, Address offset: 0x00 */
  142. } COMP_t;
  143. /**
  144. * @brief registers of CRC
  145. */
  146. typedef struct
  147. {
  148. __IO uint32_t CSR; /**< CRC control state register, Address offset: 0x00 */
  149. __IO uint32_t RDR; /**< CRC result data register, Address offset: 0x04 */
  150. uint32_t RESERVED_0[30]; /**< Reserved, Address offset: 0x08 - 7C */
  151. __IO uint32_t DR; /**< CRC data register, Address offset: 0x80 */
  152. } CRC_t;
  153. /**
  154. * @brief registers of DBG
  155. */
  156. typedef struct
  157. {
  158. __IO uint32_t CR; /**< Debug control register, Address offset: 0x00 */
  159. __IO uint32_t APB_FZ1; /**< Debug APB1 freeze register 1, Address offset: 0x04 */
  160. __IO uint32_t APB_FZ2; /**< Debug APB1 freeze register 2, Address offset: 0x08 */
  161. } DBG_t;
  162. /**
  163. * @brief registers of EXTI
  164. */
  165. typedef struct
  166. {
  167. __IO uint32_t RTSR; /**< EXTI rising trigger selection register, Address offset: 0x00 */
  168. __IO uint32_t FTSR; /**< EXTI falling trigger selection register, Address offset: 0x04 */
  169. __IO uint32_t PIR; /**< EXTI Rising or Falling pending register, Address offset: 0x08 */
  170. uint32_t RESERVED_0[17]; /**< Reserved, Address offset: 0x0C - 0x4C */
  171. __IO uint32_t EXTICR1; /**< EXTI external interrupt configuration register, Address offset: 0x50 */
  172. uint32_t RESERVED_1[7]; /**< Reserved, Address offset: 0x54 - 0x6C */
  173. __IO uint32_t IMR; /**< EXTI interrupt mask register, Address offset: 0x70 */
  174. __IO uint32_t EMR; /**< EXTI event mask register, Address offset: 0x74 */
  175. } EXTI_t;
  176. /**
  177. * @brief registers of FLASH
  178. */
  179. typedef struct
  180. {
  181. __IO uint32_t ACR; /**< FLASH access control register, Address offset: 0x00 */
  182. uint32_t RESERVED_0[1]; /**< Reserved, Address offset: 0x04 */
  183. __IO uint32_t CRKEY; /**< FLASH control key register, Address offset: 0x08 */
  184. __IO uint32_t OPTKEY; /**< FLASH option key register, Address offset: 0x0C */
  185. __IO uint32_t SR; /**< FLASH status register, Address offset: 0x10 */
  186. __IO uint32_t CR; /**< FLASH control register, Address offset: 0x14 */
  187. uint32_t RESERVED_1[2]; /**< Reserved, Address offset: 0x18 - 0x1C */
  188. __IO uint32_t OPTR1; /**< FLASH option register 1, Address offset: 0x20 */
  189. __IO uint32_t OPTR2; /**< FLASH option register 2, Address offset: 0x24 */
  190. uint32_t RESERVED_2[4]; /**< Reserved, Address offset: 0x28 - 0x34 */
  191. __IO uint32_t WRP; /**< FLASH WRP write protect area register, Address offset: 0x38 */
  192. } FLASH_t;
  193. /**
  194. * @brief registers of GPIO
  195. */
  196. typedef struct
  197. {
  198. __IO uint32_t MODE; /**< GPIO port mode register, Address offset: 0x00 */
  199. __IO uint32_t OTYPE; /**< GPIO port output type register, Address offset: 0x04 */
  200. uint32_t RESERVED_0[1]; /**< Reserved, Address offset: 0x08 */
  201. __IO uint32_t PUPD; /**< GPIO port pull-up/pull-down register, Address offset: 0x0C */
  202. __IO uint32_t IDR; /**< GPIO port input data register, Address offset: 0x10 */
  203. __IO uint32_t ODR; /**< GPIO port output data register, Address offset: 0x14 */
  204. __IO uint32_t BSR; /**< GPIO port bit set/reset register, Address offset: 0x18 */
  205. uint32_t RESERVED_1[1]; /**< Reserved, Address offset: 0x1C */
  206. __IO uint32_t AFL; /**< GPIO alternate function registers, Address offset: 0x20 */
  207. uint32_t RESERVED_2[1]; /**< Reserved, Address offset: 0x24 */
  208. __IO uint32_t BR; /**< GPIO bit reset register, Address offset: 0x28 */
  209. } GPIO_t;
  210. /**
  211. * @brief registers of I2C
  212. */
  213. typedef struct
  214. {
  215. __IO uint32_t CR1; /**< I2C control register 1, Address offset: 0x00 */
  216. __IO uint32_t CR2; /**< I2C control register 2, Address offset: 0x04 */
  217. __IO uint32_t ADDR1; /**< I2C own address 1 register, Address offset: 0x08 */
  218. uint32_t RESERVED_0[3]; /**< reserved, Address offset: 0x0C - 0x14 */
  219. __IO uint32_t ISR; /**< I2C interrupt status register, Address offset: 0x18 */
  220. __IO uint32_t ICR; /**< I2C interrupt clear register, Address offset: 0x1C */
  221. uint32_t RESERVED_1[1]; /**< Reserved, Address offset: 0x20 */
  222. __IO uint32_t RDR; /**< I2C receive data register, Address offset: 0x24 */
  223. __IO uint32_t TDR; /**< I2C transmit data register, Address offset: 0x28 */
  224. } I2C_t;
  225. /**
  226. * @brief registers of IRTIM
  227. */
  228. typedef struct
  229. {
  230. __IO uint32_t CR; /**< IRTIM control register Address offset: 0x00 */
  231. } IRTIM_t;
  232. /**
  233. * @brief registers of IWDG
  234. */
  235. typedef struct
  236. {
  237. __IO uint32_t CR; /**< IWDG control register, Address offset: 0x00 */
  238. __IO uint32_t CFG; /**< IWDG configuration register, Address offset: 0x04 */
  239. __IO uint32_t RESERVED_0[3]; /**< Reserved, Address offset: 0x08 - 0x10 */
  240. __IO uint32_t CNT; /**< IWDG counter register, Address offset: 0x14 */
  241. } IWDG_t;
  242. /**
  243. * @brief registers of LPTimer
  244. */
  245. typedef struct
  246. {
  247. __IO uint32_t ISR; /**< LPTIM interrupt and status register, Address offset: 0x00 */
  248. __IO uint32_t ICR; /**< LPTIM interrupt clear register, Address offset: 0x04 */
  249. __IO uint32_t IER; /**< LPTIM interrupt enable register, Address offset: 0x08 */
  250. __IO uint32_t CFG; /**< LPTIM configuration register, Address offset: 0x0C */
  251. __IO uint32_t CR; /**< LPTIM control register, Address offset: 0x10 */
  252. __IO uint32_t RESERVED_0[1]; /**< Reserved, Address offset: 0x10 */
  253. __IO uint32_t ARR; /**< LPTIM autoreload register, Address offset: 0x18 */
  254. __IO uint32_t CNT; /**< LPTIM counter register, Address offset: 0x1C */
  255. } LPTIM_t;
  256. /**
  257. * @brief registers of PMU
  258. */
  259. typedef struct
  260. {
  261. __IO uint32_t CR; /**< PMU control register, Address offset: 0x00 */
  262. __IO uint32_t RESERVED_0[11]; /**< Reserved, Address offset: 0x04 - 0x2C */
  263. __IO uint32_t FLASH_WAKEUP; /**< PMU Flash wakeup time control, Address offset: 0x30 */
  264. } PMU_t;
  265. /**
  266. * @brief registers of RCC
  267. */
  268. typedef struct
  269. {
  270. __IO uint32_t CSR1; /**< RCC clock control and status register 1, Address offset: 0x00 */
  271. uint32_t RESERVED_0[1]; /**< Reserved, Address offset: 0x04 */
  272. __IO uint32_t CFG; /**< RCC clocks config register, Address offset: 0x08 */
  273. uint32_t RESERVED_1[1]; /**< Reserved, Address offset: 0x0C */
  274. __IO uint32_t IER; /**< RCC interrupt enable register, Address offset: 0x10 */
  275. __IO uint32_t ISR; /**< RCC interrupt status register, Address offset: 0x14 */
  276. __IO uint32_t ICR; /**< RCC interrupt clear register, Address offset: 0x18 */
  277. __IO uint32_t IOPRST; /**< RCC IO port reset register, Address offset: 0x1C */
  278. __IO uint32_t AHBRST; /**< RCC AHB peripherals reset register, Address offset: 0x20 */
  279. __IO uint32_t APBRST1; /**< RCC APB peripherals reset register 1, Address offset: 0x24 */
  280. __IO uint32_t APBRST2; /**< RCC APB peripherals reset register 2, Address offset: 0x28 */
  281. __IO uint32_t IOPEN; /**< RCC IO port clock enable register, Address offset: 0x2C */
  282. __IO uint32_t AHBEN; /**< RCC AHB peripherals clock enable register, Address offset: 0x30 */
  283. __IO uint32_t APBEN1; /**< RCC APB peripherals clock enable register 1, Address offset: 0x34 */
  284. __IO uint32_t APBEN2; /**< RCC APB peripherals clock enable register 2, Address offset: 0x38 */
  285. __IO uint32_t CLKSEL; /**< RCC peripherals independent clock source select register, Address offset: 0x3C */
  286. uint32_t RESERVED_2[1]; /**< Reserved, Address offset: 0x40 */
  287. __IO uint32_t CSR2; /**< RCC clock control and status register 2, Address offset: 0x44 */
  288. uint32_t RESERVED_3[2]; /**< Reserved, Address offset: 0x48 - 0x4C */
  289. __IO uint32_t RCLCAL; /**< RCC RCL calibration register, Address offset: 0x50 */
  290. __IO uint32_t RCHCAL; /**< RCC RCH calibration register, Address offset: 0x54 */
  291. } RCC_t;
  292. /**
  293. * @brief registers of SPI
  294. */
  295. typedef struct
  296. {
  297. __IO uint32_t CR1; /**< SPI control register 1, Address offset: 0x00 */
  298. __IO uint32_t CR2; /**< SPI control register 2, Address offset: 0x04 */
  299. uint32_t RESERVED_0[1]; /**< Reserved, Address offset: 0x08 */
  300. __IO uint32_t ISR; /**< SPI interrupt status register, Address offset: 0x0C */
  301. __IO uint32_t ICR; /**< SPI interrupt status clear register, Address offset: 0x10 */
  302. __IO uint32_t DR; /**< SPI data register, Address offset: 0x14 */
  303. } SPI_t;
  304. /**
  305. * @brief registers of Timer
  306. */
  307. typedef struct
  308. {
  309. __IO uint32_t CR1; /**< TIM control register 1, Address offset: 0x00 */
  310. __IO uint32_t CR2; /**< TIM control register 2, Address offset: 0x04 */
  311. __IO uint32_t SMC; /**< TIM slave mode control register, Address offset: 0x08 */
  312. __IO uint32_t DIER; /**< TIM DMA/interrupt enable register, Address offset: 0x0C */
  313. __IO uint32_t SR; /**< TIM status register, Address offset: 0x10 */
  314. __IO uint32_t EVTG; /**< TIM event generation register, Address offset: 0x14 */
  315. __IO uint32_t CCM1; /**< TIM capture/compare mode register 1, Address offset: 0x18 */
  316. __IO uint32_t CCM2; /**< TIM capture/compare mode register 2, Address offset: 0x1C */
  317. __IO uint32_t CCEN; /**< TIM capture/compare enable register, Address offset: 0x20 */
  318. __IO uint32_t CNT; /**< TIM counter register, Address offset: 0x24 */
  319. __IO uint32_t PSC; /**< TIM prescaler register, Address offset: 0x28 */
  320. __IO uint32_t ARR; /**< TIM auto-reload register, Address offset: 0x2C */
  321. __IO uint32_t RCR; /**< TIM repetition counter register, Address offset: 0x30 */
  322. __IO uint32_t CC1; /**< TIM capture/compare register 1, Address offset: 0x34 */
  323. __IO uint32_t CC2; /**< TIM capture/compare register 2, Address offset: 0x38 */
  324. __IO uint32_t CC3; /**< TIM capture/compare register 3, Address offset: 0x3C */
  325. __IO uint32_t CC4; /**< TIM capture/compare register 4, Address offset: 0x40 */
  326. __IO uint32_t BDT; /**< TIM break and dead-time register, Address offset: 0x44 */
  327. uint32_t RESERVED_0[2]; /**< Reserved, Address offset: 0x48 - 0x4C */
  328. __IO uint32_t CFG; /**< TIM option register, Address offset: 0x50 */
  329. uint32_t RESERVED_1[3]; /**< Reserved, Address offset: 0x54 - 0x5C */
  330. __IO uint32_t AF1; /**< TIM alternate function register 1, Address offset: 0x60 */
  331. uint32_t RESERVED_2[1]; /**< Reserved, Address offset: 0x64 */
  332. __IO uint32_t TISEL; /**< TIM Input Selection register, Address offset: 0x68 */
  333. } TIM_t;
  334. /**
  335. * @brief registers of UART
  336. */
  337. typedef struct
  338. {
  339. __IO uint32_t CR1; /**< UART control register 1, Address offset: 0x00 */
  340. __IO uint32_t CR2; /**< UART control register 2, Address offset: 0x04 */
  341. __IO uint32_t CR3; /**< UART control register 3, Address offset: 0x08 */
  342. __IO uint32_t BRR; /**< UART baud rate register, Address offset: 0x0C */
  343. uint32_t RESERVED_0[3]; /**< Reserved, Address offset: 0x10-0x18 */
  344. __IO uint32_t ISR; /**< UART interrupt and status register, Address offset: 0x1C */
  345. __IO uint32_t ICR; /**< UART interrupt flag clear register, Address offset: 0x20 */
  346. __IO uint32_t RDR; /**< UART receive data register, Address offset: 0x24 */
  347. __IO uint32_t TDR; /**< UART transmit data register, Address offset: 0x28 */
  348. } UART_t;
  349. /**
  350. * @}
  351. */
  352. /*--------------------------------------------define--------------------------------------------*/
  353. /************************************************************************************************/
  354. /**
  355. * @addtogroup CIU32F003_Constants
  356. * @{
  357. */
  358. /************************************************************************************************/
  359. /* Memory Map */
  360. #define FLASH_MEM_BASE (0x00000000UL) /**< FLASH Base Address */
  361. #define SRAM_BASE (0x20000000UL) /**< SRAM Base Address */
  362. #define APB_BASE (0x40000000UL) /**< APB Base Address */
  363. #define AHB_BASE (0x40020000UL) /**< AHB Base Address */
  364. #define GPIO_BASE (0x50000000UL) /**< GPIO Base Address */
  365. /* Option Bytes */
  366. #define FLASH_OB_OPTR1_ADDR (0x1FFF0000UL) /**< Option Bytes1 base address */
  367. #define FLASH_OB_OPTR2_ADDR (0x1FFF0004UL) /**< Option Bytes2 base address */
  368. #define FLASH_OB_WRP_ADDR (0x1FFF0008UL) /**< WRP base address */
  369. /* Engineer */
  370. #define RCH_CAL (0x1FFF0204UL) /**< RCH calibration value address */
  371. #define RCL_CAL (0x1FFF020CUL) /**< RCL calibration value address */
  372. #define UID_BASE (0x1FFF0340UL) /**< Unique device ID register base address */
  373. #define DEVICE_TYPE (0x1FFF03A4UL) /**< device type */
  374. #define USERFLASH_SIZE (0x1FFF03A8UL) /**< Size of user flash */
  375. #define SRAM_SIZE (0x1FFF03ACUL) /**< Size of sram */
  376. #define BGR_CAL (0x1FFF03C0UL) /**< BGR calibration value address */
  377. /* APB Peripherals */
  378. #define TIM3_BASE (APB_BASE + 0x00000400UL)
  379. #define IWDG_BASE (APB_BASE + 0x00003000UL)
  380. #define UART2_BASE (APB_BASE + 0x00004400UL)
  381. #define I2C1_BASE (APB_BASE + 0x00005400UL)
  382. #define PMU_BASE (APB_BASE + 0x00007000UL)
  383. #define LPTIM1_BASE (APB_BASE + 0x00007C00UL)
  384. #define IRTIM_BASE (APB_BASE + 0x00010000UL)
  385. #define COMP_COMMON_BASE (APB_BASE + 0x00010200UL)
  386. #define COMP1_BASE (COMP_COMMON_BASE + 0x00000010UL)
  387. #define COMP2_BASE (COMP_COMMON_BASE + 0x00000014UL)
  388. #define ADC_BASE (APB_BASE + 0x00012400UL)
  389. #define TIM1_BASE (APB_BASE + 0x00012C00UL)
  390. #define SPI1_BASE (APB_BASE + 0x00013000UL)
  391. #define UART1_BASE (APB_BASE + 0x00013800UL)
  392. #define DBG_BASE (APB_BASE + 0x00015800UL)
  393. /* AHB Peripherals */
  394. #define RCC_BASE (AHB_BASE + 0x00001000UL)
  395. #define EXTI_BASE (AHB_BASE + 0x00001800UL)
  396. #define FLASH_REGISTERS_BASE (AHB_BASE + 0x00002000UL)
  397. #define CRC_BASE (AHB_BASE + 0x00003000UL)
  398. /* GPIO */
  399. #define GPIOA_BASE (GPIO_BASE + 0x00000000UL)
  400. #define GPIOB_BASE (GPIO_BASE + 0x00000400UL)
  401. #define GPIOC_BASE (GPIO_BASE + 0x00000800UL)
  402. /* APB Peripherals instance*/
  403. #define TIM1 ((TIM_t *) TIM1_BASE)
  404. #define TIM3 ((TIM_t *) TIM3_BASE)
  405. #define IWDG ((IWDG_t *) IWDG_BASE)
  406. #define UART2 ((UART_t *) UART2_BASE)
  407. #define I2C1 ((I2C_t *) I2C1_BASE)
  408. #define PMU ((PMU_t *) PMU_BASE)
  409. #define LPTIM1 ((LPTIM_t *) LPTIM1_BASE)
  410. #define COMP_COMMON ((COMP_COMMON_t *) COMP_COMMON_BASE)
  411. #define COMP1 ((COMP_t *) COMP1_BASE)
  412. #define COMP2 ((COMP_t *) COMP2_BASE)
  413. #define ADC ((ADC_t *) ADC_BASE)
  414. #define SPI1 ((SPI_t *) SPI1_BASE)
  415. #define UART1 ((UART_t *) UART1_BASE)
  416. #define DBG ((DBG_t *) DBG_BASE)
  417. #define IRTIM ((IRTIM_t *) IRTIM_BASE)
  418. /* AHB Peripherals instance*/
  419. #define RCC ((RCC_t *) RCC_BASE)
  420. #define EXTI ((EXTI_t *) EXTI_BASE)
  421. #define FLASH ((FLASH_t *) FLASH_REGISTERS_BASE)
  422. #define CRC ((CRC_t *) CRC_BASE)
  423. /* GPIO instance*/
  424. #define GPIOA ((GPIO_t *) GPIOA_BASE)
  425. #define GPIOB ((GPIO_t *) GPIOB_BASE)
  426. #define GPIOC ((GPIO_t *) GPIOC_BASE)
  427. /*---------------------------Peripheral Registers Bits Definition-------------------------------*/
  428. /*-----------------------------------------------------------------------------------------------
  429. ADC Registers Bits
  430. ------------------------------------------------------------------------------------------------*/
  431. /* Bits for ADC_CR */
  432. #define ADC_CR_ADEN_POS (0U)
  433. #define ADC_CR_ADEN_MASK (0x1UL << ADC_CR_ADEN_POS) /**< 0x00000001 */
  434. #define ADC_CR_ADEN ADC_CR_ADEN_MASK /**< ADC enable */
  435. #define ADC_CR_ADDIS_POS (1U)
  436. #define ADC_CR_ADDIS_MASK (0x1UL << ADC_CR_ADDIS_POS) /**< 0x00000002 */
  437. #define ADC_CR_ADDIS ADC_CR_ADDIS_MASK /**< ADC disable */
  438. #define ADC_CR_START_POS (2U)
  439. #define ADC_CR_START_MASK (0x1UL << ADC_CR_START_POS) /**< 0x00000004 */
  440. #define ADC_CR_START ADC_CR_START_MASK /**< ADC group regular conversion start */
  441. #define ADC_CR_STOP_POS (4U)
  442. #define ADC_CR_STOP_MASK (0x1UL << ADC_CR_STOP_POS) /**< 0x00000010 */
  443. #define ADC_CR_STOP ADC_CR_STOP_MASK /**< ADC group regular conversion stop */
  444. #define ADC_CR_CALEN_POS (31U)
  445. #define ADC_CR_CALEN_MASK (0x1UL << ADC_CR_CALEN_POS) /**< 0x80000000 */
  446. #define ADC_CR_CALEN ADC_CR_CALEN_MASK /**< ADC calibration */
  447. /* Bits for ADC_CFG1 */
  448. #define ADC_CFG1_SDIR_POS (2U)
  449. #define ADC_CFG1_SDIR_MASK (0x1UL << ADC_CFG1_SDIR_POS) /**< 0x00000004 */
  450. #define ADC_CFG1_SDIR ADC_CFG1_SDIR_MASK /**< ADC group regular sequencer scan direction */
  451. #define ADC_CFG1_TRIGEN_POS (9U)
  452. #define ADC_CFG1_TRIGEN_MASK (0x3UL << ADC_CFG1_TRIGEN_POS) /**< 0x00000600 */
  453. #define ADC_CFG1_TRIGEN ADC_CFG1_TRIGEN_MASK /**< ADC group regular external trigger polarity */
  454. #define ADC_CFG1_TRIGEN_SW (0x0UL << ADC_CFG1_TRIGEN_POS) /**< 0x00000000 */
  455. #define ADC_CFG1_TRIGEN_HW_EDGE_RISING (0x1UL << ADC_CFG1_TRIGEN_POS) /**< 0x00000200 */
  456. #define ADC_CFG1_TRIGEN_HW_EDGE_FALLING (0x2UL << ADC_CFG1_TRIGEN_POS) /**< 0x00000400 */
  457. #define ADC_CFG1_TRIGEN_HW_EDGE_BOTH (0x3UL << ADC_CFG1_TRIGEN_POS) /**< 0x00000600 */
  458. #define ADC_CFG1_OVRN_MOD_POS (11U)
  459. #define ADC_CFG1_OVRN_MOD_MASK (0x1UL << ADC_CFG1_OVRN_MOD_POS) /**< 0x00000800 */
  460. #define ADC_CFG1_OVRN_MOD ADC_CFG1_OVRN_MOD_MASK /**< ADC group regular overrun configuration */
  461. #define ADC_CFG1_CONV_MOD_POS (12U)
  462. #define ADC_CFG1_CONV_MOD_MASK (0x3UL << ADC_CFG1_CONV_MOD_POS) /**< 0x00003000 */
  463. #define ADC_CFG1_CONV_MOD ADC_CFG1_CONV_MOD_MASK /**< ADC group regular sequencer conversion mode */
  464. #define ADC_CFG1_CONV_MOD_SINGLE (0x0UL << ADC_CFG1_CONV_MOD_POS) /**< 0x00000000 */
  465. #define ADC_CFG1_CONV_MOD_CONTINUOUS (0x1UL << ADC_CFG1_CONV_MOD_POS) /**< 0x00001000 */
  466. #define ADC_CFG1_CONV_MOD_DISCONTINUOUS (0x2UL << ADC_CFG1_CONV_MOD_POS) /**< 0x00002000 */
  467. #define ADC_CFG1_WAIT_MOD_POS (14U)
  468. #define ADC_CFG1_WAIT_MOD_MASK (0x1UL << ADC_CFG1_WAIT_MOD_POS) /**< 0x00004000 */
  469. #define ADC_CFG1_WAIT_MOD ADC_CFG1_WAIT_MOD_MASK /**< ADC auto wait */
  470. #define ADC_CFG1_TRIG_SEL_POS (16U)
  471. #define ADC_CFG1_TRIG_SEL_MASK (0x3UL << ADC_CFG1_TRIG_SEL_POS) /**< 0x00030000 */
  472. #define ADC_CFG1_TRIG_SEL ADC_CFG1_TRIG_SEL_MASK /**< ADC group regular external trigger source */
  473. #define ADC_CFG1_TRIG_TIM1_TRGO (0x0UL << ADC_CFG1_TRIG_SEL_POS) /**< 0x00000000 */
  474. #define ADC_CFG1_TRIG_TIM1_OC4_ADC (0x1UL << ADC_CFG1_TRIG_SEL_POS) /**< 0x00010000 */
  475. #define ADC_CFG1_TRIG_TIM3_TRGO (0x2UL << ADC_CFG1_TRIG_SEL_POS) /**< 0x00020000 */
  476. #define ADC_CFG1_TRIG_EXTI7 (0x3UL << ADC_CFG1_TRIG_SEL_POS) /**< 0x00030000 */
  477. /* Bits for ADC_CFG2 */
  478. #define ADC_CFG2_VBGREN_POS (16U)
  479. #define ADC_CFG2_VBGREN_MASK (0x1UL << ADC_CFG2_VBGREN_POS) /**< 0x00010000 */
  480. #define ADC_CFG2_VBGREN ADC_CFG2_VBGREN_MASK /**< ADC internal path to VBGR enable */
  481. #define ADC_CFG2_PRESC_POS (24U)
  482. #define ADC_CFG2_PRESC_MASK (0x7UL << ADC_CFG2_PRESC_POS) /**< 0x07000000 */
  483. #define ADC_CFG2_PRESC ADC_CFG2_PRESC_MASK /**< ADC asynchronous clock prescaler (prescaler only for clock source asynchronous) */
  484. #define ADC_CFG2_PRESC_DIV1 (0x0UL << ADC_CFG2_PRESC_POS) /**< 0x00000000 */
  485. #define ADC_CFG2_PRESC_DIV2 (0x1UL << ADC_CFG2_PRESC_POS) /**< 0x01000000 */
  486. #define ADC_CFG2_PRESC_DIV3 (0x2UL << ADC_CFG2_PRESC_POS) /**< 0x02000000 */
  487. #define ADC_CFG2_PRESC_DIV4 (0x3UL << ADC_CFG2_PRESC_POS) /**< 0x03000000 */
  488. #define ADC_CFG2_PRESC_DIV8 (0x4UL << ADC_CFG2_PRESC_POS) /**< 0x04000000 */
  489. #define ADC_CFG2_PRESC_DIV16 (0x5UL << ADC_CFG2_PRESC_POS) /**< 0x05000000 */
  490. #define ADC_CFG2_PRESC_DIV32 (0x6UL << ADC_CFG2_PRESC_POS) /**< 0x06000000 */
  491. #define ADC_CFG2_PRESC_DIV64 (0x7UL << ADC_CFG2_PRESC_POS) /**< 0x07000000 */
  492. /* Bits for ADC_ISR */
  493. #define ADC_ISR_EOSAMP_POS (1U)
  494. #define ADC_ISR_EOSAMP_MASK (0x1UL << ADC_ISR_EOSAMP_POS) /**< 0x00000002 */
  495. #define ADC_ISR_EOSAMP ADC_ISR_EOSAMP_MASK /**< ADC group regular end of sampling flag */
  496. #define ADC_ISR_EOC_POS (2U)
  497. #define ADC_ISR_EOC_MASK (0x1UL << ADC_ISR_EOC_POS) /**< 0x00000004 */
  498. #define ADC_ISR_EOC ADC_ISR_EOC_MASK /**< ADC group regular end of unitary conversion flag */
  499. #define ADC_ISR_EOS_POS (3U)
  500. #define ADC_ISR_EOS_MASK (0x1UL << ADC_ISR_EOS_POS) /**< 0x00000008 */
  501. #define ADC_ISR_EOS ADC_ISR_EOS_MASK /**< ADC group regular end of sequence conversions flag */
  502. #define ADC_ISR_OVRN_POS (4U)
  503. #define ADC_ISR_OVRN_MASK (0x1UL << ADC_ISR_OVRN_POS) /**< 0x00000010 */
  504. #define ADC_ISR_OVRN ADC_ISR_OVRN_MASK /**< ADC group regular overrun flag */
  505. #define ADC_ISR_AWDG_POS (7U)
  506. #define ADC_ISR_AWDG_MASK (0x1UL << ADC_ISR_AWDG_POS) /**< 0x00000080 */
  507. #define ADC_ISR_AWDG ADC_ISR_AWDG_MASK /**< ADC analog watchdog flag */
  508. #define ADC_ISR_EOCAL_POS (11U)
  509. #define ADC_ISR_EOCAL_MASK (0x1UL << ADC_ISR_EOCAL_POS) /**< 0x00000800 */
  510. #define ADC_ISR_EOCAL ADC_ISR_EOCAL_MASK /**< ADC end of calibration flag */
  511. /* Bits for ADC_IER */
  512. #define ADC_IER_EOSAMPIE_POS (1U)
  513. #define ADC_IER_EOSAMPIE_MASK (0x1UL << ADC_IER_EOSAMPIE_POS) /**< 0x00000002 */
  514. #define ADC_IER_EOSAMPIE ADC_IER_EOSAMPIE_MASK /**< ADC group regular end of sampling interrupt */
  515. #define ADC_IER_EOCIE_POS (2U)
  516. #define ADC_IER_EOCIE_MASK (0x1UL << ADC_IER_EOCIE_POS) /**< 0x00000004 */
  517. #define ADC_IER_EOCIE ADC_IER_EOCIE_MASK /**< ADC group regular end of unitary conversion interrupt */
  518. #define ADC_IER_EOSIE_POS (3U)
  519. #define ADC_IER_EOSIE_MASK (0x1UL << ADC_IER_EOSIE_POS) /**< 0x00000008 */
  520. #define ADC_IER_EOSIE ADC_IER_EOSIE_MASK /**< ADC group regular end of sequence conversions interrupt */
  521. #define ADC_IER_OVRNIE_POS (4U)
  522. #define ADC_IER_OVRNIE_MASK (0x1UL << ADC_IER_OVRNIE_POS) /**< 0x00000010 */
  523. #define ADC_IER_OVRNIE ADC_IER_OVRNIE_MASK /**< ADC group regular overrun interrupt */
  524. #define ADC_IER_AWDGIE_POS (7U)
  525. #define ADC_IER_AWDGIE_MASK (0x1UL << ADC_IER_AWDGIE_POS) /**< 0x00000080 */
  526. #define ADC_IER_AWDGIE ADC_IER_AWDGIE_MASK /**< ADC analog watchdog interrupt */
  527. #define ADC_IER_EOCALIE_POS (11U)
  528. #define ADC_IER_EOCALIE_MASK (0x1UL << ADC_IER_EOCALIE_POS) /**< 0x00000800 */
  529. #define ADC_IER_EOCALIE ADC_IER_EOCALIE_MASK /**< ADC end of calibration interrupt */
  530. /* Bits for ADC_SAMPT */
  531. #define ADC_SAMPT_SAMPT_POS (0U)
  532. #define ADC_SAMPT_SAMPT_MASK (0xFUL << ADC_SAMPT_SAMPT_POS) /**< 0x0000000F */
  533. #define ADC_SAMPT_SAMPT ADC_SAMPT_SAMPT_MASK /**< ADC group of channels sampling time */
  534. #define ADC_SAMPT_SAMPT_3CYCLES (0x1UL << ADC_SAMPT_SAMPT_POS) /**< 0x00000001 */
  535. #define ADC_SAMPT_SAMPT_7CYCLES (0x2UL << ADC_SAMPT_SAMPT_POS) /**< 0x00000002 */
  536. #define ADC_SAMPT_SAMPT_12CYCLES (0x3UL << ADC_SAMPT_SAMPT_POS) /**< 0x00000003 */
  537. #define ADC_SAMPT_SAMPT_19CYCLES (0x4UL << ADC_SAMPT_SAMPT_POS) /**< 0x00000004 */
  538. #define ADC_SAMPT_SAMPT_39CYCLES (0x5UL << ADC_SAMPT_SAMPT_POS) /**< 0x00000005 */
  539. #define ADC_SAMPT_SAMPT_79CYCLES (0x6UL << ADC_SAMPT_SAMPT_POS) /**< 0x00000006 */
  540. #define ADC_SAMPT_SAMPT_119CYCLES (0x7UL << ADC_SAMPT_SAMPT_POS) /**< 0x00000007 */
  541. #define ADC_SAMPT_SAMPT_159CYCLES (0x8UL << ADC_SAMPT_SAMPT_POS) /**< 0x00000008 */
  542. #define ADC_SAMPT_SAMPT_239CYCLES (0x9UL << ADC_SAMPT_SAMPT_POS) /**< 0x00000009 */
  543. #define ADC_SAMPT_SAMPT_319CYCLES (0xAUL << ADC_SAMPT_SAMPT_POS) /**< 0x0000000A */
  544. #define ADC_SAMPT_SAMPT_479CYCLES (0xBUL << ADC_SAMPT_SAMPT_POS) /**< 0x0000000B */
  545. #define ADC_SAMPT_SAMPT_639CYCLES (0xCUL << ADC_SAMPT_SAMPT_POS) /**< 0x0000000C */
  546. #define ADC_SAMPT_SAMPT_959CYCLES (0xDUL << ADC_SAMPT_SAMPT_POS) /**< 0x0000000D */
  547. #define ADC_SAMPT_SAMPT_1279CYCLES (0xEUL << ADC_SAMPT_SAMPT_POS) /**< 0x0000000E */
  548. #define ADC_SAMPT_SAMPT_1919CYCLES (0xFUL << ADC_SAMPT_SAMPT_POS) /**< 0x0000000F */
  549. /* Bits for ADC_CHCFG */
  550. #define ADC_CHCFG_CHN_POS (0U)
  551. #define ADC_CHCFG_CHN_MASK (0x1FFUL << ADC_CHCFG_CHN_POS) /**< 0x000001FF */
  552. #define ADC_CHCFG_CHN ADC_CHCFG_CHN_MASK /**< ADC group regular sequencer channels */
  553. #define ADC_CHCFG_CHN0_POS (0U)
  554. #define ADC_CHCFG_CHN0_MASK (0x1UL << ADC_CHCFG_CHN0_POS) /**< 0x00000001 */
  555. #define ADC_CHCFG_CHN0 ADC_CHCFG_CHN0_MASK /**< ADC group regular sequencer channel 0 */
  556. #define ADC_CHCFG_CHN1_POS (1U)
  557. #define ADC_CHCFG_CHN1_MASK (0x1UL << ADC_CHCFG_CHN1_POS) /**< 0x00000002 */
  558. #define ADC_CHCFG_CHN1 ADC_CHCFG_CHN1_MASK /**< ADC group regular sequencer channel 1 */
  559. #define ADC_CHCFG_CHN2_POS (2U)
  560. #define ADC_CHCFG_CHN2_MASK (0x1UL << ADC_CHCFG_CHN2_POS) /**< 0x00000004 */
  561. #define ADC_CHCFG_CHN2 ADC_CHCFG_CHN2_MASK /**< ADC group regular sequencer channel 2 */
  562. #define ADC_CHCFG_CHN3_POS (3U)
  563. #define ADC_CHCFG_CHN3_MASK (0x1UL << ADC_CHCFG_CHN3_POS) /**< 0x00000008 */
  564. #define ADC_CHCFG_CHN3 ADC_CHCFG_CHN3_MASK /**< ADC group regular sequencer channel 3 */
  565. #define ADC_CHCFG_CHN4_POS (4U)
  566. #define ADC_CHCFG_CHN4_MASK (0x1UL << ADC_CHCFG_CHN4_POS) /**< 0x00000010 */
  567. #define ADC_CHCFG_CHN4 ADC_CHCFG_CHN4_MASK /**< ADC group regular sequencer channel 4 */
  568. #define ADC_CHCFG_CHN5_POS (5U)
  569. #define ADC_CHCFG_CHN5_MASK (0x1UL << ADC_CHCFG_CHN5_POS) /**< 0x00000020 */
  570. #define ADC_CHCFG_CHN5 ADC_CHCFG_CHN5_MASK /**< ADC group regular sequencer channel 5 */
  571. #define ADC_CHCFG_CHN6_POS (6U)
  572. #define ADC_CHCFG_CHN6_MASK (0x1UL << ADC_CHCFG_CHN6_POS) /**< 0x00000040 */
  573. #define ADC_CHCFG_CHN6 ADC_CHCFG_CHN6_MASK /**< ADC group regular sequencer channel 6 */
  574. #define ADC_CHCFG_CHN7_POS (7U)
  575. #define ADC_CHCFG_CHN7_MASK (0x1UL << ADC_CHCFG_CHN7_POS) /**< 0x00000080 */
  576. #define ADC_CHCFG_CHN7 ADC_CHCFG_CHN7_MASK /**< ADC group regular sequencer channel 7 */
  577. #define ADC_CHCFG_CHN8_POS (8U)
  578. #define ADC_CHCFG_CHN8_MASK (0x1UL << ADC_CHCFG_CHN8_POS) /**< 0x00000100 */
  579. #define ADC_CHCFG_CHN8 ADC_CHCFG_CHN8_MASK /**< ADC group regular sequencer channel 8 */
  580. /* Bits for ADC_AWDGCR */
  581. #define ADC_AWDGCR_CHN_POS (0U)
  582. #define ADC_AWDGCR_CHN_MASK (0x1FFUL << ADC_AWDGCR_CHN_POS) /**< 0x000001FF */
  583. #define ADC_AWDGCR_CHN ADC_AWDGCR_CHN_MASK /**< ADC analog watchdog monitored channel selection */
  584. #define ADC_AWDGCR_CHN0_POS (0U)
  585. #define ADC_AWDGCR_CHN0_MASK (0x1UL << ADC_AWDGCR_CHN0_POS) /**< 0x00000001 */
  586. #define ADC_AWDGCR_CHN0 ADC_AWDGCR_CHN0_MASK /**< ADC analog watchdog monitored channel 0 */
  587. #define ADC_AWDGCR_CHN1_POS (1U)
  588. #define ADC_AWDGCR_CHN1_MASK (0x1UL << ADC_AWDGCR_CHN1_POS) /**< 0x00000002 */
  589. #define ADC_AWDGCR_CHN1 ADC_AWDGCR_CHN1_MASK /**< ADC analog watchdog monitored channel 1 */
  590. #define ADC_AWDGCR_CHN2_POS (2U)
  591. #define ADC_AWDGCR_CHN2_MASK (0x1UL << ADC_AWDGCR_CHN2_POS) /**< 0x00000004 */
  592. #define ADC_AWDGCR_CHN2 ADC_AWDGCR_CHN2_MASK /**< ADC analog watchdog monitored channel 2 */
  593. #define ADC_AWDGCR_CHN3_POS (3U)
  594. #define ADC_AWDGCR_CHN3_MASK (0x1UL << ADC_AWDGCR_CHN3_POS) /**< 0x00000008 */
  595. #define ADC_AWDGCR_CHN3 ADC_AWDGCR_CHN3_MASK /**< ADC analog watchdog monitored channel 3 */
  596. #define ADC_AWDGCR_CHN4_POS (4U)
  597. #define ADC_AWDGCR_CHN4_MASK (0x1UL << ADC_AWDGCR_CHN4_POS) /**< 0x00000010 */
  598. #define ADC_AWDGCR_CHN4 ADC_AWDGCR_CHN4_MASK /**< ADC analog watchdog monitored channel 4 */
  599. #define ADC_AWDGCR_CHN5_POS (5U)
  600. #define ADC_AWDGCR_CHN5_MASK (0x1UL << ADC_AWDGCR_CHN5_POS) /**< 0x00000020 */
  601. #define ADC_AWDGCR_CHN5 ADC_AWDGCR_CHN5_MASK /**< ADC analog watchdog monitored channel 5 */
  602. #define ADC_AWDGCR_CHN6_POS (6U)
  603. #define ADC_AWDGCR_CHN6_MASK (0x1UL << ADC_AWDGCR_CHN6_POS) /**< 0x00000040 */
  604. #define ADC_AWDGCR_CHN6 ADC_AWDGCR_CHN6_MASK /**< ADC analog watchdog monitored channel 6 */
  605. #define ADC_AWDGCR_CHN7_POS (7U)
  606. #define ADC_AWDGCR_CHN7_MASK (0x1UL << ADC_AWDGCR_CHN7_POS) /**< 0x00000080 */
  607. #define ADC_AWDGCR_CHN7 ADC_AWDGCR_CHN7_MASK /**< ADC analog watchdog monitored channel 7 */
  608. #define ADC_AWDGCR_CHN8_POS (8U)
  609. #define ADC_AWDGCR_CHN8_MASK (0x1UL << ADC_AWDGCR_CHN8_POS) /**< 0x00000100 */
  610. #define ADC_AWDGCR_CHN8 ADC_AWDGCR_CHN8_MASK /**< ADC analog watchdog monitored channel 8 */
  611. /* Bits for ADC_AWDGTR */
  612. #define ADC_AWDGTR_AWDG_LT_POS (0U)
  613. #define ADC_AWDGTR_AWDG_LT_MASK (0xFFFUL << ADC_AWDGTR_AWDG_LT_POS) /**< 0x00000FFF */
  614. #define ADC_AWDGTR_AWDG_LT ADC_AWDGTR_AWDG_LT_MASK /**< ADC analog watchdog threshold low */
  615. #define ADC_AWDGTR_AWDG_LT_0 (0x001UL << ADC_AWDGTR_AWDG_LT_POS) /**< 0x00000001 */
  616. #define ADC_AWDGTR_AWDG_LT_1 (0x002UL << ADC_AWDGTR_AWDG_LT_POS) /**< 0x00000002 */
  617. #define ADC_AWDGTR_AWDG_LT_2 (0x004UL << ADC_AWDGTR_AWDG_LT_POS) /**< 0x00000004 */
  618. #define ADC_AWDGTR_AWDG_LT_3 (0x008UL << ADC_AWDGTR_AWDG_LT_POS) /**< 0x00000008 */
  619. #define ADC_AWDGTR_AWDG_LT_4 (0x010UL << ADC_AWDGTR_AWDG_LT_POS) /**< 0x00000010 */
  620. #define ADC_AWDGTR_AWDG_LT_5 (0x020UL << ADC_AWDGTR_AWDG_LT_POS) /**< 0x00000020 */
  621. #define ADC_AWDGTR_AWDG_LT_6 (0x040UL << ADC_AWDGTR_AWDG_LT_POS) /**< 0x00000040 */
  622. #define ADC_AWDGTR_AWDG_LT_7 (0x080UL << ADC_AWDGTR_AWDG_LT_POS) /**< 0x00000080 */
  623. #define ADC_AWDGTR_AWDG_LT_8 (0x100UL << ADC_AWDGTR_AWDG_LT_POS) /**< 0x00000100 */
  624. #define ADC_AWDGTR_AWDG_LT_9 (0x200UL << ADC_AWDGTR_AWDG_LT_POS) /**< 0x00000200 */
  625. #define ADC_AWDGTR_AWDG_LT_10 (0x400UL << ADC_AWDGTR_AWDG_LT_POS) /**< 0x00000400 */
  626. #define ADC_AWDGTR_AWDG_LT_11 (0x800UL << ADC_AWDGTR_AWDG_LT_POS) /**< 0x00000800 */
  627. #define ADC_AWDGTR_AWDG_HT_POS (16U)
  628. #define ADC_AWDGTR_AWDG_HT_MASK (0xFFFUL << ADC_AWDGTR_AWDG_HT_POS) /**< 0x0FFF0000 */
  629. #define ADC_AWDGTR_AWDG_HT ADC_AWDGTR_AWDG_HT_MASK /**< ADC Analog watchdog threshold high */
  630. #define ADC_AWDGTR_AWDG_HT_0 (0x001UL << ADC_AWDGTR_AWDG_HT_POS) /**< 0x00010000 */
  631. #define ADC_AWDGTR_AWDG_HT_1 (0x002UL << ADC_AWDGTR_AWDG_HT_POS) /**< 0x00020000 */
  632. #define ADC_AWDGTR_AWDG_HT_2 (0x004UL << ADC_AWDGTR_AWDG_HT_POS) /**< 0x00040000 */
  633. #define ADC_AWDGTR_AWDG_HT_3 (0x008UL << ADC_AWDGTR_AWDG_HT_POS) /**< 0x00080000 */
  634. #define ADC_AWDGTR_AWDG_HT_4 (0x010UL << ADC_AWDGTR_AWDG_HT_POS) /**< 0x00100000 */
  635. #define ADC_AWDGTR_AWDG_HT_5 (0x020UL << ADC_AWDGTR_AWDG_HT_POS) /**< 0x00200000 */
  636. #define ADC_AWDGTR_AWDG_HT_6 (0x040UL << ADC_AWDGTR_AWDG_HT_POS) /**< 0x00400000 */
  637. #define ADC_AWDGTR_AWDG_HT_7 (0x080UL << ADC_AWDGTR_AWDG_HT_POS) /**< 0x00800000 */
  638. #define ADC_AWDGTR_AWDG_HT_8 (0x100UL << ADC_AWDGTR_AWDG_HT_POS) /**< 0x01000000 */
  639. #define ADC_AWDGTR_AWDG_HT_9 (0x200UL << ADC_AWDGTR_AWDG_HT_POS) /**< 0x02000000 */
  640. #define ADC_AWDGTR_AWDG_HT_10 (0x400UL << ADC_AWDGTR_AWDG_HT_POS) /**< 0x04000000 */
  641. #define ADC_AWDGTR_AWDG_HT_11 (0x800UL << ADC_AWDGTR_AWDG_HT_POS) /**< 0x08000000 */
  642. /* Bits for ADC_CALFACT */
  643. #define ADC_CALFACT_CALFACT_POS (0U)
  644. #define ADC_CALFACT_CALFACT_MASK (0x3FUL << ADC_CALFACT_CALFACT_POS) /**< 0x0000003F */
  645. #define ADC_CALFACT_CALFACT ADC_CALFACT_CALFACT_MASK /**< ADC calibration factor in single-ended mode */
  646. #define ADC_CALFACT_CALFACT_0 (0x01UL << ADC_CALFACT_CALFACT_POS) /**< 0x00000001 */
  647. #define ADC_CALFACT_CALFACT_1 (0x02UL << ADC_CALFACT_CALFACT_POS) /**< 0x00000002 */
  648. #define ADC_CALFACT_CALFACT_2 (0x04UL << ADC_CALFACT_CALFACT_POS) /**< 0x00000004 */
  649. #define ADC_CALFACT_CALFACT_3 (0x08UL << ADC_CALFACT_CALFACT_POS) /**< 0x00000008 */
  650. #define ADC_CALFACT_CALFACT_4 (0x10UL << ADC_CALFACT_CALFACT_POS) /**< 0x00000010 */
  651. #define ADC_CALFACT_CALFACT_5 (0x20UL << ADC_CALFACT_CALFACT_POS) /**< 0x00000020 */
  652. /* Bits for ADC_DR */
  653. #define ADC_DR_DATA_POS (0U)
  654. #define ADC_DR_DATA_MASK (0xFFFUL << ADC_DR_DATA_POS) /**< 0x00000FFF */
  655. #define ADC_DR_DATA ADC_DR_DATA_MASK /**< ADC group regular conversion data */
  656. /* Bits for ADC_CFG3 */
  657. #define ADC_CFG3_MODE_POS (1U)
  658. #define ADC_CFG3_MODE_MASK (0x1UL << ADC_CFG3_MODE_POS) /**< 0x00000002 */
  659. #define ADC_CFG3_MODE ADC_CFG3_MODE_MASK /**< ADC mode selection */
  660. /*-----------------------------------------------------------------------------------------------
  661. COMP Registers Bits
  662. ------------------------------------------------------------------------------------------------*/
  663. /* Bits for COMP_CSR */
  664. #define COMP_CSR_EN_POS (0U)
  665. #define COMP_CSR_EN_MASK (0x1UL << COMP_CSR_EN_POS) /**< 0x00000001 */
  666. #define COMP_CSR_EN COMP_CSR_EN_MASK /**< Comparator enable */
  667. #define COMP_CSR_INM_POS (4U)
  668. #define COMP_CSR_INM_MASK (0x1UL << COMP_CSR_INM_POS) /**< 0x00000010 */
  669. #define COMP_CSR_INM COMP_CSR_INM_MASK /**< Comparator input minus selection */
  670. #define COMP_CSR_INM_INT_VREF (0x0UL << COMP_CSR_INM_POS) /**< 0x00000000 */
  671. #define COMP_CSR_INM_IO (0x1UL << COMP_CSR_INM_POS) /**< 0x00000010 */
  672. #define COMP_CSR_INP_POS (8U)
  673. #define COMP_CSR_INP_MASK (0x1UL << COMP_CSR_INP_POS) /**< 0x00000100 */
  674. #define COMP_CSR_INP COMP_CSR_INP_MASK /**< Comparator input plus selection */
  675. #define COMP_CSR_INP_IO1 (0x0UL << COMP_CSR_INP_POS) /**< 0x00000000 */
  676. #define COMP_CSR_INP_IO2 (0x1UL << COMP_CSR_INP_POS) /**< 0x00000100 */
  677. #define COMP_CSR_INPMOD_POS (13U)
  678. #define COMP_CSR_INPMOD_MASK (0x1UL << COMP_CSR_INPMOD_POS) /**< 0x00002000 */
  679. #define COMP_CSR_INPMOD COMP_CSR_INPMOD_MASK /**< Pair of comparators window mode. */
  680. #define COMP_CSR_OUTMOD_POS (14U)
  681. #define COMP_CSR_OUTMOD_MASK (0x1UL << COMP_CSR_OUTMOD_POS) /**< 0x00004000 */
  682. #define COMP_CSR_OUTMOD COMP_CSR_OUTMOD_MASK /**< Pair of comparators window output level. */
  683. #define COMP_CSR_POL_POS (15U)
  684. #define COMP_CSR_POL_MASK (0x1UL << COMP_CSR_POL_POS) /**< 0x00008000 */
  685. #define COMP_CSR_POL COMP_CSR_POL_MASK /**< Comparator output polarity */
  686. #define COMP_CSR_FLTIME_POS (25U)
  687. #define COMP_CSR_FLTIME_MASK (0x7UL << COMP_CSR_FLTIME_POS) /**< 0x0E000000 */
  688. #define COMP_CSR_FLTIME COMP_CSR_FLTIME_MASK /**< Comparator filtering time */
  689. #define COMP_CSR_FLTIME_1CYCLE (0x0UL << COMP_CSR_FLTIME_POS) /**< 0x00000000 */
  690. #define COMP_CSR_FLTIME_3CYCLE (0x1UL << COMP_CSR_FLTIME_POS) /**< 0x02000000 */
  691. #define COMP_CSR_FLTIME_7CYCLE (0x2UL << COMP_CSR_FLTIME_POS) /**< 0x04000000 */
  692. #define COMP_CSR_FLTIME_15CYCLE (0x3UL << COMP_CSR_FLTIME_POS) /**< 0x06000000 */
  693. #define COMP_CSR_FLTIME_31CYCLE (0x4UL << COMP_CSR_FLTIME_POS) /**< 0x08000000 */
  694. #define COMP_CSR_FLTIME_63CYCLE (0x5UL << COMP_CSR_FLTIME_POS) /**< 0x0A000000 */
  695. #define COMP_CSR_FLTIME_255CYCLE (0x6UL << COMP_CSR_FLTIME_POS) /**< 0x0C000000 */
  696. #define COMP_CSR_FLTIME_1023CYCLE (0x7UL << COMP_CSR_FLTIME_POS) /**< 0x0E000000 */
  697. #define COMP_CSR_FLTEN_POS (28U)
  698. #define COMP_CSR_FLTEN_MASK (0x1UL << COMP_CSR_FLTEN_POS) /**< 0x10000000 */
  699. #define COMP_CSR_FLTEN COMP_CSR_FLTEN_MASK /**< Comparator filtering enable */
  700. #define COMP_CSR_VAL_POS (30U)
  701. #define COMP_CSR_VAL_MASK (0x1UL << COMP_CSR_VAL_POS) /**< 0x40000000 */
  702. #define COMP_CSR_VAL COMP_CSR_VAL_MASK /**< Comparator output level */
  703. /* Bits for COMP_CR */
  704. #define COMP_CR_VCDIV_POS (0U)
  705. #define COMP_CR_VCDIV_MASK (0xFUL << COMP_CR_VCDIV_POS) /**< 0x0000000F */
  706. #define COMP_CR_VCDIV COMP_CR_VCDIV_MASK /**< Comparator VDDA divide selection */
  707. #define COMP_CR_VCDIV_1DIV16 (0x0UL << COMP_CR_VCDIV_POS) /**< 0x00000000 */
  708. #define COMP_CR_VCDIV_2DIV16 (0x1UL << COMP_CR_VCDIV_POS) /**< 0x00000001 */
  709. #define COMP_CR_VCDIV_3DIV16 (0x2UL << COMP_CR_VCDIV_POS) /**< 0x00000002 */
  710. #define COMP_CR_VCDIV_4DIV16 (0x3UL << COMP_CR_VCDIV_POS) /**< 0x00000003 */
  711. #define COMP_CR_VCDIV_5DIV16 (0x4UL << COMP_CR_VCDIV_POS) /**< 0x00000004 */
  712. #define COMP_CR_VCDIV_6DIV16 (0x5UL << COMP_CR_VCDIV_POS) /**< 0x00000005 */
  713. #define COMP_CR_VCDIV_7DIV16 (0x6UL << COMP_CR_VCDIV_POS) /**< 0x00000006 */
  714. #define COMP_CR_VCDIV_8DIV16 (0x7UL << COMP_CR_VCDIV_POS) /**< 0x00000007 */
  715. #define COMP_CR_VCDIV_9DIV16 (0x8UL << COMP_CR_VCDIV_POS) /**< 0x00000008 */
  716. #define COMP_CR_VCDIV_10DIV16 (0x9UL << COMP_CR_VCDIV_POS) /**< 0x00000009 */
  717. #define COMP_CR_VCDIV_11DIV16 (0xAUL << COMP_CR_VCDIV_POS) /**< 0x0000000A */
  718. #define COMP_CR_VCDIV_12DIV16 (0xBUL << COMP_CR_VCDIV_POS) /**< 0x0000000B */
  719. #define COMP_CR_VCDIV_13DIV16 (0xCUL << COMP_CR_VCDIV_POS) /**< 0x0000000C */
  720. #define COMP_CR_VCSEL_POS (6U)
  721. #define COMP_CR_VCSEL_MASK (0x1UL << COMP_CR_VCSEL_POS) /**< 0x00000040 */
  722. #define COMP_CR_VCSEL COMP_CR_VCSEL_MASK /**< Comparator internal reference voltage selection */
  723. #define COMP_CR_HYST_POS (16)
  724. #define COMP_CR_HYST_MASK (0x1UL << COMP_CR_HYST_POS) /**< 0x00010000 */
  725. #define COMP_CR_HYST COMP_CR_HYST_MASK /**< Comparator input hysteresis function control*/
  726. /*-----------------------------------------------------------------------------------------------
  727. CRC Registers Bits
  728. ------------------------------------------------------------------------------------------------*/
  729. /* Bits for CRC_CSR */
  730. #define CRC_CSR_POLY_SIZE_POS (0U)
  731. #define CRC_CSR_POLY_SIZE_MASK (0x1UL << CRC_CSR_POLY_SIZE_POS) /**< 0x00000001 */
  732. #define CRC_CSR_POLY_SIZE CRC_CSR_POLY_SIZE_MASK /**< Polynomial size bits */
  733. #define CRC_CSR_POLY_SIZE_16 (0x0UL << CRC_CSR_POLY_SIZE_POS) /**< 0x00000000 */
  734. #define CRC_CSR_POLY_SIZE_32 (0x1UL << CRC_CSR_POLY_SIZE_POS) /**< 0x00000001 */
  735. /* Bits for CRC_RDR */
  736. #define CRC_RDR_RESULT_POS (0U)
  737. #define CRC_RDR_RESULT_MASK (0xFFFFFFFFUL << CRC_RDR_RESULT_POS) /**< 0xFFFFFFFF */
  738. #define CRC_RDR_RESULT CRC_RDR_RESULT_MASK /**< Result data register bits */
  739. /* Bits for CRC_DR */
  740. #define CRC_DR_DATA_POS (0U)
  741. #define CRC_DR_DATA_MASK (0xFFUL << CRC_DR_DATA_POS) /**< 0x000000FF */
  742. #define CRC_DR_DATA CRC_DR_DATA_MASK /**< Data register bits */
  743. /*-----------------------------------------------------------------------------------------------
  744. DBG Registers Bits
  745. ------------------------------------------------------------------------------------------------*/
  746. /* Bits for DBG_CR */
  747. #define DBG_CR_DBG_STOP_POS (0U)
  748. #define DBG_CR_DBG_STOP_MASK (0x1UL << DBG_CR_DBG_STOP_POS) /**< 0x00000001 */
  749. #define DBG_CR_DBG_STOP DBG_CR_DBG_STOP_MASK
  750. /* Bits for DBG_APB_FZ1 */
  751. #define DBG_APB_FZ1_TIM3_HOLD_POS (1U)
  752. #define DBG_APB_FZ1_TIM3_HOLD_MASK (0x1UL << DBG_APB_FZ1_TIM3_HOLD_POS) /**< 0x00000002 */
  753. #define DBG_APB_FZ1_TIM3_HOLD DBG_APB_FZ1_TIM3_HOLD_MASK
  754. #define DBG_APB_FZ1_IWDG_HOLD_POS (18U)
  755. #define DBG_APB_FZ1_IWDG_HOLD_MASK (0x1UL << DBG_APB_FZ1_IWDG_HOLD_POS) /**< 0x00040000 */
  756. #define DBG_APB_FZ1_IWDG_HOLD DBG_APB_FZ1_IWDG_HOLD_MASK
  757. #define DBG_APB_FZ1_LPTIM1_HOLD_POS (29U)
  758. #define DBG_APB_FZ1_LPTIM1_HOLD_MASK (0x1UL << DBG_APB_FZ1_LPTIM1_HOLD_POS) /**< 0x20000000 */
  759. #define DBG_APB_FZ1_LPTIM1_HOLD DBG_APB_FZ1_LPTIM1_HOLD_MASK
  760. /* Bits for DBG_APB_FZ2 */
  761. #define DBG_APB_FZ2_TIM1_HOLD_POS (0U)
  762. #define DBG_APB_FZ2_TIM1_HOLD_MASK (0x1UL << DBG_APB_FZ2_TIM1_HOLD_POS) /**< 0x00000001 */
  763. #define DBG_APB_FZ2_TIM1_HOLD DBG_APB_FZ2_TIM1_HOLD_MASK
  764. /*-----------------------------------------------------------------------------------------------
  765. EXTI Registers Bits
  766. ------------------------------------------------------------------------------------------------*/
  767. /* Bits for EXTI_RTSR */
  768. #define EXTI_RTSR_RT0_POS (0U)
  769. #define EXTI_RTSR_RT0_MASK (0x1UL << EXTI_RTSR_RT0_POS) /**< 0x00000001 */
  770. #define EXTI_RTSR_RT0 EXTI_RTSR_RT0_MASK /**< Rising trigger configuration for input line 0 */
  771. #define EXTI_RTSR_RT1_POS (1U)
  772. #define EXTI_RTSR_RT1_MASK (0x1UL << EXTI_RTSR_RT1_POS) /**< 0x00000002 */
  773. #define EXTI_RTSR_RT1 EXTI_RTSR_RT1_MASK /**< Rising trigger configuration for input line 1 */
  774. #define EXTI_RTSR_RT2_POS (2U)
  775. #define EXTI_RTSR_RT2_MASK (0x1UL << EXTI_RTSR_RT2_POS) /**< 0x00000004 */
  776. #define EXTI_RTSR_RT2 EXTI_RTSR_RT2_MASK /**< Rising trigger configuration for input line 2 */
  777. #define EXTI_RTSR_RT3_POS (3U)
  778. #define EXTI_RTSR_RT3_MASK (0x1UL << EXTI_RTSR_RT3_POS) /**< 0x00000008 */
  779. #define EXTI_RTSR_RT3 EXTI_RTSR_RT3_MASK /**< Rising trigger configuration for input line 3 */
  780. #define EXTI_RTSR_RT4_POS (4U)
  781. #define EXTI_RTSR_RT4_MASK (0x1UL << EXTI_RTSR_RT4_POS) /**< 0x00000010 */
  782. #define EXTI_RTSR_RT4 EXTI_RTSR_RT4_MASK /**< Rising trigger configuration for input line 4 */
  783. #define EXTI_RTSR_RT5_POS (5U)
  784. #define EXTI_RTSR_RT5_MASK (0x1UL << EXTI_RTSR_RT5_POS) /**< 0x00000020 */
  785. #define EXTI_RTSR_RT5 EXTI_RTSR_RT5_MASK /**< Rising trigger configuration for input line 5 */
  786. #define EXTI_RTSR_RT6_POS (6U)
  787. #define EXTI_RTSR_RT6_MASK (0x1UL << EXTI_RTSR_RT6_POS) /**< 0x00000040 */
  788. #define EXTI_RTSR_RT6 EXTI_RTSR_RT6_MASK /**< Rising trigger configuration for input line 6 */
  789. #define EXTI_RTSR_RT7_POS (7U)
  790. #define EXTI_RTSR_RT7_MASK (0x1UL << EXTI_RTSR_RT7_POS) /**< 0x00000080 */
  791. #define EXTI_RTSR_RT7 EXTI_RTSR_RT7_MASK /**< Rising trigger configuration for input line 7 */
  792. #define EXTI_RTSR_RT16_POS (16U)
  793. #define EXTI_RTSR_RT16_MASK (0x1UL << EXTI_RTSR_RT16_POS) /**< 0x00010000 */
  794. #define EXTI_RTSR_RT16 EXTI_RTSR_RT16_MASK /**< Rising trigger configuration for input line 16 */
  795. #define EXTI_RTSR_RT17_POS (17U)
  796. #define EXTI_RTSR_RT17_MASK (0x1UL << EXTI_RTSR_RT17_POS) /**< 0x00020000 */
  797. #define EXTI_RTSR_RT17 EXTI_RTSR_RT17_MASK /**< Rising trigger configuration for input line 17 */
  798. /* Bits for EXTI_FTSR */
  799. #define EXTI_FTSR_FT0_POS (0U)
  800. #define EXTI_FTSR_FT0_MASK (0x1UL << EXTI_FTSR_FT0_POS) /**< 0x00000001 */
  801. #define EXTI_FTSR_FT0 EXTI_FTSR_FT0_MASK /**< Falling trigger configuration for input line 0 */
  802. #define EXTI_FTSR_FT1_POS (1U)
  803. #define EXTI_FTSR_FT1_MASK (0x1UL << EXTI_FTSR_FT1_POS) /**< 0x00000002 */
  804. #define EXTI_FTSR_FT1 EXTI_FTSR_FT1_MASK /**< Falling trigger configuration for input line 1 */
  805. #define EXTI_FTSR_FT2_POS (2U)
  806. #define EXTI_FTSR_FT2_MASK (0x1UL << EXTI_FTSR_FT2_POS) /**< 0x00000004 */
  807. #define EXTI_FTSR_FT2 EXTI_FTSR_FT2_MASK /**< Falling trigger configuration for input line 2 */
  808. #define EXTI_FTSR_FT3_POS (3U)
  809. #define EXTI_FTSR_FT3_MASK (0x1UL << EXTI_FTSR_FT3_POS) /**< 0x00000008 */
  810. #define EXTI_FTSR_FT3 EXTI_FTSR_FT3_MASK /**< Falling trigger configuration for input line 3 */
  811. #define EXTI_FTSR_FT4_POS (4U)
  812. #define EXTI_FTSR_FT4_MASK (0x1UL << EXTI_FTSR_FT4_POS) /**< 0x00000010 */
  813. #define EXTI_FTSR_FT4 EXTI_FTSR_FT4_MASK /**< Falling trigger configuration for input line 4 */
  814. #define EXTI_FTSR_FT5_POS (5U)
  815. #define EXTI_FTSR_FT5_MASK (0x1UL << EXTI_FTSR_FT5_POS) /**< 0x00000020 */
  816. #define EXTI_FTSR_FT5 EXTI_FTSR_FT5_MASK /**< Falling trigger configuration for input line 5 */
  817. #define EXTI_FTSR_FT6_POS (6U)
  818. #define EXTI_FTSR_FT6_MASK (0x1UL << EXTI_FTSR_FT6_POS) /**< 0x00000040 */
  819. #define EXTI_FTSR_FT6 EXTI_FTSR_FT6_MASK /**< Falling trigger configuration for input line 6 */
  820. #define EXTI_FTSR_FT7_POS (7U)
  821. #define EXTI_FTSR_FT7_MASK (0x1UL << EXTI_FTSR_FT7_POS) /**< 0x00000080 */
  822. #define EXTI_FTSR_FT7 EXTI_FTSR_FT7_MASK /**< Falling trigger configuration for input line 7 */
  823. #define EXTI_FTSR_FT16_POS (16U)
  824. #define EXTI_FTSR_FT16_MASK (0x1UL << EXTI_FTSR_FT16_POS) /**< 0x00010000 */
  825. #define EXTI_FTSR_FT16 EXTI_FTSR_FT16_MASK /**< Falling trigger configuration for input line 16 */
  826. #define EXTI_FTSR_FT17_POS (17U)
  827. #define EXTI_FTSR_FT17_MASK (0x1UL << EXTI_FTSR_FT17_POS) /**< 0x00020000 */
  828. #define EXTI_FTSR_FT17 EXTI_FTSR_FT17_MASK /**< Falling trigger configuration for input line 17 */
  829. /* Bits for EXTI_PIR */
  830. #define EXTI_PIR_PIF0_POS (0U)
  831. #define EXTI_PIR_PIF0_MASK (0x1UL << EXTI_PIR_PIF0_POS) /**< 0x00000001 */
  832. #define EXTI_PIR_PIF0 EXTI_PIR_PIF0_MASK /**< Rising or Falling pending interrupt flag on line 0 */
  833. #define EXTI_PIR_PIF1_POS (1U)
  834. #define EXTI_PIR_PIF1_MASK (0x1UL << EXTI_PIR_PIF1_POS) /**< 0x00000002 */
  835. #define EXTI_PIR_PIF1 EXTI_PIR_PIF1_MASK /**< Rising or Falling pending interrupt flag on line 1 */
  836. #define EXTI_PIR_PIF2_POS (2U)
  837. #define EXTI_PIR_PIF2_MASK (0x1UL << EXTI_PIR_PIF2_POS) /**< 0x00000004 */
  838. #define EXTI_PIR_PIF2 EXTI_PIR_PIF2_MASK /**< Rising or Falling pending interrupt flag on line 2 */
  839. #define EXTI_PIR_PIF3_POS (3U)
  840. #define EXTI_PIR_PIF3_MASK (0x1UL << EXTI_PIR_PIF3_POS) /**< 0x00000008 */
  841. #define EXTI_PIR_PIF3 EXTI_PIR_PIF3_MASK /**< Rising or Falling pending interrupt flag on line 3 */
  842. #define EXTI_PIR_PIF4_POS (4U)
  843. #define EXTI_PIR_PIF4_MASK (0x1UL << EXTI_PIR_PIF4_POS) /**< 0x00000010 */
  844. #define EXTI_PIR_PIF4 EXTI_PIR_PIF4_MASK /**< Rising or Falling pending interrupt flag on line 4 */
  845. #define EXTI_PIR_PIF5_POS (5U)
  846. #define EXTI_PIR_PIF5_MASK (0x1UL << EXTI_PIR_PIF5_POS) /**< 0x00000020 */
  847. #define EXTI_PIR_PIF5 EXTI_PIR_PIF5_MASK /**< Rising or Falling pending interrupt flag on line 5 */
  848. #define EXTI_PIR_PIF6_POS (6U)
  849. #define EXTI_PIR_PIF6_MASK (0x1UL << EXTI_PIR_PIF6_POS) /**< 0x00000040 */
  850. #define EXTI_PIR_PIF6 EXTI_PIR_PIF6_MASK /**< Rising or Falling pending interrupt flag on line 6 */
  851. #define EXTI_PIR_PIF7_POS (7U)
  852. #define EXTI_PIR_PIF7_MASK (0x1UL << EXTI_PIR_PIF7_POS) /**< 0x00000080 */
  853. #define EXTI_PIR_PIF7 EXTI_PIR_PIF7_MASK /**< Rising or Falling pending interrupt flag on line 7 */
  854. #define EXTI_PIR_PIF16_POS (16U)
  855. #define EXTI_PIR_PIF16_MASK (0x1UL << EXTI_PIR_PIF16_POS) /**< 0x00010000 */
  856. #define EXTI_PIR_PIF16 EXTI_PIR_PIF16_MASK /**< Rising or Falling pending interrupt flag on line 16 */
  857. #define EXTI_PIR_PIF17_POS (17U)
  858. #define EXTI_PIR_PIF17_MASK (0x1UL << EXTI_PIR_PIF17_POS) /**< 0x00020000 */
  859. #define EXTI_PIR_PIF17 EXTI_PIR_PIF17_MASK /**< Rising or Falling pending interrupt flag on line 17 */
  860. /* Bits for EXTI_EXTICR1 */
  861. #define EXTI_EXTICR1_EXTI0_POS (0U)
  862. #define EXTI_EXTICR1_EXTI0_MASK (0x3UL << EXTI_EXTICR1_EXTI0_POS) /**< 0x00000003 */
  863. #define EXTI_EXTICR1_EXTI0 EXTI_EXTICR1_EXTI0_MASK /**< EXTI 0 configuration */
  864. #define EXTI_EXTICR1_EXTI1_POS (4U)
  865. #define EXTI_EXTICR1_EXTI1_MASK (0x3UL << EXTI_EXTICR1_EXTI1_POS) /**< 0x00000030 */
  866. #define EXTI_EXTICR1_EXTI1 EXTI_EXTICR1_EXTI1_MASK /**< EXTI 1 configuration */
  867. #define EXTI_EXTICR1_EXTI2_POS (8U)
  868. #define EXTI_EXTICR1_EXTI2_MASK (0x3UL << EXTI_EXTICR1_EXTI2_POS) /**< 0x00000300 */
  869. #define EXTI_EXTICR1_EXTI2 EXTI_EXTICR1_EXTI2_MASK /**< EXTI 2 configuration */
  870. #define EXTI_EXTICR1_EXTI3_POS (12U)
  871. #define EXTI_EXTICR1_EXTI3_MASK (0x3UL << EXTI_EXTICR1_EXTI3_POS) /**< 0x00003000 */
  872. #define EXTI_EXTICR1_EXTI3 EXTI_EXTICR1_EXTI3_MASK /**< EXTI 3 configuration */
  873. #define EXTI_EXTICR1_EXTI4_POS (16U)
  874. #define EXTI_EXTICR1_EXTI4_MASK (0x3UL << EXTI_EXTICR1_EXTI4_POS) /**< 0x00030000 */
  875. #define EXTI_EXTICR1_EXTI4 EXTI_EXTICR1_EXTI4_MASK /**< EXTI 4 configuration */
  876. #define EXTI_EXTICR1_EXTI5_POS (20U)
  877. #define EXTI_EXTICR1_EXTI5_MASK (0x3UL << EXTI_EXTICR1_EXTI5_POS) /**< 0x00300000 */
  878. #define EXTI_EXTICR1_EXTI5 EXTI_EXTICR1_EXTI5_MASK /**< EXTI 5 configuration */
  879. #define EXTI_EXTICR1_EXTI6_POS (24U)
  880. #define EXTI_EXTICR1_EXTI6_MASK (0x3UL << EXTI_EXTICR1_EXTI6_POS) /**< 0x03000000 */
  881. #define EXTI_EXTICR1_EXTI6 EXTI_EXTICR1_EXTI6_MASK /**< EXTI 6 configuration */
  882. #define EXTI_EXTICR1_EXTI7_POS (28U)
  883. #define EXTI_EXTICR1_EXTI7_MASK (0x3UL << EXTI_EXTICR1_EXTI7_POS) /**< 0x30000000 */
  884. #define EXTI_EXTICR1_EXTI7 EXTI_EXTICR1_EXTI7_MASK /**< EXTI 7 configuration */
  885. /* Bits for EXTI_IMR */
  886. #define EXTI_IMR_IM0_POS (0U)
  887. #define EXTI_IMR_IM0_MASK (0x1UL << EXTI_IMR_IM0_POS) /**< 0x00000001 */
  888. #define EXTI_IMR_IM0 EXTI_IMR_IM0_MASK /**< Interrupt mask on line 0 */
  889. #define EXTI_IMR_IM1_POS (1U)
  890. #define EXTI_IMR_IM1_MASK (0x1UL << EXTI_IMR_IM1_POS) /**< 0x00000002 */
  891. #define EXTI_IMR_IM1 EXTI_IMR_IM1_MASK /**< Interrupt mask on line 1 */
  892. #define EXTI_IMR_IM2_POS (2U)
  893. #define EXTI_IMR_IM2_MASK (0x1UL << EXTI_IMR_IM2_POS) /**< 0x00000004 */
  894. #define EXTI_IMR_IM2 EXTI_IMR_IM2_MASK /**< Interrupt mask on line 2 */
  895. #define EXTI_IMR_IM3_POS (3U)
  896. #define EXTI_IMR_IM3_MASK (0x1UL << EXTI_IMR_IM3_POS) /**< 0x00000008 */
  897. #define EXTI_IMR_IM3 EXTI_IMR_IM3_MASK /**< Interrupt mask on line 3 */
  898. #define EXTI_IMR_IM4_POS (4U)
  899. #define EXTI_IMR_IM4_MASK (0x1UL << EXTI_IMR_IM4_POS) /**< 0x00000010 */
  900. #define EXTI_IMR_IM4 EXTI_IMR_IM4_MASK /**< Interrupt mask on line 4 */
  901. #define EXTI_IMR_IM5_POS (5U)
  902. #define EXTI_IMR_IM5_MASK (0x1UL << EXTI_IMR_IM5_POS) /**< 0x00000020 */
  903. #define EXTI_IMR_IM5 EXTI_IMR_IM5_MASK /**< Interrupt mask on line 5 */
  904. #define EXTI_IMR_IM6_POS (6U)
  905. #define EXTI_IMR_IM6_MASK (0x1UL << EXTI_IMR_IM6_POS) /**< 0x00000040 */
  906. #define EXTI_IMR_IM6 EXTI_IMR_IM6_MASK /**< Interrupt mask on line 6 */
  907. #define EXTI_IMR_IM7_POS (7U)
  908. #define EXTI_IMR_IM7_MASK (0x1UL << EXTI_IMR_IM7_POS) /**< 0x00000080 */
  909. #define EXTI_IMR_IM7 EXTI_IMR_IM7_MASK /**< Interrupt mask on line 7 */
  910. #define EXTI_IMR_IM16_POS (16U)
  911. #define EXTI_IMR_IM16_MASK (0x1UL << EXTI_IMR_IM16_POS) /**< 0x00010000 */
  912. #define EXTI_IMR_IM16 EXTI_IMR_IM16_MASK /**< Interrupt mask on line 16 */
  913. #define EXTI_IMR_IM17_POS (17U)
  914. #define EXTI_IMR_IM17_MASK (0x1UL << EXTI_IMR_IM17_POS) /**< 0x00020000 */
  915. #define EXTI_IMR_IM17 EXTI_IMR_IM17_MASK /**< Interrupt mask on line 17 */
  916. #define EXTI_IMR_IM30_POS (30U)
  917. #define EXTI_IMR_IM30_MASK (0x1UL << EXTI_IMR_IM30_POS) /**< 0x40000000 */
  918. #define EXTI_IMR_IM30 EXTI_IMR_IM30_MASK /**< Interrupt mask on line 30 */
  919. /* Bits for EXTI_EMR */
  920. #define EXTI_EMR_EM0_POS (0U)
  921. #define EXTI_EMR_EM0_MASK (0x1UL << EXTI_EMR_EM0_POS) /**< 0x00000001 */
  922. #define EXTI_EMR_EM0 EXTI_EMR_EM0_MASK /**< Event mask on line 0 */
  923. #define EXTI_EMR_EM1_POS (1U)
  924. #define EXTI_EMR_EM1_MASK (0x1UL << EXTI_EMR_EM1_POS) /**< 0x00000002 */
  925. #define EXTI_EMR_EM1 EXTI_EMR_EM1_MASK /**< Event mask on line 1 */
  926. #define EXTI_EMR_EM2_POS (2U)
  927. #define EXTI_EMR_EM2_MASK (0x1UL << EXTI_EMR_EM2_POS) /**< 0x00000004 */
  928. #define EXTI_EMR_EM2 EXTI_EMR_EM2_MASK /**< Event mask on line 2 */
  929. #define EXTI_EMR_EM3_POS (3U)
  930. #define EXTI_EMR_EM3_MASK (0x1UL << EXTI_EMR_EM3_POS) /**< 0x00000008 */
  931. #define EXTI_EMR_EM3 EXTI_EMR_EM3_MASK /**< Event mask on line 3 */
  932. #define EXTI_EMR_EM4_POS (4U)
  933. #define EXTI_EMR_EM4_MASK (0x1UL << EXTI_EMR_EM4_POS) /**< 0x00000010 */
  934. #define EXTI_EMR_EM4 EXTI_EMR_EM4_MASK /**< Event mask on line 4 */
  935. #define EXTI_EMR_EM5_POS (5U)
  936. #define EXTI_EMR_EM5_MASK (0x1UL << EXTI_EMR_EM5_POS) /**< 0x00000020 */
  937. #define EXTI_EMR_EM5 EXTI_EMR_EM5_MASK /**< Event mask on line 5 */
  938. #define EXTI_EMR_EM6_POS (6U)
  939. #define EXTI_EMR_EM6_MASK (0x1UL << EXTI_EMR_EM6_POS) /**< 0x00000040 */
  940. #define EXTI_EMR_EM6 EXTI_EMR_EM6_MASK /**< Event mask on line 6 */
  941. #define EXTI_EMR_EM7_POS (7U)
  942. #define EXTI_EMR_EM7_MASK (0x1UL << EXTI_EMR_EM7_POS) /**< 0x00000080 */
  943. #define EXTI_EMR_EM7 EXTI_EMR_EM7_MASK /**< Event mask on line 7 */
  944. #define EXTI_EMR_EM16_POS (16U)
  945. #define EXTI_EMR_EM16_MASK (0x1UL << EXTI_EMR_EM16_POS) /**< 0x00010000 */
  946. #define EXTI_EMR_EM16 EXTI_EMR_EM16_MASK /**< Event mask on line 16 */
  947. #define EXTI_EMR_EM17_POS (17U)
  948. #define EXTI_EMR_EM17_MASK (0x1UL << EXTI_EMR_EM17_POS) /**< 0x00020000 */
  949. #define EXTI_EMR_EM17 EXTI_EMR_EM17_MASK /**< Event mask on line 17 */
  950. #define EXTI_EMR_EM30_POS (30U)
  951. #define EXTI_EMR_EM30_MASK (0x1UL << EXTI_EMR_EM30_POS) /**< 0x40000000 */
  952. #define EXTI_EMR_EM30 EXTI_EMR_EM30_MASK /**< Event mask on line 30 */
  953. /*-----------------------------------------------------------------------------------------------
  954. Flash Registers Bits
  955. ------------------------------------------------------------------------------------------------*/
  956. /* Bits for FLASH_ACR */
  957. #define FLASH_ACR_LATENCY_POS (0U)
  958. #define FLASH_ACR_LATENCY_MASK (0x1UL << FLASH_ACR_LATENCY_POS) /**< 0x00000001 */
  959. #define FLASH_ACR_LATENCY FLASH_ACR_LATENCY_MASK /**< Flash read access waiting_latency */
  960. #define FLASH_ACR_LATENCY_0CLK (0x0UL << FLASH_ACR_LATENCY_POS) /**< 0x00000000 */
  961. #define FLASH_ACR_LATENCY_1CLK (0x1UL << FLASH_ACR_LATENCY_POS) /**< 0x00000001 */
  962. /* Bits for FLASH_CRKEY */
  963. #define FLASH_CRKEY_KEY_POS (0U)
  964. #define FLASH_CRKEY_KEY_MASK (0xFFFFFFFFUL << FLASH_CRKEY_KEY_POS) /**< 0xFFFFFFFF */
  965. #define FLASH_CRKEY_KEY FLASH_CRKEY_KEY_MASK /**< Flash unlock CR regigster key */
  966. /* Bits for FLASH_OPTKEY */
  967. #define FLASH_OPTKEY_KEY_POS (0U)
  968. #define FLASH_OPTKEY_KEY_MASK (0xFFFFFFFFUL << FLASH_OPTKEY_KEY_POS) /**< 0xFFFFFFFF */
  969. #define FLASH_OPTKEY_KEY FLASH_OPTKEY_KEY_MASK /**< Flash unlock option bytes key */
  970. /* Bits for FLASH_SR */
  971. #define FLASH_SR_WRPERR_POS (4U)
  972. #define FLASH_SR_WRPERR_MASK (0x1UL << FLASH_SR_WRPERR_POS) /**< 0x00000010 */
  973. #define FLASH_SR_WRPERR FLASH_SR_WRPERR_MASK /**< Flash WRP error flag */
  974. #define FLASH_SR_OPTVERR_POS (15U)
  975. #define FLASH_SR_OPTVERR_MASK (0x1UL << FLASH_SR_OPTVERR_POS) /**< 0x00008000 */
  976. #define FLASH_SR_OPTVERR FLASH_SR_OPTVERR_MASK /**< Flash option bytes verify error flag */
  977. #define FLASH_SR_BSY_POS (16U)
  978. #define FLASH_SR_BSY_MASK (0x1UL << FLASH_SR_BSY_POS) /**< 0x00010000 */
  979. #define FLASH_SR_BSY FLASH_SR_BSY_MASK /**< Flash operation status flag */
  980. #define FLASH_SR_EOP_POS (24U)
  981. #define FLASH_SR_EOP_MASK (0x1UL << FLASH_SR_EOP_POS) /**< 0x01000000 */
  982. #define FLASH_SR_EOP FLASH_SR_EOP_MASK /**< Flash operation complete flag */
  983. /* Bits for FLASH_CR */
  984. #define FLASH_CR_OP_MODE_POS (1U)
  985. #define FLASH_CR_OP_MODE_MASK (0x3UL << FLASH_CR_OP_MODE_POS) /**< 0x00000006 */
  986. #define FLASH_CR_OP_MODE FLASH_CR_OP_MODE_MASK /**< Flash operate mode selection */
  987. #define FLASH_CR_OP_MODE_IDLE (0x0UL << FLASH_CR_OP_MODE_POS) /**< 0x00000000 */
  988. #define FLASH_CR_OP_MODE_PROGRAM (0x1UL << FLASH_CR_OP_MODE_POS) /**< 0x00000002 */
  989. #define FLASH_CR_OP_MODE_PAGE_ERASE (0x2UL << FLASH_CR_OP_MODE_POS) /**< 0x00000004 */
  990. #define FLASH_CR_OP_MODE_MASS_ERASE (0x3UL << FLASH_CR_OP_MODE_POS) /**< 0x00000006 */
  991. #define FLASH_CR_EOPIE_POS (24U)
  992. #define FLASH_CR_EOPIE_MASK (0x1UL << FLASH_CR_EOPIE_POS) /**< 0x01000000 */
  993. #define FLASH_CR_EOPIE FLASH_CR_EOPIE_MASK /**< Flash operation complete interrupt_control */
  994. #define FLASH_CR_OPERRIE_POS (25U)
  995. #define FLASH_CR_OPERRIE_MASK (0x1UL << FLASH_CR_OPERRIE_POS) /**< 0x02000000 */
  996. #define FLASH_CR_OPERRIE FLASH_CR_OPERRIE_MASK /**< Flash option error interrupt_control */
  997. #define FLASH_CR_OPTLOCK_POS (30U)
  998. #define FLASH_CR_OPTLOCK_MASK (0x1UL << FLASH_CR_OPTLOCK_POS) /**< 0x40000000 */
  999. #define FLASH_CR_OPTLOCK FLASH_CR_OPTLOCK_MASK /**< Flash option bytes lock status */
  1000. #define FLASH_CR_LOCK_POS (31U)
  1001. #define FLASH_CR_LOCK_MASK (0x1UL << FLASH_CR_LOCK_POS) /**< 0x80000000 */
  1002. #define FLASH_CR_LOCK FLASH_CR_LOCK_MASK /**< Flash CR register lock status */
  1003. /* Bits for FLASH_OPTR1 */
  1004. #define FLASH_OPTR1_RDPRP_POS (0U)
  1005. #define FLASH_OPTR1_RDPRP_MASK (0x1UL << FLASH_OPTR1_RDPRP_POS) /**< 0x00000001 */
  1006. #define FLASH_OPTR1_RDPRP FLASH_OPTR1_RDPRP_MASK /**< Flash RDP protect level */
  1007. #define FLASH_OPTR1_BOR_EN_POS (8U)
  1008. #define FLASH_OPTR1_BOR_EN_MASK (0x1UL << FLASH_OPTR1_BOR_EN_POS) /**< 0x00000100 */
  1009. #define FLASH_OPTR1_BOR_EN FLASH_OPTR1_BOR_EN_MASK /**< Flash BOR enable control */
  1010. #define FLASH_OPTR1_BOR_LEVEL_POS (9U)
  1011. #define FLASH_OPTR1_BOR_LEVEL_MASK (0x3UL << FLASH_OPTR1_BOR_LEVEL_POS) /**< 0x00000600 */
  1012. #define FLASH_OPTR1_BOR_LEVEL FLASH_OPTR1_BOR_LEVEL_MASK /**< Flash BOR level selection */
  1013. #define FLASH_OPTR1_BOR_LEVEL_0 (0x0UL << FLASH_OPTR1_BOR_LEVEL_POS) /**< 0x00000000 */
  1014. #define FLASH_OPTR1_BOR_LEVEL_1 (0x1UL << FLASH_OPTR1_BOR_LEVEL_POS) /**< 0x00000200 */
  1015. #define FLASH_OPTR1_BOR_LEVEL_2 (0x2UL << FLASH_OPTR1_BOR_LEVEL_POS) /**< 0x00000400 */
  1016. #define FLASH_OPTR1_BOR_LEVEL_3 (0x3UL << FLASH_OPTR1_BOR_LEVEL_POS) /**< 0x00000600 */
  1017. #define FLASH_OPTR1_NRST_SWD_MODE_POS (13U)
  1018. #define FLASH_OPTR1_NRST_SWD_MODE_MASK (0x3UL << FLASH_OPTR1_NRST_SWD_MODE_POS) /**< 0x00006000 */
  1019. #define FLASH_OPTR1_NRST_SWD_MODE FLASH_OPTR1_NRST_SWD_MODE_MASK /**< NRST/SWD pin selection */
  1020. #define FLASH_OPTR1_NRST_SWD_MODE_0 (0x0UL << FLASH_OPTR1_NRST_SWD_MODE_POS) /**< 0x00000000 */
  1021. #define FLASH_OPTR1_NRST_SWD_MODE_1 (0x1UL << FLASH_OPTR1_NRST_SWD_MODE_POS) /**< 0x00002000 */
  1022. #define FLASH_OPTR1_NRST_SWD_MODE_2 (0x2UL << FLASH_OPTR1_NRST_SWD_MODE_POS) /**< 0x00004000 */
  1023. #define FLASH_OPTR1_NRST_SWD_MODE_3 (0x3UL << FLASH_OPTR1_NRST_SWD_MODE_POS) /**< 0x00006000 */
  1024. /* Bits for FLASH_OPTR2 */
  1025. #define FLASH_OPTR2_RST_STOP_POS (0U)
  1026. #define FLASH_OPTR2_RST_STOP_MASK (0x1UL << FLASH_OPTR2_RST_STOP_POS) /**< 0x00000001 */
  1027. #define FLASH_OPTR2_RST_STOP FLASH_OPTR2_RST_STOP_MASK /**< Enter stop or deepstop generate reset control */
  1028. #define FLASH_OPTR2_IWDG_STOP_POS (5U)
  1029. #define FLASH_OPTR2_IWDG_STOP_MASK (0x1UL << FLASH_OPTR2_IWDG_STOP_POS) /**< 0x00000020 */
  1030. #define FLASH_OPTR2_IWDG_STOP FLASH_OPTR2_IWDG_STOP_MASK /**< Stop or deepstop IWDG counter stop control */
  1031. /* Bits for FLASH_WRP */
  1032. #define FLASH_WRP_WRP_POS (0U)
  1033. #define FLASH_WRP_WRP_MASK (0x3FUL << FLASH_WRP_WRP_POS) /**< 0x0000003F */
  1034. #define FLASH_WRP_WRP FLASH_WRP_WRP_MASK /**< Flash WRP protect area */
  1035. /*-----------------------------------------------------------------------------------------------
  1036. GPIO Registers Bits
  1037. ------------------------------------------------------------------------------------------------*/
  1038. /* Bits for GPIO_MODER */
  1039. #define GPIO_MODE_MODE0_POS (0U)
  1040. #define GPIO_MODE_MODE0_MASK (0x3UL << GPIO_MODE_MODE0_POS) /**< 0x00000003 */
  1041. #define GPIO_MODE_MODE0 GPIO_MODE_MODE0_MASK
  1042. #define GPIO_MODE_MODE1_POS (2U)
  1043. #define GPIO_MODE_MODE1_MASK (0x3UL << GPIO_MODE_MODE1_POS) /**< 0x0000000C */
  1044. #define GPIO_MODE_MODE1 GPIO_MODE_MODE1_MASK
  1045. #define GPIO_MODE_MODE2_POS (4U)
  1046. #define GPIO_MODE_MODE2_MASK (0x3UL << GPIO_MODE_MODE2_POS) /**< 0x00000030 */
  1047. #define GPIO_MODE_MODE2 GPIO_MODE_MODE2_MASK
  1048. #define GPIO_MODE_MODE3_POS (6U)
  1049. #define GPIO_MODE_MODE3_MASK (0x3UL << GPIO_MODE_MODE3_POS) /**< 0x000000C0 */
  1050. #define GPIO_MODE_MODE3 GPIO_MODE_MODE3_MASK
  1051. #define GPIO_MODE_MODE4_POS (8U)
  1052. #define GPIO_MODE_MODE4_MASK (0x3UL << GPIO_MODE_MODE4_POS) /**< 0x00000300 */
  1053. #define GPIO_MODE_MODE4 GPIO_MODE_MODE4_MASK
  1054. #define GPIO_MODE_MODE5_POS (10U)
  1055. #define GPIO_MODE_MODE5_MASK (0x3UL << GPIO_MODE_MODE5_POS) /**< 0x00000C00 */
  1056. #define GPIO_MODE_MODE5 GPIO_MODE_MODE5_MASK
  1057. #define GPIO_MODE_MODE6_POS (12U)
  1058. #define GPIO_MODE_MODE6_MASK (0x3UL << GPIO_MODE_MODE6_POS) /**< 0x00003000 */
  1059. #define GPIO_MODE_MODE6 GPIO_MODE_MODE6_MASK
  1060. #define GPIO_MODE_MODE7_POS (14U)
  1061. #define GPIO_MODE_MODE7_MASK (0x3UL << GPIO_MODE_MODE7_POS) /**< 0x0000C000 */
  1062. #define GPIO_MODE_MODE7 GPIO_MODE_MODE7_MASK
  1063. /* Bits for GPIO_OTYPER */
  1064. #define GPIO_OTYPE_OT0_POS (0U)
  1065. #define GPIO_OTYPE_OT0_MASK (0x1UL << GPIO_OTYPE_OT0_POS) /**< 0x00000001 */
  1066. #define GPIO_OTYPE_OT0 GPIO_OTYPE_OT0_MASK
  1067. #define GPIO_OTYPE_OT1_POS (1U)
  1068. #define GPIO_OTYPE_OT1_MASK (0x1UL << GPIO_OTYPE_OT1_POS) /**< 0x00000002 */
  1069. #define GPIO_OTYPE_OT1 GPIO_OTYPE_OT1_MASK
  1070. #define GPIO_OTYPE_OT2_POS (2U)
  1071. #define GPIO_OTYPE_OT2_MASK (0x1UL << GPIO_OTYPE_OT2_POS) /**< 0x00000004 */
  1072. #define GPIO_OTYPE_OT2 GPIO_OTYPE_OT2_MASK
  1073. #define GPIO_OTYPE_OT3_POS (3U)
  1074. #define GPIO_OTYPE_OT3_MASK (0x1UL << GPIO_OTYPE_OT3_POS) /**< 0x00000008 */
  1075. #define GPIO_OTYPE_OT3 GPIO_OTYPE_OT3_MASK
  1076. #define GPIO_OTYPE_OT4_POS (4U)
  1077. #define GPIO_OTYPE_OT4_MASK (0x1UL << GPIO_OTYPE_OT4_POS) /**< 0x00000010 */
  1078. #define GPIO_OTYPE_OT4 GPIO_OTYPE_OT4_MASK
  1079. #define GPIO_OTYPE_OT5_POS (5U)
  1080. #define GPIO_OTYPE_OT5_MASK (0x1UL << GPIO_OTYPE_OT5_POS) /**< 0x00000020 */
  1081. #define GPIO_OTYPE_OT5 GPIO_OTYPE_OT5_MASK
  1082. #define GPIO_OTYPE_OT6_POS (6U)
  1083. #define GPIO_OTYPE_OT6_MASK (0x1UL << GPIO_OTYPE_OT6_POS) /**< 0x00000040 */
  1084. #define GPIO_OTYPE_OT6 GPIO_OTYPE_OT6_MASK
  1085. #define GPIO_OTYPE_OT7_POS (7U)
  1086. #define GPIO_OTYPE_OT7_MASK (0x1UL << GPIO_OTYPE_OT7_POS) /**< 0x00000080 */
  1087. #define GPIO_OTYPE_OT7 GPIO_OTYPE_OT7_MASK
  1088. /* Bits for GPIO_PUPDR */
  1089. #define GPIO_PUPD_PUPD0_POS (0U)
  1090. #define GPIO_PUPD_PUPD0_MASK (0x3UL << GPIO_PUPD_PUPD0_POS) /**< 0x00000003 */
  1091. #define GPIO_PUPD_PUPD0 GPIO_PUPD_PUPD0_MASK
  1092. #define GPIO_PUPD_PUPD1_POS (2U)
  1093. #define GPIO_PUPD_PUPD1_MASK (0x3UL << GPIO_PUPD_PUPD1_POS) /**< 0x0000000C */
  1094. #define GPIO_PUPD_PUPD1 GPIO_PUPD_PUPD1_MASK
  1095. #define GPIO_PUPD_PUPD2_POS (4U)
  1096. #define GPIO_PUPD_PUPD2_MASK (0x3UL << GPIO_PUPD_PUPD2_POS) /**< 0x00000030 */
  1097. #define GPIO_PUPD_PUPD2 GPIO_PUPD_PUPD2_MASK
  1098. #define GPIO_PUPD_PUPD3_POS (6U)
  1099. #define GPIO_PUPD_PUPD3_MASK (0x3UL << GPIO_PUPD_PUPD3_POS) /**< 0x000000C0 */
  1100. #define GPIO_PUPD_PUPD3 GPIO_PUPD_PUPD3_MASK
  1101. #define GPIO_PUPD_PUPD4_POS (8U)
  1102. #define GPIO_PUPD_PUPD4_MASK (0x3UL << GPIO_PUPD_PUPD4_POS) /**< 0x00000300 */
  1103. #define GPIO_PUPD_PUPD4 GPIO_PUPD_PUPD4_MASK
  1104. #define GPIO_PUPD_PUPD5_POS (10U)
  1105. #define GPIO_PUPD_PUPD5_MASK (0x3UL << GPIO_PUPD_PUPD5_POS) /**< 0x00000C00 */
  1106. #define GPIO_PUPD_PUPD5 GPIO_PUPD_PUPD5_MASK
  1107. #define GPIO_PUPD_PUPD6_POS (12U)
  1108. #define GPIO_PUPD_PUPD6_MASK (0x3UL << GPIO_PUPD_PUPD6_POS) /**< 0x00003000 */
  1109. #define GPIO_PUPD_PUPD6 GPIO_PUPD_PUPD6_MASK
  1110. #define GPIO_PUPD_PUPD7_POS (14U)
  1111. #define GPIO_PUPD_PUPD7_MASK (0x3UL << GPIO_PUPD_PUPD7_POS) /**< 0x0000C000 */
  1112. #define GPIO_PUPD_PUPD7 GPIO_PUPD_PUPD7_MASK
  1113. /* Bits for GPIO_IDR */
  1114. #define GPIO_IDR_ID0_POS (0U)
  1115. #define GPIO_IDR_ID0_MASK (0x1UL << GPIO_IDR_ID0_POS) /**< 0x00000001 */
  1116. #define GPIO_IDR_ID0 GPIO_IDR_ID0_MASK
  1117. #define GPIO_IDR_ID1_POS (1U)
  1118. #define GPIO_IDR_ID1_MASK (0x1UL << GPIO_IDR_ID1_POS) /**< 0x00000002 */
  1119. #define GPIO_IDR_ID1 GPIO_IDR_ID1_MASK
  1120. #define GPIO_IDR_ID2_POS (2U)
  1121. #define GPIO_IDR_ID2_MASK (0x1UL << GPIO_IDR_ID2_POS) /**< 0x00000004 */
  1122. #define GPIO_IDR_ID2 GPIO_IDR_ID2_MASK
  1123. #define GPIO_IDR_ID3_POS (3U)
  1124. #define GPIO_IDR_ID3_MASK (0x1UL << GPIO_IDR_ID3_POS) /**< 0x00000008 */
  1125. #define GPIO_IDR_ID3 GPIO_IDR_ID3_MASK
  1126. #define GPIO_IDR_ID4_POS (4U)
  1127. #define GPIO_IDR_ID4_MASK (0x1UL << GPIO_IDR_ID4_POS) /**< 0x00000010 */
  1128. #define GPIO_IDR_ID4 GPIO_IDR_ID4_MASK
  1129. #define GPIO_IDR_ID5_POS (5U)
  1130. #define GPIO_IDR_ID5_MASK (0x1UL << GPIO_IDR_ID5_POS) /**< 0x00000020 */
  1131. #define GPIO_IDR_ID5 GPIO_IDR_ID5_MASK
  1132. #define GPIO_IDR_ID6_POS (6U)
  1133. #define GPIO_IDR_ID6_MASK (0x1UL << GPIO_IDR_ID6_POS) /**< 0x00000040 */
  1134. #define GPIO_IDR_ID6 GPIO_IDR_ID6_MASK
  1135. #define GPIO_IDR_ID7_POS (7U)
  1136. #define GPIO_IDR_ID7_MASK (0x1UL << GPIO_IDR_ID7_POS) /**< 0x00000080 */
  1137. #define GPIO_IDR_ID7 GPIO_IDR_ID7_MASK
  1138. /* Bits for GPIO_ODR */
  1139. #define GPIO_ODR_OD0_POS (0U)
  1140. #define GPIO_ODR_OD0_MASK (0x1UL << GPIO_ODR_OD0_POS) /**< 0x00000001 */
  1141. #define GPIO_ODR_OD0 GPIO_ODR_OD0_MASK
  1142. #define GPIO_ODR_OD1_POS (1U)
  1143. #define GPIO_ODR_OD1_MASK (0x1UL << GPIO_ODR_OD1_POS) /**< 0x00000002 */
  1144. #define GPIO_ODR_OD1 GPIO_ODR_OD1_MASK
  1145. #define GPIO_ODR_OD2_POS (2U)
  1146. #define GPIO_ODR_OD2_MASK (0x1UL << GPIO_ODR_OD2_POS) /**< 0x00000004 */
  1147. #define GPIO_ODR_OD2 GPIO_ODR_OD2_MASK
  1148. #define GPIO_ODR_OD3_POS (3U)
  1149. #define GPIO_ODR_OD3_MASK (0x1UL << GPIO_ODR_OD3_POS) /**< 0x00000008 */
  1150. #define GPIO_ODR_OD3 GPIO_ODR_OD3_MASK
  1151. #define GPIO_ODR_OD4_POS (4U)
  1152. #define GPIO_ODR_OD4_MASK (0x1UL << GPIO_ODR_OD4_POS) /**< 0x00000010 */
  1153. #define GPIO_ODR_OD4 GPIO_ODR_OD4_MASK
  1154. #define GPIO_ODR_OD5_POS (5U)
  1155. #define GPIO_ODR_OD5_MASK (0x1UL << GPIO_ODR_OD5_POS) /**< 0x00000020 */
  1156. #define GPIO_ODR_OD5 GPIO_ODR_OD5_MASK
  1157. #define GPIO_ODR_OD6_POS (6U)
  1158. #define GPIO_ODR_OD6_MASK (0x1UL << GPIO_ODR_OD6_POS) /**< 0x00000040 */
  1159. #define GPIO_ODR_OD6 GPIO_ODR_OD6_MASK
  1160. #define GPIO_ODR_OD7_POS (7U)
  1161. #define GPIO_ODR_OD7_MASK (0x1UL << GPIO_ODR_OD7_POS) /**< 0x00000080 */
  1162. #define GPIO_ODR_OD7 GPIO_ODR_OD7_MASK
  1163. /* Bits for GPIO_BSR */
  1164. #define GPIO_BSR_BS0_POS (0U)
  1165. #define GPIO_BSR_BS0_MASK (0x1UL << GPIO_BSR_BS0_POS) /**< 0x00000001 */
  1166. #define GPIO_BSR_BS0 GPIO_BSR_BS0_MASK
  1167. #define GPIO_BSR_BS1_POS (1U)
  1168. #define GPIO_BSR_BS1_MASK (0x1UL << GPIO_BSR_BS1_POS) /**< 0x00000002 */
  1169. #define GPIO_BSR_BS1 GPIO_BSR_BS1_MASK
  1170. #define GPIO_BSR_BS2_POS (2U)
  1171. #define GPIO_BSR_BS2_MASK (0x1UL << GPIO_BSR_BS2_POS) /**< 0x00000004 */
  1172. #define GPIO_BSR_BS2 GPIO_BSR_BS2_MASK
  1173. #define GPIO_BSR_BS3_POS (3U)
  1174. #define GPIO_BSR_BS3_MASK (0x1UL << GPIO_BSR_BS3_POS) /**< 0x00000008 */
  1175. #define GPIO_BSR_BS3 GPIO_BSR_BS3_MASK
  1176. #define GPIO_BSR_BS4_POS (4U)
  1177. #define GPIO_BSR_BS4_MASK (0x1UL << GPIO_BSR_BS4_POS) /**< 0x00000010 */
  1178. #define GPIO_BSR_BS4 GPIO_BSR_BS4_MASK
  1179. #define GPIO_BSR_BS5_POS (5U)
  1180. #define GPIO_BSR_BS5_MASK (0x1UL << GPIO_BSR_BS5_POS) /**< 0x00000020 */
  1181. #define GPIO_BSR_BS5 GPIO_BSR_BS5_MASK
  1182. #define GPIO_BSR_BS6_POS (6U)
  1183. #define GPIO_BSR_BS6_MASK (0x1UL << GPIO_BSR_BS6_POS) /**< 0x00000040 */
  1184. #define GPIO_BSR_BS6 GPIO_BSR_BS6_MASK
  1185. #define GPIO_BSR_BS7_POS (7U)
  1186. #define GPIO_BSR_BS7_MASK (0x1UL << GPIO_BSR_BS7_POS) /**< 0x00000080 */
  1187. #define GPIO_BSR_BS7 GPIO_BSR_BS7_MASK
  1188. #define GPIO_BSR_BR0_POS (16U)
  1189. #define GPIO_BSR_BR0_MASK (0x1UL << GPIO_BSR_BR0_POS) /**< 0x00010000 */
  1190. #define GPIO_BSR_BR0 GPIO_BSR_BR0_MASK
  1191. #define GPIO_BSR_BR1_POS (17U)
  1192. #define GPIO_BSR_BR1_MASK (0x1UL << GPIO_BSR_BR1_POS) /**< 0x00020000 */
  1193. #define GPIO_BSR_BR1 GPIO_BSR_BR1_MASK
  1194. #define GPIO_BSR_BR2_POS (18U)
  1195. #define GPIO_BSR_BR2_MASK (0x1UL << GPIO_BSR_BR2_POS) /**< 0x00040000 */
  1196. #define GPIO_BSR_BR2 GPIO_BSR_BR2_MASK
  1197. #define GPIO_BSR_BR3_POS (19U)
  1198. #define GPIO_BSR_BR3_MASK (0x1UL << GPIO_BSR_BR3_POS) /**< 0x00080000 */
  1199. #define GPIO_BSR_BR3 GPIO_BSR_BR3_MASK
  1200. #define GPIO_BSR_BR4_POS (20U)
  1201. #define GPIO_BSR_BR4_MASK (0x1UL << GPIO_BSR_BR4_POS) /**< 0x00100000 */
  1202. #define GPIO_BSR_BR4 GPIO_BSR_BR4_MASK
  1203. #define GPIO_BSR_BR5_POS (21U)
  1204. #define GPIO_BSR_BR5_MASK (0x1UL << GPIO_BSR_BR5_POS) /**< 0x00200000 */
  1205. #define GPIO_BSR_BR5 GPIO_BSR_BR5_MASK
  1206. #define GPIO_BSR_BR6_POS (22U)
  1207. #define GPIO_BSR_BR6_MASK (0x1UL << GPIO_BSR_BR6_POS) /**< 0x00400000 */
  1208. #define GPIO_BSR_BR6 GPIO_BSR_BR6_MASK
  1209. #define GPIO_BSR_BR7_POS (23U)
  1210. #define GPIO_BSR_BR7_MASK (0x1UL << GPIO_BSR_BR7_POS) /**< 0x00800000 */
  1211. #define GPIO_BSR_BR7 GPIO_BSR_BR7_MASK
  1212. /* Bits for GPIO_AFL */
  1213. #define GPIO_AFL_AFSEL0_POS (0U)
  1214. #define GPIO_AFL_AFSEL0_MASK (0x7UL << GPIO_AFL_AFSEL0_POS) /**< 0x00000007 */
  1215. #define GPIO_AFL_AFSEL0 GPIO_AFL_AFSEL0_MASK
  1216. #define GPIO_AFL_AFSEL1_POS (4U)
  1217. #define GPIO_AFL_AFSEL1_MASK (0x7UL << GPIO_AFL_AFSEL1_POS) /**< 0x00000070 */
  1218. #define GPIO_AFL_AFSEL1 GPIO_AFL_AFSEL1_MASK
  1219. #define GPIO_AFL_AFSEL2_POS (8U)
  1220. #define GPIO_AFL_AFSEL2_MASK (0x7UL << GPIO_AFL_AFSEL2_POS) /**< 0x00000700 */
  1221. #define GPIO_AFL_AFSEL2 GPIO_AFL_AFSEL2_MASK
  1222. #define GPIO_AFL_AFSEL3_POS (12U)
  1223. #define GPIO_AFL_AFSEL3_MASK (0x7UL << GPIO_AFL_AFSEL3_POS) /**< 0x00007000 */
  1224. #define GPIO_AFL_AFSEL3 GPIO_AFL_AFSEL3_MASK
  1225. #define GPIO_AFL_AFSEL4_POS (16U)
  1226. #define GPIO_AFL_AFSEL4_MASK (0x7UL << GPIO_AFL_AFSEL4_POS) /**< 0x00070000 */
  1227. #define GPIO_AFL_AFSEL4 GPIO_AFL_AFSEL4_MASK
  1228. #define GPIO_AFL_AFSEL5_POS (20U)
  1229. #define GPIO_AFL_AFSEL5_MASK (0x7UL << GPIO_AFL_AFSEL5_POS) /**< 0x00700000 */
  1230. #define GPIO_AFL_AFSEL5 GPIO_AFL_AFSEL5_MASK
  1231. #define GPIO_AFL_AFSEL6_POS (24U)
  1232. #define GPIO_AFL_AFSEL6_MASK (0x7UL << GPIO_AFL_AFSEL6_POS) /**< 0x07000000 */
  1233. #define GPIO_AFL_AFSEL6 GPIO_AFL_AFSEL6_MASK
  1234. #define GPIO_AFL_AFSEL7_POS (28U)
  1235. #define GPIO_AFL_AFSEL7_MASK (0x7UL << GPIO_AFL_AFSEL7_POS) /**< 0x70000000 */
  1236. #define GPIO_AFL_AFSEL7 GPIO_AFL_AFSEL7_MASK
  1237. /* Bits for GPIO_BR */
  1238. #define GPIO_BR_BR0_POS (0U)
  1239. #define GPIO_BR_BR0_MASK (0x1UL << GPIO_BR_BR0_POS) /**< 0x00000001 */
  1240. #define GPIO_BR_BR0 GPIO_BR_BR0_MASK
  1241. #define GPIO_BR_BR1_POS (1U)
  1242. #define GPIO_BR_BR1_MASK (0x1UL << GPIO_BR_BR1_POS) /**< 0x00000002 */
  1243. #define GPIO_BR_BR1 GPIO_BR_BR1_MASK
  1244. #define GPIO_BR_BR2_POS (2U)
  1245. #define GPIO_BR_BR2_MASK (0x1UL << GPIO_BR_BR2_POS) /**< 0x00000004 */
  1246. #define GPIO_BR_BR2 GPIO_BR_BR2_MASK
  1247. #define GPIO_BR_BR3_POS (3U)
  1248. #define GPIO_BR_BR3_MASK (0x1UL << GPIO_BR_BR3_POS) /**< 0x00000008 */
  1249. #define GPIO_BR_BR3 GPIO_BR_BR3_MASK
  1250. #define GPIO_BR_BR4_POS (4U)
  1251. #define GPIO_BR_BR4_MASK (0x1UL << GPIO_BR_BR4_POS) /**< 0x00000010 */
  1252. #define GPIO_BR_BR4 GPIO_BR_BR4_MASK
  1253. #define GPIO_BR_BR5_POS (5U)
  1254. #define GPIO_BR_BR5_MASK (0x1UL << GPIO_BR_BR5_POS) /**< 0x00000020 */
  1255. #define GPIO_BR_BR5 GPIO_BR_BR5_MASK
  1256. #define GPIO_BR_BR6_POS (6U)
  1257. #define GPIO_BR_BR6_MASK (0x1UL << GPIO_BR_BR6_POS) /**< 0x00000040 */
  1258. #define GPIO_BR_BR6 GPIO_BR_BR6_MASK
  1259. #define GPIO_BR_BR7_POS (7U)
  1260. #define GPIO_BR_BR7_MASK (0x1UL << GPIO_BR_BR7_POS) /**< 0x00000080 */
  1261. #define GPIO_BR_BR7 GPIO_BR_BR7_MASK
  1262. /*-----------------------------------------------------------------------------------------------
  1263. I2C Registers Bits
  1264. ------------------------------------------------------------------------------------------------*/
  1265. /* Bits for I2C_CR1 */
  1266. #define I2C_CR1_PE_POS (0U)
  1267. #define I2C_CR1_PE_MASK (0x1UL << I2C_CR1_PE_POS) /**< 0x00000001 */
  1268. #define I2C_CR1_PE I2C_CR1_PE_MASK /**< Peripheral enable */
  1269. #define I2C_CR1_BUFIE_POS (1U)
  1270. #define I2C_CR1_BUFIE_MASK (0x1UL << I2C_CR1_BUFIE_POS) /**< 0x00000002 */
  1271. #define I2C_CR1_BUFIE I2C_CR1_BUFIE_MASK /**< Buffer interrupt enable */
  1272. #define I2C_CR1_EVTIE_POS (3U)
  1273. #define I2C_CR1_EVTIE_MASK (0x1UL << I2C_CR1_EVTIE_POS) /**< 0x00000008 */
  1274. #define I2C_CR1_EVTIE I2C_CR1_EVTIE_MASK /**< Event interrupt enable */
  1275. #define I2C_CR1_ERRIE_POS (7U)
  1276. #define I2C_CR1_ERRIE_MASK (0x1UL << I2C_CR1_ERRIE_POS) /**< 0x00000080 */
  1277. #define I2C_CR1_ERRIE I2C_CR1_ERRIE_MASK /**< Errors interrupt enable */
  1278. #define I2C_CR1_DNF_POS (8U)
  1279. #define I2C_CR1_DNF_MASK (0xFUL << I2C_CR1_DNF_POS) /**< 0x00000F00 */
  1280. #define I2C_CR1_DNF I2C_CR1_DNF_MASK /**< Digital noise filter */
  1281. #define I2C_CR1_DNF_DISABLE (0x0UL << I2C_CR1_DNF_POS) /**< 0x00000000 */
  1282. #define I2C_CR1_DNF_1CLK (0x1UL << I2C_CR1_DNF_POS) /**< 0x00000100 */
  1283. #define I2C_CR1_DNF_2CLK (0x2UL << I2C_CR1_DNF_POS) /**< 0x00000200 */
  1284. #define I2C_CR1_DNF_3CLK (0x3UL << I2C_CR1_DNF_POS) /**< 0x00000300 */
  1285. #define I2C_CR1_DNF_4CLK (0x4UL << I2C_CR1_DNF_POS) /**< 0x00000400 */
  1286. #define I2C_CR1_DNF_5CLK (0x5UL << I2C_CR1_DNF_POS) /**< 0x00000500 */
  1287. #define I2C_CR1_DNF_6CLK (0x6UL << I2C_CR1_DNF_POS) /**< 0x00000600 */
  1288. #define I2C_CR1_DNF_7CLK (0x7UL << I2C_CR1_DNF_POS) /**< 0x00000700 */
  1289. #define I2C_CR1_DNF_8CLK (0x8UL << I2C_CR1_DNF_POS) /**< 0x00000800 */
  1290. #define I2C_CR1_DNF_9CLK (0x9UL << I2C_CR1_DNF_POS) /**< 0x00000900 */
  1291. #define I2C_CR1_DNF_10CLK (0xAUL << I2C_CR1_DNF_POS) /**< 0x00000A00 */
  1292. #define I2C_CR1_DNF_11CLK (0xBUL << I2C_CR1_DNF_POS) /**< 0x00000B00 */
  1293. #define I2C_CR1_DNF_12CLK (0xCUL << I2C_CR1_DNF_POS) /**< 0x00000C00 */
  1294. #define I2C_CR1_DNF_13CLK (0xDUL << I2C_CR1_DNF_POS) /**< 0x00000D00 */
  1295. #define I2C_CR1_DNF_14CLK (0xEUL << I2C_CR1_DNF_POS) /**< 0x00000E00 */
  1296. #define I2C_CR1_DNF_15CLK (0xFUL << I2C_CR1_DNF_POS) /**< 0x00000F00 */
  1297. #define I2C_CR1_NOSTRETCH_POS (17U)
  1298. #define I2C_CR1_NOSTRETCH_MASK (0x1UL << I2C_CR1_NOSTRETCH_POS) /**< 0x00020000 */
  1299. #define I2C_CR1_NOSTRETCH I2C_CR1_NOSTRETCH_MASK /**< Clock stretching disable */
  1300. #define I2C_CR1_GCEN_POS (19U)
  1301. #define I2C_CR1_GCEN_MASK (0x1UL << I2C_CR1_GCEN_POS) /**< 0x00080000 */
  1302. #define I2C_CR1_GCEN I2C_CR1_GCEN_MASK /**< General call enable */
  1303. /* Bits for I2C_CR2 */
  1304. #define I2C_CR2_NACK_POS (15U)
  1305. #define I2C_CR2_NACK_MASK (0x1UL << I2C_CR2_NACK_POS) /**< 0x00008000 */
  1306. #define I2C_CR2_NACK I2C_CR2_NACK_MASK /**< NACK generation */
  1307. /* Bits for I2C_ADDR1 */
  1308. #define I2C_ADDR1_ADDR1_POS (1U)
  1309. #define I2C_ADDR1_ADDR1_MASK (0x7FUL << I2C_ADDR1_ADDR1_POS) /**< 0x00000FE */
  1310. #define I2C_ADDR1_ADDR1 I2C_ADDR1_ADDR1_MASK /**< Interface address 1 */
  1311. /* Bits for I2C_ISR */
  1312. #define I2C_ISR_TXE_POS (0U)
  1313. #define I2C_ISR_TXE_MASK (0x1UL << I2C_ISR_TXE_POS) /**< 0x00000001 */
  1314. #define I2C_ISR_TXE I2C_ISR_TXE_MASK /**< Transmit data register empty */
  1315. #define I2C_ISR_TXIS_POS (1U)
  1316. #define I2C_ISR_TXIS_MASK (0x1UL << I2C_ISR_TXIS_POS) /**< 0x00000002 */
  1317. #define I2C_ISR_TXIS I2C_ISR_TXIS_MASK /**< Transmit interrupt status */
  1318. #define I2C_ISR_RXNE_POS (2U)
  1319. #define I2C_ISR_RXNE_MASK (0x1UL << I2C_ISR_RXNE_POS) /**< 0x00000004 */
  1320. #define I2C_ISR_RXNE I2C_ISR_RXNE_MASK /**< Receive data register not empty */
  1321. #define I2C_ISR_ADDR_POS (3U)
  1322. #define I2C_ISR_ADDR_MASK (0x1UL << I2C_ISR_ADDR_POS) /**< 0x00000008 */
  1323. #define I2C_ISR_ADDR I2C_ISR_ADDR_MASK /**< Address matched (slave mode)*/
  1324. #define I2C_ISR_NACKF_POS (4U)
  1325. #define I2C_ISR_NACKF_MASK (0x1UL << I2C_ISR_NACKF_POS) /**< 0x00000010 */
  1326. #define I2C_ISR_NACKF I2C_ISR_NACKF_MASK /**< NACK received flag */
  1327. #define I2C_ISR_STOPF_POS (5U)
  1328. #define I2C_ISR_STOPF_MASK (0x1UL << I2C_ISR_STOPF_POS) /**< 0x00000020 */
  1329. #define I2C_ISR_STOPF I2C_ISR_STOPF_MASK /**< STOP detection flag */
  1330. #define I2C_ISR_BERR_POS (8U)
  1331. #define I2C_ISR_BERR_MASK (0x1UL << I2C_ISR_BERR_POS) /**< 0x00000100 */
  1332. #define I2C_ISR_BERR I2C_ISR_BERR_MASK /**< Bus error */
  1333. #define I2C_ISR_OVR_POS (10U)
  1334. #define I2C_ISR_OVR_MASK (0x1UL << I2C_ISR_OVR_POS) /**< 0x00000400 */
  1335. #define I2C_ISR_OVR I2C_ISR_OVR_MASK /**< Overrun/Underrun */
  1336. #define I2C_ISR_BUSY_POS (15U)
  1337. #define I2C_ISR_BUSY_MASK (0x1UL << I2C_ISR_BUSY_POS) /**< 0x00008000 */
  1338. #define I2C_ISR_BUSY I2C_ISR_BUSY_MASK /**< Bus busy */
  1339. #define I2C_ISR_DIR_POS (16U)
  1340. #define I2C_ISR_DIR_MASK (0x1UL << I2C_ISR_DIR_POS) /**< 0x00010000 */
  1341. #define I2C_ISR_DIR I2C_ISR_DIR_MASK
  1342. /* Bits for I2C_ICR */
  1343. #define I2C_ICR_ADDRCF_POS (3U)
  1344. #define I2C_ICR_ADDRCF_MASK (0x1UL << I2C_ICR_ADDRCF_POS) /**< 0x00000008 */
  1345. #define I2C_ICR_ADDRCF I2C_ICR_ADDRCF_MASK /**< Address matched clear flag */
  1346. #define I2C_ICR_NACKCF_POS (4U)
  1347. #define I2C_ICR_NACKCF_MASK (0x1UL << I2C_ICR_NACKCF_POS) /**< 0x00000010 */
  1348. #define I2C_ICR_NACKCF I2C_ICR_NACKCF_MASK /**< NACK clear flag */
  1349. #define I2C_ICR_STOPCF_POS (5U)
  1350. #define I2C_ICR_STOPCF_MASK (0x1UL << I2C_ICR_STOPCF_POS) /**< 0x00000020 */
  1351. #define I2C_ICR_STOPCF I2C_ICR_STOPCF_MASK /**< STOP detection clear flag */
  1352. #define I2C_ICR_BERRCF_POS (8U)
  1353. #define I2C_ICR_BERRCF_MASK (0x1UL << I2C_ICR_BERRCF_POS) /**< 0x00000100 */
  1354. #define I2C_ICR_BERRCF I2C_ICR_BERRCF_MASK /**< Bus error clear flag */
  1355. #define I2C_ICR_OVRCF_POS (10U)
  1356. #define I2C_ICR_OVRCF_MASK (0x1UL << I2C_ICR_OVRCF_POS) /**< 0x00000400 */
  1357. #define I2C_ICR_OVRCF I2C_ICR_OVRCF_MASK /**< Overrun/Underrun clear flag */
  1358. /* Bits for I2C_RDR */
  1359. #define I2C_RDR_RXDATA_POS (0U)
  1360. #define I2C_RDR_RXDATA_MASK (0xFFUL << I2C_RDR_RXDATA_POS) /**< 0x000000FF */
  1361. #define I2C_RDR_RXDATA I2C_RDR_RXDATA_MASK /**< 8-bit receive data */
  1362. /* Bits for I2C_TDR */
  1363. #define I2C_TDR_TXDATA_POS (0U)
  1364. #define I2C_TDR_TXDATA_MASK (0xFFUL << I2C_TDR_TXDATA_POS) /**< 0x000000FF */
  1365. #define I2C_TDR_TXDATA I2C_TDR_TXDATA_MASK /**< 8-bit transmit data */
  1366. /*-----------------------------------------------------------------------------------------------
  1367. IRTIM Registers Bits
  1368. ------------------------------------------------------------------------------------------------*/
  1369. /* Bits for IRTIM_CR*/
  1370. #define IRTIM_CR_IR_POL_POS (2U)
  1371. #define IRTIM_CR_IR_POL_MASK (0x01UL << IRTIM_CR_IR_POL_POS) /**< 0x00000004 */
  1372. #define IRTIM_CR_IR_POL IRTIM_CR_IR_POL_MASK /**< ITRIM config output pol */
  1373. #define IRTIM_CR_IR_MODE_POS (3U)
  1374. #define IRTIM_CR_IR_MODE_MASK (0x03UL << IRTIM_CR_IR_MODE_POS) /**< 0x00000018 */
  1375. #define IRTIM_CR_IR_MODE IRTIM_CR_IR_MODE_MASK /**< IRTIM select the modulation signal */
  1376. #define IRTIM_CR_IR_MODE_TIM3_OC1 (0x0UL << IRTIM_CR_IR_MODE_POS) /**< 0x00000000 */
  1377. #define IRTIM_CR_IR_MODE_UART1_TX (0x1UL << IRTIM_CR_IR_MODE_POS) /**< 0x00000008 */
  1378. #define IRTIM_CR_IR_MODE_UART2_TX (0x2UL << IRTIM_CR_IR_MODE_POS) /**< 0x00000010 */
  1379. /*-----------------------------------------------------------------------------------------------
  1380. IWDG Registers Bits
  1381. ------------------------------------------------------------------------------------------------*/
  1382. /* Bits for IWDG_CR */
  1383. #define IWDG_CR_KEY_POS (0U)
  1384. #define IWDG_CR_KEY_MASK (0xFFFFUL << IWDG_CR_KEY_POS) /**< 0x0000FFFF */
  1385. #define IWDG_CR_KEY IWDG_CR_KEY_MASK /**< KEY[15:0] bits(16-bit key value) */
  1386. /* Bits for IWDG_CFG */
  1387. #define IWDG_CFG_OVP_POS (0U)
  1388. #define IWDG_CFG_OVP_MASK (0x7UL << IWDG_CFG_OVP_POS) /**< 0x00000007 */
  1389. #define IWDG_CFG_OVP IWDG_CFG_OVP_MASK /**< OVP[2:0] bits (3-bit overflowperiod value) */
  1390. #define IWDG_CFG_OVP_128 (0x0UL << IWDG_CFG_OVP_POS) /**< 0x00000000 */
  1391. #define IWDG_CFG_OVP_256 (0x1UL << IWDG_CFG_OVP_POS) /**< 0x00000001 */
  1392. #define IWDG_CFG_OVP_512 (0x2UL << IWDG_CFG_OVP_POS) /**< 0x00000002 */
  1393. #define IWDG_CFG_OVP_1024 (0x3UL << IWDG_CFG_OVP_POS) /**< 0x00000003 */
  1394. #define IWDG_CFG_OVP_2048 (0x4UL << IWDG_CFG_OVP_POS) /**< 0x00000004 */
  1395. #define IWDG_CFG_OVP_4096 (0x5UL << IWDG_CFG_OVP_POS) /**< 0x00000005 */
  1396. #define IWDG_CFG_OVP_8192 (0x6UL << IWDG_CFG_OVP_POS) /**< 0x00000006 */
  1397. #define IWDG_CFG_OVP_16384 (0x7UL << IWDG_CFG_OVP_POS) /**< 0x00000007 */
  1398. /* Bits for IWDG_CNT */
  1399. #define IWDG_CNT_CNT_POS (0U)
  1400. #define IWDG_CNT_CNT_MASK (0xFFFUL << IWDG_CNT_CNT_POS) /**< 0x00000FFF */
  1401. #define IWDG_CNT_CNT IWDG_CNT_CNT_MASK /**< CNT[11:0] bits (12-bit counter value) */
  1402. /*-----------------------------------------------------------------------------------------------
  1403. LPTimer Registers Bits
  1404. ------------------------------------------------------------------------------------------------*/
  1405. /* Bits for LPTIM_ISR */
  1406. #define LPTIM_ISR_ARRM_POS (1U)
  1407. #define LPTIM_ISR_ARRM_MASK (0x1UL << LPTIM_ISR_ARRM_POS) /**< 0x00000002 */
  1408. #define LPTIM_ISR_ARRM LPTIM_ISR_ARRM_MASK /**< Autoreload match */
  1409. #define LPTIM_ISR_ITRF_POS (15U)
  1410. #define LPTIM_ISR_ITRF_MASK (0x1UL << LPTIM_ISR_ITRF_POS) /**< 0x00008000 */
  1411. #define LPTIM_ISR_ITRF LPTIM_ISR_ITRF_MASK /**< ITR trigger flag */
  1412. /* Bits for LPTIM_ICR */
  1413. #define LPTIM_ICR_ARRM_CF_POS (1U)
  1414. #define LPTIM_ICR_ARRM_CF_MASK (0x1UL << LPTIM_ICR_ARRM_CF_POS) /**< 0x00000002 */
  1415. #define LPTIM_ICR_ARRM_CF LPTIM_ICR_ARRM_CF_MASK /**< Autoreload match clear flag */
  1416. #define LPTIM_ICR_ITRF_CF_POS (15U)
  1417. #define LPTIM_ICR_ITRF_CF_MASK (0x1UL << LPTIM_ICR_ITRF_CF_POS) /**< 0x00008000 */
  1418. #define LPTIM_ICR_ITRF_CF LPTIM_ICR_ITRF_CF_MASK /**< ITR trigger edge event clear flag */
  1419. /* Bits for LPTIM_IER */
  1420. #define LPTIM_IER_ARRM_IE_POS (1U)
  1421. #define LPTIM_IER_ARRM_IE_MASK (0x1UL << LPTIM_IER_ARRM_IE_POS) /**< 0x00000002 */
  1422. #define LPTIM_IER_ARRM_IE LPTIM_IER_ARRM_IE_MASK /**< Autoreload match interrupt enable */
  1423. #define LPTIM_IER_ITRF_IE_POS (15U)
  1424. #define LPTIM_IER_ITRF_IE_MASK (0x1UL << LPTIM_IER_ITRF_IE_POS) /**< 0x00008000 */
  1425. #define LPTIM_IER_ITRF_IE LPTIM_IER_ITRF_IE_MASK /**< ITR trigger edge event interrupt enable */
  1426. /* Bits for LPTIM_CFG */
  1427. #define LPTIM_CFG_PRESC_POS (9U)
  1428. #define LPTIM_CFG_PRESC_MASK (0x7UL << LPTIM_CFG_PRESC_POS) /**< 0x00000E00 */
  1429. #define LPTIM_CFG_PRESC LPTIM_CFG_PRESC_MASK /**< PRESC[2:0] bits (clock prescaler) */
  1430. #define LPTIM_CFG_PRESC_1 (0x0UL << LPTIM_CFG_PRESC_POS) /**< 0x00000000 */
  1431. #define LPTIM_CFG_PRESC_2 (0x1UL << LPTIM_CFG_PRESC_POS) /**< 0x00000200 */
  1432. #define LPTIM_CFG_PRESC_4 (0x2UL << LPTIM_CFG_PRESC_POS) /**< 0x00000400 */
  1433. #define LPTIM_CFG_PRESC_8 (0x3UL << LPTIM_CFG_PRESC_POS) /**< 0x00000600 */
  1434. #define LPTIM_CFG_PRESC_16 (0x4UL << LPTIM_CFG_PRESC_POS) /**< 0x00000800 */
  1435. #define LPTIM_CFG_PRESC_32 (0x5UL << LPTIM_CFG_PRESC_POS) /**< 0x00000A00 */
  1436. #define LPTIM_CFG_PRESC_64 (0x6UL << LPTIM_CFG_PRESC_POS) /**< 0x00000C00 */
  1437. #define LPTIM_CFG_PRESC_128 (0x7UL << LPTIM_CFG_PRESC_POS) /**< 0x00000E00 */
  1438. #define LPTIM_CFG_ITREN_POS (16U)
  1439. #define LPTIM_CFG_ITREN_MASK (0x1UL << LPTIM_CFG_ITREN_POS) /**< 0x00010000 */
  1440. #define LPTIM_CFG_ITREN LPTIM_CFG_ITREN_MASK /**< ITR trigger enable */
  1441. /* Bits for LPTIM_CR */
  1442. #define LPTIM_CR_ENABLE_POS (0U)
  1443. #define LPTIM_CR_ENABLE_MASK (0x1UL << LPTIM_CR_ENABLE_POS) /**< 0x00000001 */
  1444. #define LPTIM_CR_ENABLE LPTIM_CR_ENABLE_MASK /**< LPTIM enable */
  1445. #define LPTIM_CR_SNGSTRT_POS (1U)
  1446. #define LPTIM_CR_SNGSTRT_MASK (0x1UL << LPTIM_CR_SNGSTRT_POS) /**< 0x00000002 */
  1447. #define LPTIM_CR_SNGSTRT LPTIM_CR_SNGSTRT_MASK /**< Timer start in single mode */
  1448. #define LPTIM_CR_CNTSTRT_POS (2U)
  1449. #define LPTIM_CR_CNTSTRT_MASK (0x1UL << LPTIM_CR_CNTSTRT_POS) /**< 0x00000004 */
  1450. #define LPTIM_CR_CNTSTRT LPTIM_CR_CNTSTRT_MASK /**< Timer start in continuous mode */
  1451. /* Bits for LPTIM_ARR */
  1452. #define LPTIM_ARR_ARR_POS (0U)
  1453. #define LPTIM_ARR_ARR_MASK (0xFFFFUL << LPTIM_ARR_ARR_POS) /**< 0x0000FFF */
  1454. #define LPTIM_ARR_ARR LPTIM_ARR_ARR_MASK /**< Auto reload register */
  1455. /* Bits for LPTIM_CNT */
  1456. #define LPTIM_CNT_CNT_POS (0U)
  1457. #define LPTIM_CNT_CNT_MASK (0xFFFFUL << LPTIM_CNT_CNT_POS) /**< 0x0000FFFF */
  1458. #define LPTIM_CNT_CNT LPTIM_CNT_CNT_MASK /**< Counter register */
  1459. /*-----------------------------------------------------------------------------------------------
  1460. PMU Registers Bits
  1461. ------------------------------------------------------------------------------------------------*/
  1462. /* Bits for PMU_CR */
  1463. #define PMU_CR_LP_MODE_POS (0U)
  1464. #define PMU_CR_LP_MODE_MASK (0x1UL << PMU_CR_LP_MODE_POS) /**< 0x00000001 */
  1465. #define PMU_CR_LP_MODE PMU_CR_LP_MODE_MASK /**< low power mode */
  1466. #define PMU_CR_LP_MODE_STOP (0x0UL << PMU_CR_LP_MODE_POS) /**< 0x00000000 */
  1467. #define PMU_CR_LP_MODE_DEEPSTOP (0x1UL << PMU_CR_LP_MODE_POS) /**< 0x00000001 */
  1468. /* Bits for PMU_FLASH_WAKEUP */
  1469. #define PMU_FLASH_WAKEUP_FLASH_WAKEUP_POS (0U)
  1470. #define PMU_FLASH_WAKEUP_FLASH_WAKEUP_MASK (0x3UL << PMU_FLASH_WAKEUP_FLASH_WAKEUP_POS) /**< 0x00000003 */
  1471. #define PMU_FLASH_WAKEUP_FLASH_WAKEUP PMU_FLASH_WAKEUP_FLASH_WAKEUP_MASK /**< falsh wakeup time */
  1472. /*-----------------------------------------------------------------------------------------------
  1473. RCC Registers Bits
  1474. ------------------------------------------------------------------------------------------------*/
  1475. /* Bits for RCC_CSR1 */
  1476. #define RCC_CSR1_RCHON_POS (8U)
  1477. #define RCC_CSR1_RCHON_MASK (0x1UL << RCC_CSR1_RCHON_POS) /**< 0x00000100 */
  1478. #define RCC_CSR1_RCHON RCC_CSR1_RCHON_MASK /**< RCH enable */
  1479. #define RCC_CSR1_RCHRDY_POS (10U)
  1480. #define RCC_CSR1_RCHRDY_MASK (0x1UL << RCC_CSR1_RCHRDY_POS) /**< 0x00000400 */
  1481. #define RCC_CSR1_RCHRDY RCC_CSR1_RCHRDY_MASK /**< RCH ready flag */
  1482. #define RCC_CSR1_EXTCLKON_POS (16U)
  1483. #define RCC_CSR1_EXTCLKON_MASK (0x1UL << RCC_CSR1_EXTCLKON_POS) /**< 0x00010000 */
  1484. #define RCC_CSR1_EXTCLKON RCC_CSR1_EXTCLKON_MASK /**< EXTCLK enable */
  1485. /* Bits for RCC_CFG */
  1486. #define RCC_CFG_SYSW_POS (0U)
  1487. #define RCC_CFG_SYSW_MASK (0x7UL << RCC_CFG_SYSW_POS) /**< 0x00000007 */
  1488. #define RCC_CFG_SYSW RCC_CFG_SYSW_MASK /**< SYSW[2:0] system clock selection */
  1489. #define RCC_CFG_SYSW_RCHDIV6 (0x0UL << RCC_CFG_SYSW_POS) /**< 0x00000000 */
  1490. #define RCC_CFG_SYSW_RCHDIV3 (0x1UL << RCC_CFG_SYSW_POS) /**< 0x00000001 */
  1491. #define RCC_CFG_SYSW_RCH (0x2UL << RCC_CFG_SYSW_POS) /**< 0x00000002 */
  1492. #define RCC_CFG_SYSW_RCL (0x3UL << RCC_CFG_SYSW_POS) /**< 0x00000003 */
  1493. #define RCC_CFG_SYSW_EXTCLK (0x4UL << RCC_CFG_SYSW_POS) /**< 0x00000004 */
  1494. #define RCC_CFG_SYSWS_POS (3U)
  1495. #define RCC_CFG_SYSWS_MASK (0x7UL << RCC_CFG_SYSWS_POS) /**< 0x00000038 */
  1496. #define RCC_CFG_SYSWS RCC_CFG_SYSWS_MASK /**< SYSWS[2:0] system clock select status */
  1497. #define RCC_CFG_SYSWS_RCHDIV6 (0x0UL << RCC_CFG_SYSWS_POS) /**< 0x00000000 RCHDIV6 used as system clock */
  1498. #define RCC_CFG_SYSWS_RCHDIV3 (0x1UL << RCC_CFG_SYSWS_POS) /**< 0x00000008 RCHDIV3 used as system clock */
  1499. #define RCC_CFG_SYSWS_RCH (0x2UL << RCC_CFG_SYSWS_POS) /**< 0x00000010 RCH used as system clock */
  1500. #define RCC_CFG_SYSWS_RCL (0x3UL << RCC_CFG_SYSWS_POS) /**< 0x00000018 RCL used as system clock */
  1501. #define RCC_CFG_SYSWS_EXTCLK (0x4UL << RCC_CFG_SYSWS_POS) /**< 0x00000020 EXTCLK used as system clock */
  1502. #define RCC_CFG_HPRE_POS (8U)
  1503. #define RCC_CFG_HPRE_MASK (0x7UL << RCC_CFG_HPRE_POS) /**< 0x00000700 */
  1504. #define RCC_CFG_HPRE RCC_CFG_HPRE_MASK /**< HPRE[2:0] AHB clock division factor */
  1505. #define RCC_CFG_HPRE_1 (0x0UL << RCC_CFG_HPRE_POS) /**< 0x00000000 */
  1506. #define RCC_CFG_HPRE_2 (0x1UL << RCC_CFG_HPRE_POS) /**< 0x00000100 */
  1507. #define RCC_CFG_HPRE_4 (0x2UL << RCC_CFG_HPRE_POS) /**< 0x00000200 */
  1508. #define RCC_CFG_HPRE_8 (0x3UL << RCC_CFG_HPRE_POS) /**< 0x00000300 */
  1509. #define RCC_CFG_HPRE_16 (0x4UL << RCC_CFG_HPRE_POS) /**< 0x00000400 */
  1510. #define RCC_CFG_HPRE_32 (0x5UL << RCC_CFG_HPRE_POS) /**< 0x00000500 */
  1511. #define RCC_CFG_HPRE_64 (0x6UL << RCC_CFG_HPRE_POS) /**< 0x00000600 */
  1512. #define RCC_CFG_HPRE_128 (0x7UL << RCC_CFG_HPRE_POS) /**< 0x00000700 */
  1513. #define RCC_CFG_PPRE_POS (12U)
  1514. #define RCC_CFG_PPRE_MASK (0x7UL << RCC_CFG_PPRE_POS) /**< 0x00007000 */
  1515. #define RCC_CFG_PPRE RCC_CFG_PPRE_MASK /**< PPRE[2:0] APB clock division factor */
  1516. #define RCC_CFG_PPRE_1 (0x0UL << RCC_CFG_PPRE_POS) /**< 0x00000000 */
  1517. #define RCC_CFG_PPRE_2 (0x4UL << RCC_CFG_PPRE_POS) /**< 0x00004000 */
  1518. #define RCC_CFG_PPRE_4 (0x5UL << RCC_CFG_PPRE_POS) /**< 0x00005000 */
  1519. #define RCC_CFG_PPRE_8 (0x6UL << RCC_CFG_PPRE_POS) /**< 0x00006000 */
  1520. #define RCC_CFG_PPRE_16 (0x7UL << RCC_CFG_PPRE_POS) /**< 0x00007000 */
  1521. #define RCC_CFG_MCOSEL_POS (24U)
  1522. #define RCC_CFG_MCOSEL_MASK (0x7UL << RCC_CFG_MCOSEL_POS) /**< 0x07000000 */
  1523. #define RCC_CFG_MCOSEL RCC_CFG_MCOSEL_MASK /**< MCOSEL [2:0] MCO clock output selection */
  1524. #define RCC_CFG_MCOSEL_DISABLE (0x0UL << RCC_CFG_MCOSEL_POS) /**< 0x00000000 */
  1525. #define RCC_CFG_MCOSEL_SYSCLK (0x1UL << RCC_CFG_MCOSEL_POS) /**< 0x01000000 */
  1526. #define RCC_CFG_MCOSEL_RCHDIV6 (0x3UL << RCC_CFG_MCOSEL_POS) /**< 0x03000000 */
  1527. #define RCC_CFG_MCOSEL_EXTCLK (0x4UL << RCC_CFG_MCOSEL_POS) /**< 0x04000000 */
  1528. #define RCC_CFG_MCOSEL_RCL (0x6UL << RCC_CFG_MCOSEL_POS) /**< 0x06000000 */
  1529. #define RCC_CFG_MCOPRE_POS (28U)
  1530. #define RCC_CFG_MCOPRE_MASK (0x7UL << RCC_CFG_MCOPRE_POS) /**< 0x70000000 */
  1531. #define RCC_CFG_MCOPRE RCC_CFG_MCOPRE_MASK /**< MCOPRE[2:0] MCO output clock division factor */
  1532. #define RCC_CFG_MCOPRE_DIV1 (0x0UL << RCC_CFG_MCOPRE_POS) /**< 0x00000000 */
  1533. #define RCC_CFG_MCOPRE_DIV2 (0x1UL << RCC_CFG_MCOPRE_POS) /**< 0x10000000 */
  1534. #define RCC_CFG_MCOPRE_DIV4 (0x2UL << RCC_CFG_MCOPRE_POS) /**< 0x20000000 */
  1535. #define RCC_CFG_MCOPRE_DIV8 (0x3UL << RCC_CFG_MCOPRE_POS) /**< 0x30000000 */
  1536. #define RCC_CFG_MCOPRE_DIV16 (0x4UL << RCC_CFG_MCOPRE_POS) /**< 0x40000000 */
  1537. #define RCC_CFG_MCOPRE_DIV32 (0x5UL << RCC_CFG_MCOPRE_POS) /**< 0x50000000 */
  1538. #define RCC_CFG_MCOPRE_DIV64 (0x6UL << RCC_CFG_MCOPRE_POS) /**< 0x60000000 */
  1539. #define RCC_CFG_MCOPRE_DIV128 (0x7UL << RCC_CFG_MCOPRE_POS) /**< 0x70000000 */
  1540. /* Bits for RCC_IER */
  1541. #define RCC_IER_RCL_RDYIE_POS (0U)
  1542. #define RCC_IER_RCL_RDYIE_MASK (0x1UL << RCC_IER_RCL_RDYIE_POS) /**< 0x00000001 */
  1543. #define RCC_IER_RCL_RDYIE RCC_IER_RCL_RDYIE_MASK /**< RCL ready interrupt enable */
  1544. #define RCC_IER_RCH_RDYIE_POS (3U)
  1545. #define RCC_IER_RCH_RDYIE_MASK (0x1UL << RCC_IER_RCH_RDYIE_POS) /**< 0x00000008 */
  1546. #define RCC_IER_RCH_RDYIE RCC_IER_RCH_RDYIE_MASK /**< RCH ready interrupt enable */
  1547. /* Bits for RCC_ISR */
  1548. #define RCC_ISR_RCL_RDYF_POS (0U)
  1549. #define RCC_ISR_RCL_RDYF_MASK (0x1UL << RCC_ISR_RCL_RDYF_POS) /**< 0x00000001 */
  1550. #define RCC_ISR_RCL_RDYF RCC_ISR_RCL_RDYF_MASK /**< RCL ready interrupt flag */
  1551. #define RCC_ISR_RCH_RDYF_POS (3U)
  1552. #define RCC_ISR_RCH_RDYF_MASK (0x1UL << RCC_ISR_RCH_RDYF_POS) /**< 0x00000008 */
  1553. #define RCC_ISR_RCH_RDYF RCC_ISR_RCH_RDYF_MASK /**< RCH ready interrupt flag */
  1554. /* Bits for RCC_ICR */
  1555. #define RCC_ICR_RCL_RDYC_POS (0U)
  1556. #define RCC_ICR_RCL_RDYC_MASK (0x1UL << RCC_ICR_RCL_RDYC_POS) /**< 0x00000001 */
  1557. #define RCC_ICR_RCL_RDYC RCC_ICR_RCL_RDYC_MASK /**< Clear RCL ready interrupt flag */
  1558. #define RCC_ICR_RCH_RDYC_POS (3U)
  1559. #define RCC_ICR_RCH_RDYC_MASK (0x1UL << RCC_ICR_RCH_RDYC_POS) /**< 0x00000008 */
  1560. #define RCC_ICR_RCH_RDYC RCC_ICR_RCH_RDYC_MASK /**< Clear RCH ready interrupt flag */
  1561. /* Bits for RCC_IOPRST */
  1562. #define RCC_IOPRST_GPIOA_RST_POS (0U)
  1563. #define RCC_IOPRST_GPIOA_RST_MASK (0x1UL << RCC_IOPRST_GPIOA_RST_POS) /**< 0x00000001 */
  1564. #define RCC_IOPRST_GPIOA_RST RCC_IOPRST_GPIOA_RST_MASK /**< GPIOA reset control */
  1565. #define RCC_IOPRST_GPIOB_RST_POS (1U)
  1566. #define RCC_IOPRST_GPIOB_RST_MASK (0x1UL << RCC_IOPRST_GPIOB_RST_POS) /**< 0x00000002 */
  1567. #define RCC_IOPRST_GPIOB_RST RCC_IOPRST_GPIOB_RST_MASK /**< GPIOB reset control */
  1568. #define RCC_IOPRST_GPIOC_RST_POS (2U)
  1569. #define RCC_IOPRST_GPIOC_RST_MASK (0x1UL << RCC_IOPRST_GPIOC_RST_POS) /**< 0x00000004 */
  1570. #define RCC_IOPRST_GPIOC_RST RCC_IOPRST_GPIOC_RST_MASK /**< GPIOC reset control */
  1571. /* Bits for RCC_AHBRST */
  1572. #define RCC_AHBRST_CRC_RST_POS (12U)
  1573. #define RCC_AHBRST_CRC_RST_MASK (0x1UL << RCC_AHBRST_CRC_RST_POS) /**< 0x00001000 */
  1574. #define RCC_AHBRST_CRC_RST RCC_AHBRST_CRC_RST_MASK /**< CRC reset control */
  1575. /* Bits for RCC_APBRST1 */
  1576. #define RCC_APBRST1_TIM3_RST_POS (1U)
  1577. #define RCC_APBRST1_TIM3_RST_MASK (0x1UL << RCC_APBRST1_TIM3_RST_POS) /**< 0x00000002 */
  1578. #define RCC_APBRST1_TIM3_RST RCC_APBRST1_TIM3_RST_MASK /**< TIM3 reset control */
  1579. #define RCC_APBRST1_UART2_RST_POS (17U)
  1580. #define RCC_APBRST1_UART2_RST_MASK (0x1UL << RCC_APBRST1_UART2_RST_POS) /**< 0x00020000 */
  1581. #define RCC_APBRST1_UART2_RST RCC_APBRST1_UART2_RST_MASK /**< UART2 reset control */
  1582. #define RCC_APBRST1_I2C1_RST_POS (21U)
  1583. #define RCC_APBRST1_I2C1_RST_MASK (0x1UL << RCC_APBRST1_I2C1_RST_POS) /**< 0x00200000 */
  1584. #define RCC_APBRST1_I2C1_RST RCC_APBRST1_I2C1_RST_MASK /**< I2C1 reset control */
  1585. #define RCC_APBRST1_LPTIM1_RST_POS (31U)
  1586. #define RCC_APBRST1_LPTIM1_RST_MASK (0x1UL << RCC_APBRST1_LPTIM1_RST_POS) /**< 0x80000000 */
  1587. #define RCC_APBRST1_LPTIM1_RST RCC_APBRST1_LPTIM1_RST_MASK /**< LPTIM1 reset control */
  1588. /* Bits for RCC_APBRST2 */
  1589. #define RCC_APBRST2_COMP_RST_POS (0U)
  1590. #define RCC_APBRST2_COMP_RST_MASK (0x1UL << RCC_APBRST2_COMP_RST_POS) /**< 0x00000001 */
  1591. #define RCC_APBRST2_COMP_RST RCC_APBRST2_COMP_RST_MASK /**< COMP reset control */
  1592. #define RCC_APBRST2_TIM1_RST_POS (11U)
  1593. #define RCC_APBRST2_TIM1_RST_MASK (0x1UL << RCC_APBRST2_TIM1_RST_POS) /**< 0x00000800 */
  1594. #define RCC_APBRST2_TIM1_RST RCC_APBRST2_TIM1_RST_MASK /**< TIM1 reset control */
  1595. #define RCC_APBRST2_SPI1_RST_POS (12U)
  1596. #define RCC_APBRST2_SPI1_RST_MASK (0x1UL << RCC_APBRST2_SPI1_RST_POS) /**< 0x00001000 */
  1597. #define RCC_APBRST2_SPI1_RST RCC_APBRST2_SPI1_RST_MASK /**< SPI1 reset control */
  1598. #define RCC_APBRST2_UART1_RST_POS (14U)
  1599. #define RCC_APBRST2_UART1_RST_MASK (0x1UL << RCC_APBRST2_UART1_RST_POS) /**< 0x00004000 */
  1600. #define RCC_APBRST2_UART1_RST RCC_APBRST2_UART1_RST_MASK /**< UART1 reset control */
  1601. #define RCC_APBRST2_ADC_RST_POS (20U)
  1602. #define RCC_APBRST2_ADC_RST_MASK (0x1UL << RCC_APBRST2_ADC_RST_POS) /**< 0x00100000 */
  1603. #define RCC_APBRST2_ADC_RST RCC_APBRST2_ADC_RST_MASK /**< ADC reset control */
  1604. #define RCC_APBRST2_DBG_RST_POS (27U)
  1605. #define RCC_APBRST2_DBG_RST_MASK (0x1UL << RCC_APBRST2_DBG_RST_POS) /**< 0x08000000 */
  1606. #define RCC_APBRST2_DBG_RST RCC_APBRST2_DBG_RST_MASK /**< DBG reset control */
  1607. /* Bits for RCC_IOPEN */
  1608. #define RCC_IOPEN_GPIOAEN_POS (0U)
  1609. #define RCC_IOPEN_GPIOAEN_MASK (0x1UL << RCC_IOPEN_GPIOAEN_POS) /**< 0x00000001 */
  1610. #define RCC_IOPEN_GPIOAEN RCC_IOPEN_GPIOAEN_MASK /**< GPIOA clock enable */
  1611. #define RCC_IOPEN_GPIOBEN_POS (1U)
  1612. #define RCC_IOPEN_GPIOBEN_MASK (0x1UL << RCC_IOPEN_GPIOBEN_POS) /**< 0x00000002 */
  1613. #define RCC_IOPEN_GPIOBEN RCC_IOPEN_GPIOBEN_MASK /**< GPIOB clock enable */
  1614. #define RCC_IOPEN_GPIOCEN_POS (2U)
  1615. #define RCC_IOPEN_GPIOCEN_MASK (0x1UL << RCC_IOPEN_GPIOCEN_POS) /**< 0x00000004 */
  1616. #define RCC_IOPEN_GPIOCEN RCC_IOPEN_GPIOCEN_MASK /**< GPIOC clock enable */
  1617. /* Bits for RCC_AHBEN */
  1618. #define RCC_AHBEN_CRCEN_POS (12U)
  1619. #define RCC_AHBEN_CRCEN_MASK (0x1UL << RCC_AHBEN_CRCEN_POS) /**< 0x00001000 */
  1620. #define RCC_AHBEN_CRCEN RCC_AHBEN_CRCEN_MASK /**< CRC clock enable */
  1621. /* Bits for RCC_APBEN1 */
  1622. #define RCC_APBEN1_TIM3EN_POS (1U)
  1623. #define RCC_APBEN1_TIM3EN_MASK (0x1UL << RCC_APBEN1_TIM3EN_POS) /**< 0x00000002 */
  1624. #define RCC_APBEN1_TIM3EN RCC_APBEN1_TIM3EN_MASK /**< TIM3 clock enable */
  1625. #define RCC_APBEN1_UART2EN_POS (17U)
  1626. #define RCC_APBEN1_UART2EN_MASK (0x1UL << RCC_APBEN1_UART2EN_POS) /**< 0x00020000 */
  1627. #define RCC_APBEN1_UART2EN RCC_APBEN1_UART2EN_MASK /**< UART2 clock enable */
  1628. #define RCC_APBEN1_I2C1EN_POS (21U)
  1629. #define RCC_APBEN1_I2C1EN_MASK (0x1UL << RCC_APBEN1_I2C1EN_POS) /**< 0x00200000 */
  1630. #define RCC_APBEN1_I2C1EN RCC_APBEN1_I2C1EN_MASK /**< I2C1 clock enable */
  1631. #define RCC_APBEN1_PMUEN_POS (28U)
  1632. #define RCC_APBEN1_PMUEN_MASK (0x1UL << RCC_APBEN1_PMUEN_POS) /**< 0x10000000 */
  1633. #define RCC_APBEN1_PMUEN RCC_APBEN1_PMUEN_MASK /**< PMU clock enable */
  1634. #define RCC_APBEN1_LPTIM1EN_POS (31U)
  1635. #define RCC_APBEN1_LPTIM1EN_MASK (0x1UL << RCC_APBEN1_LPTIM1EN_POS) /**< 0x80000000 */
  1636. #define RCC_APBEN1_LPTIM1EN RCC_APBEN1_LPTIM1EN_MASK /**< LPTIM1 clock enable */
  1637. /* Bits for RCC_APBEN2 */
  1638. #define RCC_APBEN2_COMPEN_POS (0U)
  1639. #define RCC_APBEN2_COMPEN_MASK (0x1UL << RCC_APBEN2_COMPEN_POS) /**< 0x00000001 */
  1640. #define RCC_APBEN2_COMPEN RCC_APBEN2_COMPEN_MASK /**< COMP clock enable */
  1641. #define RCC_APBEN2_TIM1EN_POS (11U)
  1642. #define RCC_APBEN2_TIM1EN_MASK (0x1UL << RCC_APBEN2_TIM1EN_POS) /**< 0x00000800 */
  1643. #define RCC_APBEN2_TIM1EN RCC_APBEN2_TIM1EN_MASK /**< TIM1 clock enable */
  1644. #define RCC_APBEN2_SPI1EN_POS (12U)
  1645. #define RCC_APBEN2_SPI1EN_MASK (0x1UL << RCC_APBEN2_SPI1EN_POS) /**< 0x00001000 */
  1646. #define RCC_APBEN2_SPI1EN RCC_APBEN2_SPI1EN_MASK /**< SPI1 clock enable */
  1647. #define RCC_APBEN2_UART1EN_POS (14U)
  1648. #define RCC_APBEN2_UART1EN_MASK (0x1UL << RCC_APBEN2_UART1EN_POS) /**< 0x00004000 */
  1649. #define RCC_APBEN2_UART1EN RCC_APBEN2_UART1EN_MASK /**< UART1 clock enable */
  1650. #define RCC_APBEN2_ADCEN_POS (20U)
  1651. #define RCC_APBEN2_ADCEN_MASK (0x1UL << RCC_APBEN2_ADCEN_POS) /**< 0x00100000 */
  1652. #define RCC_APBEN2_ADCEN RCC_APBEN2_ADCEN_MASK /**< ADC clock enable */
  1653. #define RCC_APBEN2_DBGEN_POS (27U)
  1654. #define RCC_APBEN2_DBGEN_MASK (0x1UL << RCC_APBEN2_DBGEN_POS) /**< 0x08000000 */
  1655. #define RCC_APBEN2_DBGEN RCC_APBEN2_DBGEN_MASK /**< DBG clock enable */
  1656. /* Bits for RCC_CLKSEL */
  1657. #define RCC_CLKSEL_COMP1_SEL_POS (0U)
  1658. #define RCC_CLKSEL_COMP1_SEL_MASK (0x1UL << RCC_CLKSEL_COMP1_SEL_POS) /**< 0x00000001 */
  1659. #define RCC_CLKSEL_COMP1_SEL RCC_CLKSEL_COMP1_SEL_MASK /**< COMP1 KCLK selection */
  1660. #define RCC_CLKSEL_COMP1_SEL_PCLK (0x0UL << RCC_CLKSEL_COMP1_SEL_POS) /**< 0x00000000 */
  1661. #define RCC_CLKSEL_COMP1_SEL_RCL (0x1UL << RCC_CLKSEL_COMP1_SEL_POS) /**< 0x00000001 */
  1662. #define RCC_CLKSEL_COMP2_SEL_POS (1U)
  1663. #define RCC_CLKSEL_COMP2_SEL_MASK (0x1UL << RCC_CLKSEL_COMP2_SEL_POS) /**< 0x00000002 */
  1664. #define RCC_CLKSEL_COMP2_SEL RCC_CLKSEL_COMP2_SEL_MASK /**< COMP2 KCLK selection */
  1665. #define RCC_CLKSEL_COMP2_SEL_PCLK (0x0UL << RCC_CLKSEL_COMP2_SEL_POS) /**< 0x00000000 */
  1666. #define RCC_CLKSEL_COMP2_SEL_RCL (0x1UL << RCC_CLKSEL_COMP2_SEL_POS) /**< 0x00000002 */
  1667. #define RCC_CLKSEL_LPTIM1_SEL_POS (18U)
  1668. #define RCC_CLKSEL_LPTIM1_SEL_MASK (0x3UL << RCC_CLKSEL_LPTIM1_SEL_POS) /**< 0x000C0000 */
  1669. #define RCC_CLKSEL_LPTIM1_SEL RCC_CLKSEL_LPTIM1_SEL_MASK /**< LPTIM1 KCLK selection */
  1670. #define RCC_CLKSEL_LPTIM1_SEL_PCLK (0x0UL << RCC_CLKSEL_LPTIM1_SEL_POS) /**< 0x00000000 */
  1671. #define RCC_CLKSEL_LPTIM1_SEL_RCL (0x1UL << RCC_CLKSEL_LPTIM1_SEL_POS) /**< 0x00040000 */
  1672. #define RCC_CLKSEL_LPTIM1_SEL_MCO (0x2UL << RCC_CLKSEL_LPTIM1_SEL_POS) /**< 0x00080000 */
  1673. /* Bits for RCC_CSR2 */
  1674. #define RCC_CSR2_RCLON_POS (0U)
  1675. #define RCC_CSR2_RCLON_MASK (0x1UL << RCC_CSR2_RCLON_POS) /**< 0x00000001 */
  1676. #define RCC_CSR2_RCLON RCC_CSR2_RCLON_MASK /**< RCL enable */
  1677. #define RCC_CSR2_RCLRDY_POS (1U)
  1678. #define RCC_CSR2_RCLRDY_MASK (0x1UL << RCC_CSR2_RCLRDY_POS) /**< 0x00000002 */
  1679. #define RCC_CSR2_RCLRDY RCC_CSR2_RCLRDY_MASK /**< RCL ready flag */
  1680. #define RCC_CSR2_LOCKUP_RSTEN_POS (8U)
  1681. #define RCC_CSR2_LOCKUP_RSTEN_MASK (0x1UL << RCC_CSR2_LOCKUP_RSTEN_POS) /**< 0x00000100 */
  1682. #define RCC_CSR2_LOCKUP_RSTEN RCC_CSR2_LOCKUP_RSTEN_MASK /**< LOCKUP reset enable */
  1683. #define RCC_CSR2_RMVF_POS (16U)
  1684. #define RCC_CSR2_RMVF_MASK (0x1UL << RCC_CSR2_RMVF_POS) /**< 0x00010000 */
  1685. #define RCC_CSR2_RMVF RCC_CSR2_RMVF_MASK /**< Clear reset flag */
  1686. #define RCC_CSR2_LOCKUP_RSTF_POS (24U)
  1687. #define RCC_CSR2_LOCKUP_RSTF_MASK (0x1UL << RCC_CSR2_LOCKUP_RSTF_POS) /**< 0x01000000 */
  1688. #define RCC_CSR2_LOCKUP_RSTF RCC_CSR2_LOCKUP_RSTF_MASK /**< LOCKUP reset flag */
  1689. #define RCC_CSR2_NRST_RSTF_POS (26U)
  1690. #define RCC_CSR2_NRST_RSTF_MASK (0x1UL << RCC_CSR2_NRST_RSTF_POS) /**< 0x04000000 */
  1691. #define RCC_CSR2_NRST_RSTF RCC_CSR2_NRST_RSTF_MASK /**< NRST pin reset flag */
  1692. #define RCC_CSR2_PMU_RSTF_POS (27U)
  1693. #define RCC_CSR2_PMU_RSTF_MASK (0x1UL << RCC_CSR2_PMU_RSTF_POS) /**< 0x08000000 */
  1694. #define RCC_CSR2_PMU_RSTF RCC_CSR2_PMU_RSTF_MASK /**< POR or BOR reset flag */
  1695. #define RCC_CSR2_SW_RSTF_POS (28U)
  1696. #define RCC_CSR2_SW_RSTF_MASK (0x1UL << RCC_CSR2_SW_RSTF_POS) /**< 0x10000000 */
  1697. #define RCC_CSR2_SW_RSTF RCC_CSR2_SW_RSTF_MASK /**< Software reset flag */
  1698. #define RCC_CSR2_IWDG_RSTF_POS (29U)
  1699. #define RCC_CSR2_IWDG_RSTF_MASK (0x1UL << RCC_CSR2_IWDG_RSTF_POS) /**< 0x20000000 */
  1700. #define RCC_CSR2_IWDG_RSTF RCC_CSR2_IWDG_RSTF_MASK /**< IWDG reset flag */
  1701. #define RCC_CSR2_LPM_RSTF_POS (31U)
  1702. #define RCC_CSR2_LPM_RSTF_MASK (0x1UL << RCC_CSR2_LPM_RSTF_POS) /**< 0x80000000 */
  1703. #define RCC_CSR2_LPM_RSTF RCC_CSR2_LPM_RSTF_MASK /**< Low power mode reset flag */
  1704. /* Bits for RCC_RCL_CAL */
  1705. #define RCC_RCLCAL_RCL_CAL_POS (0U)
  1706. #define RCC_RCLCAL_RCL_CAL_MASK (0x0FUL << RCC_RCLCAL_RCL_CAL_POS) /**< 0x0000000F */
  1707. #define RCC_RCLCAL_RCL_CAL RCC_RCLCAL_RCL_CAL_MASK
  1708. /* Bits for RCC_RCH_CAL */
  1709. #define RCC_RCHCAL_RCH_CAL_FINE_POS (0U)
  1710. #define RCC_RCHCAL_RCH_CAL_FINE_MASK (0x3FUL << RCC_RCHCAL_RCH_CAL_FINE_POS) /**< 0x0000003F */
  1711. #define RCC_RCHCAL_RCH_CAL_FINE RCC_RCHCAL_RCH_CAL_FINE_MASK
  1712. #define RCC_RCHCAL_RCH_CAL_COARSE_POS (8U)
  1713. #define RCC_RCHCAL_RCH_CAL_COARSE_MASK (0x7UL << RCC_RCHCAL_RCH_CAL_COARSE_POS) /**< 0x00000700 */
  1714. #define RCC_RCHCAL_RCH_CAL_COARSE RCC_RCHCAL_RCH_CAL_COARSE_MASK
  1715. /*-----------------------------------------------------------------------------------------------
  1716. SPI Registers Bits
  1717. ------------------------------------------------------------------------------------------------*/
  1718. /* Bits for SPI_CR1 */
  1719. #define SPI_CR1_SPE_POS (0U)
  1720. #define SPI_CR1_SPE_MASK (0x1UL << SPI_CR1_SPE_POS) /**< 0x00000001 */
  1721. #define SPI_CR1_SPE SPI_CR1_SPE_MASK /**< SPI enable */
  1722. #define SPI_CR1_BR_POS (1U)
  1723. #define SPI_CR1_BR_MASK (0x7UL << SPI_CR1_BR_POS) /**< 0x0000000E */
  1724. #define SPI_CR1_BR SPI_CR1_BR_MASK /**< BR[2:0] bits (baud rate control) */
  1725. #define SPI_CR1_BR_PCLK_DIV_2 (0x0UL << SPI_CR1_BR_POS) /**< 0x00000000 */
  1726. #define SPI_CR1_BR_PCLK_DIV_4 (0x1UL << SPI_CR1_BR_POS) /**< 0x00000002 */
  1727. #define SPI_CR1_BR_PCLK_DIV_8 (0x2UL << SPI_CR1_BR_POS) /**< 0x00000004 */
  1728. #define SPI_CR1_BR_PCLK_DIV_16 (0x3UL << SPI_CR1_BR_POS) /**< 0x00000006 */
  1729. #define SPI_CR1_BR_PCLK_DIV_32 (0x4UL << SPI_CR1_BR_POS) /**< 0x00000008 */
  1730. #define SPI_CR1_BR_PCLK_DIV_64 (0x5UL << SPI_CR1_BR_POS) /**< 0x0000000A */
  1731. #define SPI_CR1_BR_PCLK_DIV_128 (0x6UL << SPI_CR1_BR_POS) /**< 0x0000000C */
  1732. #define SPI_CR1_CPHA_POS (4U)
  1733. #define SPI_CR1_CPHA_MASK (0x1UL << SPI_CR1_CPHA_POS) /**< 0x00000010 */
  1734. #define SPI_CR1_CPHA SPI_CR1_CPHA_MASK /**< Clock phase */
  1735. #define SPI_CR1_CPOL_POS (5U)
  1736. #define SPI_CR1_CPOL_MASK (0x1UL << SPI_CR1_CPOL_POS) /**< 0x00000020 */
  1737. #define SPI_CR1_CPOL SPI_CR1_CPOL_MASK /**< Clock polarity */
  1738. #define SPI_CR1_MSTR_POS (6U)
  1739. #define SPI_CR1_MSTR_MASK (0x1UL << SPI_CR1_MSTR_POS) /**< 0x00000040 */
  1740. #define SPI_CR1_MSTR SPI_CR1_MSTR_MASK /**< Master mode selection */
  1741. #define SPI_CR1_LSBFIRST_POS (8U)
  1742. #define SPI_CR1_LSBFIRST_MASK (0x1UL << SPI_CR1_LSBFIRST_POS) /**< 0x00000100 */
  1743. #define SPI_CR1_LSBFIRST SPI_CR1_LSBFIRST_MASK /**< Frame format */
  1744. #define SPI_CR1_NSSOE_POS (10U)
  1745. #define SPI_CR1_NSSOE_MASK (0x1UL << SPI_CR1_NSSOE_POS) /**< 0x00000400 */
  1746. #define SPI_CR1_NSSOE SPI_CR1_NSSOE_MASK /**< NSS out enable */
  1747. #define SPI_CR1_SSM_POS (11U)
  1748. #define SPI_CR1_SSM_MASK (0x1UL << SPI_CR1_SSM_POS) /**< 0x00000800 */
  1749. #define SPI_CR1_SSM SPI_CR1_SSM_MASK /**< Slave Software NSS */
  1750. #define SPI_CR1_ERRIE_POS (18U)
  1751. #define SPI_CR1_ERRIE_MASK (0x1UL << SPI_CR1_ERRIE_POS) /**< 0x00040000 */
  1752. #define SPI_CR1_ERRIE SPI_CR1_ERRIE_MASK /**< Error interrupt enable */
  1753. #define SPI_CR1_RXFNEIE_POS (20U)
  1754. #define SPI_CR1_RXFNEIE_MASK (0x1UL << SPI_CR1_RXFNEIE_POS) /**< 0x00100000 */
  1755. #define SPI_CR1_RXFNEIE SPI_CR1_RXFNEIE_MASK /**< RX data register not empty interrupt enable */
  1756. #define SPI_CR1_TXFEIE_POS (25U)
  1757. #define SPI_CR1_TXFEIE_MASK (0x1UL << SPI_CR1_TXFEIE_POS) /**< 0x02000000 */
  1758. #define SPI_CR1_TXFEIE SPI_CR1_TXFEIE_MASK /**< TX data register empty interrupt enable */
  1759. /* Bits for SPI_CR2 */
  1760. #define SPI_CR2_NSSO_POS (0U)
  1761. #define SPI_CR2_NSSO_MASK (0x1UL << SPI_CR2_NSSO_POS) /**< 0x00000001 */
  1762. #define SPI_CR2_NSSO SPI_CR2_NSSO_MASK /**< NSS out level */
  1763. /* Bits for SPI_ISR */
  1764. #define SPI_ISR_MMF_POS (0U)
  1765. #define SPI_ISR_MMF_MASK (0x1UL << SPI_ISR_MMF_POS) /**< 0x00000001 */
  1766. #define SPI_ISR_MMF SPI_ISR_MMF_MASK /**< Master mode confilct flag */
  1767. #define SPI_ISR_OVR_POS (2U)
  1768. #define SPI_ISR_OVR_MASK (0x1UL << SPI_ISR_OVR_POS) /**< 0x00000004 */
  1769. #define SPI_ISR_OVR SPI_ISR_OVR_MASK /**< RX FIFO overrun flag */
  1770. #define SPI_ISR_BUSY_POS (4U)
  1771. #define SPI_ISR_BUSY_MASK (0x1UL << SPI_ISR_BUSY_POS) /**< 0x00000010 */
  1772. #define SPI_ISR_BUSY SPI_ISR_BUSY_MASK /**< Busy flag */
  1773. #define SPI_ISR_RXFNE_POS (6U)
  1774. #define SPI_ISR_RXFNE_MASK (0x1UL << SPI_ISR_RXFNE_POS) /**< 0x00000040 */
  1775. #define SPI_ISR_RXFNE SPI_ISR_RXFNE_MASK /**< RX data register not empty flag */
  1776. #define SPI_ISR_TXFE_POS (8U)
  1777. #define SPI_ISR_TXFE_MASK (0x1UL << SPI_ISR_TXFE_POS) /**< 0x00000100 */
  1778. #define SPI_ISR_TXFE SPI_ISR_TXFE_MASK /**< TX data register empty flag */
  1779. /* Bits for SPI_ICR */
  1780. #define SPI_ICR_MMFCF_POS (0U)
  1781. #define SPI_ICR_MMFCF_MASK (0x1UL << SPI_ICR_MMFCF_POS) /**< 0x00000001 */
  1782. #define SPI_ICR_MMFCF SPI_ICR_MMFCF_MASK /**< Master mode confilct clear flag */
  1783. #define SPI_ICR_OVRCF_POS (2U)
  1784. #define SPI_ICR_OVRCF_MASK (0x1UL << SPI_ICR_OVRCF_POS) /**< 0x00000004 */
  1785. #define SPI_ICR_OVRCF SPI_ICR_OVRCF_MASK /**< RX data register overrun clear flag */
  1786. /* Bits for SPI_DR */
  1787. #define SPI_DR_DR_POS (0U)
  1788. #define SPI_DR_DR_MASK (0xFFUL << SPI_DR_DR_POS) /**< 0x000000FF */
  1789. #define SPI_DR_DR SPI_DR_DR_MASK /**< 8 bits transmit or receive data */
  1790. /*-----------------------------------------------------------------------------------------------
  1791. Timer Registers Bits
  1792. ------------------------------------------------------------------------------------------------*/
  1793. /* Bits for TIM_CR1 */
  1794. #define TIM_CR1_CEN_POS (0U)
  1795. #define TIM_CR1_CEN_MASK (0x1UL << TIM_CR1_CEN_POS) /**< 0x00000001 */
  1796. #define TIM_CR1_CEN TIM_CR1_CEN_MASK /**< Counter enable */
  1797. #define TIM_CR1_UDIS_POS (1U)
  1798. #define TIM_CR1_UDIS_MASK (0x1UL << TIM_CR1_UDIS_POS) /**< 0x00000002 */
  1799. #define TIM_CR1_UDIS TIM_CR1_UDIS_MASK /**< Update disable */
  1800. #define TIM_CR1_URS_POS (2U)
  1801. #define TIM_CR1_URS_MASK (0x1UL << TIM_CR1_URS_POS) /**< 0x00000004 */
  1802. #define TIM_CR1_URS TIM_CR1_URS_MASK /**< Update request source */
  1803. #define TIM_CR1_OPM_POS (3U)
  1804. #define TIM_CR1_OPM_MASK (0x1UL << TIM_CR1_OPM_POS) /**< 0x00000008 */
  1805. #define TIM_CR1_OPM TIM_CR1_OPM_MASK /**< One pulse mode */
  1806. #define TIM_CR1_DIR_POS (4U)
  1807. #define TIM_CR1_DIR_MASK (0x1UL << TIM_CR1_DIR_POS) /**< 0x00000010 */
  1808. #define TIM_CR1_DIR TIM_CR1_DIR_MASK /**< Direction */
  1809. #define TIM_CR1_CMS_POS (5U)
  1810. #define TIM_CR1_CMS_MASK (0x3UL << TIM_CR1_CMS_POS) /**< 0x00000060 */
  1811. #define TIM_CR1_CMS TIM_CR1_CMS_MASK /**< CMS[1:0] bits (center-aligned mode selection) */
  1812. #define TIM_CR1_CMS_CENTER_UP (0x1UL << TIM_CR1_CMS_POS) /**< 0x00000020 */
  1813. #define TIM_CR1_CMS_CENTER_DOWN (0x2UL << TIM_CR1_CMS_POS) /**< 0x00000040 */
  1814. #define TIM_CR1_CMS_CENTER_UP_DOWN (0x3UL << TIM_CR1_CMS_POS) /**< 0x00000060 */
  1815. #define TIM_CR1_ARPE_POS (7U)
  1816. #define TIM_CR1_ARPE_MASK (0x1UL << TIM_CR1_ARPE_POS) /**< 0x00000080 */
  1817. #define TIM_CR1_ARPE TIM_CR1_ARPE_MASK /**< Auto-reload preload enable */
  1818. #define TIM_CR1_CLK_DIV_POS (8U)
  1819. #define TIM_CR1_CLK_DIV_MASK (0x3UL << TIM_CR1_CLK_DIV_POS) /**< 0x00000300 */
  1820. #define TIM_CR1_CLK_DIV TIM_CR1_CLK_DIV_MASK /**< CLK_DIV[1:0] bits (clock division) */
  1821. #define TIM_CR1_CLK_DIV1 (0x0UL << TIM_CR1_CLK_DIV_POS) /**< 0x00000000 */
  1822. #define TIM_CR1_CLK_DIV2 (0x1UL << TIM_CR1_CLK_DIV_POS) /**< 0x00000100 */
  1823. #define TIM_CR1_CLK_DIV4 (0x2UL << TIM_CR1_CLK_DIV_POS) /**< 0x00000200 */
  1824. #define TIM_CR1_MODE_POS (15U)
  1825. #define TIM_CR1_MODE_MASK (0x1UL << TIM_CR1_MODE_POS) /**< 0x00008000 */
  1826. #define TIM_CR1_MODE TIM_CR1_MODE_MASK /**< work mode */
  1827. /* Bits for TIM_CR2 */
  1828. #define TIM_CR2_CC_PRECR_POS (0U)
  1829. #define TIM_CR2_CC_PRECR_MASK (0x1UL << TIM_CR2_CC_PRECR_POS) /**< 0x00000001 */
  1830. #define TIM_CR2_CC_PRECR TIM_CR2_CC_PRECR_MASK /**< Capture/Compare preloaded control */
  1831. #define TIM_CR2_CCU_SEL_POS (2U)
  1832. #define TIM_CR2_CCU_SEL_MASK (0x1UL << TIM_CR2_CCU_SEL_POS) /**< 0x00000004 */
  1833. #define TIM_CR2_CCU_SEL TIM_CR2_CCU_SEL_MASK /**< COM control update selection */
  1834. #define TIM_CR2_MM_SEL_POS (4U)
  1835. #define TIM_CR2_MM_SEL_MASK (0x7UL << TIM_CR2_MM_SEL_POS) /**< 0x00000070 */
  1836. #define TIM_CR2_MM_SEL TIM_CR2_MM_SEL_MASK /**< MM_SEL[2:0] bits (master mode melection) */
  1837. #define TIM_CR2_MM_SEL_RESET (0x0UL << TIM_CR2_MM_SEL_POS) /**< 0x00000000 */
  1838. #define TIM_CR2_MM_SEL_ENABLE (0x1UL << TIM_CR2_MM_SEL_POS) /**< 0x00000010 */
  1839. #define TIM_CR2_MM_SEL_UPDATE (0x2UL << TIM_CR2_MM_SEL_POS) /**< 0x00000020 */
  1840. #define TIM_CR2_MM_SEL_CC1IF (0x3UL << TIM_CR2_MM_SEL_POS) /**< 0x00000030 */
  1841. #define TIM_CR2_MM_SEL_OC1REF (0x4UL << TIM_CR2_MM_SEL_POS) /**< 0x00000040 */
  1842. #define TIM_CR2_MM_SEL_OC2REF (0x5UL << TIM_CR2_MM_SEL_POS) /**< 0x00000050 */
  1843. #define TIM_CR2_MM_SEL_OC3REF (0x6UL << TIM_CR2_MM_SEL_POS) /**< 0x00000060 */
  1844. #define TIM_CR2_MM_SEL_OC4REF (0x7UL << TIM_CR2_MM_SEL_POS) /**< 0x00000070 */
  1845. #define TIM_CR2_TI1_XOR_SEL_POS (7U)
  1846. #define TIM_CR2_TI1_XOR_SEL_MASK (0x1UL << TIM_CR2_TI1_XOR_SEL_POS) /**< 0x00000080 */
  1847. #define TIM_CR2_TI1_XOR_SEL TIM_CR2_TI1_XOR_SEL_MASK /**< TI1 selection */
  1848. #define TIM_CR2_OIS1_POS (8U)
  1849. #define TIM_CR2_OIS1_MASK (0x1UL << TIM_CR2_OIS1_POS) /**< 0x00000100 */
  1850. #define TIM_CR2_OIS1 TIM_CR2_OIS1_MASK /**< Output idle state 1 (OC1 output) */
  1851. #define TIM_CR2_OIS1N_POS (9U)
  1852. #define TIM_CR2_OIS1N_MASK (0x1UL << TIM_CR2_OIS1N_POS) /**< 0x00000200 */
  1853. #define TIM_CR2_OIS1N TIM_CR2_OIS1N_MASK /**< Output idle state 1 (OC1N output) */
  1854. #define TIM_CR2_OIS2_POS (10U)
  1855. #define TIM_CR2_OIS2_MASK (0x1UL << TIM_CR2_OIS2_POS) /**< 0x00000400 */
  1856. #define TIM_CR2_OIS2 TIM_CR2_OIS2_MASK /**< Output idle state 2 (OC2 output) */
  1857. #define TIM_CR2_OIS2N_POS (11U)
  1858. #define TIM_CR2_OIS2N_MASK (0x1UL << TIM_CR2_OIS2N_POS) /**< 0x00000800 */
  1859. #define TIM_CR2_OIS2N TIM_CR2_OIS2N_MASK /**< Output idle state 2 (OC2N output) */
  1860. #define TIM_CR2_OIS3_POS (12U)
  1861. #define TIM_CR2_OIS3_MASK (0x1UL << TIM_CR2_OIS3_POS) /**< 0x00001000 */
  1862. #define TIM_CR2_OIS3 TIM_CR2_OIS3_MASK /**< Output idle state 3 (OC3 output) */
  1863. #define TIM_CR2_OIS3N_POS (13U)
  1864. #define TIM_CR2_OIS3N_MASK (0x1UL << TIM_CR2_OIS3N_POS) /**< 0x00002000 */
  1865. #define TIM_CR2_OIS3N TIM_CR2_OIS3N_MASK /**< Output idle state 3 (OC3N output) */
  1866. #define TIM_CR2_OIS4_POS (14U)
  1867. #define TIM_CR2_OIS4_MASK (0x1UL << TIM_CR2_OIS4_POS) /**< 0x00004000 */
  1868. #define TIM_CR2_OIS4 TIM_CR2_OIS4_MASK /**< Output idle state 4 (OC4 output) */
  1869. /* Bits for TIM_SMC */
  1870. #define TIM_SMC_SM_SEL_POS (0U)
  1871. #define TIM_SMC_SM_SEL_MASK (0x7UL << TIM_SMC_SM_SEL_POS) /**< 0x00000007 */
  1872. #define TIM_SMC_SM_SEL TIM_SMC_SM_SEL_MASK /**< SM_SEL[2:0] bits (slave mode selection) */
  1873. #define TIM_SMC_SM_SEL_NONE (0x00UL << TIM_SMC_SM_SEL_POS) /**< 0x00000000 */
  1874. #define TIM_SMC_SM_SEL_RESET (0x04UL << TIM_SMC_SM_SEL_POS) /**< 0x00000004 */
  1875. #define TIM_SMC_SM_SEL_GATED (0x05UL << TIM_SMC_SM_SEL_POS) /**< 0x00000005 */
  1876. #define TIM_SMC_SM_SEL_TRIG (0x06UL << TIM_SMC_SM_SEL_POS) /**< 0x00000006 */
  1877. #define TIM_SMC_SM_SEL_EXT_MODE1 (0x07UL << TIM_SMC_SM_SEL_POS) /**< 0x00000007 */
  1878. #define TIM_SMC_TS_POS (4U)
  1879. #define TIM_SMC_TS_MASK (0x3UL << TIM_SMC_TS_POS) /**< 0x00000030 */
  1880. #define TIM_SMC_TS TIM_SMC_TS_MASK /**< TS[1:0] bits (trigger selection) */
  1881. #define TIM_SMC_TS_ITR0 (0x00UL << TIM_SMC_TS_POS) /**< 0x00000000 */
  1882. #define TIM_SMC_TS_TI1F_ED (0x01UL << TIM_SMC_TS_POS) /**< 0x00000010 */
  1883. #define TIM_SMC_TS_TI1FP1 (0x02UL << TIM_SMC_TS_POS) /**< 0x00000020 */
  1884. #define TIM_SMC_TS_TI2FP2 (0x03UL << TIM_SMC_TS_POS) /**< 0x00000030 */
  1885. #define TIM_SMC_MS_MOD_POS (7U)
  1886. #define TIM_SMC_MS_MOD_MASK (0x1UL << TIM_SMC_MS_MOD_POS) /**< 0x00000080 */
  1887. #define TIM_SMC_MS_MOD TIM_SMC_MS_MOD_MASK /**< Master/Slave mode */
  1888. /* Bits for TIM_DIER */
  1889. #define TIM_DIER_UIE_POS (0U)
  1890. #define TIM_DIER_UIE_MASK (0x1UL << TIM_DIER_UIE_POS) /**< 0x00000001 */
  1891. #define TIM_DIER_UIE TIM_DIER_UIE_MASK /**< Update interrupt enable */
  1892. #define TIM_DIER_CC1IE_POS (1U)
  1893. #define TIM_DIER_CC1IE_MASK (0x1UL << TIM_DIER_CC1IE_POS) /**< 0x00000002 */
  1894. #define TIM_DIER_CC1IE TIM_DIER_CC1IE_MASK /**< Capture/Compare 1 interrupt enable */
  1895. #define TIM_DIER_CC2IE_POS (2U)
  1896. #define TIM_DIER_CC2IE_MASK (0x1UL << TIM_DIER_CC2IE_POS) /**< 0x00000004 */
  1897. #define TIM_DIER_CC2IE TIM_DIER_CC2IE_MASK /**< Capture/Compare 2 interrupt enable */
  1898. #define TIM_DIER_CC3IE_POS (3U)
  1899. #define TIM_DIER_CC3IE_MASK (0x1UL << TIM_DIER_CC3IE_POS) /**< 0x00000008 */
  1900. #define TIM_DIER_CC3IE TIM_DIER_CC3IE_MASK /**< Capture/Compare 3 interrupt enable */
  1901. #define TIM_DIER_CC4IE_POS (4U)
  1902. #define TIM_DIER_CC4IE_MASK (0x1UL << TIM_DIER_CC4IE_POS) /**< 0x00000010 */
  1903. #define TIM_DIER_CC4IE TIM_DIER_CC4IE_MASK /**< Capture/Compare 4 interrupt enable */
  1904. #define TIM_DIER_COMIE_POS (5U)
  1905. #define TIM_DIER_COMIE_MASK (0x1UL << TIM_DIER_COMIE_POS) /**< 0x00000020 */
  1906. #define TIM_DIER_COMIE TIM_DIER_COMIE_MASK /**< COM interrupt enable */
  1907. #define TIM_DIER_TIE_POS (6U)
  1908. #define TIM_DIER_TIE_MASK (0x1UL << TIM_DIER_TIE_POS) /**< 0x00000040 */
  1909. #define TIM_DIER_TIE TIM_DIER_TIE_MASK /**< Trigger interrupt enable */
  1910. #define TIM_DIER_BIE_POS (7U)
  1911. #define TIM_DIER_BIE_MASK (0x1UL << TIM_DIER_BIE_POS) /**< 0x00000080 */
  1912. #define TIM_DIER_BIE TIM_DIER_BIE_MASK /**< Break interrupt enable */
  1913. /* Bits for TIM_SR */
  1914. #define TIM_SR_UIF_POS (0U)
  1915. #define TIM_SR_UIF_MASK (0x1UL << TIM_SR_UIF_POS) /**< 0x00000001 */
  1916. #define TIM_SR_UIF TIM_SR_UIF_MASK /**< Update interrupt flag */
  1917. #define TIM_SR_CC1IF_POS (1U)
  1918. #define TIM_SR_CC1IF_MASK (0x1UL << TIM_SR_CC1IF_POS) /**< 0x00000002 */
  1919. #define TIM_SR_CC1IF TIM_SR_CC1IF_MASK /**< Capture/Compare 1 interrupt flag */
  1920. #define TIM_SR_CC2IF_POS (2U)
  1921. #define TIM_SR_CC2IF_MASK (0x1UL << TIM_SR_CC2IF_POS) /**< 0x00000004 */
  1922. #define TIM_SR_CC2IF TIM_SR_CC2IF_MASK /**< Capture/Compare 2 interrupt flag */
  1923. #define TIM_SR_CC3IF_POS (3U)
  1924. #define TIM_SR_CC3IF_MASK (0x1UL << TIM_SR_CC3IF_POS) /**< 0x00000008 */
  1925. #define TIM_SR_CC3IF TIM_SR_CC3IF_MASK /**< Capture/Compare 3 interrupt flag */
  1926. #define TIM_SR_CC4IF_POS (4U)
  1927. #define TIM_SR_CC4IF_MASK (0x1UL << TIM_SR_CC4IF_POS) /**< 0x00000010 */
  1928. #define TIM_SR_CC4IF TIM_SR_CC4IF_MASK /**< Capture/Compare 4 interrupt flag */
  1929. #define TIM_SR_COMIF_POS (5U)
  1930. #define TIM_SR_COMIF_MASK (0x1UL << TIM_SR_COMIF_POS) /**< 0x00000020 */
  1931. #define TIM_SR_COMIF TIM_SR_COMIF_MASK /**< COM interrupt flag */
  1932. #define TIM_SR_TIF_POS (6U)
  1933. #define TIM_SR_TIF_MASK (0x1UL << TIM_SR_TIF_POS) /**< 0x00000040 */
  1934. #define TIM_SR_TIF TIM_SR_TIF_MASK /**< Trigger interrupt flag */
  1935. #define TIM_SR_BIF_POS (7U)
  1936. #define TIM_SR_BIF_MASK (0x1UL << TIM_SR_BIF_POS) /**< 0x00000080 */
  1937. #define TIM_SR_BIF TIM_SR_BIF_MASK /**< Break interrupt flag */
  1938. #define TIM_SR_CC1OF_POS (9U)
  1939. #define TIM_SR_CC1OF_MASK (0x1UL << TIM_SR_CC1OF_POS) /**< 0x00000200 */
  1940. #define TIM_SR_CC1OF TIM_SR_CC1OF_MASK /**< Capture/Compare 1 overcapture flag */
  1941. #define TIM_SR_CC2OF_POS (10U)
  1942. #define TIM_SR_CC2OF_MASK (0x1UL << TIM_SR_CC2OF_POS) /**< 0x00000400 */
  1943. #define TIM_SR_CC2OF TIM_SR_CC2OF_MASK /**< Capture/Compare 2 overcapture flag */
  1944. /* Bits for TIM_EVTG */
  1945. #define TIM_EVTG_UG_POS (0U)
  1946. #define TIM_EVTG_UG_MASK (0x1UL << TIM_EVTG_UG_POS) /**< 0x00000001 */
  1947. #define TIM_EVTG_UG TIM_EVTG_UG_MASK /**< Update generation */
  1948. #define TIM_EVTG_CC1G_POS (1U)
  1949. #define TIM_EVTG_CC1G_MASK (0x1UL << TIM_EVTG_CC1G_POS) /**< 0x00000002 */
  1950. #define TIM_EVTG_CC1G TIM_EVTG_CC1G_MASK /**< Capture/Compare 1 generation */
  1951. #define TIM_EVTG_CC2G_POS (2U)
  1952. #define TIM_EVTG_CC2G_MASK (0x1UL << TIM_EVTG_CC2G_POS) /**< 0x00000004 */
  1953. #define TIM_EVTG_CC2G TIM_EVTG_CC2G_MASK /**< Capture/Compare 2 generation */
  1954. #define TIM_EVTG_CC3G_POS (3U)
  1955. #define TIM_EVTG_CC3G_MASK (0x1UL << TIM_EVTG_CC3G_POS) /**< 0x00000008 */
  1956. #define TIM_EVTG_CC3G TIM_EVTG_CC3G_MASK /**< Capture/Compare 3 generation */
  1957. #define TIM_EVTG_CC4G_POS (4U)
  1958. #define TIM_EVTG_CC4G_MASK (0x1UL << TIM_EVTG_CC4G_POS) /**< 0x00000010 */
  1959. #define TIM_EVTG_CC4G TIM_EVTG_CC4G_MASK /**< Capture/Compare 4 generation */
  1960. #define TIM_EVTG_COMG_POS (5U)
  1961. #define TIM_EVTG_COMG_MASK (0x1UL << TIM_EVTG_COMG_POS) /**< 0x00000020 */
  1962. #define TIM_EVTG_COMG TIM_EVTG_COMG_MASK /**< Capture/Compare control update generation */
  1963. #define TIM_EVTG_TG_POS (6U)
  1964. #define TIM_EVTG_TG_MASK (0x1UL << TIM_EVTG_TG_POS) /**< 0x00000040 */
  1965. #define TIM_EVTG_TG TIM_EVTG_TG_MASK /**< Trigger generation */
  1966. #define TIM_EVTG_BG_POS (7U)
  1967. #define TIM_EVTG_BG_MASK (0x1UL << TIM_EVTG_BG_POS) /**< 0x00000080 */
  1968. #define TIM_EVTG_BG TIM_EVTG_BG_MASK /**< Break generation */
  1969. /* Bits for TIM_CCM1 */
  1970. #define TIM_CCM1_CC1S_POS (0U)
  1971. #define TIM_CCM1_CC1S_MASK (0x3UL << TIM_CCM1_CC1S_POS) /**< 0x00000003 */
  1972. #define TIM_CCM1_CC1S TIM_CCM1_CC1S_MASK /**< CC1S[1:0] bits (Capture/Compare 1 selection) */
  1973. #define TIM_CCM1_CC1S_DIRECTTI (0x1UL << TIM_CCM1_CC1S_POS) /**< 0x00000001 */
  1974. #define TIM_CCM1_CC1S_INDIRECTTI (0x2UL << TIM_CCM1_CC1S_POS) /**< 0x00000002 */
  1975. #define TIM_CCM1_CC1S_TRC (0x3UL << TIM_CCM1_CC1S_POS) /**< 0x00000003 */
  1976. #define TIM_CCM1_OC1FE_POS (2U)
  1977. #define TIM_CCM1_OC1FE_MASK (0x1UL << TIM_CCM1_OC1FE_POS) /**< 0x00000004 */
  1978. #define TIM_CCM1_OC1FE TIM_CCM1_OC1FE_MASK /**< Output Compare 1 fast enable */
  1979. #define TIM_CCM1_OC1PE_POS (3U)
  1980. #define TIM_CCM1_OC1PE_MASK (0x1UL << TIM_CCM1_OC1PE_POS) /**< 0x00000008 */
  1981. #define TIM_CCM1_OC1PE TIM_CCM1_OC1PE_MASK /**< Output Compare 1 preload enable */
  1982. #define TIM_CCM1_OC1M_POS (4U)
  1983. #define TIM_CCM1_OC1M_MASK (0x7UL << TIM_CCM1_OC1M_POS) /**< 0x00000070 */
  1984. #define TIM_CCM1_OC1M TIM_CCM1_OC1M_MASK /**< OC1M[2:0] bits (output compare 1 mode) */
  1985. #define TIM_CCM1_OC1M_FROZEN (0x00UL << TIM_CCM1_OC1M_POS) /**< 0x00000000 */
  1986. #define TIM_CCM1_OC1M_ACTIVE (0x01UL << TIM_CCM1_OC1M_POS) /**< 0x00000010 */
  1987. #define TIM_CCM1_OC1M_INACTIVE (0x02UL << TIM_CCM1_OC1M_POS) /**< 0x00000020 */
  1988. #define TIM_CCM1_OC1M_TOGGLE (0x03UL << TIM_CCM1_OC1M_POS) /**< 0x00000030 */
  1989. #define TIM_CCM1_OC1M_FORCED_INACTIVE (0x04UL << TIM_CCM1_OC1M_POS) /**< 0x00000040 */
  1990. #define TIM_CCM1_OC1M_FORCED_ACTIVE (0x05UL << TIM_CCM1_OC1M_POS) /**< 0x00000050 */
  1991. #define TIM_CCM1_OC1M_PWM1 (0x06UL << TIM_CCM1_OC1M_POS) /**< 0x00000060 */
  1992. #define TIM_CCM1_OC1M_PWM2 (0x07UL << TIM_CCM1_OC1M_POS) /**< 0x00000070 */
  1993. #define TIM_CCM1_OC1CE_POS (7U)
  1994. #define TIM_CCM1_OC1CE_MASK (0x1UL << TIM_CCM1_OC1CE_POS) /**< 0x00000080 */
  1995. #define TIM_CCM1_OC1CE TIM_CCM1_OC1CE_MASK /**<Output compare 1 clear enable */
  1996. #define TIM_CCM1_CC2S_POS (8U)
  1997. #define TIM_CCM1_CC2S_MASK (0x3UL << TIM_CCM1_CC2S_POS) /**< 0x00000300 */
  1998. #define TIM_CCM1_CC2S TIM_CCM1_CC2S_MASK /**< CC2S[1:0] bits (Capture/Compare 2 selection) */
  1999. #define TIM_CCM1_CC2S_DIRECTTI (0x1UL << TIM_CCM1_CC2S_POS) /**< 0x00000100 */
  2000. #define TIM_CCM1_CC2S_INDIRECTTI (0x2UL << TIM_CCM1_CC2S_POS) /**< 0x00000200 */
  2001. #define TIM_CCM1_CC2S_TRC (0x3UL << TIM_CCM1_CC2S_POS) /**< 0x00000300 */
  2002. #define TIM_CCM1_OC2FE_POS (10U)
  2003. #define TIM_CCM1_OC2FE_MASK (0x1UL << TIM_CCM1_OC2FE_POS) /**< 0x00000400 */
  2004. #define TIM_CCM1_OC2FE TIM_CCM1_OC2FE_MASK /**<Output compare 2 fast enable */
  2005. #define TIM_CCM1_OC2PE_POS (11U)
  2006. #define TIM_CCM1_OC2PE_MASK (0x1UL << TIM_CCM1_OC2PE_POS) /**< 0x00000800 */
  2007. #define TIM_CCM1_OC2PE TIM_CCM1_OC2PE_MASK /**<Output compare 2 preload enable */
  2008. #define TIM_CCM1_OC2M_POS (12U)
  2009. #define TIM_CCM1_OC2M_MASK (0x7UL << TIM_CCM1_OC2M_POS) /**< 0x00007000 */
  2010. #define TIM_CCM1_OC2M TIM_CCM1_OC2M_MASK /**< OC2M[2:0] bits (Output compare 2 mode) */
  2011. #define TIM_CCM1_OC2M_FROZEN (0x00UL << TIM_CCM1_OC2M_POS) /**< 0x00000000 */
  2012. #define TIM_CCM1_OC2M_ACTIVE (0x01UL << TIM_CCM1_OC2M_POS) /**< 0x00001000 */
  2013. #define TIM_CCM1_OC2M_INACTIVE (0x02UL << TIM_CCM1_OC2M_POS) /**< 0x00002000 */
  2014. #define TIM_CCM1_OC2M_TOGGLE (0x03UL << TIM_CCM1_OC2M_POS) /**< 0x00003000 */
  2015. #define TIM_CCM1_OC2M_FORCED_INACTIVE (0x04UL << TIM_CCM1_OC2M_POS) /**< 0x00004000 */
  2016. #define TIM_CCM1_OC2M_FORCED_ACTIVE (0x05UL << TIM_CCM1_OC2M_POS) /**< 0x00005000 */
  2017. #define TIM_CCM1_OC2M_PWM1 (0x06UL << TIM_CCM1_OC2M_POS) /**< 0x00006000 */
  2018. #define TIM_CCM1_OC2M_PWM2 (0x07UL << TIM_CCM1_OC2M_POS) /**< 0x00007000 */
  2019. #define TIM_CCM1_OC2CE_POS (15U)
  2020. #define TIM_CCM1_OC2CE_MASK (0x1UL << TIM_CCM1_OC2CE_POS) /**< 0x00008000 */
  2021. #define TIM_CCM1_OC2CE TIM_CCM1_OC2CE_MASK /**< Output compare 2 clear enable */
  2022. /* input and output multiplex*/
  2023. #define TIM_CCM1_IC1PSC_POS (2U)
  2024. #define TIM_CCM1_IC1PSC_MASK (0x3UL << TIM_CCM1_IC1PSC_POS) /**< 0x0000000C */
  2025. #define TIM_CCM1_IC1PSC TIM_CCM1_IC1PSC_MASK /**< IC1PSC[1:0] bits (Input capture 1 prescaler) */
  2026. #define TIM_CCM1_IC1PSC_DIV1 (0x0UL << TIM_CCM1_IC1PSC_POS) /**< 0x00000000 */
  2027. #define TIM_CCM1_IC1PSC_DIV2 (0x1UL << TIM_CCM1_IC1PSC_POS) /**< 0x00000004 */
  2028. #define TIM_CCM1_IC1PSC_DIV4 (0x2UL << TIM_CCM1_IC1PSC_POS) /**< 0x00000008 */
  2029. #define TIM_CCM1_IC1PSC_DIV8 (0x3UL << TIM_CCM1_IC1PSC_POS) /**< 0x0000000C */
  2030. #define TIM_CCM1_IC1F_POS (4U)
  2031. #define TIM_CCM1_IC1F_MASK (0x7UL << TIM_CCM1_IC1F_POS) /**< 0x00000070 */
  2032. #define TIM_CCM1_IC1F TIM_CCM1_IC1F_MASK /**< IC1F[2:0] bits (Input capture 1 filter) */
  2033. #define TIM_CCM1_IC1F_FILT_DIV1 (0x01UL << TIM_CCM1_IC1F_POS) /**< 0x00000010 */
  2034. #define TIM_CCM1_IC1F_FILT_DIV2 (0x02UL << TIM_CCM1_IC1F_POS) /**< 0x00000020 */
  2035. #define TIM_CCM1_IC1F_FILT_DIV4 (0x03UL << TIM_CCM1_IC1F_POS) /**< 0x00000030 */
  2036. #define TIM_CCM1_IC1F_FILT_DIV8 (0x04UL << TIM_CCM1_IC1F_POS) /**< 0x00000040 */
  2037. #define TIM_CCM1_IC1F_FILT_DIV16 (0x05UL << TIM_CCM1_IC1F_POS) /**< 0x00000050 */
  2038. #define TIM_CCM1_IC1F_FILT_DIV32 (0x06UL << TIM_CCM1_IC1F_POS) /**< 0x00000060 */
  2039. #define TIM_CCM1_IC2PSC_POS (10U)
  2040. #define TIM_CCM1_IC2PSC_MASK (0x3UL << TIM_CCM1_IC2PSC_POS) /**< 0x00000C00 */
  2041. #define TIM_CCM1_IC2PSC TIM_CCM1_IC2PSC_MASK /**< IC2PSC[1:0] bits (Input capture 2 prescaler) */
  2042. #define TIM_CCM1_IC2PSC_DIV1 (0x0UL << TIM_CCM1_IC2PSC_POS) /**< 0x00000000 */
  2043. #define TIM_CCM1_IC2PSC_DIV2 (0x1UL << TIM_CCM1_IC2PSC_POS) /**< 0x00000400 */
  2044. #define TIM_CCM1_IC2PSC_DIV4 (0x2UL << TIM_CCM1_IC2PSC_POS) /**< 0x00000800 */
  2045. #define TIM_CCM1_IC2PSC_DIV8 (0x3UL << TIM_CCM1_IC2PSC_POS) /**< 0x00000C00 */
  2046. #define TIM_CCM1_IC2F_POS (12U)
  2047. #define TIM_CCM1_IC2F_MASK (0x7UL << TIM_CCM1_IC2F_POS) /**< 0x0000F000 */
  2048. #define TIM_CCM1_IC2F TIM_CCM1_IC2F_MASK /**< IC2F[2:0] bits (Input capture 2 filter) */
  2049. #define TIM_CCM1_IC2F_FILT_DIV1 (0x01UL << TIM_CCM1_IC2F_POS) /**< 0x00001000 */
  2050. #define TIM_CCM1_IC2F_FILT_DIV2 (0x02UL << TIM_CCM1_IC2F_POS) /**< 0x00002000 */
  2051. #define TIM_CCM1_IC2F_FILT_DIV4 (0x03UL << TIM_CCM1_IC2F_POS) /**< 0x00003000 */
  2052. #define TIM_CCM1_IC2F_FILT_DIV8 (0x04UL << TIM_CCM1_IC2F_POS) /**< 0x00004000 */
  2053. #define TIM_CCM1_IC2F_FILT_DIV16 (0x05UL << TIM_CCM1_IC2F_POS) /**< 0x00005000 */
  2054. #define TIM_CCM1_IC2F_FILT_DIV32 (0x06UL << TIM_CCM1_IC2F_POS) /**< 0x00006000 */
  2055. /* Bits for TIM_CCM2 */
  2056. #define TIM_CCM2_OC3FE_POS (2U)
  2057. #define TIM_CCM2_OC3FE_MASK (0x1UL << TIM_CCM2_OC3FE_POS) /**< 0x00000004 */
  2058. #define TIM_CCM2_OC3FE TIM_CCM2_OC3FE_MASK /**< Output Compare 3 fast enable */
  2059. #define TIM_CCM2_OC3PE_POS (3U)
  2060. #define TIM_CCM2_OC3PE_MASK (0x1UL << TIM_CCM2_OC3PE_POS) /**< 0x00000008 */
  2061. #define TIM_CCM2_OC3PE TIM_CCM2_OC3PE_MASK /**< Output Compare 3 preload enable */
  2062. #define TIM_CCM2_OC3M_POS (4U)
  2063. #define TIM_CCM2_OC3M_MASK (0x7UL << TIM_CCM2_OC3M_POS) /**< 0x00010070 */
  2064. #define TIM_CCM2_OC3M TIM_CCM2_OC3M_MASK /**< OC3M[2:0] bits (Output compare 3 mode) */
  2065. #define TIM_CCM2_OC3M_FROZEN (0x00UL << TIM_CCM2_OC3M_POS) /**< 0x00000000 */
  2066. #define TIM_CCM2_OC3M_ACTIVE (0x01UL << TIM_CCM2_OC3M_POS) /**< 0x00000010 */
  2067. #define TIM_CCM2_OC3M_INACTIVE (0x02UL << TIM_CCM2_OC3M_POS) /**< 0x00000020 */
  2068. #define TIM_CCM2_OC3M_TOGGLE (0x03UL << TIM_CCM2_OC3M_POS) /**< 0x00000030 */
  2069. #define TIM_CCM2_OC3M_FORCED_INACTIVE (0x04UL << TIM_CCM2_OC3M_POS) /**< 0x00000040 */
  2070. #define TIM_CCM2_OC3M_FORCED_ACTIVE (0x05UL << TIM_CCM2_OC3M_POS) /**< 0x00000050 */
  2071. #define TIM_CCM2_OC3M_PWM1 (0x06UL << TIM_CCM2_OC3M_POS) /**< 0x00000060 */
  2072. #define TIM_CCM2_OC3M_PWM2 (0x07UL << TIM_CCM2_OC3M_POS) /**< 0x00000070 */
  2073. #define TIM_CCM2_OC3CE_POS (7U)
  2074. #define TIM_CCM2_OC3CE_MASK (0x1UL << TIM_CCM2_OC3CE_POS) /**< 0x00000080 */
  2075. #define TIM_CCM2_OC3CE TIM_CCM2_OC3CE_MASK /**< Output compare 3 clear enable */
  2076. #define TIM_CCM2_OC4FE_POS (10U)
  2077. #define TIM_CCM2_OC4FE_MASK (0x1UL << TIM_CCM2_OC4FE_POS) /**< 0x00000400 */
  2078. #define TIM_CCM2_OC4FE TIM_CCM2_OC4FE_MASK /**< Output compare 4 fast enable */
  2079. #define TIM_CCM2_OC4PE_POS (11U)
  2080. #define TIM_CCM2_OC4PE_MASK (0x1UL << TIM_CCM2_OC4PE_POS) /**< 0x00000800 */
  2081. #define TIM_CCM2_OC4PE TIM_CCM2_OC4PE_MASK /**< Output compare 4 preload enable */
  2082. #define TIM_CCM2_OC4M_POS (12U)
  2083. #define TIM_CCM2_OC4M_MASK (0x7UL << TIM_CCM2_OC4M_POS) /**< 0x01007000 */
  2084. #define TIM_CCM2_OC4M TIM_CCM2_OC4M_MASK /**< OC4M[2:0] bits (Output compare 4 mode) */
  2085. #define TIM_CCM2_OC4M_FROZEN (0x00UL << TIM_CCM2_OC4M_POS) /**< 0x00000000 */
  2086. #define TIM_CCM2_OC4M_ACTIVE (0x01UL << TIM_CCM2_OC4M_POS) /**< 0x00001000 */
  2087. #define TIM_CCM2_OC4M_INACTIVE (0x02UL << TIM_CCM2_OC4M_POS) /**< 0x00002000 */
  2088. #define TIM_CCM2_OC4M_TOGGLE (0x03UL << TIM_CCM2_OC4M_POS) /**< 0x00003000 */
  2089. #define TIM_CCM2_OC4M_FORCED_INACTIVE (0x04UL << TIM_CCM2_OC4M_POS) /**< 0x00004000 */
  2090. #define TIM_CCM2_OC4M_FORCED_ACTIVE (0x05UL << TIM_CCM2_OC4M_POS) /**< 0x00005000 */
  2091. #define TIM_CCM2_OC4M_PWM1 (0x06UL << TIM_CCM2_OC4M_POS) /**< 0x00006000 */
  2092. #define TIM_CCM2_OC4M_PWM2 (0x07UL << TIM_CCM2_OC4M_POS) /**< 0x00007000 */
  2093. #define TIM_CCM2_OC4CE_POS (15U)
  2094. #define TIM_CCM2_OC4CE_MASK (0x1UL << TIM_CCM2_OC4CE_POS) /**< 0x00008000 */
  2095. #define TIM_CCM2_OC4CE TIM_CCM2_OC4CE_MASK /**<Output compare 4 clear enable */
  2096. /* Bits for TIM_CCEN */
  2097. #define TIM_CCEN_CC1E_POS (0U)
  2098. #define TIM_CCEN_CC1E_MASK (0x1UL << TIM_CCEN_CC1E_POS) /**< 0x00000001 */
  2099. #define TIM_CCEN_CC1E TIM_CCEN_CC1E_MASK /**<Capture/Compare 1 output enable */
  2100. #define TIM_CCEN_CC1P_POS (1U)
  2101. #define TIM_CCEN_CC1P_MASK (0x1UL << TIM_CCEN_CC1P_POS) /**< 0x00000002 */
  2102. #define TIM_CCEN_CC1P TIM_CCEN_CC1P_MASK /**<Capture/Compare 1 output Polarity */
  2103. #define TIM_CCEN_CC1NE_POS (2U)
  2104. #define TIM_CCEN_CC1NE_MASK (0x1UL << TIM_CCEN_CC1NE_POS) /**< 0x00000004 */
  2105. #define TIM_CCEN_CC1NE TIM_CCEN_CC1NE_MASK /**<Capture/Compare 1 complementary output enable */
  2106. #define TIM_CCEN_CC1NP_POS (3U)
  2107. #define TIM_CCEN_CC1NP_MASK (0x1UL << TIM_CCEN_CC1NP_POS) /**< 0x00000008 */
  2108. #define TIM_CCEN_CC1NP TIM_CCEN_CC1NP_MASK /**<Capture/Compare 1 complementary output Polarity */
  2109. #define TIM_CCEN_CC2E_POS (4U)
  2110. #define TIM_CCEN_CC2E_MASK (0x1UL << TIM_CCEN_CC2E_POS) /**< 0x00000010 */
  2111. #define TIM_CCEN_CC2E TIM_CCEN_CC2E_MASK /**<Capture/Compare 2 output enable */
  2112. #define TIM_CCEN_CC2P_POS (5U)
  2113. #define TIM_CCEN_CC2P_MASK (0x1UL << TIM_CCEN_CC2P_POS) /**< 0x00000020 */
  2114. #define TIM_CCEN_CC2P TIM_CCEN_CC2P_MASK /**<Capture/Compare 2 output Polarity */
  2115. #define TIM_CCEN_CC2NE_POS (6U)
  2116. #define TIM_CCEN_CC2NE_MASK (0x1UL << TIM_CCEN_CC2NE_POS) /**< 0x00000040 */
  2117. #define TIM_CCEN_CC2NE TIM_CCEN_CC2NE_MASK /**<Capture/Compare 2 complementary output enable */
  2118. #define TIM_CCEN_CC2NP_POS (7U)
  2119. #define TIM_CCEN_CC2NP_MASK (0x1UL << TIM_CCEN_CC2NP_POS) /**< 0x00000080 */
  2120. #define TIM_CCEN_CC2NP TIM_CCEN_CC2NP_MASK /**<Capture/Compare 2 complementary output Polarity */
  2121. #define TIM_CCEN_CC3E_POS (8U)
  2122. #define TIM_CCEN_CC3E_MASK (0x1UL << TIM_CCEN_CC3E_POS) /**< 0x00000100 */
  2123. #define TIM_CCEN_CC3E TIM_CCEN_CC3E_MASK /**<Capture/Compare 3 output enable */
  2124. #define TIM_CCEN_CC3P_POS (9U)
  2125. #define TIM_CCEN_CC3P_MASK (0x1UL << TIM_CCEN_CC3P_POS) /**< 0x00000200 */
  2126. #define TIM_CCEN_CC3P TIM_CCEN_CC3P_MASK /**<Capture/Compare 3 output Polarity */
  2127. #define TIM_CCEN_CC3NE_POS (10U)
  2128. #define TIM_CCEN_CC3NE_MASK (0x1UL << TIM_CCEN_CC3NE_POS) /**< 0x00000400 */
  2129. #define TIM_CCEN_CC3NE TIM_CCEN_CC3NE_MASK /**<Capture/Compare 3 complementary output enable */
  2130. #define TIM_CCEN_CC3NP_POS (11U)
  2131. #define TIM_CCEN_CC3NP_MASK (0x1UL << TIM_CCEN_CC3NP_POS) /**< 0x00000800 */
  2132. #define TIM_CCEN_CC3NP TIM_CCEN_CC3NP_MASK /**<Capture/Compare 3 complementary output polarity */
  2133. #define TIM_CCEN_CC4E_POS (12U)
  2134. #define TIM_CCEN_CC4E_MASK (0x1UL << TIM_CCEN_CC4E_POS) /**< 0x00001000 */
  2135. #define TIM_CCEN_CC4E TIM_CCEN_CC4E_MASK /**<Capture/Compare 4 output enable */
  2136. #define TIM_CCEN_CC4P_POS (13U)
  2137. #define TIM_CCEN_CC4P_MASK (0x1UL << TIM_CCEN_CC4P_POS) /**< 0x00002000 */
  2138. #define TIM_CCEN_CC4P TIM_CCEN_CC4P_MASK /**<Capture/Compare 4 output Polarity */
  2139. /* Bits for TIM_CNT */
  2140. #define TIM_CNT_CNT_POS (0U)
  2141. #define TIM_CNT_CNT_MASK (0xFFFFUL << TIM_CNT_CNT_POS) /**< 0x0000FFFF */
  2142. #define TIM_CNT_CNT TIM_CNT_CNT_MASK /**<Counter value */
  2143. /* Bits for TIM_PSC */
  2144. #define TIM_PSC_PSC_POS (0U)
  2145. #define TIM_PSC_PSC_MASK (0xFFFFUL << TIM_PSC_PSC_POS) /**< note£ºTIM1£º0x0000FFFF; TIM3£º0x000000FF */
  2146. #define TIM_PSC_PSC TIM_PSC_PSC_MASK /**<Prescaler value */
  2147. /* Bits for TIM_ARR */
  2148. #define TIM_ARR_ARR_POS (0U)
  2149. #define TIM_ARR_ARR_MASK (0xFFFFUL << TIM_ARR_ARR_POS) /**< 0x0000FFFF */
  2150. #define TIM_ARR_ARR TIM_ARR_ARR_MASK /**< Actual auto-reload value */
  2151. /* Bits for TIM_RCR */
  2152. #define TIM_RCR_REP_POS (0U)
  2153. #define TIM_RCR_REP_MASK (0xFFUL << TIM_RCR_REP_POS) /**< 0x0000FF */
  2154. #define TIM_RCR_REP TIM_RCR_REP_MASK /**< Repetition Counter value */
  2155. /* Bits for TIM_CC1 */
  2156. #define TIM_CC1_CC1_POS (0U)
  2157. #define TIM_CC1_CC1_MASK (0xFFFFUL << TIM_CC1_CC1_POS) /**< 0x0000FFFF */
  2158. #define TIM_CC1_CC1 TIM_CC1_CC1_MASK /**<Capture/Compare 1 value */
  2159. /* Bits for TIM_CC2 */
  2160. #define TIM_CC2_CC2_POS (0U)
  2161. #define TIM_CC2_CC2_MASK (0xFFFFUL << TIM_CC2_CC2_POS) /**< 0x0000FFFF */
  2162. #define TIM_CC2_CC2 TIM_CC2_CC2_MASK /**<Capture/Compare 2 value */
  2163. /* Bits for TIM1_CC3 */
  2164. #define TIM1_CC3_CC3_POS (0U)
  2165. #define TIM1_CC3_CC3_MASK (0xFFFFUL << TIM1_CC3_CC3_POS) /**< 0x0000FFFF */
  2166. #define TIM1_CC3_CC3 TIM1_CC3_CC3_MASK /**<Capture/Compare 3 value */
  2167. /* Bits for TIM1_CC4 */
  2168. #define TIM1_CC4_CC4_POS (0U)
  2169. #define TIM1_CC4_CC4_MASK (0xFFFFUL << TIM1_CC4_CC4_POS) /**< 0x0000FFFF */
  2170. #define TIM1_CC4_CC4 TIM1_CC4_CC4_MASK /**< Capture/Compare 4 value */
  2171. /* Bits for TIM3_CC1_MODE1 */
  2172. #define TIM3_CC1_CC1_MODE1_POS (0U)
  2173. #define TIM3_CC1_CC1_MODE1_MASK (0xFFUL << TIM3_CC1_CC1_MODE1_POS) /**< 0x000000FF */
  2174. #define TIM3_CC1_CC1_MODE1 TIM3_CC1_CC1_MODE1_MASK /**<Capture/Compare 1 value */
  2175. /* Bits for TIM3_MODE1_CC2 */
  2176. #define TIM3_CC2_CC2_MODE1_POS (0U)
  2177. #define TIM3_CC2_CC2_MODE1_MASK (0xFFUL << TIM3_CC2_CC2_MODE1_POS) /**< 0x000000FF */
  2178. #define TIM3_CC2_CC2_MODE1 TIM3_CC2_CC2_MODE1_MASK /**<Capture/Compare 2 value */
  2179. /* Bits for TIM3_MODE1_CC3 */
  2180. #define TIM3_CC1_CC3_MODE1_POS (8U)
  2181. #define TIM3_CC1_CC3_MODE1_MASK (0xFFUL << TIM3_CC1_CC3_MODE1_POS) /**< 0x0000FF00 */
  2182. #define TIM3_CC1_CC3_MODE1 TIM3_CC1_CC3_MODE1_MASK /**<Capture/Compare 3 value */
  2183. /* Bits for TIM3_MODE1_CC4 */
  2184. #define TIM3_CC2_CC4_MODE1_POS (8U)
  2185. #define TIM3_CC2_CC4_MODE1_MASK (0xFFUL << TIM3_CC2_CC4_MODE1_POS) /**< 0x0000FF00 */
  2186. #define TIM3_CC2_CC4_MODE1 TIM3_CC2_CC4_MODE1_MASK /**<Capture/Compare 4 value */
  2187. /* Bits for TIM_BDT */
  2188. #define TIM_BDT_DTG_POS (0U)
  2189. #define TIM_BDT_DTG_MASK (0xFFUL << TIM_BDT_DTG_POS) /**< 0x000000FF */
  2190. #define TIM_BDT_DTG TIM_BDT_DTG_MASK /**< DTG[0:7] bits (Dead-Time generator set-up) */
  2191. #define TIM_BDT_LOCK_POS (8U)
  2192. #define TIM_BDT_LOCK_MASK (0x3UL << TIM_BDT_LOCK_POS) /**< 0x00000300 */
  2193. #define TIM_BDT_LOCK TIM_BDT_LOCK_MASK /**< LOCK[1:0] bits (Lock configuration) */
  2194. #define TIM_BDT_LOCK_LEVEL1 (0x1UL << TIM_BDT_LOCK_POS) /**< 0x00000100 */
  2195. #define TIM_BDT_LOCK_LEVEL2 (0x2UL << TIM_BDT_LOCK_POS) /**< 0x00000200 */
  2196. #define TIM_BDT_LOCK_LEVEL3 (0x3UL << TIM_BDT_LOCK_POS) /**< 0x00000300 */
  2197. #define TIM_BDT_OSSI_POS (10U)
  2198. #define TIM_BDT_OSSI_MASK (0x1UL << TIM_BDT_OSSI_POS) /**< 0x00000400 */
  2199. #define TIM_BDT_OSSI TIM_BDT_OSSI_MASK /**< Off-State selection for idle mode */
  2200. #define TIM_BDT_OSSR_POS (11U)
  2201. #define TIM_BDT_OSSR_MASK (0x1UL << TIM_BDT_OSSR_POS) /**< 0x00000800 */
  2202. #define TIM_BDT_OSSR TIM_BDT_OSSR_MASK /**< Off-State selection for run mode */
  2203. #define TIM_BDT_BKEN_POS (12U)
  2204. #define TIM_BDT_BKEN_MASK (0x1UL << TIM_BDT_BKEN_POS) /**< 0x00001000 */
  2205. #define TIM_BDT_BKEN TIM_BDT_BKEN_MASK /**< Break enable for break 1 */
  2206. #define TIM_BDT_AOEN_POS (14U)
  2207. #define TIM_BDT_AOEN_MASK (0x1UL << TIM_BDT_AOEN_POS) /**< 0x00004000 */
  2208. #define TIM_BDT_AOEN TIM_BDT_AOEN_MASK /**< Automatic output enable */
  2209. #define TIM_BDT_MOEN_POS (15U)
  2210. #define TIM_BDT_MOEN_MASK (0x1UL << TIM_BDT_MOEN_POS) /**< 0x00008000 */
  2211. #define TIM_BDT_MOEN TIM_BDT_MOEN_MASK /**< Main output enable */
  2212. /* Bits for TIM_CFG */
  2213. #define TIM_CFG_OCREF_CLR_POS (0U)
  2214. #define TIM_CFG_OCREF_CLR_MASK (0x1UL << TIM_CFG_OCREF_CLR_POS) /**< 0x00000001 */
  2215. #define TIM_CFG_OCREF_CLR TIM_CFG_OCREF_CLR_MASK /**<OCREF clear input selection */
  2216. /* BK Bits for TIM1_AF1 */
  2217. #define TIM1_AF1_BKINE_POS (0U)
  2218. #define TIM1_AF1_BKINE_MASK (0x1UL << TIM1_AF1_BKINE_POS) /**< 0x00000001 */
  2219. #define TIM1_AF1_BKINE TIM1_AF1_BKINE_MASK /**< BRK BKIN input enable */
  2220. #define TIM1_AF1_BKCMP1E_POS (1U)
  2221. #define TIM1_AF1_BKCMP1E_MASK (0x1UL << TIM1_AF1_BKCMP1E_POS) /**< 0x00000002 */
  2222. #define TIM1_AF1_BKCMP1E TIM1_AF1_BKCMP1E_MASK /**< BRK COMP1 enable */
  2223. #define TIM1_AF1_BKCMP2E_POS (2U)
  2224. #define TIM1_AF1_BKCMP2E_MASK (0x1UL << TIM1_AF1_BKCMP2E_POS) /**< 0x00000004 */
  2225. #define TIM1_AF1_BKCMP2E TIM1_AF1_BKCMP2E_MASK /**< BRK COMP2 enable */
  2226. #define TIM1_AF1_LOCKUP_LOCK_POS (7U)
  2227. #define TIM1_AF1_LOCKUP_LOCK_MASK (0x1UL << TIM1_AF1_LOCKUP_LOCK_POS) /**< 0x00000080 */
  2228. #define TIM1_AF1_LOCKUP_LOCK TIM1_AF1_LOCKUP_LOCK_MASK /**< LOCKUP LOCK enable */
  2229. #define TIM1_AF1_BKINP_POS (9U)
  2230. #define TIM1_AF1_BKINP_MASK (0x1UL << TIM1_AF1_BKINP_POS) /**< 0x00000200 */
  2231. #define TIM1_AF1_BKINP TIM1_AF1_BKINP_MASK /**< BRK BKIN input polarity */
  2232. #define TIM1_AF1_BKCMP1P_POS (10U)
  2233. #define TIM1_AF1_BKCMP1P_MASK (0x1UL << TIM1_AF1_BKCMP1P_POS) /**< 0x00000400 */
  2234. #define TIM1_AF1_BKCMP1P TIM1_AF1_BKCMP1P_MASK /**< BRK COMP1 input polarity */
  2235. #define TIM1_AF1_BKCMP2P_POS (11U)
  2236. #define TIM1_AF1_BKCMP2P_MASK (0x1UL << TIM1_AF1_BKCMP2P_POS) /**< 0x00000800 */
  2237. #define TIM1_AF1_BKCMP2P TIM1_AF1_BKCMP2P_MASK /**< BRK COMP2 input polarity */
  2238. /* Bits for TIM_TISEL */
  2239. #define TIM_TISEL_TI1_SEL_POS (0U)
  2240. #define TIM_TISEL_TI1_SEL_MASK (0x1UL << TIM_TISEL_TI1_SEL_POS) /**< 0x00000001 */
  2241. #define TIM_TISEL_TI1_SEL TIM_TISEL_TI1_SEL_MASK /**<TI1_SEL bits (TIM1 TI1 SEL)*/
  2242. #define TIM_TISEL_TI1_SEL_CH1 (0x0UL << TIM_TISEL_TI1_SEL_POS) /**< 0x00000000 */
  2243. #define TIM_TISEL_TI1_SEL_COMP1 (0x1UL << TIM_TISEL_TI1_SEL_POS) /**< 0x00000001 */
  2244. #define TIM_TISEL_TI2_SEL_POS (8U)
  2245. #define TIM_TISEL_TI2_SEL_MASK (0x1UL << TIM_TISEL_TI2_SEL_POS) /**< 0x00000100 */
  2246. #define TIM_TISEL_TI2_SEL TIM_TISEL_TI2_SEL_MASK /**<TI2_SEL bits (TIM1 TI2 SEL)*/
  2247. #define TIM_TISEL_TI2_SEL_CH2 (0x0UL << TIM_TISEL_TI2_SEL_POS) /**< 0x00000000 */
  2248. #define TIM_TISEL_TI2_SEL_COMP2 (0x1UL << TIM_TISEL_TI2_SEL_POS) /**< 0x00000001 */
  2249. /*-----------------------------------------------------------------------------------------------
  2250. UART Registers Bits
  2251. ------------------------------------------------------------------------------------------------*/
  2252. /* Bits for UART_CR1 */
  2253. #define UART_CR1_UE_POS (0U)
  2254. #define UART_CR1_UE_MASK (0x1UL << UART_CR1_UE_POS) /**< 0x00000001 */
  2255. #define UART_CR1_UE UART_CR1_UE_MASK /**< UART enable */
  2256. #define UART_CR1_RE_POS (2U)
  2257. #define UART_CR1_RE_MASK (0x1UL << UART_CR1_RE_POS) /**< 0x00000004 */
  2258. #define UART_CR1_RE UART_CR1_RE_MASK /**< Receiver enable */
  2259. #define UART_CR1_TE_POS (3U)
  2260. #define UART_CR1_TE_MASK (0x1UL << UART_CR1_TE_POS) /**< 0x00000008 */
  2261. #define UART_CR1_TE UART_CR1_TE_MASK /**< Transmitter enable */
  2262. #define UART_CR1_RXNEIE_POS (5U)
  2263. #define UART_CR1_RXNEIE_MASK (0x1UL << UART_CR1_RXNEIE_POS) /**< 0x00000020 */
  2264. #define UART_CR1_RXNEIE UART_CR1_RXNEIE_MASK /**< Read data register not empty interrupt enable */
  2265. #define UART_CR1_TCIE_POS (6U)
  2266. #define UART_CR1_TCIE_MASK (0x1UL << UART_CR1_TCIE_POS) /**< 0x00000040 */
  2267. #define UART_CR1_TCIE UART_CR1_TCIE_MASK /**< Transmission Complete interrupt enable */
  2268. #define UART_CR1_TXEIE_POS (7U)
  2269. #define UART_CR1_TXEIE_MASK (0x1UL << UART_CR1_TXEIE_POS) /**< 0x00000080 */
  2270. #define UART_CR1_TXEIE UART_CR1_TXEIE_MASK /**< Transmit Data Register empty interrupt enable */
  2271. #define UART_CR1_PEIE_POS (8U)
  2272. #define UART_CR1_PEIE_MASK (0x1UL << UART_CR1_PEIE_POS) /**< 0x00000100 */
  2273. #define UART_CR1_PEIE UART_CR1_PEIE_MASK /**< PE interrupt enable */
  2274. #define UART_CR1_PTS_POS (9U)
  2275. #define UART_CR1_PTS_MASK (0x1UL << UART_CR1_PTS_POS) /**< 0x00000200 */
  2276. #define UART_CR1_PTS UART_CR1_PTS_MASK /**< Parity selection */
  2277. #define UART_CR1_PEN_POS (10U)
  2278. #define UART_CR1_PEN_MASK (0x1UL << UART_CR1_PEN_POS) /**< 0x00000400 */
  2279. #define UART_CR1_PEN UART_CR1_PEN_MASK /**< Parity control enable */
  2280. #define UART_CR1_WL_POS (12U)
  2281. #define UART_CR1_WL_MASK (0x1UL << UART_CR1_WL_POS)
  2282. #define UART_CR1_WL UART_CR1_WL_MASK /**< Word length */
  2283. #define UART_CR1_WL8BITS (0x0UL << UART_CR1_WL_POS) /**< 0x00000000 */
  2284. #define UART_CR1_WL9BITS UART_CR1_WL_MASK /**< 0x00001000 */
  2285. /* Bits for UART_CR2 */
  2286. #define UART_CR2_STOPBIT_POS (13U)
  2287. #define UART_CR2_STOPBIT_MASK (0x1UL << UART_CR2_STOPBIT_POS) /**< 0x00002000 */
  2288. #define UART_CR2_STOPBIT UART_CR2_STOPBIT_MASK /**< STOP[1:0] bits (STOP bits) */
  2289. #define UART_CR2_STOPBIT_1 (0x0UL << UART_CR2_STOPBIT_POS) /**< 0x00000000 */
  2290. #define UART_CR2_STOPBIT_2 (0x1UL << UART_CR2_STOPBIT_POS) /**< 0x00002000 */
  2291. #define UART_CR2_SWAP_POS (15U)
  2292. #define UART_CR2_SWAP_MASK (0x1UL << UART_CR2_SWAP_POS) /**< 0x00008000 */
  2293. #define UART_CR2_SWAP UART_CR2_SWAP_MASK /**< SWAP TX/RX pins */
  2294. #define UART_CR2_RXIVC_POS (16U)
  2295. #define UART_CR2_RXIVC_MASK (0x1UL << UART_CR2_RXIVC_POS) /**< 0x00010000 */
  2296. #define UART_CR2_RXIVC UART_CR2_RXIVC_MASK /**< RX pin active level inversion */
  2297. #define UART_CR2_TXIVC_POS (17U)
  2298. #define UART_CR2_TXIVC_MASK (0x1UL << UART_CR2_TXIVC_POS) /**< 0x00020000 */
  2299. #define UART_CR2_TXIVC UART_CR2_TXIVC_MASK /**< TX pin active level inversion */
  2300. #define UART_CR2_DATAIVC_POS (18U)
  2301. #define UART_CR2_DATAIVC_MASK (0x1UL << UART_CR2_DATAIVC_POS) /**< 0x00040000 */
  2302. #define UART_CR2_DATAIVC UART_CR2_DATAIVC_MASK /**< Binary data inversion */
  2303. #define UART_CR2_MSBFIRST_POS (19U)
  2304. #define UART_CR2_MSBFIRST_MASK (0x1UL << UART_CR2_MSBFIRST_POS) /**< 0x00080000 */
  2305. #define UART_CR2_MSBFIRST UART_CR2_MSBFIRST_MASK /**< Most significant bit first */
  2306. /* Bits for UART_CR3 */
  2307. #define UART_CR3_EIE_POS (0U)
  2308. #define UART_CR3_EIE_MASK (0x1UL << UART_CR3_EIE_POS) /**< 0x00000001 */
  2309. #define UART_CR3_EIE UART_CR3_EIE_MASK /**< Error interrupt enable */
  2310. #define UART_CR3_HDEN_POS (3U)
  2311. #define UART_CR3_HDEN_MASK (0x1UL << UART_CR3_HDEN_POS) /**< 0x00000008 */
  2312. #define UART_CR3_HDEN UART_CR3_HDEN_MASK /**< Half-Duplex selection */
  2313. #define UART_CR3_OBS_POS (11U)
  2314. #define UART_CR3_OBS_MASK (0x1UL << UART_CR3_OBS_POS) /**< 0x00000800 */
  2315. #define UART_CR3_OBS UART_CR3_OBS_MASK /**< One sample bit method enable */
  2316. #define UART_CR3_ORED_POS (12U)
  2317. #define UART_CR3_ORED_MASK (0x1UL << UART_CR3_ORED_POS) /**< 0x00001000 */
  2318. #define UART_CR3_ORED UART_CR3_ORED_MASK /**< Overrun disable */
  2319. /* Bits for UART_BRR */
  2320. #define UART_BRR_BRR_POS (0U)
  2321. #define UART_BRR_BRR_MASK (0xFFFFUL << UART_BRR_BRR_POS) /**< 0x0000FFFF */
  2322. #define UART_BRR_BRR UART_BRR_BRR_MASK /**< UART baud rate register [15:0] */
  2323. /* Bits for UART_ISR */
  2324. #define UART_ISR_PE_POS (0U)
  2325. #define UART_ISR_PE_MASK (0x1UL << UART_ISR_PE_POS) /**< 0x00000001 */
  2326. #define UART_ISR_PE UART_ISR_PE_MASK /**< Parity error */
  2327. #define UART_ISR_FE_POS (1U)
  2328. #define UART_ISR_FE_MASK (0x1UL << UART_ISR_FE_POS) /**< 0x00000002 */
  2329. #define UART_ISR_FE UART_ISR_FE_MASK /**< Framing error */
  2330. #define UART_ISR_NOISE_POS (2U)
  2331. #define UART_ISR_NOISE_MASK (0x1UL << UART_ISR_NOISE_POS) /**< 0x00000004 */
  2332. #define UART_ISR_NOISE UART_ISR_NOISE_MASK /**< Noise detected flag */
  2333. #define UART_ISR_ORE_POS (3U)
  2334. #define UART_ISR_ORE_MASK (0x1UL << UART_ISR_ORE_POS) /**< 0x00000008 */
  2335. #define UART_ISR_ORE UART_ISR_ORE_MASK /**< OverRun error */
  2336. #define UART_ISR_RXNE_POS (5U)
  2337. #define UART_ISR_RXNE_MASK (0x1UL << UART_ISR_RXNE_POS) /**< 0x00000020 */
  2338. #define UART_ISR_RXNE UART_ISR_RXNE_MASK /**< Read data register not empty */
  2339. #define UART_ISR_TC_POS (6U)
  2340. #define UART_ISR_TC_MASK (0x1UL << UART_ISR_TC_POS) /**< 0x00000040 */
  2341. #define UART_ISR_TC UART_ISR_TC_MASK /**< Transmission complete */
  2342. #define UART_ISR_TXE_POS (7U)
  2343. #define UART_ISR_TXE_MASK (0x1UL << UART_ISR_TXE_POS) /**< 0x00000080 */
  2344. #define UART_ISR_TXE UART_ISR_TXE_MASK /**< Transmit data register empty */
  2345. #define UART_ISR_BUSY_POS (16U)
  2346. #define UART_ISR_BUSY_MASK (0x1UL << UART_ISR_BUSY_POS) /**< 0x00010000 */
  2347. #define UART_ISR_BUSY UART_ISR_BUSY_MASK /**< Busy flag */
  2348. /* Bits for UART_ICR */
  2349. #define UART_ICR_PECF_POS (0U)
  2350. #define UART_ICR_PECF_MASK (0x1UL << UART_ICR_PECF_POS) /**< 0x00000001 */
  2351. #define UART_ICR_PECF UART_ICR_PECF_MASK /**< Parity error clear flag */
  2352. #define UART_ICR_FECF_POS (1U)
  2353. #define UART_ICR_FECF_MASK (0x1UL << UART_ICR_FECF_POS) /**< 0x00000002 */
  2354. #define UART_ICR_FECF UART_ICR_FECF_MASK /**< Framing error clear flag */
  2355. #define UART_ICR_NOISECF_POS (2U)
  2356. #define UART_ICR_NOISECF_MASK (0x1UL << UART_ICR_NOISECF_POS) /**< 0x00000004 */
  2357. #define UART_ICR_NOISECF UART_ICR_NOISECF_MASK /**< Noise error detected clear flag */
  2358. #define UART_ICR_ORECF_POS (3U)
  2359. #define UART_ICR_ORECF_MASK (0x1UL << UART_ICR_ORECF_POS) /**< 0x00000008 */
  2360. #define UART_ICR_ORECF UART_ICR_ORECF_MASK /**< OverRun error clear flag*/
  2361. #define UART_ICR_TCCF_POS (6U)
  2362. #define UART_ICR_TCCF_MASK (0x1UL << UART_ICR_TCCF_POS) /**< 0x00000040 */
  2363. #define UART_ICR_TCCF UART_ICR_TCCF_MASK /**< Transmission complete clear flag */
  2364. /* Bits for UART_RDR */
  2365. #define UART_RDR_RDR_POS (0U)
  2366. #define UART_RDR_RDR_MASK (0x1FFUL << UART_RDR_RDR_POS) /**< 0x000001FF */
  2367. #define UART_RDR_RDR UART_RDR_RDR_MASK /**< RDR[8:0] bits (Receive data value) */
  2368. /* Bits for UART_TDR */
  2369. #define UART_TDR_TDR_POS (0U)
  2370. #define UART_TDR_TDR_MASK (0x1FFUL << UART_TDR_TDR_POS) /**< 0x000001FF */
  2371. #define UART_TDR_TDR UART_TDR_TDR_MASK /**< TDR[8:0] bits (Transmit data value) */
  2372. /**
  2373. * @}
  2374. */
  2375. #ifdef __cplusplus
  2376. }
  2377. #endif /* __cplusplus */
  2378. /**
  2379. * @}
  2380. */
  2381. /**
  2382. * @}
  2383. */
  2384. #endif /* CIU32F003_H */