MK64F12_uart.h 195 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933
  1. /*
  2. * Copyright (c) 2014, Freescale Semiconductor, Inc.
  3. * All rights reserved.
  4. *
  5. * THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
  6. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  7. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
  8. * SHALL FREESCALE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  9. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
  10. * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  11. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  12. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  13. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  14. * OF SUCH DAMAGE.
  15. */
  16. /*
  17. * WARNING! DO NOT EDIT THIS FILE DIRECTLY!
  18. *
  19. * This file was generated automatically and any changes may be lost.
  20. */
  21. #ifndef __HW_UART_REGISTERS_H__
  22. #define __HW_UART_REGISTERS_H__
  23. #include "regs.h"
  24. /*
  25. * MK64F12 UART
  26. *
  27. * Serial Communication Interface
  28. *
  29. * Registers defined in this header file:
  30. * - HW_UART_BDH - UART Baud Rate Registers: High
  31. * - HW_UART_BDL - UART Baud Rate Registers: Low
  32. * - HW_UART_C1 - UART Control Register 1
  33. * - HW_UART_C2 - UART Control Register 2
  34. * - HW_UART_S1 - UART Status Register 1
  35. * - HW_UART_S2 - UART Status Register 2
  36. * - HW_UART_C3 - UART Control Register 3
  37. * - HW_UART_D - UART Data Register
  38. * - HW_UART_MA1 - UART Match Address Registers 1
  39. * - HW_UART_MA2 - UART Match Address Registers 2
  40. * - HW_UART_C4 - UART Control Register 4
  41. * - HW_UART_C5 - UART Control Register 5
  42. * - HW_UART_ED - UART Extended Data Register
  43. * - HW_UART_MODEM - UART Modem Register
  44. * - HW_UART_IR - UART Infrared Register
  45. * - HW_UART_PFIFO - UART FIFO Parameters
  46. * - HW_UART_CFIFO - UART FIFO Control Register
  47. * - HW_UART_SFIFO - UART FIFO Status Register
  48. * - HW_UART_TWFIFO - UART FIFO Transmit Watermark
  49. * - HW_UART_TCFIFO - UART FIFO Transmit Count
  50. * - HW_UART_RWFIFO - UART FIFO Receive Watermark
  51. * - HW_UART_RCFIFO - UART FIFO Receive Count
  52. * - HW_UART_C7816 - UART 7816 Control Register
  53. * - HW_UART_IE7816 - UART 7816 Interrupt Enable Register
  54. * - HW_UART_IS7816 - UART 7816 Interrupt Status Register
  55. * - HW_UART_WP7816_T_TYPE0 - UART 7816 Wait Parameter Register
  56. * - HW_UART_WP7816_T_TYPE1 - UART 7816 Wait Parameter Register
  57. * - HW_UART_WN7816 - UART 7816 Wait N Register
  58. * - HW_UART_WF7816 - UART 7816 Wait FD Register
  59. * - HW_UART_ET7816 - UART 7816 Error Threshold Register
  60. * - HW_UART_TL7816 - UART 7816 Transmit Length Register
  61. *
  62. * - hw_uart_t - Struct containing all module registers.
  63. */
  64. //! @name Module base addresses
  65. //@{
  66. #ifndef REGS_UART_BASE
  67. #define HW_UART_INSTANCE_COUNT (6U) //!< Number of instances of the UART module.
  68. #define HW_UART0 (0U) //!< Instance number for UART0.
  69. #define HW_UART1 (1U) //!< Instance number for UART1.
  70. #define HW_UART2 (2U) //!< Instance number for UART2.
  71. #define HW_UART3 (3U) //!< Instance number for UART3.
  72. #define HW_UART4 (4U) //!< Instance number for UART4.
  73. #define HW_UART5 (5U) //!< Instance number for UART5.
  74. #define REGS_UART0_BASE (0x4006A000U) //!< Base address for UART0.
  75. #define REGS_UART1_BASE (0x4006B000U) //!< Base address for UART1.
  76. #define REGS_UART2_BASE (0x4006C000U) //!< Base address for UART2.
  77. #define REGS_UART3_BASE (0x4006D000U) //!< Base address for UART3.
  78. #define REGS_UART4_BASE (0x400EA000U) //!< Base address for UART4.
  79. #define REGS_UART5_BASE (0x400EB000U) //!< Base address for UART5.
  80. //! @brief Table of base addresses for UART instances.
  81. static const uint32_t __g_regs_UART_base_addresses[] = {
  82. REGS_UART0_BASE,
  83. REGS_UART1_BASE,
  84. REGS_UART2_BASE,
  85. REGS_UART3_BASE,
  86. REGS_UART4_BASE,
  87. REGS_UART5_BASE,
  88. };
  89. //! @brief Get the base address of UART by instance number.
  90. //! @param x UART instance number, from 0 through 5.
  91. #define REGS_UART_BASE(x) (__g_regs_UART_base_addresses[(x)])
  92. //! @brief Get the instance number given a base address.
  93. //! @param b Base address for an instance of UART.
  94. #define REGS_UART_INSTANCE(b) ((b) == REGS_UART0_BASE ? HW_UART0 : (b) == REGS_UART1_BASE ? HW_UART1 : (b) == REGS_UART2_BASE ? HW_UART2 : (b) == REGS_UART3_BASE ? HW_UART3 : (b) == REGS_UART4_BASE ? HW_UART4 : (b) == REGS_UART5_BASE ? HW_UART5 : 0)
  95. #endif
  96. //@}
  97. //-------------------------------------------------------------------------------------------
  98. // HW_UART_BDH - UART Baud Rate Registers: High
  99. //-------------------------------------------------------------------------------------------
  100. #ifndef __LANGUAGE_ASM__
  101. /*!
  102. * @brief HW_UART_BDH - UART Baud Rate Registers: High (RW)
  103. *
  104. * Reset value: 0x00U
  105. *
  106. * This register, along with the BDL register, controls the prescale divisor for
  107. * UART baud rate generation. To update the 13-bit baud rate setting
  108. * (SBR[12:0]), first write to BDH to buffer the high half of the new value and then write
  109. * to BDL. The working value in BDH does not change until BDL is written. BDL is
  110. * reset to a nonzero value, but after reset, the baud rate generator remains
  111. * disabled until the first time the receiver or transmitter is enabled, that is,
  112. * when C2[RE] or C2[TE] is set.
  113. */
  114. typedef union _hw_uart_bdh
  115. {
  116. uint8_t U;
  117. struct _hw_uart_bdh_bitfields
  118. {
  119. uint8_t SBR : 5; //!< [4:0] UART Baud Rate Bits
  120. uint8_t SBNS : 1; //!< [5] Stop Bit Number Select
  121. uint8_t RXEDGIE : 1; //!< [6] RxD Input Active Edge Interrupt Enable
  122. uint8_t LBKDIE : 1; //!< [7] LIN Break Detect Interrupt or DMA
  123. //! Request Enable
  124. } B;
  125. } hw_uart_bdh_t;
  126. #endif
  127. /*!
  128. * @name Constants and macros for entire UART_BDH register
  129. */
  130. //@{
  131. #define HW_UART_BDH_ADDR(x) (REGS_UART_BASE(x) + 0x0U)
  132. #ifndef __LANGUAGE_ASM__
  133. #define HW_UART_BDH(x) (*(__IO hw_uart_bdh_t *) HW_UART_BDH_ADDR(x))
  134. #define HW_UART_BDH_RD(x) (HW_UART_BDH(x).U)
  135. #define HW_UART_BDH_WR(x, v) (HW_UART_BDH(x).U = (v))
  136. #define HW_UART_BDH_SET(x, v) (HW_UART_BDH_WR(x, HW_UART_BDH_RD(x) | (v)))
  137. #define HW_UART_BDH_CLR(x, v) (HW_UART_BDH_WR(x, HW_UART_BDH_RD(x) & ~(v)))
  138. #define HW_UART_BDH_TOG(x, v) (HW_UART_BDH_WR(x, HW_UART_BDH_RD(x) ^ (v)))
  139. #endif
  140. //@}
  141. /*
  142. * Constants & macros for individual UART_BDH bitfields
  143. */
  144. /*!
  145. * @name Register UART_BDH, field SBR[4:0] (RW)
  146. *
  147. * The baud rate for the UART is determined by the 13 SBR fields. See Baud rate
  148. * generation for details. The baud rate generator is disabled until C2[TE] or
  149. * C2[RE] is set for the first time after reset.The baud rate generator is disabled
  150. * when SBR = 0. Writing to BDH has no effect without writing to BDL, because
  151. * writing to BDH puts the data in a temporary location until BDL is written.
  152. */
  153. //@{
  154. #define BP_UART_BDH_SBR (0U) //!< Bit position for UART_BDH_SBR.
  155. #define BM_UART_BDH_SBR (0x1FU) //!< Bit mask for UART_BDH_SBR.
  156. #define BS_UART_BDH_SBR (5U) //!< Bit field size in bits for UART_BDH_SBR.
  157. #ifndef __LANGUAGE_ASM__
  158. //! @brief Read current value of the UART_BDH_SBR field.
  159. #define BR_UART_BDH_SBR(x) (HW_UART_BDH(x).B.SBR)
  160. #endif
  161. //! @brief Format value for bitfield UART_BDH_SBR.
  162. #define BF_UART_BDH_SBR(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_BDH_SBR), uint8_t) & BM_UART_BDH_SBR)
  163. #ifndef __LANGUAGE_ASM__
  164. //! @brief Set the SBR field to a new value.
  165. #define BW_UART_BDH_SBR(x, v) (HW_UART_BDH_WR(x, (HW_UART_BDH_RD(x) & ~BM_UART_BDH_SBR) | BF_UART_BDH_SBR(v)))
  166. #endif
  167. //@}
  168. /*!
  169. * @name Register UART_BDH, field SBNS[5] (RW)
  170. *
  171. * SBNS selects the number of stop bits present in a data frame. This field
  172. * valid for all 8, 9 and 10 bit data formats available. This field is not valid when
  173. * C7816[ISO7816E] is enabled.
  174. *
  175. * Values:
  176. * - 0 - Data frame consists of a single stop bit.
  177. * - 1 - Data frame consists of two stop bits.
  178. */
  179. //@{
  180. #define BP_UART_BDH_SBNS (5U) //!< Bit position for UART_BDH_SBNS.
  181. #define BM_UART_BDH_SBNS (0x20U) //!< Bit mask for UART_BDH_SBNS.
  182. #define BS_UART_BDH_SBNS (1U) //!< Bit field size in bits for UART_BDH_SBNS.
  183. #ifndef __LANGUAGE_ASM__
  184. //! @brief Read current value of the UART_BDH_SBNS field.
  185. #define BR_UART_BDH_SBNS(x) (BITBAND_ACCESS8(HW_UART_BDH_ADDR(x), BP_UART_BDH_SBNS))
  186. #endif
  187. //! @brief Format value for bitfield UART_BDH_SBNS.
  188. #define BF_UART_BDH_SBNS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_BDH_SBNS), uint8_t) & BM_UART_BDH_SBNS)
  189. #ifndef __LANGUAGE_ASM__
  190. //! @brief Set the SBNS field to a new value.
  191. #define BW_UART_BDH_SBNS(x, v) (BITBAND_ACCESS8(HW_UART_BDH_ADDR(x), BP_UART_BDH_SBNS) = (v))
  192. #endif
  193. //@}
  194. /*!
  195. * @name Register UART_BDH, field RXEDGIE[6] (RW)
  196. *
  197. * Enables the receive input active edge, RXEDGIF, to generate interrupt
  198. * requests.
  199. *
  200. * Values:
  201. * - 0 - Hardware interrupts from RXEDGIF disabled using polling.
  202. * - 1 - RXEDGIF interrupt request enabled.
  203. */
  204. //@{
  205. #define BP_UART_BDH_RXEDGIE (6U) //!< Bit position for UART_BDH_RXEDGIE.
  206. #define BM_UART_BDH_RXEDGIE (0x40U) //!< Bit mask for UART_BDH_RXEDGIE.
  207. #define BS_UART_BDH_RXEDGIE (1U) //!< Bit field size in bits for UART_BDH_RXEDGIE.
  208. #ifndef __LANGUAGE_ASM__
  209. //! @brief Read current value of the UART_BDH_RXEDGIE field.
  210. #define BR_UART_BDH_RXEDGIE(x) (BITBAND_ACCESS8(HW_UART_BDH_ADDR(x), BP_UART_BDH_RXEDGIE))
  211. #endif
  212. //! @brief Format value for bitfield UART_BDH_RXEDGIE.
  213. #define BF_UART_BDH_RXEDGIE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_BDH_RXEDGIE), uint8_t) & BM_UART_BDH_RXEDGIE)
  214. #ifndef __LANGUAGE_ASM__
  215. //! @brief Set the RXEDGIE field to a new value.
  216. #define BW_UART_BDH_RXEDGIE(x, v) (BITBAND_ACCESS8(HW_UART_BDH_ADDR(x), BP_UART_BDH_RXEDGIE) = (v))
  217. #endif
  218. //@}
  219. /*!
  220. * @name Register UART_BDH, field LBKDIE[7] (RW)
  221. *
  222. * Enables the LIN break detect flag, LBKDIF, to generate interrupt requests
  223. * based on the state of LBKDDMAS. or DMA transfer requests,
  224. *
  225. * Values:
  226. * - 0 - LBKDIF interrupt and DMA transfer requests disabled.
  227. * - 1 - LBKDIF interrupt or DMA transfer requests enabled.
  228. */
  229. //@{
  230. #define BP_UART_BDH_LBKDIE (7U) //!< Bit position for UART_BDH_LBKDIE.
  231. #define BM_UART_BDH_LBKDIE (0x80U) //!< Bit mask for UART_BDH_LBKDIE.
  232. #define BS_UART_BDH_LBKDIE (1U) //!< Bit field size in bits for UART_BDH_LBKDIE.
  233. #ifndef __LANGUAGE_ASM__
  234. //! @brief Read current value of the UART_BDH_LBKDIE field.
  235. #define BR_UART_BDH_LBKDIE(x) (BITBAND_ACCESS8(HW_UART_BDH_ADDR(x), BP_UART_BDH_LBKDIE))
  236. #endif
  237. //! @brief Format value for bitfield UART_BDH_LBKDIE.
  238. #define BF_UART_BDH_LBKDIE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_BDH_LBKDIE), uint8_t) & BM_UART_BDH_LBKDIE)
  239. #ifndef __LANGUAGE_ASM__
  240. //! @brief Set the LBKDIE field to a new value.
  241. #define BW_UART_BDH_LBKDIE(x, v) (BITBAND_ACCESS8(HW_UART_BDH_ADDR(x), BP_UART_BDH_LBKDIE) = (v))
  242. #endif
  243. //@}
  244. //-------------------------------------------------------------------------------------------
  245. // HW_UART_BDL - UART Baud Rate Registers: Low
  246. //-------------------------------------------------------------------------------------------
  247. #ifndef __LANGUAGE_ASM__
  248. /*!
  249. * @brief HW_UART_BDL - UART Baud Rate Registers: Low (RW)
  250. *
  251. * Reset value: 0x04U
  252. *
  253. * This register, along with the BDH register, controls the prescale divisor for
  254. * UART baud rate generation. To update the 13-bit baud rate setting, SBR[12:0],
  255. * first write to BDH to buffer the high half of the new value and then write to
  256. * BDL. The working value in BDH does not change until BDL is written. BDL is
  257. * reset to a nonzero value, but after reset, the baud rate generator remains
  258. * disabled until the first time the receiver or transmitter is enabled, that is, when
  259. * C2[RE] or C2[TE] is set.
  260. */
  261. typedef union _hw_uart_bdl
  262. {
  263. uint8_t U;
  264. struct _hw_uart_bdl_bitfields
  265. {
  266. uint8_t SBR : 8; //!< [7:0] UART Baud Rate Bits
  267. } B;
  268. } hw_uart_bdl_t;
  269. #endif
  270. /*!
  271. * @name Constants and macros for entire UART_BDL register
  272. */
  273. //@{
  274. #define HW_UART_BDL_ADDR(x) (REGS_UART_BASE(x) + 0x1U)
  275. #ifndef __LANGUAGE_ASM__
  276. #define HW_UART_BDL(x) (*(__IO hw_uart_bdl_t *) HW_UART_BDL_ADDR(x))
  277. #define HW_UART_BDL_RD(x) (HW_UART_BDL(x).U)
  278. #define HW_UART_BDL_WR(x, v) (HW_UART_BDL(x).U = (v))
  279. #define HW_UART_BDL_SET(x, v) (HW_UART_BDL_WR(x, HW_UART_BDL_RD(x) | (v)))
  280. #define HW_UART_BDL_CLR(x, v) (HW_UART_BDL_WR(x, HW_UART_BDL_RD(x) & ~(v)))
  281. #define HW_UART_BDL_TOG(x, v) (HW_UART_BDL_WR(x, HW_UART_BDL_RD(x) ^ (v)))
  282. #endif
  283. //@}
  284. /*
  285. * Constants & macros for individual UART_BDL bitfields
  286. */
  287. /*!
  288. * @name Register UART_BDL, field SBR[7:0] (RW)
  289. *
  290. * The baud rate for the UART is determined by the 13 SBR fields. See Baud rate
  291. * generation for details. The baud rate generator is disabled until C2[TE] or
  292. * C2[RE] is set for the first time after reset.The baud rate generator is disabled
  293. * when SBR = 0. Writing to BDH has no effect without writing to BDL, because
  294. * writing to BDH puts the data in a temporary location until BDL is written. When
  295. * the 1/32 narrow pulse width is selected for infrared (IrDA), the baud rate
  296. * fields must be even, the least significant bit is 0. See MODEM register for more
  297. * details.
  298. */
  299. //@{
  300. #define BP_UART_BDL_SBR (0U) //!< Bit position for UART_BDL_SBR.
  301. #define BM_UART_BDL_SBR (0xFFU) //!< Bit mask for UART_BDL_SBR.
  302. #define BS_UART_BDL_SBR (8U) //!< Bit field size in bits for UART_BDL_SBR.
  303. #ifndef __LANGUAGE_ASM__
  304. //! @brief Read current value of the UART_BDL_SBR field.
  305. #define BR_UART_BDL_SBR(x) (HW_UART_BDL(x).U)
  306. #endif
  307. //! @brief Format value for bitfield UART_BDL_SBR.
  308. #define BF_UART_BDL_SBR(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_BDL_SBR), uint8_t) & BM_UART_BDL_SBR)
  309. #ifndef __LANGUAGE_ASM__
  310. //! @brief Set the SBR field to a new value.
  311. #define BW_UART_BDL_SBR(x, v) (HW_UART_BDL_WR(x, v))
  312. #endif
  313. //@}
  314. //-------------------------------------------------------------------------------------------
  315. // HW_UART_C1 - UART Control Register 1
  316. //-------------------------------------------------------------------------------------------
  317. #ifndef __LANGUAGE_ASM__
  318. /*!
  319. * @brief HW_UART_C1 - UART Control Register 1 (RW)
  320. *
  321. * Reset value: 0x00U
  322. *
  323. * This read/write register controls various optional features of the UART
  324. * system.
  325. */
  326. typedef union _hw_uart_c1
  327. {
  328. uint8_t U;
  329. struct _hw_uart_c1_bitfields
  330. {
  331. uint8_t PT : 1; //!< [0] Parity Type
  332. uint8_t PE : 1; //!< [1] Parity Enable
  333. uint8_t ILT : 1; //!< [2] Idle Line Type Select
  334. uint8_t WAKE : 1; //!< [3] Receiver Wakeup Method Select
  335. uint8_t M : 1; //!< [4] 9-bit or 8-bit Mode Select
  336. uint8_t RSRC : 1; //!< [5] Receiver Source Select
  337. uint8_t UARTSWAI : 1; //!< [6] UART Stops in Wait Mode
  338. uint8_t LOOPS : 1; //!< [7] Loop Mode Select
  339. } B;
  340. } hw_uart_c1_t;
  341. #endif
  342. /*!
  343. * @name Constants and macros for entire UART_C1 register
  344. */
  345. //@{
  346. #define HW_UART_C1_ADDR(x) (REGS_UART_BASE(x) + 0x2U)
  347. #ifndef __LANGUAGE_ASM__
  348. #define HW_UART_C1(x) (*(__IO hw_uart_c1_t *) HW_UART_C1_ADDR(x))
  349. #define HW_UART_C1_RD(x) (HW_UART_C1(x).U)
  350. #define HW_UART_C1_WR(x, v) (HW_UART_C1(x).U = (v))
  351. #define HW_UART_C1_SET(x, v) (HW_UART_C1_WR(x, HW_UART_C1_RD(x) | (v)))
  352. #define HW_UART_C1_CLR(x, v) (HW_UART_C1_WR(x, HW_UART_C1_RD(x) & ~(v)))
  353. #define HW_UART_C1_TOG(x, v) (HW_UART_C1_WR(x, HW_UART_C1_RD(x) ^ (v)))
  354. #endif
  355. //@}
  356. /*
  357. * Constants & macros for individual UART_C1 bitfields
  358. */
  359. /*!
  360. * @name Register UART_C1, field PT[0] (RW)
  361. *
  362. * Determines whether the UART generates and checks for even parity or odd
  363. * parity. With even parity, an even number of 1s clears the parity bit and an odd
  364. * number of 1s sets the parity bit. With odd parity, an odd number of 1s clears the
  365. * parity bit and an even number of 1s sets the parity bit. This field must be
  366. * cleared when C7816[ISO_7816E] is set/enabled.
  367. *
  368. * Values:
  369. * - 0 - Even parity.
  370. * - 1 - Odd parity.
  371. */
  372. //@{
  373. #define BP_UART_C1_PT (0U) //!< Bit position for UART_C1_PT.
  374. #define BM_UART_C1_PT (0x01U) //!< Bit mask for UART_C1_PT.
  375. #define BS_UART_C1_PT (1U) //!< Bit field size in bits for UART_C1_PT.
  376. #ifndef __LANGUAGE_ASM__
  377. //! @brief Read current value of the UART_C1_PT field.
  378. #define BR_UART_C1_PT(x) (BITBAND_ACCESS8(HW_UART_C1_ADDR(x), BP_UART_C1_PT))
  379. #endif
  380. //! @brief Format value for bitfield UART_C1_PT.
  381. #define BF_UART_C1_PT(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C1_PT), uint8_t) & BM_UART_C1_PT)
  382. #ifndef __LANGUAGE_ASM__
  383. //! @brief Set the PT field to a new value.
  384. #define BW_UART_C1_PT(x, v) (BITBAND_ACCESS8(HW_UART_C1_ADDR(x), BP_UART_C1_PT) = (v))
  385. #endif
  386. //@}
  387. /*!
  388. * @name Register UART_C1, field PE[1] (RW)
  389. *
  390. * Enables the parity function. When parity is enabled, parity function inserts
  391. * a parity bit in the bit position immediately preceding the stop bit. This
  392. * field must be set when C7816[ISO_7816E] is set/enabled.
  393. *
  394. * Values:
  395. * - 0 - Parity function disabled.
  396. * - 1 - Parity function enabled.
  397. */
  398. //@{
  399. #define BP_UART_C1_PE (1U) //!< Bit position for UART_C1_PE.
  400. #define BM_UART_C1_PE (0x02U) //!< Bit mask for UART_C1_PE.
  401. #define BS_UART_C1_PE (1U) //!< Bit field size in bits for UART_C1_PE.
  402. #ifndef __LANGUAGE_ASM__
  403. //! @brief Read current value of the UART_C1_PE field.
  404. #define BR_UART_C1_PE(x) (BITBAND_ACCESS8(HW_UART_C1_ADDR(x), BP_UART_C1_PE))
  405. #endif
  406. //! @brief Format value for bitfield UART_C1_PE.
  407. #define BF_UART_C1_PE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C1_PE), uint8_t) & BM_UART_C1_PE)
  408. #ifndef __LANGUAGE_ASM__
  409. //! @brief Set the PE field to a new value.
  410. #define BW_UART_C1_PE(x, v) (BITBAND_ACCESS8(HW_UART_C1_ADDR(x), BP_UART_C1_PE) = (v))
  411. #endif
  412. //@}
  413. /*!
  414. * @name Register UART_C1, field ILT[2] (RW)
  415. *
  416. * Determines when the receiver starts counting logic 1s as idle character bits.
  417. * The count begins either after a valid start bit or after the stop bit. If the
  418. * count begins after the start bit, then a string of logic 1s preceding the
  419. * stop bit can cause false recognition of an idle character. Beginning the count
  420. * after the stop bit avoids false idle character recognition, but requires
  421. * properly synchronized transmissions. In case the UART is programmed with ILT = 1, a
  422. * logic of 1'b0 is automatically shifted after a received stop bit, therefore
  423. * resetting the idle count. In case the UART is programmed for IDLE line wakeup
  424. * (RWU = 1 and WAKE = 0), ILT has no effect on when the receiver starts counting
  425. * logic 1s as idle character bits. In idle line wakeup, an idle character is
  426. * recognized at anytime the receiver sees 10, 11, or 12 1s depending on the M, PE,
  427. * and C4[M10] fields.
  428. *
  429. * Values:
  430. * - 0 - Idle character bit count starts after start bit.
  431. * - 1 - Idle character bit count starts after stop bit.
  432. */
  433. //@{
  434. #define BP_UART_C1_ILT (2U) //!< Bit position for UART_C1_ILT.
  435. #define BM_UART_C1_ILT (0x04U) //!< Bit mask for UART_C1_ILT.
  436. #define BS_UART_C1_ILT (1U) //!< Bit field size in bits for UART_C1_ILT.
  437. #ifndef __LANGUAGE_ASM__
  438. //! @brief Read current value of the UART_C1_ILT field.
  439. #define BR_UART_C1_ILT(x) (BITBAND_ACCESS8(HW_UART_C1_ADDR(x), BP_UART_C1_ILT))
  440. #endif
  441. //! @brief Format value for bitfield UART_C1_ILT.
  442. #define BF_UART_C1_ILT(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C1_ILT), uint8_t) & BM_UART_C1_ILT)
  443. #ifndef __LANGUAGE_ASM__
  444. //! @brief Set the ILT field to a new value.
  445. #define BW_UART_C1_ILT(x, v) (BITBAND_ACCESS8(HW_UART_C1_ADDR(x), BP_UART_C1_ILT) = (v))
  446. #endif
  447. //@}
  448. /*!
  449. * @name Register UART_C1, field WAKE[3] (RW)
  450. *
  451. * Determines which condition wakes the UART: Address mark in the most
  452. * significant bit position of a received data character, or An idle condition on the
  453. * receive pin input signal.
  454. *
  455. * Values:
  456. * - 0 - Idle line wakeup.
  457. * - 1 - Address mark wakeup.
  458. */
  459. //@{
  460. #define BP_UART_C1_WAKE (3U) //!< Bit position for UART_C1_WAKE.
  461. #define BM_UART_C1_WAKE (0x08U) //!< Bit mask for UART_C1_WAKE.
  462. #define BS_UART_C1_WAKE (1U) //!< Bit field size in bits for UART_C1_WAKE.
  463. #ifndef __LANGUAGE_ASM__
  464. //! @brief Read current value of the UART_C1_WAKE field.
  465. #define BR_UART_C1_WAKE(x) (BITBAND_ACCESS8(HW_UART_C1_ADDR(x), BP_UART_C1_WAKE))
  466. #endif
  467. //! @brief Format value for bitfield UART_C1_WAKE.
  468. #define BF_UART_C1_WAKE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C1_WAKE), uint8_t) & BM_UART_C1_WAKE)
  469. #ifndef __LANGUAGE_ASM__
  470. //! @brief Set the WAKE field to a new value.
  471. #define BW_UART_C1_WAKE(x, v) (BITBAND_ACCESS8(HW_UART_C1_ADDR(x), BP_UART_C1_WAKE) = (v))
  472. #endif
  473. //@}
  474. /*!
  475. * @name Register UART_C1, field M[4] (RW)
  476. *
  477. * This field must be set when C7816[ISO_7816E] is set/enabled.
  478. *
  479. * Values:
  480. * - 0 - Normal-start + 8 data bits (MSB/LSB first as determined by MSBF) + stop.
  481. * - 1 - Use-start + 9 data bits (MSB/LSB first as determined by MSBF) + stop.
  482. */
  483. //@{
  484. #define BP_UART_C1_M (4U) //!< Bit position for UART_C1_M.
  485. #define BM_UART_C1_M (0x10U) //!< Bit mask for UART_C1_M.
  486. #define BS_UART_C1_M (1U) //!< Bit field size in bits for UART_C1_M.
  487. #ifndef __LANGUAGE_ASM__
  488. //! @brief Read current value of the UART_C1_M field.
  489. #define BR_UART_C1_M(x) (BITBAND_ACCESS8(HW_UART_C1_ADDR(x), BP_UART_C1_M))
  490. #endif
  491. //! @brief Format value for bitfield UART_C1_M.
  492. #define BF_UART_C1_M(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C1_M), uint8_t) & BM_UART_C1_M)
  493. #ifndef __LANGUAGE_ASM__
  494. //! @brief Set the M field to a new value.
  495. #define BW_UART_C1_M(x, v) (BITBAND_ACCESS8(HW_UART_C1_ADDR(x), BP_UART_C1_M) = (v))
  496. #endif
  497. //@}
  498. /*!
  499. * @name Register UART_C1, field RSRC[5] (RW)
  500. *
  501. * This field has no meaning or effect unless the LOOPS field is set. When LOOPS
  502. * is set, the RSRC field determines the source for the receiver shift register
  503. * input.
  504. *
  505. * Values:
  506. * - 0 - Selects internal loop back mode. The receiver input is internally
  507. * connected to transmitter output.
  508. * - 1 - Single wire UART mode where the receiver input is connected to the
  509. * transmit pin input signal.
  510. */
  511. //@{
  512. #define BP_UART_C1_RSRC (5U) //!< Bit position for UART_C1_RSRC.
  513. #define BM_UART_C1_RSRC (0x20U) //!< Bit mask for UART_C1_RSRC.
  514. #define BS_UART_C1_RSRC (1U) //!< Bit field size in bits for UART_C1_RSRC.
  515. #ifndef __LANGUAGE_ASM__
  516. //! @brief Read current value of the UART_C1_RSRC field.
  517. #define BR_UART_C1_RSRC(x) (BITBAND_ACCESS8(HW_UART_C1_ADDR(x), BP_UART_C1_RSRC))
  518. #endif
  519. //! @brief Format value for bitfield UART_C1_RSRC.
  520. #define BF_UART_C1_RSRC(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C1_RSRC), uint8_t) & BM_UART_C1_RSRC)
  521. #ifndef __LANGUAGE_ASM__
  522. //! @brief Set the RSRC field to a new value.
  523. #define BW_UART_C1_RSRC(x, v) (BITBAND_ACCESS8(HW_UART_C1_ADDR(x), BP_UART_C1_RSRC) = (v))
  524. #endif
  525. //@}
  526. /*!
  527. * @name Register UART_C1, field UARTSWAI[6] (RW)
  528. *
  529. * Values:
  530. * - 0 - UART clock continues to run in Wait mode.
  531. * - 1 - UART clock freezes while CPU is in Wait mode.
  532. */
  533. //@{
  534. #define BP_UART_C1_UARTSWAI (6U) //!< Bit position for UART_C1_UARTSWAI.
  535. #define BM_UART_C1_UARTSWAI (0x40U) //!< Bit mask for UART_C1_UARTSWAI.
  536. #define BS_UART_C1_UARTSWAI (1U) //!< Bit field size in bits for UART_C1_UARTSWAI.
  537. #ifndef __LANGUAGE_ASM__
  538. //! @brief Read current value of the UART_C1_UARTSWAI field.
  539. #define BR_UART_C1_UARTSWAI(x) (BITBAND_ACCESS8(HW_UART_C1_ADDR(x), BP_UART_C1_UARTSWAI))
  540. #endif
  541. //! @brief Format value for bitfield UART_C1_UARTSWAI.
  542. #define BF_UART_C1_UARTSWAI(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C1_UARTSWAI), uint8_t) & BM_UART_C1_UARTSWAI)
  543. #ifndef __LANGUAGE_ASM__
  544. //! @brief Set the UARTSWAI field to a new value.
  545. #define BW_UART_C1_UARTSWAI(x, v) (BITBAND_ACCESS8(HW_UART_C1_ADDR(x), BP_UART_C1_UARTSWAI) = (v))
  546. #endif
  547. //@}
  548. /*!
  549. * @name Register UART_C1, field LOOPS[7] (RW)
  550. *
  551. * When LOOPS is set, the RxD pin is disconnected from the UART and the
  552. * transmitter output is internally connected to the receiver input. The transmitter and
  553. * the receiver must be enabled to use the loop function.
  554. *
  555. * Values:
  556. * - 0 - Normal operation.
  557. * - 1 - Loop mode where transmitter output is internally connected to receiver
  558. * input. The receiver input is determined by RSRC.
  559. */
  560. //@{
  561. #define BP_UART_C1_LOOPS (7U) //!< Bit position for UART_C1_LOOPS.
  562. #define BM_UART_C1_LOOPS (0x80U) //!< Bit mask for UART_C1_LOOPS.
  563. #define BS_UART_C1_LOOPS (1U) //!< Bit field size in bits for UART_C1_LOOPS.
  564. #ifndef __LANGUAGE_ASM__
  565. //! @brief Read current value of the UART_C1_LOOPS field.
  566. #define BR_UART_C1_LOOPS(x) (BITBAND_ACCESS8(HW_UART_C1_ADDR(x), BP_UART_C1_LOOPS))
  567. #endif
  568. //! @brief Format value for bitfield UART_C1_LOOPS.
  569. #define BF_UART_C1_LOOPS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C1_LOOPS), uint8_t) & BM_UART_C1_LOOPS)
  570. #ifndef __LANGUAGE_ASM__
  571. //! @brief Set the LOOPS field to a new value.
  572. #define BW_UART_C1_LOOPS(x, v) (BITBAND_ACCESS8(HW_UART_C1_ADDR(x), BP_UART_C1_LOOPS) = (v))
  573. #endif
  574. //@}
  575. //-------------------------------------------------------------------------------------------
  576. // HW_UART_C2 - UART Control Register 2
  577. //-------------------------------------------------------------------------------------------
  578. #ifndef __LANGUAGE_ASM__
  579. /*!
  580. * @brief HW_UART_C2 - UART Control Register 2 (RW)
  581. *
  582. * Reset value: 0x00U
  583. *
  584. * This register can be read or written at any time.
  585. */
  586. typedef union _hw_uart_c2
  587. {
  588. uint8_t U;
  589. struct _hw_uart_c2_bitfields
  590. {
  591. uint8_t SBK : 1; //!< [0] Send Break
  592. uint8_t RWU : 1; //!< [1] Receiver Wakeup Control
  593. uint8_t RE : 1; //!< [2] Receiver Enable
  594. uint8_t TE : 1; //!< [3] Transmitter Enable
  595. uint8_t ILIE : 1; //!< [4] Idle Line Interrupt DMA Transfer Enable
  596. uint8_t RIE : 1; //!< [5] Receiver Full Interrupt or DMA Transfer
  597. //! Enable
  598. uint8_t TCIE : 1; //!< [6] Transmission Complete Interrupt or DMA
  599. //! Transfer Enable
  600. uint8_t TIE : 1; //!< [7] Transmitter Interrupt or DMA Transfer
  601. //! Enable.
  602. } B;
  603. } hw_uart_c2_t;
  604. #endif
  605. /*!
  606. * @name Constants and macros for entire UART_C2 register
  607. */
  608. //@{
  609. #define HW_UART_C2_ADDR(x) (REGS_UART_BASE(x) + 0x3U)
  610. #ifndef __LANGUAGE_ASM__
  611. #define HW_UART_C2(x) (*(__IO hw_uart_c2_t *) HW_UART_C2_ADDR(x))
  612. #define HW_UART_C2_RD(x) (HW_UART_C2(x).U)
  613. #define HW_UART_C2_WR(x, v) (HW_UART_C2(x).U = (v))
  614. #define HW_UART_C2_SET(x, v) (HW_UART_C2_WR(x, HW_UART_C2_RD(x) | (v)))
  615. #define HW_UART_C2_CLR(x, v) (HW_UART_C2_WR(x, HW_UART_C2_RD(x) & ~(v)))
  616. #define HW_UART_C2_TOG(x, v) (HW_UART_C2_WR(x, HW_UART_C2_RD(x) ^ (v)))
  617. #endif
  618. //@}
  619. /*
  620. * Constants & macros for individual UART_C2 bitfields
  621. */
  622. /*!
  623. * @name Register UART_C2, field SBK[0] (RW)
  624. *
  625. * Toggling SBK sends one break character from the following: See Transmitting
  626. * break characters for the number of logic 0s for the different configurations.
  627. * Toggling implies clearing the SBK field before the break character has finished
  628. * transmitting. As long as SBK is set, the transmitter continues to send
  629. * complete break characters (10, 11, or 12 bits, or 13 or 14 bits, or 15 or 16 bits).
  630. * Ensure that C2[TE] is asserted atleast 1 clock before assertion of this bit.
  631. * 10, 11, or 12 logic 0s if S2[BRK13] is cleared 13 or 14 logic 0s if S2[BRK13]
  632. * is set. 15 or 16 logic 0s if BDH[SBNS] is set. This field must be cleared when
  633. * C7816[ISO_7816E] is set.
  634. *
  635. * Values:
  636. * - 0 - Normal transmitter operation.
  637. * - 1 - Queue break characters to be sent.
  638. */
  639. //@{
  640. #define BP_UART_C2_SBK (0U) //!< Bit position for UART_C2_SBK.
  641. #define BM_UART_C2_SBK (0x01U) //!< Bit mask for UART_C2_SBK.
  642. #define BS_UART_C2_SBK (1U) //!< Bit field size in bits for UART_C2_SBK.
  643. #ifndef __LANGUAGE_ASM__
  644. //! @brief Read current value of the UART_C2_SBK field.
  645. #define BR_UART_C2_SBK(x) (BITBAND_ACCESS8(HW_UART_C2_ADDR(x), BP_UART_C2_SBK))
  646. #endif
  647. //! @brief Format value for bitfield UART_C2_SBK.
  648. #define BF_UART_C2_SBK(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C2_SBK), uint8_t) & BM_UART_C2_SBK)
  649. #ifndef __LANGUAGE_ASM__
  650. //! @brief Set the SBK field to a new value.
  651. #define BW_UART_C2_SBK(x, v) (BITBAND_ACCESS8(HW_UART_C2_ADDR(x), BP_UART_C2_SBK) = (v))
  652. #endif
  653. //@}
  654. /*!
  655. * @name Register UART_C2, field RWU[1] (RW)
  656. *
  657. * This field can be set to place the UART receiver in a standby state. RWU
  658. * automatically clears when an RWU event occurs, that is, an IDLE event when
  659. * C1[WAKE] is clear or an address match when C1[WAKE] is set. This field must be
  660. * cleared when C7816[ISO_7816E] is set. RWU must be set only with C1[WAKE] = 0 (wakeup
  661. * on idle) if the channel is currently not idle. This can be determined by
  662. * S2[RAF]. If the flag is set to wake up an IDLE event and the channel is already
  663. * idle, it is possible that the UART will discard data. This is because the data
  664. * must be received or a LIN break detected after an IDLE is detected before IDLE
  665. * is allowed to reasserted.
  666. *
  667. * Values:
  668. * - 0 - Normal operation.
  669. * - 1 - RWU enables the wakeup function and inhibits further receiver interrupt
  670. * requests. Normally, hardware wakes the receiver by automatically clearing
  671. * RWU.
  672. */
  673. //@{
  674. #define BP_UART_C2_RWU (1U) //!< Bit position for UART_C2_RWU.
  675. #define BM_UART_C2_RWU (0x02U) //!< Bit mask for UART_C2_RWU.
  676. #define BS_UART_C2_RWU (1U) //!< Bit field size in bits for UART_C2_RWU.
  677. #ifndef __LANGUAGE_ASM__
  678. //! @brief Read current value of the UART_C2_RWU field.
  679. #define BR_UART_C2_RWU(x) (BITBAND_ACCESS8(HW_UART_C2_ADDR(x), BP_UART_C2_RWU))
  680. #endif
  681. //! @brief Format value for bitfield UART_C2_RWU.
  682. #define BF_UART_C2_RWU(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C2_RWU), uint8_t) & BM_UART_C2_RWU)
  683. #ifndef __LANGUAGE_ASM__
  684. //! @brief Set the RWU field to a new value.
  685. #define BW_UART_C2_RWU(x, v) (BITBAND_ACCESS8(HW_UART_C2_ADDR(x), BP_UART_C2_RWU) = (v))
  686. #endif
  687. //@}
  688. /*!
  689. * @name Register UART_C2, field RE[2] (RW)
  690. *
  691. * Enables the UART receiver.
  692. *
  693. * Values:
  694. * - 0 - Receiver off.
  695. * - 1 - Receiver on.
  696. */
  697. //@{
  698. #define BP_UART_C2_RE (2U) //!< Bit position for UART_C2_RE.
  699. #define BM_UART_C2_RE (0x04U) //!< Bit mask for UART_C2_RE.
  700. #define BS_UART_C2_RE (1U) //!< Bit field size in bits for UART_C2_RE.
  701. #ifndef __LANGUAGE_ASM__
  702. //! @brief Read current value of the UART_C2_RE field.
  703. #define BR_UART_C2_RE(x) (BITBAND_ACCESS8(HW_UART_C2_ADDR(x), BP_UART_C2_RE))
  704. #endif
  705. //! @brief Format value for bitfield UART_C2_RE.
  706. #define BF_UART_C2_RE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C2_RE), uint8_t) & BM_UART_C2_RE)
  707. #ifndef __LANGUAGE_ASM__
  708. //! @brief Set the RE field to a new value.
  709. #define BW_UART_C2_RE(x, v) (BITBAND_ACCESS8(HW_UART_C2_ADDR(x), BP_UART_C2_RE) = (v))
  710. #endif
  711. //@}
  712. /*!
  713. * @name Register UART_C2, field TE[3] (RW)
  714. *
  715. * Enables the UART transmitter. TE can be used to queue an idle preamble by
  716. * clearing and then setting TE. When C7816[ISO_7816E] is set/enabled and
  717. * C7816[TTYPE] = 1, this field is automatically cleared after the requested block has been
  718. * transmitted. This condition is detected when TL7816[TLEN] = 0 and four
  719. * additional characters are transmitted.
  720. *
  721. * Values:
  722. * - 0 - Transmitter off.
  723. * - 1 - Transmitter on.
  724. */
  725. //@{
  726. #define BP_UART_C2_TE (3U) //!< Bit position for UART_C2_TE.
  727. #define BM_UART_C2_TE (0x08U) //!< Bit mask for UART_C2_TE.
  728. #define BS_UART_C2_TE (1U) //!< Bit field size in bits for UART_C2_TE.
  729. #ifndef __LANGUAGE_ASM__
  730. //! @brief Read current value of the UART_C2_TE field.
  731. #define BR_UART_C2_TE(x) (BITBAND_ACCESS8(HW_UART_C2_ADDR(x), BP_UART_C2_TE))
  732. #endif
  733. //! @brief Format value for bitfield UART_C2_TE.
  734. #define BF_UART_C2_TE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C2_TE), uint8_t) & BM_UART_C2_TE)
  735. #ifndef __LANGUAGE_ASM__
  736. //! @brief Set the TE field to a new value.
  737. #define BW_UART_C2_TE(x, v) (BITBAND_ACCESS8(HW_UART_C2_ADDR(x), BP_UART_C2_TE) = (v))
  738. #endif
  739. //@}
  740. /*!
  741. * @name Register UART_C2, field ILIE[4] (RW)
  742. *
  743. * Enables the idle line flag, S1[IDLE], to generate interrupt requestsor DMA
  744. * transfer requests based on the state of C5[ILDMAS].
  745. *
  746. * Values:
  747. * - 0 - IDLE interrupt requests disabled. and DMA transfer
  748. * - 1 - IDLE interrupt requests enabled. or DMA transfer
  749. */
  750. //@{
  751. #define BP_UART_C2_ILIE (4U) //!< Bit position for UART_C2_ILIE.
  752. #define BM_UART_C2_ILIE (0x10U) //!< Bit mask for UART_C2_ILIE.
  753. #define BS_UART_C2_ILIE (1U) //!< Bit field size in bits for UART_C2_ILIE.
  754. #ifndef __LANGUAGE_ASM__
  755. //! @brief Read current value of the UART_C2_ILIE field.
  756. #define BR_UART_C2_ILIE(x) (BITBAND_ACCESS8(HW_UART_C2_ADDR(x), BP_UART_C2_ILIE))
  757. #endif
  758. //! @brief Format value for bitfield UART_C2_ILIE.
  759. #define BF_UART_C2_ILIE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C2_ILIE), uint8_t) & BM_UART_C2_ILIE)
  760. #ifndef __LANGUAGE_ASM__
  761. //! @brief Set the ILIE field to a new value.
  762. #define BW_UART_C2_ILIE(x, v) (BITBAND_ACCESS8(HW_UART_C2_ADDR(x), BP_UART_C2_ILIE) = (v))
  763. #endif
  764. //@}
  765. /*!
  766. * @name Register UART_C2, field RIE[5] (RW)
  767. *
  768. * Enables S1[RDRF] to generate interrupt requests or DMA transfer requests,
  769. * based on the state of C5[RDMAS].
  770. *
  771. * Values:
  772. * - 0 - RDRF interrupt and DMA transfer requests disabled.
  773. * - 1 - RDRF interrupt or DMA transfer requests enabled.
  774. */
  775. //@{
  776. #define BP_UART_C2_RIE (5U) //!< Bit position for UART_C2_RIE.
  777. #define BM_UART_C2_RIE (0x20U) //!< Bit mask for UART_C2_RIE.
  778. #define BS_UART_C2_RIE (1U) //!< Bit field size in bits for UART_C2_RIE.
  779. #ifndef __LANGUAGE_ASM__
  780. //! @brief Read current value of the UART_C2_RIE field.
  781. #define BR_UART_C2_RIE(x) (BITBAND_ACCESS8(HW_UART_C2_ADDR(x), BP_UART_C2_RIE))
  782. #endif
  783. //! @brief Format value for bitfield UART_C2_RIE.
  784. #define BF_UART_C2_RIE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C2_RIE), uint8_t) & BM_UART_C2_RIE)
  785. #ifndef __LANGUAGE_ASM__
  786. //! @brief Set the RIE field to a new value.
  787. #define BW_UART_C2_RIE(x, v) (BITBAND_ACCESS8(HW_UART_C2_ADDR(x), BP_UART_C2_RIE) = (v))
  788. #endif
  789. //@}
  790. /*!
  791. * @name Register UART_C2, field TCIE[6] (RW)
  792. *
  793. * Enables the transmission complete flag, S1[TC], to generate interrupt
  794. * requests . or DMA transfer requests based on the state of C5[TCDMAS] If C2[TCIE] and
  795. * C5[TCDMAS] are both set, then TIE must be cleared, and D[D] must not be
  796. * written unless servicing a DMA request.
  797. *
  798. * Values:
  799. * - 0 - TC interrupt and DMA transfer requests disabled.
  800. * - 1 - TC interrupt or DMA transfer requests enabled.
  801. */
  802. //@{
  803. #define BP_UART_C2_TCIE (6U) //!< Bit position for UART_C2_TCIE.
  804. #define BM_UART_C2_TCIE (0x40U) //!< Bit mask for UART_C2_TCIE.
  805. #define BS_UART_C2_TCIE (1U) //!< Bit field size in bits for UART_C2_TCIE.
  806. #ifndef __LANGUAGE_ASM__
  807. //! @brief Read current value of the UART_C2_TCIE field.
  808. #define BR_UART_C2_TCIE(x) (BITBAND_ACCESS8(HW_UART_C2_ADDR(x), BP_UART_C2_TCIE))
  809. #endif
  810. //! @brief Format value for bitfield UART_C2_TCIE.
  811. #define BF_UART_C2_TCIE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C2_TCIE), uint8_t) & BM_UART_C2_TCIE)
  812. #ifndef __LANGUAGE_ASM__
  813. //! @brief Set the TCIE field to a new value.
  814. #define BW_UART_C2_TCIE(x, v) (BITBAND_ACCESS8(HW_UART_C2_ADDR(x), BP_UART_C2_TCIE) = (v))
  815. #endif
  816. //@}
  817. /*!
  818. * @name Register UART_C2, field TIE[7] (RW)
  819. *
  820. * Enables S1[TDRE] to generate interrupt requests or DMA transfer requests,
  821. * based on the state of C5[TDMAS]. If C2[TIE] and C5[TDMAS] are both set, then TCIE
  822. * must be cleared, and D[D] must not be written unless servicing a DMA request.
  823. *
  824. * Values:
  825. * - 0 - TDRE interrupt and DMA transfer requests disabled.
  826. * - 1 - TDRE interrupt or DMA transfer requests enabled.
  827. */
  828. //@{
  829. #define BP_UART_C2_TIE (7U) //!< Bit position for UART_C2_TIE.
  830. #define BM_UART_C2_TIE (0x80U) //!< Bit mask for UART_C2_TIE.
  831. #define BS_UART_C2_TIE (1U) //!< Bit field size in bits for UART_C2_TIE.
  832. #ifndef __LANGUAGE_ASM__
  833. //! @brief Read current value of the UART_C2_TIE field.
  834. #define BR_UART_C2_TIE(x) (BITBAND_ACCESS8(HW_UART_C2_ADDR(x), BP_UART_C2_TIE))
  835. #endif
  836. //! @brief Format value for bitfield UART_C2_TIE.
  837. #define BF_UART_C2_TIE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C2_TIE), uint8_t) & BM_UART_C2_TIE)
  838. #ifndef __LANGUAGE_ASM__
  839. //! @brief Set the TIE field to a new value.
  840. #define BW_UART_C2_TIE(x, v) (BITBAND_ACCESS8(HW_UART_C2_ADDR(x), BP_UART_C2_TIE) = (v))
  841. #endif
  842. //@}
  843. //-------------------------------------------------------------------------------------------
  844. // HW_UART_S1 - UART Status Register 1
  845. //-------------------------------------------------------------------------------------------
  846. #ifndef __LANGUAGE_ASM__
  847. /*!
  848. * @brief HW_UART_S1 - UART Status Register 1 (RO)
  849. *
  850. * Reset value: 0xC0U
  851. *
  852. * The S1 register provides inputs to the MCU for generation of UART interrupts
  853. * or DMA requests. This register can also be polled by the MCU to check the
  854. * status of its fields. To clear a flag, the status register should be read followed
  855. * by a read or write to D register, depending on the interrupt flag type. Other
  856. * instructions can be executed between the two steps as long the handling of
  857. * I/O is not compromised, but the order of operations is important for flag
  858. * clearing. When a flag is configured to trigger a DMA request, assertion of the
  859. * associated DMA done signal from the DMA controller clears the flag. If the
  860. * condition that results in the assertion of the flag, interrupt, or DMA request is not
  861. * resolved prior to clearing the flag, the flag, and interrupt/DMA request,
  862. * reasserts. For example, if the DMA or interrupt service routine fails to write
  863. * sufficient data to the transmit buffer to raise it above the watermark level, the
  864. * flag reasserts and generates another interrupt or DMA request. Reading an
  865. * empty data register to clear one of the flags of the S1 register causes the FIFO
  866. * pointers to become misaligned. A receive FIFO flush reinitializes the
  867. * pointers. A better way to prevent this situation is to always leave one byte in FIFO
  868. * and this byte will be read eventually in clearing the flag bit.
  869. */
  870. typedef union _hw_uart_s1
  871. {
  872. uint8_t U;
  873. struct _hw_uart_s1_bitfields
  874. {
  875. uint8_t PF : 1; //!< [0] Parity Error Flag
  876. uint8_t FE : 1; //!< [1] Framing Error Flag
  877. uint8_t NF : 1; //!< [2] Noise Flag
  878. uint8_t OR : 1; //!< [3] Receiver Overrun Flag
  879. uint8_t IDLE : 1; //!< [4] Idle Line Flag
  880. uint8_t RDRF : 1; //!< [5] Receive Data Register Full Flag
  881. uint8_t TC : 1; //!< [6] Transmit Complete Flag
  882. uint8_t TDRE : 1; //!< [7] Transmit Data Register Empty Flag
  883. } B;
  884. } hw_uart_s1_t;
  885. #endif
  886. /*!
  887. * @name Constants and macros for entire UART_S1 register
  888. */
  889. //@{
  890. #define HW_UART_S1_ADDR(x) (REGS_UART_BASE(x) + 0x4U)
  891. #ifndef __LANGUAGE_ASM__
  892. #define HW_UART_S1(x) (*(__I hw_uart_s1_t *) HW_UART_S1_ADDR(x))
  893. #define HW_UART_S1_RD(x) (HW_UART_S1(x).U)
  894. #endif
  895. //@}
  896. /*
  897. * Constants & macros for individual UART_S1 bitfields
  898. */
  899. /*!
  900. * @name Register UART_S1, field PF[0] (RO)
  901. *
  902. * PF is set when PE is set and the parity of the received data does not match
  903. * its parity bit. The PF is not set in the case of an overrun condition. When PF
  904. * is set, it indicates only that a dataword was received with parity error since
  905. * the last time it was cleared. There is no guarantee that the first dataword
  906. * read from the receive buffer has a parity error or that there is only one
  907. * dataword in the buffer that was received with a parity error, unless the receive
  908. * buffer has a depth of one. To clear PF, read S1 and then read D., S2[LBKDE] is
  909. * disabled, Within the receive buffer structure the received dataword is tagged
  910. * if it is received with a parity error. This information is available by reading
  911. * the ED register prior to reading the D register.
  912. *
  913. * Values:
  914. * - 0 - No parity error detected since the last time this flag was cleared. If
  915. * the receive buffer has a depth greater than 1, then there may be data in
  916. * the receive buffer what was received with a parity error.
  917. * - 1 - At least one dataword was received with a parity error since the last
  918. * time this flag was cleared.
  919. */
  920. //@{
  921. #define BP_UART_S1_PF (0U) //!< Bit position for UART_S1_PF.
  922. #define BM_UART_S1_PF (0x01U) //!< Bit mask for UART_S1_PF.
  923. #define BS_UART_S1_PF (1U) //!< Bit field size in bits for UART_S1_PF.
  924. #ifndef __LANGUAGE_ASM__
  925. //! @brief Read current value of the UART_S1_PF field.
  926. #define BR_UART_S1_PF(x) (BITBAND_ACCESS8(HW_UART_S1_ADDR(x), BP_UART_S1_PF))
  927. #endif
  928. //@}
  929. /*!
  930. * @name Register UART_S1, field FE[1] (RO)
  931. *
  932. * FE is set when a logic 0 is accepted as the stop bit. When BDH[SBNS] is set,
  933. * then FE will set when a logic 0 is accepted for either of the two stop bits.
  934. * FE does not set in the case of an overrun or while the LIN break detect feature
  935. * is enabled (S2[LBKDE] = 1). FE inhibits further data reception until it is
  936. * cleared. To clear FE, read S1 with FE set and then read D. The last data in the
  937. * receive buffer represents the data that was received with the frame error
  938. * enabled. Framing errors are not supported when 7816E is set/enabled. However, if
  939. * this flag is set, data is still not received in 7816 mode.
  940. *
  941. * Values:
  942. * - 0 - No framing error detected.
  943. * - 1 - Framing error.
  944. */
  945. //@{
  946. #define BP_UART_S1_FE (1U) //!< Bit position for UART_S1_FE.
  947. #define BM_UART_S1_FE (0x02U) //!< Bit mask for UART_S1_FE.
  948. #define BS_UART_S1_FE (1U) //!< Bit field size in bits for UART_S1_FE.
  949. #ifndef __LANGUAGE_ASM__
  950. //! @brief Read current value of the UART_S1_FE field.
  951. #define BR_UART_S1_FE(x) (BITBAND_ACCESS8(HW_UART_S1_ADDR(x), BP_UART_S1_FE))
  952. #endif
  953. //@}
  954. /*!
  955. * @name Register UART_S1, field NF[2] (RO)
  956. *
  957. * NF is set when the UART detects noise on the receiver input. NF does not
  958. * become set in the case of an overrun or while the LIN break detect feature is
  959. * enabled (S2[LBKDE] = 1). When NF is set, it indicates only that a dataword has
  960. * been received with noise since the last time it was cleared. There is no
  961. * guarantee that the first dataword read from the receive buffer has noise or that there
  962. * is only one dataword in the buffer that was received with noise unless the
  963. * receive buffer has a depth of one. To clear NF, read S1 and then read D.
  964. *
  965. * Values:
  966. * - 0 - No noise detected since the last time this flag was cleared. If the
  967. * receive buffer has a depth greater than 1 then there may be data in the
  968. * receiver buffer that was received with noise.
  969. * - 1 - At least one dataword was received with noise detected since the last
  970. * time the flag was cleared.
  971. */
  972. //@{
  973. #define BP_UART_S1_NF (2U) //!< Bit position for UART_S1_NF.
  974. #define BM_UART_S1_NF (0x04U) //!< Bit mask for UART_S1_NF.
  975. #define BS_UART_S1_NF (1U) //!< Bit field size in bits for UART_S1_NF.
  976. #ifndef __LANGUAGE_ASM__
  977. //! @brief Read current value of the UART_S1_NF field.
  978. #define BR_UART_S1_NF(x) (BITBAND_ACCESS8(HW_UART_S1_ADDR(x), BP_UART_S1_NF))
  979. #endif
  980. //@}
  981. /*!
  982. * @name Register UART_S1, field OR[3] (RO)
  983. *
  984. * OR is set when software fails to prevent the receive data register from
  985. * overflowing with data. The OR bit is set immediately after the stop bit has been
  986. * completely received for the dataword that overflows the buffer and all the other
  987. * error flags (FE, NF, and PF) are prevented from setting. The data in the
  988. * shift register is lost, but the data already in the UART data registers is not
  989. * affected. If the OR flag is set, no data is stored in the data buffer even if
  990. * sufficient room exists. Additionally, while the OR flag is set, the RDRF and IDLE
  991. * flags are blocked from asserting, that is, transition from an inactive to an
  992. * active state. To clear OR, read S1 when OR is set and then read D. See
  993. * functional description for more details regarding the operation of the OR bit.If
  994. * LBKDE is enabled and a LIN Break is detected, the OR field asserts if S2[LBKDIF]
  995. * is not cleared before the next data character is received. In 7816 mode, it is
  996. * possible to configure a NACK to be returned by programing C7816[ONACK].
  997. *
  998. * Values:
  999. * - 0 - No overrun has occurred since the last time the flag was cleared.
  1000. * - 1 - Overrun has occurred or the overrun flag has not been cleared since the
  1001. * last overrun occured.
  1002. */
  1003. //@{
  1004. #define BP_UART_S1_OR (3U) //!< Bit position for UART_S1_OR.
  1005. #define BM_UART_S1_OR (0x08U) //!< Bit mask for UART_S1_OR.
  1006. #define BS_UART_S1_OR (1U) //!< Bit field size in bits for UART_S1_OR.
  1007. #ifndef __LANGUAGE_ASM__
  1008. //! @brief Read current value of the UART_S1_OR field.
  1009. #define BR_UART_S1_OR(x) (BITBAND_ACCESS8(HW_UART_S1_ADDR(x), BP_UART_S1_OR))
  1010. #endif
  1011. //@}
  1012. /*!
  1013. * @name Register UART_S1, field IDLE[4] (RO)
  1014. *
  1015. * After the IDLE flag is cleared, a frame must be received (although not
  1016. * necessarily stored in the data buffer, for example if C2[RWU] is set), or a LIN
  1017. * break character must set the S2[LBKDIF] flag before an idle condition can set the
  1018. * IDLE flag. To clear IDLE, read UART status S1 with IDLE set and then read D.
  1019. * IDLE is set when either of the following appear on the receiver input: 10
  1020. * consecutive logic 1s if C1[M] = 0 11 consecutive logic 1s if C1[M] = 1 and C4[M10]
  1021. * = 0 12 consecutive logic 1s if C1[M] = 1, C4[M10] = 1, and C1[PE] = 1 Idle
  1022. * detection is not supported when 7816E is set/enabled and hence this flag is
  1023. * ignored. When RWU is set and WAKE is cleared, an idle line condition sets the IDLE
  1024. * flag if RWUID is set, else the IDLE flag does not become set.
  1025. *
  1026. * Values:
  1027. * - 0 - Receiver input is either active now or has never become active since
  1028. * the IDLE flag was last cleared.
  1029. * - 1 - Receiver input has become idle or the flag has not been cleared since
  1030. * it last asserted.
  1031. */
  1032. //@{
  1033. #define BP_UART_S1_IDLE (4U) //!< Bit position for UART_S1_IDLE.
  1034. #define BM_UART_S1_IDLE (0x10U) //!< Bit mask for UART_S1_IDLE.
  1035. #define BS_UART_S1_IDLE (1U) //!< Bit field size in bits for UART_S1_IDLE.
  1036. #ifndef __LANGUAGE_ASM__
  1037. //! @brief Read current value of the UART_S1_IDLE field.
  1038. #define BR_UART_S1_IDLE(x) (BITBAND_ACCESS8(HW_UART_S1_ADDR(x), BP_UART_S1_IDLE))
  1039. #endif
  1040. //@}
  1041. /*!
  1042. * @name Register UART_S1, field RDRF[5] (RO)
  1043. *
  1044. * RDRF is set when the number of datawords in the receive buffer is equal to or
  1045. * more than the number indicated by RWFIFO[RXWATER]. A dataword that is in the
  1046. * process of being received is not included in the count. To clear RDRF, read S1
  1047. * when RDRF is set and then read D. For more efficient interrupt and DMA
  1048. * operation, read all data except the final value from the buffer, using D/C3[T8]/ED.
  1049. * Then read S1 and the final data value, resulting in the clearing of the RDRF
  1050. * flag. Even if RDRF is set, data will continue to be received until an overrun
  1051. * condition occurs.RDRF is prevented from setting while S2[LBKDE] is set.
  1052. * Additionally, when S2[LBKDE] is set, the received datawords are stored in the receive
  1053. * buffer but over-write each other.
  1054. *
  1055. * Values:
  1056. * - 0 - The number of datawords in the receive buffer is less than the number
  1057. * indicated by RXWATER.
  1058. * - 1 - The number of datawords in the receive buffer is equal to or greater
  1059. * than the number indicated by RXWATER at some point in time since this flag
  1060. * was last cleared.
  1061. */
  1062. //@{
  1063. #define BP_UART_S1_RDRF (5U) //!< Bit position for UART_S1_RDRF.
  1064. #define BM_UART_S1_RDRF (0x20U) //!< Bit mask for UART_S1_RDRF.
  1065. #define BS_UART_S1_RDRF (1U) //!< Bit field size in bits for UART_S1_RDRF.
  1066. #ifndef __LANGUAGE_ASM__
  1067. //! @brief Read current value of the UART_S1_RDRF field.
  1068. #define BR_UART_S1_RDRF(x) (BITBAND_ACCESS8(HW_UART_S1_ADDR(x), BP_UART_S1_RDRF))
  1069. #endif
  1070. //@}
  1071. /*!
  1072. * @name Register UART_S1, field TC[6] (RO)
  1073. *
  1074. * TC is set when the transmit buffer is empty and no data, preamble, or break
  1075. * character is being transmitted. When TC is set, the transmit data output signal
  1076. * becomes idle (logic 1). TC is cleared by reading S1 with TC set and then
  1077. * doing one of the following: When C7816[ISO_7816E] is set/enabled, this field is
  1078. * set after any NACK signal has been received, but prior to any corresponding
  1079. * guard times expiring. Writing to D to transmit new data. Queuing a preamble by
  1080. * clearing and then setting C2[TE]. Queuing a break character by writing 1 to SBK
  1081. * in C2.
  1082. *
  1083. * Values:
  1084. * - 0 - Transmitter active (sending data, a preamble, or a break).
  1085. * - 1 - Transmitter idle (transmission activity complete).
  1086. */
  1087. //@{
  1088. #define BP_UART_S1_TC (6U) //!< Bit position for UART_S1_TC.
  1089. #define BM_UART_S1_TC (0x40U) //!< Bit mask for UART_S1_TC.
  1090. #define BS_UART_S1_TC (1U) //!< Bit field size in bits for UART_S1_TC.
  1091. #ifndef __LANGUAGE_ASM__
  1092. //! @brief Read current value of the UART_S1_TC field.
  1093. #define BR_UART_S1_TC(x) (BITBAND_ACCESS8(HW_UART_S1_ADDR(x), BP_UART_S1_TC))
  1094. #endif
  1095. //@}
  1096. /*!
  1097. * @name Register UART_S1, field TDRE[7] (RO)
  1098. *
  1099. * TDRE will set when the number of datawords in the transmit buffer (D and
  1100. * C3[T8])is equal to or less than the number indicated by TWFIFO[TXWATER]. A
  1101. * character that is in the process of being transmitted is not included in the count.
  1102. * To clear TDRE, read S1 when TDRE is set and then write to the UART data
  1103. * register (D). For more efficient interrupt servicing, all data except the final value
  1104. * to be written to the buffer must be written to D/C3[T8]. Then S1 can be read
  1105. * before writing the final data value, resulting in the clearing of the TRDE
  1106. * flag. This is more efficient because the TDRE reasserts until the watermark has
  1107. * been exceeded. So, attempting to clear the TDRE with every write will be
  1108. * ineffective until sufficient data has been written.
  1109. *
  1110. * Values:
  1111. * - 0 - The amount of data in the transmit buffer is greater than the value
  1112. * indicated by TWFIFO[TXWATER].
  1113. * - 1 - The amount of data in the transmit buffer is less than or equal to the
  1114. * value indicated by TWFIFO[TXWATER] at some point in time since the flag
  1115. * has been cleared.
  1116. */
  1117. //@{
  1118. #define BP_UART_S1_TDRE (7U) //!< Bit position for UART_S1_TDRE.
  1119. #define BM_UART_S1_TDRE (0x80U) //!< Bit mask for UART_S1_TDRE.
  1120. #define BS_UART_S1_TDRE (1U) //!< Bit field size in bits for UART_S1_TDRE.
  1121. #ifndef __LANGUAGE_ASM__
  1122. //! @brief Read current value of the UART_S1_TDRE field.
  1123. #define BR_UART_S1_TDRE(x) (BITBAND_ACCESS8(HW_UART_S1_ADDR(x), BP_UART_S1_TDRE))
  1124. #endif
  1125. //@}
  1126. //-------------------------------------------------------------------------------------------
  1127. // HW_UART_S2 - UART Status Register 2
  1128. //-------------------------------------------------------------------------------------------
  1129. #ifndef __LANGUAGE_ASM__
  1130. /*!
  1131. * @brief HW_UART_S2 - UART Status Register 2 (RW)
  1132. *
  1133. * Reset value: 0x00U
  1134. *
  1135. * The S2 register provides inputs to the MCU for generation of UART interrupts
  1136. * or DMA requests. Also, this register can be polled by the MCU to check the
  1137. * status of these bits. This register can be read or written at any time, with the
  1138. * exception of the MSBF and RXINV bits, which should be changed by the user only
  1139. * between transmit and receive packets.
  1140. */
  1141. typedef union _hw_uart_s2
  1142. {
  1143. uint8_t U;
  1144. struct _hw_uart_s2_bitfields
  1145. {
  1146. uint8_t RAF : 1; //!< [0] Receiver Active Flag
  1147. uint8_t LBKDE : 1; //!< [1] LIN Break Detection Enable
  1148. uint8_t BRK13 : 1; //!< [2] Break Transmit Character Length
  1149. uint8_t RWUID : 1; //!< [3] Receive Wakeup Idle Detect
  1150. uint8_t RXINV : 1; //!< [4] Receive Data Inversion
  1151. uint8_t MSBF : 1; //!< [5] Most Significant Bit First
  1152. uint8_t RXEDGIF : 1; //!< [6] RxD Pin Active Edge Interrupt Flag
  1153. uint8_t LBKDIF : 1; //!< [7] LIN Break Detect Interrupt Flag
  1154. } B;
  1155. } hw_uart_s2_t;
  1156. #endif
  1157. /*!
  1158. * @name Constants and macros for entire UART_S2 register
  1159. */
  1160. //@{
  1161. #define HW_UART_S2_ADDR(x) (REGS_UART_BASE(x) + 0x5U)
  1162. #ifndef __LANGUAGE_ASM__
  1163. #define HW_UART_S2(x) (*(__IO hw_uart_s2_t *) HW_UART_S2_ADDR(x))
  1164. #define HW_UART_S2_RD(x) (HW_UART_S2(x).U)
  1165. #define HW_UART_S2_WR(x, v) (HW_UART_S2(x).U = (v))
  1166. #define HW_UART_S2_SET(x, v) (HW_UART_S2_WR(x, HW_UART_S2_RD(x) | (v)))
  1167. #define HW_UART_S2_CLR(x, v) (HW_UART_S2_WR(x, HW_UART_S2_RD(x) & ~(v)))
  1168. #define HW_UART_S2_TOG(x, v) (HW_UART_S2_WR(x, HW_UART_S2_RD(x) ^ (v)))
  1169. #endif
  1170. //@}
  1171. /*
  1172. * Constants & macros for individual UART_S2 bitfields
  1173. */
  1174. /*!
  1175. * @name Register UART_S2, field RAF[0] (RO)
  1176. *
  1177. * RAF is set when the UART receiver detects a logic 0 during the RT1 time
  1178. * period of the start bit search. RAF is cleared when the receiver detects an idle
  1179. * character when C7816[ISO7816E] is cleared/disabled. When C7816[ISO7816E] is
  1180. * enabled, the RAF is cleared if the C7816[TTYPE] = 0 expires or the C7816[TTYPE] =
  1181. * 1 expires.In case C7816[ISO7816E] is set and C7816[TTYPE] = 0, it is possible
  1182. * to configure the guard time to 12. However, if a NACK is required to be
  1183. * transmitted, the data transfer actually takes 13 ETU with the 13th ETU slot being a
  1184. * inactive buffer. Therefore, in this situation, the RAF may deassert one ETU
  1185. * prior to actually being inactive.
  1186. *
  1187. * Values:
  1188. * - 0 - UART receiver idle/inactive waiting for a start bit.
  1189. * - 1 - UART receiver active, RxD input not idle.
  1190. */
  1191. //@{
  1192. #define BP_UART_S2_RAF (0U) //!< Bit position for UART_S2_RAF.
  1193. #define BM_UART_S2_RAF (0x01U) //!< Bit mask for UART_S2_RAF.
  1194. #define BS_UART_S2_RAF (1U) //!< Bit field size in bits for UART_S2_RAF.
  1195. #ifndef __LANGUAGE_ASM__
  1196. //! @brief Read current value of the UART_S2_RAF field.
  1197. #define BR_UART_S2_RAF(x) (BITBAND_ACCESS8(HW_UART_S2_ADDR(x), BP_UART_S2_RAF))
  1198. #endif
  1199. //@}
  1200. /*!
  1201. * @name Register UART_S2, field LBKDE[1] (RW)
  1202. *
  1203. * Enables the LIN Break detection feature. While LBKDE is set, S1[RDRF],
  1204. * S1[NF], S1[FE], and S1[PF] are prevented from setting. When LBKDE is set, see .
  1205. * Overrun operation LBKDE must be cleared when C7816[ISO7816E] is set.
  1206. *
  1207. * Values:
  1208. * - 0 - Break character detection is disabled.
  1209. * - 1 - Break character is detected at length of 11 bit times if C1[M] = 0 or
  1210. * 12 bits time if C1[M] = 1.
  1211. */
  1212. //@{
  1213. #define BP_UART_S2_LBKDE (1U) //!< Bit position for UART_S2_LBKDE.
  1214. #define BM_UART_S2_LBKDE (0x02U) //!< Bit mask for UART_S2_LBKDE.
  1215. #define BS_UART_S2_LBKDE (1U) //!< Bit field size in bits for UART_S2_LBKDE.
  1216. #ifndef __LANGUAGE_ASM__
  1217. //! @brief Read current value of the UART_S2_LBKDE field.
  1218. #define BR_UART_S2_LBKDE(x) (BITBAND_ACCESS8(HW_UART_S2_ADDR(x), BP_UART_S2_LBKDE))
  1219. #endif
  1220. //! @brief Format value for bitfield UART_S2_LBKDE.
  1221. #define BF_UART_S2_LBKDE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_S2_LBKDE), uint8_t) & BM_UART_S2_LBKDE)
  1222. #ifndef __LANGUAGE_ASM__
  1223. //! @brief Set the LBKDE field to a new value.
  1224. #define BW_UART_S2_LBKDE(x, v) (BITBAND_ACCESS8(HW_UART_S2_ADDR(x), BP_UART_S2_LBKDE) = (v))
  1225. #endif
  1226. //@}
  1227. /*!
  1228. * @name Register UART_S2, field BRK13[2] (RW)
  1229. *
  1230. * Determines whether the transmit break character is 10, 11, or 12 bits long,
  1231. * or 13 or 14 bits long. See for the length of the break character for the
  1232. * different configurations. The detection of a framing error is not affected by this
  1233. * field. Transmitting break characters
  1234. *
  1235. * Values:
  1236. * - 0 - Break character is 10, 11, or 12 bits long.
  1237. * - 1 - Break character is 13 or 14 bits long.
  1238. */
  1239. //@{
  1240. #define BP_UART_S2_BRK13 (2U) //!< Bit position for UART_S2_BRK13.
  1241. #define BM_UART_S2_BRK13 (0x04U) //!< Bit mask for UART_S2_BRK13.
  1242. #define BS_UART_S2_BRK13 (1U) //!< Bit field size in bits for UART_S2_BRK13.
  1243. #ifndef __LANGUAGE_ASM__
  1244. //! @brief Read current value of the UART_S2_BRK13 field.
  1245. #define BR_UART_S2_BRK13(x) (BITBAND_ACCESS8(HW_UART_S2_ADDR(x), BP_UART_S2_BRK13))
  1246. #endif
  1247. //! @brief Format value for bitfield UART_S2_BRK13.
  1248. #define BF_UART_S2_BRK13(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_S2_BRK13), uint8_t) & BM_UART_S2_BRK13)
  1249. #ifndef __LANGUAGE_ASM__
  1250. //! @brief Set the BRK13 field to a new value.
  1251. #define BW_UART_S2_BRK13(x, v) (BITBAND_ACCESS8(HW_UART_S2_ADDR(x), BP_UART_S2_BRK13) = (v))
  1252. #endif
  1253. //@}
  1254. /*!
  1255. * @name Register UART_S2, field RWUID[3] (RW)
  1256. *
  1257. * When RWU is set and WAKE is cleared, this field controls whether the idle
  1258. * character that wakes the receiver sets S1[IDLE]. This field must be cleared when
  1259. * C7816[ISO7816E] is set/enabled.
  1260. *
  1261. * Values:
  1262. * - 0 - S1[IDLE] is not set upon detection of an idle character.
  1263. * - 1 - S1[IDLE] is set upon detection of an idle character.
  1264. */
  1265. //@{
  1266. #define BP_UART_S2_RWUID (3U) //!< Bit position for UART_S2_RWUID.
  1267. #define BM_UART_S2_RWUID (0x08U) //!< Bit mask for UART_S2_RWUID.
  1268. #define BS_UART_S2_RWUID (1U) //!< Bit field size in bits for UART_S2_RWUID.
  1269. #ifndef __LANGUAGE_ASM__
  1270. //! @brief Read current value of the UART_S2_RWUID field.
  1271. #define BR_UART_S2_RWUID(x) (BITBAND_ACCESS8(HW_UART_S2_ADDR(x), BP_UART_S2_RWUID))
  1272. #endif
  1273. //! @brief Format value for bitfield UART_S2_RWUID.
  1274. #define BF_UART_S2_RWUID(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_S2_RWUID), uint8_t) & BM_UART_S2_RWUID)
  1275. #ifndef __LANGUAGE_ASM__
  1276. //! @brief Set the RWUID field to a new value.
  1277. #define BW_UART_S2_RWUID(x, v) (BITBAND_ACCESS8(HW_UART_S2_ADDR(x), BP_UART_S2_RWUID) = (v))
  1278. #endif
  1279. //@}
  1280. /*!
  1281. * @name Register UART_S2, field RXINV[4] (RW)
  1282. *
  1283. * Setting this field reverses the polarity of the received data input. In NRZ
  1284. * format, a one is represented by a mark and a zero is represented by a space for
  1285. * normal polarity, and the opposite for inverted polarity. In IrDA format, a
  1286. * zero is represented by short high pulse in the middle of a bit time remaining
  1287. * idle low for a one for normal polarity. A zero is represented by a short low
  1288. * pulse in the middle of a bit time remaining idle high for a one for inverted
  1289. * polarity. This field is automatically set when C7816[INIT] and C7816[ISO7816E] are
  1290. * enabled and an initial character is detected in T = 0 protocol mode. Setting
  1291. * RXINV inverts the RxD input for data bits, start and stop bits, break, and
  1292. * idle. When C7816[ISO7816E] is set/enabled, only the data bits and the parity bit
  1293. * are inverted.
  1294. *
  1295. * Values:
  1296. * - 0 - Receive data is not inverted.
  1297. * - 1 - Receive data is inverted.
  1298. */
  1299. //@{
  1300. #define BP_UART_S2_RXINV (4U) //!< Bit position for UART_S2_RXINV.
  1301. #define BM_UART_S2_RXINV (0x10U) //!< Bit mask for UART_S2_RXINV.
  1302. #define BS_UART_S2_RXINV (1U) //!< Bit field size in bits for UART_S2_RXINV.
  1303. #ifndef __LANGUAGE_ASM__
  1304. //! @brief Read current value of the UART_S2_RXINV field.
  1305. #define BR_UART_S2_RXINV(x) (BITBAND_ACCESS8(HW_UART_S2_ADDR(x), BP_UART_S2_RXINV))
  1306. #endif
  1307. //! @brief Format value for bitfield UART_S2_RXINV.
  1308. #define BF_UART_S2_RXINV(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_S2_RXINV), uint8_t) & BM_UART_S2_RXINV)
  1309. #ifndef __LANGUAGE_ASM__
  1310. //! @brief Set the RXINV field to a new value.
  1311. #define BW_UART_S2_RXINV(x, v) (BITBAND_ACCESS8(HW_UART_S2_ADDR(x), BP_UART_S2_RXINV) = (v))
  1312. #endif
  1313. //@}
  1314. /*!
  1315. * @name Register UART_S2, field MSBF[5] (RW)
  1316. *
  1317. * Setting this field reverses the order of the bits that are transmitted and
  1318. * received on the wire. This field does not affect the polarity of the bits, the
  1319. * location of the parity bit, or the location of the start or stop bits. This
  1320. * field is automatically set when C7816[INIT] and C7816[ISO7816E] are enabled and
  1321. * an initial character is detected in T = 0 protocol mode.
  1322. *
  1323. * Values:
  1324. * - 0 - LSB (bit0) is the first bit that is transmitted following the start
  1325. * bit. Further, the first bit received after the start bit is identified as
  1326. * bit0.
  1327. * - 1 - MSB (bit8, bit7 or bit6) is the first bit that is transmitted following
  1328. * the start bit, depending on the setting of C1[M] and C1[PE]. Further, the
  1329. * first bit received after the start bit is identified as bit8, bit7, or
  1330. * bit6, depending on the setting of C1[M] and C1[PE].
  1331. */
  1332. //@{
  1333. #define BP_UART_S2_MSBF (5U) //!< Bit position for UART_S2_MSBF.
  1334. #define BM_UART_S2_MSBF (0x20U) //!< Bit mask for UART_S2_MSBF.
  1335. #define BS_UART_S2_MSBF (1U) //!< Bit field size in bits for UART_S2_MSBF.
  1336. #ifndef __LANGUAGE_ASM__
  1337. //! @brief Read current value of the UART_S2_MSBF field.
  1338. #define BR_UART_S2_MSBF(x) (BITBAND_ACCESS8(HW_UART_S2_ADDR(x), BP_UART_S2_MSBF))
  1339. #endif
  1340. //! @brief Format value for bitfield UART_S2_MSBF.
  1341. #define BF_UART_S2_MSBF(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_S2_MSBF), uint8_t) & BM_UART_S2_MSBF)
  1342. #ifndef __LANGUAGE_ASM__
  1343. //! @brief Set the MSBF field to a new value.
  1344. #define BW_UART_S2_MSBF(x, v) (BITBAND_ACCESS8(HW_UART_S2_ADDR(x), BP_UART_S2_MSBF) = (v))
  1345. #endif
  1346. //@}
  1347. /*!
  1348. * @name Register UART_S2, field RXEDGIF[6] (W1C)
  1349. *
  1350. * RXEDGIF is set when an active edge occurs on the RxD pin. The active edge is
  1351. * falling if RXINV = 0, and rising if RXINV=1. RXEDGIF is cleared by writing a 1
  1352. * to it. See for additional details. RXEDGIF description The active edge is
  1353. * detected only in two wire mode and on receiving data coming from the RxD pin.
  1354. *
  1355. * Values:
  1356. * - 0 - No active edge on the receive pin has occurred.
  1357. * - 1 - An active edge on the receive pin has occurred.
  1358. */
  1359. //@{
  1360. #define BP_UART_S2_RXEDGIF (6U) //!< Bit position for UART_S2_RXEDGIF.
  1361. #define BM_UART_S2_RXEDGIF (0x40U) //!< Bit mask for UART_S2_RXEDGIF.
  1362. #define BS_UART_S2_RXEDGIF (1U) //!< Bit field size in bits for UART_S2_RXEDGIF.
  1363. #ifndef __LANGUAGE_ASM__
  1364. //! @brief Read current value of the UART_S2_RXEDGIF field.
  1365. #define BR_UART_S2_RXEDGIF(x) (BITBAND_ACCESS8(HW_UART_S2_ADDR(x), BP_UART_S2_RXEDGIF))
  1366. #endif
  1367. //! @brief Format value for bitfield UART_S2_RXEDGIF.
  1368. #define BF_UART_S2_RXEDGIF(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_S2_RXEDGIF), uint8_t) & BM_UART_S2_RXEDGIF)
  1369. #ifndef __LANGUAGE_ASM__
  1370. //! @brief Set the RXEDGIF field to a new value.
  1371. #define BW_UART_S2_RXEDGIF(x, v) (BITBAND_ACCESS8(HW_UART_S2_ADDR(x), BP_UART_S2_RXEDGIF) = (v))
  1372. #endif
  1373. //@}
  1374. /*!
  1375. * @name Register UART_S2, field LBKDIF[7] (W1C)
  1376. *
  1377. * LBKDIF is set when LBKDE is set and a LIN break character is detected on the
  1378. * receiver input. The LIN break characters are 11 consecutive logic 0s if C1[M]
  1379. * = 0 or 12 consecutive logic 0s if C1[M] = 1. LBKDIF is set after receiving the
  1380. * last LIN break character. LBKDIF is cleared by writing a 1 to it.
  1381. *
  1382. * Values:
  1383. * - 0 - No LIN break character detected.
  1384. * - 1 - LIN break character detected.
  1385. */
  1386. //@{
  1387. #define BP_UART_S2_LBKDIF (7U) //!< Bit position for UART_S2_LBKDIF.
  1388. #define BM_UART_S2_LBKDIF (0x80U) //!< Bit mask for UART_S2_LBKDIF.
  1389. #define BS_UART_S2_LBKDIF (1U) //!< Bit field size in bits for UART_S2_LBKDIF.
  1390. #ifndef __LANGUAGE_ASM__
  1391. //! @brief Read current value of the UART_S2_LBKDIF field.
  1392. #define BR_UART_S2_LBKDIF(x) (BITBAND_ACCESS8(HW_UART_S2_ADDR(x), BP_UART_S2_LBKDIF))
  1393. #endif
  1394. //! @brief Format value for bitfield UART_S2_LBKDIF.
  1395. #define BF_UART_S2_LBKDIF(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_S2_LBKDIF), uint8_t) & BM_UART_S2_LBKDIF)
  1396. #ifndef __LANGUAGE_ASM__
  1397. //! @brief Set the LBKDIF field to a new value.
  1398. #define BW_UART_S2_LBKDIF(x, v) (BITBAND_ACCESS8(HW_UART_S2_ADDR(x), BP_UART_S2_LBKDIF) = (v))
  1399. #endif
  1400. //@}
  1401. //-------------------------------------------------------------------------------------------
  1402. // HW_UART_C3 - UART Control Register 3
  1403. //-------------------------------------------------------------------------------------------
  1404. #ifndef __LANGUAGE_ASM__
  1405. /*!
  1406. * @brief HW_UART_C3 - UART Control Register 3 (RW)
  1407. *
  1408. * Reset value: 0x00U
  1409. *
  1410. * Writing R8 does not have any effect. TXDIR and TXINV can be changed only
  1411. * between transmit and receive packets.
  1412. */
  1413. typedef union _hw_uart_c3
  1414. {
  1415. uint8_t U;
  1416. struct _hw_uart_c3_bitfields
  1417. {
  1418. uint8_t PEIE : 1; //!< [0] Parity Error Interrupt Enable
  1419. uint8_t FEIE : 1; //!< [1] Framing Error Interrupt Enable
  1420. uint8_t NEIE : 1; //!< [2] Noise Error Interrupt Enable
  1421. uint8_t ORIE : 1; //!< [3] Overrun Error Interrupt Enable
  1422. uint8_t TXINV : 1; //!< [4] Transmit Data Inversion.
  1423. uint8_t TXDIR : 1; //!< [5] Transmitter Pin Data Direction in
  1424. //! Single-Wire mode
  1425. uint8_t T8 : 1; //!< [6] Transmit Bit 8
  1426. uint8_t R8 : 1; //!< [7] Received Bit 8
  1427. } B;
  1428. } hw_uart_c3_t;
  1429. #endif
  1430. /*!
  1431. * @name Constants and macros for entire UART_C3 register
  1432. */
  1433. //@{
  1434. #define HW_UART_C3_ADDR(x) (REGS_UART_BASE(x) + 0x6U)
  1435. #ifndef __LANGUAGE_ASM__
  1436. #define HW_UART_C3(x) (*(__IO hw_uart_c3_t *) HW_UART_C3_ADDR(x))
  1437. #define HW_UART_C3_RD(x) (HW_UART_C3(x).U)
  1438. #define HW_UART_C3_WR(x, v) (HW_UART_C3(x).U = (v))
  1439. #define HW_UART_C3_SET(x, v) (HW_UART_C3_WR(x, HW_UART_C3_RD(x) | (v)))
  1440. #define HW_UART_C3_CLR(x, v) (HW_UART_C3_WR(x, HW_UART_C3_RD(x) & ~(v)))
  1441. #define HW_UART_C3_TOG(x, v) (HW_UART_C3_WR(x, HW_UART_C3_RD(x) ^ (v)))
  1442. #endif
  1443. //@}
  1444. /*
  1445. * Constants & macros for individual UART_C3 bitfields
  1446. */
  1447. /*!
  1448. * @name Register UART_C3, field PEIE[0] (RW)
  1449. *
  1450. * Enables the parity error flag, S1[PF], to generate interrupt requests.
  1451. *
  1452. * Values:
  1453. * - 0 - PF interrupt requests are disabled.
  1454. * - 1 - PF interrupt requests are enabled.
  1455. */
  1456. //@{
  1457. #define BP_UART_C3_PEIE (0U) //!< Bit position for UART_C3_PEIE.
  1458. #define BM_UART_C3_PEIE (0x01U) //!< Bit mask for UART_C3_PEIE.
  1459. #define BS_UART_C3_PEIE (1U) //!< Bit field size in bits for UART_C3_PEIE.
  1460. #ifndef __LANGUAGE_ASM__
  1461. //! @brief Read current value of the UART_C3_PEIE field.
  1462. #define BR_UART_C3_PEIE(x) (BITBAND_ACCESS8(HW_UART_C3_ADDR(x), BP_UART_C3_PEIE))
  1463. #endif
  1464. //! @brief Format value for bitfield UART_C3_PEIE.
  1465. #define BF_UART_C3_PEIE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C3_PEIE), uint8_t) & BM_UART_C3_PEIE)
  1466. #ifndef __LANGUAGE_ASM__
  1467. //! @brief Set the PEIE field to a new value.
  1468. #define BW_UART_C3_PEIE(x, v) (BITBAND_ACCESS8(HW_UART_C3_ADDR(x), BP_UART_C3_PEIE) = (v))
  1469. #endif
  1470. //@}
  1471. /*!
  1472. * @name Register UART_C3, field FEIE[1] (RW)
  1473. *
  1474. * Enables the framing error flag, S1[FE], to generate interrupt requests.
  1475. *
  1476. * Values:
  1477. * - 0 - FE interrupt requests are disabled.
  1478. * - 1 - FE interrupt requests are enabled.
  1479. */
  1480. //@{
  1481. #define BP_UART_C3_FEIE (1U) //!< Bit position for UART_C3_FEIE.
  1482. #define BM_UART_C3_FEIE (0x02U) //!< Bit mask for UART_C3_FEIE.
  1483. #define BS_UART_C3_FEIE (1U) //!< Bit field size in bits for UART_C3_FEIE.
  1484. #ifndef __LANGUAGE_ASM__
  1485. //! @brief Read current value of the UART_C3_FEIE field.
  1486. #define BR_UART_C3_FEIE(x) (BITBAND_ACCESS8(HW_UART_C3_ADDR(x), BP_UART_C3_FEIE))
  1487. #endif
  1488. //! @brief Format value for bitfield UART_C3_FEIE.
  1489. #define BF_UART_C3_FEIE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C3_FEIE), uint8_t) & BM_UART_C3_FEIE)
  1490. #ifndef __LANGUAGE_ASM__
  1491. //! @brief Set the FEIE field to a new value.
  1492. #define BW_UART_C3_FEIE(x, v) (BITBAND_ACCESS8(HW_UART_C3_ADDR(x), BP_UART_C3_FEIE) = (v))
  1493. #endif
  1494. //@}
  1495. /*!
  1496. * @name Register UART_C3, field NEIE[2] (RW)
  1497. *
  1498. * Enables the noise flag, S1[NF], to generate interrupt requests.
  1499. *
  1500. * Values:
  1501. * - 0 - NF interrupt requests are disabled.
  1502. * - 1 - NF interrupt requests are enabled.
  1503. */
  1504. //@{
  1505. #define BP_UART_C3_NEIE (2U) //!< Bit position for UART_C3_NEIE.
  1506. #define BM_UART_C3_NEIE (0x04U) //!< Bit mask for UART_C3_NEIE.
  1507. #define BS_UART_C3_NEIE (1U) //!< Bit field size in bits for UART_C3_NEIE.
  1508. #ifndef __LANGUAGE_ASM__
  1509. //! @brief Read current value of the UART_C3_NEIE field.
  1510. #define BR_UART_C3_NEIE(x) (BITBAND_ACCESS8(HW_UART_C3_ADDR(x), BP_UART_C3_NEIE))
  1511. #endif
  1512. //! @brief Format value for bitfield UART_C3_NEIE.
  1513. #define BF_UART_C3_NEIE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C3_NEIE), uint8_t) & BM_UART_C3_NEIE)
  1514. #ifndef __LANGUAGE_ASM__
  1515. //! @brief Set the NEIE field to a new value.
  1516. #define BW_UART_C3_NEIE(x, v) (BITBAND_ACCESS8(HW_UART_C3_ADDR(x), BP_UART_C3_NEIE) = (v))
  1517. #endif
  1518. //@}
  1519. /*!
  1520. * @name Register UART_C3, field ORIE[3] (RW)
  1521. *
  1522. * Enables the overrun error flag, S1[OR], to generate interrupt requests.
  1523. *
  1524. * Values:
  1525. * - 0 - OR interrupts are disabled.
  1526. * - 1 - OR interrupt requests are enabled.
  1527. */
  1528. //@{
  1529. #define BP_UART_C3_ORIE (3U) //!< Bit position for UART_C3_ORIE.
  1530. #define BM_UART_C3_ORIE (0x08U) //!< Bit mask for UART_C3_ORIE.
  1531. #define BS_UART_C3_ORIE (1U) //!< Bit field size in bits for UART_C3_ORIE.
  1532. #ifndef __LANGUAGE_ASM__
  1533. //! @brief Read current value of the UART_C3_ORIE field.
  1534. #define BR_UART_C3_ORIE(x) (BITBAND_ACCESS8(HW_UART_C3_ADDR(x), BP_UART_C3_ORIE))
  1535. #endif
  1536. //! @brief Format value for bitfield UART_C3_ORIE.
  1537. #define BF_UART_C3_ORIE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C3_ORIE), uint8_t) & BM_UART_C3_ORIE)
  1538. #ifndef __LANGUAGE_ASM__
  1539. //! @brief Set the ORIE field to a new value.
  1540. #define BW_UART_C3_ORIE(x, v) (BITBAND_ACCESS8(HW_UART_C3_ADDR(x), BP_UART_C3_ORIE) = (v))
  1541. #endif
  1542. //@}
  1543. /*!
  1544. * @name Register UART_C3, field TXINV[4] (RW)
  1545. *
  1546. * Setting this field reverses the polarity of the transmitted data output. In
  1547. * NRZ format, a one is represented by a mark and a zero is represented by a space
  1548. * for normal polarity, and the opposite for inverted polarity. In IrDA format,
  1549. * a zero is represented by short high pulse in the middle of a bit time
  1550. * remaining idle low for a one for normal polarity, and a zero is represented by short
  1551. * low pulse in the middle of a bit time remaining idle high for a one for
  1552. * inverted polarity. This field is automatically set when C7816[INIT] and
  1553. * C7816[ISO7816E] are enabled and an initial character is detected in T = 0 protocol mode.
  1554. * Setting TXINV inverts all transmitted values, including idle, break, start, and
  1555. * stop bits. In loop mode, if TXINV is set, the receiver gets the transmit
  1556. * inversion bit when RXINV is disabled. When C7816[ISO7816E] is set/enabled then only
  1557. * the transmitted data bits and parity bit are inverted.
  1558. *
  1559. * Values:
  1560. * - 0 - Transmit data is not inverted.
  1561. * - 1 - Transmit data is inverted.
  1562. */
  1563. //@{
  1564. #define BP_UART_C3_TXINV (4U) //!< Bit position for UART_C3_TXINV.
  1565. #define BM_UART_C3_TXINV (0x10U) //!< Bit mask for UART_C3_TXINV.
  1566. #define BS_UART_C3_TXINV (1U) //!< Bit field size in bits for UART_C3_TXINV.
  1567. #ifndef __LANGUAGE_ASM__
  1568. //! @brief Read current value of the UART_C3_TXINV field.
  1569. #define BR_UART_C3_TXINV(x) (BITBAND_ACCESS8(HW_UART_C3_ADDR(x), BP_UART_C3_TXINV))
  1570. #endif
  1571. //! @brief Format value for bitfield UART_C3_TXINV.
  1572. #define BF_UART_C3_TXINV(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C3_TXINV), uint8_t) & BM_UART_C3_TXINV)
  1573. #ifndef __LANGUAGE_ASM__
  1574. //! @brief Set the TXINV field to a new value.
  1575. #define BW_UART_C3_TXINV(x, v) (BITBAND_ACCESS8(HW_UART_C3_ADDR(x), BP_UART_C3_TXINV) = (v))
  1576. #endif
  1577. //@}
  1578. /*!
  1579. * @name Register UART_C3, field TXDIR[5] (RW)
  1580. *
  1581. * Determines whether the TXD pin is used as an input or output in the
  1582. * single-wire mode of operation. This field is relevant only to the single wire mode.
  1583. * When C7816[ISO7816E] is set/enabled and C7816[TTYPE] = 1, this field is
  1584. * automatically cleared after the requested block is transmitted. This condition is
  1585. * detected when TL7816[TLEN] = 0 and 4 additional characters are transmitted.
  1586. * Additionally, if C7816[ISO7816E] is set/enabled and C7816[TTYPE] = 0 and a NACK is
  1587. * being transmitted, the hardware automatically overrides this field as needed. In
  1588. * this situation, TXDIR does not reflect the temporary state associated with
  1589. * the NACK.
  1590. *
  1591. * Values:
  1592. * - 0 - TXD pin is an input in single wire mode.
  1593. * - 1 - TXD pin is an output in single wire mode.
  1594. */
  1595. //@{
  1596. #define BP_UART_C3_TXDIR (5U) //!< Bit position for UART_C3_TXDIR.
  1597. #define BM_UART_C3_TXDIR (0x20U) //!< Bit mask for UART_C3_TXDIR.
  1598. #define BS_UART_C3_TXDIR (1U) //!< Bit field size in bits for UART_C3_TXDIR.
  1599. #ifndef __LANGUAGE_ASM__
  1600. //! @brief Read current value of the UART_C3_TXDIR field.
  1601. #define BR_UART_C3_TXDIR(x) (BITBAND_ACCESS8(HW_UART_C3_ADDR(x), BP_UART_C3_TXDIR))
  1602. #endif
  1603. //! @brief Format value for bitfield UART_C3_TXDIR.
  1604. #define BF_UART_C3_TXDIR(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C3_TXDIR), uint8_t) & BM_UART_C3_TXDIR)
  1605. #ifndef __LANGUAGE_ASM__
  1606. //! @brief Set the TXDIR field to a new value.
  1607. #define BW_UART_C3_TXDIR(x, v) (BITBAND_ACCESS8(HW_UART_C3_ADDR(x), BP_UART_C3_TXDIR) = (v))
  1608. #endif
  1609. //@}
  1610. /*!
  1611. * @name Register UART_C3, field T8[6] (RW)
  1612. *
  1613. * T8 is the ninth data bit transmitted when the UART is configured for 9-bit
  1614. * data format, that is, if C1[M] = 1 or C4[M10] = 1. If the value of T8 is the
  1615. * same as in the previous transmission, T8 does not have to be rewritten. The same
  1616. * value is transmitted until T8 is rewritten. To correctly transmit the 9th bit,
  1617. * write UARTx_C3[T8] to the desired value, then write the UARTx_D register with
  1618. * the remaining data.
  1619. */
  1620. //@{
  1621. #define BP_UART_C3_T8 (6U) //!< Bit position for UART_C3_T8.
  1622. #define BM_UART_C3_T8 (0x40U) //!< Bit mask for UART_C3_T8.
  1623. #define BS_UART_C3_T8 (1U) //!< Bit field size in bits for UART_C3_T8.
  1624. #ifndef __LANGUAGE_ASM__
  1625. //! @brief Read current value of the UART_C3_T8 field.
  1626. #define BR_UART_C3_T8(x) (BITBAND_ACCESS8(HW_UART_C3_ADDR(x), BP_UART_C3_T8))
  1627. #endif
  1628. //! @brief Format value for bitfield UART_C3_T8.
  1629. #define BF_UART_C3_T8(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C3_T8), uint8_t) & BM_UART_C3_T8)
  1630. #ifndef __LANGUAGE_ASM__
  1631. //! @brief Set the T8 field to a new value.
  1632. #define BW_UART_C3_T8(x, v) (BITBAND_ACCESS8(HW_UART_C3_ADDR(x), BP_UART_C3_T8) = (v))
  1633. #endif
  1634. //@}
  1635. /*!
  1636. * @name Register UART_C3, field R8[7] (RO)
  1637. *
  1638. * R8 is the ninth data bit received when the UART is configured for 9-bit data
  1639. * format, that is, if C1[M] = 1 or C4[M10] = 1. The R8 value corresponds to the
  1640. * current data value in the UARTx_D register. To read the 9th bit, read the
  1641. * value of UARTx_C3[R8], then read the UARTx_D register.
  1642. */
  1643. //@{
  1644. #define BP_UART_C3_R8 (7U) //!< Bit position for UART_C3_R8.
  1645. #define BM_UART_C3_R8 (0x80U) //!< Bit mask for UART_C3_R8.
  1646. #define BS_UART_C3_R8 (1U) //!< Bit field size in bits for UART_C3_R8.
  1647. #ifndef __LANGUAGE_ASM__
  1648. //! @brief Read current value of the UART_C3_R8 field.
  1649. #define BR_UART_C3_R8(x) (BITBAND_ACCESS8(HW_UART_C3_ADDR(x), BP_UART_C3_R8))
  1650. #endif
  1651. //@}
  1652. //-------------------------------------------------------------------------------------------
  1653. // HW_UART_D - UART Data Register
  1654. //-------------------------------------------------------------------------------------------
  1655. #ifndef __LANGUAGE_ASM__
  1656. /*!
  1657. * @brief HW_UART_D - UART Data Register (RW)
  1658. *
  1659. * Reset value: 0x00U
  1660. *
  1661. * This register is actually two separate registers. Reads return the contents
  1662. * of the read-only receive data register and writes go to the write-only transmit
  1663. * data register. In 8-bit or 9-bit data format, only UART data register (D)
  1664. * needs to be accessed to clear the S1[RDRF] bit (assuming receiver buffer level is
  1665. * less than RWFIFO[RXWATER]). The C3 register needs to be read, prior to the D
  1666. * register, only if the ninth bit of data needs to be captured. Similarly, the
  1667. * ED register needs to be read, prior to the D register, only if the additional
  1668. * flag data for the dataword needs to be captured. In the normal 8-bit mode (M
  1669. * bit cleared) if the parity is enabled, you get seven data bits and one parity
  1670. * bit. That one parity bit is loaded into the D register. So, for the data bits,
  1671. * mask off the parity bit from the value you read out of this register. When
  1672. * transmitting in 9-bit data format and using 8-bit write instructions, write first
  1673. * to transmit bit 8 in UART control register 3 (C3[T8]), then D. A write to
  1674. * C3[T8] stores the data in a temporary register. If D register is written first,
  1675. * and then the new data on data bus is stored in D, the temporary value written by
  1676. * the last write to C3[T8] gets stored in the C3[T8] register.
  1677. */
  1678. typedef union _hw_uart_d
  1679. {
  1680. uint8_t U;
  1681. struct _hw_uart_d_bitfields
  1682. {
  1683. uint8_t RT : 8; //!< [7:0]
  1684. } B;
  1685. } hw_uart_d_t;
  1686. #endif
  1687. /*!
  1688. * @name Constants and macros for entire UART_D register
  1689. */
  1690. //@{
  1691. #define HW_UART_D_ADDR(x) (REGS_UART_BASE(x) + 0x7U)
  1692. #ifndef __LANGUAGE_ASM__
  1693. #define HW_UART_D(x) (*(__IO hw_uart_d_t *) HW_UART_D_ADDR(x))
  1694. #define HW_UART_D_RD(x) (HW_UART_D(x).U)
  1695. #define HW_UART_D_WR(x, v) (HW_UART_D(x).U = (v))
  1696. #define HW_UART_D_SET(x, v) (HW_UART_D_WR(x, HW_UART_D_RD(x) | (v)))
  1697. #define HW_UART_D_CLR(x, v) (HW_UART_D_WR(x, HW_UART_D_RD(x) & ~(v)))
  1698. #define HW_UART_D_TOG(x, v) (HW_UART_D_WR(x, HW_UART_D_RD(x) ^ (v)))
  1699. #endif
  1700. //@}
  1701. /*
  1702. * Constants & macros for individual UART_D bitfields
  1703. */
  1704. /*!
  1705. * @name Register UART_D, field RT[7:0] (RW)
  1706. *
  1707. * Reads return the contents of the read-only receive data register and writes
  1708. * go to the write-only transmit data register.
  1709. */
  1710. //@{
  1711. #define BP_UART_D_RT (0U) //!< Bit position for UART_D_RT.
  1712. #define BM_UART_D_RT (0xFFU) //!< Bit mask for UART_D_RT.
  1713. #define BS_UART_D_RT (8U) //!< Bit field size in bits for UART_D_RT.
  1714. #ifndef __LANGUAGE_ASM__
  1715. //! @brief Read current value of the UART_D_RT field.
  1716. #define BR_UART_D_RT(x) (HW_UART_D(x).U)
  1717. #endif
  1718. //! @brief Format value for bitfield UART_D_RT.
  1719. #define BF_UART_D_RT(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_D_RT), uint8_t) & BM_UART_D_RT)
  1720. #ifndef __LANGUAGE_ASM__
  1721. //! @brief Set the RT field to a new value.
  1722. #define BW_UART_D_RT(x, v) (HW_UART_D_WR(x, v))
  1723. #endif
  1724. //@}
  1725. //-------------------------------------------------------------------------------------------
  1726. // HW_UART_MA1 - UART Match Address Registers 1
  1727. //-------------------------------------------------------------------------------------------
  1728. #ifndef __LANGUAGE_ASM__
  1729. /*!
  1730. * @brief HW_UART_MA1 - UART Match Address Registers 1 (RW)
  1731. *
  1732. * Reset value: 0x00U
  1733. *
  1734. * The MA1 and MA2 registers are compared to input data addresses when the most
  1735. * significant bit is set and the associated C4[MAEN] field is set. If a match
  1736. * occurs, the following data is transferred to the data register. If a match
  1737. * fails, the following data is discarded. These registers can be read and written at
  1738. * anytime.
  1739. */
  1740. typedef union _hw_uart_ma1
  1741. {
  1742. uint8_t U;
  1743. struct _hw_uart_ma1_bitfields
  1744. {
  1745. uint8_t MA : 8; //!< [7:0] Match Address
  1746. } B;
  1747. } hw_uart_ma1_t;
  1748. #endif
  1749. /*!
  1750. * @name Constants and macros for entire UART_MA1 register
  1751. */
  1752. //@{
  1753. #define HW_UART_MA1_ADDR(x) (REGS_UART_BASE(x) + 0x8U)
  1754. #ifndef __LANGUAGE_ASM__
  1755. #define HW_UART_MA1(x) (*(__IO hw_uart_ma1_t *) HW_UART_MA1_ADDR(x))
  1756. #define HW_UART_MA1_RD(x) (HW_UART_MA1(x).U)
  1757. #define HW_UART_MA1_WR(x, v) (HW_UART_MA1(x).U = (v))
  1758. #define HW_UART_MA1_SET(x, v) (HW_UART_MA1_WR(x, HW_UART_MA1_RD(x) | (v)))
  1759. #define HW_UART_MA1_CLR(x, v) (HW_UART_MA1_WR(x, HW_UART_MA1_RD(x) & ~(v)))
  1760. #define HW_UART_MA1_TOG(x, v) (HW_UART_MA1_WR(x, HW_UART_MA1_RD(x) ^ (v)))
  1761. #endif
  1762. //@}
  1763. /*
  1764. * Constants & macros for individual UART_MA1 bitfields
  1765. */
  1766. /*!
  1767. * @name Register UART_MA1, field MA[7:0] (RW)
  1768. */
  1769. //@{
  1770. #define BP_UART_MA1_MA (0U) //!< Bit position for UART_MA1_MA.
  1771. #define BM_UART_MA1_MA (0xFFU) //!< Bit mask for UART_MA1_MA.
  1772. #define BS_UART_MA1_MA (8U) //!< Bit field size in bits for UART_MA1_MA.
  1773. #ifndef __LANGUAGE_ASM__
  1774. //! @brief Read current value of the UART_MA1_MA field.
  1775. #define BR_UART_MA1_MA(x) (HW_UART_MA1(x).U)
  1776. #endif
  1777. //! @brief Format value for bitfield UART_MA1_MA.
  1778. #define BF_UART_MA1_MA(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_MA1_MA), uint8_t) & BM_UART_MA1_MA)
  1779. #ifndef __LANGUAGE_ASM__
  1780. //! @brief Set the MA field to a new value.
  1781. #define BW_UART_MA1_MA(x, v) (HW_UART_MA1_WR(x, v))
  1782. #endif
  1783. //@}
  1784. //-------------------------------------------------------------------------------------------
  1785. // HW_UART_MA2 - UART Match Address Registers 2
  1786. //-------------------------------------------------------------------------------------------
  1787. #ifndef __LANGUAGE_ASM__
  1788. /*!
  1789. * @brief HW_UART_MA2 - UART Match Address Registers 2 (RW)
  1790. *
  1791. * Reset value: 0x00U
  1792. *
  1793. * These registers can be read and written at anytime. The MA1 and MA2 registers
  1794. * are compared to input data addresses when the most significant bit is set and
  1795. * the associated C4[MAEN] field is set. If a match occurs, the following data
  1796. * is transferred to the data register. If a match fails, the following data is
  1797. * discarded.
  1798. */
  1799. typedef union _hw_uart_ma2
  1800. {
  1801. uint8_t U;
  1802. struct _hw_uart_ma2_bitfields
  1803. {
  1804. uint8_t MA : 8; //!< [7:0] Match Address
  1805. } B;
  1806. } hw_uart_ma2_t;
  1807. #endif
  1808. /*!
  1809. * @name Constants and macros for entire UART_MA2 register
  1810. */
  1811. //@{
  1812. #define HW_UART_MA2_ADDR(x) (REGS_UART_BASE(x) + 0x9U)
  1813. #ifndef __LANGUAGE_ASM__
  1814. #define HW_UART_MA2(x) (*(__IO hw_uart_ma2_t *) HW_UART_MA2_ADDR(x))
  1815. #define HW_UART_MA2_RD(x) (HW_UART_MA2(x).U)
  1816. #define HW_UART_MA2_WR(x, v) (HW_UART_MA2(x).U = (v))
  1817. #define HW_UART_MA2_SET(x, v) (HW_UART_MA2_WR(x, HW_UART_MA2_RD(x) | (v)))
  1818. #define HW_UART_MA2_CLR(x, v) (HW_UART_MA2_WR(x, HW_UART_MA2_RD(x) & ~(v)))
  1819. #define HW_UART_MA2_TOG(x, v) (HW_UART_MA2_WR(x, HW_UART_MA2_RD(x) ^ (v)))
  1820. #endif
  1821. //@}
  1822. /*
  1823. * Constants & macros for individual UART_MA2 bitfields
  1824. */
  1825. /*!
  1826. * @name Register UART_MA2, field MA[7:0] (RW)
  1827. */
  1828. //@{
  1829. #define BP_UART_MA2_MA (0U) //!< Bit position for UART_MA2_MA.
  1830. #define BM_UART_MA2_MA (0xFFU) //!< Bit mask for UART_MA2_MA.
  1831. #define BS_UART_MA2_MA (8U) //!< Bit field size in bits for UART_MA2_MA.
  1832. #ifndef __LANGUAGE_ASM__
  1833. //! @brief Read current value of the UART_MA2_MA field.
  1834. #define BR_UART_MA2_MA(x) (HW_UART_MA2(x).U)
  1835. #endif
  1836. //! @brief Format value for bitfield UART_MA2_MA.
  1837. #define BF_UART_MA2_MA(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_MA2_MA), uint8_t) & BM_UART_MA2_MA)
  1838. #ifndef __LANGUAGE_ASM__
  1839. //! @brief Set the MA field to a new value.
  1840. #define BW_UART_MA2_MA(x, v) (HW_UART_MA2_WR(x, v))
  1841. #endif
  1842. //@}
  1843. //-------------------------------------------------------------------------------------------
  1844. // HW_UART_C4 - UART Control Register 4
  1845. //-------------------------------------------------------------------------------------------
  1846. #ifndef __LANGUAGE_ASM__
  1847. /*!
  1848. * @brief HW_UART_C4 - UART Control Register 4 (RW)
  1849. *
  1850. * Reset value: 0x00U
  1851. */
  1852. typedef union _hw_uart_c4
  1853. {
  1854. uint8_t U;
  1855. struct _hw_uart_c4_bitfields
  1856. {
  1857. uint8_t BRFA : 5; //!< [4:0] Baud Rate Fine Adjust
  1858. uint8_t M10 : 1; //!< [5] 10-bit Mode select
  1859. uint8_t MAEN2 : 1; //!< [6] Match Address Mode Enable 2
  1860. uint8_t MAEN1 : 1; //!< [7] Match Address Mode Enable 1
  1861. } B;
  1862. } hw_uart_c4_t;
  1863. #endif
  1864. /*!
  1865. * @name Constants and macros for entire UART_C4 register
  1866. */
  1867. //@{
  1868. #define HW_UART_C4_ADDR(x) (REGS_UART_BASE(x) + 0xAU)
  1869. #ifndef __LANGUAGE_ASM__
  1870. #define HW_UART_C4(x) (*(__IO hw_uart_c4_t *) HW_UART_C4_ADDR(x))
  1871. #define HW_UART_C4_RD(x) (HW_UART_C4(x).U)
  1872. #define HW_UART_C4_WR(x, v) (HW_UART_C4(x).U = (v))
  1873. #define HW_UART_C4_SET(x, v) (HW_UART_C4_WR(x, HW_UART_C4_RD(x) | (v)))
  1874. #define HW_UART_C4_CLR(x, v) (HW_UART_C4_WR(x, HW_UART_C4_RD(x) & ~(v)))
  1875. #define HW_UART_C4_TOG(x, v) (HW_UART_C4_WR(x, HW_UART_C4_RD(x) ^ (v)))
  1876. #endif
  1877. //@}
  1878. /*
  1879. * Constants & macros for individual UART_C4 bitfields
  1880. */
  1881. /*!
  1882. * @name Register UART_C4, field BRFA[4:0] (RW)
  1883. *
  1884. * This bit field is used to add more timing resolution to the average baud
  1885. * frequency, in increments of 1/32. See Baud rate generation for more information.
  1886. */
  1887. //@{
  1888. #define BP_UART_C4_BRFA (0U) //!< Bit position for UART_C4_BRFA.
  1889. #define BM_UART_C4_BRFA (0x1FU) //!< Bit mask for UART_C4_BRFA.
  1890. #define BS_UART_C4_BRFA (5U) //!< Bit field size in bits for UART_C4_BRFA.
  1891. #ifndef __LANGUAGE_ASM__
  1892. //! @brief Read current value of the UART_C4_BRFA field.
  1893. #define BR_UART_C4_BRFA(x) (HW_UART_C4(x).B.BRFA)
  1894. #endif
  1895. //! @brief Format value for bitfield UART_C4_BRFA.
  1896. #define BF_UART_C4_BRFA(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C4_BRFA), uint8_t) & BM_UART_C4_BRFA)
  1897. #ifndef __LANGUAGE_ASM__
  1898. //! @brief Set the BRFA field to a new value.
  1899. #define BW_UART_C4_BRFA(x, v) (HW_UART_C4_WR(x, (HW_UART_C4_RD(x) & ~BM_UART_C4_BRFA) | BF_UART_C4_BRFA(v)))
  1900. #endif
  1901. //@}
  1902. /*!
  1903. * @name Register UART_C4, field M10[5] (RW)
  1904. *
  1905. * Causes a tenth, non-memory mapped bit to be part of the serial transmission.
  1906. * This tenth bit is generated and interpreted as a parity bit. The M10 field
  1907. * does not affect the LIN send or detect break behavior. If M10 is set, then both
  1908. * C1[M] and C1[PE] must also be set. This field must be cleared when
  1909. * C7816[ISO7816E] is set/enabled. See Data format (non ISO-7816) for more information.
  1910. *
  1911. * Values:
  1912. * - 0 - The parity bit is the ninth bit in the serial transmission.
  1913. * - 1 - The parity bit is the tenth bit in the serial transmission.
  1914. */
  1915. //@{
  1916. #define BP_UART_C4_M10 (5U) //!< Bit position for UART_C4_M10.
  1917. #define BM_UART_C4_M10 (0x20U) //!< Bit mask for UART_C4_M10.
  1918. #define BS_UART_C4_M10 (1U) //!< Bit field size in bits for UART_C4_M10.
  1919. #ifndef __LANGUAGE_ASM__
  1920. //! @brief Read current value of the UART_C4_M10 field.
  1921. #define BR_UART_C4_M10(x) (BITBAND_ACCESS8(HW_UART_C4_ADDR(x), BP_UART_C4_M10))
  1922. #endif
  1923. //! @brief Format value for bitfield UART_C4_M10.
  1924. #define BF_UART_C4_M10(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C4_M10), uint8_t) & BM_UART_C4_M10)
  1925. #ifndef __LANGUAGE_ASM__
  1926. //! @brief Set the M10 field to a new value.
  1927. #define BW_UART_C4_M10(x, v) (BITBAND_ACCESS8(HW_UART_C4_ADDR(x), BP_UART_C4_M10) = (v))
  1928. #endif
  1929. //@}
  1930. /*!
  1931. * @name Register UART_C4, field MAEN2[6] (RW)
  1932. *
  1933. * See Match address operation for more information.
  1934. *
  1935. * Values:
  1936. * - 0 - All data received is transferred to the data buffer if MAEN1 is cleared.
  1937. * - 1 - All data received with the most significant bit cleared, is discarded.
  1938. * All data received with the most significant bit set, is compared with
  1939. * contents of MA2 register. If no match occurs, the data is discarded. If a
  1940. * match occurs, data is transferred to the data buffer. This field must be
  1941. * cleared when C7816[ISO7816E] is set/enabled.
  1942. */
  1943. //@{
  1944. #define BP_UART_C4_MAEN2 (6U) //!< Bit position for UART_C4_MAEN2.
  1945. #define BM_UART_C4_MAEN2 (0x40U) //!< Bit mask for UART_C4_MAEN2.
  1946. #define BS_UART_C4_MAEN2 (1U) //!< Bit field size in bits for UART_C4_MAEN2.
  1947. #ifndef __LANGUAGE_ASM__
  1948. //! @brief Read current value of the UART_C4_MAEN2 field.
  1949. #define BR_UART_C4_MAEN2(x) (BITBAND_ACCESS8(HW_UART_C4_ADDR(x), BP_UART_C4_MAEN2))
  1950. #endif
  1951. //! @brief Format value for bitfield UART_C4_MAEN2.
  1952. #define BF_UART_C4_MAEN2(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C4_MAEN2), uint8_t) & BM_UART_C4_MAEN2)
  1953. #ifndef __LANGUAGE_ASM__
  1954. //! @brief Set the MAEN2 field to a new value.
  1955. #define BW_UART_C4_MAEN2(x, v) (BITBAND_ACCESS8(HW_UART_C4_ADDR(x), BP_UART_C4_MAEN2) = (v))
  1956. #endif
  1957. //@}
  1958. /*!
  1959. * @name Register UART_C4, field MAEN1[7] (RW)
  1960. *
  1961. * See Match address operation for more information.
  1962. *
  1963. * Values:
  1964. * - 0 - All data received is transferred to the data buffer if MAEN2 is cleared.
  1965. * - 1 - All data received with the most significant bit cleared, is discarded.
  1966. * All data received with the most significant bit set, is compared with
  1967. * contents of MA1 register. If no match occurs, the data is discarded. If match
  1968. * occurs, data is transferred to the data buffer. This field must be cleared
  1969. * when C7816[ISO7816E] is set/enabled.
  1970. */
  1971. //@{
  1972. #define BP_UART_C4_MAEN1 (7U) //!< Bit position for UART_C4_MAEN1.
  1973. #define BM_UART_C4_MAEN1 (0x80U) //!< Bit mask for UART_C4_MAEN1.
  1974. #define BS_UART_C4_MAEN1 (1U) //!< Bit field size in bits for UART_C4_MAEN1.
  1975. #ifndef __LANGUAGE_ASM__
  1976. //! @brief Read current value of the UART_C4_MAEN1 field.
  1977. #define BR_UART_C4_MAEN1(x) (BITBAND_ACCESS8(HW_UART_C4_ADDR(x), BP_UART_C4_MAEN1))
  1978. #endif
  1979. //! @brief Format value for bitfield UART_C4_MAEN1.
  1980. #define BF_UART_C4_MAEN1(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C4_MAEN1), uint8_t) & BM_UART_C4_MAEN1)
  1981. #ifndef __LANGUAGE_ASM__
  1982. //! @brief Set the MAEN1 field to a new value.
  1983. #define BW_UART_C4_MAEN1(x, v) (BITBAND_ACCESS8(HW_UART_C4_ADDR(x), BP_UART_C4_MAEN1) = (v))
  1984. #endif
  1985. //@}
  1986. //-------------------------------------------------------------------------------------------
  1987. // HW_UART_C5 - UART Control Register 5
  1988. //-------------------------------------------------------------------------------------------
  1989. #ifndef __LANGUAGE_ASM__
  1990. /*!
  1991. * @brief HW_UART_C5 - UART Control Register 5 (RW)
  1992. *
  1993. * Reset value: 0x00U
  1994. */
  1995. typedef union _hw_uart_c5
  1996. {
  1997. uint8_t U;
  1998. struct _hw_uart_c5_bitfields
  1999. {
  2000. uint8_t RESERVED0 : 3; //!< [2:0]
  2001. uint8_t LBKDDMAS : 1; //!< [3] LIN Break Detect DMA Select Bit
  2002. uint8_t ILDMAS : 1; //!< [4] Idle Line DMA Select
  2003. uint8_t RDMAS : 1; //!< [5] Receiver Full DMA Select
  2004. uint8_t TCDMAS : 1; //!< [6] Transmission Complete DMA Select
  2005. uint8_t TDMAS : 1; //!< [7] Transmitter DMA Select
  2006. } B;
  2007. } hw_uart_c5_t;
  2008. #endif
  2009. /*!
  2010. * @name Constants and macros for entire UART_C5 register
  2011. */
  2012. //@{
  2013. #define HW_UART_C5_ADDR(x) (REGS_UART_BASE(x) + 0xBU)
  2014. #ifndef __LANGUAGE_ASM__
  2015. #define HW_UART_C5(x) (*(__IO hw_uart_c5_t *) HW_UART_C5_ADDR(x))
  2016. #define HW_UART_C5_RD(x) (HW_UART_C5(x).U)
  2017. #define HW_UART_C5_WR(x, v) (HW_UART_C5(x).U = (v))
  2018. #define HW_UART_C5_SET(x, v) (HW_UART_C5_WR(x, HW_UART_C5_RD(x) | (v)))
  2019. #define HW_UART_C5_CLR(x, v) (HW_UART_C5_WR(x, HW_UART_C5_RD(x) & ~(v)))
  2020. #define HW_UART_C5_TOG(x, v) (HW_UART_C5_WR(x, HW_UART_C5_RD(x) ^ (v)))
  2021. #endif
  2022. //@}
  2023. /*
  2024. * Constants & macros for individual UART_C5 bitfields
  2025. */
  2026. /*!
  2027. * @name Register UART_C5, field LBKDDMAS[3] (RW)
  2028. *
  2029. * Configures the LIN break detect flag, S2[LBKDIF], to generate interrupt or
  2030. * DMA requests if BDH[LBKDIE] is set. If BDH[LBKDIE] is cleared, and S2[LBKDIF] is
  2031. * set, the LBKDIF DMA and LBKDIF interrupt signals are not asserted, regardless
  2032. * of the state of LBKDDMAS.
  2033. *
  2034. * Values:
  2035. * - 0 - If BDH[LBKDIE] and S2[LBKDIF] are set, the LBKDIF interrupt signal is
  2036. * asserted to request an interrupt service.
  2037. * - 1 - If BDH[LBKDIE] and S2[LBKDIF] are set, the LBKDIF DMA request signal is
  2038. * asserted to request a DMA transfer.
  2039. */
  2040. //@{
  2041. #define BP_UART_C5_LBKDDMAS (3U) //!< Bit position for UART_C5_LBKDDMAS.
  2042. #define BM_UART_C5_LBKDDMAS (0x08U) //!< Bit mask for UART_C5_LBKDDMAS.
  2043. #define BS_UART_C5_LBKDDMAS (1U) //!< Bit field size in bits for UART_C5_LBKDDMAS.
  2044. #ifndef __LANGUAGE_ASM__
  2045. //! @brief Read current value of the UART_C5_LBKDDMAS field.
  2046. #define BR_UART_C5_LBKDDMAS(x) (BITBAND_ACCESS8(HW_UART_C5_ADDR(x), BP_UART_C5_LBKDDMAS))
  2047. #endif
  2048. //! @brief Format value for bitfield UART_C5_LBKDDMAS.
  2049. #define BF_UART_C5_LBKDDMAS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C5_LBKDDMAS), uint8_t) & BM_UART_C5_LBKDDMAS)
  2050. #ifndef __LANGUAGE_ASM__
  2051. //! @brief Set the LBKDDMAS field to a new value.
  2052. #define BW_UART_C5_LBKDDMAS(x, v) (BITBAND_ACCESS8(HW_UART_C5_ADDR(x), BP_UART_C5_LBKDDMAS) = (v))
  2053. #endif
  2054. //@}
  2055. /*!
  2056. * @name Register UART_C5, field ILDMAS[4] (RW)
  2057. *
  2058. * Configures the idle line flag, S1[IDLE], to generate interrupt or DMA
  2059. * requests if C2[ILIE] is set. If C2[ILIE] is cleared, and S1[IDLE] is set, the IDLE
  2060. * DMA and IDLE interrupt request signals are not asserted, regardless of the state
  2061. * of ILDMAS.
  2062. *
  2063. * Values:
  2064. * - 0 - If C2[ILIE] and S1[IDLE] are set, the IDLE interrupt request signal is
  2065. * asserted to request an interrupt service.
  2066. * - 1 - If C2[ILIE] and S1[IDLE] are set, the IDLE DMA request signal is
  2067. * asserted to request a DMA transfer.
  2068. */
  2069. //@{
  2070. #define BP_UART_C5_ILDMAS (4U) //!< Bit position for UART_C5_ILDMAS.
  2071. #define BM_UART_C5_ILDMAS (0x10U) //!< Bit mask for UART_C5_ILDMAS.
  2072. #define BS_UART_C5_ILDMAS (1U) //!< Bit field size in bits for UART_C5_ILDMAS.
  2073. #ifndef __LANGUAGE_ASM__
  2074. //! @brief Read current value of the UART_C5_ILDMAS field.
  2075. #define BR_UART_C5_ILDMAS(x) (BITBAND_ACCESS8(HW_UART_C5_ADDR(x), BP_UART_C5_ILDMAS))
  2076. #endif
  2077. //! @brief Format value for bitfield UART_C5_ILDMAS.
  2078. #define BF_UART_C5_ILDMAS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C5_ILDMAS), uint8_t) & BM_UART_C5_ILDMAS)
  2079. #ifndef __LANGUAGE_ASM__
  2080. //! @brief Set the ILDMAS field to a new value.
  2081. #define BW_UART_C5_ILDMAS(x, v) (BITBAND_ACCESS8(HW_UART_C5_ADDR(x), BP_UART_C5_ILDMAS) = (v))
  2082. #endif
  2083. //@}
  2084. /*!
  2085. * @name Register UART_C5, field RDMAS[5] (RW)
  2086. *
  2087. * Configures the receiver data register full flag, S1[RDRF], to generate
  2088. * interrupt or DMA requests if C2[RIE] is set. If C2[RIE] is cleared, and S1[RDRF] is
  2089. * set, the RDRF DMA and RDFR interrupt request signals are not asserted,
  2090. * regardless of the state of RDMAS.
  2091. *
  2092. * Values:
  2093. * - 0 - If C2[RIE] and S1[RDRF] are set, the RDFR interrupt request signal is
  2094. * asserted to request an interrupt service.
  2095. * - 1 - If C2[RIE] and S1[RDRF] are set, the RDRF DMA request signal is
  2096. * asserted to request a DMA transfer.
  2097. */
  2098. //@{
  2099. #define BP_UART_C5_RDMAS (5U) //!< Bit position for UART_C5_RDMAS.
  2100. #define BM_UART_C5_RDMAS (0x20U) //!< Bit mask for UART_C5_RDMAS.
  2101. #define BS_UART_C5_RDMAS (1U) //!< Bit field size in bits for UART_C5_RDMAS.
  2102. #ifndef __LANGUAGE_ASM__
  2103. //! @brief Read current value of the UART_C5_RDMAS field.
  2104. #define BR_UART_C5_RDMAS(x) (BITBAND_ACCESS8(HW_UART_C5_ADDR(x), BP_UART_C5_RDMAS))
  2105. #endif
  2106. //! @brief Format value for bitfield UART_C5_RDMAS.
  2107. #define BF_UART_C5_RDMAS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C5_RDMAS), uint8_t) & BM_UART_C5_RDMAS)
  2108. #ifndef __LANGUAGE_ASM__
  2109. //! @brief Set the RDMAS field to a new value.
  2110. #define BW_UART_C5_RDMAS(x, v) (BITBAND_ACCESS8(HW_UART_C5_ADDR(x), BP_UART_C5_RDMAS) = (v))
  2111. #endif
  2112. //@}
  2113. /*!
  2114. * @name Register UART_C5, field TCDMAS[6] (RW)
  2115. *
  2116. * Configures the transmission complete flag, S1[TC], to generate interrupt or
  2117. * DMA requests if C2[TCIE] is set. If C2[TCIE] is cleared, the TC DMA and TC
  2118. * interrupt request signals are not asserted when the S1[TC] flag is set, regardless
  2119. * of the state of TCDMAS. If C2[TCIE] and TCDMAS are both set, then C2[TIE]
  2120. * must be cleared, and D must not be written unless a DMA request is being serviced.
  2121. *
  2122. * Values:
  2123. * - 0 - If C2[TCIE] is set and the S1[TC] flag is set, the TC interrupt request
  2124. * signal is asserted to request an interrupt service.
  2125. * - 1 - If C2[TCIE] is set and the S1[TC] flag is set, the TC DMA request
  2126. * signal is asserted to request a DMA transfer.
  2127. */
  2128. //@{
  2129. #define BP_UART_C5_TCDMAS (6U) //!< Bit position for UART_C5_TCDMAS.
  2130. #define BM_UART_C5_TCDMAS (0x40U) //!< Bit mask for UART_C5_TCDMAS.
  2131. #define BS_UART_C5_TCDMAS (1U) //!< Bit field size in bits for UART_C5_TCDMAS.
  2132. #ifndef __LANGUAGE_ASM__
  2133. //! @brief Read current value of the UART_C5_TCDMAS field.
  2134. #define BR_UART_C5_TCDMAS(x) (BITBAND_ACCESS8(HW_UART_C5_ADDR(x), BP_UART_C5_TCDMAS))
  2135. #endif
  2136. //! @brief Format value for bitfield UART_C5_TCDMAS.
  2137. #define BF_UART_C5_TCDMAS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C5_TCDMAS), uint8_t) & BM_UART_C5_TCDMAS)
  2138. #ifndef __LANGUAGE_ASM__
  2139. //! @brief Set the TCDMAS field to a new value.
  2140. #define BW_UART_C5_TCDMAS(x, v) (BITBAND_ACCESS8(HW_UART_C5_ADDR(x), BP_UART_C5_TCDMAS) = (v))
  2141. #endif
  2142. //@}
  2143. /*!
  2144. * @name Register UART_C5, field TDMAS[7] (RW)
  2145. *
  2146. * Configures the transmit data register empty flag, S1[TDRE], to generate
  2147. * interrupt or DMA requests if C2[TIE] is set. If C2[TIE] is cleared, TDRE DMA and
  2148. * TDRE interrupt request signals are not asserted when the TDRE flag is set,
  2149. * regardless of the state of TDMAS. If C2[TIE] and TDMAS are both set, then C2[TCIE]
  2150. * must be cleared, and D must not be written unless a DMA request is being
  2151. * serviced.
  2152. *
  2153. * Values:
  2154. * - 0 - If C2[TIE] is set and the S1[TDRE] flag is set, the TDRE interrupt
  2155. * request signal is asserted to request interrupt service.
  2156. * - 1 - If C2[TIE] is set and the S1[TDRE] flag is set, the TDRE DMA request
  2157. * signal is asserted to request a DMA transfer.
  2158. */
  2159. //@{
  2160. #define BP_UART_C5_TDMAS (7U) //!< Bit position for UART_C5_TDMAS.
  2161. #define BM_UART_C5_TDMAS (0x80U) //!< Bit mask for UART_C5_TDMAS.
  2162. #define BS_UART_C5_TDMAS (1U) //!< Bit field size in bits for UART_C5_TDMAS.
  2163. #ifndef __LANGUAGE_ASM__
  2164. //! @brief Read current value of the UART_C5_TDMAS field.
  2165. #define BR_UART_C5_TDMAS(x) (BITBAND_ACCESS8(HW_UART_C5_ADDR(x), BP_UART_C5_TDMAS))
  2166. #endif
  2167. //! @brief Format value for bitfield UART_C5_TDMAS.
  2168. #define BF_UART_C5_TDMAS(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C5_TDMAS), uint8_t) & BM_UART_C5_TDMAS)
  2169. #ifndef __LANGUAGE_ASM__
  2170. //! @brief Set the TDMAS field to a new value.
  2171. #define BW_UART_C5_TDMAS(x, v) (BITBAND_ACCESS8(HW_UART_C5_ADDR(x), BP_UART_C5_TDMAS) = (v))
  2172. #endif
  2173. //@}
  2174. //-------------------------------------------------------------------------------------------
  2175. // HW_UART_ED - UART Extended Data Register
  2176. //-------------------------------------------------------------------------------------------
  2177. #ifndef __LANGUAGE_ASM__
  2178. /*!
  2179. * @brief HW_UART_ED - UART Extended Data Register (RO)
  2180. *
  2181. * Reset value: 0x00U
  2182. *
  2183. * This register contains additional information flags that are stored with a
  2184. * received dataword. This register may be read at any time but contains valid data
  2185. * only if there is a dataword in the receive FIFO. The data contained in this
  2186. * register represents additional information regarding the conditions on which a
  2187. * dataword was received. The importance of this data varies with the
  2188. * application, and in some cases maybe completely optional. These fields automatically
  2189. * update to reflect the conditions of the next dataword whenever D is read. If
  2190. * S1[NF] and S1[PF] have not been set since the last time the receive buffer was
  2191. * empty, the NOISY and PARITYE fields will be zero.
  2192. */
  2193. typedef union _hw_uart_ed
  2194. {
  2195. uint8_t U;
  2196. struct _hw_uart_ed_bitfields
  2197. {
  2198. uint8_t RESERVED0 : 6; //!< [5:0]
  2199. uint8_t PARITYE : 1; //!< [6]
  2200. uint8_t NOISY : 1; //!< [7]
  2201. } B;
  2202. } hw_uart_ed_t;
  2203. #endif
  2204. /*!
  2205. * @name Constants and macros for entire UART_ED register
  2206. */
  2207. //@{
  2208. #define HW_UART_ED_ADDR(x) (REGS_UART_BASE(x) + 0xCU)
  2209. #ifndef __LANGUAGE_ASM__
  2210. #define HW_UART_ED(x) (*(__I hw_uart_ed_t *) HW_UART_ED_ADDR(x))
  2211. #define HW_UART_ED_RD(x) (HW_UART_ED(x).U)
  2212. #endif
  2213. //@}
  2214. /*
  2215. * Constants & macros for individual UART_ED bitfields
  2216. */
  2217. /*!
  2218. * @name Register UART_ED, field PARITYE[6] (RO)
  2219. *
  2220. * The current received dataword contained in D and C3[R8] was received with a
  2221. * parity error.
  2222. *
  2223. * Values:
  2224. * - 0 - The dataword was received without a parity error.
  2225. * - 1 - The dataword was received with a parity error.
  2226. */
  2227. //@{
  2228. #define BP_UART_ED_PARITYE (6U) //!< Bit position for UART_ED_PARITYE.
  2229. #define BM_UART_ED_PARITYE (0x40U) //!< Bit mask for UART_ED_PARITYE.
  2230. #define BS_UART_ED_PARITYE (1U) //!< Bit field size in bits for UART_ED_PARITYE.
  2231. #ifndef __LANGUAGE_ASM__
  2232. //! @brief Read current value of the UART_ED_PARITYE field.
  2233. #define BR_UART_ED_PARITYE(x) (BITBAND_ACCESS8(HW_UART_ED_ADDR(x), BP_UART_ED_PARITYE))
  2234. #endif
  2235. //@}
  2236. /*!
  2237. * @name Register UART_ED, field NOISY[7] (RO)
  2238. *
  2239. * The current received dataword contained in D and C3[R8] was received with
  2240. * noise.
  2241. *
  2242. * Values:
  2243. * - 0 - The dataword was received without noise.
  2244. * - 1 - The data was received with noise.
  2245. */
  2246. //@{
  2247. #define BP_UART_ED_NOISY (7U) //!< Bit position for UART_ED_NOISY.
  2248. #define BM_UART_ED_NOISY (0x80U) //!< Bit mask for UART_ED_NOISY.
  2249. #define BS_UART_ED_NOISY (1U) //!< Bit field size in bits for UART_ED_NOISY.
  2250. #ifndef __LANGUAGE_ASM__
  2251. //! @brief Read current value of the UART_ED_NOISY field.
  2252. #define BR_UART_ED_NOISY(x) (BITBAND_ACCESS8(HW_UART_ED_ADDR(x), BP_UART_ED_NOISY))
  2253. #endif
  2254. //@}
  2255. //-------------------------------------------------------------------------------------------
  2256. // HW_UART_MODEM - UART Modem Register
  2257. //-------------------------------------------------------------------------------------------
  2258. #ifndef __LANGUAGE_ASM__
  2259. /*!
  2260. * @brief HW_UART_MODEM - UART Modem Register (RW)
  2261. *
  2262. * Reset value: 0x00U
  2263. *
  2264. * The MODEM register controls options for setting the modem configuration.
  2265. * RXRTSE, TXRTSPOL, TXRTSE, and TXCTSE must all be cleared when C7816[ISO7816EN] is
  2266. * enabled. This will cause the RTS to deassert during ISO-7816 wait times. The
  2267. * ISO-7816 protocol does not use the RTS and CTS signals.
  2268. */
  2269. typedef union _hw_uart_modem
  2270. {
  2271. uint8_t U;
  2272. struct _hw_uart_modem_bitfields
  2273. {
  2274. uint8_t TXCTSE : 1; //!< [0] Transmitter clear-to-send enable
  2275. uint8_t TXRTSE : 1; //!< [1] Transmitter request-to-send enable
  2276. uint8_t TXRTSPOL : 1; //!< [2] Transmitter request-to-send polarity
  2277. uint8_t RXRTSE : 1; //!< [3] Receiver request-to-send enable
  2278. uint8_t RESERVED0 : 4; //!< [7:4]
  2279. } B;
  2280. } hw_uart_modem_t;
  2281. #endif
  2282. /*!
  2283. * @name Constants and macros for entire UART_MODEM register
  2284. */
  2285. //@{
  2286. #define HW_UART_MODEM_ADDR(x) (REGS_UART_BASE(x) + 0xDU)
  2287. #ifndef __LANGUAGE_ASM__
  2288. #define HW_UART_MODEM(x) (*(__IO hw_uart_modem_t *) HW_UART_MODEM_ADDR(x))
  2289. #define HW_UART_MODEM_RD(x) (HW_UART_MODEM(x).U)
  2290. #define HW_UART_MODEM_WR(x, v) (HW_UART_MODEM(x).U = (v))
  2291. #define HW_UART_MODEM_SET(x, v) (HW_UART_MODEM_WR(x, HW_UART_MODEM_RD(x) | (v)))
  2292. #define HW_UART_MODEM_CLR(x, v) (HW_UART_MODEM_WR(x, HW_UART_MODEM_RD(x) & ~(v)))
  2293. #define HW_UART_MODEM_TOG(x, v) (HW_UART_MODEM_WR(x, HW_UART_MODEM_RD(x) ^ (v)))
  2294. #endif
  2295. //@}
  2296. /*
  2297. * Constants & macros for individual UART_MODEM bitfields
  2298. */
  2299. /*!
  2300. * @name Register UART_MODEM, field TXCTSE[0] (RW)
  2301. *
  2302. * TXCTSE controls the operation of the transmitter. TXCTSE can be set
  2303. * independently from the state of TXRTSE and RXRTSE.
  2304. *
  2305. * Values:
  2306. * - 0 - CTS has no effect on the transmitter.
  2307. * - 1 - Enables clear-to-send operation. The transmitter checks the state of
  2308. * CTS each time it is ready to send a character. If CTS is asserted, the
  2309. * character is sent. If CTS is deasserted, the signal TXD remains in the mark
  2310. * state and transmission is delayed until CTS is asserted. Changes in CTS as a
  2311. * character is being sent do not affect its transmission.
  2312. */
  2313. //@{
  2314. #define BP_UART_MODEM_TXCTSE (0U) //!< Bit position for UART_MODEM_TXCTSE.
  2315. #define BM_UART_MODEM_TXCTSE (0x01U) //!< Bit mask for UART_MODEM_TXCTSE.
  2316. #define BS_UART_MODEM_TXCTSE (1U) //!< Bit field size in bits for UART_MODEM_TXCTSE.
  2317. #ifndef __LANGUAGE_ASM__
  2318. //! @brief Read current value of the UART_MODEM_TXCTSE field.
  2319. #define BR_UART_MODEM_TXCTSE(x) (BITBAND_ACCESS8(HW_UART_MODEM_ADDR(x), BP_UART_MODEM_TXCTSE))
  2320. #endif
  2321. //! @brief Format value for bitfield UART_MODEM_TXCTSE.
  2322. #define BF_UART_MODEM_TXCTSE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_MODEM_TXCTSE), uint8_t) & BM_UART_MODEM_TXCTSE)
  2323. #ifndef __LANGUAGE_ASM__
  2324. //! @brief Set the TXCTSE field to a new value.
  2325. #define BW_UART_MODEM_TXCTSE(x, v) (BITBAND_ACCESS8(HW_UART_MODEM_ADDR(x), BP_UART_MODEM_TXCTSE) = (v))
  2326. #endif
  2327. //@}
  2328. /*!
  2329. * @name Register UART_MODEM, field TXRTSE[1] (RW)
  2330. *
  2331. * Controls RTS before and after a transmission.
  2332. *
  2333. * Values:
  2334. * - 0 - The transmitter has no effect on RTS.
  2335. * - 1 - When a character is placed into an empty transmitter data buffer , RTS
  2336. * asserts one bit time before the start bit is transmitted. RTS deasserts
  2337. * one bit time after all characters in the transmitter data buffer and shift
  2338. * register are completely sent, including the last stop bit. (FIFO) (FIFO)
  2339. */
  2340. //@{
  2341. #define BP_UART_MODEM_TXRTSE (1U) //!< Bit position for UART_MODEM_TXRTSE.
  2342. #define BM_UART_MODEM_TXRTSE (0x02U) //!< Bit mask for UART_MODEM_TXRTSE.
  2343. #define BS_UART_MODEM_TXRTSE (1U) //!< Bit field size in bits for UART_MODEM_TXRTSE.
  2344. #ifndef __LANGUAGE_ASM__
  2345. //! @brief Read current value of the UART_MODEM_TXRTSE field.
  2346. #define BR_UART_MODEM_TXRTSE(x) (BITBAND_ACCESS8(HW_UART_MODEM_ADDR(x), BP_UART_MODEM_TXRTSE))
  2347. #endif
  2348. //! @brief Format value for bitfield UART_MODEM_TXRTSE.
  2349. #define BF_UART_MODEM_TXRTSE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_MODEM_TXRTSE), uint8_t) & BM_UART_MODEM_TXRTSE)
  2350. #ifndef __LANGUAGE_ASM__
  2351. //! @brief Set the TXRTSE field to a new value.
  2352. #define BW_UART_MODEM_TXRTSE(x, v) (BITBAND_ACCESS8(HW_UART_MODEM_ADDR(x), BP_UART_MODEM_TXRTSE) = (v))
  2353. #endif
  2354. //@}
  2355. /*!
  2356. * @name Register UART_MODEM, field TXRTSPOL[2] (RW)
  2357. *
  2358. * Controls the polarity of the transmitter RTS. TXRTSPOL does not affect the
  2359. * polarity of the receiver RTS. RTS will remain negated in the active low state
  2360. * unless TXRTSE is set.
  2361. *
  2362. * Values:
  2363. * - 0 - Transmitter RTS is active low.
  2364. * - 1 - Transmitter RTS is active high.
  2365. */
  2366. //@{
  2367. #define BP_UART_MODEM_TXRTSPOL (2U) //!< Bit position for UART_MODEM_TXRTSPOL.
  2368. #define BM_UART_MODEM_TXRTSPOL (0x04U) //!< Bit mask for UART_MODEM_TXRTSPOL.
  2369. #define BS_UART_MODEM_TXRTSPOL (1U) //!< Bit field size in bits for UART_MODEM_TXRTSPOL.
  2370. #ifndef __LANGUAGE_ASM__
  2371. //! @brief Read current value of the UART_MODEM_TXRTSPOL field.
  2372. #define BR_UART_MODEM_TXRTSPOL(x) (BITBAND_ACCESS8(HW_UART_MODEM_ADDR(x), BP_UART_MODEM_TXRTSPOL))
  2373. #endif
  2374. //! @brief Format value for bitfield UART_MODEM_TXRTSPOL.
  2375. #define BF_UART_MODEM_TXRTSPOL(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_MODEM_TXRTSPOL), uint8_t) & BM_UART_MODEM_TXRTSPOL)
  2376. #ifndef __LANGUAGE_ASM__
  2377. //! @brief Set the TXRTSPOL field to a new value.
  2378. #define BW_UART_MODEM_TXRTSPOL(x, v) (BITBAND_ACCESS8(HW_UART_MODEM_ADDR(x), BP_UART_MODEM_TXRTSPOL) = (v))
  2379. #endif
  2380. //@}
  2381. /*!
  2382. * @name Register UART_MODEM, field RXRTSE[3] (RW)
  2383. *
  2384. * Allows the RTS output to control the CTS input of the transmitting device to
  2385. * prevent receiver overrun. Do not set both RXRTSE and TXRTSE.
  2386. *
  2387. * Values:
  2388. * - 0 - The receiver has no effect on RTS.
  2389. * - 1 - RTS is deasserted if the number of characters in the receiver data
  2390. * register (FIFO) is equal to or greater than RWFIFO[RXWATER]. RTS is asserted
  2391. * when the number of characters in the receiver data register (FIFO) is less
  2392. * than RWFIFO[RXWATER].
  2393. */
  2394. //@{
  2395. #define BP_UART_MODEM_RXRTSE (3U) //!< Bit position for UART_MODEM_RXRTSE.
  2396. #define BM_UART_MODEM_RXRTSE (0x08U) //!< Bit mask for UART_MODEM_RXRTSE.
  2397. #define BS_UART_MODEM_RXRTSE (1U) //!< Bit field size in bits for UART_MODEM_RXRTSE.
  2398. #ifndef __LANGUAGE_ASM__
  2399. //! @brief Read current value of the UART_MODEM_RXRTSE field.
  2400. #define BR_UART_MODEM_RXRTSE(x) (BITBAND_ACCESS8(HW_UART_MODEM_ADDR(x), BP_UART_MODEM_RXRTSE))
  2401. #endif
  2402. //! @brief Format value for bitfield UART_MODEM_RXRTSE.
  2403. #define BF_UART_MODEM_RXRTSE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_MODEM_RXRTSE), uint8_t) & BM_UART_MODEM_RXRTSE)
  2404. #ifndef __LANGUAGE_ASM__
  2405. //! @brief Set the RXRTSE field to a new value.
  2406. #define BW_UART_MODEM_RXRTSE(x, v) (BITBAND_ACCESS8(HW_UART_MODEM_ADDR(x), BP_UART_MODEM_RXRTSE) = (v))
  2407. #endif
  2408. //@}
  2409. //-------------------------------------------------------------------------------------------
  2410. // HW_UART_IR - UART Infrared Register
  2411. //-------------------------------------------------------------------------------------------
  2412. #ifndef __LANGUAGE_ASM__
  2413. /*!
  2414. * @brief HW_UART_IR - UART Infrared Register (RW)
  2415. *
  2416. * Reset value: 0x00U
  2417. *
  2418. * The IR register controls options for setting the infrared configuration.
  2419. */
  2420. typedef union _hw_uart_ir
  2421. {
  2422. uint8_t U;
  2423. struct _hw_uart_ir_bitfields
  2424. {
  2425. uint8_t TNP : 2; //!< [1:0] Transmitter narrow pulse
  2426. uint8_t IREN : 1; //!< [2] Infrared enable
  2427. uint8_t RESERVED0 : 5; //!< [7:3]
  2428. } B;
  2429. } hw_uart_ir_t;
  2430. #endif
  2431. /*!
  2432. * @name Constants and macros for entire UART_IR register
  2433. */
  2434. //@{
  2435. #define HW_UART_IR_ADDR(x) (REGS_UART_BASE(x) + 0xEU)
  2436. #ifndef __LANGUAGE_ASM__
  2437. #define HW_UART_IR(x) (*(__IO hw_uart_ir_t *) HW_UART_IR_ADDR(x))
  2438. #define HW_UART_IR_RD(x) (HW_UART_IR(x).U)
  2439. #define HW_UART_IR_WR(x, v) (HW_UART_IR(x).U = (v))
  2440. #define HW_UART_IR_SET(x, v) (HW_UART_IR_WR(x, HW_UART_IR_RD(x) | (v)))
  2441. #define HW_UART_IR_CLR(x, v) (HW_UART_IR_WR(x, HW_UART_IR_RD(x) & ~(v)))
  2442. #define HW_UART_IR_TOG(x, v) (HW_UART_IR_WR(x, HW_UART_IR_RD(x) ^ (v)))
  2443. #endif
  2444. //@}
  2445. /*
  2446. * Constants & macros for individual UART_IR bitfields
  2447. */
  2448. /*!
  2449. * @name Register UART_IR, field TNP[1:0] (RW)
  2450. *
  2451. * Enables whether the UART transmits a 1/16, 3/16, 1/32, or 1/4 narrow pulse.
  2452. *
  2453. * Values:
  2454. * - 00 - 3/16.
  2455. * - 01 - 1/16.
  2456. * - 10 - 1/32.
  2457. * - 11 - 1/4.
  2458. */
  2459. //@{
  2460. #define BP_UART_IR_TNP (0U) //!< Bit position for UART_IR_TNP.
  2461. #define BM_UART_IR_TNP (0x03U) //!< Bit mask for UART_IR_TNP.
  2462. #define BS_UART_IR_TNP (2U) //!< Bit field size in bits for UART_IR_TNP.
  2463. #ifndef __LANGUAGE_ASM__
  2464. //! @brief Read current value of the UART_IR_TNP field.
  2465. #define BR_UART_IR_TNP(x) (HW_UART_IR(x).B.TNP)
  2466. #endif
  2467. //! @brief Format value for bitfield UART_IR_TNP.
  2468. #define BF_UART_IR_TNP(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_IR_TNP), uint8_t) & BM_UART_IR_TNP)
  2469. #ifndef __LANGUAGE_ASM__
  2470. //! @brief Set the TNP field to a new value.
  2471. #define BW_UART_IR_TNP(x, v) (HW_UART_IR_WR(x, (HW_UART_IR_RD(x) & ~BM_UART_IR_TNP) | BF_UART_IR_TNP(v)))
  2472. #endif
  2473. //@}
  2474. /*!
  2475. * @name Register UART_IR, field IREN[2] (RW)
  2476. *
  2477. * Enables/disables the infrared modulation/demodulation.
  2478. *
  2479. * Values:
  2480. * - 0 - IR disabled.
  2481. * - 1 - IR enabled.
  2482. */
  2483. //@{
  2484. #define BP_UART_IR_IREN (2U) //!< Bit position for UART_IR_IREN.
  2485. #define BM_UART_IR_IREN (0x04U) //!< Bit mask for UART_IR_IREN.
  2486. #define BS_UART_IR_IREN (1U) //!< Bit field size in bits for UART_IR_IREN.
  2487. #ifndef __LANGUAGE_ASM__
  2488. //! @brief Read current value of the UART_IR_IREN field.
  2489. #define BR_UART_IR_IREN(x) (BITBAND_ACCESS8(HW_UART_IR_ADDR(x), BP_UART_IR_IREN))
  2490. #endif
  2491. //! @brief Format value for bitfield UART_IR_IREN.
  2492. #define BF_UART_IR_IREN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_IR_IREN), uint8_t) & BM_UART_IR_IREN)
  2493. #ifndef __LANGUAGE_ASM__
  2494. //! @brief Set the IREN field to a new value.
  2495. #define BW_UART_IR_IREN(x, v) (BITBAND_ACCESS8(HW_UART_IR_ADDR(x), BP_UART_IR_IREN) = (v))
  2496. #endif
  2497. //@}
  2498. //-------------------------------------------------------------------------------------------
  2499. // HW_UART_PFIFO - UART FIFO Parameters
  2500. //-------------------------------------------------------------------------------------------
  2501. #ifndef __LANGUAGE_ASM__
  2502. /*!
  2503. * @brief HW_UART_PFIFO - UART FIFO Parameters (RW)
  2504. *
  2505. * Reset value: 0x00U
  2506. *
  2507. * This register provides the ability for the programmer to turn on and off FIFO
  2508. * functionality. It also provides the size of the FIFO that has been
  2509. * implemented. This register may be read at any time. This register must be written only
  2510. * when C2[RE] and C2[TE] are cleared/not set and when the data buffer/FIFO is
  2511. * empty.
  2512. */
  2513. typedef union _hw_uart_pfifo
  2514. {
  2515. uint8_t U;
  2516. struct _hw_uart_pfifo_bitfields
  2517. {
  2518. uint8_t RXFIFOSIZE : 3; //!< [2:0] Receive FIFO. Buffer Depth
  2519. uint8_t RXFE : 1; //!< [3] Receive FIFO Enable
  2520. uint8_t TXFIFOSIZE : 3; //!< [6:4] Transmit FIFO. Buffer Depth
  2521. uint8_t TXFE : 1; //!< [7] Transmit FIFO Enable
  2522. } B;
  2523. } hw_uart_pfifo_t;
  2524. #endif
  2525. /*!
  2526. * @name Constants and macros for entire UART_PFIFO register
  2527. */
  2528. //@{
  2529. #define HW_UART_PFIFO_ADDR(x) (REGS_UART_BASE(x) + 0x10U)
  2530. #ifndef __LANGUAGE_ASM__
  2531. #define HW_UART_PFIFO(x) (*(__IO hw_uart_pfifo_t *) HW_UART_PFIFO_ADDR(x))
  2532. #define HW_UART_PFIFO_RD(x) (HW_UART_PFIFO(x).U)
  2533. #define HW_UART_PFIFO_WR(x, v) (HW_UART_PFIFO(x).U = (v))
  2534. #define HW_UART_PFIFO_SET(x, v) (HW_UART_PFIFO_WR(x, HW_UART_PFIFO_RD(x) | (v)))
  2535. #define HW_UART_PFIFO_CLR(x, v) (HW_UART_PFIFO_WR(x, HW_UART_PFIFO_RD(x) & ~(v)))
  2536. #define HW_UART_PFIFO_TOG(x, v) (HW_UART_PFIFO_WR(x, HW_UART_PFIFO_RD(x) ^ (v)))
  2537. #endif
  2538. //@}
  2539. /*
  2540. * Constants & macros for individual UART_PFIFO bitfields
  2541. */
  2542. /*!
  2543. * @name Register UART_PFIFO, field RXFIFOSIZE[2:0] (RO)
  2544. *
  2545. * The maximum number of receive datawords that can be stored in the receive
  2546. * buffer before an overrun occurs. This field is read only.
  2547. *
  2548. * Values:
  2549. * - 000 - Receive FIFO/Buffer depth = 1 dataword.
  2550. * - 001 - Receive FIFO/Buffer depth = 4 datawords.
  2551. * - 010 - Receive FIFO/Buffer depth = 8 datawords.
  2552. * - 011 - Receive FIFO/Buffer depth = 16 datawords.
  2553. * - 100 - Receive FIFO/Buffer depth = 32 datawords.
  2554. * - 101 - Receive FIFO/Buffer depth = 64 datawords.
  2555. * - 110 - Receive FIFO/Buffer depth = 128 datawords.
  2556. * - 111 - Reserved.
  2557. */
  2558. //@{
  2559. #define BP_UART_PFIFO_RXFIFOSIZE (0U) //!< Bit position for UART_PFIFO_RXFIFOSIZE.
  2560. #define BM_UART_PFIFO_RXFIFOSIZE (0x07U) //!< Bit mask for UART_PFIFO_RXFIFOSIZE.
  2561. #define BS_UART_PFIFO_RXFIFOSIZE (3U) //!< Bit field size in bits for UART_PFIFO_RXFIFOSIZE.
  2562. #ifndef __LANGUAGE_ASM__
  2563. //! @brief Read current value of the UART_PFIFO_RXFIFOSIZE field.
  2564. #define BR_UART_PFIFO_RXFIFOSIZE(x) (HW_UART_PFIFO(x).B.RXFIFOSIZE)
  2565. #endif
  2566. //@}
  2567. /*!
  2568. * @name Register UART_PFIFO, field RXFE[3] (RW)
  2569. *
  2570. * When this field is set, the built in FIFO structure for the receive buffer is
  2571. * enabled. The size of the FIFO structure is indicated by the RXFIFOSIZE field.
  2572. * If this field is not set, the receive buffer operates as a FIFO of depth one
  2573. * dataword regardless of the value in RXFIFOSIZE. Both C2[TE] and C2[RE] must be
  2574. * cleared prior to changing this field. Additionally, TXFLUSH and RXFLUSH
  2575. * commands must be issued immediately after changing this field.
  2576. *
  2577. * Values:
  2578. * - 0 - Receive FIFO is not enabled. Buffer is depth 1. (Legacy support)
  2579. * - 1 - Receive FIFO is enabled. Buffer is depth indicted by RXFIFOSIZE.
  2580. */
  2581. //@{
  2582. #define BP_UART_PFIFO_RXFE (3U) //!< Bit position for UART_PFIFO_RXFE.
  2583. #define BM_UART_PFIFO_RXFE (0x08U) //!< Bit mask for UART_PFIFO_RXFE.
  2584. #define BS_UART_PFIFO_RXFE (1U) //!< Bit field size in bits for UART_PFIFO_RXFE.
  2585. #ifndef __LANGUAGE_ASM__
  2586. //! @brief Read current value of the UART_PFIFO_RXFE field.
  2587. #define BR_UART_PFIFO_RXFE(x) (BITBAND_ACCESS8(HW_UART_PFIFO_ADDR(x), BP_UART_PFIFO_RXFE))
  2588. #endif
  2589. //! @brief Format value for bitfield UART_PFIFO_RXFE.
  2590. #define BF_UART_PFIFO_RXFE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_PFIFO_RXFE), uint8_t) & BM_UART_PFIFO_RXFE)
  2591. #ifndef __LANGUAGE_ASM__
  2592. //! @brief Set the RXFE field to a new value.
  2593. #define BW_UART_PFIFO_RXFE(x, v) (BITBAND_ACCESS8(HW_UART_PFIFO_ADDR(x), BP_UART_PFIFO_RXFE) = (v))
  2594. #endif
  2595. //@}
  2596. /*!
  2597. * @name Register UART_PFIFO, field TXFIFOSIZE[6:4] (RO)
  2598. *
  2599. * The maximum number of transmit datawords that can be stored in the transmit
  2600. * buffer. This field is read only.
  2601. *
  2602. * Values:
  2603. * - 000 - Transmit FIFO/Buffer depth = 1 dataword.
  2604. * - 001 - Transmit FIFO/Buffer depth = 4 datawords.
  2605. * - 010 - Transmit FIFO/Buffer depth = 8 datawords.
  2606. * - 011 - Transmit FIFO/Buffer depth = 16 datawords.
  2607. * - 100 - Transmit FIFO/Buffer depth = 32 datawords.
  2608. * - 101 - Transmit FIFO/Buffer depth = 64 datawords.
  2609. * - 110 - Transmit FIFO/Buffer depth = 128 datawords.
  2610. * - 111 - Reserved.
  2611. */
  2612. //@{
  2613. #define BP_UART_PFIFO_TXFIFOSIZE (4U) //!< Bit position for UART_PFIFO_TXFIFOSIZE.
  2614. #define BM_UART_PFIFO_TXFIFOSIZE (0x70U) //!< Bit mask for UART_PFIFO_TXFIFOSIZE.
  2615. #define BS_UART_PFIFO_TXFIFOSIZE (3U) //!< Bit field size in bits for UART_PFIFO_TXFIFOSIZE.
  2616. #ifndef __LANGUAGE_ASM__
  2617. //! @brief Read current value of the UART_PFIFO_TXFIFOSIZE field.
  2618. #define BR_UART_PFIFO_TXFIFOSIZE(x) (HW_UART_PFIFO(x).B.TXFIFOSIZE)
  2619. #endif
  2620. //@}
  2621. /*!
  2622. * @name Register UART_PFIFO, field TXFE[7] (RW)
  2623. *
  2624. * When this field is set, the built in FIFO structure for the transmit buffer
  2625. * is enabled. The size of the FIFO structure is indicated by TXFIFOSIZE. If this
  2626. * field is not set, the transmit buffer operates as a FIFO of depth one dataword
  2627. * regardless of the value in TXFIFOSIZE. Both C2[TE] and C2[RE] must be cleared
  2628. * prior to changing this field. Additionally, TXFLUSH and RXFLUSH commands must
  2629. * be issued immediately after changing this field.
  2630. *
  2631. * Values:
  2632. * - 0 - Transmit FIFO is not enabled. Buffer is depth 1. (Legacy support).
  2633. * - 1 - Transmit FIFO is enabled. Buffer is depth indicated by TXFIFOSIZE.
  2634. */
  2635. //@{
  2636. #define BP_UART_PFIFO_TXFE (7U) //!< Bit position for UART_PFIFO_TXFE.
  2637. #define BM_UART_PFIFO_TXFE (0x80U) //!< Bit mask for UART_PFIFO_TXFE.
  2638. #define BS_UART_PFIFO_TXFE (1U) //!< Bit field size in bits for UART_PFIFO_TXFE.
  2639. #ifndef __LANGUAGE_ASM__
  2640. //! @brief Read current value of the UART_PFIFO_TXFE field.
  2641. #define BR_UART_PFIFO_TXFE(x) (BITBAND_ACCESS8(HW_UART_PFIFO_ADDR(x), BP_UART_PFIFO_TXFE))
  2642. #endif
  2643. //! @brief Format value for bitfield UART_PFIFO_TXFE.
  2644. #define BF_UART_PFIFO_TXFE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_PFIFO_TXFE), uint8_t) & BM_UART_PFIFO_TXFE)
  2645. #ifndef __LANGUAGE_ASM__
  2646. //! @brief Set the TXFE field to a new value.
  2647. #define BW_UART_PFIFO_TXFE(x, v) (BITBAND_ACCESS8(HW_UART_PFIFO_ADDR(x), BP_UART_PFIFO_TXFE) = (v))
  2648. #endif
  2649. //@}
  2650. //-------------------------------------------------------------------------------------------
  2651. // HW_UART_CFIFO - UART FIFO Control Register
  2652. //-------------------------------------------------------------------------------------------
  2653. #ifndef __LANGUAGE_ASM__
  2654. /*!
  2655. * @brief HW_UART_CFIFO - UART FIFO Control Register (RW)
  2656. *
  2657. * Reset value: 0x00U
  2658. *
  2659. * This register provides the ability to program various control fields for FIFO
  2660. * operation. This register may be read or written at any time. Note that
  2661. * writing to TXFLUSH and RXFLUSH may result in data loss and requires careful action
  2662. * to prevent unintended/unpredictable behavior. Therefore, it is recommended that
  2663. * TE and RE be cleared prior to flushing the corresponding FIFO.
  2664. */
  2665. typedef union _hw_uart_cfifo
  2666. {
  2667. uint8_t U;
  2668. struct _hw_uart_cfifo_bitfields
  2669. {
  2670. uint8_t RXUFE : 1; //!< [0] Receive FIFO Underflow Interrupt Enable
  2671. uint8_t TXOFE : 1; //!< [1] Transmit FIFO Overflow Interrupt Enable
  2672. uint8_t RXOFE : 1; //!< [2] Receive FIFO Overflow Interrupt Enable
  2673. uint8_t RESERVED0 : 3; //!< [5:3]
  2674. uint8_t RXFLUSH : 1; //!< [6] Receive FIFO/Buffer Flush
  2675. uint8_t TXFLUSH : 1; //!< [7] Transmit FIFO/Buffer Flush
  2676. } B;
  2677. } hw_uart_cfifo_t;
  2678. #endif
  2679. /*!
  2680. * @name Constants and macros for entire UART_CFIFO register
  2681. */
  2682. //@{
  2683. #define HW_UART_CFIFO_ADDR(x) (REGS_UART_BASE(x) + 0x11U)
  2684. #ifndef __LANGUAGE_ASM__
  2685. #define HW_UART_CFIFO(x) (*(__IO hw_uart_cfifo_t *) HW_UART_CFIFO_ADDR(x))
  2686. #define HW_UART_CFIFO_RD(x) (HW_UART_CFIFO(x).U)
  2687. #define HW_UART_CFIFO_WR(x, v) (HW_UART_CFIFO(x).U = (v))
  2688. #define HW_UART_CFIFO_SET(x, v) (HW_UART_CFIFO_WR(x, HW_UART_CFIFO_RD(x) | (v)))
  2689. #define HW_UART_CFIFO_CLR(x, v) (HW_UART_CFIFO_WR(x, HW_UART_CFIFO_RD(x) & ~(v)))
  2690. #define HW_UART_CFIFO_TOG(x, v) (HW_UART_CFIFO_WR(x, HW_UART_CFIFO_RD(x) ^ (v)))
  2691. #endif
  2692. //@}
  2693. /*
  2694. * Constants & macros for individual UART_CFIFO bitfields
  2695. */
  2696. /*!
  2697. * @name Register UART_CFIFO, field RXUFE[0] (RW)
  2698. *
  2699. * When this field is set, the RXUF flag generates an interrupt to the host.
  2700. *
  2701. * Values:
  2702. * - 0 - RXUF flag does not generate an interrupt to the host.
  2703. * - 1 - RXUF flag generates an interrupt to the host.
  2704. */
  2705. //@{
  2706. #define BP_UART_CFIFO_RXUFE (0U) //!< Bit position for UART_CFIFO_RXUFE.
  2707. #define BM_UART_CFIFO_RXUFE (0x01U) //!< Bit mask for UART_CFIFO_RXUFE.
  2708. #define BS_UART_CFIFO_RXUFE (1U) //!< Bit field size in bits for UART_CFIFO_RXUFE.
  2709. #ifndef __LANGUAGE_ASM__
  2710. //! @brief Read current value of the UART_CFIFO_RXUFE field.
  2711. #define BR_UART_CFIFO_RXUFE(x) (BITBAND_ACCESS8(HW_UART_CFIFO_ADDR(x), BP_UART_CFIFO_RXUFE))
  2712. #endif
  2713. //! @brief Format value for bitfield UART_CFIFO_RXUFE.
  2714. #define BF_UART_CFIFO_RXUFE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_CFIFO_RXUFE), uint8_t) & BM_UART_CFIFO_RXUFE)
  2715. #ifndef __LANGUAGE_ASM__
  2716. //! @brief Set the RXUFE field to a new value.
  2717. #define BW_UART_CFIFO_RXUFE(x, v) (BITBAND_ACCESS8(HW_UART_CFIFO_ADDR(x), BP_UART_CFIFO_RXUFE) = (v))
  2718. #endif
  2719. //@}
  2720. /*!
  2721. * @name Register UART_CFIFO, field TXOFE[1] (RW)
  2722. *
  2723. * When this field is set, the TXOF flag generates an interrupt to the host.
  2724. *
  2725. * Values:
  2726. * - 0 - TXOF flag does not generate an interrupt to the host.
  2727. * - 1 - TXOF flag generates an interrupt to the host.
  2728. */
  2729. //@{
  2730. #define BP_UART_CFIFO_TXOFE (1U) //!< Bit position for UART_CFIFO_TXOFE.
  2731. #define BM_UART_CFIFO_TXOFE (0x02U) //!< Bit mask for UART_CFIFO_TXOFE.
  2732. #define BS_UART_CFIFO_TXOFE (1U) //!< Bit field size in bits for UART_CFIFO_TXOFE.
  2733. #ifndef __LANGUAGE_ASM__
  2734. //! @brief Read current value of the UART_CFIFO_TXOFE field.
  2735. #define BR_UART_CFIFO_TXOFE(x) (BITBAND_ACCESS8(HW_UART_CFIFO_ADDR(x), BP_UART_CFIFO_TXOFE))
  2736. #endif
  2737. //! @brief Format value for bitfield UART_CFIFO_TXOFE.
  2738. #define BF_UART_CFIFO_TXOFE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_CFIFO_TXOFE), uint8_t) & BM_UART_CFIFO_TXOFE)
  2739. #ifndef __LANGUAGE_ASM__
  2740. //! @brief Set the TXOFE field to a new value.
  2741. #define BW_UART_CFIFO_TXOFE(x, v) (BITBAND_ACCESS8(HW_UART_CFIFO_ADDR(x), BP_UART_CFIFO_TXOFE) = (v))
  2742. #endif
  2743. //@}
  2744. /*!
  2745. * @name Register UART_CFIFO, field RXOFE[2] (RW)
  2746. *
  2747. * When this field is set, the RXOF flag generates an interrupt to the host.
  2748. *
  2749. * Values:
  2750. * - 0 - RXOF flag does not generate an interrupt to the host.
  2751. * - 1 - RXOF flag generates an interrupt to the host.
  2752. */
  2753. //@{
  2754. #define BP_UART_CFIFO_RXOFE (2U) //!< Bit position for UART_CFIFO_RXOFE.
  2755. #define BM_UART_CFIFO_RXOFE (0x04U) //!< Bit mask for UART_CFIFO_RXOFE.
  2756. #define BS_UART_CFIFO_RXOFE (1U) //!< Bit field size in bits for UART_CFIFO_RXOFE.
  2757. #ifndef __LANGUAGE_ASM__
  2758. //! @brief Read current value of the UART_CFIFO_RXOFE field.
  2759. #define BR_UART_CFIFO_RXOFE(x) (BITBAND_ACCESS8(HW_UART_CFIFO_ADDR(x), BP_UART_CFIFO_RXOFE))
  2760. #endif
  2761. //! @brief Format value for bitfield UART_CFIFO_RXOFE.
  2762. #define BF_UART_CFIFO_RXOFE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_CFIFO_RXOFE), uint8_t) & BM_UART_CFIFO_RXOFE)
  2763. #ifndef __LANGUAGE_ASM__
  2764. //! @brief Set the RXOFE field to a new value.
  2765. #define BW_UART_CFIFO_RXOFE(x, v) (BITBAND_ACCESS8(HW_UART_CFIFO_ADDR(x), BP_UART_CFIFO_RXOFE) = (v))
  2766. #endif
  2767. //@}
  2768. /*!
  2769. * @name Register UART_CFIFO, field RXFLUSH[6] (WORZ)
  2770. *
  2771. * Writing to this field causes all data that is stored in the receive
  2772. * FIFO/buffer to be flushed. This does not affect data that is in the receive shift
  2773. * register.
  2774. *
  2775. * Values:
  2776. * - 0 - No flush operation occurs.
  2777. * - 1 - All data in the receive FIFO/buffer is cleared out.
  2778. */
  2779. //@{
  2780. #define BP_UART_CFIFO_RXFLUSH (6U) //!< Bit position for UART_CFIFO_RXFLUSH.
  2781. #define BM_UART_CFIFO_RXFLUSH (0x40U) //!< Bit mask for UART_CFIFO_RXFLUSH.
  2782. #define BS_UART_CFIFO_RXFLUSH (1U) //!< Bit field size in bits for UART_CFIFO_RXFLUSH.
  2783. //! @brief Format value for bitfield UART_CFIFO_RXFLUSH.
  2784. #define BF_UART_CFIFO_RXFLUSH(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_CFIFO_RXFLUSH), uint8_t) & BM_UART_CFIFO_RXFLUSH)
  2785. #ifndef __LANGUAGE_ASM__
  2786. //! @brief Set the RXFLUSH field to a new value.
  2787. #define BW_UART_CFIFO_RXFLUSH(x, v) (BITBAND_ACCESS8(HW_UART_CFIFO_ADDR(x), BP_UART_CFIFO_RXFLUSH) = (v))
  2788. #endif
  2789. //@}
  2790. /*!
  2791. * @name Register UART_CFIFO, field TXFLUSH[7] (WORZ)
  2792. *
  2793. * Writing to this field causes all data that is stored in the transmit
  2794. * FIFO/buffer to be flushed. This does not affect data that is in the transmit shift
  2795. * register.
  2796. *
  2797. * Values:
  2798. * - 0 - No flush operation occurs.
  2799. * - 1 - All data in the transmit FIFO/Buffer is cleared out.
  2800. */
  2801. //@{
  2802. #define BP_UART_CFIFO_TXFLUSH (7U) //!< Bit position for UART_CFIFO_TXFLUSH.
  2803. #define BM_UART_CFIFO_TXFLUSH (0x80U) //!< Bit mask for UART_CFIFO_TXFLUSH.
  2804. #define BS_UART_CFIFO_TXFLUSH (1U) //!< Bit field size in bits for UART_CFIFO_TXFLUSH.
  2805. //! @brief Format value for bitfield UART_CFIFO_TXFLUSH.
  2806. #define BF_UART_CFIFO_TXFLUSH(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_CFIFO_TXFLUSH), uint8_t) & BM_UART_CFIFO_TXFLUSH)
  2807. #ifndef __LANGUAGE_ASM__
  2808. //! @brief Set the TXFLUSH field to a new value.
  2809. #define BW_UART_CFIFO_TXFLUSH(x, v) (BITBAND_ACCESS8(HW_UART_CFIFO_ADDR(x), BP_UART_CFIFO_TXFLUSH) = (v))
  2810. #endif
  2811. //@}
  2812. //-------------------------------------------------------------------------------------------
  2813. // HW_UART_SFIFO - UART FIFO Status Register
  2814. //-------------------------------------------------------------------------------------------
  2815. #ifndef __LANGUAGE_ASM__
  2816. /*!
  2817. * @brief HW_UART_SFIFO - UART FIFO Status Register (RW)
  2818. *
  2819. * Reset value: 0xC0U
  2820. *
  2821. * This register provides status information regarding the transmit and receiver
  2822. * buffers/FIFOs, including interrupt information. This register may be written
  2823. * to or read at any time.
  2824. */
  2825. typedef union _hw_uart_sfifo
  2826. {
  2827. uint8_t U;
  2828. struct _hw_uart_sfifo_bitfields
  2829. {
  2830. uint8_t RXUF : 1; //!< [0] Receiver Buffer Underflow Flag
  2831. uint8_t TXOF : 1; //!< [1] Transmitter Buffer Overflow Flag
  2832. uint8_t RXOF : 1; //!< [2] Receiver Buffer Overflow Flag
  2833. uint8_t RESERVED0 : 3; //!< [5:3]
  2834. uint8_t RXEMPT : 1; //!< [6] Receive Buffer/FIFO Empty
  2835. uint8_t TXEMPT : 1; //!< [7] Transmit Buffer/FIFO Empty
  2836. } B;
  2837. } hw_uart_sfifo_t;
  2838. #endif
  2839. /*!
  2840. * @name Constants and macros for entire UART_SFIFO register
  2841. */
  2842. //@{
  2843. #define HW_UART_SFIFO_ADDR(x) (REGS_UART_BASE(x) + 0x12U)
  2844. #ifndef __LANGUAGE_ASM__
  2845. #define HW_UART_SFIFO(x) (*(__IO hw_uart_sfifo_t *) HW_UART_SFIFO_ADDR(x))
  2846. #define HW_UART_SFIFO_RD(x) (HW_UART_SFIFO(x).U)
  2847. #define HW_UART_SFIFO_WR(x, v) (HW_UART_SFIFO(x).U = (v))
  2848. #define HW_UART_SFIFO_SET(x, v) (HW_UART_SFIFO_WR(x, HW_UART_SFIFO_RD(x) | (v)))
  2849. #define HW_UART_SFIFO_CLR(x, v) (HW_UART_SFIFO_WR(x, HW_UART_SFIFO_RD(x) & ~(v)))
  2850. #define HW_UART_SFIFO_TOG(x, v) (HW_UART_SFIFO_WR(x, HW_UART_SFIFO_RD(x) ^ (v)))
  2851. #endif
  2852. //@}
  2853. /*
  2854. * Constants & macros for individual UART_SFIFO bitfields
  2855. */
  2856. /*!
  2857. * @name Register UART_SFIFO, field RXUF[0] (W1C)
  2858. *
  2859. * Indicates that more data has been read from the receive buffer than was
  2860. * present. This field will assert regardless of the value of CFIFO[RXUFE]. However,
  2861. * an interrupt will be issued to the host only if CFIFO[RXUFE] is set. This flag
  2862. * is cleared by writing a 1.
  2863. *
  2864. * Values:
  2865. * - 0 - No receive buffer underflow has occurred since the last time the flag
  2866. * was cleared.
  2867. * - 1 - At least one receive buffer underflow has occurred since the last time
  2868. * the flag was cleared.
  2869. */
  2870. //@{
  2871. #define BP_UART_SFIFO_RXUF (0U) //!< Bit position for UART_SFIFO_RXUF.
  2872. #define BM_UART_SFIFO_RXUF (0x01U) //!< Bit mask for UART_SFIFO_RXUF.
  2873. #define BS_UART_SFIFO_RXUF (1U) //!< Bit field size in bits for UART_SFIFO_RXUF.
  2874. #ifndef __LANGUAGE_ASM__
  2875. //! @brief Read current value of the UART_SFIFO_RXUF field.
  2876. #define BR_UART_SFIFO_RXUF(x) (BITBAND_ACCESS8(HW_UART_SFIFO_ADDR(x), BP_UART_SFIFO_RXUF))
  2877. #endif
  2878. //! @brief Format value for bitfield UART_SFIFO_RXUF.
  2879. #define BF_UART_SFIFO_RXUF(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_SFIFO_RXUF), uint8_t) & BM_UART_SFIFO_RXUF)
  2880. #ifndef __LANGUAGE_ASM__
  2881. //! @brief Set the RXUF field to a new value.
  2882. #define BW_UART_SFIFO_RXUF(x, v) (BITBAND_ACCESS8(HW_UART_SFIFO_ADDR(x), BP_UART_SFIFO_RXUF) = (v))
  2883. #endif
  2884. //@}
  2885. /*!
  2886. * @name Register UART_SFIFO, field TXOF[1] (W1C)
  2887. *
  2888. * Indicates that more data has been written to the transmit buffer than it can
  2889. * hold. This field will assert regardless of the value of CFIFO[TXOFE]. However,
  2890. * an interrupt will be issued to the host only if CFIFO[TXOFE] is set. This
  2891. * flag is cleared by writing a 1.
  2892. *
  2893. * Values:
  2894. * - 0 - No transmit buffer overflow has occurred since the last time the flag
  2895. * was cleared.
  2896. * - 1 - At least one transmit buffer overflow has occurred since the last time
  2897. * the flag was cleared.
  2898. */
  2899. //@{
  2900. #define BP_UART_SFIFO_TXOF (1U) //!< Bit position for UART_SFIFO_TXOF.
  2901. #define BM_UART_SFIFO_TXOF (0x02U) //!< Bit mask for UART_SFIFO_TXOF.
  2902. #define BS_UART_SFIFO_TXOF (1U) //!< Bit field size in bits for UART_SFIFO_TXOF.
  2903. #ifndef __LANGUAGE_ASM__
  2904. //! @brief Read current value of the UART_SFIFO_TXOF field.
  2905. #define BR_UART_SFIFO_TXOF(x) (BITBAND_ACCESS8(HW_UART_SFIFO_ADDR(x), BP_UART_SFIFO_TXOF))
  2906. #endif
  2907. //! @brief Format value for bitfield UART_SFIFO_TXOF.
  2908. #define BF_UART_SFIFO_TXOF(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_SFIFO_TXOF), uint8_t) & BM_UART_SFIFO_TXOF)
  2909. #ifndef __LANGUAGE_ASM__
  2910. //! @brief Set the TXOF field to a new value.
  2911. #define BW_UART_SFIFO_TXOF(x, v) (BITBAND_ACCESS8(HW_UART_SFIFO_ADDR(x), BP_UART_SFIFO_TXOF) = (v))
  2912. #endif
  2913. //@}
  2914. /*!
  2915. * @name Register UART_SFIFO, field RXOF[2] (W1C)
  2916. *
  2917. * Indicates that more data has been written to the receive buffer than it can
  2918. * hold. This field will assert regardless of the value of CFIFO[RXOFE]. However,
  2919. * an interrupt will be issued to the host only if CFIFO[RXOFE] is set. This flag
  2920. * is cleared by writing a 1.
  2921. *
  2922. * Values:
  2923. * - 0 - No receive buffer overflow has occurred since the last time the flag
  2924. * was cleared.
  2925. * - 1 - At least one receive buffer overflow has occurred since the last time
  2926. * the flag was cleared.
  2927. */
  2928. //@{
  2929. #define BP_UART_SFIFO_RXOF (2U) //!< Bit position for UART_SFIFO_RXOF.
  2930. #define BM_UART_SFIFO_RXOF (0x04U) //!< Bit mask for UART_SFIFO_RXOF.
  2931. #define BS_UART_SFIFO_RXOF (1U) //!< Bit field size in bits for UART_SFIFO_RXOF.
  2932. #ifndef __LANGUAGE_ASM__
  2933. //! @brief Read current value of the UART_SFIFO_RXOF field.
  2934. #define BR_UART_SFIFO_RXOF(x) (BITBAND_ACCESS8(HW_UART_SFIFO_ADDR(x), BP_UART_SFIFO_RXOF))
  2935. #endif
  2936. //! @brief Format value for bitfield UART_SFIFO_RXOF.
  2937. #define BF_UART_SFIFO_RXOF(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_SFIFO_RXOF), uint8_t) & BM_UART_SFIFO_RXOF)
  2938. #ifndef __LANGUAGE_ASM__
  2939. //! @brief Set the RXOF field to a new value.
  2940. #define BW_UART_SFIFO_RXOF(x, v) (BITBAND_ACCESS8(HW_UART_SFIFO_ADDR(x), BP_UART_SFIFO_RXOF) = (v))
  2941. #endif
  2942. //@}
  2943. /*!
  2944. * @name Register UART_SFIFO, field RXEMPT[6] (RO)
  2945. *
  2946. * Asserts when there is no data in the receive FIFO/Buffer. This field does not
  2947. * take into account data that is in the receive shift register.
  2948. *
  2949. * Values:
  2950. * - 0 - Receive buffer is not empty.
  2951. * - 1 - Receive buffer is empty.
  2952. */
  2953. //@{
  2954. #define BP_UART_SFIFO_RXEMPT (6U) //!< Bit position for UART_SFIFO_RXEMPT.
  2955. #define BM_UART_SFIFO_RXEMPT (0x40U) //!< Bit mask for UART_SFIFO_RXEMPT.
  2956. #define BS_UART_SFIFO_RXEMPT (1U) //!< Bit field size in bits for UART_SFIFO_RXEMPT.
  2957. #ifndef __LANGUAGE_ASM__
  2958. //! @brief Read current value of the UART_SFIFO_RXEMPT field.
  2959. #define BR_UART_SFIFO_RXEMPT(x) (BITBAND_ACCESS8(HW_UART_SFIFO_ADDR(x), BP_UART_SFIFO_RXEMPT))
  2960. #endif
  2961. //@}
  2962. /*!
  2963. * @name Register UART_SFIFO, field TXEMPT[7] (RO)
  2964. *
  2965. * Asserts when there is no data in the Transmit FIFO/buffer. This field does
  2966. * not take into account data that is in the transmit shift register.
  2967. *
  2968. * Values:
  2969. * - 0 - Transmit buffer is not empty.
  2970. * - 1 - Transmit buffer is empty.
  2971. */
  2972. //@{
  2973. #define BP_UART_SFIFO_TXEMPT (7U) //!< Bit position for UART_SFIFO_TXEMPT.
  2974. #define BM_UART_SFIFO_TXEMPT (0x80U) //!< Bit mask for UART_SFIFO_TXEMPT.
  2975. #define BS_UART_SFIFO_TXEMPT (1U) //!< Bit field size in bits for UART_SFIFO_TXEMPT.
  2976. #ifndef __LANGUAGE_ASM__
  2977. //! @brief Read current value of the UART_SFIFO_TXEMPT field.
  2978. #define BR_UART_SFIFO_TXEMPT(x) (BITBAND_ACCESS8(HW_UART_SFIFO_ADDR(x), BP_UART_SFIFO_TXEMPT))
  2979. #endif
  2980. //@}
  2981. //-------------------------------------------------------------------------------------------
  2982. // HW_UART_TWFIFO - UART FIFO Transmit Watermark
  2983. //-------------------------------------------------------------------------------------------
  2984. #ifndef __LANGUAGE_ASM__
  2985. /*!
  2986. * @brief HW_UART_TWFIFO - UART FIFO Transmit Watermark (RW)
  2987. *
  2988. * Reset value: 0x00U
  2989. *
  2990. * This register provides the ability to set a programmable threshold for
  2991. * notification of needing additional transmit data. This register may be read at any
  2992. * time but must be written only when C2[TE] is not set. Changing the value of the
  2993. * watermark will not clear the S1[TDRE] flag.
  2994. */
  2995. typedef union _hw_uart_twfifo
  2996. {
  2997. uint8_t U;
  2998. struct _hw_uart_twfifo_bitfields
  2999. {
  3000. uint8_t TXWATER : 8; //!< [7:0] Transmit Watermark
  3001. } B;
  3002. } hw_uart_twfifo_t;
  3003. #endif
  3004. /*!
  3005. * @name Constants and macros for entire UART_TWFIFO register
  3006. */
  3007. //@{
  3008. #define HW_UART_TWFIFO_ADDR(x) (REGS_UART_BASE(x) + 0x13U)
  3009. #ifndef __LANGUAGE_ASM__
  3010. #define HW_UART_TWFIFO(x) (*(__IO hw_uart_twfifo_t *) HW_UART_TWFIFO_ADDR(x))
  3011. #define HW_UART_TWFIFO_RD(x) (HW_UART_TWFIFO(x).U)
  3012. #define HW_UART_TWFIFO_WR(x, v) (HW_UART_TWFIFO(x).U = (v))
  3013. #define HW_UART_TWFIFO_SET(x, v) (HW_UART_TWFIFO_WR(x, HW_UART_TWFIFO_RD(x) | (v)))
  3014. #define HW_UART_TWFIFO_CLR(x, v) (HW_UART_TWFIFO_WR(x, HW_UART_TWFIFO_RD(x) & ~(v)))
  3015. #define HW_UART_TWFIFO_TOG(x, v) (HW_UART_TWFIFO_WR(x, HW_UART_TWFIFO_RD(x) ^ (v)))
  3016. #endif
  3017. //@}
  3018. /*
  3019. * Constants & macros for individual UART_TWFIFO bitfields
  3020. */
  3021. /*!
  3022. * @name Register UART_TWFIFO, field TXWATER[7:0] (RW)
  3023. *
  3024. * When the number of datawords in the transmit FIFO/buffer is equal to or less
  3025. * than the value in this register field, an interrupt via S1[TDRE] or a DMA
  3026. * request via C5[TDMAS] is generated as determined by C5[TDMAS] and C2[TIE]. For
  3027. * proper operation, the value in TXWATER must be set to be less than the size of
  3028. * the transmit buffer/FIFO size as indicated by PFIFO[TXFIFOSIZE] and PFIFO[TXFE].
  3029. */
  3030. //@{
  3031. #define BP_UART_TWFIFO_TXWATER (0U) //!< Bit position for UART_TWFIFO_TXWATER.
  3032. #define BM_UART_TWFIFO_TXWATER (0xFFU) //!< Bit mask for UART_TWFIFO_TXWATER.
  3033. #define BS_UART_TWFIFO_TXWATER (8U) //!< Bit field size in bits for UART_TWFIFO_TXWATER.
  3034. #ifndef __LANGUAGE_ASM__
  3035. //! @brief Read current value of the UART_TWFIFO_TXWATER field.
  3036. #define BR_UART_TWFIFO_TXWATER(x) (HW_UART_TWFIFO(x).U)
  3037. #endif
  3038. //! @brief Format value for bitfield UART_TWFIFO_TXWATER.
  3039. #define BF_UART_TWFIFO_TXWATER(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_TWFIFO_TXWATER), uint8_t) & BM_UART_TWFIFO_TXWATER)
  3040. #ifndef __LANGUAGE_ASM__
  3041. //! @brief Set the TXWATER field to a new value.
  3042. #define BW_UART_TWFIFO_TXWATER(x, v) (HW_UART_TWFIFO_WR(x, v))
  3043. #endif
  3044. //@}
  3045. //-------------------------------------------------------------------------------------------
  3046. // HW_UART_TCFIFO - UART FIFO Transmit Count
  3047. //-------------------------------------------------------------------------------------------
  3048. #ifndef __LANGUAGE_ASM__
  3049. /*!
  3050. * @brief HW_UART_TCFIFO - UART FIFO Transmit Count (RO)
  3051. *
  3052. * Reset value: 0x00U
  3053. *
  3054. * This is a read only register that indicates how many datawords are currently
  3055. * in the transmit buffer/FIFO. It may be read at any time.
  3056. */
  3057. typedef union _hw_uart_tcfifo
  3058. {
  3059. uint8_t U;
  3060. struct _hw_uart_tcfifo_bitfields
  3061. {
  3062. uint8_t TXCOUNT : 8; //!< [7:0] Transmit Counter
  3063. } B;
  3064. } hw_uart_tcfifo_t;
  3065. #endif
  3066. /*!
  3067. * @name Constants and macros for entire UART_TCFIFO register
  3068. */
  3069. //@{
  3070. #define HW_UART_TCFIFO_ADDR(x) (REGS_UART_BASE(x) + 0x14U)
  3071. #ifndef __LANGUAGE_ASM__
  3072. #define HW_UART_TCFIFO(x) (*(__I hw_uart_tcfifo_t *) HW_UART_TCFIFO_ADDR(x))
  3073. #define HW_UART_TCFIFO_RD(x) (HW_UART_TCFIFO(x).U)
  3074. #endif
  3075. //@}
  3076. /*
  3077. * Constants & macros for individual UART_TCFIFO bitfields
  3078. */
  3079. /*!
  3080. * @name Register UART_TCFIFO, field TXCOUNT[7:0] (RO)
  3081. *
  3082. * The value in this register indicates the number of datawords that are in the
  3083. * transmit FIFO/buffer. If a dataword is being transmitted, that is, in the
  3084. * transmit shift register, it is not included in the count. This value may be used
  3085. * in conjunction with PFIFO[TXFIFOSIZE] to calculate how much room is left in the
  3086. * transmit FIFO/buffer.
  3087. */
  3088. //@{
  3089. #define BP_UART_TCFIFO_TXCOUNT (0U) //!< Bit position for UART_TCFIFO_TXCOUNT.
  3090. #define BM_UART_TCFIFO_TXCOUNT (0xFFU) //!< Bit mask for UART_TCFIFO_TXCOUNT.
  3091. #define BS_UART_TCFIFO_TXCOUNT (8U) //!< Bit field size in bits for UART_TCFIFO_TXCOUNT.
  3092. #ifndef __LANGUAGE_ASM__
  3093. //! @brief Read current value of the UART_TCFIFO_TXCOUNT field.
  3094. #define BR_UART_TCFIFO_TXCOUNT(x) (HW_UART_TCFIFO(x).U)
  3095. #endif
  3096. //@}
  3097. //-------------------------------------------------------------------------------------------
  3098. // HW_UART_RWFIFO - UART FIFO Receive Watermark
  3099. //-------------------------------------------------------------------------------------------
  3100. #ifndef __LANGUAGE_ASM__
  3101. /*!
  3102. * @brief HW_UART_RWFIFO - UART FIFO Receive Watermark (RW)
  3103. *
  3104. * Reset value: 0x01U
  3105. *
  3106. * This register provides the ability to set a programmable threshold for
  3107. * notification of the need to remove data from the receiver FIFO/buffer. This register
  3108. * may be read at any time but must be written only when C2[RE] is not asserted.
  3109. * Changing the value in this register will not clear S1[RDRF].
  3110. */
  3111. typedef union _hw_uart_rwfifo
  3112. {
  3113. uint8_t U;
  3114. struct _hw_uart_rwfifo_bitfields
  3115. {
  3116. uint8_t RXWATER : 8; //!< [7:0] Receive Watermark
  3117. } B;
  3118. } hw_uart_rwfifo_t;
  3119. #endif
  3120. /*!
  3121. * @name Constants and macros for entire UART_RWFIFO register
  3122. */
  3123. //@{
  3124. #define HW_UART_RWFIFO_ADDR(x) (REGS_UART_BASE(x) + 0x15U)
  3125. #ifndef __LANGUAGE_ASM__
  3126. #define HW_UART_RWFIFO(x) (*(__IO hw_uart_rwfifo_t *) HW_UART_RWFIFO_ADDR(x))
  3127. #define HW_UART_RWFIFO_RD(x) (HW_UART_RWFIFO(x).U)
  3128. #define HW_UART_RWFIFO_WR(x, v) (HW_UART_RWFIFO(x).U = (v))
  3129. #define HW_UART_RWFIFO_SET(x, v) (HW_UART_RWFIFO_WR(x, HW_UART_RWFIFO_RD(x) | (v)))
  3130. #define HW_UART_RWFIFO_CLR(x, v) (HW_UART_RWFIFO_WR(x, HW_UART_RWFIFO_RD(x) & ~(v)))
  3131. #define HW_UART_RWFIFO_TOG(x, v) (HW_UART_RWFIFO_WR(x, HW_UART_RWFIFO_RD(x) ^ (v)))
  3132. #endif
  3133. //@}
  3134. /*
  3135. * Constants & macros for individual UART_RWFIFO bitfields
  3136. */
  3137. /*!
  3138. * @name Register UART_RWFIFO, field RXWATER[7:0] (RW)
  3139. *
  3140. * When the number of datawords in the receive FIFO/buffer is equal to or
  3141. * greater than the value in this register field, an interrupt via S1[RDRF] or a DMA
  3142. * request via C5[RDMAS] is generated as determined by C5[RDMAS] and C2[RIE]. For
  3143. * proper operation, the value in RXWATER must be set to be less than the receive
  3144. * FIFO/buffer size as indicated by PFIFO[RXFIFOSIZE] and PFIFO[RXFE] and must be
  3145. * greater than 0.
  3146. */
  3147. //@{
  3148. #define BP_UART_RWFIFO_RXWATER (0U) //!< Bit position for UART_RWFIFO_RXWATER.
  3149. #define BM_UART_RWFIFO_RXWATER (0xFFU) //!< Bit mask for UART_RWFIFO_RXWATER.
  3150. #define BS_UART_RWFIFO_RXWATER (8U) //!< Bit field size in bits for UART_RWFIFO_RXWATER.
  3151. #ifndef __LANGUAGE_ASM__
  3152. //! @brief Read current value of the UART_RWFIFO_RXWATER field.
  3153. #define BR_UART_RWFIFO_RXWATER(x) (HW_UART_RWFIFO(x).U)
  3154. #endif
  3155. //! @brief Format value for bitfield UART_RWFIFO_RXWATER.
  3156. #define BF_UART_RWFIFO_RXWATER(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_RWFIFO_RXWATER), uint8_t) & BM_UART_RWFIFO_RXWATER)
  3157. #ifndef __LANGUAGE_ASM__
  3158. //! @brief Set the RXWATER field to a new value.
  3159. #define BW_UART_RWFIFO_RXWATER(x, v) (HW_UART_RWFIFO_WR(x, v))
  3160. #endif
  3161. //@}
  3162. //-------------------------------------------------------------------------------------------
  3163. // HW_UART_RCFIFO - UART FIFO Receive Count
  3164. //-------------------------------------------------------------------------------------------
  3165. #ifndef __LANGUAGE_ASM__
  3166. /*!
  3167. * @brief HW_UART_RCFIFO - UART FIFO Receive Count (RO)
  3168. *
  3169. * Reset value: 0x00U
  3170. *
  3171. * This is a read only register that indicates how many datawords are currently
  3172. * in the receive FIFO/buffer. It may be read at any time.
  3173. */
  3174. typedef union _hw_uart_rcfifo
  3175. {
  3176. uint8_t U;
  3177. struct _hw_uart_rcfifo_bitfields
  3178. {
  3179. uint8_t RXCOUNT : 8; //!< [7:0] Receive Counter
  3180. } B;
  3181. } hw_uart_rcfifo_t;
  3182. #endif
  3183. /*!
  3184. * @name Constants and macros for entire UART_RCFIFO register
  3185. */
  3186. //@{
  3187. #define HW_UART_RCFIFO_ADDR(x) (REGS_UART_BASE(x) + 0x16U)
  3188. #ifndef __LANGUAGE_ASM__
  3189. #define HW_UART_RCFIFO(x) (*(__I hw_uart_rcfifo_t *) HW_UART_RCFIFO_ADDR(x))
  3190. #define HW_UART_RCFIFO_RD(x) (HW_UART_RCFIFO(x).U)
  3191. #endif
  3192. //@}
  3193. /*
  3194. * Constants & macros for individual UART_RCFIFO bitfields
  3195. */
  3196. /*!
  3197. * @name Register UART_RCFIFO, field RXCOUNT[7:0] (RO)
  3198. *
  3199. * The value in this register indicates the number of datawords that are in the
  3200. * receive FIFO/buffer. If a dataword is being received, that is, in the receive
  3201. * shift register, it is not included in the count. This value may be used in
  3202. * conjunction with PFIFO[RXFIFOSIZE] to calculate how much room is left in the
  3203. * receive FIFO/buffer.
  3204. */
  3205. //@{
  3206. #define BP_UART_RCFIFO_RXCOUNT (0U) //!< Bit position for UART_RCFIFO_RXCOUNT.
  3207. #define BM_UART_RCFIFO_RXCOUNT (0xFFU) //!< Bit mask for UART_RCFIFO_RXCOUNT.
  3208. #define BS_UART_RCFIFO_RXCOUNT (8U) //!< Bit field size in bits for UART_RCFIFO_RXCOUNT.
  3209. #ifndef __LANGUAGE_ASM__
  3210. //! @brief Read current value of the UART_RCFIFO_RXCOUNT field.
  3211. #define BR_UART_RCFIFO_RXCOUNT(x) (HW_UART_RCFIFO(x).U)
  3212. #endif
  3213. //@}
  3214. //-------------------------------------------------------------------------------------------
  3215. // HW_UART_C7816 - UART 7816 Control Register
  3216. //-------------------------------------------------------------------------------------------
  3217. #ifndef __LANGUAGE_ASM__
  3218. /*!
  3219. * @brief HW_UART_C7816 - UART 7816 Control Register (RW)
  3220. *
  3221. * Reset value: 0x00U
  3222. *
  3223. * The C7816 register is the primary control register for ISO-7816 specific
  3224. * functionality. This register is specific to 7816 functionality and the values in
  3225. * this register have no effect on UART operation and should be ignored if
  3226. * ISO_7816E is not set/enabled. This register may be read at any time but values must
  3227. * be changed only when ISO_7816E is not set.
  3228. */
  3229. typedef union _hw_uart_c7816
  3230. {
  3231. uint8_t U;
  3232. struct _hw_uart_c7816_bitfields
  3233. {
  3234. uint8_t ISO_7816E : 1; //!< [0] ISO-7816 Functionality Enabled
  3235. uint8_t TTYPE : 1; //!< [1] Transfer Type
  3236. uint8_t INIT : 1; //!< [2] Detect Initial Character
  3237. uint8_t ANACK : 1; //!< [3] Generate NACK on Error
  3238. uint8_t ONACK : 1; //!< [4] Generate NACK on Overflow
  3239. uint8_t RESERVED0 : 3; //!< [7:5]
  3240. } B;
  3241. } hw_uart_c7816_t;
  3242. #endif
  3243. /*!
  3244. * @name Constants and macros for entire UART_C7816 register
  3245. */
  3246. //@{
  3247. #define HW_UART_C7816_ADDR(x) (REGS_UART_BASE(x) + 0x18U)
  3248. #ifndef __LANGUAGE_ASM__
  3249. #define HW_UART_C7816(x) (*(__IO hw_uart_c7816_t *) HW_UART_C7816_ADDR(x))
  3250. #define HW_UART_C7816_RD(x) (HW_UART_C7816(x).U)
  3251. #define HW_UART_C7816_WR(x, v) (HW_UART_C7816(x).U = (v))
  3252. #define HW_UART_C7816_SET(x, v) (HW_UART_C7816_WR(x, HW_UART_C7816_RD(x) | (v)))
  3253. #define HW_UART_C7816_CLR(x, v) (HW_UART_C7816_WR(x, HW_UART_C7816_RD(x) & ~(v)))
  3254. #define HW_UART_C7816_TOG(x, v) (HW_UART_C7816_WR(x, HW_UART_C7816_RD(x) ^ (v)))
  3255. #endif
  3256. //@}
  3257. /*
  3258. * Constants & macros for individual UART_C7816 bitfields
  3259. */
  3260. /*!
  3261. * @name Register UART_C7816, field ISO_7816E[0] (RW)
  3262. *
  3263. * Indicates that the UART is operating according to the ISO-7816 protocol. This
  3264. * field must be modified only when no transmit or receive is occurring. If this
  3265. * field is changed during a data transfer, the data being transmitted or
  3266. * received may be transferred incorrectly.
  3267. *
  3268. * Values:
  3269. * - 0 - ISO-7816 functionality is turned off/not enabled.
  3270. * - 1 - ISO-7816 functionality is turned on/enabled.
  3271. */
  3272. //@{
  3273. #define BP_UART_C7816_ISO_7816E (0U) //!< Bit position for UART_C7816_ISO_7816E.
  3274. #define BM_UART_C7816_ISO_7816E (0x01U) //!< Bit mask for UART_C7816_ISO_7816E.
  3275. #define BS_UART_C7816_ISO_7816E (1U) //!< Bit field size in bits for UART_C7816_ISO_7816E.
  3276. #ifndef __LANGUAGE_ASM__
  3277. //! @brief Read current value of the UART_C7816_ISO_7816E field.
  3278. #define BR_UART_C7816_ISO_7816E(x) (BITBAND_ACCESS8(HW_UART_C7816_ADDR(x), BP_UART_C7816_ISO_7816E))
  3279. #endif
  3280. //! @brief Format value for bitfield UART_C7816_ISO_7816E.
  3281. #define BF_UART_C7816_ISO_7816E(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C7816_ISO_7816E), uint8_t) & BM_UART_C7816_ISO_7816E)
  3282. #ifndef __LANGUAGE_ASM__
  3283. //! @brief Set the ISO_7816E field to a new value.
  3284. #define BW_UART_C7816_ISO_7816E(x, v) (BITBAND_ACCESS8(HW_UART_C7816_ADDR(x), BP_UART_C7816_ISO_7816E) = (v))
  3285. #endif
  3286. //@}
  3287. /*!
  3288. * @name Register UART_C7816, field TTYPE[1] (RW)
  3289. *
  3290. * Indicates the transfer protocol being used. See ISO-7816 / smartcard support
  3291. * for more details.
  3292. *
  3293. * Values:
  3294. * - 0 - T = 0 per the ISO-7816 specification.
  3295. * - 1 - T = 1 per the ISO-7816 specification.
  3296. */
  3297. //@{
  3298. #define BP_UART_C7816_TTYPE (1U) //!< Bit position for UART_C7816_TTYPE.
  3299. #define BM_UART_C7816_TTYPE (0x02U) //!< Bit mask for UART_C7816_TTYPE.
  3300. #define BS_UART_C7816_TTYPE (1U) //!< Bit field size in bits for UART_C7816_TTYPE.
  3301. #ifndef __LANGUAGE_ASM__
  3302. //! @brief Read current value of the UART_C7816_TTYPE field.
  3303. #define BR_UART_C7816_TTYPE(x) (BITBAND_ACCESS8(HW_UART_C7816_ADDR(x), BP_UART_C7816_TTYPE))
  3304. #endif
  3305. //! @brief Format value for bitfield UART_C7816_TTYPE.
  3306. #define BF_UART_C7816_TTYPE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C7816_TTYPE), uint8_t) & BM_UART_C7816_TTYPE)
  3307. #ifndef __LANGUAGE_ASM__
  3308. //! @brief Set the TTYPE field to a new value.
  3309. #define BW_UART_C7816_TTYPE(x, v) (BITBAND_ACCESS8(HW_UART_C7816_ADDR(x), BP_UART_C7816_TTYPE) = (v))
  3310. #endif
  3311. //@}
  3312. /*!
  3313. * @name Register UART_C7816, field INIT[2] (RW)
  3314. *
  3315. * When this field is set, all received characters are searched for a valid
  3316. * initial character. If an invalid initial character is identified, and ANACK is
  3317. * set, a NACK is sent. All received data is discarded and error flags blocked
  3318. * (S1[NF], S1[OR], S1[FE], S1[PF], IS7816[WT], IS7816[CWT], IS7816[BWT], IS7816[GTV])
  3319. * until a valid initial character is detected. Upon detecting a valid initial
  3320. * character, the configuration values S2[MSBF], C3[TXINV], and S2[RXINV] are
  3321. * automatically updated to reflect the initial character that was received. The
  3322. * actual INIT data value is not stored in the receive buffer. Additionally, upon
  3323. * detection of a valid initial character, IS7816[INITD] is set and an interrupt
  3324. * issued as programmed by IE7816[INITDE]. When a valid initial character is
  3325. * detected, INIT is automatically cleared. This Initial Character Detect feature is
  3326. * supported only in T = 0 protocol mode.
  3327. *
  3328. * Values:
  3329. * - 0 - Normal operating mode. Receiver does not seek to identify initial
  3330. * character.
  3331. * - 1 - Receiver searches for initial character.
  3332. */
  3333. //@{
  3334. #define BP_UART_C7816_INIT (2U) //!< Bit position for UART_C7816_INIT.
  3335. #define BM_UART_C7816_INIT (0x04U) //!< Bit mask for UART_C7816_INIT.
  3336. #define BS_UART_C7816_INIT (1U) //!< Bit field size in bits for UART_C7816_INIT.
  3337. #ifndef __LANGUAGE_ASM__
  3338. //! @brief Read current value of the UART_C7816_INIT field.
  3339. #define BR_UART_C7816_INIT(x) (BITBAND_ACCESS8(HW_UART_C7816_ADDR(x), BP_UART_C7816_INIT))
  3340. #endif
  3341. //! @brief Format value for bitfield UART_C7816_INIT.
  3342. #define BF_UART_C7816_INIT(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C7816_INIT), uint8_t) & BM_UART_C7816_INIT)
  3343. #ifndef __LANGUAGE_ASM__
  3344. //! @brief Set the INIT field to a new value.
  3345. #define BW_UART_C7816_INIT(x, v) (BITBAND_ACCESS8(HW_UART_C7816_ADDR(x), BP_UART_C7816_INIT) = (v))
  3346. #endif
  3347. //@}
  3348. /*!
  3349. * @name Register UART_C7816, field ANACK[3] (RW)
  3350. *
  3351. * When this field is set, the receiver automatically generates a NACK response
  3352. * if a parity error occurs or if INIT is set and an invalid initial character is
  3353. * detected. A NACK is generated only if TTYPE = 0. If ANACK is set, the UART
  3354. * attempts to retransmit the data indefinitely. To stop retransmission attempts,
  3355. * clear C2[TE] or ISO_7816E and do not set until S1[TC] sets C2[TE] again.
  3356. *
  3357. * Values:
  3358. * - 0 - No NACK is automatically generated.
  3359. * - 1 - A NACK is automatically generated if a parity error is detected or if
  3360. * an invalid initial character is detected.
  3361. */
  3362. //@{
  3363. #define BP_UART_C7816_ANACK (3U) //!< Bit position for UART_C7816_ANACK.
  3364. #define BM_UART_C7816_ANACK (0x08U) //!< Bit mask for UART_C7816_ANACK.
  3365. #define BS_UART_C7816_ANACK (1U) //!< Bit field size in bits for UART_C7816_ANACK.
  3366. #ifndef __LANGUAGE_ASM__
  3367. //! @brief Read current value of the UART_C7816_ANACK field.
  3368. #define BR_UART_C7816_ANACK(x) (BITBAND_ACCESS8(HW_UART_C7816_ADDR(x), BP_UART_C7816_ANACK))
  3369. #endif
  3370. //! @brief Format value for bitfield UART_C7816_ANACK.
  3371. #define BF_UART_C7816_ANACK(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C7816_ANACK), uint8_t) & BM_UART_C7816_ANACK)
  3372. #ifndef __LANGUAGE_ASM__
  3373. //! @brief Set the ANACK field to a new value.
  3374. #define BW_UART_C7816_ANACK(x, v) (BITBAND_ACCESS8(HW_UART_C7816_ADDR(x), BP_UART_C7816_ANACK) = (v))
  3375. #endif
  3376. //@}
  3377. /*!
  3378. * @name Register UART_C7816, field ONACK[4] (RW)
  3379. *
  3380. * When this field is set, the receiver automatically generates a NACK response
  3381. * if a receive buffer overrun occurs, as indicated by S1[OR]. In many systems,
  3382. * this results in the transmitter resending the packet that overflowed until the
  3383. * retransmit threshold for that transmitter is reached. A NACK is generated only
  3384. * if TTYPE=0. This field operates independently of ANACK. See . Overrun NACK
  3385. * considerations
  3386. *
  3387. * Values:
  3388. * - 0 - The received data does not generate a NACK when the receipt of the data
  3389. * results in an overflow event.
  3390. * - 1 - If the receiver buffer overflows, a NACK is automatically sent on a
  3391. * received character.
  3392. */
  3393. //@{
  3394. #define BP_UART_C7816_ONACK (4U) //!< Bit position for UART_C7816_ONACK.
  3395. #define BM_UART_C7816_ONACK (0x10U) //!< Bit mask for UART_C7816_ONACK.
  3396. #define BS_UART_C7816_ONACK (1U) //!< Bit field size in bits for UART_C7816_ONACK.
  3397. #ifndef __LANGUAGE_ASM__
  3398. //! @brief Read current value of the UART_C7816_ONACK field.
  3399. #define BR_UART_C7816_ONACK(x) (BITBAND_ACCESS8(HW_UART_C7816_ADDR(x), BP_UART_C7816_ONACK))
  3400. #endif
  3401. //! @brief Format value for bitfield UART_C7816_ONACK.
  3402. #define BF_UART_C7816_ONACK(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_C7816_ONACK), uint8_t) & BM_UART_C7816_ONACK)
  3403. #ifndef __LANGUAGE_ASM__
  3404. //! @brief Set the ONACK field to a new value.
  3405. #define BW_UART_C7816_ONACK(x, v) (BITBAND_ACCESS8(HW_UART_C7816_ADDR(x), BP_UART_C7816_ONACK) = (v))
  3406. #endif
  3407. //@}
  3408. //-------------------------------------------------------------------------------------------
  3409. // HW_UART_IE7816 - UART 7816 Interrupt Enable Register
  3410. //-------------------------------------------------------------------------------------------
  3411. #ifndef __LANGUAGE_ASM__
  3412. /*!
  3413. * @brief HW_UART_IE7816 - UART 7816 Interrupt Enable Register (RW)
  3414. *
  3415. * Reset value: 0x00U
  3416. *
  3417. * The IE7816 register controls which flags result in an interrupt being issued.
  3418. * This register is specific to 7816 functionality, the corresponding flags that
  3419. * drive the interrupts are not asserted when 7816E is not set/enabled. However,
  3420. * these flags may remain set if they are asserted while 7816E was set and not
  3421. * subsequently cleared. This register may be read or written to at any time.
  3422. */
  3423. typedef union _hw_uart_ie7816
  3424. {
  3425. uint8_t U;
  3426. struct _hw_uart_ie7816_bitfields
  3427. {
  3428. uint8_t RXTE : 1; //!< [0] Receive Threshold Exceeded Interrupt Enable
  3429. uint8_t TXTE : 1; //!< [1] Transmit Threshold Exceeded Interrupt
  3430. //! Enable
  3431. uint8_t GTVE : 1; //!< [2] Guard Timer Violated Interrupt Enable
  3432. uint8_t RESERVED0 : 1; //!< [3]
  3433. uint8_t INITDE : 1; //!< [4] Initial Character Detected Interrupt
  3434. //! Enable
  3435. uint8_t BWTE : 1; //!< [5] Block Wait Timer Interrupt Enable
  3436. uint8_t CWTE : 1; //!< [6] Character Wait Timer Interrupt Enable
  3437. uint8_t WTE : 1; //!< [7] Wait Timer Interrupt Enable
  3438. } B;
  3439. } hw_uart_ie7816_t;
  3440. #endif
  3441. /*!
  3442. * @name Constants and macros for entire UART_IE7816 register
  3443. */
  3444. //@{
  3445. #define HW_UART_IE7816_ADDR(x) (REGS_UART_BASE(x) + 0x19U)
  3446. #ifndef __LANGUAGE_ASM__
  3447. #define HW_UART_IE7816(x) (*(__IO hw_uart_ie7816_t *) HW_UART_IE7816_ADDR(x))
  3448. #define HW_UART_IE7816_RD(x) (HW_UART_IE7816(x).U)
  3449. #define HW_UART_IE7816_WR(x, v) (HW_UART_IE7816(x).U = (v))
  3450. #define HW_UART_IE7816_SET(x, v) (HW_UART_IE7816_WR(x, HW_UART_IE7816_RD(x) | (v)))
  3451. #define HW_UART_IE7816_CLR(x, v) (HW_UART_IE7816_WR(x, HW_UART_IE7816_RD(x) & ~(v)))
  3452. #define HW_UART_IE7816_TOG(x, v) (HW_UART_IE7816_WR(x, HW_UART_IE7816_RD(x) ^ (v)))
  3453. #endif
  3454. //@}
  3455. /*
  3456. * Constants & macros for individual UART_IE7816 bitfields
  3457. */
  3458. /*!
  3459. * @name Register UART_IE7816, field RXTE[0] (RW)
  3460. *
  3461. * Values:
  3462. * - 0 - The assertion of IS7816[RXT] does not result in the generation of an
  3463. * interrupt.
  3464. * - 1 - The assertion of IS7816[RXT] results in the generation of an interrupt.
  3465. */
  3466. //@{
  3467. #define BP_UART_IE7816_RXTE (0U) //!< Bit position for UART_IE7816_RXTE.
  3468. #define BM_UART_IE7816_RXTE (0x01U) //!< Bit mask for UART_IE7816_RXTE.
  3469. #define BS_UART_IE7816_RXTE (1U) //!< Bit field size in bits for UART_IE7816_RXTE.
  3470. #ifndef __LANGUAGE_ASM__
  3471. //! @brief Read current value of the UART_IE7816_RXTE field.
  3472. #define BR_UART_IE7816_RXTE(x) (BITBAND_ACCESS8(HW_UART_IE7816_ADDR(x), BP_UART_IE7816_RXTE))
  3473. #endif
  3474. //! @brief Format value for bitfield UART_IE7816_RXTE.
  3475. #define BF_UART_IE7816_RXTE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_IE7816_RXTE), uint8_t) & BM_UART_IE7816_RXTE)
  3476. #ifndef __LANGUAGE_ASM__
  3477. //! @brief Set the RXTE field to a new value.
  3478. #define BW_UART_IE7816_RXTE(x, v) (BITBAND_ACCESS8(HW_UART_IE7816_ADDR(x), BP_UART_IE7816_RXTE) = (v))
  3479. #endif
  3480. //@}
  3481. /*!
  3482. * @name Register UART_IE7816, field TXTE[1] (RW)
  3483. *
  3484. * Values:
  3485. * - 0 - The assertion of IS7816[TXT] does not result in the generation of an
  3486. * interrupt.
  3487. * - 1 - The assertion of IS7816[TXT] results in the generation of an interrupt.
  3488. */
  3489. //@{
  3490. #define BP_UART_IE7816_TXTE (1U) //!< Bit position for UART_IE7816_TXTE.
  3491. #define BM_UART_IE7816_TXTE (0x02U) //!< Bit mask for UART_IE7816_TXTE.
  3492. #define BS_UART_IE7816_TXTE (1U) //!< Bit field size in bits for UART_IE7816_TXTE.
  3493. #ifndef __LANGUAGE_ASM__
  3494. //! @brief Read current value of the UART_IE7816_TXTE field.
  3495. #define BR_UART_IE7816_TXTE(x) (BITBAND_ACCESS8(HW_UART_IE7816_ADDR(x), BP_UART_IE7816_TXTE))
  3496. #endif
  3497. //! @brief Format value for bitfield UART_IE7816_TXTE.
  3498. #define BF_UART_IE7816_TXTE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_IE7816_TXTE), uint8_t) & BM_UART_IE7816_TXTE)
  3499. #ifndef __LANGUAGE_ASM__
  3500. //! @brief Set the TXTE field to a new value.
  3501. #define BW_UART_IE7816_TXTE(x, v) (BITBAND_ACCESS8(HW_UART_IE7816_ADDR(x), BP_UART_IE7816_TXTE) = (v))
  3502. #endif
  3503. //@}
  3504. /*!
  3505. * @name Register UART_IE7816, field GTVE[2] (RW)
  3506. *
  3507. * Values:
  3508. * - 0 - The assertion of IS7816[GTV] does not result in the generation of an
  3509. * interrupt.
  3510. * - 1 - The assertion of IS7816[GTV] results in the generation of an interrupt.
  3511. */
  3512. //@{
  3513. #define BP_UART_IE7816_GTVE (2U) //!< Bit position for UART_IE7816_GTVE.
  3514. #define BM_UART_IE7816_GTVE (0x04U) //!< Bit mask for UART_IE7816_GTVE.
  3515. #define BS_UART_IE7816_GTVE (1U) //!< Bit field size in bits for UART_IE7816_GTVE.
  3516. #ifndef __LANGUAGE_ASM__
  3517. //! @brief Read current value of the UART_IE7816_GTVE field.
  3518. #define BR_UART_IE7816_GTVE(x) (BITBAND_ACCESS8(HW_UART_IE7816_ADDR(x), BP_UART_IE7816_GTVE))
  3519. #endif
  3520. //! @brief Format value for bitfield UART_IE7816_GTVE.
  3521. #define BF_UART_IE7816_GTVE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_IE7816_GTVE), uint8_t) & BM_UART_IE7816_GTVE)
  3522. #ifndef __LANGUAGE_ASM__
  3523. //! @brief Set the GTVE field to a new value.
  3524. #define BW_UART_IE7816_GTVE(x, v) (BITBAND_ACCESS8(HW_UART_IE7816_ADDR(x), BP_UART_IE7816_GTVE) = (v))
  3525. #endif
  3526. //@}
  3527. /*!
  3528. * @name Register UART_IE7816, field INITDE[4] (RW)
  3529. *
  3530. * Values:
  3531. * - 0 - The assertion of IS7816[INITD] does not result in the generation of an
  3532. * interrupt.
  3533. * - 1 - The assertion of IS7816[INITD] results in the generation of an
  3534. * interrupt.
  3535. */
  3536. //@{
  3537. #define BP_UART_IE7816_INITDE (4U) //!< Bit position for UART_IE7816_INITDE.
  3538. #define BM_UART_IE7816_INITDE (0x10U) //!< Bit mask for UART_IE7816_INITDE.
  3539. #define BS_UART_IE7816_INITDE (1U) //!< Bit field size in bits for UART_IE7816_INITDE.
  3540. #ifndef __LANGUAGE_ASM__
  3541. //! @brief Read current value of the UART_IE7816_INITDE field.
  3542. #define BR_UART_IE7816_INITDE(x) (BITBAND_ACCESS8(HW_UART_IE7816_ADDR(x), BP_UART_IE7816_INITDE))
  3543. #endif
  3544. //! @brief Format value for bitfield UART_IE7816_INITDE.
  3545. #define BF_UART_IE7816_INITDE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_IE7816_INITDE), uint8_t) & BM_UART_IE7816_INITDE)
  3546. #ifndef __LANGUAGE_ASM__
  3547. //! @brief Set the INITDE field to a new value.
  3548. #define BW_UART_IE7816_INITDE(x, v) (BITBAND_ACCESS8(HW_UART_IE7816_ADDR(x), BP_UART_IE7816_INITDE) = (v))
  3549. #endif
  3550. //@}
  3551. /*!
  3552. * @name Register UART_IE7816, field BWTE[5] (RW)
  3553. *
  3554. * Values:
  3555. * - 0 - The assertion of IS7816[BWT] does not result in the generation of an
  3556. * interrupt.
  3557. * - 1 - The assertion of IS7816[BWT] results in the generation of an interrupt.
  3558. */
  3559. //@{
  3560. #define BP_UART_IE7816_BWTE (5U) //!< Bit position for UART_IE7816_BWTE.
  3561. #define BM_UART_IE7816_BWTE (0x20U) //!< Bit mask for UART_IE7816_BWTE.
  3562. #define BS_UART_IE7816_BWTE (1U) //!< Bit field size in bits for UART_IE7816_BWTE.
  3563. #ifndef __LANGUAGE_ASM__
  3564. //! @brief Read current value of the UART_IE7816_BWTE field.
  3565. #define BR_UART_IE7816_BWTE(x) (BITBAND_ACCESS8(HW_UART_IE7816_ADDR(x), BP_UART_IE7816_BWTE))
  3566. #endif
  3567. //! @brief Format value for bitfield UART_IE7816_BWTE.
  3568. #define BF_UART_IE7816_BWTE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_IE7816_BWTE), uint8_t) & BM_UART_IE7816_BWTE)
  3569. #ifndef __LANGUAGE_ASM__
  3570. //! @brief Set the BWTE field to a new value.
  3571. #define BW_UART_IE7816_BWTE(x, v) (BITBAND_ACCESS8(HW_UART_IE7816_ADDR(x), BP_UART_IE7816_BWTE) = (v))
  3572. #endif
  3573. //@}
  3574. /*!
  3575. * @name Register UART_IE7816, field CWTE[6] (RW)
  3576. *
  3577. * Values:
  3578. * - 0 - The assertion of IS7816[CWT] does not result in the generation of an
  3579. * interrupt.
  3580. * - 1 - The assertion of IS7816[CWT] results in the generation of an interrupt.
  3581. */
  3582. //@{
  3583. #define BP_UART_IE7816_CWTE (6U) //!< Bit position for UART_IE7816_CWTE.
  3584. #define BM_UART_IE7816_CWTE (0x40U) //!< Bit mask for UART_IE7816_CWTE.
  3585. #define BS_UART_IE7816_CWTE (1U) //!< Bit field size in bits for UART_IE7816_CWTE.
  3586. #ifndef __LANGUAGE_ASM__
  3587. //! @brief Read current value of the UART_IE7816_CWTE field.
  3588. #define BR_UART_IE7816_CWTE(x) (BITBAND_ACCESS8(HW_UART_IE7816_ADDR(x), BP_UART_IE7816_CWTE))
  3589. #endif
  3590. //! @brief Format value for bitfield UART_IE7816_CWTE.
  3591. #define BF_UART_IE7816_CWTE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_IE7816_CWTE), uint8_t) & BM_UART_IE7816_CWTE)
  3592. #ifndef __LANGUAGE_ASM__
  3593. //! @brief Set the CWTE field to a new value.
  3594. #define BW_UART_IE7816_CWTE(x, v) (BITBAND_ACCESS8(HW_UART_IE7816_ADDR(x), BP_UART_IE7816_CWTE) = (v))
  3595. #endif
  3596. //@}
  3597. /*!
  3598. * @name Register UART_IE7816, field WTE[7] (RW)
  3599. *
  3600. * Values:
  3601. * - 0 - The assertion of IS7816[WT] does not result in the generation of an
  3602. * interrupt.
  3603. * - 1 - The assertion of IS7816[WT] results in the generation of an interrupt.
  3604. */
  3605. //@{
  3606. #define BP_UART_IE7816_WTE (7U) //!< Bit position for UART_IE7816_WTE.
  3607. #define BM_UART_IE7816_WTE (0x80U) //!< Bit mask for UART_IE7816_WTE.
  3608. #define BS_UART_IE7816_WTE (1U) //!< Bit field size in bits for UART_IE7816_WTE.
  3609. #ifndef __LANGUAGE_ASM__
  3610. //! @brief Read current value of the UART_IE7816_WTE field.
  3611. #define BR_UART_IE7816_WTE(x) (BITBAND_ACCESS8(HW_UART_IE7816_ADDR(x), BP_UART_IE7816_WTE))
  3612. #endif
  3613. //! @brief Format value for bitfield UART_IE7816_WTE.
  3614. #define BF_UART_IE7816_WTE(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_IE7816_WTE), uint8_t) & BM_UART_IE7816_WTE)
  3615. #ifndef __LANGUAGE_ASM__
  3616. //! @brief Set the WTE field to a new value.
  3617. #define BW_UART_IE7816_WTE(x, v) (BITBAND_ACCESS8(HW_UART_IE7816_ADDR(x), BP_UART_IE7816_WTE) = (v))
  3618. #endif
  3619. //@}
  3620. //-------------------------------------------------------------------------------------------
  3621. // HW_UART_IS7816 - UART 7816 Interrupt Status Register
  3622. //-------------------------------------------------------------------------------------------
  3623. #ifndef __LANGUAGE_ASM__
  3624. /*!
  3625. * @brief HW_UART_IS7816 - UART 7816 Interrupt Status Register (RW)
  3626. *
  3627. * Reset value: 0x00U
  3628. *
  3629. * The IS7816 register provides a mechanism to read and clear the interrupt
  3630. * flags. All flags/interrupts are cleared by writing a 1 to the field location.
  3631. * Writing a 0 has no effect. All bits are "sticky", meaning they indicate that only
  3632. * the flag condition that occurred since the last time the bit was cleared, not
  3633. * that the condition currently exists. The status flags are set regardless of
  3634. * whether the corresponding field in the IE7816 is set or cleared. The IE7816
  3635. * controls only if an interrupt is issued to the host processor. This register is
  3636. * specific to 7816 functionality and the values in this register have no affect on
  3637. * UART operation and should be ignored if 7816E is not set/enabled. This
  3638. * register may be read or written at anytime.
  3639. */
  3640. typedef union _hw_uart_is7816
  3641. {
  3642. uint8_t U;
  3643. struct _hw_uart_is7816_bitfields
  3644. {
  3645. uint8_t RXT : 1; //!< [0] Receive Threshold Exceeded Interrupt
  3646. uint8_t TXT : 1; //!< [1] Transmit Threshold Exceeded Interrupt
  3647. uint8_t GTV : 1; //!< [2] Guard Timer Violated Interrupt
  3648. uint8_t RESERVED0 : 1; //!< [3]
  3649. uint8_t INITD : 1; //!< [4] Initial Character Detected Interrupt
  3650. uint8_t BWT : 1; //!< [5] Block Wait Timer Interrupt
  3651. uint8_t CWT : 1; //!< [6] Character Wait Timer Interrupt
  3652. uint8_t WT : 1; //!< [7] Wait Timer Interrupt
  3653. } B;
  3654. } hw_uart_is7816_t;
  3655. #endif
  3656. /*!
  3657. * @name Constants and macros for entire UART_IS7816 register
  3658. */
  3659. //@{
  3660. #define HW_UART_IS7816_ADDR(x) (REGS_UART_BASE(x) + 0x1AU)
  3661. #ifndef __LANGUAGE_ASM__
  3662. #define HW_UART_IS7816(x) (*(__IO hw_uart_is7816_t *) HW_UART_IS7816_ADDR(x))
  3663. #define HW_UART_IS7816_RD(x) (HW_UART_IS7816(x).U)
  3664. #define HW_UART_IS7816_WR(x, v) (HW_UART_IS7816(x).U = (v))
  3665. #define HW_UART_IS7816_SET(x, v) (HW_UART_IS7816_WR(x, HW_UART_IS7816_RD(x) | (v)))
  3666. #define HW_UART_IS7816_CLR(x, v) (HW_UART_IS7816_WR(x, HW_UART_IS7816_RD(x) & ~(v)))
  3667. #define HW_UART_IS7816_TOG(x, v) (HW_UART_IS7816_WR(x, HW_UART_IS7816_RD(x) ^ (v)))
  3668. #endif
  3669. //@}
  3670. /*
  3671. * Constants & macros for individual UART_IS7816 bitfields
  3672. */
  3673. /*!
  3674. * @name Register UART_IS7816, field RXT[0] (W1C)
  3675. *
  3676. * Indicates that there are more than ET7816[RXTHRESHOLD] consecutive NACKS
  3677. * generated in response to parity errors on received data. This flag requires ANACK
  3678. * to be set. Additionally, this flag asserts only when C7816[TTYPE] = 0.
  3679. * Clearing this field also resets the counter keeping track of consecutive NACKS. The
  3680. * UART will continue to attempt to receive data regardless of whether this flag
  3681. * is set. If 7816E is cleared/disabled, RE is cleared/disabled, C7816[TTYPE] = 1,
  3682. * or packet is received without needing to issue a NACK, the internal NACK
  3683. * detection counter is cleared and the count restarts from zero on the next
  3684. * transmitted NACK. This interrupt is cleared by writing 1.
  3685. *
  3686. * Values:
  3687. * - 0 - The number of consecutive NACKS generated as a result of parity errors
  3688. * and buffer overruns is less than or equal to the value in
  3689. * ET7816[RXTHRESHOLD].
  3690. * - 1 - The number of consecutive NACKS generated as a result of parity errors
  3691. * and buffer overruns is greater than the value in ET7816[RXTHRESHOLD].
  3692. */
  3693. //@{
  3694. #define BP_UART_IS7816_RXT (0U) //!< Bit position for UART_IS7816_RXT.
  3695. #define BM_UART_IS7816_RXT (0x01U) //!< Bit mask for UART_IS7816_RXT.
  3696. #define BS_UART_IS7816_RXT (1U) //!< Bit field size in bits for UART_IS7816_RXT.
  3697. #ifndef __LANGUAGE_ASM__
  3698. //! @brief Read current value of the UART_IS7816_RXT field.
  3699. #define BR_UART_IS7816_RXT(x) (BITBAND_ACCESS8(HW_UART_IS7816_ADDR(x), BP_UART_IS7816_RXT))
  3700. #endif
  3701. //! @brief Format value for bitfield UART_IS7816_RXT.
  3702. #define BF_UART_IS7816_RXT(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_IS7816_RXT), uint8_t) & BM_UART_IS7816_RXT)
  3703. #ifndef __LANGUAGE_ASM__
  3704. //! @brief Set the RXT field to a new value.
  3705. #define BW_UART_IS7816_RXT(x, v) (BITBAND_ACCESS8(HW_UART_IS7816_ADDR(x), BP_UART_IS7816_RXT) = (v))
  3706. #endif
  3707. //@}
  3708. /*!
  3709. * @name Register UART_IS7816, field TXT[1] (W1C)
  3710. *
  3711. * Indicates that the transmit NACK threshold has been exceeded as indicated by
  3712. * ET7816[TXTHRESHOLD]. Regardless of whether this flag is set, the UART
  3713. * continues to retransmit indefinitely. This flag asserts only when C7816[TTYPE] = 0. If
  3714. * 7816E is cleared/disabled, ANACK is cleared/disabled, C2[TE] is
  3715. * cleared/disabled, C7816[TTYPE] = 1, or packet is transferred without receiving a NACK, the
  3716. * internal NACK detection counter is cleared and the count restarts from zero on
  3717. * the next received NACK. This interrupt is cleared by writing 1.
  3718. *
  3719. * Values:
  3720. * - 0 - The number of retries and corresponding NACKS does not exceed the value
  3721. * in ET7816[TXTHRESHOLD].
  3722. * - 1 - The number of retries and corresponding NACKS exceeds the value in
  3723. * ET7816[TXTHRESHOLD].
  3724. */
  3725. //@{
  3726. #define BP_UART_IS7816_TXT (1U) //!< Bit position for UART_IS7816_TXT.
  3727. #define BM_UART_IS7816_TXT (0x02U) //!< Bit mask for UART_IS7816_TXT.
  3728. #define BS_UART_IS7816_TXT (1U) //!< Bit field size in bits for UART_IS7816_TXT.
  3729. #ifndef __LANGUAGE_ASM__
  3730. //! @brief Read current value of the UART_IS7816_TXT field.
  3731. #define BR_UART_IS7816_TXT(x) (BITBAND_ACCESS8(HW_UART_IS7816_ADDR(x), BP_UART_IS7816_TXT))
  3732. #endif
  3733. //! @brief Format value for bitfield UART_IS7816_TXT.
  3734. #define BF_UART_IS7816_TXT(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_IS7816_TXT), uint8_t) & BM_UART_IS7816_TXT)
  3735. #ifndef __LANGUAGE_ASM__
  3736. //! @brief Set the TXT field to a new value.
  3737. #define BW_UART_IS7816_TXT(x, v) (BITBAND_ACCESS8(HW_UART_IS7816_ADDR(x), BP_UART_IS7816_TXT) = (v))
  3738. #endif
  3739. //@}
  3740. /*!
  3741. * @name Register UART_IS7816, field GTV[2] (W1C)
  3742. *
  3743. * Indicates that one or more of the character guard time, block guard time, or
  3744. * guard time are violated. This interrupt is cleared by writing 1.
  3745. *
  3746. * Values:
  3747. * - 0 - A guard time (GT, CGT, or BGT) has not been violated.
  3748. * - 1 - A guard time (GT, CGT, or BGT) has been violated.
  3749. */
  3750. //@{
  3751. #define BP_UART_IS7816_GTV (2U) //!< Bit position for UART_IS7816_GTV.
  3752. #define BM_UART_IS7816_GTV (0x04U) //!< Bit mask for UART_IS7816_GTV.
  3753. #define BS_UART_IS7816_GTV (1U) //!< Bit field size in bits for UART_IS7816_GTV.
  3754. #ifndef __LANGUAGE_ASM__
  3755. //! @brief Read current value of the UART_IS7816_GTV field.
  3756. #define BR_UART_IS7816_GTV(x) (BITBAND_ACCESS8(HW_UART_IS7816_ADDR(x), BP_UART_IS7816_GTV))
  3757. #endif
  3758. //! @brief Format value for bitfield UART_IS7816_GTV.
  3759. #define BF_UART_IS7816_GTV(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_IS7816_GTV), uint8_t) & BM_UART_IS7816_GTV)
  3760. #ifndef __LANGUAGE_ASM__
  3761. //! @brief Set the GTV field to a new value.
  3762. #define BW_UART_IS7816_GTV(x, v) (BITBAND_ACCESS8(HW_UART_IS7816_ADDR(x), BP_UART_IS7816_GTV) = (v))
  3763. #endif
  3764. //@}
  3765. /*!
  3766. * @name Register UART_IS7816, field INITD[4] (W1C)
  3767. *
  3768. * Indicates that a valid initial character is received. This interrupt is
  3769. * cleared by writing 1.
  3770. *
  3771. * Values:
  3772. * - 0 - A valid initial character has not been received.
  3773. * - 1 - A valid initial character has been received.
  3774. */
  3775. //@{
  3776. #define BP_UART_IS7816_INITD (4U) //!< Bit position for UART_IS7816_INITD.
  3777. #define BM_UART_IS7816_INITD (0x10U) //!< Bit mask for UART_IS7816_INITD.
  3778. #define BS_UART_IS7816_INITD (1U) //!< Bit field size in bits for UART_IS7816_INITD.
  3779. #ifndef __LANGUAGE_ASM__
  3780. //! @brief Read current value of the UART_IS7816_INITD field.
  3781. #define BR_UART_IS7816_INITD(x) (BITBAND_ACCESS8(HW_UART_IS7816_ADDR(x), BP_UART_IS7816_INITD))
  3782. #endif
  3783. //! @brief Format value for bitfield UART_IS7816_INITD.
  3784. #define BF_UART_IS7816_INITD(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_IS7816_INITD), uint8_t) & BM_UART_IS7816_INITD)
  3785. #ifndef __LANGUAGE_ASM__
  3786. //! @brief Set the INITD field to a new value.
  3787. #define BW_UART_IS7816_INITD(x, v) (BITBAND_ACCESS8(HW_UART_IS7816_ADDR(x), BP_UART_IS7816_INITD) = (v))
  3788. #endif
  3789. //@}
  3790. /*!
  3791. * @name Register UART_IS7816, field BWT[5] (W1C)
  3792. *
  3793. * Indicates that the block wait time, the time between the leading edge of
  3794. * first received character of a block and the leading edge of the last character the
  3795. * previously transmitted block, has exceeded the programmed value. This flag
  3796. * asserts only when C7816[TTYPE] = 1.This interrupt is cleared by writing 1.
  3797. *
  3798. * Values:
  3799. * - 0 - Block wait time (BWT) has not been violated.
  3800. * - 1 - Block wait time (BWT) has been violated.
  3801. */
  3802. //@{
  3803. #define BP_UART_IS7816_BWT (5U) //!< Bit position for UART_IS7816_BWT.
  3804. #define BM_UART_IS7816_BWT (0x20U) //!< Bit mask for UART_IS7816_BWT.
  3805. #define BS_UART_IS7816_BWT (1U) //!< Bit field size in bits for UART_IS7816_BWT.
  3806. #ifndef __LANGUAGE_ASM__
  3807. //! @brief Read current value of the UART_IS7816_BWT field.
  3808. #define BR_UART_IS7816_BWT(x) (BITBAND_ACCESS8(HW_UART_IS7816_ADDR(x), BP_UART_IS7816_BWT))
  3809. #endif
  3810. //! @brief Format value for bitfield UART_IS7816_BWT.
  3811. #define BF_UART_IS7816_BWT(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_IS7816_BWT), uint8_t) & BM_UART_IS7816_BWT)
  3812. #ifndef __LANGUAGE_ASM__
  3813. //! @brief Set the BWT field to a new value.
  3814. #define BW_UART_IS7816_BWT(x, v) (BITBAND_ACCESS8(HW_UART_IS7816_ADDR(x), BP_UART_IS7816_BWT) = (v))
  3815. #endif
  3816. //@}
  3817. /*!
  3818. * @name Register UART_IS7816, field CWT[6] (W1C)
  3819. *
  3820. * Indicates that the character wait time, the time between the leading edges of
  3821. * two consecutive characters in a block, has exceeded the programmed value.
  3822. * This flag asserts only when C7816[TTYPE] = 1. This interrupt is cleared by
  3823. * writing 1.
  3824. *
  3825. * Values:
  3826. * - 0 - Character wait time (CWT) has not been violated.
  3827. * - 1 - Character wait time (CWT) has been violated.
  3828. */
  3829. //@{
  3830. #define BP_UART_IS7816_CWT (6U) //!< Bit position for UART_IS7816_CWT.
  3831. #define BM_UART_IS7816_CWT (0x40U) //!< Bit mask for UART_IS7816_CWT.
  3832. #define BS_UART_IS7816_CWT (1U) //!< Bit field size in bits for UART_IS7816_CWT.
  3833. #ifndef __LANGUAGE_ASM__
  3834. //! @brief Read current value of the UART_IS7816_CWT field.
  3835. #define BR_UART_IS7816_CWT(x) (BITBAND_ACCESS8(HW_UART_IS7816_ADDR(x), BP_UART_IS7816_CWT))
  3836. #endif
  3837. //! @brief Format value for bitfield UART_IS7816_CWT.
  3838. #define BF_UART_IS7816_CWT(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_IS7816_CWT), uint8_t) & BM_UART_IS7816_CWT)
  3839. #ifndef __LANGUAGE_ASM__
  3840. //! @brief Set the CWT field to a new value.
  3841. #define BW_UART_IS7816_CWT(x, v) (BITBAND_ACCESS8(HW_UART_IS7816_ADDR(x), BP_UART_IS7816_CWT) = (v))
  3842. #endif
  3843. //@}
  3844. /*!
  3845. * @name Register UART_IS7816, field WT[7] (W1C)
  3846. *
  3847. * Indicates that the wait time, the time between the leading edge of a
  3848. * character being transmitted and the leading edge of the next response character, has
  3849. * exceeded the programmed value. This flag asserts only when C7816[TTYPE] = 0.
  3850. * This interrupt is cleared by writing 1.
  3851. *
  3852. * Values:
  3853. * - 0 - Wait time (WT) has not been violated.
  3854. * - 1 - Wait time (WT) has been violated.
  3855. */
  3856. //@{
  3857. #define BP_UART_IS7816_WT (7U) //!< Bit position for UART_IS7816_WT.
  3858. #define BM_UART_IS7816_WT (0x80U) //!< Bit mask for UART_IS7816_WT.
  3859. #define BS_UART_IS7816_WT (1U) //!< Bit field size in bits for UART_IS7816_WT.
  3860. #ifndef __LANGUAGE_ASM__
  3861. //! @brief Read current value of the UART_IS7816_WT field.
  3862. #define BR_UART_IS7816_WT(x) (BITBAND_ACCESS8(HW_UART_IS7816_ADDR(x), BP_UART_IS7816_WT))
  3863. #endif
  3864. //! @brief Format value for bitfield UART_IS7816_WT.
  3865. #define BF_UART_IS7816_WT(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_IS7816_WT), uint8_t) & BM_UART_IS7816_WT)
  3866. #ifndef __LANGUAGE_ASM__
  3867. //! @brief Set the WT field to a new value.
  3868. #define BW_UART_IS7816_WT(x, v) (BITBAND_ACCESS8(HW_UART_IS7816_ADDR(x), BP_UART_IS7816_WT) = (v))
  3869. #endif
  3870. //@}
  3871. //-------------------------------------------------------------------------------------------
  3872. // HW_UART_WP7816_T_TYPE0 - UART 7816 Wait Parameter Register
  3873. //-------------------------------------------------------------------------------------------
  3874. #ifndef __LANGUAGE_ASM__
  3875. /*!
  3876. * @brief HW_UART_WP7816_T_TYPE0 - UART 7816 Wait Parameter Register (RW)
  3877. *
  3878. * Reset value: 0x0AU
  3879. *
  3880. * The WP7816 register contains constants used in the generation of various wait
  3881. * timer counters. To save register space, this register is used differently
  3882. * when C7816[TTYPE] = 0 and C7816[TTYPE] = 1. This register may be read at any
  3883. * time. This register must be written to only when C7816[ISO_7816E] is not set.
  3884. */
  3885. typedef union _hw_uart_wp7816_t_type0
  3886. {
  3887. uint8_t U;
  3888. struct _hw_uart_wp7816_t_type0_bitfields
  3889. {
  3890. uint8_t WI : 8; //!< [7:0] Wait Time Integer (C7816[TTYPE] = 0)
  3891. } B;
  3892. } hw_uart_wp7816_t_type0_t;
  3893. #endif
  3894. /*!
  3895. * @name Constants and macros for entire UART_WP7816_T_TYPE0 register
  3896. */
  3897. //@{
  3898. #define HW_UART_WP7816_T_TYPE0_ADDR(x) (REGS_UART_BASE(x) + 0x1BU)
  3899. #ifndef __LANGUAGE_ASM__
  3900. #define HW_UART_WP7816_T_TYPE0(x) (*(__IO hw_uart_wp7816_t_type0_t *) HW_UART_WP7816_T_TYPE0_ADDR(x))
  3901. #define HW_UART_WP7816_T_TYPE0_RD(x) (HW_UART_WP7816_T_TYPE0(x).U)
  3902. #define HW_UART_WP7816_T_TYPE0_WR(x, v) (HW_UART_WP7816_T_TYPE0(x).U = (v))
  3903. #define HW_UART_WP7816_T_TYPE0_SET(x, v) (HW_UART_WP7816_T_TYPE0_WR(x, HW_UART_WP7816_T_TYPE0_RD(x) | (v)))
  3904. #define HW_UART_WP7816_T_TYPE0_CLR(x, v) (HW_UART_WP7816_T_TYPE0_WR(x, HW_UART_WP7816_T_TYPE0_RD(x) & ~(v)))
  3905. #define HW_UART_WP7816_T_TYPE0_TOG(x, v) (HW_UART_WP7816_T_TYPE0_WR(x, HW_UART_WP7816_T_TYPE0_RD(x) ^ (v)))
  3906. #endif
  3907. //@}
  3908. /*
  3909. * Constants & macros for individual UART_WP7816_T_TYPE0 bitfields
  3910. */
  3911. /*!
  3912. * @name Register UART_WP7816_T_TYPE0, field WI[7:0] (RW)
  3913. *
  3914. * Used to calculate the value used for the WT counter. It represents a value
  3915. * between 1 and 255. The value of zero is not valid. This value is used only when
  3916. * C7816[TTYPE] = 0. See Wait time and guard time parameters.
  3917. */
  3918. //@{
  3919. #define BP_UART_WP7816_T_TYPE0_WI (0U) //!< Bit position for UART_WP7816_T_TYPE0_WI.
  3920. #define BM_UART_WP7816_T_TYPE0_WI (0xFFU) //!< Bit mask for UART_WP7816_T_TYPE0_WI.
  3921. #define BS_UART_WP7816_T_TYPE0_WI (8U) //!< Bit field size in bits for UART_WP7816_T_TYPE0_WI.
  3922. #ifndef __LANGUAGE_ASM__
  3923. //! @brief Read current value of the UART_WP7816_T_TYPE0_WI field.
  3924. #define BR_UART_WP7816_T_TYPE0_WI(x) (HW_UART_WP7816_T_TYPE0(x).U)
  3925. #endif
  3926. //! @brief Format value for bitfield UART_WP7816_T_TYPE0_WI.
  3927. #define BF_UART_WP7816_T_TYPE0_WI(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_WP7816_T_TYPE0_WI), uint8_t) & BM_UART_WP7816_T_TYPE0_WI)
  3928. #ifndef __LANGUAGE_ASM__
  3929. //! @brief Set the WI field to a new value.
  3930. #define BW_UART_WP7816_T_TYPE0_WI(x, v) (HW_UART_WP7816_T_TYPE0_WR(x, v))
  3931. #endif
  3932. //@}
  3933. //-------------------------------------------------------------------------------------------
  3934. // HW_UART_WP7816_T_TYPE1 - UART 7816 Wait Parameter Register
  3935. //-------------------------------------------------------------------------------------------
  3936. #ifndef __LANGUAGE_ASM__
  3937. /*!
  3938. * @brief HW_UART_WP7816_T_TYPE1 - UART 7816 Wait Parameter Register (RW)
  3939. *
  3940. * Reset value: 0x0AU
  3941. *
  3942. * The WP7816 register contains constants used in the generation of various wait
  3943. * timer counters. To save register space, this register is used differently
  3944. * when C7816[TTYPE] = 0 and C7816[TTYPE] = 1. This register may be read at any
  3945. * time. This register must be written to only when C7816[ISO_7816E] is not set.
  3946. */
  3947. typedef union _hw_uart_wp7816_t_type1
  3948. {
  3949. uint8_t U;
  3950. struct _hw_uart_wp7816_t_type1_bitfields
  3951. {
  3952. uint8_t BWI : 4; //!< [3:0] Block Wait Time Integer(C7816[TTYPE] = 1)
  3953. uint8_t CWI : 4; //!< [7:4] Character Wait Time Integer (C7816[TTYPE]
  3954. //! = 1)
  3955. } B;
  3956. } hw_uart_wp7816_t_type1_t;
  3957. #endif
  3958. /*!
  3959. * @name Constants and macros for entire UART_WP7816_T_TYPE1 register
  3960. */
  3961. //@{
  3962. #define HW_UART_WP7816_T_TYPE1_ADDR(x) (REGS_UART_BASE(x) + 0x1BU)
  3963. #ifndef __LANGUAGE_ASM__
  3964. #define HW_UART_WP7816_T_TYPE1(x) (*(__IO hw_uart_wp7816_t_type1_t *) HW_UART_WP7816_T_TYPE1_ADDR(x))
  3965. #define HW_UART_WP7816_T_TYPE1_RD(x) (HW_UART_WP7816_T_TYPE1(x).U)
  3966. #define HW_UART_WP7816_T_TYPE1_WR(x, v) (HW_UART_WP7816_T_TYPE1(x).U = (v))
  3967. #define HW_UART_WP7816_T_TYPE1_SET(x, v) (HW_UART_WP7816_T_TYPE1_WR(x, HW_UART_WP7816_T_TYPE1_RD(x) | (v)))
  3968. #define HW_UART_WP7816_T_TYPE1_CLR(x, v) (HW_UART_WP7816_T_TYPE1_WR(x, HW_UART_WP7816_T_TYPE1_RD(x) & ~(v)))
  3969. #define HW_UART_WP7816_T_TYPE1_TOG(x, v) (HW_UART_WP7816_T_TYPE1_WR(x, HW_UART_WP7816_T_TYPE1_RD(x) ^ (v)))
  3970. #endif
  3971. //@}
  3972. /*
  3973. * Constants & macros for individual UART_WP7816_T_TYPE1 bitfields
  3974. */
  3975. /*!
  3976. * @name Register UART_WP7816_T_TYPE1, field BWI[3:0] (RW)
  3977. *
  3978. * Used to calculate the value used for the BWT counter. It represent a value
  3979. * between 0 and 15. This value is used only when C7816[TTYPE] = 1. See Wait time
  3980. * and guard time parameters .
  3981. */
  3982. //@{
  3983. #define BP_UART_WP7816_T_TYPE1_BWI (0U) //!< Bit position for UART_WP7816_T_TYPE1_BWI.
  3984. #define BM_UART_WP7816_T_TYPE1_BWI (0x0FU) //!< Bit mask for UART_WP7816_T_TYPE1_BWI.
  3985. #define BS_UART_WP7816_T_TYPE1_BWI (4U) //!< Bit field size in bits for UART_WP7816_T_TYPE1_BWI.
  3986. #ifndef __LANGUAGE_ASM__
  3987. //! @brief Read current value of the UART_WP7816_T_TYPE1_BWI field.
  3988. #define BR_UART_WP7816_T_TYPE1_BWI(x) (HW_UART_WP7816_T_TYPE1(x).B.BWI)
  3989. #endif
  3990. //! @brief Format value for bitfield UART_WP7816_T_TYPE1_BWI.
  3991. #define BF_UART_WP7816_T_TYPE1_BWI(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_WP7816_T_TYPE1_BWI), uint8_t) & BM_UART_WP7816_T_TYPE1_BWI)
  3992. #ifndef __LANGUAGE_ASM__
  3993. //! @brief Set the BWI field to a new value.
  3994. #define BW_UART_WP7816_T_TYPE1_BWI(x, v) (HW_UART_WP7816_T_TYPE1_WR(x, (HW_UART_WP7816_T_TYPE1_RD(x) & ~BM_UART_WP7816_T_TYPE1_BWI) | BF_UART_WP7816_T_TYPE1_BWI(v)))
  3995. #endif
  3996. //@}
  3997. /*!
  3998. * @name Register UART_WP7816_T_TYPE1, field CWI[7:4] (RW)
  3999. *
  4000. * Used to calculate the value used for the CWT counter. It represents a value
  4001. * between 0 and 15. This value is used only when C7816[TTYPE] = 1. See Wait time
  4002. * and guard time parameters .
  4003. */
  4004. //@{
  4005. #define BP_UART_WP7816_T_TYPE1_CWI (4U) //!< Bit position for UART_WP7816_T_TYPE1_CWI.
  4006. #define BM_UART_WP7816_T_TYPE1_CWI (0xF0U) //!< Bit mask for UART_WP7816_T_TYPE1_CWI.
  4007. #define BS_UART_WP7816_T_TYPE1_CWI (4U) //!< Bit field size in bits for UART_WP7816_T_TYPE1_CWI.
  4008. #ifndef __LANGUAGE_ASM__
  4009. //! @brief Read current value of the UART_WP7816_T_TYPE1_CWI field.
  4010. #define BR_UART_WP7816_T_TYPE1_CWI(x) (HW_UART_WP7816_T_TYPE1(x).B.CWI)
  4011. #endif
  4012. //! @brief Format value for bitfield UART_WP7816_T_TYPE1_CWI.
  4013. #define BF_UART_WP7816_T_TYPE1_CWI(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_WP7816_T_TYPE1_CWI), uint8_t) & BM_UART_WP7816_T_TYPE1_CWI)
  4014. #ifndef __LANGUAGE_ASM__
  4015. //! @brief Set the CWI field to a new value.
  4016. #define BW_UART_WP7816_T_TYPE1_CWI(x, v) (HW_UART_WP7816_T_TYPE1_WR(x, (HW_UART_WP7816_T_TYPE1_RD(x) & ~BM_UART_WP7816_T_TYPE1_CWI) | BF_UART_WP7816_T_TYPE1_CWI(v)))
  4017. #endif
  4018. //@}
  4019. //-------------------------------------------------------------------------------------------
  4020. // HW_UART_WN7816 - UART 7816 Wait N Register
  4021. //-------------------------------------------------------------------------------------------
  4022. #ifndef __LANGUAGE_ASM__
  4023. /*!
  4024. * @brief HW_UART_WN7816 - UART 7816 Wait N Register (RW)
  4025. *
  4026. * Reset value: 0x00U
  4027. *
  4028. * The WN7816 register contains a parameter that is used in the calculation of
  4029. * the guard time counter. This register may be read at any time. This register
  4030. * must be written to only when C7816[ISO_7816E] is not set.
  4031. */
  4032. typedef union _hw_uart_wn7816
  4033. {
  4034. uint8_t U;
  4035. struct _hw_uart_wn7816_bitfields
  4036. {
  4037. uint8_t GTN : 8; //!< [7:0] Guard Band N
  4038. } B;
  4039. } hw_uart_wn7816_t;
  4040. #endif
  4041. /*!
  4042. * @name Constants and macros for entire UART_WN7816 register
  4043. */
  4044. //@{
  4045. #define HW_UART_WN7816_ADDR(x) (REGS_UART_BASE(x) + 0x1CU)
  4046. #ifndef __LANGUAGE_ASM__
  4047. #define HW_UART_WN7816(x) (*(__IO hw_uart_wn7816_t *) HW_UART_WN7816_ADDR(x))
  4048. #define HW_UART_WN7816_RD(x) (HW_UART_WN7816(x).U)
  4049. #define HW_UART_WN7816_WR(x, v) (HW_UART_WN7816(x).U = (v))
  4050. #define HW_UART_WN7816_SET(x, v) (HW_UART_WN7816_WR(x, HW_UART_WN7816_RD(x) | (v)))
  4051. #define HW_UART_WN7816_CLR(x, v) (HW_UART_WN7816_WR(x, HW_UART_WN7816_RD(x) & ~(v)))
  4052. #define HW_UART_WN7816_TOG(x, v) (HW_UART_WN7816_WR(x, HW_UART_WN7816_RD(x) ^ (v)))
  4053. #endif
  4054. //@}
  4055. /*
  4056. * Constants & macros for individual UART_WN7816 bitfields
  4057. */
  4058. /*!
  4059. * @name Register UART_WN7816, field GTN[7:0] (RW)
  4060. *
  4061. * Defines a parameter used in the calculation of GT, CGT, and BGT counters. The
  4062. * value represents an integer number between 0 and 255. See Wait time and guard
  4063. * time parameters .
  4064. */
  4065. //@{
  4066. #define BP_UART_WN7816_GTN (0U) //!< Bit position for UART_WN7816_GTN.
  4067. #define BM_UART_WN7816_GTN (0xFFU) //!< Bit mask for UART_WN7816_GTN.
  4068. #define BS_UART_WN7816_GTN (8U) //!< Bit field size in bits for UART_WN7816_GTN.
  4069. #ifndef __LANGUAGE_ASM__
  4070. //! @brief Read current value of the UART_WN7816_GTN field.
  4071. #define BR_UART_WN7816_GTN(x) (HW_UART_WN7816(x).U)
  4072. #endif
  4073. //! @brief Format value for bitfield UART_WN7816_GTN.
  4074. #define BF_UART_WN7816_GTN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_WN7816_GTN), uint8_t) & BM_UART_WN7816_GTN)
  4075. #ifndef __LANGUAGE_ASM__
  4076. //! @brief Set the GTN field to a new value.
  4077. #define BW_UART_WN7816_GTN(x, v) (HW_UART_WN7816_WR(x, v))
  4078. #endif
  4079. //@}
  4080. //-------------------------------------------------------------------------------------------
  4081. // HW_UART_WF7816 - UART 7816 Wait FD Register
  4082. //-------------------------------------------------------------------------------------------
  4083. #ifndef __LANGUAGE_ASM__
  4084. /*!
  4085. * @brief HW_UART_WF7816 - UART 7816 Wait FD Register (RW)
  4086. *
  4087. * Reset value: 0x01U
  4088. *
  4089. * The WF7816 contains parameters that are used in the generation of various
  4090. * counters including GT, CGT, BGT, WT, and BWT. This register may be read at any
  4091. * time. This register must be written to only when C7816[ISO_7816E] is not set.
  4092. */
  4093. typedef union _hw_uart_wf7816
  4094. {
  4095. uint8_t U;
  4096. struct _hw_uart_wf7816_bitfields
  4097. {
  4098. uint8_t GTFD : 8; //!< [7:0] FD Multiplier
  4099. } B;
  4100. } hw_uart_wf7816_t;
  4101. #endif
  4102. /*!
  4103. * @name Constants and macros for entire UART_WF7816 register
  4104. */
  4105. //@{
  4106. #define HW_UART_WF7816_ADDR(x) (REGS_UART_BASE(x) + 0x1DU)
  4107. #ifndef __LANGUAGE_ASM__
  4108. #define HW_UART_WF7816(x) (*(__IO hw_uart_wf7816_t *) HW_UART_WF7816_ADDR(x))
  4109. #define HW_UART_WF7816_RD(x) (HW_UART_WF7816(x).U)
  4110. #define HW_UART_WF7816_WR(x, v) (HW_UART_WF7816(x).U = (v))
  4111. #define HW_UART_WF7816_SET(x, v) (HW_UART_WF7816_WR(x, HW_UART_WF7816_RD(x) | (v)))
  4112. #define HW_UART_WF7816_CLR(x, v) (HW_UART_WF7816_WR(x, HW_UART_WF7816_RD(x) & ~(v)))
  4113. #define HW_UART_WF7816_TOG(x, v) (HW_UART_WF7816_WR(x, HW_UART_WF7816_RD(x) ^ (v)))
  4114. #endif
  4115. //@}
  4116. /*
  4117. * Constants & macros for individual UART_WF7816 bitfields
  4118. */
  4119. /*!
  4120. * @name Register UART_WF7816, field GTFD[7:0] (RW)
  4121. *
  4122. * Used as another multiplier in the calculation of WT and BWT. This value
  4123. * represents a number between 1 and 255. The value of 0 is invalid. This value is not
  4124. * used in baud rate generation. See Wait time and guard time parameters and
  4125. * Baud rate generation .
  4126. */
  4127. //@{
  4128. #define BP_UART_WF7816_GTFD (0U) //!< Bit position for UART_WF7816_GTFD.
  4129. #define BM_UART_WF7816_GTFD (0xFFU) //!< Bit mask for UART_WF7816_GTFD.
  4130. #define BS_UART_WF7816_GTFD (8U) //!< Bit field size in bits for UART_WF7816_GTFD.
  4131. #ifndef __LANGUAGE_ASM__
  4132. //! @brief Read current value of the UART_WF7816_GTFD field.
  4133. #define BR_UART_WF7816_GTFD(x) (HW_UART_WF7816(x).U)
  4134. #endif
  4135. //! @brief Format value for bitfield UART_WF7816_GTFD.
  4136. #define BF_UART_WF7816_GTFD(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_WF7816_GTFD), uint8_t) & BM_UART_WF7816_GTFD)
  4137. #ifndef __LANGUAGE_ASM__
  4138. //! @brief Set the GTFD field to a new value.
  4139. #define BW_UART_WF7816_GTFD(x, v) (HW_UART_WF7816_WR(x, v))
  4140. #endif
  4141. //@}
  4142. //-------------------------------------------------------------------------------------------
  4143. // HW_UART_ET7816 - UART 7816 Error Threshold Register
  4144. //-------------------------------------------------------------------------------------------
  4145. #ifndef __LANGUAGE_ASM__
  4146. /*!
  4147. * @brief HW_UART_ET7816 - UART 7816 Error Threshold Register (RW)
  4148. *
  4149. * Reset value: 0x00U
  4150. *
  4151. * The ET7816 register contains fields that determine the number of NACKs that
  4152. * must be received or transmitted before the host processor is notified. This
  4153. * register may be read at anytime. This register must be written to only when
  4154. * C7816[ISO_7816E] is not set.
  4155. */
  4156. typedef union _hw_uart_et7816
  4157. {
  4158. uint8_t U;
  4159. struct _hw_uart_et7816_bitfields
  4160. {
  4161. uint8_t RXTHRESHOLD : 4; //!< [3:0] Receive NACK Threshold
  4162. uint8_t TXTHRESHOLD : 4; //!< [7:4] Transmit NACK Threshold
  4163. } B;
  4164. } hw_uart_et7816_t;
  4165. #endif
  4166. /*!
  4167. * @name Constants and macros for entire UART_ET7816 register
  4168. */
  4169. //@{
  4170. #define HW_UART_ET7816_ADDR(x) (REGS_UART_BASE(x) + 0x1EU)
  4171. #ifndef __LANGUAGE_ASM__
  4172. #define HW_UART_ET7816(x) (*(__IO hw_uart_et7816_t *) HW_UART_ET7816_ADDR(x))
  4173. #define HW_UART_ET7816_RD(x) (HW_UART_ET7816(x).U)
  4174. #define HW_UART_ET7816_WR(x, v) (HW_UART_ET7816(x).U = (v))
  4175. #define HW_UART_ET7816_SET(x, v) (HW_UART_ET7816_WR(x, HW_UART_ET7816_RD(x) | (v)))
  4176. #define HW_UART_ET7816_CLR(x, v) (HW_UART_ET7816_WR(x, HW_UART_ET7816_RD(x) & ~(v)))
  4177. #define HW_UART_ET7816_TOG(x, v) (HW_UART_ET7816_WR(x, HW_UART_ET7816_RD(x) ^ (v)))
  4178. #endif
  4179. //@}
  4180. /*
  4181. * Constants & macros for individual UART_ET7816 bitfields
  4182. */
  4183. /*!
  4184. * @name Register UART_ET7816, field RXTHRESHOLD[3:0] (RW)
  4185. *
  4186. * The value written to this field indicates the maximum number of consecutive
  4187. * NACKs generated as a result of a parity error or receiver buffer overruns
  4188. * before the host processor is notified. After the counter exceeds that value in the
  4189. * field, the IS7816[RXT] is asserted. This field is meaningful only when
  4190. * C7816[TTYPE] = 0. The value read from this field represents the number of consecutive
  4191. * NACKs that have been transmitted since the last successful reception. This
  4192. * counter saturates at 4'hF and does not wrap around. Regardless of the number of
  4193. * NACKs sent, the UART continues to receive valid packets indefinitely. For
  4194. * additional information, see IS7816[RXT] field description.
  4195. */
  4196. //@{
  4197. #define BP_UART_ET7816_RXTHRESHOLD (0U) //!< Bit position for UART_ET7816_RXTHRESHOLD.
  4198. #define BM_UART_ET7816_RXTHRESHOLD (0x0FU) //!< Bit mask for UART_ET7816_RXTHRESHOLD.
  4199. #define BS_UART_ET7816_RXTHRESHOLD (4U) //!< Bit field size in bits for UART_ET7816_RXTHRESHOLD.
  4200. #ifndef __LANGUAGE_ASM__
  4201. //! @brief Read current value of the UART_ET7816_RXTHRESHOLD field.
  4202. #define BR_UART_ET7816_RXTHRESHOLD(x) (HW_UART_ET7816(x).B.RXTHRESHOLD)
  4203. #endif
  4204. //! @brief Format value for bitfield UART_ET7816_RXTHRESHOLD.
  4205. #define BF_UART_ET7816_RXTHRESHOLD(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_ET7816_RXTHRESHOLD), uint8_t) & BM_UART_ET7816_RXTHRESHOLD)
  4206. #ifndef __LANGUAGE_ASM__
  4207. //! @brief Set the RXTHRESHOLD field to a new value.
  4208. #define BW_UART_ET7816_RXTHRESHOLD(x, v) (HW_UART_ET7816_WR(x, (HW_UART_ET7816_RD(x) & ~BM_UART_ET7816_RXTHRESHOLD) | BF_UART_ET7816_RXTHRESHOLD(v)))
  4209. #endif
  4210. //@}
  4211. /*!
  4212. * @name Register UART_ET7816, field TXTHRESHOLD[7:4] (RW)
  4213. *
  4214. * The value written to this field indicates the maximum number of failed
  4215. * attempts (NACKs) a transmitted character can have before the host processor is
  4216. * notified. This field is meaningful only when C7816[TTYPE] = 0 and C7816[ANACK] = 1.
  4217. * The value read from this field represents the number of consecutive NACKs
  4218. * that have been received since the last successful transmission. This counter
  4219. * saturates at 4'hF and does not wrap around. Regardless of how many NACKs that are
  4220. * received, the UART continues to retransmit indefinitely. This flag only
  4221. * asserts when C7816[TTYPE] = 0. For additional information see the IS7816[TXT] field
  4222. * description.
  4223. *
  4224. * Values:
  4225. * - 0 - TXT asserts on the first NACK that is received.
  4226. * - 1 - TXT asserts on the second NACK that is received.
  4227. */
  4228. //@{
  4229. #define BP_UART_ET7816_TXTHRESHOLD (4U) //!< Bit position for UART_ET7816_TXTHRESHOLD.
  4230. #define BM_UART_ET7816_TXTHRESHOLD (0xF0U) //!< Bit mask for UART_ET7816_TXTHRESHOLD.
  4231. #define BS_UART_ET7816_TXTHRESHOLD (4U) //!< Bit field size in bits for UART_ET7816_TXTHRESHOLD.
  4232. #ifndef __LANGUAGE_ASM__
  4233. //! @brief Read current value of the UART_ET7816_TXTHRESHOLD field.
  4234. #define BR_UART_ET7816_TXTHRESHOLD(x) (HW_UART_ET7816(x).B.TXTHRESHOLD)
  4235. #endif
  4236. //! @brief Format value for bitfield UART_ET7816_TXTHRESHOLD.
  4237. #define BF_UART_ET7816_TXTHRESHOLD(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_ET7816_TXTHRESHOLD), uint8_t) & BM_UART_ET7816_TXTHRESHOLD)
  4238. #ifndef __LANGUAGE_ASM__
  4239. //! @brief Set the TXTHRESHOLD field to a new value.
  4240. #define BW_UART_ET7816_TXTHRESHOLD(x, v) (HW_UART_ET7816_WR(x, (HW_UART_ET7816_RD(x) & ~BM_UART_ET7816_TXTHRESHOLD) | BF_UART_ET7816_TXTHRESHOLD(v)))
  4241. #endif
  4242. //@}
  4243. //-------------------------------------------------------------------------------------------
  4244. // HW_UART_TL7816 - UART 7816 Transmit Length Register
  4245. //-------------------------------------------------------------------------------------------
  4246. #ifndef __LANGUAGE_ASM__
  4247. /*!
  4248. * @brief HW_UART_TL7816 - UART 7816 Transmit Length Register (RW)
  4249. *
  4250. * Reset value: 0x00U
  4251. *
  4252. * The TL7816 register is used to indicate the number of characters contained in
  4253. * the block being transmitted. This register is used only when C7816[TTYPE] =
  4254. * 1. This register may be read at anytime. This register must be written only
  4255. * when C2[TE] is not enabled.
  4256. */
  4257. typedef union _hw_uart_tl7816
  4258. {
  4259. uint8_t U;
  4260. struct _hw_uart_tl7816_bitfields
  4261. {
  4262. uint8_t TLEN : 8; //!< [7:0] Transmit Length
  4263. } B;
  4264. } hw_uart_tl7816_t;
  4265. #endif
  4266. /*!
  4267. * @name Constants and macros for entire UART_TL7816 register
  4268. */
  4269. //@{
  4270. #define HW_UART_TL7816_ADDR(x) (REGS_UART_BASE(x) + 0x1FU)
  4271. #ifndef __LANGUAGE_ASM__
  4272. #define HW_UART_TL7816(x) (*(__IO hw_uart_tl7816_t *) HW_UART_TL7816_ADDR(x))
  4273. #define HW_UART_TL7816_RD(x) (HW_UART_TL7816(x).U)
  4274. #define HW_UART_TL7816_WR(x, v) (HW_UART_TL7816(x).U = (v))
  4275. #define HW_UART_TL7816_SET(x, v) (HW_UART_TL7816_WR(x, HW_UART_TL7816_RD(x) | (v)))
  4276. #define HW_UART_TL7816_CLR(x, v) (HW_UART_TL7816_WR(x, HW_UART_TL7816_RD(x) & ~(v)))
  4277. #define HW_UART_TL7816_TOG(x, v) (HW_UART_TL7816_WR(x, HW_UART_TL7816_RD(x) ^ (v)))
  4278. #endif
  4279. //@}
  4280. /*
  4281. * Constants & macros for individual UART_TL7816 bitfields
  4282. */
  4283. /*!
  4284. * @name Register UART_TL7816, field TLEN[7:0] (RW)
  4285. *
  4286. * This value plus four indicates the number of characters contained in the
  4287. * block being transmitted. This register is automatically decremented by 1 for each
  4288. * character in the information field portion of the block. Additionally, this
  4289. * register is automatically decremented by 1 for the first character of a CRC in
  4290. * the epilogue field. Therefore, this register must be programmed with the number
  4291. * of bytes in the data packet if an LRC is being transmitted, and the number of
  4292. * bytes + 1 if a CRC is being transmitted. This register is not decremented for
  4293. * characters that are assumed to be part of the Prologue field, that is, the
  4294. * first three characters transmitted in a block, or the LRC or last CRC character
  4295. * in the Epilogue field, that is, the last character transmitted. This field
  4296. * must be programed or adjusted only when C2[TE] is cleared.
  4297. */
  4298. //@{
  4299. #define BP_UART_TL7816_TLEN (0U) //!< Bit position for UART_TL7816_TLEN.
  4300. #define BM_UART_TL7816_TLEN (0xFFU) //!< Bit mask for UART_TL7816_TLEN.
  4301. #define BS_UART_TL7816_TLEN (8U) //!< Bit field size in bits for UART_TL7816_TLEN.
  4302. #ifndef __LANGUAGE_ASM__
  4303. //! @brief Read current value of the UART_TL7816_TLEN field.
  4304. #define BR_UART_TL7816_TLEN(x) (HW_UART_TL7816(x).U)
  4305. #endif
  4306. //! @brief Format value for bitfield UART_TL7816_TLEN.
  4307. #define BF_UART_TL7816_TLEN(v) (__REG_VALUE_TYPE((__REG_VALUE_TYPE((v), uint8_t) << BP_UART_TL7816_TLEN), uint8_t) & BM_UART_TL7816_TLEN)
  4308. #ifndef __LANGUAGE_ASM__
  4309. //! @brief Set the TLEN field to a new value.
  4310. #define BW_UART_TL7816_TLEN(x, v) (HW_UART_TL7816_WR(x, v))
  4311. #endif
  4312. //@}
  4313. //-------------------------------------------------------------------------------------------
  4314. // hw_uart_t - module struct
  4315. //-------------------------------------------------------------------------------------------
  4316. /*!
  4317. * @brief All UART module registers.
  4318. */
  4319. #ifndef __LANGUAGE_ASM__
  4320. #pragma pack(1)
  4321. typedef struct _hw_uart
  4322. {
  4323. __IO hw_uart_bdh_t BDH; //!< [0x0] UART Baud Rate Registers: High
  4324. __IO hw_uart_bdl_t BDL; //!< [0x1] UART Baud Rate Registers: Low
  4325. __IO hw_uart_c1_t C1; //!< [0x2] UART Control Register 1
  4326. __IO hw_uart_c2_t C2; //!< [0x3] UART Control Register 2
  4327. __I hw_uart_s1_t S1; //!< [0x4] UART Status Register 1
  4328. __IO hw_uart_s2_t S2; //!< [0x5] UART Status Register 2
  4329. __IO hw_uart_c3_t C3; //!< [0x6] UART Control Register 3
  4330. __IO hw_uart_d_t D; //!< [0x7] UART Data Register
  4331. __IO hw_uart_ma1_t MA1; //!< [0x8] UART Match Address Registers 1
  4332. __IO hw_uart_ma2_t MA2; //!< [0x9] UART Match Address Registers 2
  4333. __IO hw_uart_c4_t C4; //!< [0xA] UART Control Register 4
  4334. __IO hw_uart_c5_t C5; //!< [0xB] UART Control Register 5
  4335. __I hw_uart_ed_t ED; //!< [0xC] UART Extended Data Register
  4336. __IO hw_uart_modem_t MODEM; //!< [0xD] UART Modem Register
  4337. __IO hw_uart_ir_t IR; //!< [0xE] UART Infrared Register
  4338. uint8_t _reserved0[1];
  4339. __IO hw_uart_pfifo_t PFIFO; //!< [0x10] UART FIFO Parameters
  4340. __IO hw_uart_cfifo_t CFIFO; //!< [0x11] UART FIFO Control Register
  4341. __IO hw_uart_sfifo_t SFIFO; //!< [0x12] UART FIFO Status Register
  4342. __IO hw_uart_twfifo_t TWFIFO; //!< [0x13] UART FIFO Transmit Watermark
  4343. __I hw_uart_tcfifo_t TCFIFO; //!< [0x14] UART FIFO Transmit Count
  4344. __IO hw_uart_rwfifo_t RWFIFO; //!< [0x15] UART FIFO Receive Watermark
  4345. __I hw_uart_rcfifo_t RCFIFO; //!< [0x16] UART FIFO Receive Count
  4346. uint8_t _reserved1[1];
  4347. __IO hw_uart_c7816_t C7816; //!< [0x18] UART 7816 Control Register
  4348. __IO hw_uart_ie7816_t IE7816; //!< [0x19] UART 7816 Interrupt Enable Register
  4349. __IO hw_uart_is7816_t IS7816; //!< [0x1A] UART 7816 Interrupt Status Register
  4350. union {
  4351. __IO hw_uart_wp7816_t_type0_t WP7816_T_TYPE0; //!< [0x1B] UART 7816 Wait Parameter Register
  4352. __IO hw_uart_wp7816_t_type1_t WP7816_T_TYPE1; //!< [0x1B] UART 7816 Wait Parameter Register
  4353. };
  4354. __IO hw_uart_wn7816_t WN7816; //!< [0x1C] UART 7816 Wait N Register
  4355. __IO hw_uart_wf7816_t WF7816; //!< [0x1D] UART 7816 Wait FD Register
  4356. __IO hw_uart_et7816_t ET7816; //!< [0x1E] UART 7816 Error Threshold Register
  4357. __IO hw_uart_tl7816_t TL7816; //!< [0x1F] UART 7816 Transmit Length Register
  4358. } hw_uart_t;
  4359. #pragma pack()
  4360. //! @brief Macro to access all UART registers.
  4361. //! @param x UART instance number.
  4362. //! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
  4363. //! use the '&' operator, like <code>&HW_UART(0)</code>.
  4364. #define HW_UART(x) (*(hw_uart_t *) REGS_UART_BASE(x))
  4365. #endif
  4366. #endif // __HW_UART_REGISTERS_H__
  4367. // v22/130726/0.9
  4368. // EOF