stm32f401xc.h 339 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779
  1. /**
  2. ******************************************************************************
  3. * @file stm32f401xc.h
  4. * @author MCD Application Team
  5. * @version V2.4.2
  6. * @date 13-November-2015
  7. * @brief CMSIS STM32F401xCxx Device Peripheral Access Layer Header File.
  8. *
  9. * This file contains:
  10. * - Data structures and the address mapping for all peripherals
  11. * - Peripheral's registers declarations and bits definition
  12. * - Macros to access peripheral’s registers hardware
  13. *
  14. ******************************************************************************
  15. * @attention
  16. *
  17. * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
  18. *
  19. * Redistribution and use in source and binary forms, with or without modification,
  20. * are permitted provided that the following conditions are met:
  21. * 1. Redistributions of source code must retain the above copyright notice,
  22. * this list of conditions and the following disclaimer.
  23. * 2. Redistributions in binary form must reproduce the above copyright notice,
  24. * this list of conditions and the following disclaimer in the documentation
  25. * and/or other materials provided with the distribution.
  26. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  27. * may be used to endorse or promote products derived from this software
  28. * without specific prior written permission.
  29. *
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  31. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  32. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  33. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  34. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  36. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  37. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  38. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  39. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. *
  41. ******************************************************************************
  42. */
  43. /** @addtogroup CMSIS
  44. * @{
  45. */
  46. /** @addtogroup stm32f401xc
  47. * @{
  48. */
  49. #ifndef __STM32F401xC_H
  50. #define __STM32F401xC_H
  51. #ifdef __cplusplus
  52. extern "C" {
  53. #endif /* __cplusplus */
  54. /** @addtogroup Configuration_section_for_CMSIS
  55. * @{
  56. */
  57. /**
  58. * @brief Configuration of the Cortex-M4 Processor and Core Peripherals
  59. */
  60. #define __CM4_REV 0x0001 /*!< Core revision r0p1 */
  61. #define __MPU_PRESENT 1 /*!< STM32F4XX provides an MPU */
  62. #define __NVIC_PRIO_BITS 4 /*!< STM32F4XX uses 4 Bits for the Priority Levels */
  63. #define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */
  64. #define __FPU_PRESENT 1 /*!< FPU present */
  65. /**
  66. * @}
  67. */
  68. /** @addtogroup Peripheral_interrupt_number_definition
  69. * @{
  70. */
  71. /**
  72. * @brief STM32F4XX Interrupt Number Definition, according to the selected device
  73. * in @ref Library_configuration_section
  74. */
  75. typedef enum
  76. {
  77. /****** Cortex-M4 Processor Exceptions Numbers ****************************************************************/
  78. NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
  79. MemoryManagement_IRQn = -12, /*!< 4 Cortex-M4 Memory Management Interrupt */
  80. BusFault_IRQn = -11, /*!< 5 Cortex-M4 Bus Fault Interrupt */
  81. UsageFault_IRQn = -10, /*!< 6 Cortex-M4 Usage Fault Interrupt */
  82. SVCall_IRQn = -5, /*!< 11 Cortex-M4 SV Call Interrupt */
  83. DebugMonitor_IRQn = -4, /*!< 12 Cortex-M4 Debug Monitor Interrupt */
  84. PendSV_IRQn = -2, /*!< 14 Cortex-M4 Pend SV Interrupt */
  85. SysTick_IRQn = -1, /*!< 15 Cortex-M4 System Tick Interrupt */
  86. /****** STM32 specific Interrupt Numbers **********************************************************************/
  87. WWDG_IRQn = 0, /*!< Window WatchDog Interrupt */
  88. PVD_IRQn = 1, /*!< PVD through EXTI Line detection Interrupt */
  89. TAMP_STAMP_IRQn = 2, /*!< Tamper and TimeStamp interrupts through the EXTI line */
  90. RTC_WKUP_IRQn = 3, /*!< RTC Wakeup interrupt through the EXTI line */
  91. FLASH_IRQn = 4, /*!< FLASH global Interrupt */
  92. RCC_IRQn = 5, /*!< RCC global Interrupt */
  93. EXTI0_IRQn = 6, /*!< EXTI Line0 Interrupt */
  94. EXTI1_IRQn = 7, /*!< EXTI Line1 Interrupt */
  95. EXTI2_IRQn = 8, /*!< EXTI Line2 Interrupt */
  96. EXTI3_IRQn = 9, /*!< EXTI Line3 Interrupt */
  97. EXTI4_IRQn = 10, /*!< EXTI Line4 Interrupt */
  98. DMA1_Stream0_IRQn = 11, /*!< DMA1 Stream 0 global Interrupt */
  99. DMA1_Stream1_IRQn = 12, /*!< DMA1 Stream 1 global Interrupt */
  100. DMA1_Stream2_IRQn = 13, /*!< DMA1 Stream 2 global Interrupt */
  101. DMA1_Stream3_IRQn = 14, /*!< DMA1 Stream 3 global Interrupt */
  102. DMA1_Stream4_IRQn = 15, /*!< DMA1 Stream 4 global Interrupt */
  103. DMA1_Stream5_IRQn = 16, /*!< DMA1 Stream 5 global Interrupt */
  104. DMA1_Stream6_IRQn = 17, /*!< DMA1 Stream 6 global Interrupt */
  105. ADC_IRQn = 18, /*!< ADC1, ADC2 and ADC3 global Interrupts */
  106. EXTI9_5_IRQn = 23, /*!< External Line[9:5] Interrupts */
  107. TIM1_BRK_TIM9_IRQn = 24, /*!< TIM1 Break interrupt and TIM9 global interrupt */
  108. TIM1_UP_TIM10_IRQn = 25, /*!< TIM1 Update Interrupt and TIM10 global interrupt */
  109. TIM1_TRG_COM_TIM11_IRQn = 26, /*!< TIM1 Trigger and Commutation Interrupt and TIM11 global interrupt */
  110. TIM1_CC_IRQn = 27, /*!< TIM1 Capture Compare Interrupt */
  111. TIM2_IRQn = 28, /*!< TIM2 global Interrupt */
  112. TIM3_IRQn = 29, /*!< TIM3 global Interrupt */
  113. TIM4_IRQn = 30, /*!< TIM4 global Interrupt */
  114. I2C1_EV_IRQn = 31, /*!< I2C1 Event Interrupt */
  115. I2C1_ER_IRQn = 32, /*!< I2C1 Error Interrupt */
  116. I2C2_EV_IRQn = 33, /*!< I2C2 Event Interrupt */
  117. I2C2_ER_IRQn = 34, /*!< I2C2 Error Interrupt */
  118. SPI1_IRQn = 35, /*!< SPI1 global Interrupt */
  119. SPI2_IRQn = 36, /*!< SPI2 global Interrupt */
  120. USART1_IRQn = 37, /*!< USART1 global Interrupt */
  121. USART2_IRQn = 38, /*!< USART2 global Interrupt */
  122. EXTI15_10_IRQn = 40, /*!< External Line[15:10] Interrupts */
  123. RTC_Alarm_IRQn = 41, /*!< RTC Alarm (A and B) through EXTI Line Interrupt */
  124. OTG_FS_WKUP_IRQn = 42, /*!< USB OTG FS Wakeup through EXTI line interrupt */
  125. DMA1_Stream7_IRQn = 47, /*!< DMA1 Stream7 Interrupt */
  126. SDIO_IRQn = 49, /*!< SDIO global Interrupt */
  127. TIM5_IRQn = 50, /*!< TIM5 global Interrupt */
  128. SPI3_IRQn = 51, /*!< SPI3 global Interrupt */
  129. DMA2_Stream0_IRQn = 56, /*!< DMA2 Stream 0 global Interrupt */
  130. DMA2_Stream1_IRQn = 57, /*!< DMA2 Stream 1 global Interrupt */
  131. DMA2_Stream2_IRQn = 58, /*!< DMA2 Stream 2 global Interrupt */
  132. DMA2_Stream3_IRQn = 59, /*!< DMA2 Stream 3 global Interrupt */
  133. DMA2_Stream4_IRQn = 60, /*!< DMA2 Stream 4 global Interrupt */
  134. OTG_FS_IRQn = 67, /*!< USB OTG FS global Interrupt */
  135. DMA2_Stream5_IRQn = 68, /*!< DMA2 Stream 5 global interrupt */
  136. DMA2_Stream6_IRQn = 69, /*!< DMA2 Stream 6 global interrupt */
  137. DMA2_Stream7_IRQn = 70, /*!< DMA2 Stream 7 global interrupt */
  138. USART6_IRQn = 71, /*!< USART6 global interrupt */
  139. I2C3_EV_IRQn = 72, /*!< I2C3 event interrupt */
  140. I2C3_ER_IRQn = 73, /*!< I2C3 error interrupt */
  141. FPU_IRQn = 81, /*!< FPU global interrupt */
  142. SPI4_IRQn = 84 /*!< SPI4 global Interrupt */
  143. } IRQn_Type;
  144. /**
  145. * @}
  146. */
  147. #include "core_cm4.h" /* Cortex-M4 processor and core peripherals */
  148. #include "system_stm32f4xx.h"
  149. #include <stdint.h>
  150. /** @addtogroup Peripheral_registers_structures
  151. * @{
  152. */
  153. /**
  154. * @brief Analog to Digital Converter
  155. */
  156. typedef struct
  157. {
  158. __IO uint32_t SR; /*!< ADC status register, Address offset: 0x00 */
  159. __IO uint32_t CR1; /*!< ADC control register 1, Address offset: 0x04 */
  160. __IO uint32_t CR2; /*!< ADC control register 2, Address offset: 0x08 */
  161. __IO uint32_t SMPR1; /*!< ADC sample time register 1, Address offset: 0x0C */
  162. __IO uint32_t SMPR2; /*!< ADC sample time register 2, Address offset: 0x10 */
  163. __IO uint32_t JOFR1; /*!< ADC injected channel data offset register 1, Address offset: 0x14 */
  164. __IO uint32_t JOFR2; /*!< ADC injected channel data offset register 2, Address offset: 0x18 */
  165. __IO uint32_t JOFR3; /*!< ADC injected channel data offset register 3, Address offset: 0x1C */
  166. __IO uint32_t JOFR4; /*!< ADC injected channel data offset register 4, Address offset: 0x20 */
  167. __IO uint32_t HTR; /*!< ADC watchdog higher threshold register, Address offset: 0x24 */
  168. __IO uint32_t LTR; /*!< ADC watchdog lower threshold register, Address offset: 0x28 */
  169. __IO uint32_t SQR1; /*!< ADC regular sequence register 1, Address offset: 0x2C */
  170. __IO uint32_t SQR2; /*!< ADC regular sequence register 2, Address offset: 0x30 */
  171. __IO uint32_t SQR3; /*!< ADC regular sequence register 3, Address offset: 0x34 */
  172. __IO uint32_t JSQR; /*!< ADC injected sequence register, Address offset: 0x38*/
  173. __IO uint32_t JDR1; /*!< ADC injected data register 1, Address offset: 0x3C */
  174. __IO uint32_t JDR2; /*!< ADC injected data register 2, Address offset: 0x40 */
  175. __IO uint32_t JDR3; /*!< ADC injected data register 3, Address offset: 0x44 */
  176. __IO uint32_t JDR4; /*!< ADC injected data register 4, Address offset: 0x48 */
  177. __IO uint32_t DR; /*!< ADC regular data register, Address offset: 0x4C */
  178. } ADC_TypeDef;
  179. typedef struct
  180. {
  181. __IO uint32_t CSR; /*!< ADC Common status register, Address offset: ADC1 base address + 0x300 */
  182. __IO uint32_t CCR; /*!< ADC common control register, Address offset: ADC1 base address + 0x304 */
  183. __IO uint32_t CDR; /*!< ADC common regular data register for dual
  184. AND triple modes, Address offset: ADC1 base address + 0x308 */
  185. } ADC_Common_TypeDef;
  186. /**
  187. * @brief CRC calculation unit
  188. */
  189. typedef struct
  190. {
  191. __IO uint32_t DR; /*!< CRC Data register, Address offset: 0x00 */
  192. __IO uint8_t IDR; /*!< CRC Independent data register, Address offset: 0x04 */
  193. uint8_t RESERVED0; /*!< Reserved, 0x05 */
  194. uint16_t RESERVED1; /*!< Reserved, 0x06 */
  195. __IO uint32_t CR; /*!< CRC Control register, Address offset: 0x08 */
  196. } CRC_TypeDef;
  197. /**
  198. * @brief Debug MCU
  199. */
  200. typedef struct
  201. {
  202. __IO uint32_t IDCODE; /*!< MCU device ID code, Address offset: 0x00 */
  203. __IO uint32_t CR; /*!< Debug MCU configuration register, Address offset: 0x04 */
  204. __IO uint32_t APB1FZ; /*!< Debug MCU APB1 freeze register, Address offset: 0x08 */
  205. __IO uint32_t APB2FZ; /*!< Debug MCU APB2 freeze register, Address offset: 0x0C */
  206. }DBGMCU_TypeDef;
  207. /**
  208. * @brief DMA Controller
  209. */
  210. typedef struct
  211. {
  212. __IO uint32_t CR; /*!< DMA stream x configuration register */
  213. __IO uint32_t NDTR; /*!< DMA stream x number of data register */
  214. __IO uint32_t PAR; /*!< DMA stream x peripheral address register */
  215. __IO uint32_t M0AR; /*!< DMA stream x memory 0 address register */
  216. __IO uint32_t M1AR; /*!< DMA stream x memory 1 address register */
  217. __IO uint32_t FCR; /*!< DMA stream x FIFO control register */
  218. } DMA_Stream_TypeDef;
  219. typedef struct
  220. {
  221. __IO uint32_t LISR; /*!< DMA low interrupt status register, Address offset: 0x00 */
  222. __IO uint32_t HISR; /*!< DMA high interrupt status register, Address offset: 0x04 */
  223. __IO uint32_t LIFCR; /*!< DMA low interrupt flag clear register, Address offset: 0x08 */
  224. __IO uint32_t HIFCR; /*!< DMA high interrupt flag clear register, Address offset: 0x0C */
  225. } DMA_TypeDef;
  226. /**
  227. * @brief External Interrupt/Event Controller
  228. */
  229. typedef struct
  230. {
  231. __IO uint32_t IMR; /*!< EXTI Interrupt mask register, Address offset: 0x00 */
  232. __IO uint32_t EMR; /*!< EXTI Event mask register, Address offset: 0x04 */
  233. __IO uint32_t RTSR; /*!< EXTI Rising trigger selection register, Address offset: 0x08 */
  234. __IO uint32_t FTSR; /*!< EXTI Falling trigger selection register, Address offset: 0x0C */
  235. __IO uint32_t SWIER; /*!< EXTI Software interrupt event register, Address offset: 0x10 */
  236. __IO uint32_t PR; /*!< EXTI Pending register, Address offset: 0x14 */
  237. } EXTI_TypeDef;
  238. /**
  239. * @brief FLASH Registers
  240. */
  241. typedef struct
  242. {
  243. __IO uint32_t ACR; /*!< FLASH access control register, Address offset: 0x00 */
  244. __IO uint32_t KEYR; /*!< FLASH key register, Address offset: 0x04 */
  245. __IO uint32_t OPTKEYR; /*!< FLASH option key register, Address offset: 0x08 */
  246. __IO uint32_t SR; /*!< FLASH status register, Address offset: 0x0C */
  247. __IO uint32_t CR; /*!< FLASH control register, Address offset: 0x10 */
  248. __IO uint32_t OPTCR; /*!< FLASH option control register , Address offset: 0x14 */
  249. __IO uint32_t OPTCR1; /*!< FLASH option control register 1, Address offset: 0x18 */
  250. } FLASH_TypeDef;
  251. /**
  252. * @brief General Purpose I/O
  253. */
  254. typedef struct
  255. {
  256. __IO uint32_t MODER; /*!< GPIO port mode register, Address offset: 0x00 */
  257. __IO uint32_t OTYPER; /*!< GPIO port output type register, Address offset: 0x04 */
  258. __IO uint32_t OSPEEDR; /*!< GPIO port output speed register, Address offset: 0x08 */
  259. __IO uint32_t PUPDR; /*!< GPIO port pull-up/pull-down register, Address offset: 0x0C */
  260. __IO uint32_t IDR; /*!< GPIO port input data register, Address offset: 0x10 */
  261. __IO uint32_t ODR; /*!< GPIO port output data register, Address offset: 0x14 */
  262. __IO uint32_t BSRR; /*!< GPIO port bit set/reset register, Address offset: 0x18 */
  263. __IO uint32_t LCKR; /*!< GPIO port configuration lock register, Address offset: 0x1C */
  264. __IO uint32_t AFR[2]; /*!< GPIO alternate function registers, Address offset: 0x20-0x24 */
  265. } GPIO_TypeDef;
  266. /**
  267. * @brief System configuration controller
  268. */
  269. typedef struct
  270. {
  271. __IO uint32_t MEMRMP; /*!< SYSCFG memory remap register, Address offset: 0x00 */
  272. __IO uint32_t PMC; /*!< SYSCFG peripheral mode configuration register, Address offset: 0x04 */
  273. __IO uint32_t EXTICR[4]; /*!< SYSCFG external interrupt configuration registers, Address offset: 0x08-0x14 */
  274. uint32_t RESERVED[2]; /*!< Reserved, 0x18-0x1C */
  275. __IO uint32_t CMPCR; /*!< SYSCFG Compensation cell control register, Address offset: 0x20 */
  276. } SYSCFG_TypeDef;
  277. /**
  278. * @brief Inter-integrated Circuit Interface
  279. */
  280. typedef struct
  281. {
  282. __IO uint32_t CR1; /*!< I2C Control register 1, Address offset: 0x00 */
  283. __IO uint32_t CR2; /*!< I2C Control register 2, Address offset: 0x04 */
  284. __IO uint32_t OAR1; /*!< I2C Own address register 1, Address offset: 0x08 */
  285. __IO uint32_t OAR2; /*!< I2C Own address register 2, Address offset: 0x0C */
  286. __IO uint32_t DR; /*!< I2C Data register, Address offset: 0x10 */
  287. __IO uint32_t SR1; /*!< I2C Status register 1, Address offset: 0x14 */
  288. __IO uint32_t SR2; /*!< I2C Status register 2, Address offset: 0x18 */
  289. __IO uint32_t CCR; /*!< I2C Clock control register, Address offset: 0x1C */
  290. __IO uint32_t TRISE; /*!< I2C TRISE register, Address offset: 0x20 */
  291. __IO uint32_t FLTR; /*!< I2C FLTR register, Address offset: 0x24 */
  292. } I2C_TypeDef;
  293. /**
  294. * @brief Independent WATCHDOG
  295. */
  296. typedef struct
  297. {
  298. __IO uint32_t KR; /*!< IWDG Key register, Address offset: 0x00 */
  299. __IO uint32_t PR; /*!< IWDG Prescaler register, Address offset: 0x04 */
  300. __IO uint32_t RLR; /*!< IWDG Reload register, Address offset: 0x08 */
  301. __IO uint32_t SR; /*!< IWDG Status register, Address offset: 0x0C */
  302. } IWDG_TypeDef;
  303. /**
  304. * @brief Power Control
  305. */
  306. typedef struct
  307. {
  308. __IO uint32_t CR; /*!< PWR power control register, Address offset: 0x00 */
  309. __IO uint32_t CSR; /*!< PWR power control/status register, Address offset: 0x04 */
  310. } PWR_TypeDef;
  311. /**
  312. * @brief Reset and Clock Control
  313. */
  314. typedef struct
  315. {
  316. __IO uint32_t CR; /*!< RCC clock control register, Address offset: 0x00 */
  317. __IO uint32_t PLLCFGR; /*!< RCC PLL configuration register, Address offset: 0x04 */
  318. __IO uint32_t CFGR; /*!< RCC clock configuration register, Address offset: 0x08 */
  319. __IO uint32_t CIR; /*!< RCC clock interrupt register, Address offset: 0x0C */
  320. __IO uint32_t AHB1RSTR; /*!< RCC AHB1 peripheral reset register, Address offset: 0x10 */
  321. __IO uint32_t AHB2RSTR; /*!< RCC AHB2 peripheral reset register, Address offset: 0x14 */
  322. __IO uint32_t AHB3RSTR; /*!< RCC AHB3 peripheral reset register, Address offset: 0x18 */
  323. uint32_t RESERVED0; /*!< Reserved, 0x1C */
  324. __IO uint32_t APB1RSTR; /*!< RCC APB1 peripheral reset register, Address offset: 0x20 */
  325. __IO uint32_t APB2RSTR; /*!< RCC APB2 peripheral reset register, Address offset: 0x24 */
  326. uint32_t RESERVED1[2]; /*!< Reserved, 0x28-0x2C */
  327. __IO uint32_t AHB1ENR; /*!< RCC AHB1 peripheral clock register, Address offset: 0x30 */
  328. __IO uint32_t AHB2ENR; /*!< RCC AHB2 peripheral clock register, Address offset: 0x34 */
  329. __IO uint32_t AHB3ENR; /*!< RCC AHB3 peripheral clock register, Address offset: 0x38 */
  330. uint32_t RESERVED2; /*!< Reserved, 0x3C */
  331. __IO uint32_t APB1ENR; /*!< RCC APB1 peripheral clock enable register, Address offset: 0x40 */
  332. __IO uint32_t APB2ENR; /*!< RCC APB2 peripheral clock enable register, Address offset: 0x44 */
  333. uint32_t RESERVED3[2]; /*!< Reserved, 0x48-0x4C */
  334. __IO uint32_t AHB1LPENR; /*!< RCC AHB1 peripheral clock enable in low power mode register, Address offset: 0x50 */
  335. __IO uint32_t AHB2LPENR; /*!< RCC AHB2 peripheral clock enable in low power mode register, Address offset: 0x54 */
  336. __IO uint32_t AHB3LPENR; /*!< RCC AHB3 peripheral clock enable in low power mode register, Address offset: 0x58 */
  337. uint32_t RESERVED4; /*!< Reserved, 0x5C */
  338. __IO uint32_t APB1LPENR; /*!< RCC APB1 peripheral clock enable in low power mode register, Address offset: 0x60 */
  339. __IO uint32_t APB2LPENR; /*!< RCC APB2 peripheral clock enable in low power mode register, Address offset: 0x64 */
  340. uint32_t RESERVED5[2]; /*!< Reserved, 0x68-0x6C */
  341. __IO uint32_t BDCR; /*!< RCC Backup domain control register, Address offset: 0x70 */
  342. __IO uint32_t CSR; /*!< RCC clock control & status register, Address offset: 0x74 */
  343. uint32_t RESERVED6[2]; /*!< Reserved, 0x78-0x7C */
  344. __IO uint32_t SSCGR; /*!< RCC spread spectrum clock generation register, Address offset: 0x80 */
  345. __IO uint32_t PLLI2SCFGR; /*!< RCC PLLI2S configuration register, Address offset: 0x84 */
  346. } RCC_TypeDef;
  347. /**
  348. * @brief Real-Time Clock
  349. */
  350. typedef struct
  351. {
  352. __IO uint32_t TR; /*!< RTC time register, Address offset: 0x00 */
  353. __IO uint32_t DR; /*!< RTC date register, Address offset: 0x04 */
  354. __IO uint32_t CR; /*!< RTC control register, Address offset: 0x08 */
  355. __IO uint32_t ISR; /*!< RTC initialization and status register, Address offset: 0x0C */
  356. __IO uint32_t PRER; /*!< RTC prescaler register, Address offset: 0x10 */
  357. __IO uint32_t WUTR; /*!< RTC wakeup timer register, Address offset: 0x14 */
  358. __IO uint32_t CALIBR; /*!< RTC calibration register, Address offset: 0x18 */
  359. __IO uint32_t ALRMAR; /*!< RTC alarm A register, Address offset: 0x1C */
  360. __IO uint32_t ALRMBR; /*!< RTC alarm B register, Address offset: 0x20 */
  361. __IO uint32_t WPR; /*!< RTC write protection register, Address offset: 0x24 */
  362. __IO uint32_t SSR; /*!< RTC sub second register, Address offset: 0x28 */
  363. __IO uint32_t SHIFTR; /*!< RTC shift control register, Address offset: 0x2C */
  364. __IO uint32_t TSTR; /*!< RTC time stamp time register, Address offset: 0x30 */
  365. __IO uint32_t TSDR; /*!< RTC time stamp date register, Address offset: 0x34 */
  366. __IO uint32_t TSSSR; /*!< RTC time-stamp sub second register, Address offset: 0x38 */
  367. __IO uint32_t CALR; /*!< RTC calibration register, Address offset: 0x3C */
  368. __IO uint32_t TAFCR; /*!< RTC tamper and alternate function configuration register, Address offset: 0x40 */
  369. __IO uint32_t ALRMASSR;/*!< RTC alarm A sub second register, Address offset: 0x44 */
  370. __IO uint32_t ALRMBSSR;/*!< RTC alarm B sub second register, Address offset: 0x48 */
  371. uint32_t RESERVED7; /*!< Reserved, 0x4C */
  372. __IO uint32_t BKP0R; /*!< RTC backup register 1, Address offset: 0x50 */
  373. __IO uint32_t BKP1R; /*!< RTC backup register 1, Address offset: 0x54 */
  374. __IO uint32_t BKP2R; /*!< RTC backup register 2, Address offset: 0x58 */
  375. __IO uint32_t BKP3R; /*!< RTC backup register 3, Address offset: 0x5C */
  376. __IO uint32_t BKP4R; /*!< RTC backup register 4, Address offset: 0x60 */
  377. __IO uint32_t BKP5R; /*!< RTC backup register 5, Address offset: 0x64 */
  378. __IO uint32_t BKP6R; /*!< RTC backup register 6, Address offset: 0x68 */
  379. __IO uint32_t BKP7R; /*!< RTC backup register 7, Address offset: 0x6C */
  380. __IO uint32_t BKP8R; /*!< RTC backup register 8, Address offset: 0x70 */
  381. __IO uint32_t BKP9R; /*!< RTC backup register 9, Address offset: 0x74 */
  382. __IO uint32_t BKP10R; /*!< RTC backup register 10, Address offset: 0x78 */
  383. __IO uint32_t BKP11R; /*!< RTC backup register 11, Address offset: 0x7C */
  384. __IO uint32_t BKP12R; /*!< RTC backup register 12, Address offset: 0x80 */
  385. __IO uint32_t BKP13R; /*!< RTC backup register 13, Address offset: 0x84 */
  386. __IO uint32_t BKP14R; /*!< RTC backup register 14, Address offset: 0x88 */
  387. __IO uint32_t BKP15R; /*!< RTC backup register 15, Address offset: 0x8C */
  388. __IO uint32_t BKP16R; /*!< RTC backup register 16, Address offset: 0x90 */
  389. __IO uint32_t BKP17R; /*!< RTC backup register 17, Address offset: 0x94 */
  390. __IO uint32_t BKP18R; /*!< RTC backup register 18, Address offset: 0x98 */
  391. __IO uint32_t BKP19R; /*!< RTC backup register 19, Address offset: 0x9C */
  392. } RTC_TypeDef;
  393. /**
  394. * @brief SD host Interface
  395. */
  396. typedef struct
  397. {
  398. __IO uint32_t POWER; /*!< SDIO power control register, Address offset: 0x00 */
  399. __IO uint32_t CLKCR; /*!< SDI clock control register, Address offset: 0x04 */
  400. __IO uint32_t ARG; /*!< SDIO argument register, Address offset: 0x08 */
  401. __IO uint32_t CMD; /*!< SDIO command register, Address offset: 0x0C */
  402. __I uint32_t RESPCMD; /*!< SDIO command response register, Address offset: 0x10 */
  403. __I uint32_t RESP1; /*!< SDIO response 1 register, Address offset: 0x14 */
  404. __I uint32_t RESP2; /*!< SDIO response 2 register, Address offset: 0x18 */
  405. __I uint32_t RESP3; /*!< SDIO response 3 register, Address offset: 0x1C */
  406. __I uint32_t RESP4; /*!< SDIO response 4 register, Address offset: 0x20 */
  407. __IO uint32_t DTIMER; /*!< SDIO data timer register, Address offset: 0x24 */
  408. __IO uint32_t DLEN; /*!< SDIO data length register, Address offset: 0x28 */
  409. __IO uint32_t DCTRL; /*!< SDIO data control register, Address offset: 0x2C */
  410. __I uint32_t DCOUNT; /*!< SDIO data counter register, Address offset: 0x30 */
  411. __I uint32_t STA; /*!< SDIO status register, Address offset: 0x34 */
  412. __IO uint32_t ICR; /*!< SDIO interrupt clear register, Address offset: 0x38 */
  413. __IO uint32_t MASK; /*!< SDIO mask register, Address offset: 0x3C */
  414. uint32_t RESERVED0[2]; /*!< Reserved, 0x40-0x44 */
  415. __I uint32_t FIFOCNT; /*!< SDIO FIFO counter register, Address offset: 0x48 */
  416. uint32_t RESERVED1[13]; /*!< Reserved, 0x4C-0x7C */
  417. __IO uint32_t FIFO; /*!< SDIO data FIFO register, Address offset: 0x80 */
  418. } SDIO_TypeDef;
  419. /**
  420. * @brief Serial Peripheral Interface
  421. */
  422. typedef struct
  423. {
  424. __IO uint32_t CR1; /*!< SPI control register 1 (not used in I2S mode), Address offset: 0x00 */
  425. __IO uint32_t CR2; /*!< SPI control register 2, Address offset: 0x04 */
  426. __IO uint32_t SR; /*!< SPI status register, Address offset: 0x08 */
  427. __IO uint32_t DR; /*!< SPI data register, Address offset: 0x0C */
  428. __IO uint32_t CRCPR; /*!< SPI CRC polynomial register (not used in I2S mode), Address offset: 0x10 */
  429. __IO uint32_t RXCRCR; /*!< SPI RX CRC register (not used in I2S mode), Address offset: 0x14 */
  430. __IO uint32_t TXCRCR; /*!< SPI TX CRC register (not used in I2S mode), Address offset: 0x18 */
  431. __IO uint32_t I2SCFGR; /*!< SPI_I2S configuration register, Address offset: 0x1C */
  432. __IO uint32_t I2SPR; /*!< SPI_I2S prescaler register, Address offset: 0x20 */
  433. } SPI_TypeDef;
  434. /**
  435. * @brief TIM
  436. */
  437. typedef struct
  438. {
  439. __IO uint32_t CR1; /*!< TIM control register 1, Address offset: 0x00 */
  440. __IO uint32_t CR2; /*!< TIM control register 2, Address offset: 0x04 */
  441. __IO uint32_t SMCR; /*!< TIM slave mode control register, Address offset: 0x08 */
  442. __IO uint32_t DIER; /*!< TIM DMA/interrupt enable register, Address offset: 0x0C */
  443. __IO uint32_t SR; /*!< TIM status register, Address offset: 0x10 */
  444. __IO uint32_t EGR; /*!< TIM event generation register, Address offset: 0x14 */
  445. __IO uint32_t CCMR1; /*!< TIM capture/compare mode register 1, Address offset: 0x18 */
  446. __IO uint32_t CCMR2; /*!< TIM capture/compare mode register 2, Address offset: 0x1C */
  447. __IO uint32_t CCER; /*!< TIM capture/compare enable register, Address offset: 0x20 */
  448. __IO uint32_t CNT; /*!< TIM counter register, Address offset: 0x24 */
  449. __IO uint32_t PSC; /*!< TIM prescaler, Address offset: 0x28 */
  450. __IO uint32_t ARR; /*!< TIM auto-reload register, Address offset: 0x2C */
  451. __IO uint32_t RCR; /*!< TIM repetition counter register, Address offset: 0x30 */
  452. __IO uint32_t CCR1; /*!< TIM capture/compare register 1, Address offset: 0x34 */
  453. __IO uint32_t CCR2; /*!< TIM capture/compare register 2, Address offset: 0x38 */
  454. __IO uint32_t CCR3; /*!< TIM capture/compare register 3, Address offset: 0x3C */
  455. __IO uint32_t CCR4; /*!< TIM capture/compare register 4, Address offset: 0x40 */
  456. __IO uint32_t BDTR; /*!< TIM break and dead-time register, Address offset: 0x44 */
  457. __IO uint32_t DCR; /*!< TIM DMA control register, Address offset: 0x48 */
  458. __IO uint32_t DMAR; /*!< TIM DMA address for full transfer, Address offset: 0x4C */
  459. __IO uint32_t OR; /*!< TIM option register, Address offset: 0x50 */
  460. } TIM_TypeDef;
  461. /**
  462. * @brief Universal Synchronous Asynchronous Receiver Transmitter
  463. */
  464. typedef struct
  465. {
  466. __IO uint32_t SR; /*!< USART Status register, Address offset: 0x00 */
  467. __IO uint32_t DR; /*!< USART Data register, Address offset: 0x04 */
  468. __IO uint32_t BRR; /*!< USART Baud rate register, Address offset: 0x08 */
  469. __IO uint32_t CR1; /*!< USART Control register 1, Address offset: 0x0C */
  470. __IO uint32_t CR2; /*!< USART Control register 2, Address offset: 0x10 */
  471. __IO uint32_t CR3; /*!< USART Control register 3, Address offset: 0x14 */
  472. __IO uint32_t GTPR; /*!< USART Guard time and prescaler register, Address offset: 0x18 */
  473. } USART_TypeDef;
  474. /**
  475. * @brief Window WATCHDOG
  476. */
  477. typedef struct
  478. {
  479. __IO uint32_t CR; /*!< WWDG Control register, Address offset: 0x00 */
  480. __IO uint32_t CFR; /*!< WWDG Configuration register, Address offset: 0x04 */
  481. __IO uint32_t SR; /*!< WWDG Status register, Address offset: 0x08 */
  482. } WWDG_TypeDef;
  483. /**
  484. * @brief __USB_OTG_Core_register
  485. */
  486. typedef struct
  487. {
  488. __IO uint32_t GOTGCTL; /*!< USB_OTG Control and Status Register Address offset : 0x00 */
  489. __IO uint32_t GOTGINT; /*!< USB_OTG Interrupt Register Address offset : 0x04 */
  490. __IO uint32_t GAHBCFG; /*!< Core AHB Configuration Register Address offset : 0x08 */
  491. __IO uint32_t GUSBCFG; /*!< Core USB Configuration Register Address offset : 0x0C */
  492. __IO uint32_t GRSTCTL; /*!< Core Reset Register Address offset : 0x10 */
  493. __IO uint32_t GINTSTS; /*!< Core Interrupt Register Address offset : 0x14 */
  494. __IO uint32_t GINTMSK; /*!< Core Interrupt Mask Register Address offset : 0x18 */
  495. __IO uint32_t GRXSTSR; /*!< Receive Sts Q Read Register Address offset : 0x1C */
  496. __IO uint32_t GRXSTSP; /*!< Receive Sts Q Read & POP Register Address offset : 0x20 */
  497. __IO uint32_t GRXFSIZ; /* Receive FIFO Size Register Address offset : 0x24 */
  498. __IO uint32_t DIEPTXF0_HNPTXFSIZ; /*!< EP0 / Non Periodic Tx FIFO Size Register Address offset : 0x28 */
  499. __IO uint32_t HNPTXSTS; /*!< Non Periodic Tx FIFO/Queue Sts reg Address offset : 0x2C */
  500. uint32_t Reserved30[2]; /* Reserved Address offset : 0x30 */
  501. __IO uint32_t GCCFG; /*!< General Purpose IO Register Address offset : 0x38 */
  502. __IO uint32_t CID; /*!< User ID Register Address offset : 0x3C */
  503. uint32_t Reserved40[48]; /*!< Reserved Address offset : 0x40-0xFF */
  504. __IO uint32_t HPTXFSIZ; /*!< Host Periodic Tx FIFO Size Reg Address offset : 0x100 */
  505. __IO uint32_t DIEPTXF[0x0F]; /*!< dev Periodic Transmit FIFO */
  506. }
  507. USB_OTG_GlobalTypeDef;
  508. /**
  509. * @brief __device_Registers
  510. */
  511. typedef struct
  512. {
  513. __IO uint32_t DCFG; /*!< dev Configuration Register Address offset : 0x800 */
  514. __IO uint32_t DCTL; /*!< dev Control Register Address offset : 0x804 */
  515. __IO uint32_t DSTS; /*!< dev Status Register (RO) Address offset : 0x808 */
  516. uint32_t Reserved0C; /*!< Reserved Address offset : 0x80C */
  517. __IO uint32_t DIEPMSK; /* !< dev IN Endpoint Mask Address offset : 0x810 */
  518. __IO uint32_t DOEPMSK; /*!< dev OUT Endpoint Mask Address offset : 0x814 */
  519. __IO uint32_t DAINT; /*!< dev All Endpoints Itr Reg Address offset : 0x818 */
  520. __IO uint32_t DAINTMSK; /*!< dev All Endpoints Itr Mask Address offset : 0x81C */
  521. uint32_t Reserved20; /*!< Reserved Address offset : 0x820 */
  522. uint32_t Reserved9; /*!< Reserved Address offset : 0x824 */
  523. __IO uint32_t DVBUSDIS; /*!< dev VBUS discharge Register Address offset : 0x828 */
  524. __IO uint32_t DVBUSPULSE; /*!< dev VBUS Pulse Register Address offset : 0x82C */
  525. __IO uint32_t DTHRCTL; /*!< dev thr Address offset : 0x830 */
  526. __IO uint32_t DIEPEMPMSK; /*!< dev empty msk Address offset : 0x834 */
  527. __IO uint32_t DEACHINT; /*!< dedicated EP interrupt Address offset : 0x838 */
  528. __IO uint32_t DEACHMSK; /*!< dedicated EP msk Address offset : 0x83C */
  529. uint32_t Reserved40; /*!< dedicated EP mask Address offset : 0x840 */
  530. __IO uint32_t DINEP1MSK; /*!< dedicated EP mask Address offset : 0x844 */
  531. uint32_t Reserved44[15]; /*!< Reserved Address offset : 0x844-0x87C */
  532. __IO uint32_t DOUTEP1MSK; /*!< dedicated EP msk Address offset : 0x884 */
  533. }
  534. USB_OTG_DeviceTypeDef;
  535. /**
  536. * @brief __IN_Endpoint-Specific_Register
  537. */
  538. typedef struct
  539. {
  540. __IO uint32_t DIEPCTL; /* dev IN Endpoint Control Reg 900h + (ep_num * 20h) + 00h */
  541. uint32_t Reserved04; /* Reserved 900h + (ep_num * 20h) + 04h */
  542. __IO uint32_t DIEPINT; /* dev IN Endpoint Itr Reg 900h + (ep_num * 20h) + 08h */
  543. uint32_t Reserved0C; /* Reserved 900h + (ep_num * 20h) + 0Ch */
  544. __IO uint32_t DIEPTSIZ; /* IN Endpoint Txfer Size 900h + (ep_num * 20h) + 10h */
  545. __IO uint32_t DIEPDMA; /* IN Endpoint DMA Address Reg 900h + (ep_num * 20h) + 14h */
  546. __IO uint32_t DTXFSTS; /*IN Endpoint Tx FIFO Status Reg 900h + (ep_num * 20h) + 18h */
  547. uint32_t Reserved18; /* Reserved 900h+(ep_num*20h)+1Ch-900h+ (ep_num * 20h) + 1Ch */
  548. }
  549. USB_OTG_INEndpointTypeDef;
  550. /**
  551. * @brief __OUT_Endpoint-Specific_Registers
  552. */
  553. typedef struct
  554. {
  555. __IO uint32_t DOEPCTL; /* dev OUT Endpoint Control Reg B00h + (ep_num * 20h) + 00h*/
  556. uint32_t Reserved04; /* Reserved B00h + (ep_num * 20h) + 04h*/
  557. __IO uint32_t DOEPINT; /* dev OUT Endpoint Itr Reg B00h + (ep_num * 20h) + 08h*/
  558. uint32_t Reserved0C; /* Reserved B00h + (ep_num * 20h) + 0Ch*/
  559. __IO uint32_t DOEPTSIZ; /* dev OUT Endpoint Txfer Size B00h + (ep_num * 20h) + 10h*/
  560. __IO uint32_t DOEPDMA; /* dev OUT Endpoint DMA Address B00h + (ep_num * 20h) + 14h*/
  561. uint32_t Reserved18[2]; /* Reserved B00h + (ep_num * 20h) + 18h - B00h + (ep_num * 20h) + 1Ch*/
  562. }
  563. USB_OTG_OUTEndpointTypeDef;
  564. /**
  565. * @brief __Host_Mode_Register_Structures
  566. */
  567. typedef struct
  568. {
  569. __IO uint32_t HCFG; /* Host Configuration Register 400h*/
  570. __IO uint32_t HFIR; /* Host Frame Interval Register 404h*/
  571. __IO uint32_t HFNUM; /* Host Frame Nbr/Frame Remaining 408h*/
  572. uint32_t Reserved40C; /* Reserved 40Ch*/
  573. __IO uint32_t HPTXSTS; /* Host Periodic Tx FIFO/ Queue Status 410h*/
  574. __IO uint32_t HAINT; /* Host All Channels Interrupt Register 414h*/
  575. __IO uint32_t HAINTMSK; /* Host All Channels Interrupt Mask 418h*/
  576. }
  577. USB_OTG_HostTypeDef;
  578. /**
  579. * @brief __Host_Channel_Specific_Registers
  580. */
  581. typedef struct
  582. {
  583. __IO uint32_t HCCHAR;
  584. __IO uint32_t HCSPLT;
  585. __IO uint32_t HCINT;
  586. __IO uint32_t HCINTMSK;
  587. __IO uint32_t HCTSIZ;
  588. __IO uint32_t HCDMA;
  589. uint32_t Reserved[2];
  590. }
  591. USB_OTG_HostChannelTypeDef;
  592. /**
  593. * @brief Peripheral_memory_map
  594. */
  595. #define FLASH_BASE ((uint32_t)0x08000000) /*!< FLASH(up to 1 MB) base address in the alias region */
  596. #define CCMDATARAM_BASE ((uint32_t)0x10000000) /*!< CCM(core coupled memory) data RAM(64 KB) base address in the alias region */
  597. #define SRAM1_BASE ((uint32_t)0x20000000) /*!< SRAM1(112 KB) base address in the alias region */
  598. #define SRAM2_BASE ((uint32_t)0x2001C000) /*!< SRAM2(16 KB) base address in the alias region */
  599. #define PERIPH_BASE ((uint32_t)0x40000000) /*!< Peripheral base address in the alias region */
  600. #define BKPSRAM_BASE ((uint32_t)0x40024000) /*!< Backup SRAM(4 KB) base address in the alias region */
  601. #define SRAM1_BB_BASE ((uint32_t)0x22000000) /*!< SRAM1(112 KB) base address in the bit-band region */
  602. #define SRAM2_BB_BASE ((uint32_t)0x22380000) /*!< SRAM2(16 KB) base address in the bit-band region */
  603. #define PERIPH_BB_BASE ((uint32_t)0x42000000) /*!< Peripheral base address in the bit-band region */
  604. #define BKPSRAM_BB_BASE ((uint32_t)0x42480000) /*!< Backup SRAM(4 KB) base address in the bit-band region */
  605. #define FLASH_END ((uint32_t)0x0803FFFF) /*!< FLASH end address */
  606. /* Legacy defines */
  607. #define SRAM_BASE SRAM1_BASE
  608. #define SRAM_BB_BASE SRAM1_BB_BASE
  609. /*!< Peripheral memory map */
  610. #define APB1PERIPH_BASE PERIPH_BASE
  611. #define APB2PERIPH_BASE (PERIPH_BASE + 0x00010000)
  612. #define AHB1PERIPH_BASE (PERIPH_BASE + 0x00020000)
  613. #define AHB2PERIPH_BASE (PERIPH_BASE + 0x10000000)
  614. /*!< APB1 peripherals */
  615. #define TIM2_BASE (APB1PERIPH_BASE + 0x0000)
  616. #define TIM3_BASE (APB1PERIPH_BASE + 0x0400)
  617. #define TIM4_BASE (APB1PERIPH_BASE + 0x0800)
  618. #define TIM5_BASE (APB1PERIPH_BASE + 0x0C00)
  619. #define RTC_BASE (APB1PERIPH_BASE + 0x2800)
  620. #define WWDG_BASE (APB1PERIPH_BASE + 0x2C00)
  621. #define IWDG_BASE (APB1PERIPH_BASE + 0x3000)
  622. #define I2S2ext_BASE (APB1PERIPH_BASE + 0x3400)
  623. #define SPI2_BASE (APB1PERIPH_BASE + 0x3800)
  624. #define SPI3_BASE (APB1PERIPH_BASE + 0x3C00)
  625. #define I2S3ext_BASE (APB1PERIPH_BASE + 0x4000)
  626. #define USART2_BASE (APB1PERIPH_BASE + 0x4400)
  627. #define I2C1_BASE (APB1PERIPH_BASE + 0x5400)
  628. #define I2C2_BASE (APB1PERIPH_BASE + 0x5800)
  629. #define I2C3_BASE (APB1PERIPH_BASE + 0x5C00)
  630. #define PWR_BASE (APB1PERIPH_BASE + 0x7000)
  631. /*!< APB2 peripherals */
  632. #define TIM1_BASE (APB2PERIPH_BASE + 0x0000)
  633. #define USART1_BASE (APB2PERIPH_BASE + 0x1000)
  634. #define USART6_BASE (APB2PERIPH_BASE + 0x1400)
  635. #define ADC1_BASE (APB2PERIPH_BASE + 0x2000)
  636. #define ADC_BASE (APB2PERIPH_BASE + 0x2300)
  637. #define SDIO_BASE (APB2PERIPH_BASE + 0x2C00)
  638. #define SPI1_BASE (APB2PERIPH_BASE + 0x3000)
  639. #define SPI4_BASE (APB2PERIPH_BASE + 0x3400)
  640. #define SYSCFG_BASE (APB2PERIPH_BASE + 0x3800)
  641. #define EXTI_BASE (APB2PERIPH_BASE + 0x3C00)
  642. #define TIM9_BASE (APB2PERIPH_BASE + 0x4000)
  643. #define TIM10_BASE (APB2PERIPH_BASE + 0x4400)
  644. #define TIM11_BASE (APB2PERIPH_BASE + 0x4800)
  645. /*!< AHB1 peripherals */
  646. #define GPIOA_BASE (AHB1PERIPH_BASE + 0x0000)
  647. #define GPIOB_BASE (AHB1PERIPH_BASE + 0x0400)
  648. #define GPIOC_BASE (AHB1PERIPH_BASE + 0x0800)
  649. #define GPIOD_BASE (AHB1PERIPH_BASE + 0x0C00)
  650. #define GPIOE_BASE (AHB1PERIPH_BASE + 0x1000)
  651. #define GPIOH_BASE (AHB1PERIPH_BASE + 0x1C00)
  652. #define CRC_BASE (AHB1PERIPH_BASE + 0x3000)
  653. #define RCC_BASE (AHB1PERIPH_BASE + 0x3800)
  654. #define FLASH_R_BASE (AHB1PERIPH_BASE + 0x3C00)
  655. #define DMA1_BASE (AHB1PERIPH_BASE + 0x6000)
  656. #define DMA1_Stream0_BASE (DMA1_BASE + 0x010)
  657. #define DMA1_Stream1_BASE (DMA1_BASE + 0x028)
  658. #define DMA1_Stream2_BASE (DMA1_BASE + 0x040)
  659. #define DMA1_Stream3_BASE (DMA1_BASE + 0x058)
  660. #define DMA1_Stream4_BASE (DMA1_BASE + 0x070)
  661. #define DMA1_Stream5_BASE (DMA1_BASE + 0x088)
  662. #define DMA1_Stream6_BASE (DMA1_BASE + 0x0A0)
  663. #define DMA1_Stream7_BASE (DMA1_BASE + 0x0B8)
  664. #define DMA2_BASE (AHB1PERIPH_BASE + 0x6400)
  665. #define DMA2_Stream0_BASE (DMA2_BASE + 0x010)
  666. #define DMA2_Stream1_BASE (DMA2_BASE + 0x028)
  667. #define DMA2_Stream2_BASE (DMA2_BASE + 0x040)
  668. #define DMA2_Stream3_BASE (DMA2_BASE + 0x058)
  669. #define DMA2_Stream4_BASE (DMA2_BASE + 0x070)
  670. #define DMA2_Stream5_BASE (DMA2_BASE + 0x088)
  671. #define DMA2_Stream6_BASE (DMA2_BASE + 0x0A0)
  672. #define DMA2_Stream7_BASE (DMA2_BASE + 0x0B8)
  673. /* Debug MCU registers base address */
  674. #define DBGMCU_BASE ((uint32_t )0xE0042000)
  675. /*!< USB registers base address */
  676. #define USB_OTG_FS_PERIPH_BASE ((uint32_t )0x50000000)
  677. #define USB_OTG_GLOBAL_BASE ((uint32_t )0x000)
  678. #define USB_OTG_DEVICE_BASE ((uint32_t )0x800)
  679. #define USB_OTG_IN_ENDPOINT_BASE ((uint32_t )0x900)
  680. #define USB_OTG_OUT_ENDPOINT_BASE ((uint32_t )0xB00)
  681. #define USB_OTG_EP_REG_SIZE ((uint32_t )0x20)
  682. #define USB_OTG_HOST_BASE ((uint32_t )0x400)
  683. #define USB_OTG_HOST_PORT_BASE ((uint32_t )0x440)
  684. #define USB_OTG_HOST_CHANNEL_BASE ((uint32_t )0x500)
  685. #define USB_OTG_HOST_CHANNEL_SIZE ((uint32_t )0x20)
  686. #define USB_OTG_PCGCCTL_BASE ((uint32_t )0xE00)
  687. #define USB_OTG_FIFO_BASE ((uint32_t )0x1000)
  688. #define USB_OTG_FIFO_SIZE ((uint32_t )0x1000)
  689. /**
  690. * @}
  691. */
  692. /** @addtogroup Peripheral_declaration
  693. * @{
  694. */
  695. #define TIM2 ((TIM_TypeDef *) TIM2_BASE)
  696. #define TIM3 ((TIM_TypeDef *) TIM3_BASE)
  697. #define TIM4 ((TIM_TypeDef *) TIM4_BASE)
  698. #define TIM5 ((TIM_TypeDef *) TIM5_BASE)
  699. #define RTC ((RTC_TypeDef *) RTC_BASE)
  700. #define WWDG ((WWDG_TypeDef *) WWDG_BASE)
  701. #define IWDG ((IWDG_TypeDef *) IWDG_BASE)
  702. #define I2S2ext ((SPI_TypeDef *) I2S2ext_BASE)
  703. #define SPI2 ((SPI_TypeDef *) SPI2_BASE)
  704. #define SPI3 ((SPI_TypeDef *) SPI3_BASE)
  705. #define I2S3ext ((SPI_TypeDef *) I2S3ext_BASE)
  706. #define USART2 ((USART_TypeDef *) USART2_BASE)
  707. #define I2C1 ((I2C_TypeDef *) I2C1_BASE)
  708. #define I2C2 ((I2C_TypeDef *) I2C2_BASE)
  709. #define I2C3 ((I2C_TypeDef *) I2C3_BASE)
  710. #define PWR ((PWR_TypeDef *) PWR_BASE)
  711. #define TIM1 ((TIM_TypeDef *) TIM1_BASE)
  712. #define USART1 ((USART_TypeDef *) USART1_BASE)
  713. #define USART6 ((USART_TypeDef *) USART6_BASE)
  714. #define ADC ((ADC_Common_TypeDef *) ADC_BASE)
  715. #define ADC1 ((ADC_TypeDef *) ADC1_BASE)
  716. #define SDIO ((SDIO_TypeDef *) SDIO_BASE)
  717. #define SPI1 ((SPI_TypeDef *) SPI1_BASE)
  718. #define SPI4 ((SPI_TypeDef *) SPI4_BASE)
  719. #define SYSCFG ((SYSCFG_TypeDef *) SYSCFG_BASE)
  720. #define EXTI ((EXTI_TypeDef *) EXTI_BASE)
  721. #define TIM9 ((TIM_TypeDef *) TIM9_BASE)
  722. #define TIM10 ((TIM_TypeDef *) TIM10_BASE)
  723. #define TIM11 ((TIM_TypeDef *) TIM11_BASE)
  724. #define GPIOA ((GPIO_TypeDef *) GPIOA_BASE)
  725. #define GPIOB ((GPIO_TypeDef *) GPIOB_BASE)
  726. #define GPIOC ((GPIO_TypeDef *) GPIOC_BASE)
  727. #define GPIOD ((GPIO_TypeDef *) GPIOD_BASE)
  728. #define GPIOE ((GPIO_TypeDef *) GPIOE_BASE)
  729. #define GPIOH ((GPIO_TypeDef *) GPIOH_BASE)
  730. #define CRC ((CRC_TypeDef *) CRC_BASE)
  731. #define RCC ((RCC_TypeDef *) RCC_BASE)
  732. #define FLASH ((FLASH_TypeDef *) FLASH_R_BASE)
  733. #define DMA1 ((DMA_TypeDef *) DMA1_BASE)
  734. #define DMA1_Stream0 ((DMA_Stream_TypeDef *) DMA1_Stream0_BASE)
  735. #define DMA1_Stream1 ((DMA_Stream_TypeDef *) DMA1_Stream1_BASE)
  736. #define DMA1_Stream2 ((DMA_Stream_TypeDef *) DMA1_Stream2_BASE)
  737. #define DMA1_Stream3 ((DMA_Stream_TypeDef *) DMA1_Stream3_BASE)
  738. #define DMA1_Stream4 ((DMA_Stream_TypeDef *) DMA1_Stream4_BASE)
  739. #define DMA1_Stream5 ((DMA_Stream_TypeDef *) DMA1_Stream5_BASE)
  740. #define DMA1_Stream6 ((DMA_Stream_TypeDef *) DMA1_Stream6_BASE)
  741. #define DMA1_Stream7 ((DMA_Stream_TypeDef *) DMA1_Stream7_BASE)
  742. #define DMA2 ((DMA_TypeDef *) DMA2_BASE)
  743. #define DMA2_Stream0 ((DMA_Stream_TypeDef *) DMA2_Stream0_BASE)
  744. #define DMA2_Stream1 ((DMA_Stream_TypeDef *) DMA2_Stream1_BASE)
  745. #define DMA2_Stream2 ((DMA_Stream_TypeDef *) DMA2_Stream2_BASE)
  746. #define DMA2_Stream3 ((DMA_Stream_TypeDef *) DMA2_Stream3_BASE)
  747. #define DMA2_Stream4 ((DMA_Stream_TypeDef *) DMA2_Stream4_BASE)
  748. #define DMA2_Stream5 ((DMA_Stream_TypeDef *) DMA2_Stream5_BASE)
  749. #define DMA2_Stream6 ((DMA_Stream_TypeDef *) DMA2_Stream6_BASE)
  750. #define DMA2_Stream7 ((DMA_Stream_TypeDef *) DMA2_Stream7_BASE)
  751. #define DBGMCU ((DBGMCU_TypeDef *) DBGMCU_BASE)
  752. #define USB_OTG_FS ((USB_OTG_GlobalTypeDef *) USB_OTG_FS_PERIPH_BASE)
  753. /**
  754. * @}
  755. */
  756. /** @addtogroup Exported_constants
  757. * @{
  758. */
  759. /** @addtogroup Peripheral_Registers_Bits_Definition
  760. * @{
  761. */
  762. /******************************************************************************/
  763. /* Peripheral Registers_Bits_Definition */
  764. /******************************************************************************/
  765. /******************************************************************************/
  766. /* */
  767. /* Analog to Digital Converter */
  768. /* */
  769. /******************************************************************************/
  770. /******************** Bit definition for ADC_SR register ********************/
  771. #define ADC_SR_AWD ((uint32_t)0x00000001) /*!<Analog watchdog flag */
  772. #define ADC_SR_EOC ((uint32_t)0x00000002) /*!<End of conversion */
  773. #define ADC_SR_JEOC ((uint32_t)0x00000004) /*!<Injected channel end of conversion */
  774. #define ADC_SR_JSTRT ((uint32_t)0x00000008) /*!<Injected channel Start flag */
  775. #define ADC_SR_STRT ((uint32_t)0x00000010) /*!<Regular channel Start flag */
  776. #define ADC_SR_OVR ((uint32_t)0x00000020) /*!<Overrun flag */
  777. /******************* Bit definition for ADC_CR1 register ********************/
  778. #define ADC_CR1_AWDCH ((uint32_t)0x0000001F) /*!<AWDCH[4:0] bits (Analog watchdog channel select bits) */
  779. #define ADC_CR1_AWDCH_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  780. #define ADC_CR1_AWDCH_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  781. #define ADC_CR1_AWDCH_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  782. #define ADC_CR1_AWDCH_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  783. #define ADC_CR1_AWDCH_4 ((uint32_t)0x00000010) /*!<Bit 4 */
  784. #define ADC_CR1_EOCIE ((uint32_t)0x00000020) /*!<Interrupt enable for EOC */
  785. #define ADC_CR1_AWDIE ((uint32_t)0x00000040) /*!<AAnalog Watchdog interrupt enable */
  786. #define ADC_CR1_JEOCIE ((uint32_t)0x00000080) /*!<Interrupt enable for injected channels */
  787. #define ADC_CR1_SCAN ((uint32_t)0x00000100) /*!<Scan mode */
  788. #define ADC_CR1_AWDSGL ((uint32_t)0x00000200) /*!<Enable the watchdog on a single channel in scan mode */
  789. #define ADC_CR1_JAUTO ((uint32_t)0x00000400) /*!<Automatic injected group conversion */
  790. #define ADC_CR1_DISCEN ((uint32_t)0x00000800) /*!<Discontinuous mode on regular channels */
  791. #define ADC_CR1_JDISCEN ((uint32_t)0x00001000) /*!<Discontinuous mode on injected channels */
  792. #define ADC_CR1_DISCNUM ((uint32_t)0x0000E000) /*!<DISCNUM[2:0] bits (Discontinuous mode channel count) */
  793. #define ADC_CR1_DISCNUM_0 ((uint32_t)0x00002000) /*!<Bit 0 */
  794. #define ADC_CR1_DISCNUM_1 ((uint32_t)0x00004000) /*!<Bit 1 */
  795. #define ADC_CR1_DISCNUM_2 ((uint32_t)0x00008000) /*!<Bit 2 */
  796. #define ADC_CR1_JAWDEN ((uint32_t)0x00400000) /*!<Analog watchdog enable on injected channels */
  797. #define ADC_CR1_AWDEN ((uint32_t)0x00800000) /*!<Analog watchdog enable on regular channels */
  798. #define ADC_CR1_RES ((uint32_t)0x03000000) /*!<RES[2:0] bits (Resolution) */
  799. #define ADC_CR1_RES_0 ((uint32_t)0x01000000) /*!<Bit 0 */
  800. #define ADC_CR1_RES_1 ((uint32_t)0x02000000) /*!<Bit 1 */
  801. #define ADC_CR1_OVRIE ((uint32_t)0x04000000) /*!<overrun interrupt enable */
  802. /******************* Bit definition for ADC_CR2 register ********************/
  803. #define ADC_CR2_ADON ((uint32_t)0x00000001) /*!<A/D Converter ON / OFF */
  804. #define ADC_CR2_CONT ((uint32_t)0x00000002) /*!<Continuous Conversion */
  805. #define ADC_CR2_DMA ((uint32_t)0x00000100) /*!<Direct Memory access mode */
  806. #define ADC_CR2_DDS ((uint32_t)0x00000200) /*!<DMA disable selection (Single ADC) */
  807. #define ADC_CR2_EOCS ((uint32_t)0x00000400) /*!<End of conversion selection */
  808. #define ADC_CR2_ALIGN ((uint32_t)0x00000800) /*!<Data Alignment */
  809. #define ADC_CR2_JEXTSEL ((uint32_t)0x000F0000) /*!<JEXTSEL[3:0] bits (External event select for injected group) */
  810. #define ADC_CR2_JEXTSEL_0 ((uint32_t)0x00010000) /*!<Bit 0 */
  811. #define ADC_CR2_JEXTSEL_1 ((uint32_t)0x00020000) /*!<Bit 1 */
  812. #define ADC_CR2_JEXTSEL_2 ((uint32_t)0x00040000) /*!<Bit 2 */
  813. #define ADC_CR2_JEXTSEL_3 ((uint32_t)0x00080000) /*!<Bit 3 */
  814. #define ADC_CR2_JEXTEN ((uint32_t)0x00300000) /*!<JEXTEN[1:0] bits (External Trigger Conversion mode for injected channelsp) */
  815. #define ADC_CR2_JEXTEN_0 ((uint32_t)0x00100000) /*!<Bit 0 */
  816. #define ADC_CR2_JEXTEN_1 ((uint32_t)0x00200000) /*!<Bit 1 */
  817. #define ADC_CR2_JSWSTART ((uint32_t)0x00400000) /*!<Start Conversion of injected channels */
  818. #define ADC_CR2_EXTSEL ((uint32_t)0x0F000000) /*!<EXTSEL[3:0] bits (External Event Select for regular group) */
  819. #define ADC_CR2_EXTSEL_0 ((uint32_t)0x01000000) /*!<Bit 0 */
  820. #define ADC_CR2_EXTSEL_1 ((uint32_t)0x02000000) /*!<Bit 1 */
  821. #define ADC_CR2_EXTSEL_2 ((uint32_t)0x04000000) /*!<Bit 2 */
  822. #define ADC_CR2_EXTSEL_3 ((uint32_t)0x08000000) /*!<Bit 3 */
  823. #define ADC_CR2_EXTEN ((uint32_t)0x30000000) /*!<EXTEN[1:0] bits (External Trigger Conversion mode for regular channelsp) */
  824. #define ADC_CR2_EXTEN_0 ((uint32_t)0x10000000) /*!<Bit 0 */
  825. #define ADC_CR2_EXTEN_1 ((uint32_t)0x20000000) /*!<Bit 1 */
  826. #define ADC_CR2_SWSTART ((uint32_t)0x40000000) /*!<Start Conversion of regular channels */
  827. /****************** Bit definition for ADC_SMPR1 register *******************/
  828. #define ADC_SMPR1_SMP10 ((uint32_t)0x00000007) /*!<SMP10[2:0] bits (Channel 10 Sample time selection) */
  829. #define ADC_SMPR1_SMP10_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  830. #define ADC_SMPR1_SMP10_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  831. #define ADC_SMPR1_SMP10_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  832. #define ADC_SMPR1_SMP11 ((uint32_t)0x00000038) /*!<SMP11[2:0] bits (Channel 11 Sample time selection) */
  833. #define ADC_SMPR1_SMP11_0 ((uint32_t)0x00000008) /*!<Bit 0 */
  834. #define ADC_SMPR1_SMP11_1 ((uint32_t)0x00000010) /*!<Bit 1 */
  835. #define ADC_SMPR1_SMP11_2 ((uint32_t)0x00000020) /*!<Bit 2 */
  836. #define ADC_SMPR1_SMP12 ((uint32_t)0x000001C0) /*!<SMP12[2:0] bits (Channel 12 Sample time selection) */
  837. #define ADC_SMPR1_SMP12_0 ((uint32_t)0x00000040) /*!<Bit 0 */
  838. #define ADC_SMPR1_SMP12_1 ((uint32_t)0x00000080) /*!<Bit 1 */
  839. #define ADC_SMPR1_SMP12_2 ((uint32_t)0x00000100) /*!<Bit 2 */
  840. #define ADC_SMPR1_SMP13 ((uint32_t)0x00000E00) /*!<SMP13[2:0] bits (Channel 13 Sample time selection) */
  841. #define ADC_SMPR1_SMP13_0 ((uint32_t)0x00000200) /*!<Bit 0 */
  842. #define ADC_SMPR1_SMP13_1 ((uint32_t)0x00000400) /*!<Bit 1 */
  843. #define ADC_SMPR1_SMP13_2 ((uint32_t)0x00000800) /*!<Bit 2 */
  844. #define ADC_SMPR1_SMP14 ((uint32_t)0x00007000) /*!<SMP14[2:0] bits (Channel 14 Sample time selection) */
  845. #define ADC_SMPR1_SMP14_0 ((uint32_t)0x00001000) /*!<Bit 0 */
  846. #define ADC_SMPR1_SMP14_1 ((uint32_t)0x00002000) /*!<Bit 1 */
  847. #define ADC_SMPR1_SMP14_2 ((uint32_t)0x00004000) /*!<Bit 2 */
  848. #define ADC_SMPR1_SMP15 ((uint32_t)0x00038000) /*!<SMP15[2:0] bits (Channel 15 Sample time selection) */
  849. #define ADC_SMPR1_SMP15_0 ((uint32_t)0x00008000) /*!<Bit 0 */
  850. #define ADC_SMPR1_SMP15_1 ((uint32_t)0x00010000) /*!<Bit 1 */
  851. #define ADC_SMPR1_SMP15_2 ((uint32_t)0x00020000) /*!<Bit 2 */
  852. #define ADC_SMPR1_SMP16 ((uint32_t)0x001C0000) /*!<SMP16[2:0] bits (Channel 16 Sample time selection) */
  853. #define ADC_SMPR1_SMP16_0 ((uint32_t)0x00040000) /*!<Bit 0 */
  854. #define ADC_SMPR1_SMP16_1 ((uint32_t)0x00080000) /*!<Bit 1 */
  855. #define ADC_SMPR1_SMP16_2 ((uint32_t)0x00100000) /*!<Bit 2 */
  856. #define ADC_SMPR1_SMP17 ((uint32_t)0x00E00000) /*!<SMP17[2:0] bits (Channel 17 Sample time selection) */
  857. #define ADC_SMPR1_SMP17_0 ((uint32_t)0x00200000) /*!<Bit 0 */
  858. #define ADC_SMPR1_SMP17_1 ((uint32_t)0x00400000) /*!<Bit 1 */
  859. #define ADC_SMPR1_SMP17_2 ((uint32_t)0x00800000) /*!<Bit 2 */
  860. #define ADC_SMPR1_SMP18 ((uint32_t)0x07000000) /*!<SMP18[2:0] bits (Channel 18 Sample time selection) */
  861. #define ADC_SMPR1_SMP18_0 ((uint32_t)0x01000000) /*!<Bit 0 */
  862. #define ADC_SMPR1_SMP18_1 ((uint32_t)0x02000000) /*!<Bit 1 */
  863. #define ADC_SMPR1_SMP18_2 ((uint32_t)0x04000000) /*!<Bit 2 */
  864. /****************** Bit definition for ADC_SMPR2 register *******************/
  865. #define ADC_SMPR2_SMP0 ((uint32_t)0x00000007) /*!<SMP0[2:0] bits (Channel 0 Sample time selection) */
  866. #define ADC_SMPR2_SMP0_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  867. #define ADC_SMPR2_SMP0_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  868. #define ADC_SMPR2_SMP0_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  869. #define ADC_SMPR2_SMP1 ((uint32_t)0x00000038) /*!<SMP1[2:0] bits (Channel 1 Sample time selection) */
  870. #define ADC_SMPR2_SMP1_0 ((uint32_t)0x00000008) /*!<Bit 0 */
  871. #define ADC_SMPR2_SMP1_1 ((uint32_t)0x00000010) /*!<Bit 1 */
  872. #define ADC_SMPR2_SMP1_2 ((uint32_t)0x00000020) /*!<Bit 2 */
  873. #define ADC_SMPR2_SMP2 ((uint32_t)0x000001C0) /*!<SMP2[2:0] bits (Channel 2 Sample time selection) */
  874. #define ADC_SMPR2_SMP2_0 ((uint32_t)0x00000040) /*!<Bit 0 */
  875. #define ADC_SMPR2_SMP2_1 ((uint32_t)0x00000080) /*!<Bit 1 */
  876. #define ADC_SMPR2_SMP2_2 ((uint32_t)0x00000100) /*!<Bit 2 */
  877. #define ADC_SMPR2_SMP3 ((uint32_t)0x00000E00) /*!<SMP3[2:0] bits (Channel 3 Sample time selection) */
  878. #define ADC_SMPR2_SMP3_0 ((uint32_t)0x00000200) /*!<Bit 0 */
  879. #define ADC_SMPR2_SMP3_1 ((uint32_t)0x00000400) /*!<Bit 1 */
  880. #define ADC_SMPR2_SMP3_2 ((uint32_t)0x00000800) /*!<Bit 2 */
  881. #define ADC_SMPR2_SMP4 ((uint32_t)0x00007000) /*!<SMP4[2:0] bits (Channel 4 Sample time selection) */
  882. #define ADC_SMPR2_SMP4_0 ((uint32_t)0x00001000) /*!<Bit 0 */
  883. #define ADC_SMPR2_SMP4_1 ((uint32_t)0x00002000) /*!<Bit 1 */
  884. #define ADC_SMPR2_SMP4_2 ((uint32_t)0x00004000) /*!<Bit 2 */
  885. #define ADC_SMPR2_SMP5 ((uint32_t)0x00038000) /*!<SMP5[2:0] bits (Channel 5 Sample time selection) */
  886. #define ADC_SMPR2_SMP5_0 ((uint32_t)0x00008000) /*!<Bit 0 */
  887. #define ADC_SMPR2_SMP5_1 ((uint32_t)0x00010000) /*!<Bit 1 */
  888. #define ADC_SMPR2_SMP5_2 ((uint32_t)0x00020000) /*!<Bit 2 */
  889. #define ADC_SMPR2_SMP6 ((uint32_t)0x001C0000) /*!<SMP6[2:0] bits (Channel 6 Sample time selection) */
  890. #define ADC_SMPR2_SMP6_0 ((uint32_t)0x00040000) /*!<Bit 0 */
  891. #define ADC_SMPR2_SMP6_1 ((uint32_t)0x00080000) /*!<Bit 1 */
  892. #define ADC_SMPR2_SMP6_2 ((uint32_t)0x00100000) /*!<Bit 2 */
  893. #define ADC_SMPR2_SMP7 ((uint32_t)0x00E00000) /*!<SMP7[2:0] bits (Channel 7 Sample time selection) */
  894. #define ADC_SMPR2_SMP7_0 ((uint32_t)0x00200000) /*!<Bit 0 */
  895. #define ADC_SMPR2_SMP7_1 ((uint32_t)0x00400000) /*!<Bit 1 */
  896. #define ADC_SMPR2_SMP7_2 ((uint32_t)0x00800000) /*!<Bit 2 */
  897. #define ADC_SMPR2_SMP8 ((uint32_t)0x07000000) /*!<SMP8[2:0] bits (Channel 8 Sample time selection) */
  898. #define ADC_SMPR2_SMP8_0 ((uint32_t)0x01000000) /*!<Bit 0 */
  899. #define ADC_SMPR2_SMP8_1 ((uint32_t)0x02000000) /*!<Bit 1 */
  900. #define ADC_SMPR2_SMP8_2 ((uint32_t)0x04000000) /*!<Bit 2 */
  901. #define ADC_SMPR2_SMP9 ((uint32_t)0x38000000) /*!<SMP9[2:0] bits (Channel 9 Sample time selection) */
  902. #define ADC_SMPR2_SMP9_0 ((uint32_t)0x08000000) /*!<Bit 0 */
  903. #define ADC_SMPR2_SMP9_1 ((uint32_t)0x10000000) /*!<Bit 1 */
  904. #define ADC_SMPR2_SMP9_2 ((uint32_t)0x20000000) /*!<Bit 2 */
  905. /****************** Bit definition for ADC_JOFR1 register *******************/
  906. #define ADC_JOFR1_JOFFSET1 ((uint32_t)0x0FFF) /*!<Data offset for injected channel 1 */
  907. /****************** Bit definition for ADC_JOFR2 register *******************/
  908. #define ADC_JOFR2_JOFFSET2 ((uint32_t)0x0FFF) /*!<Data offset for injected channel 2 */
  909. /****************** Bit definition for ADC_JOFR3 register *******************/
  910. #define ADC_JOFR3_JOFFSET3 ((uint32_t)0x0FFF) /*!<Data offset for injected channel 3 */
  911. /****************** Bit definition for ADC_JOFR4 register *******************/
  912. #define ADC_JOFR4_JOFFSET4 ((uint32_t)0x0FFF) /*!<Data offset for injected channel 4 */
  913. /******************* Bit definition for ADC_HTR register ********************/
  914. #define ADC_HTR_HT ((uint32_t)0x0FFF) /*!<Analog watchdog high threshold */
  915. /******************* Bit definition for ADC_LTR register ********************/
  916. #define ADC_LTR_LT ((uint32_t)0x0FFF) /*!<Analog watchdog low threshold */
  917. /******************* Bit definition for ADC_SQR1 register *******************/
  918. #define ADC_SQR1_SQ13 ((uint32_t)0x0000001F) /*!<SQ13[4:0] bits (13th conversion in regular sequence) */
  919. #define ADC_SQR1_SQ13_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  920. #define ADC_SQR1_SQ13_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  921. #define ADC_SQR1_SQ13_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  922. #define ADC_SQR1_SQ13_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  923. #define ADC_SQR1_SQ13_4 ((uint32_t)0x00000010) /*!<Bit 4 */
  924. #define ADC_SQR1_SQ14 ((uint32_t)0x000003E0) /*!<SQ14[4:0] bits (14th conversion in regular sequence) */
  925. #define ADC_SQR1_SQ14_0 ((uint32_t)0x00000020) /*!<Bit 0 */
  926. #define ADC_SQR1_SQ14_1 ((uint32_t)0x00000040) /*!<Bit 1 */
  927. #define ADC_SQR1_SQ14_2 ((uint32_t)0x00000080) /*!<Bit 2 */
  928. #define ADC_SQR1_SQ14_3 ((uint32_t)0x00000100) /*!<Bit 3 */
  929. #define ADC_SQR1_SQ14_4 ((uint32_t)0x00000200) /*!<Bit 4 */
  930. #define ADC_SQR1_SQ15 ((uint32_t)0x00007C00) /*!<SQ15[4:0] bits (15th conversion in regular sequence) */
  931. #define ADC_SQR1_SQ15_0 ((uint32_t)0x00000400) /*!<Bit 0 */
  932. #define ADC_SQR1_SQ15_1 ((uint32_t)0x00000800) /*!<Bit 1 */
  933. #define ADC_SQR1_SQ15_2 ((uint32_t)0x00001000) /*!<Bit 2 */
  934. #define ADC_SQR1_SQ15_3 ((uint32_t)0x00002000) /*!<Bit 3 */
  935. #define ADC_SQR1_SQ15_4 ((uint32_t)0x00004000) /*!<Bit 4 */
  936. #define ADC_SQR1_SQ16 ((uint32_t)0x000F8000) /*!<SQ16[4:0] bits (16th conversion in regular sequence) */
  937. #define ADC_SQR1_SQ16_0 ((uint32_t)0x00008000) /*!<Bit 0 */
  938. #define ADC_SQR1_SQ16_1 ((uint32_t)0x00010000) /*!<Bit 1 */
  939. #define ADC_SQR1_SQ16_2 ((uint32_t)0x00020000) /*!<Bit 2 */
  940. #define ADC_SQR1_SQ16_3 ((uint32_t)0x00040000) /*!<Bit 3 */
  941. #define ADC_SQR1_SQ16_4 ((uint32_t)0x00080000) /*!<Bit 4 */
  942. #define ADC_SQR1_L ((uint32_t)0x00F00000) /*!<L[3:0] bits (Regular channel sequence length) */
  943. #define ADC_SQR1_L_0 ((uint32_t)0x00100000) /*!<Bit 0 */
  944. #define ADC_SQR1_L_1 ((uint32_t)0x00200000) /*!<Bit 1 */
  945. #define ADC_SQR1_L_2 ((uint32_t)0x00400000) /*!<Bit 2 */
  946. #define ADC_SQR1_L_3 ((uint32_t)0x00800000) /*!<Bit 3 */
  947. /******************* Bit definition for ADC_SQR2 register *******************/
  948. #define ADC_SQR2_SQ7 ((uint32_t)0x0000001F) /*!<SQ7[4:0] bits (7th conversion in regular sequence) */
  949. #define ADC_SQR2_SQ7_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  950. #define ADC_SQR2_SQ7_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  951. #define ADC_SQR2_SQ7_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  952. #define ADC_SQR2_SQ7_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  953. #define ADC_SQR2_SQ7_4 ((uint32_t)0x00000010) /*!<Bit 4 */
  954. #define ADC_SQR2_SQ8 ((uint32_t)0x000003E0) /*!<SQ8[4:0] bits (8th conversion in regular sequence) */
  955. #define ADC_SQR2_SQ8_0 ((uint32_t)0x00000020) /*!<Bit 0 */
  956. #define ADC_SQR2_SQ8_1 ((uint32_t)0x00000040) /*!<Bit 1 */
  957. #define ADC_SQR2_SQ8_2 ((uint32_t)0x00000080) /*!<Bit 2 */
  958. #define ADC_SQR2_SQ8_3 ((uint32_t)0x00000100) /*!<Bit 3 */
  959. #define ADC_SQR2_SQ8_4 ((uint32_t)0x00000200) /*!<Bit 4 */
  960. #define ADC_SQR2_SQ9 ((uint32_t)0x00007C00) /*!<SQ9[4:0] bits (9th conversion in regular sequence) */
  961. #define ADC_SQR2_SQ9_0 ((uint32_t)0x00000400) /*!<Bit 0 */
  962. #define ADC_SQR2_SQ9_1 ((uint32_t)0x00000800) /*!<Bit 1 */
  963. #define ADC_SQR2_SQ9_2 ((uint32_t)0x00001000) /*!<Bit 2 */
  964. #define ADC_SQR2_SQ9_3 ((uint32_t)0x00002000) /*!<Bit 3 */
  965. #define ADC_SQR2_SQ9_4 ((uint32_t)0x00004000) /*!<Bit 4 */
  966. #define ADC_SQR2_SQ10 ((uint32_t)0x000F8000) /*!<SQ10[4:0] bits (10th conversion in regular sequence) */
  967. #define ADC_SQR2_SQ10_0 ((uint32_t)0x00008000) /*!<Bit 0 */
  968. #define ADC_SQR2_SQ10_1 ((uint32_t)0x00010000) /*!<Bit 1 */
  969. #define ADC_SQR2_SQ10_2 ((uint32_t)0x00020000) /*!<Bit 2 */
  970. #define ADC_SQR2_SQ10_3 ((uint32_t)0x00040000) /*!<Bit 3 */
  971. #define ADC_SQR2_SQ10_4 ((uint32_t)0x00080000) /*!<Bit 4 */
  972. #define ADC_SQR2_SQ11 ((uint32_t)0x01F00000) /*!<SQ11[4:0] bits (11th conversion in regular sequence) */
  973. #define ADC_SQR2_SQ11_0 ((uint32_t)0x00100000) /*!<Bit 0 */
  974. #define ADC_SQR2_SQ11_1 ((uint32_t)0x00200000) /*!<Bit 1 */
  975. #define ADC_SQR2_SQ11_2 ((uint32_t)0x00400000) /*!<Bit 2 */
  976. #define ADC_SQR2_SQ11_3 ((uint32_t)0x00800000) /*!<Bit 3 */
  977. #define ADC_SQR2_SQ11_4 ((uint32_t)0x01000000) /*!<Bit 4 */
  978. #define ADC_SQR2_SQ12 ((uint32_t)0x3E000000) /*!<SQ12[4:0] bits (12th conversion in regular sequence) */
  979. #define ADC_SQR2_SQ12_0 ((uint32_t)0x02000000) /*!<Bit 0 */
  980. #define ADC_SQR2_SQ12_1 ((uint32_t)0x04000000) /*!<Bit 1 */
  981. #define ADC_SQR2_SQ12_2 ((uint32_t)0x08000000) /*!<Bit 2 */
  982. #define ADC_SQR2_SQ12_3 ((uint32_t)0x10000000) /*!<Bit 3 */
  983. #define ADC_SQR2_SQ12_4 ((uint32_t)0x20000000) /*!<Bit 4 */
  984. /******************* Bit definition for ADC_SQR3 register *******************/
  985. #define ADC_SQR3_SQ1 ((uint32_t)0x0000001F) /*!<SQ1[4:0] bits (1st conversion in regular sequence) */
  986. #define ADC_SQR3_SQ1_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  987. #define ADC_SQR3_SQ1_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  988. #define ADC_SQR3_SQ1_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  989. #define ADC_SQR3_SQ1_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  990. #define ADC_SQR3_SQ1_4 ((uint32_t)0x00000010) /*!<Bit 4 */
  991. #define ADC_SQR3_SQ2 ((uint32_t)0x000003E0) /*!<SQ2[4:0] bits (2nd conversion in regular sequence) */
  992. #define ADC_SQR3_SQ2_0 ((uint32_t)0x00000020) /*!<Bit 0 */
  993. #define ADC_SQR3_SQ2_1 ((uint32_t)0x00000040) /*!<Bit 1 */
  994. #define ADC_SQR3_SQ2_2 ((uint32_t)0x00000080) /*!<Bit 2 */
  995. #define ADC_SQR3_SQ2_3 ((uint32_t)0x00000100) /*!<Bit 3 */
  996. #define ADC_SQR3_SQ2_4 ((uint32_t)0x00000200) /*!<Bit 4 */
  997. #define ADC_SQR3_SQ3 ((uint32_t)0x00007C00) /*!<SQ3[4:0] bits (3rd conversion in regular sequence) */
  998. #define ADC_SQR3_SQ3_0 ((uint32_t)0x00000400) /*!<Bit 0 */
  999. #define ADC_SQR3_SQ3_1 ((uint32_t)0x00000800) /*!<Bit 1 */
  1000. #define ADC_SQR3_SQ3_2 ((uint32_t)0x00001000) /*!<Bit 2 */
  1001. #define ADC_SQR3_SQ3_3 ((uint32_t)0x00002000) /*!<Bit 3 */
  1002. #define ADC_SQR3_SQ3_4 ((uint32_t)0x00004000) /*!<Bit 4 */
  1003. #define ADC_SQR3_SQ4 ((uint32_t)0x000F8000) /*!<SQ4[4:0] bits (4th conversion in regular sequence) */
  1004. #define ADC_SQR3_SQ4_0 ((uint32_t)0x00008000) /*!<Bit 0 */
  1005. #define ADC_SQR3_SQ4_1 ((uint32_t)0x00010000) /*!<Bit 1 */
  1006. #define ADC_SQR3_SQ4_2 ((uint32_t)0x00020000) /*!<Bit 2 */
  1007. #define ADC_SQR3_SQ4_3 ((uint32_t)0x00040000) /*!<Bit 3 */
  1008. #define ADC_SQR3_SQ4_4 ((uint32_t)0x00080000) /*!<Bit 4 */
  1009. #define ADC_SQR3_SQ5 ((uint32_t)0x01F00000) /*!<SQ5[4:0] bits (5th conversion in regular sequence) */
  1010. #define ADC_SQR3_SQ5_0 ((uint32_t)0x00100000) /*!<Bit 0 */
  1011. #define ADC_SQR3_SQ5_1 ((uint32_t)0x00200000) /*!<Bit 1 */
  1012. #define ADC_SQR3_SQ5_2 ((uint32_t)0x00400000) /*!<Bit 2 */
  1013. #define ADC_SQR3_SQ5_3 ((uint32_t)0x00800000) /*!<Bit 3 */
  1014. #define ADC_SQR3_SQ5_4 ((uint32_t)0x01000000) /*!<Bit 4 */
  1015. #define ADC_SQR3_SQ6 ((uint32_t)0x3E000000) /*!<SQ6[4:0] bits (6th conversion in regular sequence) */
  1016. #define ADC_SQR3_SQ6_0 ((uint32_t)0x02000000) /*!<Bit 0 */
  1017. #define ADC_SQR3_SQ6_1 ((uint32_t)0x04000000) /*!<Bit 1 */
  1018. #define ADC_SQR3_SQ6_2 ((uint32_t)0x08000000) /*!<Bit 2 */
  1019. #define ADC_SQR3_SQ6_3 ((uint32_t)0x10000000) /*!<Bit 3 */
  1020. #define ADC_SQR3_SQ6_4 ((uint32_t)0x20000000) /*!<Bit 4 */
  1021. /******************* Bit definition for ADC_JSQR register *******************/
  1022. #define ADC_JSQR_JSQ1 ((uint32_t)0x0000001F) /*!<JSQ1[4:0] bits (1st conversion in injected sequence) */
  1023. #define ADC_JSQR_JSQ1_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  1024. #define ADC_JSQR_JSQ1_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  1025. #define ADC_JSQR_JSQ1_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  1026. #define ADC_JSQR_JSQ1_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  1027. #define ADC_JSQR_JSQ1_4 ((uint32_t)0x00000010) /*!<Bit 4 */
  1028. #define ADC_JSQR_JSQ2 ((uint32_t)0x000003E0) /*!<JSQ2[4:0] bits (2nd conversion in injected sequence) */
  1029. #define ADC_JSQR_JSQ2_0 ((uint32_t)0x00000020) /*!<Bit 0 */
  1030. #define ADC_JSQR_JSQ2_1 ((uint32_t)0x00000040) /*!<Bit 1 */
  1031. #define ADC_JSQR_JSQ2_2 ((uint32_t)0x00000080) /*!<Bit 2 */
  1032. #define ADC_JSQR_JSQ2_3 ((uint32_t)0x00000100) /*!<Bit 3 */
  1033. #define ADC_JSQR_JSQ2_4 ((uint32_t)0x00000200) /*!<Bit 4 */
  1034. #define ADC_JSQR_JSQ3 ((uint32_t)0x00007C00) /*!<JSQ3[4:0] bits (3rd conversion in injected sequence) */
  1035. #define ADC_JSQR_JSQ3_0 ((uint32_t)0x00000400) /*!<Bit 0 */
  1036. #define ADC_JSQR_JSQ3_1 ((uint32_t)0x00000800) /*!<Bit 1 */
  1037. #define ADC_JSQR_JSQ3_2 ((uint32_t)0x00001000) /*!<Bit 2 */
  1038. #define ADC_JSQR_JSQ3_3 ((uint32_t)0x00002000) /*!<Bit 3 */
  1039. #define ADC_JSQR_JSQ3_4 ((uint32_t)0x00004000) /*!<Bit 4 */
  1040. #define ADC_JSQR_JSQ4 ((uint32_t)0x000F8000) /*!<JSQ4[4:0] bits (4th conversion in injected sequence) */
  1041. #define ADC_JSQR_JSQ4_0 ((uint32_t)0x00008000) /*!<Bit 0 */
  1042. #define ADC_JSQR_JSQ4_1 ((uint32_t)0x00010000) /*!<Bit 1 */
  1043. #define ADC_JSQR_JSQ4_2 ((uint32_t)0x00020000) /*!<Bit 2 */
  1044. #define ADC_JSQR_JSQ4_3 ((uint32_t)0x00040000) /*!<Bit 3 */
  1045. #define ADC_JSQR_JSQ4_4 ((uint32_t)0x00080000) /*!<Bit 4 */
  1046. #define ADC_JSQR_JL ((uint32_t)0x00300000) /*!<JL[1:0] bits (Injected Sequence length) */
  1047. #define ADC_JSQR_JL_0 ((uint32_t)0x00100000) /*!<Bit 0 */
  1048. #define ADC_JSQR_JL_1 ((uint32_t)0x00200000) /*!<Bit 1 */
  1049. /******************* Bit definition for ADC_JDR1 register *******************/
  1050. #define ADC_JDR1_JDATA ((uint32_t)0xFFFF) /*!<Injected data */
  1051. /******************* Bit definition for ADC_JDR2 register *******************/
  1052. #define ADC_JDR2_JDATA ((uint32_t)0xFFFF) /*!<Injected data */
  1053. /******************* Bit definition for ADC_JDR3 register *******************/
  1054. #define ADC_JDR3_JDATA ((uint32_t)0xFFFF) /*!<Injected data */
  1055. /******************* Bit definition for ADC_JDR4 register *******************/
  1056. #define ADC_JDR4_JDATA ((uint32_t)0xFFFF) /*!<Injected data */
  1057. /******************** Bit definition for ADC_DR register ********************/
  1058. #define ADC_DR_DATA ((uint32_t)0x0000FFFF) /*!<Regular data */
  1059. #define ADC_DR_ADC2DATA ((uint32_t)0xFFFF0000) /*!<ADC2 data */
  1060. /******************* Bit definition for ADC_CSR register ********************/
  1061. #define ADC_CSR_AWD1 ((uint32_t)0x00000001) /*!<ADC1 Analog watchdog flag */
  1062. #define ADC_CSR_EOC1 ((uint32_t)0x00000002) /*!<ADC1 End of conversion */
  1063. #define ADC_CSR_JEOC1 ((uint32_t)0x00000004) /*!<ADC1 Injected channel end of conversion */
  1064. #define ADC_CSR_JSTRT1 ((uint32_t)0x00000008) /*!<ADC1 Injected channel Start flag */
  1065. #define ADC_CSR_STRT1 ((uint32_t)0x00000010) /*!<ADC1 Regular channel Start flag */
  1066. #define ADC_CSR_DOVR1 ((uint32_t)0x00000020) /*!<ADC1 DMA overrun flag */
  1067. #define ADC_CSR_AWD2 ((uint32_t)0x00000100) /*!<ADC2 Analog watchdog flag */
  1068. #define ADC_CSR_EOC2 ((uint32_t)0x00000200) /*!<ADC2 End of conversion */
  1069. #define ADC_CSR_JEOC2 ((uint32_t)0x00000400) /*!<ADC2 Injected channel end of conversion */
  1070. #define ADC_CSR_JSTRT2 ((uint32_t)0x00000800) /*!<ADC2 Injected channel Start flag */
  1071. #define ADC_CSR_STRT2 ((uint32_t)0x00001000) /*!<ADC2 Regular channel Start flag */
  1072. #define ADC_CSR_DOVR2 ((uint32_t)0x00002000) /*!<ADC2 DMA overrun flag */
  1073. #define ADC_CSR_AWD3 ((uint32_t)0x00010000) /*!<ADC3 Analog watchdog flag */
  1074. #define ADC_CSR_EOC3 ((uint32_t)0x00020000) /*!<ADC3 End of conversion */
  1075. #define ADC_CSR_JEOC3 ((uint32_t)0x00040000) /*!<ADC3 Injected channel end of conversion */
  1076. #define ADC_CSR_JSTRT3 ((uint32_t)0x00080000) /*!<ADC3 Injected channel Start flag */
  1077. #define ADC_CSR_STRT3 ((uint32_t)0x00100000) /*!<ADC3 Regular channel Start flag */
  1078. #define ADC_CSR_DOVR3 ((uint32_t)0x00200000) /*!<ADC3 DMA overrun flag */
  1079. /******************* Bit definition for ADC_CCR register ********************/
  1080. #define ADC_CCR_MULTI ((uint32_t)0x0000001F) /*!<MULTI[4:0] bits (Multi-ADC mode selection) */
  1081. #define ADC_CCR_MULTI_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  1082. #define ADC_CCR_MULTI_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  1083. #define ADC_CCR_MULTI_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  1084. #define ADC_CCR_MULTI_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  1085. #define ADC_CCR_MULTI_4 ((uint32_t)0x00000010) /*!<Bit 4 */
  1086. #define ADC_CCR_DELAY ((uint32_t)0x00000F00) /*!<DELAY[3:0] bits (Delay between 2 sampling phases) */
  1087. #define ADC_CCR_DELAY_0 ((uint32_t)0x00000100) /*!<Bit 0 */
  1088. #define ADC_CCR_DELAY_1 ((uint32_t)0x00000200) /*!<Bit 1 */
  1089. #define ADC_CCR_DELAY_2 ((uint32_t)0x00000400) /*!<Bit 2 */
  1090. #define ADC_CCR_DELAY_3 ((uint32_t)0x00000800) /*!<Bit 3 */
  1091. #define ADC_CCR_DDS ((uint32_t)0x00002000) /*!<DMA disable selection (Multi-ADC mode) */
  1092. #define ADC_CCR_DMA ((uint32_t)0x0000C000) /*!<DMA[1:0] bits (Direct Memory Access mode for multimode) */
  1093. #define ADC_CCR_DMA_0 ((uint32_t)0x00004000) /*!<Bit 0 */
  1094. #define ADC_CCR_DMA_1 ((uint32_t)0x00008000) /*!<Bit 1 */
  1095. #define ADC_CCR_ADCPRE ((uint32_t)0x00030000) /*!<ADCPRE[1:0] bits (ADC prescaler) */
  1096. #define ADC_CCR_ADCPRE_0 ((uint32_t)0x00010000) /*!<Bit 0 */
  1097. #define ADC_CCR_ADCPRE_1 ((uint32_t)0x00020000) /*!<Bit 1 */
  1098. #define ADC_CCR_VBATE ((uint32_t)0x00400000) /*!<VBAT Enable */
  1099. #define ADC_CCR_TSVREFE ((uint32_t)0x00800000) /*!<Temperature Sensor and VREFINT Enable */
  1100. /******************* Bit definition for ADC_CDR register ********************/
  1101. #define ADC_CDR_DATA1 ((uint32_t)0x0000FFFF) /*!<1st data of a pair of regular conversions */
  1102. #define ADC_CDR_DATA2 ((uint32_t)0xFFFF0000) /*!<2nd data of a pair of regular conversions */
  1103. /******************************************************************************/
  1104. /* */
  1105. /* CRC calculation unit */
  1106. /* */
  1107. /******************************************************************************/
  1108. /******************* Bit definition for CRC_DR register *********************/
  1109. #define CRC_DR_DR ((uint32_t)0xFFFFFFFF) /*!< Data register bits */
  1110. /******************* Bit definition for CRC_IDR register ********************/
  1111. #define CRC_IDR_IDR ((uint32_t)0xFF) /*!< General-purpose 8-bit data register bits */
  1112. /******************** Bit definition for CRC_CR register ********************/
  1113. #define CRC_CR_RESET ((uint32_t)0x01) /*!< RESET bit */
  1114. /******************************************************************************/
  1115. /* */
  1116. /* Debug MCU */
  1117. /* */
  1118. /******************************************************************************/
  1119. /******************************************************************************/
  1120. /* */
  1121. /* DMA Controller */
  1122. /* */
  1123. /******************************************************************************/
  1124. /******************** Bits definition for DMA_SxCR register *****************/
  1125. #define DMA_SxCR_CHSEL ((uint32_t)0x0E000000)
  1126. #define DMA_SxCR_CHSEL_0 ((uint32_t)0x02000000)
  1127. #define DMA_SxCR_CHSEL_1 ((uint32_t)0x04000000)
  1128. #define DMA_SxCR_CHSEL_2 ((uint32_t)0x08000000)
  1129. #define DMA_SxCR_MBURST ((uint32_t)0x01800000)
  1130. #define DMA_SxCR_MBURST_0 ((uint32_t)0x00800000)
  1131. #define DMA_SxCR_MBURST_1 ((uint32_t)0x01000000)
  1132. #define DMA_SxCR_PBURST ((uint32_t)0x00600000)
  1133. #define DMA_SxCR_PBURST_0 ((uint32_t)0x00200000)
  1134. #define DMA_SxCR_PBURST_1 ((uint32_t)0x00400000)
  1135. #define DMA_SxCR_ACK ((uint32_t)0x00100000)
  1136. #define DMA_SxCR_CT ((uint32_t)0x00080000)
  1137. #define DMA_SxCR_DBM ((uint32_t)0x00040000)
  1138. #define DMA_SxCR_PL ((uint32_t)0x00030000)
  1139. #define DMA_SxCR_PL_0 ((uint32_t)0x00010000)
  1140. #define DMA_SxCR_PL_1 ((uint32_t)0x00020000)
  1141. #define DMA_SxCR_PINCOS ((uint32_t)0x00008000)
  1142. #define DMA_SxCR_MSIZE ((uint32_t)0x00006000)
  1143. #define DMA_SxCR_MSIZE_0 ((uint32_t)0x00002000)
  1144. #define DMA_SxCR_MSIZE_1 ((uint32_t)0x00004000)
  1145. #define DMA_SxCR_PSIZE ((uint32_t)0x00001800)
  1146. #define DMA_SxCR_PSIZE_0 ((uint32_t)0x00000800)
  1147. #define DMA_SxCR_PSIZE_1 ((uint32_t)0x00001000)
  1148. #define DMA_SxCR_MINC ((uint32_t)0x00000400)
  1149. #define DMA_SxCR_PINC ((uint32_t)0x00000200)
  1150. #define DMA_SxCR_CIRC ((uint32_t)0x00000100)
  1151. #define DMA_SxCR_DIR ((uint32_t)0x000000C0)
  1152. #define DMA_SxCR_DIR_0 ((uint32_t)0x00000040)
  1153. #define DMA_SxCR_DIR_1 ((uint32_t)0x00000080)
  1154. #define DMA_SxCR_PFCTRL ((uint32_t)0x00000020)
  1155. #define DMA_SxCR_TCIE ((uint32_t)0x00000010)
  1156. #define DMA_SxCR_HTIE ((uint32_t)0x00000008)
  1157. #define DMA_SxCR_TEIE ((uint32_t)0x00000004)
  1158. #define DMA_SxCR_DMEIE ((uint32_t)0x00000002)
  1159. #define DMA_SxCR_EN ((uint32_t)0x00000001)
  1160. /******************** Bits definition for DMA_SxCNDTR register **************/
  1161. #define DMA_SxNDT ((uint32_t)0x0000FFFF)
  1162. #define DMA_SxNDT_0 ((uint32_t)0x00000001)
  1163. #define DMA_SxNDT_1 ((uint32_t)0x00000002)
  1164. #define DMA_SxNDT_2 ((uint32_t)0x00000004)
  1165. #define DMA_SxNDT_3 ((uint32_t)0x00000008)
  1166. #define DMA_SxNDT_4 ((uint32_t)0x00000010)
  1167. #define DMA_SxNDT_5 ((uint32_t)0x00000020)
  1168. #define DMA_SxNDT_6 ((uint32_t)0x00000040)
  1169. #define DMA_SxNDT_7 ((uint32_t)0x00000080)
  1170. #define DMA_SxNDT_8 ((uint32_t)0x00000100)
  1171. #define DMA_SxNDT_9 ((uint32_t)0x00000200)
  1172. #define DMA_SxNDT_10 ((uint32_t)0x00000400)
  1173. #define DMA_SxNDT_11 ((uint32_t)0x00000800)
  1174. #define DMA_SxNDT_12 ((uint32_t)0x00001000)
  1175. #define DMA_SxNDT_13 ((uint32_t)0x00002000)
  1176. #define DMA_SxNDT_14 ((uint32_t)0x00004000)
  1177. #define DMA_SxNDT_15 ((uint32_t)0x00008000)
  1178. /******************** Bits definition for DMA_SxFCR register ****************/
  1179. #define DMA_SxFCR_FEIE ((uint32_t)0x00000080)
  1180. #define DMA_SxFCR_FS ((uint32_t)0x00000038)
  1181. #define DMA_SxFCR_FS_0 ((uint32_t)0x00000008)
  1182. #define DMA_SxFCR_FS_1 ((uint32_t)0x00000010)
  1183. #define DMA_SxFCR_FS_2 ((uint32_t)0x00000020)
  1184. #define DMA_SxFCR_DMDIS ((uint32_t)0x00000004)
  1185. #define DMA_SxFCR_FTH ((uint32_t)0x00000003)
  1186. #define DMA_SxFCR_FTH_0 ((uint32_t)0x00000001)
  1187. #define DMA_SxFCR_FTH_1 ((uint32_t)0x00000002)
  1188. /******************** Bits definition for DMA_LISR register *****************/
  1189. #define DMA_LISR_TCIF3 ((uint32_t)0x08000000)
  1190. #define DMA_LISR_HTIF3 ((uint32_t)0x04000000)
  1191. #define DMA_LISR_TEIF3 ((uint32_t)0x02000000)
  1192. #define DMA_LISR_DMEIF3 ((uint32_t)0x01000000)
  1193. #define DMA_LISR_FEIF3 ((uint32_t)0x00400000)
  1194. #define DMA_LISR_TCIF2 ((uint32_t)0x00200000)
  1195. #define DMA_LISR_HTIF2 ((uint32_t)0x00100000)
  1196. #define DMA_LISR_TEIF2 ((uint32_t)0x00080000)
  1197. #define DMA_LISR_DMEIF2 ((uint32_t)0x00040000)
  1198. #define DMA_LISR_FEIF2 ((uint32_t)0x00010000)
  1199. #define DMA_LISR_TCIF1 ((uint32_t)0x00000800)
  1200. #define DMA_LISR_HTIF1 ((uint32_t)0x00000400)
  1201. #define DMA_LISR_TEIF1 ((uint32_t)0x00000200)
  1202. #define DMA_LISR_DMEIF1 ((uint32_t)0x00000100)
  1203. #define DMA_LISR_FEIF1 ((uint32_t)0x00000040)
  1204. #define DMA_LISR_TCIF0 ((uint32_t)0x00000020)
  1205. #define DMA_LISR_HTIF0 ((uint32_t)0x00000010)
  1206. #define DMA_LISR_TEIF0 ((uint32_t)0x00000008)
  1207. #define DMA_LISR_DMEIF0 ((uint32_t)0x00000004)
  1208. #define DMA_LISR_FEIF0 ((uint32_t)0x00000001)
  1209. /******************** Bits definition for DMA_HISR register *****************/
  1210. #define DMA_HISR_TCIF7 ((uint32_t)0x08000000)
  1211. #define DMA_HISR_HTIF7 ((uint32_t)0x04000000)
  1212. #define DMA_HISR_TEIF7 ((uint32_t)0x02000000)
  1213. #define DMA_HISR_DMEIF7 ((uint32_t)0x01000000)
  1214. #define DMA_HISR_FEIF7 ((uint32_t)0x00400000)
  1215. #define DMA_HISR_TCIF6 ((uint32_t)0x00200000)
  1216. #define DMA_HISR_HTIF6 ((uint32_t)0x00100000)
  1217. #define DMA_HISR_TEIF6 ((uint32_t)0x00080000)
  1218. #define DMA_HISR_DMEIF6 ((uint32_t)0x00040000)
  1219. #define DMA_HISR_FEIF6 ((uint32_t)0x00010000)
  1220. #define DMA_HISR_TCIF5 ((uint32_t)0x00000800)
  1221. #define DMA_HISR_HTIF5 ((uint32_t)0x00000400)
  1222. #define DMA_HISR_TEIF5 ((uint32_t)0x00000200)
  1223. #define DMA_HISR_DMEIF5 ((uint32_t)0x00000100)
  1224. #define DMA_HISR_FEIF5 ((uint32_t)0x00000040)
  1225. #define DMA_HISR_TCIF4 ((uint32_t)0x00000020)
  1226. #define DMA_HISR_HTIF4 ((uint32_t)0x00000010)
  1227. #define DMA_HISR_TEIF4 ((uint32_t)0x00000008)
  1228. #define DMA_HISR_DMEIF4 ((uint32_t)0x00000004)
  1229. #define DMA_HISR_FEIF4 ((uint32_t)0x00000001)
  1230. /******************** Bits definition for DMA_LIFCR register ****************/
  1231. #define DMA_LIFCR_CTCIF3 ((uint32_t)0x08000000)
  1232. #define DMA_LIFCR_CHTIF3 ((uint32_t)0x04000000)
  1233. #define DMA_LIFCR_CTEIF3 ((uint32_t)0x02000000)
  1234. #define DMA_LIFCR_CDMEIF3 ((uint32_t)0x01000000)
  1235. #define DMA_LIFCR_CFEIF3 ((uint32_t)0x00400000)
  1236. #define DMA_LIFCR_CTCIF2 ((uint32_t)0x00200000)
  1237. #define DMA_LIFCR_CHTIF2 ((uint32_t)0x00100000)
  1238. #define DMA_LIFCR_CTEIF2 ((uint32_t)0x00080000)
  1239. #define DMA_LIFCR_CDMEIF2 ((uint32_t)0x00040000)
  1240. #define DMA_LIFCR_CFEIF2 ((uint32_t)0x00010000)
  1241. #define DMA_LIFCR_CTCIF1 ((uint32_t)0x00000800)
  1242. #define DMA_LIFCR_CHTIF1 ((uint32_t)0x00000400)
  1243. #define DMA_LIFCR_CTEIF1 ((uint32_t)0x00000200)
  1244. #define DMA_LIFCR_CDMEIF1 ((uint32_t)0x00000100)
  1245. #define DMA_LIFCR_CFEIF1 ((uint32_t)0x00000040)
  1246. #define DMA_LIFCR_CTCIF0 ((uint32_t)0x00000020)
  1247. #define DMA_LIFCR_CHTIF0 ((uint32_t)0x00000010)
  1248. #define DMA_LIFCR_CTEIF0 ((uint32_t)0x00000008)
  1249. #define DMA_LIFCR_CDMEIF0 ((uint32_t)0x00000004)
  1250. #define DMA_LIFCR_CFEIF0 ((uint32_t)0x00000001)
  1251. /******************** Bits definition for DMA_HIFCR register ****************/
  1252. #define DMA_HIFCR_CTCIF7 ((uint32_t)0x08000000)
  1253. #define DMA_HIFCR_CHTIF7 ((uint32_t)0x04000000)
  1254. #define DMA_HIFCR_CTEIF7 ((uint32_t)0x02000000)
  1255. #define DMA_HIFCR_CDMEIF7 ((uint32_t)0x01000000)
  1256. #define DMA_HIFCR_CFEIF7 ((uint32_t)0x00400000)
  1257. #define DMA_HIFCR_CTCIF6 ((uint32_t)0x00200000)
  1258. #define DMA_HIFCR_CHTIF6 ((uint32_t)0x00100000)
  1259. #define DMA_HIFCR_CTEIF6 ((uint32_t)0x00080000)
  1260. #define DMA_HIFCR_CDMEIF6 ((uint32_t)0x00040000)
  1261. #define DMA_HIFCR_CFEIF6 ((uint32_t)0x00010000)
  1262. #define DMA_HIFCR_CTCIF5 ((uint32_t)0x00000800)
  1263. #define DMA_HIFCR_CHTIF5 ((uint32_t)0x00000400)
  1264. #define DMA_HIFCR_CTEIF5 ((uint32_t)0x00000200)
  1265. #define DMA_HIFCR_CDMEIF5 ((uint32_t)0x00000100)
  1266. #define DMA_HIFCR_CFEIF5 ((uint32_t)0x00000040)
  1267. #define DMA_HIFCR_CTCIF4 ((uint32_t)0x00000020)
  1268. #define DMA_HIFCR_CHTIF4 ((uint32_t)0x00000010)
  1269. #define DMA_HIFCR_CTEIF4 ((uint32_t)0x00000008)
  1270. #define DMA_HIFCR_CDMEIF4 ((uint32_t)0x00000004)
  1271. #define DMA_HIFCR_CFEIF4 ((uint32_t)0x00000001)
  1272. /******************************************************************************/
  1273. /* */
  1274. /* External Interrupt/Event Controller */
  1275. /* */
  1276. /******************************************************************************/
  1277. /******************* Bit definition for EXTI_IMR register *******************/
  1278. #define EXTI_IMR_MR0 ((uint32_t)0x00000001) /*!< Interrupt Mask on line 0 */
  1279. #define EXTI_IMR_MR1 ((uint32_t)0x00000002) /*!< Interrupt Mask on line 1 */
  1280. #define EXTI_IMR_MR2 ((uint32_t)0x00000004) /*!< Interrupt Mask on line 2 */
  1281. #define EXTI_IMR_MR3 ((uint32_t)0x00000008) /*!< Interrupt Mask on line 3 */
  1282. #define EXTI_IMR_MR4 ((uint32_t)0x00000010) /*!< Interrupt Mask on line 4 */
  1283. #define EXTI_IMR_MR5 ((uint32_t)0x00000020) /*!< Interrupt Mask on line 5 */
  1284. #define EXTI_IMR_MR6 ((uint32_t)0x00000040) /*!< Interrupt Mask on line 6 */
  1285. #define EXTI_IMR_MR7 ((uint32_t)0x00000080) /*!< Interrupt Mask on line 7 */
  1286. #define EXTI_IMR_MR8 ((uint32_t)0x00000100) /*!< Interrupt Mask on line 8 */
  1287. #define EXTI_IMR_MR9 ((uint32_t)0x00000200) /*!< Interrupt Mask on line 9 */
  1288. #define EXTI_IMR_MR10 ((uint32_t)0x00000400) /*!< Interrupt Mask on line 10 */
  1289. #define EXTI_IMR_MR11 ((uint32_t)0x00000800) /*!< Interrupt Mask on line 11 */
  1290. #define EXTI_IMR_MR12 ((uint32_t)0x00001000) /*!< Interrupt Mask on line 12 */
  1291. #define EXTI_IMR_MR13 ((uint32_t)0x00002000) /*!< Interrupt Mask on line 13 */
  1292. #define EXTI_IMR_MR14 ((uint32_t)0x00004000) /*!< Interrupt Mask on line 14 */
  1293. #define EXTI_IMR_MR15 ((uint32_t)0x00008000) /*!< Interrupt Mask on line 15 */
  1294. #define EXTI_IMR_MR16 ((uint32_t)0x00010000) /*!< Interrupt Mask on line 16 */
  1295. #define EXTI_IMR_MR17 ((uint32_t)0x00020000) /*!< Interrupt Mask on line 17 */
  1296. #define EXTI_IMR_MR18 ((uint32_t)0x00040000) /*!< Interrupt Mask on line 18 */
  1297. #define EXTI_IMR_MR19 ((uint32_t)0x00080000) /*!< Interrupt Mask on line 19 */
  1298. #define EXTI_IMR_MR20 ((uint32_t)0x00100000) /*!< Interrupt Mask on line 20 */
  1299. #define EXTI_IMR_MR21 ((uint32_t)0x00200000) /*!< Interrupt Mask on line 21 */
  1300. #define EXTI_IMR_MR22 ((uint32_t)0x00400000) /*!< Interrupt Mask on line 22 */
  1301. /******************* Bit definition for EXTI_EMR register *******************/
  1302. #define EXTI_EMR_MR0 ((uint32_t)0x00000001) /*!< Event Mask on line 0 */
  1303. #define EXTI_EMR_MR1 ((uint32_t)0x00000002) /*!< Event Mask on line 1 */
  1304. #define EXTI_EMR_MR2 ((uint32_t)0x00000004) /*!< Event Mask on line 2 */
  1305. #define EXTI_EMR_MR3 ((uint32_t)0x00000008) /*!< Event Mask on line 3 */
  1306. #define EXTI_EMR_MR4 ((uint32_t)0x00000010) /*!< Event Mask on line 4 */
  1307. #define EXTI_EMR_MR5 ((uint32_t)0x00000020) /*!< Event Mask on line 5 */
  1308. #define EXTI_EMR_MR6 ((uint32_t)0x00000040) /*!< Event Mask on line 6 */
  1309. #define EXTI_EMR_MR7 ((uint32_t)0x00000080) /*!< Event Mask on line 7 */
  1310. #define EXTI_EMR_MR8 ((uint32_t)0x00000100) /*!< Event Mask on line 8 */
  1311. #define EXTI_EMR_MR9 ((uint32_t)0x00000200) /*!< Event Mask on line 9 */
  1312. #define EXTI_EMR_MR10 ((uint32_t)0x00000400) /*!< Event Mask on line 10 */
  1313. #define EXTI_EMR_MR11 ((uint32_t)0x00000800) /*!< Event Mask on line 11 */
  1314. #define EXTI_EMR_MR12 ((uint32_t)0x00001000) /*!< Event Mask on line 12 */
  1315. #define EXTI_EMR_MR13 ((uint32_t)0x00002000) /*!< Event Mask on line 13 */
  1316. #define EXTI_EMR_MR14 ((uint32_t)0x00004000) /*!< Event Mask on line 14 */
  1317. #define EXTI_EMR_MR15 ((uint32_t)0x00008000) /*!< Event Mask on line 15 */
  1318. #define EXTI_EMR_MR16 ((uint32_t)0x00010000) /*!< Event Mask on line 16 */
  1319. #define EXTI_EMR_MR17 ((uint32_t)0x00020000) /*!< Event Mask on line 17 */
  1320. #define EXTI_EMR_MR18 ((uint32_t)0x00040000) /*!< Event Mask on line 18 */
  1321. #define EXTI_EMR_MR19 ((uint32_t)0x00080000) /*!< Event Mask on line 19 */
  1322. #define EXTI_EMR_MR20 ((uint32_t)0x00100000) /*!< Event Mask on line 20 */
  1323. #define EXTI_EMR_MR21 ((uint32_t)0x00200000) /*!< Event Mask on line 21 */
  1324. #define EXTI_EMR_MR22 ((uint32_t)0x00400000) /*!< Event Mask on line 22 */
  1325. /****************** Bit definition for EXTI_RTSR register *******************/
  1326. #define EXTI_RTSR_TR0 ((uint32_t)0x00000001) /*!< Rising trigger event configuration bit of line 0 */
  1327. #define EXTI_RTSR_TR1 ((uint32_t)0x00000002) /*!< Rising trigger event configuration bit of line 1 */
  1328. #define EXTI_RTSR_TR2 ((uint32_t)0x00000004) /*!< Rising trigger event configuration bit of line 2 */
  1329. #define EXTI_RTSR_TR3 ((uint32_t)0x00000008) /*!< Rising trigger event configuration bit of line 3 */
  1330. #define EXTI_RTSR_TR4 ((uint32_t)0x00000010) /*!< Rising trigger event configuration bit of line 4 */
  1331. #define EXTI_RTSR_TR5 ((uint32_t)0x00000020) /*!< Rising trigger event configuration bit of line 5 */
  1332. #define EXTI_RTSR_TR6 ((uint32_t)0x00000040) /*!< Rising trigger event configuration bit of line 6 */
  1333. #define EXTI_RTSR_TR7 ((uint32_t)0x00000080) /*!< Rising trigger event configuration bit of line 7 */
  1334. #define EXTI_RTSR_TR8 ((uint32_t)0x00000100) /*!< Rising trigger event configuration bit of line 8 */
  1335. #define EXTI_RTSR_TR9 ((uint32_t)0x00000200) /*!< Rising trigger event configuration bit of line 9 */
  1336. #define EXTI_RTSR_TR10 ((uint32_t)0x00000400) /*!< Rising trigger event configuration bit of line 10 */
  1337. #define EXTI_RTSR_TR11 ((uint32_t)0x00000800) /*!< Rising trigger event configuration bit of line 11 */
  1338. #define EXTI_RTSR_TR12 ((uint32_t)0x00001000) /*!< Rising trigger event configuration bit of line 12 */
  1339. #define EXTI_RTSR_TR13 ((uint32_t)0x00002000) /*!< Rising trigger event configuration bit of line 13 */
  1340. #define EXTI_RTSR_TR14 ((uint32_t)0x00004000) /*!< Rising trigger event configuration bit of line 14 */
  1341. #define EXTI_RTSR_TR15 ((uint32_t)0x00008000) /*!< Rising trigger event configuration bit of line 15 */
  1342. #define EXTI_RTSR_TR16 ((uint32_t)0x00010000) /*!< Rising trigger event configuration bit of line 16 */
  1343. #define EXTI_RTSR_TR17 ((uint32_t)0x00020000) /*!< Rising trigger event configuration bit of line 17 */
  1344. #define EXTI_RTSR_TR18 ((uint32_t)0x00040000) /*!< Rising trigger event configuration bit of line 18 */
  1345. #define EXTI_RTSR_TR19 ((uint32_t)0x00080000) /*!< Rising trigger event configuration bit of line 19 */
  1346. #define EXTI_RTSR_TR20 ((uint32_t)0x00100000) /*!< Rising trigger event configuration bit of line 20 */
  1347. #define EXTI_RTSR_TR21 ((uint32_t)0x00200000) /*!< Rising trigger event configuration bit of line 21 */
  1348. #define EXTI_RTSR_TR22 ((uint32_t)0x00400000) /*!< Rising trigger event configuration bit of line 22 */
  1349. /****************** Bit definition for EXTI_FTSR register *******************/
  1350. #define EXTI_FTSR_TR0 ((uint32_t)0x00000001) /*!< Falling trigger event configuration bit of line 0 */
  1351. #define EXTI_FTSR_TR1 ((uint32_t)0x00000002) /*!< Falling trigger event configuration bit of line 1 */
  1352. #define EXTI_FTSR_TR2 ((uint32_t)0x00000004) /*!< Falling trigger event configuration bit of line 2 */
  1353. #define EXTI_FTSR_TR3 ((uint32_t)0x00000008) /*!< Falling trigger event configuration bit of line 3 */
  1354. #define EXTI_FTSR_TR4 ((uint32_t)0x00000010) /*!< Falling trigger event configuration bit of line 4 */
  1355. #define EXTI_FTSR_TR5 ((uint32_t)0x00000020) /*!< Falling trigger event configuration bit of line 5 */
  1356. #define EXTI_FTSR_TR6 ((uint32_t)0x00000040) /*!< Falling trigger event configuration bit of line 6 */
  1357. #define EXTI_FTSR_TR7 ((uint32_t)0x00000080) /*!< Falling trigger event configuration bit of line 7 */
  1358. #define EXTI_FTSR_TR8 ((uint32_t)0x00000100) /*!< Falling trigger event configuration bit of line 8 */
  1359. #define EXTI_FTSR_TR9 ((uint32_t)0x00000200) /*!< Falling trigger event configuration bit of line 9 */
  1360. #define EXTI_FTSR_TR10 ((uint32_t)0x00000400) /*!< Falling trigger event configuration bit of line 10 */
  1361. #define EXTI_FTSR_TR11 ((uint32_t)0x00000800) /*!< Falling trigger event configuration bit of line 11 */
  1362. #define EXTI_FTSR_TR12 ((uint32_t)0x00001000) /*!< Falling trigger event configuration bit of line 12 */
  1363. #define EXTI_FTSR_TR13 ((uint32_t)0x00002000) /*!< Falling trigger event configuration bit of line 13 */
  1364. #define EXTI_FTSR_TR14 ((uint32_t)0x00004000) /*!< Falling trigger event configuration bit of line 14 */
  1365. #define EXTI_FTSR_TR15 ((uint32_t)0x00008000) /*!< Falling trigger event configuration bit of line 15 */
  1366. #define EXTI_FTSR_TR16 ((uint32_t)0x00010000) /*!< Falling trigger event configuration bit of line 16 */
  1367. #define EXTI_FTSR_TR17 ((uint32_t)0x00020000) /*!< Falling trigger event configuration bit of line 17 */
  1368. #define EXTI_FTSR_TR18 ((uint32_t)0x00040000) /*!< Falling trigger event configuration bit of line 18 */
  1369. #define EXTI_FTSR_TR19 ((uint32_t)0x00080000) /*!< Falling trigger event configuration bit of line 19 */
  1370. #define EXTI_FTSR_TR20 ((uint32_t)0x00100000) /*!< Falling trigger event configuration bit of line 20 */
  1371. #define EXTI_FTSR_TR21 ((uint32_t)0x00200000) /*!< Falling trigger event configuration bit of line 21 */
  1372. #define EXTI_FTSR_TR22 ((uint32_t)0x00400000) /*!< Falling trigger event configuration bit of line 22 */
  1373. /****************** Bit definition for EXTI_SWIER register ******************/
  1374. #define EXTI_SWIER_SWIER0 ((uint32_t)0x00000001) /*!< Software Interrupt on line 0 */
  1375. #define EXTI_SWIER_SWIER1 ((uint32_t)0x00000002) /*!< Software Interrupt on line 1 */
  1376. #define EXTI_SWIER_SWIER2 ((uint32_t)0x00000004) /*!< Software Interrupt on line 2 */
  1377. #define EXTI_SWIER_SWIER3 ((uint32_t)0x00000008) /*!< Software Interrupt on line 3 */
  1378. #define EXTI_SWIER_SWIER4 ((uint32_t)0x00000010) /*!< Software Interrupt on line 4 */
  1379. #define EXTI_SWIER_SWIER5 ((uint32_t)0x00000020) /*!< Software Interrupt on line 5 */
  1380. #define EXTI_SWIER_SWIER6 ((uint32_t)0x00000040) /*!< Software Interrupt on line 6 */
  1381. #define EXTI_SWIER_SWIER7 ((uint32_t)0x00000080) /*!< Software Interrupt on line 7 */
  1382. #define EXTI_SWIER_SWIER8 ((uint32_t)0x00000100) /*!< Software Interrupt on line 8 */
  1383. #define EXTI_SWIER_SWIER9 ((uint32_t)0x00000200) /*!< Software Interrupt on line 9 */
  1384. #define EXTI_SWIER_SWIER10 ((uint32_t)0x00000400) /*!< Software Interrupt on line 10 */
  1385. #define EXTI_SWIER_SWIER11 ((uint32_t)0x00000800) /*!< Software Interrupt on line 11 */
  1386. #define EXTI_SWIER_SWIER12 ((uint32_t)0x00001000) /*!< Software Interrupt on line 12 */
  1387. #define EXTI_SWIER_SWIER13 ((uint32_t)0x00002000) /*!< Software Interrupt on line 13 */
  1388. #define EXTI_SWIER_SWIER14 ((uint32_t)0x00004000) /*!< Software Interrupt on line 14 */
  1389. #define EXTI_SWIER_SWIER15 ((uint32_t)0x00008000) /*!< Software Interrupt on line 15 */
  1390. #define EXTI_SWIER_SWIER16 ((uint32_t)0x00010000) /*!< Software Interrupt on line 16 */
  1391. #define EXTI_SWIER_SWIER17 ((uint32_t)0x00020000) /*!< Software Interrupt on line 17 */
  1392. #define EXTI_SWIER_SWIER18 ((uint32_t)0x00040000) /*!< Software Interrupt on line 18 */
  1393. #define EXTI_SWIER_SWIER19 ((uint32_t)0x00080000) /*!< Software Interrupt on line 19 */
  1394. #define EXTI_SWIER_SWIER20 ((uint32_t)0x00100000) /*!< Software Interrupt on line 20 */
  1395. #define EXTI_SWIER_SWIER21 ((uint32_t)0x00200000) /*!< Software Interrupt on line 21 */
  1396. #define EXTI_SWIER_SWIER22 ((uint32_t)0x00400000) /*!< Software Interrupt on line 22 */
  1397. /******************* Bit definition for EXTI_PR register ********************/
  1398. #define EXTI_PR_PR0 ((uint32_t)0x00000001) /*!< Pending bit for line 0 */
  1399. #define EXTI_PR_PR1 ((uint32_t)0x00000002) /*!< Pending bit for line 1 */
  1400. #define EXTI_PR_PR2 ((uint32_t)0x00000004) /*!< Pending bit for line 2 */
  1401. #define EXTI_PR_PR3 ((uint32_t)0x00000008) /*!< Pending bit for line 3 */
  1402. #define EXTI_PR_PR4 ((uint32_t)0x00000010) /*!< Pending bit for line 4 */
  1403. #define EXTI_PR_PR5 ((uint32_t)0x00000020) /*!< Pending bit for line 5 */
  1404. #define EXTI_PR_PR6 ((uint32_t)0x00000040) /*!< Pending bit for line 6 */
  1405. #define EXTI_PR_PR7 ((uint32_t)0x00000080) /*!< Pending bit for line 7 */
  1406. #define EXTI_PR_PR8 ((uint32_t)0x00000100) /*!< Pending bit for line 8 */
  1407. #define EXTI_PR_PR9 ((uint32_t)0x00000200) /*!< Pending bit for line 9 */
  1408. #define EXTI_PR_PR10 ((uint32_t)0x00000400) /*!< Pending bit for line 10 */
  1409. #define EXTI_PR_PR11 ((uint32_t)0x00000800) /*!< Pending bit for line 11 */
  1410. #define EXTI_PR_PR12 ((uint32_t)0x00001000) /*!< Pending bit for line 12 */
  1411. #define EXTI_PR_PR13 ((uint32_t)0x00002000) /*!< Pending bit for line 13 */
  1412. #define EXTI_PR_PR14 ((uint32_t)0x00004000) /*!< Pending bit for line 14 */
  1413. #define EXTI_PR_PR15 ((uint32_t)0x00008000) /*!< Pending bit for line 15 */
  1414. #define EXTI_PR_PR16 ((uint32_t)0x00010000) /*!< Pending bit for line 16 */
  1415. #define EXTI_PR_PR17 ((uint32_t)0x00020000) /*!< Pending bit for line 17 */
  1416. #define EXTI_PR_PR18 ((uint32_t)0x00040000) /*!< Pending bit for line 18 */
  1417. #define EXTI_PR_PR19 ((uint32_t)0x00080000) /*!< Pending bit for line 19 */
  1418. #define EXTI_PR_PR20 ((uint32_t)0x00100000) /*!< Pending bit for line 20 */
  1419. #define EXTI_PR_PR21 ((uint32_t)0x00200000) /*!< Pending bit for line 21 */
  1420. #define EXTI_PR_PR22 ((uint32_t)0x00400000) /*!< Pending bit for line 22 */
  1421. /******************************************************************************/
  1422. /* */
  1423. /* FLASH */
  1424. /* */
  1425. /******************************************************************************/
  1426. /******************* Bits definition for FLASH_ACR register *****************/
  1427. #define FLASH_ACR_LATENCY ((uint32_t)0x0000000F)
  1428. #define FLASH_ACR_LATENCY_0WS ((uint32_t)0x00000000)
  1429. #define FLASH_ACR_LATENCY_1WS ((uint32_t)0x00000001)
  1430. #define FLASH_ACR_LATENCY_2WS ((uint32_t)0x00000002)
  1431. #define FLASH_ACR_LATENCY_3WS ((uint32_t)0x00000003)
  1432. #define FLASH_ACR_LATENCY_4WS ((uint32_t)0x00000004)
  1433. #define FLASH_ACR_LATENCY_5WS ((uint32_t)0x00000005)
  1434. #define FLASH_ACR_LATENCY_6WS ((uint32_t)0x00000006)
  1435. #define FLASH_ACR_LATENCY_7WS ((uint32_t)0x00000007)
  1436. #define FLASH_ACR_PRFTEN ((uint32_t)0x00000100)
  1437. #define FLASH_ACR_ICEN ((uint32_t)0x00000200)
  1438. #define FLASH_ACR_DCEN ((uint32_t)0x00000400)
  1439. #define FLASH_ACR_ICRST ((uint32_t)0x00000800)
  1440. #define FLASH_ACR_DCRST ((uint32_t)0x00001000)
  1441. #define FLASH_ACR_BYTE0_ADDRESS ((uint32_t)0x40023C00)
  1442. #define FLASH_ACR_BYTE2_ADDRESS ((uint32_t)0x40023C03)
  1443. /******************* Bits definition for FLASH_SR register ******************/
  1444. #define FLASH_SR_EOP ((uint32_t)0x00000001)
  1445. #define FLASH_SR_SOP ((uint32_t)0x00000002)
  1446. #define FLASH_SR_WRPERR ((uint32_t)0x00000010)
  1447. #define FLASH_SR_PGAERR ((uint32_t)0x00000020)
  1448. #define FLASH_SR_PGPERR ((uint32_t)0x00000040)
  1449. #define FLASH_SR_PGSERR ((uint32_t)0x00000080)
  1450. #define FLASH_SR_BSY ((uint32_t)0x00010000)
  1451. /******************* Bits definition for FLASH_CR register ******************/
  1452. #define FLASH_CR_PG ((uint32_t)0x00000001)
  1453. #define FLASH_CR_SER ((uint32_t)0x00000002)
  1454. #define FLASH_CR_MER ((uint32_t)0x00000004)
  1455. #define FLASH_CR_SNB ((uint32_t)0x000000F8)
  1456. #define FLASH_CR_SNB_0 ((uint32_t)0x00000008)
  1457. #define FLASH_CR_SNB_1 ((uint32_t)0x00000010)
  1458. #define FLASH_CR_SNB_2 ((uint32_t)0x00000020)
  1459. #define FLASH_CR_SNB_3 ((uint32_t)0x00000040)
  1460. #define FLASH_CR_SNB_4 ((uint32_t)0x00000080)
  1461. #define FLASH_CR_PSIZE ((uint32_t)0x00000300)
  1462. #define FLASH_CR_PSIZE_0 ((uint32_t)0x00000100)
  1463. #define FLASH_CR_PSIZE_1 ((uint32_t)0x00000200)
  1464. #define FLASH_CR_STRT ((uint32_t)0x00010000)
  1465. #define FLASH_CR_EOPIE ((uint32_t)0x01000000)
  1466. #define FLASH_CR_LOCK ((uint32_t)0x80000000)
  1467. /******************* Bits definition for FLASH_OPTCR register ***************/
  1468. #define FLASH_OPTCR_OPTLOCK ((uint32_t)0x00000001)
  1469. #define FLASH_OPTCR_OPTSTRT ((uint32_t)0x00000002)
  1470. #define FLASH_OPTCR_BOR_LEV_0 ((uint32_t)0x00000004)
  1471. #define FLASH_OPTCR_BOR_LEV_1 ((uint32_t)0x00000008)
  1472. #define FLASH_OPTCR_BOR_LEV ((uint32_t)0x0000000C)
  1473. #define FLASH_OPTCR_WDG_SW ((uint32_t)0x00000020)
  1474. #define FLASH_OPTCR_nRST_STOP ((uint32_t)0x00000040)
  1475. #define FLASH_OPTCR_nRST_STDBY ((uint32_t)0x00000080)
  1476. #define FLASH_OPTCR_RDP ((uint32_t)0x0000FF00)
  1477. #define FLASH_OPTCR_RDP_0 ((uint32_t)0x00000100)
  1478. #define FLASH_OPTCR_RDP_1 ((uint32_t)0x00000200)
  1479. #define FLASH_OPTCR_RDP_2 ((uint32_t)0x00000400)
  1480. #define FLASH_OPTCR_RDP_3 ((uint32_t)0x00000800)
  1481. #define FLASH_OPTCR_RDP_4 ((uint32_t)0x00001000)
  1482. #define FLASH_OPTCR_RDP_5 ((uint32_t)0x00002000)
  1483. #define FLASH_OPTCR_RDP_6 ((uint32_t)0x00004000)
  1484. #define FLASH_OPTCR_RDP_7 ((uint32_t)0x00008000)
  1485. #define FLASH_OPTCR_nWRP ((uint32_t)0x0FFF0000)
  1486. #define FLASH_OPTCR_nWRP_0 ((uint32_t)0x00010000)
  1487. #define FLASH_OPTCR_nWRP_1 ((uint32_t)0x00020000)
  1488. #define FLASH_OPTCR_nWRP_2 ((uint32_t)0x00040000)
  1489. #define FLASH_OPTCR_nWRP_3 ((uint32_t)0x00080000)
  1490. #define FLASH_OPTCR_nWRP_4 ((uint32_t)0x00100000)
  1491. #define FLASH_OPTCR_nWRP_5 ((uint32_t)0x00200000)
  1492. #define FLASH_OPTCR_nWRP_6 ((uint32_t)0x00400000)
  1493. #define FLASH_OPTCR_nWRP_7 ((uint32_t)0x00800000)
  1494. #define FLASH_OPTCR_nWRP_8 ((uint32_t)0x01000000)
  1495. #define FLASH_OPTCR_nWRP_9 ((uint32_t)0x02000000)
  1496. #define FLASH_OPTCR_nWRP_10 ((uint32_t)0x04000000)
  1497. #define FLASH_OPTCR_nWRP_11 ((uint32_t)0x08000000)
  1498. /****************** Bits definition for FLASH_OPTCR1 register ***************/
  1499. #define FLASH_OPTCR1_nWRP ((uint32_t)0x0FFF0000)
  1500. #define FLASH_OPTCR1_nWRP_0 ((uint32_t)0x00010000)
  1501. #define FLASH_OPTCR1_nWRP_1 ((uint32_t)0x00020000)
  1502. #define FLASH_OPTCR1_nWRP_2 ((uint32_t)0x00040000)
  1503. #define FLASH_OPTCR1_nWRP_3 ((uint32_t)0x00080000)
  1504. #define FLASH_OPTCR1_nWRP_4 ((uint32_t)0x00100000)
  1505. #define FLASH_OPTCR1_nWRP_5 ((uint32_t)0x00200000)
  1506. #define FLASH_OPTCR1_nWRP_6 ((uint32_t)0x00400000)
  1507. #define FLASH_OPTCR1_nWRP_7 ((uint32_t)0x00800000)
  1508. #define FLASH_OPTCR1_nWRP_8 ((uint32_t)0x01000000)
  1509. #define FLASH_OPTCR1_nWRP_9 ((uint32_t)0x02000000)
  1510. #define FLASH_OPTCR1_nWRP_10 ((uint32_t)0x04000000)
  1511. #define FLASH_OPTCR1_nWRP_11 ((uint32_t)0x08000000)
  1512. /******************************************************************************/
  1513. /* */
  1514. /* General Purpose I/O */
  1515. /* */
  1516. /******************************************************************************/
  1517. /****************** Bits definition for GPIO_MODER register *****************/
  1518. #define GPIO_MODER_MODER0 ((uint32_t)0x00000003)
  1519. #define GPIO_MODER_MODER0_0 ((uint32_t)0x00000001)
  1520. #define GPIO_MODER_MODER0_1 ((uint32_t)0x00000002)
  1521. #define GPIO_MODER_MODER1 ((uint32_t)0x0000000C)
  1522. #define GPIO_MODER_MODER1_0 ((uint32_t)0x00000004)
  1523. #define GPIO_MODER_MODER1_1 ((uint32_t)0x00000008)
  1524. #define GPIO_MODER_MODER2 ((uint32_t)0x00000030)
  1525. #define GPIO_MODER_MODER2_0 ((uint32_t)0x00000010)
  1526. #define GPIO_MODER_MODER2_1 ((uint32_t)0x00000020)
  1527. #define GPIO_MODER_MODER3 ((uint32_t)0x000000C0)
  1528. #define GPIO_MODER_MODER3_0 ((uint32_t)0x00000040)
  1529. #define GPIO_MODER_MODER3_1 ((uint32_t)0x00000080)
  1530. #define GPIO_MODER_MODER4 ((uint32_t)0x00000300)
  1531. #define GPIO_MODER_MODER4_0 ((uint32_t)0x00000100)
  1532. #define GPIO_MODER_MODER4_1 ((uint32_t)0x00000200)
  1533. #define GPIO_MODER_MODER5 ((uint32_t)0x00000C00)
  1534. #define GPIO_MODER_MODER5_0 ((uint32_t)0x00000400)
  1535. #define GPIO_MODER_MODER5_1 ((uint32_t)0x00000800)
  1536. #define GPIO_MODER_MODER6 ((uint32_t)0x00003000)
  1537. #define GPIO_MODER_MODER6_0 ((uint32_t)0x00001000)
  1538. #define GPIO_MODER_MODER6_1 ((uint32_t)0x00002000)
  1539. #define GPIO_MODER_MODER7 ((uint32_t)0x0000C000)
  1540. #define GPIO_MODER_MODER7_0 ((uint32_t)0x00004000)
  1541. #define GPIO_MODER_MODER7_1 ((uint32_t)0x00008000)
  1542. #define GPIO_MODER_MODER8 ((uint32_t)0x00030000)
  1543. #define GPIO_MODER_MODER8_0 ((uint32_t)0x00010000)
  1544. #define GPIO_MODER_MODER8_1 ((uint32_t)0x00020000)
  1545. #define GPIO_MODER_MODER9 ((uint32_t)0x000C0000)
  1546. #define GPIO_MODER_MODER9_0 ((uint32_t)0x00040000)
  1547. #define GPIO_MODER_MODER9_1 ((uint32_t)0x00080000)
  1548. #define GPIO_MODER_MODER10 ((uint32_t)0x00300000)
  1549. #define GPIO_MODER_MODER10_0 ((uint32_t)0x00100000)
  1550. #define GPIO_MODER_MODER10_1 ((uint32_t)0x00200000)
  1551. #define GPIO_MODER_MODER11 ((uint32_t)0x00C00000)
  1552. #define GPIO_MODER_MODER11_0 ((uint32_t)0x00400000)
  1553. #define GPIO_MODER_MODER11_1 ((uint32_t)0x00800000)
  1554. #define GPIO_MODER_MODER12 ((uint32_t)0x03000000)
  1555. #define GPIO_MODER_MODER12_0 ((uint32_t)0x01000000)
  1556. #define GPIO_MODER_MODER12_1 ((uint32_t)0x02000000)
  1557. #define GPIO_MODER_MODER13 ((uint32_t)0x0C000000)
  1558. #define GPIO_MODER_MODER13_0 ((uint32_t)0x04000000)
  1559. #define GPIO_MODER_MODER13_1 ((uint32_t)0x08000000)
  1560. #define GPIO_MODER_MODER14 ((uint32_t)0x30000000)
  1561. #define GPIO_MODER_MODER14_0 ((uint32_t)0x10000000)
  1562. #define GPIO_MODER_MODER14_1 ((uint32_t)0x20000000)
  1563. #define GPIO_MODER_MODER15 ((uint32_t)0xC0000000)
  1564. #define GPIO_MODER_MODER15_0 ((uint32_t)0x40000000)
  1565. #define GPIO_MODER_MODER15_1 ((uint32_t)0x80000000)
  1566. /****************** Bits definition for GPIO_OTYPER register ****************/
  1567. #define GPIO_OTYPER_OT_0 ((uint32_t)0x00000001)
  1568. #define GPIO_OTYPER_OT_1 ((uint32_t)0x00000002)
  1569. #define GPIO_OTYPER_OT_2 ((uint32_t)0x00000004)
  1570. #define GPIO_OTYPER_OT_3 ((uint32_t)0x00000008)
  1571. #define GPIO_OTYPER_OT_4 ((uint32_t)0x00000010)
  1572. #define GPIO_OTYPER_OT_5 ((uint32_t)0x00000020)
  1573. #define GPIO_OTYPER_OT_6 ((uint32_t)0x00000040)
  1574. #define GPIO_OTYPER_OT_7 ((uint32_t)0x00000080)
  1575. #define GPIO_OTYPER_OT_8 ((uint32_t)0x00000100)
  1576. #define GPIO_OTYPER_OT_9 ((uint32_t)0x00000200)
  1577. #define GPIO_OTYPER_OT_10 ((uint32_t)0x00000400)
  1578. #define GPIO_OTYPER_OT_11 ((uint32_t)0x00000800)
  1579. #define GPIO_OTYPER_OT_12 ((uint32_t)0x00001000)
  1580. #define GPIO_OTYPER_OT_13 ((uint32_t)0x00002000)
  1581. #define GPIO_OTYPER_OT_14 ((uint32_t)0x00004000)
  1582. #define GPIO_OTYPER_OT_15 ((uint32_t)0x00008000)
  1583. /****************** Bits definition for GPIO_OSPEEDR register ***************/
  1584. #define GPIO_OSPEEDER_OSPEEDR0 ((uint32_t)0x00000003)
  1585. #define GPIO_OSPEEDER_OSPEEDR0_0 ((uint32_t)0x00000001)
  1586. #define GPIO_OSPEEDER_OSPEEDR0_1 ((uint32_t)0x00000002)
  1587. #define GPIO_OSPEEDER_OSPEEDR1 ((uint32_t)0x0000000C)
  1588. #define GPIO_OSPEEDER_OSPEEDR1_0 ((uint32_t)0x00000004)
  1589. #define GPIO_OSPEEDER_OSPEEDR1_1 ((uint32_t)0x00000008)
  1590. #define GPIO_OSPEEDER_OSPEEDR2 ((uint32_t)0x00000030)
  1591. #define GPIO_OSPEEDER_OSPEEDR2_0 ((uint32_t)0x00000010)
  1592. #define GPIO_OSPEEDER_OSPEEDR2_1 ((uint32_t)0x00000020)
  1593. #define GPIO_OSPEEDER_OSPEEDR3 ((uint32_t)0x000000C0)
  1594. #define GPIO_OSPEEDER_OSPEEDR3_0 ((uint32_t)0x00000040)
  1595. #define GPIO_OSPEEDER_OSPEEDR3_1 ((uint32_t)0x00000080)
  1596. #define GPIO_OSPEEDER_OSPEEDR4 ((uint32_t)0x00000300)
  1597. #define GPIO_OSPEEDER_OSPEEDR4_0 ((uint32_t)0x00000100)
  1598. #define GPIO_OSPEEDER_OSPEEDR4_1 ((uint32_t)0x00000200)
  1599. #define GPIO_OSPEEDER_OSPEEDR5 ((uint32_t)0x00000C00)
  1600. #define GPIO_OSPEEDER_OSPEEDR5_0 ((uint32_t)0x00000400)
  1601. #define GPIO_OSPEEDER_OSPEEDR5_1 ((uint32_t)0x00000800)
  1602. #define GPIO_OSPEEDER_OSPEEDR6 ((uint32_t)0x00003000)
  1603. #define GPIO_OSPEEDER_OSPEEDR6_0 ((uint32_t)0x00001000)
  1604. #define GPIO_OSPEEDER_OSPEEDR6_1 ((uint32_t)0x00002000)
  1605. #define GPIO_OSPEEDER_OSPEEDR7 ((uint32_t)0x0000C000)
  1606. #define GPIO_OSPEEDER_OSPEEDR7_0 ((uint32_t)0x00004000)
  1607. #define GPIO_OSPEEDER_OSPEEDR7_1 ((uint32_t)0x00008000)
  1608. #define GPIO_OSPEEDER_OSPEEDR8 ((uint32_t)0x00030000)
  1609. #define GPIO_OSPEEDER_OSPEEDR8_0 ((uint32_t)0x00010000)
  1610. #define GPIO_OSPEEDER_OSPEEDR8_1 ((uint32_t)0x00020000)
  1611. #define GPIO_OSPEEDER_OSPEEDR9 ((uint32_t)0x000C0000)
  1612. #define GPIO_OSPEEDER_OSPEEDR9_0 ((uint32_t)0x00040000)
  1613. #define GPIO_OSPEEDER_OSPEEDR9_1 ((uint32_t)0x00080000)
  1614. #define GPIO_OSPEEDER_OSPEEDR10 ((uint32_t)0x00300000)
  1615. #define GPIO_OSPEEDER_OSPEEDR10_0 ((uint32_t)0x00100000)
  1616. #define GPIO_OSPEEDER_OSPEEDR10_1 ((uint32_t)0x00200000)
  1617. #define GPIO_OSPEEDER_OSPEEDR11 ((uint32_t)0x00C00000)
  1618. #define GPIO_OSPEEDER_OSPEEDR11_0 ((uint32_t)0x00400000)
  1619. #define GPIO_OSPEEDER_OSPEEDR11_1 ((uint32_t)0x00800000)
  1620. #define GPIO_OSPEEDER_OSPEEDR12 ((uint32_t)0x03000000)
  1621. #define GPIO_OSPEEDER_OSPEEDR12_0 ((uint32_t)0x01000000)
  1622. #define GPIO_OSPEEDER_OSPEEDR12_1 ((uint32_t)0x02000000)
  1623. #define GPIO_OSPEEDER_OSPEEDR13 ((uint32_t)0x0C000000)
  1624. #define GPIO_OSPEEDER_OSPEEDR13_0 ((uint32_t)0x04000000)
  1625. #define GPIO_OSPEEDER_OSPEEDR13_1 ((uint32_t)0x08000000)
  1626. #define GPIO_OSPEEDER_OSPEEDR14 ((uint32_t)0x30000000)
  1627. #define GPIO_OSPEEDER_OSPEEDR14_0 ((uint32_t)0x10000000)
  1628. #define GPIO_OSPEEDER_OSPEEDR14_1 ((uint32_t)0x20000000)
  1629. #define GPIO_OSPEEDER_OSPEEDR15 ((uint32_t)0xC0000000)
  1630. #define GPIO_OSPEEDER_OSPEEDR15_0 ((uint32_t)0x40000000)
  1631. #define GPIO_OSPEEDER_OSPEEDR15_1 ((uint32_t)0x80000000)
  1632. /****************** Bits definition for GPIO_PUPDR register *****************/
  1633. #define GPIO_PUPDR_PUPDR0 ((uint32_t)0x00000003)
  1634. #define GPIO_PUPDR_PUPDR0_0 ((uint32_t)0x00000001)
  1635. #define GPIO_PUPDR_PUPDR0_1 ((uint32_t)0x00000002)
  1636. #define GPIO_PUPDR_PUPDR1 ((uint32_t)0x0000000C)
  1637. #define GPIO_PUPDR_PUPDR1_0 ((uint32_t)0x00000004)
  1638. #define GPIO_PUPDR_PUPDR1_1 ((uint32_t)0x00000008)
  1639. #define GPIO_PUPDR_PUPDR2 ((uint32_t)0x00000030)
  1640. #define GPIO_PUPDR_PUPDR2_0 ((uint32_t)0x00000010)
  1641. #define GPIO_PUPDR_PUPDR2_1 ((uint32_t)0x00000020)
  1642. #define GPIO_PUPDR_PUPDR3 ((uint32_t)0x000000C0)
  1643. #define GPIO_PUPDR_PUPDR3_0 ((uint32_t)0x00000040)
  1644. #define GPIO_PUPDR_PUPDR3_1 ((uint32_t)0x00000080)
  1645. #define GPIO_PUPDR_PUPDR4 ((uint32_t)0x00000300)
  1646. #define GPIO_PUPDR_PUPDR4_0 ((uint32_t)0x00000100)
  1647. #define GPIO_PUPDR_PUPDR4_1 ((uint32_t)0x00000200)
  1648. #define GPIO_PUPDR_PUPDR5 ((uint32_t)0x00000C00)
  1649. #define GPIO_PUPDR_PUPDR5_0 ((uint32_t)0x00000400)
  1650. #define GPIO_PUPDR_PUPDR5_1 ((uint32_t)0x00000800)
  1651. #define GPIO_PUPDR_PUPDR6 ((uint32_t)0x00003000)
  1652. #define GPIO_PUPDR_PUPDR6_0 ((uint32_t)0x00001000)
  1653. #define GPIO_PUPDR_PUPDR6_1 ((uint32_t)0x00002000)
  1654. #define GPIO_PUPDR_PUPDR7 ((uint32_t)0x0000C000)
  1655. #define GPIO_PUPDR_PUPDR7_0 ((uint32_t)0x00004000)
  1656. #define GPIO_PUPDR_PUPDR7_1 ((uint32_t)0x00008000)
  1657. #define GPIO_PUPDR_PUPDR8 ((uint32_t)0x00030000)
  1658. #define GPIO_PUPDR_PUPDR8_0 ((uint32_t)0x00010000)
  1659. #define GPIO_PUPDR_PUPDR8_1 ((uint32_t)0x00020000)
  1660. #define GPIO_PUPDR_PUPDR9 ((uint32_t)0x000C0000)
  1661. #define GPIO_PUPDR_PUPDR9_0 ((uint32_t)0x00040000)
  1662. #define GPIO_PUPDR_PUPDR9_1 ((uint32_t)0x00080000)
  1663. #define GPIO_PUPDR_PUPDR10 ((uint32_t)0x00300000)
  1664. #define GPIO_PUPDR_PUPDR10_0 ((uint32_t)0x00100000)
  1665. #define GPIO_PUPDR_PUPDR10_1 ((uint32_t)0x00200000)
  1666. #define GPIO_PUPDR_PUPDR11 ((uint32_t)0x00C00000)
  1667. #define GPIO_PUPDR_PUPDR11_0 ((uint32_t)0x00400000)
  1668. #define GPIO_PUPDR_PUPDR11_1 ((uint32_t)0x00800000)
  1669. #define GPIO_PUPDR_PUPDR12 ((uint32_t)0x03000000)
  1670. #define GPIO_PUPDR_PUPDR12_0 ((uint32_t)0x01000000)
  1671. #define GPIO_PUPDR_PUPDR12_1 ((uint32_t)0x02000000)
  1672. #define GPIO_PUPDR_PUPDR13 ((uint32_t)0x0C000000)
  1673. #define GPIO_PUPDR_PUPDR13_0 ((uint32_t)0x04000000)
  1674. #define GPIO_PUPDR_PUPDR13_1 ((uint32_t)0x08000000)
  1675. #define GPIO_PUPDR_PUPDR14 ((uint32_t)0x30000000)
  1676. #define GPIO_PUPDR_PUPDR14_0 ((uint32_t)0x10000000)
  1677. #define GPIO_PUPDR_PUPDR14_1 ((uint32_t)0x20000000)
  1678. #define GPIO_PUPDR_PUPDR15 ((uint32_t)0xC0000000)
  1679. #define GPIO_PUPDR_PUPDR15_0 ((uint32_t)0x40000000)
  1680. #define GPIO_PUPDR_PUPDR15_1 ((uint32_t)0x80000000)
  1681. /****************** Bits definition for GPIO_IDR register *******************/
  1682. #define GPIO_IDR_IDR_0 ((uint32_t)0x00000001)
  1683. #define GPIO_IDR_IDR_1 ((uint32_t)0x00000002)
  1684. #define GPIO_IDR_IDR_2 ((uint32_t)0x00000004)
  1685. #define GPIO_IDR_IDR_3 ((uint32_t)0x00000008)
  1686. #define GPIO_IDR_IDR_4 ((uint32_t)0x00000010)
  1687. #define GPIO_IDR_IDR_5 ((uint32_t)0x00000020)
  1688. #define GPIO_IDR_IDR_6 ((uint32_t)0x00000040)
  1689. #define GPIO_IDR_IDR_7 ((uint32_t)0x00000080)
  1690. #define GPIO_IDR_IDR_8 ((uint32_t)0x00000100)
  1691. #define GPIO_IDR_IDR_9 ((uint32_t)0x00000200)
  1692. #define GPIO_IDR_IDR_10 ((uint32_t)0x00000400)
  1693. #define GPIO_IDR_IDR_11 ((uint32_t)0x00000800)
  1694. #define GPIO_IDR_IDR_12 ((uint32_t)0x00001000)
  1695. #define GPIO_IDR_IDR_13 ((uint32_t)0x00002000)
  1696. #define GPIO_IDR_IDR_14 ((uint32_t)0x00004000)
  1697. #define GPIO_IDR_IDR_15 ((uint32_t)0x00008000)
  1698. /* Old GPIO_IDR register bits definition, maintained for legacy purpose */
  1699. #define GPIO_OTYPER_IDR_0 GPIO_IDR_IDR_0
  1700. #define GPIO_OTYPER_IDR_1 GPIO_IDR_IDR_1
  1701. #define GPIO_OTYPER_IDR_2 GPIO_IDR_IDR_2
  1702. #define GPIO_OTYPER_IDR_3 GPIO_IDR_IDR_3
  1703. #define GPIO_OTYPER_IDR_4 GPIO_IDR_IDR_4
  1704. #define GPIO_OTYPER_IDR_5 GPIO_IDR_IDR_5
  1705. #define GPIO_OTYPER_IDR_6 GPIO_IDR_IDR_6
  1706. #define GPIO_OTYPER_IDR_7 GPIO_IDR_IDR_7
  1707. #define GPIO_OTYPER_IDR_8 GPIO_IDR_IDR_8
  1708. #define GPIO_OTYPER_IDR_9 GPIO_IDR_IDR_9
  1709. #define GPIO_OTYPER_IDR_10 GPIO_IDR_IDR_10
  1710. #define GPIO_OTYPER_IDR_11 GPIO_IDR_IDR_11
  1711. #define GPIO_OTYPER_IDR_12 GPIO_IDR_IDR_12
  1712. #define GPIO_OTYPER_IDR_13 GPIO_IDR_IDR_13
  1713. #define GPIO_OTYPER_IDR_14 GPIO_IDR_IDR_14
  1714. #define GPIO_OTYPER_IDR_15 GPIO_IDR_IDR_15
  1715. /****************** Bits definition for GPIO_ODR register *******************/
  1716. #define GPIO_ODR_ODR_0 ((uint32_t)0x00000001)
  1717. #define GPIO_ODR_ODR_1 ((uint32_t)0x00000002)
  1718. #define GPIO_ODR_ODR_2 ((uint32_t)0x00000004)
  1719. #define GPIO_ODR_ODR_3 ((uint32_t)0x00000008)
  1720. #define GPIO_ODR_ODR_4 ((uint32_t)0x00000010)
  1721. #define GPIO_ODR_ODR_5 ((uint32_t)0x00000020)
  1722. #define GPIO_ODR_ODR_6 ((uint32_t)0x00000040)
  1723. #define GPIO_ODR_ODR_7 ((uint32_t)0x00000080)
  1724. #define GPIO_ODR_ODR_8 ((uint32_t)0x00000100)
  1725. #define GPIO_ODR_ODR_9 ((uint32_t)0x00000200)
  1726. #define GPIO_ODR_ODR_10 ((uint32_t)0x00000400)
  1727. #define GPIO_ODR_ODR_11 ((uint32_t)0x00000800)
  1728. #define GPIO_ODR_ODR_12 ((uint32_t)0x00001000)
  1729. #define GPIO_ODR_ODR_13 ((uint32_t)0x00002000)
  1730. #define GPIO_ODR_ODR_14 ((uint32_t)0x00004000)
  1731. #define GPIO_ODR_ODR_15 ((uint32_t)0x00008000)
  1732. /* Old GPIO_ODR register bits definition, maintained for legacy purpose */
  1733. #define GPIO_OTYPER_ODR_0 GPIO_ODR_ODR_0
  1734. #define GPIO_OTYPER_ODR_1 GPIO_ODR_ODR_1
  1735. #define GPIO_OTYPER_ODR_2 GPIO_ODR_ODR_2
  1736. #define GPIO_OTYPER_ODR_3 GPIO_ODR_ODR_3
  1737. #define GPIO_OTYPER_ODR_4 GPIO_ODR_ODR_4
  1738. #define GPIO_OTYPER_ODR_5 GPIO_ODR_ODR_5
  1739. #define GPIO_OTYPER_ODR_6 GPIO_ODR_ODR_6
  1740. #define GPIO_OTYPER_ODR_7 GPIO_ODR_ODR_7
  1741. #define GPIO_OTYPER_ODR_8 GPIO_ODR_ODR_8
  1742. #define GPIO_OTYPER_ODR_9 GPIO_ODR_ODR_9
  1743. #define GPIO_OTYPER_ODR_10 GPIO_ODR_ODR_10
  1744. #define GPIO_OTYPER_ODR_11 GPIO_ODR_ODR_11
  1745. #define GPIO_OTYPER_ODR_12 GPIO_ODR_ODR_12
  1746. #define GPIO_OTYPER_ODR_13 GPIO_ODR_ODR_13
  1747. #define GPIO_OTYPER_ODR_14 GPIO_ODR_ODR_14
  1748. #define GPIO_OTYPER_ODR_15 GPIO_ODR_ODR_15
  1749. /****************** Bits definition for GPIO_BSRR register ******************/
  1750. #define GPIO_BSRR_BS_0 ((uint32_t)0x00000001)
  1751. #define GPIO_BSRR_BS_1 ((uint32_t)0x00000002)
  1752. #define GPIO_BSRR_BS_2 ((uint32_t)0x00000004)
  1753. #define GPIO_BSRR_BS_3 ((uint32_t)0x00000008)
  1754. #define GPIO_BSRR_BS_4 ((uint32_t)0x00000010)
  1755. #define GPIO_BSRR_BS_5 ((uint32_t)0x00000020)
  1756. #define GPIO_BSRR_BS_6 ((uint32_t)0x00000040)
  1757. #define GPIO_BSRR_BS_7 ((uint32_t)0x00000080)
  1758. #define GPIO_BSRR_BS_8 ((uint32_t)0x00000100)
  1759. #define GPIO_BSRR_BS_9 ((uint32_t)0x00000200)
  1760. #define GPIO_BSRR_BS_10 ((uint32_t)0x00000400)
  1761. #define GPIO_BSRR_BS_11 ((uint32_t)0x00000800)
  1762. #define GPIO_BSRR_BS_12 ((uint32_t)0x00001000)
  1763. #define GPIO_BSRR_BS_13 ((uint32_t)0x00002000)
  1764. #define GPIO_BSRR_BS_14 ((uint32_t)0x00004000)
  1765. #define GPIO_BSRR_BS_15 ((uint32_t)0x00008000)
  1766. #define GPIO_BSRR_BR_0 ((uint32_t)0x00010000)
  1767. #define GPIO_BSRR_BR_1 ((uint32_t)0x00020000)
  1768. #define GPIO_BSRR_BR_2 ((uint32_t)0x00040000)
  1769. #define GPIO_BSRR_BR_3 ((uint32_t)0x00080000)
  1770. #define GPIO_BSRR_BR_4 ((uint32_t)0x00100000)
  1771. #define GPIO_BSRR_BR_5 ((uint32_t)0x00200000)
  1772. #define GPIO_BSRR_BR_6 ((uint32_t)0x00400000)
  1773. #define GPIO_BSRR_BR_7 ((uint32_t)0x00800000)
  1774. #define GPIO_BSRR_BR_8 ((uint32_t)0x01000000)
  1775. #define GPIO_BSRR_BR_9 ((uint32_t)0x02000000)
  1776. #define GPIO_BSRR_BR_10 ((uint32_t)0x04000000)
  1777. #define GPIO_BSRR_BR_11 ((uint32_t)0x08000000)
  1778. #define GPIO_BSRR_BR_12 ((uint32_t)0x10000000)
  1779. #define GPIO_BSRR_BR_13 ((uint32_t)0x20000000)
  1780. #define GPIO_BSRR_BR_14 ((uint32_t)0x40000000)
  1781. #define GPIO_BSRR_BR_15 ((uint32_t)0x80000000)
  1782. /****************** Bit definition for GPIO_LCKR register *********************/
  1783. #define GPIO_LCKR_LCK0 ((uint32_t)0x00000001)
  1784. #define GPIO_LCKR_LCK1 ((uint32_t)0x00000002)
  1785. #define GPIO_LCKR_LCK2 ((uint32_t)0x00000004)
  1786. #define GPIO_LCKR_LCK3 ((uint32_t)0x00000008)
  1787. #define GPIO_LCKR_LCK4 ((uint32_t)0x00000010)
  1788. #define GPIO_LCKR_LCK5 ((uint32_t)0x00000020)
  1789. #define GPIO_LCKR_LCK6 ((uint32_t)0x00000040)
  1790. #define GPIO_LCKR_LCK7 ((uint32_t)0x00000080)
  1791. #define GPIO_LCKR_LCK8 ((uint32_t)0x00000100)
  1792. #define GPIO_LCKR_LCK9 ((uint32_t)0x00000200)
  1793. #define GPIO_LCKR_LCK10 ((uint32_t)0x00000400)
  1794. #define GPIO_LCKR_LCK11 ((uint32_t)0x00000800)
  1795. #define GPIO_LCKR_LCK12 ((uint32_t)0x00001000)
  1796. #define GPIO_LCKR_LCK13 ((uint32_t)0x00002000)
  1797. #define GPIO_LCKR_LCK14 ((uint32_t)0x00004000)
  1798. #define GPIO_LCKR_LCK15 ((uint32_t)0x00008000)
  1799. #define GPIO_LCKR_LCKK ((uint32_t)0x00010000)
  1800. /******************************************************************************/
  1801. /* */
  1802. /* Inter-integrated Circuit Interface */
  1803. /* */
  1804. /******************************************************************************/
  1805. /******************* Bit definition for I2C_CR1 register ********************/
  1806. #define I2C_CR1_PE ((uint32_t)0x00000001) /*!<Peripheral Enable */
  1807. #define I2C_CR1_SMBUS ((uint32_t)0x00000002) /*!<SMBus Mode */
  1808. #define I2C_CR1_SMBTYPE ((uint32_t)0x00000008) /*!<SMBus Type */
  1809. #define I2C_CR1_ENARP ((uint32_t)0x00000010) /*!<ARP Enable */
  1810. #define I2C_CR1_ENPEC ((uint32_t)0x00000020) /*!<PEC Enable */
  1811. #define I2C_CR1_ENGC ((uint32_t)0x00000040) /*!<General Call Enable */
  1812. #define I2C_CR1_NOSTRETCH ((uint32_t)0x00000080) /*!<Clock Stretching Disable (Slave mode) */
  1813. #define I2C_CR1_START ((uint32_t)0x00000100) /*!<Start Generation */
  1814. #define I2C_CR1_STOP ((uint32_t)0x00000200) /*!<Stop Generation */
  1815. #define I2C_CR1_ACK ((uint32_t)0x00000400) /*!<Acknowledge Enable */
  1816. #define I2C_CR1_POS ((uint32_t)0x00000800) /*!<Acknowledge/PEC Position (for data reception) */
  1817. #define I2C_CR1_PEC ((uint32_t)0x00001000) /*!<Packet Error Checking */
  1818. #define I2C_CR1_ALERT ((uint32_t)0x00002000) /*!<SMBus Alert */
  1819. #define I2C_CR1_SWRST ((uint32_t)0x00008000) /*!<Software Reset */
  1820. /******************* Bit definition for I2C_CR2 register ********************/
  1821. #define I2C_CR2_FREQ ((uint32_t)0x0000003F) /*!<FREQ[5:0] bits (Peripheral Clock Frequency) */
  1822. #define I2C_CR2_FREQ_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  1823. #define I2C_CR2_FREQ_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  1824. #define I2C_CR2_FREQ_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  1825. #define I2C_CR2_FREQ_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  1826. #define I2C_CR2_FREQ_4 ((uint32_t)0x00000010) /*!<Bit 4 */
  1827. #define I2C_CR2_FREQ_5 ((uint32_t)0x00000020) /*!<Bit 5 */
  1828. #define I2C_CR2_ITERREN ((uint32_t)0x00000100) /*!<Error Interrupt Enable */
  1829. #define I2C_CR2_ITEVTEN ((uint32_t)0x00000200) /*!<Event Interrupt Enable */
  1830. #define I2C_CR2_ITBUFEN ((uint32_t)0x00000400) /*!<Buffer Interrupt Enable */
  1831. #define I2C_CR2_DMAEN ((uint32_t)0x00000800) /*!<DMA Requests Enable */
  1832. #define I2C_CR2_LAST ((uint32_t)0x00001000) /*!<DMA Last Transfer */
  1833. /******************* Bit definition for I2C_OAR1 register *******************/
  1834. #define I2C_OAR1_ADD1_7 ((uint32_t)0x000000FE) /*!<Interface Address */
  1835. #define I2C_OAR1_ADD8_9 ((uint32_t)0x00000300) /*!<Interface Address */
  1836. #define I2C_OAR1_ADD0 ((uint32_t)0x00000001) /*!<Bit 0 */
  1837. #define I2C_OAR1_ADD1 ((uint32_t)0x00000002) /*!<Bit 1 */
  1838. #define I2C_OAR1_ADD2 ((uint32_t)0x00000004) /*!<Bit 2 */
  1839. #define I2C_OAR1_ADD3 ((uint32_t)0x00000008) /*!<Bit 3 */
  1840. #define I2C_OAR1_ADD4 ((uint32_t)0x00000010) /*!<Bit 4 */
  1841. #define I2C_OAR1_ADD5 ((uint32_t)0x00000020) /*!<Bit 5 */
  1842. #define I2C_OAR1_ADD6 ((uint32_t)0x00000040) /*!<Bit 6 */
  1843. #define I2C_OAR1_ADD7 ((uint32_t)0x00000080) /*!<Bit 7 */
  1844. #define I2C_OAR1_ADD8 ((uint32_t)0x00000100) /*!<Bit 8 */
  1845. #define I2C_OAR1_ADD9 ((uint32_t)0x00000200) /*!<Bit 9 */
  1846. #define I2C_OAR1_ADDMODE ((uint32_t)0x00008000) /*!<Addressing Mode (Slave mode) */
  1847. /******************* Bit definition for I2C_OAR2 register *******************/
  1848. #define I2C_OAR2_ENDUAL ((uint32_t)0x00000001) /*!<Dual addressing mode enable */
  1849. #define I2C_OAR2_ADD2 ((uint32_t)0x000000FE) /*!<Interface address */
  1850. /******************** Bit definition for I2C_DR register ********************/
  1851. #define I2C_DR_DR ((uint32_t)0x000000FF) /*!<8-bit Data Register */
  1852. /******************* Bit definition for I2C_SR1 register ********************/
  1853. #define I2C_SR1_SB ((uint32_t)0x00000001) /*!<Start Bit (Master mode) */
  1854. #define I2C_SR1_ADDR ((uint32_t)0x00000002) /*!<Address sent (master mode)/matched (slave mode) */
  1855. #define I2C_SR1_BTF ((uint32_t)0x00000004) /*!<Byte Transfer Finished */
  1856. #define I2C_SR1_ADD10 ((uint32_t)0x00000008) /*!<10-bit header sent (Master mode) */
  1857. #define I2C_SR1_STOPF ((uint32_t)0x00000010) /*!<Stop detection (Slave mode) */
  1858. #define I2C_SR1_RXNE ((uint32_t)0x00000040) /*!<Data Register not Empty (receivers) */
  1859. #define I2C_SR1_TXE ((uint32_t)0x00000080) /*!<Data Register Empty (transmitters) */
  1860. #define I2C_SR1_BERR ((uint32_t)0x00000100) /*!<Bus Error */
  1861. #define I2C_SR1_ARLO ((uint32_t)0x00000200) /*!<Arbitration Lost (master mode) */
  1862. #define I2C_SR1_AF ((uint32_t)0x00000400) /*!<Acknowledge Failure */
  1863. #define I2C_SR1_OVR ((uint32_t)0x00000800) /*!<Overrun/Underrun */
  1864. #define I2C_SR1_PECERR ((uint32_t)0x00001000) /*!<PEC Error in reception */
  1865. #define I2C_SR1_TIMEOUT ((uint32_t)0x00004000) /*!<Timeout or Tlow Error */
  1866. #define I2C_SR1_SMBALERT ((uint32_t)0x00008000) /*!<SMBus Alert */
  1867. /******************* Bit definition for I2C_SR2 register ********************/
  1868. #define I2C_SR2_MSL ((uint32_t)0x00000001) /*!<Master/Slave */
  1869. #define I2C_SR2_BUSY ((uint32_t)0x00000002) /*!<Bus Busy */
  1870. #define I2C_SR2_TRA ((uint32_t)0x00000004) /*!<Transmitter/Receiver */
  1871. #define I2C_SR2_GENCALL ((uint32_t)0x00000010) /*!<General Call Address (Slave mode) */
  1872. #define I2C_SR2_SMBDEFAULT ((uint32_t)0x00000020) /*!<SMBus Device Default Address (Slave mode) */
  1873. #define I2C_SR2_SMBHOST ((uint32_t)0x00000040) /*!<SMBus Host Header (Slave mode) */
  1874. #define I2C_SR2_DUALF ((uint32_t)0x00000080) /*!<Dual Flag (Slave mode) */
  1875. #define I2C_SR2_PEC ((uint32_t)0x0000FF00) /*!<Packet Error Checking Register */
  1876. /******************* Bit definition for I2C_CCR register ********************/
  1877. #define I2C_CCR_CCR ((uint32_t)0x00000FFF) /*!<Clock Control Register in Fast/Standard mode (Master mode) */
  1878. #define I2C_CCR_DUTY ((uint32_t)0x00004000) /*!<Fast Mode Duty Cycle */
  1879. #define I2C_CCR_FS ((uint32_t)0x00008000) /*!<I2C Master Mode Selection */
  1880. /****************** Bit definition for I2C_TRISE register *******************/
  1881. #define I2C_TRISE_TRISE ((uint32_t)0x0000003F) /*!<Maximum Rise Time in Fast/Standard mode (Master mode) */
  1882. /****************** Bit definition for I2C_FLTR register *******************/
  1883. #define I2C_FLTR_DNF ((uint32_t)0x0000000F) /*!<Digital Noise Filter */
  1884. #define I2C_FLTR_ANOFF ((uint32_t)0x00000010) /*!<Analog Noise Filter OFF */
  1885. /******************************************************************************/
  1886. /* */
  1887. /* Independent WATCHDOG */
  1888. /* */
  1889. /******************************************************************************/
  1890. /******************* Bit definition for IWDG_KR register ********************/
  1891. #define IWDG_KR_KEY ((uint32_t)0xFFFF) /*!<Key value (write only, read 0000h) */
  1892. /******************* Bit definition for IWDG_PR register ********************/
  1893. #define IWDG_PR_PR ((uint32_t)0x07) /*!<PR[2:0] (Prescaler divider) */
  1894. #define IWDG_PR_PR_0 ((uint32_t)0x01) /*!<Bit 0 */
  1895. #define IWDG_PR_PR_1 ((uint32_t)0x02) /*!<Bit 1 */
  1896. #define IWDG_PR_PR_2 ((uint32_t)0x04) /*!<Bit 2 */
  1897. /******************* Bit definition for IWDG_RLR register *******************/
  1898. #define IWDG_RLR_RL ((uint32_t)0x0FFF) /*!<Watchdog counter reload value */
  1899. /******************* Bit definition for IWDG_SR register ********************/
  1900. #define IWDG_SR_PVU ((uint32_t)0x01) /*!<Watchdog prescaler value update */
  1901. #define IWDG_SR_RVU ((uint32_t)0x02) /*!<Watchdog counter reload value update */
  1902. /******************************************************************************/
  1903. /* */
  1904. /* Power Control */
  1905. /* */
  1906. /******************************************************************************/
  1907. /******************** Bit definition for PWR_CR register ********************/
  1908. #define PWR_CR_LPDS ((uint32_t)0x00000001) /*!< Low-Power Deepsleep */
  1909. #define PWR_CR_PDDS ((uint32_t)0x00000002) /*!< Power Down Deepsleep */
  1910. #define PWR_CR_CWUF ((uint32_t)0x00000004) /*!< Clear Wakeup Flag */
  1911. #define PWR_CR_CSBF ((uint32_t)0x00000008) /*!< Clear Standby Flag */
  1912. #define PWR_CR_PVDE ((uint32_t)0x00000010) /*!< Power Voltage Detector Enable */
  1913. #define PWR_CR_PLS ((uint32_t)0x000000E0) /*!< PLS[2:0] bits (PVD Level Selection) */
  1914. #define PWR_CR_PLS_0 ((uint32_t)0x00000020) /*!< Bit 0 */
  1915. #define PWR_CR_PLS_1 ((uint32_t)0x00000040) /*!< Bit 1 */
  1916. #define PWR_CR_PLS_2 ((uint32_t)0x00000080) /*!< Bit 2 */
  1917. /*!< PVD level configuration */
  1918. #define PWR_CR_PLS_LEV0 ((uint32_t)0x00000000) /*!< PVD level 0 */
  1919. #define PWR_CR_PLS_LEV1 ((uint32_t)0x00000020) /*!< PVD level 1 */
  1920. #define PWR_CR_PLS_LEV2 ((uint32_t)0x00000040) /*!< PVD level 2 */
  1921. #define PWR_CR_PLS_LEV3 ((uint32_t)0x00000060) /*!< PVD level 3 */
  1922. #define PWR_CR_PLS_LEV4 ((uint32_t)0x00000080) /*!< PVD level 4 */
  1923. #define PWR_CR_PLS_LEV5 ((uint32_t)0x000000A0) /*!< PVD level 5 */
  1924. #define PWR_CR_PLS_LEV6 ((uint32_t)0x000000C0) /*!< PVD level 6 */
  1925. #define PWR_CR_PLS_LEV7 ((uint32_t)0x000000E0) /*!< PVD level 7 */
  1926. #define PWR_CR_DBP ((uint32_t)0x00000100) /*!< Disable Backup Domain write protection */
  1927. #define PWR_CR_FPDS ((uint32_t)0x00000200) /*!< Flash power down in Stop mode */
  1928. #define PWR_CR_LPLVDS ((uint32_t)0x00000400) /*!< Low Power Regulator Low Voltage in Deep Sleep mode */
  1929. #define PWR_CR_MRLVDS ((uint32_t)0x00000800) /*!< Main Regulator Low Voltage in Deep Sleep mode */
  1930. #define PWR_CR_ADCDC1 ((uint32_t)0x00002000) /*!< Refer to AN4073 on how to use this bit */
  1931. #define PWR_CR_VOS ((uint32_t)0x0000C000) /*!< VOS[1:0] bits (Regulator voltage scaling output selection) */
  1932. #define PWR_CR_VOS_0 ((uint32_t)0x00004000) /*!< Bit 0 */
  1933. #define PWR_CR_VOS_1 ((uint32_t)0x00008000) /*!< Bit 1 */
  1934. /* Legacy define */
  1935. #define PWR_CR_PMODE PWR_CR_VOS
  1936. /******************* Bit definition for PWR_CSR register ********************/
  1937. #define PWR_CSR_WUF ((uint32_t)0x00000001) /*!< Wakeup Flag */
  1938. #define PWR_CSR_SBF ((uint32_t)0x00000002) /*!< Standby Flag */
  1939. #define PWR_CSR_PVDO ((uint32_t)0x00000004) /*!< PVD Output */
  1940. #define PWR_CSR_BRR ((uint32_t)0x00000008) /*!< Backup regulator ready */
  1941. #define PWR_CSR_EWUP ((uint32_t)0x00000100) /*!< Enable WKUP pin */
  1942. #define PWR_CSR_BRE ((uint32_t)0x00000200) /*!< Backup regulator enable */
  1943. #define PWR_CSR_VOSRDY ((uint32_t)0x00004000) /*!< Regulator voltage scaling output selection ready */
  1944. /* Legacy define */
  1945. #define PWR_CSR_REGRDY PWR_CSR_VOSRDY
  1946. /******************************************************************************/
  1947. /* */
  1948. /* Reset and Clock Control */
  1949. /* */
  1950. /******************************************************************************/
  1951. /******************** Bit definition for RCC_CR register ********************/
  1952. #define RCC_CR_HSION ((uint32_t)0x00000001)
  1953. #define RCC_CR_HSIRDY ((uint32_t)0x00000002)
  1954. #define RCC_CR_HSITRIM ((uint32_t)0x000000F8)
  1955. #define RCC_CR_HSITRIM_0 ((uint32_t)0x00000008)/*!<Bit 0 */
  1956. #define RCC_CR_HSITRIM_1 ((uint32_t)0x00000010)/*!<Bit 1 */
  1957. #define RCC_CR_HSITRIM_2 ((uint32_t)0x00000020)/*!<Bit 2 */
  1958. #define RCC_CR_HSITRIM_3 ((uint32_t)0x00000040)/*!<Bit 3 */
  1959. #define RCC_CR_HSITRIM_4 ((uint32_t)0x00000080)/*!<Bit 4 */
  1960. #define RCC_CR_HSICAL ((uint32_t)0x0000FF00)
  1961. #define RCC_CR_HSICAL_0 ((uint32_t)0x00000100)/*!<Bit 0 */
  1962. #define RCC_CR_HSICAL_1 ((uint32_t)0x00000200)/*!<Bit 1 */
  1963. #define RCC_CR_HSICAL_2 ((uint32_t)0x00000400)/*!<Bit 2 */
  1964. #define RCC_CR_HSICAL_3 ((uint32_t)0x00000800)/*!<Bit 3 */
  1965. #define RCC_CR_HSICAL_4 ((uint32_t)0x00001000)/*!<Bit 4 */
  1966. #define RCC_CR_HSICAL_5 ((uint32_t)0x00002000)/*!<Bit 5 */
  1967. #define RCC_CR_HSICAL_6 ((uint32_t)0x00004000)/*!<Bit 6 */
  1968. #define RCC_CR_HSICAL_7 ((uint32_t)0x00008000)/*!<Bit 7 */
  1969. #define RCC_CR_HSEON ((uint32_t)0x00010000)
  1970. #define RCC_CR_HSERDY ((uint32_t)0x00020000)
  1971. #define RCC_CR_HSEBYP ((uint32_t)0x00040000)
  1972. #define RCC_CR_CSSON ((uint32_t)0x00080000)
  1973. #define RCC_CR_PLLON ((uint32_t)0x01000000)
  1974. #define RCC_CR_PLLRDY ((uint32_t)0x02000000)
  1975. #define RCC_CR_PLLI2SON ((uint32_t)0x04000000)
  1976. #define RCC_CR_PLLI2SRDY ((uint32_t)0x08000000)
  1977. /******************** Bit definition for RCC_PLLCFGR register ***************/
  1978. #define RCC_PLLCFGR_PLLM ((uint32_t)0x0000003F)
  1979. #define RCC_PLLCFGR_PLLM_0 ((uint32_t)0x00000001)
  1980. #define RCC_PLLCFGR_PLLM_1 ((uint32_t)0x00000002)
  1981. #define RCC_PLLCFGR_PLLM_2 ((uint32_t)0x00000004)
  1982. #define RCC_PLLCFGR_PLLM_3 ((uint32_t)0x00000008)
  1983. #define RCC_PLLCFGR_PLLM_4 ((uint32_t)0x00000010)
  1984. #define RCC_PLLCFGR_PLLM_5 ((uint32_t)0x00000020)
  1985. #define RCC_PLLCFGR_PLLN ((uint32_t)0x00007FC0)
  1986. #define RCC_PLLCFGR_PLLN_0 ((uint32_t)0x00000040)
  1987. #define RCC_PLLCFGR_PLLN_1 ((uint32_t)0x00000080)
  1988. #define RCC_PLLCFGR_PLLN_2 ((uint32_t)0x00000100)
  1989. #define RCC_PLLCFGR_PLLN_3 ((uint32_t)0x00000200)
  1990. #define RCC_PLLCFGR_PLLN_4 ((uint32_t)0x00000400)
  1991. #define RCC_PLLCFGR_PLLN_5 ((uint32_t)0x00000800)
  1992. #define RCC_PLLCFGR_PLLN_6 ((uint32_t)0x00001000)
  1993. #define RCC_PLLCFGR_PLLN_7 ((uint32_t)0x00002000)
  1994. #define RCC_PLLCFGR_PLLN_8 ((uint32_t)0x00004000)
  1995. #define RCC_PLLCFGR_PLLP ((uint32_t)0x00030000)
  1996. #define RCC_PLLCFGR_PLLP_0 ((uint32_t)0x00010000)
  1997. #define RCC_PLLCFGR_PLLP_1 ((uint32_t)0x00020000)
  1998. #define RCC_PLLCFGR_PLLSRC ((uint32_t)0x00400000)
  1999. #define RCC_PLLCFGR_PLLSRC_HSE ((uint32_t)0x00400000)
  2000. #define RCC_PLLCFGR_PLLSRC_HSI ((uint32_t)0x00000000)
  2001. #define RCC_PLLCFGR_PLLQ ((uint32_t)0x0F000000)
  2002. #define RCC_PLLCFGR_PLLQ_0 ((uint32_t)0x01000000)
  2003. #define RCC_PLLCFGR_PLLQ_1 ((uint32_t)0x02000000)
  2004. #define RCC_PLLCFGR_PLLQ_2 ((uint32_t)0x04000000)
  2005. #define RCC_PLLCFGR_PLLQ_3 ((uint32_t)0x08000000)
  2006. /******************** Bit definition for RCC_CFGR register ******************/
  2007. /*!< SW configuration */
  2008. #define RCC_CFGR_SW ((uint32_t)0x00000003) /*!< SW[1:0] bits (System clock Switch) */
  2009. #define RCC_CFGR_SW_0 ((uint32_t)0x00000001) /*!< Bit 0 */
  2010. #define RCC_CFGR_SW_1 ((uint32_t)0x00000002) /*!< Bit 1 */
  2011. #define RCC_CFGR_SW_HSI ((uint32_t)0x00000000) /*!< HSI selected as system clock */
  2012. #define RCC_CFGR_SW_HSE ((uint32_t)0x00000001) /*!< HSE selected as system clock */
  2013. #define RCC_CFGR_SW_PLL ((uint32_t)0x00000002) /*!< PLL selected as system clock */
  2014. /*!< SWS configuration */
  2015. #define RCC_CFGR_SWS ((uint32_t)0x0000000C) /*!< SWS[1:0] bits (System Clock Switch Status) */
  2016. #define RCC_CFGR_SWS_0 ((uint32_t)0x00000004) /*!< Bit 0 */
  2017. #define RCC_CFGR_SWS_1 ((uint32_t)0x00000008) /*!< Bit 1 */
  2018. #define RCC_CFGR_SWS_HSI ((uint32_t)0x00000000) /*!< HSI oscillator used as system clock */
  2019. #define RCC_CFGR_SWS_HSE ((uint32_t)0x00000004) /*!< HSE oscillator used as system clock */
  2020. #define RCC_CFGR_SWS_PLL ((uint32_t)0x00000008) /*!< PLL used as system clock */
  2021. /*!< HPRE configuration */
  2022. #define RCC_CFGR_HPRE ((uint32_t)0x000000F0) /*!< HPRE[3:0] bits (AHB prescaler) */
  2023. #define RCC_CFGR_HPRE_0 ((uint32_t)0x00000010) /*!< Bit 0 */
  2024. #define RCC_CFGR_HPRE_1 ((uint32_t)0x00000020) /*!< Bit 1 */
  2025. #define RCC_CFGR_HPRE_2 ((uint32_t)0x00000040) /*!< Bit 2 */
  2026. #define RCC_CFGR_HPRE_3 ((uint32_t)0x00000080) /*!< Bit 3 */
  2027. #define RCC_CFGR_HPRE_DIV1 ((uint32_t)0x00000000) /*!< SYSCLK not divided */
  2028. #define RCC_CFGR_HPRE_DIV2 ((uint32_t)0x00000080) /*!< SYSCLK divided by 2 */
  2029. #define RCC_CFGR_HPRE_DIV4 ((uint32_t)0x00000090) /*!< SYSCLK divided by 4 */
  2030. #define RCC_CFGR_HPRE_DIV8 ((uint32_t)0x000000A0) /*!< SYSCLK divided by 8 */
  2031. #define RCC_CFGR_HPRE_DIV16 ((uint32_t)0x000000B0) /*!< SYSCLK divided by 16 */
  2032. #define RCC_CFGR_HPRE_DIV64 ((uint32_t)0x000000C0) /*!< SYSCLK divided by 64 */
  2033. #define RCC_CFGR_HPRE_DIV128 ((uint32_t)0x000000D0) /*!< SYSCLK divided by 128 */
  2034. #define RCC_CFGR_HPRE_DIV256 ((uint32_t)0x000000E0) /*!< SYSCLK divided by 256 */
  2035. #define RCC_CFGR_HPRE_DIV512 ((uint32_t)0x000000F0) /*!< SYSCLK divided by 512 */
  2036. /*!< PPRE1 configuration */
  2037. #define RCC_CFGR_PPRE1 ((uint32_t)0x00001C00) /*!< PRE1[2:0] bits (APB1 prescaler) */
  2038. #define RCC_CFGR_PPRE1_0 ((uint32_t)0x00000400) /*!< Bit 0 */
  2039. #define RCC_CFGR_PPRE1_1 ((uint32_t)0x00000800) /*!< Bit 1 */
  2040. #define RCC_CFGR_PPRE1_2 ((uint32_t)0x00001000) /*!< Bit 2 */
  2041. #define RCC_CFGR_PPRE1_DIV1 ((uint32_t)0x00000000) /*!< HCLK not divided */
  2042. #define RCC_CFGR_PPRE1_DIV2 ((uint32_t)0x00001000) /*!< HCLK divided by 2 */
  2043. #define RCC_CFGR_PPRE1_DIV4 ((uint32_t)0x00001400) /*!< HCLK divided by 4 */
  2044. #define RCC_CFGR_PPRE1_DIV8 ((uint32_t)0x00001800) /*!< HCLK divided by 8 */
  2045. #define RCC_CFGR_PPRE1_DIV16 ((uint32_t)0x00001C00) /*!< HCLK divided by 16 */
  2046. /*!< PPRE2 configuration */
  2047. #define RCC_CFGR_PPRE2 ((uint32_t)0x0000E000) /*!< PRE2[2:0] bits (APB2 prescaler) */
  2048. #define RCC_CFGR_PPRE2_0 ((uint32_t)0x00002000) /*!< Bit 0 */
  2049. #define RCC_CFGR_PPRE2_1 ((uint32_t)0x00004000) /*!< Bit 1 */
  2050. #define RCC_CFGR_PPRE2_2 ((uint32_t)0x00008000) /*!< Bit 2 */
  2051. #define RCC_CFGR_PPRE2_DIV1 ((uint32_t)0x00000000) /*!< HCLK not divided */
  2052. #define RCC_CFGR_PPRE2_DIV2 ((uint32_t)0x00008000) /*!< HCLK divided by 2 */
  2053. #define RCC_CFGR_PPRE2_DIV4 ((uint32_t)0x0000A000) /*!< HCLK divided by 4 */
  2054. #define RCC_CFGR_PPRE2_DIV8 ((uint32_t)0x0000C000) /*!< HCLK divided by 8 */
  2055. #define RCC_CFGR_PPRE2_DIV16 ((uint32_t)0x0000E000) /*!< HCLK divided by 16 */
  2056. /*!< RTCPRE configuration */
  2057. #define RCC_CFGR_RTCPRE ((uint32_t)0x001F0000)
  2058. #define RCC_CFGR_RTCPRE_0 ((uint32_t)0x00010000)
  2059. #define RCC_CFGR_RTCPRE_1 ((uint32_t)0x00020000)
  2060. #define RCC_CFGR_RTCPRE_2 ((uint32_t)0x00040000)
  2061. #define RCC_CFGR_RTCPRE_3 ((uint32_t)0x00080000)
  2062. #define RCC_CFGR_RTCPRE_4 ((uint32_t)0x00100000)
  2063. /*!< MCO1 configuration */
  2064. #define RCC_CFGR_MCO1 ((uint32_t)0x00600000)
  2065. #define RCC_CFGR_MCO1_0 ((uint32_t)0x00200000)
  2066. #define RCC_CFGR_MCO1_1 ((uint32_t)0x00400000)
  2067. #define RCC_CFGR_I2SSRC ((uint32_t)0x00800000)
  2068. #define RCC_CFGR_MCO1PRE ((uint32_t)0x07000000)
  2069. #define RCC_CFGR_MCO1PRE_0 ((uint32_t)0x01000000)
  2070. #define RCC_CFGR_MCO1PRE_1 ((uint32_t)0x02000000)
  2071. #define RCC_CFGR_MCO1PRE_2 ((uint32_t)0x04000000)
  2072. #define RCC_CFGR_MCO2PRE ((uint32_t)0x38000000)
  2073. #define RCC_CFGR_MCO2PRE_0 ((uint32_t)0x08000000)
  2074. #define RCC_CFGR_MCO2PRE_1 ((uint32_t)0x10000000)
  2075. #define RCC_CFGR_MCO2PRE_2 ((uint32_t)0x20000000)
  2076. #define RCC_CFGR_MCO2 ((uint32_t)0xC0000000)
  2077. #define RCC_CFGR_MCO2_0 ((uint32_t)0x40000000)
  2078. #define RCC_CFGR_MCO2_1 ((uint32_t)0x80000000)
  2079. /******************** Bit definition for RCC_CIR register *******************/
  2080. #define RCC_CIR_LSIRDYF ((uint32_t)0x00000001)
  2081. #define RCC_CIR_LSERDYF ((uint32_t)0x00000002)
  2082. #define RCC_CIR_HSIRDYF ((uint32_t)0x00000004)
  2083. #define RCC_CIR_HSERDYF ((uint32_t)0x00000008)
  2084. #define RCC_CIR_PLLRDYF ((uint32_t)0x00000010)
  2085. #define RCC_CIR_PLLI2SRDYF ((uint32_t)0x00000020)
  2086. #define RCC_CIR_CSSF ((uint32_t)0x00000080)
  2087. #define RCC_CIR_LSIRDYIE ((uint32_t)0x00000100)
  2088. #define RCC_CIR_LSERDYIE ((uint32_t)0x00000200)
  2089. #define RCC_CIR_HSIRDYIE ((uint32_t)0x00000400)
  2090. #define RCC_CIR_HSERDYIE ((uint32_t)0x00000800)
  2091. #define RCC_CIR_PLLRDYIE ((uint32_t)0x00001000)
  2092. #define RCC_CIR_PLLI2SRDYIE ((uint32_t)0x00002000)
  2093. #define RCC_CIR_LSIRDYC ((uint32_t)0x00010000)
  2094. #define RCC_CIR_LSERDYC ((uint32_t)0x00020000)
  2095. #define RCC_CIR_HSIRDYC ((uint32_t)0x00040000)
  2096. #define RCC_CIR_HSERDYC ((uint32_t)0x00080000)
  2097. #define RCC_CIR_PLLRDYC ((uint32_t)0x00100000)
  2098. #define RCC_CIR_PLLI2SRDYC ((uint32_t)0x00200000)
  2099. #define RCC_CIR_CSSC ((uint32_t)0x00800000)
  2100. /******************** Bit definition for RCC_AHB1RSTR register **************/
  2101. #define RCC_AHB1RSTR_GPIOARST ((uint32_t)0x00000001)
  2102. #define RCC_AHB1RSTR_GPIOBRST ((uint32_t)0x00000002)
  2103. #define RCC_AHB1RSTR_GPIOCRST ((uint32_t)0x00000004)
  2104. #define RCC_AHB1RSTR_GPIODRST ((uint32_t)0x00000008)
  2105. #define RCC_AHB1RSTR_GPIOERST ((uint32_t)0x00000010)
  2106. #define RCC_AHB1RSTR_GPIOHRST ((uint32_t)0x00000080)
  2107. #define RCC_AHB1RSTR_CRCRST ((uint32_t)0x00001000)
  2108. #define RCC_AHB1RSTR_DMA1RST ((uint32_t)0x00200000)
  2109. #define RCC_AHB1RSTR_DMA2RST ((uint32_t)0x00400000)
  2110. /******************** Bit definition for RCC_AHB2RSTR register **************/
  2111. #define RCC_AHB2RSTR_OTGFSRST ((uint32_t)0x00000080)
  2112. /******************** Bit definition for RCC_AHB3RSTR register **************/
  2113. /******************** Bit definition for RCC_APB1RSTR register **************/
  2114. #define RCC_APB1RSTR_TIM2RST ((uint32_t)0x00000001)
  2115. #define RCC_APB1RSTR_TIM3RST ((uint32_t)0x00000002)
  2116. #define RCC_APB1RSTR_TIM4RST ((uint32_t)0x00000004)
  2117. #define RCC_APB1RSTR_TIM5RST ((uint32_t)0x00000008)
  2118. #define RCC_APB1RSTR_WWDGRST ((uint32_t)0x00000800)
  2119. #define RCC_APB1RSTR_SPI2RST ((uint32_t)0x00004000)
  2120. #define RCC_APB1RSTR_SPI3RST ((uint32_t)0x00008000)
  2121. #define RCC_APB1RSTR_USART2RST ((uint32_t)0x00020000)
  2122. #define RCC_APB1RSTR_I2C1RST ((uint32_t)0x00200000)
  2123. #define RCC_APB1RSTR_I2C2RST ((uint32_t)0x00400000)
  2124. #define RCC_APB1RSTR_I2C3RST ((uint32_t)0x00800000)
  2125. #define RCC_APB1RSTR_PWRRST ((uint32_t)0x10000000)
  2126. /******************** Bit definition for RCC_APB2RSTR register **************/
  2127. #define RCC_APB2RSTR_TIM1RST ((uint32_t)0x00000001)
  2128. #define RCC_APB2RSTR_USART1RST ((uint32_t)0x00000010)
  2129. #define RCC_APB2RSTR_USART6RST ((uint32_t)0x00000020)
  2130. #define RCC_APB2RSTR_ADCRST ((uint32_t)0x00000100)
  2131. #define RCC_APB2RSTR_SDIORST ((uint32_t)0x00000800)
  2132. #define RCC_APB2RSTR_SPI1RST ((uint32_t)0x00001000)
  2133. #define RCC_APB2RSTR_SPI4RST ((uint32_t)0x00002000)
  2134. #define RCC_APB2RSTR_SYSCFGRST ((uint32_t)0x00004000)
  2135. #define RCC_APB2RSTR_TIM9RST ((uint32_t)0x00010000)
  2136. #define RCC_APB2RSTR_TIM10RST ((uint32_t)0x00020000)
  2137. #define RCC_APB2RSTR_TIM11RST ((uint32_t)0x00040000)
  2138. /* Old SPI1RST bit definition, maintained for legacy purpose */
  2139. #define RCC_APB2RSTR_SPI1 RCC_APB2RSTR_SPI1RST
  2140. /******************** Bit definition for RCC_AHB1ENR register ***************/
  2141. #define RCC_AHB1ENR_GPIOAEN ((uint32_t)0x00000001)
  2142. #define RCC_AHB1ENR_GPIOBEN ((uint32_t)0x00000002)
  2143. #define RCC_AHB1ENR_GPIOCEN ((uint32_t)0x00000004)
  2144. #define RCC_AHB1ENR_GPIODEN ((uint32_t)0x00000008)
  2145. #define RCC_AHB1ENR_GPIOEEN ((uint32_t)0x00000010)
  2146. #define RCC_AHB1ENR_GPIOHEN ((uint32_t)0x00000080)
  2147. #define RCC_AHB1ENR_CRCEN ((uint32_t)0x00001000)
  2148. #define RCC_AHB1ENR_BKPSRAMEN ((uint32_t)0x00040000)
  2149. #define RCC_AHB1ENR_CCMDATARAMEN ((uint32_t)0x00100000)
  2150. #define RCC_AHB1ENR_DMA1EN ((uint32_t)0x00200000)
  2151. #define RCC_AHB1ENR_DMA2EN ((uint32_t)0x00400000)
  2152. /******************** Bit definition for RCC_AHB2ENR register ***************/
  2153. #define RCC_AHB2ENR_OTGFSEN ((uint32_t)0x00000080)
  2154. /******************** Bit definition for RCC_AHB3ENR register ***************/
  2155. /******************** Bit definition for RCC_APB1ENR register ***************/
  2156. #define RCC_APB1ENR_TIM2EN ((uint32_t)0x00000001)
  2157. #define RCC_APB1ENR_TIM3EN ((uint32_t)0x00000002)
  2158. #define RCC_APB1ENR_TIM4EN ((uint32_t)0x00000004)
  2159. #define RCC_APB1ENR_TIM5EN ((uint32_t)0x00000008)
  2160. #define RCC_APB1ENR_WWDGEN ((uint32_t)0x00000800)
  2161. #define RCC_APB1ENR_SPI2EN ((uint32_t)0x00004000)
  2162. #define RCC_APB1ENR_SPI3EN ((uint32_t)0x00008000)
  2163. #define RCC_APB1ENR_USART2EN ((uint32_t)0x00020000)
  2164. #define RCC_APB1ENR_I2C1EN ((uint32_t)0x00200000)
  2165. #define RCC_APB1ENR_I2C2EN ((uint32_t)0x00400000)
  2166. #define RCC_APB1ENR_I2C3EN ((uint32_t)0x00800000)
  2167. #define RCC_APB1ENR_PWREN ((uint32_t)0x10000000)
  2168. /******************** Bit definition for RCC_APB2ENR register ***************/
  2169. #define RCC_APB2ENR_TIM1EN ((uint32_t)0x00000001)
  2170. #define RCC_APB2ENR_USART1EN ((uint32_t)0x00000010)
  2171. #define RCC_APB2ENR_USART6EN ((uint32_t)0x00000020)
  2172. #define RCC_APB2ENR_ADC1EN ((uint32_t)0x00000100)
  2173. #define RCC_APB2ENR_SDIOEN ((uint32_t)0x00000800)
  2174. #define RCC_APB2ENR_SPI1EN ((uint32_t)0x00001000)
  2175. #define RCC_APB2ENR_SPI4EN ((uint32_t)0x00002000)
  2176. #define RCC_APB2ENR_SYSCFGEN ((uint32_t)0x00004000)
  2177. #define RCC_APB2ENR_TIM9EN ((uint32_t)0x00010000)
  2178. #define RCC_APB2ENR_TIM10EN ((uint32_t)0x00020000)
  2179. #define RCC_APB2ENR_TIM11EN ((uint32_t)0x00040000)
  2180. /******************** Bit definition for RCC_AHB1LPENR register *************/
  2181. #define RCC_AHB1LPENR_GPIOALPEN ((uint32_t)0x00000001)
  2182. #define RCC_AHB1LPENR_GPIOBLPEN ((uint32_t)0x00000002)
  2183. #define RCC_AHB1LPENR_GPIOCLPEN ((uint32_t)0x00000004)
  2184. #define RCC_AHB1LPENR_GPIODLPEN ((uint32_t)0x00000008)
  2185. #define RCC_AHB1LPENR_GPIOELPEN ((uint32_t)0x00000010)
  2186. #define RCC_AHB1LPENR_GPIOHLPEN ((uint32_t)0x00000080)
  2187. #define RCC_AHB1LPENR_CRCLPEN ((uint32_t)0x00001000)
  2188. #define RCC_AHB1LPENR_FLITFLPEN ((uint32_t)0x00008000)
  2189. #define RCC_AHB1LPENR_SRAM1LPEN ((uint32_t)0x00010000)
  2190. #define RCC_AHB1LPENR_SRAM2LPEN ((uint32_t)0x00020000)
  2191. #define RCC_AHB1LPENR_BKPSRAMLPEN ((uint32_t)0x00040000)
  2192. #define RCC_AHB1LPENR_DMA1LPEN ((uint32_t)0x00200000)
  2193. #define RCC_AHB1LPENR_DMA2LPEN ((uint32_t)0x00400000)
  2194. /******************** Bit definition for RCC_AHB2LPENR register *************/
  2195. #define RCC_AHB2LPENR_OTGFSLPEN ((uint32_t)0x00000080)
  2196. /******************** Bit definition for RCC_AHB3LPENR register *************/
  2197. /******************** Bit definition for RCC_APB1LPENR register *************/
  2198. #define RCC_APB1LPENR_TIM2LPEN ((uint32_t)0x00000001)
  2199. #define RCC_APB1LPENR_TIM3LPEN ((uint32_t)0x00000002)
  2200. #define RCC_APB1LPENR_TIM4LPEN ((uint32_t)0x00000004)
  2201. #define RCC_APB1LPENR_TIM5LPEN ((uint32_t)0x00000008)
  2202. #define RCC_APB1LPENR_WWDGLPEN ((uint32_t)0x00000800)
  2203. #define RCC_APB1LPENR_SPI2LPEN ((uint32_t)0x00004000)
  2204. #define RCC_APB1LPENR_SPI3LPEN ((uint32_t)0x00008000)
  2205. #define RCC_APB1LPENR_USART2LPEN ((uint32_t)0x00020000)
  2206. #define RCC_APB1LPENR_I2C1LPEN ((uint32_t)0x00200000)
  2207. #define RCC_APB1LPENR_I2C2LPEN ((uint32_t)0x00400000)
  2208. #define RCC_APB1LPENR_I2C3LPEN ((uint32_t)0x00800000)
  2209. #define RCC_APB1LPENR_PWRLPEN ((uint32_t)0x10000000)
  2210. #define RCC_APB1LPENR_DACLPEN ((uint32_t)0x20000000)
  2211. /******************** Bit definition for RCC_APB2LPENR register *************/
  2212. #define RCC_APB2LPENR_TIM1LPEN ((uint32_t)0x00000001)
  2213. #define RCC_APB2LPENR_USART1LPEN ((uint32_t)0x00000010)
  2214. #define RCC_APB2LPENR_USART6LPEN ((uint32_t)0x00000020)
  2215. #define RCC_APB2LPENR_ADC1LPEN ((uint32_t)0x00000100)
  2216. #define RCC_APB2LPENR_SDIOLPEN ((uint32_t)0x00000800)
  2217. #define RCC_APB2LPENR_SPI1LPEN ((uint32_t)0x00001000)
  2218. #define RCC_APB2LPENR_SPI4LPEN ((uint32_t)0x00002000)
  2219. #define RCC_APB2LPENR_SYSCFGLPEN ((uint32_t)0x00004000)
  2220. #define RCC_APB2LPENR_TIM9LPEN ((uint32_t)0x00010000)
  2221. #define RCC_APB2LPENR_TIM10LPEN ((uint32_t)0x00020000)
  2222. #define RCC_APB2LPENR_TIM11LPEN ((uint32_t)0x00040000)
  2223. /******************** Bit definition for RCC_BDCR register ******************/
  2224. #define RCC_BDCR_LSEON ((uint32_t)0x00000001)
  2225. #define RCC_BDCR_LSERDY ((uint32_t)0x00000002)
  2226. #define RCC_BDCR_LSEBYP ((uint32_t)0x00000004)
  2227. #define RCC_BDCR_RTCSEL ((uint32_t)0x00000300)
  2228. #define RCC_BDCR_RTCSEL_0 ((uint32_t)0x00000100)
  2229. #define RCC_BDCR_RTCSEL_1 ((uint32_t)0x00000200)
  2230. #define RCC_BDCR_RTCEN ((uint32_t)0x00008000)
  2231. #define RCC_BDCR_BDRST ((uint32_t)0x00010000)
  2232. /******************** Bit definition for RCC_CSR register *******************/
  2233. #define RCC_CSR_LSION ((uint32_t)0x00000001)
  2234. #define RCC_CSR_LSIRDY ((uint32_t)0x00000002)
  2235. #define RCC_CSR_RMVF ((uint32_t)0x01000000)
  2236. #define RCC_CSR_BORRSTF ((uint32_t)0x02000000)
  2237. #define RCC_CSR_PADRSTF ((uint32_t)0x04000000)
  2238. #define RCC_CSR_PORRSTF ((uint32_t)0x08000000)
  2239. #define RCC_CSR_SFTRSTF ((uint32_t)0x10000000)
  2240. #define RCC_CSR_WDGRSTF ((uint32_t)0x20000000)
  2241. #define RCC_CSR_WWDGRSTF ((uint32_t)0x40000000)
  2242. #define RCC_CSR_LPWRRSTF ((uint32_t)0x80000000)
  2243. /******************** Bit definition for RCC_SSCGR register *****************/
  2244. #define RCC_SSCGR_MODPER ((uint32_t)0x00001FFF)
  2245. #define RCC_SSCGR_INCSTEP ((uint32_t)0x0FFFE000)
  2246. #define RCC_SSCGR_SPREADSEL ((uint32_t)0x40000000)
  2247. #define RCC_SSCGR_SSCGEN ((uint32_t)0x80000000)
  2248. /******************** Bit definition for RCC_PLLI2SCFGR register ************/
  2249. #define RCC_PLLI2SCFGR_PLLI2SN ((uint32_t)0x00007FC0)
  2250. #define RCC_PLLI2SCFGR_PLLI2SN_0 ((uint32_t)0x00000040)
  2251. #define RCC_PLLI2SCFGR_PLLI2SN_1 ((uint32_t)0x00000080)
  2252. #define RCC_PLLI2SCFGR_PLLI2SN_2 ((uint32_t)0x00000100)
  2253. #define RCC_PLLI2SCFGR_PLLI2SN_3 ((uint32_t)0x00000200)
  2254. #define RCC_PLLI2SCFGR_PLLI2SN_4 ((uint32_t)0x00000400)
  2255. #define RCC_PLLI2SCFGR_PLLI2SN_5 ((uint32_t)0x00000800)
  2256. #define RCC_PLLI2SCFGR_PLLI2SN_6 ((uint32_t)0x00001000)
  2257. #define RCC_PLLI2SCFGR_PLLI2SN_7 ((uint32_t)0x00002000)
  2258. #define RCC_PLLI2SCFGR_PLLI2SN_8 ((uint32_t)0x00004000)
  2259. #define RCC_PLLI2SCFGR_PLLI2SR ((uint32_t)0x70000000)
  2260. #define RCC_PLLI2SCFGR_PLLI2SR_0 ((uint32_t)0x10000000)
  2261. #define RCC_PLLI2SCFGR_PLLI2SR_1 ((uint32_t)0x20000000)
  2262. #define RCC_PLLI2SCFGR_PLLI2SR_2 ((uint32_t)0x40000000)
  2263. /******************************************************************************/
  2264. /* */
  2265. /* Real-Time Clock (RTC) */
  2266. /* */
  2267. /******************************************************************************/
  2268. /******************** Bits definition for RTC_TR register *******************/
  2269. #define RTC_TR_PM ((uint32_t)0x00400000)
  2270. #define RTC_TR_HT ((uint32_t)0x00300000)
  2271. #define RTC_TR_HT_0 ((uint32_t)0x00100000)
  2272. #define RTC_TR_HT_1 ((uint32_t)0x00200000)
  2273. #define RTC_TR_HU ((uint32_t)0x000F0000)
  2274. #define RTC_TR_HU_0 ((uint32_t)0x00010000)
  2275. #define RTC_TR_HU_1 ((uint32_t)0x00020000)
  2276. #define RTC_TR_HU_2 ((uint32_t)0x00040000)
  2277. #define RTC_TR_HU_3 ((uint32_t)0x00080000)
  2278. #define RTC_TR_MNT ((uint32_t)0x00007000)
  2279. #define RTC_TR_MNT_0 ((uint32_t)0x00001000)
  2280. #define RTC_TR_MNT_1 ((uint32_t)0x00002000)
  2281. #define RTC_TR_MNT_2 ((uint32_t)0x00004000)
  2282. #define RTC_TR_MNU ((uint32_t)0x00000F00)
  2283. #define RTC_TR_MNU_0 ((uint32_t)0x00000100)
  2284. #define RTC_TR_MNU_1 ((uint32_t)0x00000200)
  2285. #define RTC_TR_MNU_2 ((uint32_t)0x00000400)
  2286. #define RTC_TR_MNU_3 ((uint32_t)0x00000800)
  2287. #define RTC_TR_ST ((uint32_t)0x00000070)
  2288. #define RTC_TR_ST_0 ((uint32_t)0x00000010)
  2289. #define RTC_TR_ST_1 ((uint32_t)0x00000020)
  2290. #define RTC_TR_ST_2 ((uint32_t)0x00000040)
  2291. #define RTC_TR_SU ((uint32_t)0x0000000F)
  2292. #define RTC_TR_SU_0 ((uint32_t)0x00000001)
  2293. #define RTC_TR_SU_1 ((uint32_t)0x00000002)
  2294. #define RTC_TR_SU_2 ((uint32_t)0x00000004)
  2295. #define RTC_TR_SU_3 ((uint32_t)0x00000008)
  2296. /******************** Bits definition for RTC_DR register *******************/
  2297. #define RTC_DR_YT ((uint32_t)0x00F00000)
  2298. #define RTC_DR_YT_0 ((uint32_t)0x00100000)
  2299. #define RTC_DR_YT_1 ((uint32_t)0x00200000)
  2300. #define RTC_DR_YT_2 ((uint32_t)0x00400000)
  2301. #define RTC_DR_YT_3 ((uint32_t)0x00800000)
  2302. #define RTC_DR_YU ((uint32_t)0x000F0000)
  2303. #define RTC_DR_YU_0 ((uint32_t)0x00010000)
  2304. #define RTC_DR_YU_1 ((uint32_t)0x00020000)
  2305. #define RTC_DR_YU_2 ((uint32_t)0x00040000)
  2306. #define RTC_DR_YU_3 ((uint32_t)0x00080000)
  2307. #define RTC_DR_WDU ((uint32_t)0x0000E000)
  2308. #define RTC_DR_WDU_0 ((uint32_t)0x00002000)
  2309. #define RTC_DR_WDU_1 ((uint32_t)0x00004000)
  2310. #define RTC_DR_WDU_2 ((uint32_t)0x00008000)
  2311. #define RTC_DR_MT ((uint32_t)0x00001000)
  2312. #define RTC_DR_MU ((uint32_t)0x00000F00)
  2313. #define RTC_DR_MU_0 ((uint32_t)0x00000100)
  2314. #define RTC_DR_MU_1 ((uint32_t)0x00000200)
  2315. #define RTC_DR_MU_2 ((uint32_t)0x00000400)
  2316. #define RTC_DR_MU_3 ((uint32_t)0x00000800)
  2317. #define RTC_DR_DT ((uint32_t)0x00000030)
  2318. #define RTC_DR_DT_0 ((uint32_t)0x00000010)
  2319. #define RTC_DR_DT_1 ((uint32_t)0x00000020)
  2320. #define RTC_DR_DU ((uint32_t)0x0000000F)
  2321. #define RTC_DR_DU_0 ((uint32_t)0x00000001)
  2322. #define RTC_DR_DU_1 ((uint32_t)0x00000002)
  2323. #define RTC_DR_DU_2 ((uint32_t)0x00000004)
  2324. #define RTC_DR_DU_3 ((uint32_t)0x00000008)
  2325. /******************** Bits definition for RTC_CR register *******************/
  2326. #define RTC_CR_COE ((uint32_t)0x00800000)
  2327. #define RTC_CR_OSEL ((uint32_t)0x00600000)
  2328. #define RTC_CR_OSEL_0 ((uint32_t)0x00200000)
  2329. #define RTC_CR_OSEL_1 ((uint32_t)0x00400000)
  2330. #define RTC_CR_POL ((uint32_t)0x00100000)
  2331. #define RTC_CR_COSEL ((uint32_t)0x00080000)
  2332. #define RTC_CR_BCK ((uint32_t)0x00040000)
  2333. #define RTC_CR_SUB1H ((uint32_t)0x00020000)
  2334. #define RTC_CR_ADD1H ((uint32_t)0x00010000)
  2335. #define RTC_CR_TSIE ((uint32_t)0x00008000)
  2336. #define RTC_CR_WUTIE ((uint32_t)0x00004000)
  2337. #define RTC_CR_ALRBIE ((uint32_t)0x00002000)
  2338. #define RTC_CR_ALRAIE ((uint32_t)0x00001000)
  2339. #define RTC_CR_TSE ((uint32_t)0x00000800)
  2340. #define RTC_CR_WUTE ((uint32_t)0x00000400)
  2341. #define RTC_CR_ALRBE ((uint32_t)0x00000200)
  2342. #define RTC_CR_ALRAE ((uint32_t)0x00000100)
  2343. #define RTC_CR_DCE ((uint32_t)0x00000080)
  2344. #define RTC_CR_FMT ((uint32_t)0x00000040)
  2345. #define RTC_CR_BYPSHAD ((uint32_t)0x00000020)
  2346. #define RTC_CR_REFCKON ((uint32_t)0x00000010)
  2347. #define RTC_CR_TSEDGE ((uint32_t)0x00000008)
  2348. #define RTC_CR_WUCKSEL ((uint32_t)0x00000007)
  2349. #define RTC_CR_WUCKSEL_0 ((uint32_t)0x00000001)
  2350. #define RTC_CR_WUCKSEL_1 ((uint32_t)0x00000002)
  2351. #define RTC_CR_WUCKSEL_2 ((uint32_t)0x00000004)
  2352. /******************** Bits definition for RTC_ISR register ******************/
  2353. #define RTC_ISR_RECALPF ((uint32_t)0x00010000)
  2354. #define RTC_ISR_TAMP1F ((uint32_t)0x00002000)
  2355. #define RTC_ISR_TAMP2F ((uint32_t)0x00004000)
  2356. #define RTC_ISR_TSOVF ((uint32_t)0x00001000)
  2357. #define RTC_ISR_TSF ((uint32_t)0x00000800)
  2358. #define RTC_ISR_WUTF ((uint32_t)0x00000400)
  2359. #define RTC_ISR_ALRBF ((uint32_t)0x00000200)
  2360. #define RTC_ISR_ALRAF ((uint32_t)0x00000100)
  2361. #define RTC_ISR_INIT ((uint32_t)0x00000080)
  2362. #define RTC_ISR_INITF ((uint32_t)0x00000040)
  2363. #define RTC_ISR_RSF ((uint32_t)0x00000020)
  2364. #define RTC_ISR_INITS ((uint32_t)0x00000010)
  2365. #define RTC_ISR_SHPF ((uint32_t)0x00000008)
  2366. #define RTC_ISR_WUTWF ((uint32_t)0x00000004)
  2367. #define RTC_ISR_ALRBWF ((uint32_t)0x00000002)
  2368. #define RTC_ISR_ALRAWF ((uint32_t)0x00000001)
  2369. /******************** Bits definition for RTC_PRER register *****************/
  2370. #define RTC_PRER_PREDIV_A ((uint32_t)0x007F0000)
  2371. #define RTC_PRER_PREDIV_S ((uint32_t)0x00007FFF)
  2372. /******************** Bits definition for RTC_WUTR register *****************/
  2373. #define RTC_WUTR_WUT ((uint32_t)0x0000FFFF)
  2374. /******************** Bits definition for RTC_CALIBR register ***************/
  2375. #define RTC_CALIBR_DCS ((uint32_t)0x00000080)
  2376. #define RTC_CALIBR_DC ((uint32_t)0x0000001F)
  2377. /******************** Bits definition for RTC_ALRMAR register ***************/
  2378. #define RTC_ALRMAR_MSK4 ((uint32_t)0x80000000)
  2379. #define RTC_ALRMAR_WDSEL ((uint32_t)0x40000000)
  2380. #define RTC_ALRMAR_DT ((uint32_t)0x30000000)
  2381. #define RTC_ALRMAR_DT_0 ((uint32_t)0x10000000)
  2382. #define RTC_ALRMAR_DT_1 ((uint32_t)0x20000000)
  2383. #define RTC_ALRMAR_DU ((uint32_t)0x0F000000)
  2384. #define RTC_ALRMAR_DU_0 ((uint32_t)0x01000000)
  2385. #define RTC_ALRMAR_DU_1 ((uint32_t)0x02000000)
  2386. #define RTC_ALRMAR_DU_2 ((uint32_t)0x04000000)
  2387. #define RTC_ALRMAR_DU_3 ((uint32_t)0x08000000)
  2388. #define RTC_ALRMAR_MSK3 ((uint32_t)0x00800000)
  2389. #define RTC_ALRMAR_PM ((uint32_t)0x00400000)
  2390. #define RTC_ALRMAR_HT ((uint32_t)0x00300000)
  2391. #define RTC_ALRMAR_HT_0 ((uint32_t)0x00100000)
  2392. #define RTC_ALRMAR_HT_1 ((uint32_t)0x00200000)
  2393. #define RTC_ALRMAR_HU ((uint32_t)0x000F0000)
  2394. #define RTC_ALRMAR_HU_0 ((uint32_t)0x00010000)
  2395. #define RTC_ALRMAR_HU_1 ((uint32_t)0x00020000)
  2396. #define RTC_ALRMAR_HU_2 ((uint32_t)0x00040000)
  2397. #define RTC_ALRMAR_HU_3 ((uint32_t)0x00080000)
  2398. #define RTC_ALRMAR_MSK2 ((uint32_t)0x00008000)
  2399. #define RTC_ALRMAR_MNT ((uint32_t)0x00007000)
  2400. #define RTC_ALRMAR_MNT_0 ((uint32_t)0x00001000)
  2401. #define RTC_ALRMAR_MNT_1 ((uint32_t)0x00002000)
  2402. #define RTC_ALRMAR_MNT_2 ((uint32_t)0x00004000)
  2403. #define RTC_ALRMAR_MNU ((uint32_t)0x00000F00)
  2404. #define RTC_ALRMAR_MNU_0 ((uint32_t)0x00000100)
  2405. #define RTC_ALRMAR_MNU_1 ((uint32_t)0x00000200)
  2406. #define RTC_ALRMAR_MNU_2 ((uint32_t)0x00000400)
  2407. #define RTC_ALRMAR_MNU_3 ((uint32_t)0x00000800)
  2408. #define RTC_ALRMAR_MSK1 ((uint32_t)0x00000080)
  2409. #define RTC_ALRMAR_ST ((uint32_t)0x00000070)
  2410. #define RTC_ALRMAR_ST_0 ((uint32_t)0x00000010)
  2411. #define RTC_ALRMAR_ST_1 ((uint32_t)0x00000020)
  2412. #define RTC_ALRMAR_ST_2 ((uint32_t)0x00000040)
  2413. #define RTC_ALRMAR_SU ((uint32_t)0x0000000F)
  2414. #define RTC_ALRMAR_SU_0 ((uint32_t)0x00000001)
  2415. #define RTC_ALRMAR_SU_1 ((uint32_t)0x00000002)
  2416. #define RTC_ALRMAR_SU_2 ((uint32_t)0x00000004)
  2417. #define RTC_ALRMAR_SU_3 ((uint32_t)0x00000008)
  2418. /******************** Bits definition for RTC_ALRMBR register ***************/
  2419. #define RTC_ALRMBR_MSK4 ((uint32_t)0x80000000)
  2420. #define RTC_ALRMBR_WDSEL ((uint32_t)0x40000000)
  2421. #define RTC_ALRMBR_DT ((uint32_t)0x30000000)
  2422. #define RTC_ALRMBR_DT_0 ((uint32_t)0x10000000)
  2423. #define RTC_ALRMBR_DT_1 ((uint32_t)0x20000000)
  2424. #define RTC_ALRMBR_DU ((uint32_t)0x0F000000)
  2425. #define RTC_ALRMBR_DU_0 ((uint32_t)0x01000000)
  2426. #define RTC_ALRMBR_DU_1 ((uint32_t)0x02000000)
  2427. #define RTC_ALRMBR_DU_2 ((uint32_t)0x04000000)
  2428. #define RTC_ALRMBR_DU_3 ((uint32_t)0x08000000)
  2429. #define RTC_ALRMBR_MSK3 ((uint32_t)0x00800000)
  2430. #define RTC_ALRMBR_PM ((uint32_t)0x00400000)
  2431. #define RTC_ALRMBR_HT ((uint32_t)0x00300000)
  2432. #define RTC_ALRMBR_HT_0 ((uint32_t)0x00100000)
  2433. #define RTC_ALRMBR_HT_1 ((uint32_t)0x00200000)
  2434. #define RTC_ALRMBR_HU ((uint32_t)0x000F0000)
  2435. #define RTC_ALRMBR_HU_0 ((uint32_t)0x00010000)
  2436. #define RTC_ALRMBR_HU_1 ((uint32_t)0x00020000)
  2437. #define RTC_ALRMBR_HU_2 ((uint32_t)0x00040000)
  2438. #define RTC_ALRMBR_HU_3 ((uint32_t)0x00080000)
  2439. #define RTC_ALRMBR_MSK2 ((uint32_t)0x00008000)
  2440. #define RTC_ALRMBR_MNT ((uint32_t)0x00007000)
  2441. #define RTC_ALRMBR_MNT_0 ((uint32_t)0x00001000)
  2442. #define RTC_ALRMBR_MNT_1 ((uint32_t)0x00002000)
  2443. #define RTC_ALRMBR_MNT_2 ((uint32_t)0x00004000)
  2444. #define RTC_ALRMBR_MNU ((uint32_t)0x00000F00)
  2445. #define RTC_ALRMBR_MNU_0 ((uint32_t)0x00000100)
  2446. #define RTC_ALRMBR_MNU_1 ((uint32_t)0x00000200)
  2447. #define RTC_ALRMBR_MNU_2 ((uint32_t)0x00000400)
  2448. #define RTC_ALRMBR_MNU_3 ((uint32_t)0x00000800)
  2449. #define RTC_ALRMBR_MSK1 ((uint32_t)0x00000080)
  2450. #define RTC_ALRMBR_ST ((uint32_t)0x00000070)
  2451. #define RTC_ALRMBR_ST_0 ((uint32_t)0x00000010)
  2452. #define RTC_ALRMBR_ST_1 ((uint32_t)0x00000020)
  2453. #define RTC_ALRMBR_ST_2 ((uint32_t)0x00000040)
  2454. #define RTC_ALRMBR_SU ((uint32_t)0x0000000F)
  2455. #define RTC_ALRMBR_SU_0 ((uint32_t)0x00000001)
  2456. #define RTC_ALRMBR_SU_1 ((uint32_t)0x00000002)
  2457. #define RTC_ALRMBR_SU_2 ((uint32_t)0x00000004)
  2458. #define RTC_ALRMBR_SU_3 ((uint32_t)0x00000008)
  2459. /******************** Bits definition for RTC_WPR register ******************/
  2460. #define RTC_WPR_KEY ((uint32_t)0x000000FF)
  2461. /******************** Bits definition for RTC_SSR register ******************/
  2462. #define RTC_SSR_SS ((uint32_t)0x0000FFFF)
  2463. /******************** Bits definition for RTC_SHIFTR register ***************/
  2464. #define RTC_SHIFTR_SUBFS ((uint32_t)0x00007FFF)
  2465. #define RTC_SHIFTR_ADD1S ((uint32_t)0x80000000)
  2466. /******************** Bits definition for RTC_TSTR register *****************/
  2467. #define RTC_TSTR_PM ((uint32_t)0x00400000)
  2468. #define RTC_TSTR_HT ((uint32_t)0x00300000)
  2469. #define RTC_TSTR_HT_0 ((uint32_t)0x00100000)
  2470. #define RTC_TSTR_HT_1 ((uint32_t)0x00200000)
  2471. #define RTC_TSTR_HU ((uint32_t)0x000F0000)
  2472. #define RTC_TSTR_HU_0 ((uint32_t)0x00010000)
  2473. #define RTC_TSTR_HU_1 ((uint32_t)0x00020000)
  2474. #define RTC_TSTR_HU_2 ((uint32_t)0x00040000)
  2475. #define RTC_TSTR_HU_3 ((uint32_t)0x00080000)
  2476. #define RTC_TSTR_MNT ((uint32_t)0x00007000)
  2477. #define RTC_TSTR_MNT_0 ((uint32_t)0x00001000)
  2478. #define RTC_TSTR_MNT_1 ((uint32_t)0x00002000)
  2479. #define RTC_TSTR_MNT_2 ((uint32_t)0x00004000)
  2480. #define RTC_TSTR_MNU ((uint32_t)0x00000F00)
  2481. #define RTC_TSTR_MNU_0 ((uint32_t)0x00000100)
  2482. #define RTC_TSTR_MNU_1 ((uint32_t)0x00000200)
  2483. #define RTC_TSTR_MNU_2 ((uint32_t)0x00000400)
  2484. #define RTC_TSTR_MNU_3 ((uint32_t)0x00000800)
  2485. #define RTC_TSTR_ST ((uint32_t)0x00000070)
  2486. #define RTC_TSTR_ST_0 ((uint32_t)0x00000010)
  2487. #define RTC_TSTR_ST_1 ((uint32_t)0x00000020)
  2488. #define RTC_TSTR_ST_2 ((uint32_t)0x00000040)
  2489. #define RTC_TSTR_SU ((uint32_t)0x0000000F)
  2490. #define RTC_TSTR_SU_0 ((uint32_t)0x00000001)
  2491. #define RTC_TSTR_SU_1 ((uint32_t)0x00000002)
  2492. #define RTC_TSTR_SU_2 ((uint32_t)0x00000004)
  2493. #define RTC_TSTR_SU_3 ((uint32_t)0x00000008)
  2494. /******************** Bits definition for RTC_TSDR register *****************/
  2495. #define RTC_TSDR_WDU ((uint32_t)0x0000E000)
  2496. #define RTC_TSDR_WDU_0 ((uint32_t)0x00002000)
  2497. #define RTC_TSDR_WDU_1 ((uint32_t)0x00004000)
  2498. #define RTC_TSDR_WDU_2 ((uint32_t)0x00008000)
  2499. #define RTC_TSDR_MT ((uint32_t)0x00001000)
  2500. #define RTC_TSDR_MU ((uint32_t)0x00000F00)
  2501. #define RTC_TSDR_MU_0 ((uint32_t)0x00000100)
  2502. #define RTC_TSDR_MU_1 ((uint32_t)0x00000200)
  2503. #define RTC_TSDR_MU_2 ((uint32_t)0x00000400)
  2504. #define RTC_TSDR_MU_3 ((uint32_t)0x00000800)
  2505. #define RTC_TSDR_DT ((uint32_t)0x00000030)
  2506. #define RTC_TSDR_DT_0 ((uint32_t)0x00000010)
  2507. #define RTC_TSDR_DT_1 ((uint32_t)0x00000020)
  2508. #define RTC_TSDR_DU ((uint32_t)0x0000000F)
  2509. #define RTC_TSDR_DU_0 ((uint32_t)0x00000001)
  2510. #define RTC_TSDR_DU_1 ((uint32_t)0x00000002)
  2511. #define RTC_TSDR_DU_2 ((uint32_t)0x00000004)
  2512. #define RTC_TSDR_DU_3 ((uint32_t)0x00000008)
  2513. /******************** Bits definition for RTC_TSSSR register ****************/
  2514. #define RTC_TSSSR_SS ((uint32_t)0x0000FFFF)
  2515. /******************** Bits definition for RTC_CAL register *****************/
  2516. #define RTC_CALR_CALP ((uint32_t)0x00008000)
  2517. #define RTC_CALR_CALW8 ((uint32_t)0x00004000)
  2518. #define RTC_CALR_CALW16 ((uint32_t)0x00002000)
  2519. #define RTC_CALR_CALM ((uint32_t)0x000001FF)
  2520. #define RTC_CALR_CALM_0 ((uint32_t)0x00000001)
  2521. #define RTC_CALR_CALM_1 ((uint32_t)0x00000002)
  2522. #define RTC_CALR_CALM_2 ((uint32_t)0x00000004)
  2523. #define RTC_CALR_CALM_3 ((uint32_t)0x00000008)
  2524. #define RTC_CALR_CALM_4 ((uint32_t)0x00000010)
  2525. #define RTC_CALR_CALM_5 ((uint32_t)0x00000020)
  2526. #define RTC_CALR_CALM_6 ((uint32_t)0x00000040)
  2527. #define RTC_CALR_CALM_7 ((uint32_t)0x00000080)
  2528. #define RTC_CALR_CALM_8 ((uint32_t)0x00000100)
  2529. /******************** Bits definition for RTC_TAFCR register ****************/
  2530. #define RTC_TAFCR_ALARMOUTTYPE ((uint32_t)0x00040000)
  2531. #define RTC_TAFCR_TSINSEL ((uint32_t)0x00020000)
  2532. #define RTC_TAFCR_TAMPINSEL ((uint32_t)0x00010000)
  2533. #define RTC_TAFCR_TAMPPUDIS ((uint32_t)0x00008000)
  2534. #define RTC_TAFCR_TAMPPRCH ((uint32_t)0x00006000)
  2535. #define RTC_TAFCR_TAMPPRCH_0 ((uint32_t)0x00002000)
  2536. #define RTC_TAFCR_TAMPPRCH_1 ((uint32_t)0x00004000)
  2537. #define RTC_TAFCR_TAMPFLT ((uint32_t)0x00001800)
  2538. #define RTC_TAFCR_TAMPFLT_0 ((uint32_t)0x00000800)
  2539. #define RTC_TAFCR_TAMPFLT_1 ((uint32_t)0x00001000)
  2540. #define RTC_TAFCR_TAMPFREQ ((uint32_t)0x00000700)
  2541. #define RTC_TAFCR_TAMPFREQ_0 ((uint32_t)0x00000100)
  2542. #define RTC_TAFCR_TAMPFREQ_1 ((uint32_t)0x00000200)
  2543. #define RTC_TAFCR_TAMPFREQ_2 ((uint32_t)0x00000400)
  2544. #define RTC_TAFCR_TAMPTS ((uint32_t)0x00000080)
  2545. #define RTC_TAFCR_TAMP2TRG ((uint32_t)0x00000010)
  2546. #define RTC_TAFCR_TAMP2E ((uint32_t)0x00000008)
  2547. #define RTC_TAFCR_TAMPIE ((uint32_t)0x00000004)
  2548. #define RTC_TAFCR_TAMP1TRG ((uint32_t)0x00000002)
  2549. #define RTC_TAFCR_TAMP1E ((uint32_t)0x00000001)
  2550. /******************** Bits definition for RTC_ALRMASSR register *************/
  2551. #define RTC_ALRMASSR_MASKSS ((uint32_t)0x0F000000)
  2552. #define RTC_ALRMASSR_MASKSS_0 ((uint32_t)0x01000000)
  2553. #define RTC_ALRMASSR_MASKSS_1 ((uint32_t)0x02000000)
  2554. #define RTC_ALRMASSR_MASKSS_2 ((uint32_t)0x04000000)
  2555. #define RTC_ALRMASSR_MASKSS_3 ((uint32_t)0x08000000)
  2556. #define RTC_ALRMASSR_SS ((uint32_t)0x00007FFF)
  2557. /******************** Bits definition for RTC_ALRMBSSR register *************/
  2558. #define RTC_ALRMBSSR_MASKSS ((uint32_t)0x0F000000)
  2559. #define RTC_ALRMBSSR_MASKSS_0 ((uint32_t)0x01000000)
  2560. #define RTC_ALRMBSSR_MASKSS_1 ((uint32_t)0x02000000)
  2561. #define RTC_ALRMBSSR_MASKSS_2 ((uint32_t)0x04000000)
  2562. #define RTC_ALRMBSSR_MASKSS_3 ((uint32_t)0x08000000)
  2563. #define RTC_ALRMBSSR_SS ((uint32_t)0x00007FFF)
  2564. /******************** Bits definition for RTC_BKP0R register ****************/
  2565. #define RTC_BKP0R ((uint32_t)0xFFFFFFFF)
  2566. /******************** Bits definition for RTC_BKP1R register ****************/
  2567. #define RTC_BKP1R ((uint32_t)0xFFFFFFFF)
  2568. /******************** Bits definition for RTC_BKP2R register ****************/
  2569. #define RTC_BKP2R ((uint32_t)0xFFFFFFFF)
  2570. /******************** Bits definition for RTC_BKP3R register ****************/
  2571. #define RTC_BKP3R ((uint32_t)0xFFFFFFFF)
  2572. /******************** Bits definition for RTC_BKP4R register ****************/
  2573. #define RTC_BKP4R ((uint32_t)0xFFFFFFFF)
  2574. /******************** Bits definition for RTC_BKP5R register ****************/
  2575. #define RTC_BKP5R ((uint32_t)0xFFFFFFFF)
  2576. /******************** Bits definition for RTC_BKP6R register ****************/
  2577. #define RTC_BKP6R ((uint32_t)0xFFFFFFFF)
  2578. /******************** Bits definition for RTC_BKP7R register ****************/
  2579. #define RTC_BKP7R ((uint32_t)0xFFFFFFFF)
  2580. /******************** Bits definition for RTC_BKP8R register ****************/
  2581. #define RTC_BKP8R ((uint32_t)0xFFFFFFFF)
  2582. /******************** Bits definition for RTC_BKP9R register ****************/
  2583. #define RTC_BKP9R ((uint32_t)0xFFFFFFFF)
  2584. /******************** Bits definition for RTC_BKP10R register ***************/
  2585. #define RTC_BKP10R ((uint32_t)0xFFFFFFFF)
  2586. /******************** Bits definition for RTC_BKP11R register ***************/
  2587. #define RTC_BKP11R ((uint32_t)0xFFFFFFFF)
  2588. /******************** Bits definition for RTC_BKP12R register ***************/
  2589. #define RTC_BKP12R ((uint32_t)0xFFFFFFFF)
  2590. /******************** Bits definition for RTC_BKP13R register ***************/
  2591. #define RTC_BKP13R ((uint32_t)0xFFFFFFFF)
  2592. /******************** Bits definition for RTC_BKP14R register ***************/
  2593. #define RTC_BKP14R ((uint32_t)0xFFFFFFFF)
  2594. /******************** Bits definition for RTC_BKP15R register ***************/
  2595. #define RTC_BKP15R ((uint32_t)0xFFFFFFFF)
  2596. /******************** Bits definition for RTC_BKP16R register ***************/
  2597. #define RTC_BKP16R ((uint32_t)0xFFFFFFFF)
  2598. /******************** Bits definition for RTC_BKP17R register ***************/
  2599. #define RTC_BKP17R ((uint32_t)0xFFFFFFFF)
  2600. /******************** Bits definition for RTC_BKP18R register ***************/
  2601. #define RTC_BKP18R ((uint32_t)0xFFFFFFFF)
  2602. /******************** Bits definition for RTC_BKP19R register ***************/
  2603. #define RTC_BKP19R ((uint32_t)0xFFFFFFFF)
  2604. /******************************************************************************/
  2605. /* */
  2606. /* SD host Interface */
  2607. /* */
  2608. /******************************************************************************/
  2609. /****************** Bit definition for SDIO_POWER register ******************/
  2610. #define SDIO_POWER_PWRCTRL ((uint32_t)0x03) /*!<PWRCTRL[1:0] bits (Power supply control bits) */
  2611. #define SDIO_POWER_PWRCTRL_0 ((uint32_t)0x01) /*!<Bit 0 */
  2612. #define SDIO_POWER_PWRCTRL_1 ((uint32_t)0x02) /*!<Bit 1 */
  2613. /****************** Bit definition for SDIO_CLKCR register ******************/
  2614. #define SDIO_CLKCR_CLKDIV ((uint32_t)0x00FF) /*!<Clock divide factor */
  2615. #define SDIO_CLKCR_CLKEN ((uint32_t)0x0100) /*!<Clock enable bit */
  2616. #define SDIO_CLKCR_PWRSAV ((uint32_t)0x0200) /*!<Power saving configuration bit */
  2617. #define SDIO_CLKCR_BYPASS ((uint32_t)0x0400) /*!<Clock divider bypass enable bit */
  2618. #define SDIO_CLKCR_WIDBUS ((uint32_t)0x1800) /*!<WIDBUS[1:0] bits (Wide bus mode enable bit) */
  2619. #define SDIO_CLKCR_WIDBUS_0 ((uint32_t)0x0800) /*!<Bit 0 */
  2620. #define SDIO_CLKCR_WIDBUS_1 ((uint32_t)0x1000) /*!<Bit 1 */
  2621. #define SDIO_CLKCR_NEGEDGE ((uint32_t)0x2000) /*!<SDIO_CK dephasing selection bit */
  2622. #define SDIO_CLKCR_HWFC_EN ((uint32_t)0x4000) /*!<HW Flow Control enable */
  2623. /******************* Bit definition for SDIO_ARG register *******************/
  2624. #define SDIO_ARG_CMDARG ((uint32_t)0xFFFFFFFF) /*!<Command argument */
  2625. /******************* Bit definition for SDIO_CMD register *******************/
  2626. #define SDIO_CMD_CMDINDEX ((uint32_t)0x003F) /*!<Command Index */
  2627. #define SDIO_CMD_WAITRESP ((uint32_t)0x00C0) /*!<WAITRESP[1:0] bits (Wait for response bits) */
  2628. #define SDIO_CMD_WAITRESP_0 ((uint32_t)0x0040) /*!< Bit 0 */
  2629. #define SDIO_CMD_WAITRESP_1 ((uint32_t)0x0080) /*!< Bit 1 */
  2630. #define SDIO_CMD_WAITINT ((uint32_t)0x0100) /*!<CPSM Waits for Interrupt Request */
  2631. #define SDIO_CMD_WAITPEND ((uint32_t)0x0200) /*!<CPSM Waits for ends of data transfer (CmdPend internal signal) */
  2632. #define SDIO_CMD_CPSMEN ((uint32_t)0x0400) /*!<Command path state machine (CPSM) Enable bit */
  2633. #define SDIO_CMD_SDIOSUSPEND ((uint32_t)0x0800) /*!<SD I/O suspend command */
  2634. #define SDIO_CMD_ENCMDCOMPL ((uint32_t)0x1000) /*!<Enable CMD completion */
  2635. #define SDIO_CMD_NIEN ((uint32_t)0x2000) /*!<Not Interrupt Enable */
  2636. #define SDIO_CMD_CEATACMD ((uint32_t)0x4000) /*!<CE-ATA command */
  2637. /***************** Bit definition for SDIO_RESPCMD register *****************/
  2638. #define SDIO_RESPCMD_RESPCMD ((uint32_t)0x3F) /*!<Response command index */
  2639. /****************** Bit definition for SDIO_RESP0 register ******************/
  2640. #define SDIO_RESP0_CARDSTATUS0 ((uint32_t)0xFFFFFFFF) /*!<Card Status */
  2641. /****************** Bit definition for SDIO_RESP1 register ******************/
  2642. #define SDIO_RESP1_CARDSTATUS1 ((uint32_t)0xFFFFFFFF) /*!<Card Status */
  2643. /****************** Bit definition for SDIO_RESP2 register ******************/
  2644. #define SDIO_RESP2_CARDSTATUS2 ((uint32_t)0xFFFFFFFF) /*!<Card Status */
  2645. /****************** Bit definition for SDIO_RESP3 register ******************/
  2646. #define SDIO_RESP3_CARDSTATUS3 ((uint32_t)0xFFFFFFFF) /*!<Card Status */
  2647. /****************** Bit definition for SDIO_RESP4 register ******************/
  2648. #define SDIO_RESP4_CARDSTATUS4 ((uint32_t)0xFFFFFFFF) /*!<Card Status */
  2649. /****************** Bit definition for SDIO_DTIMER register *****************/
  2650. #define SDIO_DTIMER_DATATIME ((uint32_t)0xFFFFFFFF) /*!<Data timeout period. */
  2651. /****************** Bit definition for SDIO_DLEN register *******************/
  2652. #define SDIO_DLEN_DATALENGTH ((uint32_t)0x01FFFFFF) /*!<Data length value */
  2653. /****************** Bit definition for SDIO_DCTRL register ******************/
  2654. #define SDIO_DCTRL_DTEN ((uint32_t)0x0001) /*!<Data transfer enabled bit */
  2655. #define SDIO_DCTRL_DTDIR ((uint32_t)0x0002) /*!<Data transfer direction selection */
  2656. #define SDIO_DCTRL_DTMODE ((uint32_t)0x0004) /*!<Data transfer mode selection */
  2657. #define SDIO_DCTRL_DMAEN ((uint32_t)0x0008) /*!<DMA enabled bit */
  2658. #define SDIO_DCTRL_DBLOCKSIZE ((uint32_t)0x00F0) /*!<DBLOCKSIZE[3:0] bits (Data block size) */
  2659. #define SDIO_DCTRL_DBLOCKSIZE_0 ((uint32_t)0x0010) /*!<Bit 0 */
  2660. #define SDIO_DCTRL_DBLOCKSIZE_1 ((uint32_t)0x0020) /*!<Bit 1 */
  2661. #define SDIO_DCTRL_DBLOCKSIZE_2 ((uint32_t)0x0040) /*!<Bit 2 */
  2662. #define SDIO_DCTRL_DBLOCKSIZE_3 ((uint32_t)0x0080) /*!<Bit 3 */
  2663. #define SDIO_DCTRL_RWSTART ((uint32_t)0x0100) /*!<Read wait start */
  2664. #define SDIO_DCTRL_RWSTOP ((uint32_t)0x0200) /*!<Read wait stop */
  2665. #define SDIO_DCTRL_RWMOD ((uint32_t)0x0400) /*!<Read wait mode */
  2666. #define SDIO_DCTRL_SDIOEN ((uint32_t)0x0800) /*!<SD I/O enable functions */
  2667. /****************** Bit definition for SDIO_DCOUNT register *****************/
  2668. #define SDIO_DCOUNT_DATACOUNT ((uint32_t)0x01FFFFFF) /*!<Data count value */
  2669. /****************** Bit definition for SDIO_STA register ********************/
  2670. #define SDIO_STA_CCRCFAIL ((uint32_t)0x00000001) /*!<Command response received (CRC check failed) */
  2671. #define SDIO_STA_DCRCFAIL ((uint32_t)0x00000002) /*!<Data block sent/received (CRC check failed) */
  2672. #define SDIO_STA_CTIMEOUT ((uint32_t)0x00000004) /*!<Command response timeout */
  2673. #define SDIO_STA_DTIMEOUT ((uint32_t)0x00000008) /*!<Data timeout */
  2674. #define SDIO_STA_TXUNDERR ((uint32_t)0x00000010) /*!<Transmit FIFO underrun error */
  2675. #define SDIO_STA_RXOVERR ((uint32_t)0x00000020) /*!<Received FIFO overrun error */
  2676. #define SDIO_STA_CMDREND ((uint32_t)0x00000040) /*!<Command response received (CRC check passed) */
  2677. #define SDIO_STA_CMDSENT ((uint32_t)0x00000080) /*!<Command sent (no response required) */
  2678. #define SDIO_STA_DATAEND ((uint32_t)0x00000100) /*!<Data end (data counter, SDIDCOUNT, is zero) */
  2679. #define SDIO_STA_STBITERR ((uint32_t)0x00000200) /*!<Start bit not detected on all data signals in wide bus mode */
  2680. #define SDIO_STA_DBCKEND ((uint32_t)0x00000400) /*!<Data block sent/received (CRC check passed) */
  2681. #define SDIO_STA_CMDACT ((uint32_t)0x00000800) /*!<Command transfer in progress */
  2682. #define SDIO_STA_TXACT ((uint32_t)0x00001000) /*!<Data transmit in progress */
  2683. #define SDIO_STA_RXACT ((uint32_t)0x00002000) /*!<Data receive in progress */
  2684. #define SDIO_STA_TXFIFOHE ((uint32_t)0x00004000) /*!<Transmit FIFO Half Empty: at least 8 words can be written into the FIFO */
  2685. #define SDIO_STA_RXFIFOHF ((uint32_t)0x00008000) /*!<Receive FIFO Half Full: there are at least 8 words in the FIFO */
  2686. #define SDIO_STA_TXFIFOF ((uint32_t)0x00010000) /*!<Transmit FIFO full */
  2687. #define SDIO_STA_RXFIFOF ((uint32_t)0x00020000) /*!<Receive FIFO full */
  2688. #define SDIO_STA_TXFIFOE ((uint32_t)0x00040000) /*!<Transmit FIFO empty */
  2689. #define SDIO_STA_RXFIFOE ((uint32_t)0x00080000) /*!<Receive FIFO empty */
  2690. #define SDIO_STA_TXDAVL ((uint32_t)0x00100000) /*!<Data available in transmit FIFO */
  2691. #define SDIO_STA_RXDAVL ((uint32_t)0x00200000) /*!<Data available in receive FIFO */
  2692. #define SDIO_STA_SDIOIT ((uint32_t)0x00400000) /*!<SDIO interrupt received */
  2693. #define SDIO_STA_CEATAEND ((uint32_t)0x00800000) /*!<CE-ATA command completion signal received for CMD61 */
  2694. /******************* Bit definition for SDIO_ICR register *******************/
  2695. #define SDIO_ICR_CCRCFAILC ((uint32_t)0x00000001) /*!<CCRCFAIL flag clear bit */
  2696. #define SDIO_ICR_DCRCFAILC ((uint32_t)0x00000002) /*!<DCRCFAIL flag clear bit */
  2697. #define SDIO_ICR_CTIMEOUTC ((uint32_t)0x00000004) /*!<CTIMEOUT flag clear bit */
  2698. #define SDIO_ICR_DTIMEOUTC ((uint32_t)0x00000008) /*!<DTIMEOUT flag clear bit */
  2699. #define SDIO_ICR_TXUNDERRC ((uint32_t)0x00000010) /*!<TXUNDERR flag clear bit */
  2700. #define SDIO_ICR_RXOVERRC ((uint32_t)0x00000020) /*!<RXOVERR flag clear bit */
  2701. #define SDIO_ICR_CMDRENDC ((uint32_t)0x00000040) /*!<CMDREND flag clear bit */
  2702. #define SDIO_ICR_CMDSENTC ((uint32_t)0x00000080) /*!<CMDSENT flag clear bit */
  2703. #define SDIO_ICR_DATAENDC ((uint32_t)0x00000100) /*!<DATAEND flag clear bit */
  2704. #define SDIO_ICR_STBITERRC ((uint32_t)0x00000200) /*!<STBITERR flag clear bit */
  2705. #define SDIO_ICR_DBCKENDC ((uint32_t)0x00000400) /*!<DBCKEND flag clear bit */
  2706. #define SDIO_ICR_SDIOITC ((uint32_t)0x00400000) /*!<SDIOIT flag clear bit */
  2707. #define SDIO_ICR_CEATAENDC ((uint32_t)0x00800000) /*!<CEATAEND flag clear bit */
  2708. /****************** Bit definition for SDIO_MASK register *******************/
  2709. #define SDIO_MASK_CCRCFAILIE ((uint32_t)0x00000001) /*!<Command CRC Fail Interrupt Enable */
  2710. #define SDIO_MASK_DCRCFAILIE ((uint32_t)0x00000002) /*!<Data CRC Fail Interrupt Enable */
  2711. #define SDIO_MASK_CTIMEOUTIE ((uint32_t)0x00000004) /*!<Command TimeOut Interrupt Enable */
  2712. #define SDIO_MASK_DTIMEOUTIE ((uint32_t)0x00000008) /*!<Data TimeOut Interrupt Enable */
  2713. #define SDIO_MASK_TXUNDERRIE ((uint32_t)0x00000010) /*!<Tx FIFO UnderRun Error Interrupt Enable */
  2714. #define SDIO_MASK_RXOVERRIE ((uint32_t)0x00000020) /*!<Rx FIFO OverRun Error Interrupt Enable */
  2715. #define SDIO_MASK_CMDRENDIE ((uint32_t)0x00000040) /*!<Command Response Received Interrupt Enable */
  2716. #define SDIO_MASK_CMDSENTIE ((uint32_t)0x00000080) /*!<Command Sent Interrupt Enable */
  2717. #define SDIO_MASK_DATAENDIE ((uint32_t)0x00000100) /*!<Data End Interrupt Enable */
  2718. #define SDIO_MASK_STBITERRIE ((uint32_t)0x00000200) /*!<Start Bit Error Interrupt Enable */
  2719. #define SDIO_MASK_DBCKENDIE ((uint32_t)0x00000400) /*!<Data Block End Interrupt Enable */
  2720. #define SDIO_MASK_CMDACTIE ((uint32_t)0x00000800) /*!<CCommand Acting Interrupt Enable */
  2721. #define SDIO_MASK_TXACTIE ((uint32_t)0x00001000) /*!<Data Transmit Acting Interrupt Enable */
  2722. #define SDIO_MASK_RXACTIE ((uint32_t)0x00002000) /*!<Data receive acting interrupt enabled */
  2723. #define SDIO_MASK_TXFIFOHEIE ((uint32_t)0x00004000) /*!<Tx FIFO Half Empty interrupt Enable */
  2724. #define SDIO_MASK_RXFIFOHFIE ((uint32_t)0x00008000) /*!<Rx FIFO Half Full interrupt Enable */
  2725. #define SDIO_MASK_TXFIFOFIE ((uint32_t)0x00010000) /*!<Tx FIFO Full interrupt Enable */
  2726. #define SDIO_MASK_RXFIFOFIE ((uint32_t)0x00020000) /*!<Rx FIFO Full interrupt Enable */
  2727. #define SDIO_MASK_TXFIFOEIE ((uint32_t)0x00040000) /*!<Tx FIFO Empty interrupt Enable */
  2728. #define SDIO_MASK_RXFIFOEIE ((uint32_t)0x00080000) /*!<Rx FIFO Empty interrupt Enable */
  2729. #define SDIO_MASK_TXDAVLIE ((uint32_t)0x00100000) /*!<Data available in Tx FIFO interrupt Enable */
  2730. #define SDIO_MASK_RXDAVLIE ((uint32_t)0x00200000) /*!<Data available in Rx FIFO interrupt Enable */
  2731. #define SDIO_MASK_SDIOITIE ((uint32_t)0x00400000) /*!<SDIO Mode Interrupt Received interrupt Enable */
  2732. #define SDIO_MASK_CEATAENDIE ((uint32_t)0x00800000) /*!<CE-ATA command completion signal received Interrupt Enable */
  2733. /***************** Bit definition for SDIO_FIFOCNT register *****************/
  2734. #define SDIO_FIFOCNT_FIFOCOUNT ((uint32_t)0x00FFFFFF) /*!<Remaining number of words to be written to or read from the FIFO */
  2735. /****************** Bit definition for SDIO_FIFO register *******************/
  2736. #define SDIO_FIFO_FIFODATA ((uint32_t)0xFFFFFFFF) /*!<Receive and transmit FIFO data */
  2737. /******************************************************************************/
  2738. /* */
  2739. /* Serial Peripheral Interface */
  2740. /* */
  2741. /******************************************************************************/
  2742. /******************* Bit definition for SPI_CR1 register ********************/
  2743. #define SPI_CR1_CPHA ((uint32_t)0x00000001) /*!<Clock Phase */
  2744. #define SPI_CR1_CPOL ((uint32_t)0x00000002) /*!<Clock Polarity */
  2745. #define SPI_CR1_MSTR ((uint32_t)0x00000004) /*!<Master Selection */
  2746. #define SPI_CR1_BR ((uint32_t)0x00000038) /*!<BR[2:0] bits (Baud Rate Control) */
  2747. #define SPI_CR1_BR_0 ((uint32_t)0x00000008) /*!<Bit 0 */
  2748. #define SPI_CR1_BR_1 ((uint32_t)0x00000010) /*!<Bit 1 */
  2749. #define SPI_CR1_BR_2 ((uint32_t)0x00000020) /*!<Bit 2 */
  2750. #define SPI_CR1_SPE ((uint32_t)0x00000040) /*!<SPI Enable */
  2751. #define SPI_CR1_LSBFIRST ((uint32_t)0x00000080) /*!<Frame Format */
  2752. #define SPI_CR1_SSI ((uint32_t)0x00000100) /*!<Internal slave select */
  2753. #define SPI_CR1_SSM ((uint32_t)0x00000200) /*!<Software slave management */
  2754. #define SPI_CR1_RXONLY ((uint32_t)0x00000400) /*!<Receive only */
  2755. #define SPI_CR1_DFF ((uint32_t)0x00000800) /*!<Data Frame Format */
  2756. #define SPI_CR1_CRCNEXT ((uint32_t)0x00001000) /*!<Transmit CRC next */
  2757. #define SPI_CR1_CRCEN ((uint32_t)0x00002000) /*!<Hardware CRC calculation enable */
  2758. #define SPI_CR1_BIDIOE ((uint32_t)0x00004000) /*!<Output enable in bidirectional mode */
  2759. #define SPI_CR1_BIDIMODE ((uint32_t)0x00008000) /*!<Bidirectional data mode enable */
  2760. /******************* Bit definition for SPI_CR2 register ********************/
  2761. #define SPI_CR2_RXDMAEN ((uint32_t)0x00000001) /*!<Rx Buffer DMA Enable */
  2762. #define SPI_CR2_TXDMAEN ((uint32_t)0x00000002) /*!<Tx Buffer DMA Enable */
  2763. #define SPI_CR2_SSOE ((uint32_t)0x00000004) /*!<SS Output Enable */
  2764. #define SPI_CR2_FRF ((uint32_t)0x00000010) /*!<Frame Format */
  2765. #define SPI_CR2_ERRIE ((uint32_t)0x00000020) /*!<Error Interrupt Enable */
  2766. #define SPI_CR2_RXNEIE ((uint32_t)0x00000040) /*!<RX buffer Not Empty Interrupt Enable */
  2767. #define SPI_CR2_TXEIE ((uint32_t)0x00000080) /*!<Tx buffer Empty Interrupt Enable */
  2768. /******************** Bit definition for SPI_SR register ********************/
  2769. #define SPI_SR_RXNE ((uint32_t)0x00000001) /*!<Receive buffer Not Empty */
  2770. #define SPI_SR_TXE ((uint32_t)0x00000002) /*!<Transmit buffer Empty */
  2771. #define SPI_SR_CHSIDE ((uint32_t)0x00000004) /*!<Channel side */
  2772. #define SPI_SR_UDR ((uint32_t)0x00000008) /*!<Underrun flag */
  2773. #define SPI_SR_CRCERR ((uint32_t)0x00000010) /*!<CRC Error flag */
  2774. #define SPI_SR_MODF ((uint32_t)0x00000020) /*!<Mode fault */
  2775. #define SPI_SR_OVR ((uint32_t)0x00000040) /*!<Overrun flag */
  2776. #define SPI_SR_BSY ((uint32_t)0x00000080) /*!<Busy flag */
  2777. #define SPI_SR_FRE ((uint32_t)0x00000100) /*!<Frame format error flag */
  2778. /******************** Bit definition for SPI_DR register ********************/
  2779. #define SPI_DR_DR ((uint32_t)0x0000FFFF) /*!<Data Register */
  2780. /******************* Bit definition for SPI_CRCPR register ******************/
  2781. #define SPI_CRCPR_CRCPOLY ((uint32_t)0x0000FFFF) /*!<CRC polynomial register */
  2782. /****************** Bit definition for SPI_RXCRCR register ******************/
  2783. #define SPI_RXCRCR_RXCRC ((uint32_t)0x0000FFFF) /*!<Rx CRC Register */
  2784. /****************** Bit definition for SPI_TXCRCR register ******************/
  2785. #define SPI_TXCRCR_TXCRC ((uint32_t)0x0000FFFF) /*!<Tx CRC Register */
  2786. /****************** Bit definition for SPI_I2SCFGR register *****************/
  2787. #define SPI_I2SCFGR_CHLEN ((uint32_t)0x00000001) /*!<Channel length (number of bits per audio channel) */
  2788. #define SPI_I2SCFGR_DATLEN ((uint32_t)0x00000006) /*!<DATLEN[1:0] bits (Data length to be transferred) */
  2789. #define SPI_I2SCFGR_DATLEN_0 ((uint32_t)0x00000002) /*!<Bit 0 */
  2790. #define SPI_I2SCFGR_DATLEN_1 ((uint32_t)0x00000004) /*!<Bit 1 */
  2791. #define SPI_I2SCFGR_CKPOL ((uint32_t)0x00000008) /*!<steady state clock polarity */
  2792. #define SPI_I2SCFGR_I2SSTD ((uint32_t)0x00000030) /*!<I2SSTD[1:0] bits (I2S standard selection) */
  2793. #define SPI_I2SCFGR_I2SSTD_0 ((uint32_t)0x00000010) /*!<Bit 0 */
  2794. #define SPI_I2SCFGR_I2SSTD_1 ((uint32_t)0x00000020) /*!<Bit 1 */
  2795. #define SPI_I2SCFGR_PCMSYNC ((uint32_t)0x00000080) /*!<PCM frame synchronization */
  2796. #define SPI_I2SCFGR_I2SCFG ((uint32_t)0x00000300) /*!<I2SCFG[1:0] bits (I2S configuration mode) */
  2797. #define SPI_I2SCFGR_I2SCFG_0 ((uint32_t)0x00000100) /*!<Bit 0 */
  2798. #define SPI_I2SCFGR_I2SCFG_1 ((uint32_t)0x00000200) /*!<Bit 1 */
  2799. #define SPI_I2SCFGR_I2SE ((uint32_t)0x00000400) /*!<I2S Enable */
  2800. #define SPI_I2SCFGR_I2SMOD ((uint32_t)0x00000800) /*!<I2S mode selection */
  2801. /****************** Bit definition for SPI_I2SPR register *******************/
  2802. #define SPI_I2SPR_I2SDIV ((uint32_t)0x000000FF) /*!<I2S Linear prescaler */
  2803. #define SPI_I2SPR_ODD ((uint32_t)0x00000100) /*!<Odd factor for the prescaler */
  2804. #define SPI_I2SPR_MCKOE ((uint32_t)0x00000200) /*!<Master Clock Output Enable */
  2805. /******************************************************************************/
  2806. /* */
  2807. /* SYSCFG */
  2808. /* */
  2809. /******************************************************************************/
  2810. /****************** Bit definition for SYSCFG_MEMRMP register ***************/
  2811. #define SYSCFG_MEMRMP_MEM_MODE ((uint32_t)0x00000007) /*!< SYSCFG_Memory Remap Config */
  2812. #define SYSCFG_MEMRMP_MEM_MODE_0 ((uint32_t)0x00000001)
  2813. #define SYSCFG_MEMRMP_MEM_MODE_1 ((uint32_t)0x00000002)
  2814. #define SYSCFG_MEMRMP_MEM_MODE_2 ((uint32_t)0x00000004)
  2815. /****************** Bit definition for SYSCFG_PMC register ******************/
  2816. #define SYSCFG_PMC_ADC1DC2 ((uint32_t)0x00010000) /*!< Refer to AN4073 on how to use this bit */
  2817. /***************** Bit definition for SYSCFG_EXTICR1 register ***************/
  2818. #define SYSCFG_EXTICR1_EXTI0 ((uint32_t)0x000F) /*!<EXTI 0 configuration */
  2819. #define SYSCFG_EXTICR1_EXTI1 ((uint32_t)0x00F0) /*!<EXTI 1 configuration */
  2820. #define SYSCFG_EXTICR1_EXTI2 ((uint32_t)0x0F00) /*!<EXTI 2 configuration */
  2821. #define SYSCFG_EXTICR1_EXTI3 ((uint32_t)0xF000) /*!<EXTI 3 configuration */
  2822. /**
  2823. * @brief EXTI0 configuration
  2824. */
  2825. #define SYSCFG_EXTICR1_EXTI0_PA ((uint32_t)0x0000) /*!<PA[0] pin */
  2826. #define SYSCFG_EXTICR1_EXTI0_PB ((uint32_t)0x0001) /*!<PB[0] pin */
  2827. #define SYSCFG_EXTICR1_EXTI0_PC ((uint32_t)0x0002) /*!<PC[0] pin */
  2828. #define SYSCFG_EXTICR1_EXTI0_PD ((uint32_t)0x0003) /*!<PD[0] pin */
  2829. #define SYSCFG_EXTICR1_EXTI0_PE ((uint32_t)0x0004) /*!<PE[0] pin */
  2830. #define SYSCFG_EXTICR1_EXTI0_PH ((uint32_t)0x0007) /*!<PH[0] pin */
  2831. /**
  2832. * @brief EXTI1 configuration
  2833. */
  2834. #define SYSCFG_EXTICR1_EXTI1_PA ((uint32_t)0x0000) /*!<PA[1] pin */
  2835. #define SYSCFG_EXTICR1_EXTI1_PB ((uint32_t)0x0010) /*!<PB[1] pin */
  2836. #define SYSCFG_EXTICR1_EXTI1_PC ((uint32_t)0x0020) /*!<PC[1] pin */
  2837. #define SYSCFG_EXTICR1_EXTI1_PD ((uint32_t)0x0030) /*!<PD[1] pin */
  2838. #define SYSCFG_EXTICR1_EXTI1_PE ((uint32_t)0x0040) /*!<PE[1] pin */
  2839. #define SYSCFG_EXTICR1_EXTI1_PH ((uint32_t)0x0070) /*!<PH[1] pin */
  2840. /**
  2841. * @brief EXTI2 configuration
  2842. */
  2843. #define SYSCFG_EXTICR1_EXTI2_PA ((uint32_t)0x0000) /*!<PA[2] pin */
  2844. #define SYSCFG_EXTICR1_EXTI2_PB ((uint32_t)0x0100) /*!<PB[2] pin */
  2845. #define SYSCFG_EXTICR1_EXTI2_PC ((uint32_t)0x0200) /*!<PC[2] pin */
  2846. #define SYSCFG_EXTICR1_EXTI2_PD ((uint32_t)0x0300) /*!<PD[2] pin */
  2847. #define SYSCFG_EXTICR1_EXTI2_PE ((uint32_t)0x0400) /*!<PE[2] pin */
  2848. #define SYSCFG_EXTICR1_EXTI2_PH ((uint32_t)0x0700) /*!<PH[2] pin */
  2849. /**
  2850. * @brief EXTI3 configuration
  2851. */
  2852. #define SYSCFG_EXTICR1_EXTI3_PA ((uint32_t)0x0000) /*!<PA[3] pin */
  2853. #define SYSCFG_EXTICR1_EXTI3_PB ((uint32_t)0x1000) /*!<PB[3] pin */
  2854. #define SYSCFG_EXTICR1_EXTI3_PC ((uint32_t)0x2000) /*!<PC[3] pin */
  2855. #define SYSCFG_EXTICR1_EXTI3_PD ((uint32_t)0x3000) /*!<PD[3] pin */
  2856. #define SYSCFG_EXTICR1_EXTI3_PE ((uint32_t)0x4000) /*!<PE[3] pin */
  2857. #define SYSCFG_EXTICR1_EXTI3_PH ((uint32_t)0x7000) /*!<PH[3] pin */
  2858. /***************** Bit definition for SYSCFG_EXTICR2 register ***************/
  2859. #define SYSCFG_EXTICR2_EXTI4 ((uint32_t)0x000F) /*!<EXTI 4 configuration */
  2860. #define SYSCFG_EXTICR2_EXTI5 ((uint32_t)0x00F0) /*!<EXTI 5 configuration */
  2861. #define SYSCFG_EXTICR2_EXTI6 ((uint32_t)0x0F00) /*!<EXTI 6 configuration */
  2862. #define SYSCFG_EXTICR2_EXTI7 ((uint32_t)0xF000) /*!<EXTI 7 configuration */
  2863. /**
  2864. * @brief EXTI4 configuration
  2865. */
  2866. #define SYSCFG_EXTICR2_EXTI4_PA ((uint32_t)0x0000) /*!<PA[4] pin */
  2867. #define SYSCFG_EXTICR2_EXTI4_PB ((uint32_t)0x0001) /*!<PB[4] pin */
  2868. #define SYSCFG_EXTICR2_EXTI4_PC ((uint32_t)0x0002) /*!<PC[4] pin */
  2869. #define SYSCFG_EXTICR2_EXTI4_PD ((uint32_t)0x0003) /*!<PD[4] pin */
  2870. #define SYSCFG_EXTICR2_EXTI4_PE ((uint32_t)0x0004) /*!<PE[4] pin */
  2871. #define SYSCFG_EXTICR2_EXTI4_PH ((uint32_t)0x0007) /*!<PH[4] pin */
  2872. /**
  2873. * @brief EXTI5 configuration
  2874. */
  2875. #define SYSCFG_EXTICR2_EXTI5_PA ((uint32_t)0x0000) /*!<PA[5] pin */
  2876. #define SYSCFG_EXTICR2_EXTI5_PB ((uint32_t)0x0010) /*!<PB[5] pin */
  2877. #define SYSCFG_EXTICR2_EXTI5_PC ((uint32_t)0x0020) /*!<PC[5] pin */
  2878. #define SYSCFG_EXTICR2_EXTI5_PD ((uint32_t)0x0030) /*!<PD[5] pin */
  2879. #define SYSCFG_EXTICR2_EXTI5_PE ((uint32_t)0x0040) /*!<PE[5] pin */
  2880. #define SYSCFG_EXTICR2_EXTI5_PH ((uint32_t)0x0070) /*!<PH[5] pin */
  2881. /**
  2882. * @brief EXTI6 configuration
  2883. */
  2884. #define SYSCFG_EXTICR2_EXTI6_PA ((uint32_t)0x0000) /*!<PA[6] pin */
  2885. #define SYSCFG_EXTICR2_EXTI6_PB ((uint32_t)0x0100) /*!<PB[6] pin */
  2886. #define SYSCFG_EXTICR2_EXTI6_PC ((uint32_t)0x0200) /*!<PC[6] pin */
  2887. #define SYSCFG_EXTICR2_EXTI6_PD ((uint32_t)0x0300) /*!<PD[6] pin */
  2888. #define SYSCFG_EXTICR2_EXTI6_PE ((uint32_t)0x0400) /*!<PE[6] pin */
  2889. #define SYSCFG_EXTICR2_EXTI6_PH ((uint32_t)0x0700) /*!<PH[6] pin */
  2890. /**
  2891. * @brief EXTI7 configuration
  2892. */
  2893. #define SYSCFG_EXTICR2_EXTI7_PA ((uint32_t)0x0000) /*!<PA[7] pin */
  2894. #define SYSCFG_EXTICR2_EXTI7_PB ((uint32_t)0x1000) /*!<PB[7] pin */
  2895. #define SYSCFG_EXTICR2_EXTI7_PC ((uint32_t)0x2000) /*!<PC[7] pin */
  2896. #define SYSCFG_EXTICR2_EXTI7_PD ((uint32_t)0x3000) /*!<PD[7] pin */
  2897. #define SYSCFG_EXTICR2_EXTI7_PE ((uint32_t)0x4000) /*!<PE[7] pin */
  2898. #define SYSCFG_EXTICR2_EXTI7_PH ((uint32_t)0x7000) /*!<PH[7] pin */
  2899. /***************** Bit definition for SYSCFG_EXTICR3 register ***************/
  2900. #define SYSCFG_EXTICR3_EXTI8 ((uint32_t)0x000F) /*!<EXTI 8 configuration */
  2901. #define SYSCFG_EXTICR3_EXTI9 ((uint32_t)0x00F0) /*!<EXTI 9 configuration */
  2902. #define SYSCFG_EXTICR3_EXTI10 ((uint32_t)0x0F00) /*!<EXTI 10 configuration */
  2903. #define SYSCFG_EXTICR3_EXTI11 ((uint32_t)0xF000) /*!<EXTI 11 configuration */
  2904. /**
  2905. * @brief EXTI8 configuration
  2906. */
  2907. #define SYSCFG_EXTICR3_EXTI8_PA ((uint32_t)0x0000) /*!<PA[8] pin */
  2908. #define SYSCFG_EXTICR3_EXTI8_PB ((uint32_t)0x0001) /*!<PB[8] pin */
  2909. #define SYSCFG_EXTICR3_EXTI8_PC ((uint32_t)0x0002) /*!<PC[8] pin */
  2910. #define SYSCFG_EXTICR3_EXTI8_PD ((uint32_t)0x0003) /*!<PD[8] pin */
  2911. #define SYSCFG_EXTICR3_EXTI8_PE ((uint32_t)0x0004) /*!<PE[8] pin */
  2912. #define SYSCFG_EXTICR3_EXTI8_PH ((uint32_t)0x0007) /*!<PH[8] pin */
  2913. /**
  2914. * @brief EXTI9 configuration
  2915. */
  2916. #define SYSCFG_EXTICR3_EXTI9_PA ((uint32_t)0x0000) /*!<PA[9] pin */
  2917. #define SYSCFG_EXTICR3_EXTI9_PB ((uint32_t)0x0010) /*!<PB[9] pin */
  2918. #define SYSCFG_EXTICR3_EXTI9_PC ((uint32_t)0x0020) /*!<PC[9] pin */
  2919. #define SYSCFG_EXTICR3_EXTI9_PD ((uint32_t)0x0030) /*!<PD[9] pin */
  2920. #define SYSCFG_EXTICR3_EXTI9_PE ((uint32_t)0x0040) /*!<PE[9] pin */
  2921. #define SYSCFG_EXTICR3_EXTI9_PH ((uint32_t)0x0070) /*!<PH[9] pin */
  2922. /**
  2923. * @brief EXTI10 configuration
  2924. */
  2925. #define SYSCFG_EXTICR3_EXTI10_PA ((uint32_t)0x0000) /*!<PA[10] pin */
  2926. #define SYSCFG_EXTICR3_EXTI10_PB ((uint32_t)0x0100) /*!<PB[10] pin */
  2927. #define SYSCFG_EXTICR3_EXTI10_PC ((uint32_t)0x0200) /*!<PC[10] pin */
  2928. #define SYSCFG_EXTICR3_EXTI10_PD ((uint32_t)0x0300) /*!<PD[10] pin */
  2929. #define SYSCFG_EXTICR3_EXTI10_PE ((uint32_t)0x0400) /*!<PE[10] pin */
  2930. #define SYSCFG_EXTICR3_EXTI10_PH ((uint32_t)0x0700) /*!<PH[10] pin */
  2931. /**
  2932. * @brief EXTI11 configuration
  2933. */
  2934. #define SYSCFG_EXTICR3_EXTI11_PA ((uint32_t)0x0000) /*!<PA[11] pin */
  2935. #define SYSCFG_EXTICR3_EXTI11_PB ((uint32_t)0x1000) /*!<PB[11] pin */
  2936. #define SYSCFG_EXTICR3_EXTI11_PC ((uint32_t)0x2000) /*!<PC[11] pin */
  2937. #define SYSCFG_EXTICR3_EXTI11_PD ((uint32_t)0x3000) /*!<PD[11] pin */
  2938. #define SYSCFG_EXTICR3_EXTI11_PE ((uint32_t)0x4000) /*!<PE[11] pin */
  2939. #define SYSCFG_EXTICR3_EXTI11_PH ((uint32_t)0x7000) /*!<PH[11] pin */
  2940. /***************** Bit definition for SYSCFG_EXTICR4 register ***************/
  2941. #define SYSCFG_EXTICR4_EXTI12 ((uint32_t)0x000F) /*!<EXTI 12 configuration */
  2942. #define SYSCFG_EXTICR4_EXTI13 ((uint32_t)0x00F0) /*!<EXTI 13 configuration */
  2943. #define SYSCFG_EXTICR4_EXTI14 ((uint32_t)0x0F00) /*!<EXTI 14 configuration */
  2944. #define SYSCFG_EXTICR4_EXTI15 ((uint32_t)0xF000) /*!<EXTI 15 configuration */
  2945. /**
  2946. * @brief EXTI12 configuration
  2947. */
  2948. #define SYSCFG_EXTICR4_EXTI12_PA ((uint32_t)0x0000) /*!<PA[12] pin */
  2949. #define SYSCFG_EXTICR4_EXTI12_PB ((uint32_t)0x0001) /*!<PB[12] pin */
  2950. #define SYSCFG_EXTICR4_EXTI12_PC ((uint32_t)0x0002) /*!<PC[12] pin */
  2951. #define SYSCFG_EXTICR4_EXTI12_PD ((uint32_t)0x0003) /*!<PD[12] pin */
  2952. #define SYSCFG_EXTICR4_EXTI12_PE ((uint32_t)0x0004) /*!<PE[12] pin */
  2953. #define SYSCFG_EXTICR4_EXTI12_PH ((uint32_t)0x0007) /*!<PH[12] pin */
  2954. /**
  2955. * @brief EXTI13 configuration
  2956. */
  2957. #define SYSCFG_EXTICR4_EXTI13_PA ((uint32_t)0x0000) /*!<PA[13] pin */
  2958. #define SYSCFG_EXTICR4_EXTI13_PB ((uint32_t)0x0010) /*!<PB[13] pin */
  2959. #define SYSCFG_EXTICR4_EXTI13_PC ((uint32_t)0x0020) /*!<PC[13] pin */
  2960. #define SYSCFG_EXTICR4_EXTI13_PD ((uint32_t)0x0030) /*!<PD[13] pin */
  2961. #define SYSCFG_EXTICR4_EXTI13_PE ((uint32_t)0x0040) /*!<PE[13] pin */
  2962. #define SYSCFG_EXTICR4_EXTI13_PH ((uint32_t)0x0070) /*!<PH[13] pin */
  2963. /**
  2964. * @brief EXTI14 configuration
  2965. */
  2966. #define SYSCFG_EXTICR4_EXTI14_PA ((uint32_t)0x0000) /*!<PA[14] pin */
  2967. #define SYSCFG_EXTICR4_EXTI14_PB ((uint32_t)0x0100) /*!<PB[14] pin */
  2968. #define SYSCFG_EXTICR4_EXTI14_PC ((uint32_t)0x0200) /*!<PC[14] pin */
  2969. #define SYSCFG_EXTICR4_EXTI14_PD ((uint32_t)0x0300) /*!<PD[14] pin */
  2970. #define SYSCFG_EXTICR4_EXTI14_PE ((uint32_t)0x0400) /*!<PE[14] pin */
  2971. #define SYSCFG_EXTICR4_EXTI14_PH ((uint32_t)0x0700) /*!<PH[14] pin */
  2972. /**
  2973. * @brief EXTI15 configuration
  2974. */
  2975. #define SYSCFG_EXTICR4_EXTI15_PA ((uint32_t)0x0000) /*!<PA[15] pin */
  2976. #define SYSCFG_EXTICR4_EXTI15_PB ((uint32_t)0x1000) /*!<PB[15] pin */
  2977. #define SYSCFG_EXTICR4_EXTI15_PC ((uint32_t)0x2000) /*!<PC[15] pin */
  2978. #define SYSCFG_EXTICR4_EXTI15_PD ((uint32_t)0x3000) /*!<PD[15] pin */
  2979. #define SYSCFG_EXTICR4_EXTI15_PE ((uint32_t)0x4000) /*!<PE[15] pin */
  2980. #define SYSCFG_EXTICR4_EXTI15_PH ((uint32_t)0x7000) /*!<PH[15] pin */
  2981. /****************** Bit definition for SYSCFG_CMPCR register ****************/
  2982. #define SYSCFG_CMPCR_CMP_PD ((uint32_t)0x00000001) /*!<Compensation cell ready flag */
  2983. #define SYSCFG_CMPCR_READY ((uint32_t)0x00000100) /*!<Compensation cell power-down */
  2984. /******************************************************************************/
  2985. /* */
  2986. /* TIM */
  2987. /* */
  2988. /******************************************************************************/
  2989. /******************* Bit definition for TIM_CR1 register ********************/
  2990. #define TIM_CR1_CEN ((uint32_t)0x0001) /*!<Counter enable */
  2991. #define TIM_CR1_UDIS ((uint32_t)0x0002) /*!<Update disable */
  2992. #define TIM_CR1_URS ((uint32_t)0x0004) /*!<Update request source */
  2993. #define TIM_CR1_OPM ((uint32_t)0x0008) /*!<One pulse mode */
  2994. #define TIM_CR1_DIR ((uint32_t)0x0010) /*!<Direction */
  2995. #define TIM_CR1_CMS ((uint32_t)0x0060) /*!<CMS[1:0] bits (Center-aligned mode selection) */
  2996. #define TIM_CR1_CMS_0 ((uint32_t)0x0020) /*!<Bit 0 */
  2997. #define TIM_CR1_CMS_1 ((uint32_t)0x0040) /*!<Bit 1 */
  2998. #define TIM_CR1_ARPE ((uint32_t)0x0080) /*!<Auto-reload preload enable */
  2999. #define TIM_CR1_CKD ((uint32_t)0x0300) /*!<CKD[1:0] bits (clock division) */
  3000. #define TIM_CR1_CKD_0 ((uint32_t)0x0100) /*!<Bit 0 */
  3001. #define TIM_CR1_CKD_1 ((uint32_t)0x0200) /*!<Bit 1 */
  3002. /******************* Bit definition for TIM_CR2 register ********************/
  3003. #define TIM_CR2_CCPC ((uint32_t)0x0001) /*!<Capture/Compare Preloaded Control */
  3004. #define TIM_CR2_CCUS ((uint32_t)0x0004) /*!<Capture/Compare Control Update Selection */
  3005. #define TIM_CR2_CCDS ((uint32_t)0x0008) /*!<Capture/Compare DMA Selection */
  3006. #define TIM_CR2_MMS ((uint32_t)0x0070) /*!<MMS[2:0] bits (Master Mode Selection) */
  3007. #define TIM_CR2_MMS_0 ((uint32_t)0x0010) /*!<Bit 0 */
  3008. #define TIM_CR2_MMS_1 ((uint32_t)0x0020) /*!<Bit 1 */
  3009. #define TIM_CR2_MMS_2 ((uint32_t)0x0040) /*!<Bit 2 */
  3010. #define TIM_CR2_TI1S ((uint32_t)0x0080) /*!<TI1 Selection */
  3011. #define TIM_CR2_OIS1 ((uint32_t)0x0100) /*!<Output Idle state 1 (OC1 output) */
  3012. #define TIM_CR2_OIS1N ((uint32_t)0x0200) /*!<Output Idle state 1 (OC1N output) */
  3013. #define TIM_CR2_OIS2 ((uint32_t)0x0400) /*!<Output Idle state 2 (OC2 output) */
  3014. #define TIM_CR2_OIS2N ((uint32_t)0x0800) /*!<Output Idle state 2 (OC2N output) */
  3015. #define TIM_CR2_OIS3 ((uint32_t)0x1000) /*!<Output Idle state 3 (OC3 output) */
  3016. #define TIM_CR2_OIS3N ((uint32_t)0x2000) /*!<Output Idle state 3 (OC3N output) */
  3017. #define TIM_CR2_OIS4 ((uint32_t)0x4000) /*!<Output Idle state 4 (OC4 output) */
  3018. /******************* Bit definition for TIM_SMCR register *******************/
  3019. #define TIM_SMCR_SMS ((uint32_t)0x0007) /*!<SMS[2:0] bits (Slave mode selection) */
  3020. #define TIM_SMCR_SMS_0 ((uint32_t)0x0001) /*!<Bit 0 */
  3021. #define TIM_SMCR_SMS_1 ((uint32_t)0x0002) /*!<Bit 1 */
  3022. #define TIM_SMCR_SMS_2 ((uint32_t)0x0004) /*!<Bit 2 */
  3023. #define TIM_SMCR_TS ((uint32_t)0x0070) /*!<TS[2:0] bits (Trigger selection) */
  3024. #define TIM_SMCR_TS_0 ((uint32_t)0x0010) /*!<Bit 0 */
  3025. #define TIM_SMCR_TS_1 ((uint32_t)0x0020) /*!<Bit 1 */
  3026. #define TIM_SMCR_TS_2 ((uint32_t)0x0040) /*!<Bit 2 */
  3027. #define TIM_SMCR_MSM ((uint32_t)0x0080) /*!<Master/slave mode */
  3028. #define TIM_SMCR_ETF ((uint32_t)0x0F00) /*!<ETF[3:0] bits (External trigger filter) */
  3029. #define TIM_SMCR_ETF_0 ((uint32_t)0x0100) /*!<Bit 0 */
  3030. #define TIM_SMCR_ETF_1 ((uint32_t)0x0200) /*!<Bit 1 */
  3031. #define TIM_SMCR_ETF_2 ((uint32_t)0x0400) /*!<Bit 2 */
  3032. #define TIM_SMCR_ETF_3 ((uint32_t)0x0800) /*!<Bit 3 */
  3033. #define TIM_SMCR_ETPS ((uint32_t)0x3000) /*!<ETPS[1:0] bits (External trigger prescaler) */
  3034. #define TIM_SMCR_ETPS_0 ((uint32_t)0x1000) /*!<Bit 0 */
  3035. #define TIM_SMCR_ETPS_1 ((uint32_t)0x2000) /*!<Bit 1 */
  3036. #define TIM_SMCR_ECE ((uint32_t)0x4000) /*!<External clock enable */
  3037. #define TIM_SMCR_ETP ((uint32_t)0x8000) /*!<External trigger polarity */
  3038. /******************* Bit definition for TIM_DIER register *******************/
  3039. #define TIM_DIER_UIE ((uint32_t)0x0001) /*!<Update interrupt enable */
  3040. #define TIM_DIER_CC1IE ((uint32_t)0x0002) /*!<Capture/Compare 1 interrupt enable */
  3041. #define TIM_DIER_CC2IE ((uint32_t)0x0004) /*!<Capture/Compare 2 interrupt enable */
  3042. #define TIM_DIER_CC3IE ((uint32_t)0x0008) /*!<Capture/Compare 3 interrupt enable */
  3043. #define TIM_DIER_CC4IE ((uint32_t)0x0010) /*!<Capture/Compare 4 interrupt enable */
  3044. #define TIM_DIER_COMIE ((uint32_t)0x0020) /*!<COM interrupt enable */
  3045. #define TIM_DIER_TIE ((uint32_t)0x0040) /*!<Trigger interrupt enable */
  3046. #define TIM_DIER_BIE ((uint32_t)0x0080) /*!<Break interrupt enable */
  3047. #define TIM_DIER_UDE ((uint32_t)0x0100) /*!<Update DMA request enable */
  3048. #define TIM_DIER_CC1DE ((uint32_t)0x0200) /*!<Capture/Compare 1 DMA request enable */
  3049. #define TIM_DIER_CC2DE ((uint32_t)0x0400) /*!<Capture/Compare 2 DMA request enable */
  3050. #define TIM_DIER_CC3DE ((uint32_t)0x0800) /*!<Capture/Compare 3 DMA request enable */
  3051. #define TIM_DIER_CC4DE ((uint32_t)0x1000) /*!<Capture/Compare 4 DMA request enable */
  3052. #define TIM_DIER_COMDE ((uint32_t)0x2000) /*!<COM DMA request enable */
  3053. #define TIM_DIER_TDE ((uint32_t)0x4000) /*!<Trigger DMA request enable */
  3054. /******************** Bit definition for TIM_SR register ********************/
  3055. #define TIM_SR_UIF ((uint32_t)0x0001) /*!<Update interrupt Flag */
  3056. #define TIM_SR_CC1IF ((uint32_t)0x0002) /*!<Capture/Compare 1 interrupt Flag */
  3057. #define TIM_SR_CC2IF ((uint32_t)0x0004) /*!<Capture/Compare 2 interrupt Flag */
  3058. #define TIM_SR_CC3IF ((uint32_t)0x0008) /*!<Capture/Compare 3 interrupt Flag */
  3059. #define TIM_SR_CC4IF ((uint32_t)0x0010) /*!<Capture/Compare 4 interrupt Flag */
  3060. #define TIM_SR_COMIF ((uint32_t)0x0020) /*!<COM interrupt Flag */
  3061. #define TIM_SR_TIF ((uint32_t)0x0040) /*!<Trigger interrupt Flag */
  3062. #define TIM_SR_BIF ((uint32_t)0x0080) /*!<Break interrupt Flag */
  3063. #define TIM_SR_CC1OF ((uint32_t)0x0200) /*!<Capture/Compare 1 Overcapture Flag */
  3064. #define TIM_SR_CC2OF ((uint32_t)0x0400) /*!<Capture/Compare 2 Overcapture Flag */
  3065. #define TIM_SR_CC3OF ((uint32_t)0x0800) /*!<Capture/Compare 3 Overcapture Flag */
  3066. #define TIM_SR_CC4OF ((uint32_t)0x1000) /*!<Capture/Compare 4 Overcapture Flag */
  3067. /******************* Bit definition for TIM_EGR register ********************/
  3068. #define TIM_EGR_UG ((uint32_t)0x01) /*!<Update Generation */
  3069. #define TIM_EGR_CC1G ((uint32_t)0x02) /*!<Capture/Compare 1 Generation */
  3070. #define TIM_EGR_CC2G ((uint32_t)0x04) /*!<Capture/Compare 2 Generation */
  3071. #define TIM_EGR_CC3G ((uint32_t)0x08) /*!<Capture/Compare 3 Generation */
  3072. #define TIM_EGR_CC4G ((uint32_t)0x10) /*!<Capture/Compare 4 Generation */
  3073. #define TIM_EGR_COMG ((uint32_t)0x20) /*!<Capture/Compare Control Update Generation */
  3074. #define TIM_EGR_TG ((uint32_t)0x40) /*!<Trigger Generation */
  3075. #define TIM_EGR_BG ((uint32_t)0x80) /*!<Break Generation */
  3076. /****************** Bit definition for TIM_CCMR1 register *******************/
  3077. #define TIM_CCMR1_CC1S ((uint32_t)0x0003) /*!<CC1S[1:0] bits (Capture/Compare 1 Selection) */
  3078. #define TIM_CCMR1_CC1S_0 ((uint32_t)0x0001) /*!<Bit 0 */
  3079. #define TIM_CCMR1_CC1S_1 ((uint32_t)0x0002) /*!<Bit 1 */
  3080. #define TIM_CCMR1_OC1FE ((uint32_t)0x0004) /*!<Output Compare 1 Fast enable */
  3081. #define TIM_CCMR1_OC1PE ((uint32_t)0x0008) /*!<Output Compare 1 Preload enable */
  3082. #define TIM_CCMR1_OC1M ((uint32_t)0x0070) /*!<OC1M[2:0] bits (Output Compare 1 Mode) */
  3083. #define TIM_CCMR1_OC1M_0 ((uint32_t)0x0010) /*!<Bit 0 */
  3084. #define TIM_CCMR1_OC1M_1 ((uint32_t)0x0020) /*!<Bit 1 */
  3085. #define TIM_CCMR1_OC1M_2 ((uint32_t)0x0040) /*!<Bit 2 */
  3086. #define TIM_CCMR1_OC1CE ((uint32_t)0x0080) /*!<Output Compare 1Clear Enable */
  3087. #define TIM_CCMR1_CC2S ((uint32_t)0x0300) /*!<CC2S[1:0] bits (Capture/Compare 2 Selection) */
  3088. #define TIM_CCMR1_CC2S_0 ((uint32_t)0x0100) /*!<Bit 0 */
  3089. #define TIM_CCMR1_CC2S_1 ((uint32_t)0x0200) /*!<Bit 1 */
  3090. #define TIM_CCMR1_OC2FE ((uint32_t)0x0400) /*!<Output Compare 2 Fast enable */
  3091. #define TIM_CCMR1_OC2PE ((uint32_t)0x0800) /*!<Output Compare 2 Preload enable */
  3092. #define TIM_CCMR1_OC2M ((uint32_t)0x7000) /*!<OC2M[2:0] bits (Output Compare 2 Mode) */
  3093. #define TIM_CCMR1_OC2M_0 ((uint32_t)0x1000) /*!<Bit 0 */
  3094. #define TIM_CCMR1_OC2M_1 ((uint32_t)0x2000) /*!<Bit 1 */
  3095. #define TIM_CCMR1_OC2M_2 ((uint32_t)0x4000) /*!<Bit 2 */
  3096. #define TIM_CCMR1_OC2CE ((uint32_t)0x8000) /*!<Output Compare 2 Clear Enable */
  3097. /*----------------------------------------------------------------------------*/
  3098. #define TIM_CCMR1_IC1PSC ((uint32_t)0x000C) /*!<IC1PSC[1:0] bits (Input Capture 1 Prescaler) */
  3099. #define TIM_CCMR1_IC1PSC_0 ((uint32_t)0x0004) /*!<Bit 0 */
  3100. #define TIM_CCMR1_IC1PSC_1 ((uint32_t)0x0008) /*!<Bit 1 */
  3101. #define TIM_CCMR1_IC1F ((uint32_t)0x00F0) /*!<IC1F[3:0] bits (Input Capture 1 Filter) */
  3102. #define TIM_CCMR1_IC1F_0 ((uint32_t)0x0010) /*!<Bit 0 */
  3103. #define TIM_CCMR1_IC1F_1 ((uint32_t)0x0020) /*!<Bit 1 */
  3104. #define TIM_CCMR1_IC1F_2 ((uint32_t)0x0040) /*!<Bit 2 */
  3105. #define TIM_CCMR1_IC1F_3 ((uint32_t)0x0080) /*!<Bit 3 */
  3106. #define TIM_CCMR1_IC2PSC ((uint32_t)0x0C00) /*!<IC2PSC[1:0] bits (Input Capture 2 Prescaler) */
  3107. #define TIM_CCMR1_IC2PSC_0 ((uint32_t)0x0400) /*!<Bit 0 */
  3108. #define TIM_CCMR1_IC2PSC_1 ((uint32_t)0x0800) /*!<Bit 1 */
  3109. #define TIM_CCMR1_IC2F ((uint32_t)0xF000) /*!<IC2F[3:0] bits (Input Capture 2 Filter) */
  3110. #define TIM_CCMR1_IC2F_0 ((uint32_t)0x1000) /*!<Bit 0 */
  3111. #define TIM_CCMR1_IC2F_1 ((uint32_t)0x2000) /*!<Bit 1 */
  3112. #define TIM_CCMR1_IC2F_2 ((uint32_t)0x4000) /*!<Bit 2 */
  3113. #define TIM_CCMR1_IC2F_3 ((uint32_t)0x8000) /*!<Bit 3 */
  3114. /****************** Bit definition for TIM_CCMR2 register *******************/
  3115. #define TIM_CCMR2_CC3S ((uint32_t)0x0003) /*!<CC3S[1:0] bits (Capture/Compare 3 Selection) */
  3116. #define TIM_CCMR2_CC3S_0 ((uint32_t)0x0001) /*!<Bit 0 */
  3117. #define TIM_CCMR2_CC3S_1 ((uint32_t)0x0002) /*!<Bit 1 */
  3118. #define TIM_CCMR2_OC3FE ((uint32_t)0x0004) /*!<Output Compare 3 Fast enable */
  3119. #define TIM_CCMR2_OC3PE ((uint32_t)0x0008) /*!<Output Compare 3 Preload enable */
  3120. #define TIM_CCMR2_OC3M ((uint32_t)0x0070) /*!<OC3M[2:0] bits (Output Compare 3 Mode) */
  3121. #define TIM_CCMR2_OC3M_0 ((uint32_t)0x0010) /*!<Bit 0 */
  3122. #define TIM_CCMR2_OC3M_1 ((uint32_t)0x0020) /*!<Bit 1 */
  3123. #define TIM_CCMR2_OC3M_2 ((uint32_t)0x0040) /*!<Bit 2 */
  3124. #define TIM_CCMR2_OC3CE ((uint32_t)0x0080) /*!<Output Compare 3 Clear Enable */
  3125. #define TIM_CCMR2_CC4S ((uint32_t)0x0300) /*!<CC4S[1:0] bits (Capture/Compare 4 Selection) */
  3126. #define TIM_CCMR2_CC4S_0 ((uint32_t)0x0100) /*!<Bit 0 */
  3127. #define TIM_CCMR2_CC4S_1 ((uint32_t)0x0200) /*!<Bit 1 */
  3128. #define TIM_CCMR2_OC4FE ((uint32_t)0x0400) /*!<Output Compare 4 Fast enable */
  3129. #define TIM_CCMR2_OC4PE ((uint32_t)0x0800) /*!<Output Compare 4 Preload enable */
  3130. #define TIM_CCMR2_OC4M ((uint32_t)0x7000) /*!<OC4M[2:0] bits (Output Compare 4 Mode) */
  3131. #define TIM_CCMR2_OC4M_0 ((uint32_t)0x1000) /*!<Bit 0 */
  3132. #define TIM_CCMR2_OC4M_1 ((uint32_t)0x2000) /*!<Bit 1 */
  3133. #define TIM_CCMR2_OC4M_2 ((uint32_t)0x4000) /*!<Bit 2 */
  3134. #define TIM_CCMR2_OC4CE ((uint32_t)0x8000) /*!<Output Compare 4 Clear Enable */
  3135. /*----------------------------------------------------------------------------*/
  3136. #define TIM_CCMR2_IC3PSC ((uint32_t)0x000C) /*!<IC3PSC[1:0] bits (Input Capture 3 Prescaler) */
  3137. #define TIM_CCMR2_IC3PSC_0 ((uint32_t)0x0004) /*!<Bit 0 */
  3138. #define TIM_CCMR2_IC3PSC_1 ((uint32_t)0x0008) /*!<Bit 1 */
  3139. #define TIM_CCMR2_IC3F ((uint32_t)0x00F0) /*!<IC3F[3:0] bits (Input Capture 3 Filter) */
  3140. #define TIM_CCMR2_IC3F_0 ((uint32_t)0x0010) /*!<Bit 0 */
  3141. #define TIM_CCMR2_IC3F_1 ((uint32_t)0x0020) /*!<Bit 1 */
  3142. #define TIM_CCMR2_IC3F_2 ((uint32_t)0x0040) /*!<Bit 2 */
  3143. #define TIM_CCMR2_IC3F_3 ((uint32_t)0x0080) /*!<Bit 3 */
  3144. #define TIM_CCMR2_IC4PSC ((uint32_t)0x0C00) /*!<IC4PSC[1:0] bits (Input Capture 4 Prescaler) */
  3145. #define TIM_CCMR2_IC4PSC_0 ((uint32_t)0x0400) /*!<Bit 0 */
  3146. #define TIM_CCMR2_IC4PSC_1 ((uint32_t)0x0800) /*!<Bit 1 */
  3147. #define TIM_CCMR2_IC4F ((uint32_t)0xF000) /*!<IC4F[3:0] bits (Input Capture 4 Filter) */
  3148. #define TIM_CCMR2_IC4F_0 ((uint32_t)0x1000) /*!<Bit 0 */
  3149. #define TIM_CCMR2_IC4F_1 ((uint32_t)0x2000) /*!<Bit 1 */
  3150. #define TIM_CCMR2_IC4F_2 ((uint32_t)0x4000) /*!<Bit 2 */
  3151. #define TIM_CCMR2_IC4F_3 ((uint32_t)0x8000) /*!<Bit 3 */
  3152. /******************* Bit definition for TIM_CCER register *******************/
  3153. #define TIM_CCER_CC1E ((uint32_t)0x0001) /*!<Capture/Compare 1 output enable */
  3154. #define TIM_CCER_CC1P ((uint32_t)0x0002) /*!<Capture/Compare 1 output Polarity */
  3155. #define TIM_CCER_CC1NE ((uint32_t)0x0004) /*!<Capture/Compare 1 Complementary output enable */
  3156. #define TIM_CCER_CC1NP ((uint32_t)0x0008) /*!<Capture/Compare 1 Complementary output Polarity */
  3157. #define TIM_CCER_CC2E ((uint32_t)0x0010) /*!<Capture/Compare 2 output enable */
  3158. #define TIM_CCER_CC2P ((uint32_t)0x0020) /*!<Capture/Compare 2 output Polarity */
  3159. #define TIM_CCER_CC2NE ((uint32_t)0x0040) /*!<Capture/Compare 2 Complementary output enable */
  3160. #define TIM_CCER_CC2NP ((uint32_t)0x0080) /*!<Capture/Compare 2 Complementary output Polarity */
  3161. #define TIM_CCER_CC3E ((uint32_t)0x0100) /*!<Capture/Compare 3 output enable */
  3162. #define TIM_CCER_CC3P ((uint32_t)0x0200) /*!<Capture/Compare 3 output Polarity */
  3163. #define TIM_CCER_CC3NE ((uint32_t)0x0400) /*!<Capture/Compare 3 Complementary output enable */
  3164. #define TIM_CCER_CC3NP ((uint32_t)0x0800) /*!<Capture/Compare 3 Complementary output Polarity */
  3165. #define TIM_CCER_CC4E ((uint32_t)0x1000) /*!<Capture/Compare 4 output enable */
  3166. #define TIM_CCER_CC4P ((uint32_t)0x2000) /*!<Capture/Compare 4 output Polarity */
  3167. #define TIM_CCER_CC4NP ((uint32_t)0x8000) /*!<Capture/Compare 4 Complementary output Polarity */
  3168. /******************* Bit definition for TIM_CNT register ********************/
  3169. #define TIM_CNT_CNT ((uint32_t)0xFFFF) /*!<Counter Value */
  3170. /******************* Bit definition for TIM_PSC register ********************/
  3171. #define TIM_PSC_PSC ((uint32_t)0xFFFF) /*!<Prescaler Value */
  3172. /******************* Bit definition for TIM_ARR register ********************/
  3173. #define TIM_ARR_ARR ((uint32_t)0xFFFF) /*!<actual auto-reload Value */
  3174. /******************* Bit definition for TIM_RCR register ********************/
  3175. #define TIM_RCR_REP ((uint32_t)0xFF) /*!<Repetition Counter Value */
  3176. /******************* Bit definition for TIM_CCR1 register *******************/
  3177. #define TIM_CCR1_CCR1 ((uint32_t)0xFFFF) /*!<Capture/Compare 1 Value */
  3178. /******************* Bit definition for TIM_CCR2 register *******************/
  3179. #define TIM_CCR2_CCR2 ((uint32_t)0xFFFF) /*!<Capture/Compare 2 Value */
  3180. /******************* Bit definition for TIM_CCR3 register *******************/
  3181. #define TIM_CCR3_CCR3 ((uint32_t)0xFFFF) /*!<Capture/Compare 3 Value */
  3182. /******************* Bit definition for TIM_CCR4 register *******************/
  3183. #define TIM_CCR4_CCR4 ((uint32_t)0xFFFF) /*!<Capture/Compare 4 Value */
  3184. /******************* Bit definition for TIM_BDTR register *******************/
  3185. #define TIM_BDTR_DTG ((uint32_t)0x00FF) /*!<DTG[0:7] bits (Dead-Time Generator set-up) */
  3186. #define TIM_BDTR_DTG_0 ((uint32_t)0x0001) /*!<Bit 0 */
  3187. #define TIM_BDTR_DTG_1 ((uint32_t)0x0002) /*!<Bit 1 */
  3188. #define TIM_BDTR_DTG_2 ((uint32_t)0x0004) /*!<Bit 2 */
  3189. #define TIM_BDTR_DTG_3 ((uint32_t)0x0008) /*!<Bit 3 */
  3190. #define TIM_BDTR_DTG_4 ((uint32_t)0x0010) /*!<Bit 4 */
  3191. #define TIM_BDTR_DTG_5 ((uint32_t)0x0020) /*!<Bit 5 */
  3192. #define TIM_BDTR_DTG_6 ((uint32_t)0x0040) /*!<Bit 6 */
  3193. #define TIM_BDTR_DTG_7 ((uint32_t)0x0080) /*!<Bit 7 */
  3194. #define TIM_BDTR_LOCK ((uint32_t)0x0300) /*!<LOCK[1:0] bits (Lock Configuration) */
  3195. #define TIM_BDTR_LOCK_0 ((uint32_t)0x0100) /*!<Bit 0 */
  3196. #define TIM_BDTR_LOCK_1 ((uint32_t)0x0200) /*!<Bit 1 */
  3197. #define TIM_BDTR_OSSI ((uint32_t)0x0400) /*!<Off-State Selection for Idle mode */
  3198. #define TIM_BDTR_OSSR ((uint32_t)0x0800) /*!<Off-State Selection for Run mode */
  3199. #define TIM_BDTR_BKE ((uint32_t)0x1000) /*!<Break enable */
  3200. #define TIM_BDTR_BKP ((uint32_t)0x2000) /*!<Break Polarity */
  3201. #define TIM_BDTR_AOE ((uint32_t)0x4000) /*!<Automatic Output enable */
  3202. #define TIM_BDTR_MOE ((uint32_t)0x8000) /*!<Main Output enable */
  3203. /******************* Bit definition for TIM_DCR register ********************/
  3204. #define TIM_DCR_DBA ((uint32_t)0x001F) /*!<DBA[4:0] bits (DMA Base Address) */
  3205. #define TIM_DCR_DBA_0 ((uint32_t)0x0001) /*!<Bit 0 */
  3206. #define TIM_DCR_DBA_1 ((uint32_t)0x0002) /*!<Bit 1 */
  3207. #define TIM_DCR_DBA_2 ((uint32_t)0x0004) /*!<Bit 2 */
  3208. #define TIM_DCR_DBA_3 ((uint32_t)0x0008) /*!<Bit 3 */
  3209. #define TIM_DCR_DBA_4 ((uint32_t)0x0010) /*!<Bit 4 */
  3210. #define TIM_DCR_DBL ((uint32_t)0x1F00) /*!<DBL[4:0] bits (DMA Burst Length) */
  3211. #define TIM_DCR_DBL_0 ((uint32_t)0x0100) /*!<Bit 0 */
  3212. #define TIM_DCR_DBL_1 ((uint32_t)0x0200) /*!<Bit 1 */
  3213. #define TIM_DCR_DBL_2 ((uint32_t)0x0400) /*!<Bit 2 */
  3214. #define TIM_DCR_DBL_3 ((uint32_t)0x0800) /*!<Bit 3 */
  3215. #define TIM_DCR_DBL_4 ((uint32_t)0x1000) /*!<Bit 4 */
  3216. /******************* Bit definition for TIM_DMAR register *******************/
  3217. #define TIM_DMAR_DMAB ((uint32_t)0xFFFF) /*!<DMA register for burst accesses */
  3218. /******************* Bit definition for TIM_OR register *********************/
  3219. #define TIM_OR_TI4_RMP ((uint32_t)0x00C0) /*!<TI4_RMP[1:0] bits (TIM5 Input 4 remap) */
  3220. #define TIM_OR_TI4_RMP_0 ((uint32_t)0x0040) /*!<Bit 0 */
  3221. #define TIM_OR_TI4_RMP_1 ((uint32_t)0x0080) /*!<Bit 1 */
  3222. #define TIM_OR_ITR1_RMP ((uint32_t)0x0C00) /*!<ITR1_RMP[1:0] bits (TIM2 Internal trigger 1 remap) */
  3223. #define TIM_OR_ITR1_RMP_0 ((uint32_t)0x0400) /*!<Bit 0 */
  3224. #define TIM_OR_ITR1_RMP_1 ((uint32_t)0x0800) /*!<Bit 1 */
  3225. /******************************************************************************/
  3226. /* */
  3227. /* Universal Synchronous Asynchronous Receiver Transmitter */
  3228. /* */
  3229. /******************************************************************************/
  3230. /******************* Bit definition for USART_SR register *******************/
  3231. #define USART_SR_PE ((uint32_t)0x0001) /*!<Parity Error */
  3232. #define USART_SR_FE ((uint32_t)0x0002) /*!<Framing Error */
  3233. #define USART_SR_NE ((uint32_t)0x0004) /*!<Noise Error Flag */
  3234. #define USART_SR_ORE ((uint32_t)0x0008) /*!<OverRun Error */
  3235. #define USART_SR_IDLE ((uint32_t)0x0010) /*!<IDLE line detected */
  3236. #define USART_SR_RXNE ((uint32_t)0x0020) /*!<Read Data Register Not Empty */
  3237. #define USART_SR_TC ((uint32_t)0x0040) /*!<Transmission Complete */
  3238. #define USART_SR_TXE ((uint32_t)0x0080) /*!<Transmit Data Register Empty */
  3239. #define USART_SR_LBD ((uint32_t)0x0100) /*!<LIN Break Detection Flag */
  3240. #define USART_SR_CTS ((uint32_t)0x0200) /*!<CTS Flag */
  3241. /******************* Bit definition for USART_DR register *******************/
  3242. #define USART_DR_DR ((uint32_t)0x01FF) /*!<Data value */
  3243. /****************** Bit definition for USART_BRR register *******************/
  3244. #define USART_BRR_DIV_Fraction ((uint32_t)0x000F) /*!<Fraction of USARTDIV */
  3245. #define USART_BRR_DIV_Mantissa ((uint32_t)0xFFF0) /*!<Mantissa of USARTDIV */
  3246. /****************** Bit definition for USART_CR1 register *******************/
  3247. #define USART_CR1_SBK ((uint32_t)0x0001) /*!<Send Break */
  3248. #define USART_CR1_RWU ((uint32_t)0x0002) /*!<Receiver wakeup */
  3249. #define USART_CR1_RE ((uint32_t)0x0004) /*!<Receiver Enable */
  3250. #define USART_CR1_TE ((uint32_t)0x0008) /*!<Transmitter Enable */
  3251. #define USART_CR1_IDLEIE ((uint32_t)0x0010) /*!<IDLE Interrupt Enable */
  3252. #define USART_CR1_RXNEIE ((uint32_t)0x0020) /*!<RXNE Interrupt Enable */
  3253. #define USART_CR1_TCIE ((uint32_t)0x0040) /*!<Transmission Complete Interrupt Enable */
  3254. #define USART_CR1_TXEIE ((uint32_t)0x0080) /*!<PE Interrupt Enable */
  3255. #define USART_CR1_PEIE ((uint32_t)0x0100) /*!<PE Interrupt Enable */
  3256. #define USART_CR1_PS ((uint32_t)0x0200) /*!<Parity Selection */
  3257. #define USART_CR1_PCE ((uint32_t)0x0400) /*!<Parity Control Enable */
  3258. #define USART_CR1_WAKE ((uint32_t)0x0800) /*!<Wakeup method */
  3259. #define USART_CR1_M ((uint32_t)0x1000) /*!<Word length */
  3260. #define USART_CR1_UE ((uint32_t)0x2000) /*!<USART Enable */
  3261. #define USART_CR1_OVER8 ((uint32_t)0x8000) /*!<USART Oversampling by 8 enable */
  3262. /****************** Bit definition for USART_CR2 register *******************/
  3263. #define USART_CR2_ADD ((uint32_t)0x000F) /*!<Address of the USART node */
  3264. #define USART_CR2_LBDL ((uint32_t)0x0020) /*!<LIN Break Detection Length */
  3265. #define USART_CR2_LBDIE ((uint32_t)0x0040) /*!<LIN Break Detection Interrupt Enable */
  3266. #define USART_CR2_LBCL ((uint32_t)0x0100) /*!<Last Bit Clock pulse */
  3267. #define USART_CR2_CPHA ((uint32_t)0x0200) /*!<Clock Phase */
  3268. #define USART_CR2_CPOL ((uint32_t)0x0400) /*!<Clock Polarity */
  3269. #define USART_CR2_CLKEN ((uint32_t)0x0800) /*!<Clock Enable */
  3270. #define USART_CR2_STOP ((uint32_t)0x3000) /*!<STOP[1:0] bits (STOP bits) */
  3271. #define USART_CR2_STOP_0 ((uint32_t)0x1000) /*!<Bit 0 */
  3272. #define USART_CR2_STOP_1 ((uint32_t)0x2000) /*!<Bit 1 */
  3273. #define USART_CR2_LINEN ((uint32_t)0x4000) /*!<LIN mode enable */
  3274. /****************** Bit definition for USART_CR3 register *******************/
  3275. #define USART_CR3_EIE ((uint32_t)0x0001) /*!<Error Interrupt Enable */
  3276. #define USART_CR3_IREN ((uint32_t)0x0002) /*!<IrDA mode Enable */
  3277. #define USART_CR3_IRLP ((uint32_t)0x0004) /*!<IrDA Low-Power */
  3278. #define USART_CR3_HDSEL ((uint32_t)0x0008) /*!<Half-Duplex Selection */
  3279. #define USART_CR3_NACK ((uint32_t)0x0010) /*!<Smartcard NACK enable */
  3280. #define USART_CR3_SCEN ((uint32_t)0x0020) /*!<Smartcard mode enable */
  3281. #define USART_CR3_DMAR ((uint32_t)0x0040) /*!<DMA Enable Receiver */
  3282. #define USART_CR3_DMAT ((uint32_t)0x0080) /*!<DMA Enable Transmitter */
  3283. #define USART_CR3_RTSE ((uint32_t)0x0100) /*!<RTS Enable */
  3284. #define USART_CR3_CTSE ((uint32_t)0x0200) /*!<CTS Enable */
  3285. #define USART_CR3_CTSIE ((uint32_t)0x0400) /*!<CTS Interrupt Enable */
  3286. #define USART_CR3_ONEBIT ((uint32_t)0x0800) /*!<USART One bit method enable */
  3287. /****************** Bit definition for USART_GTPR register ******************/
  3288. #define USART_GTPR_PSC ((uint32_t)0x00FF) /*!<PSC[7:0] bits (Prescaler value) */
  3289. #define USART_GTPR_PSC_0 ((uint32_t)0x0001) /*!<Bit 0 */
  3290. #define USART_GTPR_PSC_1 ((uint32_t)0x0002) /*!<Bit 1 */
  3291. #define USART_GTPR_PSC_2 ((uint32_t)0x0004) /*!<Bit 2 */
  3292. #define USART_GTPR_PSC_3 ((uint32_t)0x0008) /*!<Bit 3 */
  3293. #define USART_GTPR_PSC_4 ((uint32_t)0x0010) /*!<Bit 4 */
  3294. #define USART_GTPR_PSC_5 ((uint32_t)0x0020) /*!<Bit 5 */
  3295. #define USART_GTPR_PSC_6 ((uint32_t)0x0040) /*!<Bit 6 */
  3296. #define USART_GTPR_PSC_7 ((uint32_t)0x0080) /*!<Bit 7 */
  3297. #define USART_GTPR_GT ((uint32_t)0xFF00) /*!<Guard time value */
  3298. /******************************************************************************/
  3299. /* */
  3300. /* Window WATCHDOG */
  3301. /* */
  3302. /******************************************************************************/
  3303. /******************* Bit definition for WWDG_CR register ********************/
  3304. #define WWDG_CR_T ((uint32_t)0x7F) /*!<T[6:0] bits (7-Bit counter (MSB to LSB)) */
  3305. #define WWDG_CR_T0 ((uint32_t)0x01) /*!<Bit 0 */
  3306. #define WWDG_CR_T1 ((uint32_t)0x02) /*!<Bit 1 */
  3307. #define WWDG_CR_T2 ((uint32_t)0x04) /*!<Bit 2 */
  3308. #define WWDG_CR_T3 ((uint32_t)0x08) /*!<Bit 3 */
  3309. #define WWDG_CR_T4 ((uint32_t)0x10) /*!<Bit 4 */
  3310. #define WWDG_CR_T5 ((uint32_t)0x20) /*!<Bit 5 */
  3311. #define WWDG_CR_T6 ((uint32_t)0x40) /*!<Bit 6 */
  3312. #define WWDG_CR_WDGA ((uint32_t)0x80) /*!<Activation bit */
  3313. /******************* Bit definition for WWDG_CFR register *******************/
  3314. #define WWDG_CFR_W ((uint32_t)0x007F) /*!<W[6:0] bits (7-bit window value) */
  3315. #define WWDG_CFR_W0 ((uint32_t)0x0001) /*!<Bit 0 */
  3316. #define WWDG_CFR_W1 ((uint32_t)0x0002) /*!<Bit 1 */
  3317. #define WWDG_CFR_W2 ((uint32_t)0x0004) /*!<Bit 2 */
  3318. #define WWDG_CFR_W3 ((uint32_t)0x0008) /*!<Bit 3 */
  3319. #define WWDG_CFR_W4 ((uint32_t)0x0010) /*!<Bit 4 */
  3320. #define WWDG_CFR_W5 ((uint32_t)0x0020) /*!<Bit 5 */
  3321. #define WWDG_CFR_W6 ((uint32_t)0x0040) /*!<Bit 6 */
  3322. #define WWDG_CFR_WDGTB ((uint32_t)0x0180) /*!<WDGTB[1:0] bits (Timer Base) */
  3323. #define WWDG_CFR_WDGTB0 ((uint32_t)0x0080) /*!<Bit 0 */
  3324. #define WWDG_CFR_WDGTB1 ((uint32_t)0x0100) /*!<Bit 1 */
  3325. #define WWDG_CFR_EWI ((uint32_t)0x0200) /*!<Early Wakeup Interrupt */
  3326. /******************* Bit definition for WWDG_SR register ********************/
  3327. #define WWDG_SR_EWIF ((uint32_t)0x01) /*!<Early Wakeup Interrupt Flag */
  3328. /******************************************************************************/
  3329. /* */
  3330. /* DBG */
  3331. /* */
  3332. /******************************************************************************/
  3333. /******************** Bit definition for DBGMCU_IDCODE register *************/
  3334. #define DBGMCU_IDCODE_DEV_ID ((uint32_t)0x00000FFF)
  3335. #define DBGMCU_IDCODE_REV_ID ((uint32_t)0xFFFF0000)
  3336. /******************** Bit definition for DBGMCU_CR register *****************/
  3337. #define DBGMCU_CR_DBG_SLEEP ((uint32_t)0x00000001)
  3338. #define DBGMCU_CR_DBG_STOP ((uint32_t)0x00000002)
  3339. #define DBGMCU_CR_DBG_STANDBY ((uint32_t)0x00000004)
  3340. #define DBGMCU_CR_TRACE_IOEN ((uint32_t)0x00000020)
  3341. #define DBGMCU_CR_TRACE_MODE ((uint32_t)0x000000C0)
  3342. #define DBGMCU_CR_TRACE_MODE_0 ((uint32_t)0x00000040)/*!<Bit 0 */
  3343. #define DBGMCU_CR_TRACE_MODE_1 ((uint32_t)0x00000080)/*!<Bit 1 */
  3344. /******************** Bit definition for DBGMCU_APB1_FZ register ************/
  3345. #define DBGMCU_APB1_FZ_DBG_TIM2_STOP ((uint32_t)0x00000001)
  3346. #define DBGMCU_APB1_FZ_DBG_TIM3_STOP ((uint32_t)0x00000002)
  3347. #define DBGMCU_APB1_FZ_DBG_TIM4_STOP ((uint32_t)0x00000004)
  3348. #define DBGMCU_APB1_FZ_DBG_TIM5_STOP ((uint32_t)0x00000008)
  3349. #define DBGMCU_APB1_FZ_DBG_TIM6_STOP ((uint32_t)0x00000010)
  3350. #define DBGMCU_APB1_FZ_DBG_TIM7_STOP ((uint32_t)0x00000020)
  3351. #define DBGMCU_APB1_FZ_DBG_TIM12_STOP ((uint32_t)0x00000040)
  3352. #define DBGMCU_APB1_FZ_DBG_TIM13_STOP ((uint32_t)0x00000080)
  3353. #define DBGMCU_APB1_FZ_DBG_TIM14_STOP ((uint32_t)0x00000100)
  3354. #define DBGMCU_APB1_FZ_DBG_RTC_STOP ((uint32_t)0x00000400)
  3355. #define DBGMCU_APB1_FZ_DBG_WWDG_STOP ((uint32_t)0x00000800)
  3356. #define DBGMCU_APB1_FZ_DBG_IWDG_STOP ((uint32_t)0x00001000)
  3357. #define DBGMCU_APB1_FZ_DBG_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00200000)
  3358. #define DBGMCU_APB1_FZ_DBG_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00400000)
  3359. #define DBGMCU_APB1_FZ_DBG_I2C3_SMBUS_TIMEOUT ((uint32_t)0x00800000)
  3360. #define DBGMCU_APB1_FZ_DBG_CAN1_STOP ((uint32_t)0x02000000)
  3361. #define DBGMCU_APB1_FZ_DBG_CAN2_STOP ((uint32_t)0x04000000)
  3362. /* Old IWDGSTOP bit definition, maintained for legacy purpose */
  3363. #define DBGMCU_APB1_FZ_DBG_IWDEG_STOP DBGMCU_APB1_FZ_DBG_IWDG_STOP
  3364. /******************** Bit definition for DBGMCU_APB2_FZ register ************/
  3365. #define DBGMCU_APB2_FZ_DBG_TIM1_STOP ((uint32_t)0x00000001)
  3366. #define DBGMCU_APB2_FZ_DBG_TIM8_STOP ((uint32_t)0x00000002)
  3367. #define DBGMCU_APB2_FZ_DBG_TIM9_STOP ((uint32_t)0x00010000)
  3368. #define DBGMCU_APB2_FZ_DBG_TIM10_STOP ((uint32_t)0x00020000)
  3369. #define DBGMCU_APB2_FZ_DBG_TIM11_STOP ((uint32_t)0x00040000)
  3370. /******************************************************************************/
  3371. /* */
  3372. /* USB_OTG */
  3373. /* */
  3374. /******************************************************************************/
  3375. /******************** Bit definition forUSB_OTG_GOTGCTL register ********************/
  3376. #define USB_OTG_GOTGCTL_SRQSCS ((uint32_t)0x00000001) /*!< Session request success */
  3377. #define USB_OTG_GOTGCTL_SRQ ((uint32_t)0x00000002) /*!< Session request */
  3378. #define USB_OTG_GOTGCTL_HNGSCS ((uint32_t)0x00000100) /*!< Host negotiation success */
  3379. #define USB_OTG_GOTGCTL_HNPRQ ((uint32_t)0x00000200) /*!< HNP request */
  3380. #define USB_OTG_GOTGCTL_HSHNPEN ((uint32_t)0x00000400) /*!< Host set HNP enable */
  3381. #define USB_OTG_GOTGCTL_DHNPEN ((uint32_t)0x00000800) /*!< Device HNP enabled */
  3382. #define USB_OTG_GOTGCTL_CIDSTS ((uint32_t)0x00010000) /*!< Connector ID status */
  3383. #define USB_OTG_GOTGCTL_DBCT ((uint32_t)0x00020000) /*!< Long/short debounce time */
  3384. #define USB_OTG_GOTGCTL_ASVLD ((uint32_t)0x00040000) /*!< A-session valid */
  3385. #define USB_OTG_GOTGCTL_BSVLD ((uint32_t)0x00080000) /*!< B-session valid */
  3386. /******************** Bit definition forUSB_OTG_HCFG register ********************/
  3387. #define USB_OTG_HCFG_FSLSPCS ((uint32_t)0x00000003) /*!< FS/LS PHY clock select */
  3388. #define USB_OTG_HCFG_FSLSPCS_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  3389. #define USB_OTG_HCFG_FSLSPCS_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  3390. #define USB_OTG_HCFG_FSLSS ((uint32_t)0x00000004) /*!< FS- and LS-only support */
  3391. /******************** Bit definition forUSB_OTG_DCFG register ********************/
  3392. #define USB_OTG_DCFG_DSPD ((uint32_t)0x00000003) /*!< Device speed */
  3393. #define USB_OTG_DCFG_DSPD_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  3394. #define USB_OTG_DCFG_DSPD_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  3395. #define USB_OTG_DCFG_NZLSOHSK ((uint32_t)0x00000004) /*!< Nonzero-length status OUT handshake */
  3396. #define USB_OTG_DCFG_DAD ((uint32_t)0x000007F0) /*!< Device address */
  3397. #define USB_OTG_DCFG_DAD_0 ((uint32_t)0x00000010) /*!<Bit 0 */
  3398. #define USB_OTG_DCFG_DAD_1 ((uint32_t)0x00000020) /*!<Bit 1 */
  3399. #define USB_OTG_DCFG_DAD_2 ((uint32_t)0x00000040) /*!<Bit 2 */
  3400. #define USB_OTG_DCFG_DAD_3 ((uint32_t)0x00000080) /*!<Bit 3 */
  3401. #define USB_OTG_DCFG_DAD_4 ((uint32_t)0x00000100) /*!<Bit 4 */
  3402. #define USB_OTG_DCFG_DAD_5 ((uint32_t)0x00000200) /*!<Bit 5 */
  3403. #define USB_OTG_DCFG_DAD_6 ((uint32_t)0x00000400) /*!<Bit 6 */
  3404. #define USB_OTG_DCFG_PFIVL ((uint32_t)0x00001800) /*!< Periodic (micro)frame interval */
  3405. #define USB_OTG_DCFG_PFIVL_0 ((uint32_t)0x00000800) /*!<Bit 0 */
  3406. #define USB_OTG_DCFG_PFIVL_1 ((uint32_t)0x00001000) /*!<Bit 1 */
  3407. #define USB_OTG_DCFG_PERSCHIVL ((uint32_t)0x03000000) /*!< Periodic scheduling interval */
  3408. #define USB_OTG_DCFG_PERSCHIVL_0 ((uint32_t)0x01000000) /*!<Bit 0 */
  3409. #define USB_OTG_DCFG_PERSCHIVL_1 ((uint32_t)0x02000000) /*!<Bit 1 */
  3410. /******************** Bit definition forUSB_OTG_PCGCR register ********************/
  3411. #define USB_OTG_PCGCR_STPPCLK ((uint32_t)0x00000001) /*!< Stop PHY clock */
  3412. #define USB_OTG_PCGCR_GATEHCLK ((uint32_t)0x00000002) /*!< Gate HCLK */
  3413. #define USB_OTG_PCGCR_PHYSUSP ((uint32_t)0x00000010) /*!< PHY suspended */
  3414. /******************** Bit definition forUSB_OTG_GOTGINT register ********************/
  3415. #define USB_OTG_GOTGINT_SEDET ((uint32_t)0x00000004) /*!< Session end detected */
  3416. #define USB_OTG_GOTGINT_SRSSCHG ((uint32_t)0x00000100) /*!< Session request success status change */
  3417. #define USB_OTG_GOTGINT_HNSSCHG ((uint32_t)0x00000200) /*!< Host negotiation success status change */
  3418. #define USB_OTG_GOTGINT_HNGDET ((uint32_t)0x00020000) /*!< Host negotiation detected */
  3419. #define USB_OTG_GOTGINT_ADTOCHG ((uint32_t)0x00040000) /*!< A-device timeout change */
  3420. #define USB_OTG_GOTGINT_DBCDNE ((uint32_t)0x00080000) /*!< Debounce done */
  3421. /******************** Bit definition forUSB_OTG_DCTL register ********************/
  3422. #define USB_OTG_DCTL_RWUSIG ((uint32_t)0x00000001) /*!< Remote wakeup signaling */
  3423. #define USB_OTG_DCTL_SDIS ((uint32_t)0x00000002) /*!< Soft disconnect */
  3424. #define USB_OTG_DCTL_GINSTS ((uint32_t)0x00000004) /*!< Global IN NAK status */
  3425. #define USB_OTG_DCTL_GONSTS ((uint32_t)0x00000008) /*!< Global OUT NAK status */
  3426. #define USB_OTG_DCTL_TCTL ((uint32_t)0x00000070) /*!< Test control */
  3427. #define USB_OTG_DCTL_TCTL_0 ((uint32_t)0x00000010) /*!<Bit 0 */
  3428. #define USB_OTG_DCTL_TCTL_1 ((uint32_t)0x00000020) /*!<Bit 1 */
  3429. #define USB_OTG_DCTL_TCTL_2 ((uint32_t)0x00000040) /*!<Bit 2 */
  3430. #define USB_OTG_DCTL_SGINAK ((uint32_t)0x00000080) /*!< Set global IN NAK */
  3431. #define USB_OTG_DCTL_CGINAK ((uint32_t)0x00000100) /*!< Clear global IN NAK */
  3432. #define USB_OTG_DCTL_SGONAK ((uint32_t)0x00000200) /*!< Set global OUT NAK */
  3433. #define USB_OTG_DCTL_CGONAK ((uint32_t)0x00000400) /*!< Clear global OUT NAK */
  3434. #define USB_OTG_DCTL_POPRGDNE ((uint32_t)0x00000800) /*!< Power-on programming done */
  3435. /******************** Bit definition forUSB_OTG_HFIR register ********************/
  3436. #define USB_OTG_HFIR_FRIVL ((uint32_t)0x0000FFFF) /*!< Frame interval */
  3437. /******************** Bit definition forUSB_OTG_HFNUM register ********************/
  3438. #define USB_OTG_HFNUM_FRNUM ((uint32_t)0x0000FFFF) /*!< Frame number */
  3439. #define USB_OTG_HFNUM_FTREM ((uint32_t)0xFFFF0000) /*!< Frame time remaining */
  3440. /******************** Bit definition forUSB_OTG_DSTS register ********************/
  3441. #define USB_OTG_DSTS_SUSPSTS ((uint32_t)0x00000001) /*!< Suspend status */
  3442. #define USB_OTG_DSTS_ENUMSPD ((uint32_t)0x00000006) /*!< Enumerated speed */
  3443. #define USB_OTG_DSTS_ENUMSPD_0 ((uint32_t)0x00000002) /*!<Bit 0 */
  3444. #define USB_OTG_DSTS_ENUMSPD_1 ((uint32_t)0x00000004) /*!<Bit 1 */
  3445. #define USB_OTG_DSTS_EERR ((uint32_t)0x00000008) /*!< Erratic error */
  3446. #define USB_OTG_DSTS_FNSOF ((uint32_t)0x003FFF00) /*!< Frame number of the received SOF */
  3447. /******************** Bit definition forUSB_OTG_GAHBCFG register ********************/
  3448. #define USB_OTG_GAHBCFG_GINT ((uint32_t)0x00000001) /*!< Global interrupt mask */
  3449. #define USB_OTG_GAHBCFG_HBSTLEN ((uint32_t)0x0000001E) /*!< Burst length/type */
  3450. #define USB_OTG_GAHBCFG_HBSTLEN_0 ((uint32_t)0x00000002) /*!<Bit 0 */
  3451. #define USB_OTG_GAHBCFG_HBSTLEN_1 ((uint32_t)0x00000004) /*!<Bit 1 */
  3452. #define USB_OTG_GAHBCFG_HBSTLEN_2 ((uint32_t)0x00000008) /*!<Bit 2 */
  3453. #define USB_OTG_GAHBCFG_HBSTLEN_3 ((uint32_t)0x00000010) /*!<Bit 3 */
  3454. #define USB_OTG_GAHBCFG_DMAEN ((uint32_t)0x00000020) /*!< DMA enable */
  3455. #define USB_OTG_GAHBCFG_TXFELVL ((uint32_t)0x00000080) /*!< TxFIFO empty level */
  3456. #define USB_OTG_GAHBCFG_PTXFELVL ((uint32_t)0x00000100) /*!< Periodic TxFIFO empty level */
  3457. /******************** Bit definition forUSB_OTG_GUSBCFG register ********************/
  3458. #define USB_OTG_GUSBCFG_TOCAL ((uint32_t)0x00000007) /*!< FS timeout calibration */
  3459. #define USB_OTG_GUSBCFG_TOCAL_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  3460. #define USB_OTG_GUSBCFG_TOCAL_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  3461. #define USB_OTG_GUSBCFG_TOCAL_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  3462. #define USB_OTG_GUSBCFG_PHYSEL ((uint32_t)0x00000040) /*!< USB 2.0 high-speed ULPI PHY or USB 1.1 full-speed serial transceiver select */
  3463. #define USB_OTG_GUSBCFG_SRPCAP ((uint32_t)0x00000100) /*!< SRP-capable */
  3464. #define USB_OTG_GUSBCFG_HNPCAP ((uint32_t)0x00000200) /*!< HNP-capable */
  3465. #define USB_OTG_GUSBCFG_TRDT ((uint32_t)0x00003C00) /*!< USB turnaround time */
  3466. #define USB_OTG_GUSBCFG_TRDT_0 ((uint32_t)0x00000400) /*!<Bit 0 */
  3467. #define USB_OTG_GUSBCFG_TRDT_1 ((uint32_t)0x00000800) /*!<Bit 1 */
  3468. #define USB_OTG_GUSBCFG_TRDT_2 ((uint32_t)0x00001000) /*!<Bit 2 */
  3469. #define USB_OTG_GUSBCFG_TRDT_3 ((uint32_t)0x00002000) /*!<Bit 3 */
  3470. #define USB_OTG_GUSBCFG_PHYLPCS ((uint32_t)0x00008000) /*!< PHY Low-power clock select */
  3471. #define USB_OTG_GUSBCFG_ULPIFSLS ((uint32_t)0x00020000) /*!< ULPI FS/LS select */
  3472. #define USB_OTG_GUSBCFG_ULPIAR ((uint32_t)0x00040000) /*!< ULPI Auto-resume */
  3473. #define USB_OTG_GUSBCFG_ULPICSM ((uint32_t)0x00080000) /*!< ULPI Clock SuspendM */
  3474. #define USB_OTG_GUSBCFG_ULPIEVBUSD ((uint32_t)0x00100000) /*!< ULPI External VBUS Drive */
  3475. #define USB_OTG_GUSBCFG_ULPIEVBUSI ((uint32_t)0x00200000) /*!< ULPI external VBUS indicator */
  3476. #define USB_OTG_GUSBCFG_TSDPS ((uint32_t)0x00400000) /*!< TermSel DLine pulsing selection */
  3477. #define USB_OTG_GUSBCFG_PCCI ((uint32_t)0x00800000) /*!< Indicator complement */
  3478. #define USB_OTG_GUSBCFG_PTCI ((uint32_t)0x01000000) /*!< Indicator pass through */
  3479. #define USB_OTG_GUSBCFG_ULPIIPD ((uint32_t)0x02000000) /*!< ULPI interface protect disable */
  3480. #define USB_OTG_GUSBCFG_FHMOD ((uint32_t)0x20000000) /*!< Forced host mode */
  3481. #define USB_OTG_GUSBCFG_FDMOD ((uint32_t)0x40000000) /*!< Forced peripheral mode */
  3482. #define USB_OTG_GUSBCFG_CTXPKT ((uint32_t)0x80000000) /*!< Corrupt Tx packet */
  3483. /******************** Bit definition forUSB_OTG_GRSTCTL register ********************/
  3484. #define USB_OTG_GRSTCTL_CSRST ((uint32_t)0x00000001) /*!< Core soft reset */
  3485. #define USB_OTG_GRSTCTL_HSRST ((uint32_t)0x00000002) /*!< HCLK soft reset */
  3486. #define USB_OTG_GRSTCTL_FCRST ((uint32_t)0x00000004) /*!< Host frame counter reset */
  3487. #define USB_OTG_GRSTCTL_RXFFLSH ((uint32_t)0x00000010) /*!< RxFIFO flush */
  3488. #define USB_OTG_GRSTCTL_TXFFLSH ((uint32_t)0x00000020) /*!< TxFIFO flush */
  3489. #define USB_OTG_GRSTCTL_TXFNUM ((uint32_t)0x000007C0) /*!< TxFIFO number */
  3490. #define USB_OTG_GRSTCTL_TXFNUM_0 ((uint32_t)0x00000040) /*!<Bit 0 */
  3491. #define USB_OTG_GRSTCTL_TXFNUM_1 ((uint32_t)0x00000080) /*!<Bit 1 */
  3492. #define USB_OTG_GRSTCTL_TXFNUM_2 ((uint32_t)0x00000100) /*!<Bit 2 */
  3493. #define USB_OTG_GRSTCTL_TXFNUM_3 ((uint32_t)0x00000200) /*!<Bit 3 */
  3494. #define USB_OTG_GRSTCTL_TXFNUM_4 ((uint32_t)0x00000400) /*!<Bit 4 */
  3495. #define USB_OTG_GRSTCTL_DMAREQ ((uint32_t)0x40000000) /*!< DMA request signal */
  3496. #define USB_OTG_GRSTCTL_AHBIDL ((uint32_t)0x80000000) /*!< AHB master idle */
  3497. /******************** Bit definition forUSB_OTG_DIEPMSK register ********************/
  3498. #define USB_OTG_DIEPMSK_XFRCM ((uint32_t)0x00000001) /*!< Transfer completed interrupt mask */
  3499. #define USB_OTG_DIEPMSK_EPDM ((uint32_t)0x00000002) /*!< Endpoint disabled interrupt mask */
  3500. #define USB_OTG_DIEPMSK_TOM ((uint32_t)0x00000008) /*!< Timeout condition mask (nonisochronous endpoints) */
  3501. #define USB_OTG_DIEPMSK_ITTXFEMSK ((uint32_t)0x00000010) /*!< IN token received when TxFIFO empty mask */
  3502. #define USB_OTG_DIEPMSK_INEPNMM ((uint32_t)0x00000020) /*!< IN token received with EP mismatch mask */
  3503. #define USB_OTG_DIEPMSK_INEPNEM ((uint32_t)0x00000040) /*!< IN endpoint NAK effective mask */
  3504. #define USB_OTG_DIEPMSK_TXFURM ((uint32_t)0x00000100) /*!< FIFO underrun mask */
  3505. #define USB_OTG_DIEPMSK_BIM ((uint32_t)0x00000200) /*!< BNA interrupt mask */
  3506. /******************** Bit definition forUSB_OTG_HPTXSTS register ********************/
  3507. #define USB_OTG_HPTXSTS_PTXFSAVL ((uint32_t)0x0000FFFF) /*!< Periodic transmit data FIFO space available */
  3508. #define USB_OTG_HPTXSTS_PTXQSAV ((uint32_t)0x00FF0000) /*!< Periodic transmit request queue space available */
  3509. #define USB_OTG_HPTXSTS_PTXQSAV_0 ((uint32_t)0x00010000) /*!<Bit 0 */
  3510. #define USB_OTG_HPTXSTS_PTXQSAV_1 ((uint32_t)0x00020000) /*!<Bit 1 */
  3511. #define USB_OTG_HPTXSTS_PTXQSAV_2 ((uint32_t)0x00040000) /*!<Bit 2 */
  3512. #define USB_OTG_HPTXSTS_PTXQSAV_3 ((uint32_t)0x00080000) /*!<Bit 3 */
  3513. #define USB_OTG_HPTXSTS_PTXQSAV_4 ((uint32_t)0x00100000) /*!<Bit 4 */
  3514. #define USB_OTG_HPTXSTS_PTXQSAV_5 ((uint32_t)0x00200000) /*!<Bit 5 */
  3515. #define USB_OTG_HPTXSTS_PTXQSAV_6 ((uint32_t)0x00400000) /*!<Bit 6 */
  3516. #define USB_OTG_HPTXSTS_PTXQSAV_7 ((uint32_t)0x00800000) /*!<Bit 7 */
  3517. #define USB_OTG_HPTXSTS_PTXQTOP ((uint32_t)0xFF000000) /*!< Top of the periodic transmit request queue */
  3518. #define USB_OTG_HPTXSTS_PTXQTOP_0 ((uint32_t)0x01000000) /*!<Bit 0 */
  3519. #define USB_OTG_HPTXSTS_PTXQTOP_1 ((uint32_t)0x02000000) /*!<Bit 1 */
  3520. #define USB_OTG_HPTXSTS_PTXQTOP_2 ((uint32_t)0x04000000) /*!<Bit 2 */
  3521. #define USB_OTG_HPTXSTS_PTXQTOP_3 ((uint32_t)0x08000000) /*!<Bit 3 */
  3522. #define USB_OTG_HPTXSTS_PTXQTOP_4 ((uint32_t)0x10000000) /*!<Bit 4 */
  3523. #define USB_OTG_HPTXSTS_PTXQTOP_5 ((uint32_t)0x20000000) /*!<Bit 5 */
  3524. #define USB_OTG_HPTXSTS_PTXQTOP_6 ((uint32_t)0x40000000) /*!<Bit 6 */
  3525. #define USB_OTG_HPTXSTS_PTXQTOP_7 ((uint32_t)0x80000000) /*!<Bit 7 */
  3526. /******************** Bit definition forUSB_OTG_HAINT register ********************/
  3527. #define USB_OTG_HAINT_HAINT ((uint32_t)0x0000FFFF) /*!< Channel interrupts */
  3528. /******************** Bit definition forUSB_OTG_DOEPMSK register ********************/
  3529. #define USB_OTG_DOEPMSK_XFRCM ((uint32_t)0x00000001) /*!< Transfer completed interrupt mask */
  3530. #define USB_OTG_DOEPMSK_EPDM ((uint32_t)0x00000002) /*!< Endpoint disabled interrupt mask */
  3531. #define USB_OTG_DOEPMSK_STUPM ((uint32_t)0x00000008) /*!< SETUP phase done mask */
  3532. #define USB_OTG_DOEPMSK_OTEPDM ((uint32_t)0x00000010) /*!< OUT token received when endpoint disabled mask */
  3533. #define USB_OTG_DOEPMSK_B2BSTUP ((uint32_t)0x00000040) /*!< Back-to-back SETUP packets received mask */
  3534. #define USB_OTG_DOEPMSK_OPEM ((uint32_t)0x00000100) /*!< OUT packet error mask */
  3535. #define USB_OTG_DOEPMSK_BOIM ((uint32_t)0x00000200) /*!< BNA interrupt mask */
  3536. /******************** Bit definition forUSB_OTG_GINTSTS register ********************/
  3537. #define USB_OTG_GINTSTS_CMOD ((uint32_t)0x00000001) /*!< Current mode of operation */
  3538. #define USB_OTG_GINTSTS_MMIS ((uint32_t)0x00000002) /*!< Mode mismatch interrupt */
  3539. #define USB_OTG_GINTSTS_OTGINT ((uint32_t)0x00000004) /*!< OTG interrupt */
  3540. #define USB_OTG_GINTSTS_SOF ((uint32_t)0x00000008) /*!< Start of frame */
  3541. #define USB_OTG_GINTSTS_RXFLVL ((uint32_t)0x00000010) /*!< RxFIFO nonempty */
  3542. #define USB_OTG_GINTSTS_NPTXFE ((uint32_t)0x00000020) /*!< Nonperiodic TxFIFO empty */
  3543. #define USB_OTG_GINTSTS_GINAKEFF ((uint32_t)0x00000040) /*!< Global IN nonperiodic NAK effective */
  3544. #define USB_OTG_GINTSTS_BOUTNAKEFF ((uint32_t)0x00000080) /*!< Global OUT NAK effective */
  3545. #define USB_OTG_GINTSTS_ESUSP ((uint32_t)0x00000400) /*!< Early suspend */
  3546. #define USB_OTG_GINTSTS_USBSUSP ((uint32_t)0x00000800) /*!< USB suspend */
  3547. #define USB_OTG_GINTSTS_USBRST ((uint32_t)0x00001000) /*!< USB reset */
  3548. #define USB_OTG_GINTSTS_ENUMDNE ((uint32_t)0x00002000) /*!< Enumeration done */
  3549. #define USB_OTG_GINTSTS_ISOODRP ((uint32_t)0x00004000) /*!< Isochronous OUT packet dropped interrupt */
  3550. #define USB_OTG_GINTSTS_EOPF ((uint32_t)0x00008000) /*!< End of periodic frame interrupt */
  3551. #define USB_OTG_GINTSTS_IEPINT ((uint32_t)0x00040000) /*!< IN endpoint interrupt */
  3552. #define USB_OTG_GINTSTS_OEPINT ((uint32_t)0x00080000) /*!< OUT endpoint interrupt */
  3553. #define USB_OTG_GINTSTS_IISOIXFR ((uint32_t)0x00100000) /*!< Incomplete isochronous IN transfer */
  3554. #define USB_OTG_GINTSTS_PXFR_INCOMPISOOUT ((uint32_t)0x00200000) /*!< Incomplete periodic transfer */
  3555. #define USB_OTG_GINTSTS_DATAFSUSP ((uint32_t)0x00400000) /*!< Data fetch suspended */
  3556. #define USB_OTG_GINTSTS_HPRTINT ((uint32_t)0x01000000) /*!< Host port interrupt */
  3557. #define USB_OTG_GINTSTS_HCINT ((uint32_t)0x02000000) /*!< Host channels interrupt */
  3558. #define USB_OTG_GINTSTS_PTXFE ((uint32_t)0x04000000) /*!< Periodic TxFIFO empty */
  3559. #define USB_OTG_GINTSTS_CIDSCHG ((uint32_t)0x10000000) /*!< Connector ID status change */
  3560. #define USB_OTG_GINTSTS_DISCINT ((uint32_t)0x20000000) /*!< Disconnect detected interrupt */
  3561. #define USB_OTG_GINTSTS_SRQINT ((uint32_t)0x40000000) /*!< Session request/new session detected interrupt */
  3562. #define USB_OTG_GINTSTS_WKUINT ((uint32_t)0x80000000) /*!< Resume/remote wakeup detected interrupt */
  3563. /******************** Bit definition forUSB_OTG_GINTMSK register ********************/
  3564. #define USB_OTG_GINTMSK_MMISM ((uint32_t)0x00000002) /*!< Mode mismatch interrupt mask */
  3565. #define USB_OTG_GINTMSK_OTGINT ((uint32_t)0x00000004) /*!< OTG interrupt mask */
  3566. #define USB_OTG_GINTMSK_SOFM ((uint32_t)0x00000008) /*!< Start of frame mask */
  3567. #define USB_OTG_GINTMSK_RXFLVLM ((uint32_t)0x00000010) /*!< Receive FIFO nonempty mask */
  3568. #define USB_OTG_GINTMSK_NPTXFEM ((uint32_t)0x00000020) /*!< Nonperiodic TxFIFO empty mask */
  3569. #define USB_OTG_GINTMSK_GINAKEFFM ((uint32_t)0x00000040) /*!< Global nonperiodic IN NAK effective mask */
  3570. #define USB_OTG_GINTMSK_GONAKEFFM ((uint32_t)0x00000080) /*!< Global OUT NAK effective mask */
  3571. #define USB_OTG_GINTMSK_ESUSPM ((uint32_t)0x00000400) /*!< Early suspend mask */
  3572. #define USB_OTG_GINTMSK_USBSUSPM ((uint32_t)0x00000800) /*!< USB suspend mask */
  3573. #define USB_OTG_GINTMSK_USBRST ((uint32_t)0x00001000) /*!< USB reset mask */
  3574. #define USB_OTG_GINTMSK_ENUMDNEM ((uint32_t)0x00002000) /*!< Enumeration done mask */
  3575. #define USB_OTG_GINTMSK_ISOODRPM ((uint32_t)0x00004000) /*!< Isochronous OUT packet dropped interrupt mask */
  3576. #define USB_OTG_GINTMSK_EOPFM ((uint32_t)0x00008000) /*!< End of periodic frame interrupt mask */
  3577. #define USB_OTG_GINTMSK_EPMISM ((uint32_t)0x00020000) /*!< Endpoint mismatch interrupt mask */
  3578. #define USB_OTG_GINTMSK_IEPINT ((uint32_t)0x00040000) /*!< IN endpoints interrupt mask */
  3579. #define USB_OTG_GINTMSK_OEPINT ((uint32_t)0x00080000) /*!< OUT endpoints interrupt mask */
  3580. #define USB_OTG_GINTMSK_IISOIXFRM ((uint32_t)0x00100000) /*!< Incomplete isochronous IN transfer mask */
  3581. #define USB_OTG_GINTMSK_PXFRM_IISOOXFRM ((uint32_t)0x00200000) /*!< Incomplete periodic transfer mask */
  3582. #define USB_OTG_GINTMSK_FSUSPM ((uint32_t)0x00400000) /*!< Data fetch suspended mask */
  3583. #define USB_OTG_GINTMSK_PRTIM ((uint32_t)0x01000000) /*!< Host port interrupt mask */
  3584. #define USB_OTG_GINTMSK_HCIM ((uint32_t)0x02000000) /*!< Host channels interrupt mask */
  3585. #define USB_OTG_GINTMSK_PTXFEM ((uint32_t)0x04000000) /*!< Periodic TxFIFO empty mask */
  3586. #define USB_OTG_GINTMSK_CIDSCHGM ((uint32_t)0x10000000) /*!< Connector ID status change mask */
  3587. #define USB_OTG_GINTMSK_DISCINT ((uint32_t)0x20000000) /*!< Disconnect detected interrupt mask */
  3588. #define USB_OTG_GINTMSK_SRQIM ((uint32_t)0x40000000) /*!< Session request/new session detected interrupt mask */
  3589. #define USB_OTG_GINTMSK_WUIM ((uint32_t)0x80000000) /*!< Resume/remote wakeup detected interrupt mask */
  3590. /******************** Bit definition forUSB_OTG_DAINT register ********************/
  3591. #define USB_OTG_DAINT_IEPINT ((uint32_t)0x0000FFFF) /*!< IN endpoint interrupt bits */
  3592. #define USB_OTG_DAINT_OEPINT ((uint32_t)0xFFFF0000) /*!< OUT endpoint interrupt bits */
  3593. /******************** Bit definition forUSB_OTG_HAINTMSK register ********************/
  3594. #define USB_OTG_HAINTMSK_HAINTM ((uint32_t)0x0000FFFF) /*!< Channel interrupt mask */
  3595. /******************** Bit definition for USB_OTG_GRXSTSP register ********************/
  3596. #define USB_OTG_GRXSTSP_EPNUM ((uint32_t)0x0000000F) /*!< IN EP interrupt mask bits */
  3597. #define USB_OTG_GRXSTSP_BCNT ((uint32_t)0x00007FF0) /*!< OUT EP interrupt mask bits */
  3598. #define USB_OTG_GRXSTSP_DPID ((uint32_t)0x00018000) /*!< OUT EP interrupt mask bits */
  3599. #define USB_OTG_GRXSTSP_PKTSTS ((uint32_t)0x001E0000) /*!< OUT EP interrupt mask bits */
  3600. /******************** Bit definition forUSB_OTG_DAINTMSK register ********************/
  3601. #define USB_OTG_DAINTMSK_IEPM ((uint32_t)0x0000FFFF) /*!< IN EP interrupt mask bits */
  3602. #define USB_OTG_DAINTMSK_OEPM ((uint32_t)0xFFFF0000) /*!< OUT EP interrupt mask bits */
  3603. /******************** Bit definition for OTG register ********************/
  3604. #define USB_OTG_CHNUM ((uint32_t)0x0000000F) /*!< Channel number */
  3605. #define USB_OTG_CHNUM_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  3606. #define USB_OTG_CHNUM_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  3607. #define USB_OTG_CHNUM_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  3608. #define USB_OTG_CHNUM_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  3609. #define USB_OTG_BCNT ((uint32_t)0x00007FF0) /*!< Byte count */
  3610. #define USB_OTG_DPID ((uint32_t)0x00018000) /*!< Data PID */
  3611. #define USB_OTG_DPID_0 ((uint32_t)0x00008000) /*!<Bit 0 */
  3612. #define USB_OTG_DPID_1 ((uint32_t)0x00010000) /*!<Bit 1 */
  3613. #define USB_OTG_PKTSTS ((uint32_t)0x001E0000) /*!< Packet status */
  3614. #define USB_OTG_PKTSTS_0 ((uint32_t)0x00020000) /*!<Bit 0 */
  3615. #define USB_OTG_PKTSTS_1 ((uint32_t)0x00040000) /*!<Bit 1 */
  3616. #define USB_OTG_PKTSTS_2 ((uint32_t)0x00080000) /*!<Bit 2 */
  3617. #define USB_OTG_PKTSTS_3 ((uint32_t)0x00100000) /*!<Bit 3 */
  3618. #define USB_OTG_EPNUM ((uint32_t)0x0000000F) /*!< Endpoint number */
  3619. #define USB_OTG_EPNUM_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  3620. #define USB_OTG_EPNUM_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  3621. #define USB_OTG_EPNUM_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  3622. #define USB_OTG_EPNUM_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  3623. #define USB_OTG_FRMNUM ((uint32_t)0x01E00000) /*!< Frame number */
  3624. #define USB_OTG_FRMNUM_0 ((uint32_t)0x00200000) /*!<Bit 0 */
  3625. #define USB_OTG_FRMNUM_1 ((uint32_t)0x00400000) /*!<Bit 1 */
  3626. #define USB_OTG_FRMNUM_2 ((uint32_t)0x00800000) /*!<Bit 2 */
  3627. #define USB_OTG_FRMNUM_3 ((uint32_t)0x01000000) /*!<Bit 3 */
  3628. /******************** Bit definition for OTG register ********************/
  3629. #define USB_OTG_CHNUM ((uint32_t)0x0000000F) /*!< Channel number */
  3630. #define USB_OTG_CHNUM_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  3631. #define USB_OTG_CHNUM_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  3632. #define USB_OTG_CHNUM_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  3633. #define USB_OTG_CHNUM_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  3634. #define USB_OTG_BCNT ((uint32_t)0x00007FF0) /*!< Byte count */
  3635. #define USB_OTG_DPID ((uint32_t)0x00018000) /*!< Data PID */
  3636. #define USB_OTG_DPID_0 ((uint32_t)0x00008000) /*!<Bit 0 */
  3637. #define USB_OTG_DPID_1 ((uint32_t)0x00010000) /*!<Bit 1 */
  3638. #define USB_OTG_PKTSTS ((uint32_t)0x001E0000) /*!< Packet status */
  3639. #define USB_OTG_PKTSTS_0 ((uint32_t)0x00020000) /*!<Bit 0 */
  3640. #define USB_OTG_PKTSTS_1 ((uint32_t)0x00040000) /*!<Bit 1 */
  3641. #define USB_OTG_PKTSTS_2 ((uint32_t)0x00080000) /*!<Bit 2 */
  3642. #define USB_OTG_PKTSTS_3 ((uint32_t)0x00100000) /*!<Bit 3 */
  3643. #define USB_OTG_EPNUM ((uint32_t)0x0000000F) /*!< Endpoint number */
  3644. #define USB_OTG_EPNUM_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  3645. #define USB_OTG_EPNUM_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  3646. #define USB_OTG_EPNUM_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  3647. #define USB_OTG_EPNUM_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  3648. #define USB_OTG_FRMNUM ((uint32_t)0x01E00000) /*!< Frame number */
  3649. #define USB_OTG_FRMNUM_0 ((uint32_t)0x00200000) /*!<Bit 0 */
  3650. #define USB_OTG_FRMNUM_1 ((uint32_t)0x00400000) /*!<Bit 1 */
  3651. #define USB_OTG_FRMNUM_2 ((uint32_t)0x00800000) /*!<Bit 2 */
  3652. #define USB_OTG_FRMNUM_3 ((uint32_t)0x01000000) /*!<Bit 3 */
  3653. /******************** Bit definition forUSB_OTG_GRXFSIZ register ********************/
  3654. #define USB_OTG_GRXFSIZ_RXFD ((uint32_t)0x0000FFFF) /*!< RxFIFO depth */
  3655. /******************** Bit definition forUSB_OTG_DVBUSDIS register ********************/
  3656. #define USB_OTG_DVBUSDIS_VBUSDT ((uint32_t)0x0000FFFF) /*!< Device VBUS discharge time */
  3657. /******************** Bit definition for OTG register ********************/
  3658. #define USB_OTG_NPTXFSA ((uint32_t)0x0000FFFF) /*!< Nonperiodic transmit RAM start address */
  3659. #define USB_OTG_NPTXFD ((uint32_t)0xFFFF0000) /*!< Nonperiodic TxFIFO depth */
  3660. #define USB_OTG_TX0FSA ((uint32_t)0x0000FFFF) /*!< Endpoint 0 transmit RAM start address */
  3661. #define USB_OTG_TX0FD ((uint32_t)0xFFFF0000) /*!< Endpoint 0 TxFIFO depth */
  3662. /******************** Bit definition forUSB_OTG_DVBUSPULSE register ********************/
  3663. #define USB_OTG_DVBUSPULSE_DVBUSP ((uint32_t)0x00000FFF) /*!< Device VBUS pulsing time */
  3664. /******************** Bit definition forUSB_OTG_GNPTXSTS register ********************/
  3665. #define USB_OTG_GNPTXSTS_NPTXFSAV ((uint32_t)0x0000FFFF) /*!< Nonperiodic TxFIFO space available */
  3666. #define USB_OTG_GNPTXSTS_NPTQXSAV ((uint32_t)0x00FF0000) /*!< Nonperiodic transmit request queue space available */
  3667. #define USB_OTG_GNPTXSTS_NPTQXSAV_0 ((uint32_t)0x00010000) /*!<Bit 0 */
  3668. #define USB_OTG_GNPTXSTS_NPTQXSAV_1 ((uint32_t)0x00020000) /*!<Bit 1 */
  3669. #define USB_OTG_GNPTXSTS_NPTQXSAV_2 ((uint32_t)0x00040000) /*!<Bit 2 */
  3670. #define USB_OTG_GNPTXSTS_NPTQXSAV_3 ((uint32_t)0x00080000) /*!<Bit 3 */
  3671. #define USB_OTG_GNPTXSTS_NPTQXSAV_4 ((uint32_t)0x00100000) /*!<Bit 4 */
  3672. #define USB_OTG_GNPTXSTS_NPTQXSAV_5 ((uint32_t)0x00200000) /*!<Bit 5 */
  3673. #define USB_OTG_GNPTXSTS_NPTQXSAV_6 ((uint32_t)0x00400000) /*!<Bit 6 */
  3674. #define USB_OTG_GNPTXSTS_NPTQXSAV_7 ((uint32_t)0x00800000) /*!<Bit 7 */
  3675. #define USB_OTG_GNPTXSTS_NPTXQTOP ((uint32_t)0x7F000000) /*!< Top of the nonperiodic transmit request queue */
  3676. #define USB_OTG_GNPTXSTS_NPTXQTOP_0 ((uint32_t)0x01000000) /*!<Bit 0 */
  3677. #define USB_OTG_GNPTXSTS_NPTXQTOP_1 ((uint32_t)0x02000000) /*!<Bit 1 */
  3678. #define USB_OTG_GNPTXSTS_NPTXQTOP_2 ((uint32_t)0x04000000) /*!<Bit 2 */
  3679. #define USB_OTG_GNPTXSTS_NPTXQTOP_3 ((uint32_t)0x08000000) /*!<Bit 3 */
  3680. #define USB_OTG_GNPTXSTS_NPTXQTOP_4 ((uint32_t)0x10000000) /*!<Bit 4 */
  3681. #define USB_OTG_GNPTXSTS_NPTXQTOP_5 ((uint32_t)0x20000000) /*!<Bit 5 */
  3682. #define USB_OTG_GNPTXSTS_NPTXQTOP_6 ((uint32_t)0x40000000) /*!<Bit 6 */
  3683. /******************** Bit definition forUSB_OTG_DTHRCTL register ********************/
  3684. #define USB_OTG_DTHRCTL_NONISOTHREN ((uint32_t)0x00000001) /*!< Nonisochronous IN endpoints threshold enable */
  3685. #define USB_OTG_DTHRCTL_ISOTHREN ((uint32_t)0x00000002) /*!< ISO IN endpoint threshold enable */
  3686. #define USB_OTG_DTHRCTL_TXTHRLEN ((uint32_t)0x000007FC) /*!< Transmit threshold length */
  3687. #define USB_OTG_DTHRCTL_TXTHRLEN_0 ((uint32_t)0x00000004) /*!<Bit 0 */
  3688. #define USB_OTG_DTHRCTL_TXTHRLEN_1 ((uint32_t)0x00000008) /*!<Bit 1 */
  3689. #define USB_OTG_DTHRCTL_TXTHRLEN_2 ((uint32_t)0x00000010) /*!<Bit 2 */
  3690. #define USB_OTG_DTHRCTL_TXTHRLEN_3 ((uint32_t)0x00000020) /*!<Bit 3 */
  3691. #define USB_OTG_DTHRCTL_TXTHRLEN_4 ((uint32_t)0x00000040) /*!<Bit 4 */
  3692. #define USB_OTG_DTHRCTL_TXTHRLEN_5 ((uint32_t)0x00000080) /*!<Bit 5 */
  3693. #define USB_OTG_DTHRCTL_TXTHRLEN_6 ((uint32_t)0x00000100) /*!<Bit 6 */
  3694. #define USB_OTG_DTHRCTL_TXTHRLEN_7 ((uint32_t)0x00000200) /*!<Bit 7 */
  3695. #define USB_OTG_DTHRCTL_TXTHRLEN_8 ((uint32_t)0x00000400) /*!<Bit 8 */
  3696. #define USB_OTG_DTHRCTL_RXTHREN ((uint32_t)0x00010000) /*!< Receive threshold enable */
  3697. #define USB_OTG_DTHRCTL_RXTHRLEN ((uint32_t)0x03FE0000) /*!< Receive threshold length */
  3698. #define USB_OTG_DTHRCTL_RXTHRLEN_0 ((uint32_t)0x00020000) /*!<Bit 0 */
  3699. #define USB_OTG_DTHRCTL_RXTHRLEN_1 ((uint32_t)0x00040000) /*!<Bit 1 */
  3700. #define USB_OTG_DTHRCTL_RXTHRLEN_2 ((uint32_t)0x00080000) /*!<Bit 2 */
  3701. #define USB_OTG_DTHRCTL_RXTHRLEN_3 ((uint32_t)0x00100000) /*!<Bit 3 */
  3702. #define USB_OTG_DTHRCTL_RXTHRLEN_4 ((uint32_t)0x00200000) /*!<Bit 4 */
  3703. #define USB_OTG_DTHRCTL_RXTHRLEN_5 ((uint32_t)0x00400000) /*!<Bit 5 */
  3704. #define USB_OTG_DTHRCTL_RXTHRLEN_6 ((uint32_t)0x00800000) /*!<Bit 6 */
  3705. #define USB_OTG_DTHRCTL_RXTHRLEN_7 ((uint32_t)0x01000000) /*!<Bit 7 */
  3706. #define USB_OTG_DTHRCTL_RXTHRLEN_8 ((uint32_t)0x02000000) /*!<Bit 8 */
  3707. #define USB_OTG_DTHRCTL_ARPEN ((uint32_t)0x08000000) /*!< Arbiter parking enable */
  3708. /******************** Bit definition forUSB_OTG_DIEPEMPMSK register ********************/
  3709. #define USB_OTG_DIEPEMPMSK_INEPTXFEM ((uint32_t)0x0000FFFF) /*!< IN EP Tx FIFO empty interrupt mask bits */
  3710. /******************** Bit definition forUSB_OTG_DEACHINT register ********************/
  3711. #define USB_OTG_DEACHINT_IEP1INT ((uint32_t)0x00000002) /*!< IN endpoint 1interrupt bit */
  3712. #define USB_OTG_DEACHINT_OEP1INT ((uint32_t)0x00020000) /*!< OUT endpoint 1 interrupt bit */
  3713. /******************** Bit definition forUSB_OTG_GCCFG register ********************/
  3714. #define USB_OTG_GCCFG_PWRDWN ((uint32_t)0x00010000) /*!< Power down */
  3715. #define USB_OTG_GCCFG_I2CPADEN ((uint32_t)0x00020000) /*!< Enable I2C bus connection for the external I2C PHY interface */
  3716. #define USB_OTG_GCCFG_VBUSASEN ((uint32_t)0x00040000) /*!< Enable the VBUS sensing device */
  3717. #define USB_OTG_GCCFG_VBUSBSEN ((uint32_t)0x00080000) /*!< Enable the VBUS sensing device */
  3718. #define USB_OTG_GCCFG_SOFOUTEN ((uint32_t)0x00100000) /*!< SOF output enable */
  3719. #define USB_OTG_GCCFG_NOVBUSSENS ((uint32_t)0x00200000) /*!< VBUS sensing disable option */
  3720. /******************** Bit definition forUSB_OTG_DEACHINTMSK register ********************/
  3721. #define USB_OTG_DEACHINTMSK_IEP1INTM ((uint32_t)0x00000002) /*!< IN Endpoint 1 interrupt mask bit */
  3722. #define USB_OTG_DEACHINTMSK_OEP1INTM ((uint32_t)0x00020000) /*!< OUT Endpoint 1 interrupt mask bit */
  3723. /******************** Bit definition forUSB_OTG_CID register ********************/
  3724. #define USB_OTG_CID_PRODUCT_ID ((uint32_t)0xFFFFFFFF) /*!< Product ID field */
  3725. /******************** Bit definition forUSB_OTG_DIEPEACHMSK1 register ********************/
  3726. #define USB_OTG_DIEPEACHMSK1_XFRCM ((uint32_t)0x00000001) /*!< Transfer completed interrupt mask */
  3727. #define USB_OTG_DIEPEACHMSK1_EPDM ((uint32_t)0x00000002) /*!< Endpoint disabled interrupt mask */
  3728. #define USB_OTG_DIEPEACHMSK1_TOM ((uint32_t)0x00000008) /*!< Timeout condition mask (nonisochronous endpoints) */
  3729. #define USB_OTG_DIEPEACHMSK1_ITTXFEMSK ((uint32_t)0x00000010) /*!< IN token received when TxFIFO empty mask */
  3730. #define USB_OTG_DIEPEACHMSK1_INEPNMM ((uint32_t)0x00000020) /*!< IN token received with EP mismatch mask */
  3731. #define USB_OTG_DIEPEACHMSK1_INEPNEM ((uint32_t)0x00000040) /*!< IN endpoint NAK effective mask */
  3732. #define USB_OTG_DIEPEACHMSK1_TXFURM ((uint32_t)0x00000100) /*!< FIFO underrun mask */
  3733. #define USB_OTG_DIEPEACHMSK1_BIM ((uint32_t)0x00000200) /*!< BNA interrupt mask */
  3734. #define USB_OTG_DIEPEACHMSK1_NAKM ((uint32_t)0x00002000) /*!< NAK interrupt mask */
  3735. /******************** Bit definition forUSB_OTG_HPRT register ********************/
  3736. #define USB_OTG_HPRT_PCSTS ((uint32_t)0x00000001) /*!< Port connect status */
  3737. #define USB_OTG_HPRT_PCDET ((uint32_t)0x00000002) /*!< Port connect detected */
  3738. #define USB_OTG_HPRT_PENA ((uint32_t)0x00000004) /*!< Port enable */
  3739. #define USB_OTG_HPRT_PENCHNG ((uint32_t)0x00000008) /*!< Port enable/disable change */
  3740. #define USB_OTG_HPRT_POCA ((uint32_t)0x00000010) /*!< Port overcurrent active */
  3741. #define USB_OTG_HPRT_POCCHNG ((uint32_t)0x00000020) /*!< Port overcurrent change */
  3742. #define USB_OTG_HPRT_PRES ((uint32_t)0x00000040) /*!< Port resume */
  3743. #define USB_OTG_HPRT_PSUSP ((uint32_t)0x00000080) /*!< Port suspend */
  3744. #define USB_OTG_HPRT_PRST ((uint32_t)0x00000100) /*!< Port reset */
  3745. #define USB_OTG_HPRT_PLSTS ((uint32_t)0x00000C00) /*!< Port line status */
  3746. #define USB_OTG_HPRT_PLSTS_0 ((uint32_t)0x00000400) /*!<Bit 0 */
  3747. #define USB_OTG_HPRT_PLSTS_1 ((uint32_t)0x00000800) /*!<Bit 1 */
  3748. #define USB_OTG_HPRT_PPWR ((uint32_t)0x00001000) /*!< Port power */
  3749. #define USB_OTG_HPRT_PTCTL ((uint32_t)0x0001E000) /*!< Port test control */
  3750. #define USB_OTG_HPRT_PTCTL_0 ((uint32_t)0x00002000) /*!<Bit 0 */
  3751. #define USB_OTG_HPRT_PTCTL_1 ((uint32_t)0x00004000) /*!<Bit 1 */
  3752. #define USB_OTG_HPRT_PTCTL_2 ((uint32_t)0x00008000) /*!<Bit 2 */
  3753. #define USB_OTG_HPRT_PTCTL_3 ((uint32_t)0x00010000) /*!<Bit 3 */
  3754. #define USB_OTG_HPRT_PSPD ((uint32_t)0x00060000) /*!< Port speed */
  3755. #define USB_OTG_HPRT_PSPD_0 ((uint32_t)0x00020000) /*!<Bit 0 */
  3756. #define USB_OTG_HPRT_PSPD_1 ((uint32_t)0x00040000) /*!<Bit 1 */
  3757. /******************** Bit definition forUSB_OTG_DOEPEACHMSK1 register ********************/
  3758. #define USB_OTG_DOEPEACHMSK1_XFRCM ((uint32_t)0x00000001) /*!< Transfer completed interrupt mask */
  3759. #define USB_OTG_DOEPEACHMSK1_EPDM ((uint32_t)0x00000002) /*!< Endpoint disabled interrupt mask */
  3760. #define USB_OTG_DOEPEACHMSK1_TOM ((uint32_t)0x00000008) /*!< Timeout condition mask */
  3761. #define USB_OTG_DOEPEACHMSK1_ITTXFEMSK ((uint32_t)0x00000010) /*!< IN token received when TxFIFO empty mask */
  3762. #define USB_OTG_DOEPEACHMSK1_INEPNMM ((uint32_t)0x00000020) /*!< IN token received with EP mismatch mask */
  3763. #define USB_OTG_DOEPEACHMSK1_INEPNEM ((uint32_t)0x00000040) /*!< IN endpoint NAK effective mask */
  3764. #define USB_OTG_DOEPEACHMSK1_TXFURM ((uint32_t)0x00000100) /*!< OUT packet error mask */
  3765. #define USB_OTG_DOEPEACHMSK1_BIM ((uint32_t)0x00000200) /*!< BNA interrupt mask */
  3766. #define USB_OTG_DOEPEACHMSK1_BERRM ((uint32_t)0x00001000) /*!< Bubble error interrupt mask */
  3767. #define USB_OTG_DOEPEACHMSK1_NAKM ((uint32_t)0x00002000) /*!< NAK interrupt mask */
  3768. #define USB_OTG_DOEPEACHMSK1_NYETM ((uint32_t)0x00004000) /*!< NYET interrupt mask */
  3769. /******************** Bit definition forUSB_OTG_HPTXFSIZ register ********************/
  3770. #define USB_OTG_HPTXFSIZ_PTXSA ((uint32_t)0x0000FFFF) /*!< Host periodic TxFIFO start address */
  3771. #define USB_OTG_HPTXFSIZ_PTXFD ((uint32_t)0xFFFF0000) /*!< Host periodic TxFIFO depth */
  3772. /******************** Bit definition forUSB_OTG_DIEPCTL register ********************/
  3773. #define USB_OTG_DIEPCTL_MPSIZ ((uint32_t)0x000007FF) /*!< Maximum packet size */
  3774. #define USB_OTG_DIEPCTL_USBAEP ((uint32_t)0x00008000) /*!< USB active endpoint */
  3775. #define USB_OTG_DIEPCTL_EONUM_DPID ((uint32_t)0x00010000) /*!< Even/odd frame */
  3776. #define USB_OTG_DIEPCTL_NAKSTS ((uint32_t)0x00020000) /*!< NAK status */
  3777. #define USB_OTG_DIEPCTL_EPTYP ((uint32_t)0x000C0000) /*!< Endpoint type */
  3778. #define USB_OTG_DIEPCTL_EPTYP_0 ((uint32_t)0x00040000) /*!<Bit 0 */
  3779. #define USB_OTG_DIEPCTL_EPTYP_1 ((uint32_t)0x00080000) /*!<Bit 1 */
  3780. #define USB_OTG_DIEPCTL_STALL ((uint32_t)0x00200000) /*!< STALL handshake */
  3781. #define USB_OTG_DIEPCTL_TXFNUM ((uint32_t)0x03C00000) /*!< TxFIFO number */
  3782. #define USB_OTG_DIEPCTL_TXFNUM_0 ((uint32_t)0x00400000) /*!<Bit 0 */
  3783. #define USB_OTG_DIEPCTL_TXFNUM_1 ((uint32_t)0x00800000) /*!<Bit 1 */
  3784. #define USB_OTG_DIEPCTL_TXFNUM_2 ((uint32_t)0x01000000) /*!<Bit 2 */
  3785. #define USB_OTG_DIEPCTL_TXFNUM_3 ((uint32_t)0x02000000) /*!<Bit 3 */
  3786. #define USB_OTG_DIEPCTL_CNAK ((uint32_t)0x04000000) /*!< Clear NAK */
  3787. #define USB_OTG_DIEPCTL_SNAK ((uint32_t)0x08000000) /*!< Set NAK */
  3788. #define USB_OTG_DIEPCTL_SD0PID_SEVNFRM ((uint32_t)0x10000000) /*!< Set DATA0 PID */
  3789. #define USB_OTG_DIEPCTL_SODDFRM ((uint32_t)0x20000000) /*!< Set odd frame */
  3790. #define USB_OTG_DIEPCTL_EPDIS ((uint32_t)0x40000000) /*!< Endpoint disable */
  3791. #define USB_OTG_DIEPCTL_EPENA ((uint32_t)0x80000000) /*!< Endpoint enable */
  3792. /******************** Bit definition forUSB_OTG_HCCHAR register ********************/
  3793. #define USB_OTG_HCCHAR_MPSIZ ((uint32_t)0x000007FF) /*!< Maximum packet size */
  3794. #define USB_OTG_HCCHAR_EPNUM ((uint32_t)0x00007800) /*!< Endpoint number */
  3795. #define USB_OTG_HCCHAR_EPNUM_0 ((uint32_t)0x00000800) /*!<Bit 0 */
  3796. #define USB_OTG_HCCHAR_EPNUM_1 ((uint32_t)0x00001000) /*!<Bit 1 */
  3797. #define USB_OTG_HCCHAR_EPNUM_2 ((uint32_t)0x00002000) /*!<Bit 2 */
  3798. #define USB_OTG_HCCHAR_EPNUM_3 ((uint32_t)0x00004000) /*!<Bit 3 */
  3799. #define USB_OTG_HCCHAR_EPDIR ((uint32_t)0x00008000) /*!< Endpoint direction */
  3800. #define USB_OTG_HCCHAR_LSDEV ((uint32_t)0x00020000) /*!< Low-speed device */
  3801. #define USB_OTG_HCCHAR_EPTYP ((uint32_t)0x000C0000) /*!< Endpoint type */
  3802. #define USB_OTG_HCCHAR_EPTYP_0 ((uint32_t)0x00040000) /*!<Bit 0 */
  3803. #define USB_OTG_HCCHAR_EPTYP_1 ((uint32_t)0x00080000) /*!<Bit 1 */
  3804. #define USB_OTG_HCCHAR_MC ((uint32_t)0x00300000) /*!< Multi Count (MC) / Error Count (EC) */
  3805. #define USB_OTG_HCCHAR_MC_0 ((uint32_t)0x00100000) /*!<Bit 0 */
  3806. #define USB_OTG_HCCHAR_MC_1 ((uint32_t)0x00200000) /*!<Bit 1 */
  3807. #define USB_OTG_HCCHAR_DAD ((uint32_t)0x1FC00000) /*!< Device address */
  3808. #define USB_OTG_HCCHAR_DAD_0 ((uint32_t)0x00400000) /*!<Bit 0 */
  3809. #define USB_OTG_HCCHAR_DAD_1 ((uint32_t)0x00800000) /*!<Bit 1 */
  3810. #define USB_OTG_HCCHAR_DAD_2 ((uint32_t)0x01000000) /*!<Bit 2 */
  3811. #define USB_OTG_HCCHAR_DAD_3 ((uint32_t)0x02000000) /*!<Bit 3 */
  3812. #define USB_OTG_HCCHAR_DAD_4 ((uint32_t)0x04000000) /*!<Bit 4 */
  3813. #define USB_OTG_HCCHAR_DAD_5 ((uint32_t)0x08000000) /*!<Bit 5 */
  3814. #define USB_OTG_HCCHAR_DAD_6 ((uint32_t)0x10000000) /*!<Bit 6 */
  3815. #define USB_OTG_HCCHAR_ODDFRM ((uint32_t)0x20000000) /*!< Odd frame */
  3816. #define USB_OTG_HCCHAR_CHDIS ((uint32_t)0x40000000) /*!< Channel disable */
  3817. #define USB_OTG_HCCHAR_CHENA ((uint32_t)0x80000000) /*!< Channel enable */
  3818. /******************** Bit definition forUSB_OTG_HCSPLT register ********************/
  3819. #define USB_OTG_HCSPLT_PRTADDR ((uint32_t)0x0000007F) /*!< Port address */
  3820. #define USB_OTG_HCSPLT_PRTADDR_0 ((uint32_t)0x00000001) /*!<Bit 0 */
  3821. #define USB_OTG_HCSPLT_PRTADDR_1 ((uint32_t)0x00000002) /*!<Bit 1 */
  3822. #define USB_OTG_HCSPLT_PRTADDR_2 ((uint32_t)0x00000004) /*!<Bit 2 */
  3823. #define USB_OTG_HCSPLT_PRTADDR_3 ((uint32_t)0x00000008) /*!<Bit 3 */
  3824. #define USB_OTG_HCSPLT_PRTADDR_4 ((uint32_t)0x00000010) /*!<Bit 4 */
  3825. #define USB_OTG_HCSPLT_PRTADDR_5 ((uint32_t)0x00000020) /*!<Bit 5 */
  3826. #define USB_OTG_HCSPLT_PRTADDR_6 ((uint32_t)0x00000040) /*!<Bit 6 */
  3827. #define USB_OTG_HCSPLT_HUBADDR ((uint32_t)0x00003F80) /*!< Hub address */
  3828. #define USB_OTG_HCSPLT_HUBADDR_0 ((uint32_t)0x00000080) /*!<Bit 0 */
  3829. #define USB_OTG_HCSPLT_HUBADDR_1 ((uint32_t)0x00000100) /*!<Bit 1 */
  3830. #define USB_OTG_HCSPLT_HUBADDR_2 ((uint32_t)0x00000200) /*!<Bit 2 */
  3831. #define USB_OTG_HCSPLT_HUBADDR_3 ((uint32_t)0x00000400) /*!<Bit 3 */
  3832. #define USB_OTG_HCSPLT_HUBADDR_4 ((uint32_t)0x00000800) /*!<Bit 4 */
  3833. #define USB_OTG_HCSPLT_HUBADDR_5 ((uint32_t)0x00001000) /*!<Bit 5 */
  3834. #define USB_OTG_HCSPLT_HUBADDR_6 ((uint32_t)0x00002000) /*!<Bit 6 */
  3835. #define USB_OTG_HCSPLT_XACTPOS ((uint32_t)0x0000C000) /*!< XACTPOS */
  3836. #define USB_OTG_HCSPLT_XACTPOS_0 ((uint32_t)0x00004000) /*!<Bit 0 */
  3837. #define USB_OTG_HCSPLT_XACTPOS_1 ((uint32_t)0x00008000) /*!<Bit 1 */
  3838. #define USB_OTG_HCSPLT_COMPLSPLT ((uint32_t)0x00010000) /*!< Do complete split */
  3839. #define USB_OTG_HCSPLT_SPLITEN ((uint32_t)0x80000000) /*!< Split enable */
  3840. /******************** Bit definition forUSB_OTG_HCINT register ********************/
  3841. #define USB_OTG_HCINT_XFRC ((uint32_t)0x00000001) /*!< Transfer completed */
  3842. #define USB_OTG_HCINT_CHH ((uint32_t)0x00000002) /*!< Channel halted */
  3843. #define USB_OTG_HCINT_AHBERR ((uint32_t)0x00000004) /*!< AHB error */
  3844. #define USB_OTG_HCINT_STALL ((uint32_t)0x00000008) /*!< STALL response received interrupt */
  3845. #define USB_OTG_HCINT_NAK ((uint32_t)0x00000010) /*!< NAK response received interrupt */
  3846. #define USB_OTG_HCINT_ACK ((uint32_t)0x00000020) /*!< ACK response received/transmitted interrupt */
  3847. #define USB_OTG_HCINT_NYET ((uint32_t)0x00000040) /*!< Response received interrupt */
  3848. #define USB_OTG_HCINT_TXERR ((uint32_t)0x00000080) /*!< Transaction error */
  3849. #define USB_OTG_HCINT_BBERR ((uint32_t)0x00000100) /*!< Babble error */
  3850. #define USB_OTG_HCINT_FRMOR ((uint32_t)0x00000200) /*!< Frame overrun */
  3851. #define USB_OTG_HCINT_DTERR ((uint32_t)0x00000400) /*!< Data toggle error */
  3852. /******************** Bit definition forUSB_OTG_DIEPINT register ********************/
  3853. #define USB_OTG_DIEPINT_XFRC ((uint32_t)0x00000001) /*!< Transfer completed interrupt */
  3854. #define USB_OTG_DIEPINT_EPDISD ((uint32_t)0x00000002) /*!< Endpoint disabled interrupt */
  3855. #define USB_OTG_DIEPINT_TOC ((uint32_t)0x00000008) /*!< Timeout condition */
  3856. #define USB_OTG_DIEPINT_ITTXFE ((uint32_t)0x00000010) /*!< IN token received when TxFIFO is empty */
  3857. #define USB_OTG_DIEPINT_INEPNE ((uint32_t)0x00000040) /*!< IN endpoint NAK effective */
  3858. #define USB_OTG_DIEPINT_TXFE ((uint32_t)0x00000080) /*!< Transmit FIFO empty */
  3859. #define USB_OTG_DIEPINT_TXFIFOUDRN ((uint32_t)0x00000100) /*!< Transmit Fifo Underrun */
  3860. #define USB_OTG_DIEPINT_BNA ((uint32_t)0x00000200) /*!< Buffer not available interrupt */
  3861. #define USB_OTG_DIEPINT_PKTDRPSTS ((uint32_t)0x00000800) /*!< Packet dropped status */
  3862. #define USB_OTG_DIEPINT_BERR ((uint32_t)0x00001000) /*!< Babble error interrupt */
  3863. #define USB_OTG_DIEPINT_NAK ((uint32_t)0x00002000) /*!< NAK interrupt */
  3864. /******************** Bit definition forUSB_OTG_HCINTMSK register ********************/
  3865. #define USB_OTG_HCINTMSK_XFRCM ((uint32_t)0x00000001) /*!< Transfer completed mask */
  3866. #define USB_OTG_HCINTMSK_CHHM ((uint32_t)0x00000002) /*!< Channel halted mask */
  3867. #define USB_OTG_HCINTMSK_AHBERR ((uint32_t)0x00000004) /*!< AHB error */
  3868. #define USB_OTG_HCINTMSK_STALLM ((uint32_t)0x00000008) /*!< STALL response received interrupt mask */
  3869. #define USB_OTG_HCINTMSK_NAKM ((uint32_t)0x00000010) /*!< NAK response received interrupt mask */
  3870. #define USB_OTG_HCINTMSK_ACKM ((uint32_t)0x00000020) /*!< ACK response received/transmitted interrupt mask */
  3871. #define USB_OTG_HCINTMSK_NYET ((uint32_t)0x00000040) /*!< response received interrupt mask */
  3872. #define USB_OTG_HCINTMSK_TXERRM ((uint32_t)0x00000080) /*!< Transaction error mask */
  3873. #define USB_OTG_HCINTMSK_BBERRM ((uint32_t)0x00000100) /*!< Babble error mask */
  3874. #define USB_OTG_HCINTMSK_FRMORM ((uint32_t)0x00000200) /*!< Frame overrun mask */
  3875. #define USB_OTG_HCINTMSK_DTERRM ((uint32_t)0x00000400) /*!< Data toggle error mask */
  3876. /******************** Bit definition for USB_OTG_DIEPTSIZ register ********************/
  3877. #define USB_OTG_DIEPTSIZ_XFRSIZ ((uint32_t)0x0007FFFF) /*!< Transfer size */
  3878. #define USB_OTG_DIEPTSIZ_PKTCNT ((uint32_t)0x1FF80000) /*!< Packet count */
  3879. #define USB_OTG_DIEPTSIZ_MULCNT ((uint32_t)0x60000000) /*!< Packet count */
  3880. /******************** Bit definition forUSB_OTG_HCTSIZ register ********************/
  3881. #define USB_OTG_HCTSIZ_XFRSIZ ((uint32_t)0x0007FFFF) /*!< Transfer size */
  3882. #define USB_OTG_HCTSIZ_PKTCNT ((uint32_t)0x1FF80000) /*!< Packet count */
  3883. #define USB_OTG_HCTSIZ_DOPING ((uint32_t)0x80000000) /*!< Do PING */
  3884. #define USB_OTG_HCTSIZ_DPID ((uint32_t)0x60000000) /*!< Data PID */
  3885. #define USB_OTG_HCTSIZ_DPID_0 ((uint32_t)0x20000000) /*!<Bit 0 */
  3886. #define USB_OTG_HCTSIZ_DPID_1 ((uint32_t)0x40000000) /*!<Bit 1 */
  3887. /******************** Bit definition forUSB_OTG_DIEPDMA register ********************/
  3888. #define USB_OTG_DIEPDMA_DMAADDR ((uint32_t)0xFFFFFFFF) /*!< DMA address */
  3889. /******************** Bit definition forUSB_OTG_HCDMA register ********************/
  3890. #define USB_OTG_HCDMA_DMAADDR ((uint32_t)0xFFFFFFFF) /*!< DMA address */
  3891. /******************** Bit definition forUSB_OTG_DTXFSTS register ********************/
  3892. #define USB_OTG_DTXFSTS_INEPTFSAV ((uint32_t)0x0000FFFF) /*!< IN endpoint TxFIFO space avail */
  3893. /******************** Bit definition forUSB_OTG_DIEPTXF register ********************/
  3894. #define USB_OTG_DIEPTXF_INEPTXSA ((uint32_t)0x0000FFFF) /*!< IN endpoint FIFOx transmit RAM start address */
  3895. #define USB_OTG_DIEPTXF_INEPTXFD ((uint32_t)0xFFFF0000) /*!< IN endpoint TxFIFO depth */
  3896. /******************** Bit definition forUSB_OTG_DOEPCTL register ********************/
  3897. #define USB_OTG_DOEPCTL_MPSIZ ((uint32_t)0x000007FF) /*!< Maximum packet size */ /*!<Bit 1 */
  3898. #define USB_OTG_DOEPCTL_USBAEP ((uint32_t)0x00008000) /*!< USB active endpoint */
  3899. #define USB_OTG_DOEPCTL_NAKSTS ((uint32_t)0x00020000) /*!< NAK status */
  3900. #define USB_OTG_DOEPCTL_SD0PID_SEVNFRM ((uint32_t)0x10000000) /*!< Set DATA0 PID */
  3901. #define USB_OTG_DOEPCTL_SODDFRM ((uint32_t)0x20000000) /*!< Set odd frame */
  3902. #define USB_OTG_DOEPCTL_EPTYP ((uint32_t)0x000C0000) /*!< Endpoint type */
  3903. #define USB_OTG_DOEPCTL_EPTYP_0 ((uint32_t)0x00040000) /*!<Bit 0 */
  3904. #define USB_OTG_DOEPCTL_EPTYP_1 ((uint32_t)0x00080000) /*!<Bit 1 */
  3905. #define USB_OTG_DOEPCTL_SNPM ((uint32_t)0x00100000) /*!< Snoop mode */
  3906. #define USB_OTG_DOEPCTL_STALL ((uint32_t)0x00200000) /*!< STALL handshake */
  3907. #define USB_OTG_DOEPCTL_CNAK ((uint32_t)0x04000000) /*!< Clear NAK */
  3908. #define USB_OTG_DOEPCTL_SNAK ((uint32_t)0x08000000) /*!< Set NAK */
  3909. #define USB_OTG_DOEPCTL_EPDIS ((uint32_t)0x40000000) /*!< Endpoint disable */
  3910. #define USB_OTG_DOEPCTL_EPENA ((uint32_t)0x80000000) /*!< Endpoint enable */
  3911. /******************** Bit definition forUSB_OTG_DOEPINT register ********************/
  3912. #define USB_OTG_DOEPINT_XFRC ((uint32_t)0x00000001) /*!< Transfer completed interrupt */
  3913. #define USB_OTG_DOEPINT_EPDISD ((uint32_t)0x00000002) /*!< Endpoint disabled interrupt */
  3914. #define USB_OTG_DOEPINT_STUP ((uint32_t)0x00000008) /*!< SETUP phase done */
  3915. #define USB_OTG_DOEPINT_OTEPDIS ((uint32_t)0x00000010) /*!< OUT token received when endpoint disabled */
  3916. #define USB_OTG_DOEPINT_B2BSTUP ((uint32_t)0x00000040) /*!< Back-to-back SETUP packets received */
  3917. #define USB_OTG_DOEPINT_NYET ((uint32_t)0x00004000) /*!< NYET interrupt */
  3918. /******************** Bit definition forUSB_OTG_DOEPTSIZ register ********************/
  3919. #define USB_OTG_DOEPTSIZ_XFRSIZ ((uint32_t)0x0007FFFF) /*!< Transfer size */
  3920. #define USB_OTG_DOEPTSIZ_PKTCNT ((uint32_t)0x1FF80000) /*!< Packet count */
  3921. #define USB_OTG_DOEPTSIZ_STUPCNT ((uint32_t)0x60000000) /*!< SETUP packet count */
  3922. #define USB_OTG_DOEPTSIZ_STUPCNT_0 ((uint32_t)0x20000000) /*!<Bit 0 */
  3923. #define USB_OTG_DOEPTSIZ_STUPCNT_1 ((uint32_t)0x40000000) /*!<Bit 1 */
  3924. /******************** Bit definition for PCGCCTL register ********************/
  3925. #define USB_OTG_PCGCCTL_STOPCLK ((uint32_t)0x00000001) /*!< SETUP packet count */
  3926. #define USB_OTG_PCGCCTL_GATECLK ((uint32_t)0x00000002) /*!<Bit 0 */
  3927. #define USB_OTG_PCGCCTL_PHYSUSP ((uint32_t)0x00000010) /*!<Bit 1 */
  3928. /**
  3929. * @}
  3930. */
  3931. /**
  3932. * @}
  3933. */
  3934. /** @addtogroup Exported_macros
  3935. * @{
  3936. */
  3937. /******************************* ADC Instances ********************************/
  3938. #define IS_ADC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == ADC1)
  3939. /******************************* CRC Instances ********************************/
  3940. #define IS_CRC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == CRC)
  3941. /******************************** DMA Instances *******************************/
  3942. #define IS_DMA_STREAM_ALL_INSTANCE(INSTANCE) (((INSTANCE) == DMA1_Stream0) || \
  3943. ((INSTANCE) == DMA1_Stream1) || \
  3944. ((INSTANCE) == DMA1_Stream2) || \
  3945. ((INSTANCE) == DMA1_Stream3) || \
  3946. ((INSTANCE) == DMA1_Stream4) || \
  3947. ((INSTANCE) == DMA1_Stream5) || \
  3948. ((INSTANCE) == DMA1_Stream6) || \
  3949. ((INSTANCE) == DMA1_Stream7) || \
  3950. ((INSTANCE) == DMA2_Stream0) || \
  3951. ((INSTANCE) == DMA2_Stream1) || \
  3952. ((INSTANCE) == DMA2_Stream2) || \
  3953. ((INSTANCE) == DMA2_Stream3) || \
  3954. ((INSTANCE) == DMA2_Stream4) || \
  3955. ((INSTANCE) == DMA2_Stream5) || \
  3956. ((INSTANCE) == DMA2_Stream6) || \
  3957. ((INSTANCE) == DMA2_Stream7))
  3958. /******************************* GPIO Instances *******************************/
  3959. #define IS_GPIO_ALL_INSTANCE(INSTANCE) (((INSTANCE) == GPIOA) || \
  3960. ((INSTANCE) == GPIOB) || \
  3961. ((INSTANCE) == GPIOC) || \
  3962. ((INSTANCE) == GPIOD) || \
  3963. ((INSTANCE) == GPIOE) || \
  3964. ((INSTANCE) == GPIOH))
  3965. /******************************** I2C Instances *******************************/
  3966. #define IS_I2C_ALL_INSTANCE(INSTANCE) (((INSTANCE) == I2C1) || \
  3967. ((INSTANCE) == I2C2) || \
  3968. ((INSTANCE) == I2C3))
  3969. /******************************** I2S Instances *******************************/
  3970. #define IS_I2S_ALL_INSTANCE(INSTANCE) (((INSTANCE) == SPI2) || \
  3971. ((INSTANCE) == SPI3))
  3972. /*************************** I2S Extended Instances ***************************/
  3973. #define IS_I2S_ALL_INSTANCE_EXT(PERIPH) (((INSTANCE) == SPI2) || \
  3974. ((INSTANCE) == SPI3) || \
  3975. ((INSTANCE) == I2S2ext) || \
  3976. ((INSTANCE) == I2S3ext))
  3977. /****************************** RTC Instances *********************************/
  3978. #define IS_RTC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == RTC)
  3979. /******************************** SPI Instances *******************************/
  3980. #define IS_SPI_ALL_INSTANCE(INSTANCE) (((INSTANCE) == SPI1) || \
  3981. ((INSTANCE) == SPI2) || \
  3982. ((INSTANCE) == SPI3) || \
  3983. ((INSTANCE) == SPI4))
  3984. /*************************** SPI Extended Instances ***************************/
  3985. #define IS_SPI_ALL_INSTANCE_EXT(INSTANCE) (((INSTANCE) == SPI1) || \
  3986. ((INSTANCE) == SPI2) || \
  3987. ((INSTANCE) == SPI3) || \
  3988. ((INSTANCE) == I2S2ext) || \
  3989. ((INSTANCE) == I2S3ext))
  3990. /****************** TIM Instances : All supported instances *******************/
  3991. #define IS_TIM_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  3992. ((INSTANCE) == TIM2) || \
  3993. ((INSTANCE) == TIM3) || \
  3994. ((INSTANCE) == TIM4) || \
  3995. ((INSTANCE) == TIM5) || \
  3996. ((INSTANCE) == TIM9) || \
  3997. ((INSTANCE) == TIM10) || \
  3998. ((INSTANCE) == TIM11))
  3999. /************* TIM Instances : at least 1 capture/compare channel *************/
  4000. #define IS_TIM_CC1_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  4001. ((INSTANCE) == TIM2) || \
  4002. ((INSTANCE) == TIM3) || \
  4003. ((INSTANCE) == TIM4) || \
  4004. ((INSTANCE) == TIM5) || \
  4005. ((INSTANCE) == TIM9) || \
  4006. ((INSTANCE) == TIM10) || \
  4007. ((INSTANCE) == TIM11))
  4008. /************ TIM Instances : at least 2 capture/compare channels *************/
  4009. #define IS_TIM_CC2_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  4010. ((INSTANCE) == TIM2) || \
  4011. ((INSTANCE) == TIM3) || \
  4012. ((INSTANCE) == TIM4) || \
  4013. ((INSTANCE) == TIM5) || \
  4014. ((INSTANCE) == TIM9))
  4015. /************ TIM Instances : at least 3 capture/compare channels *************/
  4016. #define IS_TIM_CC3_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  4017. ((INSTANCE) == TIM2) || \
  4018. ((INSTANCE) == TIM3) || \
  4019. ((INSTANCE) == TIM4) || \
  4020. ((INSTANCE) == TIM5))
  4021. /************ TIM Instances : at least 4 capture/compare channels *************/
  4022. #define IS_TIM_CC4_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  4023. ((INSTANCE) == TIM2) || \
  4024. ((INSTANCE) == TIM3) || \
  4025. ((INSTANCE) == TIM4) || \
  4026. ((INSTANCE) == TIM5))
  4027. /******************** TIM Instances : Advanced-control timers *****************/
  4028. #define IS_TIM_ADVANCED_INSTANCE(INSTANCE) ((INSTANCE) == TIM1)
  4029. /******************* TIM Instances : Timer input XOR function *****************/
  4030. #define IS_TIM_XOR_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  4031. ((INSTANCE) == TIM2) || \
  4032. ((INSTANCE) == TIM3) || \
  4033. ((INSTANCE) == TIM4) || \
  4034. ((INSTANCE) == TIM5))
  4035. /****************** TIM Instances : DMA requests generation (UDE) *************/
  4036. #define IS_TIM_DMA_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  4037. ((INSTANCE) == TIM2) || \
  4038. ((INSTANCE) == TIM3) || \
  4039. ((INSTANCE) == TIM4) || \
  4040. ((INSTANCE) == TIM5))
  4041. /************ TIM Instances : DMA requests generation (CCxDE) *****************/
  4042. #define IS_TIM_DMA_CC_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  4043. ((INSTANCE) == TIM2) || \
  4044. ((INSTANCE) == TIM3) || \
  4045. ((INSTANCE) == TIM4) || \
  4046. ((INSTANCE) == TIM5))
  4047. /************ TIM Instances : DMA requests generation (COMDE) *****************/
  4048. #define IS_TIM_CCDMA_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  4049. ((INSTANCE) == TIM2) || \
  4050. ((INSTANCE) == TIM3) || \
  4051. ((INSTANCE) == TIM4) || \
  4052. ((INSTANCE) == TIM5))
  4053. /******************** TIM Instances : DMA burst feature ***********************/
  4054. #define IS_TIM_DMABURST_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  4055. ((INSTANCE) == TIM2) || \
  4056. ((INSTANCE) == TIM3) || \
  4057. ((INSTANCE) == TIM4) || \
  4058. ((INSTANCE) == TIM5))
  4059. /****** TIM Instances : master mode available (TIMx_CR2.MMS available )********/
  4060. #define IS_TIM_MASTER_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  4061. ((INSTANCE) == TIM2) || \
  4062. ((INSTANCE) == TIM3) || \
  4063. ((INSTANCE) == TIM4) || \
  4064. ((INSTANCE) == TIM5) || \
  4065. ((INSTANCE) == TIM9))
  4066. /*********** TIM Instances : Slave mode available (TIMx_SMCR available )*******/
  4067. #define IS_TIM_SLAVE_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  4068. ((INSTANCE) == TIM2) || \
  4069. ((INSTANCE) == TIM3) || \
  4070. ((INSTANCE) == TIM4) || \
  4071. ((INSTANCE) == TIM5) || \
  4072. ((INSTANCE) == TIM9))
  4073. /********************** TIM Instances : 32 bit Counter ************************/
  4074. #define IS_TIM_32B_COUNTER_INSTANCE(INSTANCE)(((INSTANCE) == TIM2) || \
  4075. ((INSTANCE) == TIM5))
  4076. /***************** TIM Instances : external trigger input availabe ************/
  4077. #define IS_TIM_ETR_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \
  4078. ((INSTANCE) == TIM2) || \
  4079. ((INSTANCE) == TIM3) || \
  4080. ((INSTANCE) == TIM4) || \
  4081. ((INSTANCE) == TIM5))
  4082. /****************** TIM Instances : remapping capability **********************/
  4083. #define IS_TIM_REMAP_INSTANCE(INSTANCE) (((INSTANCE) == TIM2) || \
  4084. ((INSTANCE) == TIM5) || \
  4085. ((INSTANCE) == TIM11))
  4086. /******************* TIM Instances : output(s) available **********************/
  4087. #define IS_TIM_CCX_INSTANCE(INSTANCE, CHANNEL) \
  4088. ((((INSTANCE) == TIM1) && \
  4089. (((CHANNEL) == TIM_CHANNEL_1) || \
  4090. ((CHANNEL) == TIM_CHANNEL_2) || \
  4091. ((CHANNEL) == TIM_CHANNEL_3) || \
  4092. ((CHANNEL) == TIM_CHANNEL_4))) \
  4093. || \
  4094. (((INSTANCE) == TIM2) && \
  4095. (((CHANNEL) == TIM_CHANNEL_1) || \
  4096. ((CHANNEL) == TIM_CHANNEL_2) || \
  4097. ((CHANNEL) == TIM_CHANNEL_3) || \
  4098. ((CHANNEL) == TIM_CHANNEL_4))) \
  4099. || \
  4100. (((INSTANCE) == TIM3) && \
  4101. (((CHANNEL) == TIM_CHANNEL_1) || \
  4102. ((CHANNEL) == TIM_CHANNEL_2) || \
  4103. ((CHANNEL) == TIM_CHANNEL_3) || \
  4104. ((CHANNEL) == TIM_CHANNEL_4))) \
  4105. || \
  4106. (((INSTANCE) == TIM4) && \
  4107. (((CHANNEL) == TIM_CHANNEL_1) || \
  4108. ((CHANNEL) == TIM_CHANNEL_2) || \
  4109. ((CHANNEL) == TIM_CHANNEL_3) || \
  4110. ((CHANNEL) == TIM_CHANNEL_4))) \
  4111. || \
  4112. (((INSTANCE) == TIM5) && \
  4113. (((CHANNEL) == TIM_CHANNEL_1) || \
  4114. ((CHANNEL) == TIM_CHANNEL_2) || \
  4115. ((CHANNEL) == TIM_CHANNEL_3) || \
  4116. ((CHANNEL) == TIM_CHANNEL_4))) \
  4117. || \
  4118. (((INSTANCE) == TIM9) && \
  4119. (((CHANNEL) == TIM_CHANNEL_1) || \
  4120. ((CHANNEL) == TIM_CHANNEL_2))) \
  4121. || \
  4122. (((INSTANCE) == TIM10) && \
  4123. (((CHANNEL) == TIM_CHANNEL_1))) \
  4124. || \
  4125. (((INSTANCE) == TIM11) && \
  4126. (((CHANNEL) == TIM_CHANNEL_1))))
  4127. /************ TIM Instances : complementary output(s) available ***************/
  4128. #define IS_TIM_CCXN_INSTANCE(INSTANCE, CHANNEL) \
  4129. ((((INSTANCE) == TIM1) && \
  4130. (((CHANNEL) == TIM_CHANNEL_1) || \
  4131. ((CHANNEL) == TIM_CHANNEL_2) || \
  4132. ((CHANNEL) == TIM_CHANNEL_3))))
  4133. /******************** USART Instances : Synchronous mode **********************/
  4134. #define IS_USART_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \
  4135. ((INSTANCE) == USART2) || \
  4136. ((INSTANCE) == USART6))
  4137. /******************** UART Instances : Asynchronous mode **********************/
  4138. #define IS_UART_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \
  4139. ((INSTANCE) == USART2) || \
  4140. ((INSTANCE) == USART6))
  4141. /****************** UART Instances : Hardware Flow control ********************/
  4142. #define IS_UART_HWFLOW_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \
  4143. ((INSTANCE) == USART2) || \
  4144. ((INSTANCE) == USART6))
  4145. /********************* UART Instances : Smard card mode ***********************/
  4146. #define IS_SMARTCARD_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \
  4147. ((INSTANCE) == USART2) || \
  4148. ((INSTANCE) == USART6))
  4149. /*********************** UART Instances : IRDA mode ***************************/
  4150. #define IS_IRDA_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \
  4151. ((INSTANCE) == USART2) || \
  4152. ((INSTANCE) == USART6))
  4153. /*********************** PCD Instances ****************************************/
  4154. #define IS_PCD_ALL_INSTANCE(INSTANCE) (((INSTANCE) == USB_OTG_FS))
  4155. /*********************** HCD Instances ****************************************/
  4156. #define IS_HCD_ALL_INSTANCE(INSTANCE) (((INSTANCE) == USB_OTG_FS))
  4157. /****************************** IWDG Instances ********************************/
  4158. #define IS_IWDG_ALL_INSTANCE(INSTANCE) ((INSTANCE) == IWDG)
  4159. /****************************** WWDG Instances ********************************/
  4160. #define IS_WWDG_ALL_INSTANCE(INSTANCE) ((INSTANCE) == WWDG)
  4161. /****************************** SDIO Instances ********************************/
  4162. #define IS_SDIO_ALL_INSTANCE(INSTANCE) ((INSTANCE) == SDIO)
  4163. /****************************** USB Exported Constants ************************/
  4164. #define USB_OTG_FS_HOST_MAX_CHANNEL_NBR 8
  4165. #define USB_OTG_FS_MAX_IN_ENDPOINTS 4 /* Including EP0 */
  4166. #define USB_OTG_FS_MAX_OUT_ENDPOINTS 4 /* Including EP0 */
  4167. #define USB_OTG_FS_TOTAL_FIFO_SIZE 1280 /* in Bytes */
  4168. /**
  4169. * @}
  4170. */
  4171. /**
  4172. * @}
  4173. */
  4174. /**
  4175. * @}
  4176. */
  4177. #ifdef __cplusplus
  4178. }
  4179. #endif /* __cplusplus */
  4180. #endif /* __STM32F401xC_H */
  4181. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/