ch32v30x.h 363 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242
  1. /********************************** (C) COPYRIGHT *******************************
  2. * File Name : ch32v30x.h
  3. * Author : WCH
  4. * Version : V1.0.0
  5. * Date : 2021/06/06
  6. * Description : CH32V30x Device Peripheral Access Layer Header File.
  7. * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
  8. * SPDX-License-Identifier: Apache-2.0
  9. *******************************************************************************/
  10. #ifndef __CH32V30x_H
  11. #define __CH32V30x_H
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. //#define CH32V30x_D8 /* CH32V303x */
  16. #define CH32V30x_D8C /* CH32V307x-CH32V305x */
  17. #define __MPU_PRESENT 0 /* Other CH32 devices does not provide an MPU */
  18. #define __Vendor_SysTickConfig 0 /* Set to 1 if different SysTick Config is used */
  19. #define HSE_VALUE ((uint32_t)8000000) /* Value of the External oscillator in Hz */
  20. /* In the following line adjust the External High Speed oscillator (HSE) Startup Timeout value */
  21. #define HSE_STARTUP_TIMEOUT ((uint16_t)0x1000) /* Time out for HSE start up */
  22. #define HSI_VALUE ((uint32_t)8000000) /* Value of the Internal oscillator in Hz */
  23. /* Interrupt Number Definition, according to the selected device */
  24. typedef enum IRQn
  25. {
  26. /****** RISC-V Processor Exceptions Numbers *******************************************************/
  27. NonMaskableInt_IRQn = 2, /* 2 Non Maskable Interrupt */
  28. EXC_IRQn = 3, /* 3 Exception Interrupt */
  29. Ecall_M_Mode_IRQn = 5, /* 5 Ecall M Mode Interrupt */
  30. Ecall_U_Mode_IRQn = 8, /* 8 Ecall U Mode Interrupt */
  31. Break_Point_IRQn = 9, /* 9 Break Point Interrupt */
  32. SysTicK_IRQn = 12, /* 12 System timer Interrupt */
  33. Software_IRQn = 14, /* 14 software Interrupt */
  34. /****** RISC-V specific Interrupt Numbers *********************************************************/
  35. WWDG_IRQn = 16, /* Window WatchDog Interrupt */
  36. PVD_IRQn = 17, /* PVD through EXTI Line detection Interrupt */
  37. TAMPER_IRQn = 18, /* Tamper Interrupt */
  38. RTC_IRQn = 19, /* RTC global Interrupt */
  39. FLASH_IRQn = 20, /* FLASH global Interrupt */
  40. RCC_IRQn = 21, /* RCC global Interrupt */
  41. EXTI0_IRQn = 22, /* EXTI Line0 Interrupt */
  42. EXTI1_IRQn = 23, /* EXTI Line1 Interrupt */
  43. EXTI2_IRQn = 24, /* EXTI Line2 Interrupt */
  44. EXTI3_IRQn = 25, /* EXTI Line3 Interrupt */
  45. EXTI4_IRQn = 26, /* EXTI Line4 Interrupt */
  46. DMA1_Channel1_IRQn = 27, /* DMA1 Channel 1 global Interrupt */
  47. DMA1_Channel2_IRQn = 28, /* DMA1 Channel 2 global Interrupt */
  48. DMA1_Channel3_IRQn = 29, /* DMA1 Channel 3 global Interrupt */
  49. DMA1_Channel4_IRQn = 30, /* DMA1 Channel 4 global Interrupt */
  50. DMA1_Channel5_IRQn = 31, /* DMA1 Channel 5 global Interrupt */
  51. DMA1_Channel6_IRQn = 32, /* DMA1 Channel 6 global Interrupt */
  52. DMA1_Channel7_IRQn = 33, /* DMA1 Channel 7 global Interrupt */
  53. ADC_IRQn = 34, /* ADC1 and ADC2 global Interrupt */
  54. USB_HP_CAN1_TX_IRQn = 35, /* USB Device High Priority or CAN1 TX Interrupts */
  55. USB_LP_CAN1_RX0_IRQn = 36, /* USB Device Low Priority or CAN1 RX0 Interrupts */
  56. CAN1_RX1_IRQn = 37, /* CAN1 RX1 Interrupt */
  57. CAN1_SCE_IRQn = 38, /* CAN1 SCE Interrupt */
  58. EXTI9_5_IRQn = 39, /* External Line[9:5] Interrupts */
  59. TIM1_BRK_IRQn = 40, /* TIM1 Break Interrupt */
  60. TIM1_UP_IRQn = 41, /* TIM1 Update Interrupt */
  61. TIM1_TRG_COM_IRQn = 42, /* TIM1 Trigger and Commutation Interrupt */
  62. TIM1_CC_IRQn = 43, /* TIM1 Capture Compare Interrupt */
  63. TIM2_IRQn = 44, /* TIM2 global Interrupt */
  64. TIM3_IRQn = 45, /* TIM3 global Interrupt */
  65. TIM4_IRQn = 46, /* TIM4 global Interrupt */
  66. I2C1_EV_IRQn = 47, /* I2C1 Event Interrupt */
  67. I2C1_ER_IRQn = 48, /* I2C1 Error Interrupt */
  68. I2C2_EV_IRQn = 49, /* I2C2 Event Interrupt */
  69. I2C2_ER_IRQn = 50, /* I2C2 Error Interrupt */
  70. SPI1_IRQn = 51, /* SPI1 global Interrupt */
  71. SPI2_IRQn = 52, /* SPI2 global Interrupt */
  72. USART1_IRQn = 53, /* USART1 global Interrupt */
  73. USART2_IRQn = 54, /* USART2 global Interrupt */
  74. USART3_IRQn = 55, /* USART3 global Interrupt */
  75. EXTI15_10_IRQn = 56, /* External Line[15:10] Interrupts */
  76. RTCAlarm_IRQn = 57, /* RTC Alarm through EXTI Line Interrupt */
  77. #ifdef CH32V30x_D8
  78. TIM8_BRK_IRQn = 59, /* TIM8 Break Interrupt */
  79. TIM8_UP_IRQn = 60, /* TIM8 Update Interrupt */
  80. TIM8_TRG_COM_IRQn = 61, /* TIM8 Trigger and Commutation Interrupt */
  81. TIM8_CC_IRQn = 62, /* TIM8 Capture Compare Interrupt */
  82. RNG_IRQn = 63, /* RNG global Interrupt */
  83. FSMC_IRQn = 64, /* FSMC global Interrupt */
  84. SDIO_IRQn = 65, /* SDIO global Interrupt */
  85. TIM5_IRQn = 66, /* TIM5 global Interrupt */
  86. SPI3_IRQn = 67, /* SPI3 global Interrupt */
  87. UART4_IRQn = 68, /* UART4 global Interrupt */
  88. UART5_IRQn = 69, /* UART5 global Interrupt */
  89. TIM6_IRQn = 70, /* TIM6 global Interrupt */
  90. TIM7_IRQn = 71, /* TIM7 global Interrupt */
  91. DMA2_Channel1_IRQn = 72, /* DMA2 Channel 1 global Interrupt */
  92. DMA2_Channel2_IRQn = 73, /* DMA2 Channel 2 global Interrupt */
  93. DMA2_Channel3_IRQn = 74, /* DMA2 Channel 3 global Interrupt */
  94. DMA2_Channel4_IRQn = 75, /* DMA2 Channel 4 global Interrupt */
  95. DMA2_Channel5_IRQn = 76, /* DMA2 Channel 5 global Interrupt */
  96. OTG_FS_IRQn = 83, /* OTGFS global Interrupt */
  97. UART6_IRQn = 87, /* UART6 global Interrupt */
  98. UART7_IRQn = 88, /* UART7 global Interrupt */
  99. UART8_IRQn = 89, /* UART8 global Interrupt */
  100. TIM9_BRK_IRQn = 90, /* TIM9 Break Interrupt */
  101. TIM9_UP_IRQn = 91, /* TIM9 Update Interrupt */
  102. TIM9_TRG_COM_IRQn = 92, /* TIM9 Trigger and Commutation Interrupt */
  103. TIM9_CC_IRQn = 93, /* TIM9 Capture Compare Interrupt */
  104. TIM10_BRK_IRQn = 94, /* TIM10 Break Interrupt */
  105. TIM10_UP_IRQn = 95, /* TIM10 Update Interrupt */
  106. TIM10_TRG_COM_IRQn = 96, /* TIM10 Trigger and Commutation Interrupt */
  107. TIM10_CC_IRQn = 97, /* TIM10 Capture Compare Interrupt */
  108. DMA2_Channel6_IRQn = 98, /* DMA2 Channel 6 global Interrupt */
  109. DMA2_Channel7_IRQn = 99, /* DMA2 Channel 7 global Interrupt */
  110. DMA2_Channel8_IRQn = 100, /* DMA2 Channel 8 global Interrupt */
  111. DMA2_Channel9_IRQn = 101, /* DMA2 Channel 9 global Interrupt */
  112. DMA2_Channel10_IRQn = 102, /* DMA2 Channel 10 global Interrupt */
  113. DMA2_Channel11_IRQn = 103, /* DMA2 Channel 11 global Interrupt */
  114. #endif
  115. #ifdef CH32V30x_D8C
  116. USBWakeUp_IRQn = 58, /* USB Device WakeUp from suspend through EXTI Line Interrupt */
  117. TIM8_BRK_IRQn = 59, /* TIM8 Break Interrupt */
  118. TIM8_UP_IRQn = 60, /* TIM8 Update Interrupt */
  119. TIM8_TRG_COM_IRQn = 61, /* TIM8 Trigger and Commutation Interrupt */
  120. TIM8_CC_IRQn = 62, /* TIM8 Capture Compare Interrupt */
  121. RNG_IRQn = 63, /* RNG global Interrupt */
  122. FSMC_IRQn = 64, /* FSMC global Interrupt */
  123. SDIO_IRQn = 65, /* SDIO global Interrupt */
  124. TIM5_IRQn = 66, /* TIM5 global Interrupt */
  125. SPI3_IRQn = 67, /* SPI3 global Interrupt */
  126. UART4_IRQn = 68, /* UART4 global Interrupt */
  127. UART5_IRQn = 69, /* UART5 global Interrupt */
  128. TIM6_IRQn = 70, /* TIM6 global Interrupt */
  129. TIM7_IRQn = 71, /* TIM7 global Interrupt */
  130. DMA2_Channel1_IRQn = 72, /* DMA2 Channel 1 global Interrupt */
  131. DMA2_Channel2_IRQn = 73, /* DMA2 Channel 2 global Interrupt */
  132. DMA2_Channel3_IRQn = 74, /* DMA2 Channel 3 global Interrupt */
  133. DMA2_Channel4_IRQn = 75, /* DMA2 Channel 4 global Interrupt */
  134. DMA2_Channel5_IRQn = 76, /* DMA2 Channel 5 global Interrupt */
  135. ETH_IRQn = 77, /* ETH global Interrupt */
  136. ETH_WKUP_IRQn = 78, /* ETH WakeUp Interrupt */
  137. CAN2_TX_IRQn = 79, /* CAN2 TX Interrupts */
  138. CAN2_RX0_IRQn = 80, /* CAN2 RX0 Interrupts */
  139. CAN2_RX1_IRQn = 81, /* CAN2 RX1 Interrupt */
  140. CAN2_SCE_IRQn = 82, /* CAN2 SCE Interrupt */
  141. OTG_FS_IRQn = 83, /* OTGFS global Interrupt */
  142. USBHSWakeup_IRQn = 84, /* USBHS WakeUp Interrupt */
  143. USBHS_IRQn = 85, /* USBHS global Interrupt */
  144. DVP_IRQn = 86, /* DVP global Interrupt */
  145. UART6_IRQn = 87, /* UART6 global Interrupt */
  146. UART7_IRQn = 88, /* UART7 global Interrupt */
  147. UART8_IRQn = 89, /* UART8 global Interrupt */
  148. TIM9_BRK_IRQn = 90, /* TIM9 Break Interrupt */
  149. TIM9_UP_IRQn = 91, /* TIM9 Update Interrupt */
  150. TIM9_TRG_COM_IRQn = 92, /* TIM9 Trigger and Commutation Interrupt */
  151. TIM9_CC_IRQn = 93, /* TIM9 Capture Compare Interrupt */
  152. TIM10_BRK_IRQn = 94, /* TIM10 Break Interrupt */
  153. TIM10_UP_IRQn = 95, /* TIM10 Update Interrupt */
  154. TIM10_TRG_COM_IRQn = 96, /* TIM10 Trigger and Commutation Interrupt */
  155. TIM10_CC_IRQn = 97, /* TIM10 Capture Compare Interrupt */
  156. DMA2_Channel6_IRQn = 98, /* DMA2 Channel 6 global Interrupt */
  157. DMA2_Channel7_IRQn = 99, /* DMA2 Channel 7 global Interrupt */
  158. DMA2_Channel8_IRQn = 100, /* DMA2 Channel 8 global Interrupt */
  159. DMA2_Channel9_IRQn = 101, /* DMA2 Channel 9 global Interrupt */
  160. DMA2_Channel10_IRQn = 102, /* DMA2 Channel 10 global Interrupt */
  161. DMA2_Channel11_IRQn = 103, /* DMA2 Channel 11 global Interrupt */
  162. #endif
  163. } IRQn_Type;
  164. #define HardFault_IRQn EXC_IRQn
  165. #define ADC1_2_IRQn ADC_IRQn
  166. #include <stdint.h>
  167. #include "core_riscv.h"
  168. #include "system_ch32v30x.h"
  169. /* Standard Peripheral Library old definitions (maintained for legacy purpose) */
  170. #define HSI_Value HSI_VALUE
  171. #define HSE_Value HSE_VALUE
  172. #define HSEStartUp_TimeOut HSE_STARTUP_TIMEOUT
  173. /* Analog to Digital Converter */
  174. typedef struct
  175. {
  176. __IO uint32_t STATR;
  177. __IO uint32_t CTLR1;
  178. __IO uint32_t CTLR2;
  179. __IO uint32_t SAMPTR1;
  180. __IO uint32_t SAMPTR2;
  181. __IO uint32_t IOFR1;
  182. __IO uint32_t IOFR2;
  183. __IO uint32_t IOFR3;
  184. __IO uint32_t IOFR4;
  185. __IO uint32_t WDHTR;
  186. __IO uint32_t WDLTR;
  187. __IO uint32_t RSQR1;
  188. __IO uint32_t RSQR2;
  189. __IO uint32_t RSQR3;
  190. __IO uint32_t ISQR;
  191. __IO uint32_t IDATAR1;
  192. __IO uint32_t IDATAR2;
  193. __IO uint32_t IDATAR3;
  194. __IO uint32_t IDATAR4;
  195. __IO uint32_t RDATAR;
  196. } ADC_TypeDef;
  197. /* Backup Registers */
  198. typedef struct
  199. {
  200. uint32_t RESERVED0;
  201. __IO uint16_t DATAR1;
  202. uint16_t RESERVED1;
  203. __IO uint16_t DATAR2;
  204. uint16_t RESERVED2;
  205. __IO uint16_t DATAR3;
  206. uint16_t RESERVED3;
  207. __IO uint16_t DATAR4;
  208. uint16_t RESERVED4;
  209. __IO uint16_t DATAR5;
  210. uint16_t RESERVED5;
  211. __IO uint16_t DATAR6;
  212. uint16_t RESERVED6;
  213. __IO uint16_t DATAR7;
  214. uint16_t RESERVED7;
  215. __IO uint16_t DATAR8;
  216. uint16_t RESERVED8;
  217. __IO uint16_t DATAR9;
  218. uint16_t RESERVED9;
  219. __IO uint16_t DATAR10;
  220. uint16_t RESERVED10;
  221. __IO uint16_t OCTLR;
  222. uint16_t RESERVED11;
  223. __IO uint16_t TPCTLR;
  224. uint16_t RESERVED12;
  225. __IO uint16_t TPCSR;
  226. uint16_t RESERVED13[5];
  227. __IO uint16_t DATAR11;
  228. uint16_t RESERVED14;
  229. __IO uint16_t DATAR12;
  230. uint16_t RESERVED15;
  231. __IO uint16_t DATAR13;
  232. uint16_t RESERVED16;
  233. __IO uint16_t DATAR14;
  234. uint16_t RESERVED17;
  235. __IO uint16_t DATAR15;
  236. uint16_t RESERVED18;
  237. __IO uint16_t DATAR16;
  238. uint16_t RESERVED19;
  239. __IO uint16_t DATAR17;
  240. uint16_t RESERVED20;
  241. __IO uint16_t DATAR18;
  242. uint16_t RESERVED21;
  243. __IO uint16_t DATAR19;
  244. uint16_t RESERVED22;
  245. __IO uint16_t DATAR20;
  246. uint16_t RESERVED23;
  247. __IO uint16_t DATAR21;
  248. uint16_t RESERVED24;
  249. __IO uint16_t DATAR22;
  250. uint16_t RESERVED25;
  251. __IO uint16_t DATAR23;
  252. uint16_t RESERVED26;
  253. __IO uint16_t DATAR24;
  254. uint16_t RESERVED27;
  255. __IO uint16_t DATAR25;
  256. uint16_t RESERVED28;
  257. __IO uint16_t DATAR26;
  258. uint16_t RESERVED29;
  259. __IO uint16_t DATAR27;
  260. uint16_t RESERVED30;
  261. __IO uint16_t DATAR28;
  262. uint16_t RESERVED31;
  263. __IO uint16_t DATAR29;
  264. uint16_t RESERVED32;
  265. __IO uint16_t DATAR30;
  266. uint16_t RESERVED33;
  267. __IO uint16_t DATAR31;
  268. uint16_t RESERVED34;
  269. __IO uint16_t DATAR32;
  270. uint16_t RESERVED35;
  271. __IO uint16_t DATAR33;
  272. uint16_t RESERVED36;
  273. __IO uint16_t DATAR34;
  274. uint16_t RESERVED37;
  275. __IO uint16_t DATAR35;
  276. uint16_t RESERVED38;
  277. __IO uint16_t DATAR36;
  278. uint16_t RESERVED39;
  279. __IO uint16_t DATAR37;
  280. uint16_t RESERVED40;
  281. __IO uint16_t DATAR38;
  282. uint16_t RESERVED41;
  283. __IO uint16_t DATAR39;
  284. uint16_t RESERVED42;
  285. __IO uint16_t DATAR40;
  286. uint16_t RESERVED43;
  287. __IO uint16_t DATAR41;
  288. uint16_t RESERVED44;
  289. __IO uint16_t DATAR42;
  290. uint16_t RESERVED45;
  291. } BKP_TypeDef;
  292. /* Controller Area Network TxMailBox */
  293. typedef struct
  294. {
  295. __IO uint32_t TXMIR;
  296. __IO uint32_t TXMDTR;
  297. __IO uint32_t TXMDLR;
  298. __IO uint32_t TXMDHR;
  299. } CAN_TxMailBox_TypeDef;
  300. /* Controller Area Network FIFOMailBox */
  301. typedef struct
  302. {
  303. __IO uint32_t RXMIR;
  304. __IO uint32_t RXMDTR;
  305. __IO uint32_t RXMDLR;
  306. __IO uint32_t RXMDHR;
  307. } CAN_FIFOMailBox_TypeDef;
  308. /* Controller Area Network FilterRegister */
  309. typedef struct
  310. {
  311. __IO uint32_t FR1;
  312. __IO uint32_t FR2;
  313. } CAN_FilterRegister_TypeDef;
  314. /* Controller Area Network */
  315. typedef struct
  316. {
  317. __IO uint32_t CTLR;
  318. __IO uint32_t STATR;
  319. __IO uint32_t TSTATR;
  320. __IO uint32_t RFIFO0;
  321. __IO uint32_t RFIFO1;
  322. __IO uint32_t INTENR;
  323. __IO uint32_t ERRSR;
  324. __IO uint32_t BTIMR;
  325. uint32_t RESERVED0[88];
  326. CAN_TxMailBox_TypeDef sTxMailBox[3];
  327. CAN_FIFOMailBox_TypeDef sFIFOMailBox[2];
  328. uint32_t RESERVED1[12];
  329. __IO uint32_t FCTLR;
  330. __IO uint32_t FMCFGR;
  331. uint32_t RESERVED2;
  332. __IO uint32_t FSCFGR;
  333. uint32_t RESERVED3;
  334. __IO uint32_t FAFIFOR;
  335. uint32_t RESERVED4;
  336. __IO uint32_t FWR;
  337. uint32_t RESERVED5[8];
  338. CAN_FilterRegister_TypeDef sFilterRegister[28];
  339. } CAN_TypeDef;
  340. /* CRC Calculation Unit */
  341. typedef struct
  342. {
  343. __IO uint32_t DATAR;
  344. __IO uint8_t IDATAR;
  345. uint8_t RESERVED0;
  346. uint16_t RESERVED1;
  347. __IO uint32_t CTLR;
  348. } CRC_TypeDef;
  349. /* Digital to Analog Converter */
  350. typedef struct
  351. {
  352. __IO uint32_t CTLR;
  353. __IO uint32_t SWTR;
  354. __IO uint32_t R12BDHR1;
  355. __IO uint32_t L12BDHR1;
  356. __IO uint32_t R8BDHR1;
  357. __IO uint32_t R12BDHR2;
  358. __IO uint32_t L12BDHR2;
  359. __IO uint32_t R8BDHR2;
  360. __IO uint32_t RD12BDHR;
  361. __IO uint32_t LD12BDHR;
  362. __IO uint32_t RD8BDHR;
  363. __IO uint32_t DOR1;
  364. __IO uint32_t DOR2;
  365. } DAC_TypeDef;
  366. /* DMA Channel Controller */
  367. typedef struct
  368. {
  369. __IO uint32_t CFGR;
  370. __IO uint32_t CNTR;
  371. __IO uint32_t PADDR;
  372. __IO uint32_t MADDR;
  373. } DMA_Channel_TypeDef;
  374. /* DMA Controller */
  375. typedef struct
  376. {
  377. __IO uint32_t INTFR;
  378. __IO uint32_t INTFCR;
  379. } DMA_TypeDef;
  380. /* External Interrupt/Event Controller */
  381. typedef struct
  382. {
  383. __IO uint32_t INTENR;
  384. __IO uint32_t EVENR;
  385. __IO uint32_t RTENR;
  386. __IO uint32_t FTENR;
  387. __IO uint32_t SWIEVR;
  388. __IO uint32_t INTFR;
  389. } EXTI_TypeDef;
  390. /* FLASH Registers */
  391. typedef struct
  392. {
  393. __IO uint32_t ACTLR;
  394. __IO uint32_t KEYR;
  395. __IO uint32_t OBKEYR;
  396. __IO uint32_t STATR;
  397. __IO uint32_t CTLR;
  398. __IO uint32_t ADDR;
  399. __IO uint32_t RESERVED;
  400. __IO uint32_t OBR;
  401. __IO uint32_t WPR;
  402. __IO uint32_t MODEKEYR;
  403. } FLASH_TypeDef;
  404. /* Option Bytes Registers */
  405. typedef struct
  406. {
  407. __IO uint16_t RDPR;
  408. __IO uint16_t USER;
  409. __IO uint16_t Data0;
  410. __IO uint16_t Data1;
  411. __IO uint16_t WRPR0;
  412. __IO uint16_t WRPR1;
  413. __IO uint16_t WRPR2;
  414. __IO uint16_t WRPR3;
  415. } OB_TypeDef;
  416. /* FSMC Bank1 Registers */
  417. typedef struct
  418. {
  419. __IO uint32_t BTCR[8];
  420. } FSMC_Bank1_TypeDef;
  421. /* FSMC Bank1E Registers */
  422. typedef struct
  423. {
  424. __IO uint32_t BWTR[7];
  425. } FSMC_Bank1E_TypeDef;
  426. /* FSMC Bank2 Registers */
  427. typedef struct
  428. {
  429. __IO uint32_t PCR2;
  430. __IO uint32_t SR2;
  431. __IO uint32_t PMEM2;
  432. __IO uint32_t PATT2;
  433. uint32_t RESERVED0;
  434. __IO uint32_t ECCR2;
  435. } FSMC_Bank2_TypeDef;
  436. /* General Purpose I/O */
  437. typedef struct
  438. {
  439. __IO uint32_t CFGLR;
  440. __IO uint32_t CFGHR;
  441. __IO uint32_t INDR;
  442. __IO uint32_t OUTDR;
  443. __IO uint32_t BSHR;
  444. __IO uint32_t BCR;
  445. __IO uint32_t LCKR;
  446. } GPIO_TypeDef;
  447. /* Alternate Function I/O */
  448. typedef struct
  449. {
  450. __IO uint32_t ECR;
  451. __IO uint32_t PCFR1;
  452. __IO uint32_t EXTICR[4];
  453. uint32_t RESERVED0;
  454. __IO uint32_t PCFR2;
  455. } AFIO_TypeDef;
  456. /* Inter Integrated Circuit Interface */
  457. typedef struct
  458. {
  459. __IO uint16_t CTLR1;
  460. uint16_t RESERVED0;
  461. __IO uint16_t CTLR2;
  462. uint16_t RESERVED1;
  463. __IO uint16_t OADDR1;
  464. uint16_t RESERVED2;
  465. __IO uint16_t OADDR2;
  466. uint16_t RESERVED3;
  467. __IO uint16_t DATAR;
  468. uint16_t RESERVED4;
  469. __IO uint16_t STAR1;
  470. uint16_t RESERVED5;
  471. __IO uint16_t STAR2;
  472. uint16_t RESERVED6;
  473. __IO uint16_t CKCFGR;
  474. uint16_t RESERVED7;
  475. __IO uint16_t RTR;
  476. uint16_t RESERVED8;
  477. } I2C_TypeDef;
  478. /* Independent WatchDog */
  479. typedef struct
  480. {
  481. __IO uint32_t CTLR;
  482. __IO uint32_t PSCR;
  483. __IO uint32_t RLDR;
  484. __IO uint32_t STATR;
  485. } IWDG_TypeDef;
  486. /* Power Control */
  487. typedef struct
  488. {
  489. __IO uint32_t CTLR;
  490. __IO uint32_t CSR;
  491. } PWR_TypeDef;
  492. /* Reset and Clock Control */
  493. typedef struct
  494. {
  495. __IO uint32_t CTLR;
  496. __IO uint32_t CFGR0;
  497. __IO uint32_t INTR;
  498. __IO uint32_t APB2PRSTR;
  499. __IO uint32_t APB1PRSTR;
  500. __IO uint32_t AHBPCENR;
  501. __IO uint32_t APB2PCENR;
  502. __IO uint32_t APB1PCENR;
  503. __IO uint32_t BDCTLR;
  504. __IO uint32_t RSTSCKR;
  505. __IO uint32_t AHBRSTR;
  506. __IO uint32_t CFGR2;
  507. } RCC_TypeDef;
  508. /* Real-Time Clock */
  509. typedef struct
  510. {
  511. __IO uint16_t CTLRH;
  512. uint16_t RESERVED0;
  513. __IO uint16_t CTLRL;
  514. uint16_t RESERVED1;
  515. __IO uint16_t PSCRH;
  516. uint16_t RESERVED2;
  517. __IO uint16_t PSCRL;
  518. uint16_t RESERVED3;
  519. __IO uint16_t DIVH;
  520. uint16_t RESERVED4;
  521. __IO uint16_t DIVL;
  522. uint16_t RESERVED5;
  523. __IO uint16_t CNTH;
  524. uint16_t RESERVED6;
  525. __IO uint16_t CNTL;
  526. uint16_t RESERVED7;
  527. __IO uint16_t ALRMH;
  528. uint16_t RESERVED8;
  529. __IO uint16_t ALRML;
  530. uint16_t RESERVED9;
  531. } RTC_TypeDef;
  532. /* SDIO Registers */
  533. typedef struct
  534. {
  535. __IO uint32_t POWER;
  536. __IO uint32_t CLKCR;
  537. __IO uint32_t ARG;
  538. __IO uint32_t CMD;
  539. __I uint32_t RESPCMD;
  540. __I uint32_t RESP1;
  541. __I uint32_t RESP2;
  542. __I uint32_t RESP3;
  543. __I uint32_t RESP4;
  544. __IO uint32_t DTIMER;
  545. __IO uint32_t DLEN;
  546. __IO uint32_t DCTRL;
  547. __I uint32_t DCOUNT;
  548. __I uint32_t STA;
  549. __IO uint32_t ICR;
  550. __IO uint32_t MASK;
  551. uint32_t RESERVED0[2];
  552. __I uint32_t FIFOCNT;
  553. uint32_t RESERVED1[13];
  554. __IO uint32_t FIFO;
  555. } SDIO_TypeDef;
  556. /* Serial Peripheral Interface */
  557. typedef struct
  558. {
  559. __IO uint16_t CTLR1;
  560. uint16_t RESERVED0;
  561. __IO uint16_t CTLR2;
  562. uint16_t RESERVED1;
  563. __IO uint16_t STATR;
  564. uint16_t RESERVED2;
  565. __IO uint16_t DATAR;
  566. uint16_t RESERVED3;
  567. __IO uint16_t CRCR;
  568. uint16_t RESERVED4;
  569. __IO uint16_t RCRCR;
  570. uint16_t RESERVED5;
  571. __IO uint16_t TCRCR;
  572. uint16_t RESERVED6;
  573. __IO uint16_t I2SCFGR;
  574. uint16_t RESERVED7;
  575. __IO uint16_t I2SPR;
  576. uint16_t RESERVED8;
  577. __IO uint16_t HSCR;
  578. uint16_t RESERVED9;
  579. } SPI_TypeDef;
  580. /* TIM */
  581. typedef struct
  582. {
  583. __IO uint16_t CTLR1;
  584. uint16_t RESERVED0;
  585. __IO uint16_t CTLR2;
  586. uint16_t RESERVED1;
  587. __IO uint16_t SMCFGR;
  588. uint16_t RESERVED2;
  589. __IO uint16_t DMAINTENR;
  590. uint16_t RESERVED3;
  591. __IO uint16_t INTFR;
  592. uint16_t RESERVED4;
  593. __IO uint16_t SWEVGR;
  594. uint16_t RESERVED5;
  595. __IO uint16_t CHCTLR1;
  596. uint16_t RESERVED6;
  597. __IO uint16_t CHCTLR2;
  598. uint16_t RESERVED7;
  599. __IO uint16_t CCER;
  600. uint16_t RESERVED8;
  601. __IO uint16_t CNT;
  602. uint16_t RESERVED9;
  603. __IO uint16_t PSC;
  604. uint16_t RESERVED10;
  605. __IO uint16_t ATRLR;
  606. uint16_t RESERVED11;
  607. __IO uint16_t RPTCR;
  608. uint16_t RESERVED12;
  609. __IO uint16_t CH1CVR;
  610. uint16_t RESERVED13;
  611. __IO uint16_t CH2CVR;
  612. uint16_t RESERVED14;
  613. __IO uint16_t CH3CVR;
  614. uint16_t RESERVED15;
  615. __IO uint16_t CH4CVR;
  616. uint16_t RESERVED16;
  617. __IO uint16_t BDTR;
  618. uint16_t RESERVED17;
  619. __IO uint16_t DMACFGR;
  620. uint16_t RESERVED18;
  621. __IO uint16_t DMAADR;
  622. uint16_t RESERVED19;
  623. } TIM_TypeDef;
  624. /* Universal Synchronous Asynchronous Receiver Transmitter */
  625. typedef struct
  626. {
  627. __IO uint16_t STATR;
  628. uint16_t RESERVED0;
  629. __IO uint16_t DATAR;
  630. uint16_t RESERVED1;
  631. __IO uint16_t BRR;
  632. uint16_t RESERVED2;
  633. __IO uint16_t CTLR1;
  634. uint16_t RESERVED3;
  635. __IO uint16_t CTLR2;
  636. uint16_t RESERVED4;
  637. __IO uint16_t CTLR3;
  638. uint16_t RESERVED5;
  639. __IO uint16_t GPR;
  640. uint16_t RESERVED6;
  641. } USART_TypeDef;
  642. /* Window WatchDog */
  643. typedef struct
  644. {
  645. __IO uint32_t CTLR;
  646. __IO uint32_t CFGR;
  647. __IO uint32_t STATR;
  648. } WWDG_TypeDef;
  649. /* Enhanced Registers */
  650. typedef struct
  651. {
  652. __IO uint32_t EXTEN_CTR;
  653. } EXTEN_TypeDef;
  654. /* OPA Registers */
  655. typedef struct
  656. {
  657. __IO uint32_t CR;
  658. } OPA_TypeDef;
  659. /* RNG Registers */
  660. typedef struct
  661. {
  662. __IO uint32_t CR;
  663. __IO uint32_t SR;
  664. __IO uint32_t DR;
  665. } RNG_TypeDef;
  666. /* DVP Registers */
  667. typedef struct
  668. {
  669. __IO uint8_t CR0;
  670. __IO uint8_t CR1;
  671. __IO uint8_t IER;
  672. __IO uint8_t Reserved0;
  673. __IO uint16_t ROW_NUM;
  674. __IO uint16_t COL_NUM;
  675. __IO uint32_t DMA_BUF0;
  676. __IO uint32_t DMA_BUF1;
  677. __IO uint8_t IFR;
  678. __IO uint8_t STATUS;
  679. __IO uint16_t Reserved1;
  680. __IO uint16_t ROW_CNT;
  681. __IO uint16_t Reserved2;
  682. __IO uint16_t HOFFCNT;
  683. __IO uint16_t VST;
  684. __IO uint16_t CAPCNT;
  685. __IO uint16_t VLINE;
  686. __IO uint32_t DR;
  687. } DVP_TypeDef;
  688. /* USBHS Registers */
  689. typedef struct
  690. {
  691. __IO uint8_t CONTROL;
  692. __IO uint8_t HOST_CTRL;
  693. __IO uint8_t INT_EN;
  694. __IO uint8_t DEV_AD;
  695. __IO uint16_t FRAME_NO;
  696. __IO uint8_t SUSPEND;
  697. __IO uint8_t RESERVED0;
  698. __IO uint8_t SPEED_TYPE;
  699. __IO uint8_t MIS_ST;
  700. __IO uint8_t INT_FG;
  701. __IO uint8_t INT_ST;
  702. __IO uint16_t RX_LEN;
  703. __IO uint16_t RESERVED1;
  704. __IO uint32_t ENDP_CONFIG;
  705. __IO uint32_t ENDP_TYPE;
  706. __IO uint32_t BUF_MODE;
  707. __IO uint32_t UEP0_DMA;
  708. __IO uint32_t UEP1_RX_DMA;
  709. __IO uint32_t UEP2_RX_DMA;
  710. __IO uint32_t UEP3_RX_DMA;
  711. __IO uint32_t UEP4_RX_DMA;
  712. __IO uint32_t UEP5_RX_DMA;
  713. __IO uint32_t UEP6_RX_DMA;
  714. __IO uint32_t UEP7_RX_DMA;
  715. __IO uint32_t UEP8_RX_DMA;
  716. __IO uint32_t UEP9_RX_DMA;
  717. __IO uint32_t UEP10_RX_DMA;
  718. __IO uint32_t UEP11_RX_DMA;
  719. __IO uint32_t UEP12_RX_DMA;
  720. __IO uint32_t UEP13_RX_DMA;
  721. __IO uint32_t UEP14_RX_DMA;
  722. __IO uint32_t UEP15_RX_DMA;
  723. __IO uint32_t UEP1_TX_DMA;
  724. __IO uint32_t UEP2_TX_DMA;
  725. __IO uint32_t UEP3_TX_DMA;
  726. __IO uint32_t UEP4_TX_DMA;
  727. __IO uint32_t UEP5_TX_DMA;
  728. __IO uint32_t UEP6_TX_DMA;
  729. __IO uint32_t UEP7_TX_DMA;
  730. __IO uint32_t UEP8_TX_DMA;
  731. __IO uint32_t UEP9_TX_DMA;
  732. __IO uint32_t UEP10_TX_DMA;
  733. __IO uint32_t UEP11_TX_DMA;
  734. __IO uint32_t UEP12_TX_DMA;
  735. __IO uint32_t UEP13_TX_DMA;
  736. __IO uint32_t UEP14_TX_DMA;
  737. __IO uint32_t UEP15_TX_DMA;
  738. __IO uint16_t UEP0_MAX_LEN;
  739. __IO uint16_t RESERVED2;
  740. __IO uint16_t UEP1_MAX_LEN;
  741. __IO uint16_t RESERVED3;
  742. __IO uint16_t UEP2_MAX_LEN;
  743. __IO uint16_t RESERVED4;
  744. __IO uint16_t UEP3_MAX_LEN;
  745. __IO uint16_t RESERVED5;
  746. __IO uint16_t UEP4_MAX_LEN;
  747. __IO uint16_t RESERVED6;
  748. __IO uint16_t UEP5_MAX_LEN;
  749. __IO uint16_t RESERVED7;
  750. __IO uint16_t UEP6_MAX_LEN;
  751. __IO uint16_t RESERVED8;
  752. __IO uint16_t UEP7_MAX_LEN;
  753. __IO uint16_t RESERVED9;
  754. __IO uint16_t UEP8_MAX_LEN;
  755. __IO uint16_t RESERVED10;
  756. __IO uint16_t UEP9_MAX_LEN;
  757. __IO uint16_t RESERVED11;
  758. __IO uint16_t UEP10_MAX_LEN;
  759. __IO uint16_t RESERVED12;
  760. __IO uint16_t UEP11_MAX_LEN;
  761. __IO uint16_t RESERVED13;
  762. __IO uint16_t UEP12_MAX_LEN;
  763. __IO uint16_t RESERVED14;
  764. __IO uint16_t UEP13_MAX_LEN;
  765. __IO uint16_t RESERVED15;
  766. __IO uint16_t UEP14_MAX_LEN;
  767. __IO uint16_t RESERVED16;
  768. __IO uint16_t UEP15_MAX_LEN;
  769. __IO uint16_t RESERVED17;
  770. __IO uint16_t UEP0_TX_LEN;
  771. __IO uint8_t UEP0_TX_CTRL;
  772. __IO uint8_t UEP0_RX_CTRL;
  773. __IO uint16_t UEP1_TX_LEN;
  774. __IO uint8_t UEP1_TX_CTRL;
  775. __IO uint8_t UEP1_RX_CTRL;
  776. __IO uint16_t UEP2_TX_LEN;
  777. __IO uint8_t UEP2_TX_CTRL;
  778. __IO uint8_t UEP2_RX_CTRL;
  779. __IO uint16_t UEP3_TX_LEN;
  780. __IO uint8_t UEP3_TX_CTRL;
  781. __IO uint8_t UEP3_RX_CTRL;
  782. __IO uint16_t UEP4_TX_LEN;
  783. __IO uint8_t UEP4_TX_CTRL;
  784. __IO uint8_t UEP4_RX_CTRL;
  785. __IO uint16_t UEP5_TX_LEN;
  786. __IO uint8_t UEP5_TX_CTRL;
  787. __IO uint8_t UEP5_RX_CTRL;
  788. __IO uint16_t UEP6_TX_LEN;
  789. __IO uint8_t UEP6_TX_CTRL;
  790. __IO uint8_t UEP6_RX_CTRL;
  791. __IO uint16_t UEP7_TX_LEN;
  792. __IO uint8_t UEP7_TX_CTRL;
  793. __IO uint8_t UEP7_RX_CTRL;
  794. __IO uint16_t UEP8_TX_LEN;
  795. __IO uint8_t UEP8_TX_CTRL;
  796. __IO uint8_t UEP8_RX_CTRL;
  797. __IO uint16_t UEP9_TX_LEN;
  798. __IO uint8_t UEP9_TX_CTRL;
  799. __IO uint8_t UEP9_RX_CTRL;
  800. __IO uint16_t UEP10_TX_LEN;
  801. __IO uint8_t UEP10_TX_CTRL;
  802. __IO uint8_t UEP10_RX_CTRL;
  803. __IO uint16_t UEP11_TX_LEN;
  804. __IO uint8_t UEP11_TX_CTRL;
  805. __IO uint8_t UEP11_RX_CTRL;
  806. __IO uint16_t UEP12_TX_LEN;
  807. __IO uint8_t UEP12_TX_CTRL;
  808. __IO uint8_t UEP12_RX_CTRL;
  809. __IO uint16_t UEP13_TX_LEN;
  810. __IO uint8_t UEP13_TX_CTRL;
  811. __IO uint8_t UEP13_RX_CTRL;
  812. __IO uint16_t UEP14_TX_LEN;
  813. __IO uint8_t UEP14_TX_CTRL;
  814. __IO uint8_t UEP14_RX_CTRL;
  815. __IO uint16_t UEP15_TX_LEN;
  816. __IO uint8_t UEP15_TX_CTRL;
  817. __IO uint8_t UEP15_RX_CTRL;
  818. } USBHSD_TypeDef;
  819. typedef struct __attribute__((packed))
  820. {
  821. __IO uint8_t CONTROL;
  822. __IO uint8_t HOST_CTRL;
  823. __IO uint8_t INT_EN;
  824. __IO uint8_t DEV_AD;
  825. __IO uint16_t FRAME_NO;
  826. __IO uint8_t SUSPEND;
  827. __IO uint8_t RESERVED0;
  828. __IO uint8_t SPEED_TYPE;
  829. __IO uint8_t MIS_ST;
  830. __IO uint8_t INT_FG;
  831. __IO uint8_t INT_ST;
  832. __IO uint16_t RX_LEN;
  833. __IO uint16_t RESERVED1;
  834. __IO uint32_t HOST_EP_CONFIG;
  835. __IO uint32_t HOST_EP_TYPE;
  836. __IO uint32_t RESERVED2;
  837. __IO uint32_t RESERVED3;
  838. __IO uint32_t RESERVED4;
  839. __IO uint32_t HOST_RX_DMA;
  840. __IO uint32_t RESERVED5;
  841. __IO uint32_t RESERVED6;
  842. __IO uint32_t RESERVED7;
  843. __IO uint32_t RESERVED8;
  844. __IO uint32_t RESERVED9;
  845. __IO uint32_t RESERVED10;
  846. __IO uint32_t RESERVED11;
  847. __IO uint32_t RESERVED12;
  848. __IO uint32_t RESERVED13;
  849. __IO uint32_t RESERVED14;
  850. __IO uint32_t RESERVED15;
  851. __IO uint32_t RESERVED16;
  852. __IO uint32_t RESERVED17;
  853. __IO uint32_t RESERVED18;
  854. __IO uint32_t RESERVED19;
  855. __IO uint32_t HOST_TX_DMA;
  856. __IO uint32_t RESERVED20;
  857. __IO uint32_t RESERVED21;
  858. __IO uint32_t RESERVED22;
  859. __IO uint32_t RESERVED23;
  860. __IO uint32_t RESERVED24;
  861. __IO uint32_t RESERVED25;
  862. __IO uint32_t RESERVED26;
  863. __IO uint32_t RESERVED27;
  864. __IO uint32_t RESERVED28;
  865. __IO uint32_t RESERVED29;
  866. __IO uint32_t RESERVED30;
  867. __IO uint32_t RESERVED31;
  868. __IO uint32_t RESERVED32;
  869. __IO uint32_t RESERVED33;
  870. __IO uint16_t HOST_RX_MAX_LEN;
  871. __IO uint16_t RESERVED34;
  872. __IO uint32_t RESERVED35;
  873. __IO uint32_t RESERVED36;
  874. __IO uint32_t RESERVED37;
  875. __IO uint32_t RESERVED38;
  876. __IO uint32_t RESERVED39;
  877. __IO uint32_t RESERVED40;
  878. __IO uint32_t RESERVED41;
  879. __IO uint32_t RESERVED42;
  880. __IO uint32_t RESERVED43;
  881. __IO uint32_t RESERVED44;
  882. __IO uint32_t RESERVED45;
  883. __IO uint32_t RESERVED46;
  884. __IO uint32_t RESERVED47;
  885. __IO uint32_t RESERVED48;
  886. __IO uint32_t RESERVED49;
  887. __IO uint8_t HOST_EP_PID;
  888. __IO uint8_t RESERVED50;
  889. __IO uint8_t RESERVED51;
  890. __IO uint8_t HOST_RX_CTRL;
  891. __IO uint16_t HOST_TX_LEN;
  892. __IO uint8_t HOST_TX_CTRL;
  893. __IO uint8_t RESERVED52;
  894. __IO uint16_t HOST_SPLIT_DATA;
  895. } USBHSH_TypeDef;
  896. /* USBOTG_FS Registers */
  897. typedef struct
  898. {
  899. __IO uint8_t BASE_CTRL;
  900. __IO uint8_t UDEV_CTRL;
  901. __IO uint8_t INT_EN;
  902. __IO uint8_t DEV_ADDR;
  903. __IO uint8_t Reserve0;
  904. __IO uint8_t MIS_ST;
  905. __IO uint8_t INT_FG;
  906. __IO uint8_t INT_ST;
  907. __IO uint16_t RX_LEN;
  908. __IO uint16_t Reserve1;
  909. __IO uint8_t UEP4_1_MOD;
  910. __IO uint8_t UEP2_3_MOD;
  911. __IO uint8_t UEP5_6_MOD;
  912. __IO uint8_t UEP7_MOD;
  913. __IO uint32_t UEP0_DMA;
  914. __IO uint32_t UEP1_DMA;
  915. __IO uint32_t UEP2_DMA;
  916. __IO uint32_t UEP3_DMA;
  917. __IO uint32_t UEP4_DMA;
  918. __IO uint32_t UEP5_DMA;
  919. __IO uint32_t UEP6_DMA;
  920. __IO uint32_t UEP7_DMA;
  921. __IO uint16_t UEP0_TX_LEN;
  922. __IO uint8_t UEP0_TX_CTRL;
  923. __IO uint8_t UEP0_RX_CTRL;
  924. __IO uint16_t UEP1_TX_LEN;
  925. __IO uint8_t UEP1_TX_CTRL;
  926. __IO uint8_t UEP1_RX_CTRL;
  927. __IO uint16_t UEP2_TX_LEN;
  928. __IO uint8_t UEP2_TX_CTRL;
  929. __IO uint8_t UEP2_RX_CTRL;
  930. __IO uint16_t UEP3_TX_LEN;
  931. __IO uint8_t UEP3_TX_CTRL;
  932. __IO uint8_t UEP3_RX_CTRL;
  933. __IO uint16_t UEP4_TX_LEN;
  934. __IO uint8_t UEP4_TX_CTRL;
  935. __IO uint8_t UEP4_RX_CTRL;
  936. __IO uint16_t UEP5_TX_LEN;
  937. __IO uint8_t UEP5_TX_CTRL;
  938. __IO uint8_t UEP5_RX_CTRL;
  939. __IO uint16_t UEP6_TX_LEN;
  940. __IO uint8_t UEP6_TX_CTRL;
  941. __IO uint8_t UEP6_RX_CTRL;
  942. __IO uint16_t UEP7_TX_LEN;
  943. __IO uint8_t UEP7_TX_CTRL;
  944. __IO uint8_t UEP7_RX_CTRL;
  945. __IO uint32_t Reserve2;
  946. __IO uint32_t OTG_CR;
  947. __IO uint32_t OTG_SR;
  948. }USBOTG_FS_TypeDef;
  949. typedef struct __attribute__((packed))
  950. {
  951. __IO uint8_t BASE_CTRL;
  952. __IO uint8_t HOST_CTRL;
  953. __IO uint8_t INT_EN;
  954. __IO uint8_t DEV_ADDR;
  955. __IO uint8_t Reserve0;
  956. __IO uint8_t MIS_ST;
  957. __IO uint8_t INT_FG;
  958. __IO uint8_t INT_ST;
  959. __IO uint16_t RX_LEN;
  960. __IO uint16_t Reserve1;
  961. __IO uint8_t Reserve2;
  962. __IO uint8_t HOST_EP_MOD;
  963. __IO uint16_t Reserve3;
  964. __IO uint32_t Reserve4;
  965. __IO uint32_t Reserve5;
  966. __IO uint32_t HOST_RX_DMA;
  967. __IO uint32_t HOST_TX_DMA;
  968. __IO uint32_t Reserve6;
  969. __IO uint32_t Reserve7;
  970. __IO uint32_t Reserve8;
  971. __IO uint32_t Reserve9;
  972. __IO uint32_t Reserve10;
  973. __IO uint16_t Reserve11;
  974. __IO uint16_t HOST_SETUP;
  975. __IO uint8_t HOST_EP_PID;
  976. __IO uint8_t Reserve12;
  977. __IO uint8_t Reserve13;
  978. __IO uint8_t HOST_RX_CTRL;
  979. __IO uint16_t HOST_TX_LEN;
  980. __IO uint8_t HOST_TX_CTRL;
  981. __IO uint8_t Reserve14;
  982. __IO uint32_t Reserve15;
  983. __IO uint32_t Reserve16;
  984. __IO uint32_t Reserve17;
  985. __IO uint32_t Reserve18;
  986. __IO uint32_t Reserve19;
  987. __IO uint32_t OTG_CR;
  988. __IO uint32_t OTG_SR;
  989. }USBOTGH_FS_TypeDef;
  990. /* Ethernet MAC */
  991. typedef struct
  992. {
  993. __IO uint32_t MACCR;
  994. __IO uint32_t MACFFR;
  995. __IO uint32_t MACHTHR;
  996. __IO uint32_t MACHTLR;
  997. __IO uint32_t MACMIIAR;
  998. __IO uint32_t MACMIIDR;
  999. __IO uint32_t MACFCR;
  1000. __IO uint32_t MACVLANTR;
  1001. uint32_t RESERVED0[2];
  1002. __IO uint32_t MACRWUFFR;
  1003. __IO uint32_t MACPMTCSR;
  1004. uint32_t RESERVED1[2];
  1005. __IO uint32_t MACSR;
  1006. __IO uint32_t MACIMR;
  1007. __IO uint32_t MACA0HR;
  1008. __IO uint32_t MACA0LR;
  1009. __IO uint32_t MACA1HR;
  1010. __IO uint32_t MACA1LR;
  1011. __IO uint32_t MACA2HR;
  1012. __IO uint32_t MACA2LR;
  1013. __IO uint32_t MACA3HR;
  1014. __IO uint32_t MACA3LR;
  1015. uint32_t RESERVED2[40];
  1016. __IO uint32_t MMCCR;
  1017. __IO uint32_t MMCRIR;
  1018. __IO uint32_t MMCTIR;
  1019. __IO uint32_t MMCRIMR;
  1020. __IO uint32_t MMCTIMR;
  1021. uint32_t RESERVED3[14];
  1022. __IO uint32_t MMCTGFSCCR;
  1023. __IO uint32_t MMCTGFMSCCR;
  1024. uint32_t RESERVED4[5];
  1025. __IO uint32_t MMCTGFCR;
  1026. uint32_t RESERVED5[10];
  1027. __IO uint32_t MMCRFCECR;
  1028. __IO uint32_t MMCRFAECR;
  1029. uint32_t RESERVED6[10];
  1030. __IO uint32_t MMCRGUFCR;
  1031. uint32_t RESERVED7[334];
  1032. __IO uint32_t PTPTSCR;
  1033. __IO uint32_t PTPSSIR;
  1034. __IO uint32_t PTPTSHR;
  1035. __IO uint32_t PTPTSLR;
  1036. __IO uint32_t PTPTSHUR;
  1037. __IO uint32_t PTPTSLUR;
  1038. __IO uint32_t PTPTSAR;
  1039. __IO uint32_t PTPTTHR;
  1040. __IO uint32_t PTPTTLR;
  1041. uint32_t RESERVED8[567];
  1042. __IO uint32_t DMABMR;
  1043. __IO uint32_t DMATPDR;
  1044. __IO uint32_t DMARPDR;
  1045. __IO uint32_t DMARDLAR;
  1046. __IO uint32_t DMATDLAR;
  1047. __IO uint32_t DMASR;
  1048. __IO uint32_t DMAOMR;
  1049. __IO uint32_t DMAIER;
  1050. __IO uint32_t DMAMFBOCR;
  1051. uint32_t RESERVED9[9];
  1052. __IO uint32_t DMACHTDR;
  1053. __IO uint32_t DMACHRDR;
  1054. __IO uint32_t DMACHTBAR;
  1055. __IO uint32_t DMACHRBAR;
  1056. } ETH_TypeDef;
  1057. /* Peripheral memory map */
  1058. #define FLASH_BASE ((uint32_t)0x08000000) /* FLASH base address in the alias region */
  1059. #define SRAM_BASE ((uint32_t)0x20000000) /* SRAM base address in the alias region */
  1060. #define PERIPH_BASE ((uint32_t)0x40000000) /* Peripheral base address in the alias region */
  1061. #define FSMC_R_BASE ((uint32_t)0xA0000000) /* FSMC registers base address */
  1062. #define APB1PERIPH_BASE (PERIPH_BASE)
  1063. #define APB2PERIPH_BASE (PERIPH_BASE + 0x10000)
  1064. #define AHBPERIPH_BASE (PERIPH_BASE + 0x20000)
  1065. #define TIM2_BASE (APB1PERIPH_BASE + 0x0000)
  1066. #define TIM3_BASE (APB1PERIPH_BASE + 0x0400)
  1067. #define TIM4_BASE (APB1PERIPH_BASE + 0x0800)
  1068. #define TIM5_BASE (APB1PERIPH_BASE + 0x0C00)
  1069. #define TIM6_BASE (APB1PERIPH_BASE + 0x1000)
  1070. #define TIM7_BASE (APB1PERIPH_BASE + 0x1400)
  1071. #define UART6_BASE (APB1PERIPH_BASE + 0x1800)
  1072. #define UART7_BASE (APB1PERIPH_BASE + 0x1C00)
  1073. #define UART8_BASE (APB1PERIPH_BASE + 0x2000)
  1074. #define RTC_BASE (APB1PERIPH_BASE + 0x2800)
  1075. #define WWDG_BASE (APB1PERIPH_BASE + 0x2C00)
  1076. #define IWDG_BASE (APB1PERIPH_BASE + 0x3000)
  1077. #define SPI2_BASE (APB1PERIPH_BASE + 0x3800)
  1078. #define SPI3_BASE (APB1PERIPH_BASE + 0x3C00)
  1079. #define USART2_BASE (APB1PERIPH_BASE + 0x4400)
  1080. #define USART3_BASE (APB1PERIPH_BASE + 0x4800)
  1081. #define UART4_BASE (APB1PERIPH_BASE + 0x4C00)
  1082. #define UART5_BASE (APB1PERIPH_BASE + 0x5000)
  1083. #define I2C1_BASE (APB1PERIPH_BASE + 0x5400)
  1084. #define I2C2_BASE (APB1PERIPH_BASE + 0x5800)
  1085. #define CAN1_BASE (APB1PERIPH_BASE + 0x6400)
  1086. #define CAN2_BASE (APB1PERIPH_BASE + 0x6800)
  1087. #define BKP_BASE (APB1PERIPH_BASE + 0x6C00)
  1088. #define PWR_BASE (APB1PERIPH_BASE + 0x7000)
  1089. #define DAC_BASE (APB1PERIPH_BASE + 0x7400)
  1090. #define AFIO_BASE (APB2PERIPH_BASE + 0x0000)
  1091. #define EXTI_BASE (APB2PERIPH_BASE + 0x0400)
  1092. #define GPIOA_BASE (APB2PERIPH_BASE + 0x0800)
  1093. #define GPIOB_BASE (APB2PERIPH_BASE + 0x0C00)
  1094. #define GPIOC_BASE (APB2PERIPH_BASE + 0x1000)
  1095. #define GPIOD_BASE (APB2PERIPH_BASE + 0x1400)
  1096. #define GPIOE_BASE (APB2PERIPH_BASE + 0x1800)
  1097. #define GPIOF_BASE (APB2PERIPH_BASE + 0x1C00)
  1098. #define GPIOG_BASE (APB2PERIPH_BASE + 0x2000)
  1099. #define ADC1_BASE (APB2PERIPH_BASE + 0x2400)
  1100. #define ADC2_BASE (APB2PERIPH_BASE + 0x2800)
  1101. #define TIM1_BASE (APB2PERIPH_BASE + 0x2C00)
  1102. #define SPI1_BASE (APB2PERIPH_BASE + 0x3000)
  1103. #define TIM8_BASE (APB2PERIPH_BASE + 0x3400)
  1104. #define USART1_BASE (APB2PERIPH_BASE + 0x3800)
  1105. #define ADC3_BASE (APB2PERIPH_BASE + 0x3C00)
  1106. #define TIM15_BASE (APB2PERIPH_BASE + 0x4000)
  1107. #define TIM16_BASE (APB2PERIPH_BASE + 0x4400)
  1108. #define TIM17_BASE (APB2PERIPH_BASE + 0x4800)
  1109. #define TIM9_BASE (APB2PERIPH_BASE + 0x4C00)
  1110. #define TIM10_BASE (APB2PERIPH_BASE + 0x5000)
  1111. #define TIM11_BASE (APB2PERIPH_BASE + 0x5400)
  1112. #define SDIO_BASE (APB2PERIPH_BASE + 0x8000)
  1113. #define DMA1_BASE (AHBPERIPH_BASE + 0x0000)
  1114. #define DMA1_Channel1_BASE (AHBPERIPH_BASE + 0x0008)
  1115. #define DMA1_Channel2_BASE (AHBPERIPH_BASE + 0x001C)
  1116. #define DMA1_Channel3_BASE (AHBPERIPH_BASE + 0x0030)
  1117. #define DMA1_Channel4_BASE (AHBPERIPH_BASE + 0x0044)
  1118. #define DMA1_Channel5_BASE (AHBPERIPH_BASE + 0x0058)
  1119. #define DMA1_Channel6_BASE (AHBPERIPH_BASE + 0x006C)
  1120. #define DMA1_Channel7_BASE (AHBPERIPH_BASE + 0x0080)
  1121. #define DMA2_BASE (AHBPERIPH_BASE + 0x0400)
  1122. #define DMA2_Channel1_BASE (AHBPERIPH_BASE + 0x0408)
  1123. #define DMA2_Channel2_BASE (AHBPERIPH_BASE + 0x041C)
  1124. #define DMA2_Channel3_BASE (AHBPERIPH_BASE + 0x0430)
  1125. #define DMA2_Channel4_BASE (AHBPERIPH_BASE + 0x0444)
  1126. #define DMA2_Channel5_BASE (AHBPERIPH_BASE + 0x0458)
  1127. #define DMA2_Channel6_BASE (AHBPERIPH_BASE + 0x046C)
  1128. #define DMA2_Channel7_BASE (AHBPERIPH_BASE + 0x0480)
  1129. #define DMA2_Channel8_BASE (AHBPERIPH_BASE + 0x0490)
  1130. #define DMA2_Channel9_BASE (AHBPERIPH_BASE + 0x04A0)
  1131. #define DMA2_Channel10_BASE (AHBPERIPH_BASE + 0x04B0)
  1132. #define DMA2_Channel11_BASE (AHBPERIPH_BASE + 0x04C0)
  1133. #define DMA2_EXTEN_BASE (AHBPERIPH_BASE + 0x04D0)
  1134. #define RCC_BASE (AHBPERIPH_BASE + 0x1000)
  1135. #define FLASH_R_BASE (AHBPERIPH_BASE + 0x2000)
  1136. #define CRC_BASE (AHBPERIPH_BASE + 0x3000)
  1137. #define USBHS_BASE (AHBPERIPH_BASE + 0x3400)
  1138. #define EXTEN_BASE (AHBPERIPH_BASE + 0x3800)
  1139. #define OPA_BASE (AHBPERIPH_BASE + 0x3804)
  1140. #define RNG_BASE (AHBPERIPH_BASE + 0x3C00)
  1141. #define ETH_BASE (AHBPERIPH_BASE + 0x8000)
  1142. #define ETH_MAC_BASE (ETH_BASE)
  1143. #define ETH_MMC_BASE (ETH_BASE + 0x0100)
  1144. #define ETH_PTP_BASE (ETH_BASE + 0x0700)
  1145. #define ETH_DMA_BASE (ETH_BASE + 0x1000)
  1146. #define USBFS_BASE ((uint32_t)0x50000000)
  1147. #define DVP_BASE ((uint32_t)0x50050000)
  1148. #define FSMC_Bank1_R_BASE (FSMC_R_BASE + 0x0000)
  1149. #define FSMC_Bank1E_R_BASE (FSMC_R_BASE + 0x0104)
  1150. #define FSMC_Bank2_R_BASE (FSMC_R_BASE + 0x0060)
  1151. #define OB_BASE ((uint32_t)0x1FFFF800)
  1152. /* Peripheral declaration */
  1153. #define TIM2 ((TIM_TypeDef *) TIM2_BASE)
  1154. #define TIM3 ((TIM_TypeDef *) TIM3_BASE)
  1155. #define TIM4 ((TIM_TypeDef *) TIM4_BASE)
  1156. #define TIM5 ((TIM_TypeDef *) TIM5_BASE)
  1157. #define TIM6 ((TIM_TypeDef *) TIM6_BASE)
  1158. #define TIM7 ((TIM_TypeDef *) TIM7_BASE)
  1159. #define UART6 ((USART_TypeDef *) UART6_BASE)
  1160. #define UART7 ((USART_TypeDef *) UART7_BASE)
  1161. #define UART8 ((USART_TypeDef *) UART8_BASE)
  1162. #define RTC ((RTC_TypeDef *) RTC_BASE)
  1163. #define WWDG ((WWDG_TypeDef *) WWDG_BASE)
  1164. #define IWDG ((IWDG_TypeDef *) IWDG_BASE)
  1165. #define SPI2 ((SPI_TypeDef *) SPI2_BASE)
  1166. #define SPI3 ((SPI_TypeDef *) SPI3_BASE)
  1167. #define USART2 ((USART_TypeDef *) USART2_BASE)
  1168. #define USART3 ((USART_TypeDef *) USART3_BASE)
  1169. #define UART4 ((USART_TypeDef *) UART4_BASE)
  1170. #define UART5 ((USART_TypeDef *) UART5_BASE)
  1171. #define I2C1 ((I2C_TypeDef *) I2C1_BASE)
  1172. #define I2C2 ((I2C_TypeDef *) I2C2_BASE)
  1173. #define CAN1 ((CAN_TypeDef *) CAN1_BASE)
  1174. #define CAN2 ((CAN_TypeDef *) CAN2_BASE)
  1175. #define BKP ((BKP_TypeDef *) BKP_BASE)
  1176. #define PWR ((PWR_TypeDef *) PWR_BASE)
  1177. #define DAC ((DAC_TypeDef *) DAC_BASE)
  1178. #define AFIO ((AFIO_TypeDef *) AFIO_BASE)
  1179. #define EXTI ((EXTI_TypeDef *) EXTI_BASE)
  1180. #define GPIOA ((GPIO_TypeDef *) GPIOA_BASE)
  1181. #define GPIOB ((GPIO_TypeDef *) GPIOB_BASE)
  1182. #define GPIOC ((GPIO_TypeDef *) GPIOC_BASE)
  1183. #define GPIOD ((GPIO_TypeDef *) GPIOD_BASE)
  1184. #define GPIOE ((GPIO_TypeDef *) GPIOE_BASE)
  1185. #define GPIOF ((GPIO_TypeDef *) GPIOF_BASE)
  1186. #define GPIOG ((GPIO_TypeDef *) GPIOG_BASE)
  1187. #define ADC1 ((ADC_TypeDef *) ADC1_BASE)
  1188. #define ADC2 ((ADC_TypeDef *) ADC2_BASE)
  1189. #define TKey1 ((ADC_TypeDef *) ADC1_BASE)
  1190. #define TKey2 ((ADC_TypeDef *) ADC2_BASE)
  1191. #define TIM1 ((TIM_TypeDef *) TIM1_BASE)
  1192. #define SPI1 ((SPI_TypeDef *) SPI1_BASE)
  1193. #define TIM8 ((TIM_TypeDef *) TIM8_BASE)
  1194. #define USART1 ((USART_TypeDef *) USART1_BASE)
  1195. #define ADC3 ((ADC_TypeDef *) ADC3_BASE)
  1196. #define TIM15 ((TIM_TypeDef *) TIM15_BASE)
  1197. #define TIM16 ((TIM_TypeDef *) TIM16_BASE)
  1198. #define TIM17 ((TIM_TypeDef *) TIM17_BASE)
  1199. #define TIM9 ((TIM_TypeDef *) TIM9_BASE)
  1200. #define TIM10 ((TIM_TypeDef *) TIM10_BASE)
  1201. #define TIM11 ((TIM_TypeDef *) TIM11_BASE)
  1202. #define SDIO ((SDIO_TypeDef *) SDIO_BASE)
  1203. #define DMA1 ((DMA_TypeDef *) DMA1_BASE)
  1204. #define DMA2 ((DMA_TypeDef *) DMA2_BASE)
  1205. #define DMA2_EXTEN ((DMA_TypeDef *) DMA2_EXTEN_BASE)
  1206. #define DMA1_Channel1 ((DMA_Channel_TypeDef *) DMA1_Channel1_BASE)
  1207. #define DMA1_Channel2 ((DMA_Channel_TypeDef *) DMA1_Channel2_BASE)
  1208. #define DMA1_Channel3 ((DMA_Channel_TypeDef *) DMA1_Channel3_BASE)
  1209. #define DMA1_Channel4 ((DMA_Channel_TypeDef *) DMA1_Channel4_BASE)
  1210. #define DMA1_Channel5 ((DMA_Channel_TypeDef *) DMA1_Channel5_BASE)
  1211. #define DMA1_Channel6 ((DMA_Channel_TypeDef *) DMA1_Channel6_BASE)
  1212. #define DMA1_Channel7 ((DMA_Channel_TypeDef *) DMA1_Channel7_BASE)
  1213. #define DMA2_Channel1 ((DMA_Channel_TypeDef *) DMA2_Channel1_BASE)
  1214. #define DMA2_Channel2 ((DMA_Channel_TypeDef *) DMA2_Channel2_BASE)
  1215. #define DMA2_Channel3 ((DMA_Channel_TypeDef *) DMA2_Channel3_BASE)
  1216. #define DMA2_Channel4 ((DMA_Channel_TypeDef *) DMA2_Channel4_BASE)
  1217. #define DMA2_Channel5 ((DMA_Channel_TypeDef *) DMA2_Channel5_BASE)
  1218. #define DMA2_Channel6 ((DMA_Channel_TypeDef *) DMA2_Channel6_BASE)
  1219. #define DMA2_Channel7 ((DMA_Channel_TypeDef *) DMA2_Channel7_BASE)
  1220. #define DMA2_Channel8 ((DMA_Channel_TypeDef *) DMA2_Channel8_BASE)
  1221. #define DMA2_Channel9 ((DMA_Channel_TypeDef *) DMA2_Channel9_BASE)
  1222. #define DMA2_Channel10 ((DMA_Channel_TypeDef *) DMA2_Channel10_BASE)
  1223. #define DMA2_Channel11 ((DMA_Channel_TypeDef *) DMA2_Channel11_BASE)
  1224. #define RCC ((RCC_TypeDef *) RCC_BASE)
  1225. #define FLASH ((FLASH_TypeDef *) FLASH_R_BASE)
  1226. #define CRC ((CRC_TypeDef *) CRC_BASE)
  1227. #define USBHSD ((USBHSD_TypeDef *) USBHS_BASE)
  1228. #define USBHSH ((USBHSH_TypeDef *) USBHS_BASE)
  1229. #define USBOTG_FS ((USBOTG_FS_TypeDef *)USBFS_BASE)
  1230. #define USBOTG_H_FS ((USBOTGH_FS_TypeDef *)USBFS_BASE)
  1231. #define EXTEN ((EXTEN_TypeDef *) EXTEN_BASE)
  1232. #define OPA ((OPA_TypeDef *) OPA_BASE)
  1233. #define RNG ((RNG_TypeDef *) RNG_BASE)
  1234. #define ETH ((ETH_TypeDef *) ETH_BASE)
  1235. #define DVP ((DVP_TypeDef *) DVP_BASE)
  1236. #define FSMC_Bank1 ((FSMC_Bank1_TypeDef *) FSMC_Bank1_R_BASE)
  1237. #define FSMC_Bank1E ((FSMC_Bank1E_TypeDef *) FSMC_Bank1E_R_BASE)
  1238. #define FSMC_Bank2 ((FSMC_Bank2_TypeDef *) FSMC_Bank2_R_BASE)
  1239. #define OB ((OB_TypeDef *) OB_BASE)
  1240. /******************************************************************************/
  1241. /* Peripheral Registers Bits Definition */
  1242. /******************************************************************************/
  1243. /******************************************************************************/
  1244. /* Analog to Digital Converter */
  1245. /******************************************************************************/
  1246. /******************** Bit definition for ADC_STATR register ********************/
  1247. #define ADC_AWD ((uint8_t)0x01) /* Analog watchdog flag */
  1248. #define ADC_EOC ((uint8_t)0x02) /* End of conversion */
  1249. #define ADC_JEOC ((uint8_t)0x04) /* Injected channel end of conversion */
  1250. #define ADC_JSTRT ((uint8_t)0x08) /* Injected channel Start flag */
  1251. #define ADC_STRT ((uint8_t)0x10) /* Regular channel Start flag */
  1252. /******************* Bit definition for ADC_CTLR1 register ********************/
  1253. #define ADC_AWDCH ((uint32_t)0x0000001F) /* AWDCH[4:0] bits (Analog watchdog channel select bits) */
  1254. #define ADC_AWDCH_0 ((uint32_t)0x00000001) /* Bit 0 */
  1255. #define ADC_AWDCH_1 ((uint32_t)0x00000002) /* Bit 1 */
  1256. #define ADC_AWDCH_2 ((uint32_t)0x00000004) /* Bit 2 */
  1257. #define ADC_AWDCH_3 ((uint32_t)0x00000008) /* Bit 3 */
  1258. #define ADC_AWDCH_4 ((uint32_t)0x00000010) /* Bit 4 */
  1259. #define ADC_EOCIE ((uint32_t)0x00000020) /* Interrupt enable for EOC */
  1260. #define ADC_AWDIE ((uint32_t)0x00000040) /* Analog Watchdog interrupt enable */
  1261. #define ADC_JEOCIE ((uint32_t)0x00000080) /* Interrupt enable for injected channels */
  1262. #define ADC_SCAN ((uint32_t)0x00000100) /* Scan mode */
  1263. #define ADC_AWDSGL ((uint32_t)0x00000200) /* Enable the watchdog on a single channel in scan mode */
  1264. #define ADC_JAUTO ((uint32_t)0x00000400) /* Automatic injected group conversion */
  1265. #define ADC_DISCEN ((uint32_t)0x00000800) /* Discontinuous mode on regular channels */
  1266. #define ADC_JDISCEN ((uint32_t)0x00001000) /* Discontinuous mode on injected channels */
  1267. #define ADC_DISCNUM ((uint32_t)0x0000E000) /* DISCNUM[2:0] bits (Discontinuous mode channel count) */
  1268. #define ADC_DISCNUM_0 ((uint32_t)0x00002000) /* Bit 0 */
  1269. #define ADC_DISCNUM_1 ((uint32_t)0x00004000) /* Bit 1 */
  1270. #define ADC_DISCNUM_2 ((uint32_t)0x00008000) /* Bit 2 */
  1271. #define ADC_DUALMOD ((uint32_t)0x000F0000) /* DUALMOD[3:0] bits (Dual mode selection) */
  1272. #define ADC_DUALMOD_0 ((uint32_t)0x00010000) /* Bit 0 */
  1273. #define ADC_DUALMOD_1 ((uint32_t)0x00020000) /* Bit 1 */
  1274. #define ADC_DUALMOD_2 ((uint32_t)0x00040000) /* Bit 2 */
  1275. #define ADC_DUALMOD_3 ((uint32_t)0x00080000) /* Bit 3 */
  1276. #define ADC_JAWDEN ((uint32_t)0x00400000) /* Analog watchdog enable on injected channels */
  1277. #define ADC_AWDEN ((uint32_t)0x00800000) /* Analog watchdog enable on regular channels */
  1278. /******************* Bit definition for ADC_CTLR2 register ********************/
  1279. #define ADC_ADON ((uint32_t)0x00000001) /* A/D Converter ON / OFF */
  1280. #define ADC_CONT ((uint32_t)0x00000002) /* Continuous Conversion */
  1281. #define ADC_CAL ((uint32_t)0x00000004) /* A/D Calibration */
  1282. #define ADC_RSTCAL ((uint32_t)0x00000008) /* Reset Calibration */
  1283. #define ADC_DMA ((uint32_t)0x00000100) /* Direct Memory access mode */
  1284. #define ADC_ALIGN ((uint32_t)0x00000800) /* Data Alignment */
  1285. #define ADC_JEXTSEL ((uint32_t)0x00007000) /* JEXTSEL[2:0] bits (External event select for injected group) */
  1286. #define ADC_JEXTSEL_0 ((uint32_t)0x00001000) /* Bit 0 */
  1287. #define ADC_JEXTSEL_1 ((uint32_t)0x00002000) /* Bit 1 */
  1288. #define ADC_JEXTSEL_2 ((uint32_t)0x00004000) /* Bit 2 */
  1289. #define ADC_JEXTTRIG ((uint32_t)0x00008000) /* External Trigger Conversion mode for injected channels */
  1290. #define ADC_EXTSEL ((uint32_t)0x000E0000) /* EXTSEL[2:0] bits (External Event Select for regular group) */
  1291. #define ADC_EXTSEL_0 ((uint32_t)0x00020000) /* Bit 0 */
  1292. #define ADC_EXTSEL_1 ((uint32_t)0x00040000) /* Bit 1 */
  1293. #define ADC_EXTSEL_2 ((uint32_t)0x00080000) /* Bit 2 */
  1294. #define ADC_EXTTRIG ((uint32_t)0x00100000) /* External Trigger Conversion mode for regular channels */
  1295. #define ADC_JSWSTART ((uint32_t)0x00200000) /* Start Conversion of injected channels */
  1296. #define ADC_SWSTART ((uint32_t)0x00400000) /* Start Conversion of regular channels */
  1297. #define ADC_TSVREFE ((uint32_t)0x00800000) /* Temperature Sensor and VREFINT Enable */
  1298. /****************** Bit definition for ADC_SAMPTR1 register *******************/
  1299. #define ADC_SMP10 ((uint32_t)0x00000007) /* SMP10[2:0] bits (Channel 10 Sample time selection) */
  1300. #define ADC_SMP10_0 ((uint32_t)0x00000001) /* Bit 0 */
  1301. #define ADC_SMP10_1 ((uint32_t)0x00000002) /* Bit 1 */
  1302. #define ADC_SMP10_2 ((uint32_t)0x00000004) /* Bit 2 */
  1303. #define ADC_SMP11 ((uint32_t)0x00000038) /* SMP11[2:0] bits (Channel 11 Sample time selection) */
  1304. #define ADC_SMP11_0 ((uint32_t)0x00000008) /* Bit 0 */
  1305. #define ADC_SMP11_1 ((uint32_t)0x00000010) /* Bit 1 */
  1306. #define ADC_SMP11_2 ((uint32_t)0x00000020) /* Bit 2 */
  1307. #define ADC_SMP12 ((uint32_t)0x000001C0) /* SMP12[2:0] bits (Channel 12 Sample time selection) */
  1308. #define ADC_SMP12_0 ((uint32_t)0x00000040) /* Bit 0 */
  1309. #define ADC_SMP12_1 ((uint32_t)0x00000080) /* Bit 1 */
  1310. #define ADC_SMP12_2 ((uint32_t)0x00000100) /* Bit 2 */
  1311. #define ADC_SMP13 ((uint32_t)0x00000E00) /* SMP13[2:0] bits (Channel 13 Sample time selection) */
  1312. #define ADC_SMP13_0 ((uint32_t)0x00000200) /* Bit 0 */
  1313. #define ADC_SMP13_1 ((uint32_t)0x00000400) /* Bit 1 */
  1314. #define ADC_SMP13_2 ((uint32_t)0x00000800) /* Bit 2 */
  1315. #define ADC_SMP14 ((uint32_t)0x00007000) /* SMP14[2:0] bits (Channel 14 Sample time selection) */
  1316. #define ADC_SMP14_0 ((uint32_t)0x00001000) /* Bit 0 */
  1317. #define ADC_SMP14_1 ((uint32_t)0x00002000) /* Bit 1 */
  1318. #define ADC_SMP14_2 ((uint32_t)0x00004000) /* Bit 2 */
  1319. #define ADC_SMP15 ((uint32_t)0x00038000) /* SMP15[2:0] bits (Channel 15 Sample time selection) */
  1320. #define ADC_SMP15_0 ((uint32_t)0x00008000) /* Bit 0 */
  1321. #define ADC_SMP15_1 ((uint32_t)0x00010000) /* Bit 1 */
  1322. #define ADC_SMP15_2 ((uint32_t)0x00020000) /* Bit 2 */
  1323. #define ADC_SMP16 ((uint32_t)0x001C0000) /* SMP16[2:0] bits (Channel 16 Sample time selection) */
  1324. #define ADC_SMP16_0 ((uint32_t)0x00040000) /* Bit 0 */
  1325. #define ADC_SMP16_1 ((uint32_t)0x00080000) /* Bit 1 */
  1326. #define ADC_SMP16_2 ((uint32_t)0x00100000) /* Bit 2 */
  1327. #define ADC_SMP17 ((uint32_t)0x00E00000) /* SMP17[2:0] bits (Channel 17 Sample time selection) */
  1328. #define ADC_SMP17_0 ((uint32_t)0x00200000) /* Bit 0 */
  1329. #define ADC_SMP17_1 ((uint32_t)0x00400000) /* Bit 1 */
  1330. #define ADC_SMP17_2 ((uint32_t)0x00800000) /* Bit 2 */
  1331. /****************** Bit definition for ADC_SAMPTR2 register *******************/
  1332. #define ADC_SMP0 ((uint32_t)0x00000007) /* SMP0[2:0] bits (Channel 0 Sample time selection) */
  1333. #define ADC_SMP0_0 ((uint32_t)0x00000001) /* Bit 0 */
  1334. #define ADC_SMP0_1 ((uint32_t)0x00000002) /* Bit 1 */
  1335. #define ADC_SMP0_2 ((uint32_t)0x00000004) /* Bit 2 */
  1336. #define ADC_SMP1 ((uint32_t)0x00000038) /* SMP1[2:0] bits (Channel 1 Sample time selection) */
  1337. #define ADC_SMP1_0 ((uint32_t)0x00000008) /* Bit 0 */
  1338. #define ADC_SMP1_1 ((uint32_t)0x00000010) /* Bit 1 */
  1339. #define ADC_SMP1_2 ((uint32_t)0x00000020) /* Bit 2 */
  1340. #define ADC_SMP2 ((uint32_t)0x000001C0) /* SMP2[2:0] bits (Channel 2 Sample time selection) */
  1341. #define ADC_SMP2_0 ((uint32_t)0x00000040) /* Bit 0 */
  1342. #define ADC_SMP2_1 ((uint32_t)0x00000080) /* Bit 1 */
  1343. #define ADC_SMP2_2 ((uint32_t)0x00000100) /* Bit 2 */
  1344. #define ADC_SMP3 ((uint32_t)0x00000E00) /* SMP3[2:0] bits (Channel 3 Sample time selection) */
  1345. #define ADC_SMP3_0 ((uint32_t)0x00000200) /* Bit 0 */
  1346. #define ADC_SMP3_1 ((uint32_t)0x00000400) /* Bit 1 */
  1347. #define ADC_SMP3_2 ((uint32_t)0x00000800) /* Bit 2 */
  1348. #define ADC_SMP4 ((uint32_t)0x00007000) /* SMP4[2:0] bits (Channel 4 Sample time selection) */
  1349. #define ADC_SMP4_0 ((uint32_t)0x00001000) /* Bit 0 */
  1350. #define ADC_SMP4_1 ((uint32_t)0x00002000) /* Bit 1 */
  1351. #define ADC_SMP4_2 ((uint32_t)0x00004000) /* Bit 2 */
  1352. #define ADC_SMP5 ((uint32_t)0x00038000) /* SMP5[2:0] bits (Channel 5 Sample time selection) */
  1353. #define ADC_SMP5_0 ((uint32_t)0x00008000) /* Bit 0 */
  1354. #define ADC_SMP5_1 ((uint32_t)0x00010000) /* Bit 1 */
  1355. #define ADC_SMP5_2 ((uint32_t)0x00020000) /* Bit 2 */
  1356. #define ADC_SMP6 ((uint32_t)0x001C0000) /* SMP6[2:0] bits (Channel 6 Sample time selection) */
  1357. #define ADC_SMP6_0 ((uint32_t)0x00040000) /* Bit 0 */
  1358. #define ADC_SMP6_1 ((uint32_t)0x00080000) /* Bit 1 */
  1359. #define ADC_SMP6_2 ((uint32_t)0x00100000) /* Bit 2 */
  1360. #define ADC_SMP7 ((uint32_t)0x00E00000) /* SMP7[2:0] bits (Channel 7 Sample time selection) */
  1361. #define ADC_SMP7_0 ((uint32_t)0x00200000) /* Bit 0 */
  1362. #define ADC_SMP7_1 ((uint32_t)0x00400000) /* Bit 1 */
  1363. #define ADC_SMP7_2 ((uint32_t)0x00800000) /* Bit 2 */
  1364. #define ADC_SMP8 ((uint32_t)0x07000000) /* SMP8[2:0] bits (Channel 8 Sample time selection) */
  1365. #define ADC_SMP8_0 ((uint32_t)0x01000000) /* Bit 0 */
  1366. #define ADC_SMP8_1 ((uint32_t)0x02000000) /* Bit 1 */
  1367. #define ADC_SMP8_2 ((uint32_t)0x04000000) /* Bit 2 */
  1368. #define ADC_SMP9 ((uint32_t)0x38000000) /* SMP9[2:0] bits (Channel 9 Sample time selection) */
  1369. #define ADC_SMP9_0 ((uint32_t)0x08000000) /* Bit 0 */
  1370. #define ADC_SMP9_1 ((uint32_t)0x10000000) /* Bit 1 */
  1371. #define ADC_SMP9_2 ((uint32_t)0x20000000) /* Bit 2 */
  1372. /****************** Bit definition for ADC_IOFR1 register *******************/
  1373. #define ADC_JOFFSET1 ((uint16_t)0x0FFF) /* Data offset for injected channel 1 */
  1374. /****************** Bit definition for ADC_IOFR2 register *******************/
  1375. #define ADC_JOFFSET2 ((uint16_t)0x0FFF) /* Data offset for injected channel 2 */
  1376. /****************** Bit definition for ADC_IOFR3 register *******************/
  1377. #define ADC_JOFFSET3 ((uint16_t)0x0FFF) /* Data offset for injected channel 3 */
  1378. /****************** Bit definition for ADC_IOFR4 register *******************/
  1379. #define ADC_JOFFSET4 ((uint16_t)0x0FFF) /* Data offset for injected channel 4 */
  1380. /******************* Bit definition for ADC_WDHTR register ********************/
  1381. #define ADC_HT ((uint16_t)0x0FFF) /* Analog watchdog high threshold */
  1382. /******************* Bit definition for ADC_WDLTR register ********************/
  1383. #define ADC_LT ((uint16_t)0x0FFF) /* Analog watchdog low threshold */
  1384. /******************* Bit definition for ADC_RSQR1 register *******************/
  1385. #define ADC_SQ13 ((uint32_t)0x0000001F) /* SQ13[4:0] bits (13th conversion in regular sequence) */
  1386. #define ADC_SQ13_0 ((uint32_t)0x00000001) /* Bit 0 */
  1387. #define ADC_SQ13_1 ((uint32_t)0x00000002) /* Bit 1 */
  1388. #define ADC_SQ13_2 ((uint32_t)0x00000004) /* Bit 2 */
  1389. #define ADC_SQ13_3 ((uint32_t)0x00000008) /* Bit 3 */
  1390. #define ADC_SQ13_4 ((uint32_t)0x00000010) /* Bit 4 */
  1391. #define ADC_SQ14 ((uint32_t)0x000003E0) /* SQ14[4:0] bits (14th conversion in regular sequence) */
  1392. #define ADC_SQ14_0 ((uint32_t)0x00000020) /* Bit 0 */
  1393. #define ADC_SQ14_1 ((uint32_t)0x00000040) /* Bit 1 */
  1394. #define ADC_SQ14_2 ((uint32_t)0x00000080) /* Bit 2 */
  1395. #define ADC_SQ14_3 ((uint32_t)0x00000100) /* Bit 3 */
  1396. #define ADC_SQ14_4 ((uint32_t)0x00000200) /* Bit 4 */
  1397. #define ADC_SQ15 ((uint32_t)0x00007C00) /* SQ15[4:0] bits (15th conversion in regular sequence) */
  1398. #define ADC_SQ15_0 ((uint32_t)0x00000400) /* Bit 0 */
  1399. #define ADC_SQ15_1 ((uint32_t)0x00000800) /* Bit 1 */
  1400. #define ADC_SQ15_2 ((uint32_t)0x00001000) /* Bit 2 */
  1401. #define ADC_SQ15_3 ((uint32_t)0x00002000) /* Bit 3 */
  1402. #define ADC_SQ15_4 ((uint32_t)0x00004000) /* Bit 4 */
  1403. #define ADC_SQ16 ((uint32_t)0x000F8000) /* SQ16[4:0] bits (16th conversion in regular sequence) */
  1404. #define ADC_SQ16_0 ((uint32_t)0x00008000) /* Bit 0 */
  1405. #define ADC_SQ16_1 ((uint32_t)0x00010000) /* Bit 1 */
  1406. #define ADC_SQ16_2 ((uint32_t)0x00020000) /* Bit 2 */
  1407. #define ADC_SQ16_3 ((uint32_t)0x00040000) /* Bit 3 */
  1408. #define ADC_SQ16_4 ((uint32_t)0x00080000) /* Bit 4 */
  1409. #define ADC_L ((uint32_t)0x00F00000) /* L[3:0] bits (Regular channel sequence length) */
  1410. #define ADC_L_0 ((uint32_t)0x00100000) /* Bit 0 */
  1411. #define ADC_L_1 ((uint32_t)0x00200000) /* Bit 1 */
  1412. #define ADC_L_2 ((uint32_t)0x00400000) /* Bit 2 */
  1413. #define ADC_L_3 ((uint32_t)0x00800000) /* Bit 3 */
  1414. /******************* Bit definition for ADC_RSQR2 register *******************/
  1415. #define ADC_SQ7 ((uint32_t)0x0000001F) /* SQ7[4:0] bits (7th conversion in regular sequence) */
  1416. #define ADC_SQ7_0 ((uint32_t)0x00000001) /* Bit 0 */
  1417. #define ADC_SQ7_1 ((uint32_t)0x00000002) /* Bit 1 */
  1418. #define ADC_SQ7_2 ((uint32_t)0x00000004) /* Bit 2 */
  1419. #define ADC_SQ7_3 ((uint32_t)0x00000008) /* Bit 3 */
  1420. #define ADC_SQ7_4 ((uint32_t)0x00000010) /* Bit 4 */
  1421. #define ADC_SQ8 ((uint32_t)0x000003E0) /* SQ8[4:0] bits (8th conversion in regular sequence) */
  1422. #define ADC_SQ8_0 ((uint32_t)0x00000020) /* Bit 0 */
  1423. #define ADC_SQ8_1 ((uint32_t)0x00000040) /* Bit 1 */
  1424. #define ADC_SQ8_2 ((uint32_t)0x00000080) /* Bit 2 */
  1425. #define ADC_SQ8_3 ((uint32_t)0x00000100) /* Bit 3 */
  1426. #define ADC_SQ8_4 ((uint32_t)0x00000200) /* Bit 4 */
  1427. #define ADC_SQ9 ((uint32_t)0x00007C00) /* SQ9[4:0] bits (9th conversion in regular sequence) */
  1428. #define ADC_SQ9_0 ((uint32_t)0x00000400) /* Bit 0 */
  1429. #define ADC_SQ9_1 ((uint32_t)0x00000800) /* Bit 1 */
  1430. #define ADC_SQ9_2 ((uint32_t)0x00001000) /* Bit 2 */
  1431. #define ADC_SQ9_3 ((uint32_t)0x00002000) /* Bit 3 */
  1432. #define ADC_SQ9_4 ((uint32_t)0x00004000) /* Bit 4 */
  1433. #define ADC_SQ10 ((uint32_t)0x000F8000) /* SQ10[4:0] bits (10th conversion in regular sequence) */
  1434. #define ADC_SQ10_0 ((uint32_t)0x00008000) /* Bit 0 */
  1435. #define ADC_SQ10_1 ((uint32_t)0x00010000) /* Bit 1 */
  1436. #define ADC_SQ10_2 ((uint32_t)0x00020000) /* Bit 2 */
  1437. #define ADC_SQ10_3 ((uint32_t)0x00040000) /* Bit 3 */
  1438. #define ADC_SQ10_4 ((uint32_t)0x00080000) /* Bit 4 */
  1439. #define ADC_SQ11 ((uint32_t)0x01F00000) /* SQ11[4:0] bits (11th conversion in regular sequence) */
  1440. #define ADC_SQ11_0 ((uint32_t)0x00100000) /* Bit 0 */
  1441. #define ADC_SQ11_1 ((uint32_t)0x00200000) /* Bit 1 */
  1442. #define ADC_SQ11_2 ((uint32_t)0x00400000) /* Bit 2 */
  1443. #define ADC_SQ11_3 ((uint32_t)0x00800000) /* Bit 3 */
  1444. #define ADC_SQ11_4 ((uint32_t)0x01000000) /* Bit 4 */
  1445. #define ADC_SQ12 ((uint32_t)0x3E000000) /* SQ12[4:0] bits (12th conversion in regular sequence) */
  1446. #define ADC_SQ12_0 ((uint32_t)0x02000000) /* Bit 0 */
  1447. #define ADC_SQ12_1 ((uint32_t)0x04000000) /* Bit 1 */
  1448. #define ADC_SQ12_2 ((uint32_t)0x08000000) /* Bit 2 */
  1449. #define ADC_SQ12_3 ((uint32_t)0x10000000) /* Bit 3 */
  1450. #define ADC_SQ12_4 ((uint32_t)0x20000000) /* Bit 4 */
  1451. /******************* Bit definition for ADC_RSQR3 register *******************/
  1452. #define ADC_SQ1 ((uint32_t)0x0000001F) /* SQ1[4:0] bits (1st conversion in regular sequence) */
  1453. #define ADC_SQ1_0 ((uint32_t)0x00000001) /* Bit 0 */
  1454. #define ADC_SQ1_1 ((uint32_t)0x00000002) /* Bit 1 */
  1455. #define ADC_SQ1_2 ((uint32_t)0x00000004) /* Bit 2 */
  1456. #define ADC_SQ1_3 ((uint32_t)0x00000008) /* Bit 3 */
  1457. #define ADC_SQ1_4 ((uint32_t)0x00000010) /* Bit 4 */
  1458. #define ADC_SQ2 ((uint32_t)0x000003E0) /* SQ2[4:0] bits (2nd conversion in regular sequence) */
  1459. #define ADC_SQ2_0 ((uint32_t)0x00000020) /* Bit 0 */
  1460. #define ADC_SQ2_1 ((uint32_t)0x00000040) /* Bit 1 */
  1461. #define ADC_SQ2_2 ((uint32_t)0x00000080) /* Bit 2 */
  1462. #define ADC_SQ2_3 ((uint32_t)0x00000100) /* Bit 3 */
  1463. #define ADC_SQ2_4 ((uint32_t)0x00000200) /* Bit 4 */
  1464. #define ADC_SQ3 ((uint32_t)0x00007C00) /* SQ3[4:0] bits (3rd conversion in regular sequence) */
  1465. #define ADC_SQ3_0 ((uint32_t)0x00000400) /* Bit 0 */
  1466. #define ADC_SQ3_1 ((uint32_t)0x00000800) /* Bit 1 */
  1467. #define ADC_SQ3_2 ((uint32_t)0x00001000) /* Bit 2 */
  1468. #define ADC_SQ3_3 ((uint32_t)0x00002000) /* Bit 3 */
  1469. #define ADC_SQ3_4 ((uint32_t)0x00004000) /* Bit 4 */
  1470. #define ADC_SQ4 ((uint32_t)0x000F8000) /* SQ4[4:0] bits (4th conversion in regular sequence) */
  1471. #define ADC_SQ4_0 ((uint32_t)0x00008000) /* Bit 0 */
  1472. #define ADC_SQ4_1 ((uint32_t)0x00010000) /* Bit 1 */
  1473. #define ADC_SQ4_2 ((uint32_t)0x00020000) /* Bit 2 */
  1474. #define ADC_SQ4_3 ((uint32_t)0x00040000) /* Bit 3 */
  1475. #define ADC_SQ4_4 ((uint32_t)0x00080000) /* Bit 4 */
  1476. #define ADC_SQ5 ((uint32_t)0x01F00000) /* SQ5[4:0] bits (5th conversion in regular sequence) */
  1477. #define ADC_SQ5_0 ((uint32_t)0x00100000) /* Bit 0 */
  1478. #define ADC_SQ5_1 ((uint32_t)0x00200000) /* Bit 1 */
  1479. #define ADC_SQ5_2 ((uint32_t)0x00400000) /* Bit 2 */
  1480. #define ADC_SQ5_3 ((uint32_t)0x00800000) /* Bit 3 */
  1481. #define ADC_SQ5_4 ((uint32_t)0x01000000) /* Bit 4 */
  1482. #define ADC_SQ6 ((uint32_t)0x3E000000) /* SQ6[4:0] bits (6th conversion in regular sequence) */
  1483. #define ADC_SQ6_0 ((uint32_t)0x02000000) /* Bit 0 */
  1484. #define ADC_SQ6_1 ((uint32_t)0x04000000) /* Bit 1 */
  1485. #define ADC_SQ6_2 ((uint32_t)0x08000000) /* Bit 2 */
  1486. #define ADC_SQ6_3 ((uint32_t)0x10000000) /* Bit 3 */
  1487. #define ADC_SQ6_4 ((uint32_t)0x20000000) /* Bit 4 */
  1488. /******************* Bit definition for ADC_ISQR register *******************/
  1489. #define ADC_JSQ1 ((uint32_t)0x0000001F) /* JSQ1[4:0] bits (1st conversion in injected sequence) */
  1490. #define ADC_JSQ1_0 ((uint32_t)0x00000001) /* Bit 0 */
  1491. #define ADC_JSQ1_1 ((uint32_t)0x00000002) /* Bit 1 */
  1492. #define ADC_JSQ1_2 ((uint32_t)0x00000004) /* Bit 2 */
  1493. #define ADC_JSQ1_3 ((uint32_t)0x00000008) /* Bit 3 */
  1494. #define ADC_JSQ1_4 ((uint32_t)0x00000010) /* Bit 4 */
  1495. #define ADC_JSQ2 ((uint32_t)0x000003E0) /* JSQ2[4:0] bits (2nd conversion in injected sequence) */
  1496. #define ADC_JSQ2_0 ((uint32_t)0x00000020) /* Bit 0 */
  1497. #define ADC_JSQ2_1 ((uint32_t)0x00000040) /* Bit 1 */
  1498. #define ADC_JSQ2_2 ((uint32_t)0x00000080) /* Bit 2 */
  1499. #define ADC_JSQ2_3 ((uint32_t)0x00000100) /* Bit 3 */
  1500. #define ADC_JSQ2_4 ((uint32_t)0x00000200) /* Bit 4 */
  1501. #define ADC_JSQ3 ((uint32_t)0x00007C00) /* JSQ3[4:0] bits (3rd conversion in injected sequence) */
  1502. #define ADC_JSQ3_0 ((uint32_t)0x00000400) /* Bit 0 */
  1503. #define ADC_JSQ3_1 ((uint32_t)0x00000800) /* Bit 1 */
  1504. #define ADC_JSQ3_2 ((uint32_t)0x00001000) /* Bit 2 */
  1505. #define ADC_JSQ3_3 ((uint32_t)0x00002000) /* Bit 3 */
  1506. #define ADC_JSQ3_4 ((uint32_t)0x00004000) /* Bit 4 */
  1507. #define ADC_JSQ4 ((uint32_t)0x000F8000) /* JSQ4[4:0] bits (4th conversion in injected sequence) */
  1508. #define ADC_JSQ4_0 ((uint32_t)0x00008000) /* Bit 0 */
  1509. #define ADC_JSQ4_1 ((uint32_t)0x00010000) /* Bit 1 */
  1510. #define ADC_JSQ4_2 ((uint32_t)0x00020000) /* Bit 2 */
  1511. #define ADC_JSQ4_3 ((uint32_t)0x00040000) /* Bit 3 */
  1512. #define ADC_JSQ4_4 ((uint32_t)0x00080000) /* Bit 4 */
  1513. #define ADC_JL ((uint32_t)0x00300000) /* JL[1:0] bits (Injected Sequence length) */
  1514. #define ADC_JL_0 ((uint32_t)0x00100000) /* Bit 0 */
  1515. #define ADC_JL_1 ((uint32_t)0x00200000) /* Bit 1 */
  1516. /******************* Bit definition for ADC_IDATAR1 register *******************/
  1517. #define ADC_IDATAR1_JDATA ((uint16_t)0xFFFF) /* Injected data */
  1518. /******************* Bit definition for ADC_IDATAR2 register *******************/
  1519. #define ADC_IDATAR2_JDATA ((uint16_t)0xFFFF) /* Injected data */
  1520. /******************* Bit definition for ADC_IDATAR3 register *******************/
  1521. #define ADC_IDATAR3_JDATA ((uint16_t)0xFFFF) /* Injected data */
  1522. /******************* Bit definition for ADC_IDATAR4 register *******************/
  1523. #define ADC_IDATAR4_JDATA ((uint16_t)0xFFFF) /* Injected data */
  1524. /******************** Bit definition for ADC_RDATAR register ********************/
  1525. #define ADC_RDATAR_DATA ((uint32_t)0x0000FFFF) /* Regular data */
  1526. #define ADC_RDATAR_ADC2DATA ((uint32_t)0xFFFF0000) /* ADC2 data */
  1527. /******************************************************************************/
  1528. /* Backup registers */
  1529. /******************************************************************************/
  1530. /******************* Bit definition for BKP_DATAR1 register ********************/
  1531. #define BKP_DATAR1_D ((uint16_t)0xFFFF) /* Backup data */
  1532. /******************* Bit definition for BKP_DATAR2 register ********************/
  1533. #define BKP_DATAR2_D ((uint16_t)0xFFFF) /* Backup data */
  1534. /******************* Bit definition for BKP_DATAR3 register ********************/
  1535. #define BKP_DATAR3_D ((uint16_t)0xFFFF) /* Backup data */
  1536. /******************* Bit definition for BKP_DATAR4 register ********************/
  1537. #define BKP_DATAR4_D ((uint16_t)0xFFFF) /* Backup data */
  1538. /******************* Bit definition for BKP_DATAR5 register ********************/
  1539. #define BKP_DATAR5_D ((uint16_t)0xFFFF) /* Backup data */
  1540. /******************* Bit definition for BKP_DATAR6 register ********************/
  1541. #define BKP_DATAR6_D ((uint16_t)0xFFFF) /* Backup data */
  1542. /******************* Bit definition for BKP_DATAR7 register ********************/
  1543. #define BKP_DATAR7_D ((uint16_t)0xFFFF) /* Backup data */
  1544. /******************* Bit definition for BKP_DATAR8 register ********************/
  1545. #define BKP_DATAR8_D ((uint16_t)0xFFFF) /* Backup data */
  1546. /******************* Bit definition for BKP_DATAR9 register ********************/
  1547. #define BKP_DATAR9_D ((uint16_t)0xFFFF) /* Backup data */
  1548. /******************* Bit definition for BKP_DATAR10 register *******************/
  1549. #define BKP_DATAR10_D ((uint16_t)0xFFFF) /* Backup data */
  1550. /******************* Bit definition for BKP_DATAR11 register *******************/
  1551. #define BKP_DATAR11_D ((uint16_t)0xFFFF) /* Backup data */
  1552. /******************* Bit definition for BKP_DATAR12 register *******************/
  1553. #define BKP_DATAR12_D ((uint16_t)0xFFFF) /* Backup data */
  1554. /******************* Bit definition for BKP_DATAR13 register *******************/
  1555. #define BKP_DATAR13_D ((uint16_t)0xFFFF) /* Backup data */
  1556. /******************* Bit definition for BKP_DATAR14 register *******************/
  1557. #define BKP_DATAR14_D ((uint16_t)0xFFFF) /* Backup data */
  1558. /******************* Bit definition for BKP_DATAR15 register *******************/
  1559. #define BKP_DATAR15_D ((uint16_t)0xFFFF) /* Backup data */
  1560. /******************* Bit definition for BKP_DATAR16 register *******************/
  1561. #define BKP_DATAR16_D ((uint16_t)0xFFFF) /* Backup data */
  1562. /******************* Bit definition for BKP_DATAR17 register *******************/
  1563. #define BKP_DATAR17_D ((uint16_t)0xFFFF) /* Backup data */
  1564. /****************** Bit definition for BKP_DATAR18 register ********************/
  1565. #define BKP_DATAR18_D ((uint16_t)0xFFFF) /* Backup data */
  1566. /******************* Bit definition for BKP_DATAR19 register *******************/
  1567. #define BKP_DATAR19_D ((uint16_t)0xFFFF) /* Backup data */
  1568. /******************* Bit definition for BKP_DATAR20 register *******************/
  1569. #define BKP_DATAR20_D ((uint16_t)0xFFFF) /* Backup data */
  1570. /******************* Bit definition for BKP_DATAR21 register *******************/
  1571. #define BKP_DATAR21_D ((uint16_t)0xFFFF) /* Backup data */
  1572. /******************* Bit definition for BKP_DATAR22 register *******************/
  1573. #define BKP_DATAR22_D ((uint16_t)0xFFFF) /* Backup data */
  1574. /******************* Bit definition for BKP_DATAR23 register *******************/
  1575. #define BKP_DATAR23_D ((uint16_t)0xFFFF) /* Backup data */
  1576. /******************* Bit definition for BKP_DATAR24 register *******************/
  1577. #define BKP_DATAR24_D ((uint16_t)0xFFFF) /* Backup data */
  1578. /******************* Bit definition for BKP_DATAR25 register *******************/
  1579. #define BKP_DATAR25_D ((uint16_t)0xFFFF) /* Backup data */
  1580. /******************* Bit definition for BKP_DATAR26 register *******************/
  1581. #define BKP_DATAR26_D ((uint16_t)0xFFFF) /* Backup data */
  1582. /******************* Bit definition for BKP_DATAR27 register *******************/
  1583. #define BKP_DATAR27_D ((uint16_t)0xFFFF) /* Backup data */
  1584. /******************* Bit definition for BKP_DATAR28 register *******************/
  1585. #define BKP_DATAR28_D ((uint16_t)0xFFFF) /* Backup data */
  1586. /******************* Bit definition for BKP_DATAR29 register *******************/
  1587. #define BKP_DATAR29_D ((uint16_t)0xFFFF) /* Backup data */
  1588. /******************* Bit definition for BKP_DATAR30 register *******************/
  1589. #define BKP_DATAR30_D ((uint16_t)0xFFFF) /* Backup data */
  1590. /******************* Bit definition for BKP_DATAR31 register *******************/
  1591. #define BKP_DATAR31_D ((uint16_t)0xFFFF) /* Backup data */
  1592. /******************* Bit definition for BKP_DATAR32 register *******************/
  1593. #define BKP_DATAR32_D ((uint16_t)0xFFFF) /* Backup data */
  1594. /******************* Bit definition for BKP_DATAR33 register *******************/
  1595. #define BKP_DATAR33_D ((uint16_t)0xFFFF) /* Backup data */
  1596. /******************* Bit definition for BKP_DATAR34 register *******************/
  1597. #define BKP_DATAR34_D ((uint16_t)0xFFFF) /* Backup data */
  1598. /******************* Bit definition for BKP_DATAR35 register *******************/
  1599. #define BKP_DATAR35_D ((uint16_t)0xFFFF) /* Backup data */
  1600. /******************* Bit definition for BKP_DATAR36 register *******************/
  1601. #define BKP_DATAR36_D ((uint16_t)0xFFFF) /* Backup data */
  1602. /******************* Bit definition for BKP_DATAR37 register *******************/
  1603. #define BKP_DATAR37_D ((uint16_t)0xFFFF) /* Backup data */
  1604. /******************* Bit definition for BKP_DATAR38 register *******************/
  1605. #define BKP_DATAR38_D ((uint16_t)0xFFFF) /* Backup data */
  1606. /******************* Bit definition for BKP_DATAR39 register *******************/
  1607. #define BKP_DATAR39_D ((uint16_t)0xFFFF) /* Backup data */
  1608. /******************* Bit definition for BKP_DATAR40 register *******************/
  1609. #define BKP_DATAR40_D ((uint16_t)0xFFFF) /* Backup data */
  1610. /******************* Bit definition for BKP_DATAR41 register *******************/
  1611. #define BKP_DATAR41_D ((uint16_t)0xFFFF) /* Backup data */
  1612. /******************* Bit definition for BKP_DATAR42 register *******************/
  1613. #define BKP_DATAR42_D ((uint16_t)0xFFFF) /* Backup data */
  1614. /****************** Bit definition for BKP_OCTLR register *******************/
  1615. #define BKP_CAL ((uint16_t)0x007F) /* Calibration value */
  1616. #define BKP_CCO ((uint16_t)0x0080) /* Calibration Clock Output */
  1617. #define BKP_ASOE ((uint16_t)0x0100) /* Alarm or Second Output Enable */
  1618. #define BKP_ASOS ((uint16_t)0x0200) /* Alarm or Second Output Selection */
  1619. /******************** Bit definition for BKP_TPCTLR register ********************/
  1620. #define BKP_TPE ((uint8_t)0x01) /* TAMPER pin enable */
  1621. #define BKP_TPAL ((uint8_t)0x02) /* TAMPER pin active level */
  1622. /******************* Bit definition for BKP_TPCSR register ********************/
  1623. #define BKP_CTE ((uint16_t)0x0001) /* Clear Tamper event */
  1624. #define BKP_CTI ((uint16_t)0x0002) /* Clear Tamper Interrupt */
  1625. #define BKP_TPIE ((uint16_t)0x0004) /* TAMPER Pin interrupt enable */
  1626. #define BKP_TEF ((uint16_t)0x0100) /* Tamper Event Flag */
  1627. #define BKP_TIF ((uint16_t)0x0200) /* Tamper Interrupt Flag */
  1628. /******************************************************************************/
  1629. /* Controller Area Network */
  1630. /******************************************************************************/
  1631. /******************* Bit definition for CAN_CTLR register ********************/
  1632. #define CAN_CTLR_INRQ ((uint16_t)0x0001) /* Initialization Request */
  1633. #define CAN_CTLR_SLEEP ((uint16_t)0x0002) /* Sleep Mode Request */
  1634. #define CAN_CTLR_TXFP ((uint16_t)0x0004) /* Transmit FIFO Priority */
  1635. #define CAN_CTLR_RFLM ((uint16_t)0x0008) /* Receive FIFO Locked Mode */
  1636. #define CAN_CTLR_NART ((uint16_t)0x0010) /* No Automatic Retransmission */
  1637. #define CAN_CTLR_AWUM ((uint16_t)0x0020) /* Automatic Wakeup Mode */
  1638. #define CAN_CTLR_ABOM ((uint16_t)0x0040) /* Automatic Bus-Off Management */
  1639. #define CAN_CTLR_TTCM ((uint16_t)0x0080) /* Time Triggered Communication Mode */
  1640. #define CAN_CTLR_RESET ((uint16_t)0x8000) /* CAN software master reset */
  1641. /******************* Bit definition for CAN_STATR register ********************/
  1642. #define CAN_STATR_INAK ((uint16_t)0x0001) /* Initialization Acknowledge */
  1643. #define CAN_STATR_SLAK ((uint16_t)0x0002) /* Sleep Acknowledge */
  1644. #define CAN_STATR_ERRI ((uint16_t)0x0004) /* Error Interrupt */
  1645. #define CAN_STATR_WKUI ((uint16_t)0x0008) /* Wakeup Interrupt */
  1646. #define CAN_STATR_SLAKI ((uint16_t)0x0010) /* Sleep Acknowledge Interrupt */
  1647. #define CAN_STATR_TXM ((uint16_t)0x0100) /* Transmit Mode */
  1648. #define CAN_STATR_RXM ((uint16_t)0x0200) /* Receive Mode */
  1649. #define CAN_STATR_SAMP ((uint16_t)0x0400) /* Last Sample Point */
  1650. #define CAN_STATR_RX ((uint16_t)0x0800) /* CAN Rx Signal */
  1651. /******************* Bit definition for CAN_TSTATR register ********************/
  1652. #define CAN_TSTATR_RQCP0 ((uint32_t)0x00000001) /* Request Completed Mailbox0 */
  1653. #define CAN_TSTATR_TXOK0 ((uint32_t)0x00000002) /* Transmission OK of Mailbox0 */
  1654. #define CAN_TSTATR_ALST0 ((uint32_t)0x00000004) /* Arbitration Lost for Mailbox0 */
  1655. #define CAN_TSTATR_TERR0 ((uint32_t)0x00000008) /* Transmission Error of Mailbox0 */
  1656. #define CAN_TSTATR_ABRQ0 ((uint32_t)0x00000080) /* Abort Request for Mailbox0 */
  1657. #define CAN_TSTATR_RQCP1 ((uint32_t)0x00000100) /* Request Completed Mailbox1 */
  1658. #define CAN_TSTATR_TXOK1 ((uint32_t)0x00000200) /* Transmission OK of Mailbox1 */
  1659. #define CAN_TSTATR_ALST1 ((uint32_t)0x00000400) /* Arbitration Lost for Mailbox1 */
  1660. #define CAN_TSTATR_TERR1 ((uint32_t)0x00000800) /* Transmission Error of Mailbox1 */
  1661. #define CAN_TSTATR_ABRQ1 ((uint32_t)0x00008000) /* Abort Request for Mailbox 1 */
  1662. #define CAN_TSTATR_RQCP2 ((uint32_t)0x00010000) /* Request Completed Mailbox2 */
  1663. #define CAN_TSTATR_TXOK2 ((uint32_t)0x00020000) /* Transmission OK of Mailbox 2 */
  1664. #define CAN_TSTATR_ALST2 ((uint32_t)0x00040000) /* Arbitration Lost for mailbox 2 */
  1665. #define CAN_TSTATR_TERR2 ((uint32_t)0x00080000) /* Transmission Error of Mailbox 2 */
  1666. #define CAN_TSTATR_ABRQ2 ((uint32_t)0x00800000) /* Abort Request for Mailbox 2 */
  1667. #define CAN_TSTATR_CODE ((uint32_t)0x03000000) /* Mailbox Code */
  1668. #define CAN_TSTATR_TME ((uint32_t)0x1C000000) /* TME[2:0] bits */
  1669. #define CAN_TSTATR_TME0 ((uint32_t)0x04000000) /* Transmit Mailbox 0 Empty */
  1670. #define CAN_TSTATR_TME1 ((uint32_t)0x08000000) /* Transmit Mailbox 1 Empty */
  1671. #define CAN_TSTATR_TME2 ((uint32_t)0x10000000) /* Transmit Mailbox 2 Empty */
  1672. #define CAN_TSTATR_LOW ((uint32_t)0xE0000000) /* LOW[2:0] bits */
  1673. #define CAN_TSTATR_LOW0 ((uint32_t)0x20000000) /* Lowest Priority Flag for Mailbox 0 */
  1674. #define CAN_TSTATR_LOW1 ((uint32_t)0x40000000) /* Lowest Priority Flag for Mailbox 1 */
  1675. #define CAN_TSTATR_LOW2 ((uint32_t)0x80000000) /* Lowest Priority Flag for Mailbox 2 */
  1676. /******************* Bit definition for CAN_RFIFO0 register *******************/
  1677. #define CAN_RFIFO0_FMP0 ((uint8_t)0x03) /* FIFO 0 Message Pending */
  1678. #define CAN_RFIFO0_FULL0 ((uint8_t)0x08) /* FIFO 0 Full */
  1679. #define CAN_RFIFO0_FOVR0 ((uint8_t)0x10) /* FIFO 0 Overrun */
  1680. #define CAN_RFIFO0_RFOM0 ((uint8_t)0x20) /* Release FIFO 0 Output Mailbox */
  1681. /******************* Bit definition for CAN_RFIFO1 register *******************/
  1682. #define CAN_RFIFO1_FMP1 ((uint8_t)0x03) /* FIFO 1 Message Pending */
  1683. #define CAN_RFIFO1_FULL1 ((uint8_t)0x08) /* FIFO 1 Full */
  1684. #define CAN_RFIFO1_FOVR1 ((uint8_t)0x10) /* FIFO 1 Overrun */
  1685. #define CAN_RFIFO1_RFOM1 ((uint8_t)0x20) /* Release FIFO 1 Output Mailbox */
  1686. /******************** Bit definition for CAN_INTENR register *******************/
  1687. #define CAN_INTENR_TMEIE ((uint32_t)0x00000001) /* Transmit Mailbox Empty Interrupt Enable */
  1688. #define CAN_INTENR_FMPIE0 ((uint32_t)0x00000002) /* FIFO Message Pending Interrupt Enable */
  1689. #define CAN_INTENR_FFIE0 ((uint32_t)0x00000004) /* FIFO Full Interrupt Enable */
  1690. #define CAN_INTENR_FOVIE0 ((uint32_t)0x00000008) /* FIFO Overrun Interrupt Enable */
  1691. #define CAN_INTENR_FMPIE1 ((uint32_t)0x00000010) /* FIFO Message Pending Interrupt Enable */
  1692. #define CAN_INTENR_FFIE1 ((uint32_t)0x00000020) /* FIFO Full Interrupt Enable */
  1693. #define CAN_INTENR_FOVIE1 ((uint32_t)0x00000040) /* FIFO Overrun Interrupt Enable */
  1694. #define CAN_INTENR_EWGIE ((uint32_t)0x00000100) /* Error Warning Interrupt Enable */
  1695. #define CAN_INTENR_EPVIE ((uint32_t)0x00000200) /* Error Passive Interrupt Enable */
  1696. #define CAN_INTENR_BOFIE ((uint32_t)0x00000400) /* Bus-Off Interrupt Enable */
  1697. #define CAN_INTENR_LECIE ((uint32_t)0x00000800) /* Last Error Code Interrupt Enable */
  1698. #define CAN_INTENR_ERRIE ((uint32_t)0x00008000) /* Error Interrupt Enable */
  1699. #define CAN_INTENR_WKUIE ((uint32_t)0x00010000) /* Wakeup Interrupt Enable */
  1700. #define CAN_INTENR_SLKIE ((uint32_t)0x00020000) /* Sleep Interrupt Enable */
  1701. /******************** Bit definition for CAN_ERRSR register *******************/
  1702. #define CAN_ERRSR_EWGF ((uint32_t)0x00000001) /* Error Warning Flag */
  1703. #define CAN_ERRSR_EPVF ((uint32_t)0x00000002) /* Error Passive Flag */
  1704. #define CAN_ERRSR_BOFF ((uint32_t)0x00000004) /* Bus-Off Flag */
  1705. #define CAN_ERRSR_LEC ((uint32_t)0x00000070) /* LEC[2:0] bits (Last Error Code) */
  1706. #define CAN_ERRSR_LEC_0 ((uint32_t)0x00000010) /* Bit 0 */
  1707. #define CAN_ERRSR_LEC_1 ((uint32_t)0x00000020) /* Bit 1 */
  1708. #define CAN_ERRSR_LEC_2 ((uint32_t)0x00000040) /* Bit 2 */
  1709. #define CAN_ERRSR_TEC ((uint32_t)0x00FF0000) /* Least significant byte of the 9-bit Transmit Error Counter */
  1710. #define CAN_ERRSR_REC ((uint32_t)0xFF000000) /* Receive Error Counter */
  1711. /******************* Bit definition for CAN_BTIMR register ********************/
  1712. #define CAN_BTIMR_BRP ((uint32_t)0x000003FF) /* Baud Rate Prescaler */
  1713. #define CAN_BTIMR_TS1 ((uint32_t)0x000F0000) /* Time Segment 1 */
  1714. #define CAN_BTIMR_TS2 ((uint32_t)0x00700000) /* Time Segment 2 */
  1715. #define CAN_BTIMR_SJW ((uint32_t)0x03000000) /* Resynchronization Jump Width */
  1716. #define CAN_BTIMR_LBKM ((uint32_t)0x40000000) /* Loop Back Mode (Debug) */
  1717. #define CAN_BTIMR_SILM ((uint32_t)0x80000000) /* Silent Mode */
  1718. /****************** Bit definition for CAN_TXMI0R register ********************/
  1719. #define CAN_TXMI0R_TXRQ ((uint32_t)0x00000001) /* Transmit Mailbox Request */
  1720. #define CAN_TXMI0R_RTR ((uint32_t)0x00000002) /* Remote Transmission Request */
  1721. #define CAN_TXMI0R_IDE ((uint32_t)0x00000004) /* Identifier Extension */
  1722. #define CAN_TXMI0R_EXID ((uint32_t)0x001FFFF8) /* Extended Identifier */
  1723. #define CAN_TXMI0R_STID ((uint32_t)0xFFE00000) /* Standard Identifier or Extended Identifier */
  1724. /****************** Bit definition for CAN_TXMDT0R register *******************/
  1725. #define CAN_TXMDT0R_DLC ((uint32_t)0x0000000F) /* Data Length Code */
  1726. #define CAN_TXMDT0R_TGT ((uint32_t)0x00000100) /* Transmit Global Time */
  1727. #define CAN_TXMDT0R_TIME ((uint32_t)0xFFFF0000) /* Message Time Stamp */
  1728. /****************** Bit definition for CAN_TXMDL0R register *******************/
  1729. #define CAN_TXMDL0R_DATA0 ((uint32_t)0x000000FF) /* Data byte 0 */
  1730. #define CAN_TXMDL0R_DATA1 ((uint32_t)0x0000FF00) /* Data byte 1 */
  1731. #define CAN_TXMDL0R_DATA2 ((uint32_t)0x00FF0000) /* Data byte 2 */
  1732. #define CAN_TXMDL0R_DATA3 ((uint32_t)0xFF000000) /* Data byte 3 */
  1733. /****************** Bit definition for CAN_TXMDH0R register *******************/
  1734. #define CAN_TXMDH0R_DATA4 ((uint32_t)0x000000FF) /* Data byte 4 */
  1735. #define CAN_TXMDH0R_DATA5 ((uint32_t)0x0000FF00) /* Data byte 5 */
  1736. #define CAN_TXMDH0R_DATA6 ((uint32_t)0x00FF0000) /* Data byte 6 */
  1737. #define CAN_TXMDH0R_DATA7 ((uint32_t)0xFF000000) /* Data byte 7 */
  1738. /******************* Bit definition for CAN_TXMI1R register *******************/
  1739. #define CAN_TXMI1R_TXRQ ((uint32_t)0x00000001) /* Transmit Mailbox Request */
  1740. #define CAN_TXMI1R_RTR ((uint32_t)0x00000002) /* Remote Transmission Request */
  1741. #define CAN_TXMI1R_IDE ((uint32_t)0x00000004) /* Identifier Extension */
  1742. #define CAN_TXMI1R_EXID ((uint32_t)0x001FFFF8) /* Extended Identifier */
  1743. #define CAN_TXMI1R_STID ((uint32_t)0xFFE00000) /* Standard Identifier or Extended Identifier */
  1744. /******************* Bit definition for CAN_TXMDT1R register ******************/
  1745. #define CAN_TXMDT1R_DLC ((uint32_t)0x0000000F) /* Data Length Code */
  1746. #define CAN_TXMDT1R_TGT ((uint32_t)0x00000100) /* Transmit Global Time */
  1747. #define CAN_TXMDT1R_TIME ((uint32_t)0xFFFF0000) /* Message Time Stamp */
  1748. /******************* Bit definition for CAN_TXMDL1R register ******************/
  1749. #define CAN_TXMDL1R_DATA0 ((uint32_t)0x000000FF) /* Data byte 0 */
  1750. #define CAN_TXMDL1R_DATA1 ((uint32_t)0x0000FF00) /* Data byte 1 */
  1751. #define CAN_TXMDL1R_DATA2 ((uint32_t)0x00FF0000) /* Data byte 2 */
  1752. #define CAN_TXMDL1R_DATA3 ((uint32_t)0xFF000000) /* Data byte 3 */
  1753. /******************* Bit definition for CAN_TXMDH1R register ******************/
  1754. #define CAN_TXMDH1R_DATA4 ((uint32_t)0x000000FF) /* Data byte 4 */
  1755. #define CAN_TXMDH1R_DATA5 ((uint32_t)0x0000FF00) /* Data byte 5 */
  1756. #define CAN_TXMDH1R_DATA6 ((uint32_t)0x00FF0000) /* Data byte 6 */
  1757. #define CAN_TXMDH1R_DATA7 ((uint32_t)0xFF000000) /* Data byte 7 */
  1758. /******************* Bit definition for CAN_TXMI2R register *******************/
  1759. #define CAN_TXMI2R_TXRQ ((uint32_t)0x00000001) /* Transmit Mailbox Request */
  1760. #define CAN_TXMI2R_RTR ((uint32_t)0x00000002) /* Remote Transmission Request */
  1761. #define CAN_TXMI2R_IDE ((uint32_t)0x00000004) /* Identifier Extension */
  1762. #define CAN_TXMI2R_EXID ((uint32_t)0x001FFFF8) /* Extended identifier */
  1763. #define CAN_TXMI2R_STID ((uint32_t)0xFFE00000) /* Standard Identifier or Extended Identifier */
  1764. /******************* Bit definition for CAN_TXMDT2R register ******************/
  1765. #define CAN_TXMDT2R_DLC ((uint32_t)0x0000000F) /* Data Length Code */
  1766. #define CAN_TXMDT2R_TGT ((uint32_t)0x00000100) /* Transmit Global Time */
  1767. #define CAN_TXMDT2R_TIME ((uint32_t)0xFFFF0000) /* Message Time Stamp */
  1768. /******************* Bit definition for CAN_TXMDL2R register ******************/
  1769. #define CAN_TXMDL2R_DATA0 ((uint32_t)0x000000FF) /* Data byte 0 */
  1770. #define CAN_TXMDL2R_DATA1 ((uint32_t)0x0000FF00) /* Data byte 1 */
  1771. #define CAN_TXMDL2R_DATA2 ((uint32_t)0x00FF0000) /* Data byte 2 */
  1772. #define CAN_TXMDL2R_DATA3 ((uint32_t)0xFF000000) /* Data byte 3 */
  1773. /******************* Bit definition for CAN_TXMDH2R register ******************/
  1774. #define CAN_TXMDH2R_DATA4 ((uint32_t)0x000000FF) /* Data byte 4 */
  1775. #define CAN_TXMDH2R_DATA5 ((uint32_t)0x0000FF00) /* Data byte 5 */
  1776. #define CAN_TXMDH2R_DATA6 ((uint32_t)0x00FF0000) /* Data byte 6 */
  1777. #define CAN_TXMDH2R_DATA7 ((uint32_t)0xFF000000) /* Data byte 7 */
  1778. /******************* Bit definition for CAN_RXMI0R register *******************/
  1779. #define CAN_RXMI0R_RTR ((uint32_t)0x00000002) /* Remote Transmission Request */
  1780. #define CAN_RXMI0R_IDE ((uint32_t)0x00000004) /* Identifier Extension */
  1781. #define CAN_RXMI0R_EXID ((uint32_t)0x001FFFF8) /* Extended Identifier */
  1782. #define CAN_RXMI0R_STID ((uint32_t)0xFFE00000) /* Standard Identifier or Extended Identifier */
  1783. /******************* Bit definition for CAN_RXMDT0R register ******************/
  1784. #define CAN_RXMDT0R_DLC ((uint32_t)0x0000000F) /* Data Length Code */
  1785. #define CAN_RXMDT0R_FMI ((uint32_t)0x0000FF00) /* Filter Match Index */
  1786. #define CAN_RXMDT0R_TIME ((uint32_t)0xFFFF0000) /* Message Time Stamp */
  1787. /******************* Bit definition for CAN_RXMDL0R register ******************/
  1788. #define CAN_RXMDL0R_DATA0 ((uint32_t)0x000000FF) /* Data byte 0 */
  1789. #define CAN_RXMDL0R_DATA1 ((uint32_t)0x0000FF00) /* Data byte 1 */
  1790. #define CAN_RXMDL0R_DATA2 ((uint32_t)0x00FF0000) /* Data byte 2 */
  1791. #define CAN_RXMDL0R_DATA3 ((uint32_t)0xFF000000) /* Data byte 3 */
  1792. /******************* Bit definition for CAN_RXMDH0R register ******************/
  1793. #define CAN_RXMDH0R_DATA4 ((uint32_t)0x000000FF) /* Data byte 4 */
  1794. #define CAN_RXMDH0R_DATA5 ((uint32_t)0x0000FF00) /* Data byte 5 */
  1795. #define CAN_RXMDH0R_DATA6 ((uint32_t)0x00FF0000) /* Data byte 6 */
  1796. #define CAN_RXMDH0R_DATA7 ((uint32_t)0xFF000000) /* Data byte 7 */
  1797. /******************* Bit definition for CAN_RXMI1R register *******************/
  1798. #define CAN_RXMI1R_RTR ((uint32_t)0x00000002) /* Remote Transmission Request */
  1799. #define CAN_RXMI1R_IDE ((uint32_t)0x00000004) /* Identifier Extension */
  1800. #define CAN_RXMI1R_EXID ((uint32_t)0x001FFFF8) /* Extended identifier */
  1801. #define CAN_RXMI1R_STID ((uint32_t)0xFFE00000) /* Standard Identifier or Extended Identifier */
  1802. /******************* Bit definition for CAN_RXMDT1R register ******************/
  1803. #define CAN_RXMDT1R_DLC ((uint32_t)0x0000000F) /* Data Length Code */
  1804. #define CAN_RXMDT1R_FMI ((uint32_t)0x0000FF00) /* Filter Match Index */
  1805. #define CAN_RXMDT1R_TIME ((uint32_t)0xFFFF0000) /* Message Time Stamp */
  1806. /******************* Bit definition for CAN_RXMDL1R register ******************/
  1807. #define CAN_RXMDL1R_DATA0 ((uint32_t)0x000000FF) /* Data byte 0 */
  1808. #define CAN_RXMDL1R_DATA1 ((uint32_t)0x0000FF00) /* Data byte 1 */
  1809. #define CAN_RXMDL1R_DATA2 ((uint32_t)0x00FF0000) /* Data byte 2 */
  1810. #define CAN_RXMDL1R_DATA3 ((uint32_t)0xFF000000) /* Data byte 3 */
  1811. /******************* Bit definition for CAN_RXMDH1R register ******************/
  1812. #define CAN_RXMDH1R_DATA4 ((uint32_t)0x000000FF) /* Data byte 4 */
  1813. #define CAN_RXMDH1R_DATA5 ((uint32_t)0x0000FF00) /* Data byte 5 */
  1814. #define CAN_RXMDH1R_DATA6 ((uint32_t)0x00FF0000) /* Data byte 6 */
  1815. #define CAN_RXMDH1R_DATA7 ((uint32_t)0xFF000000) /* Data byte 7 */
  1816. /******************* Bit definition for CAN_FCTLR register ********************/
  1817. #define CAN_FCTLR_FINIT ((uint8_t)0x01) /* Filter Init Mode */
  1818. /******************* Bit definition for CAN_FMCFGR register *******************/
  1819. #define CAN_FMCFGR_FBM ((uint16_t)0x3FFF) /* Filter Mode */
  1820. #define CAN_FMCFGR_FBM0 ((uint16_t)0x0001) /* Filter Init Mode bit 0 */
  1821. #define CAN_FMCFGR_FBM1 ((uint16_t)0x0002) /* Filter Init Mode bit 1 */
  1822. #define CAN_FMCFGR_FBM2 ((uint16_t)0x0004) /* Filter Init Mode bit 2 */
  1823. #define CAN_FMCFGR_FBM3 ((uint16_t)0x0008) /* Filter Init Mode bit 3 */
  1824. #define CAN_FMCFGR_FBM4 ((uint16_t)0x0010) /* Filter Init Mode bit 4 */
  1825. #define CAN_FMCFGR_FBM5 ((uint16_t)0x0020) /* Filter Init Mode bit 5 */
  1826. #define CAN_FMCFGR_FBM6 ((uint16_t)0x0040) /* Filter Init Mode bit 6 */
  1827. #define CAN_FMCFGR_FBM7 ((uint16_t)0x0080) /* Filter Init Mode bit 7 */
  1828. #define CAN_FMCFGR_FBM8 ((uint16_t)0x0100) /* Filter Init Mode bit 8 */
  1829. #define CAN_FMCFGR_FBM9 ((uint16_t)0x0200) /* Filter Init Mode bit 9 */
  1830. #define CAN_FMCFGR_FBM10 ((uint16_t)0x0400) /* Filter Init Mode bit 10 */
  1831. #define CAN_FMCFGR_FBM11 ((uint16_t)0x0800) /* Filter Init Mode bit 11 */
  1832. #define CAN_FMCFGR_FBM12 ((uint16_t)0x1000) /* Filter Init Mode bit 12 */
  1833. #define CAN_FMCFGR_FBM13 ((uint16_t)0x2000) /* Filter Init Mode bit 13 */
  1834. /******************* Bit definition for CAN_FSCFGR register *******************/
  1835. #define CAN_FSCFGR_FSC ((uint16_t)0x3FFF) /* Filter Scale Configuration */
  1836. #define CAN_FSCFGR_FSC0 ((uint16_t)0x0001) /* Filter Scale Configuration bit 0 */
  1837. #define CAN_FSCFGR_FSC1 ((uint16_t)0x0002) /* Filter Scale Configuration bit 1 */
  1838. #define CAN_FSCFGR_FSC2 ((uint16_t)0x0004) /* Filter Scale Configuration bit 2 */
  1839. #define CAN_FSCFGR_FSC3 ((uint16_t)0x0008) /* Filter Scale Configuration bit 3 */
  1840. #define CAN_FSCFGR_FSC4 ((uint16_t)0x0010) /* Filter Scale Configuration bit 4 */
  1841. #define CAN_FSCFGR_FSC5 ((uint16_t)0x0020) /* Filter Scale Configuration bit 5 */
  1842. #define CAN_FSCFGR_FSC6 ((uint16_t)0x0040) /* Filter Scale Configuration bit 6 */
  1843. #define CAN_FSCFGR_FSC7 ((uint16_t)0x0080) /* Filter Scale Configuration bit 7 */
  1844. #define CAN_FSCFGR_FSC8 ((uint16_t)0x0100) /* Filter Scale Configuration bit 8 */
  1845. #define CAN_FSCFGR_FSC9 ((uint16_t)0x0200) /* Filter Scale Configuration bit 9 */
  1846. #define CAN_FSCFGR_FSC10 ((uint16_t)0x0400) /* Filter Scale Configuration bit 10 */
  1847. #define CAN_FSCFGR_FSC11 ((uint16_t)0x0800) /* Filter Scale Configuration bit 11 */
  1848. #define CAN_FSCFGR_FSC12 ((uint16_t)0x1000) /* Filter Scale Configuration bit 12 */
  1849. #define CAN_FSCFGR_FSC13 ((uint16_t)0x2000) /* Filter Scale Configuration bit 13 */
  1850. /****************** Bit definition for CAN_FAFIFOR register *******************/
  1851. #define CAN_FAFIFOR_FFA ((uint16_t)0x3FFF) /* Filter FIFO Assignment */
  1852. #define CAN_FAFIFOR_FFA0 ((uint16_t)0x0001) /* Filter FIFO Assignment for Filter 0 */
  1853. #define CAN_FAFIFOR_FFA1 ((uint16_t)0x0002) /* Filter FIFO Assignment for Filter 1 */
  1854. #define CAN_FAFIFOR_FFA2 ((uint16_t)0x0004) /* Filter FIFO Assignment for Filter 2 */
  1855. #define CAN_FAFIFOR_FFA3 ((uint16_t)0x0008) /* Filter FIFO Assignment for Filter 3 */
  1856. #define CAN_FAFIFOR_FFA4 ((uint16_t)0x0010) /* Filter FIFO Assignment for Filter 4 */
  1857. #define CAN_FAFIFOR_FFA5 ((uint16_t)0x0020) /* Filter FIFO Assignment for Filter 5 */
  1858. #define CAN_FAFIFOR_FFA6 ((uint16_t)0x0040) /* Filter FIFO Assignment for Filter 6 */
  1859. #define CAN_FAFIFOR_FFA7 ((uint16_t)0x0080) /* Filter FIFO Assignment for Filter 7 */
  1860. #define CAN_FAFIFOR_FFA8 ((uint16_t)0x0100) /* Filter FIFO Assignment for Filter 8 */
  1861. #define CAN_FAFIFOR_FFA9 ((uint16_t)0x0200) /* Filter FIFO Assignment for Filter 9 */
  1862. #define CAN_FAFIFOR_FFA10 ((uint16_t)0x0400) /* Filter FIFO Assignment for Filter 10 */
  1863. #define CAN_FAFIFOR_FFA11 ((uint16_t)0x0800) /* Filter FIFO Assignment for Filter 11 */
  1864. #define CAN_FAFIFOR_FFA12 ((uint16_t)0x1000) /* Filter FIFO Assignment for Filter 12 */
  1865. #define CAN_FAFIFOR_FFA13 ((uint16_t)0x2000) /* Filter FIFO Assignment for Filter 13 */
  1866. /******************* Bit definition for CAN_FWR register *******************/
  1867. #define CAN_FWR_FACT ((uint16_t)0x3FFF) /* Filter Active */
  1868. #define CAN_FWR_FACT0 ((uint16_t)0x0001) /* Filter 0 Active */
  1869. #define CAN_FWR_FACT1 ((uint16_t)0x0002) /* Filter 1 Active */
  1870. #define CAN_FWR_FACT2 ((uint16_t)0x0004) /* Filter 2 Active */
  1871. #define CAN_FWR_FACT3 ((uint16_t)0x0008) /* Filter 3 Active */
  1872. #define CAN_FWR_FACT4 ((uint16_t)0x0010) /* Filter 4 Active */
  1873. #define CAN_FWR_FACT5 ((uint16_t)0x0020) /* Filter 5 Active */
  1874. #define CAN_FWR_FACT6 ((uint16_t)0x0040) /* Filter 6 Active */
  1875. #define CAN_FWR_FACT7 ((uint16_t)0x0080) /* Filter 7 Active */
  1876. #define CAN_FWR_FACT8 ((uint16_t)0x0100) /* Filter 8 Active */
  1877. #define CAN_FWR_FACT9 ((uint16_t)0x0200) /* Filter 9 Active */
  1878. #define CAN_FWR_FACT10 ((uint16_t)0x0400) /* Filter 10 Active */
  1879. #define CAN_FWR_FACT11 ((uint16_t)0x0800) /* Filter 11 Active */
  1880. #define CAN_FWR_FACT12 ((uint16_t)0x1000) /* Filter 12 Active */
  1881. #define CAN_FWR_FACT13 ((uint16_t)0x2000) /* Filter 13 Active */
  1882. /******************* Bit definition for CAN_F0R1 register *******************/
  1883. #define CAN_F0R1_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  1884. #define CAN_F0R1_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  1885. #define CAN_F0R1_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  1886. #define CAN_F0R1_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  1887. #define CAN_F0R1_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  1888. #define CAN_F0R1_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  1889. #define CAN_F0R1_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  1890. #define CAN_F0R1_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  1891. #define CAN_F0R1_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  1892. #define CAN_F0R1_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  1893. #define CAN_F0R1_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  1894. #define CAN_F0R1_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  1895. #define CAN_F0R1_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  1896. #define CAN_F0R1_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  1897. #define CAN_F0R1_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  1898. #define CAN_F0R1_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  1899. #define CAN_F0R1_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  1900. #define CAN_F0R1_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  1901. #define CAN_F0R1_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  1902. #define CAN_F0R1_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  1903. #define CAN_F0R1_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  1904. #define CAN_F0R1_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  1905. #define CAN_F0R1_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  1906. #define CAN_F0R1_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  1907. #define CAN_F0R1_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  1908. #define CAN_F0R1_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  1909. #define CAN_F0R1_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  1910. #define CAN_F0R1_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  1911. #define CAN_F0R1_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  1912. #define CAN_F0R1_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  1913. #define CAN_F0R1_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  1914. #define CAN_F0R1_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  1915. /******************* Bit definition for CAN_F1R1 register *******************/
  1916. #define CAN_F1R1_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  1917. #define CAN_F1R1_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  1918. #define CAN_F1R1_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  1919. #define CAN_F1R1_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  1920. #define CAN_F1R1_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  1921. #define CAN_F1R1_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  1922. #define CAN_F1R1_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  1923. #define CAN_F1R1_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  1924. #define CAN_F1R1_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  1925. #define CAN_F1R1_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  1926. #define CAN_F1R1_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  1927. #define CAN_F1R1_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  1928. #define CAN_F1R1_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  1929. #define CAN_F1R1_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  1930. #define CAN_F1R1_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  1931. #define CAN_F1R1_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  1932. #define CAN_F1R1_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  1933. #define CAN_F1R1_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  1934. #define CAN_F1R1_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  1935. #define CAN_F1R1_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  1936. #define CAN_F1R1_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  1937. #define CAN_F1R1_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  1938. #define CAN_F1R1_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  1939. #define CAN_F1R1_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  1940. #define CAN_F1R1_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  1941. #define CAN_F1R1_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  1942. #define CAN_F1R1_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  1943. #define CAN_F1R1_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  1944. #define CAN_F1R1_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  1945. #define CAN_F1R1_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  1946. #define CAN_F1R1_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  1947. #define CAN_F1R1_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  1948. /******************* Bit definition for CAN_F2R1 register *******************/
  1949. #define CAN_F2R1_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  1950. #define CAN_F2R1_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  1951. #define CAN_F2R1_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  1952. #define CAN_F2R1_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  1953. #define CAN_F2R1_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  1954. #define CAN_F2R1_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  1955. #define CAN_F2R1_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  1956. #define CAN_F2R1_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  1957. #define CAN_F2R1_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  1958. #define CAN_F2R1_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  1959. #define CAN_F2R1_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  1960. #define CAN_F2R1_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  1961. #define CAN_F2R1_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  1962. #define CAN_F2R1_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  1963. #define CAN_F2R1_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  1964. #define CAN_F2R1_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  1965. #define CAN_F2R1_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  1966. #define CAN_F2R1_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  1967. #define CAN_F2R1_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  1968. #define CAN_F2R1_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  1969. #define CAN_F2R1_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  1970. #define CAN_F2R1_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  1971. #define CAN_F2R1_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  1972. #define CAN_F2R1_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  1973. #define CAN_F2R1_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  1974. #define CAN_F2R1_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  1975. #define CAN_F2R1_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  1976. #define CAN_F2R1_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  1977. #define CAN_F2R1_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  1978. #define CAN_F2R1_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  1979. #define CAN_F2R1_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  1980. #define CAN_F2R1_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  1981. /******************* Bit definition for CAN_F3R1 register *******************/
  1982. #define CAN_F3R1_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  1983. #define CAN_F3R1_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  1984. #define CAN_F3R1_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  1985. #define CAN_F3R1_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  1986. #define CAN_F3R1_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  1987. #define CAN_F3R1_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  1988. #define CAN_F3R1_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  1989. #define CAN_F3R1_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  1990. #define CAN_F3R1_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  1991. #define CAN_F3R1_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  1992. #define CAN_F3R1_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  1993. #define CAN_F3R1_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  1994. #define CAN_F3R1_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  1995. #define CAN_F3R1_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  1996. #define CAN_F3R1_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  1997. #define CAN_F3R1_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  1998. #define CAN_F3R1_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  1999. #define CAN_F3R1_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2000. #define CAN_F3R1_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2001. #define CAN_F3R1_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2002. #define CAN_F3R1_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2003. #define CAN_F3R1_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2004. #define CAN_F3R1_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2005. #define CAN_F3R1_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2006. #define CAN_F3R1_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2007. #define CAN_F3R1_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2008. #define CAN_F3R1_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2009. #define CAN_F3R1_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2010. #define CAN_F3R1_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2011. #define CAN_F3R1_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2012. #define CAN_F3R1_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2013. #define CAN_F3R1_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2014. /******************* Bit definition for CAN_F4R1 register *******************/
  2015. #define CAN_F4R1_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2016. #define CAN_F4R1_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2017. #define CAN_F4R1_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2018. #define CAN_F4R1_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2019. #define CAN_F4R1_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2020. #define CAN_F4R1_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2021. #define CAN_F4R1_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2022. #define CAN_F4R1_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2023. #define CAN_F4R1_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2024. #define CAN_F4R1_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2025. #define CAN_F4R1_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2026. #define CAN_F4R1_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2027. #define CAN_F4R1_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2028. #define CAN_F4R1_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2029. #define CAN_F4R1_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2030. #define CAN_F4R1_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2031. #define CAN_F4R1_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2032. #define CAN_F4R1_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2033. #define CAN_F4R1_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2034. #define CAN_F4R1_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2035. #define CAN_F4R1_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2036. #define CAN_F4R1_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2037. #define CAN_F4R1_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2038. #define CAN_F4R1_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2039. #define CAN_F4R1_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2040. #define CAN_F4R1_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2041. #define CAN_F4R1_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2042. #define CAN_F4R1_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2043. #define CAN_F4R1_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2044. #define CAN_F4R1_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2045. #define CAN_F4R1_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2046. #define CAN_F4R1_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2047. /******************* Bit definition for CAN_F5R1 register *******************/
  2048. #define CAN_F5R1_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2049. #define CAN_F5R1_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2050. #define CAN_F5R1_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2051. #define CAN_F5R1_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2052. #define CAN_F5R1_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2053. #define CAN_F5R1_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2054. #define CAN_F5R1_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2055. #define CAN_F5R1_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2056. #define CAN_F5R1_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2057. #define CAN_F5R1_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2058. #define CAN_F5R1_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2059. #define CAN_F5R1_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2060. #define CAN_F5R1_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2061. #define CAN_F5R1_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2062. #define CAN_F5R1_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2063. #define CAN_F5R1_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2064. #define CAN_F5R1_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2065. #define CAN_F5R1_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2066. #define CAN_F5R1_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2067. #define CAN_F5R1_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2068. #define CAN_F5R1_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2069. #define CAN_F5R1_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2070. #define CAN_F5R1_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2071. #define CAN_F5R1_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2072. #define CAN_F5R1_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2073. #define CAN_F5R1_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2074. #define CAN_F5R1_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2075. #define CAN_F5R1_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2076. #define CAN_F5R1_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2077. #define CAN_F5R1_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2078. #define CAN_F5R1_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2079. #define CAN_F5R1_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2080. /******************* Bit definition for CAN_F6R1 register *******************/
  2081. #define CAN_F6R1_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2082. #define CAN_F6R1_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2083. #define CAN_F6R1_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2084. #define CAN_F6R1_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2085. #define CAN_F6R1_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2086. #define CAN_F6R1_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2087. #define CAN_F6R1_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2088. #define CAN_F6R1_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2089. #define CAN_F6R1_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2090. #define CAN_F6R1_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2091. #define CAN_F6R1_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2092. #define CAN_F6R1_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2093. #define CAN_F6R1_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2094. #define CAN_F6R1_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2095. #define CAN_F6R1_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2096. #define CAN_F6R1_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2097. #define CAN_F6R1_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2098. #define CAN_F6R1_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2099. #define CAN_F6R1_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2100. #define CAN_F6R1_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2101. #define CAN_F6R1_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2102. #define CAN_F6R1_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2103. #define CAN_F6R1_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2104. #define CAN_F6R1_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2105. #define CAN_F6R1_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2106. #define CAN_F6R1_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2107. #define CAN_F6R1_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2108. #define CAN_F6R1_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2109. #define CAN_F6R1_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2110. #define CAN_F6R1_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2111. #define CAN_F6R1_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2112. #define CAN_F6R1_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2113. /******************* Bit definition for CAN_F7R1 register *******************/
  2114. #define CAN_F7R1_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2115. #define CAN_F7R1_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2116. #define CAN_F7R1_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2117. #define CAN_F7R1_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2118. #define CAN_F7R1_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2119. #define CAN_F7R1_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2120. #define CAN_F7R1_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2121. #define CAN_F7R1_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2122. #define CAN_F7R1_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2123. #define CAN_F7R1_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2124. #define CAN_F7R1_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2125. #define CAN_F7R1_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2126. #define CAN_F7R1_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2127. #define CAN_F7R1_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2128. #define CAN_F7R1_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2129. #define CAN_F7R1_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2130. #define CAN_F7R1_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2131. #define CAN_F7R1_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2132. #define CAN_F7R1_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2133. #define CAN_F7R1_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2134. #define CAN_F7R1_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2135. #define CAN_F7R1_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2136. #define CAN_F7R1_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2137. #define CAN_F7R1_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2138. #define CAN_F7R1_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2139. #define CAN_F7R1_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2140. #define CAN_F7R1_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2141. #define CAN_F7R1_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2142. #define CAN_F7R1_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2143. #define CAN_F7R1_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2144. #define CAN_F7R1_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2145. #define CAN_F7R1_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2146. /******************* Bit definition for CAN_F8R1 register *******************/
  2147. #define CAN_F8R1_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2148. #define CAN_F8R1_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2149. #define CAN_F8R1_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2150. #define CAN_F8R1_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2151. #define CAN_F8R1_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2152. #define CAN_F8R1_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2153. #define CAN_F8R1_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2154. #define CAN_F8R1_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2155. #define CAN_F8R1_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2156. #define CAN_F8R1_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2157. #define CAN_F8R1_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2158. #define CAN_F8R1_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2159. #define CAN_F8R1_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2160. #define CAN_F8R1_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2161. #define CAN_F8R1_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2162. #define CAN_F8R1_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2163. #define CAN_F8R1_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2164. #define CAN_F8R1_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2165. #define CAN_F8R1_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2166. #define CAN_F8R1_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2167. #define CAN_F8R1_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2168. #define CAN_F8R1_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2169. #define CAN_F8R1_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2170. #define CAN_F8R1_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2171. #define CAN_F8R1_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2172. #define CAN_F8R1_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2173. #define CAN_F8R1_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2174. #define CAN_F8R1_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2175. #define CAN_F8R1_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2176. #define CAN_F8R1_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2177. #define CAN_F8R1_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2178. #define CAN_F8R1_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2179. /******************* Bit definition for CAN_F9R1 register *******************/
  2180. #define CAN_F9R1_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2181. #define CAN_F9R1_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2182. #define CAN_F9R1_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2183. #define CAN_F9R1_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2184. #define CAN_F9R1_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2185. #define CAN_F9R1_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2186. #define CAN_F9R1_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2187. #define CAN_F9R1_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2188. #define CAN_F9R1_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2189. #define CAN_F9R1_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2190. #define CAN_F9R1_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2191. #define CAN_F9R1_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2192. #define CAN_F9R1_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2193. #define CAN_F9R1_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2194. #define CAN_F9R1_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2195. #define CAN_F9R1_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2196. #define CAN_F9R1_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2197. #define CAN_F9R1_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2198. #define CAN_F9R1_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2199. #define CAN_F9R1_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2200. #define CAN_F9R1_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2201. #define CAN_F9R1_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2202. #define CAN_F9R1_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2203. #define CAN_F9R1_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2204. #define CAN_F9R1_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2205. #define CAN_F9R1_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2206. #define CAN_F9R1_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2207. #define CAN_F9R1_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2208. #define CAN_F9R1_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2209. #define CAN_F9R1_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2210. #define CAN_F9R1_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2211. #define CAN_F9R1_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2212. /******************* Bit definition for CAN_F10R1 register ******************/
  2213. #define CAN_F10R1_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2214. #define CAN_F10R1_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2215. #define CAN_F10R1_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2216. #define CAN_F10R1_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2217. #define CAN_F10R1_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2218. #define CAN_F10R1_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2219. #define CAN_F10R1_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2220. #define CAN_F10R1_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2221. #define CAN_F10R1_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2222. #define CAN_F10R1_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2223. #define CAN_F10R1_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2224. #define CAN_F10R1_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2225. #define CAN_F10R1_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2226. #define CAN_F10R1_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2227. #define CAN_F10R1_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2228. #define CAN_F10R1_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2229. #define CAN_F10R1_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2230. #define CAN_F10R1_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2231. #define CAN_F10R1_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2232. #define CAN_F10R1_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2233. #define CAN_F10R1_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2234. #define CAN_F10R1_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2235. #define CAN_F10R1_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2236. #define CAN_F10R1_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2237. #define CAN_F10R1_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2238. #define CAN_F10R1_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2239. #define CAN_F10R1_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2240. #define CAN_F10R1_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2241. #define CAN_F10R1_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2242. #define CAN_F10R1_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2243. #define CAN_F10R1_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2244. #define CAN_F10R1_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2245. /******************* Bit definition for CAN_F11R1 register ******************/
  2246. #define CAN_F11R1_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2247. #define CAN_F11R1_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2248. #define CAN_F11R1_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2249. #define CAN_F11R1_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2250. #define CAN_F11R1_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2251. #define CAN_F11R1_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2252. #define CAN_F11R1_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2253. #define CAN_F11R1_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2254. #define CAN_F11R1_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2255. #define CAN_F11R1_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2256. #define CAN_F11R1_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2257. #define CAN_F11R1_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2258. #define CAN_F11R1_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2259. #define CAN_F11R1_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2260. #define CAN_F11R1_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2261. #define CAN_F11R1_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2262. #define CAN_F11R1_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2263. #define CAN_F11R1_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2264. #define CAN_F11R1_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2265. #define CAN_F11R1_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2266. #define CAN_F11R1_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2267. #define CAN_F11R1_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2268. #define CAN_F11R1_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2269. #define CAN_F11R1_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2270. #define CAN_F11R1_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2271. #define CAN_F11R1_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2272. #define CAN_F11R1_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2273. #define CAN_F11R1_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2274. #define CAN_F11R1_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2275. #define CAN_F11R1_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2276. #define CAN_F11R1_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2277. #define CAN_F11R1_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2278. /******************* Bit definition for CAN_F12R1 register ******************/
  2279. #define CAN_F12R1_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2280. #define CAN_F12R1_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2281. #define CAN_F12R1_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2282. #define CAN_F12R1_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2283. #define CAN_F12R1_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2284. #define CAN_F12R1_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2285. #define CAN_F12R1_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2286. #define CAN_F12R1_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2287. #define CAN_F12R1_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2288. #define CAN_F12R1_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2289. #define CAN_F12R1_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2290. #define CAN_F12R1_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2291. #define CAN_F12R1_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2292. #define CAN_F12R1_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2293. #define CAN_F12R1_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2294. #define CAN_F12R1_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2295. #define CAN_F12R1_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2296. #define CAN_F12R1_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2297. #define CAN_F12R1_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2298. #define CAN_F12R1_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2299. #define CAN_F12R1_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2300. #define CAN_F12R1_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2301. #define CAN_F12R1_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2302. #define CAN_F12R1_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2303. #define CAN_F12R1_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2304. #define CAN_F12R1_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2305. #define CAN_F12R1_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2306. #define CAN_F12R1_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2307. #define CAN_F12R1_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2308. #define CAN_F12R1_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2309. #define CAN_F12R1_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2310. #define CAN_F12R1_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2311. /******************* Bit definition for CAN_F13R1 register ******************/
  2312. #define CAN_F13R1_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2313. #define CAN_F13R1_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2314. #define CAN_F13R1_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2315. #define CAN_F13R1_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2316. #define CAN_F13R1_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2317. #define CAN_F13R1_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2318. #define CAN_F13R1_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2319. #define CAN_F13R1_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2320. #define CAN_F13R1_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2321. #define CAN_F13R1_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2322. #define CAN_F13R1_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2323. #define CAN_F13R1_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2324. #define CAN_F13R1_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2325. #define CAN_F13R1_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2326. #define CAN_F13R1_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2327. #define CAN_F13R1_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2328. #define CAN_F13R1_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2329. #define CAN_F13R1_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2330. #define CAN_F13R1_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2331. #define CAN_F13R1_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2332. #define CAN_F13R1_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2333. #define CAN_F13R1_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2334. #define CAN_F13R1_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2335. #define CAN_F13R1_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2336. #define CAN_F13R1_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2337. #define CAN_F13R1_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2338. #define CAN_F13R1_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2339. #define CAN_F13R1_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2340. #define CAN_F13R1_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2341. #define CAN_F13R1_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2342. #define CAN_F13R1_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2343. #define CAN_F13R1_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2344. /******************* Bit definition for CAN_F0R2 register *******************/
  2345. #define CAN_F0R2_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2346. #define CAN_F0R2_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2347. #define CAN_F0R2_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2348. #define CAN_F0R2_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2349. #define CAN_F0R2_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2350. #define CAN_F0R2_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2351. #define CAN_F0R2_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2352. #define CAN_F0R2_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2353. #define CAN_F0R2_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2354. #define CAN_F0R2_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2355. #define CAN_F0R2_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2356. #define CAN_F0R2_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2357. #define CAN_F0R2_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2358. #define CAN_F0R2_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2359. #define CAN_F0R2_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2360. #define CAN_F0R2_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2361. #define CAN_F0R2_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2362. #define CAN_F0R2_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2363. #define CAN_F0R2_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2364. #define CAN_F0R2_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2365. #define CAN_F0R2_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2366. #define CAN_F0R2_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2367. #define CAN_F0R2_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2368. #define CAN_F0R2_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2369. #define CAN_F0R2_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2370. #define CAN_F0R2_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2371. #define CAN_F0R2_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2372. #define CAN_F0R2_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2373. #define CAN_F0R2_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2374. #define CAN_F0R2_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2375. #define CAN_F0R2_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2376. #define CAN_F0R2_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2377. /******************* Bit definition for CAN_F1R2 register *******************/
  2378. #define CAN_F1R2_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2379. #define CAN_F1R2_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2380. #define CAN_F1R2_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2381. #define CAN_F1R2_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2382. #define CAN_F1R2_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2383. #define CAN_F1R2_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2384. #define CAN_F1R2_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2385. #define CAN_F1R2_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2386. #define CAN_F1R2_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2387. #define CAN_F1R2_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2388. #define CAN_F1R2_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2389. #define CAN_F1R2_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2390. #define CAN_F1R2_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2391. #define CAN_F1R2_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2392. #define CAN_F1R2_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2393. #define CAN_F1R2_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2394. #define CAN_F1R2_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2395. #define CAN_F1R2_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2396. #define CAN_F1R2_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2397. #define CAN_F1R2_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2398. #define CAN_F1R2_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2399. #define CAN_F1R2_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2400. #define CAN_F1R2_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2401. #define CAN_F1R2_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2402. #define CAN_F1R2_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2403. #define CAN_F1R2_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2404. #define CAN_F1R2_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2405. #define CAN_F1R2_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2406. #define CAN_F1R2_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2407. #define CAN_F1R2_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2408. #define CAN_F1R2_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2409. #define CAN_F1R2_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2410. /******************* Bit definition for CAN_F2R2 register *******************/
  2411. #define CAN_F2R2_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2412. #define CAN_F2R2_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2413. #define CAN_F2R2_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2414. #define CAN_F2R2_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2415. #define CAN_F2R2_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2416. #define CAN_F2R2_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2417. #define CAN_F2R2_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2418. #define CAN_F2R2_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2419. #define CAN_F2R2_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2420. #define CAN_F2R2_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2421. #define CAN_F2R2_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2422. #define CAN_F2R2_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2423. #define CAN_F2R2_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2424. #define CAN_F2R2_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2425. #define CAN_F2R2_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2426. #define CAN_F2R2_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2427. #define CAN_F2R2_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2428. #define CAN_F2R2_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2429. #define CAN_F2R2_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2430. #define CAN_F2R2_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2431. #define CAN_F2R2_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2432. #define CAN_F2R2_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2433. #define CAN_F2R2_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2434. #define CAN_F2R2_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2435. #define CAN_F2R2_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2436. #define CAN_F2R2_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2437. #define CAN_F2R2_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2438. #define CAN_F2R2_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2439. #define CAN_F2R2_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2440. #define CAN_F2R2_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2441. #define CAN_F2R2_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2442. #define CAN_F2R2_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2443. /******************* Bit definition for CAN_F3R2 register *******************/
  2444. #define CAN_F3R2_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2445. #define CAN_F3R2_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2446. #define CAN_F3R2_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2447. #define CAN_F3R2_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2448. #define CAN_F3R2_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2449. #define CAN_F3R2_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2450. #define CAN_F3R2_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2451. #define CAN_F3R2_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2452. #define CAN_F3R2_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2453. #define CAN_F3R2_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2454. #define CAN_F3R2_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2455. #define CAN_F3R2_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2456. #define CAN_F3R2_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2457. #define CAN_F3R2_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2458. #define CAN_F3R2_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2459. #define CAN_F3R2_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2460. #define CAN_F3R2_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2461. #define CAN_F3R2_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2462. #define CAN_F3R2_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2463. #define CAN_F3R2_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2464. #define CAN_F3R2_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2465. #define CAN_F3R2_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2466. #define CAN_F3R2_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2467. #define CAN_F3R2_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2468. #define CAN_F3R2_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2469. #define CAN_F3R2_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2470. #define CAN_F3R2_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2471. #define CAN_F3R2_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2472. #define CAN_F3R2_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2473. #define CAN_F3R2_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2474. #define CAN_F3R2_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2475. #define CAN_F3R2_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2476. /******************* Bit definition for CAN_F4R2 register *******************/
  2477. #define CAN_F4R2_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2478. #define CAN_F4R2_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2479. #define CAN_F4R2_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2480. #define CAN_F4R2_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2481. #define CAN_F4R2_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2482. #define CAN_F4R2_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2483. #define CAN_F4R2_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2484. #define CAN_F4R2_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2485. #define CAN_F4R2_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2486. #define CAN_F4R2_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2487. #define CAN_F4R2_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2488. #define CAN_F4R2_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2489. #define CAN_F4R2_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2490. #define CAN_F4R2_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2491. #define CAN_F4R2_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2492. #define CAN_F4R2_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2493. #define CAN_F4R2_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2494. #define CAN_F4R2_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2495. #define CAN_F4R2_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2496. #define CAN_F4R2_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2497. #define CAN_F4R2_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2498. #define CAN_F4R2_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2499. #define CAN_F4R2_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2500. #define CAN_F4R2_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2501. #define CAN_F4R2_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2502. #define CAN_F4R2_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2503. #define CAN_F4R2_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2504. #define CAN_F4R2_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2505. #define CAN_F4R2_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2506. #define CAN_F4R2_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2507. #define CAN_F4R2_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2508. #define CAN_F4R2_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2509. /******************* Bit definition for CAN_F5R2 register *******************/
  2510. #define CAN_F5R2_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2511. #define CAN_F5R2_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2512. #define CAN_F5R2_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2513. #define CAN_F5R2_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2514. #define CAN_F5R2_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2515. #define CAN_F5R2_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2516. #define CAN_F5R2_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2517. #define CAN_F5R2_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2518. #define CAN_F5R2_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2519. #define CAN_F5R2_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2520. #define CAN_F5R2_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2521. #define CAN_F5R2_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2522. #define CAN_F5R2_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2523. #define CAN_F5R2_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2524. #define CAN_F5R2_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2525. #define CAN_F5R2_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2526. #define CAN_F5R2_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2527. #define CAN_F5R2_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2528. #define CAN_F5R2_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2529. #define CAN_F5R2_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2530. #define CAN_F5R2_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2531. #define CAN_F5R2_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2532. #define CAN_F5R2_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2533. #define CAN_F5R2_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2534. #define CAN_F5R2_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2535. #define CAN_F5R2_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2536. #define CAN_F5R2_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2537. #define CAN_F5R2_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2538. #define CAN_F5R2_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2539. #define CAN_F5R2_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2540. #define CAN_F5R2_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2541. #define CAN_F5R2_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2542. /******************* Bit definition for CAN_F6R2 register *******************/
  2543. #define CAN_F6R2_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2544. #define CAN_F6R2_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2545. #define CAN_F6R2_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2546. #define CAN_F6R2_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2547. #define CAN_F6R2_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2548. #define CAN_F6R2_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2549. #define CAN_F6R2_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2550. #define CAN_F6R2_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2551. #define CAN_F6R2_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2552. #define CAN_F6R2_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2553. #define CAN_F6R2_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2554. #define CAN_F6R2_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2555. #define CAN_F6R2_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2556. #define CAN_F6R2_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2557. #define CAN_F6R2_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2558. #define CAN_F6R2_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2559. #define CAN_F6R2_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2560. #define CAN_F6R2_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2561. #define CAN_F6R2_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2562. #define CAN_F6R2_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2563. #define CAN_F6R2_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2564. #define CAN_F6R2_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2565. #define CAN_F6R2_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2566. #define CAN_F6R2_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2567. #define CAN_F6R2_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2568. #define CAN_F6R2_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2569. #define CAN_F6R2_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2570. #define CAN_F6R2_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2571. #define CAN_F6R2_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2572. #define CAN_F6R2_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2573. #define CAN_F6R2_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2574. #define CAN_F6R2_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2575. /******************* Bit definition for CAN_F7R2 register *******************/
  2576. #define CAN_F7R2_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2577. #define CAN_F7R2_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2578. #define CAN_F7R2_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2579. #define CAN_F7R2_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2580. #define CAN_F7R2_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2581. #define CAN_F7R2_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2582. #define CAN_F7R2_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2583. #define CAN_F7R2_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2584. #define CAN_F7R2_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2585. #define CAN_F7R2_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2586. #define CAN_F7R2_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2587. #define CAN_F7R2_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2588. #define CAN_F7R2_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2589. #define CAN_F7R2_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2590. #define CAN_F7R2_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2591. #define CAN_F7R2_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2592. #define CAN_F7R2_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2593. #define CAN_F7R2_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2594. #define CAN_F7R2_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2595. #define CAN_F7R2_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2596. #define CAN_F7R2_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2597. #define CAN_F7R2_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2598. #define CAN_F7R2_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2599. #define CAN_F7R2_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2600. #define CAN_F7R2_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2601. #define CAN_F7R2_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2602. #define CAN_F7R2_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2603. #define CAN_F7R2_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2604. #define CAN_F7R2_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2605. #define CAN_F7R2_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2606. #define CAN_F7R2_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2607. #define CAN_F7R2_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2608. /******************* Bit definition for CAN_F8R2 register *******************/
  2609. #define CAN_F8R2_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2610. #define CAN_F8R2_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2611. #define CAN_F8R2_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2612. #define CAN_F8R2_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2613. #define CAN_F8R2_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2614. #define CAN_F8R2_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2615. #define CAN_F8R2_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2616. #define CAN_F8R2_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2617. #define CAN_F8R2_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2618. #define CAN_F8R2_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2619. #define CAN_F8R2_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2620. #define CAN_F8R2_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2621. #define CAN_F8R2_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2622. #define CAN_F8R2_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2623. #define CAN_F8R2_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2624. #define CAN_F8R2_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2625. #define CAN_F8R2_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2626. #define CAN_F8R2_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2627. #define CAN_F8R2_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2628. #define CAN_F8R2_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2629. #define CAN_F8R2_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2630. #define CAN_F8R2_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2631. #define CAN_F8R2_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2632. #define CAN_F8R2_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2633. #define CAN_F8R2_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2634. #define CAN_F8R2_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2635. #define CAN_F8R2_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2636. #define CAN_F8R2_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2637. #define CAN_F8R2_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2638. #define CAN_F8R2_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2639. #define CAN_F8R2_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2640. #define CAN_F8R2_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2641. /******************* Bit definition for CAN_F9R2 register *******************/
  2642. #define CAN_F9R2_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2643. #define CAN_F9R2_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2644. #define CAN_F9R2_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2645. #define CAN_F9R2_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2646. #define CAN_F9R2_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2647. #define CAN_F9R2_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2648. #define CAN_F9R2_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2649. #define CAN_F9R2_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2650. #define CAN_F9R2_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2651. #define CAN_F9R2_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2652. #define CAN_F9R2_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2653. #define CAN_F9R2_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2654. #define CAN_F9R2_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2655. #define CAN_F9R2_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2656. #define CAN_F9R2_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2657. #define CAN_F9R2_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2658. #define CAN_F9R2_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2659. #define CAN_F9R2_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2660. #define CAN_F9R2_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2661. #define CAN_F9R2_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2662. #define CAN_F9R2_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2663. #define CAN_F9R2_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2664. #define CAN_F9R2_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2665. #define CAN_F9R2_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2666. #define CAN_F9R2_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2667. #define CAN_F9R2_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2668. #define CAN_F9R2_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2669. #define CAN_F9R2_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2670. #define CAN_F9R2_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2671. #define CAN_F9R2_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2672. #define CAN_F9R2_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2673. #define CAN_F9R2_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2674. /******************* Bit definition for CAN_F10R2 register ******************/
  2675. #define CAN_F10R2_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2676. #define CAN_F10R2_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2677. #define CAN_F10R2_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2678. #define CAN_F10R2_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2679. #define CAN_F10R2_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2680. #define CAN_F10R2_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2681. #define CAN_F10R2_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2682. #define CAN_F10R2_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2683. #define CAN_F10R2_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2684. #define CAN_F10R2_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2685. #define CAN_F10R2_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2686. #define CAN_F10R2_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2687. #define CAN_F10R2_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2688. #define CAN_F10R2_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2689. #define CAN_F10R2_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2690. #define CAN_F10R2_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2691. #define CAN_F10R2_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2692. #define CAN_F10R2_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2693. #define CAN_F10R2_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2694. #define CAN_F10R2_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2695. #define CAN_F10R2_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2696. #define CAN_F10R2_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2697. #define CAN_F10R2_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2698. #define CAN_F10R2_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2699. #define CAN_F10R2_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2700. #define CAN_F10R2_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2701. #define CAN_F10R2_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2702. #define CAN_F10R2_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2703. #define CAN_F10R2_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2704. #define CAN_F10R2_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2705. #define CAN_F10R2_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2706. #define CAN_F10R2_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2707. /******************* Bit definition for CAN_F11R2 register ******************/
  2708. #define CAN_F11R2_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2709. #define CAN_F11R2_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2710. #define CAN_F11R2_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2711. #define CAN_F11R2_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2712. #define CAN_F11R2_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2713. #define CAN_F11R2_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2714. #define CAN_F11R2_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2715. #define CAN_F11R2_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2716. #define CAN_F11R2_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2717. #define CAN_F11R2_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2718. #define CAN_F11R2_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2719. #define CAN_F11R2_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2720. #define CAN_F11R2_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2721. #define CAN_F11R2_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2722. #define CAN_F11R2_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2723. #define CAN_F11R2_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2724. #define CAN_F11R2_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2725. #define CAN_F11R2_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2726. #define CAN_F11R2_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2727. #define CAN_F11R2_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2728. #define CAN_F11R2_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2729. #define CAN_F11R2_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2730. #define CAN_F11R2_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2731. #define CAN_F11R2_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2732. #define CAN_F11R2_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2733. #define CAN_F11R2_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2734. #define CAN_F11R2_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2735. #define CAN_F11R2_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2736. #define CAN_F11R2_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2737. #define CAN_F11R2_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2738. #define CAN_F11R2_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2739. #define CAN_F11R2_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2740. /******************* Bit definition for CAN_F12R2 register ******************/
  2741. #define CAN_F12R2_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2742. #define CAN_F12R2_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2743. #define CAN_F12R2_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2744. #define CAN_F12R2_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2745. #define CAN_F12R2_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2746. #define CAN_F12R2_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2747. #define CAN_F12R2_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2748. #define CAN_F12R2_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2749. #define CAN_F12R2_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2750. #define CAN_F12R2_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2751. #define CAN_F12R2_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2752. #define CAN_F12R2_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2753. #define CAN_F12R2_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2754. #define CAN_F12R2_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2755. #define CAN_F12R2_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2756. #define CAN_F12R2_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2757. #define CAN_F12R2_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2758. #define CAN_F12R2_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2759. #define CAN_F12R2_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2760. #define CAN_F12R2_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2761. #define CAN_F12R2_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2762. #define CAN_F12R2_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2763. #define CAN_F12R2_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2764. #define CAN_F12R2_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2765. #define CAN_F12R2_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2766. #define CAN_F12R2_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2767. #define CAN_F12R2_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2768. #define CAN_F12R2_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2769. #define CAN_F12R2_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2770. #define CAN_F12R2_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2771. #define CAN_F12R2_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2772. #define CAN_F12R2_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2773. /******************* Bit definition for CAN_F13R2 register ******************/
  2774. #define CAN_F13R2_FB0 ((uint32_t)0x00000001) /* Filter bit 0 */
  2775. #define CAN_F13R2_FB1 ((uint32_t)0x00000002) /* Filter bit 1 */
  2776. #define CAN_F13R2_FB2 ((uint32_t)0x00000004) /* Filter bit 2 */
  2777. #define CAN_F13R2_FB3 ((uint32_t)0x00000008) /* Filter bit 3 */
  2778. #define CAN_F13R2_FB4 ((uint32_t)0x00000010) /* Filter bit 4 */
  2779. #define CAN_F13R2_FB5 ((uint32_t)0x00000020) /* Filter bit 5 */
  2780. #define CAN_F13R2_FB6 ((uint32_t)0x00000040) /* Filter bit 6 */
  2781. #define CAN_F13R2_FB7 ((uint32_t)0x00000080) /* Filter bit 7 */
  2782. #define CAN_F13R2_FB8 ((uint32_t)0x00000100) /* Filter bit 8 */
  2783. #define CAN_F13R2_FB9 ((uint32_t)0x00000200) /* Filter bit 9 */
  2784. #define CAN_F13R2_FB10 ((uint32_t)0x00000400) /* Filter bit 10 */
  2785. #define CAN_F13R2_FB11 ((uint32_t)0x00000800) /* Filter bit 11 */
  2786. #define CAN_F13R2_FB12 ((uint32_t)0x00001000) /* Filter bit 12 */
  2787. #define CAN_F13R2_FB13 ((uint32_t)0x00002000) /* Filter bit 13 */
  2788. #define CAN_F13R2_FB14 ((uint32_t)0x00004000) /* Filter bit 14 */
  2789. #define CAN_F13R2_FB15 ((uint32_t)0x00008000) /* Filter bit 15 */
  2790. #define CAN_F13R2_FB16 ((uint32_t)0x00010000) /* Filter bit 16 */
  2791. #define CAN_F13R2_FB17 ((uint32_t)0x00020000) /* Filter bit 17 */
  2792. #define CAN_F13R2_FB18 ((uint32_t)0x00040000) /* Filter bit 18 */
  2793. #define CAN_F13R2_FB19 ((uint32_t)0x00080000) /* Filter bit 19 */
  2794. #define CAN_F13R2_FB20 ((uint32_t)0x00100000) /* Filter bit 20 */
  2795. #define CAN_F13R2_FB21 ((uint32_t)0x00200000) /* Filter bit 21 */
  2796. #define CAN_F13R2_FB22 ((uint32_t)0x00400000) /* Filter bit 22 */
  2797. #define CAN_F13R2_FB23 ((uint32_t)0x00800000) /* Filter bit 23 */
  2798. #define CAN_F13R2_FB24 ((uint32_t)0x01000000) /* Filter bit 24 */
  2799. #define CAN_F13R2_FB25 ((uint32_t)0x02000000) /* Filter bit 25 */
  2800. #define CAN_F13R2_FB26 ((uint32_t)0x04000000) /* Filter bit 26 */
  2801. #define CAN_F13R2_FB27 ((uint32_t)0x08000000) /* Filter bit 27 */
  2802. #define CAN_F13R2_FB28 ((uint32_t)0x10000000) /* Filter bit 28 */
  2803. #define CAN_F13R2_FB29 ((uint32_t)0x20000000) /* Filter bit 29 */
  2804. #define CAN_F13R2_FB30 ((uint32_t)0x40000000) /* Filter bit 30 */
  2805. #define CAN_F13R2_FB31 ((uint32_t)0x80000000) /* Filter bit 31 */
  2806. /******************************************************************************/
  2807. /* CRC Calculation Unit */
  2808. /******************************************************************************/
  2809. /******************* Bit definition for CRC_DATAR register *********************/
  2810. #define CRC_DATAR_DR ((uint32_t)0xFFFFFFFF) /* Data register bits */
  2811. /******************* Bit definition for CRC_IDATAR register ********************/
  2812. #define CRC_IDR_IDATAR ((uint8_t)0xFF) /* General-purpose 8-bit data register bits */
  2813. /******************** Bit definition for CRC_CTLR register ********************/
  2814. #define CRC_CTLR_RESET ((uint8_t)0x01) /* RESET bit */
  2815. /******************************************************************************/
  2816. /* Digital to Analog Converter */
  2817. /******************************************************************************/
  2818. /******************** Bit definition for DAC_CTLR register ********************/
  2819. #define DAC_EN1 ((uint32_t)0x00000001) /* DAC channel1 enable */
  2820. #define DAC_BOFF1 ((uint32_t)0x00000002) /* DAC channel1 output buffer disable */
  2821. #define DAC_TEN1 ((uint32_t)0x00000004) /* DAC channel1 Trigger enable */
  2822. #define DAC_TSEL1 ((uint32_t)0x00000038) /* TSEL1[2:0] (DAC channel1 Trigger selection) */
  2823. #define DAC_TSEL1_0 ((uint32_t)0x00000008) /* Bit 0 */
  2824. #define DAC_TSEL1_1 ((uint32_t)0x00000010) /* Bit 1 */
  2825. #define DAC_TSEL1_2 ((uint32_t)0x00000020) /* Bit 2 */
  2826. #define DAC_WAVE1 ((uint32_t)0x000000C0) /* WAVE1[1:0] (DAC channel1 noise/triangle wave generation enable) */
  2827. #define DAC_WAVE1_0 ((uint32_t)0x00000040) /* Bit 0 */
  2828. #define DAC_WAVE1_1 ((uint32_t)0x00000080) /* Bit 1 */
  2829. #define DAC_MAMP1 ((uint32_t)0x00000F00) /* MAMP1[3:0] (DAC channel1 Mask/Amplitude selector) */
  2830. #define DAC_MAMP1_0 ((uint32_t)0x00000100) /* Bit 0 */
  2831. #define DAC_MAMP1_1 ((uint32_t)0x00000200) /* Bit 1 */
  2832. #define DAC_MAMP1_2 ((uint32_t)0x00000400) /* Bit 2 */
  2833. #define DAC_MAMP1_3 ((uint32_t)0x00000800) /* Bit 3 */
  2834. #define DAC_DMAEN1 ((uint32_t)0x00001000) /* DAC channel1 DMA enable */
  2835. #define DAC_EN2 ((uint32_t)0x00010000) /* DAC channel2 enable */
  2836. #define DAC_BOFF2 ((uint32_t)0x00020000) /* DAC channel2 output buffer disable */
  2837. #define DAC_TEN2 ((uint32_t)0x00040000) /* DAC channel2 Trigger enable */
  2838. #define DAC_TSEL2 ((uint32_t)0x00380000) /* TSEL2[2:0] (DAC channel2 Trigger selection) */
  2839. #define DAC_TSEL2_0 ((uint32_t)0x00080000) /* Bit 0 */
  2840. #define DAC_TSEL2_1 ((uint32_t)0x00100000) /* Bit 1 */
  2841. #define DAC_TSEL2_2 ((uint32_t)0x00200000) /* Bit 2 */
  2842. #define DAC_WAVE2 ((uint32_t)0x00C00000) /* WAVE2[1:0] (DAC channel2 noise/triangle wave generation enable) */
  2843. #define DAC_WAVE2_0 ((uint32_t)0x00400000) /* Bit 0 */
  2844. #define DAC_WAVE2_1 ((uint32_t)0x00800000) /* Bit 1 */
  2845. #define DAC_MAMP2 ((uint32_t)0x0F000000) /* MAMP2[3:0] (DAC channel2 Mask/Amplitude selector) */
  2846. #define DAC_MAMP2_0 ((uint32_t)0x01000000) /* Bit 0 */
  2847. #define DAC_MAMP2_1 ((uint32_t)0x02000000) /* Bit 1 */
  2848. #define DAC_MAMP2_2 ((uint32_t)0x04000000) /* Bit 2 */
  2849. #define DAC_MAMP2_3 ((uint32_t)0x08000000) /* Bit 3 */
  2850. #define DAC_DMAEN2 ((uint32_t)0x10000000) /* DAC channel2 DMA enabled */
  2851. /***************** Bit definition for DAC_SWTR register ******************/
  2852. #define DAC_SWTRIG1 ((uint8_t)0x01) /* DAC channel1 software trigger */
  2853. #define DAC_SWTRIG2 ((uint8_t)0x02) /* DAC channel2 software trigger */
  2854. /***************** Bit definition for DAC_R12BDHR1 register ******************/
  2855. #define DAC_DHR12R1 ((uint16_t)0x0FFF) /* DAC channel1 12-bit Right aligned data */
  2856. /***************** Bit definition for DAC_L12BDHR1 register ******************/
  2857. #define DAC_DHR12L1 ((uint16_t)0xFFF0) /* DAC channel1 12-bit Left aligned data */
  2858. /****************** Bit definition for DAC_R8BDHR1 register ******************/
  2859. #define DAC_DHR8R1 ((uint8_t)0xFF) /* DAC channel1 8-bit Right aligned data */
  2860. /***************** Bit definition for DAC_R12BDHR2 register ******************/
  2861. #define DAC_DHR12R2 ((uint16_t)0x0FFF) /* DAC channel2 12-bit Right aligned data */
  2862. /***************** Bit definition for DAC_L12BDHR2 register ******************/
  2863. #define DAC_DHR12L2 ((uint16_t)0xFFF0) /* DAC channel2 12-bit Left aligned data */
  2864. /****************** Bit definition for DAC_R8BDHR2 register ******************/
  2865. #define DAC_DHR8R2 ((uint8_t)0xFF) /* DAC channel2 8-bit Right aligned data */
  2866. /***************** Bit definition for DAC_RD12BDHR register ******************/
  2867. #define DAC_RD12BDHR_DACC1DHR ((uint32_t)0x00000FFF) /* DAC channel1 12-bit Right aligned data */
  2868. #define DAC_RD12BDHR_DACC2DHR ((uint32_t)0x0FFF0000) /* DAC channel2 12-bit Right aligned data */
  2869. /***************** Bit definition for DAC_LD12BDHR register ******************/
  2870. #define DAC_LD12BDHR_DACC1DHR ((uint32_t)0x0000FFF0) /* DAC channel1 12-bit Left aligned data */
  2871. #define DAC_LD12BDHR_DACC2DHR ((uint32_t)0xFFF00000) /* DAC channel2 12-bit Left aligned data */
  2872. /****************** Bit definition for DAC_RD8BDHR register ******************/
  2873. #define DAC_RD8BDHR_DACC1DHR ((uint16_t)0x00FF) /* DAC channel1 8-bit Right aligned data */
  2874. #define DAC_RD8BDHR_DACC2DHR ((uint16_t)0xFF00) /* DAC channel2 8-bit Right aligned data */
  2875. /******************* Bit definition for DAC_DOR1 register *******************/
  2876. #define DAC_DACC1DOR ((uint16_t)0x0FFF) /* DAC channel1 data output */
  2877. /******************* Bit definition for DAC_DOR2 register *******************/
  2878. #define DAC_DACC2DOR ((uint16_t)0x0FFF) /* DAC channel2 data output */
  2879. /******************************************************************************/
  2880. /* DMA Controller */
  2881. /******************************************************************************/
  2882. /******************* Bit definition for DMA_INTFR register ********************/
  2883. #define DMA_GIF1 ((uint32_t)0x00000001) /* Channel 1 Global interrupt flag */
  2884. #define DMA_TCIF1 ((uint32_t)0x00000002) /* Channel 1 Transfer Complete flag */
  2885. #define DMA_HTIF1 ((uint32_t)0x00000004) /* Channel 1 Half Transfer flag */
  2886. #define DMA_TEIF1 ((uint32_t)0x00000008) /* Channel 1 Transfer Error flag */
  2887. #define DMA_GIF2 ((uint32_t)0x00000010) /* Channel 2 Global interrupt flag */
  2888. #define DMA_TCIF2 ((uint32_t)0x00000020) /* Channel 2 Transfer Complete flag */
  2889. #define DMA_HTIF2 ((uint32_t)0x00000040) /* Channel 2 Half Transfer flag */
  2890. #define DMA_TEIF2 ((uint32_t)0x00000080) /* Channel 2 Transfer Error flag */
  2891. #define DMA_GIF3 ((uint32_t)0x00000100) /* Channel 3 Global interrupt flag */
  2892. #define DMA_TCIF3 ((uint32_t)0x00000200) /* Channel 3 Transfer Complete flag */
  2893. #define DMA_HTIF3 ((uint32_t)0x00000400) /* Channel 3 Half Transfer flag */
  2894. #define DMA_TEIF3 ((uint32_t)0x00000800) /* Channel 3 Transfer Error flag */
  2895. #define DMA_GIF4 ((uint32_t)0x00001000) /* Channel 4 Global interrupt flag */
  2896. #define DMA_TCIF4 ((uint32_t)0x00002000) /* Channel 4 Transfer Complete flag */
  2897. #define DMA_HTIF4 ((uint32_t)0x00004000) /* Channel 4 Half Transfer flag */
  2898. #define DMA_TEIF4 ((uint32_t)0x00008000) /* Channel 4 Transfer Error flag */
  2899. #define DMA_GIF5 ((uint32_t)0x00010000) /* Channel 5 Global interrupt flag */
  2900. #define DMA_TCIF5 ((uint32_t)0x00020000) /* Channel 5 Transfer Complete flag */
  2901. #define DMA_HTIF5 ((uint32_t)0x00040000) /* Channel 5 Half Transfer flag */
  2902. #define DMA_TEIF5 ((uint32_t)0x00080000) /* Channel 5 Transfer Error flag */
  2903. #define DMA_GIF6 ((uint32_t)0x00100000) /* Channel 6 Global interrupt flag */
  2904. #define DMA_TCIF6 ((uint32_t)0x00200000) /* Channel 6 Transfer Complete flag */
  2905. #define DMA_HTIF6 ((uint32_t)0x00400000) /* Channel 6 Half Transfer flag */
  2906. #define DMA_TEIF6 ((uint32_t)0x00800000) /* Channel 6 Transfer Error flag */
  2907. #define DMA_GIF7 ((uint32_t)0x01000000) /* Channel 7 Global interrupt flag */
  2908. #define DMA_TCIF7 ((uint32_t)0x02000000) /* Channel 7 Transfer Complete flag */
  2909. #define DMA_HTIF7 ((uint32_t)0x04000000) /* Channel 7 Half Transfer flag */
  2910. #define DMA_TEIF7 ((uint32_t)0x08000000) /* Channel 7 Transfer Error flag */
  2911. #define DMA_GIF8 ((uint32_t)0x00000001) /* Channel 8 Global interrupt flag */
  2912. #define DMA_TCIF8 ((uint32_t)0x00000002) /* Channel 8 Transfer Complete flag */
  2913. #define DMA_HTIF8 ((uint32_t)0x00000004) /* Channel 8 Half Transfer flag */
  2914. #define DMA_TEIF8 ((uint32_t)0x00000008) /* Channel 8 Transfer Error flag */
  2915. #define DMA_GIF9 ((uint32_t)0x00000010) /* Channel 9 Global interrupt flag */
  2916. #define DMA_TCIF9 ((uint32_t)0x00000020) /* Channel 9 Transfer Complete flag */
  2917. #define DMA_HTIF9 ((uint32_t)0x00000040) /* Channel 9 Half Transfer flag */
  2918. #define DMA_TEIF9 ((uint32_t)0x00000080) /* Channel 9 Transfer Error flag */
  2919. #define DMA_GIF10 ((uint32_t)0x00000100) /* Channel 10 Global interrupt flag */
  2920. #define DMA_TCIF10 ((uint32_t)0x00000200) /* Channel 10 Transfer Complete flag */
  2921. #define DMA_HTIF10 ((uint32_t)0x00000400) /* Channel 10 Half Transfer flag */
  2922. #define DMA_TEIF10 ((uint32_t)0x00000800) /* Channel 10 Transfer Error flag */
  2923. #define DMA_GIF11 ((uint32_t)0x00001000) /* Channel 11 Global interrupt flag */
  2924. #define DMA_TCIF11 ((uint32_t)0x00002000) /* Channel 11 Transfer Complete flag */
  2925. #define DMA_HTIF11 ((uint32_t)0x00004000) /* Channel 11 Half Transfer flag */
  2926. #define DMA_TEIF11 ((uint32_t)0x00008000) /* Channel 11 Transfer Error flag */
  2927. /******************* Bit definition for DMA_INTFCR register *******************/
  2928. #define DMA_CGIF1 ((uint32_t)0x00000001) /* Channel 1 Global interrupt clear */
  2929. #define DMA_CTCIF1 ((uint32_t)0x00000002) /* Channel 1 Transfer Complete clear */
  2930. #define DMA_CHTIF1 ((uint32_t)0x00000004) /* Channel 1 Half Transfer clear */
  2931. #define DMA_CTEIF1 ((uint32_t)0x00000008) /* Channel 1 Transfer Error clear */
  2932. #define DMA_CGIF2 ((uint32_t)0x00000010) /* Channel 2 Global interrupt clear */
  2933. #define DMA_CTCIF2 ((uint32_t)0x00000020) /* Channel 2 Transfer Complete clear */
  2934. #define DMA_CHTIF2 ((uint32_t)0x00000040) /* Channel 2 Half Transfer clear */
  2935. #define DMA_CTEIF2 ((uint32_t)0x00000080) /* Channel 2 Transfer Error clear */
  2936. #define DMA_CGIF3 ((uint32_t)0x00000100) /* Channel 3 Global interrupt clear */
  2937. #define DMA_CTCIF3 ((uint32_t)0x00000200) /* Channel 3 Transfer Complete clear */
  2938. #define DMA_CHTIF3 ((uint32_t)0x00000400) /* Channel 3 Half Transfer clear */
  2939. #define DMA_CTEIF3 ((uint32_t)0x00000800) /* Channel 3 Transfer Error clear */
  2940. #define DMA_CGIF4 ((uint32_t)0x00001000) /* Channel 4 Global interrupt clear */
  2941. #define DMA_CTCIF4 ((uint32_t)0x00002000) /* Channel 4 Transfer Complete clear */
  2942. #define DMA_CHTIF4 ((uint32_t)0x00004000) /* Channel 4 Half Transfer clear */
  2943. #define DMA_CTEIF4 ((uint32_t)0x00008000) /* Channel 4 Transfer Error clear */
  2944. #define DMA_CGIF5 ((uint32_t)0x00010000) /* Channel 5 Global interrupt clear */
  2945. #define DMA_CTCIF5 ((uint32_t)0x00020000) /* Channel 5 Transfer Complete clear */
  2946. #define DMA_CHTIF5 ((uint32_t)0x00040000) /* Channel 5 Half Transfer clear */
  2947. #define DMA_CTEIF5 ((uint32_t)0x00080000) /* Channel 5 Transfer Error clear */
  2948. #define DMA_CGIF6 ((uint32_t)0x00100000) /* Channel 6 Global interrupt clear */
  2949. #define DMA_CTCIF6 ((uint32_t)0x00200000) /* Channel 6 Transfer Complete clear */
  2950. #define DMA_CHTIF6 ((uint32_t)0x00400000) /* Channel 6 Half Transfer clear */
  2951. #define DMA_CTEIF6 ((uint32_t)0x00800000) /* Channel 6 Transfer Error clear */
  2952. #define DMA_CGIF7 ((uint32_t)0x01000000) /* Channel 7 Global interrupt clear */
  2953. #define DMA_CTCIF7 ((uint32_t)0x02000000) /* Channel 7 Transfer Complete clear */
  2954. #define DMA_CHTIF7 ((uint32_t)0x04000000) /* Channel 7 Half Transfer clear */
  2955. #define DMA_CTEIF7 ((uint32_t)0x08000000) /* Channel 7 Transfer Error clear */
  2956. /******************* Bit definition for DMA_CFGR1 register *******************/
  2957. #define DMA_CFGR1_EN ((uint16_t)0x0001) /* Channel enable*/
  2958. #define DMA_CFGR1_TCIE ((uint16_t)0x0002) /* Transfer complete interrupt enable */
  2959. #define DMA_CFGR1_HTIE ((uint16_t)0x0004) /* Half Transfer interrupt enable */
  2960. #define DMA_CFGR1_TEIE ((uint16_t)0x0008) /* Transfer error interrupt enable */
  2961. #define DMA_CFGR1_DIR ((uint16_t)0x0010) /* Data transfer direction */
  2962. #define DMA_CFGR1_CIRC ((uint16_t)0x0020) /* Circular mode */
  2963. #define DMA_CFGR1_PINC ((uint16_t)0x0040) /* Peripheral increment mode */
  2964. #define DMA_CFGR1_MINC ((uint16_t)0x0080) /* Memory increment mode */
  2965. #define DMA_CFGR1_PSIZE ((uint16_t)0x0300) /* PSIZE[1:0] bits (Peripheral size) */
  2966. #define DMA_CFGR1_PSIZE_0 ((uint16_t)0x0100) /* Bit 0 */
  2967. #define DMA_CFGR1_PSIZE_1 ((uint16_t)0x0200) /* Bit 1 */
  2968. #define DMA_CFGR1_MSIZE ((uint16_t)0x0C00) /* MSIZE[1:0] bits (Memory size) */
  2969. #define DMA_CFGR1_MSIZE_0 ((uint16_t)0x0400) /* Bit 0 */
  2970. #define DMA_CFGR1_MSIZE_1 ((uint16_t)0x0800) /* Bit 1 */
  2971. #define DMA_CFGR1_PL ((uint16_t)0x3000) /* PL[1:0] bits(Channel Priority level) */
  2972. #define DMA_CFGR1_PL_0 ((uint16_t)0x1000) /* Bit 0 */
  2973. #define DMA_CFGR1_PL_1 ((uint16_t)0x2000) /* Bit 1 */
  2974. #define DMA_CFGR1_MEM2MEM ((uint16_t)0x4000) /* Memory to memory mode */
  2975. /******************* Bit definition for DMA_CFGR2 register *******************/
  2976. #define DMA_CFGR2_EN ((uint16_t)0x0001) /* Channel enable */
  2977. #define DMA_CFGR2_TCIE ((uint16_t)0x0002) /* Transfer complete interrupt enable */
  2978. #define DMA_CFGR2_HTIE ((uint16_t)0x0004) /* Half Transfer interrupt enable */
  2979. #define DMA_CFGR2_TEIE ((uint16_t)0x0008) /* Transfer error interrupt enable */
  2980. #define DMA_CFGR2_DIR ((uint16_t)0x0010) /* Data transfer direction */
  2981. #define DMA_CFGR2_CIRC ((uint16_t)0x0020) /* Circular mode */
  2982. #define DMA_CFGR2_PINC ((uint16_t)0x0040) /* Peripheral increment mode */
  2983. #define DMA_CFGR2_MINC ((uint16_t)0x0080) /* Memory increment mode */
  2984. #define DMA_CFGR2_PSIZE ((uint16_t)0x0300) /* PSIZE[1:0] bits (Peripheral size) */
  2985. #define DMA_CFGR2_PSIZE_0 ((uint16_t)0x0100) /* Bit 0 */
  2986. #define DMA_CFGR2_PSIZE_1 ((uint16_t)0x0200) /* Bit 1 */
  2987. #define DMA_CFGR2_MSIZE ((uint16_t)0x0C00) /* MSIZE[1:0] bits (Memory size) */
  2988. #define DMA_CFGR2_MSIZE_0 ((uint16_t)0x0400) /* Bit 0 */
  2989. #define DMA_CFGR2_MSIZE_1 ((uint16_t)0x0800) /* Bit 1 */
  2990. #define DMA_CFGR2_PL ((uint16_t)0x3000) /* PL[1:0] bits (Channel Priority level) */
  2991. #define DMA_CFGR2_PL_0 ((uint16_t)0x1000) /* Bit 0 */
  2992. #define DMA_CFGR2_PL_1 ((uint16_t)0x2000) /* Bit 1 */
  2993. #define DMA_CFGR2_MEM2MEM ((uint16_t)0x4000) /* Memory to memory mode */
  2994. /******************* Bit definition for DMA_CFGR3 register *******************/
  2995. #define DMA_CFGR3_EN ((uint16_t)0x0001) /* Channel enable */
  2996. #define DMA_CFGR3_TCIE ((uint16_t)0x0002) /* Transfer complete interrupt enable */
  2997. #define DMA_CFGR3_HTIE ((uint16_t)0x0004) /* Half Transfer interrupt enable */
  2998. #define DMA_CFGR3_TEIE ((uint16_t)0x0008) /* Transfer error interrupt enable */
  2999. #define DMA_CFGR3_DIR ((uint16_t)0x0010) /* Data transfer direction */
  3000. #define DMA_CFGR3_CIRC ((uint16_t)0x0020) /* Circular mode */
  3001. #define DMA_CFGR3_PINC ((uint16_t)0x0040) /* Peripheral increment mode */
  3002. #define DMA_CFGR3_MINC ((uint16_t)0x0080) /* Memory increment mode */
  3003. #define DMA_CFGR3_PSIZE ((uint16_t)0x0300) /* PSIZE[1:0] bits (Peripheral size) */
  3004. #define DMA_CFGR3_PSIZE_0 ((uint16_t)0x0100) /* Bit 0 */
  3005. #define DMA_CFGR3_PSIZE_1 ((uint16_t)0x0200) /* Bit 1 */
  3006. #define DMA_CFGR3_MSIZE ((uint16_t)0x0C00) /* MSIZE[1:0] bits (Memory size) */
  3007. #define DMA_CFGR3_MSIZE_0 ((uint16_t)0x0400) /* Bit 0 */
  3008. #define DMA_CFGR3_MSIZE_1 ((uint16_t)0x0800) /* Bit 1 */
  3009. #define DMA_CFGR3_PL ((uint16_t)0x3000) /* PL[1:0] bits (Channel Priority level) */
  3010. #define DMA_CFGR3_PL_0 ((uint16_t)0x1000) /* Bit 0 */
  3011. #define DMA_CFGR3_PL_1 ((uint16_t)0x2000) /* Bit 1 */
  3012. #define DMA_CFGR3_MEM2MEM ((uint16_t)0x4000) /* Memory to memory mode */
  3013. /******************* Bit definition for DMA_CFG4 register *******************/
  3014. #define DMA_CFG4_EN ((uint16_t)0x0001) /* Channel enable */
  3015. #define DMA_CFG4_TCIE ((uint16_t)0x0002) /* Transfer complete interrupt enable */
  3016. #define DMA_CFG4_HTIE ((uint16_t)0x0004) /* Half Transfer interrupt enable */
  3017. #define DMA_CFG4_TEIE ((uint16_t)0x0008) /* Transfer error interrupt enable */
  3018. #define DMA_CFG4_DIR ((uint16_t)0x0010) /* Data transfer direction */
  3019. #define DMA_CFG4_CIRC ((uint16_t)0x0020) /* Circular mode */
  3020. #define DMA_CFG4_PINC ((uint16_t)0x0040) /* Peripheral increment mode */
  3021. #define DMA_CFG4_MINC ((uint16_t)0x0080) /* Memory increment mode */
  3022. #define DMA_CFG4_PSIZE ((uint16_t)0x0300) /* PSIZE[1:0] bits (Peripheral size) */
  3023. #define DMA_CFG4_PSIZE_0 ((uint16_t)0x0100) /* Bit 0 */
  3024. #define DMA_CFG4_PSIZE_1 ((uint16_t)0x0200) /* Bit 1 */
  3025. #define DMA_CFG4_MSIZE ((uint16_t)0x0C00) /* MSIZE[1:0] bits (Memory size) */
  3026. #define DMA_CFG4_MSIZE_0 ((uint16_t)0x0400) /* Bit 0 */
  3027. #define DMA_CFG4_MSIZE_1 ((uint16_t)0x0800) /* Bit 1 */
  3028. #define DMA_CFG4_PL ((uint16_t)0x3000) /* PL[1:0] bits (Channel Priority level) */
  3029. #define DMA_CFG4_PL_0 ((uint16_t)0x1000) /* Bit 0 */
  3030. #define DMA_CFG4_PL_1 ((uint16_t)0x2000) /* Bit 1 */
  3031. #define DMA_CFG4_MEM2MEM ((uint16_t)0x4000) /* Memory to memory mode */
  3032. /****************** Bit definition for DMA_CFG5 register *******************/
  3033. #define DMA_CFG5_EN ((uint16_t)0x0001) /* Channel enable */
  3034. #define DMA_CFG5_TCIE ((uint16_t)0x0002) /* Transfer complete interrupt enable */
  3035. #define DMA_CFG5_HTIE ((uint16_t)0x0004) /* Half Transfer interrupt enable */
  3036. #define DMA_CFG5_TEIE ((uint16_t)0x0008) /* Transfer error interrupt enable */
  3037. #define DMA_CFG5_DIR ((uint16_t)0x0010) /* Data transfer direction */
  3038. #define DMA_CFG5_CIRC ((uint16_t)0x0020) /* Circular mode */
  3039. #define DMA_CFG5_PINC ((uint16_t)0x0040) /* Peripheral increment mode */
  3040. #define DMA_CFG5_MINC ((uint16_t)0x0080) /* Memory increment mode */
  3041. #define DMA_CFG5_PSIZE ((uint16_t)0x0300) /* PSIZE[1:0] bits (Peripheral size) */
  3042. #define DMA_CFG5_PSIZE_0 ((uint16_t)0x0100) /* Bit 0 */
  3043. #define DMA_CFG5_PSIZE_1 ((uint16_t)0x0200) /* Bit 1 */
  3044. #define DMA_CFG5_MSIZE ((uint16_t)0x0C00) /* MSIZE[1:0] bits (Memory size) */
  3045. #define DMA_CFG5_MSIZE_0 ((uint16_t)0x0400) /* Bit 0 */
  3046. #define DMA_CFG5_MSIZE_1 ((uint16_t)0x0800) /* Bit 1 */
  3047. #define DMA_CFG5_PL ((uint16_t)0x3000) /* PL[1:0] bits (Channel Priority level) */
  3048. #define DMA_CFG5_PL_0 ((uint16_t)0x1000) /* Bit 0 */
  3049. #define DMA_CFG5_PL_1 ((uint16_t)0x2000) /* Bit 1 */
  3050. #define DMA_CFG5_MEM2MEM ((uint16_t)0x4000) /* Memory to memory mode enable */
  3051. /******************* Bit definition for DMA_CFG6 register *******************/
  3052. #define DMA_CFG6_EN ((uint16_t)0x0001) /* Channel enable */
  3053. #define DMA_CFG6_TCIE ((uint16_t)0x0002) /* Transfer complete interrupt enable */
  3054. #define DMA_CFG6_HTIE ((uint16_t)0x0004) /* Half Transfer interrupt enable */
  3055. #define DMA_CFG6_TEIE ((uint16_t)0x0008) /* Transfer error interrupt enable */
  3056. #define DMA_CFG6_DIR ((uint16_t)0x0010) /* Data transfer direction */
  3057. #define DMA_CFG6_CIRC ((uint16_t)0x0020) /* Circular mode */
  3058. #define DMA_CFG6_PINC ((uint16_t)0x0040) /* Peripheral increment mode */
  3059. #define DMA_CFG6_MINC ((uint16_t)0x0080) /* Memory increment mode */
  3060. #define DMA_CFG6_PSIZE ((uint16_t)0x0300) /* PSIZE[1:0] bits (Peripheral size) */
  3061. #define DMA_CFG6_PSIZE_0 ((uint16_t)0x0100) /* Bit 0 */
  3062. #define DMA_CFG6_PSIZE_1 ((uint16_t)0x0200) /* Bit 1 */
  3063. #define DMA_CFG6_MSIZE ((uint16_t)0x0C00) /* MSIZE[1:0] bits (Memory size) */
  3064. #define DMA_CFG6_MSIZE_0 ((uint16_t)0x0400) /* Bit 0 */
  3065. #define DMA_CFG6_MSIZE_1 ((uint16_t)0x0800) /* Bit 1 */
  3066. #define DMA_CFG6_PL ((uint16_t)0x3000) /* PL[1:0] bits (Channel Priority level) */
  3067. #define DMA_CFG6_PL_0 ((uint16_t)0x1000) /* Bit 0 */
  3068. #define DMA_CFG6_PL_1 ((uint16_t)0x2000) /* Bit 1 */
  3069. #define DMA_CFG6_MEM2MEM ((uint16_t)0x4000) /* Memory to memory mode */
  3070. /******************* Bit definition for DMA_CFG7 register *******************/
  3071. #define DMA_CFG7_EN ((uint16_t)0x0001) /* Channel enable */
  3072. #define DMA_CFG7_TCIE ((uint16_t)0x0002) /* Transfer complete interrupt enable */
  3073. #define DMA_CFG7_HTIE ((uint16_t)0x0004) /* Half Transfer interrupt enable */
  3074. #define DMA_CFG7_TEIE ((uint16_t)0x0008) /* Transfer error interrupt enable */
  3075. #define DMA_CFG7_DIR ((uint16_t)0x0010) /* Data transfer direction */
  3076. #define DMA_CFG7_CIRC ((uint16_t)0x0020) /* Circular mode */
  3077. #define DMA_CFG7_PINC ((uint16_t)0x0040) /* Peripheral increment mode */
  3078. #define DMA_CFG7_MINC ((uint16_t)0x0080) /* Memory increment mode */
  3079. #define DMA_CFG7_PSIZE ((uint16_t)0x0300) /* PSIZE[1:0] bits (Peripheral size) */
  3080. #define DMA_CFG7_PSIZE_0 ((uint16_t)0x0100) /* Bit 0 */
  3081. #define DMA_CFG7_PSIZE_1 ((uint16_t)0x0200) /* Bit 1 */
  3082. #define DMA_CFG7_MSIZE ((uint16_t)0x0C00) /* MSIZE[1:0] bits (Memory size) */
  3083. #define DMA_CFG7_MSIZE_0 ((uint16_t)0x0400) /* Bit 0 */
  3084. #define DMA_CFG7_MSIZE_1 ((uint16_t)0x0800) /* Bit 1 */
  3085. #define DMA_CFG7_PL ((uint16_t)0x3000) /* PL[1:0] bits (Channel Priority level) */
  3086. #define DMA_CFG7_PL_0 ((uint16_t)0x1000) /* Bit 0 */
  3087. #define DMA_CFG7_PL_1 ((uint16_t)0x2000) /* Bit 1 */
  3088. #define DMA_CFG7_MEM2MEM ((uint16_t)0x4000) /* Memory to memory mode enable */
  3089. /****************** Bit definition for DMA_CNTR1 register ******************/
  3090. #define DMA_CNTR1_NDT ((uint16_t)0xFFFF) /* Number of data to Transfer */
  3091. /****************** Bit definition for DMA_CNTR2 register ******************/
  3092. #define DMA_CNTR2_NDT ((uint16_t)0xFFFF) /* Number of data to Transfer */
  3093. /****************** Bit definition for DMA_CNTR3 register ******************/
  3094. #define DMA_CNTR3_NDT ((uint16_t)0xFFFF) /* Number of data to Transfer */
  3095. /****************** Bit definition for DMA_CNTR4 register ******************/
  3096. #define DMA_CNTR4_NDT ((uint16_t)0xFFFF) /* Number of data to Transfer */
  3097. /****************** Bit definition for DMA_CNTR5 register ******************/
  3098. #define DMA_CNTR5_NDT ((uint16_t)0xFFFF) /* Number of data to Transfer */
  3099. /****************** Bit definition for DMA_CNTR6 register ******************/
  3100. #define DMA_CNTR6_NDT ((uint16_t)0xFFFF) /* Number of data to Transfer */
  3101. /****************** Bit definition for DMA_CNTR7 register ******************/
  3102. #define DMA_CNTR7_NDT ((uint16_t)0xFFFF) /* Number of data to Transfer */
  3103. /****************** Bit definition for DMA_PADDR1 register *******************/
  3104. #define DMA_PADDR1_PA ((uint32_t)0xFFFFFFFF) /* Peripheral Address */
  3105. /****************** Bit definition for DMA_PADDR2 register *******************/
  3106. #define DMA_PADDR2_PA ((uint32_t)0xFFFFFFFF) /* Peripheral Address */
  3107. /****************** Bit definition for DMA_PADDR3 register *******************/
  3108. #define DMA_PADDR3_PA ((uint32_t)0xFFFFFFFF) /* Peripheral Address */
  3109. /****************** Bit definition for DMA_PADDR4 register *******************/
  3110. #define DMA_PADDR4_PA ((uint32_t)0xFFFFFFFF) /* Peripheral Address */
  3111. /****************** Bit definition for DMA_PADDR5 register *******************/
  3112. #define DMA_PADDR5_PA ((uint32_t)0xFFFFFFFF) /* Peripheral Address */
  3113. /****************** Bit definition for DMA_PADDR6 register *******************/
  3114. #define DMA_PADDR6_PA ((uint32_t)0xFFFFFFFF) /* Peripheral Address */
  3115. /****************** Bit definition for DMA_PADDR7 register *******************/
  3116. #define DMA_PADDR7_PA ((uint32_t)0xFFFFFFFF) /* Peripheral Address */
  3117. /****************** Bit definition for DMA_MADDR1 register *******************/
  3118. #define DMA_MADDR1_MA ((uint32_t)0xFFFFFFFF) /* Memory Address */
  3119. /****************** Bit definition for DMA_MADDR2 register *******************/
  3120. #define DMA_MADDR2_MA ((uint32_t)0xFFFFFFFF) /* Memory Address */
  3121. /****************** Bit definition for DMA_MADDR3 register *******************/
  3122. #define DMA_MADDR3_MA ((uint32_t)0xFFFFFFFF) /* Memory Address */
  3123. /****************** Bit definition for DMA_MADDR4 register *******************/
  3124. #define DMA_MADDR4_MA ((uint32_t)0xFFFFFFFF) /* Memory Address */
  3125. /****************** Bit definition for DMA_MADDR5 register *******************/
  3126. #define DMA_MADDR5_MA ((uint32_t)0xFFFFFFFF) /* Memory Address */
  3127. /****************** Bit definition for DMA_MADDR6 register *******************/
  3128. #define DMA_MADDR6_MA ((uint32_t)0xFFFFFFFF) /* Memory Address */
  3129. /****************** Bit definition for DMA_MADDR7 register *******************/
  3130. #define DMA_MADDR7_MA ((uint32_t)0xFFFFFFFF) /* Memory Address */
  3131. /******************************************************************************/
  3132. /* External Interrupt/Event Controller */
  3133. /******************************************************************************/
  3134. /******************* Bit definition for EXTI_INTENR register *******************/
  3135. #define EXTI_INTENR_MR0 ((uint32_t)0x00000001) /* Interrupt Mask on line 0 */
  3136. #define EXTI_INTENR_MR1 ((uint32_t)0x00000002) /* Interrupt Mask on line 1 */
  3137. #define EXTI_INTENR_MR2 ((uint32_t)0x00000004) /* Interrupt Mask on line 2 */
  3138. #define EXTI_INTENR_MR3 ((uint32_t)0x00000008) /* Interrupt Mask on line 3 */
  3139. #define EXTI_INTENR_MR4 ((uint32_t)0x00000010) /* Interrupt Mask on line 4 */
  3140. #define EXTI_INTENR_MR5 ((uint32_t)0x00000020) /* Interrupt Mask on line 5 */
  3141. #define EXTI_INTENR_MR6 ((uint32_t)0x00000040) /* Interrupt Mask on line 6 */
  3142. #define EXTI_INTENR_MR7 ((uint32_t)0x00000080) /* Interrupt Mask on line 7 */
  3143. #define EXTI_INTENR_MR8 ((uint32_t)0x00000100) /* Interrupt Mask on line 8 */
  3144. #define EXTI_INTENR_MR9 ((uint32_t)0x00000200) /* Interrupt Mask on line 9 */
  3145. #define EXTI_INTENR_MR10 ((uint32_t)0x00000400) /* Interrupt Mask on line 10 */
  3146. #define EXTI_INTENR_MR11 ((uint32_t)0x00000800) /* Interrupt Mask on line 11 */
  3147. #define EXTI_INTENR_MR12 ((uint32_t)0x00001000) /* Interrupt Mask on line 12 */
  3148. #define EXTI_INTENR_MR13 ((uint32_t)0x00002000) /* Interrupt Mask on line 13 */
  3149. #define EXTI_INTENR_MR14 ((uint32_t)0x00004000) /* Interrupt Mask on line 14 */
  3150. #define EXTI_INTENR_MR15 ((uint32_t)0x00008000) /* Interrupt Mask on line 15 */
  3151. #define EXTI_INTENR_MR16 ((uint32_t)0x00010000) /* Interrupt Mask on line 16 */
  3152. #define EXTI_INTENR_MR17 ((uint32_t)0x00020000) /* Interrupt Mask on line 17 */
  3153. #define EXTI_INTENR_MR18 ((uint32_t)0x00040000) /* Interrupt Mask on line 18 */
  3154. #define EXTI_INTENR_MR19 ((uint32_t)0x00080000) /* Interrupt Mask on line 19 */
  3155. /******************* Bit definition for EXTI_EVENR register *******************/
  3156. #define EXTI_EVENR_MR0 ((uint32_t)0x00000001) /* Event Mask on line 0 */
  3157. #define EXTI_EVENR_MR1 ((uint32_t)0x00000002) /* Event Mask on line 1 */
  3158. #define EXTI_EVENR_MR2 ((uint32_t)0x00000004) /* Event Mask on line 2 */
  3159. #define EXTI_EVENR_MR3 ((uint32_t)0x00000008) /* Event Mask on line 3 */
  3160. #define EXTI_EVENR_MR4 ((uint32_t)0x00000010) /* Event Mask on line 4 */
  3161. #define EXTI_EVENR_MR5 ((uint32_t)0x00000020) /* Event Mask on line 5 */
  3162. #define EXTI_EVENR_MR6 ((uint32_t)0x00000040) /* Event Mask on line 6 */
  3163. #define EXTI_EVENR_MR7 ((uint32_t)0x00000080) /* Event Mask on line 7 */
  3164. #define EXTI_EVENR_MR8 ((uint32_t)0x00000100) /* Event Mask on line 8 */
  3165. #define EXTI_EVENR_MR9 ((uint32_t)0x00000200) /* Event Mask on line 9 */
  3166. #define EXTI_EVENR_MR10 ((uint32_t)0x00000400) /* Event Mask on line 10 */
  3167. #define EXTI_EVENR_MR11 ((uint32_t)0x00000800) /* Event Mask on line 11 */
  3168. #define EXTI_EVENR_MR12 ((uint32_t)0x00001000) /* Event Mask on line 12 */
  3169. #define EXTI_EVENR_MR13 ((uint32_t)0x00002000) /* Event Mask on line 13 */
  3170. #define EXTI_EVENR_MR14 ((uint32_t)0x00004000) /* Event Mask on line 14 */
  3171. #define EXTI_EVENR_MR15 ((uint32_t)0x00008000) /* Event Mask on line 15 */
  3172. #define EXTI_EVENR_MR16 ((uint32_t)0x00010000) /* Event Mask on line 16 */
  3173. #define EXTI_EVENR_MR17 ((uint32_t)0x00020000) /* Event Mask on line 17 */
  3174. #define EXTI_EVENR_MR18 ((uint32_t)0x00040000) /* Event Mask on line 18 */
  3175. #define EXTI_EVENR_MR19 ((uint32_t)0x00080000) /* Event Mask on line 19 */
  3176. /****************** Bit definition for EXTI_RTENR register *******************/
  3177. #define EXTI_RTENR_TR0 ((uint32_t)0x00000001) /* Rising trigger event configuration bit of line 0 */
  3178. #define EXTI_RTENR_TR1 ((uint32_t)0x00000002) /* Rising trigger event configuration bit of line 1 */
  3179. #define EXTI_RTENR_TR2 ((uint32_t)0x00000004) /* Rising trigger event configuration bit of line 2 */
  3180. #define EXTI_RTENR_TR3 ((uint32_t)0x00000008) /* Rising trigger event configuration bit of line 3 */
  3181. #define EXTI_RTENR_TR4 ((uint32_t)0x00000010) /* Rising trigger event configuration bit of line 4 */
  3182. #define EXTI_RTENR_TR5 ((uint32_t)0x00000020) /* Rising trigger event configuration bit of line 5 */
  3183. #define EXTI_RTENR_TR6 ((uint32_t)0x00000040) /* Rising trigger event configuration bit of line 6 */
  3184. #define EXTI_RTENR_TR7 ((uint32_t)0x00000080) /* Rising trigger event configuration bit of line 7 */
  3185. #define EXTI_RTENR_TR8 ((uint32_t)0x00000100) /* Rising trigger event configuration bit of line 8 */
  3186. #define EXTI_RTENR_TR9 ((uint32_t)0x00000200) /* Rising trigger event configuration bit of line 9 */
  3187. #define EXTI_RTENR_TR10 ((uint32_t)0x00000400) /* Rising trigger event configuration bit of line 10 */
  3188. #define EXTI_RTENR_TR11 ((uint32_t)0x00000800) /* Rising trigger event configuration bit of line 11 */
  3189. #define EXTI_RTENR_TR12 ((uint32_t)0x00001000) /* Rising trigger event configuration bit of line 12 */
  3190. #define EXTI_RTENR_TR13 ((uint32_t)0x00002000) /* Rising trigger event configuration bit of line 13 */
  3191. #define EXTI_RTENR_TR14 ((uint32_t)0x00004000) /* Rising trigger event configuration bit of line 14 */
  3192. #define EXTI_RTENR_TR15 ((uint32_t)0x00008000) /* Rising trigger event configuration bit of line 15 */
  3193. #define EXTI_RTENR_TR16 ((uint32_t)0x00010000) /* Rising trigger event configuration bit of line 16 */
  3194. #define EXTI_RTENR_TR17 ((uint32_t)0x00020000) /* Rising trigger event configuration bit of line 17 */
  3195. #define EXTI_RTENR_TR18 ((uint32_t)0x00040000) /* Rising trigger event configuration bit of line 18 */
  3196. #define EXTI_RTENR_TR19 ((uint32_t)0x00080000) /* Rising trigger event configuration bit of line 19 */
  3197. /****************** Bit definition for EXTI_FTENR register *******************/
  3198. #define EXTI_FTENR_TR0 ((uint32_t)0x00000001) /* Falling trigger event configuration bit of line 0 */
  3199. #define EXTI_FTENR_TR1 ((uint32_t)0x00000002) /* Falling trigger event configuration bit of line 1 */
  3200. #define EXTI_FTENR_TR2 ((uint32_t)0x00000004) /* Falling trigger event configuration bit of line 2 */
  3201. #define EXTI_FTENR_TR3 ((uint32_t)0x00000008) /* Falling trigger event configuration bit of line 3 */
  3202. #define EXTI_FTENR_TR4 ((uint32_t)0x00000010) /* Falling trigger event configuration bit of line 4 */
  3203. #define EXTI_FTENR_TR5 ((uint32_t)0x00000020) /* Falling trigger event configuration bit of line 5 */
  3204. #define EXTI_FTENR_TR6 ((uint32_t)0x00000040) /* Falling trigger event configuration bit of line 6 */
  3205. #define EXTI_FTENR_TR7 ((uint32_t)0x00000080) /* Falling trigger event configuration bit of line 7 */
  3206. #define EXTI_FTENR_TR8 ((uint32_t)0x00000100) /* Falling trigger event configuration bit of line 8 */
  3207. #define EXTI_FTENR_TR9 ((uint32_t)0x00000200) /* Falling trigger event configuration bit of line 9 */
  3208. #define EXTI_FTENR_TR10 ((uint32_t)0x00000400) /* Falling trigger event configuration bit of line 10 */
  3209. #define EXTI_FTENR_TR11 ((uint32_t)0x00000800) /* Falling trigger event configuration bit of line 11 */
  3210. #define EXTI_FTENR_TR12 ((uint32_t)0x00001000) /* Falling trigger event configuration bit of line 12 */
  3211. #define EXTI_FTENR_TR13 ((uint32_t)0x00002000) /* Falling trigger event configuration bit of line 13 */
  3212. #define EXTI_FTENR_TR14 ((uint32_t)0x00004000) /* Falling trigger event configuration bit of line 14 */
  3213. #define EXTI_FTENR_TR15 ((uint32_t)0x00008000) /* Falling trigger event configuration bit of line 15 */
  3214. #define EXTI_FTENR_TR16 ((uint32_t)0x00010000) /* Falling trigger event configuration bit of line 16 */
  3215. #define EXTI_FTENR_TR17 ((uint32_t)0x00020000) /* Falling trigger event configuration bit of line 17 */
  3216. #define EXTI_FTENR_TR18 ((uint32_t)0x00040000) /* Falling trigger event configuration bit of line 18 */
  3217. #define EXTI_FTENR_TR19 ((uint32_t)0x00080000) /* Falling trigger event configuration bit of line 19 */
  3218. /****************** Bit definition for EXTI_SWIEVR register ******************/
  3219. #define EXTI_SWIEVR_SWIEVR0 ((uint32_t)0x00000001) /* Software Interrupt on line 0 */
  3220. #define EXTI_SWIEVR_SWIEVR1 ((uint32_t)0x00000002) /* Software Interrupt on line 1 */
  3221. #define EXTI_SWIEVR_SWIEVR2 ((uint32_t)0x00000004) /* Software Interrupt on line 2 */
  3222. #define EXTI_SWIEVR_SWIEVR3 ((uint32_t)0x00000008) /* Software Interrupt on line 3 */
  3223. #define EXTI_SWIEVR_SWIEVR4 ((uint32_t)0x00000010) /* Software Interrupt on line 4 */
  3224. #define EXTI_SWIEVR_SWIEVR5 ((uint32_t)0x00000020) /* Software Interrupt on line 5 */
  3225. #define EXTI_SWIEVR_SWIEVR6 ((uint32_t)0x00000040) /* Software Interrupt on line 6 */
  3226. #define EXTI_SWIEVR_SWIEVR7 ((uint32_t)0x00000080) /* Software Interrupt on line 7 */
  3227. #define EXTI_SWIEVR_SWIEVR8 ((uint32_t)0x00000100) /* Software Interrupt on line 8 */
  3228. #define EXTI_SWIEVR_SWIEVR9 ((uint32_t)0x00000200) /* Software Interrupt on line 9 */
  3229. #define EXTI_SWIEVR_SWIEVR10 ((uint32_t)0x00000400) /* Software Interrupt on line 10 */
  3230. #define EXTI_SWIEVR_SWIEVR11 ((uint32_t)0x00000800) /* Software Interrupt on line 11 */
  3231. #define EXTI_SWIEVR_SWIEVR12 ((uint32_t)0x00001000) /* Software Interrupt on line 12 */
  3232. #define EXTI_SWIEVR_SWIEVR13 ((uint32_t)0x00002000) /* Software Interrupt on line 13 */
  3233. #define EXTI_SWIEVR_SWIEVR14 ((uint32_t)0x00004000) /* Software Interrupt on line 14 */
  3234. #define EXTI_SWIEVR_SWIEVR15 ((uint32_t)0x00008000) /* Software Interrupt on line 15 */
  3235. #define EXTI_SWIEVR_SWIEVR16 ((uint32_t)0x00010000) /* Software Interrupt on line 16 */
  3236. #define EXTI_SWIEVR_SWIEVR17 ((uint32_t)0x00020000) /* Software Interrupt on line 17 */
  3237. #define EXTI_SWIEVR_SWIEVR18 ((uint32_t)0x00040000) /* Software Interrupt on line 18 */
  3238. #define EXTI_SWIEVR_SWIEVR19 ((uint32_t)0x00080000) /* Software Interrupt on line 19 */
  3239. /******************* Bit definition for EXTI_INTFR register ********************/
  3240. #define EXTI_INTF_INTF0 ((uint32_t)0x00000001) /* Pending bit for line 0 */
  3241. #define EXTI_INTF_INTF1 ((uint32_t)0x00000002) /* Pending bit for line 1 */
  3242. #define EXTI_INTF_INTF2 ((uint32_t)0x00000004) /* Pending bit for line 2 */
  3243. #define EXTI_INTF_INTF3 ((uint32_t)0x00000008) /* Pending bit for line 3 */
  3244. #define EXTI_INTF_INTF4 ((uint32_t)0x00000010) /* Pending bit for line 4 */
  3245. #define EXTI_INTF_INTF5 ((uint32_t)0x00000020) /* Pending bit for line 5 */
  3246. #define EXTI_INTF_INTF6 ((uint32_t)0x00000040) /* Pending bit for line 6 */
  3247. #define EXTI_INTF_INTF7 ((uint32_t)0x00000080) /* Pending bit for line 7 */
  3248. #define EXTI_INTF_INTF8 ((uint32_t)0x00000100) /* Pending bit for line 8 */
  3249. #define EXTI_INTF_INTF9 ((uint32_t)0x00000200) /* Pending bit for line 9 */
  3250. #define EXTI_INTF_INTF10 ((uint32_t)0x00000400) /* Pending bit for line 10 */
  3251. #define EXTI_INTF_INTF11 ((uint32_t)0x00000800) /* Pending bit for line 11 */
  3252. #define EXTI_INTF_INTF12 ((uint32_t)0x00001000) /* Pending bit for line 12 */
  3253. #define EXTI_INTF_INTF13 ((uint32_t)0x00002000) /* Pending bit for line 13 */
  3254. #define EXTI_INTF_INTF14 ((uint32_t)0x00004000) /* Pending bit for line 14 */
  3255. #define EXTI_INTF_INTF15 ((uint32_t)0x00008000) /* Pending bit for line 15 */
  3256. #define EXTI_INTF_INTF16 ((uint32_t)0x00010000) /* Pending bit for line 16 */
  3257. #define EXTI_INTF_INTF17 ((uint32_t)0x00020000) /* Pending bit for line 17 */
  3258. #define EXTI_INTF_INTF18 ((uint32_t)0x00040000) /* Pending bit for line 18 */
  3259. #define EXTI_INTF_INTF19 ((uint32_t)0x00080000) /* Pending bit for line 19 */
  3260. /******************************************************************************/
  3261. /* FLASH and Option Bytes Registers */
  3262. /******************************************************************************/
  3263. /******************* Bit definition for FLASH_ACTLR register ******************/
  3264. /****************** Bit definition for FLASH_KEYR register ******************/
  3265. #define FLASH_KEYR_FKEYR ((uint32_t)0xFFFFFFFF) /* FPEC Key */
  3266. /***************** Bit definition for FLASH_OBKEYR register ****************/
  3267. #define FLASH_OBKEYR_OBKEYR ((uint32_t)0xFFFFFFFF) /* Option Byte Key */
  3268. /****************** Bit definition for FLASH_STATR register *******************/
  3269. #define FLASH_STATR_BSY ((uint8_t)0x01) /* Busy */
  3270. #define FLASH_STATR_PGERR ((uint8_t)0x04) /* Programming Error */
  3271. #define FLASH_STATR_WRPRTERR ((uint8_t)0x10) /* Write Protection Error */
  3272. #define FLASH_STATR_EOP ((uint8_t)0x20) /* End of operation */
  3273. /******************* Bit definition for FLASH_CTLR register *******************/
  3274. #define FLASH_CTLR_PG ((uint32_t)0x00000001) /* Programming */
  3275. #define FLASH_CTLR_PER ((uint32_t)0x00000002) /* Sector Erase 4K */
  3276. #define FLASH_CTLR_MER ((uint32_t)0x00000004) /* Mass Erase */
  3277. #define FLASH_CTLR_OPTPG ((uint32_t)0x00000010) /* Option Byte Programming */
  3278. #define FLASH_CTLR_OPTER ((uint32_t)0x00000020) /* Option Byte Erase */
  3279. #define FLASH_CTLR_STRT ((uint32_t)0x00000040) /* Start */
  3280. #define FLASH_CTLR_LOCK ((uint32_t)0x00000080) /* Lock */
  3281. #define FLASH_CTLR_OPTWRE ((uint32_t)0x00000200) /* Option Bytes Write Enable */
  3282. #define FLASH_CTLR_ERRIE ((uint32_t)0x00000400) /* Error Interrupt Enable */
  3283. #define FLASH_CTLR_EOPIE ((uint32_t)0x00001000) /* End of operation interrupt enable */
  3284. #define FLASH_CTLR_FAST_LOCK ((uint32_t)0x00008000) /* Fast Lock */
  3285. #define FLASH_CTLR_PAGE_PG ((uint32_t)0x00010000) /* Page Programming 256Byte */
  3286. #define FLASH_CTLR_PAGE_ER ((uint32_t)0x00020000) /* Page Erase 256Byte */
  3287. #define FLASH_CTLR_PAGE_BER32 ((uint32_t)0x00040000) /* Block Erase 32K */
  3288. #define FLASH_CTLR_PAGE_BER64 ((uint32_t)0x00080000) /* Block Erase 64K */
  3289. #define FLASH_CTLR_PG_STRT ((uint32_t)0x00200000) /* Page Programming Start */
  3290. /******************* Bit definition for FLASH_ADDR register *******************/
  3291. #define FLASH_ADDR_FAR ((uint32_t)0xFFFFFFFF) /* Flash Address */
  3292. /****************** Bit definition for FLASH_OBR register *******************/
  3293. #define FLASH_OBR_OPTERR ((uint16_t)0x0001) /* Option Byte Error */
  3294. #define FLASH_OBR_RDPRT ((uint16_t)0x0002) /* Read protection */
  3295. #define FLASH_OBR_USER ((uint16_t)0x03FC) /* User Option Bytes */
  3296. #define FLASH_OBR_WDG_SW ((uint16_t)0x0004) /* WDG_SW */
  3297. #define FLASH_OBR_nRST_STOP ((uint16_t)0x0008) /* nRST_STOP */
  3298. #define FLASH_OBR_nRST_STDBY ((uint16_t)0x0010) /* nRST_STDBY */
  3299. #define FLASH_OBR_BFB2 ((uint16_t)0x0020) /* BFB2 */
  3300. /****************** Bit definition for FLASH_WPR register ******************/
  3301. #define FLASH_WPR_WRP ((uint32_t)0xFFFFFFFF) /* Write Protect */
  3302. /****************** Bit definition for FLASH_RDPR register *******************/
  3303. #define FLASH_RDPR_RDPR ((uint32_t)0x000000FF) /* Read protection option byte */
  3304. #define FLASH_RDPR_nRDPR ((uint32_t)0x0000FF00) /* Read protection complemented option byte */
  3305. /****************** Bit definition for FLASH_USER register ******************/
  3306. #define FLASH_USER_USER ((uint32_t)0x00FF0000) /* User option byte */
  3307. #define FLASH_USER_nUSER ((uint32_t)0xFF000000) /* User complemented option byte */
  3308. /****************** Bit definition for FLASH_Data0 register *****************/
  3309. #define FLASH_Data0_Data0 ((uint32_t)0x000000FF) /* User data storage option byte */
  3310. #define FLASH_Data0_nData0 ((uint32_t)0x0000FF00) /* User data storage complemented option byte */
  3311. /****************** Bit definition for FLASH_Data1 register *****************/
  3312. #define FLASH_Data1_Data1 ((uint32_t)0x00FF0000) /* User data storage option byte */
  3313. #define FLASH_Data1_nData1 ((uint32_t)0xFF000000) /* User data storage complemented option byte */
  3314. /****************** Bit definition for FLASH_WRPR0 register ******************/
  3315. #define FLASH_WRPR0_WRPR0 ((uint32_t)0x000000FF) /* Flash memory write protection option bytes */
  3316. #define FLASH_WRPR0_nWRPR0 ((uint32_t)0x0000FF00) /* Flash memory write protection complemented option bytes */
  3317. /****************** Bit definition for FLASH_WRPR1 register ******************/
  3318. #define FLASH_WRPR1_WRPR1 ((uint32_t)0x00FF0000) /* Flash memory write protection option bytes */
  3319. #define FLASH_WRPR1_nWRPR1 ((uint32_t)0xFF000000) /* Flash memory write protection complemented option bytes */
  3320. /****************** Bit definition for FLASH_WRPR2 register ******************/
  3321. #define FLASH_WRPR2_WRPR2 ((uint32_t)0x000000FF) /* Flash memory write protection option bytes */
  3322. #define FLASH_WRPR2_nWRPR2 ((uint32_t)0x0000FF00) /* Flash memory write protection complemented option bytes */
  3323. /****************** Bit definition for FLASH_WRPR3 register ******************/
  3324. #define FLASH_WRPR3_WRPR3 ((uint32_t)0x00FF0000) /* Flash memory write protection option bytes */
  3325. #define FLASH_WRPR3_nWRPR3 ((uint32_t)0xFF000000) /* Flash memory write protection complemented option bytes */
  3326. /******************************************************************************/
  3327. /* General Purpose and Alternate Function I/O */
  3328. /******************************************************************************/
  3329. /******************* Bit definition for GPIO_CFGLR register *******************/
  3330. #define GPIO_CFGLR_MODE ((uint32_t)0x33333333) /* Port x mode bits */
  3331. #define GPIO_CFGLR_MODE0 ((uint32_t)0x00000003) /* MODE0[1:0] bits (Port x mode bits, pin 0) */
  3332. #define GPIO_CFGLR_MODE0_0 ((uint32_t)0x00000001) /* Bit 0 */
  3333. #define GPIO_CFGLR_MODE0_1 ((uint32_t)0x00000002) /* Bit 1 */
  3334. #define GPIO_CFGLR_MODE1 ((uint32_t)0x00000030) /* MODE1[1:0] bits (Port x mode bits, pin 1) */
  3335. #define GPIO_CFGLR_MODE1_0 ((uint32_t)0x00000010) /* Bit 0 */
  3336. #define GPIO_CFGLR_MODE1_1 ((uint32_t)0x00000020) /* Bit 1 */
  3337. #define GPIO_CFGLR_MODE2 ((uint32_t)0x00000300) /* MODE2[1:0] bits (Port x mode bits, pin 2) */
  3338. #define GPIO_CFGLR_MODE2_0 ((uint32_t)0x00000100) /* Bit 0 */
  3339. #define GPIO_CFGLR_MODE2_1 ((uint32_t)0x00000200) /* Bit 1 */
  3340. #define GPIO_CFGLR_MODE3 ((uint32_t)0x00003000) /* MODE3[1:0] bits (Port x mode bits, pin 3) */
  3341. #define GPIO_CFGLR_MODE3_0 ((uint32_t)0x00001000) /* Bit 0 */
  3342. #define GPIO_CFGLR_MODE3_1 ((uint32_t)0x00002000) /* Bit 1 */
  3343. #define GPIO_CFGLR_MODE4 ((uint32_t)0x00030000) /* MODE4[1:0] bits (Port x mode bits, pin 4) */
  3344. #define GPIO_CFGLR_MODE4_0 ((uint32_t)0x00010000) /* Bit 0 */
  3345. #define GPIO_CFGLR_MODE4_1 ((uint32_t)0x00020000) /* Bit 1 */
  3346. #define GPIO_CFGLR_MODE5 ((uint32_t)0x00300000) /* MODE5[1:0] bits (Port x mode bits, pin 5) */
  3347. #define GPIO_CFGLR_MODE5_0 ((uint32_t)0x00100000) /* Bit 0 */
  3348. #define GPIO_CFGLR_MODE5_1 ((uint32_t)0x00200000) /* Bit 1 */
  3349. #define GPIO_CFGLR_MODE6 ((uint32_t)0x03000000) /* MODE6[1:0] bits (Port x mode bits, pin 6) */
  3350. #define GPIO_CFGLR_MODE6_0 ((uint32_t)0x01000000) /* Bit 0 */
  3351. #define GPIO_CFGLR_MODE6_1 ((uint32_t)0x02000000) /* Bit 1 */
  3352. #define GPIO_CFGLR_MODE7 ((uint32_t)0x30000000) /* MODE7[1:0] bits (Port x mode bits, pin 7) */
  3353. #define GPIO_CFGLR_MODE7_0 ((uint32_t)0x10000000) /* Bit 0 */
  3354. #define GPIO_CFGLR_MODE7_1 ((uint32_t)0x20000000) /* Bit 1 */
  3355. #define GPIO_CFGLR_CNF ((uint32_t)0xCCCCCCCC) /* Port x configuration bits */
  3356. #define GPIO_CFGLR_CNF0 ((uint32_t)0x0000000C) /* CNF0[1:0] bits (Port x configuration bits, pin 0) */
  3357. #define GPIO_CFGLR_CNF0_0 ((uint32_t)0x00000004) /* Bit 0 */
  3358. #define GPIO_CFGLR_CNF0_1 ((uint32_t)0x00000008) /* Bit 1 */
  3359. #define GPIO_CFGLR_CNF1 ((uint32_t)0x000000C0) /* CNF1[1:0] bits (Port x configuration bits, pin 1) */
  3360. #define GPIO_CFGLR_CNF1_0 ((uint32_t)0x00000040) /* Bit 0 */
  3361. #define GPIO_CFGLR_CNF1_1 ((uint32_t)0x00000080) /* Bit 1 */
  3362. #define GPIO_CFGLR_CNF2 ((uint32_t)0x00000C00) /* CNF2[1:0] bits (Port x configuration bits, pin 2) */
  3363. #define GPIO_CFGLR_CNF2_0 ((uint32_t)0x00000400) /* Bit 0 */
  3364. #define GPIO_CFGLR_CNF2_1 ((uint32_t)0x00000800) /* Bit 1 */
  3365. #define GPIO_CFGLR_CNF3 ((uint32_t)0x0000C000) /* CNF3[1:0] bits (Port x configuration bits, pin 3) */
  3366. #define GPIO_CFGLR_CNF3_0 ((uint32_t)0x00004000) /* Bit 0 */
  3367. #define GPIO_CFGLR_CNF3_1 ((uint32_t)0x00008000) /* Bit 1 */
  3368. #define GPIO_CFGLR_CNF4 ((uint32_t)0x000C0000) /* CNF4[1:0] bits (Port x configuration bits, pin 4) */
  3369. #define GPIO_CFGLR_CNF4_0 ((uint32_t)0x00040000) /* Bit 0 */
  3370. #define GPIO_CFGLR_CNF4_1 ((uint32_t)0x00080000) /* Bit 1 */
  3371. #define GPIO_CFGLR_CNF5 ((uint32_t)0x00C00000) /* CNF5[1:0] bits (Port x configuration bits, pin 5) */
  3372. #define GPIO_CFGLR_CNF5_0 ((uint32_t)0x00400000) /* Bit 0 */
  3373. #define GPIO_CFGLR_CNF5_1 ((uint32_t)0x00800000) /* Bit 1 */
  3374. #define GPIO_CFGLR_CNF6 ((uint32_t)0x0C000000) /* CNF6[1:0] bits (Port x configuration bits, pin 6) */
  3375. #define GPIO_CFGLR_CNF6_0 ((uint32_t)0x04000000) /* Bit 0 */
  3376. #define GPIO_CFGLR_CNF6_1 ((uint32_t)0x08000000) /* Bit 1 */
  3377. #define GPIO_CFGLR_CNF7 ((uint32_t)0xC0000000) /* CNF7[1:0] bits (Port x configuration bits, pin 7) */
  3378. #define GPIO_CFGLR_CNF7_0 ((uint32_t)0x40000000) /* Bit 0 */
  3379. #define GPIO_CFGLR_CNF7_1 ((uint32_t)0x80000000) /* Bit 1 */
  3380. /******************* Bit definition for GPIO_CFGHR register *******************/
  3381. #define GPIO_CFGHR_MODE ((uint32_t)0x33333333) /* Port x mode bits */
  3382. #define GPIO_CFGHR_MODE8 ((uint32_t)0x00000003) /* MODE8[1:0] bits (Port x mode bits, pin 8) */
  3383. #define GPIO_CFGHR_MODE8_0 ((uint32_t)0x00000001) /* Bit 0 */
  3384. #define GPIO_CFGHR_MODE8_1 ((uint32_t)0x00000002) /* Bit 1 */
  3385. #define GPIO_CFGHR_MODE9 ((uint32_t)0x00000030) /* MODE9[1:0] bits (Port x mode bits, pin 9) */
  3386. #define GPIO_CFGHR_MODE9_0 ((uint32_t)0x00000010) /* Bit 0 */
  3387. #define GPIO_CFGHR_MODE9_1 ((uint32_t)0x00000020) /* Bit 1 */
  3388. #define GPIO_CFGHR_MODE10 ((uint32_t)0x00000300) /* MODE10[1:0] bits (Port x mode bits, pin 10) */
  3389. #define GPIO_CFGHR_MODE10_0 ((uint32_t)0x00000100) /* Bit 0 */
  3390. #define GPIO_CFGHR_MODE10_1 ((uint32_t)0x00000200) /* Bit 1 */
  3391. #define GPIO_CFGHR_MODE11 ((uint32_t)0x00003000) /* MODE11[1:0] bits (Port x mode bits, pin 11) */
  3392. #define GPIO_CFGHR_MODE11_0 ((uint32_t)0x00001000) /* Bit 0 */
  3393. #define GPIO_CFGHR_MODE11_1 ((uint32_t)0x00002000) /* Bit 1 */
  3394. #define GPIO_CFGHR_MODE12 ((uint32_t)0x00030000) /* MODE12[1:0] bits (Port x mode bits, pin 12) */
  3395. #define GPIO_CFGHR_MODE12_0 ((uint32_t)0x00010000) /* Bit 0 */
  3396. #define GPIO_CFGHR_MODE12_1 ((uint32_t)0x00020000) /* Bit 1 */
  3397. #define GPIO_CFGHR_MODE13 ((uint32_t)0x00300000) /* MODE13[1:0] bits (Port x mode bits, pin 13) */
  3398. #define GPIO_CFGHR_MODE13_0 ((uint32_t)0x00100000) /* Bit 0 */
  3399. #define GPIO_CFGHR_MODE13_1 ((uint32_t)0x00200000) /* Bit 1 */
  3400. #define GPIO_CFGHR_MODE14 ((uint32_t)0x03000000) /* MODE14[1:0] bits (Port x mode bits, pin 14) */
  3401. #define GPIO_CFGHR_MODE14_0 ((uint32_t)0x01000000) /* Bit 0 */
  3402. #define GPIO_CFGHR_MODE14_1 ((uint32_t)0x02000000) /* Bit 1 */
  3403. #define GPIO_CFGHR_MODE15 ((uint32_t)0x30000000) /* MODE15[1:0] bits (Port x mode bits, pin 15) */
  3404. #define GPIO_CFGHR_MODE15_0 ((uint32_t)0x10000000) /* Bit 0 */
  3405. #define GPIO_CFGHR_MODE15_1 ((uint32_t)0x20000000) /* Bit 1 */
  3406. #define GPIO_CFGHR_CNF ((uint32_t)0xCCCCCCCC) /* Port x configuration bits */
  3407. #define GPIO_CFGHR_CNF8 ((uint32_t)0x0000000C) /* CNF8[1:0] bits (Port x configuration bits, pin 8) */
  3408. #define GPIO_CFGHR_CNF8_0 ((uint32_t)0x00000004) /* Bit 0 */
  3409. #define GPIO_CFGHR_CNF8_1 ((uint32_t)0x00000008) /* Bit 1 */
  3410. #define GPIO_CFGHR_CNF9 ((uint32_t)0x000000C0) /* CNF9[1:0] bits (Port x configuration bits, pin 9) */
  3411. #define GPIO_CFGHR_CNF9_0 ((uint32_t)0x00000040) /* Bit 0 */
  3412. #define GPIO_CFGHR_CNF9_1 ((uint32_t)0x00000080) /* Bit 1 */
  3413. #define GPIO_CFGHR_CNF10 ((uint32_t)0x00000C00) /* CNF10[1:0] bits (Port x configuration bits, pin 10) */
  3414. #define GPIO_CFGHR_CNF10_0 ((uint32_t)0x00000400) /* Bit 0 */
  3415. #define GPIO_CFGHR_CNF10_1 ((uint32_t)0x00000800) /* Bit 1 */
  3416. #define GPIO_CFGHR_CNF11 ((uint32_t)0x0000C000) /* CNF11[1:0] bits (Port x configuration bits, pin 11) */
  3417. #define GPIO_CFGHR_CNF11_0 ((uint32_t)0x00004000) /* Bit 0 */
  3418. #define GPIO_CFGHR_CNF11_1 ((uint32_t)0x00008000) /* Bit 1 */
  3419. #define GPIO_CFGHR_CNF12 ((uint32_t)0x000C0000) /* CNF12[1:0] bits (Port x configuration bits, pin 12) */
  3420. #define GPIO_CFGHR_CNF12_0 ((uint32_t)0x00040000) /* Bit 0 */
  3421. #define GPIO_CFGHR_CNF12_1 ((uint32_t)0x00080000) /* Bit 1 */
  3422. #define GPIO_CFGHR_CNF13 ((uint32_t)0x00C00000) /* CNF13[1:0] bits (Port x configuration bits, pin 13) */
  3423. #define GPIO_CFGHR_CNF13_0 ((uint32_t)0x00400000) /* Bit 0 */
  3424. #define GPIO_CFGHR_CNF13_1 ((uint32_t)0x00800000) /* Bit 1 */
  3425. #define GPIO_CFGHR_CNF14 ((uint32_t)0x0C000000) /* CNF14[1:0] bits (Port x configuration bits, pin 14) */
  3426. #define GPIO_CFGHR_CNF14_0 ((uint32_t)0x04000000) /* Bit 0 */
  3427. #define GPIO_CFGHR_CNF14_1 ((uint32_t)0x08000000) /* Bit 1 */
  3428. #define GPIO_CFGHR_CNF15 ((uint32_t)0xC0000000) /* CNF15[1:0] bits (Port x configuration bits, pin 15) */
  3429. #define GPIO_CFGHR_CNF15_0 ((uint32_t)0x40000000) /* Bit 0 */
  3430. #define GPIO_CFGHR_CNF15_1 ((uint32_t)0x80000000) /* Bit 1 */
  3431. /******************* Bit definition for GPIO_INDR register *******************/
  3432. #define GPIO_INDR_IDR0 ((uint16_t)0x0001) /* Port input data, bit 0 */
  3433. #define GPIO_INDR_IDR1 ((uint16_t)0x0002) /* Port input data, bit 1 */
  3434. #define GPIO_INDR_IDR2 ((uint16_t)0x0004) /* Port input data, bit 2 */
  3435. #define GPIO_INDR_IDR3 ((uint16_t)0x0008) /* Port input data, bit 3 */
  3436. #define GPIO_INDR_IDR4 ((uint16_t)0x0010) /* Port input data, bit 4 */
  3437. #define GPIO_INDR_IDR5 ((uint16_t)0x0020) /* Port input data, bit 5 */
  3438. #define GPIO_INDR_IDR6 ((uint16_t)0x0040) /* Port input data, bit 6 */
  3439. #define GPIO_INDR_IDR7 ((uint16_t)0x0080) /* Port input data, bit 7 */
  3440. #define GPIO_INDR_IDR8 ((uint16_t)0x0100) /* Port input data, bit 8 */
  3441. #define GPIO_INDR_IDR9 ((uint16_t)0x0200) /* Port input data, bit 9 */
  3442. #define GPIO_INDR_IDR10 ((uint16_t)0x0400) /* Port input data, bit 10 */
  3443. #define GPIO_INDR_IDR11 ((uint16_t)0x0800) /* Port input data, bit 11 */
  3444. #define GPIO_INDR_IDR12 ((uint16_t)0x1000) /* Port input data, bit 12 */
  3445. #define GPIO_INDR_IDR13 ((uint16_t)0x2000) /* Port input data, bit 13 */
  3446. #define GPIO_INDR_IDR14 ((uint16_t)0x4000) /* Port input data, bit 14 */
  3447. #define GPIO_INDR_IDR15 ((uint16_t)0x8000) /* Port input data, bit 15 */
  3448. /******************* Bit definition for GPIO_OUTDR register *******************/
  3449. #define GPIO_OUTDR_ODR0 ((uint16_t)0x0001) /* Port output data, bit 0 */
  3450. #define GPIO_OUTDR_ODR1 ((uint16_t)0x0002) /* Port output data, bit 1 */
  3451. #define GPIO_OUTDR_ODR2 ((uint16_t)0x0004) /* Port output data, bit 2 */
  3452. #define GPIO_OUTDR_ODR3 ((uint16_t)0x0008) /* Port output data, bit 3 */
  3453. #define GPIO_OUTDR_ODR4 ((uint16_t)0x0010) /* Port output data, bit 4 */
  3454. #define GPIO_OUTDR_ODR5 ((uint16_t)0x0020) /* Port output data, bit 5 */
  3455. #define GPIO_OUTDR_ODR6 ((uint16_t)0x0040) /* Port output data, bit 6 */
  3456. #define GPIO_OUTDR_ODR7 ((uint16_t)0x0080) /* Port output data, bit 7 */
  3457. #define GPIO_OUTDR_ODR8 ((uint16_t)0x0100) /* Port output data, bit 8 */
  3458. #define GPIO_OUTDR_ODR9 ((uint16_t)0x0200) /* Port output data, bit 9 */
  3459. #define GPIO_OUTDR_ODR10 ((uint16_t)0x0400) /* Port output data, bit 10 */
  3460. #define GPIO_OUTDR_ODR11 ((uint16_t)0x0800) /* Port output data, bit 11 */
  3461. #define GPIO_OUTDR_ODR12 ((uint16_t)0x1000) /* Port output data, bit 12 */
  3462. #define GPIO_OUTDR_ODR13 ((uint16_t)0x2000) /* Port output data, bit 13 */
  3463. #define GPIO_OUTDR_ODR14 ((uint16_t)0x4000) /* Port output data, bit 14 */
  3464. #define GPIO_OUTDR_ODR15 ((uint16_t)0x8000) /* Port output data, bit 15 */
  3465. /****************** Bit definition for GPIO_BSHR register *******************/
  3466. #define GPIO_BSHR_BS0 ((uint32_t)0x00000001) /* Port x Set bit 0 */
  3467. #define GPIO_BSHR_BS1 ((uint32_t)0x00000002) /* Port x Set bit 1 */
  3468. #define GPIO_BSHR_BS2 ((uint32_t)0x00000004) /* Port x Set bit 2 */
  3469. #define GPIO_BSHR_BS3 ((uint32_t)0x00000008) /* Port x Set bit 3 */
  3470. #define GPIO_BSHR_BS4 ((uint32_t)0x00000010) /* Port x Set bit 4 */
  3471. #define GPIO_BSHR_BS5 ((uint32_t)0x00000020) /* Port x Set bit 5 */
  3472. #define GPIO_BSHR_BS6 ((uint32_t)0x00000040) /* Port x Set bit 6 */
  3473. #define GPIO_BSHR_BS7 ((uint32_t)0x00000080) /* Port x Set bit 7 */
  3474. #define GPIO_BSHR_BS8 ((uint32_t)0x00000100) /* Port x Set bit 8 */
  3475. #define GPIO_BSHR_BS9 ((uint32_t)0x00000200) /* Port x Set bit 9 */
  3476. #define GPIO_BSHR_BS10 ((uint32_t)0x00000400) /* Port x Set bit 10 */
  3477. #define GPIO_BSHR_BS11 ((uint32_t)0x00000800) /* Port x Set bit 11 */
  3478. #define GPIO_BSHR_BS12 ((uint32_t)0x00001000) /* Port x Set bit 12 */
  3479. #define GPIO_BSHR_BS13 ((uint32_t)0x00002000) /* Port x Set bit 13 */
  3480. #define GPIO_BSHR_BS14 ((uint32_t)0x00004000) /* Port x Set bit 14 */
  3481. #define GPIO_BSHR_BS15 ((uint32_t)0x00008000) /* Port x Set bit 15 */
  3482. #define GPIO_BSHR_BR0 ((uint32_t)0x00010000) /* Port x Reset bit 0 */
  3483. #define GPIO_BSHR_BR1 ((uint32_t)0x00020000) /* Port x Reset bit 1 */
  3484. #define GPIO_BSHR_BR2 ((uint32_t)0x00040000) /* Port x Reset bit 2 */
  3485. #define GPIO_BSHR_BR3 ((uint32_t)0x00080000) /* Port x Reset bit 3 */
  3486. #define GPIO_BSHR_BR4 ((uint32_t)0x00100000) /* Port x Reset bit 4 */
  3487. #define GPIO_BSHR_BR5 ((uint32_t)0x00200000) /* Port x Reset bit 5 */
  3488. #define GPIO_BSHR_BR6 ((uint32_t)0x00400000) /* Port x Reset bit 6 */
  3489. #define GPIO_BSHR_BR7 ((uint32_t)0x00800000) /* Port x Reset bit 7 */
  3490. #define GPIO_BSHR_BR8 ((uint32_t)0x01000000) /* Port x Reset bit 8 */
  3491. #define GPIO_BSHR_BR9 ((uint32_t)0x02000000) /* Port x Reset bit 9 */
  3492. #define GPIO_BSHR_BR10 ((uint32_t)0x04000000) /* Port x Reset bit 10 */
  3493. #define GPIO_BSHR_BR11 ((uint32_t)0x08000000) /* Port x Reset bit 11 */
  3494. #define GPIO_BSHR_BR12 ((uint32_t)0x10000000) /* Port x Reset bit 12 */
  3495. #define GPIO_BSHR_BR13 ((uint32_t)0x20000000) /* Port x Reset bit 13 */
  3496. #define GPIO_BSHR_BR14 ((uint32_t)0x40000000) /* Port x Reset bit 14 */
  3497. #define GPIO_BSHR_BR15 ((uint32_t)0x80000000) /* Port x Reset bit 15 */
  3498. /******************* Bit definition for GPIO_BCR register *******************/
  3499. #define GPIO_BCR_BR0 ((uint16_t)0x0001) /* Port x Reset bit 0 */
  3500. #define GPIO_BCR_BR1 ((uint16_t)0x0002) /* Port x Reset bit 1 */
  3501. #define GPIO_BCR_BR2 ((uint16_t)0x0004) /* Port x Reset bit 2 */
  3502. #define GPIO_BCR_BR3 ((uint16_t)0x0008) /* Port x Reset bit 3 */
  3503. #define GPIO_BCR_BR4 ((uint16_t)0x0010) /* Port x Reset bit 4 */
  3504. #define GPIO_BCR_BR5 ((uint16_t)0x0020) /* Port x Reset bit 5 */
  3505. #define GPIO_BCR_BR6 ((uint16_t)0x0040) /* Port x Reset bit 6 */
  3506. #define GPIO_BCR_BR7 ((uint16_t)0x0080) /* Port x Reset bit 7 */
  3507. #define GPIO_BCR_BR8 ((uint16_t)0x0100) /* Port x Reset bit 8 */
  3508. #define GPIO_BCR_BR9 ((uint16_t)0x0200) /* Port x Reset bit 9 */
  3509. #define GPIO_BCR_BR10 ((uint16_t)0x0400) /* Port x Reset bit 10 */
  3510. #define GPIO_BCR_BR11 ((uint16_t)0x0800) /* Port x Reset bit 11 */
  3511. #define GPIO_BCR_BR12 ((uint16_t)0x1000) /* Port x Reset bit 12 */
  3512. #define GPIO_BCR_BR13 ((uint16_t)0x2000) /* Port x Reset bit 13 */
  3513. #define GPIO_BCR_BR14 ((uint16_t)0x4000) /* Port x Reset bit 14 */
  3514. #define GPIO_BCR_BR15 ((uint16_t)0x8000) /* Port x Reset bit 15 */
  3515. /****************** Bit definition for GPIO_LCKR register *******************/
  3516. #define GPIO_LCK0 ((uint32_t)0x00000001) /* Port x Lock bit 0 */
  3517. #define GPIO_LCK1 ((uint32_t)0x00000002) /* Port x Lock bit 1 */
  3518. #define GPIO_LCK2 ((uint32_t)0x00000004) /* Port x Lock bit 2 */
  3519. #define GPIO_LCK3 ((uint32_t)0x00000008) /* Port x Lock bit 3 */
  3520. #define GPIO_LCK4 ((uint32_t)0x00000010) /* Port x Lock bit 4 */
  3521. #define GPIO_LCK5 ((uint32_t)0x00000020) /* Port x Lock bit 5 */
  3522. #define GPIO_LCK6 ((uint32_t)0x00000040) /* Port x Lock bit 6 */
  3523. #define GPIO_LCK7 ((uint32_t)0x00000080) /* Port x Lock bit 7 */
  3524. #define GPIO_LCK8 ((uint32_t)0x00000100) /* Port x Lock bit 8 */
  3525. #define GPIO_LCK9 ((uint32_t)0x00000200) /* Port x Lock bit 9 */
  3526. #define GPIO_LCK10 ((uint32_t)0x00000400) /* Port x Lock bit 10 */
  3527. #define GPIO_LCK11 ((uint32_t)0x00000800) /* Port x Lock bit 11 */
  3528. #define GPIO_LCK12 ((uint32_t)0x00001000) /* Port x Lock bit 12 */
  3529. #define GPIO_LCK13 ((uint32_t)0x00002000) /* Port x Lock bit 13 */
  3530. #define GPIO_LCK14 ((uint32_t)0x00004000) /* Port x Lock bit 14 */
  3531. #define GPIO_LCK15 ((uint32_t)0x00008000) /* Port x Lock bit 15 */
  3532. #define GPIO_LCKK ((uint32_t)0x00010000) /* Lock key */
  3533. /****************** Bit definition for AFIO_ECR register *******************/
  3534. #define AFIO_ECR_PIN ((uint8_t)0x0F) /* PIN[3:0] bits (Pin selection) */
  3535. #define AFIO_ECR_PIN_0 ((uint8_t)0x01) /* Bit 0 */
  3536. #define AFIO_ECR_PIN_1 ((uint8_t)0x02) /* Bit 1 */
  3537. #define AFIO_ECR_PIN_2 ((uint8_t)0x04) /* Bit 2 */
  3538. #define AFIO_ECR_PIN_3 ((uint8_t)0x08) /* Bit 3 */
  3539. #define AFIO_ECR_PIN_PX0 ((uint8_t)0x00) /* Pin 0 selected */
  3540. #define AFIO_ECR_PIN_PX1 ((uint8_t)0x01) /* Pin 1 selected */
  3541. #define AFIO_ECR_PIN_PX2 ((uint8_t)0x02) /* Pin 2 selected */
  3542. #define AFIO_ECR_PIN_PX3 ((uint8_t)0x03) /* Pin 3 selected */
  3543. #define AFIO_ECR_PIN_PX4 ((uint8_t)0x04) /* Pin 4 selected */
  3544. #define AFIO_ECR_PIN_PX5 ((uint8_t)0x05) /* Pin 5 selected */
  3545. #define AFIO_ECR_PIN_PX6 ((uint8_t)0x06) /* Pin 6 selected */
  3546. #define AFIO_ECR_PIN_PX7 ((uint8_t)0x07) /* Pin 7 selected */
  3547. #define AFIO_ECR_PIN_PX8 ((uint8_t)0x08) /* Pin 8 selected */
  3548. #define AFIO_ECR_PIN_PX9 ((uint8_t)0x09) /* Pin 9 selected */
  3549. #define AFIO_ECR_PIN_PX10 ((uint8_t)0x0A) /* Pin 10 selected */
  3550. #define AFIO_ECR_PIN_PX11 ((uint8_t)0x0B) /* Pin 11 selected */
  3551. #define AFIO_ECR_PIN_PX12 ((uint8_t)0x0C) /* Pin 12 selected */
  3552. #define AFIO_ECR_PIN_PX13 ((uint8_t)0x0D) /* Pin 13 selected */
  3553. #define AFIO_ECR_PIN_PX14 ((uint8_t)0x0E) /* Pin 14 selected */
  3554. #define AFIO_ECR_PIN_PX15 ((uint8_t)0x0F) /* Pin 15 selected */
  3555. #define AFIO_ECR_PORT ((uint8_t)0x70) /* PORT[2:0] bits (Port selection) */
  3556. #define AFIO_ECR_PORT_0 ((uint8_t)0x10) /* Bit 0 */
  3557. #define AFIO_ECR_PORT_1 ((uint8_t)0x20) /* Bit 1 */
  3558. #define AFIO_ECR_PORT_2 ((uint8_t)0x40) /* Bit 2 */
  3559. #define AFIO_ECR_PORT_PA ((uint8_t)0x00) /* Port A selected */
  3560. #define AFIO_ECR_PORT_PB ((uint8_t)0x10) /* Port B selected */
  3561. #define AFIO_ECR_PORT_PC ((uint8_t)0x20) /* Port C selected */
  3562. #define AFIO_ECR_PORT_PD ((uint8_t)0x30) /* Port D selected */
  3563. #define AFIO_ECR_PORT_PE ((uint8_t)0x40) /* Port E selected */
  3564. #define AFIO_ECR_EVOE ((uint8_t)0x80) /* Event Output Enable */
  3565. /****************** Bit definition for AFIO_PCFR1register *******************/
  3566. #define AFIO_PCFR1_SPI1_REMAP ((uint32_t)0x00000001) /* SPI1 remapping */
  3567. #define AFIO_PCFR1_I2C1_REMAP ((uint32_t)0x00000002) /* I2C1 remapping */
  3568. #define AFIO_PCFR1_USART1_REMAP ((uint32_t)0x00000004) /* USART1 remapping */
  3569. #define AFIO_PCFR1_USART2_REMAP ((uint32_t)0x00000008) /* USART2 remapping */
  3570. #define AFIO_PCFR1_USART3_REMAP ((uint32_t)0x00000030) /* USART3_REMAP[1:0] bits (USART3 remapping) */
  3571. #define AFIO_PCFR1_USART3_REMAP_0 ((uint32_t)0x00000010) /* Bit 0 */
  3572. #define AFIO_PCFR1_USART3_REMAP_1 ((uint32_t)0x00000020) /* Bit 1 */
  3573. #define AFIO_PCFR1_USART3_REMAP_NOREMAP ((uint32_t)0x00000000) /* No remap (TX/PB10, RX/PB11, CK/PB12, CTS/PB13, RTS/PB14) */
  3574. #define AFIO_PCFR1_USART3_REMAP_PARTIALREMAP ((uint32_t)0x00000010) /* Partial remap (TX/PC10, RX/PC11, CK/PC12, CTS/PB13, RTS/PB14) */
  3575. #define AFIO_PCFR1_USART3_REMAP_FULLREMAP ((uint32_t)0x00000030) /* Full remap (TX/PD8, RX/PD9, CK/PD10, CTS/PD11, RTS/PD12) */
  3576. #define AFIO_PCFR1_TIM1_REMAP ((uint32_t)0x000000C0) /* TIM1_REMAP[1:0] bits (TIM1 remapping) */
  3577. #define AFIO_PCFR1_TIM1_REMAP_0 ((uint32_t)0x00000040) /* Bit 0 */
  3578. #define AFIO_PCFR1_TIM1_REMAP_1 ((uint32_t)0x00000080) /* Bit 1 */
  3579. #define AFIO_PCFR1_TIM1_REMAP_NOREMAP ((uint32_t)0x00000000) /* No remap (ETR/PA12, CH1/PA8, CH2/PA9, CH3/PA10, CH4/PA11, BKIN/PB12, CH1N/PB13, CH2N/PB14, CH3N/PB15) */
  3580. #define AFIO_PCFR1_TIM1_REMAP_PARTIALREMAP ((uint32_t)0x00000040) /* Partial remap (ETR/PA12, CH1/PA8, CH2/PA9, CH3/PA10, CH4/PA11, BKIN/PA6, CH1N/PA7, CH2N/PB0, CH3N/PB1) */
  3581. #define AFIO_PCFR1_TIM1_REMAP_FULLREMAP ((uint32_t)0x000000C0) /* Full remap (ETR/PE7, CH1/PE9, CH2/PE11, CH3/PE13, CH4/PE14, BKIN/PE15, CH1N/PE8, CH2N/PE10, CH3N/PE12) */
  3582. #define AFIO_PCFR1_TIM2_REMAP ((uint32_t)0x00000300) /* TIM2_REMAP[1:0] bits (TIM2 remapping) */
  3583. #define AFIO_PCFR1_TIM2_REMAP_0 ((uint32_t)0x00000100) /* Bit 0 */
  3584. #define AFIO_PCFR1_TIM2_REMAP_1 ((uint32_t)0x00000200) /* Bit 1 */
  3585. #define AFIO_PCFR1_TIM2_REMAP_NOREMAP ((uint32_t)0x00000000) /* No remap (CH1/ETR/PA0, CH2/PA1, CH3/PA2, CH4/PA3) */
  3586. #define AFIO_PCFR1_TIM2_REMAP_PARTIALREMAP1 ((uint32_t)0x00000100) /* Partial remap (CH1/ETR/PA15, CH2/PB3, CH3/PA2, CH4/PA3) */
  3587. #define AFIO_PCFR1_TIM2_REMAP_PARTIALREMAP2 ((uint32_t)0x00000200) /* Partial remap (CH1/ETR/PA0, CH2/PA1, CH3/PB10, CH4/PB11) */
  3588. #define AFIO_PCFR1_TIM2_REMAP_FULLREMAP ((uint32_t)0x00000300) /* Full remap (CH1/ETR/PA15, CH2/PB3, CH3/PB10, CH4/PB11) */
  3589. #define AFIO_PCFR1_TIM3_REMAP ((uint32_t)0x00000C00) /* TIM3_REMAP[1:0] bits (TIM3 remapping) */
  3590. #define AFIO_PCFR1_TIM3_REMAP_0 ((uint32_t)0x00000400) /* Bit 0 */
  3591. #define AFIO_PCFR1_TIM3_REMAP_1 ((uint32_t)0x00000800) /* Bit 1 */
  3592. #define AFIO_PCFR1_TIM3_REMAP_NOREMAP ((uint32_t)0x00000000) /* No remap (CH1/PA6, CH2/PA7, CH3/PB0, CH4/PB1) */
  3593. #define AFIO_PCFR1_TIM3_REMAP_PARTIALREMAP ((uint32_t)0x00000800) /* Partial remap (CH1/PB4, CH2/PB5, CH3/PB0, CH4/PB1) */
  3594. #define AFIO_PCFR1_TIM3_REMAP_FULLREMAP ((uint32_t)0x00000C00) /* Full remap (CH1/PC6, CH2/PC7, CH3/PC8, CH4/PC9) */
  3595. #define AFIO_PCFR1_TIM4_REMAP ((uint32_t)0x00001000) /* TIM4_REMAP bit (TIM4 remapping) */
  3596. #define AFIO_PCFR1_CAN_REMAP ((uint32_t)0x00006000) /* CAN_REMAP[1:0] bits (CAN Alternate function remapping) */
  3597. #define AFIO_PCFR1_CAN_REMAP_0 ((uint32_t)0x00002000) /* Bit 0 */
  3598. #define AFIO_PCFR1_CAN_REMAP_1 ((uint32_t)0x00004000) /* Bit 1 */
  3599. #define AFIO_PCFR1_CAN_REMAP_REMAP1 ((uint32_t)0x00000000) /* CANRX mapped to PA11, CANTX mapped to PA12 */
  3600. #define AFIO_PCFR1_CAN_REMAP_REMAP2 ((uint32_t)0x00004000) /* CANRX mapped to PB8, CANTX mapped to PB9 */
  3601. #define AFIO_PCFR1_CAN_REMAP_REMAP3 ((uint32_t)0x00006000) /* CANRX mapped to PD0, CANTX mapped to PD1 */
  3602. #define AFIO_PCFR1_PD01_REMAP ((uint32_t)0x00008000) /* Port D0/Port D1 mapping on OSC_IN/OSC_OUT */
  3603. #define AFIO_PCFR1_TIM5CH4_IREMAP ((uint32_t)0x00010000) /* TIM5 Channel4 Internal Remap */
  3604. #define AFIO_PCFR1_ADC1_ETRGINJ_REMAP ((uint32_t)0x00020000) /* ADC 1 External Trigger Injected Conversion remapping */
  3605. #define AFIO_PCFR1_ADC1_ETRGREG_REMAP ((uint32_t)0x00040000) /* ADC 1 External Trigger Regular Conversion remapping */
  3606. #define AFIO_PCFR1_ADC2_ETRGINJ_REMAP ((uint32_t)0x00080000) /* ADC 2 External Trigger Injected Conversion remapping */
  3607. #define AFIO_PCFR1_ADC2_ETRGREG_REMAP ((uint32_t)0x00100000) /* ADC 2 External Trigger Regular Conversion remapping */
  3608. #define AFIO_PCFR1_SWJ_CFG ((uint32_t)0x07000000) /* SWJ_CFG[2:0] bits (Serial Wire JTAG configuration) */
  3609. #define AFIO_PCFR1_SWJ_CFG_0 ((uint32_t)0x01000000) /* Bit 0 */
  3610. #define AFIO_PCFR1_SWJ_CFG_1 ((uint32_t)0x02000000) /* Bit 1 */
  3611. #define AFIO_PCFR1_SWJ_CFG_2 ((uint32_t)0x04000000) /* Bit 2 */
  3612. #define AFIO_PCFR1_SWJ_CFG_RESET ((uint32_t)0x00000000) /* Full SWJ (JTAG-DP + SW-DP) : Reset State */
  3613. #define AFIO_PCFR1_SWJ_CFG_NOJNTRST ((uint32_t)0x01000000) /* Full SWJ (JTAG-DP + SW-DP) but without JNTRST */
  3614. #define AFIO_PCFR1_SWJ_CFG_JTAGDISABLE ((uint32_t)0x02000000) /* JTAG-DP Disabled and SW-DP Enabled */
  3615. #define AFIO_PCFR1_SWJ_CFG_DISABLE ((uint32_t)0x04000000) /* JTAG-DP Disabled and SW-DP Disabled */
  3616. /***************** Bit definition for AFIO_EXTICR1 register *****************/
  3617. #define AFIO_EXTICR1_EXTI0 ((uint16_t)0x000F) /* EXTI 0 configuration */
  3618. #define AFIO_EXTICR1_EXTI1 ((uint16_t)0x00F0) /* EXTI 1 configuration */
  3619. #define AFIO_EXTICR1_EXTI2 ((uint16_t)0x0F00) /* EXTI 2 configuration */
  3620. #define AFIO_EXTICR1_EXTI3 ((uint16_t)0xF000) /* EXTI 3 configuration */
  3621. #define AFIO_EXTICR1_EXTI0_PA ((uint16_t)0x0000) /* PA[0] pin */
  3622. #define AFIO_EXTICR1_EXTI0_PB ((uint16_t)0x0001) /* PB[0] pin */
  3623. #define AFIO_EXTICR1_EXTI0_PC ((uint16_t)0x0002) /* PC[0] pin */
  3624. #define AFIO_EXTICR1_EXTI0_PD ((uint16_t)0x0003) /* PD[0] pin */
  3625. #define AFIO_EXTICR1_EXTI0_PE ((uint16_t)0x0004) /* PE[0] pin */
  3626. #define AFIO_EXTICR1_EXTI0_PF ((uint16_t)0x0005) /* PF[0] pin */
  3627. #define AFIO_EXTICR1_EXTI0_PG ((uint16_t)0x0006) /* PG[0] pin */
  3628. #define AFIO_EXTICR1_EXTI1_PA ((uint16_t)0x0000) /* PA[1] pin */
  3629. #define AFIO_EXTICR1_EXTI1_PB ((uint16_t)0x0010) /* PB[1] pin */
  3630. #define AFIO_EXTICR1_EXTI1_PC ((uint16_t)0x0020) /* PC[1] pin */
  3631. #define AFIO_EXTICR1_EXTI1_PD ((uint16_t)0x0030) /* PD[1] pin */
  3632. #define AFIO_EXTICR1_EXTI1_PE ((uint16_t)0x0040) /* PE[1] pin */
  3633. #define AFIO_EXTICR1_EXTI1_PF ((uint16_t)0x0050) /* PF[1] pin */
  3634. #define AFIO_EXTICR1_EXTI1_PG ((uint16_t)0x0060) /* PG[1] pin */
  3635. #define AFIO_EXTICR1_EXTI2_PA ((uint16_t)0x0000) /* PA[2] pin */
  3636. #define AFIO_EXTICR1_EXTI2_PB ((uint16_t)0x0100) /* PB[2] pin */
  3637. #define AFIO_EXTICR1_EXTI2_PC ((uint16_t)0x0200) /* PC[2] pin */
  3638. #define AFIO_EXTICR1_EXTI2_PD ((uint16_t)0x0300) /* PD[2] pin */
  3639. #define AFIO_EXTICR1_EXTI2_PE ((uint16_t)0x0400) /* PE[2] pin */
  3640. #define AFIO_EXTICR1_EXTI2_PF ((uint16_t)0x0500) /* PF[2] pin */
  3641. #define AFIO_EXTICR1_EXTI2_PG ((uint16_t)0x0600) /* PG[2] pin */
  3642. #define AFIO_EXTICR1_EXTI3_PA ((uint16_t)0x0000) /* PA[3] pin */
  3643. #define AFIO_EXTICR1_EXTI3_PB ((uint16_t)0x1000) /* PB[3] pin */
  3644. #define AFIO_EXTICR1_EXTI3_PC ((uint16_t)0x2000) /* PC[3] pin */
  3645. #define AFIO_EXTICR1_EXTI3_PD ((uint16_t)0x3000) /* PD[3] pin */
  3646. #define AFIO_EXTICR1_EXTI3_PE ((uint16_t)0x4000) /* PE[3] pin */
  3647. #define AFIO_EXTICR1_EXTI3_PF ((uint16_t)0x5000) /* PF[3] pin */
  3648. #define AFIO_EXTICR1_EXTI3_PG ((uint16_t)0x6000) /* PG[3] pin */
  3649. /***************** Bit definition for AFIO_EXTICR2 register *****************/
  3650. #define AFIO_EXTICR2_EXTI4 ((uint16_t)0x000F) /* EXTI 4 configuration */
  3651. #define AFIO_EXTICR2_EXTI5 ((uint16_t)0x00F0) /* EXTI 5 configuration */
  3652. #define AFIO_EXTICR2_EXTI6 ((uint16_t)0x0F00) /* EXTI 6 configuration */
  3653. #define AFIO_EXTICR2_EXTI7 ((uint16_t)0xF000) /* EXTI 7 configuration */
  3654. #define AFIO_EXTICR2_EXTI4_PA ((uint16_t)0x0000) /* PA[4] pin */
  3655. #define AFIO_EXTICR2_EXTI4_PB ((uint16_t)0x0001) /* PB[4] pin */
  3656. #define AFIO_EXTICR2_EXTI4_PC ((uint16_t)0x0002) /* PC[4] pin */
  3657. #define AFIO_EXTICR2_EXTI4_PD ((uint16_t)0x0003) /* PD[4] pin */
  3658. #define AFIO_EXTICR2_EXTI4_PE ((uint16_t)0x0004) /* PE[4] pin */
  3659. #define AFIO_EXTICR2_EXTI4_PF ((uint16_t)0x0005) /* PF[4] pin */
  3660. #define AFIO_EXTICR2_EXTI4_PG ((uint16_t)0x0006) /* PG[4] pin */
  3661. #define AFIO_EXTICR2_EXTI5_PA ((uint16_t)0x0000) /* PA[5] pin */
  3662. #define AFIO_EXTICR2_EXTI5_PB ((uint16_t)0x0010) /* PB[5] pin */
  3663. #define AFIO_EXTICR2_EXTI5_PC ((uint16_t)0x0020) /* PC[5] pin */
  3664. #define AFIO_EXTICR2_EXTI5_PD ((uint16_t)0x0030) /* PD[5] pin */
  3665. #define AFIO_EXTICR2_EXTI5_PE ((uint16_t)0x0040) /* PE[5] pin */
  3666. #define AFIO_EXTICR2_EXTI5_PF ((uint16_t)0x0050) /* PF[5] pin */
  3667. #define AFIO_EXTICR2_EXTI5_PG ((uint16_t)0x0060) /* PG[5] pin */
  3668. #define AFIO_EXTICR2_EXTI6_PA ((uint16_t)0x0000) /* PA[6] pin */
  3669. #define AFIO_EXTICR2_EXTI6_PB ((uint16_t)0x0100) /* PB[6] pin */
  3670. #define AFIO_EXTICR2_EXTI6_PC ((uint16_t)0x0200) /* PC[6] pin */
  3671. #define AFIO_EXTICR2_EXTI6_PD ((uint16_t)0x0300) /* PD[6] pin */
  3672. #define AFIO_EXTICR2_EXTI6_PE ((uint16_t)0x0400) /* PE[6] pin */
  3673. #define AFIO_EXTICR2_EXTI6_PF ((uint16_t)0x0500) /* PF[6] pin */
  3674. #define AFIO_EXTICR2_EXTI6_PG ((uint16_t)0x0600) /* PG[6] pin */
  3675. #define AFIO_EXTICR2_EXTI7_PA ((uint16_t)0x0000) /* PA[7] pin */
  3676. #define AFIO_EXTICR2_EXTI7_PB ((uint16_t)0x1000) /* PB[7] pin */
  3677. #define AFIO_EXTICR2_EXTI7_PC ((uint16_t)0x2000) /* PC[7] pin */
  3678. #define AFIO_EXTICR2_EXTI7_PD ((uint16_t)0x3000) /* PD[7] pin */
  3679. #define AFIO_EXTICR2_EXTI7_PE ((uint16_t)0x4000) /* PE[7] pin */
  3680. #define AFIO_EXTICR2_EXTI7_PF ((uint16_t)0x5000) /* PF[7] pin */
  3681. #define AFIO_EXTICR2_EXTI7_PG ((uint16_t)0x6000) /* PG[7] pin */
  3682. /***************** Bit definition for AFIO_EXTICR3 register *****************/
  3683. #define AFIO_EXTICR3_EXTI8 ((uint16_t)0x000F) /* EXTI 8 configuration */
  3684. #define AFIO_EXTICR3_EXTI9 ((uint16_t)0x00F0) /* EXTI 9 configuration */
  3685. #define AFIO_EXTICR3_EXTI10 ((uint16_t)0x0F00) /* EXTI 10 configuration */
  3686. #define AFIO_EXTICR3_EXTI11 ((uint16_t)0xF000) /* EXTI 11 configuration */
  3687. #define AFIO_EXTICR3_EXTI8_PA ((uint16_t)0x0000) /* PA[8] pin */
  3688. #define AFIO_EXTICR3_EXTI8_PB ((uint16_t)0x0001) /* PB[8] pin */
  3689. #define AFIO_EXTICR3_EXTI8_PC ((uint16_t)0x0002) /* PC[8] pin */
  3690. #define AFIO_EXTICR3_EXTI8_PD ((uint16_t)0x0003) /* PD[8] pin */
  3691. #define AFIO_EXTICR3_EXTI8_PE ((uint16_t)0x0004) /* PE[8] pin */
  3692. #define AFIO_EXTICR3_EXTI8_PF ((uint16_t)0x0005) /* PF[8] pin */
  3693. #define AFIO_EXTICR3_EXTI8_PG ((uint16_t)0x0006) /* PG[8] pin */
  3694. #define AFIO_EXTICR3_EXTI9_PA ((uint16_t)0x0000) /* PA[9] pin */
  3695. #define AFIO_EXTICR3_EXTI9_PB ((uint16_t)0x0010) /* PB[9] pin */
  3696. #define AFIO_EXTICR3_EXTI9_PC ((uint16_t)0x0020) /* PC[9] pin */
  3697. #define AFIO_EXTICR3_EXTI9_PD ((uint16_t)0x0030) /* PD[9] pin */
  3698. #define AFIO_EXTICR3_EXTI9_PE ((uint16_t)0x0040) /* PE[9] pin */
  3699. #define AFIO_EXTICR3_EXTI9_PF ((uint16_t)0x0050) /* PF[9] pin */
  3700. #define AFIO_EXTICR3_EXTI9_PG ((uint16_t)0x0060) /* PG[9] pin */
  3701. #define AFIO_EXTICR3_EXTI10_PA ((uint16_t)0x0000) /* PA[10] pin */
  3702. #define AFIO_EXTICR3_EXTI10_PB ((uint16_t)0x0100) /* PB[10] pin */
  3703. #define AFIO_EXTICR3_EXTI10_PC ((uint16_t)0x0200) /* PC[10] pin */
  3704. #define AFIO_EXTICR3_EXTI10_PD ((uint16_t)0x0300) /* PD[10] pin */
  3705. #define AFIO_EXTICR3_EXTI10_PE ((uint16_t)0x0400) /* PE[10] pin */
  3706. #define AFIO_EXTICR3_EXTI10_PF ((uint16_t)0x0500) /* PF[10] pin */
  3707. #define AFIO_EXTICR3_EXTI10_PG ((uint16_t)0x0600) /* PG[10] pin */
  3708. #define AFIO_EXTICR3_EXTI11_PA ((uint16_t)0x0000) /* PA[11] pin */
  3709. #define AFIO_EXTICR3_EXTI11_PB ((uint16_t)0x1000) /* PB[11] pin */
  3710. #define AFIO_EXTICR3_EXTI11_PC ((uint16_t)0x2000) /* PC[11] pin */
  3711. #define AFIO_EXTICR3_EXTI11_PD ((uint16_t)0x3000) /* PD[11] pin */
  3712. #define AFIO_EXTICR3_EXTI11_PE ((uint16_t)0x4000) /* PE[11] pin */
  3713. #define AFIO_EXTICR3_EXTI11_PF ((uint16_t)0x5000) /* PF[11] pin */
  3714. #define AFIO_EXTICR3_EXTI11_PG ((uint16_t)0x6000) /* PG[11] pin */
  3715. /***************** Bit definition for AFIO_EXTICR4 register *****************/
  3716. #define AFIO_EXTICR4_EXTI12 ((uint16_t)0x000F) /* EXTI 12 configuration */
  3717. #define AFIO_EXTICR4_EXTI13 ((uint16_t)0x00F0) /* EXTI 13 configuration */
  3718. #define AFIO_EXTICR4_EXTI14 ((uint16_t)0x0F00) /* EXTI 14 configuration */
  3719. #define AFIO_EXTICR4_EXTI15 ((uint16_t)0xF000) /* EXTI 15 configuration */
  3720. #define AFIO_EXTICR4_EXTI12_PA ((uint16_t)0x0000) /* PA[12] pin */
  3721. #define AFIO_EXTICR4_EXTI12_PB ((uint16_t)0x0001) /* PB[12] pin */
  3722. #define AFIO_EXTICR4_EXTI12_PC ((uint16_t)0x0002) /* PC[12] pin */
  3723. #define AFIO_EXTICR4_EXTI12_PD ((uint16_t)0x0003) /* PD[12] pin */
  3724. #define AFIO_EXTICR4_EXTI12_PE ((uint16_t)0x0004) /* PE[12] pin */
  3725. #define AFIO_EXTICR4_EXTI12_PF ((uint16_t)0x0005) /* PF[12] pin */
  3726. #define AFIO_EXTICR4_EXTI12_PG ((uint16_t)0x0006) /* PG[12] pin */
  3727. #define AFIO_EXTICR4_EXTI13_PA ((uint16_t)0x0000) /* PA[13] pin */
  3728. #define AFIO_EXTICR4_EXTI13_PB ((uint16_t)0x0010) /* PB[13] pin */
  3729. #define AFIO_EXTICR4_EXTI13_PC ((uint16_t)0x0020) /* PC[13] pin */
  3730. #define AFIO_EXTICR4_EXTI13_PD ((uint16_t)0x0030) /* PD[13] pin */
  3731. #define AFIO_EXTICR4_EXTI13_PE ((uint16_t)0x0040) /* PE[13] pin */
  3732. #define AFIO_EXTICR4_EXTI13_PF ((uint16_t)0x0050) /* PF[13] pin */
  3733. #define AFIO_EXTICR4_EXTI13_PG ((uint16_t)0x0060) /* PG[13] pin */
  3734. #define AFIO_EXTICR4_EXTI14_PA ((uint16_t)0x0000) /* PA[14] pin */
  3735. #define AFIO_EXTICR4_EXTI14_PB ((uint16_t)0x0100) /* PB[14] pin */
  3736. #define AFIO_EXTICR4_EXTI14_PC ((uint16_t)0x0200) /* PC[14] pin */
  3737. #define AFIO_EXTICR4_EXTI14_PD ((uint16_t)0x0300) /* PD[14] pin */
  3738. #define AFIO_EXTICR4_EXTI14_PE ((uint16_t)0x0400) /* PE[14] pin */
  3739. #define AFIO_EXTICR4_EXTI14_PF ((uint16_t)0x0500) /* PF[14] pin */
  3740. #define AFIO_EXTICR4_EXTI14_PG ((uint16_t)0x0600) /* PG[14] pin */
  3741. #define AFIO_EXTICR4_EXTI15_PA ((uint16_t)0x0000) /* PA[15] pin */
  3742. #define AFIO_EXTICR4_EXTI15_PB ((uint16_t)0x1000) /* PB[15] pin */
  3743. #define AFIO_EXTICR4_EXTI15_PC ((uint16_t)0x2000) /* PC[15] pin */
  3744. #define AFIO_EXTICR4_EXTI15_PD ((uint16_t)0x3000) /* PD[15] pin */
  3745. #define AFIO_EXTICR4_EXTI15_PE ((uint16_t)0x4000) /* PE[15] pin */
  3746. #define AFIO_EXTICR4_EXTI15_PF ((uint16_t)0x5000) /* PF[15] pin */
  3747. #define AFIO_EXTICR4_EXTI15_PG ((uint16_t)0x6000) /* PG[15] pin */
  3748. /******************************************************************************/
  3749. /* Independent WATCHDOG */
  3750. /******************************************************************************/
  3751. /******************* Bit definition for IWDG_CTLR register ********************/
  3752. #define IWDG_KEY ((uint16_t)0xFFFF) /* Key value (write only, read 0000h) */
  3753. /******************* Bit definition for IWDG_PSCR register ********************/
  3754. #define IWDG_PR ((uint8_t)0x07) /* PR[2:0] (Prescaler divider) */
  3755. #define IWDG_PR_0 ((uint8_t)0x01) /* Bit 0 */
  3756. #define IWDG_PR_1 ((uint8_t)0x02) /* Bit 1 */
  3757. #define IWDG_PR_2 ((uint8_t)0x04) /* Bit 2 */
  3758. /******************* Bit definition for IWDG_RLDR register *******************/
  3759. #define IWDG_RL ((uint16_t)0x0FFF) /* Watchdog counter reload value */
  3760. /******************* Bit definition for IWDG_STATR register ********************/
  3761. #define IWDG_PVU ((uint8_t)0x01) /* Watchdog prescaler value update */
  3762. #define IWDG_RVU ((uint8_t)0x02) /* Watchdog counter reload value update */
  3763. /******************************************************************************/
  3764. /* Inter-integrated Circuit Interface */
  3765. /******************************************************************************/
  3766. /******************* Bit definition for I2C_CTLR1 register ********************/
  3767. #define I2C_CTLR1_PE ((uint16_t)0x0001) /* Peripheral Enable */
  3768. #define I2C_CTLR1_SMBUS ((uint16_t)0x0002) /* SMBus Mode */
  3769. #define I2C_CTLR1_SMBTYPE ((uint16_t)0x0008) /* SMBus Type */
  3770. #define I2C_CTLR1_ENARP ((uint16_t)0x0010) /* ARP Enable */
  3771. #define I2C_CTLR1_ENPEC ((uint16_t)0x0020) /* PEC Enable */
  3772. #define I2C_CTLR1_ENGC ((uint16_t)0x0040) /* General Call Enable */
  3773. #define I2C_CTLR1_NOSTRETCH ((uint16_t)0x0080) /* Clock Stretching Disable (Slave mode) */
  3774. #define I2C_CTLR1_START ((uint16_t)0x0100) /* Start Generation */
  3775. #define I2C_CTLR1_STOP ((uint16_t)0x0200) /* Stop Generation */
  3776. #define I2C_CTLR1_ACK ((uint16_t)0x0400) /* Acknowledge Enable */
  3777. #define I2C_CTLR1_POS ((uint16_t)0x0800) /* Acknowledge/PEC Position (for data reception) */
  3778. #define I2C_CTLR1_PEC ((uint16_t)0x1000) /* Packet Error Checking */
  3779. #define I2C_CTLR1_ALERT ((uint16_t)0x2000) /* SMBus Alert */
  3780. #define I2C_CTLR1_SWRST ((uint16_t)0x8000) /* Software Reset */
  3781. /******************* Bit definition for I2C_CTLR2 register ********************/
  3782. #define I2C_CTLR2_FREQ ((uint16_t)0x003F) /* FREQ[5:0] bits (Peripheral Clock Frequency) */
  3783. #define I2C_CTLR2_FREQ_0 ((uint16_t)0x0001) /* Bit 0 */
  3784. #define I2C_CTLR2_FREQ_1 ((uint16_t)0x0002) /* Bit 1 */
  3785. #define I2C_CTLR2_FREQ_2 ((uint16_t)0x0004) /* Bit 2 */
  3786. #define I2C_CTLR2_FREQ_3 ((uint16_t)0x0008) /* Bit 3 */
  3787. #define I2C_CTLR2_FREQ_4 ((uint16_t)0x0010) /* Bit 4 */
  3788. #define I2C_CTLR2_FREQ_5 ((uint16_t)0x0020) /* Bit 5 */
  3789. #define I2C_CTLR2_ITERREN ((uint16_t)0x0100) /* Error Interrupt Enable */
  3790. #define I2C_CTLR2_ITEVTEN ((uint16_t)0x0200) /* Event Interrupt Enable */
  3791. #define I2C_CTLR2_ITBUFEN ((uint16_t)0x0400) /* Buffer Interrupt Enable */
  3792. #define I2C_CTLR2_DMAEN ((uint16_t)0x0800) /* DMA Requests Enable */
  3793. #define I2C_CTLR2_LAST ((uint16_t)0x1000) /* DMA Last Transfer */
  3794. /******************* Bit definition for I2C_OADDR1 register *******************/
  3795. #define I2C_OADDR1_ADD1_7 ((uint16_t)0x00FE) /* Interface Address */
  3796. #define I2C_OADDR1_ADD8_9 ((uint16_t)0x0300) /* Interface Address */
  3797. #define I2C_OADDR1_ADD0 ((uint16_t)0x0001) /* Bit 0 */
  3798. #define I2C_OADDR1_ADD1 ((uint16_t)0x0002) /* Bit 1 */
  3799. #define I2C_OADDR1_ADD2 ((uint16_t)0x0004) /* Bit 2 */
  3800. #define I2C_OADDR1_ADD3 ((uint16_t)0x0008) /* Bit 3 */
  3801. #define I2C_OADDR1_ADD4 ((uint16_t)0x0010) /* Bit 4 */
  3802. #define I2C_OADDR1_ADD5 ((uint16_t)0x0020) /* Bit 5 */
  3803. #define I2C_OADDR1_ADD6 ((uint16_t)0x0040) /* Bit 6 */
  3804. #define I2C_OADDR1_ADD7 ((uint16_t)0x0080) /* Bit 7 */
  3805. #define I2C_OADDR1_ADD8 ((uint16_t)0x0100) /* Bit 8 */
  3806. #define I2C_OADDR1_ADD9 ((uint16_t)0x0200) /* Bit 9 */
  3807. #define I2C_OADDR1_ADDMODE ((uint16_t)0x8000) /* Addressing Mode (Slave mode) */
  3808. /******************* Bit definition for I2C_OADDR2 register *******************/
  3809. #define I2C_OADDR2_ENDUAL ((uint8_t)0x01) /* Dual addressing mode enable */
  3810. #define I2C_OADDR2_ADD2 ((uint8_t)0xFE) /* Interface address */
  3811. /******************** Bit definition for I2C_DATAR register ********************/
  3812. #define I2C_DR_DATAR ((uint8_t)0xFF) /* 8-bit Data Register */
  3813. /******************* Bit definition for I2C_STAR1 register ********************/
  3814. #define I2C_STAR1_SB ((uint16_t)0x0001) /* Start Bit (Master mode) */
  3815. #define I2C_STAR1_ADDR ((uint16_t)0x0002) /* Address sent (master mode)/matched (slave mode) */
  3816. #define I2C_STAR1_BTF ((uint16_t)0x0004) /* Byte Transfer Finished */
  3817. #define I2C_STAR1_ADD10 ((uint16_t)0x0008) /* 10-bit header sent (Master mode) */
  3818. #define I2C_STAR1_STOPF ((uint16_t)0x0010) /* Stop detection (Slave mode) */
  3819. #define I2C_STAR1_RXNE ((uint16_t)0x0040) /* Data Register not Empty (receivers) */
  3820. #define I2C_STAR1_TXE ((uint16_t)0x0080) /* Data Register Empty (transmitters) */
  3821. #define I2C_STAR1_BERR ((uint16_t)0x0100) /* Bus Error */
  3822. #define I2C_STAR1_ARLO ((uint16_t)0x0200) /* Arbitration Lost (master mode) */
  3823. #define I2C_STAR1_AF ((uint16_t)0x0400) /* Acknowledge Failure */
  3824. #define I2C_STAR1_OVR ((uint16_t)0x0800) /* Overrun/Underrun */
  3825. #define I2C_STAR1_PECERR ((uint16_t)0x1000) /* PEC Error in reception */
  3826. #define I2C_STAR1_TIMEOUT ((uint16_t)0x4000) /* Timeout or Tlow Error */
  3827. #define I2C_STAR1_SMBALERT ((uint16_t)0x8000) /* SMBus Alert */
  3828. /******************* Bit definition for I2C_STAR2 register ********************/
  3829. #define I2C_STAR2_MSL ((uint16_t)0x0001) /* Master/Slave */
  3830. #define I2C_STAR2_BUSY ((uint16_t)0x0002) /* Bus Busy */
  3831. #define I2C_STAR2_TRA ((uint16_t)0x0004) /* Transmitter/Receiver */
  3832. #define I2C_STAR2_GENCALL ((uint16_t)0x0010) /* General Call Address (Slave mode) */
  3833. #define I2C_STAR2_SMBDEFAULT ((uint16_t)0x0020) /* SMBus Device Default Address (Slave mode) */
  3834. #define I2C_STAR2_SMBHOST ((uint16_t)0x0040) /* SMBus Host Header (Slave mode) */
  3835. #define I2C_STAR2_DUALF ((uint16_t)0x0080) /* Dual Flag (Slave mode) */
  3836. #define I2C_STAR2_PEC ((uint16_t)0xFF00) /* Packet Error Checking Register */
  3837. /******************* Bit definition for I2C_CKCFGR register ********************/
  3838. #define I2C_CKCFGR_CCR ((uint16_t)0x0FFF) /* Clock Control Register in Fast/Standard mode (Master mode) */
  3839. #define I2C_CKCFGR_DUTY ((uint16_t)0x4000) /* Fast Mode Duty Cycle */
  3840. #define I2C_CKCFGR_FS ((uint16_t)0x8000) /* I2C Master Mode Selection */
  3841. /****************** Bit definition for I2C_RTR register *******************/
  3842. #define I2C_RTR_TRISE ((uint8_t)0x3F) /* Maximum Rise Time in Fast/Standard mode (Master mode) */
  3843. /******************************************************************************/
  3844. /* Power Control */
  3845. /******************************************************************************/
  3846. /******************** Bit definition for PWR_CTLR register ********************/
  3847. #define PWR_CTLR_LPDS ((uint16_t)0x0001) /* Low-Power Deepsleep */
  3848. #define PWR_CTLR_PDDS ((uint16_t)0x0002) /* Power Down Deepsleep */
  3849. #define PWR_CTLR_CWUF ((uint16_t)0x0004) /* Clear Wakeup Flag */
  3850. #define PWR_CTLR_CSBF ((uint16_t)0x0008) /* Clear Standby Flag */
  3851. #define PWR_CTLR_PVDE ((uint16_t)0x0010) /* Power Voltage Detector Enable */
  3852. #define PWR_CTLR_PLS ((uint16_t)0x00E0) /* PLS[2:0] bits (PVD Level Selection) */
  3853. #define PWR_CTLR_PLS_0 ((uint16_t)0x0020) /* Bit 0 */
  3854. #define PWR_CTLR_PLS_1 ((uint16_t)0x0040) /* Bit 1 */
  3855. #define PWR_CTLR_PLS_2 ((uint16_t)0x0080) /* Bit 2 */
  3856. #define PWR_CTLR_PLS_2V2 ((uint16_t)0x0000) /* PVD level 2.2V */
  3857. #define PWR_CTLR_PLS_2V3 ((uint16_t)0x0020) /* PVD level 2.3V */
  3858. #define PWR_CTLR_PLS_2V4 ((uint16_t)0x0040) /* PVD level 2.4V */
  3859. #define PWR_CTLR_PLS_2V5 ((uint16_t)0x0060) /* PVD level 2.5V */
  3860. #define PWR_CTLR_PLS_2V6 ((uint16_t)0x0080) /* PVD level 2.6V */
  3861. #define PWR_CTLR_PLS_2V7 ((uint16_t)0x00A0) /* PVD level 2.7V */
  3862. #define PWR_CTLR_PLS_2V8 ((uint16_t)0x00C0) /* PVD level 2.8V */
  3863. #define PWR_CTLR_PLS_2V9 ((uint16_t)0x00E0) /* PVD level 2.9V */
  3864. #define PWR_CTLR_DBP ((uint16_t)0x0100) /* Disable Backup Domain write protection */
  3865. /******************* Bit definition for PWR_CSR register ********************/
  3866. #define PWR_CSR_WUF ((uint16_t)0x0001) /* Wakeup Flag */
  3867. #define PWR_CSR_SBF ((uint16_t)0x0002) /* Standby Flag */
  3868. #define PWR_CSR_PVDO ((uint16_t)0x0004) /* PVD Output */
  3869. #define PWR_CSR_EWUP ((uint16_t)0x0100) /* Enable WKUP pin */
  3870. /******************************************************************************/
  3871. /* Reset and Clock Control */
  3872. /******************************************************************************/
  3873. /******************** Bit definition for RCC_CTLR register ********************/
  3874. #define RCC_HSION ((uint32_t)0x00000001) /* Internal High Speed clock enable */
  3875. #define RCC_HSIRDY ((uint32_t)0x00000002) /* Internal High Speed clock ready flag */
  3876. #define RCC_HSITRIM ((uint32_t)0x000000F8) /* Internal High Speed clock trimming */
  3877. #define RCC_HSICAL ((uint32_t)0x0000FF00) /* Internal High Speed clock Calibration */
  3878. #define RCC_HSEON ((uint32_t)0x00010000) /* External High Speed clock enable */
  3879. #define RCC_HSERDY ((uint32_t)0x00020000) /* External High Speed clock ready flag */
  3880. #define RCC_HSEBYP ((uint32_t)0x00040000) /* External High Speed clock Bypass */
  3881. #define RCC_CSSON ((uint32_t)0x00080000) /* Clock Security System enable */
  3882. #define RCC_PLLON ((uint32_t)0x01000000) /* PLL enable */
  3883. #define RCC_PLLRDY ((uint32_t)0x02000000) /* PLL clock ready flag */
  3884. /******************* Bit definition for RCC_CFGR0 register *******************/
  3885. #define RCC_SW ((uint32_t)0x00000003) /* SW[1:0] bits (System clock Switch) */
  3886. #define RCC_SW_0 ((uint32_t)0x00000001) /* Bit 0 */
  3887. #define RCC_SW_1 ((uint32_t)0x00000002) /* Bit 1 */
  3888. #define RCC_SW_HSI ((uint32_t)0x00000000) /* HSI selected as system clock */
  3889. #define RCC_SW_HSE ((uint32_t)0x00000001) /* HSE selected as system clock */
  3890. #define RCC_SW_PLL ((uint32_t)0x00000002) /* PLL selected as system clock */
  3891. #define RCC_SWS ((uint32_t)0x0000000C) /* SWS[1:0] bits (System Clock Switch Status) */
  3892. #define RCC_SWS_0 ((uint32_t)0x00000004) /* Bit 0 */
  3893. #define RCC_SWS_1 ((uint32_t)0x00000008) /* Bit 1 */
  3894. #define RCC_SWS_HSI ((uint32_t)0x00000000) /* HSI oscillator used as system clock */
  3895. #define RCC_SWS_HSE ((uint32_t)0x00000004) /* HSE oscillator used as system clock */
  3896. #define RCC_SWS_PLL ((uint32_t)0x00000008) /* PLL used as system clock */
  3897. #define RCC_HPRE ((uint32_t)0x000000F0) /* HPRE[3:0] bits (AHB prescaler) */
  3898. #define RCC_HPRE_0 ((uint32_t)0x00000010) /* Bit 0 */
  3899. #define RCC_HPRE_1 ((uint32_t)0x00000020) /* Bit 1 */
  3900. #define RCC_HPRE_2 ((uint32_t)0x00000040) /* Bit 2 */
  3901. #define RCC_HPRE_3 ((uint32_t)0x00000080) /* Bit 3 */
  3902. #define RCC_HPRE_DIV1 ((uint32_t)0x00000000) /* SYSCLK not divided */
  3903. #define RCC_HPRE_DIV2 ((uint32_t)0x00000080) /* SYSCLK divided by 2 */
  3904. #define RCC_HPRE_DIV4 ((uint32_t)0x00000090) /* SYSCLK divided by 4 */
  3905. #define RCC_HPRE_DIV8 ((uint32_t)0x000000A0) /* SYSCLK divided by 8 */
  3906. #define RCC_HPRE_DIV16 ((uint32_t)0x000000B0) /* SYSCLK divided by 16 */
  3907. #define RCC_HPRE_DIV64 ((uint32_t)0x000000C0) /* SYSCLK divided by 64 */
  3908. #define RCC_HPRE_DIV128 ((uint32_t)0x000000D0) /* SYSCLK divided by 128 */
  3909. #define RCC_HPRE_DIV256 ((uint32_t)0x000000E0) /* SYSCLK divided by 256 */
  3910. #define RCC_HPRE_DIV512 ((uint32_t)0x000000F0) /* SYSCLK divided by 512 */
  3911. #define RCC_PPRE1 ((uint32_t)0x00000700) /* PRE1[2:0] bits (APB1 prescaler) */
  3912. #define RCC_PPRE1_0 ((uint32_t)0x00000100) /* Bit 0 */
  3913. #define RCC_PPRE1_1 ((uint32_t)0x00000200) /* Bit 1 */
  3914. #define RCC_PPRE1_2 ((uint32_t)0x00000400) /* Bit 2 */
  3915. #define RCC_PPRE1_DIV1 ((uint32_t)0x00000000) /* HCLK not divided */
  3916. #define RCC_PPRE1_DIV2 ((uint32_t)0x00000400) /* HCLK divided by 2 */
  3917. #define RCC_PPRE1_DIV4 ((uint32_t)0x00000500) /* HCLK divided by 4 */
  3918. #define RCC_PPRE1_DIV8 ((uint32_t)0x00000600) /* HCLK divided by 8 */
  3919. #define RCC_PPRE1_DIV16 ((uint32_t)0x00000700) /* HCLK divided by 16 */
  3920. #define RCC_PPRE2 ((uint32_t)0x00003800) /* PRE2[2:0] bits (APB2 prescaler) */
  3921. #define RCC_PPRE2_0 ((uint32_t)0x00000800) /* Bit 0 */
  3922. #define RCC_PPRE2_1 ((uint32_t)0x00001000) /* Bit 1 */
  3923. #define RCC_PPRE2_2 ((uint32_t)0x00002000) /* Bit 2 */
  3924. #define RCC_PPRE2_DIV1 ((uint32_t)0x00000000) /* HCLK not divided */
  3925. #define RCC_PPRE2_DIV2 ((uint32_t)0x00002000) /* HCLK divided by 2 */
  3926. #define RCC_PPRE2_DIV4 ((uint32_t)0x00002800) /* HCLK divided by 4 */
  3927. #define RCC_PPRE2_DIV8 ((uint32_t)0x00003000) /* HCLK divided by 8 */
  3928. #define RCC_PPRE2_DIV16 ((uint32_t)0x00003800) /* HCLK divided by 16 */
  3929. #define RCC_ADCPRE ((uint32_t)0x0000C000) /* ADCPRE[1:0] bits (ADC prescaler) */
  3930. #define RCC_ADCPRE_0 ((uint32_t)0x00004000) /* Bit 0 */
  3931. #define RCC_ADCPRE_1 ((uint32_t)0x00008000) /* Bit 1 */
  3932. #define RCC_ADCPRE_DIV2 ((uint32_t)0x00000000) /* PCLK2 divided by 2 */
  3933. #define RCC_ADCPRE_DIV4 ((uint32_t)0x00004000) /* PCLK2 divided by 4 */
  3934. #define RCC_ADCPRE_DIV6 ((uint32_t)0x00008000) /* PCLK2 divided by 6 */
  3935. #define RCC_ADCPRE_DIV8 ((uint32_t)0x0000C000) /* PCLK2 divided by 8 */
  3936. #define RCC_PLLSRC ((uint32_t)0x00010000) /* PLL entry clock source */
  3937. #define RCC_PLLXTPRE ((uint32_t)0x00020000) /* HSE divider for PLL entry */
  3938. #define RCC_PLLMULL ((uint32_t)0x003C0000) /* PLLMUL[3:0] bits (PLL multiplication factor) */
  3939. #define RCC_PLLMULL_0 ((uint32_t)0x00040000) /* Bit 0 */
  3940. #define RCC_PLLMULL_1 ((uint32_t)0x00080000) /* Bit 1 */
  3941. #define RCC_PLLMULL_2 ((uint32_t)0x00100000) /* Bit 2 */
  3942. #define RCC_PLLMULL_3 ((uint32_t)0x00200000) /* Bit 3 */
  3943. #define RCC_PLLSRC_HSI_Div2 ((uint32_t)0x00000000) /* HSI clock divided by 2 selected as PLL entry clock source */
  3944. #define RCC_PLLSRC_HSE ((uint32_t)0x00010000) /* HSE clock selected as PLL entry clock source */
  3945. #define RCC_PLLXTPRE_HSE ((uint32_t)0x00000000) /* HSE clock not divided for PLL entry */
  3946. #define RCC_PLLXTPRE_HSE_Div2 ((uint32_t)0x00020000) /* HSE clock divided by 2 for PLL entry */
  3947. /* for other CH32V30x */
  3948. #define RCC_PLLMULL2 ((uint32_t)0x00000000) /* PLL input clock*2 */
  3949. #define RCC_PLLMULL3 ((uint32_t)0x00040000) /* PLL input clock*3 */
  3950. #define RCC_PLLMULL4 ((uint32_t)0x00080000) /* PLL input clock*4 */
  3951. #define RCC_PLLMULL5 ((uint32_t)0x000C0000) /* PLL input clock*5 */
  3952. #define RCC_PLLMULL6 ((uint32_t)0x00100000) /* PLL input clock*6 */
  3953. #define RCC_PLLMULL7 ((uint32_t)0x00140000) /* PLL input clock*7 */
  3954. #define RCC_PLLMULL8 ((uint32_t)0x00180000) /* PLL input clock*8 */
  3955. #define RCC_PLLMULL9 ((uint32_t)0x001C0000) /* PLL input clock*9 */
  3956. #define RCC_PLLMULL10 ((uint32_t)0x00200000) /* PLL input clock10 */
  3957. #define RCC_PLLMULL11 ((uint32_t)0x00240000) /* PLL input clock*11 */
  3958. #define RCC_PLLMULL12 ((uint32_t)0x00280000) /* PLL input clock*12 */
  3959. #define RCC_PLLMULL13 ((uint32_t)0x002C0000) /* PLL input clock*13 */
  3960. #define RCC_PLLMULL14 ((uint32_t)0x00300000) /* PLL input clock*14 */
  3961. #define RCC_PLLMULL15 ((uint32_t)0x00340000) /* PLL input clock*15 */
  3962. #define RCC_PLLMULL16 ((uint32_t)0x00380000) /* PLL input clock*16 */
  3963. #define RCC_PLLMULL18 ((uint32_t)0x003C0000) /* PLL input clock*18 */
  3964. /* for CH32V307 */
  3965. #define RCC_PLLMULL18_EXTEN ((uint32_t)0x00000000) /* PLL input clock*18 */
  3966. #define RCC_PLLMULL3_EXTEN ((uint32_t)0x00040000) /* PLL input clock*3 */
  3967. #define RCC_PLLMULL4_EXTEN ((uint32_t)0x00080000) /* PLL input clock*4 */
  3968. #define RCC_PLLMULL5_EXTEN ((uint32_t)0x000C0000) /* PLL input clock*5 */
  3969. #define RCC_PLLMULL6_EXTEN ((uint32_t)0x00100000) /* PLL input clock*6 */
  3970. #define RCC_PLLMULL7_EXTEN ((uint32_t)0x00140000) /* PLL input clock*7 */
  3971. #define RCC_PLLMULL8_EXTEN ((uint32_t)0x00180000) /* PLL input clock*8 */
  3972. #define RCC_PLLMULL9_EXTEN ((uint32_t)0x001C0000) /* PLL input clock*9 */
  3973. #define RCC_PLLMULL10_EXTEN ((uint32_t)0x00200000) /* PLL input clock10 */
  3974. #define RCC_PLLMULL11_EXTEN ((uint32_t)0x00240000) /* PLL input clock*11 */
  3975. #define RCC_PLLMULL12_EXTEN ((uint32_t)0x00280000) /* PLL input clock*12 */
  3976. #define RCC_PLLMULL13_EXTEN ((uint32_t)0x002C0000) /* PLL input clock*13 */
  3977. #define RCC_PLLMULL14_EXTEN ((uint32_t)0x00300000) /* PLL input clock*14 */
  3978. #define RCC_PLLMULL6_5_EXTEN ((uint32_t)0x00340000) /* PLL input clock*6.5 */
  3979. #define RCC_PLLMULL15_EXTEN ((uint32_t)0x00380000) /* PLL input clock*15 */
  3980. #define RCC_PLLMULL16_EXTEN ((uint32_t)0x003C0000) /* PLL input clock*16 */
  3981. #define RCC_USBPRE ((uint32_t)0x00400000) /* USB Device prescaler */
  3982. #define RCC_CFGR0_MCO ((uint32_t)0x07000000) /* MCO[2:0] bits (Microcontroller Clock Output) */
  3983. #define RCC_MCO_0 ((uint32_t)0x01000000) /* Bit 0 */
  3984. #define RCC_MCO_1 ((uint32_t)0x02000000) /* Bit 1 */
  3985. #define RCC_MCO_2 ((uint32_t)0x04000000) /* Bit 2 */
  3986. #define RCC_MCO_NOCLOCK ((uint32_t)0x00000000) /* No clock */
  3987. #define RCC_CFGR0_MCO_SYSCLK ((uint32_t)0x04000000) /* System clock selected as MCO source */
  3988. #define RCC_CFGR0_MCO_HSI ((uint32_t)0x05000000) /* HSI clock selected as MCO source */
  3989. #define RCC_CFGR0_MCO_HSE ((uint32_t)0x06000000) /* HSE clock selected as MCO source */
  3990. #define RCC_CFGR0_MCO_PLL ((uint32_t)0x07000000) /* PLL clock divided by 2 selected as MCO source */
  3991. /******************* Bit definition for RCC_INTR register ********************/
  3992. #define RCC_LSIRDYF ((uint32_t)0x00000001) /* LSI Ready Interrupt flag */
  3993. #define RCC_LSERDYF ((uint32_t)0x00000002) /* LSE Ready Interrupt flag */
  3994. #define RCC_HSIRDYF ((uint32_t)0x00000004) /* HSI Ready Interrupt flag */
  3995. #define RCC_HSERDYF ((uint32_t)0x00000008) /* HSE Ready Interrupt flag */
  3996. #define RCC_PLLRDYF ((uint32_t)0x00000010) /* PLL Ready Interrupt flag */
  3997. #define RCC_CSSF ((uint32_t)0x00000080) /* Clock Security System Interrupt flag */
  3998. #define RCC_LSIRDYIE ((uint32_t)0x00000100) /* LSI Ready Interrupt Enable */
  3999. #define RCC_LSERDYIE ((uint32_t)0x00000200) /* LSE Ready Interrupt Enable */
  4000. #define RCC_HSIRDYIE ((uint32_t)0x00000400) /* HSI Ready Interrupt Enable */
  4001. #define RCC_HSERDYIE ((uint32_t)0x00000800) /* HSE Ready Interrupt Enable */
  4002. #define RCC_PLLRDYIE ((uint32_t)0x00001000) /* PLL Ready Interrupt Enable */
  4003. #define RCC_LSIRDYC ((uint32_t)0x00010000) /* LSI Ready Interrupt Clear */
  4004. #define RCC_LSERDYC ((uint32_t)0x00020000) /* LSE Ready Interrupt Clear */
  4005. #define RCC_HSIRDYC ((uint32_t)0x00040000) /* HSI Ready Interrupt Clear */
  4006. #define RCC_HSERDYC ((uint32_t)0x00080000) /* HSE Ready Interrupt Clear */
  4007. #define RCC_PLLRDYC ((uint32_t)0x00100000) /* PLL Ready Interrupt Clear */
  4008. #define RCC_CSSC ((uint32_t)0x00800000) /* Clock Security System Interrupt Clear */
  4009. /***************** Bit definition for RCC_APB2PRSTR register *****************/
  4010. #define RCC_AFIORST ((uint32_t)0x00000001) /* Alternate Function I/O reset */
  4011. #define RCC_IOPARST ((uint32_t)0x00000004) /* I/O port A reset */
  4012. #define RCC_IOPBRST ((uint32_t)0x00000008) /* I/O port B reset */
  4013. #define RCC_IOPCRST ((uint32_t)0x00000010) /* I/O port C reset */
  4014. #define RCC_IOPDRST ((uint32_t)0x00000020) /* I/O port D reset */
  4015. #define RCC_ADC1RST ((uint32_t)0x00000200) /* ADC 1 interface reset */
  4016. #define RCC_ADC2RST ((uint32_t)0x00000400) /* ADC 2 interface reset */
  4017. #define RCC_TIM1RST ((uint32_t)0x00000800) /* TIM1 Timer reset */
  4018. #define RCC_SPI1RST ((uint32_t)0x00001000) /* SPI 1 reset */
  4019. #define RCC_USART1RST ((uint32_t)0x00004000) /* USART1 reset */
  4020. #define RCC_IOPERST ((uint32_t)0x00000040) /* I/O port E reset */
  4021. /***************** Bit definition for RCC_APB1PRSTR register *****************/
  4022. #define RCC_TIM2RST ((uint32_t)0x00000001) /* Timer 2 reset */
  4023. #define RCC_TIM3RST ((uint32_t)0x00000002) /* Timer 3 reset */
  4024. #define RCC_WWDGRST ((uint32_t)0x00000800) /* Window Watchdog reset */
  4025. #define RCC_USART2RST ((uint32_t)0x00020000) /* USART 2 reset */
  4026. #define RCC_I2C1RST ((uint32_t)0x00200000) /* I2C 1 reset */
  4027. #define RCC_CAN1RST ((uint32_t)0x02000000) /* CAN1 reset */
  4028. #define RCC_BKPRST ((uint32_t)0x08000000) /* Backup interface reset */
  4029. #define RCC_PWRRST ((uint32_t)0x10000000) /* Power interface reset */
  4030. #define RCC_TIM4RST ((uint32_t)0x00000004) /* Timer 4 reset */
  4031. #define RCC_SPI2RST ((uint32_t)0x00004000) /* SPI 2 reset */
  4032. #define RCC_USART3RST ((uint32_t)0x00040000) /* USART 3 reset */
  4033. #define RCC_I2C2RST ((uint32_t)0x00400000) /* I2C 2 reset */
  4034. #define RCC_USBRST ((uint32_t)0x00800000) /* USB Device reset */
  4035. /****************** Bit definition for RCC_AHBPCENR register ******************/
  4036. #define RCC_DMA1EN ((uint16_t)0x0001) /* DMA1 clock enable */
  4037. #define RCC_SRAMEN ((uint16_t)0x0004) /* SRAM interface clock enable */
  4038. #define RCC_FLITFEN ((uint16_t)0x0010) /* FLITF clock enable */
  4039. #define RCC_CRCEN ((uint16_t)0x0040) /* CRC clock enable */
  4040. #define RCC_USBHD ((uint16_t)0x1000)
  4041. /****************** Bit definition for RCC_APB2PCENR register *****************/
  4042. #define RCC_AFIOEN ((uint32_t)0x00000001) /* Alternate Function I/O clock enable */
  4043. #define RCC_IOPAEN ((uint32_t)0x00000004) /* I/O port A clock enable */
  4044. #define RCC_IOPBEN ((uint32_t)0x00000008) /* I/O port B clock enable */
  4045. #define RCC_IOPCEN ((uint32_t)0x00000010) /* I/O port C clock enable */
  4046. #define RCC_IOPDEN ((uint32_t)0x00000020) /* I/O port D clock enable */
  4047. #define RCC_ADC1EN ((uint32_t)0x00000200) /* ADC 1 interface clock enable */
  4048. #define RCC_ADC2EN ((uint32_t)0x00000400) /* ADC 2 interface clock enable */
  4049. #define RCC_TIM1EN ((uint32_t)0x00000800) /* TIM1 Timer clock enable */
  4050. #define RCC_SPI1EN ((uint32_t)0x00001000) /* SPI 1 clock enable */
  4051. #define RCC_USART1EN ((uint32_t)0x00004000) /* USART1 clock enable */
  4052. /***************** Bit definition for RCC_APB1PCENR register ******************/
  4053. #define RCC_TIM2EN ((uint32_t)0x00000001) /* Timer 2 clock enabled*/
  4054. #define RCC_TIM3EN ((uint32_t)0x00000002) /* Timer 3 clock enable */
  4055. #define RCC_WWDGEN ((uint32_t)0x00000800) /* Window Watchdog clock enable */
  4056. #define RCC_USART2EN ((uint32_t)0x00020000) /* USART 2 clock enable */
  4057. #define RCC_I2C1EN ((uint32_t)0x00200000) /* I2C 1 clock enable */
  4058. #define RCC_BKPEN ((uint32_t)0x08000000) /* Backup interface clock enable */
  4059. #define RCC_PWREN ((uint32_t)0x10000000) /* Power interface clock enable */
  4060. #define RCC_USBEN ((uint32_t)0x00800000) /* USB Device clock enable */
  4061. /******************* Bit definition for RCC_BDCTLR register *******************/
  4062. #define RCC_LSEON ((uint32_t)0x00000001) /* External Low Speed oscillator enable */
  4063. #define RCC_LSERDY ((uint32_t)0x00000002) /* External Low Speed oscillator Ready */
  4064. #define RCC_LSEBYP ((uint32_t)0x00000004) /* External Low Speed oscillator Bypass */
  4065. #define RCC_RTCSEL ((uint32_t)0x00000300) /* RTCSEL[1:0] bits (RTC clock source selection) */
  4066. #define RCC_RTCSEL_0 ((uint32_t)0x00000100) /* Bit 0 */
  4067. #define RCC_RTCSEL_1 ((uint32_t)0x00000200) /* Bit 1 */
  4068. #define RCC_RTCSEL_NOCLOCK ((uint32_t)0x00000000) /* No clock */
  4069. #define RCC_RTCSEL_LSE ((uint32_t)0x00000100) /* LSE oscillator clock used as RTC clock */
  4070. #define RCC_RTCSEL_LSI ((uint32_t)0x00000200) /* LSI oscillator clock used as RTC clock */
  4071. #define RCC_RTCSEL_HSE ((uint32_t)0x00000300) /* HSE oscillator clock divided by 128 used as RTC clock */
  4072. #define RCC_RTCEN ((uint32_t)0x00008000) /* RTC clock enable */
  4073. #define RCC_BDRST ((uint32_t)0x00010000) /* Backup domain software reset */
  4074. /******************* Bit definition for RCC_RSTSCKR register ********************/
  4075. #define RCC_LSION ((uint32_t)0x00000001) /* Internal Low Speed oscillator enable */
  4076. #define RCC_LSIRDY ((uint32_t)0x00000002) /* Internal Low Speed oscillator Ready */
  4077. #define RCC_RMVF ((uint32_t)0x01000000) /* Remove reset flag */
  4078. #define RCC_PINRSTF ((uint32_t)0x04000000) /* PIN reset flag */
  4079. #define RCC_PORRSTF ((uint32_t)0x08000000) /* POR/PDR reset flag */
  4080. #define RCC_SFTRSTF ((uint32_t)0x10000000) /* Software Reset flag */
  4081. #define RCC_IWDGRSTF ((uint32_t)0x20000000) /* Independent Watchdog reset flag */
  4082. #define RCC_WWDGRSTF ((uint32_t)0x40000000) /* Window watchdog reset flag */
  4083. #define RCC_LPWRRSTF ((uint32_t)0x80000000) /* Low-Power reset flag */
  4084. /******************************************************************************/
  4085. /* RNG */
  4086. /******************************************************************************/
  4087. /******************** Bit definition for RNG_CR register *******************/
  4088. #define RNG_CR_RNGEN ((uint32_t)0x00000004)
  4089. #define RNG_CR_IE ((uint32_t)0x00000008)
  4090. /******************** Bit definition for RNG_SR register *******************/
  4091. #define RNG_SR_DRDY ((uint32_t)0x00000001)
  4092. #define RNG_SR_CECS ((uint32_t)0x00000002)
  4093. #define RNG_SR_SECS ((uint32_t)0x00000004)
  4094. #define RNG_SR_CEIS ((uint32_t)0x00000020)
  4095. #define RNG_SR_SEIS ((uint32_t)0x00000040)
  4096. /******************************************************************************/
  4097. /* Real-Time Clock */
  4098. /******************************************************************************/
  4099. /******************* Bit definition for RTC_CTLRH register ********************/
  4100. #define RTC_CTLRH_SECIE ((uint8_t)0x01) /* Second Interrupt Enable */
  4101. #define RTC_CTLRH_ALRIE ((uint8_t)0x02) /* Alarm Interrupt Enable */
  4102. #define RTC_CTLRH_OWIE ((uint8_t)0x04) /* OverfloW Interrupt Enable */
  4103. /******************* Bit definition for RTC_CTLRL register ********************/
  4104. #define RTC_CTLRL_SECF ((uint8_t)0x01) /* Second Flag */
  4105. #define RTC_CTLRL_ALRF ((uint8_t)0x02) /* Alarm Flag */
  4106. #define RTC_CTLRL_OWF ((uint8_t)0x04) /* OverfloW Flag */
  4107. #define RTC_CTLRL_RSF ((uint8_t)0x08) /* Registers Synchronized Flag */
  4108. #define RTC_CTLRL_CNF ((uint8_t)0x10) /* Configuration Flag */
  4109. #define RTC_CTLRL_RTOFF ((uint8_t)0x20) /* RTC operation OFF */
  4110. /******************* Bit definition for RTC_PSCH register *******************/
  4111. #define RTC_PSCH_PRL ((uint16_t)0x000F) /* RTC Prescaler Reload Value High */
  4112. /******************* Bit definition for RTC_PRLL register *******************/
  4113. #define RTC_PSCL_PRL ((uint16_t)0xFFFF) /* RTC Prescaler Reload Value Low */
  4114. /******************* Bit definition for RTC_DIVH register *******************/
  4115. #define RTC_DIVH_RTC_DIV ((uint16_t)0x000F) /* RTC Clock Divider High */
  4116. /******************* Bit definition for RTC_DIVL register *******************/
  4117. #define RTC_DIVL_RTC_DIV ((uint16_t)0xFFFF) /* RTC Clock Divider Low */
  4118. /******************* Bit definition for RTC_CNTH register *******************/
  4119. #define RTC_CNTH_RTC_CNT ((uint16_t)0xFFFF) /* RTC Counter High */
  4120. /******************* Bit definition for RTC_CNTL register *******************/
  4121. #define RTC_CNTL_RTC_CNT ((uint16_t)0xFFFF) /* RTC Counter Low */
  4122. /******************* Bit definition for RTC_ALRMH register *******************/
  4123. #define RTC_ALRMH_RTC_ALRM ((uint16_t)0xFFFF) /* RTC Alarm High */
  4124. /******************* Bit definition for RTC_ALRML register *******************/
  4125. #define RTC_ALRML_RTC_ALRM ((uint16_t)0xFFFF) /* RTC Alarm Low */
  4126. /******************************************************************************/
  4127. /* Serial Peripheral Interface */
  4128. /******************************************************************************/
  4129. /******************* Bit definition for SPI_CTLR1 register ********************/
  4130. #define SPI_CTLR1_CPHA ((uint16_t)0x0001) /* Clock Phase */
  4131. #define SPI_CTLR1_CPOL ((uint16_t)0x0002) /* Clock Polarity */
  4132. #define SPI_CTLR1_MSTR ((uint16_t)0x0004) /* Master Selection */
  4133. #define SPI_CTLR1_BR ((uint16_t)0x0038) /* BR[2:0] bits (Baud Rate Control) */
  4134. #define SPI_CTLR1_BR_0 ((uint16_t)0x0008) /* Bit 0 */
  4135. #define SPI_CTLR1_BR_1 ((uint16_t)0x0010) /* Bit 1 */
  4136. #define SPI_CTLR1_BR_2 ((uint16_t)0x0020) /* Bit 2 */
  4137. #define SPI_CTLR1_SPE ((uint16_t)0x0040) /* SPI Enable */
  4138. #define SPI_CTLR1_LSBFIRST ((uint16_t)0x0080) /* Frame Format */
  4139. #define SPI_CTLR1_SSI ((uint16_t)0x0100) /* Internal slave select */
  4140. #define SPI_CTLR1_SSM ((uint16_t)0x0200) /* Software slave management */
  4141. #define SPI_CTLR1_RXONLY ((uint16_t)0x0400) /* Receive only */
  4142. #define SPI_CTLR1_DFF ((uint16_t)0x0800) /* Data Frame Format */
  4143. #define SPI_CTLR1_CRCNEXT ((uint16_t)0x1000) /* Transmit CRC next */
  4144. #define SPI_CTLR1_CRCEN ((uint16_t)0x2000) /* Hardware CRC calculation enable */
  4145. #define SPI_CTLR1_BIDIOE ((uint16_t)0x4000) /* Output enable in bidirectional mode */
  4146. #define SPI_CTLR1_BIDIMODE ((uint16_t)0x8000) /* Bidirectional data mode enable */
  4147. /******************* Bit definition for SPI_CTLR2 register ********************/
  4148. #define SPI_CTLR2_RXDMAEN ((uint8_t)0x01) /* Rx Buffer DMA Enable */
  4149. #define SPI_CTLR2_TXDMAEN ((uint8_t)0x02) /* Tx Buffer DMA Enable */
  4150. #define SPI_CTLR2_SSOE ((uint8_t)0x04) /* SS Output Enable */
  4151. #define SPI_CTLR2_ERRIE ((uint8_t)0x20) /* Error Interrupt Enable */
  4152. #define SPI_CTLR2_RXNEIE ((uint8_t)0x40) /* RX buffer Not Empty Interrupt Enable */
  4153. #define SPI_CTLR2_TXEIE ((uint8_t)0x80) /* Tx buffer Empty Interrupt Enable */
  4154. /******************** Bit definition for SPI_STATR register ********************/
  4155. #define SPI_STATR_RXNE ((uint8_t)0x01) /* Receive buffer Not Empty */
  4156. #define SPI_STATR_TXE ((uint8_t)0x02) /* Transmit buffer Empty */
  4157. #define SPI_STATR_CHSIDE ((uint8_t)0x04) /* Channel side */
  4158. #define SPI_STATR_UDR ((uint8_t)0x08) /* Underrun flag */
  4159. #define SPI_STATR_CRCERR ((uint8_t)0x10) /* CRC Error flag */
  4160. #define SPI_STATR_MODF ((uint8_t)0x20) /* Mode fault */
  4161. #define SPI_STATR_OVR ((uint8_t)0x40) /* Overrun flag */
  4162. #define SPI_STATR_BSY ((uint8_t)0x80) /* Busy flag */
  4163. /******************** Bit definition for SPI_DATAR register ********************/
  4164. #define SPI_DATAR_DR ((uint16_t)0xFFFF) /* Data Register */
  4165. /******************* Bit definition for SPI_CRCR register ******************/
  4166. #define SPI_CRCR_CRCPOLY ((uint16_t)0xFFFF) /* CRC polynomial register */
  4167. /****************** Bit definition for SPI_RCRCR register ******************/
  4168. #define SPI_RCRCR_RXCRC ((uint16_t)0xFFFF) /* Rx CRC Register */
  4169. /****************** Bit definition for SPI_TCRCR register ******************/
  4170. #define SPI_TCRCR_TXCRC ((uint16_t)0xFFFF) /* Tx CRC Register */
  4171. /****************** Bit definition for SPI_I2SCFGR register *****************/
  4172. #define SPI_I2SCFGR_CHLEN ((uint16_t)0x0001) /* Channel length (number of bits per audio channel) */
  4173. #define SPI_I2SCFGR_DATLEN ((uint16_t)0x0006) /* DATLEN[1:0] bits (Data length to be transferred) */
  4174. #define SPI_I2SCFGR_DATLEN_0 ((uint16_t)0x0002) /* Bit 0 */
  4175. #define SPI_I2SCFGR_DATLEN_1 ((uint16_t)0x0004) /* Bit 1 */
  4176. #define SPI_I2SCFGR_CKPOL ((uint16_t)0x0008) /* steady state clock polarity */
  4177. #define SPI_I2SCFGR_I2SSTD ((uint16_t)0x0030) /* I2SSTD[1:0] bits (I2S standard selection) */
  4178. #define SPI_I2SCFGR_I2SSTD_0 ((uint16_t)0x0010) /* Bit 0 */
  4179. #define SPI_I2SCFGR_I2SSTD_1 ((uint16_t)0x0020) /* Bit 1 */
  4180. #define SPI_I2SCFGR_PCMSYNC ((uint16_t)0x0080) /* PCM frame synchronization */
  4181. #define SPI_I2SCFGR_I2SCFG ((uint16_t)0x0300) /* I2SCFG[1:0] bits (I2S configuration mode) */
  4182. #define SPI_I2SCFGR_I2SCFG_0 ((uint16_t)0x0100) /* Bit 0 */
  4183. #define SPI_I2SCFGR_I2SCFG_1 ((uint16_t)0x0200) /* Bit 1 */
  4184. #define SPI_I2SCFGR_I2SE ((uint16_t)0x0400) /* I2S Enable */
  4185. #define SPI_I2SCFGR_I2SMOD ((uint16_t)0x0800) /* I2S mode selection */
  4186. /****************** Bit definition for SPI_I2SPR register *******************/
  4187. #define SPI_I2SPR_I2SDIV ((uint16_t)0x00FF) /* I2S Linear prescaler */
  4188. #define SPI_I2SPR_ODD ((uint16_t)0x0100) /* Odd factor for the prescaler */
  4189. #define SPI_I2SPR_MCKOE ((uint16_t)0x0200) /* Master Clock Output Enable */
  4190. /******************************************************************************/
  4191. /* TIM */
  4192. /******************************************************************************/
  4193. /******************* Bit definition for TIM_CTLR1 register ********************/
  4194. #define TIM_CEN ((uint16_t)0x0001) /* Counter enable */
  4195. #define TIM_UDIS ((uint16_t)0x0002) /* Update disable */
  4196. #define TIM_URS ((uint16_t)0x0004) /* Update request source */
  4197. #define TIM_OPM ((uint16_t)0x0008) /* One pulse mode */
  4198. #define TIM_DIR ((uint16_t)0x0010) /* Direction */
  4199. #define TIM_CMS ((uint16_t)0x0060) /* CMS[1:0] bits (Center-aligned mode selection) */
  4200. #define TIM_CMS_0 ((uint16_t)0x0020) /* Bit 0 */
  4201. #define TIM_CMS_1 ((uint16_t)0x0040) /* Bit 1 */
  4202. #define TIM_ARPE ((uint16_t)0x0080) /* Auto-reload preload enable */
  4203. #define TIM_CTLR1_CKD ((uint16_t)0x0300) /* CKD[1:0] bits (clock division) */
  4204. #define TIM_CKD_0 ((uint16_t)0x0100) /* Bit 0 */
  4205. #define TIM_CKD_1 ((uint16_t)0x0200) /* Bit 1 */
  4206. /******************* Bit definition for TIM_CTLR2 register ********************/
  4207. #define TIM_CCPC ((uint16_t)0x0001) /* Capture/Compare Preloaded Control */
  4208. #define TIM_CCUS ((uint16_t)0x0004) /* Capture/Compare Control Update Selection */
  4209. #define TIM_CCDS ((uint16_t)0x0008) /* Capture/Compare DMA Selection */
  4210. #define TIM_MMS ((uint16_t)0x0070) /* MMS[2:0] bits (Master Mode Selection) */
  4211. #define TIM_MMS_0 ((uint16_t)0x0010) /* Bit 0 */
  4212. #define TIM_MMS_1 ((uint16_t)0x0020) /* Bit 1 */
  4213. #define TIM_MMS_2 ((uint16_t)0x0040) /* Bit 2 */
  4214. #define TIM_TI1S ((uint16_t)0x0080) /* TI1 Selection */
  4215. #define TIM_OIS1 ((uint16_t)0x0100) /* Output Idle state 1 (OC1 output) */
  4216. #define TIM_OIS1N ((uint16_t)0x0200) /* Output Idle state 1 (OC1N output) */
  4217. #define TIM_OIS2 ((uint16_t)0x0400) /* Output Idle state 2 (OC2 output) */
  4218. #define TIM_OIS2N ((uint16_t)0x0800) /* Output Idle state 2 (OC2N output) */
  4219. #define TIM_OIS3 ((uint16_t)0x1000) /* Output Idle state 3 (OC3 output) */
  4220. #define TIM_OIS3N ((uint16_t)0x2000) /* Output Idle state 3 (OC3N output) */
  4221. #define TIM_OIS4 ((uint16_t)0x4000) /* Output Idle state 4 (OC4 output) */
  4222. /******************* Bit definition for TIM_SMCFGR register *******************/
  4223. #define TIM_SMS ((uint16_t)0x0007) /* SMS[2:0] bits (Slave mode selection) */
  4224. #define TIM_SMS_0 ((uint16_t)0x0001) /* Bit 0 */
  4225. #define TIM_SMS_1 ((uint16_t)0x0002) /* Bit 1 */
  4226. #define TIM_SMS_2 ((uint16_t)0x0004) /* Bit 2 */
  4227. #define TIM_TS ((uint16_t)0x0070) /* TS[2:0] bits (Trigger selection) */
  4228. #define TIM_TS_0 ((uint16_t)0x0010) /* Bit 0 */
  4229. #define TIM_TS_1 ((uint16_t)0x0020) /* Bit 1 */
  4230. #define TIM_TS_2 ((uint16_t)0x0040) /* Bit 2 */
  4231. #define TIM_MSM ((uint16_t)0x0080) /* Master/slave mode */
  4232. #define TIM_ETF ((uint16_t)0x0F00) /* ETF[3:0] bits (External trigger filter) */
  4233. #define TIM_ETF_0 ((uint16_t)0x0100) /* Bit 0 */
  4234. #define TIM_ETF_1 ((uint16_t)0x0200) /* Bit 1 */
  4235. #define TIM_ETF_2 ((uint16_t)0x0400) /* Bit 2 */
  4236. #define TIM_ETF_3 ((uint16_t)0x0800) /* Bit 3 */
  4237. #define TIM_ETPS ((uint16_t)0x3000) /* ETPS[1:0] bits (External trigger prescaler) */
  4238. #define TIM_ETPS_0 ((uint16_t)0x1000) /* Bit 0 */
  4239. #define TIM_ETPS_1 ((uint16_t)0x2000) /* Bit 1 */
  4240. #define TIM_ECE ((uint16_t)0x4000) /* External clock enable */
  4241. #define TIM_ETP ((uint16_t)0x8000) /* External trigger polarity */
  4242. /******************* Bit definition for TIM_DMAINTENR register *******************/
  4243. #define TIM_UIE ((uint16_t)0x0001) /* Update interrupt enable */
  4244. #define TIM_CC1IE ((uint16_t)0x0002) /* Capture/Compare 1 interrupt enable */
  4245. #define TIM_CC2IE ((uint16_t)0x0004) /* Capture/Compare 2 interrupt enable */
  4246. #define TIM_CC3IE ((uint16_t)0x0008) /* Capture/Compare 3 interrupt enable */
  4247. #define TIM_CC4IE ((uint16_t)0x0010) /* Capture/Compare 4 interrupt enable */
  4248. #define TIM_COMIE ((uint16_t)0x0020) /* COM interrupt enable */
  4249. #define TIM_TIE ((uint16_t)0x0040) /* Trigger interrupt enable */
  4250. #define TIM_BIE ((uint16_t)0x0080) /* Break interrupt enable */
  4251. #define TIM_UDE ((uint16_t)0x0100) /* Update DMA request enable */
  4252. #define TIM_CC1DE ((uint16_t)0x0200) /* Capture/Compare 1 DMA request enable */
  4253. #define TIM_CC2DE ((uint16_t)0x0400) /* Capture/Compare 2 DMA request enable */
  4254. #define TIM_CC3DE ((uint16_t)0x0800) /* Capture/Compare 3 DMA request enable */
  4255. #define TIM_CC4DE ((uint16_t)0x1000) /* Capture/Compare 4 DMA request enable */
  4256. #define TIM_COMDE ((uint16_t)0x2000) /* COM DMA request enable */
  4257. #define TIM_TDE ((uint16_t)0x4000) /* Trigger DMA request enable */
  4258. /******************** Bit definition for TIM_INTFR register ********************/
  4259. #define TIM_UIF ((uint16_t)0x0001) /* Update interrupt Flag */
  4260. #define TIM_CC1IF ((uint16_t)0x0002) /* Capture/Compare 1 interrupt Flag */
  4261. #define TIM_CC2IF ((uint16_t)0x0004) /* Capture/Compare 2 interrupt Flag */
  4262. #define TIM_CC3IF ((uint16_t)0x0008) /* Capture/Compare 3 interrupt Flag */
  4263. #define TIM_CC4IF ((uint16_t)0x0010) /* Capture/Compare 4 interrupt Flag */
  4264. #define TIM_COMIF ((uint16_t)0x0020) /* COM interrupt Flag */
  4265. #define TIM_TIF ((uint16_t)0x0040) /* Trigger interrupt Flag */
  4266. #define TIM_BIF ((uint16_t)0x0080) /* Break interrupt Flag */
  4267. #define TIM_CC1OF ((uint16_t)0x0200) /* Capture/Compare 1 Overcapture Flag */
  4268. #define TIM_CC2OF ((uint16_t)0x0400) /* Capture/Compare 2 Overcapture Flag */
  4269. #define TIM_CC3OF ((uint16_t)0x0800) /* Capture/Compare 3 Overcapture Flag */
  4270. #define TIM_CC4OF ((uint16_t)0x1000) /* Capture/Compare 4 Overcapture Flag */
  4271. /******************* Bit definition for TIM_SWEVGR register ********************/
  4272. #define TIM_UG ((uint8_t)0x01) /* Update Generation */
  4273. #define TIM_CC1G ((uint8_t)0x02) /* Capture/Compare 1 Generation */
  4274. #define TIM_CC2G ((uint8_t)0x04) /* Capture/Compare 2 Generation */
  4275. #define TIM_CC3G ((uint8_t)0x08) /* Capture/Compare 3 Generation */
  4276. #define TIM_CC4G ((uint8_t)0x10) /* Capture/Compare 4 Generation */
  4277. #define TIM_COMG ((uint8_t)0x20) /* Capture/Compare Control Update Generation */
  4278. #define TIM_TG ((uint8_t)0x40) /* Trigger Generation */
  4279. #define TIM_BG ((uint8_t)0x80) /* Break Generation */
  4280. /****************** Bit definition for TIM_CHCTLR1 register *******************/
  4281. #define TIM_CC1S ((uint16_t)0x0003) /* CC1S[1:0] bits (Capture/Compare 1 Selection) */
  4282. #define TIM_CC1S_0 ((uint16_t)0x0001) /* Bit 0 */
  4283. #define TIM_CC1S_1 ((uint16_t)0x0002) /* Bit 1 */
  4284. #define TIM_OC1FE ((uint16_t)0x0004) /* Output Compare 1 Fast enable */
  4285. #define TIM_OC1PE ((uint16_t)0x0008) /* Output Compare 1 Preload enable */
  4286. #define TIM_OC1M ((uint16_t)0x0070) /* OC1M[2:0] bits (Output Compare 1 Mode) */
  4287. #define TIM_OC1M_0 ((uint16_t)0x0010) /* Bit 0 */
  4288. #define TIM_OC1M_1 ((uint16_t)0x0020) /* Bit 1 */
  4289. #define TIM_OC1M_2 ((uint16_t)0x0040) /* Bit 2 */
  4290. #define TIM_OC1CE ((uint16_t)0x0080) /* Output Compare 1Clear Enable */
  4291. #define TIM_CC2S ((uint16_t)0x0300) /* CC2S[1:0] bits (Capture/Compare 2 Selection) */
  4292. #define TIM_CC2S_0 ((uint16_t)0x0100) /* Bit 0 */
  4293. #define TIM_CC2S_1 ((uint16_t)0x0200) /* Bit 1 */
  4294. #define TIM_OC2FE ((uint16_t)0x0400) /* Output Compare 2 Fast enable */
  4295. #define TIM_OC2PE ((uint16_t)0x0800) /* Output Compare 2 Preload enable */
  4296. #define TIM_OC2M ((uint16_t)0x7000) /* OC2M[2:0] bits (Output Compare 2 Mode) */
  4297. #define TIM_OC2M_0 ((uint16_t)0x1000) /* Bit 0 */
  4298. #define TIM_OC2M_1 ((uint16_t)0x2000) /* Bit 1 */
  4299. #define TIM_OC2M_2 ((uint16_t)0x4000) /* Bit 2 */
  4300. #define TIM_OC2CE ((uint16_t)0x8000) /* Output Compare 2 Clear Enable */
  4301. #define TIM_IC1PSC ((uint16_t)0x000C) /* IC1PSC[1:0] bits (Input Capture 1 Prescaler) */
  4302. #define TIM_IC1PSC_0 ((uint16_t)0x0004) /* Bit 0 */
  4303. #define TIM_IC1PSC_1 ((uint16_t)0x0008) /* Bit 1 */
  4304. #define TIM_IC1F ((uint16_t)0x00F0) /* IC1F[3:0] bits (Input Capture 1 Filter) */
  4305. #define TIM_IC1F_0 ((uint16_t)0x0010) /* Bit 0 */
  4306. #define TIM_IC1F_1 ((uint16_t)0x0020) /* Bit 1 */
  4307. #define TIM_IC1F_2 ((uint16_t)0x0040) /* Bit 2 */
  4308. #define TIM_IC1F_3 ((uint16_t)0x0080) /* Bit 3 */
  4309. #define TIM_IC2PSC ((uint16_t)0x0C00) /* IC2PSC[1:0] bits (Input Capture 2 Prescaler) */
  4310. #define TIM_IC2PSC_0 ((uint16_t)0x0400) /* Bit 0 */
  4311. #define TIM_IC2PSC_1 ((uint16_t)0x0800) /* Bit 1 */
  4312. #define TIM_IC2F ((uint16_t)0xF000) /* IC2F[3:0] bits (Input Capture 2 Filter) */
  4313. #define TIM_IC2F_0 ((uint16_t)0x1000) /* Bit 0 */
  4314. #define TIM_IC2F_1 ((uint16_t)0x2000) /* Bit 1 */
  4315. #define TIM_IC2F_2 ((uint16_t)0x4000) /* Bit 2 */
  4316. #define TIM_IC2F_3 ((uint16_t)0x8000) /* Bit 3 */
  4317. /****************** Bit definition for TIM_CHCTLR2 register *******************/
  4318. #define TIM_CC3S ((uint16_t)0x0003) /* CC3S[1:0] bits (Capture/Compare 3 Selection) */
  4319. #define TIM_CC3S_0 ((uint16_t)0x0001) /* Bit 0 */
  4320. #define TIM_CC3S_1 ((uint16_t)0x0002) /* Bit 1 */
  4321. #define TIM_OC3FE ((uint16_t)0x0004) /* Output Compare 3 Fast enable */
  4322. #define TIM_OC3PE ((uint16_t)0x0008) /* Output Compare 3 Preload enable */
  4323. #define TIM_OC3M ((uint16_t)0x0070) /* OC3M[2:0] bits (Output Compare 3 Mode) */
  4324. #define TIM_OC3M_0 ((uint16_t)0x0010) /* Bit 0 */
  4325. #define TIM_OC3M_1 ((uint16_t)0x0020) /* Bit 1 */
  4326. #define TIM_OC3M_2 ((uint16_t)0x0040) /* Bit 2 */
  4327. #define TIM_OC3CE ((uint16_t)0x0080) /* Output Compare 3 Clear Enable */
  4328. #define TIM_CC4S ((uint16_t)0x0300) /* CC4S[1:0] bits (Capture/Compare 4 Selection) */
  4329. #define TIM_CC4S_0 ((uint16_t)0x0100) /* Bit 0 */
  4330. #define TIM_CC4S_1 ((uint16_t)0x0200) /* Bit 1 */
  4331. #define TIM_OC4FE ((uint16_t)0x0400) /* Output Compare 4 Fast enable */
  4332. #define TIM_OC4PE ((uint16_t)0x0800) /* Output Compare 4 Preload enable */
  4333. #define TIM_OC4M ((uint16_t)0x7000) /* OC4M[2:0] bits (Output Compare 4 Mode) */
  4334. #define TIM_OC4M_0 ((uint16_t)0x1000) /* Bit 0 */
  4335. #define TIM_OC4M_1 ((uint16_t)0x2000) /* Bit 1 */
  4336. #define TIM_OC4M_2 ((uint16_t)0x4000) /* Bit 2 */
  4337. #define TIM_OC4CE ((uint16_t)0x8000) /* Output Compare 4 Clear Enable */
  4338. #define TIM_IC3PSC ((uint16_t)0x000C) /* IC3PSC[1:0] bits (Input Capture 3 Prescaler) */
  4339. #define TIM_IC3PSC_0 ((uint16_t)0x0004) /* Bit 0 */
  4340. #define TIM_IC3PSC_1 ((uint16_t)0x0008) /* Bit 1 */
  4341. #define TIM_IC3F ((uint16_t)0x00F0) /* IC3F[3:0] bits (Input Capture 3 Filter) */
  4342. #define TIM_IC3F_0 ((uint16_t)0x0010) /* Bit 0 */
  4343. #define TIM_IC3F_1 ((uint16_t)0x0020) /* Bit 1 */
  4344. #define TIM_IC3F_2 ((uint16_t)0x0040) /* Bit 2 */
  4345. #define TIM_IC3F_3 ((uint16_t)0x0080) /* Bit 3 */
  4346. #define TIM_IC4PSC ((uint16_t)0x0C00) /* IC4PSC[1:0] bits (Input Capture 4 Prescaler) */
  4347. #define TIM_IC4PSC_0 ((uint16_t)0x0400) /* Bit 0 */
  4348. #define TIM_IC4PSC_1 ((uint16_t)0x0800) /* Bit 1 */
  4349. #define TIM_IC4F ((uint16_t)0xF000) /* IC4F[3:0] bits (Input Capture 4 Filter) */
  4350. #define TIM_IC4F_0 ((uint16_t)0x1000) /* Bit 0 */
  4351. #define TIM_IC4F_1 ((uint16_t)0x2000) /* Bit 1 */
  4352. #define TIM_IC4F_2 ((uint16_t)0x4000) /* Bit 2 */
  4353. #define TIM_IC4F_3 ((uint16_t)0x8000) /* Bit 3 */
  4354. /******************* Bit definition for TIM_CCER register *******************/
  4355. #define TIM_CC1E ((uint16_t)0x0001) /* Capture/Compare 1 output enable */
  4356. #define TIM_CC1P ((uint16_t)0x0002) /* Capture/Compare 1 output Polarity */
  4357. #define TIM_CC1NE ((uint16_t)0x0004) /* Capture/Compare 1 Complementary output enable */
  4358. #define TIM_CC1NP ((uint16_t)0x0008) /* Capture/Compare 1 Complementary output Polarity */
  4359. #define TIM_CC2E ((uint16_t)0x0010) /* Capture/Compare 2 output enable */
  4360. #define TIM_CC2P ((uint16_t)0x0020) /* Capture/Compare 2 output Polarity */
  4361. #define TIM_CC2NE ((uint16_t)0x0040) /* Capture/Compare 2 Complementary output enable */
  4362. #define TIM_CC2NP ((uint16_t)0x0080) /* Capture/Compare 2 Complementary output Polarity */
  4363. #define TIM_CC3E ((uint16_t)0x0100) /* Capture/Compare 3 output enable */
  4364. #define TIM_CC3P ((uint16_t)0x0200) /* Capture/Compare 3 output Polarity */
  4365. #define TIM_CC3NE ((uint16_t)0x0400) /* Capture/Compare 3 Complementary output enable */
  4366. #define TIM_CC3NP ((uint16_t)0x0800) /* Capture/Compare 3 Complementary output Polarity */
  4367. #define TIM_CC4E ((uint16_t)0x1000) /* Capture/Compare 4 output enable */
  4368. #define TIM_CC4P ((uint16_t)0x2000) /* Capture/Compare 4 output Polarity */
  4369. #define TIM_CC4NP ((uint16_t)0x8000) /* Capture/Compare 4 Complementary output Polarity */
  4370. /******************* Bit definition for TIM_CNT register ********************/
  4371. #define TIM_CNT ((uint16_t)0xFFFF) /* Counter Value */
  4372. /******************* Bit definition for TIM_PSC register ********************/
  4373. #define TIM_PSC ((uint16_t)0xFFFF) /* Prescaler Value */
  4374. /******************* Bit definition for TIM_ATRLR register ********************/
  4375. #define TIM_ARR ((uint16_t)0xFFFF) /* actual auto-reload Value */
  4376. /******************* Bit definition for TIM_RPTCR register ********************/
  4377. #define TIM_REP ((uint8_t)0xFF) /* Repetition Counter Value */
  4378. /******************* Bit definition for TIM_CH1CVR register *******************/
  4379. #define TIM_CCR1 ((uint16_t)0xFFFF) /* Capture/Compare 1 Value */
  4380. /******************* Bit definition for TIM_CH2CVR register *******************/
  4381. #define TIM_CCR2 ((uint16_t)0xFFFF) /* Capture/Compare 2 Value */
  4382. /******************* Bit definition for TIM_CH3CVR register *******************/
  4383. #define TIM_CCR3 ((uint16_t)0xFFFF) /* Capture/Compare 3 Value */
  4384. /******************* Bit definition for TIM_CH4CVR register *******************/
  4385. #define TIM_CCR4 ((uint16_t)0xFFFF) /* Capture/Compare 4 Value */
  4386. /******************* Bit definition for TIM_BDTR register *******************/
  4387. #define TIM_DTG ((uint16_t)0x00FF) /* DTG[0:7] bits (Dead-Time Generator set-up) */
  4388. #define TIM_DTG_0 ((uint16_t)0x0001) /* Bit 0 */
  4389. #define TIM_DTG_1 ((uint16_t)0x0002) /* Bit 1 */
  4390. #define TIM_DTG_2 ((uint16_t)0x0004) /* Bit 2 */
  4391. #define TIM_DTG_3 ((uint16_t)0x0008) /* Bit 3 */
  4392. #define TIM_DTG_4 ((uint16_t)0x0010) /* Bit 4 */
  4393. #define TIM_DTG_5 ((uint16_t)0x0020) /* Bit 5 */
  4394. #define TIM_DTG_6 ((uint16_t)0x0040) /* Bit 6 */
  4395. #define TIM_DTG_7 ((uint16_t)0x0080) /* Bit 7 */
  4396. #define TIM_LOCK ((uint16_t)0x0300) /* LOCK[1:0] bits (Lock Configuration) */
  4397. #define TIM_LOCK_0 ((uint16_t)0x0100) /* Bit 0 */
  4398. #define TIM_LOCK_1 ((uint16_t)0x0200) /* Bit 1 */
  4399. #define TIM_OSSI ((uint16_t)0x0400) /* Off-State Selection for Idle mode */
  4400. #define TIM_OSSR ((uint16_t)0x0800) /* Off-State Selection for Run mode */
  4401. #define TIM_BKE ((uint16_t)0x1000) /* Break enable */
  4402. #define TIM_BKP ((uint16_t)0x2000) /* Break Polarity */
  4403. #define TIM_AOE ((uint16_t)0x4000) /* Automatic Output enable */
  4404. #define TIM_MOE ((uint16_t)0x8000) /* Main Output enable */
  4405. /******************* Bit definition for TIM_DMACFGR register ********************/
  4406. #define TIM_DBA ((uint16_t)0x001F) /* DBA[4:0] bits (DMA Base Address) */
  4407. #define TIM_DBA_0 ((uint16_t)0x0001) /* Bit 0 */
  4408. #define TIM_DBA_1 ((uint16_t)0x0002) /* Bit 1 */
  4409. #define TIM_DBA_2 ((uint16_t)0x0004) /* Bit 2 */
  4410. #define TIM_DBA_3 ((uint16_t)0x0008) /* Bit 3 */
  4411. #define TIM_DBA_4 ((uint16_t)0x0010) /* Bit 4 */
  4412. #define TIM_DBL ((uint16_t)0x1F00) /* DBL[4:0] bits (DMA Burst Length) */
  4413. #define TIM_DBL_0 ((uint16_t)0x0100) /* Bit 0 */
  4414. #define TIM_DBL_1 ((uint16_t)0x0200) /* Bit 1 */
  4415. #define TIM_DBL_2 ((uint16_t)0x0400) /* Bit 2 */
  4416. #define TIM_DBL_3 ((uint16_t)0x0800) /* Bit 3 */
  4417. #define TIM_DBL_4 ((uint16_t)0x1000) /* Bit 4 */
  4418. /******************* Bit definition for TIM_DMAADR register *******************/
  4419. #define TIM_DMAR_DMAB ((uint16_t)0xFFFF) /* DMA register for burst accesses */
  4420. /******************************************************************************/
  4421. /* Universal Synchronous Asynchronous Receiver Transmitter */
  4422. /******************************************************************************/
  4423. /******************* Bit definition for USART_STATR register *******************/
  4424. #define USART_STATR_PE ((uint16_t)0x0001) /* Parity Error */
  4425. #define USART_STATR_FE ((uint16_t)0x0002) /* Framing Error */
  4426. #define USART_STATR_NE ((uint16_t)0x0004) /* Noise Error Flag */
  4427. #define USART_STATR_ORE ((uint16_t)0x0008) /* OverRun Error */
  4428. #define USART_STATR_IDLE ((uint16_t)0x0010) /* IDLE line detected */
  4429. #define USART_STATR_RXNE ((uint16_t)0x0020) /* Read Data Register Not Empty */
  4430. #define USART_STATR_TC ((uint16_t)0x0040) /* Transmission Complete */
  4431. #define USART_STATR_TXE ((uint16_t)0x0080) /* Transmit Data Register Empty */
  4432. #define USART_STATR_LBD ((uint16_t)0x0100) /* LIN Break Detection Flag */
  4433. #define USART_STATR_CTS ((uint16_t)0x0200) /* CTS Flag */
  4434. /******************* Bit definition for USART_DATAR register *******************/
  4435. #define USART_DATAR_DR ((uint16_t)0x01FF) /* Data value */
  4436. /****************** Bit definition for USART_BRR register *******************/
  4437. #define USART_BRR_DIV_Fraction ((uint16_t)0x000F) /* Fraction of USARTDIV */
  4438. #define USART_BRR_DIV_Mantissa ((uint16_t)0xFFF0) /* Mantissa of USARTDIV */
  4439. /****************** Bit definition for USART_CTLR1 register *******************/
  4440. #define USART_CTLR1_SBK ((uint16_t)0x0001) /* Send Break */
  4441. #define USART_CTLR1_RWU ((uint16_t)0x0002) /* Receiver wakeup */
  4442. #define USART_CTLR1_RE ((uint16_t)0x0004) /* Receiver Enable */
  4443. #define USART_CTLR1_TE ((uint16_t)0x0008) /* Transmitter Enable */
  4444. #define USART_CTLR1_IDLEIE ((uint16_t)0x0010) /* IDLE Interrupt Enable */
  4445. #define USART_CTLR1_RXNEIE ((uint16_t)0x0020) /* RXNE Interrupt Enable */
  4446. #define USART_CTLR1_TCIE ((uint16_t)0x0040) /* Transmission Complete Interrupt Enable */
  4447. #define USART_CTLR1_TXEIE ((uint16_t)0x0080) /* PE Interrupt Enable */
  4448. #define USART_CTLR1_PEIE ((uint16_t)0x0100) /* PE Interrupt Enable */
  4449. #define USART_CTLR1_PS ((uint16_t)0x0200) /* Parity Selection */
  4450. #define USART_CTLR1_PCE ((uint16_t)0x0400) /* Parity Control Enable */
  4451. #define USART_CTLR1_WAKE ((uint16_t)0x0800) /* Wakeup method */
  4452. #define USART_CTLR1_M ((uint16_t)0x1000) /* Word length */
  4453. #define USART_CTLR1_UE ((uint16_t)0x2000) /* USART Enable */
  4454. #define USART_CTLR1_OVER8 ((uint16_t)0x8000) /* USART Oversmapling 8-bits */
  4455. /****************** Bit definition for USART_CTLR2 register *******************/
  4456. #define USART_CTLR2_ADD ((uint16_t)0x000F) /* Address of the USART node */
  4457. #define USART_CTLR2_LBDL ((uint16_t)0x0020) /* LIN Break Detection Length */
  4458. #define USART_CTLR2_LBDIE ((uint16_t)0x0040) /* LIN Break Detection Interrupt Enable */
  4459. #define USART_CTLR2_LBCL ((uint16_t)0x0100) /* Last Bit Clock pulse */
  4460. #define USART_CTLR2_CPHA ((uint16_t)0x0200) /* Clock Phase */
  4461. #define USART_CTLR2_CPOL ((uint16_t)0x0400) /* Clock Polarity */
  4462. #define USART_CTLR2_CLKEN ((uint16_t)0x0800) /* Clock Enable */
  4463. #define USART_CTLR2_STOP ((uint16_t)0x3000) /* STOP[1:0] bits (STOP bits) */
  4464. #define USART_CTLR2_STOP_0 ((uint16_t)0x1000) /* Bit 0 */
  4465. #define USART_CTLR2_STOP_1 ((uint16_t)0x2000) /* Bit 1 */
  4466. #define USART_CTLR2_LINEN ((uint16_t)0x4000) /* LIN mode enable */
  4467. /****************** Bit definition for USART_CTLR3 register *******************/
  4468. #define USART_CTLR3_EIE ((uint16_t)0x0001) /* Error Interrupt Enable */
  4469. #define USART_CTLR3_IREN ((uint16_t)0x0002) /* IrDA mode Enable */
  4470. #define USART_CTLR3_IRLP ((uint16_t)0x0004) /* IrDA Low-Power */
  4471. #define USART_CTLR3_HDSEL ((uint16_t)0x0008) /* Half-Duplex Selection */
  4472. #define USART_CTLR3_NACK ((uint16_t)0x0010) /* Smartcard NACK enable */
  4473. #define USART_CTLR3_SCEN ((uint16_t)0x0020) /* Smartcard mode enable */
  4474. #define USART_CTLR3_DMAR ((uint16_t)0x0040) /* DMA Enable Receiver */
  4475. #define USART_CTLR3_DMAT ((uint16_t)0x0080) /* DMA Enable Transmitter */
  4476. #define USART_CTLR3_RTSE ((uint16_t)0x0100) /* RTS Enable */
  4477. #define USART_CTLR3_CTSE ((uint16_t)0x0200) /* CTS Enable */
  4478. #define USART_CTLR3_CTSIE ((uint16_t)0x0400) /* CTS Interrupt Enable */
  4479. #define USART_CTLR3_ONEBIT ((uint16_t)0x0800) /* One Bit method */
  4480. /****************** Bit definition for USART_GPR register ******************/
  4481. #define USART_GPR_PSC ((uint16_t)0x00FF) /* PSC[7:0] bits (Prescaler value) */
  4482. #define USART_GPR_PSC_0 ((uint16_t)0x0001) /* Bit 0 */
  4483. #define USART_GPR_PSC_1 ((uint16_t)0x0002) /* Bit 1 */
  4484. #define USART_GPR_PSC_2 ((uint16_t)0x0004) /* Bit 2 */
  4485. #define USART_GPR_PSC_3 ((uint16_t)0x0008) /* Bit 3 */
  4486. #define USART_GPR_PSC_4 ((uint16_t)0x0010) /* Bit 4 */
  4487. #define USART_GPR_PSC_5 ((uint16_t)0x0020) /* Bit 5 */
  4488. #define USART_GPR_PSC_6 ((uint16_t)0x0040) /* Bit 6 */
  4489. #define USART_GPR_PSC_7 ((uint16_t)0x0080) /* Bit 7 */
  4490. #define USART_GPR_GT ((uint16_t)0xFF00) /* Guard time value */
  4491. /******************************************************************************/
  4492. /* Window WATCHDOG */
  4493. /******************************************************************************/
  4494. /******************* Bit definition for WWDG_CTLR register ********************/
  4495. #define WWDG_CTLR_T ((uint8_t)0x7F) /* T[6:0] bits (7-Bit counter (MSB to LSB)) */
  4496. #define WWDG_CTLR_T0 ((uint8_t)0x01) /* Bit 0 */
  4497. #define WWDG_CTLR_T1 ((uint8_t)0x02) /* Bit 1 */
  4498. #define WWDG_CTLR_T2 ((uint8_t)0x04) /* Bit 2 */
  4499. #define WWDG_CTLR_T3 ((uint8_t)0x08) /* Bit 3 */
  4500. #define WWDG_CTLR_T4 ((uint8_t)0x10) /* Bit 4 */
  4501. #define WWDG_CTLR_T5 ((uint8_t)0x20) /* Bit 5 */
  4502. #define WWDG_CTLR_T6 ((uint8_t)0x40) /* Bit 6 */
  4503. #define WWDG_CTLR_WDGA ((uint8_t)0x80) /* Activation bit */
  4504. /******************* Bit definition for WWDG_CFGR register *******************/
  4505. #define WWDG_CFGR_W ((uint16_t)0x007F) /* W[6:0] bits (7-bit window value) */
  4506. #define WWDG_CFGR_W0 ((uint16_t)0x0001) /* Bit 0 */
  4507. #define WWDG_CFGR_W1 ((uint16_t)0x0002) /* Bit 1 */
  4508. #define WWDG_CFGR_W2 ((uint16_t)0x0004) /* Bit 2 */
  4509. #define WWDG_CFGR_W3 ((uint16_t)0x0008) /* Bit 3 */
  4510. #define WWDG_CFGR_W4 ((uint16_t)0x0010) /* Bit 4 */
  4511. #define WWDG_CFGR_W5 ((uint16_t)0x0020) /* Bit 5 */
  4512. #define WWDG_CFGR_W6 ((uint16_t)0x0040) /* Bit 6 */
  4513. #define WWDG_CFGR_WDGTB ((uint16_t)0x0180) /* WDGTB[1:0] bits (Timer Base) */
  4514. #define WWDG_CFGR_WDGTB0 ((uint16_t)0x0080) /* Bit 0 */
  4515. #define WWDG_CFGR_WDGTB1 ((uint16_t)0x0100) /* Bit 1 */
  4516. #define WWDG_CFGR_EWI ((uint16_t)0x0200) /* Early Wakeup Interrupt */
  4517. /******************* Bit definition for WWDG_STATR register ********************/
  4518. #define WWDG_STATR_EWIF ((uint8_t)0x01) /* Early Wakeup Interrupt Flag */
  4519. /******************************************************************************/
  4520. /* ENHANCED FUNNCTION */
  4521. /******************************************************************************/
  4522. /**************************** Enhanced register *****************************/
  4523. #define EXTEN_USBD_LS ((uint32_t)0x00000001) /* Bit 0 */
  4524. #define EXTEN_USBD_PU_EN ((uint32_t)0x00000002) /* Bit 1 */
  4525. #define EXTEN_ETH_10M_EN ((uint32_t)0x00000004) /* Bit 2 */
  4526. #define EXTEN_ETH_RGMII_SEL ((uint32_t)0x00000008) /* Bit 3 */
  4527. #define EXTEN_PLL_HSI_PRE ((uint32_t)0x00000010) /* Bit 4 */
  4528. #define EXTEN_LOCKUP_EN ((uint32_t)0x00000040) /* Bit 5 */
  4529. #define EXTEN_LOCKUP_RSTF ((uint32_t)0x00000080) /* Bit 7 */
  4530. #define EXTEN_ULLDO_TRIM ((uint32_t)0x00000300) /* ULLDO_TRIM[1:0] bits */
  4531. #define EXTEN_ULLDO_TRIM0 ((uint32_t)0x00000100) /* Bit 0 */
  4532. #define EXTEN_ULLDO_TRIM1 ((uint32_t)0x00000200) /* Bit 1 */
  4533. #define EXTEN_LDO_TRIM ((uint32_t)0x00000C00) /* LDO_TRIM[1:0] bits */
  4534. #define EXTEN_LDO_TRIM0 ((uint32_t)0x00000400) /* Bit 0 */
  4535. #define EXTEN_LDO_TRIM1 ((uint32_t)0x00000800) /* Bit 1 */
  4536. /******************************************************************************/
  4537. /* DVP */
  4538. /******************************************************************************/
  4539. /******************* Bit definition for DVP_CR0 register ********************/
  4540. #define RB_DVP_ENABLE 0x01 // RW, DVP enable
  4541. #define RB_DVP_V_POLAR 0x02 // RW, DVP VSYNC polarity control: 1 = invert, 0 = not invert
  4542. #define RB_DVP_H_POLAR 0x04 // RW, DVP HSYNC polarity control: 1 = invert, 0 = not invert
  4543. #define RB_DVP_P_POLAR 0x08 // RW, DVP PCLK polarity control: 1 = invert, 0 = not invert
  4544. #define RB_DVP_MSK_DAT_MOD 0x30
  4545. #define RB_DVP_D8_MOD 0x00 // RW, DVP 8bits data mode
  4546. #define RB_DVP_D10_MOD 0x10 // RW, DVP 10bits data mode
  4547. #define RB_DVP_D12_MOD 0x20 // RW, DVP 12bits data mode
  4548. #define RB_DVP_JPEG 0x40 // RW, DVP JPEG mode
  4549. /******************* Bit definition for DVP_CR1 register ********************/
  4550. #define RB_DVP_DMA_EN 0x01 // RW, DVP dma enable
  4551. #define RB_DVP_ALL_CLR 0x02 // RW, DVP all clear, high action
  4552. #define RB_DVP_RCV_CLR 0x04 // RW, DVP receive logic clear, high action
  4553. #define RB_DVP_BUF_TOG 0x08 // RW, DVP bug toggle by software, write 1 to toggle, ignored writing 0
  4554. #define RB_DVP_CM 0x10 // RW, DVP capture mode
  4555. #define RB_DVP_CROP 0x20 // RW, DVP Crop feature enable
  4556. #define RB_DVP_FCRC 0xC0 // RW, DVP frame capture rate control:
  4557. #define DVP_RATE_100P 0x00 //00 = every frame captured (100%)
  4558. #define DVP_RATE_50P 0x40 //01 = every alternate frame captured (50%)
  4559. #define DVP_RATE_25P 0x80 //10 = one frame in four frame captured (25%)
  4560. /******************* Bit definition for DVP_IER register ********************/
  4561. #define RB_DVP_IE_STR_FRM 0x01 // RW, DVP frame start interrupt enable
  4562. #define RB_DVP_IE_ROW_DONE 0x02 // RW, DVP row received done interrupt enable
  4563. #define RB_DVP_IE_FRM_DONE 0x04 // RW, DVP frame received done interrupt enable
  4564. #define RB_DVP_IE_FIFO_OV 0x08 // RW, DVP receive fifo overflow interrupt enable
  4565. #define RB_DVP_IE_STP_FRM 0x10 // RW, DVP frame stop interrupt enable
  4566. /******************* Bit definition for DVP_IFR register ********************/
  4567. #define RB_DVP_IF_STR_FRM 0x01 // RW1, interrupt flag for DVP frame start
  4568. #define RB_DVP_IF_ROW_DONE 0x02 // RW1, interrupt flag for DVP row receive done
  4569. #define RB_DVP_IF_FRM_DONE 0x04 // RW1, interrupt flag for DVP frame receive done
  4570. #define RB_DVP_IF_FIFO_OV 0x08 // RW1, interrupt flag for DVP receive fifo overflow
  4571. #define RB_DVP_IF_STP_FRM 0x10 // RW1, interrupt flag for DVP frame stop
  4572. /******************* Bit definition for DVP_STATUS register ********************/
  4573. #define RB_DVP_FIFO_RDY 0x01 // RO, DVP receive fifo ready
  4574. #define RB_DVP_FIFO_FULL 0x02 // RO, DVP receive fifo full
  4575. #define RB_DVP_FIFO_OV 0x04 // RO, DVP receive fifo overflow
  4576. #define RB_DVP_MSK_FIFO_CNT 0x70 // RO, DVP receive fifo count
  4577. #include "ch32v30x_conf.h"
  4578. #ifdef __cplusplus
  4579. }
  4580. #endif
  4581. #endif